@astryxdesign/core 0.5.0 → 0.5.1-canary.70169cd
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 +222 -0
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +45 -20
- package/dist/AspectRatio/AspectRatio.d.ts +6 -6
- package/dist/Avatar/Avatar.d.ts +25 -1
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +43 -9
- package/dist/Avatar/index.d.ts +2 -2
- package/dist/Avatar/index.d.ts.map +1 -1
- package/dist/Avatar/index.js +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts +9 -2
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +5 -2
- package/dist/AvatarGroup/AvatarGroupContext.d.ts +2 -1
- package/dist/AvatarGroup/AvatarGroupContext.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +11 -7
- package/dist/Badge/Badge.d.ts.map +1 -1
- package/dist/Badge/Badge.js +26 -2
- package/dist/Banner/Banner.d.ts +10 -1
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +11 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +8 -7
- package/dist/Calendar/Calendar.d.ts +4 -2
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +15 -21
- package/dist/Calendar/hooks/useCalendarDays.js +4 -6
- package/dist/Calendar/hooks/useCalendarNavigation.js +4 -6
- package/dist/Calendar/styles.d.ts +5 -20
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +15 -17
- package/dist/Card/Card.d.ts +12 -12
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +17 -9
- package/dist/Card/index.d.ts +35 -1
- package/dist/Card/index.d.ts.map +1 -1
- package/dist/Card/index.js +21 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +108 -7
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +7 -1
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +15 -4
- package/dist/CodeBlock/highlightRanges.js +1 -1
- package/dist/CodeBlock/highlightStyles.js +13 -13
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +2 -7
- package/dist/ComplexSelector/ComplexSelector.d.ts +10 -2
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +14 -7
- package/dist/DateInput/DateInput.d.ts +43 -0
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +22 -5
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +5 -3
- package/dist/DateInput/MonthYearWheels.d.ts.map +1 -1
- package/dist/DateInput/MonthYearWheels.js +6 -4
- package/dist/DateInput/NativeDateField.d.ts +10 -0
- package/dist/DateInput/NativeDateField.d.ts.map +1 -0
- package/dist/DateInput/NativeDateField.js +494 -0
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +52 -25
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +1 -0
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.d.ts.map +1 -1
- package/dist/DateInput/nativeDateSegments.d.ts +22 -0
- package/dist/DateInput/nativeDateSegments.d.ts.map +1 -0
- package/dist/DateInput/nativeDateSegments.js +111 -0
- package/dist/DateRangeInput/DateRangeInput.d.ts +4 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +3 -5
- package/dist/DateTimeInput/DateTimeInput.d.ts +23 -24
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +35 -10
- package/dist/DateTimeInput/TouchDateTimeField.d.ts +6 -0
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -0
- package/dist/DateTimeInput/TouchDateTimeField.js +1021 -0
- package/dist/Dialog/Dialog.d.ts +16 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +28 -7
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +4 -13
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +9 -1
- package/dist/Field/InputClearButton.d.ts +9 -3
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +14 -3
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +0 -1
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +104 -3
- package/dist/HoverCard/useHoverCard.d.ts +14 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +7 -1
- package/dist/Icon/Icon.d.ts +4 -2
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/defaultIcons.d.ts +3 -2
- package/dist/Icon/defaultIcons.d.ts.map +1 -1
- package/dist/Icon/defaultIcons.js +7 -0
- package/dist/Icon/globalIconRegistry.d.ts +13 -0
- package/dist/Icon/globalIconRegistry.d.ts.map +1 -1
- package/dist/Icon/globalIconRegistry.js +34 -6
- package/dist/Icon/index.d.ts +1 -1
- package/dist/Icon/index.d.ts.map +1 -1
- package/dist/Icon/useIcon.d.ts +5 -2
- package/dist/Icon/useIcon.d.ts.map +1 -1
- package/dist/Icon/useIcon.js +3 -0
- package/dist/Indicator/CheckboxIndicator.d.ts.map +1 -1
- package/dist/Indicator/CheckboxIndicator.js +6 -2
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +2 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +2 -26
- package/dist/Layer/gestureCounter.d.ts +8 -0
- package/dist/Layer/gestureCounter.d.ts.map +1 -0
- package/dist/Layer/gestureCounter.js +53 -0
- package/dist/Layer/useLayer.d.ts +23 -13
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +146 -24
- package/dist/List/List.d.ts +1 -1
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +15 -4
- package/dist/Markdown/Markdown.d.ts +1 -1
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +20 -7
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +5 -3
- package/dist/MetadataList/MetadataListItem.d.ts +1 -1
- package/dist/MetadataList/MetadataListItem.d.ts.map +1 -1
- package/dist/MetadataList/MetadataListItem.js +4 -1
- package/dist/MultiSelector/MultiSelector.d.ts +18 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +58 -11
- package/dist/MultiSelector/hooks.d.ts +7 -1
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +3 -2
- package/dist/NavIcon/NavIcon.d.ts.map +1 -1
- package/dist/NavIcon/NavIcon.js +5 -1
- package/dist/NavItem/navItemStyles.stylex.d.ts +0 -8
- package/dist/NavItem/navItemStyles.stylex.d.ts.map +1 -1
- package/dist/NavItem/navItemStyles.stylex.js +0 -2
- package/dist/NavMenu/NavHeadingMenu.d.ts +1 -1
- package/dist/NavMenu/NavHeadingMenu.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.js +7 -4
- package/dist/NumberInput/NumberInput.d.ts +6 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +95 -126
- package/dist/NumberInput/numberInputCommit.d.ts +34 -0
- package/dist/NumberInput/numberInputCommit.d.ts.map +1 -0
- package/dist/NumberInput/numberInputCommit.js +71 -0
- package/dist/NumberInput/numberParser.d.ts +64 -0
- package/dist/NumberInput/numberParser.d.ts.map +1 -0
- package/dist/NumberInput/numberParser.js +350 -0
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +2 -3
- package/dist/OverflowList/OverflowList.d.ts +41 -1
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +43 -2
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +8 -14
- package/dist/Popover/usePopover.d.ts +15 -41
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +26 -7
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +91 -18
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +4 -2
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +18 -5
- package/dist/Resizable/useResizable.d.ts +19 -1
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +104 -38
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +9 -0
- package/dist/Selector/Selector.d.ts +18 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +92 -21
- package/dist/Selector/hooks.d.ts +7 -1
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +3 -2
- package/dist/SideNav/SideNav.d.ts +6 -1
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +57 -27
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +5 -4
- package/dist/SideNav/SideNavItem.d.ts +29 -4
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +75 -20
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +34 -2
- package/dist/Spinner/Spinner.d.ts +3 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +199 -20
- package/dist/StatusDot/StatusDot.d.ts.map +1 -1
- package/dist/StatusDot/StatusDot.js +6 -1
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +7 -6
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +5 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +6 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +3 -6
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +73 -4
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +26 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +34 -3
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +25 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +3 -4
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +0 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +13 -8
- package/dist/Timestamp/Timestamp.d.ts +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +10 -18
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +10 -5
- package/dist/Toast/Toast.d.ts +17 -2
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +77 -11
- package/dist/Toast/ToastViewport.d.ts +1 -0
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +76 -21
- package/dist/Toast/index.d.ts +1 -1
- package/dist/Toast/index.d.ts.map +1 -1
- package/dist/Toast/types.d.ts +38 -0
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Toast/useToastGesture.d.ts +26 -0
- package/dist/Toast/useToastGesture.d.ts.map +1 -0
- package/dist/Toast/useToastGesture.js +223 -0
- package/dist/Token/Token.d.ts +1 -1
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +23 -12
- package/dist/Token/TokenLink.d.ts +1 -1
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Token/TokenLink.js +5 -2
- package/dist/Tokenizer/Tokenizer.d.ts +12 -1
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +31 -21
- package/dist/TopNav/TopNavHeading.js +2 -2
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +3 -3
- package/dist/TopNav/TopNavMegaMenu.d.ts +1 -1
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +30 -9
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +3 -3
- package/dist/TopNav/TopNavMenu.d.ts +1 -1
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +21 -6
- package/dist/TreeList/TreeList.d.ts +1 -1
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +7 -2
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +2 -2
- package/dist/Typeahead/BaseTypeahead.d.ts +33 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +51 -8
- package/dist/Typeahead/Typeahead.d.ts +8 -1
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +2 -0
- package/dist/Typeahead/TypeaheadItem.d.ts +1 -1
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/Typeahead/TypeaheadItem.js +7 -2
- package/dist/astryx.css +87 -22
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +3 -25
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +14 -4
- package/dist/i18n/InternationalizationContext.d.ts +2 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +3 -1
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +3 -1
- package/dist/i18n/resolve.d.ts +1 -1
- package/dist/i18n/resolve.d.ts.map +1 -1
- package/dist/i18n/resolve.js +37 -38
- package/dist/i18n/useTranslator.d.ts.map +1 -1
- package/dist/i18n/useTranslator.js +2 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/theme/Theme.d.ts.map +1 -1
- package/dist/theme/Theme.js +46 -10
- package/dist/theme/defineTheme.d.ts +9 -3
- 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 +24 -4
- package/dist/theme/generateThemeRules.d.ts +21 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +26 -0
- package/dist/theme/syntax/tokens.d.ts +1 -1
- package/dist/theme/syntax/tokens.d.ts.map +1 -1
- package/dist/theme/syntax/tokens.js +5 -2
- package/dist/theme/useTheme.d.ts.map +1 -1
- package/dist/theme/useTheme.js +6 -7
- package/dist/utils/dateParser.d.ts +5 -8
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +10 -11
- package/dist/utils/focusOutline.stylex.d.ts +25 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +15 -0
- package/dist/utils/interactionOverlay.stylex.d.ts +26 -0
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -0
- package/dist/utils/interactionOverlay.stylex.js +42 -0
- package/dist/utils/isApplePlatform.d.ts +18 -0
- package/dist/utils/isApplePlatform.d.ts.map +1 -0
- package/dist/utils/isApplePlatform.js +37 -0
- package/dist/utils/plainDate.d.ts +11 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +20 -4
- package/locales/af-ZA.json +7 -7
- package/locales/ar-SA.json +7 -7
- package/locales/ca-ES.json +6 -6
- package/locales/cs-CZ.json +7 -7
- package/locales/da-DK.json +7 -7
- package/locales/de-DE.json +7 -7
- package/locales/el-GR.json +7 -7
- package/locales/en.json +178 -6
- package/locales/es-ES.json +6 -6
- package/locales/fi-FI.json +7 -7
- package/locales/fr-FR.json +7 -7
- package/locales/he-IL.json +7 -7
- package/locales/hu-HU.json +7 -7
- package/locales/it-IT.json +7 -7
- package/locales/ja-JP.json +7 -7
- package/locales/ko-KR.json +7 -7
- package/locales/nl-NL.json +7 -7
- package/locales/no-NO.json +7 -7
- package/locales/pl-PL.json +7 -7
- package/locales/pseudo.json +130 -1
- package/locales/pt-BR.json +7 -7
- package/locales/pt-PT.json +7 -7
- package/locales/ro-RO.json +7 -7
- package/locales/ru-RU.json +7 -7
- package/locales/sr-SP.json +7 -7
- package/locales/sv-SE.json +7 -7
- package/locales/tr-TR.json +7 -7
- package/locales/uk-UA.json +7 -7
- package/locales/vi-VN.json +7 -7
- package/locales/zh-CN.json +7 -7
- package/locales/zh-TW.json +7 -7
- package/package.json +4 -5
- package/src/AlertDialog/AlertDialog.doc.mjs +114 -30
- package/src/AlertDialog/AlertDialog.test.tsx +211 -2
- package/src/AlertDialog/AlertDialog.tsx +62 -20
- package/src/AspectRatio/AspectRatio.doc.mjs +3 -3
- package/src/AspectRatio/AspectRatio.tsx +6 -6
- package/src/Avatar/Avatar.doc.mjs +12 -2
- package/src/Avatar/Avatar.test.tsx +80 -0
- package/src/Avatar/Avatar.tsx +64 -14
- package/src/Avatar/index.ts +2 -2
- package/src/AvatarGroup/AvatarGroup.doc.mjs +8 -2
- package/src/AvatarGroup/AvatarGroup.test.tsx +24 -0
- package/src/AvatarGroup/AvatarGroup.tsx +12 -4
- package/src/AvatarGroup/AvatarGroupContext.ts +5 -3
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +12 -12
- package/src/Badge/Badge.doc.mjs +3 -2
- package/src/Badge/Badge.test.tsx +32 -3
- package/src/Badge/Badge.tsx +42 -1
- package/src/Banner/Banner.doc.mjs +9 -0
- package/src/Banner/Banner.test.tsx +76 -11
- package/src/Banner/Banner.tsx +21 -2
- package/src/Button/Button.doc.mjs +2 -1
- package/src/Button/Button.test.tsx +19 -4
- package/src/Button/Button.tsx +9 -29
- package/src/ButtonGroup/ButtonGroup.doc.mjs +2 -2
- package/src/ButtonGroup/ButtonGroup.test.tsx +13 -0
- package/src/Calendar/Calendar.doc.mjs +4 -4
- package/src/Calendar/Calendar.test.tsx +112 -0
- package/src/Calendar/Calendar.tsx +18 -16
- package/src/Calendar/hooks/useCalendarDays.ts +4 -4
- package/src/Calendar/hooks/useCalendarNavigation.ts +4 -4
- package/src/Calendar/styles.ts +48 -42
- package/src/Card/Card.doc.mjs +10 -7
- package/src/Card/Card.test.tsx +113 -19
- package/src/Card/Card.tsx +67 -89
- package/src/Card/index.ts +36 -1
- package/src/Carousel/Carousel.doc.mjs +3 -0
- package/src/Carousel/Carousel.test.tsx +360 -0
- package/src/Carousel/Carousel.tsx +116 -15
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -1
- package/src/CheckboxInput/CheckboxInput.test.tsx +15 -0
- package/src/CheckboxInput/CheckboxInput.tsx +5 -0
- package/src/CheckboxList/CheckboxList.doc.mjs +1 -1
- package/src/CodeBlock/CodeBlock.doc.mjs +10 -4
- package/src/CodeBlock/CodeBlock.test.tsx +37 -0
- package/src/CodeBlock/CodeBlock.tsx +20 -4
- package/src/CodeBlock/highlightRanges.ts +1 -1
- package/src/CodeBlock/highlightStyles.ts +13 -13
- package/src/CommandPalette/CommandPaletteItem.tsx +2 -12
- package/src/ComplexSelector/ComplexSelector.doc.mjs +9 -2
- package/src/ComplexSelector/ComplexSelector.test.tsx +183 -0
- package/src/ComplexSelector/ComplexSelector.tsx +22 -12
- package/src/DateInput/DateInput.doc.mjs +17 -1
- package/src/DateInput/DateInput.test.tsx +9 -4
- package/src/DateInput/DateInput.tsx +54 -3
- package/src/DateInput/DateInputTouch.test.tsx +146 -32
- package/src/DateInput/MonthScroller.tsx +5 -1
- package/src/DateInput/MonthYearWheels.tsx +7 -4
- package/src/DateInput/NativeDateField.test.tsx +635 -0
- package/src/DateInput/NativeDateField.tsx +641 -0
- package/src/DateInput/TouchDateField.tsx +83 -33
- package/src/DateInput/Wheel.tsx +1 -0
- package/src/DateInput/index.ts +1 -0
- package/src/DateInput/nativeDateSegments.ts +127 -0
- package/src/DateRangeInput/DateRangeInput.doc.mjs +3 -3
- package/src/DateRangeInput/DateRangeInput.test.tsx +46 -0
- package/src/DateRangeInput/DateRangeInput.tsx +8 -13
- package/src/DateTimeInput/DateTimeInput.doc.mjs +39 -22
- package/src/DateTimeInput/DateTimeInput.test.tsx +76 -0
- package/src/DateTimeInput/DateTimeInput.tsx +54 -20
- package/src/DateTimeInput/DateTimeInputTouch.test.tsx +980 -0
- package/src/DateTimeInput/TouchDateTimeField.tsx +1437 -0
- package/src/Dialog/Dialog.test.tsx +185 -18
- package/src/Dialog/Dialog.tsx +35 -11
- package/src/DropdownMenu/DropdownMenu.test.tsx +44 -10
- package/src/DropdownMenu/DropdownMenu.tsx +4 -13
- package/src/Field/Field.doc.mjs +1 -1
- package/src/Field/FieldLabel.test.tsx +29 -0
- package/src/Field/FieldLabel.tsx +7 -0
- package/src/Field/InputClearButton.test.tsx +15 -1
- package/src/Field/InputClearButton.tsx +28 -4
- package/src/FieldStatus/FieldStatus.doc.mjs +1 -1
- package/src/FileInput/FileInput.doc.mjs +1 -1
- package/src/Heading/Heading.tsx +0 -1
- package/src/HoverCard/HoverCard.doc.mjs +8 -2
- package/src/HoverCard/HoverCard.test.tsx +154 -4
- package/src/HoverCard/HoverCard.tsx +137 -3
- package/src/HoverCard/useHoverCard.tsx +23 -3
- package/src/Icon/Icon.test.tsx +55 -1
- package/src/Icon/Icon.tsx +5 -3
- package/src/Icon/defaultIcons.tsx +11 -2
- package/src/Icon/globalIconRegistry.test.tsx +16 -3
- package/src/Icon/globalIconRegistry.tsx +37 -6
- package/src/Icon/index.ts +1 -0
- package/src/Icon/useIcon.ts +9 -2
- package/src/Indicator/CheckboxIndicator.tsx +14 -8
- package/src/Indicator/Indicator.doc.mjs +3 -1
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Item/Item.tsx +2 -7
- package/src/Kbd/Kbd.test.tsx +0 -17
- package/src/Kbd/Kbd.tsx +2 -26
- package/src/Layer/gestureCounter.ts +57 -0
- package/src/Layer/useLayer.test.tsx +368 -16
- package/src/Layer/useLayer.tsx +208 -35
- package/src/Layout/__tests__/edgeCompensation.test.tsx +1 -1
- package/src/List/List.test.tsx +38 -0
- package/src/List/List.tsx +8 -1
- package/src/Markdown/Markdown.test.tsx +37 -0
- package/src/Markdown/Markdown.tsx +16 -5
- package/src/Markdown/parser.test.ts +33 -0
- package/src/Markdown/parser.ts +9 -3
- package/src/MetadataList/MetadataList.test.tsx +75 -2
- package/src/MetadataList/MetadataListItem.tsx +5 -2
- package/src/MultiSelector/MultiSelector.doc.mjs +23 -2
- package/src/MultiSelector/MultiSelector.test.tsx +205 -0
- package/src/MultiSelector/MultiSelector.tsx +103 -16
- package/src/MultiSelector/hooks.ts +9 -2
- package/src/NavIcon/NavIcon.doc.mjs +8 -2
- package/src/NavIcon/NavIcon.test.tsx +9 -0
- package/src/NavIcon/NavIcon.tsx +5 -1
- package/src/NavItem/navItemStyles.stylex.ts +0 -8
- package/src/NavMenu/NavHeadingMenu.test.tsx +30 -0
- package/src/NavMenu/NavHeadingMenu.tsx +7 -4
- package/src/NumberInput/NumberInput.doc.mjs +27 -8
- package/src/NumberInput/NumberInput.test.tsx +563 -8
- package/src/NumberInput/NumberInput.tsx +77 -131
- package/src/NumberInput/numberInputCommit.test.ts +72 -0
- package/src/NumberInput/numberInputCommit.ts +103 -0
- package/src/NumberInput/numberParser.docblock.test.ts +234 -0
- package/src/NumberInput/numberParser.test.ts +222 -0
- package/src/NumberInput/numberParser.ts +403 -0
- package/src/Outline/Outline.tsx +2 -4
- package/src/OverflowList/OverflowList.doc.mjs +102 -21
- package/src/OverflowList/OverflowList.test.tsx +550 -4
- package/src/OverflowList/OverflowList.tsx +100 -2
- package/src/Pagination/Pagination.test.tsx +3 -2
- package/src/Popover/Popover.doc.mjs +2 -2
- package/src/Popover/Popover.test.tsx +38 -0
- package/src/Popover/Popover.tsx +28 -66
- package/src/Popover/usePopover.tsx +44 -5
- package/src/PowerSearch/PowerSearch.doc.mjs +1 -1
- package/src/PowerSearch/PowerSearchEditPopover.test.tsx +87 -0
- package/src/PowerSearch/PowerSearchValueEditor.test.tsx +64 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +109 -10
- package/src/PowerSearch/formatFilterValue.test.ts +16 -1
- package/src/PowerSearch/formatFilterValue.ts +2 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +42 -6
- package/src/ProgressBar/ProgressBar.test.tsx +24 -0
- package/src/ProgressBar/ProgressBar.tsx +28 -8
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/Resizable/Resizable.doc.mjs +2 -2
- package/src/Resizable/useResizable.doc.mjs +21 -2
- package/src/Resizable/useResizable.test.ts +421 -0
- package/src/Resizable/useResizable.ts +133 -48
- package/src/SelectableCard/SelectableCard.doc.mjs +3 -0
- package/src/SelectableCard/SelectableCard.tsx +16 -0
- package/src/Selector/Selector.doc.mjs +15 -1
- package/src/Selector/Selector.source-build.test.mjs +65 -0
- package/src/Selector/Selector.test.tsx +301 -0
- package/src/Selector/Selector.tsx +145 -32
- package/src/Selector/hooks.ts +17 -2
- package/src/SideNav/SideNav.doc.mjs +2 -2
- package/src/SideNav/SideNav.test.tsx +1069 -6
- package/src/SideNav/SideNav.tsx +109 -38
- package/src/SideNav/SideNavHeading.tsx +5 -2
- package/src/SideNav/SideNavItem.doc.mjs +24 -3
- package/src/SideNav/SideNavItem.tsx +134 -44
- package/src/Slider/Slider.doc.mjs +2 -2
- package/src/Slider/Slider.test.tsx +106 -1
- package/src/Slider/Slider.tsx +52 -1
- package/src/Spinner/Spinner.doc.mjs +17 -5
- package/src/Spinner/Spinner.test.tsx +164 -0
- package/src/Spinner/Spinner.tsx +252 -22
- package/src/StatusDot/StatusDot.doc.mjs +8 -2
- package/src/StatusDot/StatusDot.test.tsx +9 -0
- package/src/StatusDot/StatusDot.tsx +7 -1
- package/src/Stepper/Step.doc.mjs +1 -1
- package/src/Stepper/Step.tsx +7 -14
- package/src/Switch/Switch.doc.mjs +3 -1
- package/src/Switch/Switch.test.tsx +10 -0
- package/src/Switch/Switch.tsx +3 -0
- package/src/Table/BaseTable.tsx +6 -1
- package/src/Table/Table.doc.mjs +5 -3
- package/src/Table/Table.tsx +3 -8
- package/src/Table/TableBody.doc.mjs +2 -2
- package/src/Table/TableFooter.doc.mjs +1 -1
- package/src/Table/TableHeader.doc.mjs +1 -1
- package/src/Table/plugins/filtering/useTableFiltering.test.tsx +44 -6
- package/src/Table/plugins/filtering/useTableFiltering.tsx +100 -4
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +50 -4
- package/src/Table/plugins/selection/useTableSelection.test.tsx +62 -0
- package/src/Table/plugins/selection/useTableSelection.tsx +25 -2
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +1 -2
- package/src/Table/useTableGroupedRows.doc.mjs +3 -3
- package/src/Table/useTablePagination.doc.mjs +1 -1
- package/src/Table/useTableSelection.doc.mjs +1 -1
- package/src/Text/Text.test.tsx +44 -0
- package/src/Text/Text.tsx +0 -1
- package/src/TextArea/TextArea.doc.mjs +13 -3
- package/src/TextArea/TextArea.test.tsx +11 -0
- package/src/TextArea/TextArea.tsx +34 -22
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/TimeInput/TimeInput.doc.mjs +1 -1
- package/src/Timestamp/Timestamp.test.tsx +89 -0
- package/src/Timestamp/Timestamp.tsx +8 -8
- package/src/Timestamp/formatInstant.ts +5 -0
- package/src/Toast/Toast.doc.mjs +213 -44
- package/src/Toast/Toast.tsx +118 -23
- package/src/Toast/ToastViewport.test.tsx +1434 -8
- package/src/Toast/ToastViewport.tsx +85 -14
- package/src/Toast/index.ts +2 -0
- package/src/Toast/types.ts +43 -5
- package/src/Toast/useToastGesture.ts +361 -0
- package/src/Token/Token.test.tsx +95 -0
- package/src/Token/Token.tsx +19 -17
- package/src/Token/TokenLink.tsx +12 -3
- package/src/Tokenizer/Tokenizer.doc.mjs +17 -4
- package/src/Tokenizer/Tokenizer.test.tsx +161 -0
- package/src/Tokenizer/Tokenizer.tsx +49 -24
- package/src/TopNav/TopNavHeading.tsx +2 -2
- package/src/TopNav/TopNavItem.tsx +3 -7
- package/src/TopNav/TopNavMegaMenu.test.tsx +104 -0
- package/src/TopNav/TopNavMegaMenu.tsx +47 -4
- package/src/TopNav/TopNavMegaMenuItem.tsx +10 -9
- package/src/TopNav/TopNavMenu.test.tsx +133 -1
- package/src/TopNav/TopNavMenu.tsx +38 -5
- package/src/TreeList/TreeList.test.tsx +49 -0
- package/src/TreeList/TreeList.tsx +7 -2
- package/src/TreeList/TreeListItem.tsx +2 -7
- package/src/Typeahead/BaseTypeahead.doc.mjs +13 -0
- package/src/Typeahead/BaseTypeahead.tsx +96 -6
- package/src/Typeahead/Typeahead.doc.mjs +7 -1
- package/src/Typeahead/Typeahead.test.tsx +154 -0
- package/src/Typeahead/Typeahead.tsx +9 -0
- package/src/Typeahead/TypeaheadItem.test.tsx +43 -0
- package/src/Typeahead/TypeaheadItem.tsx +8 -1
- package/src/hooks/useAnnounce.doc.mjs +96 -0
- package/src/hooks/useDevWarning.doc.mjs +96 -0
- package/src/hooks/useHotkeys.test.ts +0 -18
- package/src/hooks/useHotkeys.ts +3 -25
- package/src/hooks/useIndicatorFocusRing.doc.mjs +104 -0
- package/src/hooks/useInputStatusIcon.doc.mjs +142 -0
- package/src/hooks/useInteractiveRole.doc.mjs +119 -0
- package/src/hooks/useLongPress.doc.mjs +123 -0
- package/src/hooks/useOverflow.doc.mjs +58 -17
- package/src/hooks/useOverflow.ts +16 -4
- package/src/hooks/useTypeahead.doc.mjs +153 -0
- package/src/i18n/InternationalizationContext.ts +3 -0
- package/src/i18n/InternationalizationProvider.tsx +8 -1
- package/src/i18n/__tests__/resolve.test.ts +23 -1
- package/src/i18n/resolve.ts +46 -49
- package/src/i18n/useTranslator.ts +2 -7
- package/src/index.ts +2 -0
- package/src/raw-import.d.ts +14 -0
- package/src/theme/Theme.test.tsx +104 -2
- package/src/theme/Theme.tsx +49 -14
- package/src/theme/defineTheme.test.ts +23 -0
- package/src/theme/defineTheme.ts +12 -3
- package/src/theme/derivedVarRegistry.test.ts +87 -3
- package/src/theme/derivedVarRegistry.ts +23 -4
- package/src/theme/generateThemeRules.test.ts +99 -1
- package/src/theme/generateThemeRules.ts +28 -0
- package/src/theme/syntax/tokens.ts +5 -2
- package/src/theme/useTheme.test.tsx +10 -0
- package/src/theme/useTheme.ts +16 -10
- package/src/utils/dateParser.test.ts +34 -2
- package/src/utils/dateParser.ts +11 -14
- package/src/utils/focusOutline.stylex.ts +50 -0
- package/src/utils/interactionOverlay.stylex.ts +74 -0
- package/src/utils/isApplePlatform.test.ts +61 -0
- package/src/utils/isApplePlatform.ts +37 -0
- package/src/utils/plainDate.test.ts +46 -0
- package/src/utils/plainDate.ts +18 -3
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
* 3. The title is the escape hatch. Tap it and the same box becomes a month
|
|
39
39
|
* wheel and a year wheel — a flick each to reach 2019 instead of forty.
|
|
40
40
|
*
|
|
41
|
+
* Reset is chrome, so it sits in the header beside the arrows rather than in
|
|
42
|
+
* the footer: the footer is where the task ends, and an undo of equal weight
|
|
43
|
+
* beside Save is a mis-tap that throws away the date just chosen.
|
|
44
|
+
*
|
|
41
45
|
* SYNC: When modified, update these files to stay in sync:
|
|
42
46
|
* - /packages/core/src/DateInput/DateInput.tsx
|
|
43
47
|
* - /packages/core/src/DateInput/DateInput.doc.mjs
|
|
@@ -53,7 +57,7 @@ import { useInputStatusIcon, useMergedRefs } from "../hooks/index.js";
|
|
|
53
57
|
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
54
58
|
import { Icon } from "../Icon/index.js";
|
|
55
59
|
import { IconButton } from "../IconButton/index.js";
|
|
56
|
-
import { useTranslator } from "../i18n/index.js";
|
|
60
|
+
import { useLocale, useTranslator } from "../i18n/index.js";
|
|
57
61
|
import { useInputGroup } from "../InputGroup/index.js";
|
|
58
62
|
import { groupStyles } from "../InputGroup/groupStyles.js";
|
|
59
63
|
import { stableClassName } from "../naming.js";
|
|
@@ -64,6 +68,7 @@ import { colorVars, spacingVars, radiusVars, sizeVars, borderVars, fontWeightVar
|
|
|
64
68
|
import { useTooltip } from "../Tooltip/index.js";
|
|
65
69
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
66
70
|
import { focusOutlineStyles, getInputARIA, isImeKeyEvent, mergeProps, rtlStyles, themeProps, formatSharedDate, plainDateFromISO, plainDateToday, plainDateFormat, DATE_FORMAT_MONTH_YEAR, DATE_FORMAT_WEEKDAY_ONLY } from "../utils/index.js";
|
|
71
|
+
import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
|
|
67
72
|
import { normalizeDayOfWeek } from "../utils/dateTypes.js";
|
|
68
73
|
import { MonthScroller } from "./MonthScroller.js";
|
|
69
74
|
import { MonthYearWheels } from "./MonthYearWheels.js";
|
|
@@ -72,9 +77,8 @@ import "./tokens.stylex.js";
|
|
|
72
77
|
import { dateInputTouchSizes, dateInputTouchGeometry } from "./tokens.stylex.js";
|
|
73
78
|
|
|
74
79
|
/**
|
|
75
|
-
* The comfortable minimum tap target on both iOS and Android
|
|
76
|
-
*
|
|
77
|
-
* it means, it just cannot produce a control a thumb misses.
|
|
80
|
+
* The comfortable minimum tap target on both iOS and Android, honoured by
|
|
81
|
+
* every target inside the sheet.
|
|
78
82
|
*/
|
|
79
83
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
80
84
|
const TOUCH_TARGET = dateInputTouchSizes.daySize;
|
|
@@ -101,19 +105,16 @@ const sizeStyles = {
|
|
|
101
105
|
sm: {
|
|
102
106
|
kZKoxP: "x6k0iem",
|
|
103
107
|
k7Eaqz: "xfb3i0g",
|
|
104
|
-
kAzted: "xygd9yz",
|
|
105
108
|
$$css: true
|
|
106
109
|
},
|
|
107
110
|
md: {
|
|
108
111
|
kZKoxP: "x1ueg155",
|
|
109
112
|
k7Eaqz: "xfb3i0g",
|
|
110
|
-
kAzted: "xygd9yz",
|
|
111
113
|
$$css: true
|
|
112
114
|
},
|
|
113
115
|
lg: {
|
|
114
116
|
kZKoxP: "xssyfek",
|
|
115
117
|
k7Eaqz: "xfb3i0g",
|
|
116
|
-
kAzted: "xygd9yz",
|
|
117
118
|
$$css: true
|
|
118
119
|
}
|
|
119
120
|
};
|
|
@@ -152,6 +153,10 @@ const styles = {
|
|
|
152
153
|
k1xSpc: "x3nfvp2",
|
|
153
154
|
$$css: true
|
|
154
155
|
},
|
|
156
|
+
resetButton: {
|
|
157
|
+
kAzted: "xygd9yz",
|
|
158
|
+
$$css: true
|
|
159
|
+
},
|
|
155
160
|
title: {
|
|
156
161
|
k1xSpc: "x78zum5",
|
|
157
162
|
kGNEyG: "x6s0dn4",
|
|
@@ -162,16 +167,19 @@ const styles = {
|
|
|
162
167
|
kMzoRj: "xc342km",
|
|
163
168
|
ksu8eU: "xng3xce",
|
|
164
169
|
kaIpWk: "xh6dtrn",
|
|
165
|
-
kWkggS: "xjbqb8w
|
|
170
|
+
kWkggS: "xjbqb8w",
|
|
166
171
|
kMwMTN: "x1tgivj0",
|
|
167
172
|
kGuDYH: "x18juvz8",
|
|
168
173
|
k63SB2: "x2mo6ok",
|
|
169
174
|
kkrTdU: "x1ypdohk x16khyan",
|
|
170
175
|
khDVqt: "xuxw1ft",
|
|
176
|
+
k7Eaqz: "xeuugli",
|
|
177
|
+
kVQacm: "xb3r6kr",
|
|
171
178
|
$$css: true
|
|
172
179
|
},
|
|
173
180
|
titleChevron: {
|
|
174
181
|
k1xSpc: "x3nfvp2",
|
|
182
|
+
kmuXW: "x2lah0s",
|
|
175
183
|
k1ekBW: "x11xpdln",
|
|
176
184
|
kIyJzY: "xuedmi6",
|
|
177
185
|
kAMwcw: "xlr8y92",
|
|
@@ -223,6 +231,7 @@ export function TouchDateField({
|
|
|
223
231
|
...rest
|
|
224
232
|
}) {
|
|
225
233
|
const t = useTranslator();
|
|
234
|
+
const locale = useLocale();
|
|
226
235
|
const isEffectivelyRequired = useResolvedRequired({
|
|
227
236
|
isRequired,
|
|
228
237
|
isOptional
|
|
@@ -323,17 +332,17 @@ export function TouchDateField({
|
|
|
323
332
|
year: 1970,
|
|
324
333
|
month: 1,
|
|
325
334
|
day: 4 + (weekStartsOn + offset) % 7
|
|
326
|
-
}, DATE_FORMAT_WEEKDAY_ONLY)), [weekStartsOn]);
|
|
335
|
+
}, DATE_FORMAT_WEEKDAY_ONLY, locale)), [locale, weekStartsOn]);
|
|
327
336
|
const monthYearLabel = plainDateFormat({
|
|
328
337
|
year,
|
|
329
338
|
month,
|
|
330
339
|
day: 1
|
|
331
|
-
}, DATE_FORMAT_MONTH_YEAR);
|
|
340
|
+
}, DATE_FORMAT_MONTH_YEAR, locale);
|
|
332
341
|
|
|
333
342
|
// Formats the committed value only. A function format is called with the ISO
|
|
334
343
|
// value; a named one reuses Timestamp's shared date mapping, so the same
|
|
335
344
|
// literal renders the same shape here and on the desktop control.
|
|
336
|
-
const displayValue = optimisticValue != null && /^\d{4}-\d{2}-\d{2}$/.test(optimisticValue) ? typeof format === 'function' ? format(optimisticValue) : formatSharedDate(plainDateFromISO(optimisticValue), format) : '';
|
|
345
|
+
const displayValue = optimisticValue != null && /^\d{4}-\d{2}-\d{2}$/.test(optimisticValue) ? typeof format === 'function' ? format(optimisticValue) : formatSharedDate(plainDateFromISO(optimisticValue), format, locale) : '';
|
|
337
346
|
const fireChange = useCallback(newValue => {
|
|
338
347
|
if (isBusy) {
|
|
339
348
|
return;
|
|
@@ -545,8 +554,11 @@ export function TouchDateField({
|
|
|
545
554
|
// withdrawing one is not.
|
|
546
555
|
,
|
|
547
556
|
"data-title": "month-year",
|
|
548
|
-
...stylex.props(styles.title, focusOutlineStyles.focusVisible),
|
|
557
|
+
...stylex.props(styles.title, interactionOverlayStyles.backgroundColor, focusOutlineStyles.focusVisible),
|
|
549
558
|
children: [/*#__PURE__*/_jsx("span", {
|
|
559
|
+
...{
|
|
560
|
+
className: "xeuugli xb3r6kr xlyipyv"
|
|
561
|
+
},
|
|
550
562
|
children: monthYearLabel
|
|
551
563
|
}), /*#__PURE__*/_jsx(Icon, {
|
|
552
564
|
icon: "chevronDown",
|
|
@@ -603,6 +615,27 @@ export function TouchDateField({
|
|
|
603
615
|
})
|
|
604
616
|
})
|
|
605
617
|
})]
|
|
618
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
619
|
+
"data-action": "reset",
|
|
620
|
+
inert: isWheelOpen ? true : undefined,
|
|
621
|
+
...{
|
|
622
|
+
0: {
|
|
623
|
+
className: "x78zum5 x6s0dn4 x1jl3cmp xuedmi6 xcj1dhv xzg1mie"
|
|
624
|
+
},
|
|
625
|
+
1: {
|
|
626
|
+
className: "x78zum5 x6s0dn4 x1jl3cmp xuedmi6 xcj1dhv xzg1mie xlshs6z xg01cxk x47corl"
|
|
627
|
+
}
|
|
628
|
+
}[!!isWheelOpen << 0],
|
|
629
|
+
children: /*#__PURE__*/_jsx(Button
|
|
630
|
+
// ghost: a filled button up here would outrank the Save that
|
|
631
|
+
// finishes the task.
|
|
632
|
+
, {
|
|
633
|
+
variant: "ghost",
|
|
634
|
+
size: "sm",
|
|
635
|
+
xstyle: styles.resetButton,
|
|
636
|
+
label: t('@astryx.dateInput.resetPicking'),
|
|
637
|
+
onClick: handleResetInSheet
|
|
638
|
+
})
|
|
606
639
|
})]
|
|
607
640
|
}), /*#__PURE__*/_jsx("div", {
|
|
608
641
|
"aria-hidden": "true",
|
|
@@ -677,23 +710,17 @@ export function TouchDateField({
|
|
|
677
710
|
...{
|
|
678
711
|
className: "x1xye8es xrvj5dj x1y6fwsi"
|
|
679
712
|
},
|
|
680
|
-
children: [/*#__PURE__*/
|
|
713
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
681
714
|
inert: isWheelOpen ? true : undefined,
|
|
682
715
|
...{
|
|
683
716
|
0: {
|
|
684
|
-
className: "x15r89dc x78zum5
|
|
717
|
+
className: "x15r89dc x78zum5 x74b7sa xuedmi6 xzg1mie"
|
|
685
718
|
},
|
|
686
719
|
1: {
|
|
687
|
-
className: "x15r89dc x78zum5
|
|
720
|
+
className: "x15r89dc x78zum5 x74b7sa xuedmi6 xzg1mie xlshs6z x47corl"
|
|
688
721
|
}
|
|
689
722
|
}[!!isWheelOpen << 0],
|
|
690
|
-
children:
|
|
691
|
-
variant: "secondary",
|
|
692
|
-
size: "md",
|
|
693
|
-
width: "100%",
|
|
694
|
-
label: t('@astryx.dateInput.resetPicking'),
|
|
695
|
-
onClick: handleResetInSheet
|
|
696
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
723
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
697
724
|
variant: "primary"
|
|
698
725
|
// md, not sm: it is the action a thumb reaches for, so it gets
|
|
699
726
|
// the comfortable size rather than the compact one the header's
|
|
@@ -703,15 +730,15 @@ export function TouchDateField({
|
|
|
703
730
|
width: "100%",
|
|
704
731
|
label: t('@astryx.dateInput.savePicking'),
|
|
705
732
|
onClick: () => setIsSheetOpen(false)
|
|
706
|
-
})
|
|
733
|
+
})
|
|
707
734
|
}), /*#__PURE__*/_jsx("div", {
|
|
708
735
|
inert: isWheelOpen ? undefined : true,
|
|
709
736
|
...{
|
|
710
737
|
0: {
|
|
711
|
-
className: "x15r89dc x78zum5
|
|
738
|
+
className: "x15r89dc x78zum5 x10xzikg xc8icb0 x1jl3cmp xuedmi6 xcj1dhv xzg1mie"
|
|
712
739
|
},
|
|
713
740
|
1: {
|
|
714
|
-
className: "x15r89dc x78zum5
|
|
741
|
+
className: "x15r89dc x78zum5 x10xzikg xc8icb0 x1jl3cmp xuedmi6 xcj1dhv xzg1mie xlshs6z xg01cxk x47corl"
|
|
715
742
|
}
|
|
716
743
|
}[!!!isWheelOpen << 0],
|
|
717
744
|
children: /*#__PURE__*/_jsx(Button
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/Wheel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/Wheel.tsx"],"names":[],"mappings":"AA2MA,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACpC,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAe,GAChB,EAAE,UAAU,+BAgOZ;yBAtOe,KAAK"}
|
package/dist/DateInput/Wheel.js
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
*
|
|
29
29
|
* SYNC: When modified, update:
|
|
30
30
|
* - /packages/core/src/DateInput/TouchDateField.tsx
|
|
31
|
+
* - /packages/core/src/DateTimeInput/TouchDateTimeField.tsx
|
|
31
32
|
* - /packages/core/src/DateInput/DateInput.doc.mjs
|
|
32
33
|
* - /packages/core/src/DateInput/DateInputTouch.test.tsx
|
|
33
34
|
*/
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* @position Package entry point for DateInput
|
|
6
6
|
*/
|
|
7
7
|
export { DateInput } from './DateInput';
|
|
8
|
-
export type { DateInputProps, DateInputSize, DateInputFormat, DateInputStatus, DateInputStatusType, } from './DateInput';
|
|
8
|
+
export type { DateInputProps, DateInputSize, DateInputFormat, DateInputNativePicker, DateInputStatus, DateInputStatusType, } from './DateInput';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput/index.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,YAAY,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,eAAe,EACf,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput/index.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,YAAY,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the user can type into this engine's `<input type="date">`.
|
|
3
|
+
*
|
|
4
|
+
* Firefox exposes neither pseudo-element, so it — and any future engine —
|
|
5
|
+
* comes back `'unknown'` and the pointer breaks the tie. That is the right
|
|
6
|
+
* fallback precisely where the probe is blind: the pointer is wrong for
|
|
7
|
+
* Chromium because Blink's answer is fixed at build time and contradicts it,
|
|
8
|
+
* and an engine we cannot see is not in that position. It lands Firefox on
|
|
9
|
+
* the desktop (segmented) and on Android (picker-only) correctly.
|
|
10
|
+
*
|
|
11
|
+
* @param isTouchPointer Whether `(pointer: coarse)` matches.
|
|
12
|
+
* @internal Exported for tests.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasEditableDateSegments(isTouchPointer: boolean): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Drops the cached classification.
|
|
17
|
+
*
|
|
18
|
+
* @internal Exists for tests, which render against several engines in one
|
|
19
|
+
* document.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resetDateSegmentProbe(): void;
|
|
22
|
+
//# sourceMappingURL=nativeDateSegments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeDateSegments.d.ts","sourceRoot":"","sources":["../../src/DateInput/nativeDateSegments.ts"],"names":[],"mappings":"AAoGA;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,CAGxE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file nativeDateSegments.ts
|
|
7
|
+
* @input Uses the DOM only
|
|
8
|
+
* @output Exports hasEditableDateSegments, resetDateSegmentProbe
|
|
9
|
+
* @position Internal helper for NativeDateField; answers "can the user type
|
|
10
|
+
* into this engine's `<input type="date">`?"
|
|
11
|
+
*
|
|
12
|
+
* `<input type="date">` is two different controls wearing one tag name: a
|
|
13
|
+
* single untypable run the OS picker drives (iOS, Android), or a row of
|
|
14
|
+
* editable `mm`/`dd`/`yyyy` fields (desktop engines). Hiding the first costs
|
|
15
|
+
* nothing; hiding the second hides what the user is editing.
|
|
16
|
+
*
|
|
17
|
+
* Neither obvious test tells them apart. The pointer is wrong on Chrome's
|
|
18
|
+
* touch simulator, a Windows tablet and a ChromeOS convertible, which report
|
|
19
|
+
* a coarse pointer while Blink still renders segments. And measured, iOS and
|
|
20
|
+
* Chromium BOTH accept every `-webkit-datetime-*` selector, so
|
|
21
|
+
* `CSS.supports('selector(...)')` only proves the parser knows the name. What
|
|
22
|
+
* separates them is which pseudo is a real box, so this measures that.
|
|
23
|
+
*
|
|
24
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
25
|
+
* - /packages/core/src/DateInput/NativeDateField.tsx (the caller)
|
|
26
|
+
* - /packages/core/src/DateInput/NativeDateField.test.tsx (tests)
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/** Marks the throwaway probe element for the probe stylesheet. */
|
|
30
|
+
const PROBE_ATTR = 'data-astryx-date-probe';
|
|
31
|
+
|
|
32
|
+
/** How much padding the probe adds, in px. Large enough to beat rounding. */
|
|
33
|
+
const PROBE_PADDING = 100;
|
|
34
|
+
let cachedEngine = null;
|
|
35
|
+
|
|
36
|
+
/** Whether padding this pseudo-element moves the control's box. */
|
|
37
|
+
function pseudoIsRealBox(input, style, pseudo, baseWidth) {
|
|
38
|
+
style.textContent = `[${PROBE_ATTR}]${pseudo}{padding-inline-start:${PROBE_PADDING}px !important}`;
|
|
39
|
+
// Reading geometry flushes style and layout, so this already reflects it.
|
|
40
|
+
return input.getBoundingClientRect().width > baseWidth + PROBE_PADDING / 2;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Classifies the engine's date control. Cached: the answer is a build-time
|
|
45
|
+
* property of the browser, not of the field or the pointer in use.
|
|
46
|
+
*/
|
|
47
|
+
function probeEngine() {
|
|
48
|
+
if (cachedEngine !== null) {
|
|
49
|
+
return cachedEngine;
|
|
50
|
+
}
|
|
51
|
+
if (typeof document === 'undefined' || !document.body) {
|
|
52
|
+
return 'unknown';
|
|
53
|
+
}
|
|
54
|
+
const input = document.createElement('input');
|
|
55
|
+
input.setAttribute('type', 'date');
|
|
56
|
+
input.setAttribute(PROBE_ATTR, '');
|
|
57
|
+
// Off-screen, and immune to the page's own `input` rules: the probe reads a
|
|
58
|
+
// width DELTA, so anything pinning the width would swallow the signal.
|
|
59
|
+
input.style.cssText = 'position:fixed;top:-9999px;left:0;width:auto;min-width:0;max-width:none;' + 'padding:0;border:0;font-size:16px;box-sizing:content-box;';
|
|
60
|
+
const style = document.createElement('style');
|
|
61
|
+
let kind = 'unknown';
|
|
62
|
+
try {
|
|
63
|
+
document.body.appendChild(input);
|
|
64
|
+
document.head.appendChild(style);
|
|
65
|
+
const base = input.getBoundingClientRect().width;
|
|
66
|
+
if (pseudoIsRealBox(input, style, '::-webkit-datetime-edit', base)) {
|
|
67
|
+
// Chromium's editable field row, and WebKit's on macOS/GTK. Probe the
|
|
68
|
+
// container: the individual field pseudos overflow it rather than
|
|
69
|
+
// expand it, so they do not move the box even in Chromium.
|
|
70
|
+
kind = 'segmented';
|
|
71
|
+
} else if (pseudoIsRealBox(input, style, '::-webkit-date-and-time-value', base)) {
|
|
72
|
+
// The single, untypable run iOS Safari and Chrome on Android paint.
|
|
73
|
+
kind = 'picker-only';
|
|
74
|
+
}
|
|
75
|
+
} catch {
|
|
76
|
+
// A hostile CSSOM leaves the answer unknown, resolved by the pointer.
|
|
77
|
+
} finally {
|
|
78
|
+
input.remove();
|
|
79
|
+
style.remove();
|
|
80
|
+
}
|
|
81
|
+
cachedEngine = kind;
|
|
82
|
+
return kind;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Whether the user can type into this engine's `<input type="date">`.
|
|
87
|
+
*
|
|
88
|
+
* Firefox exposes neither pseudo-element, so it — and any future engine —
|
|
89
|
+
* comes back `'unknown'` and the pointer breaks the tie. That is the right
|
|
90
|
+
* fallback precisely where the probe is blind: the pointer is wrong for
|
|
91
|
+
* Chromium because Blink's answer is fixed at build time and contradicts it,
|
|
92
|
+
* and an engine we cannot see is not in that position. It lands Firefox on
|
|
93
|
+
* the desktop (segmented) and on Android (picker-only) correctly.
|
|
94
|
+
*
|
|
95
|
+
* @param isTouchPointer Whether `(pointer: coarse)` matches.
|
|
96
|
+
* @internal Exported for tests.
|
|
97
|
+
*/
|
|
98
|
+
export function hasEditableDateSegments(isTouchPointer) {
|
|
99
|
+
const engine = probeEngine();
|
|
100
|
+
return engine === 'unknown' ? !isTouchPointer : engine === 'segmented';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Drops the cached classification.
|
|
105
|
+
*
|
|
106
|
+
* @internal Exists for tests, which render against several engines in one
|
|
107
|
+
* document.
|
|
108
|
+
*/
|
|
109
|
+
export function resetDateSegmentProbe() {
|
|
110
|
+
cachedEngine = null;
|
|
111
|
+
}
|
|
@@ -111,8 +111,10 @@ export interface DateRangeInputProps extends Omit<BaseProps, 'onChange' | 'defau
|
|
|
111
111
|
* Minimum number of days the selected range must span, counting both
|
|
112
112
|
* endpoints — `minRangeSpan={2}` forbids a single-day range. Once a start
|
|
113
113
|
* date is picked, days closer than this to it are disabled — except the
|
|
114
|
-
* start itself, which stays selectable
|
|
115
|
-
*
|
|
114
|
+
* start itself, which stays selectable. Clicking the start again commits a
|
|
115
|
+
* one-day range when the minimum allows it; otherwise it cancels the
|
|
116
|
+
* in-progress selection so the start can be moved. Defaults to 1 (a
|
|
117
|
+
* same-day start and end is allowed).
|
|
116
118
|
*/
|
|
117
119
|
minRangeSpan?: number;
|
|
118
120
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../src/DateRangeInput/DateRangeInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../src/DateRangeInput/DateRangeInput.tsx"],"names":[],"mappings":"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"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - /apps/storybook/stories/DateRangeInput.stories.tsx (storybook stories)
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/DateRangeInput/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
18
|
+
import { useId, useCallback, useMemo, useOptimistic, useTransition } from 'react';
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
20
|
import { plainDateFromISO, plainDateToday, plainDateFormat, plainDateDiffDays, DATE_FORMAT_SHORT, DATE_FORMAT_SHORT_WITH_YEAR } from "../utils/plainDate.js";
|
|
21
21
|
import "../theme/tokens.stylex.js";
|
|
@@ -33,7 +33,7 @@ import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
|
33
33
|
import { themeProps } from "../utils/themeProps.js";
|
|
34
34
|
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
35
35
|
import { stableClassName } from "../naming.js";
|
|
36
|
-
import {
|
|
36
|
+
import { useLocale, useTranslator } from "../i18n/index.js";
|
|
37
37
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
38
|
const styles = {
|
|
39
39
|
iconButton: {
|
|
@@ -187,13 +187,11 @@ export function DateRangeInput({
|
|
|
187
187
|
...rest
|
|
188
188
|
}) {
|
|
189
189
|
const t = useTranslator();
|
|
190
|
+
const locale = useLocale();
|
|
190
191
|
const isEffectivelyRequired = useResolvedRequired({
|
|
191
192
|
isRequired,
|
|
192
193
|
isOptional
|
|
193
194
|
});
|
|
194
|
-
const {
|
|
195
|
-
locale
|
|
196
|
-
} = use(InternationalizationContext);
|
|
197
195
|
const placeholder = placeholderFromProps ?? t('@astryx.dateRangeInput.placeholder');
|
|
198
196
|
const size = useSize(sizeProp, 'md');
|
|
199
197
|
const id = useId();
|
|
@@ -112,24 +112,27 @@ export interface DateTimeInputProps extends Omit<BaseProps, 'onChange' | 'defaul
|
|
|
112
112
|
*/
|
|
113
113
|
hourFormat?: DateTimeInputHourFormat;
|
|
114
114
|
/**
|
|
115
|
-
* Minutes added or subtracted when stepping the time field with the
|
|
116
|
-
* keys.
|
|
115
|
+
* Minutes added or subtracted when stepping the desktop time field with the
|
|
116
|
+
* arrow keys. Ignored on the mobile touch sheet, where time is changed with
|
|
117
|
+
* wheels. Constrained to a set of sensible increments.
|
|
117
118
|
* @default 1
|
|
118
119
|
*/
|
|
119
120
|
timeIncrement?: DateTimeInputTimeIncrement;
|
|
120
121
|
/**
|
|
121
|
-
* Minute cadence for a dropdown of preset times on the time field. Set
|
|
122
|
-
* turn the time field into a combobox listing every valid time at that
|
|
122
|
+
* Minute cadence for a dropdown of preset times on the desktop time field. Set
|
|
123
|
+
* it to turn the time field into a combobox listing every valid time at that
|
|
123
124
|
* cadence (`60` gives the 12 AM - 11 PM list, `15` a quarter-hour list).
|
|
124
125
|
*
|
|
125
|
-
* Omitted, the time field stays a plain text input: typed entry and
|
|
126
|
+
* Omitted, the desktop time field stays a plain text input: typed entry and
|
|
126
127
|
* arrow-key stepping only, with no combobox semantics added to the
|
|
127
|
-
* accessibility tree. Typed entry keeps working when the dropdown is on —
|
|
128
|
-
*
|
|
129
|
-
*
|
|
128
|
+
* accessibility tree. Typed entry keeps working when the dropdown is on — the
|
|
129
|
+
* list is a shortcut, not a restriction, so a time between two options can
|
|
130
|
+
* still be typed.
|
|
130
131
|
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
132
|
+
* Ignored on the mobile touch sheet, where the wheels expose every
|
|
133
|
+
* hour/minute/second. Independent of `timeIncrement`, which governs desktop
|
|
134
|
+
* arrow-key stepping. Setting both to the same value is the usual choice for
|
|
135
|
+
* scheduling flows on desktop.
|
|
133
136
|
*/
|
|
134
137
|
timeOptionInterval?: DateTimeInputTimeOptionInterval;
|
|
135
138
|
/**
|
|
@@ -144,6 +147,7 @@ export interface DateTimeInputProps extends Omit<BaseProps, 'onChange' | 'defaul
|
|
|
144
147
|
placeholder?: string;
|
|
145
148
|
/**
|
|
146
149
|
* Placeholder text shown in the time portion when no time is selected.
|
|
150
|
+
* On touch, this appears in the closed time segment before a time is chosen.
|
|
147
151
|
* @default "Select a time"
|
|
148
152
|
*/
|
|
149
153
|
timePlaceholder?: string;
|
|
@@ -173,7 +177,9 @@ export interface DateTimeInputProps extends Omit<BaseProps, 'onChange' | 'defaul
|
|
|
173
177
|
*/
|
|
174
178
|
labelTooltip?: string;
|
|
175
179
|
/**
|
|
176
|
-
* Number of months to display in the calendar.
|
|
180
|
+
* Number of months to display in the desktop calendar popover. Ignored on the
|
|
181
|
+
* mobile touch sheet, whose Date panel always shows one swipe-paged month at a
|
|
182
|
+
* time.
|
|
177
183
|
* @default 1
|
|
178
184
|
*/
|
|
179
185
|
numberOfMonths?: 1 | 2;
|
|
@@ -186,20 +192,13 @@ export interface DateTimeInputProps extends Omit<BaseProps, 'onChange' | 'defaul
|
|
|
186
192
|
weekStartsOn?: DayOfWeek | DayOfWeekName;
|
|
187
193
|
}
|
|
188
194
|
/**
|
|
189
|
-
* A combined date and time picker
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* ```
|
|
195
|
-
* <DateTimeInput
|
|
196
|
-
* label="Meeting time"
|
|
197
|
-
* value={dateTime}
|
|
198
|
-
* onChange={setDateTime}
|
|
199
|
-
* />
|
|
200
|
-
* ```
|
|
195
|
+
* A combined date and time picker that keeps the desktop text-entry surface on
|
|
196
|
+
* mouse/trackpad devices and uses Astryx's custom bottom-sheet picker on coarse
|
|
197
|
+
* pointers. Unlike DateInput, this never hands touch picking to the browser/OS:
|
|
198
|
+
* the mobile flow has to coordinate date and time together, preserve drafted
|
|
199
|
+
* time before a date exists, and enforce datetime min/max across both panels.
|
|
201
200
|
*/
|
|
202
|
-
export declare function DateTimeInput(
|
|
201
|
+
export declare function DateTimeInput(props: DateTimeInputProps): import("react").JSX.Element;
|
|
203
202
|
export declare namespace DateTimeInput {
|
|
204
203
|
var displayName: string;
|
|
205
204
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/DateTimeInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/DateTimeInput.tsx"],"names":[],"mappings":"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"}
|
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file DateTimeInput.tsx
|
|
7
|
-
* @input Uses React, Field, Calendar, usePopover, useAnnounce, time parsing utilities
|
|
7
|
+
* @input Uses React, Field, Calendar, usePopover, useAnnounce, time parsing utilities, TouchDateTimeField, StyleX intrinsic flex layout
|
|
8
8
|
* @output Exports DateTimeInput component, DateTimeInputProps
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by DateTimeInput.test.tsx
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/DateTimeInput/DateTimeInput.doc.mjs (props table, features, implementation notes)
|
|
13
|
-
* - /packages/core/src/DateTimeInput/DateTimeInput.test.tsx (tests for new/changed behavior)
|
|
13
|
+
* - /packages/core/src/DateTimeInput/DateTimeInput.test.tsx (desktop tests for new/changed behavior)
|
|
14
|
+
* - /packages/core/src/DateTimeInput/DateTimeInputTouch.test.tsx (touch-surface tests)
|
|
14
15
|
* - /packages/core/src/DateTimeInput/index.ts (exports if types change)
|
|
15
16
|
* - /apps/storybook/stories/DateTimeInput.stories.tsx (storybook stories)
|
|
16
17
|
* - /packages/cli/assets/templates/blocks/components/DateTimeInput/ (showcase blocks)
|
|
17
18
|
*/
|
|
18
|
-
import {
|
|
19
|
+
import { useId, useState, useCallback, useEffect, useRef, useMemo, useOptimistic, useTransition } from 'react';
|
|
19
20
|
import * as stylex from '@stylexjs/stylex';
|
|
20
21
|
import "../theme/tokens.stylex.js";
|
|
21
22
|
import { colorVars, sizeVars, radiusVars, spacingVars, typographyVars, typeScaleVars, fontWeightVars } from "../theme/tokens.stylex.js";
|
|
@@ -32,12 +33,14 @@ import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
|
|
32
33
|
import { parseDateInput, parseISOTime, parseTimeInput, formatDisplayTime12h, formatDisplayTime24h, formatISOTime, isTimeInRange, adjustTime, isImeKeyEvent, mergeProps, isFocusDetached } from "../utils/index.js";
|
|
33
34
|
import { plainDateFromISO, plainDateToISO, plainDateFormat, DATE_FORMAT_LONG } from "../utils/plainDate.js";
|
|
34
35
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
36
|
+
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
35
37
|
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
36
38
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
37
39
|
import { themeProps } from "../utils/themeProps.js";
|
|
38
40
|
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
39
|
-
import {
|
|
41
|
+
import { useLocale, useTranslator } from "../i18n/index.js";
|
|
40
42
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
43
|
+
import { TouchDateTimeField } from "./TouchDateTimeField.js";
|
|
41
44
|
|
|
42
45
|
/** Supported minute increments for arrow-key stepping of the time field. */
|
|
43
46
|
|
|
@@ -46,9 +49,13 @@ import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
|
46
49
|
* an hour evenly, so each option lands on a round clock time.
|
|
47
50
|
*/
|
|
48
51
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
52
|
+
// Two 196px segments plus the 8px gap fit at exactly 400px. Below that,
|
|
53
|
+
// flex wrapping moves each growing segment onto its own full-width row.
|
|
54
|
+
const HORIZONTAL_SEGMENT_BASIS = 196;
|
|
49
55
|
const styles = {
|
|
50
56
|
row: {
|
|
51
57
|
k1xSpc: "x78zum5",
|
|
58
|
+
kwnvtZ: "x1a02dak",
|
|
52
59
|
kOIVth: "x1txdalj",
|
|
53
60
|
$$css: true
|
|
54
61
|
},
|
|
@@ -71,12 +78,14 @@ const styles = {
|
|
|
71
78
|
},
|
|
72
79
|
dateWrapper: {
|
|
73
80
|
kUk6DE: "x98rzlu",
|
|
74
|
-
kCS8Yb: "
|
|
81
|
+
kCS8Yb: "xrjwirl",
|
|
82
|
+
k7Eaqz: "xeuugli",
|
|
75
83
|
$$css: true
|
|
76
84
|
},
|
|
77
85
|
timeWrapper: {
|
|
78
86
|
kUk6DE: "x98rzlu",
|
|
79
|
-
kCS8Yb: "
|
|
87
|
+
kCS8Yb: "xrjwirl",
|
|
88
|
+
k7Eaqz: "xeuugli",
|
|
80
89
|
$$css: true
|
|
81
90
|
},
|
|
82
91
|
timeOption: {
|
|
@@ -188,7 +197,7 @@ function getDefaultTime(hasSeconds) {
|
|
|
188
197
|
* />
|
|
189
198
|
* ```
|
|
190
199
|
*/
|
|
191
|
-
|
|
200
|
+
function PointerDateTimeField({
|
|
192
201
|
label,
|
|
193
202
|
isLabelHidden = false,
|
|
194
203
|
description,
|
|
@@ -224,13 +233,11 @@ export function DateTimeInput({
|
|
|
224
233
|
...rest
|
|
225
234
|
}) {
|
|
226
235
|
const t = useTranslator();
|
|
236
|
+
const locale = useLocale();
|
|
227
237
|
const isEffectivelyRequired = useResolvedRequired({
|
|
228
238
|
isRequired,
|
|
229
239
|
isOptional
|
|
230
240
|
});
|
|
231
|
-
const {
|
|
232
|
-
locale
|
|
233
|
-
} = use(InternationalizationContext);
|
|
234
241
|
// Speaks arrow-key stepping results through the persistent live regions:
|
|
235
242
|
// stepping programmatically rewrites a plain textbox's value, which screen
|
|
236
243
|
// readers do not announce on their own (WCAG 4.1.2).
|
|
@@ -1118,4 +1125,22 @@ export function DateTimeInput({
|
|
|
1118
1125
|
}), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
1119
1126
|
});
|
|
1120
1127
|
}
|
|
1128
|
+
PointerDateTimeField.displayName = 'PointerDateTimeField';
|
|
1129
|
+
const TOUCH_POINTER_QUERY = '(pointer: coarse)';
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* A combined date and time picker that keeps the desktop text-entry surface on
|
|
1133
|
+
* mouse/trackpad devices and uses Astryx's custom bottom-sheet picker on coarse
|
|
1134
|
+
* pointers. Unlike DateInput, this never hands touch picking to the browser/OS:
|
|
1135
|
+
* the mobile flow has to coordinate date and time together, preserve drafted
|
|
1136
|
+
* time before a date exists, and enforce datetime min/max across both panels.
|
|
1137
|
+
*/
|
|
1138
|
+
export function DateTimeInput(props) {
|
|
1139
|
+
const isTouch = useMediaQuery(TOUCH_POINTER_QUERY);
|
|
1140
|
+
return isTouch ? /*#__PURE__*/_jsx(TouchDateTimeField, {
|
|
1141
|
+
...props
|
|
1142
|
+
}) : /*#__PURE__*/_jsx(PointerDateTimeField, {
|
|
1143
|
+
...props
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1121
1146
|
DateTimeInput.displayName = 'DateTimeInput';
|