beez-ui 3.0.1 → 4.0.0

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 (56) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +45 -47
  3. package/dist/components/account-menu.js +1 -1
  4. package/dist/components/alert.js +3 -7
  5. package/dist/components/animated-collapse.js +51 -38
  6. package/dist/components/animated-list-item.js +33 -34
  7. package/dist/components/animated-theme-toggler.d.ts +5 -1
  8. package/dist/components/animated-theme-toggler.js +75 -120
  9. package/dist/components/badge.js +7 -11
  10. package/dist/components/card.js +13 -16
  11. package/dist/components/dialog-surface.js +8 -21
  12. package/dist/components/filter-query-bar.js +7 -11
  13. package/dist/components/input-group.js +5 -9
  14. package/dist/components/input.js +8 -12
  15. package/dist/components/label.js +4 -8
  16. package/dist/components/link.d.ts +1 -0
  17. package/dist/components/link.js +2 -16
  18. package/dist/components/presence-swap.d.ts +1 -1
  19. package/dist/components/presence-swap.js +44 -32
  20. package/dist/components/primitives/avatar.js +6 -9
  21. package/dist/components/primitives/dropdown-menu.d.ts +2 -2
  22. package/dist/components/primitives/dropdown-menu.js +8 -5
  23. package/dist/components/primitives/select.d.ts +2 -1
  24. package/dist/components/primitives/select.js +104 -83
  25. package/dist/components/reaction-button.d.ts +5 -6
  26. package/dist/components/reaction-button.js +139 -75
  27. package/dist/components/rich-link-editor.js +1 -1
  28. package/dist/components/separator.js +5 -9
  29. package/dist/components/sheet.js +8 -11
  30. package/dist/components/sidebar.d.ts +6 -6
  31. package/dist/components/sidebar.js +221 -184
  32. package/dist/components/svgs/whatsappIcon.js +10 -14
  33. package/dist/components/table.js +4 -8
  34. package/dist/components/textarea.js +7 -11
  35. package/dist/components/themed-toaster.js +28 -62
  36. package/dist/constants/dropdown-menu.d.ts +6 -1
  37. package/dist/constants/dropdown-menu.js +33 -1
  38. package/dist/constants/popover.js +2 -8
  39. package/dist/constants/select.d.ts +3 -1
  40. package/dist/constants/select.js +30 -1
  41. package/dist/motion/arc-tokens.d.ts +6 -0
  42. package/dist/motion/arc-tokens.js +6 -0
  43. package/dist/motion/glide-indicator.d.ts +6 -21
  44. package/dist/motion/glide-indicator.js +8 -17
  45. package/dist/motion/motion-slot.d.ts +6 -3
  46. package/dist/motion/motion-slot.js +100 -411
  47. package/dist/motion/presence.d.ts +8 -0
  48. package/dist/motion/presence.js +11 -1
  49. package/dist/motion/surface-keyframes.d.ts +2 -2
  50. package/dist/motion/surface-keyframes.js +40 -141
  51. package/dist/motion/tokens.d.ts +10 -114
  52. package/dist/motion/tokens.js +11 -116
  53. package/dist/styles.css +1 -1
  54. package/package.json +1 -1
  55. package/dist/motion/shared-layout-bg.d.ts +0 -16
  56. package/dist/motion/shared-layout-bg.js +0 -181
@@ -1,135 +1,96 @@
1
1
  "use client";
2
2
  import { c as _c } from "react/compiler-runtime";
3
- /** Animates the original primitive node with Motion, without adding DOM wrappers. */
3
+ /**
4
+ * Animates the original primitive node with Motion, without adding DOM wrappers. Every kind plays Arc's motion
5
+ * (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md) for the component it serves.
6
+ */
4
7
  import { useLayoutEffect, useRef } from "react";
5
8
  import { Slot } from "radix-ui";
6
- import { animate, hover, press, usePresence, frame } from "motion/react";
9
+ import { animate, usePresence, frame } from "motion/react";
7
10
  import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
8
- import { HOVER_CAPABLE_QUERY, MILLISECONDS_PER_SECOND, MOTION_ENTERING_ATTRIBUTE } from "../constants/motion.js";
9
- import { MOTION_EASE, MOTION_TIMING, MOTION_PRESS_SCALE, MOTION_SUBTLE_PRESS_SCALE, MOTION_TOGGLE_PRESS_SCALE, MOTION_HOVER_SCALE, MOTION_THUMB_SQUISH_SCALE, MOTION_CONTENT_DISTANCE, MOTION_ITEM_CHECK_SCALE, MOTION_ITEM_ENTER_SCALE, MOTION_ICON_SWAP_SCALE, MOTION_CLOSE_BUTTON_SCALE, MOTION_EASE_IN_OUT, MOTION_REVEAL_BLUR_PX, MOTION_REVEAL_SCALE, MOTION_SHIMMER_TRANSLATE, MOTION_CARD_SHADOW_LIFT, MOTION_CARD_SHADOW_REST, SPRING_CHEVRON, SPRING_PANEL, SPRING_POP, SPRING_PRESS, SPRING_THUMB } from "./tokens.js";
11
+ import { MOTION_ENTERING_ATTRIBUTE } from "../constants/motion.js";
12
+ import { ARC_BLUR, ARC_DURATION, ARC_EASE } from "./arc-tokens.js";
13
+ import { SPRING_CHEVRON, SPRING_POP } from "./tokens.js";
10
14
  import { surfaceEnter, surfaceExit, withRestingStyle } from "./surface-keyframes.js";
11
15
  import { useAttachedElement } from "./use-attached-element.js";
12
16
  import { jsx as _jsx } from "react/jsx-runtime";
13
- const EASE_OUT = [...MOTION_EASE];
17
+ const EASE_ENTER = [...ARC_EASE.enter];
14
18
  const SURFACE_KINDS = [
15
- "tooltip",
16
- "surface",
17
19
  "dialog",
18
- "center-morph",
19
20
  "sheet",
20
21
  "overlay"
21
22
  ];
22
- const PRESS_SCALES = {
23
- press: MOTION_PRESS_SCALE,
24
- "subtle-press": MOTION_SUBTLE_PRESS_SCALE,
25
- toggle: MOTION_TOGGLE_PRESS_SCALE
26
- };
27
- const FIELD_KINDS = ["field", "toggle"];
28
23
  /** Inline style properties Motion playback may write; they are restored after playback. */
29
24
  const ANIMATED_PROPERTIES = [
30
25
  "opacity",
31
26
  "transform",
32
- "boxShadow",
33
- "filter",
34
- "clipPath"
27
+ "filter"
35
28
  ];
36
- /** SVG attributes Motion writes to draw a stroke with `pathLength`. */
37
- const STROKE_DRAW_ATTRIBUTES = [
38
- "pathLength",
39
- "stroke-dasharray",
40
- "stroke-dashoffset"
41
- ];
42
- /** Attributes whose changes re-announce a field's state with a subtle settle. */
43
- const FIELD_STATE_ATTRIBUTES = [
44
- "data-state",
45
- "aria-selected",
46
- "aria-checked",
47
- "data-loading",
48
- "data-error"
49
- ];
50
- /** Checks the actual DOM state rather than intercepting the component's event handlers. */
51
- function isEnabled(element) {
52
- return !element.hasAttribute("disabled") && element.getAttribute("aria-disabled") !== "true" && !element.hasAttribute("data-disabled");
53
- }
54
- /** Touch devices keep phantom hovers after a tap, so hover lifts need a real hover pointer. */
55
- function canHover() {
56
- return typeof window.matchMedia === "function" && window.matchMedia(HOVER_CAPABLE_QUERY).matches;
57
- }
58
- /** Reads the currently rendered transform, including a running animation, as a start keyframe. */
59
- function currentTransform(element) {
60
- const value = getComputedStyle(element).transform;
61
- return value && value !== "none" ? value : "scale(1)";
62
- }
29
+ /** Arc's theme switch grows the incoming icon from .7. */
30
+ const THEME_ICON_ENTER_SCALE = .7;
31
+ /** Arc's chosen-option check sharpens in just after its row: scale .6 and a subtle blur. */
32
+ const ITEM_CHECK_ENTER_SCALE = .6;
33
+ const ITEM_CHECK_DELAY_S = .04;
34
+ /** Arc's helper and error rows rise into place by a third of a line while they sharpen. */
35
+ const MESSAGE_RISE = "0.35em";
63
36
  /** Reads a computed `matrix()` or `matrix3d()` transform as its 2D components. */
64
37
  function matrixOf(transform) {
65
38
  const values = /^matrix(3d)?\(([^)]+)\)$/.exec(transform);
66
39
  if (!values) return {
67
40
  a: 1,
68
- b: 0,
69
- translateX: 0
41
+ b: 0
70
42
  };
71
43
  const parts = values[2].split(",").map(parseFloat);
72
44
  return {
73
45
  a: parts[0] ?? 1,
74
- b: parts[1] ?? 0,
75
- translateX: (values[1] ? parts[12] : parts[4]) ?? 0
46
+ b: parts[1] ?? 0
76
47
  };
77
48
  }
78
- /** Extracts the horizontal translation of a computed transform. */
79
- function translateXOf(transform) {
80
- return matrixOf(transform).translateX;
81
- }
82
49
  /** Extracts the rotation, in degrees, of a computed transform. */
83
50
  function rotationOf(transform) {
84
51
  const { a, b } = matrixOf(transform);
85
52
  return Math.atan2(b, a) * 180 / Math.PI;
86
53
  }
87
- /** Checked and indeterminate indicators are visible; only unchecked ones are hidden. */
88
- function isChecked(element) {
89
- const state = element.getAttribute("data-state");
90
- return state === "checked" || state === "indeterminate";
91
- }
92
- /** Composes refs through Radix Slot and delegates gesture, entry and exit playback to Motion. */
54
+ /** Composes refs through Radix Slot and delegates entry, exit and state playback to Motion. */
93
55
  export function MotionSlot(t0) {
94
56
  const $ = _c(20);
95
57
  let children;
58
+ let kind;
96
59
  let props;
97
60
  let ref;
98
- let t1;
99
61
  if ($[0] !== t0) {
100
- ({children, kind: t1, ref, ...props} = t0);
62
+ ({children, kind, ref, ...props} = t0);
101
63
  $[0] = t0;
102
64
  $[1] = children;
103
- $[2] = props;
104
- $[3] = ref;
105
- $[4] = t1;
65
+ $[2] = kind;
66
+ $[3] = props;
67
+ $[4] = ref;
106
68
  } else {
107
69
  children = $[1];
108
- props = $[2];
109
- ref = $[3];
110
- t1 = $[4];
70
+ kind = $[2];
71
+ props = $[3];
72
+ ref = $[4];
111
73
  }
112
- const kind = t1 === undefined ? "fade" : t1;
113
74
  const [element, attach] = useAttachedElement(ref);
114
75
  const reduceMotion = usePrefersReducedMotion();
115
76
  const [isPresent, safeToRemove] = usePresence();
116
77
  const safeToRemoveRef = useRef(safeToRemove);
117
- let t2;
78
+ let t1;
118
79
  if ($[5] !== safeToRemove) {
119
- t2 = () => {
80
+ t1 = () => {
120
81
  safeToRemoveRef.current = safeToRemove;
121
82
  };
122
83
  $[5] = safeToRemove;
123
- $[6] = t2;
84
+ $[6] = t1;
124
85
  } else {
125
- t2 = $[6];
86
+ t1 = $[6];
126
87
  }
127
- useLayoutEffect(t2);
88
+ useLayoutEffect(t1);
128
89
  const interruptedRef = useRef(null);
90
+ let t2;
129
91
  let t3;
130
- let t4;
131
92
  if ($[7] !== element || $[8] !== isPresent || $[9] !== kind || $[10] !== reduceMotion) {
132
- t3 = () => {
93
+ t2 = () => {
133
94
  let active = true;
134
95
  const safeToRemove_0 = () => safeToRemoveRef.current?.();
135
96
  if (!element || !element.isConnected) {
@@ -145,23 +106,20 @@ export function MotionSlot(t0) {
145
106
  };
146
107
  }
147
108
  const animations = new Map();
148
- const held = new Set();
149
109
  const cleanups = [];
150
110
  const original = {
151
111
  opacity: element.style.opacity,
152
112
  transform: element.style.transform,
153
- boxShadow: element.style.boxShadow,
154
- filter: element.style.filter,
155
- clipPath: element.style.clipPath
113
+ filter: element.style.filter
156
114
  };
157
- const restore = function restore(t5) {
158
- const properties = t5 === undefined ? ANIMATED_PROPERTIES : t5;
115
+ const restore = function restore(t4) {
116
+ const properties = t4 === undefined ? ANIMATED_PROPERTIES : t4;
159
117
  properties.forEach((property) => {
160
118
  element.style[property] = original[property];
161
119
  });
162
120
  };
163
- const cancel = function cancel(t6) {
164
- const properties_0 = t6 === undefined ? ANIMATED_PROPERTIES : t6;
121
+ const cancel = function cancel(t5) {
122
+ const properties_0 = t5 === undefined ? ANIMATED_PROPERTIES : t5;
165
123
  animations.forEach((driven, animation) => {
166
124
  if (!driven.some((property_0) => properties_0.includes(property_0))) {
167
125
  return;
@@ -193,7 +151,7 @@ export function MotionSlot(t0) {
193
151
  };
194
152
  const interrupted = interruptedRef.current;
195
153
  interruptedRef.current = null;
196
- if (reduceMotion || !isPresent && element.hasAttribute("data-beez-theme-menu")) {
154
+ if (reduceMotion) {
197
155
  if (!isPresent) {
198
156
  queueMicrotask(() => {
199
157
  if (active) {
@@ -203,24 +161,22 @@ export function MotionSlot(t0) {
203
161
  }
204
162
  return dispose;
205
163
  }
206
- const play = function play(keyframes, transition, t7) {
207
- const { remove: t8, restoreOnComplete: t9, onSettled } = t7 === undefined ? {} : t7;
208
- const remove = t8 === undefined ? false : t8;
209
- const restoreOnComplete = t9 === undefined ? true : t9;
164
+ const play = function play(keyframes, transition, t6) {
165
+ const { remove: t7, onSettled } = t6 === undefined ? {} : t6;
166
+ const remove = t7 === undefined ? false : t7;
210
167
  const properties_1 = ANIMATED_PROPERTIES.filter((property_2) => property_2 in keyframes);
211
168
  const busy = new Set([...animations.values()].flat());
212
169
  properties_1.forEach((property_3) => {
213
- if (!busy.has(property_3) && !held.has(property_3)) {
170
+ if (!busy.has(property_3)) {
214
171
  original[property_3] = element.style[property_3];
215
172
  }
216
173
  });
217
174
  cancel(properties_1);
218
- properties_1.forEach((property_4) => held.delete(property_4));
219
175
  const frames = keyframes;
220
- properties_1.forEach((property_5) => {
221
- const values = frames[property_5];
176
+ properties_1.forEach((property_4) => {
177
+ const values = frames[property_4];
222
178
  if (Array.isArray(values) && values.length > 1) {
223
- element.style[property_5] = String(values[0]);
179
+ element.style[property_4] = String(values[0]);
224
180
  }
225
181
  });
226
182
  const animation_0 = animate(element, keyframes, transition);
@@ -233,15 +189,12 @@ export function MotionSlot(t0) {
233
189
  safeToRemove_0();
234
190
  return;
235
191
  }
236
- if (!restoreOnComplete) {
237
- properties_1.forEach((property_6) => held.add(property_6));
238
- }
239
192
  frame.postRender(() => {
240
193
  if (!active) {
241
194
  return;
242
195
  }
243
196
  const busy_0 = new Set([...animations.values()].flat());
244
- restore(ANIMATED_PROPERTIES.filter((property_7) => !busy_0.has(property_7) && !held.has(property_7)));
197
+ restore(ANIMATED_PROPERTIES.filter((property_5) => !busy_0.has(property_5)));
245
198
  onSettled?.();
246
199
  });
247
200
  });
@@ -255,14 +208,14 @@ export function MotionSlot(t0) {
255
208
  opacity: Number.parseFloat(computed_0.opacity)
256
209
  });
257
210
  if (interrupted?.element === element) {
258
- Object.entries(interrupted.values).forEach((t10) => {
259
- const [property_8, value_0] = t10;
260
- const frames_0 = keyframes_0[property_8];
211
+ Object.entries(interrupted.values).forEach((t8) => {
212
+ const [property_6, value_0] = t8;
213
+ const frames_0 = keyframes_0[property_6];
261
214
  if (!Array.isArray(frames_0) || !value_0) {
262
215
  return;
263
216
  }
264
- const start = property_8 === "opacity" ? Number.parseFloat(value_0) : value_0;
265
- keyframes_0[property_8] = [start, ...frames_0.slice(1)];
217
+ const start = property_6 === "opacity" ? Number.parseFloat(value_0) : value_0;
218
+ keyframes_0[property_6] = [start, ...frames_0.slice(1)];
266
219
  });
267
220
  }
268
221
  if (isPresent) {
@@ -282,224 +235,35 @@ export function MotionSlot(t0) {
282
235
  });
283
236
  return dispose;
284
237
  }
285
- if (kind === "skeleton" && typeof element.animate === "function") {
286
- const shimmer = element.animate({ translate: [...MOTION_SHIMMER_TRANSLATE] }, {
287
- duration: MOTION_TIMING.skeleton * MILLISECONDS_PER_SECOND,
288
- easing: `cubic-bezier(${MOTION_EASE_IN_OUT.join(", ")})`,
289
- iterations: Infinity,
290
- pseudoElement: "::after"
238
+ if (kind === "icon-swap") {
239
+ play({
240
+ opacity: [0, 1],
241
+ transform: [`scale(${THEME_ICON_ENTER_SCALE})`, "scale(1)"],
242
+ filter: [`blur(${ARC_BLUR.subtle}px)`, "blur(0px)"]
243
+ }, {
244
+ ...SPRING_POP,
245
+ opacity: tween(ARC_DURATION.fast),
246
+ filter: tween(ARC_DURATION.fast)
291
247
  });
292
- cleanups.push(() => shimmer.cancel());
293
248
  } else {
294
- if (kind === "icon-swap") {
249
+ if (kind === "item-check") {
295
250
  play({
296
251
  opacity: [0, 1],
297
- transform: [`scale(${MOTION_ICON_SWAP_SCALE})`, "scale(1)"]
252
+ transform: [`scale(${ITEM_CHECK_ENTER_SCALE})`, "scale(1)"],
253
+ filter: [`blur(${ARC_BLUR.subtle}px)`, "blur(0px)"]
298
254
  }, {
299
- ...SPRING_POP,
300
- opacity: tween(MOTION_TIMING.iconSwap)
255
+ ...tween(ARC_DURATION.standard),
256
+ delay: ITEM_CHECK_DELAY_S
301
257
  });
302
258
  } else {
303
- if (kind === "item-check") {
259
+ if (kind === "message") {
304
260
  play({
305
261
  opacity: [0, 1],
306
- transform: [`scale(${MOTION_ITEM_CHECK_SCALE})`, "scale(1)"]
307
- }, {
308
- ...SPRING_PANEL,
309
- opacity: tween(MOTION_TIMING.fast)
310
- });
311
- } else {
312
- if (kind === "list-item") {
313
- play({
314
- opacity: [0, 1],
315
- transform: [`scale(${MOTION_ITEM_ENTER_SCALE})`, "scale(1)"]
316
- }, tween(MOTION_TIMING.listItem));
317
- } else {
318
- if (kind === "delayed-pop" && typeof element.animate === "function") {
319
- const pop = element.animate({
320
- opacity: [0, 1],
321
- scale: [String(MOTION_CLOSE_BUTTON_SCALE), "1"]
322
- }, {
323
- duration: MOTION_TIMING.closeEnter * MILLISECONDS_PER_SECOND,
324
- delay: MOTION_TIMING.closeDelay * MILLISECONDS_PER_SECOND,
325
- easing: `cubic-bezier(${EASE_OUT.join(", ")})`,
326
- fill: "backwards"
327
- });
328
- cleanups.push(() => pop.cancel());
329
- } else {
330
- if (kind === "selection") {
331
- play({
332
- opacity: [0, 1],
333
- transform: ["scale(0.5)", "scale(1)"]
334
- }, {
335
- ...SPRING_PANEL,
336
- opacity: tween(MOTION_TIMING.fast)
337
- });
338
- } else {
339
- if (kind === "content") {
340
- play({
341
- opacity: [0, 1],
342
- transform: [`translateY(${MOTION_CONTENT_DISTANCE}px)`, "translateY(0px)"]
343
- }, tween(MOTION_TIMING.enter));
344
- } else {
345
- if (kind === "message") {
346
- play({
347
- opacity: [0, 1],
348
- transform: [`scale(${MOTION_ITEM_ENTER_SCALE})`, "scale(1)"]
349
- }, tween(MOTION_TIMING.message));
350
- } else {
351
- if (kind === "fade" || kind === "card" || kind === "row") {
352
- play({ opacity: [0, 1] }, tween(MOTION_TIMING.enter));
353
- }
354
- }
355
- }
356
- }
357
- }
358
- }
359
- }
360
- }
361
- }
362
- const pressScale = PRESS_SCALES[kind];
363
- if (pressScale !== undefined) {
364
- const liftsOnHover = kind === "press" && element.getAttribute("data-variant") !== "link";
365
- let hovered = false;
366
- let pressed = false;
367
- const settle = () => {
368
- const target = pressed ? pressScale : hovered ? MOTION_HOVER_SCALE : 1;
369
- play({ transform: [currentTransform(element), `scale(${target})`] }, SPRING_PRESS, { restoreOnComplete: target === 1 });
370
- };
371
- cleanups.push(press(element, () => {
372
- if (!isEnabled(element)) {
373
- return;
262
+ transform: [`translateY(${MESSAGE_RISE})`, "translateY(0px)"],
263
+ filter: [`blur(${ARC_BLUR.soft}px)`, "blur(0px)"]
264
+ }, tween(ARC_DURATION.standard));
374
265
  }
375
- pressed = true;
376
- settle();
377
- return () => {
378
- pressed = false;
379
- settle();
380
- };
381
- }));
382
- if (liftsOnHover) {
383
- cleanups.push(hover(element, () => {
384
- if (!isEnabled(element) || !canHover()) {
385
- return;
386
- }
387
- hovered = true;
388
- settle();
389
- return () => {
390
- hovered = false;
391
- settle();
392
- };
393
- }));
394
- }
395
- }
396
- let restingShadow = "none";
397
- const withRestingShadow = (shadow) => {
398
- if (!element.style.boxShadow) {
399
- restingShadow = getComputedStyle(element).boxShadow;
400
266
  }
401
- return restingShadow === "none" ? shadow : `${restingShadow}, ${shadow}`;
402
- };
403
- if (kind === "card" || kind === "link" || kind === "icon") {
404
- cleanups.push(hover(element, () => {
405
- if (!isEnabled(element) || !canHover() || kind === "card" && !element.querySelector("a,button")) {
406
- return;
407
- }
408
- const keep = { restoreOnComplete: false };
409
- if (kind === "card") {
410
- const rest = withRestingShadow(MOTION_CARD_SHADOW_REST);
411
- const from = element.style.boxShadow ? getComputedStyle(element).boxShadow : rest;
412
- play({ boxShadow: [from, withRestingShadow(MOTION_CARD_SHADOW_LIFT)] }, tween(MOTION_TIMING.enter), keep);
413
- } else {
414
- if (kind === "icon") {
415
- play({ transform: ["rotate(0deg) scale(1)", "rotate(-3deg) scale(1.025)"] }, SPRING_PRESS, keep);
416
- } else {
417
- play({ opacity: .75 }, tween(MOTION_TIMING.fast), keep);
418
- }
419
- }
420
- return () => {
421
- if (kind === "card") {
422
- play({ boxShadow: [getComputedStyle(element).boxShadow, withRestingShadow(MOTION_CARD_SHADOW_REST)] }, tween(MOTION_TIMING.fast));
423
- } else {
424
- if (kind === "icon") {
425
- play({ transform: [currentTransform(element), "rotate(0deg) scale(1)"] }, SPRING_PRESS);
426
- } else {
427
- play({ opacity: 1 }, tween(MOTION_TIMING.fast));
428
- }
429
- }
430
- };
431
- }));
432
- }
433
- if (FIELD_KINDS.includes(kind)) {
434
- const settleField = () => {
435
- if (isEnabled(element) && !element.hasAttribute("hidden")) {
436
- play({ opacity: [.94, 1] }, tween(MOTION_TIMING.fast));
437
- }
438
- };
439
- element.addEventListener("focusin", settleField);
440
- cleanups.push(() => element.removeEventListener("focusin", settleField));
441
- const observer = new MutationObserver(settleField);
442
- observer.observe(element, {
443
- attributes: true,
444
- attributeFilter: FIELD_STATE_ATTRIBUTES
445
- });
446
- cleanups.push(() => observer.disconnect());
447
- }
448
- if (kind === "check") {
449
- let wasChecked = isChecked(element);
450
- const strokeDraws = new Set();
451
- const settleStrokes = () => {
452
- strokeDraws.forEach(_temp3);
453
- strokeDraws.clear();
454
- element.querySelectorAll("path").forEach(_temp4);
455
- };
456
- cleanups.push(settleStrokes);
457
- const observer_0 = new MutationObserver(() => {
458
- const checked = isChecked(element);
459
- if (checked === wasChecked) {
460
- return;
461
- }
462
- wasChecked = checked;
463
- settleStrokes();
464
- if (checked) {
465
- play({
466
- opacity: [0, 1],
467
- transform: ["scale(0.5)", "scale(1)"],
468
- filter: ["blur(0px)", "blur(0px)"]
469
- }, tween(MOTION_TIMING.enter));
470
- element.querySelectorAll("path").forEach((path_0) => {
471
- path_0.setAttribute("pathLength", "1");
472
- path_0.setAttribute("stroke-dasharray", "0 1");
473
- path_0.setAttribute("stroke-dashoffset", "0");
474
- const draw_0 = animate(path_0, { pathLength: [0, 1] }, {
475
- ...tween(MOTION_TIMING.checkDraw),
476
- delay: MOTION_TIMING.checkDrawDelay
477
- });
478
- strokeDraws.add(draw_0);
479
- draw_0.then(() => {
480
- if (!strokeDraws.delete(draw_0)) {
481
- return;
482
- }
483
- frame.postRender(() => {
484
- if (active && !strokeDraws.size) {
485
- settleStrokes();
486
- }
487
- });
488
- });
489
- });
490
- } else {
491
- play({
492
- opacity: [1, 0],
493
- transform: ["scale(1)", "scale(0.5)"],
494
- filter: ["blur(0px)", "blur(4px)"]
495
- }, tween(MOTION_TIMING.enter));
496
- }
497
- });
498
- observer_0.observe(element, {
499
- attributes: true,
500
- attributeFilter: ["data-state"]
501
- });
502
- cleanups.push(() => observer_0.disconnect());
503
267
  }
504
268
  if (kind === "rotate") {
505
269
  const restingAngle = () => parseFloat(getComputedStyle(element).rotate) || 0;
@@ -515,13 +279,13 @@ export function MotionSlot(t0) {
515
279
  play({ transform: [`rotate(${delta}deg)`, "rotate(0deg)"] }, SPRING_CHEVRON);
516
280
  }
517
281
  };
518
- const observer_1 = new MutationObserver(turn);
519
- observer_1.observe(element, {
282
+ const observer = new MutationObserver(turn);
283
+ observer.observe(element, {
520
284
  attributes: true,
521
285
  attributeFilter: ["class"]
522
286
  });
523
287
  if (element.parentElement) {
524
- observer_1.observe(element.parentElement, {
288
+ observer.observe(element.parentElement, {
525
289
  attributes: true,
526
290
  attributeFilter: [
527
291
  "aria-expanded",
@@ -530,12 +294,12 @@ export function MotionSlot(t0) {
530
294
  ]
531
295
  });
532
296
  }
533
- cleanups.push(() => observer_1.disconnect());
297
+ cleanups.push(() => observer.disconnect());
534
298
  }
535
299
  if (kind === "reveal") {
536
300
  const isLoading = () => element.hasAttribute("data-loading");
537
301
  let wasLoading = isLoading();
538
- const observer_2 = new MutationObserver(() => {
302
+ const observer_0 = new MutationObserver(() => {
539
303
  const loading = isLoading();
540
304
  const loaded = wasLoading && !loading && !element.hasAttribute("data-error");
541
305
  wasLoading = loading;
@@ -544,86 +308,18 @@ export function MotionSlot(t0) {
544
308
  }
545
309
  play({
546
310
  opacity: [0, 1],
547
- transform: [`scale(${MOTION_REVEAL_SCALE})`, "scale(1)"],
548
- filter: [`blur(${MOTION_REVEAL_BLUR_PX}px)`, "blur(0px)"]
549
- }, tween(MOTION_TIMING.reveal));
311
+ filter: [`blur(${ARC_BLUR.soft}px)`, "blur(0px)"]
312
+ }, tween(ARC_DURATION.standard));
550
313
  });
551
- observer_2.observe(element, {
314
+ observer_0.observe(element, {
552
315
  attributes: true,
553
316
  attributeFilter: ["data-loading", "data-error"]
554
317
  });
555
- cleanups.push(() => observer_2.disconnect());
556
- }
557
- if (kind === "thumb") {
558
- const restingOffset = () => {
559
- if (!element.getClientRects().length) {
560
- return null;
561
- }
562
- const rect = element.getBoundingClientRect();
563
- const trackLeft = element.parentElement?.getBoundingClientRect().left ?? 0;
564
- return rect.left - trackLeft + (rect.width - element.offsetWidth) / 2;
565
- };
566
- let previousOffset = restingOffset();
567
- const remeasure = () => {
568
- if (!animations.size) {
569
- previousOffset = restingOffset();
570
- }
571
- };
572
- element.parentElement?.addEventListener("pointerenter", remeasure);
573
- element.parentElement?.addEventListener("focusin", remeasure);
574
- cleanups.push(() => {
575
- element.parentElement?.removeEventListener("pointerenter", remeasure);
576
- element.parentElement?.removeEventListener("focusin", remeasure);
577
- });
578
- const observer_3 = new MutationObserver(() => {
579
- const glideOffset = translateXOf(getComputedStyle(element).transform);
580
- cancel(["transform"]);
581
- restore(["transform"]);
582
- const nextOffset = restingOffset();
583
- const delta_0 = previousOffset === null || nextOffset === null ? 0 : previousOffset + glideOffset - nextOffset;
584
- previousOffset = nextOffset;
585
- if (delta_0 !== 0) {
586
- play({ transform: [`translateX(${delta_0}px)`, "translateX(0px)"] }, SPRING_THUMB);
587
- }
588
- });
589
- observer_3.observe(element, {
590
- attributes: true,
591
- attributeFilter: ["data-state"]
592
- });
593
- cleanups.push(() => observer_3.disconnect());
594
- const root = element.parentElement;
595
- if (root && typeof element.animate === "function") {
596
- const squishTiming = {
597
- duration: MOTION_TIMING.fast * MILLISECONDS_PER_SECOND,
598
- easing: `cubic-bezier(${EASE_OUT.join(", ")})`,
599
- fill: "forwards"
600
- };
601
- let squish = null;
602
- cleanups.push(() => squish?.cancel());
603
- cleanups.push(press(root, () => {
604
- if (!isEnabled(root)) {
605
- return;
606
- }
607
- squish?.cancel();
608
- squish = element.animate({ scale: ["1", String(MOTION_THUMB_SQUISH_SCALE)] }, squishTiming);
609
- return () => {
610
- const from_0 = getComputedStyle(element).scale;
611
- squish?.cancel();
612
- const release = element.animate({ scale: [from_0 === "none" ? "1" : from_0, "1"] }, squishTiming);
613
- squish = release;
614
- release.finished.then(() => {
615
- if (squish === release) {
616
- release.cancel();
617
- squish = null;
618
- }
619
- }).catch(_temp5);
620
- };
621
- }));
622
- }
318
+ cleanups.push(() => observer_0.disconnect());
623
319
  }
624
320
  return dispose;
625
321
  };
626
- t4 = [
322
+ t3 = [
627
323
  element,
628
324
  kind,
629
325
  reduceMotion,
@@ -633,53 +329,46 @@ export function MotionSlot(t0) {
633
329
  $[8] = isPresent;
634
330
  $[9] = kind;
635
331
  $[10] = reduceMotion;
636
- $[11] = t3;
637
- $[12] = t4;
332
+ $[11] = t2;
333
+ $[12] = t3;
638
334
  } else {
639
- t3 = $[11];
640
- t4 = $[12];
335
+ t2 = $[11];
336
+ t3 = $[12];
641
337
  }
642
- useLayoutEffect(t3, t4);
643
- let t5;
338
+ useLayoutEffect(t2, t3);
339
+ let t4;
644
340
  if ($[13] !== isPresent) {
645
- t5 = isPresent ? {} : {
341
+ t4 = isPresent ? {} : {
646
342
  inert: true,
647
343
  "aria-hidden": true
648
344
  };
649
345
  $[13] = isPresent;
650
- $[14] = t5;
346
+ $[14] = t4;
651
347
  } else {
652
- t5 = $[14];
348
+ t4 = $[14];
653
349
  }
654
- let t6;
655
- if ($[15] !== attach || $[16] !== children || $[17] !== props || $[18] !== t5) {
656
- t6 = /* @__PURE__ */ _jsx(Slot.Root, {
350
+ let t5;
351
+ if ($[15] !== attach || $[16] !== children || $[17] !== props || $[18] !== t4) {
352
+ t5 = /* @__PURE__ */ _jsx(Slot.Root, {
657
353
  ...props,
658
354
  ref: attach,
659
- ...t5,
355
+ ...t4,
660
356
  children
661
357
  });
662
358
  $[15] = attach;
663
359
  $[16] = children;
664
360
  $[17] = props;
665
- $[18] = t5;
666
- $[19] = t6;
361
+ $[18] = t4;
362
+ $[19] = t5;
667
363
  } else {
668
- t6 = $[19];
364
+ t5 = $[19];
669
365
  }
670
- return t6;
671
- }
672
- function _temp5() {}
673
- function _temp4(path) {
674
- STROKE_DRAW_ATTRIBUTES.forEach((attribute) => path.removeAttribute(attribute));
675
- }
676
- function _temp3(draw) {
677
- return draw.cancel();
366
+ return t5;
678
367
  }
679
368
  function _temp2(duration) {
680
369
  return {
681
370
  duration,
682
- ease: EASE_OUT
371
+ ease: EASE_ENTER
683
372
  };
684
373
  }
685
374
  function _temp(cleanup) {