@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.js CHANGED
@@ -667,24 +667,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
667
667
  if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
668
668
  d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
669
669
  }
670
- d += " Z";
671
670
  return d;
672
671
  }
673
672
  function getSinePath(startX, endX, phase, wl, amp) {
674
673
  if (startX >= endX) return "";
675
- let d = "";
676
- const step = amp === 0 ? Math.max(10, endX - startX) : 1;
677
- const yStart = Math.sin((startX + phase) / wl * 2 * Math.PI) * amp;
678
- d += `M ${startX.toFixed(2)} ${yStart.toFixed(2)}`;
679
- let nextX = Math.ceil(startX / step) * step;
680
- if (nextX === startX) nextX += step;
681
- while (nextX < endX) {
682
- const y = Math.sin((nextX + phase) / wl * 2 * Math.PI) * amp;
683
- d += ` L ${nextX.toFixed(2)} ${y.toFixed(2)}`;
684
- nextX += step;
685
- }
686
- const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
687
- d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
674
+ if (amp <= 0.01) {
675
+ return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
676
+ }
677
+ const safeWl = Math.max(1, wl);
678
+ const k = 2 * Math.PI / safeWl;
679
+ const phi = phase / safeWl * 2 * Math.PI;
680
+ const yAt = (x) => amp * Math.sin(k * x + phi);
681
+ const dyAt = (x) => amp * k * Math.cos(k * x + phi);
682
+ const step = safeWl / 4;
683
+ let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
684
+ let currentX = startX;
685
+ while (currentX < endX) {
686
+ const nextX = Math.min(endX, currentX + step);
687
+ const dx = nextX - currentX;
688
+ const scale = dx / 3;
689
+ const y0 = yAt(currentX);
690
+ const dy0 = dyAt(currentX);
691
+ const y1 = yAt(nextX);
692
+ const dy1 = dyAt(nextX);
693
+ const cp1x = currentX + scale;
694
+ const cp1y = y0 + scale * dy0;
695
+ const cp2x = nextX - scale;
696
+ const cp2y = y1 - scale * dy1;
697
+ d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
698
+ currentX = nextX;
699
+ }
688
700
  return d;
689
701
  }
690
702
  var CircularProgress = React11__namespace.forwardRef(
@@ -839,16 +851,13 @@ var CircularProgress = React11__namespace.forwardRef(
839
851
  position: "absolute",
840
852
  inset: 0,
841
853
  overflow: "visible",
842
- rotate: "-90deg",
843
854
  transformOrigin: "center"
844
855
  },
845
- animate: { rotate: ["-90deg", "270deg"] },
856
+ animate: { rotate: [0, 360] },
846
857
  transition: {
847
- rotate: {
848
- duration: 2 / Math.max(0.1, crawlerSpeed),
849
- repeat: Number.POSITIVE_INFINITY,
850
- ease: "linear"
851
- }
858
+ duration: 2 / Math.max(0.1, crawlerSpeed),
859
+ repeat: Number.POSITIVE_INFINITY,
860
+ ease: "linear"
852
861
  },
853
862
  children: [
854
863
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -861,17 +870,16 @@ var CircularProgress = React11__namespace.forwardRef(
861
870
  stroke: bgTrackColor,
862
871
  strokeWidth: trackHeight,
863
872
  strokeLinecap: "round",
864
- style: { originX: "50%", originY: "50%" },
865
873
  animate: {
866
874
  pathLength: [
867
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
868
- Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
869
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
875
+ Math.max(1e-3, 0.9 - 2 * gapForTrack),
876
+ Math.max(1e-3, 0.25 - 2 * gapForTrack),
877
+ Math.max(1e-3, 0.9 - 2 * gapForTrack)
870
878
  ],
871
- rotate: [
872
- `${(0.1 + gapForTrack) * 360}deg`,
873
- `${(1 + gapForTrack) * 360}deg`,
874
- `${(1.1 + gapForTrack) * 360}deg`
879
+ pathOffset: [
880
+ 0.1 + gapForTrack,
881
+ 0.75 + gapForTrack,
882
+ 0.1 + gapForTrack
875
883
  ]
876
884
  },
877
885
  transition: {
@@ -889,10 +897,9 @@ var CircularProgress = React11__namespace.forwardRef(
889
897
  stroke: activeColor,
890
898
  strokeWidth: trackHeight,
891
899
  strokeLinecap: "round",
892
- style: { originX: "50%", originY: "50%" },
893
900
  animate: {
894
901
  pathLength: [0.1, 0.75, 0.1],
895
- rotate: ["0deg", "90deg", "360deg"]
902
+ pathOffset: [0, 0.65, 1]
896
903
  },
897
904
  transition: {
898
905
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -910,10 +917,9 @@ var CircularProgress = React11__namespace.forwardRef(
910
917
  stroke: activeColor,
911
918
  strokeWidth: trackHeight,
912
919
  strokeLinecap: "round",
913
- style: { originX: "50%", originY: "50%" },
914
920
  animate: {
915
921
  pathLength: [0.1, 0.75, 0.1],
916
- rotate: ["0deg", "90deg", "360deg"]
922
+ pathOffset: [0, 0.65, 1]
917
923
  },
918
924
  transition: {
919
925
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -1086,6 +1092,12 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
1086
1092
  duration: 0.5
1087
1093
  });
1088
1094
  react.animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
1095
+ } else {
1096
+ react.animate(amplitudeMV, amplitude, {
1097
+ type: "spring",
1098
+ bounce: 0,
1099
+ duration: 0.5
1100
+ });
1089
1101
  }
1090
1102
  }, [
1091
1103
  clampedValue,
@@ -1099,10 +1111,10 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
1099
1111
  1,
1100
1112
  isDeterminate ? wavelength : indeterminateWavelength
1101
1113
  );
1102
- const trackAmp = trackShape === "wavy" ? amplitude : 0;
1103
1114
  react.useAnimationFrame((time) => {
1104
1115
  if (width === 0) return;
1105
1116
  const currentAmp = amplitudeMV.get();
1117
+ const trackAmp = trackShape === "wavy" ? amplitude : 0;
1106
1118
  const phase = time / 1e3 * waveSpeed * activeWavelength;
1107
1119
  const capWidth = trackHeight / 2;
1108
1120
  let activePathD = "";
@@ -1203,7 +1215,7 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
1203
1215
  "div",
1204
1216
  {
1205
1217
  ref: containerRef,
1206
- className: "relative w-full overflow-hidden",
1218
+ className: "relative w-full",
1207
1219
  style: { height: svgHeight },
1208
1220
  children: width > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
1209
1221
  "svg",
@@ -1257,7 +1269,7 @@ var LinearProgress = React11__namespace.forwardRef(
1257
1269
  waveSpeed = 1,
1258
1270
  crawlerSpeed = 1,
1259
1271
  determinateAnimation = "md3",
1260
- indeterminateAnimation = "continuous",
1272
+ indeterminateAnimation = "md3",
1261
1273
  gapSize = 4,
1262
1274
  showStopIndicator = "auto",
1263
1275
  color,
@@ -1294,15 +1306,15 @@ var LinearProgress = React11__namespace.forwardRef(
1294
1306
  setIsRtl(dir === "rtl");
1295
1307
  }
1296
1308
  }, []);
1297
- const isWavy = shape === "wavy";
1298
1309
  const resolvedTrackShape = trackShape != null ? trackShape : shape;
1310
+ const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
1299
1311
  const effectiveAmplitude = React11__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
1300
1312
  const svgHeight = React11__namespace.useMemo(
1301
1313
  () => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
1302
1314
  [isWavy, trackHeight, effectiveAmplitude]
1303
1315
  );
1304
1316
  const shouldShowStop = React11__namespace.useMemo(
1305
- () => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
1317
+ () => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
1306
1318
  [isDeterminate, resolvedTrackShape, showStopIndicator]
1307
1319
  );
1308
1320
  const stopSize = React11__namespace.useMemo(
@@ -1312,6 +1324,8 @@ var LinearProgress = React11__namespace.forwardRef(
1312
1324
  const stopOffset = (trackHeight - stopSize) / 2;
1313
1325
  const activeColor = color || "var(--md-sys-color-indicator-active)";
1314
1326
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
1327
+ const useWavyTrack = isWavy || !isDeterminate;
1328
+ const trackAmp = isWavy ? effectiveAmplitude : 0;
1315
1329
  return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1316
1330
  "div",
1317
1331
  __spreadProps(__spreadValues({
@@ -1328,12 +1342,12 @@ var LinearProgress = React11__namespace.forwardRef(
1328
1342
  style: { height: svgHeight }
1329
1343
  }, restProps), {
1330
1344
  children: [
1331
- isWavy ? /* @__PURE__ */ jsxRuntime.jsx(
1345
+ useWavyTrack ? /* @__PURE__ */ jsxRuntime.jsx(
1332
1346
  WavyLinearTrack,
1333
1347
  {
1334
1348
  trackHeight,
1335
1349
  svgHeight,
1336
- amplitude: effectiveAmplitude,
1350
+ amplitude: trackAmp,
1337
1351
  wavelength,
1338
1352
  indeterminateWavelength,
1339
1353
  activeColor,