@astryxdesign/core 0.7.15 → 0.7.16-canary.g3aa244b
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/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +8 -2
- package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts +2 -1
- package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts.map +1 -1
- package/dist/AppShell/useCloseMobileDrawerOnActivate.js +15 -2
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +11 -6
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +52 -35
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +4 -7
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +1 -1
- package/dist/DateInput/DateInput.d.ts +27 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +24 -6
- package/dist/DateInput/NativeDateField.d.ts +1 -1
- package/dist/DateInput/NativeDateField.d.ts.map +1 -1
- package/dist/DateInput/NativeDateField.js +48 -31
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.d.ts +75 -8
- package/dist/DateInput/useTypedDate.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.js +188 -133
- package/dist/DateTimeInput/DateTimeInput.d.ts +32 -3
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +99 -62
- package/dist/DateTimeInput/NativeDateSegment.d.ts +8 -1
- package/dist/DateTimeInput/NativeDateSegment.d.ts.map +1 -1
- package/dist/DateTimeInput/NativeDateSegment.js +20 -14
- package/dist/DateTimeInput/NativeTimeSegment.d.ts +13 -1
- package/dist/DateTimeInput/NativeTimeSegment.d.ts.map +1 -1
- package/dist/DateTimeInput/NativeTimeSegment.js +21 -18
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +10 -3
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +4 -2
- package/dist/Field/useEntryErrorBehavior.d.ts +8 -0
- package/dist/Field/useEntryErrorBehavior.d.ts.map +1 -0
- package/dist/Field/useEntryErrorBehavior.js +30 -0
- package/dist/Field/useEntryErrorReport.d.ts +40 -0
- package/dist/Field/useEntryErrorReport.d.ts.map +1 -0
- package/dist/Field/useEntryErrorReport.js +157 -0
- package/dist/Field/useValueReplacesEntry.d.ts +11 -0
- package/dist/Field/useValueReplacesEntry.d.ts.map +1 -0
- package/dist/Field/useValueReplacesEntry.js +46 -0
- package/dist/FormLayout/FormLayout.d.ts +21 -2
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/FormLayout/FormLayout.js +5 -2
- package/dist/FormLayout/FormLayoutContext.d.ts +18 -2
- package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
- package/dist/FormLayout/FormLayoutContext.js +22 -4
- package/dist/FormLayout/index.d.ts +1 -1
- package/dist/FormLayout/index.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.d.ts +1 -1
- package/dist/InfoTip/InfoTip.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.js +4 -1
- package/dist/Layer/gestureCounter.d.ts +14 -0
- package/dist/Layer/gestureCounter.d.ts.map +1 -1
- package/dist/Layer/gestureCounter.js +123 -4
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +17 -13
- package/dist/Layer/layerEntranceSide.d.ts +24 -10
- package/dist/Layer/layerEntranceSide.d.ts.map +1 -1
- package/dist/Layer/layerEntranceSide.js +28 -13
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +76 -15
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +14 -20
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +625 -180
- package/dist/List/ListItem.d.ts +3 -2
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListReorderHandle.d.ts +7 -0
- package/dist/List/ListReorderHandle.d.ts.map +1 -1
- package/dist/List/ListReorderHandle.js +42 -58
- package/dist/List/listReorderContext.d.ts.map +1 -1
- package/dist/List/listReorderContext.js +4 -4
- package/dist/List/listReorderEngine.d.ts +50 -2
- package/dist/List/listReorderEngine.d.ts.map +1 -1
- package/dist/List/listReorderEngine.js +205 -10
- package/dist/Markdown/plugins/textTransform.d.ts.map +1 -1
- package/dist/Markdown/plugins/textTransform.js +31 -10
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +4 -1
- package/dist/NumberInput/NumberInput.d.ts +60 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +141 -40
- package/dist/NumberInput/index.d.ts +2 -2
- package/dist/NumberInput/index.d.ts.map +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/NumberInput/numberInputCommit.d.ts +18 -1
- package/dist/NumberInput/numberInputCommit.d.ts.map +1 -1
- package/dist/NumberInput/numberInputCommit.js +57 -3
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +12 -3
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +23 -15
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +8 -4
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +4 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +4 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.js +7 -3
- package/dist/PowerSearch/PowerSearchToken.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +4 -1
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +4 -0
- package/dist/Selector/useSelectorPresentation.d.ts.map +1 -1
- package/dist/Selector/useSelectorPresentation.js +13 -12
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +6 -8
- package/dist/Table/BaseTable.d.ts +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +276 -198
- package/dist/Table/Table.d.ts +5 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/index.d.ts +5 -3
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +2 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +2 -0
- package/dist/Table/plugins/infiniteScroll/TableInfiniteScrollWide.a11y.chromium.spec.d.ts.map +1 -0
- package/dist/Table/plugins/infiniteScroll/index.d.ts +9 -0
- package/dist/Table/plugins/infiniteScroll/index.d.ts.map +1 -0
- package/dist/Table/plugins/infiniteScroll/index.js +9 -0
- package/dist/Table/plugins/infiniteScroll/useTableInfiniteScroll.d.ts +29 -0
- package/dist/Table/plugins/infiniteScroll/useTableInfiniteScroll.d.ts.map +1 -0
- package/dist/Table/plugins/infiniteScroll/useTableInfiniteScroll.js +394 -0
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +4 -4
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +21 -1
- package/dist/Table/plugins/virtualization/TableColumnWindow.d.ts +4 -0
- package/dist/Table/plugins/virtualization/TableColumnWindow.d.ts.map +1 -0
- package/dist/Table/plugins/virtualization/TableColumnWindow.js +114 -0
- package/dist/Table/plugins/virtualization/index.d.ts +3 -1
- package/dist/Table/plugins/virtualization/index.d.ts.map +1 -1
- package/dist/Table/plugins/virtualization/index.js +3 -2
- package/dist/Table/plugins/virtualization/useTableColumnWindow.d.ts +39 -0
- package/dist/Table/plugins/virtualization/useTableColumnWindow.d.ts.map +1 -0
- package/dist/Table/plugins/virtualization/useTableColumnWindow.js +215 -0
- package/dist/Table/plugins/virtualization/useTableColumnsVirtualization.d.ts +23 -0
- package/dist/Table/plugins/virtualization/useTableColumnsVirtualization.d.ts.map +1 -0
- package/dist/Table/plugins/virtualization/useTableColumnsVirtualization.js +37 -0
- package/dist/Table/plugins/virtualization/useTableWindow.d.ts +2 -1
- package/dist/Table/plugins/virtualization/useTableWindow.d.ts.map +1 -1
- package/dist/Table/plugins/virtualization/useTableWindow.js +43 -13
- package/dist/Table/tableColumnWindowing.d.ts +107 -0
- package/dist/Table/tableColumnWindowing.d.ts.map +1 -0
- package/dist/Table/tableColumnWindowing.js +72 -0
- package/dist/Table/tablePinnedColumnRuns.d.ts +23 -0
- package/dist/Table/tablePinnedColumnRuns.d.ts.map +1 -0
- package/dist/Table/tablePinnedColumnRuns.js +41 -0
- package/dist/Table/tableRuntime.d.ts +14 -2
- package/dist/Table/tableRuntime.d.ts.map +1 -1
- package/dist/Table/tableRuntime.js +32 -11
- package/dist/Table/types.d.ts +28 -2
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +2 -2
- package/dist/Text/useTruncation.d.ts +6 -1
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +53 -35
- package/dist/TextArea/TextArea.d.ts +10 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +2 -0
- package/dist/TimeInput/TimeInput.d.ts +61 -0
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +97 -84
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.d.ts.map +1 -1
- package/dist/TimeInput/useTypedTime.d.ts +76 -0
- package/dist/TimeInput/useTypedTime.d.ts.map +1 -0
- package/dist/TimeInput/useTypedTime.js +258 -0
- package/dist/Toast/Toast.d.ts +1 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +4 -2
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +46 -53
- package/dist/astryx.css +22 -11
- package/dist/dragToSnapPoints/createDragToSnapPoints.d.ts +156 -0
- package/dist/dragToSnapPoints/createDragToSnapPoints.d.ts.map +1 -1
- package/dist/dragToSnapPoints/createDragToSnapPoints.js +313 -97
- package/dist/gestures/createPanGesture.d.ts +41 -0
- package/dist/gestures/createPanGesture.d.ts.map +1 -1
- package/dist/gestures/createPanGesture.js +66 -22
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +36 -2
- package/dist/i18n/generated-english/DateInput/NativeDateField.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateInput/NativeDateField.generated.js +0 -1
- package/dist/i18n/generated-english/DateTimeInput/NativeDateSegment.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateTimeInput/NativeDateSegment.generated.js +0 -1
- package/dist/i18n/generated-english/Lightbox/Lightbox.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Lightbox/Lightbox.generated.js +2 -0
- package/dist/i18n/generated-english/{DateTimeInput/NativeTimeSegment.generated.d.ts → Table/plugins/infiniteScroll/useTableInfiniteScroll.generated.d.ts} +2 -2
- package/dist/i18n/generated-english/Table/plugins/infiniteScroll/useTableInfiniteScroll.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/{DateTimeInput/NativeTimeSegment.generated.js → Table/plugins/infiniteScroll/useTableInfiniteScroll.generated.js} +2 -2
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +32 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +32 -0
- package/dist/internal/touch.d.ts +1 -1
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +1 -1
- package/dist/motion/animator.d.ts +28 -1
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +99 -19
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +14 -3
- package/dist/theme/tokenReferences.d.ts +7 -15
- package/dist/theme/tokenReferences.d.ts.map +1 -1
- package/dist/theme/tokenReferences.js +49 -7
- package/dist/utils/clickGuard.d.ts +8 -1
- package/dist/utils/clickGuard.d.ts.map +1 -1
- package/dist/utils/clickGuard.js +27 -4
- package/dist/utils/sharedResizeObserver.d.ts +18 -2
- package/dist/utils/sharedResizeObserver.d.ts.map +1 -1
- package/dist/utils/sharedResizeObserver.js +43 -2
- package/dist/utils/themeProps.d.ts +8 -0
- package/dist/utils/themeProps.d.ts.map +1 -1
- package/dist/utils/themeProps.js +17 -0
- package/dist/utils/timeFormat.d.ts +9 -1
- package/dist/utils/timeFormat.d.ts.map +1 -1
- package/dist/utils/timeFormat.js +46 -6
- package/dist/utils/timeParser.d.ts +3 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +7 -3
- package/dist/utils/touchEndMark.d.ts +7 -0
- package/dist/utils/touchEndMark.d.ts.map +1 -0
- package/dist/utils/touchEndMark.js +33 -0
- package/dist/virtualization/listWindow.d.ts +28 -2
- package/dist/virtualization/listWindow.d.ts.map +1 -1
- package/dist/virtualization/listWindow.js +71 -3
- package/dist/virtualization/useInlineListWindow.d.ts +64 -0
- package/dist/virtualization/useInlineListWindow.d.ts.map +1 -0
- package/dist/virtualization/useInlineListWindow.js +135 -0
- package/dist/virtualization/useListFocusIsland.d.ts +28 -0
- package/dist/virtualization/useListFocusIsland.d.ts.map +1 -0
- package/dist/virtualization/useListFocusIsland.js +53 -0
- package/dist/virtualization/useListWindow.d.ts +6 -4
- package/dist/virtualization/useListWindow.d.ts.map +1 -1
- package/dist/virtualization/useListWindow.js +17 -29
- package/locales/en.json +131 -3
- package/locales/pseudo.json +96 -0
- package/package.json +5 -5
- package/src/AppShell/AppShell.tsx +12 -3
- package/src/AppShell/useCloseMobileDrawerOnActivate.ts +19 -2
- package/src/BottomSheet/BottomSheet.tsx +12 -8
- package/src/BottomSheet/BottomSheetPanel.tsx +53 -40
- package/src/BottomSheet/useSheetGestures.ts +18 -18
- package/src/ButtonGroup/ButtonGroup.doc.mjs +5 -0
- package/src/Chat/ChatComposerInput.tsx +4 -0
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -0
- package/src/DateInput/DateInput.doc.mjs +21 -3
- package/src/DateInput/DateInput.tsx +61 -7
- package/src/DateInput/NativeDateField.tsx +58 -36
- package/src/DateInput/index.ts +1 -0
- package/src/DateInput/useTypedDate.ts +293 -196
- package/src/DateTimeInput/DateTimeInput.doc.mjs +21 -3
- package/src/DateTimeInput/DateTimeInput.tsx +158 -86
- package/src/DateTimeInput/NativeDateSegment.tsx +35 -13
- package/src/DateTimeInput/NativeTimeSegment.tsx +45 -22
- package/src/DateTimeInput/index.ts +1 -0
- package/src/DropdownMenu/DropdownMenu.tsx +10 -3
- package/src/Field/InputClearButton.tsx +3 -1
- package/src/Field/useEntryErrorBehavior.ts +34 -0
- package/src/Field/useEntryErrorReport.ts +210 -0
- package/src/Field/useValueReplacesEntry.ts +44 -0
- package/src/FormLayout/FormLayout.doc.mjs +14 -0
- package/src/FormLayout/FormLayout.tsx +24 -2
- package/src/FormLayout/FormLayoutContext.ts +24 -4
- package/src/FormLayout/index.ts +5 -1
- package/src/InfoTip/InfoTip.doc.mjs +2 -2
- package/src/InfoTip/InfoTip.tsx +3 -0
- package/src/Layer/gestureCounter.ts +136 -4
- package/src/Layer/layerAnimations.stylex.ts +13 -9
- package/src/Layer/layerEntranceSide.ts +48 -11
- package/src/Layer/useLayer.tsx +89 -15
- package/src/Layer/useTouchTrigger.ts +21 -21
- package/src/Lightbox/Lightbox.doc.mjs +2 -1
- package/src/Lightbox/Lightbox.tsx +864 -257
- package/src/List/ListItem.tsx +3 -2
- package/src/List/ListReorderHandle.tsx +59 -77
- package/src/List/listReorderContext.ts +3 -4
- package/src/List/listReorderEngine.tsx +246 -11
- package/src/Markdown/plugins/textTransform.ts +46 -12
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -2
- package/src/MoreMenu/MoreMenu.tsx +3 -0
- package/src/NumberInput/NumberInput.doc.mjs +29 -6
- package/src/NumberInput/NumberInput.tsx +224 -52
- package/src/NumberInput/index.ts +2 -1
- package/src/NumberInput/numberInputCommit.ts +57 -13
- package/src/Pagination/Pagination.tsx +14 -4
- package/src/Popover/usePopover.tsx +30 -22
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearch.tsx +7 -3
- package/src/PowerSearch/PowerSearchEditPopover.tsx +12 -2
- package/src/PowerSearch/PowerSearchFilterEditor.tsx +3 -0
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +4 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +3 -0
- package/src/SegmentedControl/SegmentedControl.doc.mjs +5 -0
- package/src/Selector/useSelectorPresentation.ts +16 -12
- package/src/Slider/Slider.tsx +6 -8
- package/src/StatusDot/StatusDot.doc.mjs +3 -0
- package/src/Switch/Switch.doc.mjs +3 -0
- package/src/TabList/TabList.doc.mjs +4 -0
- package/src/Table/BaseTable.tsx +440 -289
- package/src/Table/Table.doc.mjs +2 -2
- package/src/Table/Table.tsx +5 -1
- package/src/Table/index.ts +8 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +2 -0
- package/src/Table/plugins/infiniteScroll/index.ts +10 -0
- package/src/Table/plugins/infiniteScroll/useTableInfiniteScroll.tsx +523 -0
- package/src/Table/plugins/sortable/useTableSortableState.tsx +4 -4
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +31 -1
- package/src/Table/plugins/virtualization/TableColumnWindow.tsx +160 -0
- package/src/Table/plugins/virtualization/index.ts +3 -1
- package/src/Table/plugins/virtualization/useTableColumnWindow.ts +284 -0
- package/src/Table/plugins/virtualization/useTableColumnsVirtualization.ts +53 -0
- package/src/Table/plugins/virtualization/useTableWindow.ts +49 -17
- package/src/Table/tableColumnWindowing.ts +181 -0
- package/src/Table/tablePinnedColumnRuns.ts +55 -0
- package/src/Table/tableRuntime.ts +44 -11
- package/src/Table/types.ts +25 -2
- package/src/Table/useBaseTablePlugins.ts +2 -2
- package/src/Table/useTableColumnsVirtualization.doc.mjs +29 -0
- package/src/Table/useTableInfiniteScroll.doc.mjs +58 -0
- package/src/Text/Heading.doc.mjs +3 -0
- package/src/Text/useTruncation.doc.mjs +10 -0
- package/src/Text/useTruncation.ts +53 -35
- package/src/TextArea/TextArea.doc.mjs +15 -0
- package/src/TextArea/TextArea.tsx +11 -0
- package/src/TextInput/TextInput.doc.mjs +3 -0
- package/src/TimeInput/TimeInput.doc.mjs +38 -4
- package/src/TimeInput/TimeInput.tsx +176 -99
- package/src/TimeInput/index.ts +2 -0
- package/src/TimeInput/useTypedTime.ts +341 -0
- package/src/Toast/Toast.doc.mjs +2 -2
- package/src/Toast/Toast.tsx +3 -1
- package/src/Tooltip/useTooltip.tsx +147 -136
- package/src/TopNav/TopNav.doc.mjs +4 -0
- package/src/dragToSnapPoints/createDragToSnapPoints.ts +437 -119
- package/src/gestures/createPanGesture.ts +112 -39
- package/src/hooks/useMenuPress.ts +39 -0
- package/src/i18n/generated-english/DateInput/NativeDateField.generated.ts +0 -1
- package/src/i18n/generated-english/DateTimeInput/NativeDateSegment.generated.ts +0 -1
- package/src/i18n/generated-english/Lightbox/Lightbox.generated.ts +2 -0
- package/src/i18n/generated-english/{DateTimeInput/NativeTimeSegment.generated.ts → Table/plugins/infiniteScroll/useTableInfiniteScroll.generated.ts} +2 -2
- package/src/i18n/generated-locales/en.generated.ts +34 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +34 -0
- package/src/internal/touch.ts +5 -1
- package/src/motion/animator.ts +181 -23
- package/src/theme/generateThemeRules.ts +14 -3
- package/src/theme/tokenReferences.ts +48 -7
- package/src/utils/clickGuard.ts +33 -3
- package/src/utils/sharedResizeObserver.ts +46 -2
- package/src/utils/themeProps.ts +17 -0
- package/src/utils/timeFormat.ts +55 -10
- package/src/utils/timeParser.ts +7 -9
- package/src/utils/touchEndMark.ts +33 -0
- package/src/virtualization/listWindow.ts +105 -3
- package/src/virtualization/useInlineListWindow.ts +261 -0
- package/src/virtualization/useListFocusIsland.ts +87 -0
- package/src/virtualization/useListWindow.ts +14 -51
- package/dist/i18n/generated-english/DateTimeInput/NativeTimeSegment.generated.d.ts.map +0 -1
|
@@ -5,14 +5,20 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTypedDate.ts
|
|
7
7
|
* @input Provider locale and calendar, a field's format, bounds and constraints;
|
|
8
|
-
* calendarDateParser,
|
|
8
|
+
* calendarDateParser, parseDateInput for other Gregorian text,
|
|
9
|
+
* Field/useEntryErrorReport for the rejection status, alert and report,
|
|
10
|
+
* Field/useValueReplacesEntry for when a new value replaces a kept entry, and
|
|
11
|
+
* the field's resolved entry error behavior
|
|
9
12
|
* @output Typed-date reading, committed text, the format hint, the calendar
|
|
10
13
|
* description and rejection messages for a date text field, the typed
|
|
11
|
-
* entry state that DateInput and DateTimeInput share,
|
|
12
|
-
* DateInputEntryError that the field reports to its caller
|
|
14
|
+
* entry state that DateInput and DateTimeInput share, the
|
|
15
|
+
* DateInputEntryError that the field reports to its caller, and the
|
|
16
|
+
* rejection state of a native date control
|
|
13
17
|
* @position DateInput helper hook; used by DateInput and DateTimeInput
|
|
14
18
|
*/
|
|
15
|
-
import { useCallback,
|
|
19
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
20
|
+
import { useEntryErrorReport } from "../Field/useEntryErrorReport.js";
|
|
21
|
+
import { useValueReplacesEntry } from "../Field/useValueReplacesEntry.js";
|
|
16
22
|
import { useLocale } from "../i18n/useLocale.js";
|
|
17
23
|
import { useCalendarSystem } from "../i18n/useCalendarSystem.js";
|
|
18
24
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
@@ -30,29 +36,35 @@ registerEnglishFallback(english);
|
|
|
30
36
|
* through `onEntryErrorChange`, so the app can word its own message.
|
|
31
37
|
*/
|
|
32
38
|
|
|
33
|
-
function isSameEntryError(a, b) {
|
|
34
|
-
return a === b || a != null && b != null && a.kind === b.kind && a.text === b.text && a.date === b.date;
|
|
35
|
-
}
|
|
36
39
|
function isOutsideBounds(date, min, max) {
|
|
37
40
|
return min != null && plainDateIsBefore(date, plainDateFromISO(min)) || max != null && plainDateIsAfter(date, plainDateFromISO(max));
|
|
38
41
|
}
|
|
39
|
-
/**
|
|
40
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The rejection a result shows: the error of text that Enter or blur
|
|
44
|
+
* committed, or, under `'complete'`, of a complete date. Text that is not a
|
|
45
|
+
* date is never complete, so its error waits for the commit.
|
|
46
|
+
*/
|
|
47
|
+
export function typedDateError(result, isCommitted, entryErrorBehavior) {
|
|
41
48
|
if (result == null) {
|
|
42
49
|
return null;
|
|
43
50
|
}
|
|
44
|
-
if (result.kind === 'unreadable' || result.kind === 'incomplete' && isCommitted) {
|
|
51
|
+
if ((result.kind === 'unreadable' || result.kind === 'incomplete') && isCommitted) {
|
|
45
52
|
return 'unreadable';
|
|
46
53
|
}
|
|
47
|
-
if ((result.kind === 'nonexistent' || result.kind === 'outOfRange') && (result.isComplete
|
|
54
|
+
if ((result.kind === 'nonexistent' || result.kind === 'outOfRange') && (isCommitted || result.isComplete && entryErrorBehavior === 'complete')) {
|
|
48
55
|
return result.kind;
|
|
49
56
|
}
|
|
50
57
|
return null;
|
|
51
58
|
}
|
|
52
59
|
|
|
60
|
+
/** Whether a result is a date that typing commits, which ends a rejection. */
|
|
61
|
+
function isAcceptedDate(result) {
|
|
62
|
+
return result.kind === 'value' && result.isComplete;
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
/** The rejection a result shows, as the field reports it to its caller. */
|
|
54
|
-
function dateEntryError(result, isCommitted, text, min, max) {
|
|
55
|
-
const error = typedDateError(result, isCommitted);
|
|
66
|
+
function dateEntryError(result, isCommitted, text, min, max, entryErrorBehavior) {
|
|
67
|
+
const error = typedDateError(result, isCommitted, entryErrorBehavior);
|
|
56
68
|
if (error == null || result == null) {
|
|
57
69
|
return null;
|
|
58
70
|
}
|
|
@@ -180,6 +192,7 @@ export function useTypedDateField({
|
|
|
180
192
|
isStatusAnnounced,
|
|
181
193
|
onEntryErrorChange,
|
|
182
194
|
hasPlaceholder,
|
|
195
|
+
entryErrorBehavior,
|
|
183
196
|
...options
|
|
184
197
|
}) {
|
|
185
198
|
const typedDate = useTypedDate(options);
|
|
@@ -187,6 +200,11 @@ export function useTypedDateField({
|
|
|
187
200
|
const [pendingInput, setPendingInput] = useState(null);
|
|
188
201
|
// Set when Enter or blur keeps rejected text so the person can correct it.
|
|
189
202
|
const [isRejectionCommitted, setIsRejectionCommitted] = useState(false);
|
|
203
|
+
// Counts each Enter or blur that keeps rejected text.
|
|
204
|
+
const [keptCommits, setKeptCommits] = useState(0);
|
|
205
|
+
// Rejected text whose rejection stays shown while an edit leaves the entry
|
|
206
|
+
// rejected or unfinished.
|
|
207
|
+
const [keptText, setKeptText] = useState(null);
|
|
190
208
|
const [isFocused, setIsFocused] = useState(false);
|
|
191
209
|
// The date that typing last reported, so one typing session reports each
|
|
192
210
|
// date once. Only the handlers write it. A value from outside and a
|
|
@@ -199,130 +217,58 @@ export function useTypedDateField({
|
|
|
199
217
|
const [firedEpoch, setFiredEpoch] = useState(0);
|
|
200
218
|
const lastFiredDate = lastFired.epoch === firedEpoch ? lastFired.date : undefined;
|
|
201
219
|
const typedResult = pendingInput !== null && pendingInput.trim() ? typedDate.parse(pendingInput) : null;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
//
|
|
217
|
-
//
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// Field announces its status when the status appears or changes. A
|
|
231
|
-
// rejection that starts under the caller's error message changes no status,
|
|
232
|
-
// so the field's alert announces that message once for it. This record
|
|
233
|
-
// holds the error message that the status showed while no rejection stood.
|
|
234
|
-
// A change of the shown message during the rejection ends the repeat,
|
|
235
|
-
// because Field announces that change.
|
|
236
|
-
const shownErrorMessage = fieldStatus?.type === 'error' ? fieldStatus.message ?? null : null;
|
|
237
|
-
const [statusRecord, setStatusRecord] = useState({
|
|
238
|
-
message: shownErrorMessage,
|
|
239
|
-
isRepeatable: true
|
|
220
|
+
const ownError = typedDateError(typedResult, isRejectionCommitted, entryErrorBehavior);
|
|
221
|
+
const keptResult = ownError == null && keptText !== null && typedResult != null && !isAcceptedDate(typedResult) ? typedDate.parse(keptText) : null;
|
|
222
|
+
// The rejection the field shows. A locked field hides it but keeps its
|
|
223
|
+
// state, so the rejection shows again once the field is editable.
|
|
224
|
+
const shown = isDisabled ? null : ownError != null && typedResult != null && pendingInput !== null ? {
|
|
225
|
+
text: pendingInput,
|
|
226
|
+
result: typedResult
|
|
227
|
+
} : keptResult != null && keptText !== null && typedDateError(keptResult, true, entryErrorBehavior) != null ? {
|
|
228
|
+
text: keptText,
|
|
229
|
+
result: keptResult
|
|
230
|
+
} : null;
|
|
231
|
+
const errorMessage = shown != null ? typedDate.errorMessage(shown.result) : null;
|
|
232
|
+
const entryError = shown != null ? dateEntryError(shown.result, true, shown.text, options.min, options.max, entryErrorBehavior) : null;
|
|
233
|
+
const shownText = shown?.text ?? null;
|
|
234
|
+
// Unreadable text that Enter or blur kept: the form posts the committed
|
|
235
|
+
// date, as it does where the text gives way to it.
|
|
236
|
+
const isKeptUnreadable = isRejectionCommitted && typedResult?.kind === 'unreadable';
|
|
237
|
+
const {
|
|
238
|
+
fieldStatus,
|
|
239
|
+
alertMessage,
|
|
240
|
+
reportEntryError
|
|
241
|
+
} = useEntryErrorReport({
|
|
242
|
+
entryError,
|
|
243
|
+
rejectionMessage: errorMessage,
|
|
244
|
+
status,
|
|
245
|
+
isStatusAnnounced,
|
|
246
|
+
callerErrorPrecedence: 'withCallback',
|
|
247
|
+
onEntryErrorChange
|
|
240
248
|
});
|
|
241
|
-
// The alert and the status change in the same render.
|
|
242
|
-
const statusRecordInput = `${entryError != null}:${shownErrorMessage}`;
|
|
243
|
-
const prevStatusRecordInputRef = useRef(statusRecordInput);
|
|
244
|
-
if (hasEntryErrorCallback && statusRecordInput !== prevStatusRecordInputRef.current) {
|
|
245
|
-
prevStatusRecordInputRef.current = statusRecordInput;
|
|
246
|
-
if (entryError == null) {
|
|
247
|
-
if (statusRecord.message !== shownErrorMessage || !statusRecord.isRepeatable) {
|
|
248
|
-
setStatusRecord({
|
|
249
|
-
message: shownErrorMessage,
|
|
250
|
-
isRepeatable: true
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
} else if (statusRecord.isRepeatable && statusRecord.message !== shownErrorMessage) {
|
|
254
|
-
setStatusRecord({
|
|
255
|
-
message: statusRecord.message,
|
|
256
|
-
isRepeatable: false
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
let alertMessage = '';
|
|
261
|
-
if (errorMessage != null && !isCallerBehind) {
|
|
262
|
-
if (callerErrorMessage != null) {
|
|
263
|
-
const isStatusRepeated = statusRecord.isRepeatable && statusRecord.message === callerErrorMessage;
|
|
264
|
-
// Inside an InputGroup no Field announces the caller's status.
|
|
265
|
-
alertMessage = !isStatusAnnounced || isStatusRepeated ? callerErrorMessage : '';
|
|
266
|
-
} else {
|
|
267
|
-
alertMessage = isStatusAnnounced && typedStatus != null ? '' : errorMessage;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
const reportEntryError = useCallback(error => {
|
|
271
|
-
if (onEntryErrorChange == null) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
setHeardEntryError(error);
|
|
275
|
-
if (!isSameEntryError(error, reportedEntryErrorRef.current)) {
|
|
276
|
-
reportedEntryErrorRef.current = error;
|
|
277
|
-
onEntryErrorChange(error);
|
|
278
|
-
}
|
|
279
|
-
}, [onEntryErrorChange]);
|
|
280
|
-
|
|
281
|
-
// Syncs the caller's entry error with a rejection that a new `min`, `max`,
|
|
282
|
-
// `dateConstraints`, `value`, or disabled state starts, changes, or ends.
|
|
283
|
-
useEffect(() => {
|
|
284
|
-
latestEntryErrorCallbackRef.current = onEntryErrorChange;
|
|
285
|
-
if (onEntryErrorChange == null) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
if (!isSameEntryError(entryError, reportedEntryErrorRef.current)) {
|
|
289
|
-
reportedEntryErrorRef.current = entryError;
|
|
290
|
-
// Called through the ref: the set-state-in-effect rule takes a call to a
|
|
291
|
-
// hook parameter for the whole hook's body.
|
|
292
|
-
latestEntryErrorCallbackRef.current?.(entryError);
|
|
293
|
-
}
|
|
294
|
-
if (!isSameEntryError(entryError, heardEntryError)) {
|
|
295
|
-
// eslint-disable-next-line @eslint-react/set-state-in-effect -- shows the field's own message once the caller has the rejection
|
|
296
|
-
setHeardEntryError(entryError);
|
|
297
|
-
}
|
|
298
|
-
}, [entryError, heardEntryError, onEntryErrorChange]);
|
|
299
|
-
|
|
300
|
-
// Syncs the caller's entry error at unmount. A presentation or pointer
|
|
301
|
-
// change can replace the field while its reported rejection stands, and
|
|
302
|
-
// the rejection ends with the field.
|
|
303
|
-
useEffect(() => () => {
|
|
304
|
-
if (reportedEntryErrorRef.current != null) {
|
|
305
|
-
reportedEntryErrorRef.current = null;
|
|
306
|
-
latestEntryErrorCallbackRef.current?.(null);
|
|
307
|
-
}
|
|
308
|
-
}, []);
|
|
309
249
|
const reset = useCallback(() => {
|
|
310
250
|
setPendingInput(null);
|
|
311
251
|
setIsRejectionCommitted(false);
|
|
252
|
+
setKeptText(null);
|
|
312
253
|
reportEntryError(null);
|
|
313
254
|
}, [reportEntryError]);
|
|
314
255
|
|
|
315
|
-
// A value
|
|
316
|
-
//
|
|
317
|
-
//
|
|
256
|
+
// A new value drops typed text. A value that arrives with an Enter or blur
|
|
257
|
+
// that keeps rejected text does not drop it. A caller can restore its own
|
|
258
|
+
// value there.
|
|
259
|
+
const isEntryReplaced = useValueReplacesEntry(value, keptCommits);
|
|
260
|
+
// A value from outside also retires the date that typing last reported, so
|
|
261
|
+
// a retyped date reports again. Adjusted during render, so it takes no extra
|
|
262
|
+
// commit; state, so a render React discards takes its adjustment with it.
|
|
318
263
|
const [prevValue, setPrevValue] = useState(value);
|
|
319
264
|
if (value !== prevValue) {
|
|
320
265
|
setPrevValue(value);
|
|
321
266
|
if (value !== lastFiredDate) {
|
|
322
267
|
setFiredEpoch(epoch => epoch + 1);
|
|
323
|
-
if (pendingInput !== null) {
|
|
268
|
+
if (pendingInput !== null && isEntryReplaced) {
|
|
324
269
|
setPendingInput(null);
|
|
325
270
|
setIsRejectionCommitted(false);
|
|
271
|
+
setKeptText(null);
|
|
326
272
|
}
|
|
327
273
|
}
|
|
328
274
|
}
|
|
@@ -337,6 +283,7 @@ export function useTypedDateField({
|
|
|
337
283
|
setFiredEpoch(epoch => epoch + 1);
|
|
338
284
|
setPendingInput(null);
|
|
339
285
|
setIsRejectionCommitted(false);
|
|
286
|
+
setKeptText(null);
|
|
340
287
|
}
|
|
341
288
|
}
|
|
342
289
|
const report = useCallback(date => {
|
|
@@ -354,18 +301,24 @@ export function useTypedDateField({
|
|
|
354
301
|
if (isDisabled) {
|
|
355
302
|
return;
|
|
356
303
|
}
|
|
357
|
-
setPendingInput(text);
|
|
358
|
-
setIsRejectionCommitted(false);
|
|
359
304
|
// Report a date only once more typing cannot change it.
|
|
360
305
|
const result = typedDate.parse(text);
|
|
361
|
-
|
|
306
|
+
const isEmpty = !text.trim();
|
|
307
|
+
const error = isEmpty ? null : dateEntryError(result, false, text, options.min, options.max, entryErrorBehavior);
|
|
308
|
+
// An edit that leaves the entry rejected or unfinished keeps the shown
|
|
309
|
+
// rejection.
|
|
310
|
+
const nextKeptText = error != null || isEmpty || isAcceptedDate(result) ? null : shownText;
|
|
311
|
+
setPendingInput(text);
|
|
312
|
+
setIsRejectionCommitted(false);
|
|
313
|
+
setKeptText(nextKeptText);
|
|
314
|
+
reportEntryError(error ?? (nextKeptText !== null ? entryError : null));
|
|
362
315
|
if (result.kind === 'value' && result.isComplete) {
|
|
363
316
|
const date = plainDateToISO(result.date);
|
|
364
317
|
if (report(date)) {
|
|
365
318
|
onTypedDate?.(date);
|
|
366
319
|
}
|
|
367
320
|
}
|
|
368
|
-
}, [isDisabled, typedDate, reportEntryError, options.min, options.max, report, onTypedDate]);
|
|
321
|
+
}, [isDisabled, typedDate, shownText, entryError, reportEntryError, options.min, options.max, entryErrorBehavior, report, onTypedDate]);
|
|
369
322
|
const commit = useCallback(() => {
|
|
370
323
|
if (pendingInput === null || isDisabled) {
|
|
371
324
|
return;
|
|
@@ -376,11 +329,13 @@ export function useTypedDateField({
|
|
|
376
329
|
return;
|
|
377
330
|
}
|
|
378
331
|
const result = typedDate.parse(pendingInput);
|
|
379
|
-
if (result.kind === 'incomplete' || result.kind === 'nonexistent' || result.kind === 'outOfRange') {
|
|
332
|
+
if (result.kind === 'unreadable' || result.kind === 'incomplete' || result.kind === 'nonexistent' || result.kind === 'outOfRange') {
|
|
380
333
|
// Keep the text and show why it cannot commit; never finish or adjust
|
|
381
334
|
// the date.
|
|
382
335
|
setIsRejectionCommitted(true);
|
|
383
|
-
|
|
336
|
+
setKeptCommits(count => count + 1);
|
|
337
|
+
setKeptText(null);
|
|
338
|
+
reportEntryError(dateEntryError(result, true, pendingInput, options.min, options.max, entryErrorBehavior));
|
|
384
339
|
return;
|
|
385
340
|
}
|
|
386
341
|
if (result.kind === 'value') {
|
|
@@ -392,7 +347,7 @@ export function useTypedDateField({
|
|
|
392
347
|
epoch: firedEpoch
|
|
393
348
|
});
|
|
394
349
|
reset();
|
|
395
|
-
}, [pendingInput, isDisabled, onClear, typedDate, reportEntryError, options.min, options.max, report, reset, firedEpoch]);
|
|
350
|
+
}, [pendingInput, isDisabled, onClear, typedDate, reportEntryError, options.min, options.max, entryErrorBehavior, report, reset, firedEpoch]);
|
|
396
351
|
const handleFocus = useCallback(() => {
|
|
397
352
|
setIsFocused(true);
|
|
398
353
|
typedDate.prepare();
|
|
@@ -401,13 +356,15 @@ export function useTypedDateField({
|
|
|
401
356
|
setIsFocused(false);
|
|
402
357
|
commit();
|
|
403
358
|
}, [commit]);
|
|
404
|
-
const
|
|
359
|
+
const committedText = shownValue != null && /^\d{4}-\d{2}-\d{2}$/.test(shownValue) ? typedDate.formatCommitted(shownValue) : '';
|
|
360
|
+
const displayValue = pendingInput ?? committedText;
|
|
405
361
|
return {
|
|
406
362
|
typedDate,
|
|
407
363
|
displayValue,
|
|
408
364
|
formatHint: !hasPlaceholder && isFocused && !displayValue ? typedDate.getFormatHint() : null,
|
|
409
|
-
isPending: pendingInput !== null,
|
|
410
|
-
|
|
365
|
+
isPending: pendingInput !== null && !isKeptUnreadable,
|
|
366
|
+
hiddenFormValue: isKeptUnreadable ? committedText : null,
|
|
367
|
+
isInvalid: shown != null,
|
|
411
368
|
fieldStatus,
|
|
412
369
|
alertMessage,
|
|
413
370
|
handleChange,
|
|
@@ -416,4 +373,102 @@ export function useTypedDateField({
|
|
|
416
373
|
handleBlur,
|
|
417
374
|
reset
|
|
418
375
|
};
|
|
376
|
+
}
|
|
377
|
+
const NO_REFUSAL = {
|
|
378
|
+
held: null,
|
|
379
|
+
shown: null
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* The rejection of a native date control. While a person types the year, the
|
|
384
|
+
* control reports each partial year as a date, so a refused date waits for
|
|
385
|
+
* Enter or blur. The rejection then stays after the control restores the
|
|
386
|
+
* committed date, until the control reports a date the field accepts or
|
|
387
|
+
* nothing.
|
|
388
|
+
*/
|
|
389
|
+
export function useNativeDateRejection({
|
|
390
|
+
value,
|
|
391
|
+
isLocked,
|
|
392
|
+
status,
|
|
393
|
+
hasEntryErrorCallback,
|
|
394
|
+
isStatusAnnounced,
|
|
395
|
+
...options
|
|
396
|
+
}) {
|
|
397
|
+
const typedDate = useTypedDate({
|
|
398
|
+
...options,
|
|
399
|
+
calendar: 'gregory'
|
|
400
|
+
});
|
|
401
|
+
const [refusal, setRefusal] = useState(NO_REFUSAL);
|
|
402
|
+
// Counts each Enter or blur, which shows a refused date that stands.
|
|
403
|
+
const [commits, setCommits] = useState(0);
|
|
404
|
+
// A new value ends the rejection. A value that arrives with an Enter or blur
|
|
405
|
+
// that shows the rejection does not end it. A caller can restore its own
|
|
406
|
+
// value there.
|
|
407
|
+
const isRefusalReplaced = useValueReplacesEntry(value, commits);
|
|
408
|
+
if (isRefusalReplaced && refusal !== NO_REFUSAL) {
|
|
409
|
+
setRefusal(NO_REFUSAL);
|
|
410
|
+
}
|
|
411
|
+
const refuse = useCallback(date => {
|
|
412
|
+
const held = plainDateToISO(date);
|
|
413
|
+
setRefusal(prev => prev.held === held ? prev : {
|
|
414
|
+
...prev,
|
|
415
|
+
held
|
|
416
|
+
});
|
|
417
|
+
}, []);
|
|
418
|
+
const clear = useCallback(() => setRefusal(NO_REFUSAL), []);
|
|
419
|
+
const commit = useCallback(() => {
|
|
420
|
+
if (!isLocked) {
|
|
421
|
+
setCommits(count => count + 1);
|
|
422
|
+
setRefusal(prev => prev.held === null ? prev : {
|
|
423
|
+
held: null,
|
|
424
|
+
shown: prev.held
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}, [isLocked]);
|
|
428
|
+
const message = !isLocked && refusal.shown !== null ? typedDate.errorMessage({
|
|
429
|
+
kind: 'outOfRange',
|
|
430
|
+
date: plainDateFromISO(refusal.shown),
|
|
431
|
+
isComplete: true
|
|
432
|
+
}) : null;
|
|
433
|
+
const callerErrorMessage = hasEntryErrorCallback && status?.type === 'error' && status.message ? status.message : null;
|
|
434
|
+
|
|
435
|
+
// A rejection that starts under the caller's error message changes no
|
|
436
|
+
// status, so the alert announces that message once. A later change of the
|
|
437
|
+
// caller's message ends the repeat, because Field announces the change.
|
|
438
|
+
const isRejected = message != null;
|
|
439
|
+
const [repeat, setRepeat] = useState({
|
|
440
|
+
isRejected: false,
|
|
441
|
+
message: null
|
|
442
|
+
});
|
|
443
|
+
if (repeat.isRejected !== isRejected) {
|
|
444
|
+
setRepeat({
|
|
445
|
+
isRejected,
|
|
446
|
+
message: isRejected ? callerErrorMessage : null
|
|
447
|
+
});
|
|
448
|
+
} else if (repeat.message !== null && repeat.message !== callerErrorMessage) {
|
|
449
|
+
setRepeat({
|
|
450
|
+
isRejected,
|
|
451
|
+
message: null
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
let alertMessage = '';
|
|
455
|
+
if (message != null) {
|
|
456
|
+
if (!isStatusAnnounced) {
|
|
457
|
+
alertMessage = callerErrorMessage ?? message;
|
|
458
|
+
} else if (callerErrorMessage != null && callerErrorMessage === repeat.message) {
|
|
459
|
+
alertMessage = callerErrorMessage;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
message,
|
|
464
|
+
fieldStatus: message != null && callerErrorMessage == null ? {
|
|
465
|
+
type: 'error',
|
|
466
|
+
message
|
|
467
|
+
} : status,
|
|
468
|
+
alertMessage,
|
|
469
|
+
isRefused: refusal !== NO_REFUSAL,
|
|
470
|
+
refuse,
|
|
471
|
+
clear,
|
|
472
|
+
commit
|
|
473
|
+
};
|
|
419
474
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EntryErrorBehavior } from '../FormLayout/FormLayoutContext.js';
|
|
1
2
|
import { type InputStatus } from '../Field/index.js';
|
|
2
3
|
import { type DayOfWeek, type DayOfWeekName } from '../Calendar/index.js';
|
|
3
4
|
import type { CalendarSystem } from '../utils/calendarSystem.js';
|
|
@@ -6,6 +7,7 @@ import { type FieldInputBaseProps } from '../Field/fieldParts.js';
|
|
|
6
7
|
import type { SizeValue } from '../utils/types.js';
|
|
7
8
|
import { type PickerPresentation } from '../utils/inputPresentation.js';
|
|
8
9
|
export type { DateInputEntryError } from '../DateInput/useTypedDate.js';
|
|
10
|
+
export type { EntryErrorBehavior } from '../FormLayout/FormLayoutContext.js';
|
|
9
11
|
export type ISODateTimeString = string & {
|
|
10
12
|
readonly __brand: 'ISODateTimeString';
|
|
11
13
|
};
|
|
@@ -192,12 +194,16 @@ export interface DateTimeInputProps extends Omit<FieldInputBaseProps<HTMLInputEl
|
|
|
192
194
|
/**
|
|
193
195
|
* Status indicator for the input.
|
|
194
196
|
*
|
|
195
|
-
* For a
|
|
196
|
-
*
|
|
197
|
-
*
|
|
197
|
+
* For a date the date segment rejects, typed or picked in the native
|
|
198
|
+
* control, and for unreadable or unfinished date text that Enter or blur
|
|
199
|
+
* keeps, the field shows its own error message in place of `status`. With
|
|
198
200
|
* `onEntryErrorChange`, an `error` status with a message shows instead, and
|
|
199
201
|
* the field's own message applies only without one. A `warning` or
|
|
200
202
|
* `success` status never replaces a rejection.
|
|
203
|
+
*
|
|
204
|
+
* A typed time the time segment rejects shows its own error message once
|
|
205
|
+
* the time is complete, or at Enter or blur, unless the date segment holds
|
|
206
|
+
* a rejection or an `error` status with a message shows in its place.
|
|
201
207
|
*/
|
|
202
208
|
status?: InputStatus;
|
|
203
209
|
/**
|
|
@@ -219,6 +225,29 @@ export interface DateTimeInputProps extends Omit<FieldInputBaseProps<HTMLInputEl
|
|
|
219
225
|
* native and touch pickers take no typed text, so they report no rejection.
|
|
220
226
|
*/
|
|
221
227
|
onEntryErrorChange?: (error: DateInputEntryError | null) => void;
|
|
228
|
+
/**
|
|
229
|
+
* When both segments show their own entry errors: a typed date or time that
|
|
230
|
+
* the field rejects. It sets when the error shows, not when validation
|
|
231
|
+
* runs, so it is not React Aria's `validationBehavior` (native versus ARIA
|
|
232
|
+
* validation). It does not change a caller's `status`.
|
|
233
|
+
*
|
|
234
|
+
* - `'complete'` — a complete typed date the calendar does not have or that
|
|
235
|
+
* is out of range, and a complete typed time outside the range, show at
|
|
236
|
+
* once. A time the native control reports outside the range shows at
|
|
237
|
+
* once. Other rejected text shows at Enter or blur.
|
|
238
|
+
* - `'blur-or-enter'` — every rejection waits for Enter or blur in its
|
|
239
|
+
* segment. The message, `aria-invalid`, the invalid styling, the
|
|
240
|
+
* announcement, and the date segment's `onEntryErrorChange` report then
|
|
241
|
+
* appear together. An edit that the field accepts or that empties the
|
|
242
|
+
* segment clears the error at once. An edit that leaves the entry wrong
|
|
243
|
+
* keeps the shown error until the next Enter or blur.
|
|
244
|
+
*
|
|
245
|
+
* A date that the native control refuses shows at Enter or blur under both
|
|
246
|
+
* values.
|
|
247
|
+
*
|
|
248
|
+
* @default the nearest FormLayout's `defaultEntryErrorBehavior`, else `'complete'`
|
|
249
|
+
*/
|
|
250
|
+
entryErrorBehavior?: EntryErrorBehavior;
|
|
222
251
|
/**
|
|
223
252
|
* Width of the field. Numbers are treated as pixels, strings are used as-is
|
|
224
253
|
* (e.g. `'100%'`). Sizes the whole field (label, control, and status) so they
|
|
@@ -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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"}
|