@bug-on/m3-expressive 1.2.6 → 1.2.7

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/core.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import * as React11 from 'react';
2
+ import * as React4 from 'react';
3
3
  import { createContext, useState, useEffect, useRef, useCallback, useMemo, useContext } from 'react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { hexFromArgb, Hct, SchemeExpressive, SchemeNeutral, SchemeMonochrome, SchemeContent, SchemeFidelity, SchemeVibrant, SchemeTonalSpot } from '@material/material-color-utilities';
6
6
  import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
8
- import { LazyMotion, domMax, m, useMotionValue, animate, useAnimationFrame, AnimatePresence, useReducedMotion } from 'motion/react';
8
+ import { LazyMotion, domMax, m, useAnimationFrame, useMotionValue, animate, AnimatePresence, useReducedMotion } from 'motion/react';
9
9
  import { Slot } from '@radix-ui/react-slot';
10
10
 
11
11
  var __defProp = Object.defineProperty;
@@ -297,7 +297,7 @@ var VARIANT_FONT = {
297
297
  rounded: "'Material Symbols Rounded'",
298
298
  sharp: "'Material Symbols Sharp'"
299
299
  };
300
- var IconComponent = React11.forwardRef(
300
+ var IconComponent = React4.forwardRef(
301
301
  (_a, ref) => {
302
302
  var _b = _a, {
303
303
  name,
@@ -363,8 +363,8 @@ var IconComponent = React11.forwardRef(
363
363
  }
364
364
  );
365
365
  IconComponent.displayName = "Icon";
366
- var Icon = React11.memo(IconComponent);
367
- var RippleItem = React11.memo(function RippleItem2({
366
+ var Icon = React4.memo(IconComponent);
367
+ var RippleItem = React4.memo(function RippleItem2({
368
368
  ripple,
369
369
  onDone
370
370
  }) {
@@ -408,8 +408,8 @@ function Ripple({
408
408
  }
409
409
  function useRippleState(options = {}) {
410
410
  const { disabled = false } = options;
411
- const [ripples, setRipples] = React11.useState([]);
412
- const onPointerDown = React11.useCallback(
411
+ const [ripples, setRipples] = React4.useState([]);
412
+ const onPointerDown = React4.useCallback(
413
413
  (e) => {
414
414
  if (disabled) return;
415
415
  const rect = e.currentTarget.getBoundingClientRect();
@@ -426,7 +426,7 @@ function useRippleState(options = {}) {
426
426
  },
427
427
  [disabled]
428
428
  );
429
- const removeRipple = React11.useCallback((id) => {
429
+ const removeRipple = React4.useCallback((id) => {
430
430
  setRipples((prev) => prev.filter((r) => r.id !== id));
431
431
  }, []);
432
432
  return { ripples, onPointerDown, removeRipple };
@@ -477,11 +477,11 @@ var ROTATE_KEY_SPLINES = [
477
477
  var ROTATE_VALUES = "0 24 24; 154 24 24; 309 24 24; 463 24 24; 617 24 24; 771 24 24; 926 24 24; 1080 24 24";
478
478
  var DETERMINATE_CIRCLE = "M24 7 C34.49 7 41 13.51 41 24 C41 34.49 34.49 41 24 41 C13.51 41 7 34.49 7 24 C7 13.51 13.51 7 24 7 Z";
479
479
  var DETERMINATE_SOFT_BURST = "M20.9 10.4 21.4 9.5 21.9 8.7 22.5 7.8 23.2 7.2 24.2 7 25.1 7.4 25.7 8.1 26.2 9 26.8 9.8 27.3 10.6 28.1 11.2 29 11.3 30 11 30.9 10.6 31.8 10.3 32.8 9.9 33.7 10 34.5 10.6 34.9 11.5 34.8 12.5 34.8 13.5 34.7 14.5 34.7 15.5 35.2 16.3 36 16.8 37 17.1 37.9 17.3 38.9 17.5 39.8 17.9 40.4 18.7 40.5 19.7 40 20.5 39.4 21.3 38.7 22 38.1 22.8 37.6 23.7 37.7 24.6 38.3 25.5 38.9 26.2 39.6 27 40.2 27.7 40.5 28.7 40.3 29.6 39.5 30.3 38.6 30.6 37.6 30.8 36.7 31 35.7 31.3 35 31.9 34.6 32.8 34.7 33.8 34.8 34.8 34.9 35.8 34.8 36.8 34.3 37.6 33.4 38.1 32.4 38 31.5 37.6 30.6 37.2 29.7 36.9 28.7 36.6 27.8 36.9 27.1 37.6 26.6 38.5 26.1 39.3 25.5 40.2 24.8 40.8 23.8 41 22.9 40.6 22.3 39.9 21.8 39 21.2 38.2 20.7 37.4 19.9 36.8 19 36.7 18 37 17.1 37.4 16.2 37.7 15.2 38.1 14.3 38 13.5 37.4 13.1 36.5 13.2 35.5 13.2 34.5 13.3 33.5 13.3 32.5 12.8 31.7 12 31.2 11 31 10.1 30.7 9.1 30.5 8.2 30.1 7.6 29.3 7.5 28.3 8 27.5 8.7 26.7 9.3 26 9.9 25.2 10.4 24.3 10.3 23.4 9.7 22.5 9.1 21.8 8.4 21 7.8 20.3 7.5 19.3 7.7 18.4 8.5 17.7 9.4 17.4 10.4 17.2 11.3 17 12.3 16.7 13 16.1 13.4 15.2 13.3 14.2 13.2 13.2 13.1 12.2 13.2 11.2 13.7 10.4 14.6 9.9 15.6 10 16.5 10.4 17.4 10.8 18.3 11.1 19.3 11.4 20.2 11.1Z";
480
- var IndeterminateSvg = React11.memo(function IndeterminateSvg2({
480
+ var IndeterminateSvg = React4.memo(function IndeterminateSvg2({
481
481
  size
482
482
  }) {
483
- const [ready, setReady] = React11.useState(false);
484
- React11.useEffect(() => {
483
+ const [ready, setReady] = React4.useState(false);
484
+ React4.useEffect(() => {
485
485
  const raf = requestAnimationFrame(() => setReady(true));
486
486
  return () => cancelAnimationFrame(raf);
487
487
  }, []);
@@ -526,7 +526,7 @@ var IndeterminateSvg = React11.memo(function IndeterminateSvg2({
526
526
  }
527
527
  );
528
528
  });
529
- var DeterminateSvg = React11.memo(function DeterminateSvg2({
529
+ var DeterminateSvg = React4.memo(function DeterminateSvg2({
530
530
  size,
531
531
  progress
532
532
  }) {
@@ -551,7 +551,7 @@ var DeterminateSvg = React11.memo(function DeterminateSvg2({
551
551
  }
552
552
  );
553
553
  });
554
- var LoadingIndicator = React11.forwardRef(
554
+ var LoadingIndicator = React4.forwardRef(
555
555
  (_a, ref) => {
556
556
  var _b = _a, {
557
557
  variant = "uncontained",
@@ -646,7 +646,7 @@ 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
- return d;
649
+ return `${d} Z`;
650
650
  }
651
651
  function getSinePath(startX, endX, phase, wl, amp) {
652
652
  if (startX >= endX) return "";
@@ -678,7 +678,15 @@ function getSinePath(startX, endX, phase, wl, amp) {
678
678
  }
679
679
  return d;
680
680
  }
681
- var CircularProgress = React11.forwardRef(
681
+ var GLOBAL_ROTATION_DURATION = 6e3;
682
+ var GLOBAL_ROTATION_TARGET = 1080;
683
+ var ADDITIONAL_ROTATION_CYCLE = 1500;
684
+ var ADDITIONAL_ROTATION_STEP = 90;
685
+ var ADDITIONAL_ROTATION_EASE_DURATION = 500;
686
+ var DEFAULT_MIN_PROGRESS = 0.1;
687
+ var DEFAULT_MAX_PROGRESS = 0.8;
688
+ var PROGRESS_CYCLE_DURATION = 1500;
689
+ var CircularProgress = React4.forwardRef(
682
690
  (_a, ref) => {
683
691
  var _b = _a, {
684
692
  value,
@@ -691,6 +699,10 @@ var CircularProgress = React11.forwardRef(
691
699
  crawlerSpeed = 1,
692
700
  color,
693
701
  trackColor,
702
+ showTrack = "auto",
703
+ minProgress = DEFAULT_MIN_PROGRESS,
704
+ maxProgress = DEFAULT_MAX_PROGRESS,
705
+ amplitudeRange,
694
706
  className,
695
707
  "aria-label": ariaLabel
696
708
  } = _b, restProps = __objRest(_b, [
@@ -704,6 +716,10 @@ var CircularProgress = React11.forwardRef(
704
716
  "crawlerSpeed",
705
717
  "color",
706
718
  "trackColor",
719
+ "showTrack",
720
+ "minProgress",
721
+ "maxProgress",
722
+ "amplitudeRange",
707
723
  "className",
708
724
  "aria-label"
709
725
  ]);
@@ -714,17 +730,22 @@ var CircularProgress = React11.forwardRef(
714
730
  const activeColor = color || "var(--md-sys-color-indicator-active)";
715
731
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
716
732
  const isWavy = shape === "wavy";
733
+ const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
717
734
  const BASELINE_SIZE = 48;
718
735
  const scaleFactor = size / BASELINE_SIZE;
719
- const effectiveAmplitude = React11.useMemo(
736
+ const effectiveAmplitude = React4.useMemo(
720
737
  () => amplitude != null ? amplitude : 1.6 * scaleFactor,
721
738
  [amplitude, scaleFactor]
722
739
  );
723
- const effectiveWavelength = React11.useMemo(
740
+ const effectiveWavelength = React4.useMemo(
724
741
  () => wavelength != null ? wavelength : 15 * scaleFactor,
725
742
  [wavelength, scaleFactor]
726
743
  );
727
- const wavyActivePath = React11.useMemo(
744
+ const resolvedAmplitudeRange = React4.useMemo(
745
+ () => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
746
+ [amplitudeRange, effectiveAmplitude]
747
+ );
748
+ const wavyActivePath = React4.useMemo(
728
749
  () => isWavy ? generateWavyCircularPath(
729
750
  center,
730
751
  radius,
@@ -733,8 +754,8 @@ var CircularProgress = React11.forwardRef(
733
754
  ) : null,
734
755
  [isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
735
756
  );
736
- const circumference = React11.useMemo(() => 2 * Math.PI * radius, [radius]);
737
- const gapForTrack = React11.useMemo(
757
+ const circumference = React4.useMemo(() => 2 * Math.PI * radius, [radius]);
758
+ const gapForTrack = React4.useMemo(
738
759
  () => (gapSize + trackHeight) / circumference,
739
760
  [gapSize, trackHeight, circumference]
740
761
  );
@@ -743,6 +764,145 @@ var CircularProgress = React11.forwardRef(
743
764
  const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
744
765
  const ActiveCircleElem = m.circle;
745
766
  const ActivePathElem = m.path;
767
+ const indeterminateSvgRef = React4.useRef(null);
768
+ const indeterminateTrackRef = React4.useRef(null);
769
+ const indeterminateActiveRef = React4.useRef(null);
770
+ const indeterminateWavyTrackPathRef = React4.useRef(null);
771
+ const indeterminateWavyActivePathRef = React4.useRef(null);
772
+ const cachedPathLengthRef = React4.useRef(0);
773
+ React4.useLayoutEffect(() => {
774
+ if (!isWavy || !wavyActivePath) {
775
+ cachedPathLengthRef.current = circumference;
776
+ return;
777
+ }
778
+ const el = indeterminateActiveRef.current;
779
+ if (el && "getTotalLength" in el) {
780
+ try {
781
+ const len = el.getTotalLength();
782
+ if (len > 0) {
783
+ cachedPathLengthRef.current = len;
784
+ return;
785
+ }
786
+ } catch (e) {
787
+ }
788
+ }
789
+ cachedPathLengthRef.current = circumference;
790
+ }, [isWavy, circumference, wavyActivePath]);
791
+ useAnimationFrame((time) => {
792
+ if (isDeterminate) return;
793
+ const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
794
+ const scaledTime = time * safeCrawlerSpeed;
795
+ const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
796
+ const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
797
+ const additionalFullCycles = Math.floor(
798
+ scaledTime / ADDITIONAL_ROTATION_CYCLE
799
+ );
800
+ const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
801
+ const additionalEaseT = Math.min(
802
+ 1,
803
+ additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
804
+ );
805
+ const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
806
+ const totalRotation = globalAngle + additionalAngle;
807
+ if (indeterminateSvgRef.current) {
808
+ indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
809
+ }
810
+ const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
811
+ const progressCycleTime = scaledTime % progressFullCycle;
812
+ let progress;
813
+ if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
814
+ const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
815
+ progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
816
+ } else {
817
+ const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
818
+ progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
819
+ }
820
+ if (isWavy) {
821
+ const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
822
+ const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
823
+ const dynamicPath = generateWavyCircularPath(
824
+ center,
825
+ radius,
826
+ currentAmplitude,
827
+ effectiveWavelength
828
+ );
829
+ if (indeterminateWavyActivePathRef.current) {
830
+ indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
831
+ }
832
+ if (indeterminateWavyTrackPathRef.current) {
833
+ indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
834
+ }
835
+ const pathEl = indeterminateWavyActivePathRef.current;
836
+ let totalLen = cachedPathLengthRef.current || circumference;
837
+ if (pathEl) {
838
+ try {
839
+ const len = pathEl.getTotalLength();
840
+ if (len > 0) totalLen = len;
841
+ } catch (e) {
842
+ }
843
+ }
844
+ const gapFrac = (gapSize + trackHeight) / totalLen;
845
+ const activeLen = totalLen * progress;
846
+ const activeOff = 0;
847
+ if (indeterminateWavyActivePathRef.current) {
848
+ indeterminateWavyActivePathRef.current.setAttribute(
849
+ "stroke-dasharray",
850
+ `${activeLen} ${totalLen}`
851
+ );
852
+ indeterminateWavyActivePathRef.current.setAttribute(
853
+ "stroke-dashoffset",
854
+ `${activeOff}`
855
+ );
856
+ }
857
+ if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
858
+ const trackStartFrac = progress + gapFrac;
859
+ const trackLen = Math.max(
860
+ 1e-3,
861
+ totalLen * (1 - progress - 2 * gapFrac)
862
+ );
863
+ const trackOff = -totalLen * trackStartFrac;
864
+ indeterminateWavyTrackPathRef.current.setAttribute(
865
+ "stroke-dasharray",
866
+ `${trackLen} ${totalLen}`
867
+ );
868
+ indeterminateWavyTrackPathRef.current.setAttribute(
869
+ "stroke-dashoffset",
870
+ `${trackOff}`
871
+ );
872
+ }
873
+ } else {
874
+ const totalLen = circumference;
875
+ const activeLen = totalLen * progress;
876
+ const activeOff = 0;
877
+ if (indeterminateActiveRef.current) {
878
+ indeterminateActiveRef.current.setAttribute(
879
+ "stroke-dasharray",
880
+ `${activeLen} ${totalLen}`
881
+ );
882
+ indeterminateActiveRef.current.setAttribute(
883
+ "stroke-dashoffset",
884
+ `${activeOff}`
885
+ );
886
+ }
887
+ if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
888
+ const gapFrac = (gapSize + trackHeight) / totalLen;
889
+ const trackStartFrac = progress + gapFrac;
890
+ const trackLen = Math.max(
891
+ 1e-3,
892
+ totalLen * (1 - progress - 2 * gapFrac)
893
+ );
894
+ const trackOff = -totalLen * trackStartFrac;
895
+ indeterminateTrackRef.current.setAttribute(
896
+ "stroke-dasharray",
897
+ `${trackLen} ${totalLen}`
898
+ );
899
+ indeterminateTrackRef.current.setAttribute(
900
+ "stroke-dashoffset",
901
+ `${trackOff}`
902
+ );
903
+ }
904
+ }
905
+ });
746
906
  return /* @__PURE__ */ jsx(
747
907
  "div",
748
908
  __spreadProps(__spreadValues({
@@ -819,9 +979,10 @@ var CircularProgress = React11.forwardRef(
819
979
  ]
820
980
  }
821
981
  ),
822
- !isDeterminate && /* @__PURE__ */ jsxs(
823
- m.svg,
982
+ !isDeterminate && /* @__PURE__ */ jsx(
983
+ "svg",
824
984
  {
985
+ ref: indeterminateSvgRef,
825
986
  width: size,
826
987
  height: size,
827
988
  viewBox: `0 0 ${size} ${size}`,
@@ -830,84 +991,60 @@ var CircularProgress = React11.forwardRef(
830
991
  position: "absolute",
831
992
  inset: 0,
832
993
  overflow: "visible",
833
- transformOrigin: "center"
834
- },
835
- animate: { rotate: [0, 360] },
836
- transition: {
837
- duration: 2 / Math.max(0.1, crawlerSpeed),
838
- repeat: Number.POSITIVE_INFINITY,
839
- ease: "linear"
994
+ transformOrigin: "center",
995
+ transform: "rotate(-90deg)"
840
996
  },
841
- children: [
842
- /* @__PURE__ */ jsx(
843
- m.circle,
997
+ children: isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
998
+ shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
999
+ "path",
844
1000
  {
845
- cx: center,
846
- cy: center,
847
- r: radius,
1001
+ ref: indeterminateWavyTrackPathRef,
1002
+ d: wavyActivePath != null ? wavyActivePath : "",
848
1003
  fill: "none",
849
1004
  stroke: bgTrackColor,
850
1005
  strokeWidth: trackHeight,
851
- strokeLinecap: "round",
852
- animate: {
853
- pathLength: [
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)
857
- ],
858
- pathOffset: [
859
- 0.1 + gapForTrack,
860
- 0.75 + gapForTrack,
861
- 0.1 + gapForTrack
862
- ]
863
- },
864
- transition: {
865
- duration: 2 / Math.max(0.1, crawlerSpeed),
866
- repeat: Number.POSITIVE_INFINITY,
867
- ease: [0.4, 0, 0.2, 1]
868
- }
1006
+ strokeLinecap: "round"
869
1007
  }
870
1008
  ),
871
- isWavy ? /* @__PURE__ */ jsx(
872
- ActivePathElem,
1009
+ /* @__PURE__ */ jsx(
1010
+ "path",
873
1011
  {
1012
+ ref: indeterminateWavyActivePathRef,
874
1013
  d: wavyActivePath != null ? wavyActivePath : "",
875
1014
  fill: "none",
876
1015
  stroke: activeColor,
877
1016
  strokeWidth: trackHeight,
878
- strokeLinecap: "round",
879
- animate: {
880
- pathLength: [0.1, 0.75, 0.1],
881
- pathOffset: [0, 0.65, 1]
882
- },
883
- transition: {
884
- duration: 2 / Math.max(0.1, crawlerSpeed),
885
- repeat: Number.POSITIVE_INFINITY,
886
- ease: [0.4, 0, 0.2, 1]
887
- }
1017
+ strokeLinecap: "round"
888
1018
  }
889
- ) : /* @__PURE__ */ jsx(
890
- ActiveCircleElem,
1019
+ )
1020
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1021
+ shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
1022
+ "circle",
891
1023
  {
1024
+ ref: indeterminateTrackRef,
1025
+ cx: center,
1026
+ cy: center,
1027
+ r: radius,
1028
+ fill: "none",
1029
+ stroke: bgTrackColor,
1030
+ strokeWidth: trackHeight,
1031
+ strokeLinecap: "round"
1032
+ }
1033
+ ),
1034
+ /* @__PURE__ */ jsx(
1035
+ "circle",
1036
+ {
1037
+ ref: indeterminateActiveRef,
892
1038
  cx: center,
893
1039
  cy: center,
894
1040
  r: radius,
895
1041
  fill: "none",
896
1042
  stroke: activeColor,
897
1043
  strokeWidth: trackHeight,
898
- strokeLinecap: "round",
899
- animate: {
900
- pathLength: [0.1, 0.75, 0.1],
901
- pathOffset: [0, 0.65, 1]
902
- },
903
- transition: {
904
- duration: 2 / Math.max(0.1, crawlerSpeed),
905
- repeat: Number.POSITIVE_INFINITY,
906
- ease: [0.4, 0, 0.2, 1]
907
- }
1044
+ strokeLinecap: "round"
908
1045
  }
909
1046
  )
910
- ]
1047
+ ] })
911
1048
  }
912
1049
  )
913
1050
  ] })
@@ -917,9 +1054,9 @@ var CircularProgress = React11.forwardRef(
917
1054
  );
918
1055
  CircularProgress.displayName = "CircularProgress";
919
1056
  function useContainerWidth() {
920
- const [width, setWidth] = React11.useState(0);
921
- const observerRef = React11.useRef(null);
922
- const ref = React11.useCallback((node) => {
1057
+ const [width, setWidth] = React4.useState(0);
1058
+ const observerRef = React4.useRef(null);
1059
+ const ref = React4.useCallback((node) => {
923
1060
  if (observerRef.current) {
924
1061
  observerRef.current.disconnect();
925
1062
  observerRef.current = null;
@@ -933,7 +1070,7 @@ function useContainerWidth() {
933
1070
  observerRef.current = obs;
934
1071
  }
935
1072
  }, []);
936
- React11.useEffect(() => {
1073
+ React4.useEffect(() => {
937
1074
  return () => {
938
1075
  if (observerRef.current) {
939
1076
  observerRef.current.disconnect();
@@ -943,7 +1080,7 @@ function useContainerWidth() {
943
1080
  return [ref, width];
944
1081
  }
945
1082
  function useMergedRef(...refs) {
946
- return React11.useCallback(
1083
+ return React4.useCallback(
947
1084
  (node) => {
948
1085
  for (const ref of refs) {
949
1086
  if (typeof ref === "function") {
@@ -957,7 +1094,7 @@ function useMergedRef(...refs) {
957
1094
  [refs]
958
1095
  );
959
1096
  }
960
- var FlatLinearTrack = React11.memo(function FlatLinearTrack2({
1097
+ var FlatLinearTrack = React4.memo(function FlatLinearTrack2({
961
1098
  trackHeight,
962
1099
  activeColor,
963
1100
  trackColor,
@@ -1033,7 +1170,7 @@ var FlatLinearTrack = React11.memo(function FlatLinearTrack2({
1033
1170
  }
1034
1171
  );
1035
1172
  });
1036
- var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1173
+ var WavyLinearTrack = React4.memo(function WavyLinearTrack2({
1037
1174
  trackHeight,
1038
1175
  svgHeight,
1039
1176
  amplitude,
@@ -1052,13 +1189,13 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1052
1189
  }) {
1053
1190
  const isDeterminate = typeof value === "number";
1054
1191
  const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
1055
- const titleId = React11.useId();
1192
+ const titleId = React4.useId();
1056
1193
  const [containerRef, width] = useContainerWidth();
1057
- const activePathRef = React11.useRef(null);
1058
- const trackPathRef = React11.useRef(null);
1194
+ const activePathRef = React4.useRef(null);
1195
+ const trackPathRef = React4.useRef(null);
1059
1196
  const amplitudeMV = useMotionValue(amplitude);
1060
1197
  const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
1061
- React11.useEffect(() => {
1198
+ React4.useEffect(() => {
1062
1199
  if (isDeterminate) {
1063
1200
  const fraction = clampedValue / 100;
1064
1201
  let targetAmp = amplitude;
@@ -1113,7 +1250,7 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1113
1250
  currentAmp
1114
1251
  );
1115
1252
  } else if (fraction === 0) {
1116
- activePathD = `M ${capWidth} 0 L ${capWidth + 0.01} 0`;
1253
+ activePathD = "";
1117
1254
  }
1118
1255
  const trackStart = adjHead + totalGap;
1119
1256
  if (trackStart < width - capWidth) {
@@ -1145,20 +1282,20 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1145
1282
  activeLines.push({ tail: l1T, head: l1H });
1146
1283
  activeLines.push({ tail: l2T, head: l2H });
1147
1284
  }
1148
- const segments = activeLines.map((line) => {
1149
- const barTail = line.tail * width;
1150
- const barHead = line.head * width;
1285
+ const activeSegments = activeLines.map((line) => {
1286
+ const rawTail = line.tail * width;
1287
+ const rawHead = line.head * width;
1151
1288
  const adjTail = Math.max(
1152
1289
  capWidth,
1153
- Math.min(width - capWidth, barTail)
1290
+ Math.min(width - capWidth, rawTail)
1154
1291
  );
1155
1292
  const adjHead = Math.max(
1156
1293
  capWidth,
1157
- Math.min(width - capWidth, barHead)
1294
+ Math.min(width - capWidth, rawHead)
1158
1295
  );
1159
1296
  return { adjTail, adjHead };
1160
1297
  }).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
1161
- activePathD = segments.map(
1298
+ activePathD = activeSegments.map(
1162
1299
  (seg) => getSinePath(
1163
1300
  seg.adjTail,
1164
1301
  seg.adjHead,
@@ -1167,13 +1304,24 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1167
1304
  currentAmp
1168
1305
  )
1169
1306
  ).join(" ");
1307
+ const validActiveLines = activeLines.filter(
1308
+ (line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
1309
+ ).sort((a, b) => a.tail - b.tail);
1170
1310
  let currentTrackX = capWidth;
1171
- for (const seg of segments) {
1172
- const trackEnd = seg.adjTail - totalGap;
1311
+ for (const line of validActiveLines) {
1312
+ const blockStart = line.tail * width - totalGap;
1313
+ const blockEnd = line.head * width + totalGap;
1314
+ const trackEnd = Math.min(width - capWidth, blockStart);
1173
1315
  if (trackEnd > currentTrackX) {
1174
- trackD += `${getSinePath(currentTrackX, trackEnd, phase, activeWavelength, trackAmp)} `;
1316
+ trackD += `${getSinePath(
1317
+ currentTrackX,
1318
+ trackEnd,
1319
+ phase,
1320
+ activeWavelength,
1321
+ trackAmp
1322
+ )} `;
1175
1323
  }
1176
- currentTrackX = Math.max(currentTrackX, seg.adjHead + totalGap);
1324
+ currentTrackX = Math.max(currentTrackX, blockEnd);
1177
1325
  }
1178
1326
  if (currentTrackX < width - capWidth) {
1179
1327
  trackD += getSinePath(
@@ -1186,9 +1334,9 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1186
1334
  }
1187
1335
  }
1188
1336
  if (activePathRef.current)
1189
- activePathRef.current.setAttribute("d", activePathD);
1337
+ activePathRef.current.setAttribute("d", activePathD || "");
1190
1338
  if (trackPathRef.current)
1191
- trackPathRef.current.setAttribute("d", trackD.trim());
1339
+ trackPathRef.current.setAttribute("d", trackD.trim() || "");
1192
1340
  });
1193
1341
  return /* @__PURE__ */ jsx(
1194
1342
  "div",
@@ -1235,7 +1383,7 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
1235
1383
  }
1236
1384
  );
1237
1385
  });
1238
- var LinearProgress = React11.forwardRef(
1386
+ var LinearProgress = React4.forwardRef(
1239
1387
  (_a, ref) => {
1240
1388
  var _b = _a, {
1241
1389
  value,
@@ -1276,10 +1424,10 @@ var LinearProgress = React11.forwardRef(
1276
1424
  ]);
1277
1425
  const isDeterminate = value !== void 0;
1278
1426
  const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
1279
- const containerRef = React11.useRef(null);
1427
+ const containerRef = React4.useRef(null);
1280
1428
  const mergedRef = useMergedRef(ref, containerRef);
1281
- const [isRtl, setIsRtl] = React11.useState(false);
1282
- React11.useEffect(() => {
1429
+ const [isRtl, setIsRtl] = React4.useState(false);
1430
+ React4.useEffect(() => {
1283
1431
  if (containerRef.current) {
1284
1432
  const dir = getComputedStyle(containerRef.current).direction;
1285
1433
  setIsRtl(dir === "rtl");
@@ -1287,16 +1435,16 @@ var LinearProgress = React11.forwardRef(
1287
1435
  }, []);
1288
1436
  const resolvedTrackShape = trackShape != null ? trackShape : shape;
1289
1437
  const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
1290
- const effectiveAmplitude = React11.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
1291
- const svgHeight = React11.useMemo(
1438
+ const effectiveAmplitude = React4.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
1439
+ const svgHeight = React4.useMemo(
1292
1440
  () => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
1293
1441
  [isWavy, trackHeight, effectiveAmplitude]
1294
1442
  );
1295
- const shouldShowStop = React11.useMemo(
1443
+ const shouldShowStop = React4.useMemo(
1296
1444
  () => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
1297
1445
  [isDeterminate, resolvedTrackShape, showStopIndicator]
1298
1446
  );
1299
- const stopSize = React11.useMemo(
1447
+ const stopSize = React4.useMemo(
1300
1448
  () => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
1301
1449
  [trackHeight]
1302
1450
  );
@@ -1371,7 +1519,7 @@ var LinearProgress = React11.forwardRef(
1371
1519
  }
1372
1520
  );
1373
1521
  LinearProgress.displayName = "LinearProgress";
1374
- var ProgressIndicator = React11.forwardRef((props, ref) => {
1522
+ var ProgressIndicator = React4.forwardRef((props, ref) => {
1375
1523
  if (props.variant === "circular") {
1376
1524
  return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
1377
1525
  }
@@ -1512,7 +1660,7 @@ function resolveDisabledBgClass(colorStyle) {
1512
1660
  }
1513
1661
  return "disabled:text-m3-on-surface/[0.38]";
1514
1662
  }
1515
- var IconButtonComponent = React11.forwardRef(
1663
+ var IconButtonComponent = React4.forwardRef(
1516
1664
  (_a, ref) => {
1517
1665
  var _b = _a, {
1518
1666
  className,
@@ -1554,18 +1702,18 @@ var IconButtonComponent = React11.forwardRef(
1554
1702
  var _a2, _b2, _c, _d, _e;
1555
1703
  const isToggle = variant === "toggle";
1556
1704
  const isSelected = isToggle && !!selected;
1557
- const resolvedColorClass = React11.useMemo(
1705
+ const resolvedColorClass = React4.useMemo(
1558
1706
  () => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
1559
1707
  [isSelected, colorStyle]
1560
1708
  );
1561
- const outlineWidthClass = React11.useMemo(
1709
+ const outlineWidthClass = React4.useMemo(
1562
1710
  () => {
1563
1711
  var _a3;
1564
1712
  return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
1565
1713
  },
1566
1714
  [colorStyle, isSelected, size]
1567
1715
  );
1568
- const disabledBgClass = React11.useMemo(
1716
+ const disabledBgClass = React4.useMemo(
1569
1717
  () => resolveDisabledBgClass(colorStyle),
1570
1718
  [colorStyle]
1571
1719
  );
@@ -1588,7 +1736,7 @@ var IconButtonComponent = React11.forwardRef(
1588
1736
  const { ripples, onPointerDown, removeRipple } = useRippleState({
1589
1737
  disabled: loading
1590
1738
  });
1591
- const handleClick = React11.useCallback(
1739
+ const handleClick = React4.useCallback(
1592
1740
  (e) => {
1593
1741
  if (loading) {
1594
1742
  e.preventDefault();
@@ -1598,7 +1746,7 @@ var IconButtonComponent = React11.forwardRef(
1598
1746
  },
1599
1747
  [loading, onClick]
1600
1748
  );
1601
- const handleKeyDown = React11.useCallback(
1749
+ const handleKeyDown = React4.useCallback(
1602
1750
  (e) => {
1603
1751
  if (loading) return;
1604
1752
  if ((e.key === "Enter" || e.key === " ") && onClick) {
@@ -1654,7 +1802,7 @@ var IconButtonComponent = React11.forwardRef(
1654
1802
  width: isCustomSize ? `${iconSize}px` : void 0,
1655
1803
  height: isCustomSize ? `${iconSize}px` : void 0
1656
1804
  },
1657
- children: isSelected && selectedIcon ? selectedIcon : asChild ? React11.Children.only(children).props.children : children
1805
+ children: isSelected && selectedIcon ? selectedIcon : asChild ? React4.Children.only(children).props.children : children
1658
1806
  }),
1659
1807
  isSelected && selectedIcon ? "selected-content" : "content"
1660
1808
  ) })
@@ -1671,7 +1819,7 @@ var IconButtonComponent = React11.forwardRef(
1671
1819
  className
1672
1820
  );
1673
1821
  if (asChild) {
1674
- const child = React11.Children.only(children);
1822
+ const child = React4.Children.only(children);
1675
1823
  return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
1676
1824
  Slot,
1677
1825
  __spreadProps(__spreadValues({
@@ -1688,7 +1836,7 @@ var IconButtonComponent = React11.forwardRef(
1688
1836
  }),
1689
1837
  className: containerClassName
1690
1838
  }, restProps), {
1691
- children: React11.cloneElement(child, { children: innerContent })
1839
+ children: React4.cloneElement(child, { children: innerContent })
1692
1840
  })
1693
1841
  ) });
1694
1842
  }
@@ -1716,7 +1864,7 @@ var IconButtonComponent = React11.forwardRef(
1716
1864
  }
1717
1865
  );
1718
1866
  IconButtonComponent.displayName = "IconButton";
1719
- var IconButton = React11.memo(IconButtonComponent);
1867
+ var IconButton = React4.memo(IconButtonComponent);
1720
1868
  var DURATION_MAP = {
1721
1869
  short: 4e3,
1722
1870
  long: 7e3
@@ -1758,9 +1906,9 @@ function toSnackbarData(item) {
1758
1906
  return { id: generateId(), visuals: item.visuals, resolve: item.resolve };
1759
1907
  }
1760
1908
  function useSnackbarState() {
1761
- const [current, setCurrent] = React11.useState(null);
1762
- const queueRef = React11.useRef([]);
1763
- const showSnackbar = React11.useCallback(
1909
+ const [current, setCurrent] = React4.useState(null);
1910
+ const queueRef = React4.useRef([]);
1911
+ const showSnackbar = React4.useCallback(
1764
1912
  (visuals) => {
1765
1913
  return new Promise((resolve) => {
1766
1914
  const item = { visuals, resolve };
@@ -1773,14 +1921,14 @@ function useSnackbarState() {
1773
1921
  },
1774
1922
  []
1775
1923
  );
1776
- const _dismiss = React11.useCallback((result) => {
1924
+ const _dismiss = React4.useCallback((result) => {
1777
1925
  setCurrent((prev) => {
1778
1926
  if (prev) prev.resolve(result);
1779
1927
  const next = queueRef.current.shift();
1780
1928
  return next ? toSnackbarData(next) : null;
1781
1929
  });
1782
1930
  }, []);
1783
- React11.useEffect(() => {
1931
+ React4.useEffect(() => {
1784
1932
  return () => {
1785
1933
  for (const item of queueRef.current) {
1786
1934
  item.resolve(RESULT.DISMISSED);
@@ -1790,7 +1938,7 @@ function useSnackbarState() {
1790
1938
  }, []);
1791
1939
  return { current, showSnackbar, _dismiss };
1792
1940
  }
1793
- var Snackbar = React11.memo(function Snackbar2({
1941
+ var Snackbar = React4.memo(function Snackbar2({
1794
1942
  data,
1795
1943
  className
1796
1944
  }) {
@@ -1804,15 +1952,15 @@ var Snackbar = React11.memo(function Snackbar2({
1804
1952
  } = visuals;
1805
1953
  const reducedMotion = useReducedMotion();
1806
1954
  const durationMs = resolveDuration(duration);
1807
- React11.useEffect(() => {
1955
+ React4.useEffect(() => {
1808
1956
  const timer = setTimeout(() => resolve(RESULT.DISMISSED), durationMs);
1809
1957
  return () => clearTimeout(timer);
1810
1958
  }, [resolve, durationMs]);
1811
- const handleAction = React11.useCallback(
1959
+ const handleAction = React4.useCallback(
1812
1960
  () => resolve(RESULT.ACTION),
1813
1961
  [resolve]
1814
1962
  );
1815
- const handleDismiss = React11.useCallback(
1963
+ const handleDismiss = React4.useCallback(
1816
1964
  () => resolve(RESULT.DISMISSED),
1817
1965
  [resolve]
1818
1966
  );
@@ -1880,7 +2028,7 @@ var Snackbar = React11.memo(function Snackbar2({
1880
2028
  Snackbar.displayName = "Snackbar";
1881
2029
  function SnackbarHost({ state, className }) {
1882
2030
  const { current, _dismiss } = state;
1883
- const wrappedData = React11.useMemo(() => {
2031
+ const wrappedData = React4.useMemo(() => {
1884
2032
  if (!current) return null;
1885
2033
  return __spreadProps(__spreadValues({}, current), { resolve: _dismiss });
1886
2034
  }, [current, _dismiss]);
@@ -1898,7 +2046,7 @@ function SnackbarHost({ state, className }) {
1898
2046
  ) });
1899
2047
  }
1900
2048
  SnackbarHost.displayName = "SnackbarHost";
1901
- var SnackbarContext = React11.createContext(
2049
+ var SnackbarContext = React4.createContext(
1902
2050
  null
1903
2051
  );
1904
2052