@bug-on/m3-expressive 1.2.5 → 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/CHANGELOG.md +12 -0
- package/dist/buttons.js +260 -98
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +261 -99
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +338 -176
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +321 -159
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +32 -0
- package/dist/feedback.d.ts +32 -0
- package/dist/feedback.js +348 -186
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +326 -164
- package/dist/feedback.mjs.map +1 -1
- package/dist/index.js +261 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +262 -100
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +261 -99
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +262 -100
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.js +260 -98
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +261 -99
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +391 -229
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +354 -192
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +399 -237
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +367 -205
- package/dist/pickers.mjs.map +1 -1
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var React4 = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var materialColorUtilities = require('@material/material-color-utilities');
|
|
7
7
|
var clsx = require('clsx');
|
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
return Object.freeze(n);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
|
|
31
31
|
|
|
32
32
|
var __defProp = Object.defineProperty;
|
|
33
33
|
var __defProps = Object.defineProperties;
|
|
@@ -69,8 +69,8 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
69
69
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
70
70
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
71
71
|
function useMediaQuery(query) {
|
|
72
|
-
const [matches, setMatches] =
|
|
73
|
-
|
|
72
|
+
const [matches, setMatches] = React4.useState(false);
|
|
73
|
+
React4.useEffect(() => {
|
|
74
74
|
const mql = window.matchMedia(query);
|
|
75
75
|
const handler = (e) => setMatches(e.matches);
|
|
76
76
|
setMatches(mql.matches);
|
|
@@ -86,8 +86,8 @@ function useRipple(options = {}) {
|
|
|
86
86
|
opacity = 0.12,
|
|
87
87
|
disabled = false
|
|
88
88
|
} = options;
|
|
89
|
-
const ref =
|
|
90
|
-
const onPointerDown =
|
|
89
|
+
const ref = React4.useRef(null);
|
|
90
|
+
const onPointerDown = React4.useCallback(
|
|
91
91
|
(event) => {
|
|
92
92
|
if (disabled || !ref.current) return;
|
|
93
93
|
const el = ref.current;
|
|
@@ -318,7 +318,7 @@ var VARIANT_FONT = {
|
|
|
318
318
|
rounded: "'Material Symbols Rounded'",
|
|
319
319
|
sharp: "'Material Symbols Sharp'"
|
|
320
320
|
};
|
|
321
|
-
var IconComponent =
|
|
321
|
+
var IconComponent = React4__namespace.forwardRef(
|
|
322
322
|
(_a, ref) => {
|
|
323
323
|
var _b = _a, {
|
|
324
324
|
name,
|
|
@@ -384,8 +384,8 @@ var IconComponent = React11__namespace.forwardRef(
|
|
|
384
384
|
}
|
|
385
385
|
);
|
|
386
386
|
IconComponent.displayName = "Icon";
|
|
387
|
-
var Icon =
|
|
388
|
-
var RippleItem =
|
|
387
|
+
var Icon = React4__namespace.memo(IconComponent);
|
|
388
|
+
var RippleItem = React4__namespace.memo(function RippleItem2({
|
|
389
389
|
ripple,
|
|
390
390
|
onDone
|
|
391
391
|
}) {
|
|
@@ -429,8 +429,8 @@ function Ripple({
|
|
|
429
429
|
}
|
|
430
430
|
function useRippleState(options = {}) {
|
|
431
431
|
const { disabled = false } = options;
|
|
432
|
-
const [ripples, setRipples] =
|
|
433
|
-
const onPointerDown =
|
|
432
|
+
const [ripples, setRipples] = React4__namespace.useState([]);
|
|
433
|
+
const onPointerDown = React4__namespace.useCallback(
|
|
434
434
|
(e) => {
|
|
435
435
|
if (disabled) return;
|
|
436
436
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -447,7 +447,7 @@ function useRippleState(options = {}) {
|
|
|
447
447
|
},
|
|
448
448
|
[disabled]
|
|
449
449
|
);
|
|
450
|
-
const removeRipple =
|
|
450
|
+
const removeRipple = React4__namespace.useCallback((id) => {
|
|
451
451
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
452
452
|
}, []);
|
|
453
453
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -498,11 +498,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
498
498
|
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";
|
|
499
499
|
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";
|
|
500
500
|
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";
|
|
501
|
-
var IndeterminateSvg =
|
|
501
|
+
var IndeterminateSvg = React4__namespace.memo(function IndeterminateSvg2({
|
|
502
502
|
size
|
|
503
503
|
}) {
|
|
504
|
-
const [ready, setReady] =
|
|
505
|
-
|
|
504
|
+
const [ready, setReady] = React4__namespace.useState(false);
|
|
505
|
+
React4__namespace.useEffect(() => {
|
|
506
506
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
507
507
|
return () => cancelAnimationFrame(raf);
|
|
508
508
|
}, []);
|
|
@@ -547,7 +547,7 @@ var IndeterminateSvg = React11__namespace.memo(function IndeterminateSvg2({
|
|
|
547
547
|
}
|
|
548
548
|
);
|
|
549
549
|
});
|
|
550
|
-
var DeterminateSvg =
|
|
550
|
+
var DeterminateSvg = React4__namespace.memo(function DeterminateSvg2({
|
|
551
551
|
size,
|
|
552
552
|
progress
|
|
553
553
|
}) {
|
|
@@ -572,7 +572,7 @@ var DeterminateSvg = React11__namespace.memo(function DeterminateSvg2({
|
|
|
572
572
|
}
|
|
573
573
|
);
|
|
574
574
|
});
|
|
575
|
-
var LoadingIndicator =
|
|
575
|
+
var LoadingIndicator = React4__namespace.forwardRef(
|
|
576
576
|
(_a, ref) => {
|
|
577
577
|
var _b = _a, {
|
|
578
578
|
variant = "uncontained",
|
|
@@ -667,27 +667,47 @@ 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
|
|
671
|
-
return d;
|
|
670
|
+
return `${d} Z`;
|
|
672
671
|
}
|
|
673
672
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
674
673
|
if (startX >= endX) return "";
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
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
|
-
var
|
|
702
|
+
var GLOBAL_ROTATION_DURATION = 6e3;
|
|
703
|
+
var GLOBAL_ROTATION_TARGET = 1080;
|
|
704
|
+
var ADDITIONAL_ROTATION_CYCLE = 1500;
|
|
705
|
+
var ADDITIONAL_ROTATION_STEP = 90;
|
|
706
|
+
var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
707
|
+
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
708
|
+
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
709
|
+
var PROGRESS_CYCLE_DURATION = 1500;
|
|
710
|
+
var CircularProgress = React4__namespace.forwardRef(
|
|
691
711
|
(_a, ref) => {
|
|
692
712
|
var _b = _a, {
|
|
693
713
|
value,
|
|
@@ -700,6 +720,10 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
700
720
|
crawlerSpeed = 1,
|
|
701
721
|
color,
|
|
702
722
|
trackColor,
|
|
723
|
+
showTrack = "auto",
|
|
724
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
725
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
726
|
+
amplitudeRange,
|
|
703
727
|
className,
|
|
704
728
|
"aria-label": ariaLabel
|
|
705
729
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -713,6 +737,10 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
713
737
|
"crawlerSpeed",
|
|
714
738
|
"color",
|
|
715
739
|
"trackColor",
|
|
740
|
+
"showTrack",
|
|
741
|
+
"minProgress",
|
|
742
|
+
"maxProgress",
|
|
743
|
+
"amplitudeRange",
|
|
716
744
|
"className",
|
|
717
745
|
"aria-label"
|
|
718
746
|
]);
|
|
@@ -723,17 +751,22 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
723
751
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
724
752
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
725
753
|
const isWavy = shape === "wavy";
|
|
754
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
726
755
|
const BASELINE_SIZE = 48;
|
|
727
756
|
const scaleFactor = size / BASELINE_SIZE;
|
|
728
|
-
const effectiveAmplitude =
|
|
757
|
+
const effectiveAmplitude = React4__namespace.useMemo(
|
|
729
758
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
730
759
|
[amplitude, scaleFactor]
|
|
731
760
|
);
|
|
732
|
-
const effectiveWavelength =
|
|
761
|
+
const effectiveWavelength = React4__namespace.useMemo(
|
|
733
762
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
734
763
|
[wavelength, scaleFactor]
|
|
735
764
|
);
|
|
736
|
-
const
|
|
765
|
+
const resolvedAmplitudeRange = React4__namespace.useMemo(
|
|
766
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
767
|
+
[amplitudeRange, effectiveAmplitude]
|
|
768
|
+
);
|
|
769
|
+
const wavyActivePath = React4__namespace.useMemo(
|
|
737
770
|
() => isWavy ? generateWavyCircularPath(
|
|
738
771
|
center,
|
|
739
772
|
radius,
|
|
@@ -742,8 +775,8 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
742
775
|
) : null,
|
|
743
776
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
744
777
|
);
|
|
745
|
-
const circumference =
|
|
746
|
-
const gapForTrack =
|
|
778
|
+
const circumference = React4__namespace.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
779
|
+
const gapForTrack = React4__namespace.useMemo(
|
|
747
780
|
() => (gapSize + trackHeight) / circumference,
|
|
748
781
|
[gapSize, trackHeight, circumference]
|
|
749
782
|
);
|
|
@@ -752,6 +785,145 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
752
785
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
753
786
|
const ActiveCircleElem = react.m.circle;
|
|
754
787
|
const ActivePathElem = react.m.path;
|
|
788
|
+
const indeterminateSvgRef = React4__namespace.useRef(null);
|
|
789
|
+
const indeterminateTrackRef = React4__namespace.useRef(null);
|
|
790
|
+
const indeterminateActiveRef = React4__namespace.useRef(null);
|
|
791
|
+
const indeterminateWavyTrackPathRef = React4__namespace.useRef(null);
|
|
792
|
+
const indeterminateWavyActivePathRef = React4__namespace.useRef(null);
|
|
793
|
+
const cachedPathLengthRef = React4__namespace.useRef(0);
|
|
794
|
+
React4__namespace.useLayoutEffect(() => {
|
|
795
|
+
if (!isWavy || !wavyActivePath) {
|
|
796
|
+
cachedPathLengthRef.current = circumference;
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
const el = indeterminateActiveRef.current;
|
|
800
|
+
if (el && "getTotalLength" in el) {
|
|
801
|
+
try {
|
|
802
|
+
const len = el.getTotalLength();
|
|
803
|
+
if (len > 0) {
|
|
804
|
+
cachedPathLengthRef.current = len;
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
} catch (e) {
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
cachedPathLengthRef.current = circumference;
|
|
811
|
+
}, [isWavy, circumference, wavyActivePath]);
|
|
812
|
+
react.useAnimationFrame((time) => {
|
|
813
|
+
if (isDeterminate) return;
|
|
814
|
+
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
815
|
+
const scaledTime = time * safeCrawlerSpeed;
|
|
816
|
+
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
817
|
+
const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
|
|
818
|
+
const additionalFullCycles = Math.floor(
|
|
819
|
+
scaledTime / ADDITIONAL_ROTATION_CYCLE
|
|
820
|
+
);
|
|
821
|
+
const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
|
|
822
|
+
const additionalEaseT = Math.min(
|
|
823
|
+
1,
|
|
824
|
+
additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
|
|
825
|
+
);
|
|
826
|
+
const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
|
|
827
|
+
const totalRotation = globalAngle + additionalAngle;
|
|
828
|
+
if (indeterminateSvgRef.current) {
|
|
829
|
+
indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
|
|
830
|
+
}
|
|
831
|
+
const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
|
|
832
|
+
const progressCycleTime = scaledTime % progressFullCycle;
|
|
833
|
+
let progress;
|
|
834
|
+
if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
|
|
835
|
+
const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
|
|
836
|
+
progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
|
|
837
|
+
} else {
|
|
838
|
+
const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
|
|
839
|
+
progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
|
|
840
|
+
}
|
|
841
|
+
if (isWavy) {
|
|
842
|
+
const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
|
|
843
|
+
const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
|
|
844
|
+
const dynamicPath = generateWavyCircularPath(
|
|
845
|
+
center,
|
|
846
|
+
radius,
|
|
847
|
+
currentAmplitude,
|
|
848
|
+
effectiveWavelength
|
|
849
|
+
);
|
|
850
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
851
|
+
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
852
|
+
}
|
|
853
|
+
if (indeterminateWavyTrackPathRef.current) {
|
|
854
|
+
indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
855
|
+
}
|
|
856
|
+
const pathEl = indeterminateWavyActivePathRef.current;
|
|
857
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
858
|
+
if (pathEl) {
|
|
859
|
+
try {
|
|
860
|
+
const len = pathEl.getTotalLength();
|
|
861
|
+
if (len > 0) totalLen = len;
|
|
862
|
+
} catch (e) {
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
866
|
+
const activeLen = totalLen * progress;
|
|
867
|
+
const activeOff = 0;
|
|
868
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
869
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
870
|
+
"stroke-dasharray",
|
|
871
|
+
`${activeLen} ${totalLen}`
|
|
872
|
+
);
|
|
873
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
874
|
+
"stroke-dashoffset",
|
|
875
|
+
`${activeOff}`
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
|
|
879
|
+
const trackStartFrac = progress + gapFrac;
|
|
880
|
+
const trackLen = Math.max(
|
|
881
|
+
1e-3,
|
|
882
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
883
|
+
);
|
|
884
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
885
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
886
|
+
"stroke-dasharray",
|
|
887
|
+
`${trackLen} ${totalLen}`
|
|
888
|
+
);
|
|
889
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
890
|
+
"stroke-dashoffset",
|
|
891
|
+
`${trackOff}`
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
} else {
|
|
895
|
+
const totalLen = circumference;
|
|
896
|
+
const activeLen = totalLen * progress;
|
|
897
|
+
const activeOff = 0;
|
|
898
|
+
if (indeterminateActiveRef.current) {
|
|
899
|
+
indeterminateActiveRef.current.setAttribute(
|
|
900
|
+
"stroke-dasharray",
|
|
901
|
+
`${activeLen} ${totalLen}`
|
|
902
|
+
);
|
|
903
|
+
indeterminateActiveRef.current.setAttribute(
|
|
904
|
+
"stroke-dashoffset",
|
|
905
|
+
`${activeOff}`
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
|
|
909
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
910
|
+
const trackStartFrac = progress + gapFrac;
|
|
911
|
+
const trackLen = Math.max(
|
|
912
|
+
1e-3,
|
|
913
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
914
|
+
);
|
|
915
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
916
|
+
indeterminateTrackRef.current.setAttribute(
|
|
917
|
+
"stroke-dasharray",
|
|
918
|
+
`${trackLen} ${totalLen}`
|
|
919
|
+
);
|
|
920
|
+
indeterminateTrackRef.current.setAttribute(
|
|
921
|
+
"stroke-dashoffset",
|
|
922
|
+
`${trackOff}`
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
});
|
|
755
927
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
756
928
|
"div",
|
|
757
929
|
__spreadProps(__spreadValues({
|
|
@@ -828,9 +1000,10 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
828
1000
|
]
|
|
829
1001
|
}
|
|
830
1002
|
),
|
|
831
|
-
!isDeterminate && /* @__PURE__ */ jsxRuntime.
|
|
832
|
-
|
|
1003
|
+
!isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
|
+
"svg",
|
|
833
1005
|
{
|
|
1006
|
+
ref: indeterminateSvgRef,
|
|
834
1007
|
width: size,
|
|
835
1008
|
height: size,
|
|
836
1009
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -839,90 +1012,60 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
839
1012
|
position: "absolute",
|
|
840
1013
|
inset: 0,
|
|
841
1014
|
overflow: "visible",
|
|
842
|
-
|
|
843
|
-
|
|
1015
|
+
transformOrigin: "center",
|
|
1016
|
+
transform: "rotate(-90deg)"
|
|
844
1017
|
},
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
849
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
850
|
-
ease: "linear"
|
|
851
|
-
}
|
|
852
|
-
},
|
|
853
|
-
children: [
|
|
854
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
855
|
-
react.m.circle,
|
|
1018
|
+
children: isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1019
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1020
|
+
"path",
|
|
856
1021
|
{
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
r: radius,
|
|
1022
|
+
ref: indeterminateWavyTrackPathRef,
|
|
1023
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
860
1024
|
fill: "none",
|
|
861
1025
|
stroke: bgTrackColor,
|
|
862
1026
|
strokeWidth: trackHeight,
|
|
863
|
-
strokeLinecap: "round"
|
|
864
|
-
style: { originX: "50%", originY: "50%" },
|
|
865
|
-
animate: {
|
|
866
|
-
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)
|
|
870
|
-
],
|
|
871
|
-
rotate: [
|
|
872
|
-
`${(0.1 + gapForTrack) * 360}deg`,
|
|
873
|
-
`${(1 + gapForTrack) * 360}deg`,
|
|
874
|
-
`${(1.1 + gapForTrack) * 360}deg`
|
|
875
|
-
]
|
|
876
|
-
},
|
|
877
|
-
transition: {
|
|
878
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
879
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
880
|
-
ease: [0.4, 0, 0.2, 1]
|
|
881
|
-
}
|
|
1027
|
+
strokeLinecap: "round"
|
|
882
1028
|
}
|
|
883
1029
|
),
|
|
884
|
-
|
|
885
|
-
|
|
1030
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
"path",
|
|
886
1032
|
{
|
|
1033
|
+
ref: indeterminateWavyActivePathRef,
|
|
887
1034
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
888
1035
|
fill: "none",
|
|
889
1036
|
stroke: activeColor,
|
|
890
1037
|
strokeWidth: trackHeight,
|
|
891
|
-
strokeLinecap: "round"
|
|
892
|
-
style: { originX: "50%", originY: "50%" },
|
|
893
|
-
animate: {
|
|
894
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
895
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
896
|
-
},
|
|
897
|
-
transition: {
|
|
898
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
899
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
900
|
-
ease: [0.4, 0, 0.2, 1]
|
|
901
|
-
}
|
|
1038
|
+
strokeLinecap: "round"
|
|
902
1039
|
}
|
|
903
|
-
)
|
|
904
|
-
|
|
1040
|
+
)
|
|
1041
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1042
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1043
|
+
"circle",
|
|
1044
|
+
{
|
|
1045
|
+
ref: indeterminateTrackRef,
|
|
1046
|
+
cx: center,
|
|
1047
|
+
cy: center,
|
|
1048
|
+
r: radius,
|
|
1049
|
+
fill: "none",
|
|
1050
|
+
stroke: bgTrackColor,
|
|
1051
|
+
strokeWidth: trackHeight,
|
|
1052
|
+
strokeLinecap: "round"
|
|
1053
|
+
}
|
|
1054
|
+
),
|
|
1055
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1056
|
+
"circle",
|
|
905
1057
|
{
|
|
1058
|
+
ref: indeterminateActiveRef,
|
|
906
1059
|
cx: center,
|
|
907
1060
|
cy: center,
|
|
908
1061
|
r: radius,
|
|
909
1062
|
fill: "none",
|
|
910
1063
|
stroke: activeColor,
|
|
911
1064
|
strokeWidth: trackHeight,
|
|
912
|
-
strokeLinecap: "round"
|
|
913
|
-
style: { originX: "50%", originY: "50%" },
|
|
914
|
-
animate: {
|
|
915
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
916
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
917
|
-
},
|
|
918
|
-
transition: {
|
|
919
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
920
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
921
|
-
ease: [0.4, 0, 0.2, 1]
|
|
922
|
-
}
|
|
1065
|
+
strokeLinecap: "round"
|
|
923
1066
|
}
|
|
924
1067
|
)
|
|
925
|
-
]
|
|
1068
|
+
] })
|
|
926
1069
|
}
|
|
927
1070
|
)
|
|
928
1071
|
] })
|
|
@@ -932,9 +1075,9 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
932
1075
|
);
|
|
933
1076
|
CircularProgress.displayName = "CircularProgress";
|
|
934
1077
|
function useContainerWidth() {
|
|
935
|
-
const [width, setWidth] =
|
|
936
|
-
const observerRef =
|
|
937
|
-
const ref =
|
|
1078
|
+
const [width, setWidth] = React4__namespace.useState(0);
|
|
1079
|
+
const observerRef = React4__namespace.useRef(null);
|
|
1080
|
+
const ref = React4__namespace.useCallback((node) => {
|
|
938
1081
|
if (observerRef.current) {
|
|
939
1082
|
observerRef.current.disconnect();
|
|
940
1083
|
observerRef.current = null;
|
|
@@ -948,7 +1091,7 @@ function useContainerWidth() {
|
|
|
948
1091
|
observerRef.current = obs;
|
|
949
1092
|
}
|
|
950
1093
|
}, []);
|
|
951
|
-
|
|
1094
|
+
React4__namespace.useEffect(() => {
|
|
952
1095
|
return () => {
|
|
953
1096
|
if (observerRef.current) {
|
|
954
1097
|
observerRef.current.disconnect();
|
|
@@ -958,7 +1101,7 @@ function useContainerWidth() {
|
|
|
958
1101
|
return [ref, width];
|
|
959
1102
|
}
|
|
960
1103
|
function useMergedRef(...refs) {
|
|
961
|
-
return
|
|
1104
|
+
return React4__namespace.useCallback(
|
|
962
1105
|
(node) => {
|
|
963
1106
|
for (const ref of refs) {
|
|
964
1107
|
if (typeof ref === "function") {
|
|
@@ -972,7 +1115,7 @@ function useMergedRef(...refs) {
|
|
|
972
1115
|
[refs]
|
|
973
1116
|
);
|
|
974
1117
|
}
|
|
975
|
-
var FlatLinearTrack =
|
|
1118
|
+
var FlatLinearTrack = React4__namespace.memo(function FlatLinearTrack2({
|
|
976
1119
|
trackHeight,
|
|
977
1120
|
activeColor,
|
|
978
1121
|
trackColor,
|
|
@@ -1048,7 +1191,7 @@ var FlatLinearTrack = React11__namespace.memo(function FlatLinearTrack2({
|
|
|
1048
1191
|
}
|
|
1049
1192
|
);
|
|
1050
1193
|
});
|
|
1051
|
-
var WavyLinearTrack =
|
|
1194
|
+
var WavyLinearTrack = React4__namespace.memo(function WavyLinearTrack2({
|
|
1052
1195
|
trackHeight,
|
|
1053
1196
|
svgHeight,
|
|
1054
1197
|
amplitude,
|
|
@@ -1067,13 +1210,13 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1067
1210
|
}) {
|
|
1068
1211
|
const isDeterminate = typeof value === "number";
|
|
1069
1212
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1070
|
-
const titleId =
|
|
1213
|
+
const titleId = React4__namespace.useId();
|
|
1071
1214
|
const [containerRef, width] = useContainerWidth();
|
|
1072
|
-
const activePathRef =
|
|
1073
|
-
const trackPathRef =
|
|
1215
|
+
const activePathRef = React4__namespace.useRef(null);
|
|
1216
|
+
const trackPathRef = React4__namespace.useRef(null);
|
|
1074
1217
|
const amplitudeMV = react.useMotionValue(amplitude);
|
|
1075
1218
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1076
|
-
|
|
1219
|
+
React4__namespace.useEffect(() => {
|
|
1077
1220
|
if (isDeterminate) {
|
|
1078
1221
|
const fraction = clampedValue / 100;
|
|
1079
1222
|
let targetAmp = amplitude;
|
|
@@ -1086,6 +1229,12 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1086
1229
|
duration: 0.5
|
|
1087
1230
|
});
|
|
1088
1231
|
react.animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
1232
|
+
} else {
|
|
1233
|
+
react.animate(amplitudeMV, amplitude, {
|
|
1234
|
+
type: "spring",
|
|
1235
|
+
bounce: 0,
|
|
1236
|
+
duration: 0.5
|
|
1237
|
+
});
|
|
1089
1238
|
}
|
|
1090
1239
|
}, [
|
|
1091
1240
|
clampedValue,
|
|
@@ -1099,10 +1248,10 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1099
1248
|
1,
|
|
1100
1249
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
1101
1250
|
);
|
|
1102
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
1103
1251
|
react.useAnimationFrame((time) => {
|
|
1104
1252
|
if (width === 0) return;
|
|
1105
1253
|
const currentAmp = amplitudeMV.get();
|
|
1254
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
1106
1255
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
1107
1256
|
const capWidth = trackHeight / 2;
|
|
1108
1257
|
let activePathD = "";
|
|
@@ -1122,7 +1271,7 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1122
1271
|
currentAmp
|
|
1123
1272
|
);
|
|
1124
1273
|
} else if (fraction === 0) {
|
|
1125
|
-
activePathD =
|
|
1274
|
+
activePathD = "";
|
|
1126
1275
|
}
|
|
1127
1276
|
const trackStart = adjHead + totalGap;
|
|
1128
1277
|
if (trackStart < width - capWidth) {
|
|
@@ -1154,20 +1303,20 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1154
1303
|
activeLines.push({ tail: l1T, head: l1H });
|
|
1155
1304
|
activeLines.push({ tail: l2T, head: l2H });
|
|
1156
1305
|
}
|
|
1157
|
-
const
|
|
1158
|
-
const
|
|
1159
|
-
const
|
|
1306
|
+
const activeSegments = activeLines.map((line) => {
|
|
1307
|
+
const rawTail = line.tail * width;
|
|
1308
|
+
const rawHead = line.head * width;
|
|
1160
1309
|
const adjTail = Math.max(
|
|
1161
1310
|
capWidth,
|
|
1162
|
-
Math.min(width - capWidth,
|
|
1311
|
+
Math.min(width - capWidth, rawTail)
|
|
1163
1312
|
);
|
|
1164
1313
|
const adjHead = Math.max(
|
|
1165
1314
|
capWidth,
|
|
1166
|
-
Math.min(width - capWidth,
|
|
1315
|
+
Math.min(width - capWidth, rawHead)
|
|
1167
1316
|
);
|
|
1168
1317
|
return { adjTail, adjHead };
|
|
1169
1318
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
1170
|
-
activePathD =
|
|
1319
|
+
activePathD = activeSegments.map(
|
|
1171
1320
|
(seg) => getSinePath(
|
|
1172
1321
|
seg.adjTail,
|
|
1173
1322
|
seg.adjHead,
|
|
@@ -1176,13 +1325,24 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1176
1325
|
currentAmp
|
|
1177
1326
|
)
|
|
1178
1327
|
).join(" ");
|
|
1328
|
+
const validActiveLines = activeLines.filter(
|
|
1329
|
+
(line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
|
|
1330
|
+
).sort((a, b) => a.tail - b.tail);
|
|
1179
1331
|
let currentTrackX = capWidth;
|
|
1180
|
-
for (const
|
|
1181
|
-
const
|
|
1332
|
+
for (const line of validActiveLines) {
|
|
1333
|
+
const blockStart = line.tail * width - totalGap;
|
|
1334
|
+
const blockEnd = line.head * width + totalGap;
|
|
1335
|
+
const trackEnd = Math.min(width - capWidth, blockStart);
|
|
1182
1336
|
if (trackEnd > currentTrackX) {
|
|
1183
|
-
trackD += `${getSinePath(
|
|
1337
|
+
trackD += `${getSinePath(
|
|
1338
|
+
currentTrackX,
|
|
1339
|
+
trackEnd,
|
|
1340
|
+
phase,
|
|
1341
|
+
activeWavelength,
|
|
1342
|
+
trackAmp
|
|
1343
|
+
)} `;
|
|
1184
1344
|
}
|
|
1185
|
-
currentTrackX = Math.max(currentTrackX,
|
|
1345
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
1186
1346
|
}
|
|
1187
1347
|
if (currentTrackX < width - capWidth) {
|
|
1188
1348
|
trackD += getSinePath(
|
|
@@ -1195,15 +1355,15 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1195
1355
|
}
|
|
1196
1356
|
}
|
|
1197
1357
|
if (activePathRef.current)
|
|
1198
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
1358
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
1199
1359
|
if (trackPathRef.current)
|
|
1200
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
1360
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
1201
1361
|
});
|
|
1202
1362
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1203
1363
|
"div",
|
|
1204
1364
|
{
|
|
1205
1365
|
ref: containerRef,
|
|
1206
|
-
className: "relative w-full
|
|
1366
|
+
className: "relative w-full",
|
|
1207
1367
|
style: { height: svgHeight },
|
|
1208
1368
|
children: width > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1209
1369
|
"svg",
|
|
@@ -1244,7 +1404,7 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1244
1404
|
}
|
|
1245
1405
|
);
|
|
1246
1406
|
});
|
|
1247
|
-
var LinearProgress =
|
|
1407
|
+
var LinearProgress = React4__namespace.forwardRef(
|
|
1248
1408
|
(_a, ref) => {
|
|
1249
1409
|
var _b = _a, {
|
|
1250
1410
|
value,
|
|
@@ -1257,7 +1417,7 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
1257
1417
|
waveSpeed = 1,
|
|
1258
1418
|
crawlerSpeed = 1,
|
|
1259
1419
|
determinateAnimation = "md3",
|
|
1260
|
-
indeterminateAnimation = "
|
|
1420
|
+
indeterminateAnimation = "md3",
|
|
1261
1421
|
gapSize = 4,
|
|
1262
1422
|
showStopIndicator = "auto",
|
|
1263
1423
|
color,
|
|
@@ -1285,33 +1445,35 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
1285
1445
|
]);
|
|
1286
1446
|
const isDeterminate = value !== void 0;
|
|
1287
1447
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1288
|
-
const containerRef =
|
|
1448
|
+
const containerRef = React4__namespace.useRef(null);
|
|
1289
1449
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1290
|
-
const [isRtl, setIsRtl] =
|
|
1291
|
-
|
|
1450
|
+
const [isRtl, setIsRtl] = React4__namespace.useState(false);
|
|
1451
|
+
React4__namespace.useEffect(() => {
|
|
1292
1452
|
if (containerRef.current) {
|
|
1293
1453
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1294
1454
|
setIsRtl(dir === "rtl");
|
|
1295
1455
|
}
|
|
1296
1456
|
}, []);
|
|
1297
|
-
const isWavy = shape === "wavy";
|
|
1298
1457
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1299
|
-
const
|
|
1300
|
-
const
|
|
1458
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1459
|
+
const effectiveAmplitude = React4__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1460
|
+
const svgHeight = React4__namespace.useMemo(
|
|
1301
1461
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1302
1462
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1303
1463
|
);
|
|
1304
|
-
const shouldShowStop =
|
|
1305
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
1464
|
+
const shouldShowStop = React4__namespace.useMemo(
|
|
1465
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1306
1466
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1307
1467
|
);
|
|
1308
|
-
const stopSize =
|
|
1468
|
+
const stopSize = React4__namespace.useMemo(
|
|
1309
1469
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1310
1470
|
[trackHeight]
|
|
1311
1471
|
);
|
|
1312
1472
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
1313
1473
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
1314
1474
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
1475
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
1476
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
1315
1477
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1316
1478
|
"div",
|
|
1317
1479
|
__spreadProps(__spreadValues({
|
|
@@ -1328,12 +1490,12 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
1328
1490
|
style: { height: svgHeight }
|
|
1329
1491
|
}, restProps), {
|
|
1330
1492
|
children: [
|
|
1331
|
-
|
|
1493
|
+
useWavyTrack ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1332
1494
|
WavyLinearTrack,
|
|
1333
1495
|
{
|
|
1334
1496
|
trackHeight,
|
|
1335
1497
|
svgHeight,
|
|
1336
|
-
amplitude:
|
|
1498
|
+
amplitude: trackAmp,
|
|
1337
1499
|
wavelength,
|
|
1338
1500
|
indeterminateWavelength,
|
|
1339
1501
|
activeColor,
|
|
@@ -1378,7 +1540,7 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
1378
1540
|
}
|
|
1379
1541
|
);
|
|
1380
1542
|
LinearProgress.displayName = "LinearProgress";
|
|
1381
|
-
var ProgressIndicator =
|
|
1543
|
+
var ProgressIndicator = React4__namespace.forwardRef((props, ref) => {
|
|
1382
1544
|
if (props.variant === "circular") {
|
|
1383
1545
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1384
1546
|
}
|
|
@@ -1519,7 +1681,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1519
1681
|
}
|
|
1520
1682
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1521
1683
|
}
|
|
1522
|
-
var IconButtonComponent =
|
|
1684
|
+
var IconButtonComponent = React4__namespace.forwardRef(
|
|
1523
1685
|
(_a, ref) => {
|
|
1524
1686
|
var _b = _a, {
|
|
1525
1687
|
className,
|
|
@@ -1561,18 +1723,18 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1561
1723
|
var _a2, _b2, _c, _d, _e;
|
|
1562
1724
|
const isToggle = variant === "toggle";
|
|
1563
1725
|
const isSelected = isToggle && !!selected;
|
|
1564
|
-
const resolvedColorClass =
|
|
1726
|
+
const resolvedColorClass = React4__namespace.useMemo(
|
|
1565
1727
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1566
1728
|
[isSelected, colorStyle]
|
|
1567
1729
|
);
|
|
1568
|
-
const outlineWidthClass =
|
|
1730
|
+
const outlineWidthClass = React4__namespace.useMemo(
|
|
1569
1731
|
() => {
|
|
1570
1732
|
var _a3;
|
|
1571
1733
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1572
1734
|
},
|
|
1573
1735
|
[colorStyle, isSelected, size]
|
|
1574
1736
|
);
|
|
1575
|
-
const disabledBgClass =
|
|
1737
|
+
const disabledBgClass = React4__namespace.useMemo(
|
|
1576
1738
|
() => resolveDisabledBgClass(colorStyle),
|
|
1577
1739
|
[colorStyle]
|
|
1578
1740
|
);
|
|
@@ -1595,7 +1757,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1595
1757
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1596
1758
|
disabled: loading
|
|
1597
1759
|
});
|
|
1598
|
-
const handleClick =
|
|
1760
|
+
const handleClick = React4__namespace.useCallback(
|
|
1599
1761
|
(e) => {
|
|
1600
1762
|
if (loading) {
|
|
1601
1763
|
e.preventDefault();
|
|
@@ -1605,7 +1767,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1605
1767
|
},
|
|
1606
1768
|
[loading, onClick]
|
|
1607
1769
|
);
|
|
1608
|
-
const handleKeyDown =
|
|
1770
|
+
const handleKeyDown = React4__namespace.useCallback(
|
|
1609
1771
|
(e) => {
|
|
1610
1772
|
if (loading) return;
|
|
1611
1773
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1661,7 +1823,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1661
1823
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1662
1824
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1663
1825
|
},
|
|
1664
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
1826
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React4__namespace.Children.only(children).props.children : children
|
|
1665
1827
|
}),
|
|
1666
1828
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1667
1829
|
) })
|
|
@@ -1678,7 +1840,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1678
1840
|
className
|
|
1679
1841
|
);
|
|
1680
1842
|
if (asChild) {
|
|
1681
|
-
const child =
|
|
1843
|
+
const child = React4__namespace.Children.only(children);
|
|
1682
1844
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1683
1845
|
reactSlot.Slot,
|
|
1684
1846
|
__spreadProps(__spreadValues({
|
|
@@ -1695,7 +1857,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1695
1857
|
}),
|
|
1696
1858
|
className: containerClassName
|
|
1697
1859
|
}, restProps), {
|
|
1698
|
-
children:
|
|
1860
|
+
children: React4__namespace.cloneElement(child, { children: innerContent })
|
|
1699
1861
|
})
|
|
1700
1862
|
) });
|
|
1701
1863
|
}
|
|
@@ -1723,7 +1885,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1723
1885
|
}
|
|
1724
1886
|
);
|
|
1725
1887
|
IconButtonComponent.displayName = "IconButton";
|
|
1726
|
-
var IconButton =
|
|
1888
|
+
var IconButton = React4__namespace.memo(IconButtonComponent);
|
|
1727
1889
|
var DURATION_MAP = {
|
|
1728
1890
|
short: 4e3,
|
|
1729
1891
|
long: 7e3
|
|
@@ -1765,9 +1927,9 @@ function toSnackbarData(item) {
|
|
|
1765
1927
|
return { id: generateId(), visuals: item.visuals, resolve: item.resolve };
|
|
1766
1928
|
}
|
|
1767
1929
|
function useSnackbarState() {
|
|
1768
|
-
const [current, setCurrent] =
|
|
1769
|
-
const queueRef =
|
|
1770
|
-
const showSnackbar =
|
|
1930
|
+
const [current, setCurrent] = React4__namespace.useState(null);
|
|
1931
|
+
const queueRef = React4__namespace.useRef([]);
|
|
1932
|
+
const showSnackbar = React4__namespace.useCallback(
|
|
1771
1933
|
(visuals) => {
|
|
1772
1934
|
return new Promise((resolve) => {
|
|
1773
1935
|
const item = { visuals, resolve };
|
|
@@ -1780,14 +1942,14 @@ function useSnackbarState() {
|
|
|
1780
1942
|
},
|
|
1781
1943
|
[]
|
|
1782
1944
|
);
|
|
1783
|
-
const _dismiss =
|
|
1945
|
+
const _dismiss = React4__namespace.useCallback((result) => {
|
|
1784
1946
|
setCurrent((prev) => {
|
|
1785
1947
|
if (prev) prev.resolve(result);
|
|
1786
1948
|
const next = queueRef.current.shift();
|
|
1787
1949
|
return next ? toSnackbarData(next) : null;
|
|
1788
1950
|
});
|
|
1789
1951
|
}, []);
|
|
1790
|
-
|
|
1952
|
+
React4__namespace.useEffect(() => {
|
|
1791
1953
|
return () => {
|
|
1792
1954
|
for (const item of queueRef.current) {
|
|
1793
1955
|
item.resolve(RESULT.DISMISSED);
|
|
@@ -1797,7 +1959,7 @@ function useSnackbarState() {
|
|
|
1797
1959
|
}, []);
|
|
1798
1960
|
return { current, showSnackbar, _dismiss };
|
|
1799
1961
|
}
|
|
1800
|
-
var Snackbar =
|
|
1962
|
+
var Snackbar = React4__namespace.memo(function Snackbar2({
|
|
1801
1963
|
data,
|
|
1802
1964
|
className
|
|
1803
1965
|
}) {
|
|
@@ -1811,15 +1973,15 @@ var Snackbar = React11__namespace.memo(function Snackbar2({
|
|
|
1811
1973
|
} = visuals;
|
|
1812
1974
|
const reducedMotion = react.useReducedMotion();
|
|
1813
1975
|
const durationMs = resolveDuration(duration);
|
|
1814
|
-
|
|
1976
|
+
React4__namespace.useEffect(() => {
|
|
1815
1977
|
const timer = setTimeout(() => resolve(RESULT.DISMISSED), durationMs);
|
|
1816
1978
|
return () => clearTimeout(timer);
|
|
1817
1979
|
}, [resolve, durationMs]);
|
|
1818
|
-
const handleAction =
|
|
1980
|
+
const handleAction = React4__namespace.useCallback(
|
|
1819
1981
|
() => resolve(RESULT.ACTION),
|
|
1820
1982
|
[resolve]
|
|
1821
1983
|
);
|
|
1822
|
-
const handleDismiss =
|
|
1984
|
+
const handleDismiss = React4__namespace.useCallback(
|
|
1823
1985
|
() => resolve(RESULT.DISMISSED),
|
|
1824
1986
|
[resolve]
|
|
1825
1987
|
);
|
|
@@ -1887,7 +2049,7 @@ var Snackbar = React11__namespace.memo(function Snackbar2({
|
|
|
1887
2049
|
Snackbar.displayName = "Snackbar";
|
|
1888
2050
|
function SnackbarHost({ state, className }) {
|
|
1889
2051
|
const { current, _dismiss } = state;
|
|
1890
|
-
const wrappedData =
|
|
2052
|
+
const wrappedData = React4__namespace.useMemo(() => {
|
|
1891
2053
|
if (!current) return null;
|
|
1892
2054
|
return __spreadProps(__spreadValues({}, current), { resolve: _dismiss });
|
|
1893
2055
|
}, [current, _dismiss]);
|
|
@@ -1905,7 +2067,7 @@ function SnackbarHost({ state, className }) {
|
|
|
1905
2067
|
) });
|
|
1906
2068
|
}
|
|
1907
2069
|
SnackbarHost.displayName = "SnackbarHost";
|
|
1908
|
-
var SnackbarContext =
|
|
2070
|
+
var SnackbarContext = React4__namespace.createContext(
|
|
1909
2071
|
null
|
|
1910
2072
|
);
|
|
1911
2073
|
|
|
@@ -2587,8 +2749,8 @@ var TOKEN_TO_PROP = {
|
|
|
2587
2749
|
};
|
|
2588
2750
|
var defaultTokens = new TypographyTokens();
|
|
2589
2751
|
var defaultTypography = new Typography();
|
|
2590
|
-
var TypographyContext =
|
|
2591
|
-
var ThemeContext =
|
|
2752
|
+
var TypographyContext = React4.createContext(defaultTypography);
|
|
2753
|
+
var ThemeContext = React4.createContext(void 0);
|
|
2592
2754
|
var STORAGE_KEY_COLOR = "md3-source-color";
|
|
2593
2755
|
var STORAGE_KEY_MODE = "md3-theme-mode";
|
|
2594
2756
|
var defaultTokens2 = new TypographyTokens();
|
|
@@ -2605,11 +2767,11 @@ function MD3ThemeProvider({
|
|
|
2605
2767
|
fontVariationAxes,
|
|
2606
2768
|
enableSnackbar = false
|
|
2607
2769
|
}) {
|
|
2608
|
-
const [sourceColor, setSourceColor] =
|
|
2609
|
-
const [mode, setMode] =
|
|
2610
|
-
const [isHydrated, setIsHydrated] =
|
|
2611
|
-
const [systemMode, setSystemMode] =
|
|
2612
|
-
|
|
2770
|
+
const [sourceColor, setSourceColor] = React4.useState(initialSourceColor);
|
|
2771
|
+
const [mode, setMode] = React4.useState(defaultMode);
|
|
2772
|
+
const [isHydrated, setIsHydrated] = React4.useState(!persistToLocalStorage);
|
|
2773
|
+
const [systemMode, setSystemMode] = React4.useState("light");
|
|
2774
|
+
React4.useEffect(() => {
|
|
2613
2775
|
if (typeof window === "undefined") return;
|
|
2614
2776
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2615
2777
|
const updateSystemMode = () => {
|
|
@@ -2619,7 +2781,7 @@ function MD3ThemeProvider({
|
|
|
2619
2781
|
mediaQuery.addEventListener("change", updateSystemMode);
|
|
2620
2782
|
return () => mediaQuery.removeEventListener("change", updateSystemMode);
|
|
2621
2783
|
}, []);
|
|
2622
|
-
|
|
2784
|
+
React4.useEffect(() => {
|
|
2623
2785
|
if (!persistToLocalStorage) return;
|
|
2624
2786
|
const savedColor = localStorage.getItem(STORAGE_KEY_COLOR);
|
|
2625
2787
|
const savedMode = localStorage.getItem(
|
|
@@ -2631,7 +2793,7 @@ function MD3ThemeProvider({
|
|
|
2631
2793
|
setIsHydrated(true);
|
|
2632
2794
|
}, [persistToLocalStorage]);
|
|
2633
2795
|
const effectiveMode = mode === "system" ? systemMode : mode;
|
|
2634
|
-
|
|
2796
|
+
React4.useEffect(() => {
|
|
2635
2797
|
if (!isHydrated) return;
|
|
2636
2798
|
applyTheme(sourceColor, effectiveMode, document.documentElement, {
|
|
2637
2799
|
variant,
|
|
@@ -2650,7 +2812,7 @@ function MD3ThemeProvider({
|
|
|
2650
2812
|
variant,
|
|
2651
2813
|
contrastLevel
|
|
2652
2814
|
]);
|
|
2653
|
-
const themeValue =
|
|
2815
|
+
const themeValue = React4.useMemo(
|
|
2654
2816
|
() => ({
|
|
2655
2817
|
sourceColor,
|
|
2656
2818
|
setSourceColor,
|
|
@@ -2662,7 +2824,7 @@ function MD3ThemeProvider({
|
|
|
2662
2824
|
}),
|
|
2663
2825
|
[sourceColor, mode, effectiveMode, variant, contrastLevel]
|
|
2664
2826
|
);
|
|
2665
|
-
const typographyValue =
|
|
2827
|
+
const typographyValue = React4.useMemo(() => {
|
|
2666
2828
|
if (typographyProp) return typographyProp;
|
|
2667
2829
|
if (fontFamily != null ? fontFamily : fontVariationAxes) {
|
|
2668
2830
|
return new Typography(
|
|
@@ -2675,7 +2837,7 @@ function MD3ThemeProvider({
|
|
|
2675
2837
|
}
|
|
2676
2838
|
function SnackbarMountedProvider({ children }) {
|
|
2677
2839
|
const state = useSnackbarState();
|
|
2678
|
-
const contextValue =
|
|
2840
|
+
const contextValue = React4.useMemo(
|
|
2679
2841
|
() => ({ showSnackbar: state.showSnackbar }),
|
|
2680
2842
|
[state.showSnackbar]
|
|
2681
2843
|
);
|
|
@@ -2685,7 +2847,7 @@ function SnackbarMountedProvider({ children }) {
|
|
|
2685
2847
|
] });
|
|
2686
2848
|
}
|
|
2687
2849
|
function useTheme() {
|
|
2688
|
-
const context =
|
|
2850
|
+
const context = React4.useContext(ThemeContext);
|
|
2689
2851
|
if (!context) {
|
|
2690
2852
|
throw new Error("useTheme must be used within <MD3ThemeProvider>.");
|
|
2691
2853
|
}
|