@bug-on/m3-expressive 1.2.4 → 1.2.6

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 (51) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +128 -41
  3. package/dist/buttons.d.mts +1 -1
  4. package/dist/buttons.d.ts +1 -1
  5. package/dist/buttons.js +59 -45
  6. package/dist/buttons.js.map +1 -1
  7. package/dist/buttons.mjs +59 -45
  8. package/dist/buttons.mjs.map +1 -1
  9. package/dist/core.js +54 -40
  10. package/dist/core.js.map +1 -1
  11. package/dist/core.mjs +54 -40
  12. package/dist/core.mjs.map +1 -1
  13. package/dist/feedback.js +53 -39
  14. package/dist/feedback.js.map +1 -1
  15. package/dist/feedback.mjs +53 -39
  16. package/dist/feedback.mjs.map +1 -1
  17. package/dist/forms.d.mts +2 -2
  18. package/dist/forms.d.ts +2 -2
  19. package/dist/index.d.mts +77 -6
  20. package/dist/index.d.ts +77 -6
  21. package/dist/index.js +5607 -5429
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +5506 -5329
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/layout.js +60 -46
  26. package/dist/layout.js.map +1 -1
  27. package/dist/layout.mjs +60 -46
  28. package/dist/layout.mjs.map +1 -1
  29. package/dist/navigation.d.mts +27 -7
  30. package/dist/navigation.d.ts +27 -7
  31. package/dist/navigation.js +481 -474
  32. package/dist/navigation.js.map +1 -1
  33. package/dist/navigation.mjs +473 -466
  34. package/dist/navigation.mjs.map +1 -1
  35. package/dist/overlays.d.mts +2 -2
  36. package/dist/overlays.d.ts +2 -2
  37. package/dist/overlays.js +53 -39
  38. package/dist/overlays.js.map +1 -1
  39. package/dist/overlays.mjs +53 -39
  40. package/dist/overlays.mjs.map +1 -1
  41. package/dist/pickers.js +53 -39
  42. package/dist/pickers.js.map +1 -1
  43. package/dist/pickers.mjs +53 -39
  44. package/dist/pickers.mjs.map +1 -1
  45. package/dist/{side-sheet-modal-Bd5Qqvp9.d.ts → side-sheet-modal-DdEZR6Vl.d.ts} +1 -1
  46. package/dist/{side-sheet-modal-64FGhDxL.d.mts → side-sheet-modal-Dgjt739k.d.mts} +1 -1
  47. package/dist/{split-button-trailing-uncheckable-DtxrcLxH.d.ts → split-button-trailing-uncheckable--BhNTEJw.d.ts} +5 -5
  48. package/dist/{split-button-trailing-uncheckable-BTWfIN2k.d.mts → split-button-trailing-uncheckable-DPJL3bO6.d.mts} +5 -5
  49. package/dist/{text-field-T4Rg-9Bw.d.mts → text-field-DWC7qOvp.d.mts} +128 -128
  50. package/dist/{text-field-T4Rg-9Bw.d.ts → text-field-DWC7qOvp.d.ts} +128 -128
  51. package/package.json +3 -3
package/dist/core.mjs CHANGED
@@ -646,24 +646,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
646
646
  if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
647
647
  d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
648
648
  }
649
- d += " Z";
650
649
  return d;
651
650
  }
652
651
  function getSinePath(startX, endX, phase, wl, amp) {
653
652
  if (startX >= endX) return "";
654
- let d = "";
655
- const step = amp === 0 ? Math.max(10, endX - startX) : 1;
656
- const yStart = Math.sin((startX + phase) / wl * 2 * Math.PI) * amp;
657
- d += `M ${startX.toFixed(2)} ${yStart.toFixed(2)}`;
658
- let nextX = Math.ceil(startX / step) * step;
659
- if (nextX === startX) nextX += step;
660
- while (nextX < endX) {
661
- const y = Math.sin((nextX + phase) / wl * 2 * Math.PI) * amp;
662
- d += ` L ${nextX.toFixed(2)} ${y.toFixed(2)}`;
663
- nextX += step;
664
- }
665
- const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
666
- d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
653
+ if (amp <= 0.01) {
654
+ return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
655
+ }
656
+ const safeWl = Math.max(1, wl);
657
+ const k = 2 * Math.PI / safeWl;
658
+ const phi = phase / safeWl * 2 * Math.PI;
659
+ const yAt = (x) => amp * Math.sin(k * x + phi);
660
+ const dyAt = (x) => amp * k * Math.cos(k * x + phi);
661
+ const step = safeWl / 4;
662
+ let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
663
+ let currentX = startX;
664
+ while (currentX < endX) {
665
+ const nextX = Math.min(endX, currentX + step);
666
+ const dx = nextX - currentX;
667
+ const scale = dx / 3;
668
+ const y0 = yAt(currentX);
669
+ const dy0 = dyAt(currentX);
670
+ const y1 = yAt(nextX);
671
+ const dy1 = dyAt(nextX);
672
+ const cp1x = currentX + scale;
673
+ const cp1y = y0 + scale * dy0;
674
+ const cp2x = nextX - scale;
675
+ const cp2y = y1 - scale * dy1;
676
+ d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
677
+ currentX = nextX;
678
+ }
667
679
  return d;
668
680
  }
669
681
  var CircularProgress = React11.forwardRef(
@@ -818,16 +830,13 @@ var CircularProgress = React11.forwardRef(
818
830
  position: "absolute",
819
831
  inset: 0,
820
832
  overflow: "visible",
821
- rotate: "-90deg",
822
833
  transformOrigin: "center"
823
834
  },
824
- animate: { rotate: ["-90deg", "270deg"] },
835
+ animate: { rotate: [0, 360] },
825
836
  transition: {
826
- rotate: {
827
- duration: 2 / Math.max(0.1, crawlerSpeed),
828
- repeat: Number.POSITIVE_INFINITY,
829
- ease: "linear"
830
- }
837
+ duration: 2 / Math.max(0.1, crawlerSpeed),
838
+ repeat: Number.POSITIVE_INFINITY,
839
+ ease: "linear"
831
840
  },
832
841
  children: [
833
842
  /* @__PURE__ */ jsx(
@@ -840,17 +849,16 @@ var CircularProgress = React11.forwardRef(
840
849
  stroke: bgTrackColor,
841
850
  strokeWidth: trackHeight,
842
851
  strokeLinecap: "round",
843
- style: { originX: "50%", originY: "50%" },
844
852
  animate: {
845
853
  pathLength: [
846
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
847
- Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
848
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
854
+ Math.max(1e-3, 0.9 - 2 * gapForTrack),
855
+ Math.max(1e-3, 0.25 - 2 * gapForTrack),
856
+ Math.max(1e-3, 0.9 - 2 * gapForTrack)
849
857
  ],
850
- rotate: [
851
- `${(0.1 + gapForTrack) * 360}deg`,
852
- `${(1 + gapForTrack) * 360}deg`,
853
- `${(1.1 + gapForTrack) * 360}deg`
858
+ pathOffset: [
859
+ 0.1 + gapForTrack,
860
+ 0.75 + gapForTrack,
861
+ 0.1 + gapForTrack
854
862
  ]
855
863
  },
856
864
  transition: {
@@ -868,10 +876,9 @@ var CircularProgress = React11.forwardRef(
868
876
  stroke: activeColor,
869
877
  strokeWidth: trackHeight,
870
878
  strokeLinecap: "round",
871
- style: { originX: "50%", originY: "50%" },
872
879
  animate: {
873
880
  pathLength: [0.1, 0.75, 0.1],
874
- rotate: ["0deg", "90deg", "360deg"]
881
+ pathOffset: [0, 0.65, 1]
875
882
  },
876
883
  transition: {
877
884
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -889,10 +896,9 @@ var CircularProgress = React11.forwardRef(
889
896
  stroke: activeColor,
890
897
  strokeWidth: trackHeight,
891
898
  strokeLinecap: "round",
892
- style: { originX: "50%", originY: "50%" },
893
899
  animate: {
894
900
  pathLength: [0.1, 0.75, 0.1],
895
- rotate: ["0deg", "90deg", "360deg"]
901
+ pathOffset: [0, 0.65, 1]
896
902
  },
897
903
  transition: {
898
904
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -1065,6 +1071,12 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1065
1071
  duration: 0.5
1066
1072
  });
1067
1073
  animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
1074
+ } else {
1075
+ animate(amplitudeMV, amplitude, {
1076
+ type: "spring",
1077
+ bounce: 0,
1078
+ duration: 0.5
1079
+ });
1068
1080
  }
1069
1081
  }, [
1070
1082
  clampedValue,
@@ -1078,10 +1090,10 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1078
1090
  1,
1079
1091
  isDeterminate ? wavelength : indeterminateWavelength
1080
1092
  );
1081
- const trackAmp = trackShape === "wavy" ? amplitude : 0;
1082
1093
  useAnimationFrame((time) => {
1083
1094
  if (width === 0) return;
1084
1095
  const currentAmp = amplitudeMV.get();
1096
+ const trackAmp = trackShape === "wavy" ? amplitude : 0;
1085
1097
  const phase = time / 1e3 * waveSpeed * activeWavelength;
1086
1098
  const capWidth = trackHeight / 2;
1087
1099
  let activePathD = "";
@@ -1182,7 +1194,7 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1182
1194
  "div",
1183
1195
  {
1184
1196
  ref: containerRef,
1185
- className: "relative w-full overflow-hidden",
1197
+ className: "relative w-full",
1186
1198
  style: { height: svgHeight },
1187
1199
  children: width > 0 && /* @__PURE__ */ jsxs(
1188
1200
  "svg",
@@ -1236,7 +1248,7 @@ var LinearProgress = React11.forwardRef(
1236
1248
  waveSpeed = 1,
1237
1249
  crawlerSpeed = 1,
1238
1250
  determinateAnimation = "md3",
1239
- indeterminateAnimation = "continuous",
1251
+ indeterminateAnimation = "md3",
1240
1252
  gapSize = 4,
1241
1253
  showStopIndicator = "auto",
1242
1254
  color,
@@ -1273,15 +1285,15 @@ var LinearProgress = React11.forwardRef(
1273
1285
  setIsRtl(dir === "rtl");
1274
1286
  }
1275
1287
  }, []);
1276
- const isWavy = shape === "wavy";
1277
1288
  const resolvedTrackShape = trackShape != null ? trackShape : shape;
1289
+ const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
1278
1290
  const effectiveAmplitude = React11.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
1279
1291
  const svgHeight = React11.useMemo(
1280
1292
  () => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
1281
1293
  [isWavy, trackHeight, effectiveAmplitude]
1282
1294
  );
1283
1295
  const shouldShowStop = React11.useMemo(
1284
- () => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
1296
+ () => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
1285
1297
  [isDeterminate, resolvedTrackShape, showStopIndicator]
1286
1298
  );
1287
1299
  const stopSize = React11.useMemo(
@@ -1291,6 +1303,8 @@ var LinearProgress = React11.forwardRef(
1291
1303
  const stopOffset = (trackHeight - stopSize) / 2;
1292
1304
  const activeColor = color || "var(--md-sys-color-indicator-active)";
1293
1305
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
1306
+ const useWavyTrack = isWavy || !isDeterminate;
1307
+ const trackAmp = isWavy ? effectiveAmplitude : 0;
1294
1308
  return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
1295
1309
  "div",
1296
1310
  __spreadProps(__spreadValues({
@@ -1307,12 +1321,12 @@ var LinearProgress = React11.forwardRef(
1307
1321
  style: { height: svgHeight }
1308
1322
  }, restProps), {
1309
1323
  children: [
1310
- isWavy ? /* @__PURE__ */ jsx(
1324
+ useWavyTrack ? /* @__PURE__ */ jsx(
1311
1325
  WavyLinearTrack,
1312
1326
  {
1313
1327
  trackHeight,
1314
1328
  svgHeight,
1315
- amplitude: effectiveAmplitude,
1329
+ amplitude: trackAmp,
1316
1330
  wavelength,
1317
1331
  indeterminateWavelength,
1318
1332
  activeColor,