@astryxdesign/core 0.7.16-canary.ge95b87c → 0.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +90 -0
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +38 -88
- package/dist/BottomSheet/BottomSheetPanel.d.ts +14 -6
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +26 -14
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +78 -3
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +3 -0
- package/dist/DateInput/DateInput.d.ts +24 -0
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +12 -5
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.d.ts +12 -5
- package/dist/DateInput/useTypedDate.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.js +18 -16
- package/dist/DateTimeInput/DateTimeInput.d.ts +25 -0
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +10 -3
- package/dist/DateTimeInput/NativeTimeSegment.d.ts +3 -1
- package/dist/DateTimeInput/NativeTimeSegment.d.ts.map +1 -1
- package/dist/DateTimeInput/NativeTimeSegment.js +10 -1
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -0
- 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/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/Layer/inputHold.d.ts +11 -1
- package/dist/Layer/inputHold.d.ts.map +1 -1
- package/dist/Layer/inputHold.js +114 -2
- package/dist/Layer/layerEntranceSide.d.ts.map +1 -1
- package/dist/Layer/layerEntranceSide.js +2 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +63 -148
- package/dist/Lightbox/useZoomCore.d.ts +2 -13
- package/dist/Lightbox/useZoomCore.d.ts.map +1 -1
- package/dist/Lightbox/useZoomCore.js +7 -33
- package/dist/Lightbox/useZoomStage.d.ts.map +1 -1
- package/dist/Lightbox/useZoomStage.js +3 -9
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +7 -0
- package/dist/MetadataList/MetadataList.d.ts +2 -1
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +1 -1
- package/dist/NumberInput/NumberInput.d.ts +20 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +4 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromDOM.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromDOM.js +1 -0
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +1 -0
- package/dist/Popover/popoverSurfaceFrame.d.ts +4 -16
- package/dist/Popover/popoverSurfaceFrame.d.ts.map +1 -1
- package/dist/Popover/popoverSurfaceFrame.js +16 -31
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +3 -0
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +4 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedTouchTracking.js +18 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +0 -2
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +2 -0
- package/dist/Thumbnail/Thumbnail.d.ts +2 -2
- package/dist/TimeInput/TimeInput.d.ts +24 -4
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +10 -4
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.d.ts.map +1 -1
- package/dist/TimeInput/useTypedTime.d.ts +17 -6
- package/dist/TimeInput/useTypedTime.d.ts.map +1 -1
- package/dist/TimeInput/useTypedTime.js +41 -18
- package/dist/Toast/Toast.d.ts +6 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +17 -1
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +10 -9
- package/dist/astryx.css +36 -6
- package/dist/hooks/containerReveal.stylex.d.ts.map +1 -1
- package/dist/hooks/containerReveal.stylex.js +18 -15
- package/dist/hooks/useAnnounceRenderedText.d.ts +9 -3
- package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
- package/dist/hooks/useAnnounceRenderedText.js +9 -7
- package/dist/hooks/useContainerReveal.d.ts +8 -5
- package/dist/hooks/useContainerReveal.d.ts.map +1 -1
- package/dist/hooks/useContainerReveal.js +2 -1
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +1 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
- package/dist/internal/shared-context.d.ts +15 -0
- package/dist/internal/shared-context.d.ts.map +1 -0
- package/dist/internal/shared-context.js +15 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +2 -17
- package/dist/motion/linearEasing.d.ts +9 -0
- package/dist/motion/linearEasing.d.ts.map +1 -0
- package/dist/motion/linearEasing.js +32 -0
- package/dist/motion/resolveMotion.d.ts +16 -0
- package/dist/motion/resolveMotion.d.ts.map +1 -1
- package/dist/motion/resolveMotion.js +40 -1
- package/locales/en.json +15 -11
- package/locales/pseudo.json +3 -0
- package/package.json +10 -5
- package/src/BottomSheet/BottomSheet.tsx +43 -101
- package/src/BottomSheet/BottomSheetPanel.tsx +46 -23
- package/src/Button/Button.tsx +132 -5
- package/src/Chat/ChatComposerInput.tsx +4 -0
- package/src/ContextMenu/ContextMenu.tsx +13 -0
- package/src/DateInput/DateInput.doc.mjs +18 -0
- package/src/DateInput/DateInput.tsx +35 -3
- package/src/DateInput/index.ts +1 -0
- package/src/DateInput/useTypedDate.ts +50 -12
- package/src/DateTimeInput/DateTimeInput.doc.mjs +18 -0
- package/src/DateTimeInput/DateTimeInput.tsx +38 -2
- package/src/DateTimeInput/NativeTimeSegment.tsx +16 -1
- package/src/DateTimeInput/index.ts +1 -0
- package/src/Dialog/Dialog.tsx +13 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +13 -0
- package/src/Field/useEntryErrorBehavior.ts +34 -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/Layer/inputHold.ts +137 -2
- package/src/Layer/layerEntranceSide.ts +2 -1
- package/src/Lightbox/Lightbox.doc.mjs +1 -1
- package/src/Lightbox/Lightbox.tsx +226 -357
- package/src/Lightbox/useZoomCore.ts +6 -49
- package/src/Lightbox/useZoomStage.ts +7 -17
- package/src/Markdown/Markdown.tsx +6 -0
- package/src/MetadataList/MetadataList.doc.mjs +16 -0
- package/src/MetadataList/MetadataList.tsx +3 -2
- package/src/NumberInput/NumberInput.doc.mjs +18 -0
- package/src/NumberInput/NumberInput.tsx +22 -1
- package/src/NumberInput/index.ts +1 -0
- package/src/Outline/useOutlineFromDOM.doc.mjs +99 -0
- package/src/Outline/useOutlineFromDOM.ts +1 -0
- package/src/Pagination/Pagination.tsx +1 -0
- package/src/Popover/popoverSurfaceFrame.ts +18 -41
- package/src/Popover/usePopover.tsx +13 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +4 -0
- package/src/SegmentedControl/useSegmentedTouchTracking.ts +15 -0
- package/src/Selector/Selector.tsx +0 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +2 -0
- package/src/Thumbnail/Thumbnail.doc.mjs +2 -2
- package/src/Thumbnail/Thumbnail.tsx +2 -2
- package/src/TimeInput/TimeInput.doc.mjs +21 -3
- package/src/TimeInput/TimeInput.tsx +38 -8
- package/src/TimeInput/index.ts +1 -0
- package/src/TimeInput/useTypedTime.ts +60 -18
- package/src/Toast/Toast.tsx +33 -2
- package/src/Toast/ToastViewport.tsx +14 -9
- package/src/hooks/containerReveal.stylex.ts +17 -15
- package/src/hooks/useAnnounceRenderedText.ts +18 -6
- package/src/hooks/useContainerReveal.doc.mjs +3 -3
- package/src/hooks/useContainerReveal.ts +8 -5
- package/src/i18n/generated-locales/en.generated.ts +1 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
- package/src/internal/shared-context.ts +15 -0
- package/src/motion/README.md +1 -0
- package/src/motion/animatedLayout.ts +6 -21
- package/src/motion/linearEasing.ts +35 -0
- package/src/motion/resolveMotion.ts +42 -1
package/dist/Button/Button.js
CHANGED
|
@@ -250,8 +250,6 @@ const variants = {
|
|
|
250
250
|
destructive: {
|
|
251
251
|
kWkggS: "x1pjz0fi",
|
|
252
252
|
kMwMTN: "x1m024r3",
|
|
253
|
-
kMzoRj: "xc342km x13rsnn2",
|
|
254
|
-
ksu8eU: "xng3xce xx61lck",
|
|
255
253
|
kVAM5u: "x1w1tqly",
|
|
256
254
|
kjBf7l: "x1e0x2sz",
|
|
257
255
|
$$css: true
|
|
@@ -362,6 +360,82 @@ const groupStyles = {
|
|
|
362
360
|
}
|
|
363
361
|
};
|
|
364
362
|
|
|
363
|
+
/**
|
|
364
|
+
* A solid variant's edge in forced colors. These variants separate themselves
|
|
365
|
+
* from the page with a fill alone and have no border; forced colors discards
|
|
366
|
+
* the fill, which would leave plain text with no perceivable boundary
|
|
367
|
+
* (WCAG 1.4.11). `ButtonText` is the platform's own button edge. `ghost` is
|
|
368
|
+
* flat by design and keeps none.
|
|
369
|
+
*
|
|
370
|
+
* Outside forced colors a standalone button keeps the base's borderless
|
|
371
|
+
* values, and a grouped button's longhands are `null`, so the group's own
|
|
372
|
+
* values stay. A grouped button gets only the longhands its group does not own: the group's
|
|
373
|
+
* dividers stay where they are under both StyleX style resolutions, and the
|
|
374
|
+
* group's first and last buttons close its outer edge.
|
|
375
|
+
*/
|
|
376
|
+
const FORCED_COLORS = '@media (forced-colors: active)';
|
|
377
|
+
const forcedColorsEdge = {
|
|
378
|
+
standalone: {
|
|
379
|
+
kMzoRj: "xc342km x13rsnn2",
|
|
380
|
+
ksu8eU: "xng3xce xx61lck",
|
|
381
|
+
kVAM5u: "x1ylmb6m",
|
|
382
|
+
$$css: true
|
|
383
|
+
},
|
|
384
|
+
groupHorizontal: {
|
|
385
|
+
kEafiO: "x1lym3mf",
|
|
386
|
+
kPef9Z: "x4z998w",
|
|
387
|
+
kt9PQ7: "x15anc7y",
|
|
388
|
+
kfdmCh: "xe3zi7u",
|
|
389
|
+
k2ei4v: "xgbv0en x1pjv70x xnvtw6h",
|
|
390
|
+
kVhnKS: "x1t7ytsu xyf0ibl x1jd14un",
|
|
391
|
+
ke9TFa: "x1s1fdp0",
|
|
392
|
+
k8ry5P: "x1nzwmfm",
|
|
393
|
+
$$css: true
|
|
394
|
+
},
|
|
395
|
+
groupVertical: {
|
|
396
|
+
k2ei4v: "xjg5lhu",
|
|
397
|
+
kVhnKS: "x1gbqego",
|
|
398
|
+
ke9TFa: "xmzn1mo",
|
|
399
|
+
k8ry5P: "xf1j0q2",
|
|
400
|
+
kEafiO: "x11xkdxz x1g31smg x1qvjua",
|
|
401
|
+
kPef9Z: "x13fuv20 x1d9v4yf xz5oem8",
|
|
402
|
+
kt9PQ7: "x12u9vjp",
|
|
403
|
+
kfdmCh: "xoqbfsn",
|
|
404
|
+
$$css: true
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
// The color of a grouped button's forced-colors edge: `destructive` takes
|
|
409
|
+
// `CanvasText`, the others `ButtonText`. These are the same longhands the
|
|
410
|
+
// edge sets, so the color holds whichever order a build puts shorthands and
|
|
411
|
+
// longhands in.
|
|
412
|
+
const forcedColorsEdgeColor = {
|
|
413
|
+
horizontal: {
|
|
414
|
+
kLZC3w: "xnvbotg",
|
|
415
|
+
kL6WhQ: "xaj2e6u",
|
|
416
|
+
kBCPoo: "xcy1b24",
|
|
417
|
+
$$css: true
|
|
418
|
+
},
|
|
419
|
+
horizontalOnError: {
|
|
420
|
+
kLZC3w: "x19dwuzr",
|
|
421
|
+
kL6WhQ: "xszdk7l",
|
|
422
|
+
kBCPoo: "x1nw5ucf",
|
|
423
|
+
$$css: true
|
|
424
|
+
},
|
|
425
|
+
vertical: {
|
|
426
|
+
kGJrpR: "x1hbxdp3",
|
|
427
|
+
kBCPoo: "xhdp0qd",
|
|
428
|
+
kL6WhQ: "xlkh95r",
|
|
429
|
+
$$css: true
|
|
430
|
+
},
|
|
431
|
+
verticalOnError: {
|
|
432
|
+
kGJrpR: "xjslfuv",
|
|
433
|
+
kBCPoo: "x1x0u81l",
|
|
434
|
+
kL6WhQ: "x2ab8f3",
|
|
435
|
+
$$css: true
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
|
|
365
439
|
/**
|
|
366
440
|
* Whether `node` adds nothing to a content name: nothing renders, or an Icon
|
|
367
441
|
* with no label. Any other node can add text.
|
|
@@ -435,6 +509,7 @@ export function Button({
|
|
|
435
509
|
const t = useComponentTranslator();
|
|
436
510
|
const size = useSize(sizeProp, 'md');
|
|
437
511
|
const buttonGroup = useButtonGroup();
|
|
512
|
+
const isSolidVariant = variant === 'primary' || variant === 'secondary' || variant === 'destructive';
|
|
438
513
|
// A tracking group's tracker paints this button's pointer press. A menu
|
|
439
514
|
// trigger is not tracked: it keeps its own press and opening.
|
|
440
515
|
const groupPointers = use(PressGroupContext);
|
|
@@ -560,7 +635,7 @@ export function Button({
|
|
|
560
635
|
rowPressLayerStyles.cell, rowPressLayerStyles.cellOnImage, controlPressLayerStyles.control, isGroupTracked && styles.trackedOverlay, buttonDisabled && styles.inactive, isTrueDisabled && styles.disabled, buttonDisabled && styles.ariaDisabled, renderAsLink && styles.link, !buttonGroup && (isGroupTracked ? styles.pressableTracked : styles.pressable), buttonGroup && (buttonGroup.orientation === 'horizontal' ? groupStyles.horizontal : groupStyles.vertical), inputGroup != null && buttonGroup == null && inputGroupStyles.buttonAddon, buttonGroup && (variant === 'primary' || variant === 'destructive') && (buttonGroup.orientation === 'horizontal' ? groupStyles.onSolidHorizontal : groupStyles.onSolidVertical),
|
|
561
636
|
// Standalone floating buttons only — a grouped button's elevation is owned
|
|
562
637
|
// by the ButtonGroup so the shared surface lifts as one unit.
|
|
563
|
-
!buttonGroup && elevationStyles[elevation], width != null && dynamicStyles.width(width),
|
|
638
|
+
!buttonGroup && elevationStyles[elevation], width != null && dynamicStyles.width(width), isSolidVariant && (buttonGroup == null ? forcedColorsEdge.standalone : buttonGroup.orientation === 'horizontal' ? forcedColorsEdge.groupHorizontal : forcedColorsEdge.groupVertical), isSolidVariant && buttonGroup != null && (buttonGroup.orientation === 'horizontal' ? variant === 'destructive' ? forcedColorsEdgeColor.horizontalOnError : forcedColorsEdgeColor.horizontal : variant === 'destructive' ? forcedColorsEdgeColor.verticalOnError : forcedColorsEdgeColor.vertical),
|
|
564
639
|
// AFTER the shared focus outline: the outline supplies width/style/offset
|
|
565
640
|
// for every variant, and `destructive` re-colors just the ring to match
|
|
566
641
|
// its own surface. Ordering is the mechanism — StyleX is last-wins.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatComposerInput.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatComposerInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAqBrE,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAQ,KAAK,UAAU,EAAC,MAAM,UAAU,CAAC;AAQhD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAa3D,mEAAmE;AACnE,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,WAAW,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,MAAM,GAAG,SAAS,CAAC;IAC9D,6EAA6E;IAC7E,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uDAAuD;IACvD,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,sBAAsB;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,MAAM,CAAC;CAC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AK,EAAE,sBAAsB,+BA8lB9D;yBA9lBe,iBAAiB;;;AAsmBjC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,+BAkB5E;yBAlBe,wBAAwB"}
|
|
@@ -636,7 +636,7 @@ export function ChatComposerInput(props) {
|
|
|
636
636
|
...editorAriaProps,
|
|
637
637
|
"aria-disabled": isDisabled || undefined,
|
|
638
638
|
...mergeProps({
|
|
639
|
-
className: "x1a2a7pz x126k92a x13faqbe x1odjw0f xjm74w1 xf9zqsd x19v9tvf x9ynric x1tgivj0 xxugrtn x7a5moj"
|
|
639
|
+
className: "xe0957l x1a2a7pz x126k92a x13faqbe x1odjw0f xjm74w1 xf9zqsd x19v9tvf x9ynric x1tgivj0 xxugrtn x7a5moj"
|
|
640
640
|
}, {
|
|
641
641
|
style: {
|
|
642
642
|
maxHeight: `${maxHeight}px`
|
|
@@ -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;AA0CrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../src/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AA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AAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,oBAAqB,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,qBAwjBlB;yBA7kBe,WAAW"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import type { EntryErrorBehavior } from '../FormLayout/FormLayoutContext.js';
|
|
2
3
|
import { type InputStatus } from '../Field/index.js';
|
|
3
4
|
import { type ISODateString, type DayOfWeek, type DayOfWeekName } from '../Calendar/index.js';
|
|
4
5
|
import type { CalendarSystem } from '../utils/calendarSystem.js';
|
|
@@ -50,6 +51,7 @@ export type DateInputPresentation = PickerPresentation;
|
|
|
50
51
|
export type DateInputFormat = Extract<TimestampFormat, 'date' | 'date_long' | 'date_weekday' | 'system_date'>;
|
|
51
52
|
export type { InputStatus as DateInputStatus, InputStatusType as DateInputStatusType, } from '../Field/index.js';
|
|
52
53
|
export type { DateInputEntryError } from './useTypedDate.js';
|
|
54
|
+
export type { EntryErrorBehavior } from '../FormLayout/FormLayoutContext.js';
|
|
53
55
|
import { type FieldInputBaseProps } from '../Field/fieldParts.js';
|
|
54
56
|
import type { SizeValue } from '../utils/types.js';
|
|
55
57
|
import type { FieldStatusPlacement } from '../Field/fieldStatusPlacement.js';
|
|
@@ -199,6 +201,28 @@ export interface DateInputProps extends Omit<FieldInputBaseProps<HTMLInputElemen
|
|
|
199
201
|
* ```
|
|
200
202
|
*/
|
|
201
203
|
onEntryErrorChange?: (error: DateInputEntryError | null) => void;
|
|
204
|
+
/**
|
|
205
|
+
* When the field shows its own entry error: a typed date that it rejects,
|
|
206
|
+
* which `onEntryErrorChange` reports. It sets when the error shows, not when
|
|
207
|
+
* validation runs, so it is not React Aria's `validationBehavior` (native
|
|
208
|
+
* versus ARIA validation). It does not change a caller's `status`.
|
|
209
|
+
*
|
|
210
|
+
* - `'complete'` — a date the calendar does not have, or one outside `min`,
|
|
211
|
+
* `max`, or `dateConstraints`, shows as soon as the typed date is
|
|
212
|
+
* complete. Unreadable or unfinished text shows at Enter or blur.
|
|
213
|
+
* - `'blur-or-enter'` — every rejection waits for Enter or blur. The
|
|
214
|
+
* message, `aria-invalid`, the invalid styling, the announcement, and the
|
|
215
|
+
* `onEntryErrorChange` report then appear together. An edit that makes
|
|
216
|
+
* the text a date or empties it clears the error at once. An edit that
|
|
217
|
+
* leaves the text wrong keeps the shown error until the next Enter or
|
|
218
|
+
* blur.
|
|
219
|
+
*
|
|
220
|
+
* A date that the native control refuses shows at Enter or blur under both
|
|
221
|
+
* values.
|
|
222
|
+
*
|
|
223
|
+
* @default the nearest FormLayout's `defaultEntryErrorBehavior`, else `'complete'`
|
|
224
|
+
*/
|
|
225
|
+
entryErrorBehavior?: EntryErrorBehavior;
|
|
202
226
|
/**
|
|
203
227
|
* How the status message is placed relative to the input.
|
|
204
228
|
* - 'attached': message overlaps directly below the input (bordered treatment)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/DateInput/DateInput.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/DateInput/DateInput.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AAQxE,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;AAQlB,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAkBrB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAC,KAAK,mBAAmB,EAAoB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAwDpC,QAAA,MAAM,UAAU;;;;;;;;;;;;;EAad,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,UAAU,CAAC;AAEpD;;;;;;;;;;;;;GAaG;AACH;;;;;;;;GAQG;AACH,iFAAiF;AACjF,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjE,8FAA8F;AAC9F,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,eAAe,EACf,MAAM,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,CACtD,CAAC;AAIF,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,eAAe,IAAI,mBAAmB,GAC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ykBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAyD9C;yBAzDe,SAAS"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file DateInput.tsx
|
|
7
|
-
* @input Uses React, useId, useCallback, useRef, useTypedDateField, Field, Icon, Calendar, usePopover, InputGroupContext
|
|
8
|
-
* @output Exports DateInput component, DateInputProps, and
|
|
7
|
+
* @input Uses React, useId, useCallback, useRef, useTypedDateField, useEntryErrorBehavior, Field, Icon, Calendar, usePopover, InputGroupContext
|
|
8
|
+
* @output Exports DateInput component, DateInputProps, DateInputEntryError, and EntryErrorBehavior
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by DateInput.test.tsx
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
@@ -18,6 +18,7 @@
|
|
|
18
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
|
+
import { useEntryErrorBehavior } from "../Field/useEntryErrorBehavior.js";
|
|
21
22
|
import "../theme/tokens.stylex.js";
|
|
22
23
|
import { colorVars, sizeVars, radiusVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
23
24
|
import { Field, InputClearButton, inputWrapperStyles, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputStatusFocusWithinStyles } from "../Field/index.js";
|
|
@@ -174,6 +175,7 @@ function PointerDateField({
|
|
|
174
175
|
size: sizeProp,
|
|
175
176
|
status,
|
|
176
177
|
onEntryErrorChange,
|
|
178
|
+
entryErrorBehavior,
|
|
177
179
|
statusVariant = 'attached',
|
|
178
180
|
labelTooltip,
|
|
179
181
|
hasClear = false,
|
|
@@ -280,6 +282,7 @@ function PointerDateField({
|
|
|
280
282
|
const navigateToTypedDate = useCallback(date => {
|
|
281
283
|
calendarRef.current?.navigateTo(date);
|
|
282
284
|
}, []);
|
|
285
|
+
const resolvedEntryErrorBehavior = useEntryErrorBehavior(entryErrorBehavior);
|
|
283
286
|
const {
|
|
284
287
|
typedDate,
|
|
285
288
|
displayValue,
|
|
@@ -310,7 +313,8 @@ function PointerDateField({
|
|
|
310
313
|
status,
|
|
311
314
|
isStatusAnnounced: !inputGroup,
|
|
312
315
|
onEntryErrorChange,
|
|
313
|
-
hasPlaceholder: placeholderFromProps != null
|
|
316
|
+
hasPlaceholder: placeholderFromProps != null,
|
|
317
|
+
entryErrorBehavior: resolvedEntryErrorBehavior
|
|
314
318
|
});
|
|
315
319
|
const {
|
|
316
320
|
statusIcon,
|
|
@@ -675,8 +679,10 @@ export function DateInput(props) {
|
|
|
675
679
|
nativePicker: _nativePicker,
|
|
676
680
|
calendar: _calendar,
|
|
677
681
|
// Only the pointer field takes typed text. The native field reads only
|
|
678
|
-
// whether the callback is set.
|
|
682
|
+
// whether the callback is set. Its refused dates wait for Enter or blur
|
|
683
|
+
// under every entry error behavior.
|
|
679
684
|
onEntryErrorChange,
|
|
685
|
+
entryErrorBehavior,
|
|
680
686
|
...rest
|
|
681
687
|
} = props;
|
|
682
688
|
switch (surface) {
|
|
@@ -699,7 +705,8 @@ export function DateInput(props) {
|
|
|
699
705
|
...rest,
|
|
700
706
|
calendar: calendar,
|
|
701
707
|
isDisabled: isDisabled,
|
|
702
|
-
onEntryErrorChange: onEntryErrorChange
|
|
708
|
+
onEntryErrorChange: onEntryErrorChange,
|
|
709
|
+
entryErrorBehavior: entryErrorBehavior
|
|
703
710
|
});
|
|
704
711
|
}
|
|
705
712
|
}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* @position Package entry point for DateInput
|
|
6
6
|
*/
|
|
7
7
|
export { DateInput } from './DateInput.js';
|
|
8
|
-
export type { DateInputProps, DateInputSize, DateInputFormat, DateInputNativePicker, DateInputPresentation, DateInputStatus, DateInputStatusType, DateInputEntryError, } from './DateInput.js';
|
|
8
|
+
export type { DateInputProps, DateInputSize, DateInputFormat, DateInputNativePicker, DateInputPresentation, DateInputStatus, DateInputStatusType, DateInputEntryError, EntryErrorBehavior, } from './DateInput.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,YAAY,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,YAAY,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InputStatus } from '../Field/types.js';
|
|
2
|
+
import type { EntryErrorBehavior } from '../FormLayout/FormLayoutContext.js';
|
|
2
3
|
import { type CalendarSystem } from '../utils/calendarSystem.js';
|
|
3
4
|
import { type CalendarDateParseResult } from '../utils/calendarDateParser.js';
|
|
4
5
|
import type { ISODateString, PlainDate } from '../utils/dateTypes.js';
|
|
@@ -57,11 +58,11 @@ export interface TypedDate {
|
|
|
57
58
|
errorMessage: (result: CalendarDateParseResult) => string;
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
|
-
* The rejection a result shows: the error of
|
|
61
|
-
*
|
|
62
|
-
* error waits for the commit.
|
|
61
|
+
* The rejection a result shows: the error of text that Enter or blur
|
|
62
|
+
* committed, or, under `'complete'`, of a complete date. Text that is not a
|
|
63
|
+
* date is never complete, so its error waits for the commit.
|
|
63
64
|
*/
|
|
64
|
-
export declare function typedDateError(result: CalendarDateParseResult | null, isCommitted: boolean): TypedDateError | null;
|
|
65
|
+
export declare function typedDateError(result: CalendarDateParseResult | null, isCommitted: boolean, entryErrorBehavior: EntryErrorBehavior): TypedDateError | null;
|
|
65
66
|
/**
|
|
66
67
|
* Typed entry for a date text field in the active calendar. Values stay
|
|
67
68
|
* Gregorian; the calendar changes only what people type and read.
|
|
@@ -101,6 +102,12 @@ export interface UseTypedDateFieldOptions extends UseTypedDateOptions {
|
|
|
101
102
|
onEntryErrorChange?: (error: DateInputEntryError | null) => void;
|
|
102
103
|
/** Whether the caller gave a placeholder, which replaces the format hint. */
|
|
103
104
|
hasPlaceholder: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Under `'blur-or-enter'`, typing reveals no rejection: only Enter or blur
|
|
107
|
+
* does. An edit that makes the text a date or empties it still clears a
|
|
108
|
+
* revealed rejection at once.
|
|
109
|
+
*/
|
|
110
|
+
entryErrorBehavior: EntryErrorBehavior;
|
|
104
111
|
}
|
|
105
112
|
export interface TypedDateField {
|
|
106
113
|
typedDate: TypedDate;
|
|
@@ -132,7 +139,7 @@ export interface TypedDateField {
|
|
|
132
139
|
reset: () => void;
|
|
133
140
|
}
|
|
134
141
|
/** The typed entry of a date text field: its text, rejections, and commits. */
|
|
135
|
-
export declare function useTypedDateField({ value, shownValue, onChange, onClear, onTypedDate, isDisabled, status, isStatusAnnounced, onEntryErrorChange, hasPlaceholder, ...options }: UseTypedDateFieldOptions): TypedDateField;
|
|
142
|
+
export declare function useTypedDateField({ value, shownValue, onChange, onClear, onTypedDate, isDisabled, status, isStatusAnnounced, onEntryErrorChange, hasPlaceholder, entryErrorBehavior, ...options }: UseTypedDateFieldOptions): TypedDateField;
|
|
136
143
|
export interface UseNativeDateRejectionOptions {
|
|
137
144
|
/** The component that names itself in development warnings. */
|
|
138
145
|
source: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTypedDate.d.ts","sourceRoot":"","sources":["../../src/DateInput/useTypedDate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTypedDate.d.ts","sourceRoot":"","sources":["../../src/DateInput/useTypedDate.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AAUxE,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,uBAAuB,EAM7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,oBAAoB,CAAC;AAI5B,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,CAAC;AAEzE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;OAOG;IACH,IAAI,EACF,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,aAAa,CAAC;IAC7E,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAaD,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,oCAAoC;IACpC,MAAM,EAAE,gBAAgB,GAAG,CAAC,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC,CAAC;IAC9D,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,GAAG,CAAC,E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IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,MAAM,EAAE,gBAAgB,GAAG,CAAC,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC,CAAC;IAC9D,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,cAAc,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IAC7C,0DAA0D;IAC1D,KAAK,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,wEAAwE;IACxE,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sDAAsD;IACtD,qBAAqB,EAAE,OAAO,CAAC;IAC/B,yEAAyE;IACzE,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kCAAkC;IAClC,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,SAAS,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,MAAM,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAClC,sEAAsE;IACtE,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,4EAA4E;IAC5E,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAID;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,qBAAqB,EACrB,iBAAiB,EACjB,GAAG,OAAO,EACX,EAAE,6BAA6B,GAAG,mBAAmB,CAiFrD"}
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* @file useTypedDate.ts
|
|
7
7
|
* @input Provider locale and calendar, a field's format, bounds and constraints;
|
|
8
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
|
|
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
|
|
11
12
|
* @output Typed-date reading, committed text, the format hint, the calendar
|
|
12
13
|
* description and rejection messages for a date text field, the typed
|
|
13
14
|
* entry state that DateInput and DateTimeInput share, the
|
|
@@ -39,18 +40,18 @@ function isOutsideBounds(date, min, max) {
|
|
|
39
40
|
return min != null && plainDateIsBefore(date, plainDateFromISO(min)) || max != null && plainDateIsAfter(date, plainDateFromISO(max));
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
|
-
* The rejection a result shows: the error of
|
|
43
|
-
*
|
|
44
|
-
* error waits for the commit.
|
|
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.
|
|
45
46
|
*/
|
|
46
|
-
export function typedDateError(result, isCommitted) {
|
|
47
|
+
export function typedDateError(result, isCommitted, entryErrorBehavior) {
|
|
47
48
|
if (result == null) {
|
|
48
49
|
return null;
|
|
49
50
|
}
|
|
50
51
|
if ((result.kind === 'unreadable' || result.kind === 'incomplete') && isCommitted) {
|
|
51
52
|
return 'unreadable';
|
|
52
53
|
}
|
|
53
|
-
if ((result.kind === 'nonexistent' || result.kind === 'outOfRange') && (result.isComplete
|
|
54
|
+
if ((result.kind === 'nonexistent' || result.kind === 'outOfRange') && (isCommitted || result.isComplete && entryErrorBehavior === 'complete')) {
|
|
54
55
|
return result.kind;
|
|
55
56
|
}
|
|
56
57
|
return null;
|
|
@@ -62,8 +63,8 @@ function isAcceptedDate(result) {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
/** The rejection a result shows, as the field reports it to its caller. */
|
|
65
|
-
function dateEntryError(result, isCommitted, text, min, max) {
|
|
66
|
-
const error = typedDateError(result, isCommitted);
|
|
66
|
+
function dateEntryError(result, isCommitted, text, min, max, entryErrorBehavior) {
|
|
67
|
+
const error = typedDateError(result, isCommitted, entryErrorBehavior);
|
|
67
68
|
if (error == null || result == null) {
|
|
68
69
|
return null;
|
|
69
70
|
}
|
|
@@ -191,6 +192,7 @@ export function useTypedDateField({
|
|
|
191
192
|
isStatusAnnounced,
|
|
192
193
|
onEntryErrorChange,
|
|
193
194
|
hasPlaceholder,
|
|
195
|
+
entryErrorBehavior,
|
|
194
196
|
...options
|
|
195
197
|
}) {
|
|
196
198
|
const typedDate = useTypedDate(options);
|
|
@@ -215,19 +217,19 @@ export function useTypedDateField({
|
|
|
215
217
|
const [firedEpoch, setFiredEpoch] = useState(0);
|
|
216
218
|
const lastFiredDate = lastFired.epoch === firedEpoch ? lastFired.date : undefined;
|
|
217
219
|
const typedResult = pendingInput !== null && pendingInput.trim() ? typedDate.parse(pendingInput) : null;
|
|
218
|
-
const ownError = typedDateError(typedResult, isRejectionCommitted);
|
|
220
|
+
const ownError = typedDateError(typedResult, isRejectionCommitted, entryErrorBehavior);
|
|
219
221
|
const keptResult = ownError == null && keptText !== null && typedResult != null && !isAcceptedDate(typedResult) ? typedDate.parse(keptText) : null;
|
|
220
222
|
// The rejection the field shows. A locked field hides it but keeps its
|
|
221
223
|
// state, so the rejection shows again once the field is editable.
|
|
222
224
|
const shown = isDisabled ? null : ownError != null && typedResult != null && pendingInput !== null ? {
|
|
223
225
|
text: pendingInput,
|
|
224
226
|
result: typedResult
|
|
225
|
-
} : keptResult != null && keptText !== null && typedDateError(keptResult, true) != null ? {
|
|
227
|
+
} : keptResult != null && keptText !== null && typedDateError(keptResult, true, entryErrorBehavior) != null ? {
|
|
226
228
|
text: keptText,
|
|
227
229
|
result: keptResult
|
|
228
230
|
} : null;
|
|
229
231
|
const errorMessage = shown != null ? typedDate.errorMessage(shown.result) : null;
|
|
230
|
-
const entryError = shown != null ? dateEntryError(shown.result, true, shown.text, options.min, options.max) : null;
|
|
232
|
+
const entryError = shown != null ? dateEntryError(shown.result, true, shown.text, options.min, options.max, entryErrorBehavior) : null;
|
|
231
233
|
const shownText = shown?.text ?? null;
|
|
232
234
|
// Unreadable text that Enter or blur kept: the form posts the committed
|
|
233
235
|
// date, as it does where the text gives way to it.
|
|
@@ -302,7 +304,7 @@ export function useTypedDateField({
|
|
|
302
304
|
// Report a date only once more typing cannot change it.
|
|
303
305
|
const result = typedDate.parse(text);
|
|
304
306
|
const isEmpty = !text.trim();
|
|
305
|
-
const error = isEmpty ? null : dateEntryError(result, false, text, options.min, options.max);
|
|
307
|
+
const error = isEmpty ? null : dateEntryError(result, false, text, options.min, options.max, entryErrorBehavior);
|
|
306
308
|
// An edit that leaves the entry rejected or unfinished keeps the shown
|
|
307
309
|
// rejection.
|
|
308
310
|
const nextKeptText = error != null || isEmpty || isAcceptedDate(result) ? null : shownText;
|
|
@@ -316,7 +318,7 @@ export function useTypedDateField({
|
|
|
316
318
|
onTypedDate?.(date);
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
|
-
}, [isDisabled, typedDate, shownText, entryError, reportEntryError, options.min, options.max, report, onTypedDate]);
|
|
321
|
+
}, [isDisabled, typedDate, shownText, entryError, reportEntryError, options.min, options.max, entryErrorBehavior, report, onTypedDate]);
|
|
320
322
|
const commit = useCallback(() => {
|
|
321
323
|
if (pendingInput === null || isDisabled) {
|
|
322
324
|
return;
|
|
@@ -333,7 +335,7 @@ export function useTypedDateField({
|
|
|
333
335
|
setIsRejectionCommitted(true);
|
|
334
336
|
setKeptCommits(count => count + 1);
|
|
335
337
|
setKeptText(null);
|
|
336
|
-
reportEntryError(dateEntryError(result, true, pendingInput, options.min, options.max));
|
|
338
|
+
reportEntryError(dateEntryError(result, true, pendingInput, options.min, options.max, entryErrorBehavior));
|
|
337
339
|
return;
|
|
338
340
|
}
|
|
339
341
|
if (result.kind === 'value') {
|
|
@@ -345,7 +347,7 @@ export function useTypedDateField({
|
|
|
345
347
|
epoch: firedEpoch
|
|
346
348
|
});
|
|
347
349
|
reset();
|
|
348
|
-
}, [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]);
|
|
349
351
|
const handleFocus = useCallback(() => {
|
|
350
352
|
setIsFocused(true);
|
|
351
353
|
typedDate.prepare();
|
|
@@ -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
|
};
|
|
@@ -223,6 +225,29 @@ export interface DateTimeInputProps extends Omit<FieldInputBaseProps<HTMLInputEl
|
|
|
223
225
|
* native and touch pickers take no typed text, so they report no rejection.
|
|
224
226
|
*/
|
|
225
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;
|
|
226
251
|
/**
|
|
227
252
|
* Width of the field. Numbers are treated as pixels, strings are used as-is
|
|
228
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":"AAqCA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AAUxE,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;AAIlB,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAyBrB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,2BAA2B,CAAC;AAGnC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e,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAEzB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;;;;;;;;;;;;OAiBG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,KAAK,IAAI,CAAC;IAEjE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IAExC;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAEvB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC;CAC1C;AA++CD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAuDtD;yBAvDe,aAAa"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file DateTimeInput.tsx
|
|
7
7
|
* @input Uses React, Field, Calendar, NativeDateSegment, NativeTimeSegment, TouchDateTimeField, usePopover, useAnnounce, time parsing utilities, StyleX intrinsic flex layout
|
|
8
|
-
* @output Exports DateTimeInput component, DateTimeInputProps, DateInputEntryError, and native picker type; cleared values keep the pointer Calendar controlled-empty; typed date rejections reach onEntryErrorChange
|
|
8
|
+
* @output Exports DateTimeInput component, DateTimeInputProps, DateInputEntryError, EntryErrorBehavior, and native picker type; cleared values keep the pointer Calendar controlled-empty; typed date rejections reach onEntryErrorChange
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by DateTimeInput.test.tsx
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
import { useId, useState, useCallback, useEffect, useRef, useMemo, useOptimistic, useTransition } from 'react';
|
|
23
23
|
import * as stylex from '@stylexjs/stylex';
|
|
24
24
|
import { inputDisabledFocusStyles } from "../Field/inputDisabledFocus.js";
|
|
25
|
+
import { useEntryErrorBehavior } from "../Field/useEntryErrorBehavior.js";
|
|
25
26
|
import "../theme/tokens.stylex.js";
|
|
26
27
|
import { colorVars, sizeVars, radiusVars, spacingVars, typographyVars, typeScaleVars, fontWeightVars } from "../theme/tokens.stylex.js";
|
|
27
28
|
import { Field, InputClearButton, inputWrapperStyles, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputStatusFocusWithinStyles } from "../Field/index.js";
|
|
@@ -255,6 +256,7 @@ function PointerDateTimeField({
|
|
|
255
256
|
size: sizeProp,
|
|
256
257
|
status,
|
|
257
258
|
onEntryErrorChange,
|
|
259
|
+
entryErrorBehavior,
|
|
258
260
|
labelTooltip,
|
|
259
261
|
numberOfMonths = 1,
|
|
260
262
|
weekStartsOn,
|
|
@@ -399,6 +401,7 @@ function PointerDateTimeField({
|
|
|
399
401
|
}
|
|
400
402
|
}
|
|
401
403
|
const nativeTimeValue = nativeTimeDraft ?? valueParts.time;
|
|
404
|
+
const resolvedEntryErrorBehavior = useEntryErrorBehavior(entryErrorBehavior);
|
|
402
405
|
const typedTime = useTypedTime({
|
|
403
406
|
value: valueParts.time,
|
|
404
407
|
hourFormat,
|
|
@@ -410,7 +413,8 @@ function PointerDateTimeField({
|
|
|
410
413
|
hasTypedField: !usesNativeTimePicker,
|
|
411
414
|
errorMessage: t('@astryx.timeInput.invalidTime'),
|
|
412
415
|
isStatusAnnounced: true,
|
|
413
|
-
status
|
|
416
|
+
status,
|
|
417
|
+
entryErrorBehavior: resolvedEntryErrorBehavior
|
|
414
418
|
});
|
|
415
419
|
const timePendingInput = typedTime.pendingInput;
|
|
416
420
|
const formatDisplayTime = useCallback((time, includeSeconds) => formatLocaleTime(time, locale, hourFormat, includeSeconds), [locale, hourFormat]);
|
|
@@ -574,7 +578,8 @@ function PointerDateTimeField({
|
|
|
574
578
|
status,
|
|
575
579
|
isStatusAnnounced: true,
|
|
576
580
|
onEntryErrorChange,
|
|
577
|
-
hasPlaceholder: placeholderFromProps != null
|
|
581
|
+
hasPlaceholder: placeholderFromProps != null,
|
|
582
|
+
entryErrorBehavior: resolvedEntryErrorBehavior
|
|
578
583
|
});
|
|
579
584
|
const nativeDateRejection = useNativeDateRejection({
|
|
580
585
|
source: 'DateTimeInput',
|
|
@@ -1244,6 +1249,7 @@ function PointerDateTimeField({
|
|
|
1244
1249
|
ariaDescribedBy: ariaDescribedBy,
|
|
1245
1250
|
isRejected: typedTime.isSurfaceRejectionShown,
|
|
1246
1251
|
onRejectedChange: typedTime.setSurfaceRejected,
|
|
1252
|
+
onCommit: typedTime.commitSurface,
|
|
1247
1253
|
alertMessage: timeAlertMessage
|
|
1248
1254
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
1249
1255
|
children: [/*#__PURE__*/_jsx("div", {
|
|
@@ -1417,6 +1423,7 @@ export function DateTimeInput(props) {
|
|
|
1417
1423
|
// The sheet takes no typed text.
|
|
1418
1424
|
const {
|
|
1419
1425
|
onEntryErrorChange: _onEntryErrorChange,
|
|
1426
|
+
entryErrorBehavior: _entryErrorBehavior,
|
|
1420
1427
|
...sheetProps
|
|
1421
1428
|
} = rest;
|
|
1422
1429
|
// Month indexes depend on the calendar. A new calendar remounts the sheet.
|
|
@@ -31,6 +31,8 @@ export type NativeTimeSegmentProps = {
|
|
|
31
31
|
* it. The owner ends it when `value` changes.
|
|
32
32
|
*/
|
|
33
33
|
onRejectedChange: (isRejected: boolean) => void;
|
|
34
|
+
/** Runs at Enter and blur, which show a rejection that waits for them. */
|
|
35
|
+
onCommit: () => void;
|
|
34
36
|
/** The rejection message that no shown status announces. */
|
|
35
37
|
alertMessage: string;
|
|
36
38
|
/**
|
|
@@ -41,7 +43,7 @@ export type NativeTimeSegmentProps = {
|
|
|
41
43
|
controlProps?: Omit<FieldInputBaseProps<HTMLInputElement>, keyof FieldPartStyleProps | 'onChange' | 'defaultValue'>;
|
|
42
44
|
};
|
|
43
45
|
/** The shared native time control rendered inside Astryx field chrome. */
|
|
44
|
-
export declare function NativeTimeSegment({ id, inputRef, value, onChange, placeholder, inputLabel, openPickerLabel, ariaLabelledBy, iconThemeProps, hasAutoFocus, min, max, hourFormat, isEffectivelyDisabled, isFocusableDisabled, isEffectivelyRequired, isBusy, statusType, ariaDescribedBy, isRejected, onRejectedChange, alertMessage, controlProps, }: NativeTimeSegmentProps): import("react").JSX.Element;
|
|
46
|
+
export declare function NativeTimeSegment({ id, inputRef, value, onChange, placeholder, inputLabel, openPickerLabel, ariaLabelledBy, iconThemeProps, hasAutoFocus, min, max, hourFormat, isEffectivelyDisabled, isFocusableDisabled, isEffectivelyRequired, isBusy, statusType, ariaDescribedBy, isRejected, onRejectedChange, onCommit, alertMessage, controlProps, }: NativeTimeSegmentProps): import("react").JSX.Element;
|
|
45
47
|
export declare namespace NativeTimeSegment {
|
|
46
48
|
var displayName: string;
|
|
47
49
|
}
|