@bug-on/m3-expressive 1.2.7 → 1.3.1

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 (62) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/buttons.d.mts +3 -3
  3. package/dist/buttons.d.ts +3 -3
  4. package/dist/buttons.js +195 -50
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +196 -51
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/{core-D4048_K5.d.mts → core-CAU8g2HY.d.mts} +1 -1
  9. package/dist/{core-Bc5Wj_pc.d.ts → core-DRrLnsnJ.d.ts} +1 -1
  10. package/dist/core.d.mts +2 -2
  11. package/dist/core.d.ts +2 -2
  12. package/dist/core.js +159 -28
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.mjs +160 -29
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/feedback.d.mts +28 -6
  17. package/dist/feedback.d.ts +28 -6
  18. package/dist/feedback.js +161 -30
  19. package/dist/feedback.js.map +1 -1
  20. package/dist/feedback.mjs +162 -31
  21. package/dist/feedback.mjs.map +1 -1
  22. package/dist/forms.d.mts +3 -2
  23. package/dist/forms.d.ts +3 -2
  24. package/dist/forms.js +88 -100
  25. package/dist/forms.js.map +1 -1
  26. package/dist/forms.mjs +88 -100
  27. package/dist/forms.mjs.map +1 -1
  28. package/dist/{icon-button-CSsDmuQC.d.mts → icon-button-CqdQBsRe.d.ts} +11 -5
  29. package/dist/{icon-button-CSsDmuQC.d.ts → icon-button-USJo7AqO.d.mts} +11 -5
  30. package/dist/index.d.mts +8 -8
  31. package/dist/index.d.ts +8 -8
  32. package/dist/index.js +570 -309
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.mjs +570 -310
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/layout.d.mts +1 -1
  37. package/dist/layout.d.ts +1 -1
  38. package/dist/layout.js +159 -60
  39. package/dist/layout.js.map +1 -1
  40. package/dist/layout.mjs +160 -61
  41. package/dist/layout.mjs.map +1 -1
  42. package/dist/{md3-Dty-Qcad.d.mts → md3-D0_Z7IXj.d.mts} +9 -1
  43. package/dist/{md3-Dty-Qcad.d.ts → md3-D0_Z7IXj.d.ts} +9 -1
  44. package/dist/navigation.d.mts +103 -33
  45. package/dist/navigation.d.ts +103 -33
  46. package/dist/navigation.js +443 -152
  47. package/dist/navigation.js.map +1 -1
  48. package/dist/navigation.mjs +444 -154
  49. package/dist/navigation.mjs.map +1 -1
  50. package/dist/overlays.js +159 -28
  51. package/dist/overlays.js.map +1 -1
  52. package/dist/overlays.mjs +160 -29
  53. package/dist/overlays.mjs.map +1 -1
  54. package/dist/pickers.js +159 -28
  55. package/dist/pickers.js.map +1 -1
  56. package/dist/pickers.mjs +160 -29
  57. package/dist/pickers.mjs.map +1 -1
  58. package/dist/{split-button-trailing-uncheckable-DPJL3bO6.d.mts → split-button-trailing-uncheckable-CIVEYgjY.d.mts} +12 -7
  59. package/dist/{split-button-trailing-uncheckable--BhNTEJw.d.ts → split-button-trailing-uncheckable-DTQJjzsB.d.ts} +12 -7
  60. package/dist/{text-field-DWC7qOvp.d.mts → text-field-CiOmDM_8.d.ts} +52 -51
  61. package/dist/{text-field-DWC7qOvp.d.ts → text-field-Ear3hCSq.d.mts} +52 -51
  62. package/package.json +3 -3
package/dist/overlays.js CHANGED
@@ -254,7 +254,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
254
254
  function easeInOutCubic(x) {
255
255
  return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
256
256
  }
257
- function generateWavyCircularPath(center, radius, amplitude, wavelength) {
257
+ function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
258
258
  const circumference = 2 * Math.PI * radius;
259
259
  const numWaves = Math.max(
260
260
  3,
@@ -262,8 +262,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
262
262
  );
263
263
  const steps = numWaves * 4;
264
264
  const dt = 2 * Math.PI / steps;
265
- const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
266
- const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
265
+ const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
266
+ const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
267
267
  const xAt = (t) => center + rAt(t) * Math.cos(t);
268
268
  const yAt = (t) => center + rAt(t) * Math.sin(t);
269
269
  const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
@@ -328,15 +328,18 @@ var CircularProgress = React2__namespace.forwardRef(
328
328
  size = 48,
329
329
  trackHeight = 4,
330
330
  shape = "flat",
331
+ trackShape = "flat",
331
332
  amplitude,
332
333
  wavelength,
333
334
  gapSize = 4,
335
+ waveSpeed = 1,
334
336
  crawlerSpeed = 1,
335
337
  color,
336
338
  trackColor,
337
339
  showTrack = "auto",
338
340
  minProgress = DEFAULT_MIN_PROGRESS,
339
341
  maxProgress = DEFAULT_MAX_PROGRESS,
342
+ determinateAnimation = "md3",
340
343
  amplitudeRange,
341
344
  className,
342
345
  "aria-label": ariaLabel
@@ -345,15 +348,18 @@ var CircularProgress = React2__namespace.forwardRef(
345
348
  "size",
346
349
  "trackHeight",
347
350
  "shape",
351
+ "trackShape",
348
352
  "amplitude",
349
353
  "wavelength",
350
354
  "gapSize",
355
+ "waveSpeed",
351
356
  "crawlerSpeed",
352
357
  "color",
353
358
  "trackColor",
354
359
  "showTrack",
355
360
  "minProgress",
356
361
  "maxProgress",
362
+ "determinateAnimation",
357
363
  "amplitudeRange",
358
364
  "className",
359
365
  "aria-label"
@@ -366,6 +372,7 @@ var CircularProgress = React2__namespace.forwardRef(
366
372
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
367
373
  const isWavy = shape === "wavy";
368
374
  const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
375
+ const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
369
376
  const BASELINE_SIZE = 48;
370
377
  const scaleFactor = size / BASELINE_SIZE;
371
378
  const effectiveAmplitude = React2__namespace.useMemo(
@@ -398,19 +405,50 @@ var CircularProgress = React2__namespace.forwardRef(
398
405
  const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
399
406
  const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
400
407
  const ActiveCircleElem = react.m.circle;
401
- const ActivePathElem = react.m.path;
402
408
  const indeterminateSvgRef = React2__namespace.useRef(null);
403
409
  const indeterminateTrackRef = React2__namespace.useRef(null);
404
410
  const indeterminateActiveRef = React2__namespace.useRef(null);
405
411
  const indeterminateWavyTrackPathRef = React2__namespace.useRef(null);
406
412
  const indeterminateWavyActivePathRef = React2__namespace.useRef(null);
413
+ const determinateWavyActivePathRef = React2__namespace.useRef(null);
414
+ const determinateWavyTrackPathRef = React2__namespace.useRef(null);
407
415
  const cachedPathLengthRef = React2__namespace.useRef(0);
416
+ const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 0);
417
+ const amplitudeMV = react.useMotionValue(isWavy ? effectiveAmplitude : 0);
418
+ React2__namespace.useEffect(() => {
419
+ if (isDeterminate) {
420
+ react.animate(fractionMV, clampedValue / 100, {
421
+ duration: 0.4,
422
+ ease: [0.2, 0, 0, 1]
423
+ });
424
+ }
425
+ }, [clampedValue, isDeterminate, fractionMV]);
426
+ React2__namespace.useEffect(() => {
427
+ if (!isDeterminate || !isWavy) return;
428
+ const fraction = clampedValue / 100;
429
+ let targetAmp = effectiveAmplitude;
430
+ if (determinateAnimation === "md3") {
431
+ targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
432
+ }
433
+ react.animate(amplitudeMV, targetAmp, {
434
+ type: "spring",
435
+ bounce: 0,
436
+ duration: 0.5
437
+ });
438
+ }, [
439
+ clampedValue,
440
+ isDeterminate,
441
+ isWavy,
442
+ effectiveAmplitude,
443
+ amplitudeMV,
444
+ determinateAnimation
445
+ ]);
408
446
  React2__namespace.useLayoutEffect(() => {
409
447
  if (!isWavy || !wavyActivePath) {
410
448
  cachedPathLengthRef.current = circumference;
411
449
  return;
412
450
  }
413
- const el = indeterminateActiveRef.current;
451
+ const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
414
452
  if (el && "getTotalLength" in el) {
415
453
  try {
416
454
  const len = el.getTotalLength();
@@ -424,7 +462,65 @@ var CircularProgress = React2__namespace.forwardRef(
424
462
  cachedPathLengthRef.current = circumference;
425
463
  }, [isWavy, circumference, wavyActivePath]);
426
464
  react.useAnimationFrame((time) => {
427
- if (isDeterminate) return;
465
+ const safeWaveSpeed = Math.max(0.1, waveSpeed);
466
+ const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
467
+ if (isDeterminate) {
468
+ if (isWavy) {
469
+ const currentAmp = amplitudeMV.get();
470
+ const dynamicPath = generateWavyCircularPath(
471
+ center,
472
+ radius,
473
+ currentAmp,
474
+ effectiveWavelength,
475
+ wavePhase
476
+ );
477
+ if (determinateWavyActivePathRef.current) {
478
+ determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
479
+ }
480
+ if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
481
+ determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
482
+ }
483
+ const pathEl = determinateWavyActivePathRef.current;
484
+ let totalLen = cachedPathLengthRef.current || circumference;
485
+ if (pathEl) {
486
+ try {
487
+ const len = pathEl.getTotalLength();
488
+ if (len > 0) totalLen = len;
489
+ } catch (e) {
490
+ }
491
+ }
492
+ const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
493
+ const activeLen = totalLen * activeFrac;
494
+ if (determinateWavyActivePathRef.current) {
495
+ determinateWavyActivePathRef.current.setAttribute(
496
+ "stroke-dasharray",
497
+ `${activeLen} ${totalLen}`
498
+ );
499
+ determinateWavyActivePathRef.current.setAttribute(
500
+ "stroke-dashoffset",
501
+ "0"
502
+ );
503
+ }
504
+ if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
505
+ const gapFrac = (gapSize + trackHeight) / totalLen;
506
+ const trackStartFrac = activeFrac + gapFrac;
507
+ const trackLen = Math.max(
508
+ 1e-3,
509
+ totalLen * (1 - activeFrac - 2 * gapFrac)
510
+ );
511
+ const trackOff = -totalLen * trackStartFrac;
512
+ determinateWavyTrackPathRef.current.setAttribute(
513
+ "stroke-dasharray",
514
+ `${trackLen} ${totalLen}`
515
+ );
516
+ determinateWavyTrackPathRef.current.setAttribute(
517
+ "stroke-dashoffset",
518
+ `${trackOff}`
519
+ );
520
+ }
521
+ }
522
+ return;
523
+ }
428
524
  const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
429
525
  const scaledTime = time * safeCrawlerSpeed;
430
526
  const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
@@ -459,7 +555,8 @@ var CircularProgress = React2__namespace.forwardRef(
459
555
  center,
460
556
  radius,
461
557
  currentAmplitude,
462
- effectiveWavelength
558
+ effectiveWavelength,
559
+ wavePhase
463
560
  );
464
561
  if (indeterminateWavyActivePathRef.current) {
465
562
  indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
@@ -554,7 +651,7 @@ var CircularProgress = React2__namespace.forwardRef(
554
651
  style: { width: size, height: size }
555
652
  }, restProps), {
556
653
  children: /* @__PURE__ */ jsxRuntime.jsxs(react.LazyMotion, { features: react.domMax, strict: true, children: [
557
- /* @__PURE__ */ jsxRuntime.jsxs(
654
+ /* @__PURE__ */ jsxRuntime.jsx(
558
655
  "svg",
559
656
  {
560
657
  width: size,
@@ -562,8 +659,18 @@ var CircularProgress = React2__namespace.forwardRef(
562
659
  viewBox: `0 0 ${size} ${size}`,
563
660
  "aria-hidden": "true",
564
661
  style: { transform: "rotate(-90deg)", overflow: "visible" },
565
- children: [
566
- isDeterminate ? /* @__PURE__ */ jsxRuntime.jsx(
662
+ children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
663
+ shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsxRuntime.jsx(
664
+ "path",
665
+ {
666
+ ref: determinateWavyTrackPathRef,
667
+ d: wavyActivePath != null ? wavyActivePath : "",
668
+ fill: "none",
669
+ stroke: bgTrackColor,
670
+ strokeWidth: trackHeight,
671
+ strokeLinecap: "round"
672
+ }
673
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
567
674
  react.m.circle,
568
675
  {
569
676
  cx: center,
@@ -572,28 +679,52 @@ var CircularProgress = React2__namespace.forwardRef(
572
679
  fill: "none",
573
680
  stroke: bgTrackColor,
574
681
  strokeWidth: trackHeight,
575
- initial: { pathLength: trackLength, pathOffset: trackOffset },
576
- animate: { pathLength: trackLength, pathOffset: trackOffset },
682
+ initial: {
683
+ pathLength: trackLength,
684
+ pathOffset: trackOffset
685
+ },
686
+ animate: {
687
+ pathLength: trackLength,
688
+ pathOffset: trackOffset
689
+ },
577
690
  transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
578
691
  strokeLinecap: "round"
579
692
  }
580
- ) : null,
581
- isDeterminate && (isWavy ? /* @__PURE__ */ jsxRuntime.jsx(
582
- ActivePathElem,
693
+ )),
694
+ /* @__PURE__ */ jsxRuntime.jsx(
695
+ "path",
583
696
  {
697
+ ref: determinateWavyActivePathRef,
584
698
  d: wavyActivePath != null ? wavyActivePath : "",
585
699
  fill: "none",
586
700
  stroke: activeColor,
587
701
  strokeWidth: trackHeight,
588
- strokeLinecap: "round",
589
- initial: { pathLength: 0 },
590
- animate: { pathLength: clampedValue / 100 },
591
- transition: {
592
- duration: 0.4,
593
- ease: [0.2, 0, 0, 1]
594
- }
702
+ strokeLinecap: "round"
595
703
  }
596
- ) : /* @__PURE__ */ jsxRuntime.jsx(
704
+ )
705
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
706
+ /* @__PURE__ */ jsxRuntime.jsx(
707
+ react.m.circle,
708
+ {
709
+ cx: center,
710
+ cy: center,
711
+ r: radius,
712
+ fill: "none",
713
+ stroke: bgTrackColor,
714
+ strokeWidth: trackHeight,
715
+ initial: {
716
+ pathLength: trackLength,
717
+ pathOffset: trackOffset
718
+ },
719
+ animate: {
720
+ pathLength: trackLength,
721
+ pathOffset: trackOffset
722
+ },
723
+ transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
724
+ strokeLinecap: "round"
725
+ }
726
+ ),
727
+ /* @__PURE__ */ jsxRuntime.jsx(
597
728
  ActiveCircleElem,
598
729
  {
599
730
  cx: center,
@@ -610,8 +741,8 @@ var CircularProgress = React2__namespace.forwardRef(
610
741
  ease: [0.2, 0, 0, 1]
611
742
  }
612
743
  }
613
- ))
614
- ]
744
+ )
745
+ ] }) : null
615
746
  }
616
747
  ),
617
748
  !isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
@@ -1466,7 +1597,7 @@ var IconButtonComponent = React2__namespace.forwardRef(
1466
1597
  variant = "default",
1467
1598
  colorStyle = "standard",
1468
1599
  size = "sm",
1469
- widthVariant = "default",
1600
+ width = "default",
1470
1601
  shape = "round",
1471
1602
  selected,
1472
1603
  selectedIcon,
@@ -1484,7 +1615,7 @@ var IconButtonComponent = React2__namespace.forwardRef(
1484
1615
  "variant",
1485
1616
  "colorStyle",
1486
1617
  "size",
1487
- "widthVariant",
1618
+ "width",
1488
1619
  "shape",
1489
1620
  "selected",
1490
1621
  "selectedIcon",
@@ -1529,7 +1660,7 @@ var IconButtonComponent = React2__namespace.forwardRef(
1529
1660
  const iconPx = iconSize != null ? iconSize : defaultIconPx;
1530
1661
  const isCustomSize = iconSize != null && iconSize !== "inherit";
1531
1662
  const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
1532
- const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[widthVariant]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
1663
+ const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[width]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
1533
1664
  const needsTouchTarget = size === "xs" || size === "sm";
1534
1665
  const { ripples, onPointerDown, removeRipple } = useRippleState({
1535
1666
  disabled: loading