@bug-on/m3-expressive 1.3.0 → 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 (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/buttons.d.mts +1 -1
  3. package/dist/buttons.d.ts +1 -1
  4. package/dist/buttons.js +185 -40
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +186 -41
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/core.js +156 -25
  9. package/dist/core.js.map +1 -1
  10. package/dist/core.mjs +157 -26
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/feedback.d.mts +20 -0
  13. package/dist/feedback.d.ts +20 -0
  14. package/dist/feedback.js +156 -25
  15. package/dist/feedback.js.map +1 -1
  16. package/dist/feedback.mjs +157 -26
  17. package/dist/feedback.mjs.map +1 -1
  18. package/dist/forms.d.mts +3 -2
  19. package/dist/forms.d.ts +3 -2
  20. package/dist/forms.js +88 -100
  21. package/dist/forms.js.map +1 -1
  22. package/dist/forms.mjs +88 -100
  23. package/dist/forms.mjs.map +1 -1
  24. package/dist/index.d.mts +3 -3
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +279 -146
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +280 -147
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/layout.js +158 -27
  31. package/dist/layout.js.map +1 -1
  32. package/dist/layout.mjs +159 -28
  33. package/dist/layout.mjs.map +1 -1
  34. package/dist/navigation.js +156 -25
  35. package/dist/navigation.js.map +1 -1
  36. package/dist/navigation.mjs +157 -26
  37. package/dist/navigation.mjs.map +1 -1
  38. package/dist/overlays.js +156 -25
  39. package/dist/overlays.js.map +1 -1
  40. package/dist/overlays.mjs +157 -26
  41. package/dist/overlays.mjs.map +1 -1
  42. package/dist/pickers.js +156 -25
  43. package/dist/pickers.js.map +1 -1
  44. package/dist/pickers.mjs +157 -26
  45. package/dist/pickers.mjs.map +1 -1
  46. package/dist/{split-button-trailing-uncheckable-26qlZvKT.d.mts → split-button-trailing-uncheckable-CIVEYgjY.d.mts} +2 -0
  47. package/dist/{split-button-trailing-uncheckable-CXUVrH64.d.ts → split-button-trailing-uncheckable-DTQJjzsB.d.ts} +2 -0
  48. package/dist/{text-field-DWC7qOvp.d.mts → text-field-CiOmDM_8.d.ts} +52 -51
  49. package/dist/{text-field-DWC7qOvp.d.ts → text-field-Ear3hCSq.d.mts} +52 -51
  50. package/package.json +3 -3
@@ -6470,7 +6470,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
6470
6470
  function easeInOutCubic(x) {
6471
6471
  return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
6472
6472
  }
6473
- function generateWavyCircularPath(center, radius, amplitude, wavelength) {
6473
+ function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
6474
6474
  const circumference = 2 * Math.PI * radius;
6475
6475
  const numWaves = Math.max(
6476
6476
  3,
@@ -6478,8 +6478,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
6478
6478
  );
6479
6479
  const steps = numWaves * 4;
6480
6480
  const dt = 2 * Math.PI / steps;
6481
- const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
6482
- const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
6481
+ const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
6482
+ const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
6483
6483
  const xAt = (t) => center + rAt(t) * Math.cos(t);
6484
6484
  const yAt = (t) => center + rAt(t) * Math.sin(t);
6485
6485
  const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
@@ -6544,15 +6544,18 @@ var CircularProgress = React37__namespace.forwardRef(
6544
6544
  size = 48,
6545
6545
  trackHeight = 4,
6546
6546
  shape = "flat",
6547
+ trackShape = "flat",
6547
6548
  amplitude,
6548
6549
  wavelength,
6549
6550
  gapSize = 4,
6551
+ waveSpeed = 1,
6550
6552
  crawlerSpeed = 1,
6551
6553
  color,
6552
6554
  trackColor,
6553
6555
  showTrack = "auto",
6554
6556
  minProgress = DEFAULT_MIN_PROGRESS,
6555
6557
  maxProgress = DEFAULT_MAX_PROGRESS,
6558
+ determinateAnimation = "md3",
6556
6559
  amplitudeRange,
6557
6560
  className,
6558
6561
  "aria-label": ariaLabel
@@ -6561,15 +6564,18 @@ var CircularProgress = React37__namespace.forwardRef(
6561
6564
  "size",
6562
6565
  "trackHeight",
6563
6566
  "shape",
6567
+ "trackShape",
6564
6568
  "amplitude",
6565
6569
  "wavelength",
6566
6570
  "gapSize",
6571
+ "waveSpeed",
6567
6572
  "crawlerSpeed",
6568
6573
  "color",
6569
6574
  "trackColor",
6570
6575
  "showTrack",
6571
6576
  "minProgress",
6572
6577
  "maxProgress",
6578
+ "determinateAnimation",
6573
6579
  "amplitudeRange",
6574
6580
  "className",
6575
6581
  "aria-label"
@@ -6582,6 +6588,7 @@ var CircularProgress = React37__namespace.forwardRef(
6582
6588
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
6583
6589
  const isWavy = shape === "wavy";
6584
6590
  const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
6591
+ const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
6585
6592
  const BASELINE_SIZE = 48;
6586
6593
  const scaleFactor = size / BASELINE_SIZE;
6587
6594
  const effectiveAmplitude = React37__namespace.useMemo(
@@ -6614,19 +6621,50 @@ var CircularProgress = React37__namespace.forwardRef(
6614
6621
  const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
6615
6622
  const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
6616
6623
  const ActiveCircleElem = react.m.circle;
6617
- const ActivePathElem = react.m.path;
6618
6624
  const indeterminateSvgRef = React37__namespace.useRef(null);
6619
6625
  const indeterminateTrackRef = React37__namespace.useRef(null);
6620
6626
  const indeterminateActiveRef = React37__namespace.useRef(null);
6621
6627
  const indeterminateWavyTrackPathRef = React37__namespace.useRef(null);
6622
6628
  const indeterminateWavyActivePathRef = React37__namespace.useRef(null);
6629
+ const determinateWavyActivePathRef = React37__namespace.useRef(null);
6630
+ const determinateWavyTrackPathRef = React37__namespace.useRef(null);
6623
6631
  const cachedPathLengthRef = React37__namespace.useRef(0);
6632
+ const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 0);
6633
+ const amplitudeMV = react.useMotionValue(isWavy ? effectiveAmplitude : 0);
6634
+ React37__namespace.useEffect(() => {
6635
+ if (isDeterminate) {
6636
+ react.animate(fractionMV, clampedValue / 100, {
6637
+ duration: 0.4,
6638
+ ease: [0.2, 0, 0, 1]
6639
+ });
6640
+ }
6641
+ }, [clampedValue, isDeterminate, fractionMV]);
6642
+ React37__namespace.useEffect(() => {
6643
+ if (!isDeterminate || !isWavy) return;
6644
+ const fraction = clampedValue / 100;
6645
+ let targetAmp = effectiveAmplitude;
6646
+ if (determinateAnimation === "md3") {
6647
+ targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
6648
+ }
6649
+ react.animate(amplitudeMV, targetAmp, {
6650
+ type: "spring",
6651
+ bounce: 0,
6652
+ duration: 0.5
6653
+ });
6654
+ }, [
6655
+ clampedValue,
6656
+ isDeterminate,
6657
+ isWavy,
6658
+ effectiveAmplitude,
6659
+ amplitudeMV,
6660
+ determinateAnimation
6661
+ ]);
6624
6662
  React37__namespace.useLayoutEffect(() => {
6625
6663
  if (!isWavy || !wavyActivePath) {
6626
6664
  cachedPathLengthRef.current = circumference;
6627
6665
  return;
6628
6666
  }
6629
- const el = indeterminateActiveRef.current;
6667
+ const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
6630
6668
  if (el && "getTotalLength" in el) {
6631
6669
  try {
6632
6670
  const len = el.getTotalLength();
@@ -6640,7 +6678,65 @@ var CircularProgress = React37__namespace.forwardRef(
6640
6678
  cachedPathLengthRef.current = circumference;
6641
6679
  }, [isWavy, circumference, wavyActivePath]);
6642
6680
  react.useAnimationFrame((time) => {
6643
- if (isDeterminate) return;
6681
+ const safeWaveSpeed = Math.max(0.1, waveSpeed);
6682
+ const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
6683
+ if (isDeterminate) {
6684
+ if (isWavy) {
6685
+ const currentAmp = amplitudeMV.get();
6686
+ const dynamicPath = generateWavyCircularPath(
6687
+ center,
6688
+ radius,
6689
+ currentAmp,
6690
+ effectiveWavelength,
6691
+ wavePhase
6692
+ );
6693
+ if (determinateWavyActivePathRef.current) {
6694
+ determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
6695
+ }
6696
+ if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
6697
+ determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
6698
+ }
6699
+ const pathEl = determinateWavyActivePathRef.current;
6700
+ let totalLen = cachedPathLengthRef.current || circumference;
6701
+ if (pathEl) {
6702
+ try {
6703
+ const len = pathEl.getTotalLength();
6704
+ if (len > 0) totalLen = len;
6705
+ } catch (e) {
6706
+ }
6707
+ }
6708
+ const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
6709
+ const activeLen = totalLen * activeFrac;
6710
+ if (determinateWavyActivePathRef.current) {
6711
+ determinateWavyActivePathRef.current.setAttribute(
6712
+ "stroke-dasharray",
6713
+ `${activeLen} ${totalLen}`
6714
+ );
6715
+ determinateWavyActivePathRef.current.setAttribute(
6716
+ "stroke-dashoffset",
6717
+ "0"
6718
+ );
6719
+ }
6720
+ if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
6721
+ const gapFrac = (gapSize + trackHeight) / totalLen;
6722
+ const trackStartFrac = activeFrac + gapFrac;
6723
+ const trackLen = Math.max(
6724
+ 1e-3,
6725
+ totalLen * (1 - activeFrac - 2 * gapFrac)
6726
+ );
6727
+ const trackOff = -totalLen * trackStartFrac;
6728
+ determinateWavyTrackPathRef.current.setAttribute(
6729
+ "stroke-dasharray",
6730
+ `${trackLen} ${totalLen}`
6731
+ );
6732
+ determinateWavyTrackPathRef.current.setAttribute(
6733
+ "stroke-dashoffset",
6734
+ `${trackOff}`
6735
+ );
6736
+ }
6737
+ }
6738
+ return;
6739
+ }
6644
6740
  const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
6645
6741
  const scaledTime = time * safeCrawlerSpeed;
6646
6742
  const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
@@ -6675,7 +6771,8 @@ var CircularProgress = React37__namespace.forwardRef(
6675
6771
  center,
6676
6772
  radius,
6677
6773
  currentAmplitude,
6678
- effectiveWavelength
6774
+ effectiveWavelength,
6775
+ wavePhase
6679
6776
  );
6680
6777
  if (indeterminateWavyActivePathRef.current) {
6681
6778
  indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
@@ -6770,7 +6867,7 @@ var CircularProgress = React37__namespace.forwardRef(
6770
6867
  style: { width: size, height: size }
6771
6868
  }, restProps), {
6772
6869
  children: /* @__PURE__ */ jsxRuntime.jsxs(react.LazyMotion, { features: react.domMax, strict: true, children: [
6773
- /* @__PURE__ */ jsxRuntime.jsxs(
6870
+ /* @__PURE__ */ jsxRuntime.jsx(
6774
6871
  "svg",
6775
6872
  {
6776
6873
  width: size,
@@ -6778,8 +6875,18 @@ var CircularProgress = React37__namespace.forwardRef(
6778
6875
  viewBox: `0 0 ${size} ${size}`,
6779
6876
  "aria-hidden": "true",
6780
6877
  style: { transform: "rotate(-90deg)", overflow: "visible" },
6781
- children: [
6782
- isDeterminate ? /* @__PURE__ */ jsxRuntime.jsx(
6878
+ children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6879
+ shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsxRuntime.jsx(
6880
+ "path",
6881
+ {
6882
+ ref: determinateWavyTrackPathRef,
6883
+ d: wavyActivePath != null ? wavyActivePath : "",
6884
+ fill: "none",
6885
+ stroke: bgTrackColor,
6886
+ strokeWidth: trackHeight,
6887
+ strokeLinecap: "round"
6888
+ }
6889
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
6783
6890
  react.m.circle,
6784
6891
  {
6785
6892
  cx: center,
@@ -6788,28 +6895,52 @@ var CircularProgress = React37__namespace.forwardRef(
6788
6895
  fill: "none",
6789
6896
  stroke: bgTrackColor,
6790
6897
  strokeWidth: trackHeight,
6791
- initial: { pathLength: trackLength, pathOffset: trackOffset },
6792
- animate: { pathLength: trackLength, pathOffset: trackOffset },
6898
+ initial: {
6899
+ pathLength: trackLength,
6900
+ pathOffset: trackOffset
6901
+ },
6902
+ animate: {
6903
+ pathLength: trackLength,
6904
+ pathOffset: trackOffset
6905
+ },
6793
6906
  transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
6794
6907
  strokeLinecap: "round"
6795
6908
  }
6796
- ) : null,
6797
- isDeterminate && (isWavy ? /* @__PURE__ */ jsxRuntime.jsx(
6798
- ActivePathElem,
6909
+ )),
6910
+ /* @__PURE__ */ jsxRuntime.jsx(
6911
+ "path",
6799
6912
  {
6913
+ ref: determinateWavyActivePathRef,
6800
6914
  d: wavyActivePath != null ? wavyActivePath : "",
6801
6915
  fill: "none",
6802
6916
  stroke: activeColor,
6803
6917
  strokeWidth: trackHeight,
6804
- strokeLinecap: "round",
6805
- initial: { pathLength: 0 },
6806
- animate: { pathLength: clampedValue / 100 },
6807
- transition: {
6808
- duration: 0.4,
6809
- ease: [0.2, 0, 0, 1]
6810
- }
6918
+ strokeLinecap: "round"
6811
6919
  }
6812
- ) : /* @__PURE__ */ jsxRuntime.jsx(
6920
+ )
6921
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6922
+ /* @__PURE__ */ jsxRuntime.jsx(
6923
+ react.m.circle,
6924
+ {
6925
+ cx: center,
6926
+ cy: center,
6927
+ r: radius,
6928
+ fill: "none",
6929
+ stroke: bgTrackColor,
6930
+ strokeWidth: trackHeight,
6931
+ initial: {
6932
+ pathLength: trackLength,
6933
+ pathOffset: trackOffset
6934
+ },
6935
+ animate: {
6936
+ pathLength: trackLength,
6937
+ pathOffset: trackOffset
6938
+ },
6939
+ transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
6940
+ strokeLinecap: "round"
6941
+ }
6942
+ ),
6943
+ /* @__PURE__ */ jsxRuntime.jsx(
6813
6944
  ActiveCircleElem,
6814
6945
  {
6815
6946
  cx: center,
@@ -6826,8 +6957,8 @@ var CircularProgress = React37__namespace.forwardRef(
6826
6957
  ease: [0.2, 0, 0, 1]
6827
6958
  }
6828
6959
  }
6829
- ))
6830
- ]
6960
+ )
6961
+ ] }) : null
6831
6962
  }
6832
6963
  ),
6833
6964
  !isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(