@astryxdesign/core 0.4.5 → 0.4.6-canary.cea9ecd
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 +134 -0
- package/dist/Avatar/Avatar.d.ts +10 -5
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +139 -30
- package/dist/Avatar/AvatarStatusDot.d.ts +2 -1
- package/dist/Avatar/AvatarStatusDot.d.ts.map +1 -1
- package/dist/Avatar/AvatarStatusDot.js +30 -4
- package/dist/Avatar/AvatarStatusLabelContext.d.ts +39 -0
- package/dist/Avatar/AvatarStatusLabelContext.d.ts.map +1 -0
- package/dist/Avatar/AvatarStatusLabelContext.js +41 -0
- package/dist/AvatarGroup/AvatarGroup.d.ts +3 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +15 -9
- package/dist/Blockquote/Blockquote.d.ts +4 -3
- package/dist/Blockquote/Blockquote.d.ts.map +1 -1
- package/dist/Blockquote/Blockquote.js +9 -10
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +21 -5
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +47 -34
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +7 -7
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +21 -12
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +8 -4
- package/dist/Calendar/styles.d.ts +2 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +5 -5
- package/dist/Center/Center.d.ts +23 -1
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +12 -6
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +3 -3
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +2 -2
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +2 -2
- package/dist/Chat/useChatDictation.d.ts +1 -1
- package/dist/Chat/useChatDictation.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -3
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +2 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +2 -2
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +5 -5
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +4 -4
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +1 -1
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +2 -2
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +6 -6
- package/dist/DateInput/DateInput.d.ts +31 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +90 -22
- package/dist/DateInput/MonthScroller.d.ts +35 -0
- package/dist/DateInput/MonthScroller.d.ts.map +1 -0
- package/dist/DateInput/MonthScroller.js +658 -0
- package/dist/DateInput/MonthYearWheels.d.ts +24 -0
- package/dist/DateInput/MonthYearWheels.d.ts.map +1 -0
- package/dist/DateInput/MonthYearWheels.js +114 -0
- package/dist/DateInput/TouchDateField.d.ts +10 -0
- package/dist/DateInput/TouchDateField.d.ts.map +1 -0
- package/dist/DateInput/TouchDateField.js +810 -0
- package/dist/DateInput/Wheel.d.ts +41 -0
- package/dist/DateInput/Wheel.d.ts.map +1 -0
- package/dist/DateInput/Wheel.js +315 -0
- package/dist/DateInput/monthGeometry.d.ts +65 -0
- package/dist/DateInput/monthGeometry.d.ts.map +1 -0
- package/dist/DateInput/monthGeometry.js +98 -0
- package/dist/DateInput/tokens.stylex.d.ts +63 -0
- package/dist/DateInput/tokens.stylex.d.ts.map +1 -0
- package/dist/DateInput/tokens.stylex.js +74 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts +41 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts.map +1 -0
- package/dist/DateInput/useOwnScrollGesture.js +202 -0
- package/dist/DateInput/usePointerDragScroll.d.ts +15 -0
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -0
- package/dist/DateInput/usePointerDragScroll.js +216 -0
- package/dist/DateInput/useScrollSettle.d.ts +26 -0
- package/dist/DateInput/useScrollSettle.d.ts.map +1 -0
- package/dist/DateInput/useScrollSettle.js +149 -0
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +17 -14
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +17 -14
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +2 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +2 -2
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +2 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +2 -2
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +4 -4
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +6 -0
- package/dist/Field/inputStyles.stylex.d.ts +1 -1
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +5 -5
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +6 -6
- package/dist/HoverCard/HoverCard.d.ts +13 -3
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +2 -0
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/HoverCard/index.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +17 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +78 -9
- package/dist/InputGroup/InputGroup.js +1 -1
- package/dist/Item/Item.d.ts +9 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +52 -14
- package/dist/Layer/index.d.ts +4 -2
- package/dist/Layer/index.d.ts.map +1 -1
- package/dist/Layer/index.js +2 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +3 -2
- package/dist/Layer/useTouchTrigger.d.ts +113 -0
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -0
- package/dist/Layer/useTouchTrigger.js +241 -0
- package/dist/Layout/container.stylex.d.ts +4 -2
- package/dist/Layout/container.stylex.d.ts.map +1 -1
- package/dist/Layout/container.stylex.js +19 -11
- package/dist/Layout/index.d.ts +1 -0
- package/dist/Layout/index.d.ts.map +1 -1
- package/dist/Layout/index.js +4 -0
- package/dist/Layout/padding.stylex.d.ts +315 -12
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +389 -12
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +5 -4
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +6 -6
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +1 -1
- package/dist/MobileNav/MobileNav.d.ts +1 -0
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +24 -6
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +8 -8
- package/dist/NavItem/navItemStyles.stylex.d.ts +4 -4
- package/dist/NavItem/navItemStyles.stylex.d.ts.map +1 -1
- package/dist/NavItem/navItemStyles.stylex.js +4 -4
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +3 -3
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +36 -8
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +3 -3
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +2 -2
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +11 -12
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -1
- package/dist/PowerSearch/formatFilterValue.d.ts +11 -2
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +23 -8
- package/dist/RadioList/RadioListItem.d.ts +2 -2
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +70 -40
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +7 -7
- package/dist/Section/Section.d.ts +36 -1
- package/dist/Section/Section.d.ts.map +1 -1
- package/dist/Section/Section.js +12 -2
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +7 -2
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +3 -3
- package/dist/Selector/Selector.d.ts +26 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +93 -20
- package/dist/Selector/SelectorOption.d.ts +14 -1
- package/dist/Selector/SelectorOption.d.ts.map +1 -1
- package/dist/Selector/SelectorOption.js +6 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts +8 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -0
- package/dist/Selector/SelectorRowLayoutContext.js +27 -0
- package/dist/Selector/types.d.ts +1 -0
- package/dist/Selector/types.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +4 -4
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +3 -3
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +7 -7
- package/dist/Stack/Stack.d.ts +23 -1
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +12 -6
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +2 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +1 -1
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +3 -3
- package/dist/Table/TableRow.js +4 -4
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +2 -2
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +2 -2
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +2 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts +5 -3
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +12 -9
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +3 -3
- package/dist/TextArea/TextArea.js +1 -1
- package/dist/TextInput/TextInput.js +1 -1
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +3 -3
- package/dist/TimeInput/TimeInput.js +2 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +6 -4
- package/dist/Timestamp/formatInstant.d.ts +3 -2
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +8 -8
- package/dist/Timestamp/tooltipEntries.d.ts +2 -1
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +5 -3
- package/dist/Toast/Toast.d.ts +4 -3
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +10 -7
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +6 -6
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +1 -1
- package/dist/Tooltip/Tooltip.d.ts +16 -3
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +2 -0
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +21 -2
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +71 -13
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +4 -4
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +3 -3
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +2 -2
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +2 -2
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +4 -4
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +7 -7
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +2 -2
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +1 -1
- package/dist/astryx.css +124 -62
- package/dist/hooks/containerReveal.stylex.d.ts.map +1 -1
- package/dist/hooks/containerReveal.stylex.js +18 -18
- package/dist/hooks/scrollbarGutter.d.ts +28 -0
- package/dist/hooks/scrollbarGutter.d.ts.map +1 -0
- package/dist/hooks/scrollbarGutter.js +103 -0
- package/dist/hooks/useAutoMediaMode.d.ts +31 -0
- package/dist/hooks/useAutoMediaMode.d.ts.map +1 -0
- package/dist/hooks/useAutoMediaMode.js +201 -0
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +1 -1
- package/dist/hooks/useListFocus.d.ts +5 -2
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +12 -6
- package/dist/hooks/useScrollLock.d.ts +4 -0
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +13 -1
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +2 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +6 -0
- package/dist/i18n/useCollator.d.ts +12 -0
- package/dist/i18n/useCollator.d.ts.map +1 -0
- package/dist/i18n/useCollator.js +40 -0
- package/dist/i18n/useLocale.d.ts +3 -0
- package/dist/i18n/useLocale.d.ts.map +1 -0
- package/dist/i18n/useLocale.js +31 -0
- package/dist/theme/MediaTheme.d.ts +25 -5
- package/dist/theme/MediaTheme.d.ts.map +1 -1
- package/dist/theme/MediaTheme.js +31 -6
- package/dist/theme/defineTheme.d.ts +5 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +5 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +7 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +66 -5
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/syntax/index.d.ts +6 -0
- package/dist/theme/syntax/index.d.ts.map +1 -1
- package/dist/theme/syntax/index.js +7 -2
- package/dist/utils/dateParser.d.ts +4 -3
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +8 -8
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/plainDate.d.ts +5 -2
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +20 -4
- package/locales/en.json +28 -0
- package/locales/pseudo.json +21 -0
- package/package.json +3 -3
- package/src/Avatar/Avatar.doc.mjs +10 -6
- package/src/Avatar/Avatar.test.tsx +219 -1
- package/src/Avatar/Avatar.tsx +179 -37
- package/src/Avatar/AvatarStatusDot.tsx +30 -4
- package/src/Avatar/AvatarStatusLabelContext.ts +47 -0
- package/src/AvatarGroup/AvatarGroup.doc.mjs +10 -6
- package/src/AvatarGroup/AvatarGroup.test.tsx +62 -0
- package/src/AvatarGroup/AvatarGroup.tsx +3 -1
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +31 -8
- package/src/Banner/Banner.doc.mjs +2 -0
- package/src/Blockquote/Blockquote.doc.mjs +30 -7
- package/src/Blockquote/Blockquote.test.tsx +34 -3
- package/src/Blockquote/Blockquote.tsx +11 -9
- package/src/BottomSheet/BottomSheet.doc.mjs +3 -3
- package/src/BottomSheet/BottomSheet.test.tsx +24 -0
- package/src/BottomSheet/BottomSheetPanel.test.tsx +91 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +58 -3
- package/src/Breadcrumbs/BreadcrumbItem.tsx +36 -23
- package/src/Breadcrumbs/Breadcrumbs.doc.mjs +26 -2
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +31 -0
- package/src/Button/Button.tsx +12 -9
- package/src/Calendar/Calendar.tsx +15 -9
- package/src/Calendar/hooks/useCalendarNavigation.ts +6 -4
- package/src/Calendar/styles.ts +8 -5
- package/src/Center/Center.doc.mjs +48 -0
- package/src/Center/Center.test.tsx +158 -0
- package/src/Center/Center.tsx +50 -9
- package/src/Chat/ChatComposer.tsx +11 -5
- package/src/Chat/ChatComposerDrawer.tsx +4 -1
- package/src/Chat/ChatToolCalls.tsx +13 -4
- package/src/Chat/{useChatDictation.test.ts → useChatDictation.test.tsx} +29 -14
- package/src/Chat/useChatDictation.ts +1 -1
- package/src/Chat/useSpeechRecognition.ts +5 -3
- package/src/Chat/useTriggerMenu.tsx +4 -1
- package/src/CheckboxInput/CheckboxInput.tsx +5 -2
- package/src/Citation/Citation.test.tsx +6 -1
- package/src/Citation/Citation.tsx +11 -5
- package/src/ClickableCard/ClickableCard.tsx +7 -4
- package/src/CodeBlock/CodeBlock.tsx +4 -1
- package/src/Collapsible/Collapsible.tsx +5 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +6 -3
- package/src/ComplexSelector/ComplexSelector.doc.mjs +10 -0
- package/src/ComplexSelector/ComplexSelector.tsx +14 -7
- package/src/DateInput/DateInput.test.tsx +17 -1
- package/src/DateInput/DateInput.tsx +93 -21
- package/src/DateInput/DateInputTouch.test.tsx +2582 -0
- package/src/DateInput/MonthScroller.tsx +878 -0
- package/src/DateInput/MonthYearWheels.tsx +147 -0
- package/src/DateInput/TouchDateField.tsx +1223 -0
- package/src/DateInput/Wheel.tsx +473 -0
- package/src/DateInput/monthGeometry.ts +118 -0
- package/src/DateInput/tokens.stylex.ts +99 -0
- package/src/DateInput/useOwnScrollGesture.ts +227 -0
- package/src/DateInput/usePointerDragScroll.ts +220 -0
- package/src/DateInput/useScrollSettle.ts +164 -0
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.tsx +31 -13
- package/src/DateTimeInput/DateTimeInput.tsx +25 -9
- package/src/Dialog/Dialog.test.tsx +24 -0
- package/src/Dialog/Dialog.tsx +3 -0
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -2
- package/src/DropdownMenu/DropdownMenuItem.tsx +5 -2
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -2
- package/src/Field/Field.doc.mjs +2 -0
- package/src/Field/FieldLabel.tsx +9 -3
- package/src/Field/InputClearButton.test.tsx +110 -3
- package/src/Field/InputClearButton.tsx +38 -0
- package/src/Field/inputStyles.stylex.ts +17 -13
- package/src/FileInput/FileInput.tsx +15 -8
- package/src/FormLayout/FormLayout.doc.mjs +1 -1
- package/src/HoverCard/HoverCard.doc.mjs +18 -0
- package/src/HoverCard/HoverCard.test.tsx +189 -0
- package/src/HoverCard/HoverCard.tsx +22 -2
- package/src/HoverCard/index.ts +1 -0
- package/src/HoverCard/useHoverCard.doc.mjs +2 -0
- package/src/HoverCard/useHoverCard.tsx +103 -7
- package/src/InputGroup/InputGroup.tsx +1 -1
- package/src/Item/Item.doc.mjs +1 -0
- package/src/Item/Item.test.tsx +50 -0
- package/src/Item/Item.tsx +54 -6
- package/src/Layer/index.ts +10 -0
- package/src/Layer/useLayer.tsx +13 -2
- package/src/Layer/useTouchTrigger.test.ts +70 -0
- package/src/Layer/useTouchTrigger.ts +366 -0
- package/src/Layout/Layout.doc.mjs +18 -0
- package/src/Layout/container.stylex.ts +11 -3
- package/src/Layout/index.ts +4 -0
- package/src/Layout/overlayPaddingReset.test.tsx +222 -0
- package/src/Layout/padding.stylex.ts +192 -12
- package/src/Lightbox/Lightbox.tsx +11 -3
- package/src/Link/Link.tsx +9 -6
- package/src/MetadataList/MetadataList.tsx +4 -1
- package/src/MobileNav/MobileNav.tsx +61 -5
- package/src/MobileNav/MobileNavEntryAnimation.test.tsx +212 -0
- package/src/MobileNav/MobileNavScrollbarGutter.test.tsx +109 -0
- package/src/MultiSelector/MultiSelector.test.tsx +1 -1
- package/src/MultiSelector/MultiSelector.tsx +26 -10
- package/src/NavItem/navItemStyles.stylex.ts +7 -4
- package/src/NavMenu/NavHeadingMenuItem.tsx +6 -3
- package/src/NumberInput/NumberInput.doc.mjs +24 -0
- package/src/NumberInput/NumberInput.test.tsx +138 -0
- package/src/NumberInput/NumberInput.tsx +47 -8
- package/src/Outline/Outline.tsx +5 -2
- package/src/Pagination/Pagination.tsx +5 -2
- package/src/Popover/Popover.test.tsx +27 -1
- package/src/PowerSearch/PowerSearch.tsx +17 -8
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/formatFilterValue.test.ts +22 -2
- package/src/PowerSearch/formatFilterValue.ts +31 -6
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/RadioList/RadioList.test.tsx +170 -2
- package/src/RadioList/RadioListItem.tsx +88 -53
- package/src/Resizable/ResizeHandle.test.tsx +22 -0
- package/src/Resizable/ResizeHandle.tsx +25 -7
- package/src/Section/Section.doc.mjs +55 -0
- package/src/Section/Section.test.tsx +201 -4
- package/src/Section/Section.tsx +69 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +31 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +15 -3
- package/src/SelectableCard/SelectableCard.tsx +6 -3
- package/src/Selector/Selector.doc.mjs +16 -2
- package/src/Selector/Selector.test.tsx +525 -1
- package/src/Selector/Selector.tsx +180 -25
- package/src/Selector/SelectorOption.doc.mjs +7 -0
- package/src/Selector/SelectorOption.tsx +21 -0
- package/src/Selector/SelectorRowLayoutContext.ts +32 -0
- package/src/Selector/types.ts +4 -4
- package/src/SideNav/SideNavHeading.tsx +14 -5
- package/src/SideNav/SideNavItem.tsx +9 -3
- package/src/Slider/Slider.tsx +25 -6
- package/src/Stack/Stack.doc.mjs +72 -0
- package/src/Stack/Stack.test.tsx +156 -0
- package/src/Stack/Stack.tsx +50 -8
- package/src/Switch/Switch.tsx +5 -2
- package/src/TabList/Tab.tsx +4 -1
- package/src/TabList/TabMenu.tsx +9 -3
- package/src/Table/TableRow.tsx +4 -4
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +6 -2
- package/src/Table/plugins/filtering/useTableFiltering.tsx +4 -1
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +10 -3
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +6 -3
- package/src/Table/plugins/sortable/useTableSortable.tsx +4 -1
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +34 -0
- package/src/Table/plugins/sortable/useTableSortableState.tsx +26 -23
- package/src/Table/plugins/tree/useTableTreeData.tsx +10 -4
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextArea/TextArea.tsx +1 -1
- package/src/TextInput/TextInput.tsx +1 -1
- package/src/Thumbnail/Thumbnail.tsx +9 -3
- package/src/TimeInput/TimeInput.tsx +1 -1
- package/src/Timestamp/Timestamp.test.tsx +27 -7
- package/src/Timestamp/Timestamp.tsx +8 -4
- package/src/Timestamp/formatInstant.ts +9 -7
- package/src/Timestamp/tooltipEntries.test.ts +11 -6
- package/src/Timestamp/tooltipEntries.ts +6 -2
- package/src/Toast/Toast.tsx +9 -7
- package/src/Token/Token.tsx +14 -5
- package/src/Tokenizer/Tokenizer.tsx +4 -1
- package/src/Tooltip/Tooltip.doc.mjs +18 -0
- package/src/Tooltip/Tooltip.test.tsx +254 -1
- package/src/Tooltip/Tooltip.tsx +22 -2
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/useTooltip.doc.mjs +2 -0
- package/src/Tooltip/useTooltip.tsx +99 -21
- package/src/TopNav/TopNavHeading.tsx +13 -4
- package/src/TopNav/TopNavItem.tsx +6 -3
- package/src/TopNav/TopNavMegaMenu.tsx +5 -2
- package/src/TopNav/TopNavMegaMenuItem.tsx +5 -2
- package/src/TopNav/TopNavMenu.tsx +10 -4
- package/src/TreeList/TreeListItem.tsx +22 -7
- package/src/Typeahead/BaseTypeahead.tsx +5 -2
- package/src/Typeahead/Typeahead.tsx +4 -1
- package/src/hooks/containerReveal.stylex.ts +54 -18
- package/src/hooks/scrollbarGutter.test.ts +167 -0
- package/src/hooks/scrollbarGutter.ts +121 -0
- package/src/hooks/useAutoMediaMode.test.ts +109 -0
- package/src/hooks/useAutoMediaMode.ts +233 -0
- package/src/hooks/useInputStatusIcon.tsx +4 -1
- package/src/hooks/useListFocus.doc.mjs +2 -2
- package/src/hooks/useListFocus.test.tsx +65 -3
- package/src/hooks/useListFocus.ts +15 -7
- package/src/hooks/useScrollLock.doc.mjs +4 -4
- package/src/hooks/useScrollLock.test.ts +73 -0
- package/src/hooks/useScrollLock.ts +14 -0
- package/src/i18n/InternationalizationContext.ts +2 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +37 -1
- package/src/i18n/__tests__/useCollator.test.tsx +115 -0
- package/src/i18n/__tests__/useLocale.test.tsx +52 -0
- package/src/i18n/index.ts +6 -0
- package/src/i18n/useCollator.doc.mjs +84 -0
- package/src/i18n/useCollator.ts +44 -0
- package/src/i18n/useLocale.doc.mjs +70 -0
- package/src/i18n/useLocale.ts +34 -0
- package/src/i18n/useTranslator.doc.mjs +1 -1
- package/src/reset.css +9 -2
- package/src/reset.test.ts +22 -0
- package/src/theme/MediaTheme.doc.mjs +23 -4
- package/src/theme/MediaTheme.dom.test.tsx +97 -0
- package/src/theme/MediaTheme.tsx +42 -7
- package/src/theme/defineTheme.test.ts +9 -3
- package/src/theme/defineTheme.ts +5 -0
- package/src/theme/derivedVarRegistry.test.ts +19 -5
- package/src/theme/derivedVarRegistry.ts +4 -0
- package/src/theme/generateThemeRules.test.ts +118 -0
- package/src/theme/generateThemeRules.ts +83 -5
- package/src/theme/index.ts +1 -1
- package/src/theme/syntax/index.ts +6 -2
- package/src/theme/syntax/serverSafeSyntax.test.ts +68 -0
- package/src/utils/dateParser.test.ts +20 -0
- package/src/utils/dateParser.ts +14 -7
- package/src/utils/index.ts +2 -0
- package/src/utils/plainDate.test.ts +6 -0
- package/src/utils/plainDate.ts +21 -4
|
@@ -73,6 +73,7 @@ import {useCombobox, useSelectedItemOffset} from './hooks';
|
|
|
73
73
|
import {useTypeahead} from '../hooks/useTypeahead';
|
|
74
74
|
import {useResolvedRequired} from '../hooks/useResolvedRequired';
|
|
75
75
|
import {SelectorOption} from './SelectorOption';
|
|
76
|
+
import {SelectorRowLayoutContext} from './SelectorRowLayoutContext';
|
|
76
77
|
import {getInputARIA, isImeKeyEvent, mergeProps} from '../utils';
|
|
77
78
|
import {useSize} from '../SizeContext/SizeContext';
|
|
78
79
|
import type {BaseProps} from '../BaseProps';
|
|
@@ -101,9 +102,18 @@ const styles = stylex.create({
|
|
|
101
102
|
default: typeScaleVars['--text-label-size'],
|
|
102
103
|
'@media (pointer: coarse)': `max(1rem, ${typeScaleVars['--text-label-size']})`,
|
|
103
104
|
},
|
|
104
|
-
|
|
105
|
+
// A FIXED line box, not the ratio: the trigger's padding is derived from
|
|
106
|
+
// one line being `--spacing-5` tall, and a ratio makes the line box track
|
|
107
|
+
// the font — which the coarse-pointer bump above (and any theme that
|
|
108
|
+
// changes `--font-size-base`) then moves, taking the control off its size
|
|
109
|
+
// token. The glyphs still grow for touch; only the box they sit in is
|
|
110
|
+
// pinned. Item's own rows set their line heights and are unaffected.
|
|
111
|
+
lineHeight: spacingVars['--spacing-5'],
|
|
105
112
|
color: colorVars['--color-text-primary'],
|
|
106
|
-
cursor:
|
|
113
|
+
cursor: {
|
|
114
|
+
default: 'pointer',
|
|
115
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
116
|
+
},
|
|
107
117
|
},
|
|
108
118
|
// Trigger button — the actual combobox button, visually integrated with the container
|
|
109
119
|
trigger: {
|
|
@@ -124,7 +134,10 @@ const styles = stylex.create({
|
|
|
124
134
|
fontSize: 'inherit',
|
|
125
135
|
lineHeight: 'inherit',
|
|
126
136
|
color: 'inherit',
|
|
127
|
-
cursor:
|
|
137
|
+
cursor: {
|
|
138
|
+
default: 'pointer',
|
|
139
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
140
|
+
},
|
|
128
141
|
// The wrapper (inputWrapperStyles.base) renders the focus ring via
|
|
129
142
|
// :focus-within when this button is focused, matching TextInput/NumberInput.
|
|
130
143
|
// The button must not draw its own :focus-visible outline or the two stack
|
|
@@ -142,6 +155,43 @@ const styles = stylex.create({
|
|
|
142
155
|
whiteSpace: 'nowrap',
|
|
143
156
|
textAlign: 'start',
|
|
144
157
|
},
|
|
158
|
+
// Inside an InputGroup the group's own height is the row, and the trigger
|
|
159
|
+
// takes it: `height: 100%` from `groupStyles.inGroup` can only govern if the
|
|
160
|
+
// trigger stops asserting a floor of its own — otherwise a control sized
|
|
161
|
+
// above its group (`<InputGroup size="md"><Selector size="lg">`) grows the
|
|
162
|
+
// row it was supposed to sit in. The padding goes with it: the row is
|
|
163
|
+
// already the size token, and the value box is centred in it.
|
|
164
|
+
triggerInGroup: {
|
|
165
|
+
minHeight: 0,
|
|
166
|
+
paddingBlock: 0,
|
|
167
|
+
},
|
|
168
|
+
// Wrapper for `renderValue` output. Takes the free width and clips
|
|
169
|
+
// horizontally so a long value ellipsizes rather than widening the trigger;
|
|
170
|
+
// vertically the content sizes the control, which the size styles below
|
|
171
|
+
// handle.
|
|
172
|
+
triggerValue: {
|
|
173
|
+
flexGrow: 1,
|
|
174
|
+
minWidth: 0,
|
|
175
|
+
overflow: 'hidden',
|
|
176
|
+
textAlign: 'start',
|
|
177
|
+
},
|
|
178
|
+
// Inside an InputGroup the row height is the group's, so the trigger clamps
|
|
179
|
+
// its own value box to that row rather than asking the value to fit it: any
|
|
180
|
+
// node is cut off at the row's edge instead of bleeding through the border
|
|
181
|
+
// over whatever sits above and below the group. The rows the system draws
|
|
182
|
+
// itself never reach the cut — the row-layout context folds them onto one
|
|
183
|
+
// line first (SelectorRowLayoutContext).
|
|
184
|
+
//
|
|
185
|
+
// The clamp is a percentage, not the size token, because a group can be a
|
|
186
|
+
// different size than the control inside it; the row is whatever the group
|
|
187
|
+
// made it. That needs a definite height to resolve against, which is what
|
|
188
|
+
// stretching the button provides.
|
|
189
|
+
triggerButtonInGroup: {
|
|
190
|
+
alignSelf: 'stretch',
|
|
191
|
+
},
|
|
192
|
+
triggerValueInGroup: {
|
|
193
|
+
maxHeight: '100%',
|
|
194
|
+
},
|
|
145
195
|
// Only what Icon does not already provide: `size="sm"` gives the 16px box
|
|
146
196
|
// and `color` the token, but the glyph still must not shrink inside the flex
|
|
147
197
|
// trigger.
|
|
@@ -169,16 +219,17 @@ const styles = stylex.create({
|
|
|
169
219
|
backgroundColor: 'transparent',
|
|
170
220
|
backgroundImage: {
|
|
171
221
|
default: null,
|
|
172
|
-
':hover': {
|
|
222
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
173
223
|
'@media (hover: hover)': `linear-gradient(${colorVars['--color-overlay-hover']}, ${colorVars['--color-overlay-hover']})`,
|
|
174
224
|
},
|
|
175
225
|
':active': `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`,
|
|
176
226
|
},
|
|
177
227
|
boxShadow: {
|
|
178
228
|
default: 'none',
|
|
179
|
-
':hover:not(:focus-within)':
|
|
180
|
-
|
|
181
|
-
|
|
229
|
+
':hover:not(:focus-within):where(:not(:disabled,[aria-disabled="true"]))':
|
|
230
|
+
{
|
|
231
|
+
'@media (hover: hover)': 'none',
|
|
232
|
+
},
|
|
182
233
|
':focus-within': 'none',
|
|
183
234
|
},
|
|
184
235
|
fontWeight: fontWeightVars['--font-weight-medium'],
|
|
@@ -208,7 +259,10 @@ const styles = stylex.create({
|
|
|
208
259
|
borderStyle: 'none',
|
|
209
260
|
backgroundColor: 'transparent',
|
|
210
261
|
color: 'inherit',
|
|
211
|
-
cursor:
|
|
262
|
+
cursor: {
|
|
263
|
+
default: 'pointer',
|
|
264
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
265
|
+
},
|
|
212
266
|
borderRadius: radiusVars['--radius-element'],
|
|
213
267
|
},
|
|
214
268
|
|
|
@@ -286,7 +340,10 @@ const styles = stylex.create({
|
|
|
286
340
|
color: colorVars['--color-text-primary'],
|
|
287
341
|
backgroundColor: 'transparent',
|
|
288
342
|
border: 'none',
|
|
289
|
-
cursor:
|
|
343
|
+
cursor: {
|
|
344
|
+
default: 'pointer',
|
|
345
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
346
|
+
},
|
|
290
347
|
textAlign: 'start',
|
|
291
348
|
outline: 'none',
|
|
292
349
|
},
|
|
@@ -324,19 +381,35 @@ const styles = stylex.create({
|
|
|
324
381
|
},
|
|
325
382
|
itemDisabled: {
|
|
326
383
|
opacity: 0.5,
|
|
327
|
-
cursor: '
|
|
384
|
+
cursor: 'default',
|
|
328
385
|
},
|
|
329
386
|
});
|
|
330
387
|
|
|
388
|
+
// The trigger is sized by PADDING, not by a fixed height, so it is the size
|
|
389
|
+
// token plus one text line for each extra line the value uses: 28/32/36 for
|
|
390
|
+
// one line, 48/52/56 for two. The token and a text line are both multiples of
|
|
391
|
+
// 4, so every trigger lands on the 4px rhythm and lines up with the Buttons
|
|
392
|
+
// and inputs beside it. No prop picks the height — the content does, and it
|
|
393
|
+
// can only land on the grid.
|
|
394
|
+
//
|
|
395
|
+
// `--spacing-5` is one line here because `triggerContainer` pins its
|
|
396
|
+
// line-height to exactly that; the two must stay in step, which is why both
|
|
397
|
+
// read the same token rather than one hardcoding 20px.
|
|
398
|
+
const linePad = (token: string) =>
|
|
399
|
+
`calc((${token} - ${spacingVars['--spacing-5']} - 2 * ${borderVars['--border-width']}) / 2)`;
|
|
400
|
+
|
|
331
401
|
const sizeStyles = stylex.create({
|
|
332
402
|
sm: {
|
|
333
|
-
|
|
403
|
+
minHeight: sizeVars['--size-element-sm'],
|
|
404
|
+
paddingBlock: linePad(sizeVars['--size-element-sm']),
|
|
334
405
|
},
|
|
335
406
|
md: {
|
|
336
|
-
|
|
407
|
+
minHeight: sizeVars['--size-element-md'],
|
|
408
|
+
paddingBlock: linePad(sizeVars['--size-element-md']),
|
|
337
409
|
},
|
|
338
410
|
lg: {
|
|
339
|
-
|
|
411
|
+
minHeight: sizeVars['--size-element-lg'],
|
|
412
|
+
paddingBlock: linePad(sizeVars['--size-element-lg']),
|
|
340
413
|
},
|
|
341
414
|
});
|
|
342
415
|
|
|
@@ -517,7 +590,8 @@ interface SelectorPropsBase<
|
|
|
517
590
|
labelTooltip?: string;
|
|
518
591
|
|
|
519
592
|
/**
|
|
520
|
-
* Icon displayed at the start of the selector trigger.
|
|
593
|
+
* Icon displayed at the start of the selector trigger. Takes precedence over
|
|
594
|
+
* the selected option's own `icon`, which the trigger otherwise renders.
|
|
521
595
|
*/
|
|
522
596
|
startIcon?: ReactNode | IconType;
|
|
523
597
|
|
|
@@ -527,6 +601,31 @@ interface SelectorPropsBase<
|
|
|
527
601
|
*/
|
|
528
602
|
renderOption?: (option: SelectorOptionData) => ReactNode;
|
|
529
603
|
|
|
604
|
+
/**
|
|
605
|
+
* Custom render function for the selected option inside the closed trigger.
|
|
606
|
+
* Only called when something is selected; the placeholder is unaffected.
|
|
607
|
+
*
|
|
608
|
+
* Passing this does not change the trigger's height — what it draws does. A
|
|
609
|
+
* one-line value measures exactly the `size` token, so the control still
|
|
610
|
+
* lines up with the Buttons and inputs beside it; each further line of
|
|
611
|
+
* content adds one text line. Inside an `InputGroup` the group owns the row
|
|
612
|
+
* height: the trigger clamps its value box to that row, so a `SelectorOption`
|
|
613
|
+
* folds onto one line and ellipsizes, and anything taller than the row is cut
|
|
614
|
+
* off at it rather than bleeding over the rows above and below.
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```
|
|
618
|
+
* renderValue={option => (
|
|
619
|
+
* <SelectorOption
|
|
620
|
+
* icon={option.icon}
|
|
621
|
+
* label={option.label}
|
|
622
|
+
* description={option.description}
|
|
623
|
+
* />
|
|
624
|
+
* )}
|
|
625
|
+
* ```
|
|
626
|
+
*/
|
|
627
|
+
renderValue?: (option: SelectorOptionData) => ReactNode;
|
|
628
|
+
|
|
530
629
|
/**
|
|
531
630
|
* Which edge of the option row carries the selected mark. `start` reserves a
|
|
532
631
|
* mark column ahead of every label so they stay aligned, the way a native
|
|
@@ -614,7 +713,11 @@ export type SelectorProps<T extends SelectorOptionType = SelectorOptionType> =
|
|
|
614
713
|
*/
|
|
615
714
|
function DefaultOption({option}: {option: SelectorOptionData}) {
|
|
616
715
|
return (
|
|
617
|
-
<SelectorOption
|
|
716
|
+
<SelectorOption
|
|
717
|
+
icon={option.icon}
|
|
718
|
+
label={option.label ?? option.value}
|
|
719
|
+
description={option.description}
|
|
720
|
+
/>
|
|
618
721
|
);
|
|
619
722
|
}
|
|
620
723
|
|
|
@@ -687,6 +790,7 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
687
790
|
startIcon,
|
|
688
791
|
htmlName,
|
|
689
792
|
renderOption,
|
|
793
|
+
renderValue,
|
|
690
794
|
indicatorPosition = 'end',
|
|
691
795
|
hasSearch = false,
|
|
692
796
|
searchPlaceholder: searchPlaceholderFromProps,
|
|
@@ -1166,12 +1270,27 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1166
1270
|
aria-disabled={item.disabled}
|
|
1167
1271
|
onClick={() => onItemSelect(item)}
|
|
1168
1272
|
onMouseEnter={() => onItemMouseEnter(item, flatIndex)}
|
|
1169
|
-
{...
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1273
|
+
{...mergeProps(
|
|
1274
|
+
// Stable theme target on the option row itself, mirroring
|
|
1275
|
+
// `multi-selector-option`: it carries the row's size and runtime
|
|
1276
|
+
// state so a theme can express "selected option at large" or
|
|
1277
|
+
// restyle a given row density without structural selectors. The
|
|
1278
|
+
// row's padding is split across a base and a per-size override (the
|
|
1279
|
+
// default `md` trims the block axis), so `size` is what a theme
|
|
1280
|
+
// needs to reach it. Named `-option-row` because `selector-option`
|
|
1281
|
+
// is the public SelectorOption content primitive, not this row.
|
|
1282
|
+
themeProps('selector-option-row', {
|
|
1283
|
+
size,
|
|
1284
|
+
selected: isSelected ? 'selected' : null,
|
|
1285
|
+
disabled: item.disabled ? 'disabled' : null,
|
|
1286
|
+
}),
|
|
1287
|
+
stylex.props(
|
|
1288
|
+
styles.item,
|
|
1289
|
+
itemSizeStyles[size],
|
|
1290
|
+
isHighlighted && styles.itemHighlighted,
|
|
1291
|
+
isSelected && styles.itemSelected,
|
|
1292
|
+
item.disabled && styles.itemDisabled,
|
|
1293
|
+
),
|
|
1175
1294
|
)}>
|
|
1176
1295
|
{content}
|
|
1177
1296
|
</div>
|
|
@@ -1281,6 +1400,40 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1281
1400
|
const showStatusTooltip =
|
|
1282
1401
|
status != null && effectiveStatusVariant === 'tooltip' && !!status.message;
|
|
1283
1402
|
|
|
1403
|
+
// Two lines cannot fit inside an InputGroup: the group pins the row height,
|
|
1404
|
+
// and the trigger clamps its value box to one line so nothing bleeds through
|
|
1405
|
+
// its border (styles.triggerValueInGroup). The clamp holds for any node; the
|
|
1406
|
+
// context is what lets the rows the system draws itself reflow into that one
|
|
1407
|
+
// line — label and description side by side — instead of being cut off at
|
|
1408
|
+
// it. Outside a group the caller's own row decides, and the trigger's
|
|
1409
|
+
// padding sizes it to whatever that draws.
|
|
1410
|
+
const rowLayout = inputGroup ? 'inline' : 'stacked';
|
|
1411
|
+
|
|
1412
|
+
// What the closed trigger shows for the current selection: the option's icon
|
|
1413
|
+
// and label. `startIcon` wins over the option's own icon so a caller who
|
|
1414
|
+
// pins a field icon does not get two.
|
|
1415
|
+
const valueContent =
|
|
1416
|
+
selectedItem && renderValue ? (
|
|
1417
|
+
<SelectorRowLayoutContext value={rowLayout}>
|
|
1418
|
+
<span
|
|
1419
|
+
{...stylex.props(
|
|
1420
|
+
styles.triggerValue,
|
|
1421
|
+
inputGroup && styles.triggerValueInGroup,
|
|
1422
|
+
)}>
|
|
1423
|
+
{renderValue(selectedItem)}
|
|
1424
|
+
</span>
|
|
1425
|
+
</SelectorRowLayoutContext>
|
|
1426
|
+
) : (
|
|
1427
|
+
<>
|
|
1428
|
+
{!startIcon &&
|
|
1429
|
+
selectedItem?.icon != null &&
|
|
1430
|
+
renderIconSlot(selectedItem.icon, {size: 'sm', color: 'secondary'})}
|
|
1431
|
+
<span {...stylex.props(styles.triggerLabel)}>
|
|
1432
|
+
{selectedItem?.label ?? placeholder}
|
|
1433
|
+
</span>
|
|
1434
|
+
</>
|
|
1435
|
+
);
|
|
1436
|
+
|
|
1284
1437
|
const selectorContent = (
|
|
1285
1438
|
<>
|
|
1286
1439
|
<div
|
|
@@ -1318,6 +1471,7 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1318
1471
|
!isDisabled &&
|
|
1319
1472
|
inputStatusHoverShadowStyles[status.type],
|
|
1320
1473
|
variant !== 'ghost' && inputGroup && groupStyles.inGroup,
|
|
1474
|
+
inputGroup && styles.triggerInGroup,
|
|
1321
1475
|
xstyle,
|
|
1322
1476
|
),
|
|
1323
1477
|
className,
|
|
@@ -1357,10 +1511,11 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1357
1511
|
aria-disabled={showsDisabledMessage ? 'true' : undefined}
|
|
1358
1512
|
onKeyDown={handleTriggerKeyDown}
|
|
1359
1513
|
tabIndex={isDisabled && !showsDisabledMessage ? -1 : 0}
|
|
1360
|
-
{...stylex.props(
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1514
|
+
{...stylex.props(
|
|
1515
|
+
styles.trigger,
|
|
1516
|
+
inputGroup && styles.triggerButtonInGroup,
|
|
1517
|
+
)}>
|
|
1518
|
+
{valueContent}
|
|
1364
1519
|
</button>
|
|
1365
1520
|
{htmlName != null && (
|
|
1366
1521
|
<input
|
|
@@ -27,6 +27,13 @@ export const docs = {
|
|
|
27
27
|
type: 'ReactNode',
|
|
28
28
|
description: 'Secondary description text displayed below the label.',
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
name: 'layout',
|
|
32
|
+
type: "'stacked' | 'inline'",
|
|
33
|
+
description:
|
|
34
|
+
"How the label and description sit together. 'stacked' puts the description on its own line; 'inline' keeps both on one line so the row fits a fixed-height host. Inside a Selector trigger the trigger's padding sizes itself to whichever layout you pick, so both land on the 4px rhythm; an InputGroup pins the row height and forces 'inline'.",
|
|
35
|
+
default: "'stacked'",
|
|
36
|
+
},
|
|
30
37
|
{
|
|
31
38
|
name: 'endContent',
|
|
32
39
|
type: 'ReactNode',
|
|
@@ -13,6 +13,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
13
13
|
import type {StyleXStyles} from '@stylexjs/stylex';
|
|
14
14
|
import {renderIconSlot, type IconType} from '../Icon';
|
|
15
15
|
import {Item} from '../Item';
|
|
16
|
+
import {useSelectorRowLayout} from './SelectorRowLayoutContext';
|
|
16
17
|
import {mergeProps} from '../utils';
|
|
17
18
|
import {themeProps} from '../utils/themeProps';
|
|
18
19
|
|
|
@@ -40,6 +41,20 @@ export interface SelectorOptionProps {
|
|
|
40
41
|
*/
|
|
41
42
|
description?: ReactNode;
|
|
42
43
|
|
|
44
|
+
/**
|
|
45
|
+
* How the label and description sit together. `stacked` puts the
|
|
46
|
+
* description on its own line below the label; `inline` keeps both on one
|
|
47
|
+
* line, with the description ellipsizing first.
|
|
48
|
+
*
|
|
49
|
+
* In a Selector trigger this is the caller's choice and the trigger sizes
|
|
50
|
+
* itself to it — one line at the size token, two lines exactly one text line
|
|
51
|
+
* taller. Inside an `InputGroup` the row height is pinned by the group, so
|
|
52
|
+
* `inline` is forced.
|
|
53
|
+
*
|
|
54
|
+
* @default 'stacked'
|
|
55
|
+
*/
|
|
56
|
+
layout?: 'stacked' | 'inline';
|
|
57
|
+
|
|
43
58
|
/**
|
|
44
59
|
* Additional content to render after the label/description.
|
|
45
60
|
*/
|
|
@@ -95,11 +110,16 @@ export function SelectorOption({
|
|
|
95
110
|
icon,
|
|
96
111
|
label,
|
|
97
112
|
description,
|
|
113
|
+
layout,
|
|
98
114
|
endContent,
|
|
99
115
|
xstyle,
|
|
100
116
|
className,
|
|
101
117
|
style,
|
|
102
118
|
}: SelectorOptionProps) {
|
|
119
|
+
// A height-pinned host (the trigger inside an InputGroup) overrides the
|
|
120
|
+
// caller's choice: the row physically cannot be two lines there.
|
|
121
|
+
const enforcedLayout = useSelectorRowLayout();
|
|
122
|
+
|
|
103
123
|
return (
|
|
104
124
|
<Item
|
|
105
125
|
startContent={
|
|
@@ -109,6 +129,7 @@ export function SelectorOption({
|
|
|
109
129
|
}
|
|
110
130
|
label={label}
|
|
111
131
|
description={description}
|
|
132
|
+
layout={enforcedLayout === 'inline' ? 'inline' : layout}
|
|
112
133
|
endContent={endContent}
|
|
113
134
|
xstyle={[embeddedStyles.root, xstyle]}
|
|
114
135
|
{...mergeProps(themeProps('selector-option'), {className, style})}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file SelectorRowLayoutContext.ts
|
|
7
|
+
* @input React createContext/use
|
|
8
|
+
* @output Exports the row-layout context and useSelectorRowLayout hook
|
|
9
|
+
* @position Internal to the Selector module; read by SelectorOption
|
|
10
|
+
*
|
|
11
|
+
* The trigger inside an InputGroup is height-pinned by the group, so its value
|
|
12
|
+
* box is clamped to one line and anything taller is cut off at the fold. This
|
|
13
|
+
* context is how the rows the system draws itself avoid being cut: they reflow
|
|
14
|
+
* label and description onto that one line instead. The geometry does not
|
|
15
|
+
* depend on it — a node that ignores this context still cannot grow the row.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {createContext, use} from 'react';
|
|
19
|
+
|
|
20
|
+
export type SelectorRowLayout = 'stacked' | 'inline';
|
|
21
|
+
|
|
22
|
+
export const SelectorRowLayoutContext =
|
|
23
|
+
createContext<SelectorRowLayout>('stacked');
|
|
24
|
+
SelectorRowLayoutContext.displayName = 'SelectorRowLayoutContext';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The row layout a host imposes on the options it renders. `stacked` outside
|
|
28
|
+
* any height-pinned host.
|
|
29
|
+
*/
|
|
30
|
+
export function useSelectorRowLayout(): SelectorRowLayout {
|
|
31
|
+
return use(SelectorRowLayoutContext);
|
|
32
|
+
}
|
package/src/Selector/types.ts
CHANGED
|
@@ -14,7 +14,10 @@ import type {IconType} from '../Icon';
|
|
|
14
14
|
*/
|
|
15
15
|
export type SelectorOptionData = {
|
|
16
16
|
value: string;
|
|
17
|
+
// Kept a string, not ReactNode: search filtering and type-ahead both
|
|
18
|
+
// lowercase this to match keystrokes.
|
|
17
19
|
label?: string;
|
|
20
|
+
description?: ReactNode;
|
|
18
21
|
disabled?: boolean;
|
|
19
22
|
icon?: ReactNode | IconType;
|
|
20
23
|
};
|
|
@@ -40,7 +43,4 @@ export type SelectorSection = {
|
|
|
40
43
|
* Can be a plain string, option data object, divider, or section.
|
|
41
44
|
*/
|
|
42
45
|
export type SelectorOptionType =
|
|
43
|
-
|
|
|
44
|
-
| SelectorOptionData
|
|
45
|
-
| SelectorDivider
|
|
46
|
-
| SelectorSection;
|
|
46
|
+
string | SelectorOptionData | SelectorDivider | SelectorSection;
|
|
@@ -73,7 +73,10 @@ const styles = stylex.create({
|
|
|
73
73
|
paddingInline: 0,
|
|
74
74
|
},
|
|
75
75
|
interactive: {
|
|
76
|
-
cursor:
|
|
76
|
+
cursor: {
|
|
77
|
+
default: 'pointer',
|
|
78
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
79
|
+
},
|
|
77
80
|
borderRadius: radiusVars['--radius-element'],
|
|
78
81
|
borderWidth: 0,
|
|
79
82
|
borderStyle: 'none',
|
|
@@ -82,7 +85,7 @@ const styles = stylex.create({
|
|
|
82
85
|
fontSize: 'inherit',
|
|
83
86
|
fontWeight: fontWeightVars['--font-weight-normal'],
|
|
84
87
|
textAlign: 'start',
|
|
85
|
-
':hover': {
|
|
88
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
86
89
|
'@media (hover: hover)': {
|
|
87
90
|
backgroundColor: colorVars['--color-overlay-hover'],
|
|
88
91
|
},
|
|
@@ -91,7 +94,10 @@ const styles = stylex.create({
|
|
|
91
94
|
// Menu trigger: like interactive but no hover background.
|
|
92
95
|
// Only cursor:pointer signals interactivity; the popover provides context.
|
|
93
96
|
menuTrigger: {
|
|
94
|
-
cursor:
|
|
97
|
+
cursor: {
|
|
98
|
+
default: 'pointer',
|
|
99
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
100
|
+
},
|
|
95
101
|
borderRadius: radiusVars['--radius-element'],
|
|
96
102
|
borderWidth: 0,
|
|
97
103
|
borderStyle: 'none',
|
|
@@ -104,7 +110,7 @@ const styles = stylex.create({
|
|
|
104
110
|
interactiveCollapsed: {
|
|
105
111
|
backgroundColor: {
|
|
106
112
|
default: 'transparent',
|
|
107
|
-
':hover': {
|
|
113
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
108
114
|
'@media (hover: hover)': 'transparent',
|
|
109
115
|
},
|
|
110
116
|
},
|
|
@@ -212,7 +218,10 @@ const styles = stylex.create({
|
|
|
212
218
|
marginBlockStart: spacingVars['--spacing-1'],
|
|
213
219
|
marginBlockEnd: spacingVars['--spacing-2'],
|
|
214
220
|
marginInline: spacingVars['--spacing-1'],
|
|
215
|
-
cursor:
|
|
221
|
+
cursor: {
|
|
222
|
+
default: 'pointer',
|
|
223
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
224
|
+
},
|
|
216
225
|
},
|
|
217
226
|
// Chevron inside the popover heading — same as chevron but rotated up
|
|
218
227
|
popoverChevron: {
|
|
@@ -145,9 +145,12 @@ const styles = stylex.create({
|
|
|
145
145
|
borderStyle: 'none',
|
|
146
146
|
backgroundColor: 'transparent',
|
|
147
147
|
color: 'inherit',
|
|
148
|
-
cursor:
|
|
148
|
+
cursor: {
|
|
149
|
+
default: 'pointer',
|
|
150
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
151
|
+
},
|
|
149
152
|
borderRadius: radiusVars['--radius-element'],
|
|
150
|
-
':hover': {
|
|
153
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
151
154
|
'@media (hover: hover)': {
|
|
152
155
|
backgroundColor: colorVars['--color-overlay-hover'],
|
|
153
156
|
},
|
|
@@ -181,7 +184,10 @@ const styles = stylex.create({
|
|
|
181
184
|
fontWeight: 'inherit',
|
|
182
185
|
lineHeight: 'inherit',
|
|
183
186
|
textAlign: 'start',
|
|
184
|
-
cursor:
|
|
187
|
+
cursor: {
|
|
188
|
+
default: 'pointer',
|
|
189
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
190
|
+
},
|
|
185
191
|
},
|
|
186
192
|
// No border and no background: `usePopover` paints the panel this renders
|
|
187
193
|
// into. Drawing a second surface here put square corners inside its rounded
|
package/src/Slider/Slider.tsx
CHANGED
|
@@ -184,18 +184,34 @@ const styles = stylex.create({
|
|
|
184
184
|
'@media (pointer: coarse)': '24px',
|
|
185
185
|
},
|
|
186
186
|
width: '100%',
|
|
187
|
-
cursor:
|
|
187
|
+
cursor: {
|
|
188
|
+
default: 'pointer',
|
|
189
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
190
|
+
},
|
|
188
191
|
},
|
|
189
192
|
trackContainerVertical: {
|
|
190
193
|
width: THUMB_SIZE,
|
|
191
194
|
height: 160,
|
|
195
|
+
// Same tap target, rotated: the vertical track is the thing you press, and
|
|
196
|
+
// it is only THUMB_SIZE (20px) wide. `minBlockSize` above floors the
|
|
197
|
+
// horizontal track's short axis; here the short axis is the inline one
|
|
198
|
+
// (the block size is already 160px), so floor that instead. The rail,
|
|
199
|
+
// fill, marks and thumb all center on the inline 50%, so they stay put;
|
|
200
|
+
// only the invisible tappable area grows. Desktop is unchanged.
|
|
201
|
+
minInlineSize: {
|
|
202
|
+
default: null,
|
|
203
|
+
'@media (pointer: coarse)': '24px',
|
|
204
|
+
},
|
|
192
205
|
flexDirection: 'column',
|
|
193
206
|
justifyContent: 'center',
|
|
194
|
-
cursor:
|
|
207
|
+
cursor: {
|
|
208
|
+
default: 'pointer',
|
|
209
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
210
|
+
},
|
|
195
211
|
},
|
|
196
212
|
trackContainerDisabled: {
|
|
197
213
|
opacity: 0.5,
|
|
198
|
-
cursor: '
|
|
214
|
+
cursor: 'default',
|
|
199
215
|
},
|
|
200
216
|
track: {
|
|
201
217
|
position: 'absolute',
|
|
@@ -241,7 +257,10 @@ const styles = stylex.create({
|
|
|
241
257
|
},
|
|
242
258
|
transitionTimingFunction: easeVars['--ease-standard'],
|
|
243
259
|
outline: 'none',
|
|
244
|
-
cursor:
|
|
260
|
+
cursor: {
|
|
261
|
+
default: 'grab',
|
|
262
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
263
|
+
},
|
|
245
264
|
zIndex: 1,
|
|
246
265
|
},
|
|
247
266
|
thumbHorizontal: {
|
|
@@ -258,14 +277,14 @@ const styles = stylex.create({
|
|
|
258
277
|
thumbHover: {
|
|
259
278
|
backgroundColor: {
|
|
260
279
|
default: colorVars['--color-accent'],
|
|
261
|
-
':hover': {
|
|
280
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
262
281
|
'@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-tint-hover']} 15%)`,
|
|
263
282
|
},
|
|
264
283
|
},
|
|
265
284
|
},
|
|
266
285
|
thumbDisabled: {
|
|
267
286
|
backgroundColor: colorVars['--color-background-muted'],
|
|
268
|
-
cursor: '
|
|
287
|
+
cursor: 'default',
|
|
269
288
|
},
|
|
270
289
|
textValue: {
|
|
271
290
|
fontFamily: typographyVars['--font-family-body'],
|