@astryxdesign/core 0.7.9-canary.b1f604c → 0.7.9-canary.b2659fe
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/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +31 -2
- package/dist/BottomSheet/useSheetGestures.js +2 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +2 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +2 -0
- package/dist/DateInput/DateInput.d.ts +37 -6
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +98 -128
- package/dist/DateInput/MonthScroller.d.ts +5 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +26 -29
- package/dist/DateInput/MonthYearWheels.d.ts +10 -1
- package/dist/DateInput/MonthYearWheels.d.ts.map +1 -1
- package/dist/DateInput/MonthYearWheels.js +54 -42
- package/dist/DateInput/TouchDateField.d.ts +1 -1
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +26 -21
- package/dist/DateInput/monthGeometry.d.ts +42 -8
- package/dist/DateInput/monthGeometry.d.ts.map +1 -1
- package/dist/DateInput/monthGeometry.js +81 -7
- package/dist/DateInput/useCalendarPresentation.d.ts +10 -0
- package/dist/DateInput/useCalendarPresentation.d.ts.map +1 -0
- package/dist/DateInput/useCalendarPresentation.js +32 -0
- package/dist/DateInput/useTypedDate.d.ts +92 -0
- package/dist/DateInput/useTypedDate.d.ts.map +1 -0
- package/dist/DateInput/useTypedDate.js +269 -0
- package/dist/DateInput/wheelStrip.js +2 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts +17 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +15 -11
- package/dist/DateTimeInput/DateTimeInput.d.ts +26 -3
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +93 -92
- package/dist/DateTimeInput/TouchDateTimeField.d.ts +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +26 -20
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +3 -1
- package/dist/InputGroup/InputGroupText.d.ts +2 -1
- package/dist/InputGroup/InputGroupText.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupText.js +2 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +4 -1
- package/dist/Layer/LayerProvider.d.ts.map +1 -1
- package/dist/Layer/LayerProvider.js +8 -7
- package/dist/Layer/outsidePress.d.ts +4 -0
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +18 -1
- package/dist/Layer/toastHost.d.ts +77 -0
- package/dist/Layer/toastHost.d.ts.map +1 -0
- package/dist/Layer/toastHost.js +172 -0
- package/dist/Layer/useBackdropPress.d.ts +8 -0
- package/dist/Layer/useBackdropPress.d.ts.map +1 -1
- package/dist/Layer/useBackdropPress.js +31 -2
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +4 -0
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.js +12 -3
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +7 -2
- package/dist/Resizable/resizablePane.d.ts +0 -2
- package/dist/Resizable/resizablePane.d.ts.map +1 -1
- package/dist/Resizable/resizablePane.js +2 -7
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +16 -56
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +22 -5
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +0 -2
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +7 -4
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
- package/dist/Switch/useSwitchTouch.js +13 -9
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +5 -1
- package/dist/Toast/ToastContext.d.ts +6 -13
- package/dist/Toast/ToastContext.d.ts.map +1 -1
- package/dist/Toast/ToastContext.js +6 -8
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +14 -7
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +10 -50
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +2 -0
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +7 -2
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +9 -2
- package/dist/animator/createAnimator.js +2 -2
- package/dist/gestures/createPanGesture.d.ts +49 -0
- package/dist/gestures/createPanGesture.d.ts.map +1 -0
- package/dist/gestures/createPanGesture.js +80 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/useOverflow.d.ts +10 -0
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +25 -3
- package/dist/hooks/usePanGesture.d.ts +32 -0
- package/dist/hooks/usePanGesture.d.ts.map +1 -0
- package/dist/hooks/usePanGesture.js +67 -0
- package/dist/i18n/InternationalizationProvider.d.ts +2 -1
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateInput/DateInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateInput/DateInput.generated.js +0 -1
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.d.ts +8 -0
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.js +16 -0
- package/dist/i18n/generated-english/DateTimeInput/DateTimeInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateTimeInput/DateTimeInput.generated.js +0 -1
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +4 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/internal/touch.d.ts +10 -5
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +15 -7
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +10 -7
- package/dist/motion/animator.d.ts +5 -5
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +10 -8
- package/dist/motion/resolveMotion.d.ts +6 -27
- package/dist/motion/resolveMotion.d.ts.map +1 -1
- package/dist/motion/resolveMotion.js +82 -16
- package/dist/motion/themeTempo.d.ts +7 -0
- package/dist/motion/themeTempo.d.ts.map +1 -0
- package/dist/motion/themeTempo.js +38 -0
- package/dist/motion/themeTiming.d.ts +63 -0
- package/dist/motion/themeTiming.d.ts.map +1 -0
- package/dist/motion/themeTiming.js +173 -0
- package/dist/theme/defineTheme.d.ts +2 -2
- package/dist/theme/resolveThemeValues.d.ts.map +1 -1
- package/dist/theme/resolveThemeValues.js +12 -4
- package/dist/theme/themeMotion.d.ts +7 -5
- package/dist/theme/themeMotion.d.ts.map +1 -1
- package/dist/theme/themeMotion.js +7 -5
- package/dist/utils/calendarDateParser.d.ts +1 -1
- package/dist/utils/calendarDateParser.js +1 -1
- package/dist/utils/calendarSystem.d.ts +49 -3
- package/dist/utils/calendarSystem.d.ts.map +1 -1
- package/dist/utils/calendarSystem.js +129 -5
- package/dist/utils/focusReturn.d.ts +24 -11
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +48 -14
- package/dist/utils/inputPresentation.d.ts +9 -1
- package/dist/utils/inputPresentation.d.ts.map +1 -1
- package/dist/utils/inputPresentation.js +15 -1
- package/locales/en.json +17 -1
- package/locales/pseudo.json +12 -0
- package/package.json +4 -4
- package/src/BottomSheet/BottomSheet.tsx +39 -2
- package/src/BottomSheet/useSheetGestures.ts +2 -2
- package/src/CheckboxInput/CheckboxInput.tsx +5 -1
- package/src/ContextMenu/ContextMenu.tsx +2 -0
- package/src/DateInput/DateInput.doc.mjs +45 -12
- package/src/DateInput/DateInput.tsx +165 -181
- package/src/DateInput/MonthScroller.tsx +39 -37
- package/src/DateInput/MonthYearWheels.tsx +68 -47
- package/src/DateInput/TouchDateField.tsx +45 -17
- package/src/DateInput/monthGeometry.ts +110 -8
- package/src/DateInput/useCalendarPresentation.ts +64 -0
- package/src/DateInput/useTypedDate.ts +469 -0
- package/src/DateInput/wheelStrip.ts +2 -2
- package/src/DateRangeInput/DateRangeInput.doc.mjs +9 -0
- package/src/DateRangeInput/DateRangeInput.tsx +42 -10
- package/src/DateTimeInput/DateTimeInput.doc.mjs +42 -9
- package/src/DateTimeInput/DateTimeInput.tsx +138 -150
- package/src/DateTimeInput/TouchDateTimeField.tsx +31 -16
- package/src/Drawer/Drawer.tsx +3 -1
- package/src/Icon/useIcon.doc.mjs +94 -0
- package/src/InputGroup/InputGroupText.doc.mjs +45 -3
- package/src/InputGroup/InputGroupText.tsx +2 -1
- package/src/Item/Item.doc.mjs +19 -4
- package/src/Item/Item.tsx +7 -1
- package/src/Layer/LayerProvider.tsx +9 -8
- package/src/Layer/outsidePress.ts +18 -1
- package/src/Layer/toastHost.tsx +212 -0
- package/src/Layer/useBackdropPress.ts +41 -1
- package/src/Layer/useTouchTrigger.ts +4 -0
- package/src/Layout/LayoutPanel.tsx +16 -2
- package/src/Link/useLinkComponent.doc.mjs +95 -0
- package/src/OverflowList/OverflowList.tsx +15 -9
- package/src/PowerSearch/PowerSearch.doc.mjs +3 -3
- package/src/Resizable/resizablePane.ts +4 -13
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +15 -62
- package/src/Selector/Selector.tsx +37 -6
- package/src/SideNav/SideNav.tsx +0 -1
- package/src/SideNav/SideNavItem.tsx +8 -6
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Switch/useSwitchTouch.ts +17 -9
- package/src/TabList/Tab.tsx +5 -1
- package/src/Toast/ToastContext.ts +7 -17
- package/src/Toast/ToastViewport.tsx +13 -9
- package/src/Toast/useToast.tsx +7 -52
- package/src/Tooltip/useTooltip.tsx +2 -0
- package/src/TopNav/TopNavItem.tsx +7 -2
- package/src/Typeahead/BaseTypeahead.tsx +18 -1
- package/src/animator/createAnimator.ts +3 -3
- package/src/gestures/README.md +2 -1
- package/src/gestures/createPanGesture.doc.mjs +145 -0
- package/src/gestures/createPanGesture.ts +107 -0
- package/src/hooks/index.ts +8 -0
- package/src/hooks/useOverflow.ts +25 -3
- package/src/hooks/usePanGesture.doc.mjs +159 -0
- package/src/hooks/usePanGesture.ts +75 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +3 -3
- package/src/i18n/InternationalizationProvider.tsx +2 -1
- package/src/i18n/generated-english/DateInput/DateInput.generated.ts +0 -1
- package/src/i18n/generated-english/DateInput/useTypedDate.generated.ts +17 -0
- package/src/i18n/generated-english/DateTimeInput/DateTimeInput.generated.ts +0 -1
- package/src/i18n/generated-locales/en.generated.ts +6 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +6 -0
- package/src/index.ts +2 -0
- package/src/internal/touch.ts +16 -8
- package/src/motion/README.md +6 -5
- package/src/motion/animatedLayout.ts +10 -7
- package/src/motion/animator.ts +10 -9
- package/src/motion/resolveMotion.ts +89 -18
- package/src/motion/themeTempo.ts +41 -0
- package/src/motion/themeTiming.ts +198 -0
- package/src/theme/defineTheme.ts +2 -2
- package/src/theme/resolveThemeValues.ts +12 -3
- package/src/theme/themeMotion.ts +7 -5
- package/src/utils/calendarDateParser.ts +1 -1
- package/src/utils/calendarSystem.ts +212 -3
- package/src/utils/focusReturn.ts +61 -15
- package/src/utils/inputPresentation.ts +21 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAuBH,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAuBH,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AA4DhD,YAAY,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAmLhF,UAAU,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,qDAAqD;IACrD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IAEd,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,wGAAwG;IACxG,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;IAE7C;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,UAAU,wBAAyB,SAAQ,sBAAsB;IAC/D;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAC1B,0BAA0B,GAAG,wBAAwB,CAAC;AA27BxD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA6BlD;yBA7Be,WAAW"}
|
|
@@ -65,7 +65,7 @@ import { ModalAnnounceProvider } from "../hooks/ModalAnnounceProvider.js";
|
|
|
65
65
|
import { useModalOutlet } from "../Layer/modalOutlet.js";
|
|
66
66
|
import { useLayerDismissal } from "../Layer/useLayerDismissal.js";
|
|
67
67
|
import { useFocusRegionContainment } from "../hooks/useFocusTrap.js";
|
|
68
|
-
import { returnFocusForLastInput } from "../utils/focusReturn.js";
|
|
68
|
+
import { prepareFocusRepairOnRemoval, returnFocusForLastInput } from "../utils/focusReturn.js";
|
|
69
69
|
import { useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
70
70
|
import { BottomSheetPanel } from "./BottomSheetPanel.js";
|
|
71
71
|
import { BottomSheetEdgeTint } from "./BottomSheetEdgeTint.js";
|
|
@@ -387,7 +387,14 @@ function StandaloneBottomSheet({
|
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
389
|
const key = stackKeyRef.current;
|
|
390
|
-
|
|
390
|
+
const dialog = dialogRef.current;
|
|
391
|
+
// Removing an open dialog runs no close, so focus would drop to the page.
|
|
392
|
+
// After the commit, the repair sends focus where a close would, if the
|
|
393
|
+
// removal lost focus.
|
|
394
|
+
const repairOnRemoval = dialog == null ? null : prepareFocusRepairOnRemoval(dialog, {
|
|
395
|
+
keepRestingFocus: true
|
|
396
|
+
});
|
|
397
|
+
const leave = registerBottomSheet({
|
|
391
398
|
key,
|
|
392
399
|
getElement: () => dialogRef.current,
|
|
393
400
|
show: () => {
|
|
@@ -437,6 +444,28 @@ function StandaloneBottomSheet({
|
|
|
437
444
|
}
|
|
438
445
|
}
|
|
439
446
|
}, isOpenRef.current, hasScrim);
|
|
447
|
+
return () => {
|
|
448
|
+
// Read before the registry lets go of the sheet beneath. Focus the
|
|
449
|
+
// person had already moved out of the sheet to the page body stays
|
|
450
|
+
// there: the removal did not lose it.
|
|
451
|
+
if (repairOnRemoval != null && isSheetHostPresented(dialog)) {
|
|
452
|
+
const returnTarget = finalFocusRefRef.current?.current ?? triggerRef.current;
|
|
453
|
+
const revealed = hasScrim ? getBottomSheetBeneath(key) : null;
|
|
454
|
+
repairOnRemoval(() => {
|
|
455
|
+
// The sheet beneath left too. Its own repair returns focus for the
|
|
456
|
+
// stack.
|
|
457
|
+
if (revealed != null && !revealed.element.isConnected) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (revealed != null && (returnTarget == null || !revealed.element.contains(returnTarget))) {
|
|
461
|
+
revealed.focus();
|
|
462
|
+
} else if (returnTarget != null && returnTarget.isConnected) {
|
|
463
|
+
returnFocusForLastInput(returnTarget);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
leave();
|
|
468
|
+
};
|
|
440
469
|
}, [hasScrim, shouldPresent, writeScrim]);
|
|
441
470
|
useLayoutEffect(() => {
|
|
442
471
|
if (!isOpen) {
|
|
@@ -94,8 +94,8 @@ function touchPointerType(touch) {
|
|
|
94
94
|
return touch.touchType === 'stylus' ? 'pen' : 'touch';
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// A mouse's stretch past fully open: a resisted fraction of the
|
|
98
|
-
// at OVERSCROLL_MAX.
|
|
97
|
+
// A mouse's or a pen's stretch past fully open: a resisted fraction of the
|
|
98
|
+
// drag, capped at OVERSCROLL_MAX.
|
|
99
99
|
const OVERSCROLL_RESISTANCE = 0.35;
|
|
100
100
|
// SYNC: must not exceed MIN_RESERVE in BottomSheetPanel.tsx, the smallest
|
|
101
101
|
// reserve the sheet keeps below the screen.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,UAAU,EAGf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAS3C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,K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,+BAyRpB;yBApTe,aAAa"}
|
|
@@ -26,6 +26,7 @@ import { Spinner } from "../Spinner/Spinner.js";
|
|
|
26
26
|
import { useTooltip } from "../Tooltip/useTooltip.js";
|
|
27
27
|
import { mergeProps } from "../utils/mergeProps.js";
|
|
28
28
|
import { rtlStyles } from "../utils/rtlStyles.js";
|
|
29
|
+
import { withholdCallerHandlers } from "../utils/disabledInteraction.js";
|
|
29
30
|
import "../Indicator/indicator.markers.stylex.js";
|
|
30
31
|
import { indicatorScope } from "../Indicator/indicator.markers.stylex.js";
|
|
31
32
|
import "../internal/indicatorPress.stylex.js";
|
|
@@ -327,7 +328,7 @@ export function CheckboxInput({
|
|
|
327
328
|
...stylex.props(styles.checkboxWrapper, wrapperSizeStyles[size], !isDisabled && styles.indicatorPressOverlay, !isDisabled && isRowPressSurface && styles.indicatorRowPressOverlay),
|
|
328
329
|
...focusProps,
|
|
329
330
|
children: [/*#__PURE__*/_jsx("input", {
|
|
330
|
-
...rest,
|
|
331
|
+
...withholdCallerHandlers(rest, isDisabled),
|
|
331
332
|
ref: useMergedRefs(ref, indeterminateRef, disabledMessageTooltip.positionRef, inputRef),
|
|
332
333
|
id: id,
|
|
333
334
|
type: "checkbox"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../src/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KASN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../src/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KASN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,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qB,SAAQ,oBAAoB;IACzD,gDAAgD;IAChD,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,UAAU,wBAAyB,SAAQ,oBAAoB;IAC7D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,+CAA+C;IAC/C,WAAW,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;AAM/E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,IAAW,EACX,KAAK,EAAE,cAAc,EACrB,UAAkB,EAClB,YAAY,EACZ,YAAwB,EACxB,SAAiB,EACjB,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,aAAa,EACb,aAAa,EAAE,iBAAiB,EAChC,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,eAAe,EAC5B,UAAU,EAAE,cAAc,EAC1B,aAAa,EAAE,iBAAiB,EAChC,aAAa,EAAE,MAAM,EACrB,GAAG,IAAI,EACR,EAAE,gBAAgB,qBAijBlB;yBAtkBe,WAAW"}
|
|
@@ -48,6 +48,7 @@ import { useLayerInternal } from "../Layer/useLayer.js";
|
|
|
48
48
|
import { LayerDepthProvider } from "../Layer/LayerDepthContext.js";
|
|
49
49
|
import { useLayerDismissal } from "../Layer/useLayerDismissal.js";
|
|
50
50
|
import { currentGesture } from "../Layer/gestureCounter.js";
|
|
51
|
+
import { noteOutsideDismissal } from "../Layer/outsidePress.js";
|
|
51
52
|
import { MenuBottomSheetActionList } from "../DropdownMenu/MenuBottomSheetActionList.js";
|
|
52
53
|
import { menuBottomSheetStyles } from "../DropdownMenu/menuBottomSheet.stylex.js";
|
|
53
54
|
import { renderDropdownItems } from "../DropdownMenu/renderDropdownItems.js";
|
|
@@ -386,6 +387,7 @@ export function ContextMenu({
|
|
|
386
387
|
return;
|
|
387
388
|
}
|
|
388
389
|
if (menu && !menu.contains(e.target)) {
|
|
390
|
+
noteOutsideDismissal(menu.ownerDocument);
|
|
389
391
|
closeMenu();
|
|
390
392
|
}
|
|
391
393
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
2
|
import { type InputStatus } from '../Field/index.js';
|
|
3
3
|
import { type ISODateString, type DayOfWeek, type DayOfWeekName } from '../Calendar/index.js';
|
|
4
|
+
import type { CalendarSystem } from '../utils/calendarSystem.js';
|
|
4
5
|
import type { TimestampFormat } from '../Timestamp/index.js';
|
|
5
6
|
import { type PickerPresentation } from '../utils/inputPresentation.js';
|
|
6
7
|
declare const sizeStyles: Readonly<{
|
|
@@ -136,7 +137,8 @@ export interface DateInputProps extends Omit<FieldInputBaseProps<HTMLInputElemen
|
|
|
136
137
|
*/
|
|
137
138
|
dateConstraints?: ReadonlyArray<(date: Date) => boolean>;
|
|
138
139
|
/**
|
|
139
|
-
* Placeholder text shown when no date is selected.
|
|
140
|
+
* Placeholder text shown when no date is selected. A caller placeholder
|
|
141
|
+
* replaces the calendar format hint.
|
|
140
142
|
* @default "Select a date"
|
|
141
143
|
*/
|
|
142
144
|
placeholder?: string;
|
|
@@ -202,9 +204,10 @@ export interface DateInputProps extends Omit<FieldInputBaseProps<HTMLInputElemen
|
|
|
202
204
|
* - `(value: ISODateString) => string`: fully custom display string
|
|
203
205
|
*
|
|
204
206
|
* Formatting applies only to the committed value — never to text the user is
|
|
205
|
-
* actively typing.
|
|
206
|
-
*
|
|
207
|
-
*
|
|
207
|
+
* actively typing. Named formats write the date in the field's `calendar`;
|
|
208
|
+
* `'system_date'` stays the Gregorian ISO date. A custom function's output
|
|
209
|
+
* that the field cannot read back can't be re-committed after an edit;
|
|
210
|
+
* external `value` changes always recompute the display from the ISO value.
|
|
208
211
|
*
|
|
209
212
|
* @default 'date_long'
|
|
210
213
|
* @example
|
|
@@ -219,6 +222,28 @@ export interface DateInputProps extends Omit<FieldInputBaseProps<HTMLInputElemen
|
|
|
219
222
|
* ```
|
|
220
223
|
*/
|
|
221
224
|
format?: DateInputFormat | ((value: ISODateString) => string);
|
|
225
|
+
/**
|
|
226
|
+
* The calendar the field shows dates in, such as `'persian'`, `'hebrew'`, or
|
|
227
|
+
* `'buddhist'`: the text field, its calendar popover, and the bottom sheet's
|
|
228
|
+
* months and wheels. `value`, `onChange`, `min`, and `max` stay Gregorian
|
|
229
|
+
* ISO dates in every calendar. People type a date the way the locale writes
|
|
230
|
+
* it in this calendar, and the committed text uses it.
|
|
231
|
+
* Years are years of this calendar, so a Buddhist field reads `2026` as
|
|
232
|
+
* Buddhist year 2026; set `min` and `max` to catch a year typed in the
|
|
233
|
+
* wrong calendar. Calendars other than `gregory`, `iso8601`, `buddhist`,
|
|
234
|
+
* `roc`, and `japanese` need `Temporal`, native or a polyfill the
|
|
235
|
+
* application loads; without it the field uses the Gregorian calendar.
|
|
236
|
+
* The native date control is Gregorian, so with a calendar other than
|
|
237
|
+
* `gregory` or `iso8601` every presentation that would show it uses the
|
|
238
|
+
* popover on a fine pointer and the bottom sheet on a coarse pointer.
|
|
239
|
+
*
|
|
240
|
+
* @default the InternationalizationProvider's calendar, else `'gregory'`
|
|
241
|
+
* @example
|
|
242
|
+
* ```
|
|
243
|
+
* <DateInput label="Start date" calendar="persian" value={date} onChange={setDate} />
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
calendar?: CalendarSystem;
|
|
222
247
|
/**
|
|
223
248
|
* When date picking is handed to the browser/OS instead of Astryx's own
|
|
224
249
|
* surfaces: the field becomes an `<input type="date">` and the platform
|
|
@@ -244,6 +269,9 @@ export interface DateInputProps extends Omit<FieldInputBaseProps<HTMLInputElemen
|
|
|
244
269
|
* picker. `dateConstraints` is enforced the same way, on commit, and is
|
|
245
270
|
* reason enough to prefer `'never'` on a field that uses it.
|
|
246
271
|
*
|
|
272
|
+
* In a calendar other than `gregory` or `iso8601`, `'touch'` and `'always'`
|
|
273
|
+
* use the calendar popover on a mouse and the touch picker on a finger.
|
|
274
|
+
*
|
|
247
275
|
* @default 'touch'
|
|
248
276
|
* @deprecated Use `presentation` (`spec:AST-043` FR3):
|
|
249
277
|
* `'touch'` → `'adaptive-native'`, `'always'` → `'native'`,
|
|
@@ -258,12 +286,15 @@ export interface DateInputProps extends Omit<FieldInputBaseProps<HTMLInputElemen
|
|
|
258
286
|
* - `'popover'`: Astryx's typed field + calendar popover on every pointer
|
|
259
287
|
* - `'bottom-sheet'`: Astryx's bottom-sheet calendar on every pointer
|
|
260
288
|
* - `'native'`: the browser/OS picker on every pointer, with no Astryx
|
|
261
|
-
* fallback (FR2)
|
|
289
|
+
* fallback (FR2), except in a calendar other than `gregory` or
|
|
290
|
+
* `iso8601`, where it is `'adaptive-bottom-sheet'` and warns in
|
|
291
|
+
* development
|
|
262
292
|
* - `'adaptive-bottom-sheet'`: popover on a fine pointer, bottom sheet on
|
|
263
293
|
* a coarse pointer
|
|
264
294
|
* - `'adaptive-native'` (default): popover on a fine pointer, browser/OS
|
|
265
295
|
* picker on a coarse pointer, keeping the released Astryx fallbacks
|
|
266
|
-
* where a native control cannot express the value (FR2)
|
|
296
|
+
* where a native control cannot express the value (FR2), and the bottom
|
|
297
|
+
* sheet in a calendar other than `gregory` or `iso8601`
|
|
267
298
|
*
|
|
268
299
|
* @default 'adaptive-native'
|
|
269
300
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/DateInput/DateInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/DateInput/DateInput.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAS3C,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;AAQlB,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,aAA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6BG;IACH,MAAM,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC,CAAC;IAE9D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC;AAojBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BA4C9C;yBA5Ce,SAAS"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file DateInput.tsx
|
|
7
|
-
* @input Uses React, useId,
|
|
7
|
+
* @input Uses React, useId, useCallback, useRef, useTypedDateField, Field, Icon, Calendar, usePopover, InputGroupContext
|
|
8
8
|
* @output Exports DateInput component, DateInputProps
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by DateInput.test.tsx
|
|
10
10
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - /apps/storybook/stories/DateInput.stories.tsx (storybook stories)
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/DateInput/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
-
import { use, useId,
|
|
18
|
+
import { use, useId, useCallback, useRef, useOptimistic, useTransition } from 'react';
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
20
|
import { inputDisabledFocusStyles } from "../Field/inputDisabledFocus.js";
|
|
21
21
|
import "../theme/tokens.stylex.js";
|
|
@@ -35,14 +35,16 @@ import { useBusyAnnouncement } from "../hooks/useBusyAnnouncement.js";
|
|
|
35
35
|
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
36
36
|
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
37
37
|
import { usePopover } from "../Popover/index.js";
|
|
38
|
-
import { isFocusInsideOwnedLayer, isPressInsideOwnedLayer, useOutsidePress } from "../Layer/outsidePress.js";
|
|
38
|
+
import { isFocusInsideOwnedLayer, isPressInsideOwnedLayer, noteOutsideDismissal, useOutsidePress } from "../Layer/outsidePress.js";
|
|
39
39
|
import { NativeDateField } from "./NativeDateField.js";
|
|
40
40
|
import { TouchDateField } from "./TouchDateField.js";
|
|
41
41
|
import { useTooltip } from "../Tooltip/index.js";
|
|
42
|
-
import { getInputARIA, isImeKeyEvent
|
|
42
|
+
import { getInputARIA, isImeKeyEvent } from "../utils/index.js";
|
|
43
43
|
import { chainEventHandlers } from "../utils/chainEventHandlers.js";
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
44
|
+
import { isRenderable } from "../utils/isRenderable.js";
|
|
45
|
+
import { useTypedDateField } from "./useTypedDate.js";
|
|
46
|
+
import { resolvePickerPresentation } from "../utils/inputPresentation.js";
|
|
47
|
+
import { useCalendarPresentation } from "./useCalendarPresentation.js";
|
|
46
48
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
47
49
|
const styles = {
|
|
48
50
|
iconButton: {
|
|
@@ -115,7 +117,6 @@ import { joinAriaIDs } from "../utils/inputAria.js";
|
|
|
115
117
|
import { useFieldInputStyling } from "../Field/fieldParts.js";
|
|
116
118
|
import { themeProps } from "../utils/themeProps.js";
|
|
117
119
|
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
118
|
-
import { useLocale } from "../i18n/index.js";
|
|
119
120
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
120
121
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
121
122
|
import english from "../i18n/generated-english/DateInput/DateInput.generated.js";
|
|
@@ -178,6 +179,7 @@ function PointerDateField({
|
|
|
178
179
|
numberOfMonths = 1,
|
|
179
180
|
weekStartsOn,
|
|
180
181
|
format = 'date_long',
|
|
182
|
+
calendar,
|
|
181
183
|
width,
|
|
182
184
|
containerXstyle,
|
|
183
185
|
containerClassName,
|
|
@@ -202,11 +204,11 @@ function PointerDateField({
|
|
|
202
204
|
'aria-labelledby': ariaLabelledByProp,
|
|
203
205
|
onBlur: onBlurProp,
|
|
204
206
|
onClick: onClickProp,
|
|
207
|
+
onFocus: onFocusProp,
|
|
205
208
|
onKeyDown: onKeyDownProp,
|
|
206
209
|
...controlProps
|
|
207
210
|
} = rest;
|
|
208
211
|
const t = useComponentTranslator();
|
|
209
|
-
const locale = useLocale();
|
|
210
212
|
const isEffectivelyRequired = useResolvedRequired({
|
|
211
213
|
isRequired,
|
|
212
214
|
isOptional
|
|
@@ -219,9 +221,9 @@ function PointerDateField({
|
|
|
219
221
|
const inputLabelID = useId();
|
|
220
222
|
const descriptionID = useId();
|
|
221
223
|
const statusMessageID = useId();
|
|
224
|
+
const calendarDescriptionID = useId();
|
|
222
225
|
const inputRef = useRef(null);
|
|
223
226
|
const calendarRef = useRef(null);
|
|
224
|
-
const lastFiredValueRef = useRef(undefined);
|
|
225
227
|
const inputGroup = useInputGroup();
|
|
226
228
|
const [, startTransition] = useTransition();
|
|
227
229
|
const [optimisticValue, setOptimisticValue] = useOptimistic(value);
|
|
@@ -255,51 +257,71 @@ function PointerDateField({
|
|
|
255
257
|
max,
|
|
256
258
|
dateConstraints
|
|
257
259
|
});
|
|
260
|
+
const fireChange = useCallback(newValue => {
|
|
261
|
+
if (isEffectivelyDisabled) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
onChange?.(newValue);
|
|
265
|
+
if (changeAction) {
|
|
266
|
+
startTransition(async () => {
|
|
267
|
+
setOptimisticValue(newValue);
|
|
268
|
+
await changeAction(newValue);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}, [isEffectivelyDisabled, onChange, changeAction, startTransition, setOptimisticValue]);
|
|
272
|
+
const clearTypedDate = useCallback(() => {
|
|
273
|
+
if (value !== undefined) {
|
|
274
|
+
fireChange(undefined);
|
|
275
|
+
}
|
|
276
|
+
}, [value, fireChange]);
|
|
277
|
+
const navigateToTypedDate = useCallback(date => {
|
|
278
|
+
calendarRef.current?.navigateTo(date);
|
|
279
|
+
}, []);
|
|
280
|
+
const {
|
|
281
|
+
typedDate,
|
|
282
|
+
displayValue,
|
|
283
|
+
formatHint,
|
|
284
|
+
isPending,
|
|
285
|
+
isInvalid,
|
|
286
|
+
fieldStatus,
|
|
287
|
+
alertMessage,
|
|
288
|
+
handleChange: handleTypedChange,
|
|
289
|
+
commit: commitPendingInput,
|
|
290
|
+
handleFocus,
|
|
291
|
+
handleBlur,
|
|
292
|
+
reset: resetTypedInput
|
|
293
|
+
} = useTypedDateField({
|
|
294
|
+
source: 'DateInput',
|
|
295
|
+
calendar,
|
|
296
|
+
format,
|
|
297
|
+
min,
|
|
298
|
+
max,
|
|
299
|
+
isDateDisabled,
|
|
300
|
+
value,
|
|
301
|
+
shownValue: optimisticValue,
|
|
302
|
+
onChange: fireChange,
|
|
303
|
+
onClear: clearTypedDate,
|
|
304
|
+
onTypedDate: navigateToTypedDate,
|
|
305
|
+
isDisabled: isEffectivelyDisabled,
|
|
306
|
+
status,
|
|
307
|
+
isStatusAnnounced: !inputGroup,
|
|
308
|
+
hasPlaceholder: placeholderFromProps != null
|
|
309
|
+
});
|
|
258
310
|
const {
|
|
259
311
|
statusIcon,
|
|
260
312
|
describedBy: statusTooltipDescribedBy
|
|
261
313
|
} = useInputStatusIcon({
|
|
262
|
-
status,
|
|
314
|
+
status: fieldStatus,
|
|
263
315
|
statusVariant,
|
|
264
316
|
isInGroup: !!inputGroup
|
|
265
317
|
});
|
|
266
318
|
const {
|
|
267
319
|
ariaLabelledBy,
|
|
268
320
|
ariaDescribedBy
|
|
269
|
-
} = getInputARIA(inputLabelID, [description ? descriptionID : null, statusVariant !== 'tooltip' &&
|
|
321
|
+
} = getInputARIA(inputLabelID, [description ? descriptionID : null, typedDate.calendarDescription != null ? calendarDescriptionID : null, statusVariant !== 'tooltip' && fieldStatus?.message ? statusMessageID : null,
|
|
270
322
|
// The tooltip variant renders no message box; describe the input by the
|
|
271
323
|
// tooltip's content instead so the status is still announced.
|
|
272
324
|
statusTooltipDescribedBy, showsDisabledMessage ? disabledMessageTooltip.describedBy : null, ariaDescribedByProp], inputGroup);
|
|
273
|
-
|
|
274
|
-
// Pending input while user is typing (null = show formatted value)
|
|
275
|
-
const [pendingInput, setPendingInput] = useState(null);
|
|
276
|
-
|
|
277
|
-
// Clear pending input when value changes externally (computed during render
|
|
278
|
-
// via prev-value ref instead of useEffect to avoid an extra render cycle)
|
|
279
|
-
const prevValueRef = useRef(value);
|
|
280
|
-
if (value !== prevValueRef.current) {
|
|
281
|
-
prevValueRef.current = value;
|
|
282
|
-
if (value !== lastFiredValueRef.current) {
|
|
283
|
-
lastFiredValueRef.current = undefined;
|
|
284
|
-
if (pendingInput !== null) {
|
|
285
|
-
setPendingInput(null);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// Format a committed ISO value for display. The default `date_long` renders
|
|
291
|
-
// the long-month shape (byte-identical to the historical hardcoded
|
|
292
|
-
// DATE_FORMAT_LONG rendering, so still non-breaking); a function is called
|
|
293
|
-
// with the ISO value; every other named member reuses Timestamp's shared
|
|
294
|
-
// date mapping. Applies ONLY to the committed value, never to in-progress
|
|
295
|
-
// typed input.
|
|
296
|
-
const formatCommittedValue = useCallback(iso => typeof format === 'function' ? format(iso) : formatSharedDate(plainDateFromISO(iso), format, locale), [format, locale]);
|
|
297
|
-
|
|
298
|
-
// Display value: pending input if typing, otherwise formatted value
|
|
299
|
-
const displayValue = pendingInput !== null ? pendingInput : optimisticValue && /^\d{4}-\d{2}-\d{2}$/.test(optimisticValue) ? formatCommittedValue(optimisticValue) : '';
|
|
300
|
-
|
|
301
|
-
// Check if current input is valid (for styling purposes)
|
|
302
|
-
const isInputValid = pendingInput === null || !pendingInput.trim() ? true : parseDateInput(pendingInput, locale) !== null;
|
|
303
325
|
const fieldElementRef = useRef(null);
|
|
304
326
|
// Set just before a close that focus already left the field for, so onHide
|
|
305
327
|
// does not pull focus back to the input.
|
|
@@ -359,20 +381,6 @@ function PointerDateField({
|
|
|
359
381
|
}
|
|
360
382
|
}, [isEffectivelyDisabled, popover]);
|
|
361
383
|
|
|
362
|
-
// Unified change handler that fires both onChange and changeAction
|
|
363
|
-
const fireChange = useCallback(newValue => {
|
|
364
|
-
if (isEffectivelyDisabled) {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
onChange?.(newValue);
|
|
368
|
-
if (changeAction) {
|
|
369
|
-
startTransition(async () => {
|
|
370
|
-
setOptimisticValue(newValue);
|
|
371
|
-
await changeAction(newValue);
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
}, [isEffectivelyDisabled, onChange, changeAction, startTransition, setOptimisticValue]);
|
|
375
|
-
|
|
376
384
|
// Handle clear button click
|
|
377
385
|
const handleClear = useCallback(e => {
|
|
378
386
|
fireChange(undefined);
|
|
@@ -397,62 +405,12 @@ function PointerDateField({
|
|
|
397
405
|
return;
|
|
398
406
|
}
|
|
399
407
|
fireChange(selectedDate);
|
|
400
|
-
|
|
408
|
+
resetTypedInput();
|
|
401
409
|
popover.hide();
|
|
402
|
-
}, [isDisabled, fireChange, popover]);
|
|
403
|
-
|
|
404
|
-
// Handle input text change - update immediately if valid and allowed
|
|
410
|
+
}, [isDisabled, fireChange, resetTypedInput, popover]);
|
|
405
411
|
const handleInputChange = useCallback(e => {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (isEffectivelyDisabled) {
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
const newValue = e.target.value;
|
|
412
|
-
setPendingInput(newValue);
|
|
413
|
-
|
|
414
|
-
// If the input is valid and passes constraints, update immediately
|
|
415
|
-
const parsed = parseDateInput(newValue, locale);
|
|
416
|
-
if (parsed && plainDateToISO(parsed) !== value && !isDateDisabled(parsed)) {
|
|
417
|
-
const parsedISO = plainDateToISO(parsed);
|
|
418
|
-
lastFiredValueRef.current = parsedISO;
|
|
419
|
-
fireChange(parsedISO);
|
|
420
|
-
// Navigate calendar to show the parsed date's month
|
|
421
|
-
calendarRef.current?.navigateTo(parsedISO);
|
|
422
|
-
}
|
|
423
|
-
}, [value, fireChange, isDateDisabled, isEffectivelyDisabled, locale]);
|
|
424
|
-
|
|
425
|
-
// Commit pending input (shared by blur and Enter key)
|
|
426
|
-
const commitPendingInput = useCallback(() => {
|
|
427
|
-
if (pendingInput === null) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
// Disabled or busy: keep the value, drop the draft (spec:AST-085 FR2).
|
|
431
|
-
if (isEffectivelyDisabled) {
|
|
432
|
-
setPendingInput(null);
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
if (!pendingInput.trim()) {
|
|
436
|
-
if (value !== undefined) {
|
|
437
|
-
fireChange(undefined);
|
|
438
|
-
}
|
|
439
|
-
setPendingInput(null);
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
const parsed = parseDateInput(pendingInput, locale);
|
|
443
|
-
if (parsed && !isDateDisabled(parsed)) {
|
|
444
|
-
const parsedISO = plainDateToISO(parsed);
|
|
445
|
-
if (parsedISO !== value) {
|
|
446
|
-
fireChange(parsedISO);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
setPendingInput(null);
|
|
450
|
-
}, [pendingInput, isEffectivelyDisabled, value, fireChange, isDateDisabled, locale]);
|
|
451
|
-
|
|
452
|
-
// Handle blur - validate, check constraints, and clear pending input.
|
|
453
|
-
const handleBlur = useCallback(() => {
|
|
454
|
-
commitPendingInput();
|
|
455
|
-
}, [commitPendingInput]);
|
|
412
|
+
handleTypedChange(e.target.value);
|
|
413
|
+
}, [handleTypedChange]);
|
|
456
414
|
|
|
457
415
|
// A manual popover has no auto-popover exclusivity, so without this close
|
|
458
416
|
// the next field's calendar would open beside this one. Focus going nowhere
|
|
@@ -463,6 +421,7 @@ function PointerDateField({
|
|
|
463
421
|
return;
|
|
464
422
|
}
|
|
465
423
|
isFocusMovingAwayRef.current = true;
|
|
424
|
+
noteOutsideDismissal(e.currentTarget.ownerDocument);
|
|
466
425
|
popover.hide();
|
|
467
426
|
}, [popover]);
|
|
468
427
|
|
|
@@ -488,14 +447,14 @@ function PointerDateField({
|
|
|
488
447
|
skipAutoFocus: true
|
|
489
448
|
});
|
|
490
449
|
}
|
|
491
|
-
} else if (e.key === 'Enter' && (
|
|
450
|
+
} else if (e.key === 'Enter' && (isPending || isEffectivelyDisabled)) {
|
|
492
451
|
// Typed text holds Enter back, or a form would submit the value from
|
|
493
452
|
// before the commit. A disabled or busy field must not submit its
|
|
494
453
|
// form either. Otherwise Enter keeps its default, as in any text field.
|
|
495
454
|
e.preventDefault();
|
|
496
455
|
commitPendingInput();
|
|
497
456
|
}
|
|
498
|
-
}, [popover, commitPendingInput, isEffectivelyDisabled,
|
|
457
|
+
}, [popover, commitPendingInput, isEffectivelyDisabled, isPending]);
|
|
499
458
|
const inputWrapper = /*#__PURE__*/_jsxs("div", {
|
|
500
459
|
ref: el => {
|
|
501
460
|
fieldElementRef.current = el;
|
|
@@ -509,13 +468,13 @@ function PointerDateField({
|
|
|
509
468
|
...(inputGroup ? inputGroupItemProps : undefined),
|
|
510
469
|
...mergeProps(themeProps('date-input', {
|
|
511
470
|
size,
|
|
512
|
-
status:
|
|
471
|
+
status: fieldStatus?.type ?? null,
|
|
513
472
|
disabled: isDisabled ? 'disabled' : null
|
|
514
473
|
}), stylex.props(inputWrapperStyles.base, sizeStyles[size],
|
|
515
474
|
// Disabled paint belongs to the disabled state only; a busy field
|
|
516
475
|
// keeps its ordinary paint and shows the Spinner (spec:AST-085
|
|
517
476
|
// FR6, family:buttons FR4).
|
|
518
|
-
isDisabled && inputWrapperStyles.disabled, isEffectivelyDisabled && inputDisabledFocusStyles.inputFocusRing,
|
|
477
|
+
isDisabled && inputWrapperStyles.disabled, isEffectivelyDisabled && inputDisabledFocusStyles.inputFocusRing, fieldStatus && inputStatusBorderStyles[fieldStatus.type], fieldStatus && !isEffectivelyDisabled && inputStatusHoverShadowStyles[fieldStatus.type], fieldStatus && inputStatusFocusWithinStyles[fieldStatus.type], inputGroup && groupStyles.inGroup, controlXstyle), controlClassName, controlStyle),
|
|
519
478
|
children: [inputGroup && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
520
479
|
id: inputLabelID,
|
|
521
480
|
children: label
|
|
@@ -552,15 +511,16 @@ function PointerDateField({
|
|
|
552
511
|
value: displayValue,
|
|
553
512
|
onChange: handleInputChange,
|
|
554
513
|
onBlur: chainEventHandlers(handleBlur, onBlurProp),
|
|
514
|
+
onFocus: chainEventHandlers(handleFocus, onFocusProp),
|
|
555
515
|
onClick: isEffectivelyDisabled ? undefined : chainEventHandlers(handleInputClick, onClickProp),
|
|
556
516
|
onKeyDown: chainEventHandlers(handleInputKeyDown, onKeyDownProp),
|
|
557
|
-
placeholder: placeholder,
|
|
517
|
+
placeholder: formatHint ?? placeholder,
|
|
558
518
|
"aria-disabled": isEffectivelyDisabled ? 'true' : undefined,
|
|
559
519
|
readOnly: isEffectivelyDisabled || undefined,
|
|
560
520
|
"aria-labelledby": ariaLabelledByProp != null ? joinAriaIDs(ariaLabelledBy ?? fieldLabelID, ariaLabelledByProp) : ariaLabelledBy,
|
|
561
521
|
"aria-describedby": ariaDescribedBy,
|
|
562
522
|
"aria-required": isEffectivelyRequired ? 'true' : undefined,
|
|
563
|
-
"aria-invalid":
|
|
523
|
+
"aria-invalid": fieldStatus?.type === 'error' || isInvalid ? 'true' : undefined,
|
|
564
524
|
"aria-busy": isBusy || undefined,
|
|
565
525
|
"aria-expanded": popover.isOpen,
|
|
566
526
|
"aria-haspopup": "dialog",
|
|
@@ -580,12 +540,15 @@ function PointerDateField({
|
|
|
580
540
|
3: {
|
|
581
541
|
className: "x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 xf9zqsd xw6l6zx xjbqb8w x1a2a7pz xeyghm5 xt0e3qv xv1l7n4"
|
|
582
542
|
}
|
|
583
|
-
}[!!isEffectivelyDisabled << 1 |
|
|
543
|
+
}[!!isEffectivelyDisabled << 1 | !!isInvalid << 0]
|
|
584
544
|
}), /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
585
545
|
as: "div",
|
|
586
546
|
role: "alert",
|
|
587
547
|
"aria-live": "assertive",
|
|
588
|
-
children:
|
|
548
|
+
children: alertMessage
|
|
549
|
+
}), isRenderable(typedDate.calendarDescription) && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
550
|
+
id: calendarDescriptionID,
|
|
551
|
+
children: typedDate.calendarDescription
|
|
589
552
|
}), hasClear && value !== undefined && !isEffectivelyDisabled && /*#__PURE__*/_jsx(InputClearButton, {
|
|
590
553
|
label: t('@astryx.dateInput.clear', {
|
|
591
554
|
label
|
|
@@ -597,11 +560,9 @@ function PointerDateField({
|
|
|
597
560
|
}), statusIcon, popover.render(
|
|
598
561
|
// The layer renders its children open or closed, so mount the
|
|
599
562
|
// calendar only while it is open; it opens on the current value.
|
|
600
|
-
!popover.isOpen ? null : /*#__PURE__*/_jsx(Calendar
|
|
601
|
-
// The field text is Gregorian, so the popover calendar is too.
|
|
602
|
-
, {
|
|
603
|
-
calendar: "gregory",
|
|
563
|
+
!popover.isOpen ? null : /*#__PURE__*/_jsx(Calendar, {
|
|
604
564
|
handleRef: calendarRef,
|
|
565
|
+
calendar: typedDate.calendar,
|
|
605
566
|
mode: "single",
|
|
606
567
|
value: optimisticValue ?? null,
|
|
607
568
|
onChange: handleDateSelect,
|
|
@@ -629,10 +590,10 @@ function PointerDateField({
|
|
|
629
590
|
isOptional: isOptional,
|
|
630
591
|
isRequired: isRequired,
|
|
631
592
|
isDisabled: isDisabled,
|
|
632
|
-
status:
|
|
633
|
-
type:
|
|
634
|
-
message:
|
|
635
|
-
messageID:
|
|
593
|
+
status: fieldStatus ? {
|
|
594
|
+
type: fieldStatus.type,
|
|
595
|
+
message: fieldStatus.message,
|
|
596
|
+
messageID: fieldStatus.message ? statusMessageID : undefined
|
|
636
597
|
} : undefined,
|
|
637
598
|
statusVariant: statusVariant,
|
|
638
599
|
labelTooltip: labelTooltip,
|
|
@@ -693,10 +654,15 @@ export function DateInput(props) {
|
|
|
693
654
|
const isDisabled = props.isDisabled || inputGroupState.isDisabled;
|
|
694
655
|
const isTouch = useMediaQuery(TOUCH_POINTER_QUERY);
|
|
695
656
|
useDevWarning('DateInput', '`nativePicker` is deprecated; use `presentation` instead (`touch` → `adaptive-native`, `always` → `native`, `never` → `adaptive-bottom-sheet`). `presentation` wins when both are set.', props.nativePicker !== undefined);
|
|
696
|
-
const
|
|
657
|
+
const {
|
|
658
|
+
calendar,
|
|
659
|
+
presentation
|
|
660
|
+
} = useCalendarPresentation('DateInput', props.calendar, props.presentation, props.nativePicker);
|
|
661
|
+
const surface = resolvePickerPresentation(presentation, isTouch);
|
|
697
662
|
const {
|
|
698
663
|
presentation: _presentation,
|
|
699
664
|
nativePicker: _nativePicker,
|
|
665
|
+
calendar: _calendar,
|
|
700
666
|
...rest
|
|
701
667
|
} = props;
|
|
702
668
|
switch (surface) {
|
|
@@ -706,13 +672,17 @@ export function DateInput(props) {
|
|
|
706
672
|
isDisabled: isDisabled
|
|
707
673
|
});
|
|
708
674
|
case 'sheet':
|
|
709
|
-
return /*#__PURE__*/_jsx(TouchDateField
|
|
675
|
+
return /*#__PURE__*/_jsx(TouchDateField
|
|
676
|
+
// Month indexes depend on the calendar. A new calendar remounts the sheet.
|
|
677
|
+
, {
|
|
710
678
|
...rest,
|
|
679
|
+
calendar: calendar,
|
|
711
680
|
isDisabled: isDisabled
|
|
712
|
-
});
|
|
681
|
+
}, calendar);
|
|
713
682
|
case 'desktop':
|
|
714
683
|
return /*#__PURE__*/_jsx(PointerDateField, {
|
|
715
684
|
...rest,
|
|
685
|
+
calendar: calendar,
|
|
716
686
|
isDisabled: isDisabled
|
|
717
687
|
});
|
|
718
688
|
}
|