@astryxdesign/core 0.4.4 → 0.4.5-canary.0472ec1
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 +40 -0
- package/dist/AvatarGroup/AvatarGroupOverflow.js +1 -1
- 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/BottomSheet.d.ts +11 -2
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +4 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts +5 -2
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +77 -18
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.d.ts +57 -20
- package/dist/BottomSheet/snapOffsets.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.js +106 -30
- package/dist/BottomSheet/useSheetGestures.d.ts +13 -8
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +160 -64
- package/dist/Breadcrumbs/BreadcrumbItem.js +6 -6
- package/dist/Button/Button.js +5 -5
- package/dist/Calendar/Calendar.d.ts +17 -0
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +55 -15
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +14 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +1 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.js +26 -0
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts +22 -1
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarConstraints.js +26 -4
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +14 -10
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +8 -4
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts +47 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +1 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.js +40 -0
- package/dist/Calendar/styles.js +3 -3
- 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 +2 -2
- package/dist/Chat/ChatToolCalls.js +1 -1
- 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/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +9 -0
- package/dist/Citation/Citation.js +3 -3
- package/dist/ClickableCard/ClickableCard.js +2 -2
- package/dist/CommandPalette/CommandPaletteItem.js +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +8 -3
- package/dist/DateInput/DateInput.d.ts +31 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +92 -19
- package/dist/DateInput/MonthScroller.d.ts +35 -0
- package/dist/DateInput/MonthScroller.d.ts.map +1 -0
- package/dist/DateInput/MonthScroller.js +573 -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 +23 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +47 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +18 -10
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/Field/FieldLabel.d.ts +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +21 -3
- package/dist/Field/InputClearButton.d.ts +2 -1
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +12 -1
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +4 -4
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +2 -2
- package/dist/FormLayout/FormLayout.d.ts +24 -2
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/FormLayout/FormLayout.js +7 -2
- package/dist/FormLayout/FormLayoutContext.d.ts +15 -2
- package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
- package/dist/FormLayout/FormLayoutContext.js +19 -4
- package/dist/FormLayout/index.d.ts +1 -1
- package/dist/FormLayout/index.d.ts.map +1 -1
- 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/Item/Item.d.ts +9 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +46 -8
- 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 +2 -1
- package/dist/Link/Link.js +4 -4
- package/dist/Markdown/Markdown.d.ts +8 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +31 -3
- package/dist/Markdown/parser.d.ts +14 -2
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +50 -2
- 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 -3
- package/dist/NavItem/navItemStyles.stylex.d.ts +2 -2
- package/dist/NavItem/navItemStyles.stylex.js +2 -2
- package/dist/NavMenu/NavHeadingMenuItem.js +1 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +38 -5
- package/dist/Outline/Outline.js +2 -2
- package/dist/Outline/parseOutlineFromMarkdown.d.ts +2 -0
- package/dist/Outline/parseOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/parseOutlineFromMarkdown.js +5 -31
- 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/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +12 -1
- package/dist/RadioList/RadioListItem.d.ts +2 -2
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +68 -38
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +3 -3
- 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 +6 -1
- package/dist/SelectableCard/SelectableCard.js +1 -1
- package/dist/Selector/Selector.d.ts +26 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +95 -17
- 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.js +1 -1
- package/dist/SideNav/SideNavItem.js +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +3 -3
- 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/StatusDot/StatusDot.d.ts +43 -3
- package/dist/StatusDot/StatusDot.d.ts.map +1 -1
- package/dist/StatusDot/StatusDot.js +42 -5
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +9 -0
- package/dist/TabList/TabMenu.js +1 -1
- 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/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
- 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.js +2 -2
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +6 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -1
- package/dist/Thumbnail/Thumbnail.js +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +6 -1
- 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/Token/Token.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.js +2 -2
- package/dist/TopNav/TopNavItem.js +2 -2
- package/dist/TopNav/TopNavMegaMenu.js +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +1 -1
- package/dist/TopNav/TopNavMenu.js +2 -2
- package/dist/TreeList/TreeListItem.js +1 -1
- package/dist/astryx.css +123 -60
- 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/useResolvedRequired.d.ts +19 -0
- package/dist/hooks/useResolvedRequired.d.ts.map +1 -0
- package/dist/hooks/useResolvedRequired.js +40 -0
- 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/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/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 +11 -2
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +32 -4
- package/locales/af-ZA.json +958 -0
- package/locales/ar-SA.json +998 -0
- package/locales/ca-ES.json +974 -0
- package/locales/cs-CZ.json +990 -0
- package/locales/da-DK.json +966 -0
- package/locales/de-DE.json +966 -0
- package/locales/el-GR.json +990 -0
- package/locales/en.json +32 -0
- package/locales/es-ES.json +978 -0
- package/locales/fi-FI.json +990 -0
- package/locales/fr-FR.json +928 -0
- package/locales/he-IL.json +990 -0
- package/locales/hu-HU.json +990 -0
- package/locales/it-IT.json +978 -0
- package/locales/ja-JP.json +998 -0
- package/locales/ko-KR.json +990 -0
- package/locales/nl-NL.json +954 -0
- package/locales/no-NO.json +978 -0
- package/locales/pl-PL.json +982 -0
- package/locales/pseudo.json +24 -0
- package/locales/pt-BR.json +982 -0
- package/locales/pt-PT.json +982 -0
- package/locales/ro-RO.json +982 -0
- package/locales/ru-RU.json +990 -0
- package/locales/sr-SP.json +990 -0
- package/locales/sv-SE.json +986 -0
- package/locales/tr-TR.json +990 -0
- package/locales/uk-UA.json +990 -0
- package/locales/vi-VN.json +986 -0
- package/locales/zh-CN.json +998 -0
- package/locales/zh-TW.json +998 -0
- package/package.json +3 -3
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +1 -1
- 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 +36 -3
- package/src/BottomSheet/BottomSheet.test.tsx +177 -2
- package/src/BottomSheet/BottomSheet.tsx +16 -2
- package/src/BottomSheet/BottomSheetPanel.test.tsx +91 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +121 -15
- package/src/BottomSheet/index.ts +5 -1
- package/src/BottomSheet/snapOffsets.test.ts +114 -47
- package/src/BottomSheet/snapOffsets.ts +119 -33
- package/src/BottomSheet/useSheetGestures.test.ts +113 -15
- package/src/BottomSheet/useSheetGestures.ts +196 -100
- package/src/Breadcrumbs/BreadcrumbItem.tsx +1 -1
- package/src/Button/Button.tsx +7 -7
- package/src/Calendar/Calendar.doc.mjs +16 -0
- package/src/Calendar/Calendar.test.tsx +137 -0
- package/src/Calendar/Calendar.tsx +80 -11
- package/src/Calendar/getStandaloneShortWeekdayNames.test.ts +54 -0
- package/src/Calendar/getStandaloneShortWeekdayNames.ts +38 -0
- package/src/Calendar/hooks/useCalendarConstraints.ts +54 -3
- package/src/Calendar/hooks/useCalendarDays.ts +13 -10
- package/src/Calendar/hooks/useCalendarNavigation.ts +6 -4
- package/src/Calendar/standaloneShortWeekdayNames.generated.ts +50 -0
- package/src/Calendar/styles.ts +3 -3
- 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 +7 -4
- package/src/Chat/ChatToolCalls.tsx +1 -1
- 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/CheckboxInput/CheckboxInput.tsx +6 -0
- package/src/Citation/Citation.tsx +3 -3
- package/src/ClickableCard/ClickableCard.tsx +2 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -1
- package/src/ComplexSelector/ComplexSelector.doc.mjs +10 -0
- package/src/ComplexSelector/ComplexSelector.tsx +8 -5
- package/src/DateInput/DateInput.test.tsx +17 -1
- package/src/DateInput/DateInput.tsx +90 -19
- package/src/DateInput/DateInputTouch.test.tsx +2393 -0
- package/src/DateInput/MonthScroller.tsx +784 -0
- package/src/DateInput/MonthYearWheels.tsx +147 -0
- package/src/DateInput/TouchDateField.tsx +1214 -0
- package/src/DateInput/Wheel.tsx +470 -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 +16 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +81 -1
- package/src/DateRangeInput/DateRangeInput.tsx +88 -8
- package/src/DateTimeInput/DateTimeInput.tsx +23 -8
- package/src/Dialog/Dialog.test.tsx +24 -0
- package/src/Dialog/Dialog.tsx +3 -0
- package/src/Field/Field.doc.mjs +3 -0
- package/src/Field/FieldLabel.tsx +20 -4
- package/src/Field/InputClearButton.test.tsx +134 -2
- package/src/Field/InputClearButton.tsx +42 -1
- package/src/Field/inputStyles.stylex.ts +16 -12
- package/src/FileInput/FileInput.tsx +5 -4
- package/src/FormLayout/FormLayout.doc.mjs +13 -0
- package/src/FormLayout/FormLayout.test.tsx +181 -4
- package/src/FormLayout/FormLayout.tsx +33 -2
- package/src/FormLayout/FormLayoutContext.ts +22 -7
- package/src/FormLayout/index.ts +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/Item/Item.doc.mjs +1 -0
- package/src/Item/Item.test.tsx +50 -0
- package/src/Item/Item.tsx +41 -2
- 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 +2 -1
- package/src/Link/Link.tsx +4 -4
- package/src/Markdown/Markdown.doc.mjs +3 -0
- package/src/Markdown/Markdown.test.tsx +78 -0
- package/src/Markdown/Markdown.tsx +41 -1
- package/src/Markdown/parser.ts +60 -2
- 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 +8 -5
- package/src/NavItem/navItemStyles.stylex.ts +2 -2
- package/src/NavMenu/NavHeadingMenuItem.tsx +1 -1
- package/src/NumberInput/NumberInput.doc.mjs +24 -0
- package/src/NumberInput/NumberInput.test.tsx +138 -0
- package/src/NumberInput/NumberInput.tsx +44 -6
- package/src/Outline/Outline.doc.mjs +2 -0
- package/src/Outline/Outline.tsx +1 -1
- package/src/Outline/parseOutlineFromMarkdown.ts +10 -40
- 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/RadioList.tsx +9 -1
- package/src/RadioList/RadioListItem.tsx +83 -51
- package/src/Resizable/ResizeHandle.test.tsx +22 -0
- package/src/Resizable/ResizeHandle.tsx +9 -3
- 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 +11 -2
- package/src/SelectableCard/SelectableCard.tsx +1 -1
- package/src/Selector/Selector.doc.mjs +16 -2
- package/src/Selector/Selector.test.tsx +525 -1
- package/src/Selector/Selector.tsx +166 -21
- 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 +2 -2
- package/src/SideNav/SideNavItem.tsx +1 -1
- package/src/Slider/Slider.tsx +11 -1
- 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/StatusDot/StatusDot.doc.mjs +13 -0
- package/src/StatusDot/StatusDot.test.tsx +115 -8
- package/src/StatusDot/StatusDot.tsx +74 -9
- package/src/Switch/Switch.tsx +6 -0
- package/src/TabList/TabMenu.tsx +1 -1
- package/src/Table/TableRow.tsx +4 -4
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +2 -1
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +2 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +22 -4
- 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 +2 -2
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextArea/TextArea.tsx +3 -1
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +1 -1
- package/src/TimeInput/TimeInput.tsx +3 -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/Token/Token.tsx +1 -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 +1 -1
- package/src/TopNav/TopNavItem.tsx +2 -2
- package/src/TopNav/TopNavMegaMenu.tsx +1 -1
- package/src/TopNav/TopNavMegaMenuItem.tsx +1 -1
- package/src/TopNav/TopNavMenu.tsx +2 -2
- package/src/TreeList/TreeListItem.tsx +1 -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/useResolvedRequired.ts +42 -0
- 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/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/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 +56 -0
- package/src/utils/plainDate.ts +33 -4
|
@@ -78,7 +78,7 @@ const styles = stylex.create({
|
|
|
78
78
|
},
|
|
79
79
|
hoverOnPointer: {
|
|
80
80
|
'@media (hover: hover)': {
|
|
81
|
-
':hover::after': {
|
|
81
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))::after': {
|
|
82
82
|
backgroundColor: colorVars['--color-overlay-hover'],
|
|
83
83
|
},
|
|
84
84
|
},
|
|
@@ -110,7 +110,7 @@ const styles = stylex.create({
|
|
|
110
110
|
// @media (hover: hover) so touch devices don't get a stuck hover state.
|
|
111
111
|
borderedHoverOnPointer: {
|
|
112
112
|
'@media (hover: hover)': {
|
|
113
|
-
':hover': {
|
|
113
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
114
114
|
borderColor: colorVars['--color-border-emphasized'],
|
|
115
115
|
},
|
|
116
116
|
},
|
|
@@ -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:
|
|
@@ -35,6 +35,7 @@ import {useTranslator} from '../i18n';
|
|
|
35
35
|
import {layerAnimations} from '../Layer/layerAnimations.stylex';
|
|
36
36
|
import type {LayerAlignment, LayerPlacement} from '../Layer/useLayer';
|
|
37
37
|
import {usePopover} from '../Popover/usePopover';
|
|
38
|
+
import {useResolvedRequired} from '../hooks/useResolvedRequired';
|
|
38
39
|
import {
|
|
39
40
|
colorVars,
|
|
40
41
|
durationVars,
|
|
@@ -110,16 +111,17 @@ const styles = stylex.create({
|
|
|
110
111
|
backgroundColor: 'transparent',
|
|
111
112
|
backgroundImage: {
|
|
112
113
|
default: null,
|
|
113
|
-
':hover': {
|
|
114
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
114
115
|
'@media (hover: hover)': `linear-gradient(${colorVars['--color-overlay-hover']}, ${colorVars['--color-overlay-hover']})`,
|
|
115
116
|
},
|
|
116
117
|
':active': `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`,
|
|
117
118
|
},
|
|
118
119
|
boxShadow: {
|
|
119
120
|
default: 'none',
|
|
120
|
-
':hover:not(:focus-within)':
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
':hover:not(:focus-within):where(:not(:disabled,[aria-disabled="true"]))':
|
|
122
|
+
{
|
|
123
|
+
'@media (hover: hover)': 'none',
|
|
124
|
+
},
|
|
123
125
|
':focus-within': 'none',
|
|
124
126
|
},
|
|
125
127
|
fontWeight: fontWeightVars['--font-weight-medium'],
|
|
@@ -344,6 +346,7 @@ export function ComplexSelector<Value>({
|
|
|
344
346
|
...props
|
|
345
347
|
}: ComplexSelectorProps<Value>) {
|
|
346
348
|
const t = useTranslator();
|
|
349
|
+
const isEffectivelyRequired = useResolvedRequired({isRequired, isOptional});
|
|
347
350
|
const placeholder = placeholderFromProps ?? t('@astryx.selector.placeholder');
|
|
348
351
|
const effectiveStatusVariant =
|
|
349
352
|
variant === 'ghost' && statusVariant === 'attached'
|
|
@@ -497,7 +500,7 @@ export function ComplexSelector<Value>({
|
|
|
497
500
|
aria-controls={contentId}
|
|
498
501
|
aria-describedby={ariaDescribedBy}
|
|
499
502
|
aria-labelledby={labelId}
|
|
500
|
-
aria-required={
|
|
503
|
+
aria-required={isEffectivelyRequired ? 'true' : undefined}
|
|
501
504
|
aria-invalid={status?.type === 'error' ? 'true' : undefined}
|
|
502
505
|
aria-busy={isBusy || undefined}
|
|
503
506
|
disabled={isDisabled}
|
|
@@ -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,7 +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';
|
|
63
|
+
import {useResolvedRequired} from '../hooks/useResolvedRequired';
|
|
61
64
|
import {usePopover} from '../Popover';
|
|
65
|
+
import {TouchDateField} from './TouchDateField';
|
|
62
66
|
import {useTooltip} from '../Tooltip';
|
|
63
67
|
import {getInputARIA, isImeKeyEvent, parseDateInput} from '../utils';
|
|
64
68
|
import {
|
|
@@ -160,7 +164,7 @@ import type {SizeValue} from '../utils/types';
|
|
|
160
164
|
import {themeProps} from '../utils/themeProps';
|
|
161
165
|
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
162
166
|
import {stableClassName} from '../naming';
|
|
163
|
-
import {useTranslator} from '../i18n';
|
|
167
|
+
import {useTranslator, InternationalizationContext} from '../i18n';
|
|
164
168
|
|
|
165
169
|
export interface DateInputProps extends Omit<
|
|
166
170
|
BaseProps,
|
|
@@ -356,18 +360,30 @@ export interface DateInputProps extends Omit<
|
|
|
356
360
|
}
|
|
357
361
|
|
|
358
362
|
/**
|
|
359
|
-
*
|
|
363
|
+
* The pointer that decides which surface a `DateInput` renders.
|
|
360
364
|
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
365
|
+
* `pointer: coarse` is the *primary* pointing device, which is what makes it
|
|
366
|
+
* the whole test. A touchscreen laptop reports `fine` (its trackpad) with
|
|
367
|
+
* `any-pointer: coarse` alongside, so it keeps the typable field — right,
|
|
368
|
+
* because its keyboard is there. A tablet reports `coarse` and gets the
|
|
369
|
+
* picker, at any width. There is deliberately no width bound: it would only
|
|
370
|
+
* re-exclude the tablets, since a narrowed desktop window is still a mouse.
|
|
371
|
+
*
|
|
372
|
+
* Deliberately NOT exported. It was, briefly, on the theory that an app might
|
|
373
|
+
* want to ask the same question and lay out to match — but nothing asked, and
|
|
374
|
+
* six other core components (CheckboxInput, ChatComposerInput, ...) just
|
|
375
|
+
* write `@media (pointer: coarse)` inline rather than sharing a constant. An
|
|
376
|
+
* export is additive later and awkward to withdraw, so it waits for a real
|
|
377
|
+
* caller.
|
|
369
378
|
*/
|
|
370
|
-
|
|
379
|
+
const TOUCH_POINTER_QUERY = '(pointer: coarse)';
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* The pointer-driven field: a text input you can type into, with a calendar
|
|
383
|
+
* in a popover beside it. `DateInput` renders this whenever the primary
|
|
384
|
+
* pointer is not a finger — see {@link TOUCH_POINTER_QUERY}.
|
|
385
|
+
*/
|
|
386
|
+
function PointerDateField({
|
|
371
387
|
label,
|
|
372
388
|
isLabelHidden = false,
|
|
373
389
|
description,
|
|
@@ -399,6 +415,8 @@ export function DateInput({
|
|
|
399
415
|
...rest
|
|
400
416
|
}: DateInputProps) {
|
|
401
417
|
const t = useTranslator();
|
|
418
|
+
const isEffectivelyRequired = useResolvedRequired({isRequired, isOptional});
|
|
419
|
+
const {locale} = use(InternationalizationContext);
|
|
402
420
|
const placeholder =
|
|
403
421
|
placeholderFromProps ?? t('@astryx.dateInput.placeholder');
|
|
404
422
|
const size = useSize(sizeProp, 'md');
|
|
@@ -481,8 +499,8 @@ export function DateInput({
|
|
|
481
499
|
(iso: ISODateString): string =>
|
|
482
500
|
typeof format === 'function'
|
|
483
501
|
? format(iso)
|
|
484
|
-
: formatSharedDate(plainDateFromISO(iso), format),
|
|
485
|
-
[format],
|
|
502
|
+
: formatSharedDate(plainDateFromISO(iso), format, locale),
|
|
503
|
+
[format, locale],
|
|
486
504
|
);
|
|
487
505
|
|
|
488
506
|
// Display value: pending input if typing, otherwise formatted value
|
|
@@ -497,7 +515,7 @@ export function DateInput({
|
|
|
497
515
|
const isInputValid =
|
|
498
516
|
pendingInput === null || !pendingInput.trim()
|
|
499
517
|
? true
|
|
500
|
-
: parseDateInput(pendingInput) !== null;
|
|
518
|
+
: parseDateInput(pendingInput, locale) !== null;
|
|
501
519
|
|
|
502
520
|
const popover = usePopover({
|
|
503
521
|
dialogLabel: t('@astryx.dateInput.dialogLabel'),
|
|
@@ -579,7 +597,7 @@ export function DateInput({
|
|
|
579
597
|
setPendingInput(newValue);
|
|
580
598
|
|
|
581
599
|
// If the input is valid and passes constraints, update immediately
|
|
582
|
-
const parsed = parseDateInput(newValue);
|
|
600
|
+
const parsed = parseDateInput(newValue, locale);
|
|
583
601
|
if (
|
|
584
602
|
parsed &&
|
|
585
603
|
plainDateToISO(parsed) !== value &&
|
|
@@ -592,7 +610,7 @@ export function DateInput({
|
|
|
592
610
|
calendarRef.current?.navigateTo(parsedISO);
|
|
593
611
|
}
|
|
594
612
|
},
|
|
595
|
-
[value, fireChange, isDateDisabled, isEffectivelyDisabled],
|
|
613
|
+
[value, fireChange, isDateDisabled, isEffectivelyDisabled, locale],
|
|
596
614
|
);
|
|
597
615
|
|
|
598
616
|
// Commit pending input (shared by blur and Enter key)
|
|
@@ -609,7 +627,7 @@ export function DateInput({
|
|
|
609
627
|
return;
|
|
610
628
|
}
|
|
611
629
|
|
|
612
|
-
const parsed = parseDateInput(pendingInput);
|
|
630
|
+
const parsed = parseDateInput(pendingInput, locale);
|
|
613
631
|
if (parsed && !isDateDisabled(parsed)) {
|
|
614
632
|
const parsedISO = plainDateToISO(parsed);
|
|
615
633
|
if (parsedISO !== value) {
|
|
@@ -617,7 +635,7 @@ export function DateInput({
|
|
|
617
635
|
}
|
|
618
636
|
}
|
|
619
637
|
setPendingInput(null);
|
|
620
|
-
}, [pendingInput, value, fireChange, isDateDisabled]);
|
|
638
|
+
}, [pendingInput, value, fireChange, isDateDisabled, locale]);
|
|
621
639
|
|
|
622
640
|
// Handle blur - validate, check constraints, and clear pending input
|
|
623
641
|
const handleBlur = useCallback(() => {
|
|
@@ -737,7 +755,7 @@ export function DateInput({
|
|
|
737
755
|
readOnly={showsDisabledMessage || undefined}
|
|
738
756
|
aria-labelledby={ariaLabelledBy}
|
|
739
757
|
aria-describedby={ariaDescribedBy}
|
|
740
|
-
aria-required={
|
|
758
|
+
aria-required={isEffectivelyRequired ? 'true' : undefined}
|
|
741
759
|
aria-invalid={
|
|
742
760
|
status?.type === 'error' || !isInputValid ? 'true' : undefined
|
|
743
761
|
}
|
|
@@ -820,4 +838,57 @@ export function DateInput({
|
|
|
820
838
|
);
|
|
821
839
|
}
|
|
822
840
|
|
|
841
|
+
PointerDateField.displayName = 'PointerDateField';
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* A date picker that fits the pointer it is being used with.
|
|
845
|
+
*
|
|
846
|
+
* With a mouse or trackpad this is a text input you can type into, with a
|
|
847
|
+
* calendar in a popover — unchanged, and still the surface every existing
|
|
848
|
+
* consumer gets. With a finger it is a picker built for one: a bottom sheet
|
|
849
|
+
* holding one month per screen, swiped sideways, with month and year wheels
|
|
850
|
+
* behind the header title for the far jumps swiping is bad at.
|
|
851
|
+
*
|
|
852
|
+
* The props are identical either way — this is one component with two
|
|
853
|
+
* surfaces, not two components — so nothing at the call site changes, and a
|
|
854
|
+
* date typed on a laptop and a date thumbed on a phone are the same value.
|
|
855
|
+
*
|
|
856
|
+
* ## Why a runtime switch and not CSS
|
|
857
|
+
*
|
|
858
|
+
* The two surfaces are structurally different — a popover anchored to a text
|
|
859
|
+
* field versus a full-width sheet holding a scroller — so "render both, hide
|
|
860
|
+
* one" would double the DOM, double the tab stops, and mount two calendars.
|
|
861
|
+
* The condition is not layout either: it is *which interaction is faster*,
|
|
862
|
+
* and that depends on the pointer, which CSS cannot hand to JS.
|
|
863
|
+
*
|
|
864
|
+
* They are two components rather than one with a branch inside because the
|
|
865
|
+
* hook lists differ; keeping them separate is what lets each own its own.
|
|
866
|
+
*
|
|
867
|
+
* ## Hydration
|
|
868
|
+
*
|
|
869
|
+
* `useMediaQuery` reports false during SSR, so server HTML is always the
|
|
870
|
+
* pointer field and the swap happens after hydration. That is deliberately
|
|
871
|
+
* unobservable: both surfaces render the SAME closed field — a bordered input
|
|
872
|
+
* with a calendar icon and the formatted date — and differ only in what
|
|
873
|
+
* opens. Nothing moves; the field just starts opening a sheet.
|
|
874
|
+
*
|
|
875
|
+
* @example
|
|
876
|
+
* ```
|
|
877
|
+
* <DateInput
|
|
878
|
+
* label="Event date"
|
|
879
|
+
* value={date}
|
|
880
|
+
* onChange={setDate}
|
|
881
|
+
* />
|
|
882
|
+
* ```
|
|
883
|
+
*/
|
|
884
|
+
export function DateInput(props: DateInputProps) {
|
|
885
|
+
const isTouch = useMediaQuery(TOUCH_POINTER_QUERY);
|
|
886
|
+
|
|
887
|
+
return isTouch ? (
|
|
888
|
+
<TouchDateField {...props} />
|
|
889
|
+
) : (
|
|
890
|
+
<PointerDateField {...props} />
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
|
|
823
894
|
DateInput.displayName = 'DateInput';
|