Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
84f723a
chore(storybook): add nav entries for migration analysis docs
rubencarvalho May 22, 2026
859656a
feat(placement-controller): add PlacementController for 2nd-gen
rubencarvalho May 22, 2026
0d36de6
fix(placement-controller): apply review findings
rubencarvalho May 22, 2026
2b0b694
refactor(placement-controller): trim public surface and doc noise
rubencarvalho May 26, 2026
2aa2f98
refactor(placement-controller): use inline JSDoc API table
rubencarvalho May 26, 2026
731110e
chore: bump floatingui version
rubencarvalho May 26, 2026
fe69752
refactor(placement-controller): unify ShouldFlip demo with toggle
rubencarvalho May 26, 2026
154239a
refactor(placement-controller): polish demos and drop prescriptive copy
rubencarvalho May 26, 2026
809895b
refactor(placement-controller): fix virtual-trigger surface at 320x320
rubencarvalho May 26, 2026
17874d8
refactor(placement-controller): make ShouldFlip demo resizable
rubencarvalho May 26, 2026
d7e66d6
refactor(placement-controller): drop ShouldFlip demo
rubencarvalho May 26, 2026
134d2c0
docs(placement-controller): clarify that shift is always installed
rubencarvalho May 26, 2026
bdbb6b5
docs(placement-controller): stop name-dropping shift everywhere
rubencarvalho May 26, 2026
b4fc052
test(placement-controller): cover the remaining option contracts
rubencarvalho May 26, 2026
c3d22f4
chore: simplify api
rubencarvalho May 28, 2026
1308596
chore: update tests
rubencarvalho May 28, 2026
f7d8261
chore: simplify some tests
rubencarvalho May 28, 2026
0737d45
refactor(placement-controller): match 1st-gen middleware order and al…
rubencarvalho May 28, 2026
8759cbf
feat(placement-controller): wire up arrow middleware (parity with 1st…
rubencarvalho May 28, 2026
ae6d862
refactor(placement-controller): arrow demo uses bottom-end + text-siz…
rubencarvalho May 29, 2026
ae11079
docs(placement-controller): rename 1st-gen/2nd-gen to gen1/gen2
rubencarvalho May 29, 2026
4ab272b
Merge branch 'main' into ruben/feat-placement-controller-swc-1996
rubencarvalho May 29, 2026
fc04c9d
test(placement-controller): isolate tests from playground demo and ti…
rubencarvalho May 29, 2026
6fa1159
test(placement-controller): assert arrow tip points at trigger center
rubencarvalho May 29, 2026
ed15086
Merge branch 'main' into ruben/feat-placement-controller-swc-1996
rubencarvalho May 30, 2026
9a3cca8
fix(placement-controller): ignore superseded compute in size apply
rubencarvalho May 30, 2026
aa164da
fix(placement-controller): expose available space as custom properties
rubencarvalho Jun 2, 2026
5c76a44
fix(placement-controller): resolve logical start/end sides for RTL
rubencarvalho Jun 2, 2026
750b919
docs(placement-controller): logical-unit fallbacks and box-sizing gui…
rubencarvalho Jun 3, 2026
c85a43a
fix(placement-controller): recompute on dir change; split playground …
rubencarvalho Jun 3, 2026
60393e0
Merge remote-tracking branch 'origin/main' into ruben/feat-placement-…
rubencarvalho Jun 3, 2026
0e8db5c
docs(placement-controller): adopt per-unit MDX docs model
rubencarvalho Jun 3, 2026
a048fa2
test(placement-controller): cover recompute() and two controllers per…
rubencarvalho Jun 3, 2026
71e1728
fix(placement-controller): notify onPlacementChange on change only
rubencarvalho Jun 3, 2026
cbc6160
Merge branch 'main' into ruben/feat-placement-controller-swc-1996
rubencarvalho Jun 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions 2nd-gen/packages/core/controllers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ export {
LanguageResolutionController,
languageResolverUpdatedSymbol,
} from './language-resolution.js';
export {
ALL_PLACEMENTS,
fromFloatingPlacement,
PlacementController,
toFloatingPlacement,
type Placement,
type PlacementOptions,
type VirtualTrigger,
} from './placement-controller/index.js';
21 changes: 21 additions & 0 deletions 2nd-gen/packages/core/controllers/placement-controller/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2026 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

export {
ALL_PLACEMENTS,
fromFloatingPlacement,
PlacementController,
toFloatingPlacement,
type Placement,
type PlacementOptions,
type VirtualTrigger,
} from './src/placement-controller.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright 2026 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

import type { Placement as FloatingPlacement } from '@floating-ui/dom';

const FALLBACKS: Record<FloatingPlacement, FloatingPlacement[]> = {
left: ['right', 'bottom', 'top'],
'left-start': ['right-start', 'bottom', 'top'],
'left-end': ['right-end', 'bottom', 'top'],
right: ['left', 'bottom', 'top'],
'right-start': ['left-start', 'bottom', 'top'],
'right-end': ['left-end', 'bottom', 'top'],
top: ['bottom', 'left', 'right'],
'top-start': ['bottom-start', 'left', 'right'],
'top-end': ['bottom-end', 'left', 'right'],
bottom: ['top', 'left', 'right'],
'bottom-start': ['top-start', 'left', 'right'],
'bottom-end': ['top-end', 'left', 'right'],
};

/**
* Look up the fallback placement order for Floating UI's `flip` middleware
* when the anchor is a `VirtualTrigger`.
*
* @param placement - Normalized Floating UI placement for the current side.
* @returns Ordered list of placements to try when the primary side does not fit.
*/
export function getFallbackPlacements(
placement: FloatingPlacement
): FloatingPlacement[] {
return FALLBACKS[placement] ?? [placement];
}
Loading
Loading