@astryxdesign/core 0.7.0-canary.fe57f54 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +186 -0
- package/dist/BottomSheet/BottomSheet.d.ts +5 -4
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +1 -1
- package/dist/Calendar/styles.d.ts +6 -6
- package/dist/Chat/ChatComposerInput.d.ts +0 -11
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +0 -11
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts +3 -2
- package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteList.js +3 -2
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +4 -1
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +29 -13
- package/dist/DropdownMenu/DropdownMenu.d.ts +11 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +173 -11
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +13 -2
- package/dist/DropdownMenu/menuRegionsContext.d.ts +2 -0
- package/dist/DropdownMenu/menuRegionsContext.d.ts.map +1 -0
- package/dist/DropdownMenu/menuRegionsContext.js +17 -0
- package/dist/Field/inputStyles.stylex.d.ts +3 -3
- package/dist/Layout/container.stylex.d.ts +18 -20
- package/dist/Layout/container.stylex.d.ts.map +1 -1
- package/dist/Layout/container.stylex.js +15 -25
- package/dist/Layout/padding.stylex.d.ts +231 -231
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +15 -6
- package/dist/Markdown/plugins/protocol.d.ts.map +1 -1
- package/dist/Markdown/plugins/protocol.js +33 -8
- package/dist/NavItem/navItemStyles.stylex.d.ts +5 -5
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +21 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +30 -15
- package/dist/Stack/stack.stylex.d.ts +22 -22
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +89 -14
- package/dist/Table/table.stylex.d.ts +6 -6
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +4 -1
- package/dist/Tokenizer/Tokenizer.d.ts +1 -12
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +1 -13
- package/dist/Typeahead/BaseTypeahead.d.ts +0 -11
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +1 -9
- package/dist/Typeahead/Typeahead.d.ts +1 -12
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +1 -13
- package/dist/astryx.css +17 -12
- package/dist/hooks/useFocusTrap.d.ts +8 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +5 -1
- package/dist/hooks/useRenamedProp.d.ts +6 -6
- package/dist/hooks/useRenamedProp.js +6 -6
- package/dist/reset.a11y.chromium.spec.d.ts +2 -0
- package/dist/reset.a11y.chromium.spec.d.ts.map +1 -0
- package/dist/reset.a11y.chromium.spec.js +176 -0
- package/dist/theme/tokens.stylex.d.ts +30 -30
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +18 -15
- package/dist/theme/useTheme.d.ts +1 -1
- package/package.json +4 -4
- package/src/BottomSheet/BottomSheet.doc.mjs +4 -4
- package/src/BottomSheet/BottomSheet.tsx +5 -4
- package/src/BottomSheet/BottomSheetPanel.test.tsx +6 -9
- package/src/BottomSheet/BottomSheetPanel.tsx +2 -3
- package/src/Chat/ChatComposerInput.doc.mjs +3 -3
- package/src/Chat/ChatComposerInput.test.tsx +7 -55
- package/src/Chat/ChatComposerInput.tsx +0 -36
- package/src/Chat/useTriggerMenu.tsx +1 -4
- package/src/CommandPalette/CommandPalette.spec.md +2 -0
- package/src/CommandPalette/CommandPaletteList.spec.md +189 -0
- package/src/CommandPalette/CommandPaletteList.test.tsx +47 -0
- package/src/CommandPalette/CommandPaletteList.tsx +3 -2
- package/src/DateInput/TouchDateField.tsx +3 -1
- package/src/DateTimeInput/DateTimeInputTouch.test.tsx +60 -1
- package/src/DateTimeInput/TouchDateTimeField.tsx +31 -14
- package/src/DropdownMenu/DropdownMenu.doc.mjs +12 -0
- package/src/DropdownMenu/DropdownMenu.spec.md +65 -40
- package/src/DropdownMenu/DropdownMenu.test.tsx +457 -0
- package/src/DropdownMenu/DropdownMenu.tsx +278 -49
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +6 -3
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +2 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +11 -1
- package/src/DropdownMenu/__tests__/MenuHeaderFooter.a11y.chromium.spec.ts +195 -0
- package/src/DropdownMenu/menuRegionsContext.ts +17 -0
- package/src/Layout/container.stylex.ts +11 -21
- package/src/Lightbox/Lightbox.test.tsx +58 -0
- package/src/Lightbox/Lightbox.tsx +12 -6
- package/src/Markdown/plugins/protocol.ts +45 -12
- package/src/Markdown/plugins/sourceLines.test.tsx +121 -0
- package/src/PowerSearch/PowerSearch.tsx +28 -1
- package/src/PowerSearch/PowerSearchEditPopover.test.tsx +284 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +41 -13
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +33 -9
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +81 -18
- package/src/TimeInput/TouchTimeField.tsx +3 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +0 -16
- package/src/Tokenizer/Tokenizer.test.tsx +12 -63
- package/src/Tokenizer/Tokenizer.tsx +1 -25
- package/src/Toolbar/Toolbar.test.tsx +29 -0
- package/src/Typeahead/BaseTypeahead.doc.mjs +0 -16
- package/src/Typeahead/BaseTypeahead.test.tsx +1 -1
- package/src/Typeahead/BaseTypeahead.tsx +1 -21
- package/src/Typeahead/Typeahead.doc.mjs +0 -7
- package/src/Typeahead/Typeahead.test.tsx +24 -42
- package/src/Typeahead/Typeahead.tsx +1 -25
- package/src/hooks/useFocusTrap.ts +5 -1
- package/src/hooks/useRenamedProp.ts +6 -6
- package/src/reset.a11y.chromium.spec.ts +178 -0
- package/src/reset.css +8 -8
- package/src/reset.test.ts +112 -0
- package/src/theme/__tests__/SpacingRootFontSize.a11y.chromium.spec.ts +198 -0
- package/src/theme/tokens.stylex.ts +18 -15
- package/src/theme/tokens.test.ts +1 -1
- package/src/theme/useTheme.test.tsx +4 -4
- package/src/theme/useTheme.ts +1 -1
|
@@ -49,6 +49,8 @@ import { useMenuPress } from "../hooks/useMenuPress.js";
|
|
|
49
49
|
import { useTypeahead } from "../hooks/useTypeahead.js";
|
|
50
50
|
import { useFocusReturnVisibility } from "../hooks/useFocusReturnVisibility.js";
|
|
51
51
|
import { useMenuOverflow } from "./useMenuOverflow.js";
|
|
52
|
+
import { MenuRegionsContext } from "./menuRegionsContext.js";
|
|
53
|
+
import { getFocusableElements } from "../hooks/useFocusTrap.js";
|
|
52
54
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
53
55
|
import { useMenuDrillIn } from "./useMenuDrillIn.js";
|
|
54
56
|
import { resolveMenuWidth } from "./menuWidth.js";
|
|
@@ -60,9 +62,9 @@ import { MenuBottomSheetActionList } from "./MenuBottomSheetActionList.js";
|
|
|
60
62
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
61
63
|
import "../theme/tokens.stylex.js";
|
|
62
64
|
import { spacingVars, colorVars, radiusVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
63
|
-
import { mergeProps, rtlStyles } from "../utils/index.js";
|
|
65
|
+
import { isRenderable, mergeProps, rtlStyles } from "../utils/index.js";
|
|
64
66
|
import { themeProps } from "../utils/themeProps.js";
|
|
65
|
-
import { useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
67
|
+
import { getInteractionModality, useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
66
68
|
import { useTranslator } from "../i18n/index.js";
|
|
67
69
|
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
68
70
|
|
|
@@ -73,6 +75,45 @@ const MENU_BLOCK_CAP = '300px';
|
|
|
73
75
|
const MENU_MAX_BLOCK_SIZE = `min(${MENU_BLOCK_CAP}, ${layerViewportInset.maxBlockSize})`;
|
|
74
76
|
const MENU_MAX_BLOCK_SIZE_FALLBACK = `min(${MENU_BLOCK_CAP}, ${layerViewportInset.maxBlockSizeFallback})`;
|
|
75
77
|
const MENU_TRIGGER_OPEN_BACKGROUND = `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The elements Tab reaches inside a header or footer region, in order. Hidden
|
|
81
|
+
* controls (`hidden`, `display: none`, `visibility: hidden`, inert or
|
|
82
|
+
* aria-hidden subtrees) are not reachable, judged by the popover focus trap's
|
|
83
|
+
* own test so the two never disagree about where Tab can go.
|
|
84
|
+
*/
|
|
85
|
+
function tabbablesIn(region) {
|
|
86
|
+
if (region == null) {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
return getFocusableElements(region).filter(element => element.tabIndex >= 0 && !isInsideHiddenWrapper(element, region));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether a `display: none` ancestor between the element and its region hides
|
|
94
|
+
* it — a control in a wrapper hidden at some widths, say. The trap's test reads
|
|
95
|
+
* only the element's own display.
|
|
96
|
+
*/
|
|
97
|
+
function isInsideHiddenWrapper(element, region) {
|
|
98
|
+
if (typeof window === 'undefined' || !window.getComputedStyle) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
for (let node = element.parentElement; node != null && node !== region.parentElement; node = node.parentElement) {
|
|
102
|
+
if (window.getComputedStyle(node).display === 'none') {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Move focus to a region control. Reports whether focus actually arrived, so a
|
|
111
|
+
* caller can close the menu instead of stranding focus on the page.
|
|
112
|
+
*/
|
|
113
|
+
function focusRegionControl(element) {
|
|
114
|
+
element.focus();
|
|
115
|
+
return element.ownerDocument.activeElement === element;
|
|
116
|
+
}
|
|
76
117
|
const _temp = {
|
|
77
118
|
kzqmXN: "x1uyokj7",
|
|
78
119
|
"$$css": true
|
|
@@ -113,6 +154,19 @@ const styles = {
|
|
|
113
154
|
kZeWKH: "xish69e",
|
|
114
155
|
$$css: true
|
|
115
156
|
},
|
|
157
|
+
regionsFrame: {
|
|
158
|
+
kB7OPa: "x9f619",
|
|
159
|
+
k1xSpc: "x78zum5",
|
|
160
|
+
kXwgrk: "xdt5ytf",
|
|
161
|
+
kskxy: "x1uh1i8a",
|
|
162
|
+
$$css: true
|
|
163
|
+
},
|
|
164
|
+
menuInFrame: {
|
|
165
|
+
kzQI83: "x1iyjqo2",
|
|
166
|
+
kmuXW: "xs83m0k",
|
|
167
|
+
kAzted: "x2lwn1j",
|
|
168
|
+
$$css: true
|
|
169
|
+
},
|
|
116
170
|
touchPinchZoom: {
|
|
117
171
|
kFalU9: "x1j4r261",
|
|
118
172
|
$$css: true
|
|
@@ -307,6 +361,8 @@ function DropdownMenuBottomSheet({
|
|
|
307
361
|
menuMaxHeight: _menuMaxHeight,
|
|
308
362
|
placement: _placement,
|
|
309
363
|
alignment: _alignment,
|
|
364
|
+
header,
|
|
365
|
+
footer,
|
|
310
366
|
className,
|
|
311
367
|
style,
|
|
312
368
|
xstyle,
|
|
@@ -483,10 +539,20 @@ function DropdownMenuBottomSheet({
|
|
|
483
539
|
xstyle: [bottomSheetStyles.viewHeading, submenuPath.length === 0 && bottomSheetStyles.rootHeading],
|
|
484
540
|
children: currentTitle
|
|
485
541
|
})]
|
|
542
|
+
}), isRenderable(header) && /*#__PURE__*/_jsx("div", {
|
|
543
|
+
...{
|
|
544
|
+
className: "xrrkdod xce4md1"
|
|
545
|
+
},
|
|
546
|
+
children: header
|
|
486
547
|
}), /*#__PURE__*/_jsx(MenuBottomSheetActionList, {
|
|
487
548
|
items: currentItems,
|
|
488
549
|
onSelect: handleSelect,
|
|
489
550
|
onOpenSubmenu: item => setSubmenuPath(path => [...path, item])
|
|
551
|
+
}), isRenderable(footer) && /*#__PURE__*/_jsx("div", {
|
|
552
|
+
...{
|
|
553
|
+
className: "xrrkdod xce4md1"
|
|
554
|
+
},
|
|
555
|
+
children: footer
|
|
490
556
|
})]
|
|
491
557
|
})
|
|
492
558
|
})]
|
|
@@ -504,6 +570,8 @@ function DropdownMenuPopover({
|
|
|
504
570
|
placement = 'below',
|
|
505
571
|
alignment = 'start',
|
|
506
572
|
presentation: _presentation,
|
|
573
|
+
header,
|
|
574
|
+
footer,
|
|
507
575
|
className,
|
|
508
576
|
style,
|
|
509
577
|
xstyle,
|
|
@@ -548,6 +616,13 @@ function DropdownMenuPopover({
|
|
|
548
616
|
resetFocusReturn
|
|
549
617
|
} = useFocusReturnVisibility();
|
|
550
618
|
const contentRef = useRef(null);
|
|
619
|
+
const headerRef = useRef(null);
|
|
620
|
+
const footerRef = useRef(null);
|
|
621
|
+
const hasRegions = useMemo(() => isRenderable(header) || isRenderable(footer), [header, footer]);
|
|
622
|
+
// Whether the menu element itself took focus from the keyboard. A pointer
|
|
623
|
+
// open focuses it programmatically, and pointer history must not paint the
|
|
624
|
+
// keyboard ring (architecture:interaction-modality INV1).
|
|
625
|
+
const [isMenuKeyboardFocused, setIsMenuKeyboardFocused] = useState(false);
|
|
551
626
|
// The press model is mounted below (it needs the popover); the hide path
|
|
552
627
|
// above it ends the gesture in flight through this ref.
|
|
553
628
|
const cancelMenuPressRef = useRef(() => {});
|
|
@@ -717,6 +792,21 @@ function DropdownMenuPopover({
|
|
|
717
792
|
// A submenu flyout renders inline inside this menu; its key events bubble
|
|
718
793
|
// up here. Let that level own them — only handle events from this level.
|
|
719
794
|
if (!ownsEvent(e)) {
|
|
795
|
+
// Except Tab with a header or footer: each open flyout has closed
|
|
796
|
+
// itself as the key bubbled up, and the root moves focus on as Tab
|
|
797
|
+
// from one of its own rows would.
|
|
798
|
+
if (e.key === 'Tab' && hasRegions) {
|
|
799
|
+
const region = e.shiftKey ? headerRef.current : footerRef.current;
|
|
800
|
+
const tabbables = tabbablesIn(region);
|
|
801
|
+
e.stopPropagation();
|
|
802
|
+
const target = e.shiftKey ? tabbables[tabbables.length - 1] : tabbables[0];
|
|
803
|
+
if (target != null) {
|
|
804
|
+
e.preventDefault();
|
|
805
|
+
}
|
|
806
|
+
if (target == null || !focusRegionControl(target)) {
|
|
807
|
+
closeMenu();
|
|
808
|
+
}
|
|
809
|
+
}
|
|
720
810
|
return;
|
|
721
811
|
}
|
|
722
812
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
@@ -739,7 +829,27 @@ function DropdownMenuPopover({
|
|
|
739
829
|
// otherwise leak into the page while the menu stayed open (menus-5).
|
|
740
830
|
// Do NOT preventDefault — closing restores focus to the trigger, and the
|
|
741
831
|
// browser's default Tab then continues from there to the next element.
|
|
832
|
+
// A header or footer with something Tab can reach in that direction
|
|
833
|
+
// takes the Tab instead, and the menu stays open.
|
|
742
834
|
if (e.key === 'Tab') {
|
|
835
|
+
const region = e.shiftKey ? headerRef.current : footerRef.current;
|
|
836
|
+
const tabbables = tabbablesIn(region);
|
|
837
|
+
if (tabbables.length > 0) {
|
|
838
|
+
// From a row, the browser's Shift+Tab would stop on the menu element
|
|
839
|
+
// itself — the row's ancestor and a Tab stop — before reaching the
|
|
840
|
+
// header. The menu is one stop, so go straight to the header.
|
|
841
|
+
if (e.shiftKey && e.target !== listRef.current) {
|
|
842
|
+
e.preventDefault();
|
|
843
|
+
// The popover's focus trap listens on the document and would read
|
|
844
|
+
// this same Shift+Tab against the field just focused — the trap's
|
|
845
|
+
// first element — and wrap to the footer. This key is handled.
|
|
846
|
+
e.stopPropagation();
|
|
847
|
+
if (!focusRegionControl(tabbables[tabbables.length - 1])) {
|
|
848
|
+
closeMenu();
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
743
853
|
closeMenu();
|
|
744
854
|
return;
|
|
745
855
|
}
|
|
@@ -749,7 +859,24 @@ function DropdownMenuPopover({
|
|
|
749
859
|
return;
|
|
750
860
|
}
|
|
751
861
|
listNavKeyDown(e);
|
|
752
|
-
}, [listNavKeyDown, closeMenu, typeahead, ownsEvent]);
|
|
862
|
+
}, [listNavKeyDown, closeMenu, typeahead, ownsEvent, listRef, hasRegions]);
|
|
863
|
+
|
|
864
|
+
// Tab past the last control of the footer, or Shift+Tab before the first
|
|
865
|
+
// control of the header, leaves the menu as Tab from its rows does: the
|
|
866
|
+
// menu closes, focus returns to the trigger, and the browser's own Tab
|
|
867
|
+
// continues from there. Between the regions, Tab moves through the menu
|
|
868
|
+
// as one stop.
|
|
869
|
+
const handleRegionKeyDown = useCallback(e => {
|
|
870
|
+
if (e.key !== 'Tab') {
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
const tabbables = tabbablesIn(e.currentTarget);
|
|
874
|
+
const isHeader = e.currentTarget === headerRef.current;
|
|
875
|
+
const exit = isHeader ? e.shiftKey ? tabbables[0] : undefined : e.shiftKey ? undefined : tabbables[tabbables.length - 1];
|
|
876
|
+
if (exit != null && exit === document.activeElement) {
|
|
877
|
+
closeMenu();
|
|
878
|
+
}
|
|
879
|
+
}, [closeMenu]);
|
|
753
880
|
const openAndFocus = useCallback((modality = 'keyboard', notifyClick = false) => {
|
|
754
881
|
acceptedOpenRef.current = false;
|
|
755
882
|
notifyClickOnShowRef.current = notifyClick;
|
|
@@ -913,6 +1040,27 @@ function DropdownMenuPopover({
|
|
|
913
1040
|
// Resolve menu content: data-driven items become components
|
|
914
1041
|
const menuContent = wrapContent(props.items !== undefined ? renderDropdownItems(items) : children);
|
|
915
1042
|
const hasOverflow = useMenuOverflow(listRef, menuContent, popover.isOpen);
|
|
1043
|
+
|
|
1044
|
+
// The header and footer sit beside the menu inside the popover, never inside
|
|
1045
|
+
// the role="menu" element: a menu holds only its rows.
|
|
1046
|
+
const renderWithRegions = menu => hasRegions ? /*#__PURE__*/_jsxs("div", {
|
|
1047
|
+
...stylex.props(styles.regionsFrame, resolvedMaxHeight != null && dynamicStyles.menuMaxHeight(resolvedMaxHeight)),
|
|
1048
|
+
children: [isRenderable(header) && /*#__PURE__*/_jsx("div", {
|
|
1049
|
+
ref: headerRef,
|
|
1050
|
+
onKeyDown: handleRegionKeyDown,
|
|
1051
|
+
...{
|
|
1052
|
+
className: "x2lah0s x9epnlk"
|
|
1053
|
+
},
|
|
1054
|
+
children: header
|
|
1055
|
+
}), menu, isRenderable(footer) && /*#__PURE__*/_jsx("div", {
|
|
1056
|
+
ref: footerRef,
|
|
1057
|
+
onKeyDown: handleRegionKeyDown,
|
|
1058
|
+
...{
|
|
1059
|
+
className: "x2lah0s x9epnlk"
|
|
1060
|
+
},
|
|
1061
|
+
children: footer
|
|
1062
|
+
})]
|
|
1063
|
+
}) : menu;
|
|
916
1064
|
const triggerProps = {
|
|
917
1065
|
ref: el => {
|
|
918
1066
|
buttonRef.current = el;
|
|
@@ -971,7 +1119,7 @@ function DropdownMenuPopover({
|
|
|
971
1119
|
"aria-expanded": isOpen,
|
|
972
1120
|
"aria-controls": menuId,
|
|
973
1121
|
"data-testid": testId
|
|
974
|
-
}), popover.render(/*#__PURE__*/_jsx("div", {
|
|
1122
|
+
}), popover.render(renderWithRegions(/*#__PURE__*/_jsx("div", {
|
|
975
1123
|
...rest,
|
|
976
1124
|
ref: el => {
|
|
977
1125
|
listRef.current = el;
|
|
@@ -982,9 +1130,10 @@ function DropdownMenuPopover({
|
|
|
982
1130
|
// Pointer opens focus the container so arrows, typeahead, Escape and
|
|
983
1131
|
// Tab remain owned by the menu without pre-highlighting an item.
|
|
984
1132
|
// An overflowing menu joins the Tab order so its scrollable region is
|
|
985
|
-
// keyboard-accessible; Tab still dismisses through listKeyDown.
|
|
1133
|
+
// keyboard-accessible; Tab still dismisses through listKeyDown. With
|
|
1134
|
+
// a header or footer the menu is one Tab stop between them.
|
|
986
1135
|
,
|
|
987
|
-
tabIndex: hasOverflow ? 0 : -1
|
|
1136
|
+
tabIndex: hasOverflow || hasRegions ? 0 : -1
|
|
988
1137
|
// Give the menu an accessible name from its trigger's label, so
|
|
989
1138
|
// screen readers announce e.g. "Actions menu" rather than an unnamed
|
|
990
1139
|
// menu (menus-13). A custom trigger names it by reference.
|
|
@@ -992,13 +1141,26 @@ function DropdownMenuPopover({
|
|
|
992
1141
|
"aria-label": renderTrigger != null ? rest['aria-label'] : button.label,
|
|
993
1142
|
"aria-labelledby": renderTrigger != null && rest['aria-label'] == null ? triggerId : rest['aria-labelledby'],
|
|
994
1143
|
onKeyDown: listKeyDown,
|
|
1144
|
+
onFocus: event => {
|
|
1145
|
+
rest.onFocus?.(event);
|
|
1146
|
+
if (event.target === event.currentTarget) {
|
|
1147
|
+
setIsMenuKeyboardFocused(getInteractionModality() === 'keyboard');
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
995
1150
|
...menuPress.menuProps,
|
|
996
|
-
...mergeProps(themeProps('dropdown-menu'), stylex.props(styles.dropdown, resolvedMaxHeight != null && dynamicStyles.menuMaxHeight(resolvedMaxHeight), hasOverflow ? styles.touchPanYPinchZoom : styles.touchPinchZoom, hasOverflow && styles.scrollable,
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1151
|
+
...mergeProps(themeProps('dropdown-menu'), stylex.props(styles.dropdown, resolvedMaxHeight != null && dynamicStyles.menuMaxHeight(resolvedMaxHeight), hasOverflow ? styles.touchPanYPinchZoom : styles.touchPinchZoom, hasOverflow && styles.scrollable, hasRegions && styles.menuInFrame,
|
|
1152
|
+
// Between a header and a footer the menu is a Tab stop, so
|
|
1153
|
+
// keyboard focus on it must be visible (the base style removes
|
|
1154
|
+
// the ring for the pointer-open focus target).
|
|
1155
|
+
hasRegions && isMenuKeyboardFocused && focusOutlineStyles.focusVisible, xstyle), className, style),
|
|
1156
|
+
children: /*#__PURE__*/_jsx(MenuRegionsContext, {
|
|
1157
|
+
value: hasRegions,
|
|
1158
|
+
children: /*#__PURE__*/_jsx(DropdownMenuContext, {
|
|
1159
|
+
value: contextValue,
|
|
1160
|
+
children: menuContent
|
|
1161
|
+
})
|
|
1000
1162
|
})
|
|
1001
|
-
}), {
|
|
1163
|
+
})), {
|
|
1002
1164
|
placement,
|
|
1003
1165
|
alignment,
|
|
1004
1166
|
offset: spacingVars['--spacing-1'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuSubMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuSubMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"DropdownMenuSubMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuSubMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AA0B5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA0J5C,MAAM,MAAM,+BAA+B,GACzC,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAErC,UAAU,4BAA6B,SAAQ,IAAI,CACjD,SAAS,EACT,MAAM,GAAG,UAAU,CACpB;IACC,2DAA2D;IAC3D,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,8CAA8C;IAC9C,KAAK,EAAE,SAAS,CAAC;IACjB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,8CAA8C;IAC9C,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,+BAA+B,CAAC;IAC/C,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,wBAAyB,SAAQ,4BAA4B;IAC5E;;;;;;;;OAQG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,SAAS,CAgkBX;yBAlkBe,mBAAmB"}
|
|
@@ -48,11 +48,12 @@
|
|
|
48
48
|
* - /apps/storybook/stories/DropdownMenu.stories.tsx
|
|
49
49
|
* - /packages/cli/assets/templates/blocks/components/DropdownMenu/ (showcase blocks)
|
|
50
50
|
*/
|
|
51
|
-
import React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
51
|
+
import React, { use, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
52
52
|
import { createPortal } from 'react-dom';
|
|
53
53
|
import * as stylex from '@stylexjs/stylex';
|
|
54
54
|
import { Icon, renderIconSlot } from "../Icon/index.js";
|
|
55
55
|
import { Spinner } from "../Spinner/index.js";
|
|
56
|
+
import { MenuRegionsContext } from "./menuRegionsContext.js";
|
|
56
57
|
import { Item } from "../Item/index.js";
|
|
57
58
|
import { useLayer } from "../Layer/useLayer.js";
|
|
58
59
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
@@ -199,6 +200,7 @@ export function DropdownMenuSubMenu(props) {
|
|
|
199
200
|
} = props;
|
|
200
201
|
const t = useTranslator();
|
|
201
202
|
const menuCtx = useDropdownMenuContext();
|
|
203
|
+
const rootHasRegions = use(MenuRegionsContext);
|
|
202
204
|
const menuSize = menuCtx?.menuSize ?? 'md';
|
|
203
205
|
const canOpen = !isDisabled;
|
|
204
206
|
const contentId = useId();
|
|
@@ -459,6 +461,15 @@ export function DropdownMenuSubMenu(props) {
|
|
|
459
461
|
// only act on our own, letting the deeper level keep ownership. No manual
|
|
460
462
|
// stopPropagation needed — each level self-filters.
|
|
461
463
|
const handleContentKeyDown = useCallback(e => {
|
|
464
|
+
// In a menu with a header or footer, Tab leaves the whole flyout stack:
|
|
465
|
+
// every open level closes as the key bubbles past it — this one's own
|
|
466
|
+
// rows or a deeper level's — and the root menu moves focus to a region.
|
|
467
|
+
if (e.key === 'Tab' && rootHasRegions) {
|
|
468
|
+
close({
|
|
469
|
+
focusTrigger: false
|
|
470
|
+
});
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
462
473
|
if (!ownsEvent(e)) {
|
|
463
474
|
return;
|
|
464
475
|
}
|
|
@@ -503,7 +514,7 @@ export function DropdownMenuSubMenu(props) {
|
|
|
503
514
|
return;
|
|
504
515
|
}
|
|
505
516
|
listNavKeyDown(e);
|
|
506
|
-
}, [ownsEvent, close, listNavKeyDown, typeahead, menuRef]);
|
|
517
|
+
}, [ownsEvent, close, listNavKeyDown, typeahead, menuRef, rootHasRegions]);
|
|
507
518
|
|
|
508
519
|
// Re-provide the menu context so nested items behave exactly like top-level
|
|
509
520
|
// ones. Selecting a leaf item must dismiss the WHOLE stack, not just this
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menuRegionsContext.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/menuRegionsContext.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,kBAAkB,kCAAuB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file menuRegionsContext.ts
|
|
6
|
+
* @input DropdownMenu's `header` and `footer` props
|
|
7
|
+
* @output `MenuRegionsContext`: whether the root menu has a header or footer
|
|
8
|
+
* @position Internal; not exported from the package. A sub-menu flyout reads it
|
|
9
|
+
* to close itself on Tab, so the root menu can move focus to a region.
|
|
10
|
+
*
|
|
11
|
+
* A plain context rather than a layer-scoped one on purpose: each sub-menu
|
|
12
|
+
* flyout is its own layer, and it must still see the root's value. A nested
|
|
13
|
+
* DropdownMenu provides its own value, so it never inherits an outer one.
|
|
14
|
+
*/
|
|
15
|
+
import { createContext } from 'react';
|
|
16
|
+
export const MenuRegionsContext = /*#__PURE__*/createContext(false);
|
|
17
|
+
MenuRegionsContext.displayName = 'MenuRegionsContext';
|
|
@@ -23,9 +23,9 @@ export declare const inputWrapperStyles: Readonly<{
|
|
|
23
23
|
readonly zIndex: stylex.StyleXClassNameFor<"zIndex", 1>;
|
|
24
24
|
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
25
25
|
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
26
|
-
readonly gap: stylex.StyleXClassNameFor<"gap", "
|
|
27
|
-
readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", "
|
|
28
|
-
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", "
|
|
26
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", "0.5rem">;
|
|
27
|
+
readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", "0.25rem">;
|
|
28
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", "0.5rem">;
|
|
29
29
|
readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", "1px">;
|
|
30
30
|
readonly borderStyle: stylex.StyleXClassNameFor<"borderStyle", "solid">;
|
|
31
31
|
readonly borderColor: stylex.StyleXClassNameFor<"borderColor", "light-dark(#0064E0, #2694FE)" | "light-dark(#CCD3DB, #494D53)">;
|
|
@@ -17,10 +17,8 @@
|
|
|
17
17
|
* --astryx-card-padding-block-end
|
|
18
18
|
*
|
|
19
19
|
* Read order per level: `var(--astryx-…, <next level>)`, terminating at
|
|
20
|
-
* `--spacing-4`. Same pattern for section, dialog, and the Lab
|
|
21
|
-
*
|
|
22
|
-
* and its Layout insets at no value, so an unthemed sheet changes nothing for
|
|
23
|
-
* descendants.
|
|
20
|
+
* `--spacing-4`. Same pattern for section, dialog, bottom-sheet, and the Lab
|
|
21
|
+
* drawer.
|
|
24
22
|
*
|
|
25
23
|
* ```ts
|
|
26
24
|
* components: {
|
|
@@ -129,28 +127,28 @@ declare const themeDefaultStyles: {
|
|
|
129
127
|
}>;
|
|
130
128
|
'bottom-sheet': Readonly<{
|
|
131
129
|
readonly containerPaddingInlineStart: Readonly<{
|
|
132
|
-
readonly '--container-padding-inline-start': stylex.StyleXClassNameFor<"--container-padding-inline-start",
|
|
130
|
+
readonly '--container-padding-inline-start': stylex.StyleXClassNameFor<"--container-padding-inline-start", string>;
|
|
133
131
|
}>;
|
|
134
132
|
readonly containerPaddingInlineEnd: Readonly<{
|
|
135
|
-
readonly '--container-padding-inline-end': stylex.StyleXClassNameFor<"--container-padding-inline-end",
|
|
133
|
+
readonly '--container-padding-inline-end': stylex.StyleXClassNameFor<"--container-padding-inline-end", string>;
|
|
136
134
|
}>;
|
|
137
135
|
readonly containerPaddingBlockStart: Readonly<{
|
|
138
|
-
readonly '--container-padding-block-start': stylex.StyleXClassNameFor<"--container-padding-block-start",
|
|
136
|
+
readonly '--container-padding-block-start': stylex.StyleXClassNameFor<"--container-padding-block-start", string>;
|
|
139
137
|
}>;
|
|
140
138
|
readonly containerPaddingBlockEnd: Readonly<{
|
|
141
|
-
readonly '--container-padding-block-end': stylex.StyleXClassNameFor<"--container-padding-block-end",
|
|
139
|
+
readonly '--container-padding-block-end': stylex.StyleXClassNameFor<"--container-padding-block-end", string>;
|
|
142
140
|
}>;
|
|
143
141
|
readonly layoutPaddingOuterX: Readonly<{
|
|
144
|
-
readonly '--layout-padding-outer-x': stylex.StyleXClassNameFor<"--layout-padding-outer-x",
|
|
142
|
+
readonly '--layout-padding-outer-x': stylex.StyleXClassNameFor<"--layout-padding-outer-x", string>;
|
|
145
143
|
}>;
|
|
146
144
|
readonly layoutPaddingOuterY: Readonly<{
|
|
147
|
-
readonly '--layout-padding-outer-y': stylex.StyleXClassNameFor<"--layout-padding-outer-y",
|
|
145
|
+
readonly '--layout-padding-outer-y': stylex.StyleXClassNameFor<"--layout-padding-outer-y", string>;
|
|
148
146
|
}>;
|
|
149
147
|
readonly layoutPaddingInnerX: Readonly<{
|
|
150
|
-
readonly '--layout-padding-inner-x': stylex.StyleXClassNameFor<"--layout-padding-inner-x",
|
|
148
|
+
readonly '--layout-padding-inner-x': stylex.StyleXClassNameFor<"--layout-padding-inner-x", string>;
|
|
151
149
|
}>;
|
|
152
150
|
readonly layoutPaddingInnerY: Readonly<{
|
|
153
|
-
readonly '--layout-padding-inner-y': stylex.StyleXClassNameFor<"--layout-padding-inner-y",
|
|
151
|
+
readonly '--layout-padding-inner-y': stylex.StyleXClassNameFor<"--layout-padding-inner-y", string>;
|
|
154
152
|
}>;
|
|
155
153
|
}>;
|
|
156
154
|
drawer: Readonly<{
|
|
@@ -288,7 +286,7 @@ export declare function container({ padding, paddingOuterX, paddingOuterY, paddi
|
|
|
288
286
|
}> | Readonly<{
|
|
289
287
|
readonly '--container-padding-inline-start': stylex.StyleXClassNameFor<"--container-padding-inline-start", string>;
|
|
290
288
|
}> | Readonly<{
|
|
291
|
-
readonly '--container-padding-inline-start': stylex.StyleXClassNameFor<"--container-padding-inline-start",
|
|
289
|
+
readonly '--container-padding-inline-start': stylex.StyleXClassNameFor<"--container-padding-inline-start", string>;
|
|
292
290
|
}> | Readonly<{
|
|
293
291
|
readonly '--container-padding-inline-start': stylex.StyleXClassNameFor<"--container-padding-inline-start", string>;
|
|
294
292
|
}>, Readonly<{
|
|
@@ -298,7 +296,7 @@ export declare function container({ padding, paddingOuterX, paddingOuterY, paddi
|
|
|
298
296
|
}> | Readonly<{
|
|
299
297
|
readonly '--container-padding-inline-end': stylex.StyleXClassNameFor<"--container-padding-inline-end", string>;
|
|
300
298
|
}> | Readonly<{
|
|
301
|
-
readonly '--container-padding-inline-end': stylex.StyleXClassNameFor<"--container-padding-inline-end",
|
|
299
|
+
readonly '--container-padding-inline-end': stylex.StyleXClassNameFor<"--container-padding-inline-end", string>;
|
|
302
300
|
}> | Readonly<{
|
|
303
301
|
readonly '--container-padding-inline-end': stylex.StyleXClassNameFor<"--container-padding-inline-end", string>;
|
|
304
302
|
}>, Readonly<{
|
|
@@ -308,7 +306,7 @@ export declare function container({ padding, paddingOuterX, paddingOuterY, paddi
|
|
|
308
306
|
}> | Readonly<{
|
|
309
307
|
readonly '--container-padding-block-start': stylex.StyleXClassNameFor<"--container-padding-block-start", string>;
|
|
310
308
|
}> | Readonly<{
|
|
311
|
-
readonly '--container-padding-block-start': stylex.StyleXClassNameFor<"--container-padding-block-start",
|
|
309
|
+
readonly '--container-padding-block-start': stylex.StyleXClassNameFor<"--container-padding-block-start", string>;
|
|
312
310
|
}> | Readonly<{
|
|
313
311
|
readonly '--container-padding-block-start': stylex.StyleXClassNameFor<"--container-padding-block-start", string>;
|
|
314
312
|
}>, Readonly<{
|
|
@@ -318,7 +316,7 @@ export declare function container({ padding, paddingOuterX, paddingOuterY, paddi
|
|
|
318
316
|
}> | Readonly<{
|
|
319
317
|
readonly '--container-padding-block-end': stylex.StyleXClassNameFor<"--container-padding-block-end", string>;
|
|
320
318
|
}> | Readonly<{
|
|
321
|
-
readonly '--container-padding-block-end': stylex.StyleXClassNameFor<"--container-padding-block-end",
|
|
319
|
+
readonly '--container-padding-block-end': stylex.StyleXClassNameFor<"--container-padding-block-end", string>;
|
|
322
320
|
}> | Readonly<{
|
|
323
321
|
readonly '--container-padding-block-end': stylex.StyleXClassNameFor<"--container-padding-block-end", string>;
|
|
324
322
|
}>, Readonly<{
|
|
@@ -328,7 +326,7 @@ export declare function container({ padding, paddingOuterX, paddingOuterY, paddi
|
|
|
328
326
|
}> | Readonly<{
|
|
329
327
|
readonly '--layout-padding-outer-x': stylex.StyleXClassNameFor<"--layout-padding-outer-x", string>;
|
|
330
328
|
}> | Readonly<{
|
|
331
|
-
readonly '--layout-padding-outer-x': stylex.StyleXClassNameFor<"--layout-padding-outer-x",
|
|
329
|
+
readonly '--layout-padding-outer-x': stylex.StyleXClassNameFor<"--layout-padding-outer-x", string>;
|
|
332
330
|
}> | Readonly<{
|
|
333
331
|
readonly '--layout-padding-outer-x': stylex.StyleXClassNameFor<"--layout-padding-outer-x", string>;
|
|
334
332
|
}>, Readonly<{
|
|
@@ -338,7 +336,7 @@ export declare function container({ padding, paddingOuterX, paddingOuterY, paddi
|
|
|
338
336
|
}> | Readonly<{
|
|
339
337
|
readonly '--layout-padding-outer-y': stylex.StyleXClassNameFor<"--layout-padding-outer-y", string>;
|
|
340
338
|
}> | Readonly<{
|
|
341
|
-
readonly '--layout-padding-outer-y': stylex.StyleXClassNameFor<"--layout-padding-outer-y",
|
|
339
|
+
readonly '--layout-padding-outer-y': stylex.StyleXClassNameFor<"--layout-padding-outer-y", string>;
|
|
342
340
|
}> | Readonly<{
|
|
343
341
|
readonly '--layout-padding-outer-y': stylex.StyleXClassNameFor<"--layout-padding-outer-y", string>;
|
|
344
342
|
}>, Readonly<{
|
|
@@ -348,7 +346,7 @@ export declare function container({ padding, paddingOuterX, paddingOuterY, paddi
|
|
|
348
346
|
}> | Readonly<{
|
|
349
347
|
readonly '--layout-padding-inner-x': stylex.StyleXClassNameFor<"--layout-padding-inner-x", string>;
|
|
350
348
|
}> | Readonly<{
|
|
351
|
-
readonly '--layout-padding-inner-x': stylex.StyleXClassNameFor<"--layout-padding-inner-x",
|
|
349
|
+
readonly '--layout-padding-inner-x': stylex.StyleXClassNameFor<"--layout-padding-inner-x", string>;
|
|
352
350
|
}> | Readonly<{
|
|
353
351
|
readonly '--layout-padding-inner-x': stylex.StyleXClassNameFor<"--layout-padding-inner-x", string>;
|
|
354
352
|
}>, Readonly<{
|
|
@@ -358,7 +356,7 @@ export declare function container({ padding, paddingOuterX, paddingOuterY, paddi
|
|
|
358
356
|
}> | Readonly<{
|
|
359
357
|
readonly '--layout-padding-inner-y': stylex.StyleXClassNameFor<"--layout-padding-inner-y", string>;
|
|
360
358
|
}> | Readonly<{
|
|
361
|
-
readonly '--layout-padding-inner-y': stylex.StyleXClassNameFor<"--layout-padding-inner-y",
|
|
359
|
+
readonly '--layout-padding-inner-y': stylex.StyleXClassNameFor<"--layout-padding-inner-y", string>;
|
|
362
360
|
}> | Readonly<{
|
|
363
361
|
readonly '--layout-padding-inner-y': stylex.StyleXClassNameFor<"--layout-padding-inner-y", string>;
|
|
364
362
|
}>, readonly [Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.stylex.d.ts","sourceRoot":"","sources":["../../src/Layout/container.stylex.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"container.stylex.d.ts","sourceRoot":"","sources":["../../src/Layout/container.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AA2OhB;;;GAGG;AACH,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAuKjE,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B;;;;OAIG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B;;;;OAIG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B;;;;OAIG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,EAAE,kBAAkB,CAAC;IAErC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,SAAS,CAAC,EACxB,OAAoB,EACpB,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,SAAS,GACV,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAyClB"}
|
|
@@ -19,10 +19,8 @@
|
|
|
19
19
|
* --astryx-card-padding-block-end
|
|
20
20
|
*
|
|
21
21
|
* Read order per level: `var(--astryx-…, <next level>)`, terminating at
|
|
22
|
-
* `--spacing-4`. Same pattern for section, dialog, and the Lab
|
|
23
|
-
*
|
|
24
|
-
* and its Layout insets at no value, so an unthemed sheet changes nothing for
|
|
25
|
-
* descendants.
|
|
22
|
+
* `--spacing-4`. Same pattern for section, dialog, bottom-sheet, and the Lab
|
|
23
|
+
* drawer.
|
|
26
24
|
*
|
|
27
25
|
* ```ts
|
|
28
26
|
* components: {
|
|
@@ -124,19 +122,11 @@ const dialogInlineEnd = `var(--astryx-dialog-padding-inline-end, ${dialogInline}
|
|
|
124
122
|
const dialogBlockStart = `var(--astryx-dialog-padding-block-start, ${dialogShorthand})`;
|
|
125
123
|
const dialogBlockEnd = `var(--astryx-dialog-padding-block-end, ${dialogShorthand})`;
|
|
126
124
|
|
|
127
|
-
// Bottom sheet padding chains: --astryx-* then the next specificity level
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
// back to its own default, exactly as before the sheet was a container. Built
|
|
133
|
-
// as chained const strings (no function calls) so StyleX can statically
|
|
134
|
-
// analyze them; see naming.ts for the prefix policy.
|
|
135
|
-
const bottomSheetThemeShorthand = 'var(--astryx-bottom-sheet-padding)';
|
|
136
|
-
const bottomSheetThemeInline = `var(--astryx-bottom-sheet-padding-inline, ${bottomSheetThemeShorthand})`;
|
|
137
|
-
const bottomSheetThemeInlineStart = `var(--astryx-bottom-sheet-padding-inline-start, ${bottomSheetThemeInline})`;
|
|
138
|
-
const bottomSheetThemeBlockStart = `var(--astryx-bottom-sheet-padding-block-start, ${bottomSheetThemeShorthand})`;
|
|
139
|
-
const bottomSheetShorthand = 'var(--astryx-bottom-sheet-padding, 0px)';
|
|
125
|
+
// Bottom sheet padding chains: --astryx-* then the next specificity level,
|
|
126
|
+
// terminating at --spacing-4 like Dialog. Built as chained const strings (no
|
|
127
|
+
// function calls) so StyleX can statically analyze them; see naming.ts for the
|
|
128
|
+
// prefix policy.
|
|
129
|
+
const bottomSheetShorthand = `var(--astryx-bottom-sheet-padding, ${SP4})`;
|
|
140
130
|
const bottomSheetInline = `var(--astryx-bottom-sheet-padding-inline, ${bottomSheetShorthand})`;
|
|
141
131
|
const bottomSheetInlineStart = `var(--astryx-bottom-sheet-padding-inline-start, ${bottomSheetInline})`;
|
|
142
132
|
const bottomSheetInlineEnd = `var(--astryx-bottom-sheet-padding-inline-end, ${bottomSheetInline})`;
|
|
@@ -257,35 +247,35 @@ const dialogDefaultPaddingStyles = {
|
|
|
257
247
|
};
|
|
258
248
|
const bottomSheetDefaultPaddingStyles = {
|
|
259
249
|
containerPaddingInlineStart: {
|
|
260
|
-
"--container-padding-inline-start": "
|
|
250
|
+
"--container-padding-inline-start": "xv7mus7",
|
|
261
251
|
$$css: true
|
|
262
252
|
},
|
|
263
253
|
containerPaddingInlineEnd: {
|
|
264
|
-
"--container-padding-inline-end": "
|
|
254
|
+
"--container-padding-inline-end": "x1ui7op6",
|
|
265
255
|
$$css: true
|
|
266
256
|
},
|
|
267
257
|
containerPaddingBlockStart: {
|
|
268
|
-
"--container-padding-block-start": "
|
|
258
|
+
"--container-padding-block-start": "x8qn3ha",
|
|
269
259
|
$$css: true
|
|
270
260
|
},
|
|
271
261
|
containerPaddingBlockEnd: {
|
|
272
|
-
"--container-padding-block-end": "
|
|
262
|
+
"--container-padding-block-end": "x1of45zw",
|
|
273
263
|
$$css: true
|
|
274
264
|
},
|
|
275
265
|
layoutPaddingOuterX: {
|
|
276
|
-
"--layout-padding-outer-x": "
|
|
266
|
+
"--layout-padding-outer-x": "x11ixy8q",
|
|
277
267
|
$$css: true
|
|
278
268
|
},
|
|
279
269
|
layoutPaddingOuterY: {
|
|
280
|
-
"--layout-padding-outer-y": "
|
|
270
|
+
"--layout-padding-outer-y": "x1iwhsh0",
|
|
281
271
|
$$css: true
|
|
282
272
|
},
|
|
283
273
|
layoutPaddingInnerX: {
|
|
284
|
-
"--layout-padding-inner-x": "
|
|
274
|
+
"--layout-padding-inner-x": "xp9icaw",
|
|
285
275
|
$$css: true
|
|
286
276
|
},
|
|
287
277
|
layoutPaddingInnerY: {
|
|
288
|
-
"--layout-padding-inner-y": "
|
|
278
|
+
"--layout-padding-inner-y": "x10u54dy",
|
|
289
279
|
$$css: true
|
|
290
280
|
}
|
|
291
281
|
};
|