@astryxdesign/core 0.4.0 → 0.4.1-canary.1ce0b4c
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 +39 -0
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +1 -2
- package/dist/AspectRatio/index.d.ts.map +1 -1
- package/dist/AspectRatio/index.js +1 -2
- package/dist/Badge/Badge.d.ts.map +1 -1
- package/dist/Badge/Badge.js +1 -2
- package/dist/Badge/index.d.ts.map +1 -1
- package/dist/Badge/index.js +1 -2
- package/dist/Banner/Banner.d.ts +3 -0
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +17 -3
- package/dist/Blockquote/Blockquote.d.ts.map +1 -1
- package/dist/Blockquote/Blockquote.js +1 -2
- package/dist/Blockquote/index.d.ts.map +1 -1
- package/dist/Blockquote/index.js +1 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +11 -9
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +1 -2
- package/dist/Card/index.d.ts.map +1 -1
- package/dist/Card/index.js +1 -2
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +1 -2
- package/dist/Center/index.d.ts.map +1 -1
- package/dist/Center/index.js +1 -2
- package/dist/Code/Code.d.ts.map +1 -1
- package/dist/Code/Code.js +1 -2
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +5 -0
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +7 -8
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +23 -10
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +44 -16
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +32 -13
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +10 -3
- package/dist/Field/PanelSearchInput.d.ts +81 -0
- package/dist/Field/PanelSearchInput.d.ts.map +1 -0
- package/dist/Field/PanelSearchInput.js +151 -0
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +21 -10
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +1 -2
- package/dist/Grid/index.d.ts.map +1 -1
- package/dist/Grid/index.js +1 -2
- package/dist/HoverCard/HoverCard.d.ts +1 -1
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +5 -13
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +6 -5
- package/dist/Icon/globalIconRegistry.d.ts +5 -4
- package/dist/Icon/globalIconRegistry.d.ts.map +1 -1
- package/dist/Icon/globalIconRegistry.js +5 -4
- package/dist/Indicator/index.d.ts +1 -1
- package/dist/Indicator/index.d.ts.map +1 -1
- package/dist/Indicator/types.d.ts +10 -0
- package/dist/Indicator/types.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +7 -2
- package/dist/Layer/layerHost.d.ts +24 -0
- package/dist/Layer/layerHost.d.ts.map +1 -0
- package/dist/Layer/layerHost.js +79 -0
- package/dist/Layer/useLayer.d.ts +14 -6
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +155 -29
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +24 -50
- package/dist/MultiSelector/MultiSelector.d.ts +8 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +134 -102
- package/dist/NavItem/navItemStyles.stylex.d.ts +17 -5
- package/dist/NavItem/navItemStyles.stylex.d.ts.map +1 -1
- package/dist/NavItem/navItemStyles.stylex.js +11 -5
- package/dist/Popover/usePopover.d.ts +15 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +14 -2
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +2 -3
- package/dist/Section/Section.d.ts.map +1 -1
- package/dist/Section/Section.js +1 -2
- package/dist/Section/index.d.ts.map +1 -1
- package/dist/Section/index.js +1 -2
- package/dist/Selector/Selector.d.ts +10 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +135 -95
- package/dist/SideNav/SideNav.d.ts +7 -9
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +32 -5
- package/dist/SideNav/SideNavCollapseButton.d.ts +25 -9
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +39 -15
- package/dist/SideNav/SideNavCollapseContext.d.ts +21 -0
- package/dist/SideNav/SideNavCollapseContext.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseContext.js +16 -2
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +70 -24
- package/dist/SideNav/SideNavItem.d.ts +7 -2
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +114 -75
- package/dist/SideNav/SideNavSection.d.ts.map +1 -1
- package/dist/SideNav/SideNavSection.js +7 -16
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +1 -2
- package/dist/Skeleton/index.d.ts.map +1 -1
- package/dist/Skeleton/index.js +1 -2
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +2 -6
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +3 -3
- package/dist/Table/TableRow.d.ts +1 -1
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +4 -2
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +7 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +14 -3
- package/dist/Timestamp/formatInstant.d.ts +11 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +3 -1
- package/dist/TopNav/TopNavMegaMenu.js +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +1 -1
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +2 -2
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -2
- package/dist/VisuallyHidden/index.d.ts.map +1 -1
- package/dist/VisuallyHidden/index.js +1 -2
- package/dist/astryx.css +23 -24
- package/dist/astryx.umd.js +48 -48
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +16 -2
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +17 -4
- package/dist/theme/defineTheme.d.ts +2 -2
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +2 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/tokens.stylex.d.ts +12 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +23 -0
- package/dist/utils/focusOutline.stylex.d.ts +34 -19
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +46 -33
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -1
- package/dist/utils/interactionModality.d.ts +34 -0
- package/dist/utils/interactionModality.d.ts.map +1 -0
- package/dist/utils/interactionModality.js +70 -0
- package/locales/en.json +44 -0
- package/locales/pseudo.json +33 -0
- package/package.json +3 -3
- package/src/AppShell/AppShell.doc.mjs +3 -0
- package/src/AspectRatio/AspectRatio.tsx +0 -2
- package/src/AspectRatio/index.ts +0 -2
- package/src/Badge/Badge.tsx +0 -2
- package/src/Badge/index.ts +0 -2
- package/src/Banner/Banner.test.tsx +58 -1
- package/src/Banner/Banner.tsx +24 -5
- package/src/Blockquote/Blockquote.tsx +0 -2
- package/src/Blockquote/index.ts +0 -2
- package/src/Button/Button.doc.mjs +2 -2
- package/src/Button/Button.tsx +10 -7
- package/src/ButtonGroup/ButtonGroup.test.tsx +7 -4
- package/src/Card/Card.tsx +0 -2
- package/src/Card/index.ts +0 -2
- package/src/Center/Center.tsx +0 -2
- package/src/Center/index.ts +0 -2
- package/src/CheckboxInput/CheckboxInput.test.tsx +8 -3
- package/src/Code/Code.tsx +0 -2
- package/src/CommandPalette/CommandPalette.test.tsx +54 -0
- package/src/CommandPalette/CommandPalette.tsx +5 -0
- package/src/ComplexSelector/ComplexSelector.test.tsx +15 -6
- package/src/ComplexSelector/ComplexSelector.tsx +6 -10
- package/src/DateInput/DateInput.test.tsx +19 -0
- package/src/DateInput/DateInput.tsx +3 -6
- package/src/DateRangeInput/DateRangeInput.tsx +3 -9
- package/src/DateTimeInput/DateTimeInput.test.tsx +79 -1
- package/src/DateTimeInput/DateTimeInput.tsx +23 -9
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +2 -1
- package/src/Field/PanelSearchInput.tsx +271 -0
- package/src/FileInput/FileInput.tsx +21 -8
- package/src/Grid/Grid.tsx +0 -2
- package/src/Grid/index.ts +0 -2
- package/src/HoverCard/HoverCard.doc.mjs +3 -3
- package/src/HoverCard/HoverCard.test.tsx +283 -55
- package/src/HoverCard/HoverCard.tsx +5 -13
- package/src/HoverCard/useHoverCard.tsx +8 -11
- package/src/Icon/globalIconRegistry.tsx +5 -4
- package/src/Indicator/Indicator.doc.mjs +1 -1
- package/src/Indicator/index.ts +1 -0
- package/src/Indicator/types.ts +11 -0
- package/src/InputGroup/groupStyles.ts +7 -8
- package/src/Layer/layerHost.test.ts +99 -0
- package/src/Layer/layerHost.ts +141 -0
- package/src/Layer/useLayer.doc.mjs +14 -4
- package/src/Layer/useLayer.test.tsx +318 -7
- package/src/Layer/useLayer.tsx +229 -35
- package/src/Lightbox/Lightbox.tsx +2 -11
- package/src/MultiSelector/MultiSelector.doc.mjs +9 -0
- package/src/MultiSelector/MultiSelector.test.tsx +135 -5
- package/src/MultiSelector/MultiSelector.tsx +170 -127
- package/src/NavItem/navItemStyles.stylex.ts +31 -5
- package/src/Popover/Popover.doc.mjs +2 -0
- package/src/Popover/usePopover.tsx +37 -4
- package/src/ProgressBar/ProgressBar.tsx +2 -8
- package/src/Section/Section.tsx +0 -2
- package/src/Section/index.ts +0 -2
- package/src/Selector/Selector.doc.mjs +10 -0
- package/src/Selector/Selector.test.tsx +386 -2
- package/src/Selector/Selector.tsx +182 -122
- package/src/SideNav/SideNav.doc.mjs +13 -4
- package/src/SideNav/SideNav.test.tsx +771 -2
- package/src/SideNav/SideNav.tsx +37 -16
- package/src/SideNav/SideNavCollapseButton.doc.mjs +28 -6
- package/src/SideNav/SideNavCollapseButton.tsx +67 -15
- package/src/SideNav/SideNavCollapseContext.ts +29 -9
- package/src/SideNav/SideNavHeading.tsx +28 -10
- package/src/SideNav/SideNavItem.doc.mjs +13 -0
- package/src/SideNav/SideNavItem.tsx +92 -84
- package/src/SideNav/SideNavSection.tsx +6 -20
- package/src/SideNav/index.ts +2 -0
- package/src/Skeleton/Skeleton.tsx +0 -2
- package/src/Skeleton/index.ts +0 -2
- package/src/Slider/Slider.tsx +2 -11
- package/src/Switch/Switch.tsx +10 -2
- package/src/Table/Table.test.tsx +31 -0
- package/src/Table/TableRow.tsx +6 -0
- package/src/Text/Text.doc.mjs +1 -1
- package/src/TimeInput/TimeInput.test.tsx +54 -0
- package/src/TimeInput/TimeInput.tsx +17 -2
- package/src/Timestamp/Timestamp.test.tsx +125 -30
- package/src/Timestamp/Timestamp.tsx +14 -2
- package/src/Timestamp/formatInstant.ts +16 -1
- package/src/Toolbar/Toolbar.test.tsx +14 -14
- package/src/TopNav/TopNavMegaMenu.doc.mjs +5 -0
- package/src/TopNav/TopNavMegaMenu.test.tsx +43 -0
- package/src/TopNav/TopNavMegaMenu.tsx +4 -1
- package/src/TopNav/TopNavMegaMenuItem.tsx +1 -1
- package/src/TopNav/TopNavMenu.test.tsx +41 -0
- package/src/TopNav/TopNavMenu.tsx +8 -2
- package/src/TreeList/TreeList.test.tsx +3 -2
- package/src/VisuallyHidden/VisuallyHidden.tsx +0 -2
- package/src/VisuallyHidden/index.ts +0 -2
- package/src/hooks/index.ts +5 -1
- package/src/hooks/useFocusTrap.test.tsx +16 -0
- package/src/hooks/useFocusTrap.ts +20 -2
- package/src/hooks/useInputStatusIcon.tsx +8 -8
- package/src/serverSafeComponents.test.ts +665 -0
- package/src/theme/defineTheme.ts +3 -0
- package/src/theme/generateThemeRules.test.ts +17 -0
- package/src/theme/index.ts +2 -0
- package/src/theme/themingTargets.test.ts +152 -26
- package/src/theme/tokens.stylex.ts +18 -0
- package/src/theme/tokens.test.ts +37 -0
- package/src/utils/focusOutline.stylex.ts +37 -23
- package/src/utils/index.ts +4 -0
- package/src/utils/interactionModality.ts +74 -0
|
@@ -23,17 +23,18 @@ import { Icon, renderIconSlot } from "../Icon/index.js";
|
|
|
23
23
|
import { Field, InputClearButton, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputWrapperStyles } from "../Field/index.js";
|
|
24
24
|
import { Divider } from "../Divider/index.js";
|
|
25
25
|
import { Spinner } from "../Spinner/index.js";
|
|
26
|
-
import {
|
|
26
|
+
import { PanelSearchInput } from "../Field/PanelSearchInput.js";
|
|
27
27
|
import { CheckboxInput } from "../CheckboxInput/index.js";
|
|
28
28
|
import { Badge } from "../Badge/index.js";
|
|
29
29
|
import "../theme/tokens.stylex.js";
|
|
30
|
-
import { colorVars, sizeVars, spacingVars, radiusVars, durationVars, easeVars, typographyVars, fontWeightVars, typeScaleVars
|
|
30
|
+
import { colorVars, sizeVars, spacingVars, radiusVars, durationVars, easeVars, typographyVars, fontWeightVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
31
31
|
import { isOptionData, isDivider, isSection, normalizeOption, getSelectableOptions } from "../Selector/utils.js";
|
|
32
32
|
import { useMultiCombobox } from "./hooks.js";
|
|
33
33
|
import { getInputARIA, mergeProps } from "../utils/index.js";
|
|
34
34
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
35
35
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
36
36
|
import { themeProps } from "../utils/themeProps.js";
|
|
37
|
+
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
37
38
|
import { stableClassName } from "../naming.js";
|
|
38
39
|
import { groupStyles } from "../InputGroup/groupStyles.js";
|
|
39
40
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
@@ -86,8 +87,6 @@ const styles = {
|
|
|
86
87
|
kKwaWg: "x1ilzqfv xq8i9tn",
|
|
87
88
|
kGVxlE: "x1gnnqk1 x1irk71m x15ysqaf",
|
|
88
89
|
k63SB2: "x1e4wzip",
|
|
89
|
-
kI3sdo: "x1a2a7pz x1irc7jg",
|
|
90
|
-
kInvED: "x1wfwxd8 xscfbxq",
|
|
91
90
|
k1ekBW: "xrafxwg",
|
|
92
91
|
k3aq6I: "x3oybdh xk4oym4",
|
|
93
92
|
$$css: true
|
|
@@ -97,6 +96,20 @@ const styles = {
|
|
|
97
96
|
k3aq6I: "x1c071of x1pdlv7q",
|
|
98
97
|
$$css: true
|
|
99
98
|
},
|
|
99
|
+
statusButton: {
|
|
100
|
+
k1xSpc: "x78zum5",
|
|
101
|
+
kGNEyG: "x6s0dn4",
|
|
102
|
+
kjj79g: "xl56j7k",
|
|
103
|
+
kmVPX3: "x1717udv",
|
|
104
|
+
kogj98: "x1ghz6dp",
|
|
105
|
+
kMzoRj: "xc342km",
|
|
106
|
+
ksu8eU: "xng3xce",
|
|
107
|
+
kWkggS: "xjbqb8w",
|
|
108
|
+
kMwMTN: "x1heor9g",
|
|
109
|
+
kkrTdU: "x1ypdohk",
|
|
110
|
+
kaIpWk: "xh6dtrn",
|
|
111
|
+
$$css: true
|
|
112
|
+
},
|
|
100
113
|
popover: {
|
|
101
114
|
k7Eaqz: "xrzjruh",
|
|
102
115
|
$$css: true
|
|
@@ -108,10 +121,6 @@ const styles = {
|
|
|
108
121
|
kkrTdU: "x1ypdohk",
|
|
109
122
|
$$css: true
|
|
110
123
|
},
|
|
111
|
-
sectionDivider: {
|
|
112
|
-
kqGvvJ: "xsq74q5",
|
|
113
|
-
$$css: true
|
|
114
|
-
},
|
|
115
124
|
divider: {
|
|
116
125
|
kqGvvJ: "xsq74q5",
|
|
117
126
|
$$css: true
|
|
@@ -268,6 +277,7 @@ export function MultiSelector({
|
|
|
268
277
|
triggerDisplay = 'count',
|
|
269
278
|
maxBadges = 3,
|
|
270
279
|
renderOption,
|
|
280
|
+
indicatorPosition = 'start',
|
|
271
281
|
isDefaultOpen = false,
|
|
272
282
|
'data-testid': testId,
|
|
273
283
|
htmlName,
|
|
@@ -292,7 +302,7 @@ export function MultiSelector({
|
|
|
292
302
|
const searchRef = useRef(null);
|
|
293
303
|
const inputGroup = useInputGroup();
|
|
294
304
|
const [searchQuery, setSearchQuery] = useState('');
|
|
295
|
-
// A typed query shows
|
|
305
|
+
// A typed query shows the search row's clear (✕) button, which becomes
|
|
296
306
|
// the next tab stop after the search input.
|
|
297
307
|
const hasQuery = searchQuery.length > 0;
|
|
298
308
|
|
|
@@ -409,7 +419,10 @@ export function MultiSelector({
|
|
|
409
419
|
hasAutoFocus: false,
|
|
410
420
|
// The popup's own role="listbox" is the exposed semantics; the trigger
|
|
411
421
|
// keeps DOM focus, so wrapping it in a modal dialog would misrepresent it.
|
|
412
|
-
role: 'none'
|
|
422
|
+
role: 'none',
|
|
423
|
+
// The theme target belongs on the SURFACE that paints the popup, which
|
|
424
|
+
// `usePopover` owns — not on the scrolling list inside it.
|
|
425
|
+
surfaceTarget: 'multi-selector-popup'
|
|
413
426
|
});
|
|
414
427
|
|
|
415
428
|
// Open dropdown on mount when isDefaultOpen is true
|
|
@@ -615,13 +628,36 @@ export function MultiSelector({
|
|
|
615
628
|
if (!hasSearch) {
|
|
616
629
|
return null;
|
|
617
630
|
}
|
|
618
|
-
return /*#__PURE__*/_jsx(
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
631
|
+
return /*#__PURE__*/_jsx(PanelSearchInput, {
|
|
632
|
+
ref: searchRef,
|
|
633
|
+
id: searchId
|
|
634
|
+
// The search row is the panel's header: a magnifier, a borderless
|
|
635
|
+
// input, and the shared clear (✕) button. It deliberately does NOT
|
|
636
|
+
// render a bordered TextInput — the popup is already a bordered
|
|
637
|
+
// surface, and a field inside it drew a second box within that box.
|
|
638
|
+
,
|
|
639
|
+
label: t('@astryx.multiSelector.searchOptions')
|
|
640
|
+
// Same accessible name the TextInput's built-in clear produced
|
|
641
|
+
// ("Clear Search options"), so the affordance keeps its name while its
|
|
642
|
+
// chrome changes.
|
|
643
|
+
,
|
|
644
|
+
clearLabel: t('@astryx.textInput.clearLabel', {
|
|
645
|
+
label: t('@astryx.multiSelector.searchOptions')
|
|
646
|
+
}),
|
|
647
|
+
...themeProps('multi-selector-search'),
|
|
648
|
+
// When hasSearch is set, focus moves into this input on open, so it —
|
|
649
|
+
// not the trigger — must be the combobox reporting the highlighted
|
|
650
|
+
// option via aria-activedescendant (comboboxes-4).
|
|
651
|
+
role: "combobox",
|
|
652
|
+
"aria-expanded": popover.isOpen,
|
|
653
|
+
"aria-controls": listboxId,
|
|
654
|
+
"aria-autocomplete": "list",
|
|
655
|
+
"aria-activedescendant": popover.isOpen && highlightedIndex >= 0 ? getItemId(highlightedIndex) : undefined,
|
|
656
|
+
value: searchQuery,
|
|
657
|
+
onValueChange: handleSearchChange,
|
|
658
|
+
onContainerKeyDown: e => {
|
|
659
|
+
// The clear (✕) button lives inside the row, after the input in DOM
|
|
660
|
+
// order. When it is focused and the user tabs forward there is
|
|
625
661
|
// nothing else in the popup, so dismiss it (Shift+Tab returns to the
|
|
626
662
|
// input natively). Key events originating on the input are handled on
|
|
627
663
|
// the input below; ignore them here so we don't double-dismiss.
|
|
@@ -632,54 +668,23 @@ export function MultiSelector({
|
|
|
632
668
|
onKeyDown(e);
|
|
633
669
|
}
|
|
634
670
|
},
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
//
|
|
639
|
-
//
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
width: "100%"
|
|
653
|
-
// When hasSearch is set, focus moves into this input on open, so it —
|
|
654
|
-
// not the trigger — must be the combobox reporting the highlighted
|
|
655
|
-
// option via aria-activedescendant (comboboxes-4). role + aria-* pass
|
|
656
|
-
// through to the underlying <input> via BaseProps.
|
|
657
|
-
,
|
|
658
|
-
role: "combobox",
|
|
659
|
-
"aria-expanded": popover.isOpen,
|
|
660
|
-
"aria-controls": listboxId,
|
|
661
|
-
"aria-autocomplete": "list",
|
|
662
|
-
"aria-activedescendant": popover.isOpen && highlightedIndex >= 0 ? getItemId(highlightedIndex) : undefined,
|
|
663
|
-
value: searchQuery,
|
|
664
|
-
onChange: handleSearchChange,
|
|
665
|
-
onKeyDown: e => {
|
|
666
|
-
// Arrow keys navigate options; Enter toggles; Escape closes.
|
|
667
|
-
// Space and Home/End are left to the input (type a space / move
|
|
668
|
-
// the caret) per the APG editable combobox; PageUp/PageDown are
|
|
669
|
-
// the sanctioned substitute for jumping to the first/last option.
|
|
670
|
-
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'PageUp' || e.key === 'PageDown' || e.key === 'Enter' || e.key === 'Escape') {
|
|
671
|
-
onKeyDown(e);
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
// Tab: when a query is showing the clear (✕) button, forward-tab
|
|
675
|
-
// moves focus to it (keeping the popup open) so the affordance is
|
|
676
|
-
// keyboard-reachable. Every other Tab dismisses the popup as usual.
|
|
677
|
-
if (e.key === 'Tab' && (e.shiftKey || !hasQuery)) {
|
|
678
|
-
onKeyDown(e);
|
|
679
|
-
}
|
|
680
|
-
},
|
|
681
|
-
placeholder: searchPlaceholder
|
|
682
|
-
})
|
|
671
|
+
onKeyDown: e => {
|
|
672
|
+
// Arrow keys navigate options; Enter toggles; Escape closes.
|
|
673
|
+
// Space and Home/End are left to the input (type a space / move
|
|
674
|
+
// the caret) per the APG editable combobox; PageUp/PageDown are
|
|
675
|
+
// the sanctioned substitute for jumping to the first/last option.
|
|
676
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'PageUp' || e.key === 'PageDown' || e.key === 'Enter' || e.key === 'Escape') {
|
|
677
|
+
onKeyDown(e);
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
// Tab: when a query is showing the clear (✕) button, forward-tab
|
|
681
|
+
// moves focus to it (keeping the popup open) so the affordance is
|
|
682
|
+
// keyboard-reachable. Every other Tab dismisses the popup as usual.
|
|
683
|
+
if (e.key === 'Tab' && (e.shiftKey || !hasQuery)) {
|
|
684
|
+
onKeyDown(e);
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
placeholder: searchPlaceholder
|
|
683
688
|
});
|
|
684
689
|
}, [hasSearch, searchId, listboxId, searchQuery, hasQuery, searchPlaceholder, handleSearchChange, onKeyDown, popover.isOpen, highlightedIndex, getItemId, t]);
|
|
685
690
|
|
|
@@ -693,6 +698,25 @@ export function MultiSelector({
|
|
|
693
698
|
// checkbox is inert/decorative, so the indeterminate state must be
|
|
694
699
|
// conveyed through the option's accessible name (WCAG 4.1.2).
|
|
695
700
|
const isPartiallySelected = isSelectAll && selectAllState === 'indeterminate';
|
|
701
|
+
const checkbox = /*#__PURE__*/_jsx("div", {
|
|
702
|
+
inert: true,
|
|
703
|
+
...{
|
|
704
|
+
0: {
|
|
705
|
+
className: "x47corl x78zum5 x2lah0s"
|
|
706
|
+
},
|
|
707
|
+
1: {
|
|
708
|
+
className: "x47corl x78zum5 x2lah0s xvc5jky"
|
|
709
|
+
}
|
|
710
|
+
}[!!(indicatorPosition === 'end') << 0],
|
|
711
|
+
children: /*#__PURE__*/_jsx(CheckboxInput, {
|
|
712
|
+
label: "",
|
|
713
|
+
isLabelHidden: true,
|
|
714
|
+
value: checkboxValue,
|
|
715
|
+
onChange: () => {},
|
|
716
|
+
isDisabled: item.disabled,
|
|
717
|
+
size: size === 'lg' ? 'md' : size
|
|
718
|
+
})
|
|
719
|
+
});
|
|
696
720
|
return /*#__PURE__*/_jsxs("div", {
|
|
697
721
|
id: getItemId(flatIndex),
|
|
698
722
|
role: "option",
|
|
@@ -718,27 +742,14 @@ export function MultiSelector({
|
|
|
718
742
|
selected: isSelected ? 'selected' : null,
|
|
719
743
|
disabled: item.disabled ? 'disabled' : null
|
|
720
744
|
}), stylex.props(styles.item, isSelectAll ? selectAllSizeStyles[size] : itemSizeStyles[size], isSelectAll && styles.selectAllWrapper, isHighlighted && styles.itemHighlighted, item.disabled && styles.itemDisabled)),
|
|
721
|
-
children: [/*#__PURE__*/_jsx("
|
|
722
|
-
inert: true,
|
|
723
|
-
...{
|
|
724
|
-
className: "x47corl x78zum5 x2lah0s"
|
|
725
|
-
},
|
|
726
|
-
children: /*#__PURE__*/_jsx(CheckboxInput, {
|
|
727
|
-
label: "",
|
|
728
|
-
isLabelHidden: true,
|
|
729
|
-
value: checkboxValue,
|
|
730
|
-
onChange: () => {},
|
|
731
|
-
isDisabled: item.disabled,
|
|
732
|
-
size: size === 'lg' ? 'md' : size
|
|
733
|
-
})
|
|
734
|
-
}), renderOption && !isSelectAll ? renderOption(item) : /*#__PURE__*/_jsx("span", {
|
|
745
|
+
children: [indicatorPosition === 'start' && checkbox, renderOption && !isSelectAll ? renderOption(item) : /*#__PURE__*/_jsx("span", {
|
|
735
746
|
...{
|
|
736
747
|
className: "xeuugli xb3r6kr xlyipyv xuxw1ft"
|
|
737
748
|
},
|
|
738
749
|
children: item.label ?? item.value
|
|
739
|
-
})]
|
|
750
|
+
}), indicatorPosition === 'end' && checkbox]
|
|
740
751
|
}, item.value);
|
|
741
|
-
}, [renderOption, highlightedIndex, optimisticValue, allEnabledSelected, selectAllState, selectAllLabel, getItemId, handleNavigableToggle, onItemMouseEnter, size, t]);
|
|
752
|
+
}, [renderOption, indicatorPosition, highlightedIndex, optimisticValue, allEnabledSelected, selectAllState, selectAllLabel, getItemId, handleNavigableToggle, onItemMouseEnter, size, t]);
|
|
742
753
|
|
|
743
754
|
// Render all options. Uses sortedItems as the single source of truth for
|
|
744
755
|
// item order — no independent sorting here. Structural elements (dividers,
|
|
@@ -750,12 +761,11 @@ export function MultiSelector({
|
|
|
750
761
|
// Number of real items (excluding the select-all sentinel)
|
|
751
762
|
const realItemCount = hasSelectAll ? sortedItems.length - 1 : sortedItems.length;
|
|
752
763
|
|
|
753
|
-
// Show select-all only when there are real items to select
|
|
764
|
+
// Show select-all only when there are real items to select. It reads as
|
|
765
|
+
// the first row of the list, not a section of its own — no divider under
|
|
766
|
+
// it (the checkbox column already lines it up with the options below).
|
|
754
767
|
if (hasSelectAll && realItemCount > 0) {
|
|
755
768
|
elements.push(renderItem(sortedItems[0], 0));
|
|
756
|
-
elements.push(/*#__PURE__*/_jsx(Divider, {
|
|
757
|
-
xstyle: styles.divider
|
|
758
|
-
}, "select-all-divider"));
|
|
759
769
|
cursor = 1;
|
|
760
770
|
} else if (hasSelectAll) {
|
|
761
771
|
// Skip the select-all sentinel when there are no real items
|
|
@@ -813,16 +823,21 @@ export function MultiSelector({
|
|
|
813
823
|
sectionItems.push(renderItem(sortedItems[cursor], cursor));
|
|
814
824
|
cursor++;
|
|
815
825
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
elements.push(/*#__PURE__*/_jsx("div", {
|
|
826
|
+
// The heading lives INSIDE the group and is aria-hidden: the group
|
|
827
|
+
// already carries the title as its accessible name, so exposing the
|
|
828
|
+
// text again would announce it twice. This also keeps role="listbox"'s
|
|
829
|
+
// children to option/group only — the old labeled Divider sat in the
|
|
830
|
+
// listbox as a stray role="separator".
|
|
831
|
+
elements.push(/*#__PURE__*/_jsxs("div", {
|
|
823
832
|
role: "group",
|
|
824
833
|
"aria-label": option.title,
|
|
825
|
-
children:
|
|
834
|
+
children: [option.title && /*#__PURE__*/_jsx("div", {
|
|
835
|
+
"aria-hidden": "true",
|
|
836
|
+
...mergeProps(themeProps('multi-selector-section-heading'), {
|
|
837
|
+
className: "xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o"
|
|
838
|
+
}),
|
|
839
|
+
children: option.title
|
|
840
|
+
}), sectionItems]
|
|
826
841
|
}, `section-${i}`));
|
|
827
842
|
} else if (isOptionData(option)) {
|
|
828
843
|
if (!isSearching || optionMatchesQuery(normalizeOption(option), searchQuery)) {
|
|
@@ -854,7 +869,7 @@ export function MultiSelector({
|
|
|
854
869
|
size,
|
|
855
870
|
status: status?.type ?? null,
|
|
856
871
|
disabled: isDisabled ? 'disabled' : null
|
|
857
|
-
}), stylex.props(inputWrapperStyles.base, styles.triggerContainer, sizeStyles[size], variant === 'ghost' && styles.triggerGhost, isDisabled && inputWrapperStyles.disabled, variant === 'ghost' && isDisabled && styles.triggerGhostDisabled, optimisticValue.length === 0 && styles.triggerPlaceholder, variant !== 'ghost' && status && inputStatusBorderStyles[status.type], variant !== 'ghost' && status && !isDisabled && inputStatusHoverShadowStyles[status.type], variant !== 'ghost' && inputGroup && groupStyles.inGroup, xstyle), className, style),
|
|
872
|
+
}), stylex.props(inputWrapperStyles.base, styles.triggerContainer, sizeStyles[size], variant === 'ghost' && styles.triggerGhost, variant === 'ghost' && focusOutlineStyles.focusWithin, isDisabled && inputWrapperStyles.disabled, variant === 'ghost' && isDisabled && styles.triggerGhostDisabled, optimisticValue.length === 0 && styles.triggerPlaceholder, variant !== 'ghost' && status && inputStatusBorderStyles[status.type], variant !== 'ghost' && status && !isDisabled && inputStatusHoverShadowStyles[status.type], variant !== 'ghost' && inputGroup && groupStyles.inGroup, xstyle), className, style),
|
|
858
873
|
children: [startIcon && renderIconSlot(startIcon, {
|
|
859
874
|
size: 'sm',
|
|
860
875
|
color: 'secondary'
|
|
@@ -918,9 +933,7 @@ export function MultiSelector({
|
|
|
918
933
|
"aria-label": t(STATUS_BUTTON_LABEL_KEY[status.type]),
|
|
919
934
|
"aria-describedby": statusTooltip.describedBy,
|
|
920
935
|
onClick: e => e.stopPropagation(),
|
|
921
|
-
...
|
|
922
|
-
className: "x78zum5 x6s0dn4 xl56j7k x1717udv x1ghz6dp xc342km xng3xce xjbqb8w x1heor9g x1ypdohk xh6dtrn x1a2a7pz x1p25gnr x1y3gkto"
|
|
923
|
-
},
|
|
936
|
+
...stylex.props(focusOutlineStyles.focusVisible, styles.statusButton),
|
|
924
937
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
925
938
|
icon: STATUS_ICON_MAP[status.type],
|
|
926
939
|
size: "sm",
|
|
@@ -951,17 +964,36 @@ export function MultiSelector({
|
|
|
951
964
|
state: popover.isOpen ? 'expanded' : 'collapsed'
|
|
952
965
|
})
|
|
953
966
|
})]
|
|
954
|
-
}), popover.render(
|
|
955
|
-
|
|
967
|
+
}), popover.render(hasSearch ?
|
|
968
|
+
/*#__PURE__*/
|
|
969
|
+
// With a search row the panel splits: the header stays put while the
|
|
970
|
+
// options scroll under it, so the field does not slide out of reach
|
|
971
|
+
// in a long list. Without one the panel is a single scroll container,
|
|
972
|
+
// exactly as before.
|
|
973
|
+
_jsxs("div", {
|
|
974
|
+
children: [renderSearch(), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx("div", {
|
|
975
|
+
...{
|
|
976
|
+
className: "x9f619 xuyqlj2 x1odjw0f x9epnlk"
|
|
977
|
+
},
|
|
978
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
979
|
+
id: listboxId,
|
|
980
|
+
role: "listbox",
|
|
981
|
+
"aria-multiselectable": "true",
|
|
982
|
+
"aria-labelledby": triggerId,
|
|
983
|
+
children: renderOptions()
|
|
984
|
+
})
|
|
985
|
+
})]
|
|
986
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
987
|
+
...{
|
|
956
988
|
className: "x9f619 xuyqlj2 x1odjw0f x9epnlk"
|
|
957
|
-
}
|
|
958
|
-
children:
|
|
989
|
+
},
|
|
990
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
959
991
|
id: listboxId,
|
|
960
992
|
role: "listbox",
|
|
961
993
|
"aria-multiselectable": "true",
|
|
962
994
|
"aria-labelledby": triggerId,
|
|
963
995
|
children: renderOptions()
|
|
964
|
-
})
|
|
996
|
+
})
|
|
965
997
|
}), {
|
|
966
998
|
placement: 'below',
|
|
967
999
|
alignment: 'start',
|
|
@@ -9,8 +9,13 @@
|
|
|
9
9
|
* disabled state) so all nav-like components stay in sync — especially important
|
|
10
10
|
* when TopNav items render inside MobileNav drawers alongside SideNav items.
|
|
11
11
|
*
|
|
12
|
-
* Individual components layer their own overrides (e.g. collapsed mode,
|
|
13
|
-
*
|
|
12
|
+
* Individual components layer their own overrides (e.g. collapsed mode,
|
|
13
|
+
* indentation) via stylex.props composition.
|
|
14
|
+
*
|
|
15
|
+
* The focus ring is not defined here. Compose
|
|
16
|
+
* `focusOutlineProps.focusVisible` (utils/focusOutline.stylex.ts) at the call
|
|
17
|
+
* site, on whichever element actually takes focus — in a split-action row that
|
|
18
|
+
* is the link and the toggle, not the row that contains them.
|
|
14
19
|
*/
|
|
15
20
|
export type NavItemSize = 'sm' | 'md' | 'lg';
|
|
16
21
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -63,15 +68,22 @@ export declare const navItemStyles: Readonly<{
|
|
|
63
68
|
}>;
|
|
64
69
|
}>;
|
|
65
70
|
readonly selected: Readonly<{
|
|
66
|
-
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "light-dark(rgba(5, 54, 89, 0.1), rgba(223, 226, 229, 0.2))">;
|
|
71
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "light-dark(rgba(5, 54, 89, 0.1), rgba(223, 226, 229, 0.2))" | "Highlight">;
|
|
72
|
+
readonly color: stylex.StyleXClassNameFor<"color", "HighlightText" | null>;
|
|
67
73
|
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", "500">;
|
|
68
74
|
readonly ':hover': stylex.StyleXClassNameFor<":hover", {
|
|
69
75
|
readonly '@media (hover: hover)': {
|
|
70
|
-
readonly backgroundColor:
|
|
76
|
+
readonly backgroundColor: {
|
|
77
|
+
readonly default: stylex.StyleXVar<"light-dark(rgba(5, 54, 89, 0.1), rgba(223, 226, 229, 0.2))">;
|
|
78
|
+
readonly '@media (forced-colors: active)': "Highlight";
|
|
79
|
+
};
|
|
71
80
|
};
|
|
72
81
|
}>;
|
|
73
82
|
readonly ':active': stylex.StyleXClassNameFor<":active", {
|
|
74
|
-
readonly backgroundColor:
|
|
83
|
+
readonly backgroundColor: {
|
|
84
|
+
readonly default: stylex.StyleXVar<"light-dark(rgba(5, 54, 89, 0.1), rgba(223, 226, 229, 0.2))">;
|
|
85
|
+
readonly '@media (forced-colors: active)': "Highlight";
|
|
86
|
+
};
|
|
75
87
|
}>;
|
|
76
88
|
}>;
|
|
77
89
|
readonly disabled: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navItemStyles.stylex.d.ts","sourceRoot":"","sources":["../../src/NavItem/navItemStyles.stylex.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"navItemStyles.stylex.d.ts","sourceRoot":"","sources":["../../src/NavItem/navItemStyles.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAU3C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4FxB,CAAC"}
|
|
@@ -11,8 +11,13 @@
|
|
|
11
11
|
* disabled state) so all nav-like components stay in sync — especially important
|
|
12
12
|
* when TopNav items render inside MobileNav drawers alongside SideNav items.
|
|
13
13
|
*
|
|
14
|
-
* Individual components layer their own overrides (e.g. collapsed mode,
|
|
15
|
-
*
|
|
14
|
+
* Individual components layer their own overrides (e.g. collapsed mode,
|
|
15
|
+
* indentation) via stylex.props composition.
|
|
16
|
+
*
|
|
17
|
+
* The focus ring is not defined here. Compose
|
|
18
|
+
* `focusOutlineProps.focusVisible` (utils/focusOutline.stylex.ts) at the call
|
|
19
|
+
* site, on whichever element actually takes focus — in a split-action row that
|
|
20
|
+
* is the link and the toggle, not the row that contains them.
|
|
16
21
|
*/
|
|
17
22
|
|
|
18
23
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -63,10 +68,11 @@ export const navItemStyles = {
|
|
|
63
68
|
$$css: true
|
|
64
69
|
},
|
|
65
70
|
selected: {
|
|
66
|
-
kWkggS: "x17x4s8c",
|
|
71
|
+
kWkggS: "x17x4s8c x1jzqe4",
|
|
72
|
+
kMwMTN: "x1k5gbb1",
|
|
67
73
|
k63SB2: "x1e4wzip",
|
|
68
|
-
kHE3J0: "x1sua13m",
|
|
69
|
-
kSReZ0: "xjtnuge",
|
|
74
|
+
kHE3J0: "x1sua13m x1jawyga",
|
|
75
|
+
kSReZ0: "xjtnuge x1vo6n7o",
|
|
70
76
|
$$css: true
|
|
71
77
|
},
|
|
72
78
|
disabled: {
|
|
@@ -109,6 +109,21 @@ export interface UsePopoverOptions {
|
|
|
109
109
|
* @default true
|
|
110
110
|
*/
|
|
111
111
|
hasSurface?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Theme-target name stamped on the popup SURFACE — the element that paints
|
|
114
|
+
* the background, radius and elevation — without the `astryx-` prefix
|
|
115
|
+
* (e.g. `'complex-selector-popup'`).
|
|
116
|
+
*
|
|
117
|
+
* The surface is created here, not by the calling component, so a component
|
|
118
|
+
* that wants its popup themeable cannot reach it on its own: a target it
|
|
119
|
+
* renders itself lands on its content INSIDE the surface, where a background
|
|
120
|
+
* or radius rule paints the wrong box. Name the surface through this option
|
|
121
|
+
* and document the class in the component's `theming.targets`.
|
|
122
|
+
*
|
|
123
|
+
* The shared `astryx-popover-surface` class is always present alongside it,
|
|
124
|
+
* so a theme can style every popup surface at once.
|
|
125
|
+
*/
|
|
126
|
+
surfaceTarget?: string;
|
|
112
127
|
}
|
|
113
128
|
/**
|
|
114
129
|
* Return type for usePopover
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopover.d.ts","sourceRoot":"","sources":["../../src/Popover/usePopover.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAiC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAW,KAAK,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"usePopover.d.ts","sourceRoot":"","sources":["../../src/Popover/usePopover.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAiC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAW,KAAK,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAgEnD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,UAAU,EAAE,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAE7C;;;;OAIG;IACH,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAEnD;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAC,KAAK,IAAI,CAAC;IAEpD;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,kBAAkB,KAAK,SAAS,CAAC;IAEvE;;OAEG;IACH,YAAY,EAAE;QACZ,eAAe,EAAE,QAAQ,GAAG,MAAM,CAAC;QACnC,eAAe,EAAE,OAAO,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CA2K5E"}
|
|
@@ -24,6 +24,9 @@ import { Button } from "../Button/index.js";
|
|
|
24
24
|
import { rtlStyles } from "../utils/index.js";
|
|
25
25
|
import { useTranslator } from "../i18n/index.js";
|
|
26
26
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
27
|
+
import { mergeProps } from "../utils/mergeProps.js";
|
|
28
|
+
import { themeProps } from "../utils/themeProps.js";
|
|
29
|
+
import { stableClassName } from "../naming.js";
|
|
27
30
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
31
|
const styles = {
|
|
29
32
|
surface: {
|
|
@@ -107,6 +110,7 @@ export function usePopover(options = {}) {
|
|
|
107
110
|
hasEscapeDismiss = true,
|
|
108
111
|
hasAutoFocus = true,
|
|
109
112
|
hasSurface = true,
|
|
113
|
+
surfaceTarget,
|
|
110
114
|
hasCloseButton = true,
|
|
111
115
|
closeButtonLabel: closeButtonLabelFromProps,
|
|
112
116
|
dialogLabel,
|
|
@@ -188,12 +192,20 @@ export function usePopover(options = {}) {
|
|
|
188
192
|
|
|
189
193
|
// Wrapped render function that includes surface styles and optional hidden close button
|
|
190
194
|
const render = useCallback((children, props) => {
|
|
195
|
+
// `mergeProps` is positional — a third OBJECT argument is read as
|
|
196
|
+
// `style`, not as more props — so the surface's classes are composed
|
|
197
|
+
// into one props object before merging with the StyleX result.
|
|
198
|
+
const surfaceProps = themeProps('popover-surface');
|
|
199
|
+
const surfaceClassName = surfaceTarget != null ? `${surfaceProps.className} ${stableClassName(surfaceTarget)}` : surfaceProps.className;
|
|
191
200
|
return layer.render(/*#__PURE__*/_jsxs("div", {
|
|
192
201
|
ref: contentRef,
|
|
193
202
|
role: role === 'dialog' ? 'dialog' : undefined,
|
|
194
203
|
"aria-modal": role === 'dialog' && isModal ? true : undefined,
|
|
195
204
|
"aria-label": role === 'dialog' ? dialogLabel : undefined,
|
|
196
|
-
...
|
|
205
|
+
...mergeProps({
|
|
206
|
+
...surfaceProps,
|
|
207
|
+
className: surfaceClassName
|
|
208
|
+
}, stylex.props(styles.contentWrapper, hasSurface && styles.surface, xstyle)),
|
|
197
209
|
children: [children, hasCloseButton && /*#__PURE__*/_jsx("div", {
|
|
198
210
|
...stylex.props(styles.closeButtonWrapper, rtlStyles.centerInline('100%')),
|
|
199
211
|
children: /*#__PURE__*/_jsx(Button, {
|
|
@@ -206,7 +218,7 @@ export function usePopover(options = {}) {
|
|
|
206
218
|
...props,
|
|
207
219
|
xstyle: props?.xstyle
|
|
208
220
|
});
|
|
209
|
-
}, [layer, hasCloseButton, hasSurface, closeButtonLabel, contentRef, dialogLabel, role, isModal, xstyle]);
|
|
221
|
+
}, [layer, hasCloseButton, hasSurface, surfaceTarget, closeButtonLabel, contentRef, dialogLabel, role, isModal, xstyle]);
|
|
210
222
|
return {
|
|
211
223
|
triggerRef,
|
|
212
224
|
contentRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAUnD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,qBAAqB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1D;;;OAGG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACvC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAwOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAS,EACT,GAAS,EACT,KAAK,EACL,aAAqB,EACrB,aAAqB,EACrB,gBAA0C,EAC1C,OAAkB,EAClB,eAAuB,EACvB,UAAkB,EAClB,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,UAAU,EACzB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,gBAAgB,+BAoKlB;yBArLe,WAAW"}
|
|
@@ -21,6 +21,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
21
21
|
import "../theme/tokens.stylex.js";
|
|
22
22
|
import { colorVars, spacingVars, radiusVars, fontWeightVars, durationVars, easeVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
23
23
|
import { mergeProps } from "../utils/index.js";
|
|
24
|
+
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
24
25
|
import { themeProps } from "../utils/themeProps.js";
|
|
25
26
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
26
27
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -90,8 +91,6 @@ const styles = {
|
|
|
90
91
|
k87sOh: "xwa60dl",
|
|
91
92
|
kzqmXN: "x63cpjl",
|
|
92
93
|
kZKoxP: "xhovv34",
|
|
93
|
-
kI3sdo: "x1a2a7pz x17nn4n9",
|
|
94
|
-
kInvED: "x1wfwxd8 x7s97pk",
|
|
95
94
|
k3aq6I: "x11lhmoz xoffwj3",
|
|
96
95
|
$$css: true
|
|
97
96
|
}
|
|
@@ -366,7 +365,7 @@ export function ProgressBar({
|
|
|
366
365
|
...mergeProps(themeProps('progressbar-mark', {
|
|
367
366
|
variant: fillVariant,
|
|
368
367
|
placement: mark.isOnFill ? 'fill' : 'track'
|
|
369
|
-
}), stylex.props(styles.mark, mark.isOnFill ? markOnFillStyles[fillVariant] : isDisabled ? markOnTrackStyles.trackDisabled : markOnTrackStyles.track)),
|
|
368
|
+
}), stylex.props(focusOutlineStyles.focusVisible, styles.mark, mark.isOnFill ? markOnFillStyles[fillVariant] : isDisabled ? markOnTrackStyles.trackDisabled : markOnTrackStyles.track)),
|
|
370
369
|
style: {
|
|
371
370
|
insetInlineStart: `${mark.pct}%`
|
|
372
371
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../../src/Section/Section.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../../src/Section/Section.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAGrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAY5C,OAAO,KAAK,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG3D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC;AAiFrD,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC1D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IAElD;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAmB,EACnB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,YAAY,+BA0Ed;yBAzFe,OAAO"}
|
package/dist/Section/Section.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* @file Section.tsx
|
|
7
5
|
* @input Uses container utility, StyleX
|
|
@@ -14,6 +12,7 @@
|
|
|
14
12
|
* - /apps/storybook/stories/Section.stories.tsx (storybook stories)
|
|
15
13
|
* - /packages/cli/assets/templates/blocks/components/Section/ (showcase blocks)
|
|
16
14
|
*/
|
|
15
|
+
|
|
17
16
|
import * as stylex from '@stylexjs/stylex';
|
|
18
17
|
import "../theme/tokens.stylex.js";
|
|
19
18
|
import { colorVars } from "../theme/tokens.stylex.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Section/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Section/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,IAAI,CAAC;IACd,WAAW,EAAE,IAAI,CAAC;IAClB,KAAK,EAAE,IAAI,CAAC;CACb;AAED,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,YAAY,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC"}
|
package/dist/Section/index.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import React, { type ReactNode } from 'react';
|
|
16
16
|
import { type IconType } from '../Icon';
|
|
17
|
+
import type { IndicatorPosition } from '../Indicator';
|
|
17
18
|
import { type FieldStatusVariant } from '../Field';
|
|
18
19
|
import type { LayerPlacement } from '../Layer/useLayer';
|
|
19
20
|
import type { SelectorOptionType, SelectorOptionData } from './types';
|
|
@@ -144,6 +145,15 @@ interface SelectorPropsBase<T extends SelectorOptionType = SelectorOptionType> e
|
|
|
144
145
|
* Only called for selectable options (not dividers/sections).
|
|
145
146
|
*/
|
|
146
147
|
renderOption?: (option: SelectorOptionData) => ReactNode;
|
|
148
|
+
/**
|
|
149
|
+
* Which edge of the option row carries the selected mark. `start` reserves a
|
|
150
|
+
* mark column ahead of every label so they stay aligned, the way a native
|
|
151
|
+
* menu does; `end` is the house convention shared with Typeahead and
|
|
152
|
+
* CommandPalette.
|
|
153
|
+
*
|
|
154
|
+
* @default 'end'
|
|
155
|
+
*/
|
|
156
|
+
indicatorPosition?: IndicatorPosition;
|
|
147
157
|
/**
|
|
148
158
|
* Whether to show a search input for filtering options.
|
|
149
159
|
* @default false
|