@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Selector.d.ts","sourceRoot":"","sources":["../../src/Selector/Selector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO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,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,KAAK,yBAAyB,CAC5B,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IAC/C,iBAAiB,CAAC,CAAC,CAAC,GAAG;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD,CAAC;AAEF,KAAK,sBAAsB,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IAC3E,iBAAiB,CAAC,CAAC,CAAC,GAAG;IACrB;;;;;OAKG;IACH,QAAQ,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC;AAEJ,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IACzE,yBAAyB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC;AAwC3D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,kBAAkB,EACnD,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,qBAo1BxB;yBAr1Be,QAAQ"}
|
|
@@ -26,7 +26,7 @@ import { Field, InputClearButton, inputStatusBorderStyles, inputStatusHoverShado
|
|
|
26
26
|
import { Divider } from "../Divider/index.js";
|
|
27
27
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
28
28
|
import { Spinner } from "../Spinner/index.js";
|
|
29
|
-
import {
|
|
29
|
+
import { PanelSearchInput } from "../Field/PanelSearchInput.js";
|
|
30
30
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
31
31
|
import "../theme/tokens.stylex.js";
|
|
32
32
|
import { colorVars, sizeVars, spacingVars, radiusVars, durationVars, easeVars, typographyVars, fontWeightVars, typeScaleVars, borderVars } from "../theme/tokens.stylex.js";
|
|
@@ -37,12 +37,13 @@ import { SelectorOption } from "./SelectorOption.js";
|
|
|
37
37
|
import { getInputARIA, mergeProps } from "../utils/index.js";
|
|
38
38
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
39
39
|
import { themeProps } from "../utils/themeProps.js";
|
|
40
|
+
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
40
41
|
import { stableClassName } from "../naming.js";
|
|
41
42
|
import { groupStyles } from "../InputGroup/groupStyles.js";
|
|
42
43
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
43
44
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
44
45
|
import { useTranslator } from "../i18n/index.js";
|
|
45
|
-
import { jsx as _jsx,
|
|
46
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
46
47
|
const styles = {
|
|
47
48
|
triggerContainer: {
|
|
48
49
|
kVAEAm: "x1n2onr6",
|
|
@@ -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,12 +96,26 @@ const styles = {
|
|
|
97
96
|
k3aq6I: "x1c071of x1pdlv7q",
|
|
98
97
|
$$css: true
|
|
99
98
|
},
|
|
100
|
-
|
|
101
|
-
|
|
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",
|
|
102
111
|
$$css: true
|
|
103
112
|
},
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
searchRowInput: {
|
|
114
|
+
kg3NbH: "x2hg6jq",
|
|
115
|
+
$$css: true
|
|
116
|
+
},
|
|
117
|
+
popover: {
|
|
118
|
+
k7Eaqz: "xrzjruh",
|
|
106
119
|
$$css: true
|
|
107
120
|
},
|
|
108
121
|
divider: {
|
|
@@ -268,6 +281,7 @@ export function Selector(props) {
|
|
|
268
281
|
startIcon,
|
|
269
282
|
htmlName,
|
|
270
283
|
renderOption,
|
|
284
|
+
indicatorPosition = 'end',
|
|
271
285
|
hasSearch = false,
|
|
272
286
|
searchPlaceholder: searchPlaceholderFromProps,
|
|
273
287
|
placement,
|
|
@@ -301,7 +315,7 @@ export function Selector(props) {
|
|
|
301
315
|
const searchRef = useRef(null);
|
|
302
316
|
const inputGroup = useInputGroup();
|
|
303
317
|
const [searchQuery, setSearchQuery] = useState('');
|
|
304
|
-
// A typed query shows
|
|
318
|
+
// A typed query shows the search row's clear (✕) button, which becomes
|
|
305
319
|
// the next tab stop after the search input.
|
|
306
320
|
const hasQuery = searchQuery.length > 0;
|
|
307
321
|
const [, startTransition] = useTransition();
|
|
@@ -369,7 +383,10 @@ export function Selector(props) {
|
|
|
369
383
|
hasAutoFocus: false,
|
|
370
384
|
// The popup's own role="listbox" is the exposed semantics; the trigger
|
|
371
385
|
// keeps DOM focus, so wrapping it in a modal dialog would misrepresent it.
|
|
372
|
-
role: 'none'
|
|
386
|
+
role: 'none',
|
|
387
|
+
// The theme target belongs on the SURFACE that paints the popup, which
|
|
388
|
+
// `usePopover` owns — not on the scrolling list inside it.
|
|
389
|
+
surfaceTarget: 'selector-popup'
|
|
373
390
|
});
|
|
374
391
|
|
|
375
392
|
// Open dropdown on mount when isDefaultOpen is true
|
|
@@ -541,13 +558,39 @@ export function Selector(props) {
|
|
|
541
558
|
if (!hasSearch) {
|
|
542
559
|
return null;
|
|
543
560
|
}
|
|
544
|
-
return /*#__PURE__*/_jsx(
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
561
|
+
return /*#__PURE__*/_jsx(PanelSearchInput, {
|
|
562
|
+
ref: searchRef,
|
|
563
|
+
id: searchId
|
|
564
|
+
// The search row is the panel's header: a magnifier, a borderless
|
|
565
|
+
// input, and the shared clear (✕) button. It deliberately does NOT
|
|
566
|
+
// render a bordered TextInput — the popup is already a bordered
|
|
567
|
+
// surface, and a field inside it drew a second box within that box.
|
|
568
|
+
,
|
|
569
|
+
label: t('@astryx.selector.searchOptions')
|
|
570
|
+
// Same accessible name the TextInput's built-in clear produced
|
|
571
|
+
// ("Clear Search options"), so the affordance keeps its name while its
|
|
572
|
+
// chrome changes.
|
|
573
|
+
,
|
|
574
|
+
clearLabel: t('@astryx.textInput.clearLabel', {
|
|
575
|
+
label: t('@astryx.selector.searchOptions')
|
|
576
|
+
}),
|
|
577
|
+
...themeProps('selector-search'),
|
|
578
|
+
xstyle: variant !== 'ghost' && styles.searchRowInput
|
|
579
|
+
// When hasSearch is set, focus moves into this input on open, so it —
|
|
580
|
+
// not the trigger — must be the combobox that reports the highlighted
|
|
581
|
+
// option via aria-activedescendant (comboboxes-4). A bare searchbox
|
|
582
|
+
// left the highlight silent to screen readers.
|
|
583
|
+
,
|
|
584
|
+
role: "combobox",
|
|
585
|
+
"aria-expanded": popover.isOpen,
|
|
586
|
+
"aria-controls": listboxId,
|
|
587
|
+
"aria-autocomplete": "list",
|
|
588
|
+
"aria-activedescendant": popover.isOpen && highlightedIndex >= 0 ? getItemId(highlightedIndex) : undefined,
|
|
589
|
+
value: searchQuery,
|
|
590
|
+
onValueChange: handleSearchChange,
|
|
591
|
+
onContainerKeyDown: e => {
|
|
592
|
+
// The clear (✕) button lives inside the row, after the input in DOM
|
|
593
|
+
// order. When it is focused and the user tabs forward there is
|
|
551
594
|
// nothing else in the popup, so dismiss it (Shift+Tab returns to the
|
|
552
595
|
// input natively). Key events originating on the input are handled on
|
|
553
596
|
// the input below; ignore them here so we don't double-dismiss.
|
|
@@ -558,57 +601,25 @@ export function Selector(props) {
|
|
|
558
601
|
onKeyDown(e);
|
|
559
602
|
}
|
|
560
603
|
},
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
//
|
|
565
|
-
//
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
width: "100%"
|
|
579
|
-
// When hasSearch is set, focus moves into this input on open, so it —
|
|
580
|
-
// not the trigger — must be the combobox that reports the highlighted
|
|
581
|
-
// option via aria-activedescendant (comboboxes-4). A bare searchbox
|
|
582
|
-
// left the highlight silent to screen readers. role + aria-* pass
|
|
583
|
-
// through to the underlying <input> via BaseProps.
|
|
584
|
-
,
|
|
585
|
-
role: "combobox",
|
|
586
|
-
"aria-expanded": popover.isOpen,
|
|
587
|
-
"aria-controls": listboxId,
|
|
588
|
-
"aria-autocomplete": "list",
|
|
589
|
-
"aria-activedescendant": popover.isOpen && highlightedIndex >= 0 ? getItemId(highlightedIndex) : undefined,
|
|
590
|
-
value: searchQuery,
|
|
591
|
-
onChange: handleSearchChange,
|
|
592
|
-
onKeyDown: e => {
|
|
593
|
-
// Arrow keys navigate options; Enter selects; Escape closes.
|
|
594
|
-
// Home/End are left to the input for caret movement (APG editable
|
|
595
|
-
// combobox); PageUp/PageDown are the sanctioned substitute for
|
|
596
|
-
// jumping to the first/last option.
|
|
597
|
-
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'PageUp' || e.key === 'PageDown' || e.key === 'Enter' || e.key === 'Escape') {
|
|
598
|
-
onKeyDown(e);
|
|
599
|
-
return;
|
|
600
|
-
}
|
|
601
|
-
// Tab: when a query is showing the clear (✕) button, forward-tab
|
|
602
|
-
// moves focus to it (keeping the popup open) so the affordance is
|
|
603
|
-
// keyboard-reachable. Every other Tab dismisses the popup as usual.
|
|
604
|
-
if (e.key === 'Tab' && (e.shiftKey || !hasQuery)) {
|
|
605
|
-
onKeyDown(e);
|
|
606
|
-
}
|
|
607
|
-
},
|
|
608
|
-
placeholder: searchPlaceholder
|
|
609
|
-
})
|
|
604
|
+
onKeyDown: e => {
|
|
605
|
+
// Arrow keys navigate options; Enter selects; Escape closes.
|
|
606
|
+
// Home/End are left to the input for caret movement (APG editable
|
|
607
|
+
// combobox); PageUp/PageDown are the sanctioned substitute for
|
|
608
|
+
// jumping to the first/last option.
|
|
609
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'PageUp' || e.key === 'PageDown' || e.key === 'Enter' || e.key === 'Escape') {
|
|
610
|
+
onKeyDown(e);
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
// Tab: when a query is showing the clear (✕) button, forward-tab
|
|
614
|
+
// moves focus to it (keeping the popup open) so the affordance is
|
|
615
|
+
// keyboard-reachable. Every other Tab dismisses the popup as usual.
|
|
616
|
+
if (e.key === 'Tab' && (e.shiftKey || !hasQuery)) {
|
|
617
|
+
onKeyDown(e);
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
placeholder: searchPlaceholder
|
|
610
621
|
});
|
|
611
|
-
}, [hasSearch, searchId, listboxId, searchQuery, hasQuery, searchPlaceholder, handleSearchChange, onKeyDown, popover.isOpen, highlightedIndex, getItemId, t]);
|
|
622
|
+
}, [hasSearch, searchId, listboxId, searchQuery, hasQuery, searchPlaceholder, handleSearchChange, onKeyDown, popover.isOpen, highlightedIndex, getItemId, variant, t]);
|
|
612
623
|
|
|
613
624
|
// The single-selection mark, resolved from the theme once per render. A
|
|
614
625
|
// theme that maps `check` to another indicator (a radio, say) changes every
|
|
@@ -619,7 +630,41 @@ export function Selector(props) {
|
|
|
619
630
|
const renderItem = useCallback((item, flatIndex) => {
|
|
620
631
|
const isHighlighted = flatIndex === highlightedIndex;
|
|
621
632
|
const isSelected = item.value === normalizedValue;
|
|
622
|
-
|
|
633
|
+
|
|
634
|
+
/*
|
|
635
|
+
* Rendered UNCONDITIONALLY, with the state passed down: the default
|
|
636
|
+
* check draws nothing when unchecked, but a theme that replaces the
|
|
637
|
+
* `check` indicator with a radio needs the unselected state to draw
|
|
638
|
+
* its empty circle. `{isSelected && …}` would make that impossible.
|
|
639
|
+
*
|
|
640
|
+
* `selector-check` stays the stable target for the mark's position
|
|
641
|
+
* in the row; the indicator owns what the mark looks like.
|
|
642
|
+
*/
|
|
643
|
+
const mark = /*#__PURE__*/_jsx("span", {
|
|
644
|
+
...{
|
|
645
|
+
className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s xgomdpo"
|
|
646
|
+
},
|
|
647
|
+
children: /*#__PURE__*/_jsx(SelectionMark, {
|
|
648
|
+
state: isSelected ? 'checked' : 'unchecked',
|
|
649
|
+
size: "sm",
|
|
650
|
+
isDisabled: item.disabled ?? false,
|
|
651
|
+
...themeProps('selector-check')
|
|
652
|
+
})
|
|
653
|
+
});
|
|
654
|
+
const optionContent = /*#__PURE__*/_jsx("span", {
|
|
655
|
+
...{
|
|
656
|
+
className: "x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli"
|
|
657
|
+
},
|
|
658
|
+
children: renderOption ? renderOption(item) : /*#__PURE__*/_jsx(DefaultOption, {
|
|
659
|
+
option: item
|
|
660
|
+
})
|
|
661
|
+
});
|
|
662
|
+
const content = indicatorPosition === 'start' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
663
|
+
children: [mark, optionContent]
|
|
664
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
665
|
+
children: [optionContent, mark]
|
|
666
|
+
});
|
|
667
|
+
return /*#__PURE__*/_jsx("div", {
|
|
623
668
|
id: getItemId(flatIndex),
|
|
624
669
|
role: "option",
|
|
625
670
|
"aria-selected": isSelected,
|
|
@@ -627,21 +672,9 @@ export function Selector(props) {
|
|
|
627
672
|
onClick: () => onItemSelect(item),
|
|
628
673
|
onMouseEnter: () => onItemMouseEnter(item, flatIndex),
|
|
629
674
|
...stylex.props(styles.item, itemSizeStyles[size], isHighlighted && styles.itemHighlighted, isSelected && styles.itemSelected, item.disabled && styles.itemDisabled),
|
|
630
|
-
children:
|
|
631
|
-
...{
|
|
632
|
-
className: "x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli"
|
|
633
|
-
},
|
|
634
|
-
children: renderOption ? renderOption(item) : /*#__PURE__*/_jsx(DefaultOption, {
|
|
635
|
-
option: item
|
|
636
|
-
})
|
|
637
|
-
}), /*#__PURE__*/_jsx(SelectionMark, {
|
|
638
|
-
state: isSelected ? 'checked' : 'unchecked',
|
|
639
|
-
size: "sm",
|
|
640
|
-
isDisabled: item.disabled ?? false,
|
|
641
|
-
...themeProps('selector-check')
|
|
642
|
-
})]
|
|
675
|
+
children: content
|
|
643
676
|
}, item.value);
|
|
644
|
-
}, [renderOption, highlightedIndex, size, normalizedValue, getItemId, onItemSelect, onItemMouseEnter, SelectionMark]);
|
|
677
|
+
}, [renderOption, indicatorPosition, highlightedIndex, size, normalizedValue, getItemId, onItemSelect, onItemMouseEnter, SelectionMark]);
|
|
645
678
|
|
|
646
679
|
// Render all options (handling sections/dividers)
|
|
647
680
|
const renderOptions = useCallback(() => {
|
|
@@ -689,16 +722,21 @@ export function Selector(props) {
|
|
|
689
722
|
if (sectionItems.length === 0) {
|
|
690
723
|
continue;
|
|
691
724
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
elements.push(/*#__PURE__*/_jsx("div", {
|
|
725
|
+
// The heading lives INSIDE the group and is aria-hidden: the group
|
|
726
|
+
// already carries the title as its accessible name, so exposing the
|
|
727
|
+
// text again would announce it twice. This also keeps role="listbox"'s
|
|
728
|
+
// children to option/group only — the old labeled Divider sat in the
|
|
729
|
+
// listbox as a stray role="separator".
|
|
730
|
+
elements.push(/*#__PURE__*/_jsxs("div", {
|
|
699
731
|
role: "group",
|
|
700
732
|
"aria-label": option.title,
|
|
701
|
-
children:
|
|
733
|
+
children: [option.title && /*#__PURE__*/_jsx("div", {
|
|
734
|
+
"aria-hidden": "true",
|
|
735
|
+
...mergeProps(themeProps('selector-section-heading'), {
|
|
736
|
+
className: "xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o"
|
|
737
|
+
}),
|
|
738
|
+
children: option.title
|
|
739
|
+
}), sectionItems]
|
|
702
740
|
}, `section-${i}`));
|
|
703
741
|
} else if (isOptionData(option)) {
|
|
704
742
|
const normalized = normalizeOption(option);
|
|
@@ -733,7 +771,7 @@ export function Selector(props) {
|
|
|
733
771
|
size,
|
|
734
772
|
status: status?.type ?? null,
|
|
735
773
|
disabled: isDisabled ? 'disabled' : null
|
|
736
|
-
}), stylex.props(inputWrapperStyles.base, styles.triggerContainer, sizeStyles[size], variant === 'ghost' && styles.triggerGhost, isDisabled && inputWrapperStyles.disabled, variant === 'ghost' && isDisabled && styles.triggerGhostDisabled, !selectedItem && styles.triggerPlaceholder, variant !== 'ghost' && status && inputStatusBorderStyles[status.type], variant !== 'ghost' && status && !isDisabled && inputStatusHoverShadowStyles[status.type], variant !== 'ghost' && inputGroup && groupStyles.inGroup, xstyle), className, style),
|
|
774
|
+
}), stylex.props(inputWrapperStyles.base, styles.triggerContainer, sizeStyles[size], variant === 'ghost' && styles.triggerGhost, variant === 'ghost' && focusOutlineStyles.focusWithin, isDisabled && inputWrapperStyles.disabled, variant === 'ghost' && isDisabled && styles.triggerGhostDisabled, !selectedItem && styles.triggerPlaceholder, variant !== 'ghost' && status && inputStatusBorderStyles[status.type], variant !== 'ghost' && status && !isDisabled && inputStatusHoverShadowStyles[status.type], variant !== 'ghost' && inputGroup && groupStyles.inGroup, xstyle), className, style),
|
|
737
775
|
children: [startIcon && renderIconSlot(startIcon, {
|
|
738
776
|
size: 'sm',
|
|
739
777
|
color: 'secondary'
|
|
@@ -798,9 +836,7 @@ export function Selector(props) {
|
|
|
798
836
|
"aria-label": t(STATUS_BUTTON_LABEL_KEY[status.type]),
|
|
799
837
|
"aria-describedby": statusTooltip.describedBy,
|
|
800
838
|
onClick: e => e.stopPropagation(),
|
|
801
|
-
...
|
|
802
|
-
className: "x78zum5 x6s0dn4 xl56j7k x1717udv x1ghz6dp xc342km xng3xce xjbqb8w x1heor9g x1ypdohk xh6dtrn x1a2a7pz x1p25gnr x1y3gkto"
|
|
803
|
-
},
|
|
839
|
+
...stylex.props(focusOutlineStyles.focusVisible, styles.statusButton),
|
|
804
840
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
805
841
|
icon: STATUS_ICON_MAP[status.type],
|
|
806
842
|
size: "sm",
|
|
@@ -832,7 +868,7 @@ export function Selector(props) {
|
|
|
832
868
|
})
|
|
833
869
|
})]
|
|
834
870
|
}), popover.render(hasSearch ? /*#__PURE__*/_jsxs("div", {
|
|
835
|
-
children: [renderSearch(), /*#__PURE__*/_jsx("div", {
|
|
871
|
+
children: [renderSearch(), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx("div", {
|
|
836
872
|
ref: listboxRef,
|
|
837
873
|
id: listboxId,
|
|
838
874
|
role: "listbox",
|
|
@@ -870,6 +906,10 @@ export function Selector(props) {
|
|
|
870
906
|
}), {
|
|
871
907
|
placement: popoverPlacement,
|
|
872
908
|
alignment: 'start',
|
|
909
|
+
// The system's standard menu clearance, except in overlay mode:
|
|
910
|
+
// there the measured negative margin owns the block geometry and
|
|
911
|
+
// the menu is meant to sit on the trigger, not clear it.
|
|
912
|
+
offset: shouldOverlaySelectedItem ? undefined : spacingVars['--spacing-1'],
|
|
873
913
|
xstyle: [styles.popover, layerAnimations[popoverPlacement]],
|
|
874
914
|
style: popoverOffsetStyle
|
|
875
915
|
}), showStatusTooltip && statusTooltip.renderTooltip(status?.message ?? ''), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { type ReactNode } from 'react';
|
|
20
20
|
import type { BaseProps } from '../BaseProps';
|
|
21
21
|
import type { StyleXStyles } from '@stylexjs/stylex';
|
|
22
|
-
import { type SideNavImperativeCollapseHandle } from './SideNavCollapseContext';
|
|
22
|
+
import { type SideNavCollapsibleConfig, type SideNavImperativeCollapseHandle } from './SideNavCollapseContext';
|
|
23
23
|
import type { ResizableConfig } from '../Resizable/useResizable';
|
|
24
24
|
export interface SideNavProps extends BaseProps<HTMLElement> {
|
|
25
25
|
/** Ref forwarded to the root element */
|
|
@@ -28,6 +28,9 @@ export interface SideNavProps extends BaseProps<HTMLElement> {
|
|
|
28
28
|
* Imperative collapse handle for SideNavCollapseButton instances rendered
|
|
29
29
|
* outside this SideNav. This intentionally stays separate from `ref`, which
|
|
30
30
|
* continues to expose the root HTMLElement.
|
|
31
|
+
*
|
|
32
|
+
* @deprecated Hand the same controlled `collapsible` config to SideNav and
|
|
33
|
+
* to the outside button instead.
|
|
31
34
|
*/
|
|
32
35
|
handleRef?: React.Ref<SideNavImperativeCollapseHandle>;
|
|
33
36
|
/**
|
|
@@ -98,19 +101,14 @@ export interface SideNavProps extends BaseProps<HTMLElement> {
|
|
|
98
101
|
* - `true` — enables collapse with default toggle button and uncontrolled state
|
|
99
102
|
* - Object — enables collapse with advanced configuration:
|
|
100
103
|
* - `defaultIsCollapsed` — start collapsed (uncontrolled)
|
|
101
|
-
* - `isCollapsed` + `onCollapsedChange` — controlled mode
|
|
104
|
+
* - `isCollapsed` + `onCollapsedChange` — controlled mode. Pass the same
|
|
105
|
+
* object to a `SideNavCollapseButton` rendered outside this SideNav
|
|
102
106
|
* - `hasButton` — render built-in collapse button (default: true)
|
|
103
107
|
* - `buttonLabel` — accessibility label for the collapse button
|
|
104
108
|
*
|
|
105
109
|
* @default false
|
|
106
110
|
*/
|
|
107
|
-
collapsible?: boolean |
|
|
108
|
-
defaultIsCollapsed?: boolean;
|
|
109
|
-
isCollapsed?: boolean;
|
|
110
|
-
onCollapsedChange?: (isCollapsed: boolean) => void;
|
|
111
|
-
hasButton?: boolean;
|
|
112
|
-
buttonLabel?: string;
|
|
113
|
-
};
|
|
111
|
+
collapsible?: boolean | SideNavCollapsibleConfig;
|
|
114
112
|
}
|
|
115
113
|
/**
|
|
116
114
|
* Sidebar navigation container for application pages.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNav.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNav.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAGL,KAAK,+BAA+B,EACrC,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"SideNav.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNav.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAKL,KAAK,SAAS,EAC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mB,EACnB,SAAiB,EACjB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,SAAS,EACT,GAAG,KAAK,EACT,EAAE,YAAY,+BAiRd;yBAhSe,OAAO"}
|
package/dist/SideNav/SideNav.js
CHANGED
|
@@ -32,6 +32,7 @@ import { MobileNav } from "../MobileNav/MobileNav.js";
|
|
|
32
32
|
import { useResizable } from "../Resizable/useResizable.js";
|
|
33
33
|
import { ResizeHandle } from "../Resizable/ResizeHandle.js";
|
|
34
34
|
import { themeProps } from "../utils/themeProps.js";
|
|
35
|
+
import { SizeProvider } from "../SizeContext/SizeContext.js";
|
|
35
36
|
import { useTranslator } from "../i18n/index.js";
|
|
36
37
|
|
|
37
38
|
// =============================================================================
|
|
@@ -75,6 +76,13 @@ const styles = {
|
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Cascaded to the icon rows through `SizeContext` so the built-in collapse
|
|
81
|
+
* button and the consumer's `footerIcons` come out one height. An explicit
|
|
82
|
+
* `size` on a child still wins.
|
|
83
|
+
*/
|
|
84
|
+
const FOOTER_ICON_SIZE = 'sm';
|
|
85
|
+
|
|
78
86
|
// =============================================================================
|
|
79
87
|
// Types
|
|
80
88
|
// =============================================================================
|
|
@@ -160,6 +168,9 @@ export function SideNav({
|
|
|
160
168
|
});
|
|
161
169
|
const toggle = useCallback(() => {
|
|
162
170
|
const next = !collapsed;
|
|
171
|
+
|
|
172
|
+
// Deprecated `handleRef` path only: an out-of-tree button reads this
|
|
173
|
+
// snapshot while rendering, which can happen before SideNav re-renders.
|
|
163
174
|
collapseStateRef.current = {
|
|
164
175
|
...collapseStateRef.current,
|
|
165
176
|
isCollapsed: next
|
|
@@ -204,7 +215,10 @@ export function SideNav({
|
|
|
204
215
|
...{
|
|
205
216
|
className: "x78zum5 x6s0dn4 xzye2dw xvc5jky"
|
|
206
217
|
},
|
|
207
|
-
children:
|
|
218
|
+
children: /*#__PURE__*/_jsx(SizeProvider, {
|
|
219
|
+
value: FOOTER_ICON_SIZE,
|
|
220
|
+
children: footerIcons
|
|
221
|
+
})
|
|
208
222
|
})]
|
|
209
223
|
});
|
|
210
224
|
}
|
|
@@ -217,6 +231,10 @@ export function SideNav({
|
|
|
217
231
|
return /*#__PURE__*/_jsxs(MobileNav, {
|
|
218
232
|
header: header,
|
|
219
233
|
"data-testid": testId,
|
|
234
|
+
xstyle: xstyle,
|
|
235
|
+
className: className,
|
|
236
|
+
style: style,
|
|
237
|
+
...props,
|
|
220
238
|
children: [topContent, children, hasDrawerFooter && /*#__PURE__*/_jsxs("div", {
|
|
221
239
|
...{
|
|
222
240
|
className: "x78zum5 xdt5ytf xr1yuqi x1txdalj x1xye8es"
|
|
@@ -225,7 +243,10 @@ export function SideNav({
|
|
|
225
243
|
...{
|
|
226
244
|
className: "x78zum5 x6s0dn4 xzye2dw"
|
|
227
245
|
},
|
|
228
|
-
children:
|
|
246
|
+
children: /*#__PURE__*/_jsx(SizeProvider, {
|
|
247
|
+
value: FOOTER_ICON_SIZE,
|
|
248
|
+
children: footerIcons
|
|
249
|
+
})
|
|
229
250
|
})]
|
|
230
251
|
})]
|
|
231
252
|
});
|
|
@@ -245,7 +266,10 @@ export function SideNav({
|
|
|
245
266
|
...{
|
|
246
267
|
className: "x78zum5 x6s0dn4 xzye2dw"
|
|
247
268
|
},
|
|
248
|
-
children:
|
|
269
|
+
children: /*#__PURE__*/_jsx(SizeProvider, {
|
|
270
|
+
value: FOOTER_ICON_SIZE,
|
|
271
|
+
children: footerIcons
|
|
272
|
+
})
|
|
249
273
|
})]
|
|
250
274
|
})]
|
|
251
275
|
});
|
|
@@ -323,7 +347,7 @@ export function SideNav({
|
|
|
323
347
|
className: "x78zum5 xdt5ytf x2lah0s xr1yuqi x7wzq59 x1ey2m1c xgcd1z6 x1txdalj xf314gf x1wesfrj xexx8yu x6s0dn4"
|
|
324
348
|
}
|
|
325
349
|
}[!!collapsed << 0],
|
|
326
|
-
children: [footer, /*#__PURE__*/
|
|
350
|
+
children: [footer, /*#__PURE__*/_jsx("div", {
|
|
327
351
|
...{
|
|
328
352
|
0: {
|
|
329
353
|
className: "x78zum5 x6s0dn4 xzye2dw"
|
|
@@ -332,7 +356,10 @@ export function SideNav({
|
|
|
332
356
|
className: "x78zum5 x6s0dn4 xzye2dw x3ieub6"
|
|
333
357
|
}
|
|
334
358
|
}[!!collapsed << 0],
|
|
335
|
-
children:
|
|
359
|
+
children: /*#__PURE__*/_jsxs(SizeProvider, {
|
|
360
|
+
value: FOOTER_ICON_SIZE,
|
|
361
|
+
children: [showCollapseButton && /*#__PURE__*/_jsx(SideNavCollapseButton, {}), footerIcons]
|
|
362
|
+
})
|
|
336
363
|
})]
|
|
337
364
|
})]
|
|
338
365
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @position Composable toggle button for sidenav collapse
|
|
6
6
|
*
|
|
7
7
|
* Place inside SideNav (reads context automatically) or outside
|
|
8
|
-
* (pass
|
|
8
|
+
* (pass the same controlled `collapsible` config both get).
|
|
9
9
|
*
|
|
10
10
|
* SYNC: When modified, update:
|
|
11
11
|
* - /packages/core/src/SideNav/SideNav.doc.mjs
|
|
@@ -14,12 +14,20 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import React, { type ReactNode } from 'react';
|
|
16
16
|
import type { BaseProps } from '../BaseProps';
|
|
17
|
-
import { type SideNavImperativeCollapseHandle } from './SideNavCollapseContext';
|
|
17
|
+
import { type SideNavControlledCollapsible, type SideNavImperativeCollapseHandle } from './SideNavCollapseContext';
|
|
18
|
+
import type { ElementSize } from '../SizeContext/SizeContext';
|
|
18
19
|
export interface SideNavCollapseButtonProps extends BaseProps<HTMLButtonElement> {
|
|
19
20
|
ref?: React.Ref<HTMLButtonElement>;
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
22
|
+
* The same controlled `collapsible` config given to SideNav
|
|
23
|
+
* (`{isCollapsed, onCollapsedChange}`). Needed only when the button is
|
|
24
|
+
* rendered outside the sidenav, where collapse context cannot reach it.
|
|
25
|
+
*/
|
|
26
|
+
collapsible?: SideNavControlledCollapsible;
|
|
27
|
+
/**
|
|
28
|
+
* Imperative handle from SideNav.
|
|
29
|
+
*
|
|
30
|
+
* @deprecated Pass `collapsible` instead.
|
|
23
31
|
*/
|
|
24
32
|
handleRef?: React.RefObject<SideNavImperativeCollapseHandle | null>;
|
|
25
33
|
/**
|
|
@@ -27,6 +35,12 @@ export interface SideNavCollapseButtonProps extends BaseProps<HTMLButtonElement>
|
|
|
27
35
|
* with the chevron icon. When omitted, renders as an icon-only button.
|
|
28
36
|
*/
|
|
29
37
|
label?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Button size. Defaults to the size its container cascades — `sm` in a
|
|
40
|
+
* SideNav footer — or `md` outside one. Set it for placements with no row
|
|
41
|
+
* to inherit from, e.g. a button placed in a `TopNav`.
|
|
42
|
+
*/
|
|
43
|
+
size?: ElementSize;
|
|
30
44
|
/**
|
|
31
45
|
* Custom button content. Overrides the default chevron icon and label.
|
|
32
46
|
*/
|
|
@@ -37,7 +51,8 @@ export interface SideNavCollapseButtonProps extends BaseProps<HTMLButtonElement>
|
|
|
37
51
|
*
|
|
38
52
|
* Place anywhere inside SideNav (header, topContent, footer, footerIcons)
|
|
39
53
|
* and it reads collapse state from context automatically. For placement
|
|
40
|
-
* outside the sidenav (e.g. in TopNav or content area),
|
|
54
|
+
* outside the sidenav (e.g. in TopNav or content area), hold the state and
|
|
55
|
+
* hand the same `collapsible` config to both.
|
|
41
56
|
*
|
|
42
57
|
* @example
|
|
43
58
|
* ```
|
|
@@ -48,12 +63,13 @@ export interface SideNavCollapseButtonProps extends BaseProps<HTMLButtonElement>
|
|
|
48
63
|
*
|
|
49
64
|
* @example
|
|
50
65
|
* ```
|
|
51
|
-
* const
|
|
52
|
-
*
|
|
53
|
-
* <
|
|
66
|
+
* const [isCollapsed, setIsCollapsed] = useState(false);
|
|
67
|
+
* const collapsible = {isCollapsed, onCollapsedChange: setIsCollapsed};
|
|
68
|
+
* <TopNav endContent={<SideNavCollapseButton collapsible={collapsible} />} />
|
|
69
|
+
* <SideNav collapsible={{...collapsible, hasButton: false}}>...</SideNav>
|
|
54
70
|
* ```
|
|
55
71
|
*/
|
|
56
|
-
export declare function SideNavCollapseButton({ ref, handleRef, label, children, onClick: onClickProp, ...props }: SideNavCollapseButtonProps): React.JSX.Element | null;
|
|
72
|
+
export declare function SideNavCollapseButton({ ref, collapsible, handleRef, label, size, children, onClick: onClickProp, ...props }: SideNavCollapseButtonProps): React.JSX.Element | null;
|
|
57
73
|
export declare namespace SideNavCollapseButton {
|
|
58
74
|
var displayName: string;
|
|
59
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavCollapseButton.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavCollapseButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"SideNavCollapseButton.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavCollapseButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAKzD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAGL,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACrC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAkC5D,MAAM,WAAW,0BAA2B,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC9E,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;;OAIG;IACH,WAAW,CAAC,EAAE,4BAA4B,CAAC;IAE3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,+BAA+B,GAAG,IAAI,CAAC,CAAC;IAEpE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,GAAG,EACH,WAAW,EACX,SAAS,EACT,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EAAE,WAAW,EACpB,GAAG,KAAK,EACT,EAAE,0BAA0B,4BAiD5B;yBA1De,qBAAqB"}
|