@bug-on/m3-expressive 1.2.6 → 1.3.0
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.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- package/dist/buttons.js +230 -82
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +231 -83
- package/dist/buttons.mjs.map +1 -1
- package/dist/{core-D4048_K5.d.mts → core-CAU8g2HY.d.mts} +1 -1
- package/dist/{core-Bc5Wj_pc.d.ts → core-DRrLnsnJ.d.ts} +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +300 -152
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +283 -135
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +40 -6
- package/dist/feedback.d.ts +40 -6
- package/dist/feedback.js +313 -165
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +291 -143
- package/dist/feedback.mjs.map +1 -1
- package/dist/{icon-button-CSsDmuQC.d.mts → icon-button-CqdQBsRe.d.ts} +11 -5
- package/dist/{icon-button-CSsDmuQC.d.ts → icon-button-USJo7AqO.d.mts} +11 -5
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +511 -235
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +511 -236
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +1 -1
- package/dist/layout.d.ts +1 -1
- package/dist/layout.js +221 -105
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +222 -106
- package/dist/layout.mjs.map +1 -1
- package/dist/{md3-Dty-Qcad.d.mts → md3-D0_Z7IXj.d.mts} +9 -1
- package/dist/{md3-Dty-Qcad.d.ts → md3-D0_Z7IXj.d.ts} +9 -1
- package/dist/navigation.d.mts +103 -33
- package/dist/navigation.d.ts +103 -33
- package/dist/navigation.js +507 -199
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +508 -201
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +354 -206
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +317 -169
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +362 -214
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +330 -182
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-DPJL3bO6.d.mts → split-button-trailing-uncheckable-26qlZvKT.d.mts} +10 -7
- package/dist/{split-button-trailing-uncheckable--BhNTEJw.d.ts → split-button-trailing-uncheckable-CXUVrH64.d.ts} +10 -7
- 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,7 +667,7 @@ 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
|
-
return d
|
|
670
|
+
return `${d} Z`;
|
|
671
671
|
}
|
|
672
672
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
673
673
|
if (startX >= endX) return "";
|
|
@@ -699,7 +699,15 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
699
699
|
}
|
|
700
700
|
return d;
|
|
701
701
|
}
|
|
702
|
-
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(
|
|
703
711
|
(_a, ref) => {
|
|
704
712
|
var _b = _a, {
|
|
705
713
|
value,
|
|
@@ -712,6 +720,10 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
712
720
|
crawlerSpeed = 1,
|
|
713
721
|
color,
|
|
714
722
|
trackColor,
|
|
723
|
+
showTrack = "auto",
|
|
724
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
725
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
726
|
+
amplitudeRange,
|
|
715
727
|
className,
|
|
716
728
|
"aria-label": ariaLabel
|
|
717
729
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -725,6 +737,10 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
725
737
|
"crawlerSpeed",
|
|
726
738
|
"color",
|
|
727
739
|
"trackColor",
|
|
740
|
+
"showTrack",
|
|
741
|
+
"minProgress",
|
|
742
|
+
"maxProgress",
|
|
743
|
+
"amplitudeRange",
|
|
728
744
|
"className",
|
|
729
745
|
"aria-label"
|
|
730
746
|
]);
|
|
@@ -735,17 +751,22 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
735
751
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
736
752
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
737
753
|
const isWavy = shape === "wavy";
|
|
754
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
738
755
|
const BASELINE_SIZE = 48;
|
|
739
756
|
const scaleFactor = size / BASELINE_SIZE;
|
|
740
|
-
const effectiveAmplitude =
|
|
757
|
+
const effectiveAmplitude = React4__namespace.useMemo(
|
|
741
758
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
742
759
|
[amplitude, scaleFactor]
|
|
743
760
|
);
|
|
744
|
-
const effectiveWavelength =
|
|
761
|
+
const effectiveWavelength = React4__namespace.useMemo(
|
|
745
762
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
746
763
|
[wavelength, scaleFactor]
|
|
747
764
|
);
|
|
748
|
-
const
|
|
765
|
+
const resolvedAmplitudeRange = React4__namespace.useMemo(
|
|
766
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
767
|
+
[amplitudeRange, effectiveAmplitude]
|
|
768
|
+
);
|
|
769
|
+
const wavyActivePath = React4__namespace.useMemo(
|
|
749
770
|
() => isWavy ? generateWavyCircularPath(
|
|
750
771
|
center,
|
|
751
772
|
radius,
|
|
@@ -754,8 +775,8 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
754
775
|
) : null,
|
|
755
776
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
756
777
|
);
|
|
757
|
-
const circumference =
|
|
758
|
-
const gapForTrack =
|
|
778
|
+
const circumference = React4__namespace.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
779
|
+
const gapForTrack = React4__namespace.useMemo(
|
|
759
780
|
() => (gapSize + trackHeight) / circumference,
|
|
760
781
|
[gapSize, trackHeight, circumference]
|
|
761
782
|
);
|
|
@@ -764,6 +785,145 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
764
785
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
765
786
|
const ActiveCircleElem = react.m.circle;
|
|
766
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
|
+
});
|
|
767
927
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
768
928
|
"div",
|
|
769
929
|
__spreadProps(__spreadValues({
|
|
@@ -840,9 +1000,10 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
840
1000
|
]
|
|
841
1001
|
}
|
|
842
1002
|
),
|
|
843
|
-
!isDeterminate && /* @__PURE__ */ jsxRuntime.
|
|
844
|
-
|
|
1003
|
+
!isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
|
+
"svg",
|
|
845
1005
|
{
|
|
1006
|
+
ref: indeterminateSvgRef,
|
|
846
1007
|
width: size,
|
|
847
1008
|
height: size,
|
|
848
1009
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -851,84 +1012,60 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
851
1012
|
position: "absolute",
|
|
852
1013
|
inset: 0,
|
|
853
1014
|
overflow: "visible",
|
|
854
|
-
transformOrigin: "center"
|
|
855
|
-
|
|
856
|
-
animate: { rotate: [0, 360] },
|
|
857
|
-
transition: {
|
|
858
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
859
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
860
|
-
ease: "linear"
|
|
1015
|
+
transformOrigin: "center",
|
|
1016
|
+
transform: "rotate(-90deg)"
|
|
861
1017
|
},
|
|
862
|
-
children: [
|
|
863
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
864
|
-
|
|
1018
|
+
children: isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1019
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1020
|
+
"path",
|
|
865
1021
|
{
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
r: radius,
|
|
1022
|
+
ref: indeterminateWavyTrackPathRef,
|
|
1023
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
869
1024
|
fill: "none",
|
|
870
1025
|
stroke: bgTrackColor,
|
|
871
1026
|
strokeWidth: trackHeight,
|
|
872
|
-
strokeLinecap: "round"
|
|
873
|
-
animate: {
|
|
874
|
-
pathLength: [
|
|
875
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
876
|
-
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
877
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
878
|
-
],
|
|
879
|
-
pathOffset: [
|
|
880
|
-
0.1 + gapForTrack,
|
|
881
|
-
0.75 + gapForTrack,
|
|
882
|
-
0.1 + gapForTrack
|
|
883
|
-
]
|
|
884
|
-
},
|
|
885
|
-
transition: {
|
|
886
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
887
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
888
|
-
ease: [0.4, 0, 0.2, 1]
|
|
889
|
-
}
|
|
1027
|
+
strokeLinecap: "round"
|
|
890
1028
|
}
|
|
891
1029
|
),
|
|
892
|
-
|
|
893
|
-
|
|
1030
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
"path",
|
|
894
1032
|
{
|
|
1033
|
+
ref: indeterminateWavyActivePathRef,
|
|
895
1034
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
896
1035
|
fill: "none",
|
|
897
1036
|
stroke: activeColor,
|
|
898
1037
|
strokeWidth: trackHeight,
|
|
899
|
-
strokeLinecap: "round"
|
|
900
|
-
animate: {
|
|
901
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
902
|
-
pathOffset: [0, 0.65, 1]
|
|
903
|
-
},
|
|
904
|
-
transition: {
|
|
905
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
906
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
907
|
-
ease: [0.4, 0, 0.2, 1]
|
|
908
|
-
}
|
|
1038
|
+
strokeLinecap: "round"
|
|
909
1039
|
}
|
|
910
|
-
)
|
|
911
|
-
|
|
1040
|
+
)
|
|
1041
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1042
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1043
|
+
"circle",
|
|
912
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",
|
|
1057
|
+
{
|
|
1058
|
+
ref: indeterminateActiveRef,
|
|
913
1059
|
cx: center,
|
|
914
1060
|
cy: center,
|
|
915
1061
|
r: radius,
|
|
916
1062
|
fill: "none",
|
|
917
1063
|
stroke: activeColor,
|
|
918
1064
|
strokeWidth: trackHeight,
|
|
919
|
-
strokeLinecap: "round"
|
|
920
|
-
animate: {
|
|
921
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
922
|
-
pathOffset: [0, 0.65, 1]
|
|
923
|
-
},
|
|
924
|
-
transition: {
|
|
925
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
926
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
927
|
-
ease: [0.4, 0, 0.2, 1]
|
|
928
|
-
}
|
|
1065
|
+
strokeLinecap: "round"
|
|
929
1066
|
}
|
|
930
1067
|
)
|
|
931
|
-
]
|
|
1068
|
+
] })
|
|
932
1069
|
}
|
|
933
1070
|
)
|
|
934
1071
|
] })
|
|
@@ -938,9 +1075,9 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
938
1075
|
);
|
|
939
1076
|
CircularProgress.displayName = "CircularProgress";
|
|
940
1077
|
function useContainerWidth() {
|
|
941
|
-
const [width, setWidth] =
|
|
942
|
-
const observerRef =
|
|
943
|
-
const ref =
|
|
1078
|
+
const [width, setWidth] = React4__namespace.useState(0);
|
|
1079
|
+
const observerRef = React4__namespace.useRef(null);
|
|
1080
|
+
const ref = React4__namespace.useCallback((node) => {
|
|
944
1081
|
if (observerRef.current) {
|
|
945
1082
|
observerRef.current.disconnect();
|
|
946
1083
|
observerRef.current = null;
|
|
@@ -954,7 +1091,7 @@ function useContainerWidth() {
|
|
|
954
1091
|
observerRef.current = obs;
|
|
955
1092
|
}
|
|
956
1093
|
}, []);
|
|
957
|
-
|
|
1094
|
+
React4__namespace.useEffect(() => {
|
|
958
1095
|
return () => {
|
|
959
1096
|
if (observerRef.current) {
|
|
960
1097
|
observerRef.current.disconnect();
|
|
@@ -964,7 +1101,7 @@ function useContainerWidth() {
|
|
|
964
1101
|
return [ref, width];
|
|
965
1102
|
}
|
|
966
1103
|
function useMergedRef(...refs) {
|
|
967
|
-
return
|
|
1104
|
+
return React4__namespace.useCallback(
|
|
968
1105
|
(node) => {
|
|
969
1106
|
for (const ref of refs) {
|
|
970
1107
|
if (typeof ref === "function") {
|
|
@@ -978,7 +1115,7 @@ function useMergedRef(...refs) {
|
|
|
978
1115
|
[refs]
|
|
979
1116
|
);
|
|
980
1117
|
}
|
|
981
|
-
var FlatLinearTrack =
|
|
1118
|
+
var FlatLinearTrack = React4__namespace.memo(function FlatLinearTrack2({
|
|
982
1119
|
trackHeight,
|
|
983
1120
|
activeColor,
|
|
984
1121
|
trackColor,
|
|
@@ -1054,7 +1191,7 @@ var FlatLinearTrack = React11__namespace.memo(function FlatLinearTrack2({
|
|
|
1054
1191
|
}
|
|
1055
1192
|
);
|
|
1056
1193
|
});
|
|
1057
|
-
var WavyLinearTrack =
|
|
1194
|
+
var WavyLinearTrack = React4__namespace.memo(function WavyLinearTrack2({
|
|
1058
1195
|
trackHeight,
|
|
1059
1196
|
svgHeight,
|
|
1060
1197
|
amplitude,
|
|
@@ -1073,13 +1210,13 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1073
1210
|
}) {
|
|
1074
1211
|
const isDeterminate = typeof value === "number";
|
|
1075
1212
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1076
|
-
const titleId =
|
|
1213
|
+
const titleId = React4__namespace.useId();
|
|
1077
1214
|
const [containerRef, width] = useContainerWidth();
|
|
1078
|
-
const activePathRef =
|
|
1079
|
-
const trackPathRef =
|
|
1215
|
+
const activePathRef = React4__namespace.useRef(null);
|
|
1216
|
+
const trackPathRef = React4__namespace.useRef(null);
|
|
1080
1217
|
const amplitudeMV = react.useMotionValue(amplitude);
|
|
1081
1218
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1082
|
-
|
|
1219
|
+
React4__namespace.useEffect(() => {
|
|
1083
1220
|
if (isDeterminate) {
|
|
1084
1221
|
const fraction = clampedValue / 100;
|
|
1085
1222
|
let targetAmp = amplitude;
|
|
@@ -1134,7 +1271,7 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1134
1271
|
currentAmp
|
|
1135
1272
|
);
|
|
1136
1273
|
} else if (fraction === 0) {
|
|
1137
|
-
activePathD =
|
|
1274
|
+
activePathD = "";
|
|
1138
1275
|
}
|
|
1139
1276
|
const trackStart = adjHead + totalGap;
|
|
1140
1277
|
if (trackStart < width - capWidth) {
|
|
@@ -1166,20 +1303,20 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1166
1303
|
activeLines.push({ tail: l1T, head: l1H });
|
|
1167
1304
|
activeLines.push({ tail: l2T, head: l2H });
|
|
1168
1305
|
}
|
|
1169
|
-
const
|
|
1170
|
-
const
|
|
1171
|
-
const
|
|
1306
|
+
const activeSegments = activeLines.map((line) => {
|
|
1307
|
+
const rawTail = line.tail * width;
|
|
1308
|
+
const rawHead = line.head * width;
|
|
1172
1309
|
const adjTail = Math.max(
|
|
1173
1310
|
capWidth,
|
|
1174
|
-
Math.min(width - capWidth,
|
|
1311
|
+
Math.min(width - capWidth, rawTail)
|
|
1175
1312
|
);
|
|
1176
1313
|
const adjHead = Math.max(
|
|
1177
1314
|
capWidth,
|
|
1178
|
-
Math.min(width - capWidth,
|
|
1315
|
+
Math.min(width - capWidth, rawHead)
|
|
1179
1316
|
);
|
|
1180
1317
|
return { adjTail, adjHead };
|
|
1181
1318
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
1182
|
-
activePathD =
|
|
1319
|
+
activePathD = activeSegments.map(
|
|
1183
1320
|
(seg) => getSinePath(
|
|
1184
1321
|
seg.adjTail,
|
|
1185
1322
|
seg.adjHead,
|
|
@@ -1188,13 +1325,24 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1188
1325
|
currentAmp
|
|
1189
1326
|
)
|
|
1190
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);
|
|
1191
1331
|
let currentTrackX = capWidth;
|
|
1192
|
-
for (const
|
|
1193
|
-
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);
|
|
1194
1336
|
if (trackEnd > currentTrackX) {
|
|
1195
|
-
trackD += `${getSinePath(
|
|
1337
|
+
trackD += `${getSinePath(
|
|
1338
|
+
currentTrackX,
|
|
1339
|
+
trackEnd,
|
|
1340
|
+
phase,
|
|
1341
|
+
activeWavelength,
|
|
1342
|
+
trackAmp
|
|
1343
|
+
)} `;
|
|
1196
1344
|
}
|
|
1197
|
-
currentTrackX = Math.max(currentTrackX,
|
|
1345
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
1198
1346
|
}
|
|
1199
1347
|
if (currentTrackX < width - capWidth) {
|
|
1200
1348
|
trackD += getSinePath(
|
|
@@ -1207,9 +1355,9 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1207
1355
|
}
|
|
1208
1356
|
}
|
|
1209
1357
|
if (activePathRef.current)
|
|
1210
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
1358
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
1211
1359
|
if (trackPathRef.current)
|
|
1212
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
1360
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
1213
1361
|
});
|
|
1214
1362
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1215
1363
|
"div",
|
|
@@ -1256,7 +1404,7 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
1256
1404
|
}
|
|
1257
1405
|
);
|
|
1258
1406
|
});
|
|
1259
|
-
var LinearProgress =
|
|
1407
|
+
var LinearProgress = React4__namespace.forwardRef(
|
|
1260
1408
|
(_a, ref) => {
|
|
1261
1409
|
var _b = _a, {
|
|
1262
1410
|
value,
|
|
@@ -1297,10 +1445,10 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
1297
1445
|
]);
|
|
1298
1446
|
const isDeterminate = value !== void 0;
|
|
1299
1447
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1300
|
-
const containerRef =
|
|
1448
|
+
const containerRef = React4__namespace.useRef(null);
|
|
1301
1449
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1302
|
-
const [isRtl, setIsRtl] =
|
|
1303
|
-
|
|
1450
|
+
const [isRtl, setIsRtl] = React4__namespace.useState(false);
|
|
1451
|
+
React4__namespace.useEffect(() => {
|
|
1304
1452
|
if (containerRef.current) {
|
|
1305
1453
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1306
1454
|
setIsRtl(dir === "rtl");
|
|
@@ -1308,16 +1456,16 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
1308
1456
|
}, []);
|
|
1309
1457
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1310
1458
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1311
|
-
const effectiveAmplitude =
|
|
1312
|
-
const svgHeight =
|
|
1459
|
+
const effectiveAmplitude = React4__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1460
|
+
const svgHeight = React4__namespace.useMemo(
|
|
1313
1461
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1314
1462
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1315
1463
|
);
|
|
1316
|
-
const shouldShowStop =
|
|
1464
|
+
const shouldShowStop = React4__namespace.useMemo(
|
|
1317
1465
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1318
1466
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1319
1467
|
);
|
|
1320
|
-
const stopSize =
|
|
1468
|
+
const stopSize = React4__namespace.useMemo(
|
|
1321
1469
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1322
1470
|
[trackHeight]
|
|
1323
1471
|
);
|
|
@@ -1392,7 +1540,7 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
1392
1540
|
}
|
|
1393
1541
|
);
|
|
1394
1542
|
LinearProgress.displayName = "LinearProgress";
|
|
1395
|
-
var ProgressIndicator =
|
|
1543
|
+
var ProgressIndicator = React4__namespace.forwardRef((props, ref) => {
|
|
1396
1544
|
if (props.variant === "circular") {
|
|
1397
1545
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1398
1546
|
}
|
|
@@ -1533,7 +1681,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1533
1681
|
}
|
|
1534
1682
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1535
1683
|
}
|
|
1536
|
-
var IconButtonComponent =
|
|
1684
|
+
var IconButtonComponent = React4__namespace.forwardRef(
|
|
1537
1685
|
(_a, ref) => {
|
|
1538
1686
|
var _b = _a, {
|
|
1539
1687
|
className,
|
|
@@ -1541,7 +1689,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1541
1689
|
variant = "default",
|
|
1542
1690
|
colorStyle = "standard",
|
|
1543
1691
|
size = "sm",
|
|
1544
|
-
|
|
1692
|
+
width = "default",
|
|
1545
1693
|
shape = "round",
|
|
1546
1694
|
selected,
|
|
1547
1695
|
selectedIcon,
|
|
@@ -1559,7 +1707,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1559
1707
|
"variant",
|
|
1560
1708
|
"colorStyle",
|
|
1561
1709
|
"size",
|
|
1562
|
-
"
|
|
1710
|
+
"width",
|
|
1563
1711
|
"shape",
|
|
1564
1712
|
"selected",
|
|
1565
1713
|
"selectedIcon",
|
|
@@ -1575,18 +1723,18 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1575
1723
|
var _a2, _b2, _c, _d, _e;
|
|
1576
1724
|
const isToggle = variant === "toggle";
|
|
1577
1725
|
const isSelected = isToggle && !!selected;
|
|
1578
|
-
const resolvedColorClass =
|
|
1726
|
+
const resolvedColorClass = React4__namespace.useMemo(
|
|
1579
1727
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1580
1728
|
[isSelected, colorStyle]
|
|
1581
1729
|
);
|
|
1582
|
-
const outlineWidthClass =
|
|
1730
|
+
const outlineWidthClass = React4__namespace.useMemo(
|
|
1583
1731
|
() => {
|
|
1584
1732
|
var _a3;
|
|
1585
1733
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1586
1734
|
},
|
|
1587
1735
|
[colorStyle, isSelected, size]
|
|
1588
1736
|
);
|
|
1589
|
-
const disabledBgClass =
|
|
1737
|
+
const disabledBgClass = React4__namespace.useMemo(
|
|
1590
1738
|
() => resolveDisabledBgClass(colorStyle),
|
|
1591
1739
|
[colorStyle]
|
|
1592
1740
|
);
|
|
@@ -1604,12 +1752,12 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1604
1752
|
const iconPx = iconSize != null ? iconSize : defaultIconPx;
|
|
1605
1753
|
const isCustomSize = iconSize != null && iconSize !== "inherit";
|
|
1606
1754
|
const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
|
|
1607
|
-
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[
|
|
1755
|
+
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[width]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
|
|
1608
1756
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1609
1757
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1610
1758
|
disabled: loading
|
|
1611
1759
|
});
|
|
1612
|
-
const handleClick =
|
|
1760
|
+
const handleClick = React4__namespace.useCallback(
|
|
1613
1761
|
(e) => {
|
|
1614
1762
|
if (loading) {
|
|
1615
1763
|
e.preventDefault();
|
|
@@ -1619,7 +1767,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1619
1767
|
},
|
|
1620
1768
|
[loading, onClick]
|
|
1621
1769
|
);
|
|
1622
|
-
const handleKeyDown =
|
|
1770
|
+
const handleKeyDown = React4__namespace.useCallback(
|
|
1623
1771
|
(e) => {
|
|
1624
1772
|
if (loading) return;
|
|
1625
1773
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1675,7 +1823,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1675
1823
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1676
1824
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1677
1825
|
},
|
|
1678
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
1826
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React4__namespace.Children.only(children).props.children : children
|
|
1679
1827
|
}),
|
|
1680
1828
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1681
1829
|
) })
|
|
@@ -1692,7 +1840,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1692
1840
|
className
|
|
1693
1841
|
);
|
|
1694
1842
|
if (asChild) {
|
|
1695
|
-
const child =
|
|
1843
|
+
const child = React4__namespace.Children.only(children);
|
|
1696
1844
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1697
1845
|
reactSlot.Slot,
|
|
1698
1846
|
__spreadProps(__spreadValues({
|
|
@@ -1709,7 +1857,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1709
1857
|
}),
|
|
1710
1858
|
className: containerClassName
|
|
1711
1859
|
}, restProps), {
|
|
1712
|
-
children:
|
|
1860
|
+
children: React4__namespace.cloneElement(child, { children: innerContent })
|
|
1713
1861
|
})
|
|
1714
1862
|
) });
|
|
1715
1863
|
}
|
|
@@ -1737,7 +1885,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
1737
1885
|
}
|
|
1738
1886
|
);
|
|
1739
1887
|
IconButtonComponent.displayName = "IconButton";
|
|
1740
|
-
var IconButton =
|
|
1888
|
+
var IconButton = React4__namespace.memo(IconButtonComponent);
|
|
1741
1889
|
var DURATION_MAP = {
|
|
1742
1890
|
short: 4e3,
|
|
1743
1891
|
long: 7e3
|
|
@@ -1779,9 +1927,9 @@ function toSnackbarData(item) {
|
|
|
1779
1927
|
return { id: generateId(), visuals: item.visuals, resolve: item.resolve };
|
|
1780
1928
|
}
|
|
1781
1929
|
function useSnackbarState() {
|
|
1782
|
-
const [current, setCurrent] =
|
|
1783
|
-
const queueRef =
|
|
1784
|
-
const showSnackbar =
|
|
1930
|
+
const [current, setCurrent] = React4__namespace.useState(null);
|
|
1931
|
+
const queueRef = React4__namespace.useRef([]);
|
|
1932
|
+
const showSnackbar = React4__namespace.useCallback(
|
|
1785
1933
|
(visuals) => {
|
|
1786
1934
|
return new Promise((resolve) => {
|
|
1787
1935
|
const item = { visuals, resolve };
|
|
@@ -1794,14 +1942,14 @@ function useSnackbarState() {
|
|
|
1794
1942
|
},
|
|
1795
1943
|
[]
|
|
1796
1944
|
);
|
|
1797
|
-
const _dismiss =
|
|
1945
|
+
const _dismiss = React4__namespace.useCallback((result) => {
|
|
1798
1946
|
setCurrent((prev) => {
|
|
1799
1947
|
if (prev) prev.resolve(result);
|
|
1800
1948
|
const next = queueRef.current.shift();
|
|
1801
1949
|
return next ? toSnackbarData(next) : null;
|
|
1802
1950
|
});
|
|
1803
1951
|
}, []);
|
|
1804
|
-
|
|
1952
|
+
React4__namespace.useEffect(() => {
|
|
1805
1953
|
return () => {
|
|
1806
1954
|
for (const item of queueRef.current) {
|
|
1807
1955
|
item.resolve(RESULT.DISMISSED);
|
|
@@ -1811,7 +1959,7 @@ function useSnackbarState() {
|
|
|
1811
1959
|
}, []);
|
|
1812
1960
|
return { current, showSnackbar, _dismiss };
|
|
1813
1961
|
}
|
|
1814
|
-
var Snackbar =
|
|
1962
|
+
var Snackbar = React4__namespace.memo(function Snackbar2({
|
|
1815
1963
|
data,
|
|
1816
1964
|
className
|
|
1817
1965
|
}) {
|
|
@@ -1825,15 +1973,15 @@ var Snackbar = React11__namespace.memo(function Snackbar2({
|
|
|
1825
1973
|
} = visuals;
|
|
1826
1974
|
const reducedMotion = react.useReducedMotion();
|
|
1827
1975
|
const durationMs = resolveDuration(duration);
|
|
1828
|
-
|
|
1976
|
+
React4__namespace.useEffect(() => {
|
|
1829
1977
|
const timer = setTimeout(() => resolve(RESULT.DISMISSED), durationMs);
|
|
1830
1978
|
return () => clearTimeout(timer);
|
|
1831
1979
|
}, [resolve, durationMs]);
|
|
1832
|
-
const handleAction =
|
|
1980
|
+
const handleAction = React4__namespace.useCallback(
|
|
1833
1981
|
() => resolve(RESULT.ACTION),
|
|
1834
1982
|
[resolve]
|
|
1835
1983
|
);
|
|
1836
|
-
const handleDismiss =
|
|
1984
|
+
const handleDismiss = React4__namespace.useCallback(
|
|
1837
1985
|
() => resolve(RESULT.DISMISSED),
|
|
1838
1986
|
[resolve]
|
|
1839
1987
|
);
|
|
@@ -1901,7 +2049,7 @@ var Snackbar = React11__namespace.memo(function Snackbar2({
|
|
|
1901
2049
|
Snackbar.displayName = "Snackbar";
|
|
1902
2050
|
function SnackbarHost({ state, className }) {
|
|
1903
2051
|
const { current, _dismiss } = state;
|
|
1904
|
-
const wrappedData =
|
|
2052
|
+
const wrappedData = React4__namespace.useMemo(() => {
|
|
1905
2053
|
if (!current) return null;
|
|
1906
2054
|
return __spreadProps(__spreadValues({}, current), { resolve: _dismiss });
|
|
1907
2055
|
}, [current, _dismiss]);
|
|
@@ -1919,7 +2067,7 @@ function SnackbarHost({ state, className }) {
|
|
|
1919
2067
|
) });
|
|
1920
2068
|
}
|
|
1921
2069
|
SnackbarHost.displayName = "SnackbarHost";
|
|
1922
|
-
var SnackbarContext =
|
|
2070
|
+
var SnackbarContext = React4__namespace.createContext(
|
|
1923
2071
|
null
|
|
1924
2072
|
);
|
|
1925
2073
|
|
|
@@ -2601,8 +2749,8 @@ var TOKEN_TO_PROP = {
|
|
|
2601
2749
|
};
|
|
2602
2750
|
var defaultTokens = new TypographyTokens();
|
|
2603
2751
|
var defaultTypography = new Typography();
|
|
2604
|
-
var TypographyContext =
|
|
2605
|
-
var ThemeContext =
|
|
2752
|
+
var TypographyContext = React4.createContext(defaultTypography);
|
|
2753
|
+
var ThemeContext = React4.createContext(void 0);
|
|
2606
2754
|
var STORAGE_KEY_COLOR = "md3-source-color";
|
|
2607
2755
|
var STORAGE_KEY_MODE = "md3-theme-mode";
|
|
2608
2756
|
var defaultTokens2 = new TypographyTokens();
|
|
@@ -2619,11 +2767,11 @@ function MD3ThemeProvider({
|
|
|
2619
2767
|
fontVariationAxes,
|
|
2620
2768
|
enableSnackbar = false
|
|
2621
2769
|
}) {
|
|
2622
|
-
const [sourceColor, setSourceColor] =
|
|
2623
|
-
const [mode, setMode] =
|
|
2624
|
-
const [isHydrated, setIsHydrated] =
|
|
2625
|
-
const [systemMode, setSystemMode] =
|
|
2626
|
-
|
|
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(() => {
|
|
2627
2775
|
if (typeof window === "undefined") return;
|
|
2628
2776
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2629
2777
|
const updateSystemMode = () => {
|
|
@@ -2633,7 +2781,7 @@ function MD3ThemeProvider({
|
|
|
2633
2781
|
mediaQuery.addEventListener("change", updateSystemMode);
|
|
2634
2782
|
return () => mediaQuery.removeEventListener("change", updateSystemMode);
|
|
2635
2783
|
}, []);
|
|
2636
|
-
|
|
2784
|
+
React4.useEffect(() => {
|
|
2637
2785
|
if (!persistToLocalStorage) return;
|
|
2638
2786
|
const savedColor = localStorage.getItem(STORAGE_KEY_COLOR);
|
|
2639
2787
|
const savedMode = localStorage.getItem(
|
|
@@ -2645,7 +2793,7 @@ function MD3ThemeProvider({
|
|
|
2645
2793
|
setIsHydrated(true);
|
|
2646
2794
|
}, [persistToLocalStorage]);
|
|
2647
2795
|
const effectiveMode = mode === "system" ? systemMode : mode;
|
|
2648
|
-
|
|
2796
|
+
React4.useEffect(() => {
|
|
2649
2797
|
if (!isHydrated) return;
|
|
2650
2798
|
applyTheme(sourceColor, effectiveMode, document.documentElement, {
|
|
2651
2799
|
variant,
|
|
@@ -2664,7 +2812,7 @@ function MD3ThemeProvider({
|
|
|
2664
2812
|
variant,
|
|
2665
2813
|
contrastLevel
|
|
2666
2814
|
]);
|
|
2667
|
-
const themeValue =
|
|
2815
|
+
const themeValue = React4.useMemo(
|
|
2668
2816
|
() => ({
|
|
2669
2817
|
sourceColor,
|
|
2670
2818
|
setSourceColor,
|
|
@@ -2676,7 +2824,7 @@ function MD3ThemeProvider({
|
|
|
2676
2824
|
}),
|
|
2677
2825
|
[sourceColor, mode, effectiveMode, variant, contrastLevel]
|
|
2678
2826
|
);
|
|
2679
|
-
const typographyValue =
|
|
2827
|
+
const typographyValue = React4.useMemo(() => {
|
|
2680
2828
|
if (typographyProp) return typographyProp;
|
|
2681
2829
|
if (fontFamily != null ? fontFamily : fontVariationAxes) {
|
|
2682
2830
|
return new Typography(
|
|
@@ -2689,7 +2837,7 @@ function MD3ThemeProvider({
|
|
|
2689
2837
|
}
|
|
2690
2838
|
function SnackbarMountedProvider({ children }) {
|
|
2691
2839
|
const state = useSnackbarState();
|
|
2692
|
-
const contextValue =
|
|
2840
|
+
const contextValue = React4.useMemo(
|
|
2693
2841
|
() => ({ showSnackbar: state.showSnackbar }),
|
|
2694
2842
|
[state.showSnackbar]
|
|
2695
2843
|
);
|
|
@@ -2699,7 +2847,7 @@ function SnackbarMountedProvider({ children }) {
|
|
|
2699
2847
|
] });
|
|
2700
2848
|
}
|
|
2701
2849
|
function useTheme() {
|
|
2702
|
-
const context =
|
|
2850
|
+
const context = React4.useContext(ThemeContext);
|
|
2703
2851
|
if (!context) {
|
|
2704
2852
|
throw new Error("useTheme must be used within <MD3ThemeProvider>.");
|
|
2705
2853
|
}
|