@astryxdesign/core 0.7.7-canary.806d24c → 0.7.7-canary.8d809ad

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.
Files changed (69) hide show
  1. package/dist/DateInput/Wheel.d.ts +17 -1
  2. package/dist/DateInput/Wheel.d.ts.map +1 -1
  3. package/dist/DateInput/Wheel.js +179 -19
  4. package/dist/ProgressBar/ProgressBar.d.ts +1 -1
  5. package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
  6. package/dist/ProgressBar/ProgressBar.js +33 -6
  7. package/dist/Switch/Switch.d.ts +1 -1
  8. package/dist/Switch/Switch.d.ts.map +1 -1
  9. package/dist/Switch/Switch.js +200 -46
  10. package/dist/Switch/switchFill.d.ts +31 -0
  11. package/dist/Switch/switchFill.d.ts.map +1 -0
  12. package/dist/Switch/switchFill.js +88 -0
  13. package/dist/Switch/switchTouch.d.ts +81 -0
  14. package/dist/Switch/switchTouch.d.ts.map +1 -0
  15. package/dist/Switch/switchTouch.js +133 -0
  16. package/dist/Switch/useSwitchTouch.d.ts +285 -0
  17. package/dist/Switch/useSwitchTouch.d.ts.map +1 -0
  18. package/dist/Switch/useSwitchTouch.js +997 -0
  19. package/dist/Typeahead/Typeahead.d.ts.map +1 -1
  20. package/dist/Typeahead/Typeahead.js +26 -15
  21. package/dist/astryx.css +46 -2
  22. package/dist/gestures/GestureHost.d.ts.map +1 -1
  23. package/dist/gestures/GestureHost.js +4 -3
  24. package/dist/gestures/PressTracker.d.ts +6 -0
  25. package/dist/gestures/PressTracker.d.ts.map +1 -1
  26. package/dist/gestures/PressTracker.js +3 -0
  27. package/dist/gestures/types.d.ts +6 -0
  28. package/dist/gestures/types.d.ts.map +1 -1
  29. package/dist/gestures/usePressTracker.d.ts.map +1 -1
  30. package/dist/gestures/usePressTracker.js +1 -0
  31. package/dist/motion/uikit/index.d.ts +6 -4
  32. package/dist/motion/uikit/index.d.ts.map +1 -1
  33. package/dist/motion/uikit/index.js +6 -4
  34. package/dist/motion/uikit/progressBar.d.ts +27 -7
  35. package/dist/motion/uikit/progressBar.d.ts.map +1 -1
  36. package/dist/motion/uikit/progressBar.js +31 -11
  37. package/dist/motion/uikit/springs.d.ts +13 -29
  38. package/dist/motion/uikit/springs.d.ts.map +1 -1
  39. package/dist/motion/uikit/springs.js +16 -30
  40. package/dist/motion/uikit/switch.d.ts +166 -0
  41. package/dist/motion/uikit/switch.d.ts.map +1 -0
  42. package/dist/motion/uikit/switch.js +186 -0
  43. package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts +18 -0
  44. package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts.map +1 -0
  45. package/dist/privateAttributes/pressHoldsDrag.stylex.js +28 -0
  46. package/dist/utils/pressFeedback.d.ts.map +1 -1
  47. package/dist/utils/pressFeedback.js +5 -0
  48. package/package.json +4 -4
  49. package/src/DateInput/Wheel.tsx +174 -14
  50. package/src/ProgressBar/ProgressBar.doc.mjs +4 -2
  51. package/src/ProgressBar/ProgressBar.tsx +67 -7
  52. package/src/Switch/Switch.doc.mjs +3 -3
  53. package/src/Switch/Switch.tsx +412 -86
  54. package/src/Switch/switchFill.ts +106 -0
  55. package/src/Switch/switchTouch.ts +194 -0
  56. package/src/Switch/useSwitchTouch.ts +1117 -0
  57. package/src/Typeahead/Typeahead.tsx +29 -15
  58. package/src/gestures/GestureHost.ts +7 -3
  59. package/src/gestures/PressTracker.ts +10 -0
  60. package/src/gestures/types.ts +6 -0
  61. package/src/gestures/usePressTracker.ts +2 -0
  62. package/src/motion/MEASUREMENTS.md +29 -27
  63. package/src/motion/README.md +2 -1
  64. package/src/motion/uikit/index.ts +5 -4
  65. package/src/motion/uikit/progressBar.ts +31 -11
  66. package/src/motion/uikit/springs.ts +16 -30
  67. package/src/motion/uikit/switch.ts +174 -0
  68. package/src/privateAttributes/pressHoldsDrag.stylex.ts +28 -0
  69. package/src/utils/pressFeedback.ts +5 -0
@@ -3,7 +3,10 @@ export interface WheelOption {
3
3
  value: number;
4
4
  /** Row text. */
5
5
  label: string;
6
- /** Rows outside min/max stay visible but cannot be committed. */
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":"AA8MA,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,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;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAe,GAChB,EAAE,UAAU,+BAmOZ;yBAzOe,KAAK"}
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"}
@@ -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
- const scrollToIndex = useCallback((index, behavior) => {
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
- scroller.scrollTo({
124
- top: index * size,
125
- behavior
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 is bounced back to the committed one
130
- // rather than silently keeping a value the wheel is not showing.
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 option = options[index];
143
- if (option == null || option.isDisabled) {
144
- scrollToIndex(selectedIndex, 'smooth');
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
- if (option.value !== value) {
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 shown, or the
153
- // value is changed from outside (the calendar scrolled to another month).
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 || !isAtRestRef.current) {
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
- scroller.scrollTo({
172
- top: selectedIndex * size,
173
- behavior: 'auto'
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}`,
@@ -70,7 +70,7 @@ export interface ProgressBarProps extends BaseProps<HTMLDivElement> {
70
70
  * When true, renders an animated indeterminate progress indicator.
71
71
  * Use when the progress amount is unknown (e.g. loading, processing).
72
72
  * The `value` and `hasValueLabel` props are ignored in this mode.
73
- * Respects `prefers-reduced-motion` by slowing the animation.
73
+ * Under reduced motion it pulses in place instead of sliding.
74
74
  * @default false
75
75
  */
76
76
  isIndeterminate?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,K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,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAoZD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAS,EACT,GAAS,EACT,KAAK,EACL,aAAqB,EACrB,aAAqB,EACrB,gBAA0C,EAC1C,OAAkB,EAClB,eAAuB,EACvB,UAAkB,EAClB,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,UAAU,EACzB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,gBAAgB,+BA6KlB;yBA9Le,WAAW"}
@@ -4,7 +4,7 @@
4
4
 
5
5
  /**
6
6
  * @file ProgressBar.tsx
7
- * @input Uses React, useId, stylex, tokens and ProgressBarTouch
7
+ * @input Uses React, useId, stylex, tokens, ProgressBarTouch and resolveMotion
8
8
  * @output Exports ProgressBar component, ProgressBarProps, ProgressBarVariant types
9
9
  * @position Core implementation; consumed by index.ts
10
10
  *
@@ -25,6 +25,10 @@ import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
25
25
  import { themeProps } from "../utils/themeProps.js";
26
26
  import { VisuallyHidden } from "../VisuallyHidden/index.js";
27
27
  import { useProgressBarTouch } from "./ProgressBarTouch.js";
28
+ import { formatMotionRoleValue } from "../motion/roles.js";
29
+ import { resolveMotion } from "../motion/resolveMotion.js";
30
+ import { progressBar } from "../motion/uikit/progressBar.js";
31
+ import { timing } from "../motion/uikit/timing.js";
28
32
 
29
33
  // Every mark is wrapped in a Tooltip (marks always carry a label), so load it
30
34
  // lazily: a ProgressBar with no marks never bundles the Tooltip chunk. While it
@@ -57,6 +61,12 @@ const indeterminateSlide = "xr3m334-B";
57
61
  // physically left → right. The magnitudes mirror the LTR keyframe.
58
62
  const indeterminateSlideRtl = "x1c2q33o-B";
59
63
 
64
+ // Under reduced motion the indeterminate fill stops travelling and pulses in
65
+ // place. It goes from full opacity down to the pulse's floor
66
+ // (`--_progress-bar-pulse-floor`, the progress table's) and back. The
67
+ // animation alternates direction each pass.
68
+ const indeterminatePulse = "xml828b-B";
69
+
60
70
  // =============================================================================
61
71
  // Styles
62
72
  // =============================================================================
@@ -95,11 +105,12 @@ const styles = {
95
105
  k3XXqK: "x815t2r",
96
106
  kjBf7l: "x3teovq",
97
107
  kInvED: "xvr1dqx",
98
- kzqmXN: "xz84dc7",
108
+ kzqmXN: "xz84dc7 xie2s74",
99
109
  kaIpWk: "xjspbzw",
100
- kKVMdj: "xozk8ic xfd3fxj",
101
- k44tkh: "xmg6eyc xnh0sag",
102
- kyAemX: "x4hg4is",
110
+ kKVMdj: "xozk8ic xfd3fxj x1a94pi7 xfqa98z",
111
+ k44tkh: "xmg6eyc x1p2ibn3",
112
+ kyAemX: "x4hg4is x10xcq22",
113
+ kILWW9: "x4q6aw4",
103
114
  ko0y90: "xa4qsjk",
104
115
  $$css: true
105
116
  },
@@ -202,10 +213,25 @@ const markOnTrackStyles = {
202
213
  }
203
214
  };
204
215
 
216
+ // The reduced-motion pulse's variables, from the progress table.
217
+
205
218
  // `CSSProperties` has no index signature for custom properties, so the fill's
206
219
  // inline style — which publishes the filled share as the private
207
220
  // `--_progress-bar-fill` — needs this augmentation to typecheck.
208
221
 
222
+ /**
223
+ * The reduced-motion pulse plays the `progress.reducedMotionPulseMs` role on
224
+ * the `timing.curves.move` curve, down to the progress table's floor.
225
+ */
226
+ function pulseStyle(element) {
227
+ const pulseMs = resolveMotion(element, progressBar, 'reducedMotionPulseMs');
228
+ const curve = resolveMotion(element, timing.curves.move);
229
+ return {
230
+ '--_progress-bar-pulse': `${pulseMs}ms`,
231
+ '--_progress-bar-pulse-curve': formatMotionRoleValue('curve', curve),
232
+ '--_progress-bar-pulse-floor': String(progressBar.reducedMotionPulseFloor)
233
+ };
234
+ }
209
235
  function defaultFormatValueLabel(value, max) {
210
236
  const pct = max > 0 ? Math.round(value / max * 100) : 0;
211
237
  return `${pct}%`;
@@ -371,7 +397,8 @@ export function ProgressBar({
371
397
  children: isIndeterminate ? /*#__PURE__*/_jsx("div", {
372
398
  ...mergeProps(themeProps('progress-bar-fill', {
373
399
  variant: fillVariant
374
- }), stylex.props(styles.indeterminateFill, variantStyles[fillVariant]))
400
+ }), stylex.props(styles.indeterminateFill, variantStyles[fillVariant])),
401
+ style: pulseStyle(null)
375
402
  }) : /*#__PURE__*/_jsx("div", {
376
403
  ...mergeProps(themeProps('progress-bar-fill', {
377
404
  variant: fillVariant
@@ -135,7 +135,7 @@ export interface SwitchProps extends Omit<BaseProps, 'onChange'> {
135
135
  status?: InputStatus;
136
136
  /**
137
137
  * Size variant controlling track and thumb dimensions.
138
- * - 'sm': 34x20px (matches sm checkbox/radio vertical rhythm)
138
+ * - 'sm': 32x20px (matches sm checkbox/radio vertical rhythm)
139
139
  * - 'md': 40x24px (default, matches md checkbox/radio vertical rhythm)
140
140
  * @default 'md'
141
141
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/Switch/Switch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAcf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAMhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AA0V9C,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,K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