@astryxdesign/core 0.1.2 → 0.1.3
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 +165 -0
- package/README.md +12 -12
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +11 -5
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +24 -5
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +2 -4
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +0 -1
- package/dist/Calendar/Calendar.d.ts +5 -4
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +82 -43
- package/dist/Calendar/hooks/index.d.ts +0 -2
- package/dist/Calendar/hooks/index.d.ts.map +1 -1
- package/dist/Calendar/hooks/index.js +1 -2
- package/dist/Calendar/index.d.ts +3 -3
- package/dist/Calendar/index.d.ts.map +1 -1
- package/dist/Calendar/index.js +1 -1
- package/dist/Calendar/styles.d.ts +3 -9
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +3 -11
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +17 -3
- package/dist/Center/Center.d.ts +11 -1
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +9 -3
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +0 -1
- package/dist/Chat/ChatMessageList.d.ts +14 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +2 -0
- package/dist/Chat/useTriggerMenu.d.ts +8 -1
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +15 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts +23 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +51 -9
- package/dist/CheckboxList/CheckboxList.d.ts +13 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +39 -9
- package/dist/CheckboxList/CheckboxListContext.d.ts +7 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +0 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +9 -5
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +51 -37
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +5 -5
- package/dist/ContextMenu/ContextMenu.d.ts +4 -5
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +93 -11
- package/dist/DateInput/DateInput.d.ts +23 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +167 -99
- package/dist/DateRangeInput/DateRangeInput.d.ts +23 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +42 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts +35 -2
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +78 -15
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +12 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +42 -14
- package/dist/Field/Field.d.ts +19 -2
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +4 -0
- package/dist/Field/FieldLabel.d.ts +21 -2
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +41 -26
- package/dist/FileInput/FileInput.d.ts +22 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +56 -10
- package/dist/Grid/Grid.d.ts +11 -1
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +32 -6
- package/dist/InputGroup/InputGroup.d.ts +4 -3
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +16 -6
- package/dist/InputGroup/InputGroupContext.d.ts +4 -0
- package/dist/InputGroup/InputGroupContext.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupContext.js +2 -2
- package/dist/InputGroup/groupStyles.d.ts +1 -1
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +3 -3
- package/dist/InputGroup/index.d.ts +1 -0
- package/dist/InputGroup/index.d.ts.map +1 -1
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +33 -1
- package/dist/Layer/layerAnimations.stylex.d.ts +4 -0
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +8 -4
- package/dist/Layer/useLayer.d.ts +10 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +64 -9
- package/dist/Layout/Layout.d.ts +4 -11
- package/dist/Layout/Layout.d.ts.map +1 -1
- package/dist/Layout/Layout.js +10 -11
- package/dist/Layout/LayoutFooter.d.ts +2 -2
- package/dist/Layout/LayoutFooter.d.ts.map +1 -1
- package/dist/Layout/LayoutHeader.d.ts +2 -2
- package/dist/Layout/LayoutHeader.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.d.ts +2 -2
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.d.ts +51 -0
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +63 -0
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +4 -2
- package/dist/Link/Link.d.ts +16 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +18 -7
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +7 -0
- package/dist/MoreMenu/MoreMenu.d.ts +1 -7
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +0 -2
- package/dist/MultiSelector/MultiSelector.d.ts +27 -2
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +141 -42
- package/dist/MultiSelector/hooks.d.ts +12 -1
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +14 -1
- package/dist/NavMenu/NavHeadingMenu.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.js +34 -3
- package/dist/NumberInput/NumberInput.d.ts +23 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +62 -12
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +15 -1
- package/dist/Popover/Popover.d.ts +18 -2
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +5 -2
- package/dist/Popover/usePopover.d.ts +38 -3
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +24 -9
- package/dist/PowerSearch/PowerSearch.d.ts +11 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +6 -1
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +3 -5
- package/dist/RadioList/RadioList.d.ts +20 -2
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +105 -9
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +13 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts +13 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +78 -44
- package/dist/SegmentedControl/SegmentedControlContext.d.ts +7 -0
- package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +13 -2
- package/dist/Selector/Selector.d.ts +24 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +122 -43
- package/dist/Selector/hooks.d.ts +8 -1
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +14 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +2 -0
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +1 -1
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +8 -2
- package/dist/Slider/Slider.d.ts +21 -0
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +36 -9
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +1 -1
- package/dist/Stack/Stack.d.ts +38 -23
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +25 -1
- package/dist/Stack/StackItem.d.ts +12 -23
- package/dist/Stack/StackItem.d.ts.map +1 -1
- package/dist/Stack/StackItem.js +8 -1
- package/dist/Switch/Switch.d.ts +23 -2
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +41 -11
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +6 -0
- package/dist/TabList/TabList.d.ts +16 -4
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +87 -10
- package/dist/TabList/TabListContext.d.ts +5 -0
- package/dist/TabList/TabListContext.d.ts.map +1 -1
- package/dist/TabList/TabListContext.js +5 -0
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +6 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +11 -8
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +10 -1
- package/dist/Table/TableCell.d.ts +8 -1
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +10 -10
- package/dist/Table/TableHeaderCell.d.ts +8 -1
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +16 -16
- package/dist/Table/index.d.ts +2 -1
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +2 -2
- package/dist/Table/plugins/pagination/paginateData.d.ts +2 -1
- package/dist/Table/plugins/pagination/paginateData.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/paginateData.js +8 -3
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +6 -1
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +59 -3
- package/dist/Table/tableContextMenu.d.ts +33 -0
- package/dist/Table/tableContextMenu.d.ts.map +1 -0
- package/dist/Table/tableContextMenu.js +133 -0
- package/dist/Table/types.d.ts +66 -0
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/TextArea/TextArea.d.ts +22 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +41 -9
- package/dist/TextInput/TextInput.d.ts +23 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +55 -10
- package/dist/TimeInput/TimeInput.d.ts +23 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +147 -76
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +14 -0
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +131 -3
- package/dist/Tokenizer/Tokenizer.d.ts +12 -1
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +26 -4
- package/dist/Toolbar/Toolbar.d.ts +3 -3
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +51 -7
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +56 -9
- package/dist/TopNav/TopNavHeading.d.ts +7 -1
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +8 -0
- package/dist/TreeList/TreeList.d.ts +1 -1
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +72 -2
- package/dist/TreeList/TreeListItem.d.ts +11 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +51 -12
- package/dist/TreeList/treeListItem.markers.stylex.d.ts +16 -0
- package/dist/TreeList/treeListItem.markers.stylex.d.ts.map +1 -0
- package/dist/TreeList/treeListItem.markers.stylex.js +22 -0
- package/dist/Typeahead/BaseTypeahead.d.ts +13 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +69 -6
- package/dist/Typeahead/Typeahead.d.ts +26 -3
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +65 -29
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +61 -0
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -0
- package/dist/VisuallyHidden/VisuallyHidden.js +65 -0
- package/dist/VisuallyHidden/index.d.ts +11 -0
- package/dist/VisuallyHidden/index.d.ts.map +1 -0
- package/dist/VisuallyHidden/index.js +13 -0
- package/dist/astryx.css +18 -0
- package/dist/astryx.umd.js +55 -55
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/focusableSelector.d.ts +22 -0
- package/dist/hooks/focusableSelector.d.ts.map +1 -0
- package/dist/hooks/focusableSelector.js +24 -0
- package/dist/hooks/index.d.ts +12 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +7 -2
- package/dist/hooks/useAnnounce.d.ts +40 -0
- package/dist/hooks/useAnnounce.d.ts.map +1 -0
- package/dist/hooks/useAnnounce.js +142 -0
- package/dist/hooks/useClickableContainer.d.ts +16 -1
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +16 -4
- package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
- package/dist/hooks/useEntryAnimation.js +4 -4
- package/dist/hooks/useFocusTrap.d.ts +18 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +87 -3
- package/dist/hooks/useGridFocus.d.ts +88 -1
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +261 -62
- package/dist/hooks/useKeyboardHint.d.ts +82 -0
- package/dist/hooks/useKeyboardHint.d.ts.map +1 -0
- package/dist/hooks/useKeyboardHint.js +220 -0
- package/dist/hooks/useListFocus.d.ts +78 -7
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +305 -52
- package/dist/hooks/useLongPress.d.ts +21 -0
- package/dist/hooks/useLongPress.d.ts.map +1 -0
- package/dist/hooks/useLongPress.js +89 -0
- package/dist/hooks/useTreeFocus.d.ts +157 -0
- package/dist/hooks/useTreeFocus.d.ts.map +1 -0
- package/dist/hooks/useTreeFocus.js +337 -0
- package/dist/hooks/useTypeahead.d.ts +63 -0
- package/dist/hooks/useTypeahead.d.ts.map +1 -0
- package/dist/hooks/useTypeahead.js +117 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/utils/dateTypes.d.ts +12 -0
- package/dist/utils/dateTypes.d.ts.map +1 -1
- package/dist/utils/dateTypes.js +41 -1
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/inputAria.d.ts +29 -0
- package/dist/utils/inputAria.d.ts.map +1 -0
- package/dist/utils/inputAria.js +30 -0
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +5 -2
- package/docs.mjs +2 -2
- package/package.json +12 -8
- package/src/Avatar/Avatar.test.tsx +37 -0
- package/src/Avatar/Avatar.tsx +10 -5
- package/src/Breadcrumbs/BreadcrumbItem.tsx +25 -7
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +31 -10
- package/src/Button/Button.tsx +3 -16
- package/src/ButtonGroup/ButtonGroup.test.tsx +9 -9
- package/src/ButtonGroup/ButtonGroup.tsx +0 -1
- package/src/Calendar/Calendar.doc.mjs +4 -4
- package/src/Calendar/Calendar.test.tsx +168 -30
- package/src/Calendar/Calendar.tsx +121 -66
- package/src/Calendar/hooks/index.ts +0 -6
- package/src/Calendar/index.ts +1 -3
- package/src/Calendar/styles.ts +4 -9
- package/src/Carousel/Carousel.doc.mjs +7 -1
- package/src/Carousel/Carousel.test.tsx +20 -0
- package/src/Carousel/Carousel.tsx +16 -1
- package/src/Center/Center.doc.mjs +12 -2
- package/src/Center/Center.tsx +28 -3
- package/src/Chat/ChatComposerInput.test.tsx +26 -7
- package/src/Chat/ChatComposerInput.tsx +0 -1
- package/src/Chat/ChatDictationButton.doc.mjs +1 -1
- package/src/Chat/ChatMessageList.doc.mjs +8 -0
- package/src/Chat/ChatMessageList.test.tsx +18 -0
- package/src/Chat/ChatMessageList.tsx +16 -0
- package/src/Chat/useTriggerMenu.tsx +22 -4
- package/src/CheckboxInput/CheckboxInput.doc.mjs +10 -0
- package/src/CheckboxInput/CheckboxInput.test.tsx +172 -27
- package/src/CheckboxInput/CheckboxInput.tsx +78 -6
- package/src/CheckboxList/CheckboxList.doc.mjs +9 -0
- package/src/CheckboxList/CheckboxList.test.tsx +192 -26
- package/src/CheckboxList/CheckboxList.tsx +56 -3
- package/src/CheckboxList/CheckboxListContext.tsx +7 -0
- package/src/CheckboxList/CheckboxListItem.tsx +0 -3
- package/src/Citation/Citation.doc.mjs +10 -0
- package/src/Citation/Citation.test.tsx +121 -0
- package/src/Citation/Citation.tsx +15 -3
- package/src/CodeBlock/CodeBlock.test.tsx +115 -0
- package/src/CodeBlock/CodeBlock.tsx +63 -33
- package/src/CommandPalette/CommandPalette.test.tsx +47 -1
- package/src/CommandPalette/CommandPalette.tsx +9 -21
- package/src/ContextMenu/ContextMenu.doc.mjs +4 -4
- package/src/ContextMenu/ContextMenu.test.tsx +155 -1
- package/src/ContextMenu/ContextMenu.tsx +113 -16
- package/src/DateInput/DateInput.doc.mjs +286 -56
- package/src/DateInput/DateInput.test.tsx +248 -2
- package/src/DateInput/DateInput.tsx +196 -100
- package/src/DateRangeInput/DateRangeInput.doc.mjs +251 -46
- package/src/DateRangeInput/DateRangeInput.test.tsx +182 -20
- package/src/DateRangeInput/DateRangeInput.tsx +63 -5
- package/src/DateTimeInput/DateTimeInput.doc.mjs +368 -67
- package/src/DateTimeInput/DateTimeInput.test.tsx +279 -11
- package/src/DateTimeInput/DateTimeInput.tsx +125 -17
- package/src/Dialog/Dialog.doc.mjs +2 -2
- package/src/Dialog/Dialog.tsx +12 -0
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -8
- package/src/DropdownMenu/DropdownMenu.test.tsx +56 -42
- package/src/DropdownMenu/DropdownMenu.tsx +52 -18
- package/src/Field/Field.doc.mjs +59 -18
- package/src/Field/Field.test.tsx +32 -0
- package/src/Field/Field.tsx +23 -5
- package/src/Field/FieldLabel.tsx +55 -17
- package/src/FileInput/FileInput.doc.mjs +17 -0
- package/src/FileInput/FileInput.test.tsx +283 -49
- package/src/FileInput/FileInput.tsx +76 -4
- package/src/Grid/Grid.doc.mjs +17 -4
- package/src/Grid/Grid.test.tsx +43 -30
- package/src/Grid/Grid.tsx +38 -3
- package/src/Icon/Icon.doc.mjs +3 -3
- package/src/InputGroup/InputGroup.doc.mjs +111 -23
- package/src/InputGroup/InputGroup.test.tsx +257 -60
- package/src/InputGroup/InputGroup.tsx +23 -5
- package/src/InputGroup/InputGroupContext.ts +9 -4
- package/src/InputGroup/groupStyles.ts +7 -1
- package/src/InputGroup/index.ts +1 -0
- package/src/Kbd/Kbd.test.tsx +22 -4
- package/src/Kbd/Kbd.tsx +35 -3
- package/src/Layer/layerAnimations.stylex.ts +20 -4
- package/src/Layer/useLayer.doc.mjs +5 -0
- package/src/Layer/useLayer.test.tsx +111 -0
- package/src/Layer/useLayer.tsx +90 -9
- package/src/Layout/Layout.tsx +8 -16
- package/src/Layout/LayoutFooter.doc.mjs +4 -4
- package/src/Layout/LayoutFooter.tsx +3 -3
- package/src/Layout/LayoutHeader.doc.mjs +4 -4
- package/src/Layout/LayoutHeader.tsx +3 -3
- package/src/Layout/LayoutPanel.tsx +3 -3
- package/src/Layout/padding.stylex.ts +52 -0
- package/src/Lightbox/Lightbox.doc.mjs +9 -0
- package/src/Lightbox/Lightbox.test.tsx +53 -5
- package/src/Lightbox/Lightbox.tsx +9 -4
- package/src/Link/Link.doc.mjs +14 -0
- package/src/Link/Link.test.tsx +50 -0
- package/src/Link/Link.tsx +39 -4
- package/src/Markdown/Markdown.test.tsx +11 -0
- package/src/Markdown/Markdown.tsx +7 -0
- package/src/MetadataList/MetadataListItem.doc.mjs +4 -0
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -17
- package/src/MoreMenu/MoreMenu.tsx +0 -9
- package/src/MultiSelector/MultiSelector.doc.mjs +30 -0
- package/src/MultiSelector/MultiSelector.test.tsx +375 -8
- package/src/MultiSelector/MultiSelector.tsx +194 -48
- package/src/MultiSelector/hooks.ts +27 -0
- package/src/NavMenu/NavHeadingMenu.test.tsx +77 -1
- package/src/NavMenu/NavHeadingMenu.tsx +50 -3
- package/src/NumberInput/NumberInput.doc.mjs +17 -0
- package/src/NumberInput/NumberInput.test.tsx +242 -40
- package/src/NumberInput/NumberInput.tsx +89 -11
- package/src/Pagination/Pagination.doc.mjs +3 -3
- package/src/Pagination/Pagination.test.tsx +117 -5
- package/src/Pagination/Pagination.tsx +21 -1
- package/src/Popover/Popover.doc.mjs +26 -0
- package/src/Popover/Popover.test.tsx +121 -0
- package/src/Popover/Popover.tsx +23 -2
- package/src/Popover/usePopover.doc.mjs +9 -3
- package/src/Popover/usePopover.tsx +70 -12
- package/src/PowerSearch/PowerSearch.doc.mjs +15 -0
- package/src/PowerSearch/PowerSearch.test.tsx +97 -1
- package/src/PowerSearch/PowerSearch.tsx +16 -3
- package/src/ProgressBar/ProgressBar.test.tsx +34 -26
- package/src/ProgressBar/ProgressBar.tsx +3 -4
- package/src/RadioList/RadioList.doc.mjs +9 -0
- package/src/RadioList/RadioList.test.tsx +252 -16
- package/src/RadioList/RadioList.tsx +166 -10
- package/src/RadioList/RadioListItem.tsx +14 -2
- package/src/SegmentedControl/SegmentedControl.doc.mjs +9 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +214 -42
- package/src/SegmentedControl/SegmentedControl.tsx +102 -54
- package/src/SegmentedControl/SegmentedControlContext.ts +7 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +14 -1
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.doc.mjs +26 -0
- package/src/Selector/Selector.test.tsx +387 -15
- package/src/Selector/Selector.tsx +175 -67
- package/src/Selector/hooks.ts +23 -0
- package/src/SideNav/SideNav.test.tsx +48 -0
- package/src/SideNav/SideNavHeading.tsx +8 -2
- package/src/SideNav/SideNavItem.tsx +2 -4
- package/src/Skeleton/Skeleton.test.tsx +25 -0
- package/src/Skeleton/Skeleton.tsx +11 -1
- package/src/Slider/Slider.doc.mjs +15 -0
- package/src/Slider/Slider.test.tsx +155 -2
- package/src/Slider/Slider.tsx +53 -5
- package/src/Spinner/Spinner.tsx +7 -1
- package/src/Stack/Stack.doc.mjs +77 -0
- package/src/Stack/Stack.test.tsx +55 -5
- package/src/Stack/Stack.tsx +73 -24
- package/src/Stack/StackItem.test.tsx +23 -0
- package/src/Stack/StackItem.tsx +20 -23
- package/src/Switch/Switch.doc.mjs +15 -0
- package/src/Switch/Switch.test.tsx +162 -27
- package/src/Switch/Switch.tsx +61 -21
- package/src/TabList/Tab.tsx +6 -0
- package/src/TabList/TabList.doc.mjs +6 -0
- package/src/TabList/TabList.test.tsx +251 -0
- package/src/TabList/TabList.tsx +103 -12
- package/src/TabList/TabListContext.ts +7 -3
- package/src/TabList/TabMenu.tsx +6 -3
- package/src/Table/BaseTable.tsx +21 -17
- package/src/Table/Table.doc.mjs +2 -0
- package/src/Table/Table.test.tsx +10 -0
- package/src/Table/Table.tsx +8 -0
- package/src/Table/TableCell.tsx +25 -23
- package/src/Table/TableHeaderCell.tsx +28 -29
- package/src/Table/index.ts +3 -2
- package/src/Table/plugins/pagination/paginateData.ts +10 -3
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +16 -0
- package/src/Table/plugins/pagination/useTablePagination.tsx +8 -1
- package/src/Table/plugins/sortable/useTableSortable.test.tsx +91 -2
- package/src/Table/plugins/sortable/useTableSortable.tsx +53 -1
- package/src/Table/tableContextMenu.test.tsx +157 -0
- package/src/Table/tableContextMenu.tsx +142 -0
- package/src/Table/types.ts +74 -0
- package/src/Table/useTableColumnResize.doc.mjs +3 -3
- package/src/Table/useTableStickyColumns.doc.mjs +2 -2
- package/src/Text/Text.doc.mjs +18 -18
- package/src/TextArea/TextArea.doc.mjs +17 -0
- package/src/TextArea/TextArea.test.tsx +167 -35
- package/src/TextArea/TextArea.tsx +62 -15
- package/src/TextInput/TextInput.doc.mjs +17 -0
- package/src/TextInput/TextInput.test.tsx +168 -34
- package/src/TextInput/TextInput.tsx +77 -9
- package/src/Thumbnail/Thumbnail.doc.mjs +4 -4
- package/src/TimeInput/TimeInput.doc.mjs +340 -60
- package/src/TimeInput/TimeInput.test.tsx +255 -7
- package/src/TimeInput/TimeInput.tsx +176 -70
- package/src/Timestamp/Timestamp.doc.mjs +19 -19
- package/src/Toast/Toast.tsx +14 -0
- package/src/Toast/ToastViewport.test.tsx +214 -0
- package/src/Toast/ToastViewport.tsx +167 -21
- package/src/Tokenizer/Tokenizer.doc.mjs +29 -14
- package/src/Tokenizer/Tokenizer.test.tsx +105 -1
- package/src/Tokenizer/Tokenizer.tsx +37 -1
- package/src/Toolbar/Toolbar.test.tsx +109 -6
- package/src/Toolbar/Toolbar.tsx +59 -5
- package/src/Tooltip/Tooltip.test.tsx +68 -0
- package/src/Tooltip/useTooltip.tsx +55 -8
- package/src/TopNav/TopNav.test.tsx +50 -0
- package/src/TopNav/TopNavHeading.tsx +17 -1
- package/src/TreeList/TreeList.test.tsx +295 -6
- package/src/TreeList/TreeList.tsx +73 -1
- package/src/TreeList/TreeListItem.tsx +51 -5
- package/src/TreeList/treeListItem.markers.stylex.ts +20 -0
- package/src/Typeahead/BaseTypeahead.tsx +93 -9
- package/src/Typeahead/Typeahead.doc.mjs +141 -30
- package/src/Typeahead/Typeahead.test.tsx +331 -1
- package/src/Typeahead/Typeahead.tsx +105 -33
- package/src/VisuallyHidden/VisuallyHidden.doc.mjs +80 -0
- package/src/VisuallyHidden/VisuallyHidden.test.tsx +76 -0
- package/src/VisuallyHidden/VisuallyHidden.tsx +113 -0
- package/src/VisuallyHidden/index.ts +15 -0
- package/src/docs-script.test.mjs +50 -0
- package/src/hooks/focusableSelector.ts +25 -0
- package/src/hooks/index.ts +28 -2
- package/src/hooks/useAnnounce.test.tsx +101 -0
- package/src/hooks/useAnnounce.ts +168 -0
- package/src/hooks/useClickableContainer.ts +16 -4
- package/src/hooks/useEntryAnimation.ts +16 -4
- package/src/hooks/useFocusTrap.test.tsx +132 -0
- package/src/hooks/useFocusTrap.ts +98 -4
- package/src/hooks/useGridFocus.doc.mjs +40 -2
- package/src/hooks/useGridFocus.test.tsx +132 -0
- package/src/hooks/useGridFocus.ts +343 -67
- package/src/hooks/useKeyboardHint.doc.mjs +101 -0
- package/src/hooks/useKeyboardHint.test.tsx +70 -0
- package/src/hooks/useKeyboardHint.tsx +332 -0
- package/src/hooks/useListFocus.doc.mjs +50 -10
- package/src/hooks/useListFocus.test.tsx +375 -0
- package/src/hooks/useListFocus.ts +395 -57
- package/src/hooks/useLongPress.test.tsx +134 -0
- package/src/hooks/useLongPress.ts +119 -0
- package/src/hooks/useTreeFocus.doc.mjs +140 -0
- package/src/hooks/useTreeFocus.test.tsx +214 -0
- package/src/hooks/useTreeFocus.ts +559 -0
- package/src/hooks/useTypeahead.test.tsx +109 -0
- package/src/hooks/useTypeahead.ts +183 -0
- package/src/index.ts +1 -0
- package/src/theme/derivedVarRegistry.test.ts +10 -5
- package/src/utils/dateTypes.test.ts +40 -0
- package/src/utils/dateTypes.ts +40 -0
- package/src/utils/index.ts +9 -0
- package/src/utils/inputAria.test.ts +39 -0
- package/src/utils/inputAria.ts +58 -0
- package/src/utils/timeParser.test.ts +10 -0
- package/src/utils/timeParser.ts +5 -2
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts +0 -57
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts.map +0 -1
- package/dist/Calendar/hooks/useCalendarRovingTabindex.js +0 -96
- package/src/Calendar/hooks/useCalendarRovingTabindex.ts +0 -118
package/dist/Slider/Slider.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Slider.tsx
|
|
7
|
-
* @input Uses React, useId, useRef, useCallback, Field, Tooltip
|
|
7
|
+
* @input Uses React, useId, useRef, useCallback, Field, Tooltip, useTooltip
|
|
8
8
|
* @output Exports Slider component, SliderProps, SliderSingleProps, SliderRangeProps, SliderBaseProps
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by Slider.test.tsx
|
|
10
10
|
*
|
|
@@ -21,6 +21,7 @@ import "../theme/tokens.stylex.js";
|
|
|
21
21
|
import { colorVars, spacingVars, radiusVars, durationVars, easeVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
22
22
|
import { Field } from "../Field/Field.js";
|
|
23
23
|
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
24
|
+
import { useTooltip } from "../Tooltip/index.js";
|
|
24
25
|
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
25
26
|
import { themeProps } from "../utils/themeProps.js";
|
|
26
27
|
|
|
@@ -82,6 +83,7 @@ export function Slider({
|
|
|
82
83
|
isLabelHidden = false,
|
|
83
84
|
description,
|
|
84
85
|
isDisabled = false,
|
|
86
|
+
disabledMessage,
|
|
85
87
|
isOptional = false,
|
|
86
88
|
isRequired = false,
|
|
87
89
|
status,
|
|
@@ -112,6 +114,20 @@ export function Slider({
|
|
|
112
114
|
const draggingThumbRef = useRef(null);
|
|
113
115
|
const [draggingThumb, setDraggingThumb] = useState(null);
|
|
114
116
|
|
|
117
|
+
// Disabled-reason tooltip. This is a *separate* useTooltip instance from the
|
|
118
|
+
// per-thumb value bubble (the `<Tooltip>` component below): it anchors to the
|
|
119
|
+
// track container and fires on hover/focus of the whole control. Disabled
|
|
120
|
+
// controls swallow pointer events, so the thumb stays perceivable via
|
|
121
|
+
// aria-disabled while pointer/keyboard handlers early-return on isDisabled.
|
|
122
|
+
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
123
|
+
const disabledMessageTooltip = useTooltip({
|
|
124
|
+
placement: 'above',
|
|
125
|
+
// The track container is not naturally focusable; focusin bubbles up from
|
|
126
|
+
// the thumb, so always attach focus listeners.
|
|
127
|
+
focusTrigger: 'always',
|
|
128
|
+
isEnabled: showsDisabledMessage
|
|
129
|
+
});
|
|
130
|
+
|
|
115
131
|
// Build aria-describedby
|
|
116
132
|
const describedByParts = [];
|
|
117
133
|
if (description) {
|
|
@@ -120,6 +136,9 @@ export function Slider({
|
|
|
120
136
|
if (status?.message) {
|
|
121
137
|
describedByParts.push(statusMessageID);
|
|
122
138
|
}
|
|
139
|
+
if (showsDisabledMessage) {
|
|
140
|
+
describedByParts.push(disabledMessageTooltip.describedBy);
|
|
141
|
+
}
|
|
123
142
|
const ariaDescribedBy = describedByParts.length > 0 ? describedByParts.join(' ') : undefined;
|
|
124
143
|
|
|
125
144
|
// Value helpers — guard against undefined value (e.g. playground previews
|
|
@@ -306,12 +325,20 @@ export function Slider({
|
|
|
306
325
|
left: '50%'
|
|
307
326
|
};
|
|
308
327
|
const thumbLabel = isRange ? thumbIndex === 0 ? `${label}, minimum value` : `${label}, maximum value` : label;
|
|
309
|
-
|
|
328
|
+
|
|
329
|
+
// Suppress the per-thumb value bubble while the disabled-message tooltip is
|
|
330
|
+
// showing, so a disabled slider surfaces the *reason* on hover/focus rather
|
|
331
|
+
// than stacking two tooltips over the same thumb.
|
|
332
|
+
const useValueTooltip = valueDisplay === 'tooltip' && !showsDisabledMessage;
|
|
310
333
|
const tooltipPlacement = isHorizontal ? 'above' : 'start';
|
|
311
334
|
const thumbElement = /*#__PURE__*/_jsx("div", {
|
|
312
335
|
id: !isRange ? id : undefined,
|
|
313
|
-
role: "slider"
|
|
314
|
-
|
|
336
|
+
role: "slider"
|
|
337
|
+
// With a disabledMessage the thumb keeps focusability so the reason is
|
|
338
|
+
// focus-discoverable; value changes stay blocked by the isDisabled
|
|
339
|
+
// guards in the pointer/keyboard handlers.
|
|
340
|
+
,
|
|
341
|
+
tabIndex: isDisabled && !showsDisabledMessage ? -1 : 0,
|
|
315
342
|
"aria-valuemin": min,
|
|
316
343
|
"aria-valuemax": max,
|
|
317
344
|
"aria-valuenow": val,
|
|
@@ -376,7 +403,7 @@ export function Slider({
|
|
|
376
403
|
}
|
|
377
404
|
}[!!isHorizontal << 3 | !!!isDisabled << 2 | !!!isDisabled << 1 | !!isDisabled << 0], undefined, positionStyle)
|
|
378
405
|
}, thumbIndex);
|
|
379
|
-
if (
|
|
406
|
+
if (useValueTooltip) {
|
|
380
407
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
381
408
|
content: displayValue(val),
|
|
382
409
|
placement: tooltipPlacement,
|
|
@@ -426,7 +453,7 @@ export function Slider({
|
|
|
426
453
|
},
|
|
427
454
|
children: isRange ? `${displayValue(values[0])} – ${displayValue(values[1])}` : displayValue(values[0])
|
|
428
455
|
}) : null;
|
|
429
|
-
return /*#__PURE__*/
|
|
456
|
+
return /*#__PURE__*/_jsxs(Field, {
|
|
430
457
|
"data-testid": testId,
|
|
431
458
|
label: label,
|
|
432
459
|
isLabelHidden: isLabelHidden,
|
|
@@ -447,7 +474,7 @@ export function Slider({
|
|
|
447
474
|
xstyle: xstyle,
|
|
448
475
|
className: className,
|
|
449
476
|
style: style,
|
|
450
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
477
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
451
478
|
...mergeProps(themeProps('slider', {
|
|
452
479
|
orientation,
|
|
453
480
|
disabled: isDisabled ? 'disabled' : null
|
|
@@ -455,7 +482,7 @@ export function Slider({
|
|
|
455
482
|
className: "x78zum5 x6s0dn4 x1txdalj"
|
|
456
483
|
}),
|
|
457
484
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
458
|
-
ref: mergeRefs(ref, trackRef),
|
|
485
|
+
ref: mergeRefs(ref, trackRef, disabledMessageTooltip.ref),
|
|
459
486
|
...(isRange ? {
|
|
460
487
|
role: 'group',
|
|
461
488
|
'aria-label': label
|
|
@@ -552,7 +579,7 @@ export function Slider({
|
|
|
552
579
|
})
|
|
553
580
|
}), values.map((_, i) => renderThumb(i))]
|
|
554
581
|
}), textDisplay]
|
|
555
|
-
})
|
|
582
|
+
}), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
556
583
|
});
|
|
557
584
|
}
|
|
558
585
|
Slider.displayName = 'Slider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/Spinner/Spinner.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAIxD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAc5C,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;CAKV,CAAC;
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/Spinner/Spinner.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAIxD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAc5C,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;CAKV,CAAC;AAgDF,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,KAAK,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExE,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACjC;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,EACtB,IAAW,EACX,KAAiB,EACjB,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,SAAS,EACb,EAAE,YAAY,+BA4Id;yBAvJe,OAAO"}
|
package/dist/Spinner/Spinner.js
CHANGED
|
@@ -203,7 +203,7 @@ export function Spinner({
|
|
|
203
203
|
children: /*#__PURE__*/_jsx("canvas", {
|
|
204
204
|
ref: canvasRef,
|
|
205
205
|
...{
|
|
206
|
-
className: "xlp1x4z x1lliihq x14qxm4i xa4qsjk x1ka1v4i x1esw782"
|
|
206
|
+
className: "xlp1x4z x1lliihq x14qxm4i xnh0sag xa4qsjk x1ka1v4i x1esw782"
|
|
207
207
|
}
|
|
208
208
|
})
|
|
209
209
|
});
|
package/dist/Stack/Stack.d.ts
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { type ElementType, type ReactNode } from 'react';
|
|
13
13
|
import type { BaseProps } from '../BaseProps';
|
|
14
|
-
import type { StyleXStyles } from '@stylexjs/stylex';
|
|
15
14
|
import { type StackCrossAlignment, type StackDirection, type StackMainAlignment, type StackWrap, type SpacingStep } from './stack.stylex';
|
|
16
15
|
import type { SizeValue } from '../utils/types';
|
|
17
16
|
/**
|
|
@@ -77,11 +76,48 @@ export interface StackProps extends BaseProps<HTMLElement> {
|
|
|
77
76
|
* Numbers are treated as pixels, strings are used as-is (e.g., '100%').
|
|
78
77
|
*/
|
|
79
78
|
height?: SizeValue;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum width of the stack container.
|
|
81
|
+
* Numbers are treated as pixels, strings are used as-is (e.g., '100%').
|
|
82
|
+
*/
|
|
83
|
+
maxWidth?: SizeValue;
|
|
84
|
+
/**
|
|
85
|
+
* Minimum height of the stack container.
|
|
86
|
+
* Numbers are treated as pixels, strings are used as-is (e.g., '100%').
|
|
87
|
+
*/
|
|
88
|
+
minHeight?: SizeValue;
|
|
80
89
|
/**
|
|
81
90
|
* Spacing between items.
|
|
82
91
|
* Accepts numeric spacing steps: 0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10.
|
|
83
92
|
*/
|
|
84
93
|
gap?: SpacingStep;
|
|
94
|
+
/**
|
|
95
|
+
* Inner padding on all sides, using the spacing scale.
|
|
96
|
+
* Accepts numeric spacing steps: 0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10.
|
|
97
|
+
*
|
|
98
|
+
* Matches the `padding` prop on `Card`, `LayoutContent`, and `LayoutPanel`.
|
|
99
|
+
*/
|
|
100
|
+
padding?: SpacingStep;
|
|
101
|
+
/**
|
|
102
|
+
* Inline (horizontal) padding, using the spacing scale.
|
|
103
|
+
* Overrides `padding` on the inline axis when both are set.
|
|
104
|
+
*/
|
|
105
|
+
paddingInline?: SpacingStep;
|
|
106
|
+
/**
|
|
107
|
+
* Block (vertical) padding, using the spacing scale.
|
|
108
|
+
* Overrides `padding` on the block axis when both are set.
|
|
109
|
+
*/
|
|
110
|
+
paddingBlock?: SpacingStep;
|
|
111
|
+
/**
|
|
112
|
+
* Enables scrollable overflow (`overflow: auto`) for the stack.
|
|
113
|
+
*
|
|
114
|
+
* Matches the `isScrollable` prop on `LayoutContent` and `LayoutPanel`.
|
|
115
|
+
* When the stack is itself a flex child that should scroll, pair it with
|
|
116
|
+
* a parent `StackItem size="fill" isScrollable` (StackItem applies the
|
|
117
|
+
* `min-height: 0` reset that flex scroll regions require).
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
isScrollable?: boolean;
|
|
85
121
|
/**
|
|
86
122
|
* Whether items should wrap.
|
|
87
123
|
* - `nowrap`: Items stay on one line (default)
|
|
@@ -95,27 +131,6 @@ export interface StackProps extends BaseProps<HTMLElement> {
|
|
|
95
131
|
* @default 'div'
|
|
96
132
|
*/
|
|
97
133
|
as?: ElementType;
|
|
98
|
-
/**
|
|
99
|
-
* StyleX styles created via `stylex.create()`. Merged with the component's
|
|
100
|
-
* base styles inside a single `stylex.props()` call for optimal deduplication.
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```
|
|
104
|
-
* const overrides = stylex.create({ root: { marginBottom: 8 } });
|
|
105
|
-
* <Component xstyle={overrides.root} />
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
xstyle?: StyleXStyles;
|
|
109
|
-
/**
|
|
110
|
-
* CSS class name(s) appended to the root element.
|
|
111
|
-
* If you're using StyleX, prefer `xstyle` for optimal style deduplication.
|
|
112
|
-
*/
|
|
113
|
-
className?: string;
|
|
114
|
-
/**
|
|
115
|
-
* Inline styles to apply to the root element. Spread after StyleX
|
|
116
|
-
* inline styles, so these values take priority.
|
|
117
|
-
*/
|
|
118
|
-
style?: React.CSSProperties;
|
|
119
134
|
/**
|
|
120
135
|
* Content to render inside the stack.
|
|
121
136
|
*/
|
|
@@ -145,7 +160,7 @@ export interface StackProps extends BaseProps<HTMLElement> {
|
|
|
145
160
|
* </Stack>
|
|
146
161
|
* ```
|
|
147
162
|
*/
|
|
148
|
-
export declare function Stack({ direction, hAlign, vAlign, justify, align, gap, width, height, wrap, as: element, xstyle, className, style, children, ref, ...props }: StackProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
163
|
+
export declare function Stack({ direction, hAlign, vAlign, justify, align, gap, padding, paddingInline, paddingBlock, isScrollable, width, height, maxWidth, minHeight, wrap, as: element, xstyle, className, style, children, ref, ...props }: StackProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
149
164
|
export declare namespace Stack {
|
|
150
165
|
var displayName: string;
|
|
151
166
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/Stack/Stack.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/Stack/Stack.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAc9C;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAEtE,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,WAAW,CAAC;IACxD,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAE7B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAE5B;;;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,GAAG,CAAC,EAAE,WAAW,CAAC;IAElB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC;IAE5B;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAE3B;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,EAAE,CAAC,EAAE,WAAW,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,KAAK,CAAC,EACpB,SAAsB,EACtB,MAAM,EACN,MAAM,EACN,OAAO,EACP,KAAK,EACL,GAAG,EACH,OAAO,EACP,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,EAAE,EAAE,OAAe,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACT,EAAE,UAAU,0FAkEZ;yBAzFe,KAAK"}
|
package/dist/Stack/Stack.js
CHANGED
|
@@ -15,8 +15,15 @@
|
|
|
15
15
|
import { createElement } from 'react';
|
|
16
16
|
import * as stylex from '@stylexjs/stylex';
|
|
17
17
|
import { stack } from "./stack.stylex.js";
|
|
18
|
+
import { paddingInlineStyles, paddingBlockStyles } from "../Layout/padding.stylex.js";
|
|
18
19
|
import { mergeProps } from "../utils/index.js";
|
|
19
20
|
import { themeProps } from "../utils/themeProps.js";
|
|
21
|
+
const overflowStyles = {
|
|
22
|
+
scrollable: {
|
|
23
|
+
kVQacm: "xysyzu8",
|
|
24
|
+
$$css: true
|
|
25
|
+
}
|
|
26
|
+
};
|
|
20
27
|
|
|
21
28
|
/**
|
|
22
29
|
* Alignment values accepted by Stack.
|
|
@@ -60,8 +67,14 @@ export function Stack({
|
|
|
60
67
|
justify,
|
|
61
68
|
align,
|
|
62
69
|
gap,
|
|
70
|
+
padding,
|
|
71
|
+
paddingInline,
|
|
72
|
+
paddingBlock,
|
|
73
|
+
isScrollable,
|
|
63
74
|
width,
|
|
64
75
|
height,
|
|
76
|
+
maxWidth,
|
|
77
|
+
minHeight,
|
|
65
78
|
wrap,
|
|
66
79
|
as: element = 'div',
|
|
67
80
|
xstyle,
|
|
@@ -78,13 +91,18 @@ export function Stack({
|
|
|
78
91
|
// Map hAlign/vAlign to mainAlign/crossAlign based on direction
|
|
79
92
|
const mainAlign = direction === 'horizontal' ? resolvedHAlign : resolvedVAlign;
|
|
80
93
|
const crossAlign = direction === 'horizontal' ? resolvedVAlign : resolvedHAlign;
|
|
94
|
+
|
|
95
|
+
// Resolve padding to per-axis values: `padding` sets both axes; `paddingInline`
|
|
96
|
+
// / `paddingBlock` take precedence on their own axis when provided.
|
|
97
|
+
const resolvedPaddingInline = paddingInline ?? padding;
|
|
98
|
+
const resolvedPaddingBlock = paddingBlock ?? padding;
|
|
81
99
|
const stylexProps = stylex.props(...stack({
|
|
82
100
|
direction,
|
|
83
101
|
crossAlign,
|
|
84
102
|
mainAlign,
|
|
85
103
|
gap,
|
|
86
104
|
wrap
|
|
87
|
-
}), xstyle);
|
|
105
|
+
}), resolvedPaddingInline != null && paddingInlineStyles[resolvedPaddingInline], resolvedPaddingBlock != null && paddingBlockStyles[resolvedPaddingBlock], isScrollable && overflowStyles.scrollable, xstyle);
|
|
88
106
|
|
|
89
107
|
// Build inline style for dynamic sizing values
|
|
90
108
|
const sizingStyle = {
|
|
@@ -93,6 +111,12 @@ export function Stack({
|
|
|
93
111
|
}),
|
|
94
112
|
...(height != null && {
|
|
95
113
|
height: typeof height === 'number' ? `${height}px` : height
|
|
114
|
+
}),
|
|
115
|
+
...(maxWidth != null && {
|
|
116
|
+
maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth
|
|
117
|
+
}),
|
|
118
|
+
...(minHeight != null && {
|
|
119
|
+
minHeight: typeof minHeight === 'number' ? `${minHeight}px` : minHeight
|
|
96
120
|
})
|
|
97
121
|
};
|
|
98
122
|
return /*#__PURE__*/createElement(element, {
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { type ElementType, type ReactNode } from 'react';
|
|
12
12
|
import type { BaseProps } from '../BaseProps';
|
|
13
|
-
import type { StyleXStyles } from '@stylexjs/stylex';
|
|
14
13
|
import { type StackItemCrossAlignSelf, type StackItemSize } from './stackItem.stylex';
|
|
15
14
|
export interface StackItemProps extends BaseProps<HTMLElement> {
|
|
16
15
|
/** Ref forwarded to the root element */
|
|
@@ -29,31 +28,21 @@ export interface StackItemProps extends BaseProps<HTMLElement> {
|
|
|
29
28
|
*/
|
|
30
29
|
size?: StackItemSize;
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @default 'div'
|
|
34
|
-
*/
|
|
35
|
-
as?: ElementType;
|
|
36
|
-
/**
|
|
37
|
-
* StyleX styles created via `stylex.create()`. Merged with the component's
|
|
38
|
-
* base styles inside a single `stylex.props()` call for optimal deduplication.
|
|
31
|
+
* Enables scrollable overflow (`overflow: auto`) for the item.
|
|
39
32
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
33
|
+
* StackItem already applies the flex `min-height: 0` / `min-width: 0`
|
|
34
|
+
* reset, so `<StackItem size="fill" isScrollable>` is a complete scroll
|
|
35
|
+
* region — it grows to fill the stack and scrolls its own overflow with
|
|
36
|
+
* no extra style plumbing. Matches `isScrollable` on `LayoutContent`
|
|
37
|
+
* and `LayoutPanel`.
|
|
38
|
+
* @default false
|
|
45
39
|
*/
|
|
46
|
-
|
|
40
|
+
isScrollable?: boolean;
|
|
47
41
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
className?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Inline styles to apply to the root element. Spread after StyleX
|
|
54
|
-
* inline styles, so these values take priority.
|
|
42
|
+
* The element type to render.
|
|
43
|
+
* @default 'div'
|
|
55
44
|
*/
|
|
56
|
-
|
|
45
|
+
as?: ElementType;
|
|
57
46
|
/**
|
|
58
47
|
* Content to render inside the stack item.
|
|
59
48
|
*/
|
|
@@ -73,7 +62,7 @@ export interface StackItemProps extends BaseProps<HTMLElement> {
|
|
|
73
62
|
* </HStack>
|
|
74
63
|
* ```
|
|
75
64
|
*/
|
|
76
|
-
export declare function StackItem({ crossAlignSelf, size, as: element, xstyle, className, style, children, ref, ...props }: StackItemProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
65
|
+
export declare function StackItem({ crossAlignSelf, size, isScrollable, as: element, xstyle, className, style, children, ref, ...props }: StackItemProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
77
66
|
export declare namespace StackItem {
|
|
78
67
|
var displayName: string;
|
|
79
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackItem.d.ts","sourceRoot":"","sources":["../../src/Stack/StackItem.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,
|
|
1
|
+
{"version":3,"file":"StackItem.d.ts","sourceRoot":"","sources":["../../src/Stack/StackItem.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAU5B,MAAM,WAAW,cAAe,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC5D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;;OAGG;IACH,cAAc,CAAC,EAAE,uBAAuB,CAAC;IAEzC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IAErB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,EAAE,CAAC,EAAE,WAAW,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,EACxB,cAAc,EACd,IAAI,EACJ,YAAY,EACZ,EAAE,EAAE,OAAe,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACT,EAAE,cAAc,0FAqBhB;yBAhCe,SAAS"}
|
package/dist/Stack/StackItem.js
CHANGED
|
@@ -16,6 +16,12 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
16
16
|
import { stackItem } from "./stackItem.stylex.js";
|
|
17
17
|
import { mergeProps } from "../utils/index.js";
|
|
18
18
|
import { themeProps } from "../utils/themeProps.js";
|
|
19
|
+
const overflowStyles = {
|
|
20
|
+
scrollable: {
|
|
21
|
+
kVQacm: "xysyzu8",
|
|
22
|
+
$$css: true
|
|
23
|
+
}
|
|
24
|
+
};
|
|
19
25
|
/**
|
|
20
26
|
* Stack item component for controlling individual item behavior within a stack.
|
|
21
27
|
*
|
|
@@ -33,6 +39,7 @@ import { themeProps } from "../utils/themeProps.js";
|
|
|
33
39
|
export function StackItem({
|
|
34
40
|
crossAlignSelf,
|
|
35
41
|
size,
|
|
42
|
+
isScrollable,
|
|
36
43
|
as: element = 'div',
|
|
37
44
|
xstyle,
|
|
38
45
|
className,
|
|
@@ -44,7 +51,7 @@ export function StackItem({
|
|
|
44
51
|
const stylexProps = stylex.props(...stackItem({
|
|
45
52
|
crossAlignSelf,
|
|
46
53
|
size
|
|
47
|
-
}), xstyle);
|
|
54
|
+
}), isScrollable && overflowStyles.scrollable, xstyle);
|
|
48
55
|
return /*#__PURE__*/createElement(element, {
|
|
49
56
|
ref: ref,
|
|
50
57
|
...mergeProps(themeProps('stack-item', {
|
package/dist/Switch/Switch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Switch.tsx
|
|
3
|
-
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus
|
|
3
|
+
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus, useTooltip
|
|
4
4
|
* @output Exports Switch component, SwitchProps, SwitchLabelPosition, SwitchLabelSpacing
|
|
5
5
|
* @position Core implementation; consumed by index.ts, tested by Switch.test.tsx
|
|
6
6
|
*
|
|
@@ -56,6 +56,27 @@ export interface SwitchProps extends Omit<BaseProps, 'onChange'> {
|
|
|
56
56
|
* @default false
|
|
57
57
|
*/
|
|
58
58
|
isDisabled?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Explains why the switch is disabled. When set together with `isDisabled`,
|
|
61
|
+
* the switch shows a tooltip with this text on hover and keyboard focus, and
|
|
62
|
+
* the control stays focusable (via `aria-disabled`) so the reason is
|
|
63
|
+
* discoverable by keyboard and assistive technology. Activation stays
|
|
64
|
+
* blocked.
|
|
65
|
+
*
|
|
66
|
+
* Use this instead of wrapping a disabled switch in `Tooltip` — disabled
|
|
67
|
+
* controls don't emit the pointer events an external tooltip needs.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```
|
|
71
|
+
* <Switch
|
|
72
|
+
* label="Enable notifications"
|
|
73
|
+
* value={enabled}
|
|
74
|
+
* isDisabled
|
|
75
|
+
* disabledMessage="Notifications are turned off org-wide"
|
|
76
|
+
* />
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
disabledMessage?: string;
|
|
59
80
|
/**
|
|
60
81
|
* Whether the field is optional. Mutually exclusive with isRequired.
|
|
61
82
|
* @default false
|
|
@@ -126,7 +147,7 @@ export interface SwitchProps extends Omit<BaseProps, 'onChange'> {
|
|
|
126
147
|
* />
|
|
127
148
|
* ```
|
|
128
149
|
*/
|
|
129
|
-
export declare function Switch({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, isOptional, isRequired, onFocus, onBlur, labelIcon, labelTooltip, labelPosition, labelSpacing, status, width, xstyle, className, style, ref, }: SwitchProps): import("react").JSX.Element;
|
|
150
|
+
export declare function Switch({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, disabledMessage, isOptional, isRequired, onFocus, onBlur, labelIcon, labelTooltip, labelPosition, labelSpacing, status, width, xstyle, className, style, ref, }: SwitchProps): import("react").JSX.Element;
|
|
130
151
|
export declare namespace Switch {
|
|
131
152
|
var displayName: string;
|
|
132
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/Switch/Switch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/Switch/Switch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AA4I9C,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEtD,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACxE;;OAEG;IACH,YAAY,CAAC,EAAE,CACb,OAAO,EAAE,OAAO,EAChB,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAC7B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,OAAO,EACP,MAAM,EACN,SAAS,EACT,YAAY,EACZ,aAAqB,EACrB,YAAwB,EACxB,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,GACJ,EAAE,WAAW,+BA8Kb;yBAtMe,MAAM"}
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Switch.tsx
|
|
7
|
-
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus
|
|
7
|
+
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus, useTooltip
|
|
8
8
|
* @output Exports Switch component, SwitchProps, SwitchLabelPosition, SwitchLabelSpacing
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by Switch.test.tsx
|
|
10
10
|
*
|
|
@@ -22,10 +22,12 @@ import { colorVars, spacingVars, radiusVars, durationVars, easeVars, typographyV
|
|
|
22
22
|
import { FieldLabel } from "../Field/FieldLabel.js";
|
|
23
23
|
import { FieldStatus } from "../FieldStatus/FieldStatus.js";
|
|
24
24
|
import { Spinner } from "../Spinner/index.js";
|
|
25
|
-
import {
|
|
25
|
+
import { useTooltip } from "../Tooltip/index.js";
|
|
26
|
+
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
26
27
|
import "./switch.markers.stylex.js";
|
|
27
28
|
import { switchScope } from "./switch.markers.stylex.js";
|
|
28
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
30
|
+
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
29
31
|
|
|
30
32
|
// Fixed dimensions: 40px width, 24px height, 16px thumb (off), 20px thumb (on)
|
|
31
33
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -88,6 +90,7 @@ export function Switch({
|
|
|
88
90
|
isLoading = false,
|
|
89
91
|
value,
|
|
90
92
|
isDisabled = false,
|
|
93
|
+
disabledMessage,
|
|
91
94
|
isOptional = false,
|
|
92
95
|
isRequired = false,
|
|
93
96
|
onFocus,
|
|
@@ -111,6 +114,19 @@ export function Switch({
|
|
|
111
114
|
const isBusy = isLoading || optimisticValue !== value;
|
|
112
115
|
const isOn = optimisticValue === true;
|
|
113
116
|
|
|
117
|
+
// Disabled-reason tooltip. Disabled controls swallow pointer events, so the
|
|
118
|
+
// tooltip listeners attach to the switch row (which already exists) and the
|
|
119
|
+
// native checkbox stays perceivable via aria-disabled instead of the disabled
|
|
120
|
+
// attribute. Toggling is blocked by the isDisabled guard in onChange.
|
|
121
|
+
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
122
|
+
const disabledMessageTooltip = useTooltip({
|
|
123
|
+
placement: 'above',
|
|
124
|
+
// The container row is not naturally focusable; focusin bubbles up from the
|
|
125
|
+
// native input, so always attach focus listeners.
|
|
126
|
+
focusTrigger: 'always',
|
|
127
|
+
isEnabled: showsDisabledMessage
|
|
128
|
+
});
|
|
129
|
+
|
|
114
130
|
// Build aria-describedby from description and status message
|
|
115
131
|
// Only include descriptionID when the element actually renders
|
|
116
132
|
const describedByParts = [];
|
|
@@ -120,21 +136,29 @@ export function Switch({
|
|
|
120
136
|
if (status?.message) {
|
|
121
137
|
describedByParts.push(statusMessageID);
|
|
122
138
|
}
|
|
139
|
+
if (showsDisabledMessage) {
|
|
140
|
+
describedByParts.push(disabledMessageTooltip.describedBy);
|
|
141
|
+
}
|
|
123
142
|
const ariaDescribedBy = describedByParts.length > 0 ? describedByParts.join(' ') : undefined;
|
|
124
143
|
const switchElement = /*#__PURE__*/_jsxs("div", {
|
|
125
144
|
...{
|
|
126
145
|
className: "x1n2onr6 x78zum5 x6s0dn4 x2lah0s x100vrsf xxk0z11 xc8icb0"
|
|
127
146
|
},
|
|
128
147
|
children: [/*#__PURE__*/_jsx("input", {
|
|
129
|
-
ref: ref,
|
|
148
|
+
ref: mergeRefs(ref, disabledMessageTooltip.positionRef),
|
|
130
149
|
id: id,
|
|
131
150
|
type: "checkbox",
|
|
132
151
|
role: "switch",
|
|
133
|
-
checked: isOn
|
|
134
|
-
disabled
|
|
152
|
+
checked: isOn
|
|
153
|
+
// With a disabledMessage the switch keeps focusability via aria-disabled
|
|
154
|
+
// so the reason is focus-discoverable; toggling is still blocked by the
|
|
155
|
+
// isDisabled guard in onChange below.
|
|
156
|
+
,
|
|
157
|
+
disabled: isDisabled && !showsDisabledMessage,
|
|
158
|
+
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
135
159
|
required: isRequired,
|
|
136
160
|
onChange: e => {
|
|
137
|
-
if (isBusy) {
|
|
161
|
+
if (isDisabled || isBusy) {
|
|
138
162
|
return;
|
|
139
163
|
}
|
|
140
164
|
const checked = e.target.checked;
|
|
@@ -235,10 +259,7 @@ export function Switch({
|
|
|
235
259
|
size: "sm"
|
|
236
260
|
})
|
|
237
261
|
})
|
|
238
|
-
}), isBusy && /*#__PURE__*/_jsx(
|
|
239
|
-
...{
|
|
240
|
-
className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km"
|
|
241
|
-
},
|
|
262
|
+
}), isBusy && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
242
263
|
role: "status",
|
|
243
264
|
children: "Loading"
|
|
244
265
|
})]
|
|
@@ -266,6 +287,15 @@ export function Switch({
|
|
|
266
287
|
labelSpacing: labelSpacing !== 'default' ? labelSpacing : undefined
|
|
267
288
|
}), stylex.props(width != null && dynamicWidthStyles.width(width), xstyle), className, style),
|
|
268
289
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
290
|
+
ref: el => {
|
|
291
|
+
// Interaction (hover/focus) listeners for the disabled-message
|
|
292
|
+
// tooltip attach to the whole row for a larger trigger target;
|
|
293
|
+
// positioning anchors on the switch itself (above) so the tooltip
|
|
294
|
+
// appears next to the control, not the far edge of the row.
|
|
295
|
+
// Handlers are gated internally by isEnabled, so attaching
|
|
296
|
+
// unconditionally is safe.
|
|
297
|
+
disabledMessageTooltip.interactionRef(el);
|
|
298
|
+
},
|
|
269
299
|
...stylex.props(styles.container, labelSpacing === 'spread' && styles.containerSpread, !isDisabled && switchScope),
|
|
270
300
|
children: [' ', labelPosition === 'start' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
271
301
|
children: [labelElement, switchElement]
|
|
@@ -282,7 +312,7 @@ export function Switch({
|
|
|
282
312
|
id: statusMessageID,
|
|
283
313
|
variant: "detached"
|
|
284
314
|
})
|
|
285
|
-
})]
|
|
315
|
+
}), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
286
316
|
});
|
|
287
317
|
}
|
|
288
318
|
Switch.displayName = 'Switch';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../src/TabList/Tab.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAYzD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAK5C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,MAAM,WAAW,QAAS,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC5D;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAoID;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,EAClB,EAAE,EACF,GAAG,EACH,KAAK,EACL,KAAK,EACL,aAAqB,EACrB,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACb,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../src/TabList/Tab.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAYzD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAK5C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,MAAM,WAAW,QAAS,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC5D;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAoID;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,EAClB,EAAE,EACF,GAAG,EACH,KAAK,EACL,KAAK,EACL,aAAqB,EACrB,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACb,EAAE,QAAQ,qBA2GV;yBAzHe,GAAG"}
|
package/dist/TabList/Tab.js
CHANGED
|
@@ -186,7 +186,13 @@ export function Tab({
|
|
|
186
186
|
'aria-label': label
|
|
187
187
|
} : {}),
|
|
188
188
|
[EDGE_COMP_ATTR]: '',
|
|
189
|
+
'data-tab-value': value,
|
|
189
190
|
'aria-current': isSelected ? 'page' : undefined,
|
|
191
|
+
// Roving tabindex: the tab strip is a single Tab stop. The selected tab is
|
|
192
|
+
// the tabbable one; the rest are reachable via arrow keys (handled by
|
|
193
|
+
// TabList's onKeyDown). When no tab is selected, TabList's repair effect
|
|
194
|
+
// makes the first stop tabbable.
|
|
195
|
+
tabIndex: isSelected ? 0 : -1,
|
|
190
196
|
...mergeProps(themeProps('tab', {
|
|
191
197
|
selected: isSelected ? 'selected' : null
|
|
192
198
|
}), stylex.props(styles.base, sizeStyles[size], isSelected && styles.selected, isFill && layoutStyles.fill, tabScope, xstyle), className, style)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file TabList.tsx
|
|
3
|
-
* @input Uses React, StyleX, TabListContext
|
|
3
|
+
* @input Uses React, StyleX, TabListContext, useListFocus, useKeyboardHint
|
|
4
4
|
* @output Exports TabList component and TabListProps type
|
|
5
|
-
* @position Nav wrapper; provides TabListContext to Tab and TabMenu children
|
|
5
|
+
* @position Nav wrapper; provides TabListContext to Tab and TabMenu children.
|
|
6
|
+
* Owns roving-tabindex keyboard navigation (Arrow/Home/End) across the tab
|
|
7
|
+
* strip via the shared useListFocus hook so it is a single Tab stop.
|
|
6
8
|
*
|
|
7
9
|
* SYNC: When modified, update:
|
|
8
10
|
* - /packages/core/src/TabList/TabList.doc.mjs
|
|
@@ -12,7 +14,8 @@
|
|
|
12
14
|
*/
|
|
13
15
|
import React, { type ReactNode } from 'react';
|
|
14
16
|
import type { BaseProps } from '../BaseProps';
|
|
15
|
-
import type { TabListSize } from './TabListContext';
|
|
17
|
+
import type { TabListOrientation, TabListSize } from './TabListContext';
|
|
18
|
+
import { EDGE_COMP_ATTR } from '../Layout/edgeCompensation.stylex';
|
|
16
19
|
export interface TabListProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
|
|
17
20
|
ref?: React.Ref<HTMLElement>;
|
|
18
21
|
/**
|
|
@@ -41,6 +44,15 @@ export interface TabListProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
|
|
|
41
44
|
* @default false
|
|
42
45
|
*/
|
|
43
46
|
hasDivider?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Orientation of the tab strip, controlling which arrow keys move
|
|
49
|
+
* focus between tabs.
|
|
50
|
+
* - `'horizontal'` (default): ArrowLeft / ArrowRight (ArrowUp / ArrowDown
|
|
51
|
+
* also work per the WAI-ARIA APG).
|
|
52
|
+
* - `'vertical'`: ArrowUp / ArrowDown (ArrowLeft / ArrowRight also work).
|
|
53
|
+
* @default 'horizontal'
|
|
54
|
+
*/
|
|
55
|
+
orientation?: TabListOrientation;
|
|
44
56
|
/**
|
|
45
57
|
* Tab and TabMenu children.
|
|
46
58
|
*/
|
|
@@ -62,7 +74,7 @@ export interface TabListProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
|
|
|
62
74
|
* </TabList>
|
|
63
75
|
* ```
|
|
64
76
|
*/
|
|
65
|
-
export declare function TabList({ ref, value, onChange, size: sizeProp, layout, hasDivider, xstyle, className, style, children, ...restProps }: TabListProps): React.JSX.Element;
|
|
77
|
+
export declare function TabList({ ref, value, onChange, size: sizeProp, layout, hasDivider, orientation, xstyle, className, style, children, onKeyDown: onKeyDownProp, onFocus: onFocusProp, onBlur: onBlurProp, 'aria-label': ariaLabel, 'aria-orientation': _ariaOrientation, [EDGE_COMP_ATTR]: _edgeCompAttr, ...restProps }: TabListProps): React.JSX.Element;
|
|
66
78
|
export declare namespace TabList {
|
|
67
79
|
var displayName: string;
|
|
68
80
|
}
|