@astryxdesign/core 0.7.7-canary.bf14580 → 0.7.7-canary.c19ca12
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/AlertDialog/AlertDialog.d.ts +4 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +36 -6
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +76 -6
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +23 -4
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +5 -4
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +3 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +47 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +13 -2
- package/dist/ComplexSelector/ComplexSelector.d.ts +4 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +14 -4
- package/dist/ContextMenu/ContextMenu.js +2 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +13 -27
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +22 -41
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +7 -31
- package/dist/Field/Field.js +2 -2
- package/dist/HoverCard/HoverCard.d.ts +4 -3
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +27 -2
- package/dist/HoverCard/useHoverCard.d.ts +5 -4
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +17 -31
- package/dist/Icon/Icon.d.ts +5 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +5 -2
- package/dist/Layer/layerAnimations.stylex.d.ts +7 -8
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +25 -20
- package/dist/Layer/usePressPin.d.ts +17 -5
- package/dist/Layer/usePressPin.d.ts.map +1 -1
- package/dist/Layer/usePressPin.js +62 -12
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +18 -0
- package/dist/PowerSearch/PowerSearch.d.ts +36 -3
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +522 -269
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +100 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.js +1913 -0
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +32 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +17 -6
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +38 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +170 -61
- package/dist/PowerSearch/formatFilterValue.d.ts +7 -0
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +11 -1
- package/dist/PowerSearch/formatTokenValue.d.ts +28 -0
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -0
- package/dist/PowerSearch/formatTokenValue.js +160 -0
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts +65 -0
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +1 -0
- package/dist/PowerSearch/powerSearchSheetUtils.js +168 -0
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +3 -2
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +5 -3
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Spinner/Spinner.d.ts +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +60 -58
- package/dist/Switch/useSwitchTouch.js +4 -4
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -8
- package/dist/TextInput/TextInput.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +10 -7
- package/dist/Toast/Toast.d.ts +11 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +25 -15
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +94 -34
- package/dist/Toast/types.d.ts +9 -3
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Token/Token.d.ts +2 -2
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +12 -4
- package/dist/Token/TokenNamingContext.d.ts +14 -0
- package/dist/Token/TokenNamingContext.d.ts.map +1 -0
- package/dist/Token/TokenNamingContext.js +23 -0
- package/dist/Tooltip/useTooltip.d.ts +19 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +34 -53
- package/dist/Typeahead/TypeaheadItem.d.ts +2 -1
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/animator/createAnimator.d.ts +98 -0
- package/dist/animator/createAnimator.d.ts.map +1 -0
- package/dist/animator/createAnimator.js +259 -0
- package/dist/astryx.css +22 -6
- package/dist/gestures/GestureHost.d.ts +27 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +90 -8
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +4 -3
- package/dist/hooks/actionGroupTracker.d.ts +4 -1
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +13 -3
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/pressGroupContext.d.ts +6 -0
- package/dist/hooks/pressGroupContext.d.ts.map +1 -0
- package/dist/hooks/pressGroupContext.js +20 -0
- package/dist/hooks/useActionGroupTracking.d.ts +53 -0
- package/dist/hooks/useActionGroupTracking.d.ts.map +1 -0
- package/dist/hooks/useActionGroupTracking.js +174 -0
- package/dist/hooks/useAnimator.d.ts +41 -0
- package/dist/hooks/useAnimator.d.ts.map +1 -0
- package/dist/hooks/useAnimator.js +70 -0
- package/dist/hooks/useAttachment.d.ts +1 -1
- package/dist/hooks/useAttachment.js +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +2 -2
- package/dist/hooks/useLongPress.d.ts +6 -2
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +95 -15
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +4 -2
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +42 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +6 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +14 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +30 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +30 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/internal/indicatorPress.stylex.d.ts +20 -0
- package/dist/internal/indicatorPress.stylex.d.ts.map +1 -0
- package/dist/internal/indicatorPress.stylex.js +26 -0
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +41 -18
- package/dist/motion/reducedMotion.d.ts +24 -0
- package/dist/motion/reducedMotion.d.ts.map +1 -1
- package/dist/motion/reducedMotion.js +78 -1
- package/dist/motion/uikit/alert.d.ts +41 -0
- package/dist/motion/uikit/alert.d.ts.map +1 -0
- package/dist/motion/uikit/alert.js +43 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +15 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressGroupItem.stylex.js +23 -0
- package/dist/utils/clickGuard.d.ts +8 -1
- package/dist/utils/clickGuard.d.ts.map +1 -1
- package/dist/utils/clickGuard.js +24 -1
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +12 -0
- package/dist/utils/focusReturn.d.ts +15 -0
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +28 -0
- package/dist/utils/interactionOverlay.stylex.d.ts +3 -2
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +3 -2
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +19 -6
- package/dist/utils/triggerFocus.d.ts +36 -0
- package/dist/utils/triggerFocus.d.ts.map +1 -0
- package/dist/utils/triggerFocus.js +65 -0
- package/locales/en.json +120 -0
- package/locales/pseudo.json +90 -0
- package/package.json +9 -4
- package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
- package/src/AlertDialog/AlertDialog.tsx +37 -5
- package/src/BottomSheet/BottomSheet.tsx +85 -5
- package/src/BottomSheet/BottomSheetPanel.tsx +40 -5
- package/src/BottomSheet/bottomSheetStack.ts +8 -4
- package/src/BottomSheet/useSheetGestures.ts +3 -1
- package/src/Button/Button.tsx +63 -5
- package/src/CheckboxInput/CheckboxInput.doc.mjs +18 -0
- package/src/CheckboxInput/CheckboxInput.tsx +36 -9
- package/src/ComplexSelector/ComplexSelector.tsx +20 -5
- package/src/ContextMenu/ContextMenu.tsx +2 -2
- package/src/DateInput/MonthScroller.tsx +18 -22
- package/src/DateInput/Wheel.tsx +30 -32
- package/src/Dialog/Dialog.tsx +10 -31
- package/src/Field/Field.tsx +2 -2
- package/src/HoverCard/HoverCard.doc.mjs +4 -2
- package/src/HoverCard/HoverCard.tsx +35 -4
- package/src/HoverCard/useHoverCard.doc.mjs +178 -36
- package/src/HoverCard/useHoverCard.tsx +46 -52
- package/src/Icon/Icon.doc.mjs +49 -8
- package/src/Icon/Icon.tsx +15 -7
- package/src/Layer/layerAnimations.stylex.ts +24 -16
- package/src/Layer/usePressPin.ts +81 -15
- package/src/Lightbox/Lightbox.tsx +18 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +54 -5
- package/src/PowerSearch/PowerSearch.tsx +734 -288
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +2515 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +28 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +203 -38
- package/src/PowerSearch/formatFilterValue.ts +18 -1
- package/src/PowerSearch/formatTokenValue.ts +215 -0
- package/src/PowerSearch/powerSearchSheetUtils.ts +224 -0
- package/src/RadioList/RadioList.tsx +3 -2
- package/src/RadioList/RadioListItem.tsx +5 -3
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +6 -3
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +77 -63
- package/src/Switch/useSwitchTouch.ts +4 -4
- package/src/Table/BaseTable.tsx +46 -12
- package/src/TextInput/TextInput.tsx +11 -10
- package/src/Toast/Toast.doc.mjs +4 -3
- package/src/Toast/Toast.tsx +52 -32
- package/src/Toast/ToastViewport.tsx +121 -35
- package/src/Toast/types.ts +9 -3
- package/src/Token/Token.tsx +13 -4
- package/src/Token/TokenNamingContext.ts +28 -0
- package/src/Tooltip/useTooltip.doc.mjs +24 -0
- package/src/Tooltip/useTooltip.tsx +61 -56
- package/src/Typeahead/TypeaheadItem.doc.mjs +6 -3
- package/src/Typeahead/TypeaheadItem.tsx +2 -1
- package/src/animator/createAnimator.doc.mjs +153 -0
- package/src/animator/createAnimator.ts +324 -0
- package/src/gestures/GestureHost.ts +105 -10
- package/src/gestures/PressTracker.ts +4 -3
- package/src/gestures/README.md +7 -1
- package/src/hooks/actionGroupTracker.ts +20 -5
- package/src/hooks/index.ts +2 -0
- package/src/hooks/pressGroupContext.ts +21 -0
- package/src/hooks/useActionGroupTracking.ts +224 -0
- package/src/hooks/useAnimator.doc.mjs +109 -0
- package/src/hooks/useAnimator.ts +67 -0
- package/src/hooks/useAttachment.ts +1 -1
- package/src/hooks/useInputStatusIcon.tsx +3 -2
- package/src/hooks/useLongPress.doc.mjs +2 -2
- package/src/hooks/useLongPress.ts +136 -15
- package/src/hooks/useMenuPress.ts +8 -2
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +43 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +6 -0
- package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +15 -0
- package/src/i18n/generated-locales/en.generated.ts +41 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +42 -0
- package/src/index.ts +13 -0
- package/src/internal/indicatorPress.stylex.ts +24 -0
- package/src/motion/README.md +8 -5
- package/src/motion/animator.ts +61 -29
- package/src/motion/reducedMotion.ts +79 -1
- package/src/motion/uikit/alert.ts +43 -0
- package/src/privateAttributes/pressGroupItem.stylex.ts +23 -0
- package/src/utils/clickGuard.ts +37 -1
- package/src/utils/dateParser.ts +16 -0
- package/src/utils/focusReturn.ts +30 -0
- package/src/utils/interactionOverlay.stylex.ts +3 -2
- package/src/utils/pressFeedback.ts +19 -6
- package/src/utils/triggerFocus.ts +80 -0
package/dist/Spinner/Spinner.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/Spinner/Spinner.doc.mjs
|
|
13
|
-
* - /packages/core/src/Spinner/Spinner.test.tsx
|
|
13
|
+
* - /packages/core/src/Spinner/Spinner.test.tsx and __tests__/SpinnerMotion.a11y.chromium.spec.ts (rotor timing)
|
|
14
14
|
* - /packages/core/src/Spinner/index.ts
|
|
15
15
|
* - /apps/storybook/stories/Spinner.stories.tsx
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/Spinner/ (showcase blocks)
|
|
@@ -156,59 +156,54 @@ function registerSpinnerVars() {
|
|
|
156
156
|
registerSpinnerVars();
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
|
-
* Pin every ring's
|
|
160
|
-
*
|
|
159
|
+
* Pin every ring's rotation to the document timeline's origin instead of its
|
|
160
|
+
* own start time, so spinners mounted seconds apart stay in phase.
|
|
161
161
|
*
|
|
162
|
-
* Setting `startTime` is exact where arithmetic on a clock read is not
|
|
162
|
+
* Setting `startTime` is exact where arithmetic on a clock read is not. A
|
|
163
163
|
* negative `animation-delay` computed at mount is only as good as the gap
|
|
164
|
-
* between
|
|
165
|
-
*
|
|
166
|
-
* literal rotation; the same drift risk applies to the dash offset now).
|
|
164
|
+
* between the clock read and the frame the animation starts in. At 10x CPU
|
|
165
|
+
* throttling that gap measured 116 degrees of drift.
|
|
167
166
|
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
167
|
+
* Rotors are collected and pinned in one frame. `getAnimations()` resolves
|
|
168
|
+
* style, and `startTime` dirties it again. So pinning them one at a time makes
|
|
169
|
+
* each mount re-force what the previous one invalidated: 53 style recalcs for
|
|
170
|
+
* 38 spinners, against 19 batched.
|
|
172
171
|
*/
|
|
173
|
-
const
|
|
172
|
+
const pendingRotors = new Set();
|
|
174
173
|
let flushScheduled = false;
|
|
175
|
-
function
|
|
174
|
+
function pinRotorsToTimelineOrigin() {
|
|
176
175
|
flushScheduled = false;
|
|
177
176
|
const animations = [];
|
|
178
|
-
for (const
|
|
179
|
-
|
|
180
|
-
// this ref sits on (#6253), so it needs subtree:true to be found here.
|
|
181
|
-
animations.push(...svg.getAnimations({
|
|
182
|
-
subtree: true
|
|
183
|
-
}));
|
|
177
|
+
for (const rotor of pendingRotors) {
|
|
178
|
+
animations.push(...rotor.getAnimations());
|
|
184
179
|
}
|
|
185
|
-
|
|
180
|
+
pendingRotors.clear();
|
|
186
181
|
for (const animation of animations) {
|
|
187
182
|
animation.startTime = 0;
|
|
188
183
|
}
|
|
189
184
|
}
|
|
190
185
|
|
|
191
186
|
/**
|
|
192
|
-
* Ref callback for the
|
|
187
|
+
* Ref callback for the rotor: the one place a mounted ring touches the DOM.
|
|
193
188
|
*
|
|
194
189
|
* It reads nothing back — the geometry is resolved by the cascade, not in JS.
|
|
195
190
|
*/
|
|
196
|
-
function syncRotationPhase(
|
|
197
|
-
if (
|
|
191
|
+
function syncRotationPhase(rotor) {
|
|
192
|
+
if (rotor == null) {
|
|
198
193
|
return undefined;
|
|
199
194
|
}
|
|
200
195
|
// jsdom implements no Web Animations, and this runs in every consumer's
|
|
201
196
|
// component tests.
|
|
202
|
-
if (typeof
|
|
197
|
+
if (typeof rotor.getAnimations !== 'function') {
|
|
203
198
|
return undefined;
|
|
204
199
|
}
|
|
205
|
-
|
|
200
|
+
pendingRotors.add(rotor);
|
|
206
201
|
if (!flushScheduled) {
|
|
207
202
|
flushScheduled = true;
|
|
208
|
-
requestAnimationFrame(
|
|
203
|
+
requestAnimationFrame(pinRotorsToTimelineOrigin);
|
|
209
204
|
}
|
|
210
205
|
return () => {
|
|
211
|
-
|
|
206
|
+
pendingRotors.delete(rotor);
|
|
212
207
|
};
|
|
213
208
|
}
|
|
214
209
|
|
|
@@ -217,17 +212,11 @@ function syncRotationPhase(svg) {
|
|
|
217
212
|
// =============================================================================
|
|
218
213
|
|
|
219
214
|
/**
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* angle, which reads as a visible wobble on iOS Safari independent of
|
|
224
|
-
* compositing (#6253) — confirmed by a real-device test against this exact
|
|
225
|
-
* fix, since `willChange`/layer promotion alone (the earlier fix for #3617)
|
|
226
|
-
* only smooths the rotation's motion, not the per-frame stroke rasterization.
|
|
227
|
-
* A static circle with an animated `stroke-dashoffset` never rotates, so
|
|
228
|
-
* WebKit never re-rasterizes the cap at an intermediate angle at all.
|
|
215
|
+
* A `transform` animation runs on the compositor, so the ring keeps turning
|
|
216
|
+
* while a script runs. A `stroke-dashoffset` animation would repaint the arc
|
|
217
|
+
* on the main thread every frame, so it would stop while a script runs.
|
|
229
218
|
*/
|
|
230
|
-
const
|
|
219
|
+
const rotation = "xqng64z-B";
|
|
231
220
|
|
|
232
221
|
// =============================================================================
|
|
233
222
|
// Styles
|
|
@@ -412,7 +401,7 @@ export function Spinner({
|
|
|
412
401
|
// localized default. The fallback is AT-facing text, so it goes through the
|
|
413
402
|
// translation runtime like visible text does.
|
|
414
403
|
const resolvedAriaLabel = ariaLabel ?? (typeof label === 'string' ? label : undefined) ?? t('@astryx.spinner.loading');
|
|
415
|
-
const spinner = /*#__PURE__*/
|
|
404
|
+
const spinner = /*#__PURE__*/_jsxs("span", {
|
|
416
405
|
ref: hasLabel ? undefined : ref,
|
|
417
406
|
role: "status",
|
|
418
407
|
"aria-label": namedByVisibleLabel ? undefined : resolvedAriaLabel,
|
|
@@ -441,35 +430,48 @@ export function Spinner({
|
|
|
441
430
|
width: `var(${BOX_SIZE}, ${frameSize}px)`,
|
|
442
431
|
height: `var(${BOX_SIZE}, ${frameSize}px)`
|
|
443
432
|
}),
|
|
444
|
-
children: /*#__PURE__*/
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
height: frameSize,
|
|
433
|
+
children: [/*#__PURE__*/_jsx("svg", {
|
|
434
|
+
width: 0,
|
|
435
|
+
height: 0,
|
|
448
436
|
"aria-hidden": "true",
|
|
449
437
|
...{
|
|
450
|
-
className: "xlp1x4z x1lliihq x6v0vjy x7yyq19 x1rea2x4"
|
|
438
|
+
className: "xlp1x4z x1lliihq x15r89dc x6v0vjy x7yyq19 x1rea2x4"
|
|
451
439
|
},
|
|
452
|
-
children:
|
|
440
|
+
children: /*#__PURE__*/_jsx("circle", {
|
|
453
441
|
cx: "50%",
|
|
454
442
|
cy: "50%",
|
|
455
443
|
r: diameter / 2,
|
|
456
444
|
strokeWidth: border,
|
|
457
445
|
...stylex.props(styles.circle, styles.track, trackOpacityStyles[shade])
|
|
458
|
-
})
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
,
|
|
467
|
-
|
|
446
|
+
})
|
|
447
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
448
|
+
ref: syncRotationPhase,
|
|
449
|
+
"aria-hidden": "true",
|
|
450
|
+
...{
|
|
451
|
+
className: "x1lliihq x15r89dc x6v0vjy x7yyq19 x1so62im x1qcljrn xnh0sag xa4qsjk x1ka1v4i x1esw782"
|
|
452
|
+
},
|
|
453
|
+
children: /*#__PURE__*/_jsx("svg", {
|
|
454
|
+
width: frameSize,
|
|
455
|
+
height: frameSize,
|
|
468
456
|
...{
|
|
469
|
-
className: "
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
|
|
457
|
+
className: "xlp1x4z x1lliihq x15r89dc x6v0vjy x7yyq19 x1rea2x4"
|
|
458
|
+
},
|
|
459
|
+
children: /*#__PURE__*/_jsx("circle", {
|
|
460
|
+
cx: "50%",
|
|
461
|
+
cy: "50%",
|
|
462
|
+
r: diameter / 2,
|
|
463
|
+
strokeWidth: border
|
|
464
|
+
// The size's own dash, for the render with no stylesheet. The rule
|
|
465
|
+
// above composes the same lengths from the resolved diameter, so a
|
|
466
|
+
// themed ring keeps this fraction of arc rather than this length.
|
|
467
|
+
,
|
|
468
|
+
strokeDasharray: `${arcLength} ${circumference - arcLength}`,
|
|
469
|
+
...{
|
|
470
|
+
className: "xbh8q5q x1764fhq x1g0ag68 x1owpc8m xio8zfp xgw3ha0 xtve3lm x9tu13d xdv9ggb"
|
|
471
|
+
}
|
|
472
|
+
})
|
|
473
|
+
})
|
|
474
|
+
})]
|
|
473
475
|
});
|
|
474
476
|
if (!hasLabel) {
|
|
475
477
|
return spinner;
|
|
@@ -20,7 +20,7 @@ import { getGestureHost } from "../gestures/GestureHost.js";
|
|
|
20
20
|
import { createPressTracker } from "../gestures/PressTracker.js";
|
|
21
21
|
import { isRtlElement } from "../hooks/isRtlElement.js";
|
|
22
22
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
23
|
-
import {
|
|
23
|
+
import { createMotionAnimator } from "../motion/animator.js";
|
|
24
24
|
import { solveSpring, toSpring } from "../motion/spring.js";
|
|
25
25
|
import { UIKIT_GESTURES } from "../motion/uikit/gestures.js";
|
|
26
26
|
import { registerSwitchTable, switchControl } from "../motion/uikit/switch.js";
|
|
@@ -203,10 +203,10 @@ export class SwitchTouchController {
|
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
205
|
registerSwitchTable();
|
|
206
|
-
this.thumb =
|
|
206
|
+
this.thumb = createMotionAnimator(elements.thumb);
|
|
207
207
|
// The layer rests clear (its class's opacity 0) while the visuals show
|
|
208
208
|
// the value; from here its opacity is the animator's.
|
|
209
|
-
this.fade =
|
|
209
|
+
this.fade = createMotionAnimator(elements.track, {
|
|
210
210
|
pseudoElement: '::after',
|
|
211
211
|
initial: {
|
|
212
212
|
opacity: 0
|
|
@@ -215,7 +215,7 @@ export class SwitchTouchController {
|
|
|
215
215
|
this.fade.set({
|
|
216
216
|
opacity: 0
|
|
217
217
|
});
|
|
218
|
-
this.shadow =
|
|
218
|
+
this.shadow = createMotionAnimator(elements.thumb, {
|
|
219
219
|
pseudoElement: '::after',
|
|
220
220
|
initial: {
|
|
221
221
|
opacity: 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseTable.d.ts","sourceRoot":"","sources":["../../src/Table/BaseTable.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseTable.d.ts","sourceRoot":"","sources":["../../src/Table/BaseTable.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AAEH,OAAO,EAIL,KAAK,YAAY,EAEjB,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,cAAc,EAYf,MAAM,SAAS,CAAC;AAkpBjB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS,EAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3E,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAA;CAAC,KACrD,YAAY,CAAC"}
|
package/dist/Table/BaseTable.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - /packages/core/src/Table/index.ts (exports if types change)
|
|
15
15
|
* - /packages/cli/assets/templates/blocks/components/Table/ (showcase blocks)
|
|
16
16
|
*/
|
|
17
|
-
import { memo, useRef } from 'react';
|
|
17
|
+
import { memo, useId, useRef } from 'react';
|
|
18
18
|
import { isRenderable } from "../utils/isRenderable.js";
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
20
|
import "../theme/tokens.stylex.js";
|
|
@@ -317,6 +317,7 @@ function BaseTableInner({
|
|
|
317
317
|
});
|
|
318
318
|
|
|
319
319
|
// --- Plugin pipeline: header cells ---
|
|
320
|
+
const headerLabelIdBase = useId();
|
|
320
321
|
const headerCells = resolvedColumns.map((col, columnIndex) => {
|
|
321
322
|
const headerContent = col.header ?? col.key;
|
|
322
323
|
|
|
@@ -367,16 +368,36 @@ function BaseTableInner({
|
|
|
367
368
|
below
|
|
368
369
|
} = cellRenderProps;
|
|
369
370
|
const hasSlots = before != null || after != null || overlay != null || below != null;
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
children: [resolvedContent, after]
|
|
376
|
-
}) : resolvedContent, overlay, below]
|
|
371
|
+
const labelRow = isRenderable(after) ? /*#__PURE__*/_jsxs("div", {
|
|
372
|
+
...{
|
|
373
|
+
className: "x3nfvp2 x6s0dn4 xzye2dw xeuugli"
|
|
374
|
+
},
|
|
375
|
+
children: [resolvedContent, after]
|
|
377
376
|
}) : resolvedContent;
|
|
377
|
+
|
|
378
|
+
// The overlay is a control of its own. Keep its name and value out of the
|
|
379
|
+
// header's name.
|
|
380
|
+
const namesOwnHeader = isRenderable(overlay) && mergedHtmlProps['aria-label'] == null && mergedHtmlProps['aria-labelledby'] == null;
|
|
381
|
+
const labelId = `${headerLabelIdBase}-label-${columnIndex}`;
|
|
382
|
+
const belowId = `${headerLabelIdBase}-below-${columnIndex}`;
|
|
383
|
+
const hasBelow = isRenderable(below);
|
|
384
|
+
const headerInner = !hasSlots ? resolvedContent : namesOwnHeader ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
385
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
386
|
+
id: labelId,
|
|
387
|
+
children: [before, labelRow]
|
|
388
|
+
}), overlay, hasBelow && /*#__PURE__*/_jsx("div", {
|
|
389
|
+
id: belowId,
|
|
390
|
+
children: below
|
|
391
|
+
})]
|
|
392
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
393
|
+
children: [before, labelRow, overlay, below]
|
|
394
|
+
});
|
|
395
|
+
const headerNameProps = namesOwnHeader ? {
|
|
396
|
+
'aria-labelledby': hasBelow ? `${labelId} ${belowId}` : labelId
|
|
397
|
+
} : {};
|
|
378
398
|
return /*#__PURE__*/_jsx(HeaderCellComponent, {
|
|
379
399
|
...mergedHtmlProps,
|
|
400
|
+
...headerNameProps,
|
|
380
401
|
...headerTitleProp,
|
|
381
402
|
contextMenuActions: cellRenderProps.contextMenuActions,
|
|
382
403
|
xstyle: cellRenderProps.xstyle,
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { type ChangeEvent, type KeyboardEvent, type ReactNode } from 'react';
|
|
16
16
|
import * as stylex from '@stylexjs/stylex';
|
|
17
|
-
import {
|
|
18
|
-
import { type IconType } from '../Icon/
|
|
17
|
+
import type { InputStatus } from '../Field/types.js';
|
|
18
|
+
import { type IconType } from '../Icon/Icon.js';
|
|
19
19
|
import { type TextEntryTraitProps } from '../Field/textEntryTraits.js';
|
|
20
20
|
declare const sizeStyles: Readonly<{
|
|
21
21
|
readonly sm: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAe3C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,cAAc,CAAC;AAO3D,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAkClC,QAAA,MAAM,UAAU;;;;;;;;;;EAUd,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,UAAU,CAAC;AAMpD,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,eAAe,IAAI,mBAAmB,GACvC,MAAM,UAAU,CAAC;AASlB,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAK9C,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AAQxE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACvB,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3D,MAAM,WAAW,cACf,SACE,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,cAAc,CAAC,EACtD,mBAAmB;IACrB,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACrE,qEAAqE;IACrE,YAAY,CAAC,EAAE,CACb,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAC7B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,8DAA8D;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD;;;;;OAKG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,cAAc,CAAC,CAAC;IAC3E;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAa,EACb,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAU,EAAE,cAAsB,EAClC,UAAkB,EAClB,eAAe,EACf,SAAS,EACT,MAAM,EACN,aAA0B,EAC1B,IAAI,EAAE,QAAQ,EACd,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,WAAW,EACX,YAAY,EACZ,QAAgB,EAChB,YAAoB,EACpB,QAAQ,EACR,OAAO,EACP,SAAS,EACT,YAAY,EACZ,SAAS,EACT,cAAc,EACd,cAAc,EACd,aAAa,EACb,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,EAAE,EAAE,MAAM,EACV,kBAAkB,EAAE,mBAAmB,EACvC,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,SAAS,EACb,EAAE,cAAc,+BA+QhB;yBAzTe,SAAS"}
|
|
@@ -20,13 +20,16 @@ import { use, useId, useOptimistic, useTransition, useCallback, useRef } from 'r
|
|
|
20
20
|
import * as stylex from '@stylexjs/stylex';
|
|
21
21
|
import "../theme/tokens.stylex.js";
|
|
22
22
|
import { colorVars, sizeVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
23
|
-
import { Field
|
|
24
|
-
import {
|
|
23
|
+
import { Field } from "../Field/Field.js";
|
|
24
|
+
import { InputClearButton } from "../Field/InputClearButton.js";
|
|
25
|
+
import { inputWrapperStyles, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputStatusFocusWithinStyles } from "../Field/inputStyles.stylex.js";
|
|
26
|
+
import { renderIconSlot } from "../Icon/Icon.js";
|
|
25
27
|
import { isRenderable } from "../utils/isRenderable.js";
|
|
26
|
-
import { Spinner } from "../Spinner/
|
|
27
|
-
import { useTooltip } from "../Tooltip/
|
|
28
|
-
import { VisuallyHidden } from "../VisuallyHidden/
|
|
29
|
-
import { getInputARIA
|
|
28
|
+
import { Spinner } from "../Spinner/Spinner.js";
|
|
29
|
+
import { useTooltip } from "../Tooltip/useTooltip.js";
|
|
30
|
+
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
31
|
+
import { getInputARIA } from "../utils/inputAria.js";
|
|
32
|
+
import { isImeKeyEvent } from "../utils/ime.js";
|
|
30
33
|
import { textEntryTraitAttributes } from "../Field/textEntryTraits.js";
|
|
31
34
|
import { joinAriaIDs } from "../utils/inputAria.js";
|
|
32
35
|
const sizeStyles = {
|
|
@@ -47,7 +50,7 @@ import { groupStyles, inputGroupItemProps } from "../InputGroup/groupStyles.js";
|
|
|
47
50
|
|
|
48
51
|
// Re-export shared types for convenience
|
|
49
52
|
|
|
50
|
-
import { mergeProps } from "../utils/
|
|
53
|
+
import { mergeProps } from "../utils/mergeProps.js";
|
|
51
54
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
52
55
|
import { useInputContainer } from "../hooks/useInputContainer.js";
|
|
53
56
|
import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
package/dist/Toast/Toast.d.ts
CHANGED
|
@@ -18,6 +18,16 @@ export interface ToastProps {
|
|
|
18
18
|
}
|
|
19
19
|
interface ToastSurfaceProps extends ToastProps {
|
|
20
20
|
gestureDirection: ToastGestureDirection;
|
|
21
|
+
/**
|
|
22
|
+
* Changes when a uniqueID overwrite updates this card in place: the new
|
|
23
|
+
* toast's auto-hide timer starts over.
|
|
24
|
+
*/
|
|
25
|
+
timerKey?: string;
|
|
26
|
+
/**
|
|
27
|
+
* False when the viewport announces the toast: the card then carries no
|
|
28
|
+
* live region of its own, so an update in place is announced once.
|
|
29
|
+
*/
|
|
30
|
+
isLiveRegion?: boolean;
|
|
21
31
|
}
|
|
22
32
|
/**
|
|
23
33
|
* Individual toast notification.
|
|
@@ -43,7 +53,7 @@ export declare function Toast(props: ToastProps): import("react").JSX.Element;
|
|
|
43
53
|
export declare namespace Toast {
|
|
44
54
|
var displayName: string;
|
|
45
55
|
}
|
|
46
|
-
export declare function ToastSurface({ type, body, endContent, isAutoHide, autoHideDuration, isExiting, onDismiss, renderContent, gestureDirection, }: ToastSurfaceProps): import("react").JSX.Element;
|
|
56
|
+
export declare function ToastSurface({ type, body, endContent, isAutoHide, autoHideDuration, isExiting, onDismiss, renderContent, gestureDirection, timerKey, isLiveRegion, }: ToastSurfaceProps): import("react").JSX.Element;
|
|
47
57
|
export declare namespace ToastSurface {
|
|
48
58
|
var displayName: string;
|
|
49
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/Toast/Toast.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAa,SAAS,EAAY,MAAM,OAAO,CAAC;AAkB5D,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAkB,KAAK,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AA8F9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAChD;;;;OAIG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,UAAU,iBAAkB,SAAQ,UAAU;IAC5C,gBAAgB,EAAE,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/Toast/Toast.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAa,SAAS,EAAY,MAAM,OAAO,CAAC;AAkB5D,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAkB,KAAK,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AA8F9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAChD;;;;OAIG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,UAAU,iBAAkB,SAAQ,UAAU;IAC5C,gBAAgB,EAAE,qBAAqB,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,+BAEtC;yBAFe,KAAK;;;AAOrB,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,SAAiB,EACjB,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,YAAmB,GACpB,EAAE,iBAAiB,+BAqOnB;yBAjPe,YAAY"}
|
package/dist/Toast/Toast.js
CHANGED
|
@@ -85,7 +85,9 @@ export function ToastSurface({
|
|
|
85
85
|
isExiting = false,
|
|
86
86
|
onDismiss,
|
|
87
87
|
renderContent,
|
|
88
|
-
gestureDirection
|
|
88
|
+
gestureDirection,
|
|
89
|
+
timerKey,
|
|
90
|
+
isLiveRegion = true
|
|
89
91
|
}) {
|
|
90
92
|
const t = useComponentTranslator();
|
|
91
93
|
const timerRef = useRef(null);
|
|
@@ -117,10 +119,11 @@ export function ToastSurface({
|
|
|
117
119
|
onDismissRef.current('auto');
|
|
118
120
|
}, remainingRef.current);
|
|
119
121
|
}, [isAutoHide]);
|
|
122
|
+
|
|
123
|
+
// Pointer, focus and gesture holds are tracked whatever isAutoHide is: an
|
|
124
|
+
// overwrite can turn a toast that does not auto-hide into one that does
|
|
125
|
+
// while a hold is in place. The window hold leaves with its listeners.
|
|
120
126
|
const pauseTimer = useCallback(source => {
|
|
121
|
-
if (!isAutoHide) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
127
|
const sources = pauseSourcesRef.current;
|
|
125
128
|
const wasRunning = sources.size === 0;
|
|
126
129
|
sources.add(source);
|
|
@@ -135,11 +138,8 @@ export function ToastSurface({
|
|
|
135
138
|
const elapsed = Date.now() - startTimeRef.current;
|
|
136
139
|
remainingRef.current = Math.max(remainingRef.current - elapsed, 1000);
|
|
137
140
|
}
|
|
138
|
-
}, [
|
|
141
|
+
}, []);
|
|
139
142
|
const resumeTimer = useCallback(source => {
|
|
140
|
-
if (!isAutoHide) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
143
|
const sources = pauseSourcesRef.current;
|
|
144
144
|
if (!sources.delete(source)) {
|
|
145
145
|
return;
|
|
@@ -152,18 +152,25 @@ export function ToastSurface({
|
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
154
|
startTimer();
|
|
155
|
-
}, [
|
|
155
|
+
}, [startTimer]);
|
|
156
156
|
useEffect(() => {
|
|
157
157
|
remainingRef.current = autoHideDuration;
|
|
158
|
+
// An update in place can remove the focused control, which fires no blur:
|
|
159
|
+
// a focus hold whose focus has left the card is stale.
|
|
160
|
+
const root = cardRootRef.current?.current;
|
|
161
|
+
if (pauseSourcesRef.current.has('focus') && root != null && !root.contains(root.ownerDocument.activeElement)) {
|
|
162
|
+
pauseSourcesRef.current.delete('focus');
|
|
163
|
+
}
|
|
158
164
|
startTimer();
|
|
159
165
|
return () => {
|
|
160
166
|
if (timerRef.current) {
|
|
161
167
|
clearTimeout(timerRef.current);
|
|
162
168
|
}
|
|
163
169
|
};
|
|
164
|
-
// startTimer's identity is stable per isAutoHide, so this runs on mount
|
|
165
|
-
//
|
|
166
|
-
|
|
170
|
+
// startTimer's identity is stable per isAutoHide, so this runs on mount,
|
|
171
|
+
// on a genuine duration change and on an overwrite (timerKey), not on
|
|
172
|
+
// unrelated viewport renders.
|
|
173
|
+
}, [autoHideDuration, startTimer, timerKey]);
|
|
167
174
|
|
|
168
175
|
// Pause the auto-hide timer while the window is not focused, so a toast
|
|
169
176
|
// doesn't silently expire while the user is in another window or tab.
|
|
@@ -171,6 +178,7 @@ export function ToastSurface({
|
|
|
171
178
|
if (!isAutoHide) {
|
|
172
179
|
return;
|
|
173
180
|
}
|
|
181
|
+
const pauseSources = pauseSourcesRef.current;
|
|
174
182
|
const pauseForWindow = () => pauseTimer('window');
|
|
175
183
|
const resumeForWindow = () => resumeTimer('window');
|
|
176
184
|
window.addEventListener('blur', pauseForWindow);
|
|
@@ -183,6 +191,8 @@ export function ToastSurface({
|
|
|
183
191
|
return () => {
|
|
184
192
|
window.removeEventListener('blur', pauseForWindow);
|
|
185
193
|
window.removeEventListener('focus', resumeForWindow);
|
|
194
|
+
// With the listeners gone, no focus event would clear the window hold.
|
|
195
|
+
pauseSources.delete('window');
|
|
186
196
|
};
|
|
187
197
|
}, [isAutoHide, pauseTimer, resumeTimer]);
|
|
188
198
|
const isGesturePausing = useCallback(() => pauseSourcesRef.current.has('gesture'), []);
|
|
@@ -229,9 +239,9 @@ export function ToastSurface({
|
|
|
229
239
|
const fallbackMediaMode = isError || mode === 'light' ? 'dark' : 'light';
|
|
230
240
|
return /*#__PURE__*/_jsx("div", {
|
|
231
241
|
ref: rootRef,
|
|
232
|
-
role: isError ? 'alert' : 'status',
|
|
233
|
-
"aria-live": isError ? 'assertive' : 'polite',
|
|
234
|
-
"aria-atomic":
|
|
242
|
+
role: isLiveRegion ? isError ? 'alert' : 'status' : undefined,
|
|
243
|
+
"aria-live": isLiveRegion ? isError ? 'assertive' : 'polite' : undefined,
|
|
244
|
+
"aria-atomic": isLiveRegion ? 'true' : undefined,
|
|
235
245
|
onMouseEnter: pauseForPointer,
|
|
236
246
|
onMouseLeave: resumeForPointer,
|
|
237
247
|
onFocusCapture: pauseForFocus,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastViewport.d.ts","sourceRoot":"","sources":["../../src/Toast/ToastViewport.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToastViewport.d.ts","sourceRoot":"","sources":["../../src/Toast/ToastViewport.tsx"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAa,aAAa,EAAqB,MAAM,SAAS,CAAC;AAE3E,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAwItD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IACtE;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAiHD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAsB,EACtB,UAAc,EACd,KAAK,EACL,UAAU,EACV,UAAiB,EACjB,QAAQ,GACT,EAAE,kBAAkB,+BA6lBpB;yBApmBe,aAAa"}
|