@bug-on/m3-expressive 1.2.5 → 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.
package/dist/pickers.js CHANGED
@@ -735,24 +735,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
735
735
  if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
736
736
  d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
737
737
  }
738
- d += " Z";
739
738
  return d;
740
739
  }
741
740
  function getSinePath(startX, endX, phase, wl, amp) {
742
741
  if (startX >= endX) return "";
743
- let d = "";
744
- const step = amp === 0 ? Math.max(10, endX - startX) : 1;
745
- const yStart = Math.sin((startX + phase) / wl * 2 * Math.PI) * amp;
746
- d += `M ${startX.toFixed(2)} ${yStart.toFixed(2)}`;
747
- let nextX = Math.ceil(startX / step) * step;
748
- if (nextX === startX) nextX += step;
749
- while (nextX < endX) {
750
- const y = Math.sin((nextX + phase) / wl * 2 * Math.PI) * amp;
751
- d += ` L ${nextX.toFixed(2)} ${y.toFixed(2)}`;
752
- nextX += step;
742
+ if (amp <= 0.01) {
743
+ return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
744
+ }
745
+ const safeWl = Math.max(1, wl);
746
+ const k = 2 * Math.PI / safeWl;
747
+ const phi = phase / safeWl * 2 * Math.PI;
748
+ const yAt = (x) => amp * Math.sin(k * x + phi);
749
+ const dyAt = (x) => amp * k * Math.cos(k * x + phi);
750
+ const step = safeWl / 4;
751
+ let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
752
+ let currentX = startX;
753
+ while (currentX < endX) {
754
+ const nextX = Math.min(endX, currentX + step);
755
+ const dx = nextX - currentX;
756
+ const scale = dx / 3;
757
+ const y0 = yAt(currentX);
758
+ const dy0 = dyAt(currentX);
759
+ const y1 = yAt(nextX);
760
+ const dy1 = dyAt(nextX);
761
+ const cp1x = currentX + scale;
762
+ const cp1y = y0 + scale * dy0;
763
+ const cp2x = nextX - scale;
764
+ const cp2y = y1 - scale * dy1;
765
+ d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
766
+ currentX = nextX;
753
767
  }
754
- const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
755
- d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
756
768
  return d;
757
769
  }
758
770
  var CircularProgress = React13__namespace.forwardRef(
@@ -907,16 +919,13 @@ var CircularProgress = React13__namespace.forwardRef(
907
919
  position: "absolute",
908
920
  inset: 0,
909
921
  overflow: "visible",
910
- rotate: "-90deg",
911
922
  transformOrigin: "center"
912
923
  },
913
- animate: { rotate: ["-90deg", "270deg"] },
924
+ animate: { rotate: [0, 360] },
914
925
  transition: {
915
- rotate: {
916
- duration: 2 / Math.max(0.1, crawlerSpeed),
917
- repeat: Number.POSITIVE_INFINITY,
918
- ease: "linear"
919
- }
926
+ duration: 2 / Math.max(0.1, crawlerSpeed),
927
+ repeat: Number.POSITIVE_INFINITY,
928
+ ease: "linear"
920
929
  },
921
930
  children: [
922
931
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -929,17 +938,16 @@ var CircularProgress = React13__namespace.forwardRef(
929
938
  stroke: bgTrackColor,
930
939
  strokeWidth: trackHeight,
931
940
  strokeLinecap: "round",
932
- style: { originX: "50%", originY: "50%" },
933
941
  animate: {
934
942
  pathLength: [
935
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
936
- Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
937
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
943
+ Math.max(1e-3, 0.9 - 2 * gapForTrack),
944
+ Math.max(1e-3, 0.25 - 2 * gapForTrack),
945
+ Math.max(1e-3, 0.9 - 2 * gapForTrack)
938
946
  ],
939
- rotate: [
940
- `${(0.1 + gapForTrack) * 360}deg`,
941
- `${(1 + gapForTrack) * 360}deg`,
942
- `${(1.1 + gapForTrack) * 360}deg`
947
+ pathOffset: [
948
+ 0.1 + gapForTrack,
949
+ 0.75 + gapForTrack,
950
+ 0.1 + gapForTrack
943
951
  ]
944
952
  },
945
953
  transition: {
@@ -957,10 +965,9 @@ var CircularProgress = React13__namespace.forwardRef(
957
965
  stroke: activeColor,
958
966
  strokeWidth: trackHeight,
959
967
  strokeLinecap: "round",
960
- style: { originX: "50%", originY: "50%" },
961
968
  animate: {
962
969
  pathLength: [0.1, 0.75, 0.1],
963
- rotate: ["0deg", "90deg", "360deg"]
970
+ pathOffset: [0, 0.65, 1]
964
971
  },
965
972
  transition: {
966
973
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -978,10 +985,9 @@ var CircularProgress = React13__namespace.forwardRef(
978
985
  stroke: activeColor,
979
986
  strokeWidth: trackHeight,
980
987
  strokeLinecap: "round",
981
- style: { originX: "50%", originY: "50%" },
982
988
  animate: {
983
989
  pathLength: [0.1, 0.75, 0.1],
984
- rotate: ["0deg", "90deg", "360deg"]
990
+ pathOffset: [0, 0.65, 1]
985
991
  },
986
992
  transition: {
987
993
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -1154,6 +1160,12 @@ var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
1154
1160
  duration: 0.5
1155
1161
  });
1156
1162
  react.animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
1163
+ } else {
1164
+ react.animate(amplitudeMV, amplitude, {
1165
+ type: "spring",
1166
+ bounce: 0,
1167
+ duration: 0.5
1168
+ });
1157
1169
  }
1158
1170
  }, [
1159
1171
  clampedValue,
@@ -1167,10 +1179,10 @@ var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
1167
1179
  1,
1168
1180
  isDeterminate ? wavelength : indeterminateWavelength
1169
1181
  );
1170
- const trackAmp = trackShape === "wavy" ? amplitude : 0;
1171
1182
  react.useAnimationFrame((time) => {
1172
1183
  if (width === 0) return;
1173
1184
  const currentAmp = amplitudeMV.get();
1185
+ const trackAmp = trackShape === "wavy" ? amplitude : 0;
1174
1186
  const phase = time / 1e3 * waveSpeed * activeWavelength;
1175
1187
  const capWidth = trackHeight / 2;
1176
1188
  let activePathD = "";
@@ -1271,7 +1283,7 @@ var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
1271
1283
  "div",
1272
1284
  {
1273
1285
  ref: containerRef,
1274
- className: "relative w-full overflow-hidden",
1286
+ className: "relative w-full",
1275
1287
  style: { height: svgHeight },
1276
1288
  children: width > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
1277
1289
  "svg",
@@ -1325,7 +1337,7 @@ var LinearProgress = React13__namespace.forwardRef(
1325
1337
  waveSpeed = 1,
1326
1338
  crawlerSpeed = 1,
1327
1339
  determinateAnimation = "md3",
1328
- indeterminateAnimation = "continuous",
1340
+ indeterminateAnimation = "md3",
1329
1341
  gapSize = 4,
1330
1342
  showStopIndicator = "auto",
1331
1343
  color,
@@ -1362,15 +1374,15 @@ var LinearProgress = React13__namespace.forwardRef(
1362
1374
  setIsRtl(dir === "rtl");
1363
1375
  }
1364
1376
  }, []);
1365
- const isWavy = shape === "wavy";
1366
1377
  const resolvedTrackShape = trackShape != null ? trackShape : shape;
1378
+ const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
1367
1379
  const effectiveAmplitude = React13__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
1368
1380
  const svgHeight = React13__namespace.useMemo(
1369
1381
  () => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
1370
1382
  [isWavy, trackHeight, effectiveAmplitude]
1371
1383
  );
1372
1384
  const shouldShowStop = React13__namespace.useMemo(
1373
- () => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
1385
+ () => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
1374
1386
  [isDeterminate, resolvedTrackShape, showStopIndicator]
1375
1387
  );
1376
1388
  const stopSize = React13__namespace.useMemo(
@@ -1380,6 +1392,8 @@ var LinearProgress = React13__namespace.forwardRef(
1380
1392
  const stopOffset = (trackHeight - stopSize) / 2;
1381
1393
  const activeColor = color || "var(--md-sys-color-indicator-active)";
1382
1394
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
1395
+ const useWavyTrack = isWavy || !isDeterminate;
1396
+ const trackAmp = isWavy ? effectiveAmplitude : 0;
1383
1397
  return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1384
1398
  "div",
1385
1399
  __spreadProps(__spreadValues({
@@ -1396,12 +1410,12 @@ var LinearProgress = React13__namespace.forwardRef(
1396
1410
  style: { height: svgHeight }
1397
1411
  }, restProps), {
1398
1412
  children: [
1399
- isWavy ? /* @__PURE__ */ jsxRuntime.jsx(
1413
+ useWavyTrack ? /* @__PURE__ */ jsxRuntime.jsx(
1400
1414
  WavyLinearTrack,
1401
1415
  {
1402
1416
  trackHeight,
1403
1417
  svgHeight,
1404
- amplitude: effectiveAmplitude,
1418
+ amplitude: trackAmp,
1405
1419
  wavelength,
1406
1420
  indeterminateWavelength,
1407
1421
  activeColor,