@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
package/dist/core.js CHANGED
@@ -640,7 +640,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
640
640
  function easeInOutCubic(x) {
641
641
  return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
642
642
  }
643
- function generateWavyCircularPath(center, radius, amplitude, wavelength) {
643
+ function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
644
644
  const circumference = 2 * Math.PI * radius;
645
645
  const numWaves = Math.max(
646
646
  3,
@@ -648,8 +648,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
648
648
  );
649
649
  const steps = numWaves * 4;
650
650
  const dt = 2 * Math.PI / steps;
651
- const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
652
- const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
651
+ const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
652
+ const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
653
653
  const xAt = (t) => center + rAt(t) * Math.cos(t);
654
654
  const yAt = (t) => center + rAt(t) * Math.sin(t);
655
655
  const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
@@ -714,15 +714,18 @@ var CircularProgress = React4__namespace.forwardRef(
714
714
  size = 48,
715
715
  trackHeight = 4,
716
716
  shape = "flat",
717
+ trackShape = "flat",
717
718
  amplitude,
718
719
  wavelength,
719
720
  gapSize = 4,
721
+ waveSpeed = 1,
720
722
  crawlerSpeed = 1,
721
723
  color,
722
724
  trackColor,
723
725
  showTrack = "auto",
724
726
  minProgress = DEFAULT_MIN_PROGRESS,
725
727
  maxProgress = DEFAULT_MAX_PROGRESS,
728
+ determinateAnimation = "md3",
726
729
  amplitudeRange,
727
730
  className,
728
731
  "aria-label": ariaLabel
@@ -731,15 +734,18 @@ var CircularProgress = React4__namespace.forwardRef(
731
734
  "size",
732
735
  "trackHeight",
733
736
  "shape",
737
+ "trackShape",
734
738
  "amplitude",
735
739
  "wavelength",
736
740
  "gapSize",
741
+ "waveSpeed",
737
742
  "crawlerSpeed",
738
743
  "color",
739
744
  "trackColor",
740
745
  "showTrack",
741
746
  "minProgress",
742
747
  "maxProgress",
748
+ "determinateAnimation",
743
749
  "amplitudeRange",
744
750
  "className",
745
751
  "aria-label"
@@ -752,6 +758,7 @@ var CircularProgress = React4__namespace.forwardRef(
752
758
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
753
759
  const isWavy = shape === "wavy";
754
760
  const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
761
+ const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
755
762
  const BASELINE_SIZE = 48;
756
763
  const scaleFactor = size / BASELINE_SIZE;
757
764
  const effectiveAmplitude = React4__namespace.useMemo(
@@ -784,19 +791,50 @@ var CircularProgress = React4__namespace.forwardRef(
784
791
  const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
785
792
  const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
786
793
  const ActiveCircleElem = react.m.circle;
787
- const ActivePathElem = react.m.path;
788
794
  const indeterminateSvgRef = React4__namespace.useRef(null);
789
795
  const indeterminateTrackRef = React4__namespace.useRef(null);
790
796
  const indeterminateActiveRef = React4__namespace.useRef(null);
791
797
  const indeterminateWavyTrackPathRef = React4__namespace.useRef(null);
792
798
  const indeterminateWavyActivePathRef = React4__namespace.useRef(null);
799
+ const determinateWavyActivePathRef = React4__namespace.useRef(null);
800
+ const determinateWavyTrackPathRef = React4__namespace.useRef(null);
793
801
  const cachedPathLengthRef = React4__namespace.useRef(0);
802
+ const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 0);
803
+ const amplitudeMV = react.useMotionValue(isWavy ? effectiveAmplitude : 0);
804
+ React4__namespace.useEffect(() => {
805
+ if (isDeterminate) {
806
+ react.animate(fractionMV, clampedValue / 100, {
807
+ duration: 0.4,
808
+ ease: [0.2, 0, 0, 1]
809
+ });
810
+ }
811
+ }, [clampedValue, isDeterminate, fractionMV]);
812
+ React4__namespace.useEffect(() => {
813
+ if (!isDeterminate || !isWavy) return;
814
+ const fraction = clampedValue / 100;
815
+ let targetAmp = effectiveAmplitude;
816
+ if (determinateAnimation === "md3") {
817
+ targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
818
+ }
819
+ react.animate(amplitudeMV, targetAmp, {
820
+ type: "spring",
821
+ bounce: 0,
822
+ duration: 0.5
823
+ });
824
+ }, [
825
+ clampedValue,
826
+ isDeterminate,
827
+ isWavy,
828
+ effectiveAmplitude,
829
+ amplitudeMV,
830
+ determinateAnimation
831
+ ]);
794
832
  React4__namespace.useLayoutEffect(() => {
795
833
  if (!isWavy || !wavyActivePath) {
796
834
  cachedPathLengthRef.current = circumference;
797
835
  return;
798
836
  }
799
- const el = indeterminateActiveRef.current;
837
+ const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
800
838
  if (el && "getTotalLength" in el) {
801
839
  try {
802
840
  const len = el.getTotalLength();
@@ -810,7 +848,65 @@ var CircularProgress = React4__namespace.forwardRef(
810
848
  cachedPathLengthRef.current = circumference;
811
849
  }, [isWavy, circumference, wavyActivePath]);
812
850
  react.useAnimationFrame((time) => {
813
- if (isDeterminate) return;
851
+ const safeWaveSpeed = Math.max(0.1, waveSpeed);
852
+ const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
853
+ if (isDeterminate) {
854
+ if (isWavy) {
855
+ const currentAmp = amplitudeMV.get();
856
+ const dynamicPath = generateWavyCircularPath(
857
+ center,
858
+ radius,
859
+ currentAmp,
860
+ effectiveWavelength,
861
+ wavePhase
862
+ );
863
+ if (determinateWavyActivePathRef.current) {
864
+ determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
865
+ }
866
+ if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
867
+ determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
868
+ }
869
+ const pathEl = determinateWavyActivePathRef.current;
870
+ let totalLen = cachedPathLengthRef.current || circumference;
871
+ if (pathEl) {
872
+ try {
873
+ const len = pathEl.getTotalLength();
874
+ if (len > 0) totalLen = len;
875
+ } catch (e) {
876
+ }
877
+ }
878
+ const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
879
+ const activeLen = totalLen * activeFrac;
880
+ if (determinateWavyActivePathRef.current) {
881
+ determinateWavyActivePathRef.current.setAttribute(
882
+ "stroke-dasharray",
883
+ `${activeLen} ${totalLen}`
884
+ );
885
+ determinateWavyActivePathRef.current.setAttribute(
886
+ "stroke-dashoffset",
887
+ "0"
888
+ );
889
+ }
890
+ if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
891
+ const gapFrac = (gapSize + trackHeight) / totalLen;
892
+ const trackStartFrac = activeFrac + gapFrac;
893
+ const trackLen = Math.max(
894
+ 1e-3,
895
+ totalLen * (1 - activeFrac - 2 * gapFrac)
896
+ );
897
+ const trackOff = -totalLen * trackStartFrac;
898
+ determinateWavyTrackPathRef.current.setAttribute(
899
+ "stroke-dasharray",
900
+ `${trackLen} ${totalLen}`
901
+ );
902
+ determinateWavyTrackPathRef.current.setAttribute(
903
+ "stroke-dashoffset",
904
+ `${trackOff}`
905
+ );
906
+ }
907
+ }
908
+ return;
909
+ }
814
910
  const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
815
911
  const scaledTime = time * safeCrawlerSpeed;
816
912
  const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
@@ -845,7 +941,8 @@ var CircularProgress = React4__namespace.forwardRef(
845
941
  center,
846
942
  radius,
847
943
  currentAmplitude,
848
- effectiveWavelength
944
+ effectiveWavelength,
945
+ wavePhase
849
946
  );
850
947
  if (indeterminateWavyActivePathRef.current) {
851
948
  indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
@@ -940,7 +1037,7 @@ var CircularProgress = React4__namespace.forwardRef(
940
1037
  style: { width: size, height: size }
941
1038
  }, restProps), {
942
1039
  children: /* @__PURE__ */ jsxRuntime.jsxs(react.LazyMotion, { features: react.domMax, strict: true, children: [
943
- /* @__PURE__ */ jsxRuntime.jsxs(
1040
+ /* @__PURE__ */ jsxRuntime.jsx(
944
1041
  "svg",
945
1042
  {
946
1043
  width: size,
@@ -948,8 +1045,18 @@ var CircularProgress = React4__namespace.forwardRef(
948
1045
  viewBox: `0 0 ${size} ${size}`,
949
1046
  "aria-hidden": "true",
950
1047
  style: { transform: "rotate(-90deg)", overflow: "visible" },
951
- children: [
952
- isDeterminate ? /* @__PURE__ */ jsxRuntime.jsx(
1048
+ children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1049
+ shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsxRuntime.jsx(
1050
+ "path",
1051
+ {
1052
+ ref: determinateWavyTrackPathRef,
1053
+ d: wavyActivePath != null ? wavyActivePath : "",
1054
+ fill: "none",
1055
+ stroke: bgTrackColor,
1056
+ strokeWidth: trackHeight,
1057
+ strokeLinecap: "round"
1058
+ }
1059
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
953
1060
  react.m.circle,
954
1061
  {
955
1062
  cx: center,
@@ -958,28 +1065,52 @@ var CircularProgress = React4__namespace.forwardRef(
958
1065
  fill: "none",
959
1066
  stroke: bgTrackColor,
960
1067
  strokeWidth: trackHeight,
961
- initial: { pathLength: trackLength, pathOffset: trackOffset },
962
- animate: { pathLength: trackLength, pathOffset: trackOffset },
1068
+ initial: {
1069
+ pathLength: trackLength,
1070
+ pathOffset: trackOffset
1071
+ },
1072
+ animate: {
1073
+ pathLength: trackLength,
1074
+ pathOffset: trackOffset
1075
+ },
963
1076
  transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
964
1077
  strokeLinecap: "round"
965
1078
  }
966
- ) : null,
967
- isDeterminate && (isWavy ? /* @__PURE__ */ jsxRuntime.jsx(
968
- ActivePathElem,
1079
+ )),
1080
+ /* @__PURE__ */ jsxRuntime.jsx(
1081
+ "path",
969
1082
  {
1083
+ ref: determinateWavyActivePathRef,
970
1084
  d: wavyActivePath != null ? wavyActivePath : "",
971
1085
  fill: "none",
972
1086
  stroke: activeColor,
973
1087
  strokeWidth: trackHeight,
974
- strokeLinecap: "round",
975
- initial: { pathLength: 0 },
976
- animate: { pathLength: clampedValue / 100 },
977
- transition: {
978
- duration: 0.4,
979
- ease: [0.2, 0, 0, 1]
980
- }
1088
+ strokeLinecap: "round"
981
1089
  }
982
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1090
+ )
1091
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1092
+ /* @__PURE__ */ jsxRuntime.jsx(
1093
+ react.m.circle,
1094
+ {
1095
+ cx: center,
1096
+ cy: center,
1097
+ r: radius,
1098
+ fill: "none",
1099
+ stroke: bgTrackColor,
1100
+ strokeWidth: trackHeight,
1101
+ initial: {
1102
+ pathLength: trackLength,
1103
+ pathOffset: trackOffset
1104
+ },
1105
+ animate: {
1106
+ pathLength: trackLength,
1107
+ pathOffset: trackOffset
1108
+ },
1109
+ transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
1110
+ strokeLinecap: "round"
1111
+ }
1112
+ ),
1113
+ /* @__PURE__ */ jsxRuntime.jsx(
983
1114
  ActiveCircleElem,
984
1115
  {
985
1116
  cx: center,
@@ -996,8 +1127,8 @@ var CircularProgress = React4__namespace.forwardRef(
996
1127
  ease: [0.2, 0, 0, 1]
997
1128
  }
998
1129
  }
999
- ))
1000
- ]
1130
+ )
1131
+ ] }) : null
1001
1132
  }
1002
1133
  ),
1003
1134
  !isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(