@astryxdesign/core 0.7.7-canary.0d1ddcd → 0.7.7-canary.0eb44a2
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/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +2 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +3 -2
- package/dist/DateInput/Wheel.d.ts +17 -1
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +179 -19
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +63 -49
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +37 -1
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +4 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +20 -4
- package/dist/Layer/layerClickBoundary.d.ts +7 -1
- package/dist/Layer/layerClickBoundary.d.ts.map +1 -1
- package/dist/Layer/layerClickBoundary.js +2 -2
- package/dist/Layer/usePressPin.d.ts +95 -0
- package/dist/Layer/usePressPin.d.ts.map +1 -0
- package/dist/Layer/usePressPin.js +365 -0
- package/dist/Layer/useTouchTrigger.d.ts +23 -1
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +45 -7
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +2 -1
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +56 -7
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +38 -30
- package/dist/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +52 -14
- package/dist/ProgressBar/ProgressBarTouch.d.ts +29 -0
- package/dist/ProgressBar/ProgressBarTouch.d.ts.map +1 -0
- package/dist/ProgressBar/ProgressBarTouch.js +91 -0
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +2 -1
- package/dist/Switch/Switch.d.ts +1 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +200 -46
- package/dist/Switch/switchFill.d.ts +31 -0
- package/dist/Switch/switchFill.d.ts.map +1 -0
- package/dist/Switch/switchFill.js +88 -0
- package/dist/Switch/switchTouch.d.ts +81 -0
- package/dist/Switch/switchTouch.d.ts.map +1 -0
- package/dist/Switch/switchTouch.js +133 -0
- package/dist/Switch/useSwitchTouch.d.ts +285 -0
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -0
- package/dist/Switch/useSwitchTouch.js +998 -0
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +4 -3
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +12 -5
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +3 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.js +17 -0
- package/dist/Tooltip/Tooltip.d.ts +30 -6
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +5 -0
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +31 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +59 -18
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +26 -15
- package/dist/astryx.css +58 -2
- package/dist/gestures/GestureArena.d.ts +21 -2
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +19 -2
- package/dist/gestures/GestureHost.d.ts +51 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +155 -11
- package/dist/gestures/PressTracker.d.ts +6 -0
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +3 -0
- package/dist/gestures/types.d.ts +6 -0
- package/dist/gestures/types.d.ts.map +1 -1
- package/dist/gestures/usePressTracker.d.ts.map +1 -1
- package/dist/gestures/usePressTracker.js +1 -0
- package/dist/gestures/wheelSegmenter.d.ts +14 -3
- package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
- package/dist/gestures/wheelSegmenter.js +32 -8
- package/dist/hooks/useAttachment.d.ts +16 -8
- package/dist/hooks/useAttachment.d.ts.map +1 -1
- package/dist/hooks/useAttachment.js +35 -15
- package/dist/hooks/useFocusTrap.d.ts +15 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +13 -2
- package/dist/hooks/usePager.d.ts +261 -0
- package/dist/hooks/usePager.d.ts.map +1 -0
- package/dist/hooks/usePager.js +1169 -0
- package/dist/motion/paging.d.ts +16 -5
- package/dist/motion/paging.d.ts.map +1 -1
- package/dist/motion/paging.js +34 -14
- package/dist/motion/uikit/index.d.ts +7 -4
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +7 -4
- package/dist/motion/uikit/paging.d.ts +31 -20
- package/dist/motion/uikit/paging.d.ts.map +1 -1
- package/dist/motion/uikit/paging.js +41 -11
- package/dist/motion/uikit/progressBar.d.ts +79 -0
- package/dist/motion/uikit/progressBar.d.ts.map +1 -0
- package/dist/motion/uikit/progressBar.js +102 -0
- package/dist/motion/uikit/springs.d.ts +13 -29
- package/dist/motion/uikit/springs.d.ts.map +1 -1
- package/dist/motion/uikit/springs.js +16 -30
- package/dist/motion/uikit/switch.d.ts +166 -0
- package/dist/motion/uikit/switch.d.ts.map +1 -0
- package/dist/motion/uikit/switch.js +186 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts +18 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.js +28 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +5 -0
- package/dist/utils/selectionLock.d.ts +43 -0
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +394 -6
- package/package.json +4 -4
- package/src/Avatar/Avatar.tsx +3 -1
- package/src/Breadcrumbs/BreadcrumbItem.tsx +4 -1
- package/src/Button/Button.tsx +3 -2
- package/src/DateInput/Wheel.tsx +174 -14
- package/src/DateRangeInput/DateRangeInput.doc.mjs +3 -2
- package/src/DateRangeInput/DateRangeInput.tsx +117 -71
- package/src/Dialog/Dialog.tsx +37 -1
- package/src/Drawer/useDrawerDialogPresence.ts +4 -0
- package/src/DropdownMenu/DropdownMenu.tsx +28 -6
- package/src/Layer/layerClickBoundary.ts +2 -2
- package/src/Layer/usePressPin.ts +516 -0
- package/src/Layer/useTouchTrigger.ts +56 -6
- package/src/Lightbox/Lightbox.tsx +2 -1
- package/src/Popover/usePopover.tsx +71 -9
- package/src/PowerSearch/PowerSearch.tsx +38 -31
- package/src/ProgressBar/ProgressBar.doc.mjs +7 -5
- package/src/ProgressBar/ProgressBar.tsx +147 -16
- package/src/ProgressBar/ProgressBarTouch.ts +109 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +2 -1
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/Switch/Switch.tsx +412 -86
- package/src/Switch/switchFill.ts +106 -0
- package/src/Switch/switchTouch.ts +194 -0
- package/src/Switch/useSwitchTouch.ts +1121 -0
- package/src/TabList/Tab.tsx +5 -3
- package/src/Tokenizer/Tokenizer.tsx +15 -5
- package/src/Tokenizer/TokenizerItemRemovableContext.ts +22 -0
- package/src/Tooltip/Tooltip.doc.mjs +21 -6
- package/src/Tooltip/Tooltip.tsx +42 -5
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/useTooltip.doc.mjs +4 -2
- package/src/Tooltip/useTooltip.tsx +84 -21
- package/src/Typeahead/Typeahead.tsx +29 -15
- package/src/gestures/GestureArena.ts +44 -4
- package/src/gestures/GestureHost.ts +194 -11
- package/src/gestures/PressTracker.ts +10 -0
- package/src/gestures/README.md +19 -3
- package/src/gestures/types.ts +6 -0
- package/src/gestures/usePressTracker.ts +2 -0
- package/src/gestures/wheelSegmenter.ts +36 -7
- package/src/hooks/useAttachment.ts +56 -14
- package/src/hooks/useFocusTrap.ts +26 -2
- package/src/hooks/usePager.ts +1446 -0
- package/src/motion/MEASUREMENTS.md +29 -27
- package/src/motion/README.md +4 -1
- package/src/motion/paging.ts +37 -14
- package/src/motion/uikit/index.ts +6 -4
- package/src/motion/uikit/paging.ts +41 -10
- package/src/motion/uikit/progressBar.ts +102 -0
- package/src/motion/uikit/springs.ts +16 -30
- package/src/motion/uikit/switch.ts +174 -0
- package/src/privateAttributes/pressHoldsDrag.stylex.ts +28 -0
- package/src/utils/pressFeedback.ts +5 -0
- package/src/utils/selectionLock.ts +501 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAqB3C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAmCrD;;;;;;GAMG;AACH,KAAK,eAAe,GAAG,KAAK,GAAG,IAA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W,EACX,KAAgB,EAChB,GAAG,EACH,MAAM,EACN,OAAc,EACd,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,+BA+Vb;yBAnXe,MAAM"}
|
package/dist/Avatar/Avatar.js
CHANGED
|
@@ -590,7 +590,7 @@ export function Avatar({
|
|
|
590
590
|
size: numericSize
|
|
591
591
|
})
|
|
592
592
|
})]
|
|
593
|
-
}), status && /*#__PURE__*/_jsx("div", {
|
|
593
|
+
}), Boolean(status) && /*#__PURE__*/_jsx("div", {
|
|
594
594
|
...stylex.props(styles.status, resolvedShape === 'circle' ? dynamicStyles.statusPositionCircle(numericSize) : dynamicStyles.statusPositionCorner),
|
|
595
595
|
children: status
|
|
596
596
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,OAAO,CAAC;AAWf,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAa5C,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,qCAAqC,CAAC;AAM7C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,OAAO,CAA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
|
45
45
|
import { MENU_ITEM_ROLES, MENU_ITEM_SELECTOR, MENU_BOUNDARY_SELECTOR } from "../DropdownMenu/menuItemRoles.js";
|
|
46
46
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
47
47
|
import { useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
48
|
+
import { isRenderable } from "../utils/isRenderable.js";
|
|
48
49
|
// =============================================================================
|
|
49
50
|
// Props
|
|
50
51
|
// =============================================================================
|
|
@@ -242,7 +243,7 @@ export function BreadcrumbItem({
|
|
|
242
243
|
});
|
|
243
244
|
const mergedItemRef = useMergedRefs(ref, liRef);
|
|
244
245
|
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
245
|
-
children: [startIcon && /*#__PURE__*/_jsx("span", {
|
|
246
|
+
children: [isRenderable(startIcon) && /*#__PURE__*/_jsx("span", {
|
|
246
247
|
...{
|
|
247
248
|
className: "x78zum5 x6s0dn4 x2lah0s"
|
|
248
249
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAgC3C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;A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;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACrD;;OAEG;IACH,WAAW,CAAC,EAAE,CACZ,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KACnC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AA8JD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,OAAqB,EACrB,IAAI,EAAE,QAAQ,EACd,IAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,eAAuB,EACvB,WAAW,EACX,IAAI,EACJ,UAAkB,EAClB,KAAK,EACL,SAAkB,EAClB,QAAQ,EACR,UAAU,EACV,OAAO,EACP,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,SAAS,CAqTzB;yBA9Ue,MAAM"}
|
package/dist/Button/Button.js
CHANGED
|
@@ -41,6 +41,7 @@ import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js"
|
|
|
41
41
|
import { usePressFeedback } from "../hooks/usePressFeedback.js";
|
|
42
42
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
43
43
|
import english from "../i18n/generated-english/Button/Button.generated.js";
|
|
44
|
+
import { isRenderable } from "../utils/isRenderable.js";
|
|
44
45
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
45
46
|
registerEnglishFallback(english);
|
|
46
47
|
|
|
@@ -513,7 +514,7 @@ export function Button({
|
|
|
513
514
|
}), /*#__PURE__*/_jsxs("span", {
|
|
514
515
|
...stylex.props(styles.contentWrapper, isLoadingState && (delaySpinner ? loadingStyles.hiddenContentDelayed : loadingStyles.hiddenContent)),
|
|
515
516
|
"aria-hidden": isLoadingState || undefined,
|
|
516
|
-
children: [icon && /*#__PURE__*/_jsx("span", {
|
|
517
|
+
children: [isRenderable(icon) && /*#__PURE__*/_jsx("span", {
|
|
517
518
|
...stylex.props(styles.iconWrapper, iconBoxSizeStyles[iconSize]),
|
|
518
519
|
children: /*#__PURE__*/_jsx(IconDefaultSizeProvider, {
|
|
519
520
|
value: iconSize,
|
|
@@ -524,7 +525,7 @@ export function Button({
|
|
|
524
525
|
className: "xb3r6kr xlyipyv xeuugli"
|
|
525
526
|
},
|
|
526
527
|
children: children ?? label
|
|
527
|
-
}), !isIconOnly && endContent && /*#__PURE__*/_jsx("span", {
|
|
528
|
+
}), !isIconOnly && isRenderable(endContent) && /*#__PURE__*/_jsx("span", {
|
|
528
529
|
...{
|
|
529
530
|
className: "x3nfvp2 x6s0dn4 x1heor9g"
|
|
530
531
|
},
|
|
@@ -3,7 +3,10 @@ export interface WheelOption {
|
|
|
3
3
|
value: number;
|
|
4
4
|
/** Row text. */
|
|
5
5
|
label: string;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Rows outside min/max stay visible but cannot be committed: a wheel that
|
|
8
|
+
* stops on one travels on to the nearest enabled row.
|
|
9
|
+
*/
|
|
7
10
|
isDisabled?: boolean;
|
|
8
11
|
}
|
|
9
12
|
export interface WheelProps {
|
|
@@ -21,6 +24,19 @@ export interface WheelProps {
|
|
|
21
24
|
*/
|
|
22
25
|
isActive?: boolean;
|
|
23
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* The enabled row nearest `index`: `index` itself when it is enabled,
|
|
29
|
+
* otherwise the closest enabled row on either side. A tie goes to the side of
|
|
30
|
+
* `towardIndex` (the committed row), and a wheel with no enabled row stays on
|
|
31
|
+
* `towardIndex`.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```
|
|
35
|
+
* // Hours 0-23 with 09:00-17:00 bounds: stopping on 7 rests on 9.
|
|
36
|
+
* nearestEnabledIndex(hourOptions, 7, 10); // 9
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function nearestEnabledIndex(options: ReadonlyArray<WheelOption>, index: number, towardIndex: number): number;
|
|
24
40
|
/**
|
|
25
41
|
* One snap-scrolling picker column.
|
|
26
42
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/Wheel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/Wheel.tsx"],"names":[],"mappings":"AAoNA,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACpC,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,EACnC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,MAAM,CAsBR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAe,GAChB,EAAE,UAAU,+BAkVZ;yBAxVe,KAAK"}
|
package/dist/DateInput/Wheel.js
CHANGED
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
* browser that does not understand `animation-timeline` would otherwise run
|
|
22
22
|
* the same keyframes on the document timeline and simply play them once.
|
|
23
23
|
*
|
|
24
|
+
* Under Reduce Motion, the wheel's own scrolls (a step from a key or a click,
|
|
25
|
+
* the travel to the nearest enabled row) land without travel. They cross-fade
|
|
26
|
+
* on a touch screen and land at once otherwise. A finger's scroll and its
|
|
27
|
+
* momentum stay the platform's.
|
|
28
|
+
*
|
|
24
29
|
* Accessibility: this is a listbox, not a novel widget. It is one tab stop
|
|
25
30
|
* with arrow/Home/End/PageUp/PageDown keys, `aria-activedescendant` tracking
|
|
26
31
|
* the active row, and every row reachable by tap — none of which depends on
|
|
@@ -37,6 +42,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
37
42
|
import "../theme/tokens.stylex.js";
|
|
38
43
|
import { colorVars, radiusVars, fontWeightVars, typeScaleVars, spacingVars, durationVars } from "../theme/tokens.stylex.js";
|
|
39
44
|
import { focusOutlineStyles } from "../utils/index.js";
|
|
45
|
+
import { reducedMotionFade } from "../motion/reducedMotion.js";
|
|
40
46
|
import "./tokens.stylex.js";
|
|
41
47
|
import { dateInputTouchSizes, dateInputTouchGeometry } from "./tokens.stylex.js";
|
|
42
48
|
import { useOwnScrollGesture } from "./useOwnScrollGesture.js";
|
|
@@ -72,6 +78,41 @@ const styles = {
|
|
|
72
78
|
$$css: true
|
|
73
79
|
}
|
|
74
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* The enabled row nearest `index`: `index` itself when it is enabled,
|
|
83
|
+
* otherwise the closest enabled row on either side. A tie goes to the side of
|
|
84
|
+
* `towardIndex` (the committed row), and a wheel with no enabled row stays on
|
|
85
|
+
* `towardIndex`.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```
|
|
89
|
+
* // Hours 0-23 with 09:00-17:00 bounds: stopping on 7 rests on 9.
|
|
90
|
+
* nearestEnabledIndex(hourOptions, 7, 10); // 9
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export function nearestEnabledIndex(options, index, towardIndex) {
|
|
94
|
+
const isEnabled = i => i >= 0 && i < options.length && !options[i].isDisabled;
|
|
95
|
+
if (isEnabled(index)) {
|
|
96
|
+
return index;
|
|
97
|
+
}
|
|
98
|
+
for (let distance = 1; distance < options.length; distance++) {
|
|
99
|
+
const below = index - distance;
|
|
100
|
+
const above = index + distance;
|
|
101
|
+
const isBelowEnabled = isEnabled(below);
|
|
102
|
+
const isAboveEnabled = isEnabled(above);
|
|
103
|
+
if (isBelowEnabled && isAboveEnabled) {
|
|
104
|
+
return towardIndex < index ? below : above;
|
|
105
|
+
}
|
|
106
|
+
if (isBelowEnabled) {
|
|
107
|
+
return below;
|
|
108
|
+
}
|
|
109
|
+
if (isAboveEnabled) {
|
|
110
|
+
return above;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return towardIndex;
|
|
114
|
+
}
|
|
115
|
+
|
|
75
116
|
/**
|
|
76
117
|
* One snap-scrolling picker column.
|
|
77
118
|
*
|
|
@@ -114,20 +155,110 @@ export function Wheel({
|
|
|
114
155
|
const first = scrollerRef.current?.firstElementChild;
|
|
115
156
|
return first instanceof HTMLElement && first.offsetHeight > 0 ? first.offsetHeight : 0;
|
|
116
157
|
}, []);
|
|
117
|
-
|
|
158
|
+
|
|
159
|
+
// What last started a scroll of the wheel: a pointer's type, or 'wheel'
|
|
160
|
+
// for a mouse wheel or trackpad. Under Reduce Motion the release of a touch
|
|
161
|
+
// drag cross-fades on any primary pointer. A key step, a row tap or a
|
|
162
|
+
// trackpad's scroll cross-fades on a coarse primary pointer and lands at
|
|
163
|
+
// once on a fine one.
|
|
164
|
+
const lastPointerRef = useRef(null);
|
|
165
|
+
|
|
166
|
+
// A reduced-motion dip whose rows have not landed yet: its timer and the
|
|
167
|
+
// row it lands on. While one is pending the rows stay put for it, so they
|
|
168
|
+
// never move at full opacity, and a further step retargets it.
|
|
169
|
+
const pendingFadeRef = useRef(null);
|
|
170
|
+
// The running dip, so a step during its fade-in starts the next one where
|
|
171
|
+
// the column is.
|
|
172
|
+
const dipRef = useRef(null);
|
|
173
|
+
useEffect(() => () => {
|
|
174
|
+
if (pendingFadeRef.current != null) {
|
|
175
|
+
window.clearTimeout(pendingFadeRef.current.timer);
|
|
176
|
+
pendingFadeRef.current = null;
|
|
177
|
+
}
|
|
178
|
+
}, []);
|
|
179
|
+
const scrollToIndex = useCallback((index, behavior, {
|
|
180
|
+
touchRelease = false
|
|
181
|
+
} = {}) => {
|
|
118
182
|
const scroller = scrollerRef.current;
|
|
119
183
|
const size = itemBlockSize();
|
|
120
184
|
if (scroller == null || size === 0) {
|
|
121
185
|
return;
|
|
122
186
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
187
|
+
const top = index * size;
|
|
188
|
+
// Under Reduce Motion the wheel's own scroll lands without travel. It
|
|
189
|
+
// dips on a touch screen or for a touch drag's release. Otherwise it
|
|
190
|
+
// lands at once.
|
|
191
|
+
const fadeTiming = behavior === 'smooth' ? reducedMotionFade(scroller, {
|
|
192
|
+
touchRelease
|
|
193
|
+
}) : null;
|
|
194
|
+
const pending = pendingFadeRef.current;
|
|
195
|
+
if (fadeTiming == null) {
|
|
196
|
+
if (pending != null) {
|
|
197
|
+
window.clearTimeout(pending.timer);
|
|
198
|
+
pendingFadeRef.current = null;
|
|
199
|
+
}
|
|
200
|
+
scroller.scrollTo({
|
|
201
|
+
top,
|
|
202
|
+
behavior
|
|
203
|
+
});
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (fadeTiming.duration === 0 || typeof scroller.animate !== 'function') {
|
|
207
|
+
if (pending != null) {
|
|
208
|
+
window.clearTimeout(pending.timer);
|
|
209
|
+
pendingFadeRef.current = null;
|
|
210
|
+
}
|
|
211
|
+
scroller.scrollTo({
|
|
212
|
+
top,
|
|
213
|
+
behavior: 'auto'
|
|
214
|
+
});
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (pending != null) {
|
|
218
|
+
// The dip is still fading out: its rows land here instead.
|
|
219
|
+
pending.top = top;
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const {
|
|
223
|
+
duration,
|
|
224
|
+
easing
|
|
225
|
+
} = fadeTiming;
|
|
226
|
+
// A step during the last dip's fade-in starts the new dip at the
|
|
227
|
+
// column's current opacity, not at full opacity. A leaving element fades
|
|
228
|
+
// out from where it is.
|
|
229
|
+
const shown = Number.parseFloat(getComputedStyle(scroller).opacity);
|
|
230
|
+
dipRef.current?.cancel();
|
|
231
|
+
dipRef.current = scroller.animate([{
|
|
232
|
+
opacity: Number.isFinite(shown) ? shown : 1,
|
|
233
|
+
easing
|
|
234
|
+
}, {
|
|
235
|
+
opacity: 0,
|
|
236
|
+
easing
|
|
237
|
+
}, {
|
|
238
|
+
opacity: 1
|
|
239
|
+
}], {
|
|
240
|
+
duration,
|
|
241
|
+
easing: 'linear'
|
|
126
242
|
});
|
|
243
|
+
const landing = {
|
|
244
|
+
top,
|
|
245
|
+
timer: 0
|
|
246
|
+
};
|
|
247
|
+
landing.timer = window.setTimeout(() => {
|
|
248
|
+
pendingFadeRef.current = null;
|
|
249
|
+
scroller.scrollTo({
|
|
250
|
+
top: landing.top,
|
|
251
|
+
behavior: 'auto'
|
|
252
|
+
});
|
|
253
|
+
}, duration / 2);
|
|
254
|
+
pendingFadeRef.current = landing;
|
|
127
255
|
}, [itemBlockSize]);
|
|
128
256
|
|
|
129
|
-
// Commit on rest. A disabled row
|
|
130
|
-
//
|
|
257
|
+
// Commit on rest. A wheel that stops on a disabled row travels on to the
|
|
258
|
+
// nearest enabled row, as UIDatePicker does. That second rest commits it.
|
|
259
|
+
// A rest on the committed row is not a stop to correct. The park after the
|
|
260
|
+
// sheet opens rests there with no touch. A committed value outside the
|
|
261
|
+
// bounds stays until a person moves the wheel.
|
|
131
262
|
//
|
|
132
263
|
// Declared here, above the park effect, because that effect consults the
|
|
133
264
|
// `isAtRestRef` this returns before it repositions anything.
|
|
@@ -139,18 +270,24 @@ export function Wheel({
|
|
|
139
270
|
return;
|
|
140
271
|
}
|
|
141
272
|
const index = Math.min(options.length - 1, Math.max(0, Math.round(scroller.scrollTop / size)));
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
scrollToIndex(
|
|
273
|
+
const restIndex = index === selectedIndex ? index : nearestEnabledIndex(options, index, selectedIndex);
|
|
274
|
+
if (restIndex !== index) {
|
|
275
|
+
scrollToIndex(restIndex, 'smooth', {
|
|
276
|
+
touchRelease: lastPointerRef.current === 'touch'
|
|
277
|
+
});
|
|
145
278
|
return;
|
|
146
279
|
}
|
|
147
|
-
|
|
280
|
+
const option = options[index];
|
|
281
|
+
if (option != null && !option.isDisabled && option.value !== value) {
|
|
148
282
|
onChange(option.value);
|
|
149
283
|
}
|
|
150
284
|
}, isActive, isDraggingRef);
|
|
151
285
|
|
|
152
|
-
// Park the committed row under the band whenever the wheel is
|
|
153
|
-
// value
|
|
286
|
+
// Park the committed row under the band at once whenever the wheel is
|
|
287
|
+
// shown. A value that changes from outside while the wheel is shown turns
|
|
288
|
+
// the wheel onto its row instead. UIDatePicker turns onto its maximum the
|
|
289
|
+
// same way, and never jumps there. For example, a bound clamps the time
|
|
290
|
+
// after another wheel turned, or the calendar moved to another month.
|
|
154
291
|
//
|
|
155
292
|
// NEVER while the wheel is still moving. A scroller that is mid-gesture or
|
|
156
293
|
// still carrying momentum is the user's, and repositioning it does not stop
|
|
@@ -158,8 +295,15 @@ export function Wheel({
|
|
|
158
295
|
// as a new settle, commits the next row along, and parks again. See
|
|
159
296
|
// useScrollSettle. The settle handler re-checks the position afterwards, so
|
|
160
297
|
// a correction that is genuinely needed still happens, just at rest.
|
|
298
|
+
const parkedRef = useRef(false);
|
|
161
299
|
useEffect(() => {
|
|
162
|
-
if (!isActive
|
|
300
|
+
if (!isActive) {
|
|
301
|
+
parkedRef.current = false;
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
// Nor while a reduced-motion dip is still to land its rows: they land
|
|
305
|
+
// under it, on this row.
|
|
306
|
+
if (!isAtRestRef.current || pendingFadeRef.current != null) {
|
|
163
307
|
return;
|
|
164
308
|
}
|
|
165
309
|
const size = itemBlockSize();
|
|
@@ -168,14 +312,19 @@ export function Wheel({
|
|
|
168
312
|
return;
|
|
169
313
|
}
|
|
170
314
|
if (Math.round(scroller.scrollTop / size) !== selectedIndex) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
315
|
+
if (parkedRef.current) {
|
|
316
|
+
scrollToIndex(selectedIndex, 'smooth');
|
|
317
|
+
} else {
|
|
318
|
+
scroller.scrollTo({
|
|
319
|
+
top: selectedIndex * size,
|
|
320
|
+
behavior: 'auto'
|
|
321
|
+
});
|
|
322
|
+
}
|
|
175
323
|
}
|
|
324
|
+
parkedRef.current = true;
|
|
176
325
|
// eslint-disable-next-line @eslint-react/set-state-in-effect -- the highlight follows a scroll position, which only exists after layout
|
|
177
326
|
setActiveIndex(selectedIndex);
|
|
178
|
-
}, [isActive, selectedIndex, itemBlockSize, isAtRestRef]);
|
|
327
|
+
}, [isActive, selectedIndex, itemBlockSize, isAtRestRef, scrollToIndex]);
|
|
179
328
|
|
|
180
329
|
// Highlight follows the finger. rAF-throttled: a scroll can fire far more
|
|
181
330
|
// often than the display refreshes, and this only feeds a repaint.
|
|
@@ -276,7 +425,18 @@ export function Wheel({
|
|
|
276
425
|
"aria-label": label,
|
|
277
426
|
"aria-activedescendant": `${id}-${options[activeIndex]?.value}`,
|
|
278
427
|
tabIndex: 0,
|
|
279
|
-
onKeyDown: handleKeyDown
|
|
428
|
+
onKeyDown: handleKeyDown
|
|
429
|
+
// Read in the capture phase. usePointerDragScroll stops a primary
|
|
430
|
+
// mouse press from bubbling, so that it does not reach BottomSheet's
|
|
431
|
+
// drag. A bubbling handler would never see a mouse, and would keep the
|
|
432
|
+
// last touch.
|
|
433
|
+
,
|
|
434
|
+
onPointerDownCapture: event => {
|
|
435
|
+
lastPointerRef.current = event.pointerType;
|
|
436
|
+
},
|
|
437
|
+
onWheel: () => {
|
|
438
|
+
lastPointerRef.current = 'wheel';
|
|
439
|
+
},
|
|
280
440
|
...stylex.props(styles.scroller, focusOutlineStyles.focusVisible),
|
|
281
441
|
children: options.map((option, index) => /*#__PURE__*/_jsx("div", {
|
|
282
442
|
id: `${id}-${option.value}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../src/DateRangeInput/DateRangeInput.tsx"],"names":[],"mappings":"AA6CA,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;AAIlB,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAOrB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAU9C,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../src/DateRangeInput/DateRangeInput.tsx"],"names":[],"mappings":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AK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,QAAe,EACf,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,cAAkB,EAClB,YAAY,EACZ,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,GAAG,SAAS,EACb,EAAE,mBAAmB,+BAkXrB;yBArZe,cAAc"}
|
|
@@ -43,6 +43,8 @@ import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
|
43
43
|
import { useLocale } from "../i18n/index.js";
|
|
44
44
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
45
45
|
import english from "../i18n/generated-english/DateRangeInput/DateRangeInput.generated.js";
|
|
46
|
+
import "../Layer/layerViewportInset.stylex.js";
|
|
47
|
+
import { layerViewportInset } from "../Layer/layerViewportInset.stylex.js";
|
|
46
48
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
47
49
|
registerEnglishFallback(english);
|
|
48
50
|
const styles = {
|
|
@@ -63,6 +65,12 @@ const styles = {
|
|
|
63
65
|
kkrTdU: "xt0e3qv",
|
|
64
66
|
$$css: true
|
|
65
67
|
},
|
|
68
|
+
calendarPane: {
|
|
69
|
+
keTefX: "x1furv9r",
|
|
70
|
+
kCS8Yb: "x1rnznto",
|
|
71
|
+
kzQI83: "xq3h3fj",
|
|
72
|
+
$$css: true
|
|
73
|
+
},
|
|
66
74
|
presetButton: {
|
|
67
75
|
k1xSpc: "x1lliihq",
|
|
68
76
|
kzqmXN: "xh8yej3",
|
|
@@ -421,57 +429,63 @@ export function DateRangeInput({
|
|
|
421
429
|
}), isEffectivelyRequired && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
422
430
|
id: requiredID,
|
|
423
431
|
children: t('@astryx.field.required')
|
|
424
|
-
}), popover.render(/*#__PURE__*/
|
|
432
|
+
}), popover.render(/*#__PURE__*/_jsx("div", {
|
|
425
433
|
...{
|
|
426
|
-
className: "
|
|
434
|
+
className: "x1odjw0f xish69e x3v4n1"
|
|
427
435
|
},
|
|
428
|
-
children:
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
436
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
437
|
+
...{
|
|
438
|
+
className: "x78zum5 x1a02dak x7giv3"
|
|
439
|
+
},
|
|
440
|
+
children: [presets && presets.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
441
|
+
role: "group",
|
|
442
|
+
"aria-label": t('@astryx.dateRangeInput.presetDateRanges'),
|
|
443
|
+
...mergeProps(themeProps('date-range-input-presets'), {
|
|
444
|
+
className: "x78zum5 xdt5ytf xzye2dw x1b2ylru xw8tdv1 x18b5jzi xl0t3rv x92x3c3 x1q0q8m5 xib2hle x10xtbk5 xmtqr6q x1iyjqo2 x1d77m7x"
|
|
445
|
+
}),
|
|
446
|
+
children: presets.map(preset => {
|
|
447
|
+
const presetRange = preset.getRange();
|
|
448
|
+
const isActive = isRangeEqual(value, presetRange);
|
|
449
|
+
const isPresetDisabled = isDisabled || !isRangeWithinSpan(presetRange, maxRangeSpan, minRangeSpan) || isDateDisabled(plainDateFromISO(presetRange.start)) || isDateDisabled(plainDateFromISO(presetRange.end));
|
|
450
|
+
return /*#__PURE__*/_jsx("button", {
|
|
451
|
+
type: "button"
|
|
452
|
+
// These presets are independent action buttons navigated by
|
|
453
|
+
// Tab, not a single-tab-stop listbox — so they are a labeled
|
|
454
|
+
// group of buttons, and the currently-applied preset is
|
|
455
|
+
// marked with aria-current (not aria-selected, a listbox
|
|
456
|
+
// concept that contradicted the Tab interaction) (forms-5).
|
|
457
|
+
,
|
|
458
|
+
"aria-current": isActive ? 'true' : undefined
|
|
459
|
+
// Focusable while disabled (AR3, spec:AST-085 FR1).
|
|
460
|
+
,
|
|
461
|
+
"aria-disabled": isPresetDisabled || undefined,
|
|
462
|
+
"aria-describedby": showsDisabledMessage ? disabledMessageTooltip.describedBy : undefined,
|
|
463
|
+
onClick: () => {
|
|
464
|
+
if (!isPresetDisabled) {
|
|
465
|
+
handleRangeSelect(presetRange);
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
...mergeProps(themeProps('date-range-input-preset', {
|
|
469
|
+
selected: isActive ? 'selected' : null,
|
|
470
|
+
disabled: isPresetDisabled ? 'disabled' : null
|
|
471
|
+
}), stylex.props(focusOutlineStyles.focusVisible, styles.presetButton, isActive && styles.presetButtonActive, isPresetDisabled && styles.presetButtonDisabled)),
|
|
472
|
+
children: preset.label
|
|
473
|
+
}, preset.label);
|
|
474
|
+
})
|
|
475
|
+
}), popover.isOpen && /*#__PURE__*/_jsx(Calendar, {
|
|
476
|
+
mode: "range",
|
|
477
|
+
value: optimisticValue,
|
|
478
|
+
onChange: handleRangeSelect,
|
|
479
|
+
min: min,
|
|
480
|
+
max: max,
|
|
481
|
+
dateConstraints: dateConstraints,
|
|
482
|
+
maxRangeSpan: maxRangeSpan,
|
|
483
|
+
minRangeSpan: minRangeSpan,
|
|
484
|
+
numberOfMonths: numberOfMonths,
|
|
485
|
+
weekStartsOn: weekStartsOn,
|
|
486
|
+
xstyle: presets && presets.length > 0 && styles.calendarPane
|
|
487
|
+
})]
|
|
488
|
+
})
|
|
475
489
|
}), {
|
|
476
490
|
placement: 'below',
|
|
477
491
|
alignment: 'start'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA4B5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAMhD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AA6B9C;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD,4EAA4E;AAC5E,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,mBAAmB;IACzD,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAuBD,2FAA2F;AAC3F,eAAO,MAAM,uCAAuC;;;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MAAM,CAAC;IAExB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EAAE,UAAU,EAClB,QAAgB,EAChB,YAAY,EACZ,KAAW,EACX,SAAmB,EACnB,QAAQ,EACR,OAAoB,EACpB,OAAgB,EAChB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,sCAoab;yBApbe,MAAM"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -54,7 +54,7 @@ import { DialogContext } from "./DialogContext.js";
|
|
|
54
54
|
import { themeProps } from "../utils/themeProps.js";
|
|
55
55
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
56
56
|
import { useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
57
|
-
import { focusForLastInput } from "../utils/focusReturn.js";
|
|
57
|
+
import { focusForLastInput, isFocusLost } from "../utils/focusReturn.js";
|
|
58
58
|
import { ModalAnnounceProvider } from "../hooks/ModalAnnounceProvider.js";
|
|
59
59
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
60
60
|
/**
|
|
@@ -458,6 +458,42 @@ export function Dialog({
|
|
|
458
458
|
}
|
|
459
459
|
}, [isOpen, isInline]);
|
|
460
460
|
|
|
461
|
+
// A dialog that unmounts while open (rendered only while open, or removed
|
|
462
|
+
// with the rest of a view) never runs the close branch above, and removing a
|
|
463
|
+
// <dialog> does not run the browser's own focus return. Focus left inside
|
|
464
|
+
// it, or dropped to the body by the removal, goes back to the opener.
|
|
465
|
+
useEffect(() => {
|
|
466
|
+
if (isInline) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
const dialog = dialogRef.current;
|
|
470
|
+
// Read now: a removed iframe's document has no window, so its frame
|
|
471
|
+
// element can no longer be found once the dialog is gone.
|
|
472
|
+
const host = dialog?.ownerDocument.defaultView?.frameElement ?? null;
|
|
473
|
+
return () => {
|
|
474
|
+
const trigger = triggerElementRef.current;
|
|
475
|
+
if (dialog == null || trigger == null) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
// Checked once the commit has finished: StrictMode's simulated unmount
|
|
479
|
+
// leaves the dialog in the document, and only a real removal returns
|
|
480
|
+
// focus.
|
|
481
|
+
queueMicrotask(() => {
|
|
482
|
+
if (dialog.isConnected || !trigger.isConnected) {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
// isFocusLost reads the dialog's own document. For a dialog in an
|
|
486
|
+
// iframe, the document that hosts the frame must also have lost focus
|
|
487
|
+
// or keep it on that frame, wherever the opener is: a control the
|
|
488
|
+
// user pressed outside the frame to remove the dialog, or the frame
|
|
489
|
+
// itself, keeps its focus.
|
|
490
|
+
if (isFocusLost(dialog) && (host == null || isFocusLost(host))) {
|
|
491
|
+
focusForLastInput(trigger);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
};
|
|
495
|
+
}, [isInline]);
|
|
496
|
+
|
|
461
497
|
// Host app-global surfaces (toasts) inside this modal while it is open, so
|
|
462
498
|
// they stay visible and operable above it.
|
|
463
499
|
useModalOutlet(dialogRef, isOpen && !isInline);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawerDialogPresence.d.ts","sourceRoot":"","sources":["../../src/Drawer/useDrawerDialogPresence.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useDrawerDialogPresence.d.ts","sourceRoot":"","sources":["../../src/Drawer/useDrawerDialogPresence.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAcf,KAAK,8BAA8B,GAAG;IACpC,SAAS,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAClD,CAAC;AA0DF;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,MAAM,EACN,OAAO,EACP,aAAa,GACd,EAAE,8BAA8B,GAAG,IAAI,CAoEvC"}
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { useEffect, useRef } from 'react';
|
|
27
27
|
import { flushSync } from 'react-dom';
|
|
28
|
+
import { notifyTopLayerEntry } from "../Layer/modalOutlet.js";
|
|
28
29
|
|
|
29
30
|
/** Slack past the computed transition before the backstop gives up waiting. */
|
|
30
31
|
const EXIT_BACKSTOP_BUFFER_MS = 50;
|
|
@@ -51,6 +52,9 @@ function showDrawerHost(dialog, isModal) {
|
|
|
51
52
|
dialog.showModal();
|
|
52
53
|
} else if (typeof dialog.showPopover === 'function') {
|
|
53
54
|
dialog.showPopover();
|
|
55
|
+
// The drawer is now the newest top-layer entry: global hosts shown before
|
|
56
|
+
// it (the toast viewport) re-enter above it, as they do above a modal.
|
|
57
|
+
notifyTopLayerEntry();
|
|
54
58
|
} else {
|
|
55
59
|
// Reduced fallback for browsers below the Popover API support floor.
|
|
56
60
|
dialog.show();
|