@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
|
@@ -43,13 +43,16 @@ const styles = stylex.create({
|
|
|
43
43
|
color: colorVars['--color-text-primary'],
|
|
44
44
|
backgroundColor: 'transparent',
|
|
45
45
|
border: 'none',
|
|
46
|
-
cursor:
|
|
46
|
+
cursor: {
|
|
47
|
+
default: 'pointer',
|
|
48
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
49
|
+
},
|
|
47
50
|
textAlign: 'start' as const,
|
|
48
51
|
outline: 'none',
|
|
49
52
|
userSelect: 'none',
|
|
50
53
|
},
|
|
51
54
|
itemHover: {
|
|
52
|
-
':hover': {
|
|
55
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
53
56
|
[HOVER_HOVER]: {
|
|
54
57
|
backgroundColor: colorVars['--color-overlay-hover'],
|
|
55
58
|
},
|
|
@@ -63,7 +66,7 @@ const styles = stylex.create({
|
|
|
63
66
|
},
|
|
64
67
|
itemDisabled: {
|
|
65
68
|
opacity: 0.5,
|
|
66
|
-
cursor: '
|
|
69
|
+
cursor: 'default',
|
|
67
70
|
},
|
|
68
71
|
itemSelected: {
|
|
69
72
|
backgroundColor: colorVars['--color-accent-muted'],
|
|
@@ -215,6 +215,16 @@ export const docsDense = {
|
|
|
215
215
|
description:
|
|
216
216
|
'Use when a selection needs richer custom content than a Selector row. One component: it owns field, trigger, popover, focus restore, and changeAction; the render prop owns the selector-specific accessible structure.',
|
|
217
217
|
bestPractices: [
|
|
218
|
+
{
|
|
219
|
+
guidance: true,
|
|
220
|
+
description:
|
|
221
|
+
'Use variant="ghost" with a startIcon for a toolbar trigger. Use alignment="end" when a wide surface should align its end edge to the trigger.',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
guidance: true,
|
|
225
|
+
description:
|
|
226
|
+
'For staged editors, keep draft state in the composed content and call the provided onChange helper only from Apply. Cancel or dismiss without committing.',
|
|
227
|
+
},
|
|
218
228
|
{
|
|
219
229
|
guidance: true,
|
|
220
230
|
description:
|
|
@@ -70,7 +70,10 @@ const styles = stylex.create({
|
|
|
70
70
|
},
|
|
71
71
|
lineHeight: typeScaleVars['--text-label-leading'],
|
|
72
72
|
color: colorVars['--color-text-primary'],
|
|
73
|
-
cursor:
|
|
73
|
+
cursor: {
|
|
74
|
+
default: 'pointer',
|
|
75
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
76
|
+
},
|
|
74
77
|
},
|
|
75
78
|
trigger: {
|
|
76
79
|
display: 'flex',
|
|
@@ -90,7 +93,10 @@ const styles = stylex.create({
|
|
|
90
93
|
fontSize: 'inherit',
|
|
91
94
|
lineHeight: 'inherit',
|
|
92
95
|
color: 'inherit',
|
|
93
|
-
cursor:
|
|
96
|
+
cursor: {
|
|
97
|
+
default: 'pointer',
|
|
98
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
99
|
+
},
|
|
94
100
|
outline: 'none',
|
|
95
101
|
borderRadius: radiusVars['--radius-element'],
|
|
96
102
|
},
|
|
@@ -111,16 +117,17 @@ const styles = stylex.create({
|
|
|
111
117
|
backgroundColor: 'transparent',
|
|
112
118
|
backgroundImage: {
|
|
113
119
|
default: null,
|
|
114
|
-
':hover': {
|
|
120
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
115
121
|
'@media (hover: hover)': `linear-gradient(${colorVars['--color-overlay-hover']}, ${colorVars['--color-overlay-hover']})`,
|
|
116
122
|
},
|
|
117
123
|
':active': `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`,
|
|
118
124
|
},
|
|
119
125
|
boxShadow: {
|
|
120
126
|
default: 'none',
|
|
121
|
-
':hover:not(:focus-within)':
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
':hover:not(:focus-within):where(:not(:disabled,[aria-disabled="true"]))':
|
|
128
|
+
{
|
|
129
|
+
'@media (hover: hover)': 'none',
|
|
130
|
+
},
|
|
124
131
|
':focus-within': 'none',
|
|
125
132
|
},
|
|
126
133
|
fontWeight: fontWeightVars['--font-weight-medium'],
|
|
@@ -177,7 +184,7 @@ const styles = stylex.create({
|
|
|
177
184
|
height: sizeVars['--size-element-lg'],
|
|
178
185
|
},
|
|
179
186
|
disabled: {
|
|
180
|
-
cursor: '
|
|
187
|
+
cursor: 'default',
|
|
181
188
|
},
|
|
182
189
|
});
|
|
183
190
|
|
|
@@ -917,6 +917,22 @@ describe('DateInput', () => {
|
|
|
917
917
|
expect(screen.getByDisplayValue('Jan 25, 2026')).toBeInTheDocument();
|
|
918
918
|
});
|
|
919
919
|
|
|
920
|
+
it('follows the InternationalizationProvider locale (#5074)', () => {
|
|
921
|
+
render(
|
|
922
|
+
<InternationalizationProvider locale="es-ES">
|
|
923
|
+
<DateInput
|
|
924
|
+
label="Date"
|
|
925
|
+
value="2026-01-25"
|
|
926
|
+
onChange={() => {}}
|
|
927
|
+
format="date_long"
|
|
928
|
+
/>
|
|
929
|
+
</InternationalizationProvider>,
|
|
930
|
+
);
|
|
931
|
+
expect(
|
|
932
|
+
screen.getByDisplayValue('25 de enero de 2026'),
|
|
933
|
+
).toBeInTheDocument();
|
|
934
|
+
});
|
|
935
|
+
|
|
920
936
|
it('renders the ISO shape for format="system_date"', () => {
|
|
921
937
|
render(
|
|
922
938
|
<DateInput
|
|
@@ -1186,7 +1202,7 @@ describe('DateInput clear icon theme target', () => {
|
|
|
1186
1202
|
expect(css).toContain('.astryx-date-input-clear-icon {');
|
|
1187
1203
|
expect(css).toContain('width: 12px');
|
|
1188
1204
|
expect(css).toContain('height: 12px');
|
|
1189
|
-
expect(css).toContain('.astryx-date-input-clear-icon:hover
|
|
1205
|
+
expect(css).toContain('.astryx-date-input-clear-icon:hover');
|
|
1190
1206
|
expect(css).toContain('color: var(--color-icon-primary)');
|
|
1191
1207
|
});
|
|
1192
1208
|
});
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
|
+
use,
|
|
20
21
|
useId,
|
|
21
22
|
useState,
|
|
22
23
|
useCallback,
|
|
@@ -58,8 +59,10 @@ import {
|
|
|
58
59
|
} from '../Calendar';
|
|
59
60
|
import {useCalendarConstraints} from '../Calendar/hooks';
|
|
60
61
|
import {useInputStatusIcon} from '../hooks/useInputStatusIcon';
|
|
62
|
+
import {useMediaQuery} from '../hooks/useMediaQuery';
|
|
61
63
|
import {useResolvedRequired} from '../hooks/useResolvedRequired';
|
|
62
64
|
import {usePopover} from '../Popover';
|
|
65
|
+
import {TouchDateField} from './TouchDateField';
|
|
63
66
|
import {useTooltip} from '../Tooltip';
|
|
64
67
|
import {getInputARIA, isImeKeyEvent, parseDateInput} from '../utils';
|
|
65
68
|
import {
|
|
@@ -79,11 +82,14 @@ const styles = stylex.create({
|
|
|
79
82
|
borderWidth: 0,
|
|
80
83
|
borderStyle: 'none',
|
|
81
84
|
backgroundColor: 'transparent',
|
|
82
|
-
cursor:
|
|
85
|
+
cursor: {
|
|
86
|
+
default: 'pointer',
|
|
87
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
88
|
+
},
|
|
83
89
|
borderRadius: radiusVars['--radius-element'],
|
|
84
90
|
},
|
|
85
91
|
iconButtonDisabled: {
|
|
86
|
-
cursor: '
|
|
92
|
+
cursor: 'default',
|
|
87
93
|
},
|
|
88
94
|
input: {
|
|
89
95
|
display: 'block',
|
|
@@ -106,7 +112,7 @@ const styles = stylex.create({
|
|
|
106
112
|
},
|
|
107
113
|
},
|
|
108
114
|
inputDisabled: {
|
|
109
|
-
cursor: '
|
|
115
|
+
cursor: 'default',
|
|
110
116
|
},
|
|
111
117
|
inputInvalid: {
|
|
112
118
|
color: colorVars['--color-text-secondary'],
|
|
@@ -161,7 +167,7 @@ import type {SizeValue} from '../utils/types';
|
|
|
161
167
|
import {themeProps} from '../utils/themeProps';
|
|
162
168
|
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
163
169
|
import {stableClassName} from '../naming';
|
|
164
|
-
import {useTranslator} from '../i18n';
|
|
170
|
+
import {useTranslator, InternationalizationContext} from '../i18n';
|
|
165
171
|
|
|
166
172
|
export interface DateInputProps extends Omit<
|
|
167
173
|
BaseProps,
|
|
@@ -357,18 +363,30 @@ export interface DateInputProps extends Omit<
|
|
|
357
363
|
}
|
|
358
364
|
|
|
359
365
|
/**
|
|
360
|
-
*
|
|
366
|
+
* The pointer that decides which surface a `DateInput` renders.
|
|
361
367
|
*
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
368
|
+
* `pointer: coarse` is the *primary* pointing device, which is what makes it
|
|
369
|
+
* the whole test. A touchscreen laptop reports `fine` (its trackpad) with
|
|
370
|
+
* `any-pointer: coarse` alongside, so it keeps the typable field — right,
|
|
371
|
+
* because its keyboard is there. A tablet reports `coarse` and gets the
|
|
372
|
+
* picker, at any width. There is deliberately no width bound: it would only
|
|
373
|
+
* re-exclude the tablets, since a narrowed desktop window is still a mouse.
|
|
374
|
+
*
|
|
375
|
+
* Deliberately NOT exported. It was, briefly, on the theory that an app might
|
|
376
|
+
* want to ask the same question and lay out to match — but nothing asked, and
|
|
377
|
+
* six other core components (CheckboxInput, ChatComposerInput, ...) just
|
|
378
|
+
* write `@media (pointer: coarse)` inline rather than sharing a constant. An
|
|
379
|
+
* export is additive later and awkward to withdraw, so it waits for a real
|
|
380
|
+
* caller.
|
|
370
381
|
*/
|
|
371
|
-
|
|
382
|
+
const TOUCH_POINTER_QUERY = '(pointer: coarse)';
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* The pointer-driven field: a text input you can type into, with a calendar
|
|
386
|
+
* in a popover beside it. `DateInput` renders this whenever the primary
|
|
387
|
+
* pointer is not a finger — see {@link TOUCH_POINTER_QUERY}.
|
|
388
|
+
*/
|
|
389
|
+
function PointerDateField({
|
|
372
390
|
label,
|
|
373
391
|
isLabelHidden = false,
|
|
374
392
|
description,
|
|
@@ -401,6 +419,7 @@ export function DateInput({
|
|
|
401
419
|
}: DateInputProps) {
|
|
402
420
|
const t = useTranslator();
|
|
403
421
|
const isEffectivelyRequired = useResolvedRequired({isRequired, isOptional});
|
|
422
|
+
const {locale} = use(InternationalizationContext);
|
|
404
423
|
const placeholder =
|
|
405
424
|
placeholderFromProps ?? t('@astryx.dateInput.placeholder');
|
|
406
425
|
const size = useSize(sizeProp, 'md');
|
|
@@ -483,8 +502,8 @@ export function DateInput({
|
|
|
483
502
|
(iso: ISODateString): string =>
|
|
484
503
|
typeof format === 'function'
|
|
485
504
|
? format(iso)
|
|
486
|
-
: formatSharedDate(plainDateFromISO(iso), format),
|
|
487
|
-
[format],
|
|
505
|
+
: formatSharedDate(plainDateFromISO(iso), format, locale),
|
|
506
|
+
[format, locale],
|
|
488
507
|
);
|
|
489
508
|
|
|
490
509
|
// Display value: pending input if typing, otherwise formatted value
|
|
@@ -499,7 +518,7 @@ export function DateInput({
|
|
|
499
518
|
const isInputValid =
|
|
500
519
|
pendingInput === null || !pendingInput.trim()
|
|
501
520
|
? true
|
|
502
|
-
: parseDateInput(pendingInput) !== null;
|
|
521
|
+
: parseDateInput(pendingInput, locale) !== null;
|
|
503
522
|
|
|
504
523
|
const popover = usePopover({
|
|
505
524
|
dialogLabel: t('@astryx.dateInput.dialogLabel'),
|
|
@@ -581,7 +600,7 @@ export function DateInput({
|
|
|
581
600
|
setPendingInput(newValue);
|
|
582
601
|
|
|
583
602
|
// If the input is valid and passes constraints, update immediately
|
|
584
|
-
const parsed = parseDateInput(newValue);
|
|
603
|
+
const parsed = parseDateInput(newValue, locale);
|
|
585
604
|
if (
|
|
586
605
|
parsed &&
|
|
587
606
|
plainDateToISO(parsed) !== value &&
|
|
@@ -594,7 +613,7 @@ export function DateInput({
|
|
|
594
613
|
calendarRef.current?.navigateTo(parsedISO);
|
|
595
614
|
}
|
|
596
615
|
},
|
|
597
|
-
[value, fireChange, isDateDisabled, isEffectivelyDisabled],
|
|
616
|
+
[value, fireChange, isDateDisabled, isEffectivelyDisabled, locale],
|
|
598
617
|
);
|
|
599
618
|
|
|
600
619
|
// Commit pending input (shared by blur and Enter key)
|
|
@@ -611,7 +630,7 @@ export function DateInput({
|
|
|
611
630
|
return;
|
|
612
631
|
}
|
|
613
632
|
|
|
614
|
-
const parsed = parseDateInput(pendingInput);
|
|
633
|
+
const parsed = parseDateInput(pendingInput, locale);
|
|
615
634
|
if (parsed && !isDateDisabled(parsed)) {
|
|
616
635
|
const parsedISO = plainDateToISO(parsed);
|
|
617
636
|
if (parsedISO !== value) {
|
|
@@ -619,7 +638,7 @@ export function DateInput({
|
|
|
619
638
|
}
|
|
620
639
|
}
|
|
621
640
|
setPendingInput(null);
|
|
622
|
-
}, [pendingInput, value, fireChange, isDateDisabled]);
|
|
641
|
+
}, [pendingInput, value, fireChange, isDateDisabled, locale]);
|
|
623
642
|
|
|
624
643
|
// Handle blur - validate, check constraints, and clear pending input
|
|
625
644
|
const handleBlur = useCallback(() => {
|
|
@@ -822,4 +841,57 @@ export function DateInput({
|
|
|
822
841
|
);
|
|
823
842
|
}
|
|
824
843
|
|
|
844
|
+
PointerDateField.displayName = 'PointerDateField';
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* A date picker that fits the pointer it is being used with.
|
|
848
|
+
*
|
|
849
|
+
* With a mouse or trackpad this is a text input you can type into, with a
|
|
850
|
+
* calendar in a popover — unchanged, and still the surface every existing
|
|
851
|
+
* consumer gets. With a finger it is a picker built for one: a bottom sheet
|
|
852
|
+
* holding one month per screen, swiped sideways, with month and year wheels
|
|
853
|
+
* behind the header title for the far jumps swiping is bad at.
|
|
854
|
+
*
|
|
855
|
+
* The props are identical either way — this is one component with two
|
|
856
|
+
* surfaces, not two components — so nothing at the call site changes, and a
|
|
857
|
+
* date typed on a laptop and a date thumbed on a phone are the same value.
|
|
858
|
+
*
|
|
859
|
+
* ## Why a runtime switch and not CSS
|
|
860
|
+
*
|
|
861
|
+
* The two surfaces are structurally different — a popover anchored to a text
|
|
862
|
+
* field versus a full-width sheet holding a scroller — so "render both, hide
|
|
863
|
+
* one" would double the DOM, double the tab stops, and mount two calendars.
|
|
864
|
+
* The condition is not layout either: it is *which interaction is faster*,
|
|
865
|
+
* and that depends on the pointer, which CSS cannot hand to JS.
|
|
866
|
+
*
|
|
867
|
+
* They are two components rather than one with a branch inside because the
|
|
868
|
+
* hook lists differ; keeping them separate is what lets each own its own.
|
|
869
|
+
*
|
|
870
|
+
* ## Hydration
|
|
871
|
+
*
|
|
872
|
+
* `useMediaQuery` reports false during SSR, so server HTML is always the
|
|
873
|
+
* pointer field and the swap happens after hydration. That is deliberately
|
|
874
|
+
* unobservable: both surfaces render the SAME closed field — a bordered input
|
|
875
|
+
* with a calendar icon and the formatted date — and differ only in what
|
|
876
|
+
* opens. Nothing moves; the field just starts opening a sheet.
|
|
877
|
+
*
|
|
878
|
+
* @example
|
|
879
|
+
* ```
|
|
880
|
+
* <DateInput
|
|
881
|
+
* label="Event date"
|
|
882
|
+
* value={date}
|
|
883
|
+
* onChange={setDate}
|
|
884
|
+
* />
|
|
885
|
+
* ```
|
|
886
|
+
*/
|
|
887
|
+
export function DateInput(props: DateInputProps) {
|
|
888
|
+
const isTouch = useMediaQuery(TOUCH_POINTER_QUERY);
|
|
889
|
+
|
|
890
|
+
return isTouch ? (
|
|
891
|
+
<TouchDateField {...props} />
|
|
892
|
+
) : (
|
|
893
|
+
<PointerDateField {...props} />
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
|
|
825
897
|
DateInput.displayName = 'DateInput';
|