@astryxdesign/core 0.3.0-canary.e9fc2bb → 0.3.0-canary.ee705d8
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/dist/AlertDialog/AlertDialog.d.ts +10 -2
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +22 -3
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +2 -10
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +2 -3
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +11 -15
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +2 -1
- package/dist/Calendar/styles.d.ts +0 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +0 -2
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +2 -1
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +3 -1
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +4 -3
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +36 -125
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +3 -11
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +59 -55
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +2 -3
- package/dist/CommandPalette/CommandPaletteItem.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +6 -3
- package/dist/CommandPalette/CommandPaletteList.js +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +12 -8
- package/dist/ContextMenu/ContextMenu.js +1 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +4 -4
- package/dist/DropdownMenu/DropdownMenu.d.ts +5 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +46 -7
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +8 -11
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +32 -31
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +5 -5
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +24 -67
- package/dist/EmptyState/EmptyState.js +1 -1
- package/dist/Indicator/CheckIndicator.d.ts +26 -0
- package/dist/Indicator/CheckIndicator.d.ts.map +1 -0
- package/dist/Indicator/CheckIndicator.js +156 -0
- package/dist/Indicator/CheckboxIndicator.d.ts +22 -0
- package/dist/Indicator/CheckboxIndicator.d.ts.map +1 -0
- package/dist/Indicator/CheckboxIndicator.js +173 -0
- package/dist/Indicator/RadioIndicator.d.ts +23 -0
- package/dist/Indicator/RadioIndicator.d.ts.map +1 -0
- package/dist/Indicator/RadioIndicator.js +137 -0
- package/dist/Indicator/index.d.ts +24 -0
- package/dist/Indicator/index.d.ts.map +1 -0
- package/dist/Indicator/index.js +26 -0
- package/dist/Indicator/indicator.markers.stylex.d.ts +16 -0
- package/dist/Indicator/indicator.markers.stylex.d.ts.map +1 -0
- package/dist/Indicator/indicator.markers.stylex.js +21 -0
- package/dist/Indicator/indicatorRegistry.d.ts +71 -0
- package/dist/Indicator/indicatorRegistry.d.ts.map +1 -0
- package/dist/Indicator/indicatorRegistry.js +93 -0
- package/dist/Indicator/types.d.ts +160 -0
- package/dist/Indicator/types.d.ts.map +1 -0
- package/dist/Indicator/types.js +1 -0
- package/dist/Indicator/useIndicator.d.ts +18 -0
- package/dist/Indicator/useIndicator.d.ts.map +1 -0
- package/dist/Indicator/useIndicator.js +30 -0
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +2 -6
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +4 -5
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +20 -9
- package/dist/NumberInput/NumberInput.d.ts +10 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +7 -5
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +2 -3
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +30 -26
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +7 -0
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +29 -84
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +2 -3
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +2 -3
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +3 -11
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +85 -28
- package/dist/Selector/hooks.d.ts +14 -2
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +19 -21
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +1 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +1 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +1 -0
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -3
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +27 -11
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +8 -0
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +1 -1
- package/dist/Table/plugins/rowExpansion/index.d.ts +1 -1
- package/dist/Table/plugins/rowExpansion/index.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/index.js +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +41 -76
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +88 -333
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +23 -4
- package/dist/Table/tableContextMenu.d.ts.map +1 -1
- package/dist/Table/tableContextMenu.js +2 -1
- package/dist/Table/types.d.ts +11 -0
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/TextArea/TextArea.d.ts +10 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +12 -4
- package/dist/TextInput/TextInput.d.ts +10 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -4
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +32 -26
- package/dist/Timestamp/TimestampHoverCard.d.ts.map +1 -1
- package/dist/Timestamp/TimestampHoverCard.js +16 -34
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +20 -11
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +3 -9
- package/dist/TopNav/TopNavMegaMenu.d.ts +7 -0
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +94 -28
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +22 -3
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +43 -11
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +12 -10
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +14 -2
- package/dist/astryx.css +19 -27
- package/dist/astryx.umd.js +55 -55
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useClipboard.d.ts +59 -0
- package/dist/hooks/useClipboard.d.ts.map +1 -0
- package/dist/hooks/useClipboard.js +106 -0
- package/dist/hooks/useIndicatorFocusRing.d.ts +29 -0
- package/dist/hooks/useIndicatorFocusRing.d.ts.map +1 -0
- package/dist/hooks/useIndicatorFocusRing.js +97 -0
- package/dist/hooks/useStreamingText.d.ts +18 -3
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +47 -7
- package/dist/hooks/useTreeFocus.d.ts.map +1 -1
- package/dist/hooks/useTreeFocus.js +9 -3
- package/dist/hooks/useTypeahead.d.ts +3 -2
- package/dist/hooks/useTypeahead.d.ts.map +1 -1
- package/dist/hooks/useTypeahead.js +19 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/theme/defineTheme.d.ts +16 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +8 -0
- package/dist/theme/expandTypeScale.d.ts.map +1 -1
- package/dist/theme/expandTypeScale.js +17 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.d.ts +107 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -0
- package/dist/utils/focusOutline.stylex.js +130 -0
- package/dist/utils/themeProps.d.ts +20 -1
- package/dist/utils/themeProps.d.ts.map +1 -1
- package/dist/utils/themeProps.js +8 -2
- package/package.json +7 -2
- package/src/AlertDialog/AlertDialog.doc.mjs +16 -3
- package/src/AlertDialog/AlertDialog.test.tsx +208 -1
- package/src/AlertDialog/AlertDialog.tsx +21 -3
- package/src/Avatar/Avatar.tsx +2 -28
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +2 -9
- package/src/Button/Button.tsx +21 -41
- package/src/Calendar/Calendar.tsx +2 -1
- package/src/Calendar/styles.ts +0 -8
- package/src/Chat/Chat.doc.mjs +2 -0
- package/src/Chat/ChatDictationButton.tsx +7 -1
- package/src/Chat/ChatLayoutScrollButton.test.tsx +22 -0
- package/src/Chat/ChatLayoutScrollButton.tsx +8 -1
- package/src/Chat/ChatSendButton.tsx +2 -3
- package/src/Chat/ChatToolCalls.test.tsx +35 -0
- package/src/Chat/ChatToolCalls.tsx +12 -0
- package/src/CheckboxInput/CheckboxInput.doc.mjs +4 -2
- package/src/CheckboxInput/CheckboxInput.test.tsx +115 -0
- package/src/CheckboxInput/CheckboxInput.tsx +45 -202
- package/src/ClickableCard/ClickableCard.tsx +6 -11
- package/src/CodeBlock/CodeBlock.doc.mjs +1 -0
- package/src/CodeBlock/CodeBlock.test.tsx +24 -0
- package/src/CodeBlock/CodeBlock.tsx +32 -70
- package/src/Collapsible/Collapsible.tsx +2 -9
- package/src/CommandPalette/CommandPalette.test.tsx +29 -0
- package/src/CommandPalette/CommandPaletteItem.tsx +7 -4
- package/src/CommandPalette/CommandPaletteList.tsx +2 -2
- package/src/ComplexSelector/ComplexSelector.test.tsx +25 -0
- package/src/ComplexSelector/ComplexSelector.tsx +17 -9
- package/src/ContextMenu/ContextMenu.tsx +1 -1
- package/src/DateInput/DateInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateTimeInput/DateTimeInput.doc.mjs +1 -1
- package/src/Dialog/Dialog.tsx +2 -9
- package/src/DropdownMenu/DropdownMenu.doc.mjs +0 -5
- package/src/DropdownMenu/DropdownMenu.test.tsx +214 -4
- package/src/DropdownMenu/DropdownMenu.tsx +74 -30
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +27 -30
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +30 -76
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +25 -19
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +44 -14
- package/src/EmptyState/EmptyState.tsx +2 -2
- package/src/Indicator/CheckIndicator.tsx +175 -0
- package/src/Indicator/CheckboxIndicator.tsx +257 -0
- package/src/Indicator/Indicator.doc.mjs +287 -0
- package/src/Indicator/Indicator.test.tsx +369 -0
- package/src/Indicator/RadioIndicator.tsx +206 -0
- package/src/Indicator/index.ts +45 -0
- package/src/Indicator/indicator.markers.stylex.ts +19 -0
- package/src/Indicator/indicatorRegistry.test.tsx +106 -0
- package/src/Indicator/indicatorRegistry.ts +120 -0
- package/src/Indicator/types.ts +179 -0
- package/src/Indicator/useIndicator.ts +39 -0
- package/src/Item/Item.tsx +2 -12
- package/src/Link/Link.tsx +4 -11
- package/src/MoreMenu/MoreMenu.test.tsx +28 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +6 -0
- package/src/MultiSelector/MultiSelector.test.tsx +172 -0
- package/src/MultiSelector/MultiSelector.tsx +67 -54
- package/src/NumberInput/NumberInput.doc.mjs +18 -2
- package/src/NumberInput/NumberInput.test.tsx +112 -0
- package/src/NumberInput/NumberInput.tsx +15 -4
- package/src/Outline/Outline.tsx +2 -5
- package/src/Pagination/Pagination.tsx +2 -9
- package/src/PowerSearch/PowerSearchEditPopover.test.tsx +42 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +7 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +1 -1
- package/src/RadioList/RadioList.doc.mjs +4 -2
- package/src/RadioList/RadioListItem.tsx +31 -130
- package/src/Resizable/ResizeHandle.tsx +2 -9
- package/src/SegmentedControl/SegmentedControlItem.tsx +2 -9
- package/src/SelectableCard/SelectableCard.tsx +4 -9
- package/src/Selector/Selector.doc.mjs +4 -3
- package/src/Selector/Selector.test.tsx +650 -4
- package/src/Selector/Selector.tsx +140 -68
- package/src/Selector/hooks.ts +32 -29
- package/src/SideNav/SideNav.test.tsx +46 -0
- package/src/SideNav/SideNav.tsx +1 -0
- package/src/SideNav/SideNavHeading.tsx +5 -1
- package/src/Switch/Switch.test.tsx +32 -0
- package/src/Switch/Switch.tsx +1 -0
- package/src/TabList/Tab.tsx +2 -9
- package/src/TabList/TabMenu.tsx +3 -14
- package/src/Table/BaseTable.tsx +11 -0
- package/src/Table/index.ts +1 -4
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +1 -1
- package/src/Table/plugins/rowExpansion/index.ts +1 -4
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +125 -175
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +112 -474
- package/src/Table/plugins/sortable/useTableSortable.tsx +2 -6
- package/src/Table/tableContextMenu.test.tsx +27 -0
- package/src/Table/tableContextMenu.tsx +1 -0
- package/src/Table/types.ts +11 -0
- package/src/Table/useTableGroupedRows.doc.mjs +1 -1
- package/src/Table/useTableRowExpansion.doc.mjs +43 -66
- package/src/TextArea/TextArea.doc.mjs +18 -2
- package/src/TextArea/TextArea.test.tsx +145 -0
- package/src/TextArea/TextArea.tsx +20 -4
- package/src/TextInput/TextInput.doc.mjs +18 -2
- package/src/TextInput/TextInput.test.tsx +112 -0
- package/src/TextInput/TextInput.tsx +14 -3
- package/src/Thumbnail/Thumbnail.tsx +2 -9
- package/src/Timestamp/TimestampHoverCard.tsx +13 -35
- package/src/Token/Token.tsx +5 -28
- package/src/TopNav/TopNavItem.tsx +3 -21
- package/src/TopNav/TopNavMegaMenu.test.tsx +433 -33
- package/src/TopNav/TopNavMegaMenu.tsx +88 -33
- package/src/TopNav/TopNavMegaMenuItem.tsx +2 -9
- package/src/TopNav/TopNavMenu.tsx +6 -18
- package/src/TreeList/TreeList.test.tsx +7 -7
- package/src/TreeList/TreeListItem.tsx +18 -33
- package/src/Typeahead/BaseTypeahead.tsx +17 -1
- package/src/Typeahead/Typeahead.doc.mjs +1 -0
- package/src/Typeahead/Typeahead.test.tsx +76 -3
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useClipboard.doc.mjs +86 -0
- package/src/hooks/useClipboard.test.tsx +151 -0
- package/src/hooks/useClipboard.ts +135 -0
- package/src/hooks/useIndicatorFocusRing.tsx +121 -0
- package/src/hooks/useStreamingText.test.ts +46 -1
- package/src/hooks/useStreamingText.ts +49 -7
- package/src/hooks/useTreeFocus.test.tsx +50 -0
- package/src/hooks/useTreeFocus.ts +14 -3
- package/src/hooks/useTypeahead.test.tsx +150 -0
- package/src/hooks/useTypeahead.ts +24 -9
- package/src/i18n/InternationalizationProvider.doc.mjs +7 -2
- package/src/index.ts +1 -0
- package/src/theme/defineTheme.ts +24 -0
- package/src/theme/expandTypeScale.test.ts +43 -0
- package/src/theme/expandTypeScale.ts +17 -0
- package/src/theme/index.ts +13 -0
- package/src/utils/focusOutline.stylex.ts +163 -0
- package/src/utils/themeProps.ts +26 -4
- package/dist/CheckboxInput/checkbox.markers.stylex.d.ts +0 -9
- package/dist/CheckboxInput/checkbox.markers.stylex.d.ts.map +0 -1
- package/dist/CheckboxInput/checkbox.markers.stylex.js +0 -14
- package/dist/RadioList/radio.markers.stylex.d.ts +0 -7
- package/dist/RadioList/radio.markers.stylex.d.ts.map +0 -1
- package/dist/RadioList/radio.markers.stylex.js +0 -12
- package/src/CheckboxInput/checkbox.markers.stylex.ts +0 -12
- package/src/RadioList/radio.markers.stylex.ts +0 -10
|
@@ -337,9 +337,9 @@ export function ContextMenu({
|
|
|
337
337
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
338
338
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
339
339
|
ref: mergeRefs(ref, triggerRef),
|
|
340
|
+
...triggerProps,
|
|
340
341
|
onContextMenu: handleContextMenu,
|
|
341
342
|
...longPressHandlers,
|
|
342
|
-
...triggerProps,
|
|
343
343
|
"data-testid": testId,
|
|
344
344
|
...stylex.props(styles.trigger, ...(triggerXstyle ? Array.isArray(triggerXstyle) ? triggerXstyle : [triggerXstyle] : [])),
|
|
345
345
|
children: [children, /*#__PURE__*/_jsx("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAoB5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAoB5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAsB9C;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD,4EAA4E;AAC5E,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,mBAAmB;IACzD,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAuHD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,cAAc;;;;;EAUpE;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC/D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;IAE3C;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,QAAgB,EAChB,YAAY,EACZ,KAAW,EACX,SAAkB,EAClB,QAAQ,EACR,OAAoB,EACpB,OAAgB,EAChB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,sCA2Sb;yBA3Te,MAAM"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -27,12 +27,14 @@ import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
|
27
27
|
import { devWarn } from "../utils/devWarning.js";
|
|
28
28
|
import { DialogContext } from "./DialogContext.js";
|
|
29
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
30
|
-
import {
|
|
30
|
+
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
31
|
+
|
|
31
32
|
/**
|
|
32
33
|
* Calculate a directional translate offset for dialog entry animation.
|
|
33
34
|
* Returns a normalized vector from the trigger element toward the viewport
|
|
34
35
|
* center, scaled to the given distance.
|
|
35
36
|
*/
|
|
37
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
36
38
|
function getDialogDirection(triggerEl, distance = 16) {
|
|
37
39
|
const rect = triggerEl.getBoundingClientRect();
|
|
38
40
|
const dx = rect.left + rect.width / 2 - window.innerWidth / 2;
|
|
@@ -91,8 +93,6 @@ const styles = {
|
|
|
91
93
|
k44tkh: "xqgcaz",
|
|
92
94
|
kyAemX: "x128ha8g",
|
|
93
95
|
kWV6AL: "xskzprw",
|
|
94
|
-
kI3sdo: "x17nn4n9",
|
|
95
|
-
kInvED: "x1wfwxd8 x7s97pk",
|
|
96
96
|
$$css: true
|
|
97
97
|
},
|
|
98
98
|
open: {
|
|
@@ -447,7 +447,7 @@ export function Dialog({
|
|
|
447
447
|
...safeProps,
|
|
448
448
|
...mergeProps(themeProps('dialog', {
|
|
449
449
|
variant
|
|
450
|
-
}),
|
|
450
|
+
}), focusOutlineProps.focusVisible(styles.dialog, isOpen && styles.open, styles.backdrop, !isFullscreen && dynamicStyles.sizing(width, maxHeight), hasPosition && (() => {
|
|
451
451
|
const o = resolveDialogPositionOffsets(position);
|
|
452
452
|
return dynamicStyles.position(o.top, o.insetInlineStart, o.insetInlineEnd, o.bottom);
|
|
453
453
|
})(), isFullscreen && styles.fullscreen, xstyle), className, style),
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Both modes use useListFocus for DOM-based keyboard navigation.
|
|
12
12
|
*
|
|
13
|
+
* Initial focus on open follows the input modality: a keyboard open
|
|
14
|
+
* (Enter / Space / ArrowDown on the trigger) focuses the first enabled item
|
|
15
|
+
* (APG menu-button); a pointer open focuses the menu container itself so no
|
|
16
|
+
* item reads as pre-selected, and the first ArrowDown then moves to item 1.
|
|
17
|
+
*
|
|
13
18
|
* SYNC: When modified, update these files to stay in sync:
|
|
14
19
|
* - /packages/core/src/DropdownMenu/DropdownMenu.doc.mjs
|
|
15
20
|
* - /packages/core/src/DropdownMenu/DropdownMenu.test.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,WAAW,CAAC;AAInD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAa9D,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAQtE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAyC5C;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,qBAAqB,EACrB,MAAM,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAC9C;IACC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B;AAED,MAAM,MAAM,kBAAkB,GAC5B,oBAAoB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAMnE,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAEnE,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,qBAAsB,SAAQ,qBAAqB;IAC3D,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,yBAA0B,SAAQ,qBAAqB;IAC/D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAC3B,qBAAqB,GAAG,yBAAyB,CAAC;AA+BpD,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EAAE,eAAe,EACvB,UAAU,EAAE,gBAAgB,EAC5B,YAAY,EACZ,SAAS,EACT,OAAO,EACP,UAAiB,EACjB,SAAmB,EACnB,SAAmB,EACnB,SAAS,EACT,KAAK,EACL,MAAM,EACN,aAAa,EAAE,MAAM,EACrB,GAAG,KAAK,EACT,EAAE,iBAAiB,qBA+TnB;yBA7Ue,YAAY"}
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Both modes use useListFocus for DOM-based keyboard navigation.
|
|
16
16
|
*
|
|
17
|
+
* Initial focus on open follows the input modality: a keyboard open
|
|
18
|
+
* (Enter / Space / ArrowDown on the trigger) focuses the first enabled item
|
|
19
|
+
* (APG menu-button); a pointer open focuses the menu container itself so no
|
|
20
|
+
* item reads as pre-selected, and the first ArrowDown then moves to item 1.
|
|
21
|
+
*
|
|
17
22
|
* SYNC: When modified, update these files to stay in sync:
|
|
18
23
|
* - /packages/core/src/DropdownMenu/DropdownMenu.doc.mjs
|
|
19
24
|
* - /packages/core/src/DropdownMenu/DropdownMenu.test.tsx
|
|
@@ -179,6 +184,13 @@ export function DropdownMenu({
|
|
|
179
184
|
// Defer item focus until the layer has committed open, so focus restore
|
|
180
185
|
// captures the trigger instead of the first menu item.
|
|
181
186
|
const shouldFocusOnOpenRef = useRef(false);
|
|
187
|
+
|
|
188
|
+
// How the next open was initiated. Keyboard (and programmatic) opens focus
|
|
189
|
+
// the first enabled item per the APG menu-button pattern; pointer opens
|
|
190
|
+
// focus the menu container instead, so no item is visually highlighted as
|
|
191
|
+
// if pre-selected (#4477). Reset to 'keyboard' after every open so
|
|
192
|
+
// programmatic controlled opens keep the item-focus behavior.
|
|
193
|
+
const openModalityRef = useRef('keyboard');
|
|
182
194
|
const handleLayerShow = useCallback(() => {
|
|
183
195
|
onOpenChange?.(true);
|
|
184
196
|
if (!isControlled) {
|
|
@@ -238,14 +250,26 @@ export function DropdownMenu({
|
|
|
238
250
|
}
|
|
239
251
|
}, [controlledIsOpen, isControlled, popover]);
|
|
240
252
|
|
|
241
|
-
// Move focus into the menu only after the layer has committed open
|
|
253
|
+
// Move focus into the menu only after the layer has committed open,
|
|
254
|
+
// honoring the input modality: keyboard (and programmatic) opens land on
|
|
255
|
+
// the first enabled item per the APG menu-button pattern; pointer opens
|
|
256
|
+
// focus the menu container itself (tabIndex={-1}) so no item is
|
|
257
|
+
// highlighted as if pre-selected (#4477). Container focus keeps arrows,
|
|
258
|
+
// typeahead, Escape and Tab in the menu's onKeyDown, and is also the
|
|
259
|
+
// fallback when no item is focusable (e.g. all disabled), mirroring the
|
|
260
|
+
// submenu flyout fallback.
|
|
242
261
|
useEffect(() => {
|
|
243
262
|
if (!popover.isOpen || !shouldFocusOnOpenRef.current) {
|
|
244
263
|
return;
|
|
245
264
|
}
|
|
246
265
|
shouldFocusOnOpenRef.current = false;
|
|
247
|
-
requestAnimationFrame(() =>
|
|
248
|
-
|
|
266
|
+
requestAnimationFrame(() => {
|
|
267
|
+
if (openModalityRef.current === 'pointer' || !focusFirst()) {
|
|
268
|
+
listRef.current?.focus();
|
|
269
|
+
}
|
|
270
|
+
openModalityRef.current = 'keyboard';
|
|
271
|
+
});
|
|
272
|
+
}, [popover.isOpen, focusFirst, listRef]);
|
|
249
273
|
|
|
250
274
|
// Extend useListFocus with Enter/Space activation + typeahead
|
|
251
275
|
const listKeyDown = useCallback(e => {
|
|
@@ -278,25 +302,34 @@ export function DropdownMenu({
|
|
|
278
302
|
}
|
|
279
303
|
listNavKeyDown(e);
|
|
280
304
|
}, [listNavKeyDown, closeMenu, typeahead, ownsEvent]);
|
|
281
|
-
const openAndFocus = useCallback(() => {
|
|
305
|
+
const openAndFocus = useCallback((modality = 'keyboard') => {
|
|
306
|
+
openModalityRef.current = modality;
|
|
282
307
|
shouldFocusOnOpenRef.current = true;
|
|
283
308
|
popover.show();
|
|
284
309
|
}, [popover]);
|
|
285
|
-
const handleButtonClick = useCallback(
|
|
310
|
+
const handleButtonClick = useCallback(e => {
|
|
286
311
|
// If the menu was just closed by light dismiss (e.g. iOS Safari fires
|
|
287
312
|
// pointerdown → hide before the trigger's click), the click would
|
|
288
|
-
// otherwise immediately re-open it. Short-circuit within the guard
|
|
313
|
+
// otherwise immediately re-open it. Short-circuit within the guard
|
|
314
|
+
// window.
|
|
289
315
|
if (Date.now() - lastHideTimeRef.current < 50) {
|
|
290
316
|
return;
|
|
291
317
|
}
|
|
292
318
|
onClick?.();
|
|
319
|
+
// detail === 0 marks a synthesized click (screen reader / AT
|
|
320
|
+
// activation): treat it as keyboard so those users still land on the
|
|
321
|
+
// first item. Real pointer clicks report detail >= 1.
|
|
322
|
+
const modality = e.detail === 0 ? 'keyboard' : 'pointer';
|
|
293
323
|
if (isControlled) {
|
|
324
|
+
if (!controlledIsOpen) {
|
|
325
|
+
openModalityRef.current = modality;
|
|
326
|
+
}
|
|
294
327
|
onOpenChange?.(!controlledIsOpen);
|
|
295
328
|
} else {
|
|
296
329
|
if (popover.isOpen) {
|
|
297
330
|
popover.hide();
|
|
298
331
|
} else {
|
|
299
|
-
openAndFocus();
|
|
332
|
+
openAndFocus(modality);
|
|
300
333
|
}
|
|
301
334
|
}
|
|
302
335
|
}, [onClick, isControlled, onOpenChange, controlledIsOpen, popover, openAndFocus]);
|
|
@@ -356,6 +389,12 @@ export function DropdownMenu({
|
|
|
356
389
|
ref: listRef,
|
|
357
390
|
id: menuId,
|
|
358
391
|
role: "menu"
|
|
392
|
+
// Focus target for pointer opens (not in the Tab order): holding
|
|
393
|
+
// focus on the container keeps key events (arrows, typeahead,
|
|
394
|
+
// Escape, Tab) inside the menu without highlighting any item.
|
|
395
|
+
// Mirrors the DropdownMenuSubMenu flyout container.
|
|
396
|
+
,
|
|
397
|
+
tabIndex: -1
|
|
359
398
|
// Give the menu an accessible name from its trigger's label, so
|
|
360
399
|
// screen readers announce e.g. "Actions menu" rather than an unnamed
|
|
361
400
|
// menu (menus-13).
|
|
@@ -11,17 +11,14 @@
|
|
|
11
11
|
* Enter/Space activation come from the parent DropdownMenu's useListFocus +
|
|
12
12
|
* activation path, which matches menuitemcheckbox alongside plain menuitem rows.
|
|
13
13
|
*
|
|
14
|
-
* The checkbox visual
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* `sm` menu gets the compact control; `md`/`lg` get the standard one) and it
|
|
23
|
-
* swaps to the inline-end of the row on coarse-pointer (touch) devices via CSS
|
|
24
|
-
* `order`, so it lands where selection toggles are conventionally placed on
|
|
14
|
+
* The checkbox visual is the shared checkbox indicator, decorative
|
|
15
|
+
* (aria-hidden) — the row owns the role, checked state, and accessible name, so
|
|
16
|
+
* there is no nested native <input> to shim out of the accessibility tree. It
|
|
17
|
+
* picks up the same `checkbox` theming (and any theme replacement) as
|
|
18
|
+
* CheckboxInput. The control size is derived from the menu's item size (a `sm`
|
|
19
|
+
* menu gets the compact control; `md`/`lg` get the standard one) and the marker
|
|
20
|
+
* box swaps to the inline-end of the row on coarse-pointer (touch) devices via
|
|
21
|
+
* CSS `order`, so it lands where selection toggles are conventionally placed on
|
|
25
22
|
* mobile.
|
|
26
23
|
*/
|
|
27
24
|
import { type ReactNode } from 'react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuCheckboxItem.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuCheckboxItem.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"DropdownMenuCheckboxItem.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuCheckboxItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAiC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAErE,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAOtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAyC5C,MAAM,WAAW,6BAA8B,SAAQ,IAAI,CACzD,SAAS,EACT,UAAU,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,CAClD;IACC;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,WAAW,EACX,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,UAAkB,EAClB,gBAAwB,EACxB,UAAU,EACV,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,6BAA6B,+BA0D/B;yBAvEe,wBAAwB"}
|
|
@@ -15,23 +15,20 @@
|
|
|
15
15
|
* Enter/Space activation come from the parent DropdownMenu's useListFocus +
|
|
16
16
|
* activation path, which matches menuitemcheckbox alongside plain menuitem rows.
|
|
17
17
|
*
|
|
18
|
-
* The checkbox visual
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* `sm` menu gets the compact control; `md`/`lg` get the standard one) and it
|
|
27
|
-
* swaps to the inline-end of the row on coarse-pointer (touch) devices via CSS
|
|
28
|
-
* `order`, so it lands where selection toggles are conventionally placed on
|
|
18
|
+
* The checkbox visual is the shared checkbox indicator, decorative
|
|
19
|
+
* (aria-hidden) — the row owns the role, checked state, and accessible name, so
|
|
20
|
+
* there is no nested native <input> to shim out of the accessibility tree. It
|
|
21
|
+
* picks up the same `checkbox` theming (and any theme replacement) as
|
|
22
|
+
* CheckboxInput. The control size is derived from the menu's item size (a `sm`
|
|
23
|
+
* menu gets the compact control; `md`/`lg` get the standard one) and the marker
|
|
24
|
+
* box swaps to the inline-end of the row on coarse-pointer (touch) devices via
|
|
25
|
+
* CSS `order`, so it lands where selection toggles are conventionally placed on
|
|
29
26
|
* mobile.
|
|
30
27
|
*/
|
|
31
28
|
import { useCallback } from 'react';
|
|
32
29
|
import * as stylex from '@stylexjs/stylex';
|
|
33
30
|
import { renderIconSlot } from "../Icon/index.js";
|
|
34
|
-
import {
|
|
31
|
+
import { useIndicator } from "../Indicator/index.js";
|
|
35
32
|
import { Item } from "../Item/index.js";
|
|
36
33
|
import { useDropdownMenuContext } from "./DropdownMenuContext.js";
|
|
37
34
|
import { focusMenuItemOnHover } from "./menuItemHover.js";
|
|
@@ -53,8 +50,18 @@ const styles = {
|
|
|
53
50
|
kSiTet: "xbyyjgo",
|
|
54
51
|
kkrTdU: "x1h6gzvc",
|
|
55
52
|
$$css: true
|
|
53
|
+
},
|
|
54
|
+
marker: {
|
|
55
|
+
kfzvcC: "x47corl",
|
|
56
|
+
kayTVb: "x1g77sc7 xozvky",
|
|
57
|
+
keTefX: "x1lziwak x1jymrmb",
|
|
58
|
+
$$css: true
|
|
56
59
|
}
|
|
57
60
|
};
|
|
61
|
+
|
|
62
|
+
// Matches the control sizes CheckboxInput uses, so a checkbox reads the same in
|
|
63
|
+
// a menu row as it does in a form.
|
|
64
|
+
|
|
58
65
|
/**
|
|
59
66
|
* A checkable dropdown menu item (role="menuitemcheckbox").
|
|
60
67
|
*
|
|
@@ -90,12 +97,7 @@ export function DropdownMenuCheckboxItem({
|
|
|
90
97
|
const ctx = useDropdownMenuContext();
|
|
91
98
|
const menuSize = ctx?.menuSize ?? 'md';
|
|
92
99
|
const controlSize = menuSize === 'sm' ? 'sm' : 'md';
|
|
93
|
-
|
|
94
|
-
// The composed checkbox is decorative and inert, so its label never reaches
|
|
95
|
-
// the accessibility tree — the row's `label` prop provides the announced
|
|
96
|
-
// name. CheckboxInput still requires a string label, so pass one through when
|
|
97
|
-
// the row label is a plain string.
|
|
98
|
-
const checkboxLabel = typeof label === 'string' ? label : '';
|
|
100
|
+
const CheckboxControl = useIndicator('checkbox');
|
|
99
101
|
const handleClick = useCallback(() => {
|
|
100
102
|
if (isDisabled) {
|
|
101
103
|
return;
|
|
@@ -112,19 +114,18 @@ export function DropdownMenuCheckboxItem({
|
|
|
112
114
|
"aria-checked": value,
|
|
113
115
|
tabIndex: isDisabled ? undefined : -1,
|
|
114
116
|
onPointerMove: handlePointerMove,
|
|
115
|
-
marker:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})
|
|
117
|
+
marker:
|
|
118
|
+
/*#__PURE__*/
|
|
119
|
+
// No wrapper, and no menu-specific theme target: the shared
|
|
120
|
+
// `astryx-checkbox` target is already on this element (main reached
|
|
121
|
+
// the menu checkbox through it too), so the menu adds only its own
|
|
122
|
+
// placement rules. A wrapper here would have duplicated the
|
|
123
|
+
// indicator's control size and moved nothing themeable.
|
|
124
|
+
_jsx(CheckboxControl, {
|
|
125
|
+
state: value ? 'checked' : 'unchecked',
|
|
126
|
+
size: controlSize,
|
|
127
|
+
isDisabled: isDisabled,
|
|
128
|
+
xstyle: styles.marker
|
|
128
129
|
}),
|
|
129
130
|
startContent: icon ? renderIconSlot(icon, {
|
|
130
131
|
size: 'sm',
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
* state + onChange come from DropdownMenuRadioGroupContext. Keyboard nav +
|
|
11
11
|
* Enter/Space activation come from the parent DropdownMenu.
|
|
12
12
|
*
|
|
13
|
-
* The round radio visual
|
|
14
|
-
* the row owns the checked state
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* The round radio visual is the shared radio indicator, decorative
|
|
14
|
+
* (aria-hidden) — the row owns the checked state, and menu radios pick up the
|
|
15
|
+
* same `radio` theming (and any theme replacement) as RadioList. This row keeps
|
|
16
|
+
* the marker box: its size is derived from the menu's item size and it swaps to
|
|
17
|
+
* the inline-end of the row on coarse-pointer (touch) devices via CSS `order`.
|
|
18
18
|
*/
|
|
19
19
|
import { type ReactNode } from 'react';
|
|
20
20
|
import { type IconType } from '../Icon';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuRadioItem.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAiC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAErE,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownMenuRadioItem.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAiC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAErE,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAOtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAyC5C,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CACtD,SAAS,EACT,MAAM,GAAG,cAAc,GAAG,UAAU,CACrC;IACC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,KAAK,EACL,WAAW,EACX,IAAI,EACJ,UAAkB,EAClB,UAAU,EACV,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,0BAA0B,+BAmE5B;yBA9Ee,qBAAqB"}
|
|
@@ -14,20 +14,21 @@
|
|
|
14
14
|
* state + onChange come from DropdownMenuRadioGroupContext. Keyboard nav +
|
|
15
15
|
* Enter/Space activation come from the parent DropdownMenu.
|
|
16
16
|
*
|
|
17
|
-
* The round radio visual
|
|
18
|
-
* the row owns the checked state
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* The round radio visual is the shared radio indicator, decorative
|
|
18
|
+
* (aria-hidden) — the row owns the checked state, and menu radios pick up the
|
|
19
|
+
* same `radio` theming (and any theme replacement) as RadioList. This row keeps
|
|
20
|
+
* the marker box: its size is derived from the menu's item size and it swaps to
|
|
21
|
+
* the inline-end of the row on coarse-pointer (touch) devices via CSS `order`.
|
|
22
22
|
*/
|
|
23
23
|
import { useCallback } from 'react';
|
|
24
24
|
import * as stylex from '@stylexjs/stylex';
|
|
25
25
|
import { renderIconSlot } from "../Icon/index.js";
|
|
26
|
+
import { useIndicator } from "../Indicator/index.js";
|
|
26
27
|
import { Item } from "../Item/index.js";
|
|
27
28
|
import { useDropdownMenuContext } from "./DropdownMenuContext.js";
|
|
28
29
|
import { focusMenuItemOnHover } from "./menuItemHover.js";
|
|
29
30
|
import "../theme/tokens.stylex.js";
|
|
30
|
-
import { colorVars, spacingVars
|
|
31
|
+
import { colorVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
31
32
|
import { mergeProps, themeProps } from "../utils/index.js";
|
|
32
33
|
import { useDropdownMenuRadioGroupContext } from "./DropdownMenuContext.js";
|
|
33
34
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -46,62 +47,17 @@ const styles = {
|
|
|
46
47
|
kkrTdU: "x1h6gzvc",
|
|
47
48
|
$$css: true
|
|
48
49
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
kGNEyG: "x6s0dn4",
|
|
52
|
-
kjj79g: "xl56j7k",
|
|
53
|
-
kmuXW: "x2lah0s",
|
|
54
|
-
kB7OPa: "x9f619",
|
|
55
|
-
kMzoRj: "x1litavf",
|
|
56
|
-
ksu8eU: "x1y0btm7",
|
|
57
|
-
kaIpWk: "x16rqkct",
|
|
58
|
-
k1ekBW: "xts7igz",
|
|
59
|
-
kIyJzY: "xuedmi6 x12w9bfk",
|
|
60
|
-
kAMwcw: "xlr8y92",
|
|
50
|
+
marker: {
|
|
51
|
+
kfzvcC: "x47corl",
|
|
61
52
|
kayTVb: "x1g77sc7 xozvky",
|
|
62
53
|
keTefX: "x1lziwak x1jymrmb",
|
|
63
54
|
$$css: true
|
|
64
|
-
},
|
|
65
|
-
unchecked: {
|
|
66
|
-
kVAM5u: "xvy26l8",
|
|
67
|
-
kWkggS: "x10xzikg",
|
|
68
|
-
$$css: true
|
|
69
|
-
},
|
|
70
|
-
checked: {
|
|
71
|
-
kVAM5u: "xad5do",
|
|
72
|
-
kWkggS: "x1ewilqj",
|
|
73
|
-
$$css: true
|
|
74
|
-
},
|
|
75
|
-
dot: {
|
|
76
|
-
kaIpWk: "x16rqkct",
|
|
77
|
-
kWkggS: "x1azo05",
|
|
78
|
-
$$css: true
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const circleSizeStyles = {
|
|
82
|
-
sm: {
|
|
83
|
-
kzqmXN: "x1xp8n7a",
|
|
84
|
-
kZKoxP: "xmix8c7",
|
|
85
|
-
$$css: true
|
|
86
|
-
},
|
|
87
|
-
md: {
|
|
88
|
-
kzqmXN: "x17z2i9w",
|
|
89
|
-
kZKoxP: "x17rw0jw",
|
|
90
|
-
$$css: true
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const dotSizeStyles = {
|
|
94
|
-
sm: {
|
|
95
|
-
kzqmXN: "x1v4s8kt",
|
|
96
|
-
kZKoxP: "xols6we",
|
|
97
|
-
$$css: true
|
|
98
|
-
},
|
|
99
|
-
md: {
|
|
100
|
-
kzqmXN: "x1xc55vz",
|
|
101
|
-
kZKoxP: "xdk7pt",
|
|
102
|
-
$$css: true
|
|
103
55
|
}
|
|
104
56
|
};
|
|
57
|
+
|
|
58
|
+
// Matches the control sizes RadioList uses, so a radio reads the same in a
|
|
59
|
+
// menu row as it does in a radio group.
|
|
60
|
+
|
|
105
61
|
/**
|
|
106
62
|
* A single option in a DropdownMenuRadioGroup (role="menuitemradio").
|
|
107
63
|
*
|
|
@@ -133,6 +89,7 @@ export function DropdownMenuRadioItem({
|
|
|
133
89
|
const menuSize = menuCtx?.menuSize ?? 'md';
|
|
134
90
|
const controlSize = menuSize === 'sm' ? 'sm' : 'md';
|
|
135
91
|
const isChecked = groupCtx.value === value;
|
|
92
|
+
const RadioControl = useIndicator('radio');
|
|
136
93
|
const handleClick = useCallback(() => {
|
|
137
94
|
if (isDisabled) {
|
|
138
95
|
return;
|
|
@@ -149,19 +106,19 @@ export function DropdownMenuRadioItem({
|
|
|
149
106
|
"aria-checked": isChecked,
|
|
150
107
|
tabIndex: isDisabled ? undefined : -1,
|
|
151
108
|
onPointerMove: handlePointerMove,
|
|
152
|
-
marker:
|
|
153
|
-
|
|
154
|
-
|
|
109
|
+
marker:
|
|
110
|
+
/*#__PURE__*/
|
|
111
|
+
// No wrapper — see DropdownMenuCheckboxItem: the target belongs on the
|
|
112
|
+
// visible circle, and the indicator already owns its control size.
|
|
113
|
+
_jsx(RadioControl, {
|
|
114
|
+
state: isChecked ? 'checked' : 'unchecked',
|
|
115
|
+
size: controlSize,
|
|
116
|
+
isDisabled: isDisabled,
|
|
117
|
+
xstyle: styles.marker,
|
|
118
|
+
...themeProps('dropdown-menu-radio', {
|
|
155
119
|
size: controlSize,
|
|
156
120
|
checked: isChecked ? 'checked' : null,
|
|
157
121
|
disabled: isDisabled ? 'disabled' : null
|
|
158
|
-
}), stylex.props(styles.circle, circleSizeStyles[controlSize], isChecked ? styles.checked : styles.unchecked)),
|
|
159
|
-
children: isChecked && /*#__PURE__*/_jsx("span", {
|
|
160
|
-
...mergeProps(themeProps('dropdown-menu-radio-dot', {
|
|
161
|
-
size: controlSize,
|
|
162
|
-
checked: 'checked',
|
|
163
|
-
disabled: isDisabled ? 'disabled' : null
|
|
164
|
-
}), stylex.props(styles.dot, dotSizeStyles[controlSize]))
|
|
165
122
|
})
|
|
166
123
|
}),
|
|
167
124
|
startContent: icon ? renderIconSlot(icon, {
|
|
@@ -77,11 +77,11 @@ export function EmptyState({
|
|
|
77
77
|
const HeadingTag = `h${headingLevel}`;
|
|
78
78
|
return /*#__PURE__*/_jsxs("div", {
|
|
79
79
|
ref: ref,
|
|
80
|
+
...props,
|
|
80
81
|
role: "status",
|
|
81
82
|
...mergeProps(themeProps('empty-state', {
|
|
82
83
|
variant: isCompact ? 'compact' : null
|
|
83
84
|
}), stylex.props(styles.container, isCompact && styles.containerCompact, xstyle), className, style),
|
|
84
|
-
...props,
|
|
85
85
|
children: [icon != null && /*#__PURE__*/_jsx("div", {
|
|
86
86
|
"aria-hidden": "true",
|
|
87
87
|
children: icon
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IndicatorProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The default single-selection mark: a checkmark when chosen, nothing when not.
|
|
4
|
+
*
|
|
5
|
+
* Decorative and non-interactive — it renders `aria-hidden` and owns no role,
|
|
6
|
+
* state, or focus behavior; the option or row that hosts it keeps all of that.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```
|
|
10
|
+
* <CheckIndicator state={isSelected ? 'checked' : 'unchecked'} size="sm" />
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Swap every single-selection mark for a radio:
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```
|
|
17
|
+
* import {RadioIndicator} from '@astryxdesign/core/Indicator';
|
|
18
|
+
*
|
|
19
|
+
* defineTheme({name: 'brand', indicators: {check: RadioIndicator}});
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function CheckIndicator({ state, size, isDisabled, children, ref, className, style, xstyle, ...rest }: IndicatorProps<'singleSelection'>): import("react").JSX.Element | null;
|
|
23
|
+
export declare namespace CheckIndicator {
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=CheckIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckIndicator.d.ts","sourceRoot":"","sources":["../../src/Indicator/CheckIndicator.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AA6B5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,IAAW,EACX,UAAkB,EAClB,QAAQ,EACR,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,iBAAiB,CAAC,sCA6EnC;yBAvFe,cAAc"}
|