@astryxdesign/core 0.5.0 → 0.5.1-canary.046f6ea
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
|
@@ -0,0 +1,1021 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file TouchDateTimeField.tsx
|
|
7
|
+
* @input Uses React, Field, BottomSheet, SegmentedControl, DateInput month picker primitives, Wheel, StyleX intrinsic flex layout
|
|
8
|
+
* @output Exports TouchDateTimeField — the coarse-pointer surface behind DateTimeInput
|
|
9
|
+
* @position Internal component; consumed by DateTimeInput.tsx
|
|
10
|
+
*
|
|
11
|
+
* The touch half of `DateTimeInput`, holding `DateTimeInput`'s whole prop
|
|
12
|
+
* contract so the desktop and touch surfaces are interchangeable. The desktop
|
|
13
|
+
* only props `timeIncrement` and `timeOptionInterval` remain accepted but are
|
|
14
|
+
* intentionally ignored here: time is selected with wheels instead of a typed
|
|
15
|
+
* field or preset list.
|
|
16
|
+
*
|
|
17
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
18
|
+
* - /packages/core/src/DateTimeInput/DateTimeInput.tsx
|
|
19
|
+
* - /packages/core/src/DateTimeInput/DateTimeInput.doc.mjs
|
|
20
|
+
* - /packages/core/src/DateTimeInput/DateTimeInputTouch.test.tsx
|
|
21
|
+
* - /apps/storybook/stories/DateTimeInput.stories.tsx
|
|
22
|
+
* - /packages/cli/assets/templates/blocks/components/DateTimeInput/
|
|
23
|
+
*/
|
|
24
|
+
import { use, useCallback, useEffect, useId, useMemo, useOptimistic, useRef, useState, useTransition } from 'react';
|
|
25
|
+
import * as stylex from '@stylexjs/stylex';
|
|
26
|
+
import { BottomSheet } from "../BottomSheet/index.js";
|
|
27
|
+
import { Button } from "../Button/index.js";
|
|
28
|
+
import { useCalendarConstraints } from "../Calendar/index.js";
|
|
29
|
+
import { Field, InputClearButton, inputWrapperStyles, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputStatusFocusWithinStyles } from "../Field/index.js";
|
|
30
|
+
import { useInputStatusIcon, useMergedRefs } from "../hooks/index.js";
|
|
31
|
+
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
32
|
+
import { Icon } from "../Icon/index.js";
|
|
33
|
+
import { IconButton } from "../IconButton/index.js";
|
|
34
|
+
import { useTranslator, InternationalizationContext } from "../i18n/index.js";
|
|
35
|
+
import { SegmentedControl, SegmentedControlItem } from "../SegmentedControl/index.js";
|
|
36
|
+
import { useSize } from "../SizeContext/SizeContext.js";
|
|
37
|
+
import { Spinner } from "../Spinner/index.js";
|
|
38
|
+
import { useTooltip } from "../Tooltip/index.js";
|
|
39
|
+
import "../theme/tokens.stylex.js";
|
|
40
|
+
import { colorVars, fontWeightVars, radiusVars, sizeVars, spacingVars, typeScaleVars, typographyVars } from "../theme/tokens.stylex.js";
|
|
41
|
+
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
42
|
+
import { rtlStyles } from "../utils/rtlStyles.js";
|
|
43
|
+
import { themeProps } from "../utils/themeProps.js";
|
|
44
|
+
import { normalizeDayOfWeek } from "../utils/dateTypes.js";
|
|
45
|
+
import { formatDisplayTime12h, formatDisplayTime24h, formatISOTime, isImeKeyEvent, isRenderable, isTimeInRange, clampTime, mergeProps, parseISOTime } from "../utils/index.js";
|
|
46
|
+
import { DATE_FORMAT_LONG, DATE_FORMAT_MONTH_YEAR, DATE_FORMAT_WEEKDAY_ONLY, plainDateFormat, plainDateFromISO, plainDateToday } from "../utils/plainDate.js";
|
|
47
|
+
import { MonthScroller } from "../DateInput/MonthScroller.js";
|
|
48
|
+
import { MonthYearWheels } from "../DateInput/MonthYearWheels.js";
|
|
49
|
+
import { Wheel } from "../DateInput/Wheel.js";
|
|
50
|
+
import "../DateInput/tokens.stylex.js";
|
|
51
|
+
import { dateInputTouchGeometry, dateInputTouchSizes } from "../DateInput/tokens.stylex.js";
|
|
52
|
+
import { DEFAULT_MONTH_REACH, clampIndex, fromMonthIndex, monthIndexOf } from "../DateInput/monthGeometry.js";
|
|
53
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
54
|
+
function splitDateTime(dt) {
|
|
55
|
+
if (!dt) {
|
|
56
|
+
return {
|
|
57
|
+
date: undefined,
|
|
58
|
+
time: undefined
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const tIndex = dt.indexOf('T');
|
|
62
|
+
if (tIndex === -1) {
|
|
63
|
+
return {
|
|
64
|
+
date: dt,
|
|
65
|
+
time: undefined
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
date: dt.slice(0, tIndex),
|
|
70
|
+
time: dt.slice(tIndex + 1)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function combineDateTime(date, time) {
|
|
74
|
+
if (!date || !time) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
return `${date}T${time}`;
|
|
78
|
+
}
|
|
79
|
+
function getDefaultTime(hasSeconds) {
|
|
80
|
+
const now = new Date();
|
|
81
|
+
return formatISOTime({
|
|
82
|
+
hour: now.getHours(),
|
|
83
|
+
minute: now.getMinutes(),
|
|
84
|
+
second: now.getSeconds()
|
|
85
|
+
}, hasSeconds);
|
|
86
|
+
}
|
|
87
|
+
const sizeStyles = {
|
|
88
|
+
sm: {
|
|
89
|
+
kZKoxP: "x6k0iem",
|
|
90
|
+
$$css: true
|
|
91
|
+
},
|
|
92
|
+
md: {
|
|
93
|
+
kZKoxP: "x1ueg155",
|
|
94
|
+
$$css: true
|
|
95
|
+
},
|
|
96
|
+
lg: {
|
|
97
|
+
kZKoxP: "xssyfek",
|
|
98
|
+
$$css: true
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const HORIZONTAL_SEGMENT_BASIS = 196;
|
|
102
|
+
const styles = {
|
|
103
|
+
iconButton: {
|
|
104
|
+
k1xSpc: "x78zum5",
|
|
105
|
+
kGNEyG: "x6s0dn4",
|
|
106
|
+
kjj79g: "xl56j7k",
|
|
107
|
+
kmVPX3: "x1717udv",
|
|
108
|
+
kogj98: "x1ghz6dp",
|
|
109
|
+
kMzoRj: "xc342km",
|
|
110
|
+
ksu8eU: "xng3xce",
|
|
111
|
+
kWkggS: "xjbqb8w",
|
|
112
|
+
kkrTdU: "x1ypdohk x16khyan",
|
|
113
|
+
kaIpWk: "xh6dtrn",
|
|
114
|
+
$$css: true
|
|
115
|
+
},
|
|
116
|
+
iconButtonDisabled: {
|
|
117
|
+
kkrTdU: "xt0e3qv",
|
|
118
|
+
$$css: true
|
|
119
|
+
},
|
|
120
|
+
touchRow: {
|
|
121
|
+
k1xSpc: "x78zum5",
|
|
122
|
+
kwnvtZ: "x1a02dak",
|
|
123
|
+
kzqmXN: "xh8yej3",
|
|
124
|
+
k7Eaqz: "xeuugli",
|
|
125
|
+
kOIVth: "x1txdalj",
|
|
126
|
+
$$css: true
|
|
127
|
+
},
|
|
128
|
+
touchDateWrapper: {
|
|
129
|
+
kUk6DE: "x98rzlu",
|
|
130
|
+
kCS8Yb: "xrjwirl",
|
|
131
|
+
k7Eaqz: "xeuugli",
|
|
132
|
+
$$css: true
|
|
133
|
+
},
|
|
134
|
+
touchTimeWrapper: {
|
|
135
|
+
kUk6DE: "x98rzlu",
|
|
136
|
+
kCS8Yb: "xrjwirl",
|
|
137
|
+
k7Eaqz: "xeuugli",
|
|
138
|
+
$$css: true
|
|
139
|
+
},
|
|
140
|
+
touchTitle: {
|
|
141
|
+
k1xSpc: "x78zum5",
|
|
142
|
+
kGNEyG: "x6s0dn4",
|
|
143
|
+
kOIVth: "xzye2dw",
|
|
144
|
+
k7Eaqz: "xeuugli",
|
|
145
|
+
kg3NbH: "xf314gf",
|
|
146
|
+
kMzoRj: "xc342km",
|
|
147
|
+
ksu8eU: "xng3xce",
|
|
148
|
+
kaIpWk: "xh6dtrn",
|
|
149
|
+
kWkggS: "xjbqb8w",
|
|
150
|
+
kMwMTN: "x1tgivj0",
|
|
151
|
+
kMv6JI: "x9ynric",
|
|
152
|
+
kGuDYH: "x18juvz8",
|
|
153
|
+
k63SB2: "x2mo6ok",
|
|
154
|
+
kkrTdU: "x1ypdohk x16khyan",
|
|
155
|
+
$$css: true
|
|
156
|
+
},
|
|
157
|
+
touchArrow: {
|
|
158
|
+
kAzted: "xygd9yz",
|
|
159
|
+
k7Eaqz: "xngvp7v",
|
|
160
|
+
$$css: true
|
|
161
|
+
},
|
|
162
|
+
touchArrowUnavailable: {
|
|
163
|
+
k33iCy: "xlshs6z",
|
|
164
|
+
$$css: true
|
|
165
|
+
},
|
|
166
|
+
touchArrowIcon: {
|
|
167
|
+
k1xSpc: "x3nfvp2",
|
|
168
|
+
$$css: true
|
|
169
|
+
},
|
|
170
|
+
touchResetButton: {
|
|
171
|
+
kAzted: "xygd9yz",
|
|
172
|
+
$$css: true
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
176
|
+
function parseValidISODate(date) {
|
|
177
|
+
if (date == null || !ISO_DATE.test(date)) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
return plainDateFromISO(date);
|
|
182
|
+
} catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function normalizeISOTime(time, hasSeconds) {
|
|
187
|
+
if (time === undefined) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
const parsed = parseISOTime(time);
|
|
191
|
+
return parsed ? formatISOTime(parsed, hasSeconds) : undefined;
|
|
192
|
+
}
|
|
193
|
+
function timeToSeconds(time) {
|
|
194
|
+
if (time === undefined) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
const parsed = parseISOTime(time);
|
|
198
|
+
return parsed == null ? null : parsed.hour * 3600 + parsed.minute * 60 + parsed.second;
|
|
199
|
+
}
|
|
200
|
+
function twoDigits(value) {
|
|
201
|
+
return String(value).padStart(2, '0');
|
|
202
|
+
}
|
|
203
|
+
function hour12From24(hour) {
|
|
204
|
+
return hour === 0 ? 12 : hour > 12 ? hour - 12 : hour;
|
|
205
|
+
}
|
|
206
|
+
function hour24From12(hour, meridiem) {
|
|
207
|
+
if (meridiem === 0) {
|
|
208
|
+
return hour === 12 ? 0 : hour;
|
|
209
|
+
}
|
|
210
|
+
return hour === 12 ? 12 : hour + 12;
|
|
211
|
+
}
|
|
212
|
+
function rangeOverlaps(startSecond, endSecond, min, max) {
|
|
213
|
+
const minSecond = timeToSeconds(min);
|
|
214
|
+
const maxSecond = timeToSeconds(max);
|
|
215
|
+
return (minSecond == null || endSecond >= minSecond) && (maxSecond == null || startSecond <= maxSecond);
|
|
216
|
+
}
|
|
217
|
+
export function TouchDateTimeField({
|
|
218
|
+
label,
|
|
219
|
+
isLabelHidden = false,
|
|
220
|
+
description,
|
|
221
|
+
isOptional = false,
|
|
222
|
+
isRequired = false,
|
|
223
|
+
isDisabled = false,
|
|
224
|
+
disabledMessage,
|
|
225
|
+
value,
|
|
226
|
+
onChange,
|
|
227
|
+
changeAction,
|
|
228
|
+
isLoading = false,
|
|
229
|
+
min,
|
|
230
|
+
max,
|
|
231
|
+
dateConstraints,
|
|
232
|
+
hasSeconds = false,
|
|
233
|
+
hourFormat = '12h',
|
|
234
|
+
// Desktop-only: mobile uses wheels instead of typed arrow stepping or a preset list.
|
|
235
|
+
timeIncrement: _timeIncrement,
|
|
236
|
+
timeOptionInterval: _timeOptionInterval,
|
|
237
|
+
hasClear = false,
|
|
238
|
+
placeholder: placeholderFromProps,
|
|
239
|
+
timePlaceholder: timePlaceholderFromProps,
|
|
240
|
+
timeLabel,
|
|
241
|
+
size: sizeProp,
|
|
242
|
+
status,
|
|
243
|
+
labelTooltip,
|
|
244
|
+
// Desktop-only: the touch Date panel shows one swipe-paged month at a time.
|
|
245
|
+
numberOfMonths: _numberOfMonths,
|
|
246
|
+
weekStartsOn: weekStartsOnProp = 0,
|
|
247
|
+
width,
|
|
248
|
+
xstyle,
|
|
249
|
+
className,
|
|
250
|
+
style,
|
|
251
|
+
ref,
|
|
252
|
+
...rest
|
|
253
|
+
}) {
|
|
254
|
+
const t = useTranslator();
|
|
255
|
+
const isEffectivelyRequired = useResolvedRequired({
|
|
256
|
+
isRequired,
|
|
257
|
+
isOptional
|
|
258
|
+
});
|
|
259
|
+
const {
|
|
260
|
+
locale
|
|
261
|
+
} = use(InternationalizationContext);
|
|
262
|
+
const placeholder = placeholderFromProps ?? t('@astryx.dateTimeInput.placeholder');
|
|
263
|
+
const timePlaceholder = timePlaceholderFromProps ?? t('@astryx.dateTimeInput.timePlaceholder');
|
|
264
|
+
const resolvedTimeLabel = timeLabel ?? t('@astryx.dateTimeInput.timeSuffix', {
|
|
265
|
+
label
|
|
266
|
+
});
|
|
267
|
+
const size = useSize(sizeProp, 'md');
|
|
268
|
+
const dateInputId = useId();
|
|
269
|
+
const timeInputId = useId();
|
|
270
|
+
const descriptionID = useId();
|
|
271
|
+
const statusMessageID = useId();
|
|
272
|
+
const dateInputRef = useRef(null);
|
|
273
|
+
const timeInputRef = useRef(null);
|
|
274
|
+
const timeSegmentRef = useRef(null);
|
|
275
|
+
const mergedDateInputRef = useMergedRefs(ref, dateInputRef);
|
|
276
|
+
const scrollerHandleRef = useRef(null);
|
|
277
|
+
const [, startTransition] = useTransition();
|
|
278
|
+
const [optimisticValue, setOptimisticValue] = useOptimistic(value);
|
|
279
|
+
const isPendingChange = optimisticValue !== value;
|
|
280
|
+
const isBusy = isLoading || isPendingChange;
|
|
281
|
+
const isEffectivelyDisabled = isDisabled || isLoading;
|
|
282
|
+
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
283
|
+
const disabledMessageTooltip = useTooltip({
|
|
284
|
+
placement: 'above',
|
|
285
|
+
focusTrigger: 'always',
|
|
286
|
+
isEnabled: showsDisabledMessage
|
|
287
|
+
});
|
|
288
|
+
const {
|
|
289
|
+
statusIcon,
|
|
290
|
+
describedBy: statusTooltipDescribedBy
|
|
291
|
+
} = useInputStatusIcon({
|
|
292
|
+
status,
|
|
293
|
+
statusVariant: 'detached'
|
|
294
|
+
});
|
|
295
|
+
const ariaDescribedBy = [description ? descriptionID : null, status?.message ? statusMessageID : null, statusTooltipDescribedBy, showsDisabledMessage ? disabledMessageTooltip.describedBy : null].filter(Boolean).join(' ') || undefined;
|
|
296
|
+
const minParts = useMemo(() => splitDateTime(min), [min]);
|
|
297
|
+
const maxParts = useMemo(() => splitDateTime(max), [max]);
|
|
298
|
+
const valueParts = useMemo(() => splitDateTime(optimisticValue), [optimisticValue]);
|
|
299
|
+
const calendarMin = minParts.date;
|
|
300
|
+
const calendarMax = maxParts.date;
|
|
301
|
+
const {
|
|
302
|
+
isDateDisabled
|
|
303
|
+
} = useCalendarConstraints({
|
|
304
|
+
min: calendarMin,
|
|
305
|
+
max: calendarMax,
|
|
306
|
+
dateConstraints
|
|
307
|
+
});
|
|
308
|
+
const [isSheetOpen, setIsSheetOpen] = useState(false);
|
|
309
|
+
const [activePanel, setActivePanel] = useState('date');
|
|
310
|
+
const [isWheelOpen, setIsWheelOpen] = useState(false);
|
|
311
|
+
const [draftTime, setDraftTime] = useState(() => normalizeISOTime(splitDateTime(value).time, hasSeconds));
|
|
312
|
+
const today = useMemo(() => plainDateToday(), []);
|
|
313
|
+
const selectedDate = useMemo(() => parseValidISODate(valueParts.date), [valueParts.date]);
|
|
314
|
+
const fallbackTime = useMemo(() => getDefaultTime(hasSeconds), [hasSeconds]);
|
|
315
|
+
const normalizedValueTime = normalizeISOTime(valueParts.time, hasSeconds);
|
|
316
|
+
const timeForWheels = normalizedValueTime ?? draftTime ?? fallbackTime;
|
|
317
|
+
const parsedWheelTime = useMemo(() => parseISOTime(timeForWheels) ?? {
|
|
318
|
+
hour: 0,
|
|
319
|
+
minute: 0,
|
|
320
|
+
second: 0
|
|
321
|
+
}, [timeForWheels]);
|
|
322
|
+
const weekStartsOn = normalizeDayOfWeek(weekStartsOnProp);
|
|
323
|
+
useEffect(() => {
|
|
324
|
+
if (normalizedValueTime !== undefined) {
|
|
325
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- mirrors an externally controlled time into the sheet-local draft
|
|
326
|
+
setDraftTime(normalizedValueTime);
|
|
327
|
+
} else if (optimisticValue === undefined) {
|
|
328
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- external clear resets the sheet-local draft too
|
|
329
|
+
setDraftTime(undefined);
|
|
330
|
+
}
|
|
331
|
+
}, [normalizedValueTime, optimisticValue]);
|
|
332
|
+
const [anchorMonthIndex] = useState(() => monthIndexOf(selectedDate ?? plainDateToday()));
|
|
333
|
+
const minMonthIndex = calendarMin != null ? monthIndexOf(plainDateFromISO(calendarMin)) : anchorMonthIndex - DEFAULT_MONTH_REACH;
|
|
334
|
+
const maxMonthIndex = calendarMax != null ? monthIndexOf(plainDateFromISO(calendarMax)) : anchorMonthIndex + DEFAULT_MONTH_REACH;
|
|
335
|
+
const [monthIndex, setMonthIndex] = useState(() => clampIndex(anchorMonthIndex, minMonthIndex, maxMonthIndex));
|
|
336
|
+
const {
|
|
337
|
+
year,
|
|
338
|
+
month
|
|
339
|
+
} = fromMonthIndex(monthIndex);
|
|
340
|
+
const canStepBack = monthIndex > minMonthIndex;
|
|
341
|
+
const canStepForward = monthIndex < maxMonthIndex;
|
|
342
|
+
useEffect(() => {
|
|
343
|
+
const clamped = clampIndex(monthIndex, minMonthIndex, maxMonthIndex);
|
|
344
|
+
if (clamped !== monthIndex) {
|
|
345
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- min/max can change underneath the mounted sheet; keep the visible month in range
|
|
346
|
+
setMonthIndex(clamped);
|
|
347
|
+
scrollerHandleRef.current?.scrollToMonth(clamped, 'auto');
|
|
348
|
+
}
|
|
349
|
+
}, [monthIndex, minMonthIndex, maxMonthIndex]);
|
|
350
|
+
const dayNames = useMemo(() => Array.from({
|
|
351
|
+
length: 7
|
|
352
|
+
}, (_, offset) => plainDateFormat({
|
|
353
|
+
year: 1970,
|
|
354
|
+
month: 1,
|
|
355
|
+
day: 4 + (weekStartsOn + offset) % 7
|
|
356
|
+
}, DATE_FORMAT_WEEKDAY_ONLY, locale)), [weekStartsOn, locale]);
|
|
357
|
+
const monthYearLabel = plainDateFormat({
|
|
358
|
+
year,
|
|
359
|
+
month,
|
|
360
|
+
day: 1
|
|
361
|
+
}, DATE_FORMAT_MONTH_YEAR, locale);
|
|
362
|
+
const dateDisplayValue = useMemo(() => {
|
|
363
|
+
if (selectedDate == null) {
|
|
364
|
+
return '';
|
|
365
|
+
}
|
|
366
|
+
return plainDateFormat(selectedDate, DATE_FORMAT_LONG, locale);
|
|
367
|
+
}, [selectedDate, locale]);
|
|
368
|
+
const timeDisplayValue = useMemo(() => {
|
|
369
|
+
const displayTime = normalizedValueTime ?? draftTime;
|
|
370
|
+
return displayTime ? (hourFormat === '12h' ? formatDisplayTime12h : formatDisplayTime24h)(displayTime, hasSeconds) : '';
|
|
371
|
+
}, [draftTime, normalizedValueTime, hourFormat, hasSeconds]);
|
|
372
|
+
const timeBoundsForDate = useCallback(date => ({
|
|
373
|
+
min: date != null && minParts.date === date && minParts.time ? minParts.time : undefined,
|
|
374
|
+
max: date != null && maxParts.date === date && maxParts.time ? maxParts.time : undefined
|
|
375
|
+
}), [minParts.date, minParts.time, maxParts.date, maxParts.time]);
|
|
376
|
+
const clampTimeForDate = useCallback((date, time) => {
|
|
377
|
+
const bounds = timeBoundsForDate(date);
|
|
378
|
+
return clampTime(time, bounds.min, bounds.max, hasSeconds);
|
|
379
|
+
}, [hasSeconds, timeBoundsForDate]);
|
|
380
|
+
const fireChange = useCallback(newValue => {
|
|
381
|
+
if (isEffectivelyDisabled) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
onChange(newValue);
|
|
385
|
+
if (changeAction) {
|
|
386
|
+
startTransition(async () => {
|
|
387
|
+
setOptimisticValue(newValue);
|
|
388
|
+
await changeAction(newValue);
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}, [isEffectivelyDisabled, onChange, changeAction, startTransition, setOptimisticValue]);
|
|
392
|
+
const openSheet = useCallback(panel => {
|
|
393
|
+
if (!isEffectivelyDisabled) {
|
|
394
|
+
setIsWheelOpen(false);
|
|
395
|
+
setActivePanel(panel);
|
|
396
|
+
setIsSheetOpen(true);
|
|
397
|
+
}
|
|
398
|
+
}, [isEffectivelyDisabled]);
|
|
399
|
+
const closeSheet = useCallback(() => {
|
|
400
|
+
if (selectedDate == null) {
|
|
401
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- The shared close path is also used by the disabled/loading effect.
|
|
402
|
+
setDraftTime(undefined);
|
|
403
|
+
}
|
|
404
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- The shared close path is also used by the disabled/loading effect.
|
|
405
|
+
setIsSheetOpen(false);
|
|
406
|
+
}, [selectedDate]);
|
|
407
|
+
const handleSheetOpenChange = useCallback(nextOpen => {
|
|
408
|
+
if (nextOpen) {
|
|
409
|
+
setIsSheetOpen(true);
|
|
410
|
+
} else {
|
|
411
|
+
closeSheet();
|
|
412
|
+
}
|
|
413
|
+
}, [closeSheet]);
|
|
414
|
+
useEffect(() => {
|
|
415
|
+
if (isEffectivelyDisabled && isSheetOpen) {
|
|
416
|
+
closeSheet();
|
|
417
|
+
}
|
|
418
|
+
}, [closeSheet, isEffectivelyDisabled, isSheetOpen]);
|
|
419
|
+
const stepMonth = useCallback(delta => {
|
|
420
|
+
const target = clampIndex(monthIndex + delta, minMonthIndex, maxMonthIndex);
|
|
421
|
+
if (target === monthIndex) {
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
setMonthIndex(target);
|
|
425
|
+
scrollerHandleRef.current?.scrollToMonth(target, 'smooth');
|
|
426
|
+
}, [monthIndex, minMonthIndex, maxMonthIndex]);
|
|
427
|
+
const handleResetInSheet = useCallback(() => {
|
|
428
|
+
fireChange(undefined);
|
|
429
|
+
setDraftTime(undefined);
|
|
430
|
+
const currentMonth = monthIndexOf(today);
|
|
431
|
+
if (currentMonth < minMonthIndex || currentMonth > maxMonthIndex) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
setMonthIndex(currentMonth);
|
|
435
|
+
scrollerHandleRef.current?.scrollToMonth(currentMonth, 'smooth');
|
|
436
|
+
}, [fireChange, today, minMonthIndex, maxMonthIndex]);
|
|
437
|
+
const handleDateSelect = useCallback(nextDate => {
|
|
438
|
+
const nextTime = clampTimeForDate(nextDate, timeForWheels);
|
|
439
|
+
setDraftTime(nextTime);
|
|
440
|
+
const combined = combineDateTime(nextDate, nextTime);
|
|
441
|
+
if (combined && combined !== optimisticValue) {
|
|
442
|
+
fireChange(combined);
|
|
443
|
+
}
|
|
444
|
+
}, [clampTimeForDate, fireChange, optimisticValue, timeForWheels]);
|
|
445
|
+
const commitWheelTime = useCallback(rawTime => {
|
|
446
|
+
const nextTime = clampTimeForDate(valueParts.date, rawTime);
|
|
447
|
+
setDraftTime(nextTime);
|
|
448
|
+
if (valueParts.date != null) {
|
|
449
|
+
const combined = combineDateTime(valueParts.date, nextTime);
|
|
450
|
+
if (combined && combined !== optimisticValue) {
|
|
451
|
+
fireChange(combined);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}, [clampTimeForDate, fireChange, optimisticValue, valueParts.date]);
|
|
455
|
+
const composeWheelTime = useCallback(({
|
|
456
|
+
hour24,
|
|
457
|
+
hour12,
|
|
458
|
+
minute,
|
|
459
|
+
second,
|
|
460
|
+
meridiem
|
|
461
|
+
}) => {
|
|
462
|
+
const currentMeridiem = parsedWheelTime.hour < 12 ? 0 : 1;
|
|
463
|
+
let hour = parsedWheelTime.hour;
|
|
464
|
+
if (hourFormat === '24h') {
|
|
465
|
+
hour = hour24 ?? hour;
|
|
466
|
+
} else {
|
|
467
|
+
hour = hour24From12(hour12 ?? hour12From24(hour), meridiem ?? currentMeridiem);
|
|
468
|
+
}
|
|
469
|
+
return formatISOTime({
|
|
470
|
+
hour,
|
|
471
|
+
minute: minute ?? parsedWheelTime.minute,
|
|
472
|
+
second: hasSeconds ? second ?? parsedWheelTime.second : 0
|
|
473
|
+
}, hasSeconds);
|
|
474
|
+
}, [hasSeconds, hourFormat, parsedWheelTime]);
|
|
475
|
+
const timeBounds = timeBoundsForDate(valueParts.date);
|
|
476
|
+
const hourOptions = useMemo(() => {
|
|
477
|
+
if (hourFormat === '24h') {
|
|
478
|
+
return Array.from({
|
|
479
|
+
length: 24
|
|
480
|
+
}, (_, hour) => ({
|
|
481
|
+
value: hour,
|
|
482
|
+
label: twoDigits(hour),
|
|
483
|
+
isDisabled: !rangeOverlaps(hour * 3600, hour * 3600 + 3599, timeBounds.min, timeBounds.max)
|
|
484
|
+
}));
|
|
485
|
+
}
|
|
486
|
+
const meridiem = parsedWheelTime.hour < 12 ? 0 : 1;
|
|
487
|
+
// In 12-hour mode the hour column is interpreted inside the active AM/PM
|
|
488
|
+
// half, so disabled rows describe reachability within that half only.
|
|
489
|
+
return Array.from({
|
|
490
|
+
length: 12
|
|
491
|
+
}, (_, index) => {
|
|
492
|
+
const hour = index + 1;
|
|
493
|
+
const hour24 = hour24From12(hour, meridiem);
|
|
494
|
+
return {
|
|
495
|
+
value: hour,
|
|
496
|
+
label: String(hour),
|
|
497
|
+
isDisabled: !rangeOverlaps(hour24 * 3600, hour24 * 3600 + 3599, timeBounds.min, timeBounds.max)
|
|
498
|
+
};
|
|
499
|
+
});
|
|
500
|
+
}, [hourFormat, parsedWheelTime.hour, timeBounds.min, timeBounds.max]);
|
|
501
|
+
const minuteOptions = useMemo(() => Array.from({
|
|
502
|
+
length: 60
|
|
503
|
+
}, (_, minute) => {
|
|
504
|
+
const start = parsedWheelTime.hour * 3600 + minute * 60;
|
|
505
|
+
return {
|
|
506
|
+
value: minute,
|
|
507
|
+
label: twoDigits(minute),
|
|
508
|
+
isDisabled: !rangeOverlaps(start, start + (hasSeconds ? 59 : 0), timeBounds.min, timeBounds.max)
|
|
509
|
+
};
|
|
510
|
+
}), [hasSeconds, parsedWheelTime.hour, timeBounds.min, timeBounds.max]);
|
|
511
|
+
const secondOptions = useMemo(() => Array.from({
|
|
512
|
+
length: 60
|
|
513
|
+
}, (_, second) => ({
|
|
514
|
+
value: second,
|
|
515
|
+
label: twoDigits(second),
|
|
516
|
+
isDisabled: !isTimeInRange(formatISOTime({
|
|
517
|
+
hour: parsedWheelTime.hour,
|
|
518
|
+
minute: parsedWheelTime.minute,
|
|
519
|
+
second
|
|
520
|
+
}, true), timeBounds.min, timeBounds.max)
|
|
521
|
+
})), [parsedWheelTime.hour, parsedWheelTime.minute, timeBounds.min, timeBounds.max]);
|
|
522
|
+
const meridiemOptions = useMemo(() => [{
|
|
523
|
+
value: 0,
|
|
524
|
+
label: t('@astryx.dateTimeInput.meridiemAM'),
|
|
525
|
+
isDisabled: !rangeOverlaps(0, 11 * 3600 + 3599, timeBounds.min, timeBounds.max)
|
|
526
|
+
}, {
|
|
527
|
+
value: 1,
|
|
528
|
+
label: t('@astryx.dateTimeInput.meridiemPM'),
|
|
529
|
+
isDisabled: !rangeOverlaps(12 * 3600, 23 * 3600 + 3599, timeBounds.min, timeBounds.max)
|
|
530
|
+
}], [t, timeBounds.min, timeBounds.max]);
|
|
531
|
+
const handleVisibleMonthChange = useCallback(next => {
|
|
532
|
+
if (activePanel === 'date' && !isWheelOpen) {
|
|
533
|
+
setMonthIndex(next);
|
|
534
|
+
}
|
|
535
|
+
}, [activePanel, isWheelOpen]);
|
|
536
|
+
const monthIndexRef = useRef(monthIndex);
|
|
537
|
+
monthIndexRef.current = monthIndex;
|
|
538
|
+
useEffect(() => {
|
|
539
|
+
if (activePanel === 'date' && !isWheelOpen) {
|
|
540
|
+
scrollerHandleRef.current?.scrollToMonth(monthIndexRef.current, 'auto');
|
|
541
|
+
}
|
|
542
|
+
}, [activePanel, isWheelOpen]);
|
|
543
|
+
const handleInputKeyDown = useCallback((event, panel) => {
|
|
544
|
+
if (isImeKeyEvent(event.nativeEvent)) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar') {
|
|
548
|
+
event.preventDefault();
|
|
549
|
+
openSheet(panel);
|
|
550
|
+
}
|
|
551
|
+
}, [openSheet]);
|
|
552
|
+
const clearFocusTimerRef = useRef(null);
|
|
553
|
+
useEffect(() => () => {
|
|
554
|
+
if (clearFocusTimerRef.current != null) {
|
|
555
|
+
clearTimeout(clearFocusTimerRef.current);
|
|
556
|
+
}
|
|
557
|
+
}, []);
|
|
558
|
+
const timeSegmentFocusTimerRef = useRef(null);
|
|
559
|
+
useEffect(() => () => {
|
|
560
|
+
if (timeSegmentFocusTimerRef.current != null) {
|
|
561
|
+
clearTimeout(timeSegmentFocusTimerRef.current);
|
|
562
|
+
}
|
|
563
|
+
}, []);
|
|
564
|
+
const handleClear = useCallback(event => {
|
|
565
|
+
event.stopPropagation();
|
|
566
|
+
fireChange(undefined);
|
|
567
|
+
setDraftTime(undefined);
|
|
568
|
+
setIsSheetOpen(false);
|
|
569
|
+
const field = dateInputRef.current;
|
|
570
|
+
if (field == null) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
clearFocusTimerRef.current = window.setTimeout(() => {
|
|
574
|
+
clearFocusTimerRef.current = null;
|
|
575
|
+
field.focus({
|
|
576
|
+
preventScroll: true
|
|
577
|
+
});
|
|
578
|
+
}, 0);
|
|
579
|
+
}, [fireChange]);
|
|
580
|
+
const surface = /*#__PURE__*/_jsxs("div", {
|
|
581
|
+
...{
|
|
582
|
+
className: "x78zum5 xdt5ytf xh8yej3 xeuugli xjcht0a"
|
|
583
|
+
},
|
|
584
|
+
children: [/*#__PURE__*/_jsxs(SegmentedControl, {
|
|
585
|
+
value: activePanel,
|
|
586
|
+
onChange: nextPanel => {
|
|
587
|
+
setActivePanel(nextPanel);
|
|
588
|
+
setIsWheelOpen(false);
|
|
589
|
+
},
|
|
590
|
+
label: t('@astryx.dateTimeInput.pickerMode'),
|
|
591
|
+
layout: "fill",
|
|
592
|
+
children: [/*#__PURE__*/_jsx(SegmentedControlItem, {
|
|
593
|
+
value: "date",
|
|
594
|
+
label: t('@astryx.dateTimeInput.dateTab')
|
|
595
|
+
}), /*#__PURE__*/_jsx(SegmentedControlItem, {
|
|
596
|
+
ref: timeSegmentRef,
|
|
597
|
+
value: "time",
|
|
598
|
+
label: t('@astryx.dateTimeInput.timeTab')
|
|
599
|
+
})]
|
|
600
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
601
|
+
...{
|
|
602
|
+
className: "xrvj5dj xh8yej3 xeuugli"
|
|
603
|
+
},
|
|
604
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
605
|
+
"data-panel": "date",
|
|
606
|
+
"aria-hidden": activePanel !== 'date' ? 'true' : undefined,
|
|
607
|
+
inert: activePanel !== 'date' ? true : undefined,
|
|
608
|
+
...{
|
|
609
|
+
0: {
|
|
610
|
+
className: "x15r89dc x78zum5 xh8yej3 xeuugli xdt5ytf x1txdalj"
|
|
611
|
+
},
|
|
612
|
+
1: {
|
|
613
|
+
className: "x15r89dc x78zum5 xh8yej3 xeuugli xdt5ytf x1txdalj xlshs6z xg01cxk x47corl"
|
|
614
|
+
}
|
|
615
|
+
}[!!(activePanel !== 'date') << 0],
|
|
616
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
617
|
+
...{
|
|
618
|
+
className: "x78zum5 x6s0dn4 xzye2dw xssyfek"
|
|
619
|
+
},
|
|
620
|
+
children: [/*#__PURE__*/_jsxs("button", {
|
|
621
|
+
type: "button",
|
|
622
|
+
onClick: () => setIsWheelOpen(open => !open),
|
|
623
|
+
"aria-expanded": isWheelOpen,
|
|
624
|
+
"aria-label": t('@astryx.dateInput.chooseMonthYear', {
|
|
625
|
+
monthYear: monthYearLabel
|
|
626
|
+
}),
|
|
627
|
+
...stylex.props(styles.touchTitle, focusOutlineStyles.focusVisible),
|
|
628
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
629
|
+
...{
|
|
630
|
+
className: "xeuugli xb3r6kr xlyipyv xuxw1ft"
|
|
631
|
+
},
|
|
632
|
+
children: monthYearLabel
|
|
633
|
+
}), /*#__PURE__*/_jsx(Icon, {
|
|
634
|
+
icon: "chevronDown",
|
|
635
|
+
size: "sm",
|
|
636
|
+
color: "secondary"
|
|
637
|
+
})]
|
|
638
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
639
|
+
inert: isWheelOpen ? true : undefined,
|
|
640
|
+
...{
|
|
641
|
+
0: {
|
|
642
|
+
className: "x78zum5 x6s0dn4 x1lsbc85 xvc5jky"
|
|
643
|
+
},
|
|
644
|
+
1: {
|
|
645
|
+
className: "x78zum5 x6s0dn4 x1lsbc85 xvc5jky xlshs6z xg01cxk x47corl"
|
|
646
|
+
}
|
|
647
|
+
}[!!isWheelOpen << 0],
|
|
648
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
649
|
+
variant: "ghost",
|
|
650
|
+
size: "sm",
|
|
651
|
+
xstyle: [styles.touchArrow, !canStepBack && styles.touchArrowUnavailable],
|
|
652
|
+
isDisabled: !canStepBack,
|
|
653
|
+
onClick: () => stepMonth(-1),
|
|
654
|
+
label: t('@astryx.calendar.previousMonth'),
|
|
655
|
+
icon: /*#__PURE__*/_jsx("span", {
|
|
656
|
+
...stylex.props(styles.touchArrowIcon, rtlStyles.mirror),
|
|
657
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
658
|
+
icon: "chevronLeft",
|
|
659
|
+
size: "sm",
|
|
660
|
+
color: "inherit"
|
|
661
|
+
})
|
|
662
|
+
})
|
|
663
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
664
|
+
variant: "ghost",
|
|
665
|
+
size: "sm",
|
|
666
|
+
xstyle: [styles.touchArrow, !canStepForward && styles.touchArrowUnavailable],
|
|
667
|
+
isDisabled: !canStepForward,
|
|
668
|
+
onClick: () => stepMonth(1),
|
|
669
|
+
label: t('@astryx.calendar.nextMonth'),
|
|
670
|
+
icon: /*#__PURE__*/_jsx("span", {
|
|
671
|
+
...stylex.props(styles.touchArrowIcon, rtlStyles.mirror),
|
|
672
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
673
|
+
icon: "chevronRight",
|
|
674
|
+
size: "sm",
|
|
675
|
+
color: "inherit"
|
|
676
|
+
})
|
|
677
|
+
})
|
|
678
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
679
|
+
variant: "ghost",
|
|
680
|
+
size: "sm",
|
|
681
|
+
xstyle: styles.touchResetButton,
|
|
682
|
+
label: t('@astryx.dateInput.resetPicking'),
|
|
683
|
+
onClick: handleResetInSheet
|
|
684
|
+
})]
|
|
685
|
+
})]
|
|
686
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
687
|
+
...{
|
|
688
|
+
className: "xrvj5dj xh8yej3 xeuugli"
|
|
689
|
+
},
|
|
690
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
691
|
+
"data-date-surface": "calendar",
|
|
692
|
+
"aria-hidden": isWheelOpen ? 'true' : undefined,
|
|
693
|
+
inert: isWheelOpen ? true : undefined,
|
|
694
|
+
...{
|
|
695
|
+
0: {
|
|
696
|
+
className: "x15r89dc x78zum5 xh8yej3 xeuugli xdt5ytf x1txdalj"
|
|
697
|
+
},
|
|
698
|
+
1: {
|
|
699
|
+
className: "x15r89dc x78zum5 xh8yej3 xeuugli xdt5ytf x1txdalj xlshs6z xg01cxk x47corl"
|
|
700
|
+
}
|
|
701
|
+
}[!!isWheelOpen << 0],
|
|
702
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
703
|
+
"aria-hidden": "true",
|
|
704
|
+
...{
|
|
705
|
+
className: "xrvj5dj x1mzazjb x6k0iem x6s0dn4"
|
|
706
|
+
},
|
|
707
|
+
children: dayNames.map(name => /*#__PURE__*/_jsx("div", {
|
|
708
|
+
...{
|
|
709
|
+
className: "x2b8uid x141an7d x1sodnla xv1l7n4"
|
|
710
|
+
},
|
|
711
|
+
children: name
|
|
712
|
+
}, name))
|
|
713
|
+
}), /*#__PURE__*/_jsx(MonthScroller, {
|
|
714
|
+
handleRef: scrollerHandleRef,
|
|
715
|
+
minMonthIndex: minMonthIndex,
|
|
716
|
+
maxMonthIndex: maxMonthIndex,
|
|
717
|
+
initialMonthIndex: monthIndex,
|
|
718
|
+
onVisibleMonthChange: handleVisibleMonthChange,
|
|
719
|
+
selectedDate: selectedDate,
|
|
720
|
+
today: today,
|
|
721
|
+
isDateDisabled: isDateDisabled,
|
|
722
|
+
weekStartsOn: weekStartsOn,
|
|
723
|
+
onSelect: handleDateSelect
|
|
724
|
+
}, `${minMonthIndex}:${maxMonthIndex}`), /*#__PURE__*/_jsx("div", {
|
|
725
|
+
...{
|
|
726
|
+
className: "x78zum5 xr1yuqi xfsso4q"
|
|
727
|
+
},
|
|
728
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
729
|
+
variant: "primary",
|
|
730
|
+
size: "md",
|
|
731
|
+
width: "100%",
|
|
732
|
+
label: t('@astryx.dateTimeInput.saveDatePicking'),
|
|
733
|
+
isDisabled: selectedDate == null,
|
|
734
|
+
onClick: () => {
|
|
735
|
+
setIsWheelOpen(false);
|
|
736
|
+
setActivePanel('time');
|
|
737
|
+
if (timeSegmentFocusTimerRef.current != null) {
|
|
738
|
+
clearTimeout(timeSegmentFocusTimerRef.current);
|
|
739
|
+
}
|
|
740
|
+
timeSegmentFocusTimerRef.current = window.setTimeout(() => {
|
|
741
|
+
timeSegmentFocusTimerRef.current = null;
|
|
742
|
+
timeSegmentRef.current?.focus({
|
|
743
|
+
preventScroll: true
|
|
744
|
+
});
|
|
745
|
+
}, 0);
|
|
746
|
+
}
|
|
747
|
+
})
|
|
748
|
+
})]
|
|
749
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
750
|
+
"data-date-surface": "wheels",
|
|
751
|
+
"aria-hidden": !isWheelOpen ? 'true' : undefined,
|
|
752
|
+
inert: !isWheelOpen ? true : undefined,
|
|
753
|
+
...{
|
|
754
|
+
0: {
|
|
755
|
+
className: "x15r89dc x78zum5 xh8yej3 xeuugli xdt5ytf x1txdalj"
|
|
756
|
+
},
|
|
757
|
+
1: {
|
|
758
|
+
className: "x15r89dc x78zum5 xh8yej3 xeuugli xdt5ytf x1txdalj xlshs6z xg01cxk x47corl"
|
|
759
|
+
}
|
|
760
|
+
}[!!!isWheelOpen << 0],
|
|
761
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
762
|
+
"aria-hidden": "true",
|
|
763
|
+
...{
|
|
764
|
+
className: "x6k0iem"
|
|
765
|
+
}
|
|
766
|
+
}), /*#__PURE__*/_jsx(MonthYearWheels, {
|
|
767
|
+
monthIndex: monthIndex,
|
|
768
|
+
minMonthIndex: minMonthIndex,
|
|
769
|
+
maxMonthIndex: maxMonthIndex,
|
|
770
|
+
onChange: next => {
|
|
771
|
+
setMonthIndex(next);
|
|
772
|
+
scrollerHandleRef.current?.scrollToMonth(next, 'auto');
|
|
773
|
+
},
|
|
774
|
+
monthLabel: t('@astryx.dateInput.monthWheel'),
|
|
775
|
+
yearLabel: t('@astryx.dateInput.yearWheel'),
|
|
776
|
+
isActive: activePanel === 'date' && isWheelOpen
|
|
777
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
778
|
+
...{
|
|
779
|
+
className: "x78zum5 xr1yuqi xfsso4q"
|
|
780
|
+
},
|
|
781
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
782
|
+
variant: "secondary",
|
|
783
|
+
size: "md",
|
|
784
|
+
width: "100%",
|
|
785
|
+
label: t('@astryx.dateInput.doneChoosingMonth'),
|
|
786
|
+
onClick: () => setIsWheelOpen(false)
|
|
787
|
+
})
|
|
788
|
+
})]
|
|
789
|
+
})]
|
|
790
|
+
})]
|
|
791
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
792
|
+
"data-panel": "time",
|
|
793
|
+
role: "group",
|
|
794
|
+
"aria-label": resolvedTimeLabel,
|
|
795
|
+
"aria-hidden": activePanel !== 'time' ? 'true' : undefined,
|
|
796
|
+
inert: activePanel !== 'time' ? true : undefined,
|
|
797
|
+
...{
|
|
798
|
+
0: {
|
|
799
|
+
className: "x15r89dc x78zum5 xh8yej3 xeuugli xdt5ytf x1txdalj"
|
|
800
|
+
},
|
|
801
|
+
1: {
|
|
802
|
+
className: "x15r89dc x78zum5 xh8yej3 xeuugli xdt5ytf x1txdalj xlshs6z xg01cxk x47corl"
|
|
803
|
+
}
|
|
804
|
+
}[!!(activePanel !== 'time') << 0],
|
|
805
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
806
|
+
...{
|
|
807
|
+
className: "x78zum5 xh8yej3 xeuugli xm8gem x1txdalj"
|
|
808
|
+
},
|
|
809
|
+
children: [/*#__PURE__*/_jsx(Wheel, {
|
|
810
|
+
label: t('@astryx.dateTimeInput.hourWheel'),
|
|
811
|
+
options: hourOptions,
|
|
812
|
+
value: hourFormat === '24h' ? parsedWheelTime.hour : hour12From24(parsedWheelTime.hour),
|
|
813
|
+
isActive: activePanel === 'time',
|
|
814
|
+
onChange: hour => commitWheelTime(hourFormat === '24h' ? composeWheelTime({
|
|
815
|
+
hour24: hour
|
|
816
|
+
}) : composeWheelTime({
|
|
817
|
+
hour12: hour
|
|
818
|
+
}))
|
|
819
|
+
}), /*#__PURE__*/_jsx(Wheel, {
|
|
820
|
+
label: t('@astryx.dateTimeInput.minuteWheel'),
|
|
821
|
+
options: minuteOptions,
|
|
822
|
+
value: parsedWheelTime.minute,
|
|
823
|
+
isActive: activePanel === 'time',
|
|
824
|
+
onChange: minute => commitWheelTime(composeWheelTime({
|
|
825
|
+
minute
|
|
826
|
+
}))
|
|
827
|
+
}), hasSeconds && /*#__PURE__*/_jsx(Wheel, {
|
|
828
|
+
label: t('@astryx.dateTimeInput.secondWheel'),
|
|
829
|
+
options: secondOptions,
|
|
830
|
+
value: parsedWheelTime.second,
|
|
831
|
+
isActive: activePanel === 'time',
|
|
832
|
+
onChange: second => commitWheelTime(composeWheelTime({
|
|
833
|
+
second
|
|
834
|
+
}))
|
|
835
|
+
}), hourFormat === '12h' && /*#__PURE__*/_jsx(Wheel, {
|
|
836
|
+
label: t('@astryx.dateTimeInput.meridiemWheel'),
|
|
837
|
+
options: meridiemOptions,
|
|
838
|
+
value: parsedWheelTime.hour < 12 ? 0 : 1,
|
|
839
|
+
isActive: activePanel === 'time',
|
|
840
|
+
onChange: meridiem => commitWheelTime(composeWheelTime({
|
|
841
|
+
meridiem
|
|
842
|
+
}))
|
|
843
|
+
})]
|
|
844
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
845
|
+
...{
|
|
846
|
+
className: "x78zum5 xr1yuqi xfsso4q"
|
|
847
|
+
},
|
|
848
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
849
|
+
variant: "primary",
|
|
850
|
+
size: "md",
|
|
851
|
+
width: "100%",
|
|
852
|
+
label: t('@astryx.dateInput.savePicking'),
|
|
853
|
+
onClick: closeSheet
|
|
854
|
+
})
|
|
855
|
+
})]
|
|
856
|
+
})]
|
|
857
|
+
})]
|
|
858
|
+
});
|
|
859
|
+
return /*#__PURE__*/_jsx(Field, {
|
|
860
|
+
label: label,
|
|
861
|
+
isLabelHidden: isLabelHidden,
|
|
862
|
+
description: description,
|
|
863
|
+
inputID: dateInputId,
|
|
864
|
+
descriptionID: description ? descriptionID : undefined,
|
|
865
|
+
isOptional: isOptional,
|
|
866
|
+
isRequired: isRequired,
|
|
867
|
+
isDisabled: isDisabled,
|
|
868
|
+
status: status ? {
|
|
869
|
+
type: status.type,
|
|
870
|
+
message: status.message,
|
|
871
|
+
messageID: status.message ? statusMessageID : undefined
|
|
872
|
+
} : undefined,
|
|
873
|
+
labelTooltip: labelTooltip,
|
|
874
|
+
statusVariant: "detached",
|
|
875
|
+
width: width,
|
|
876
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
877
|
+
ref: el => {
|
|
878
|
+
disabledMessageTooltip.ref(el);
|
|
879
|
+
},
|
|
880
|
+
...rest,
|
|
881
|
+
...mergeProps(themeProps('date-time-input', {
|
|
882
|
+
size,
|
|
883
|
+
status: status?.type ?? null,
|
|
884
|
+
disabled: isDisabled ? 'disabled' : null
|
|
885
|
+
}), stylex.props(styles.touchRow, xstyle), className, style),
|
|
886
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
887
|
+
onClick: event => {
|
|
888
|
+
if (event.target === event.currentTarget) {
|
|
889
|
+
openSheet('date');
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
...mergeProps(themeProps('date-time-input-date-segment', {
|
|
893
|
+
size,
|
|
894
|
+
status: status?.type ?? null
|
|
895
|
+
}), stylex.props(inputWrapperStyles.base, sizeStyles[size], styles.touchDateWrapper, isEffectivelyDisabled && inputWrapperStyles.disabled, status && inputStatusBorderStyles[status.type], status && !isEffectivelyDisabled && inputStatusHoverShadowStyles[status.type], status && inputStatusFocusWithinStyles[status.type])),
|
|
896
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
897
|
+
type: "button",
|
|
898
|
+
onClick: () => openSheet('date'),
|
|
899
|
+
disabled: isEffectivelyDisabled,
|
|
900
|
+
"aria-label": t('@astryx.dateInput.openCalendar'),
|
|
901
|
+
tabIndex: -1,
|
|
902
|
+
...stylex.props(focusOutlineStyles.focusVisible, styles.iconButton, isEffectivelyDisabled && styles.iconButtonDisabled),
|
|
903
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
904
|
+
icon: "calendar",
|
|
905
|
+
size: "sm",
|
|
906
|
+
color: "secondary",
|
|
907
|
+
...themeProps('date-time-input-toggle-icon', {
|
|
908
|
+
state: isSheetOpen ? 'expanded' : 'collapsed'
|
|
909
|
+
})
|
|
910
|
+
})
|
|
911
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
912
|
+
ref: mergedDateInputRef,
|
|
913
|
+
id: dateInputId,
|
|
914
|
+
type: "text",
|
|
915
|
+
role: "combobox",
|
|
916
|
+
value: dateDisplayValue,
|
|
917
|
+
readOnly: true,
|
|
918
|
+
inputMode: "none",
|
|
919
|
+
onChange: () => {},
|
|
920
|
+
onClick: () => openSheet('date'),
|
|
921
|
+
onKeyDown: event => handleInputKeyDown(event, 'date'),
|
|
922
|
+
placeholder: placeholder,
|
|
923
|
+
disabled: isEffectivelyDisabled && !showsDisabledMessage,
|
|
924
|
+
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
925
|
+
"aria-describedby": ariaDescribedBy,
|
|
926
|
+
"aria-required": isEffectivelyRequired ? 'true' : undefined,
|
|
927
|
+
"aria-invalid": status?.type === 'error' ? 'true' : undefined,
|
|
928
|
+
"aria-busy": isBusy || undefined,
|
|
929
|
+
"aria-expanded": isSheetOpen && activePanel === 'date',
|
|
930
|
+
"aria-haspopup": "dialog",
|
|
931
|
+
"aria-autocomplete": "none",
|
|
932
|
+
autoComplete: "off",
|
|
933
|
+
...{
|
|
934
|
+
0: {
|
|
935
|
+
className: "x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5 xbuiw85 x1ypdohk x16khyan x87ps6o"
|
|
936
|
+
},
|
|
937
|
+
1: {
|
|
938
|
+
className: "x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5 xbuiw85 x87ps6o xt0e3qv"
|
|
939
|
+
}
|
|
940
|
+
}[!!isEffectivelyDisabled << 0]
|
|
941
|
+
}), hasClear && value !== undefined && !isEffectivelyDisabled && /*#__PURE__*/_jsx(InputClearButton, {
|
|
942
|
+
label: t('@astryx.dateInput.clear', {
|
|
943
|
+
label
|
|
944
|
+
}),
|
|
945
|
+
onClick: handleClear
|
|
946
|
+
}), isBusy && /*#__PURE__*/_jsx(Spinner, {
|
|
947
|
+
size: "sm"
|
|
948
|
+
}), isRenderable(statusIcon) && statusIcon]
|
|
949
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
950
|
+
onClick: event => {
|
|
951
|
+
if (event.target === event.currentTarget) {
|
|
952
|
+
openSheet('time');
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
...mergeProps(themeProps('date-time-input-time-segment', {
|
|
956
|
+
size,
|
|
957
|
+
status: status?.type ?? null
|
|
958
|
+
}), stylex.props(inputWrapperStyles.base, sizeStyles[size], styles.touchTimeWrapper, isEffectivelyDisabled && inputWrapperStyles.disabled, status && inputStatusBorderStyles[status.type], status && !isEffectivelyDisabled && inputStatusHoverShadowStyles[status.type], status && inputStatusFocusWithinStyles[status.type])),
|
|
959
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
960
|
+
type: "button",
|
|
961
|
+
onClick: () => openSheet('time'),
|
|
962
|
+
disabled: isEffectivelyDisabled,
|
|
963
|
+
"aria-label": t('@astryx.dateTimeInput.openTimePicker', {
|
|
964
|
+
label: resolvedTimeLabel
|
|
965
|
+
}),
|
|
966
|
+
tabIndex: -1,
|
|
967
|
+
...stylex.props(focusOutlineStyles.focusVisible, styles.iconButton, isEffectivelyDisabled && styles.iconButtonDisabled),
|
|
968
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
969
|
+
icon: "clock",
|
|
970
|
+
size: "sm",
|
|
971
|
+
color: "secondary",
|
|
972
|
+
...themeProps('date-time-input-clock-icon')
|
|
973
|
+
})
|
|
974
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
975
|
+
ref: timeInputRef,
|
|
976
|
+
id: timeInputId,
|
|
977
|
+
type: "text",
|
|
978
|
+
role: "combobox",
|
|
979
|
+
value: timeDisplayValue,
|
|
980
|
+
readOnly: true,
|
|
981
|
+
inputMode: "none",
|
|
982
|
+
onChange: () => {},
|
|
983
|
+
onClick: () => openSheet('time'),
|
|
984
|
+
onKeyDown: event => handleInputKeyDown(event, 'time'),
|
|
985
|
+
placeholder: timePlaceholder,
|
|
986
|
+
disabled: isEffectivelyDisabled && !showsDisabledMessage,
|
|
987
|
+
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
988
|
+
"aria-label": resolvedTimeLabel,
|
|
989
|
+
"aria-describedby": ariaDescribedBy,
|
|
990
|
+
"aria-required": isEffectivelyRequired ? 'true' : undefined,
|
|
991
|
+
"aria-invalid": status?.type === 'error' ? 'true' : undefined,
|
|
992
|
+
"aria-busy": isBusy || undefined,
|
|
993
|
+
"aria-expanded": isSheetOpen && activePanel === 'time',
|
|
994
|
+
"aria-haspopup": "dialog",
|
|
995
|
+
"aria-autocomplete": "none",
|
|
996
|
+
autoComplete: "off",
|
|
997
|
+
...{
|
|
998
|
+
0: {
|
|
999
|
+
className: "x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5 xbuiw85 x1ypdohk x16khyan x87ps6o"
|
|
1000
|
+
},
|
|
1001
|
+
1: {
|
|
1002
|
+
className: "x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5 xbuiw85 x87ps6o xt0e3qv"
|
|
1003
|
+
}
|
|
1004
|
+
}[!!isEffectivelyDisabled << 0]
|
|
1005
|
+
})]
|
|
1006
|
+
}), /*#__PURE__*/_jsx(BottomSheet, {
|
|
1007
|
+
isOpen: isSheetOpen,
|
|
1008
|
+
onOpenChange: handleSheetOpenChange,
|
|
1009
|
+
label: t('@astryx.dateTimeInput.dialogLabel'),
|
|
1010
|
+
height: "hug",
|
|
1011
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
1012
|
+
...{
|
|
1013
|
+
className: "x9f619 xh8yej3 xeuugli x1pzlopt x1adxfkp x1awphl8"
|
|
1014
|
+
},
|
|
1015
|
+
children: surface
|
|
1016
|
+
})
|
|
1017
|
+
}), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
1018
|
+
})
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
TouchDateTimeField.displayName = 'TouchDateTimeField';
|