@bug-on/m3-expressive 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/buttons.js +220 -72
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +221 -73
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +297 -149
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +280 -132
- 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 +308 -160
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +286 -138
- package/dist/feedback.mjs.map +1 -1
- package/dist/index.js +220 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +221 -73
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +220 -72
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +221 -73
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.js +220 -72
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +221 -73
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +351 -203
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +314 -166
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +359 -211
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +327 -179
- package/dist/pickers.mjs.map +1 -1
- package/package.json +1 -1
package/dist/pickers.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { m, LazyMotion, domMax, useMotionValue, animate,
|
|
3
|
-
import * as
|
|
2
|
+
import { m, useAnimationFrame, LazyMotion, domMax, useMotionValue, animate, AnimatePresence, useReducedMotion } from 'motion/react';
|
|
3
|
+
import * as React6 from 'react';
|
|
4
4
|
import { useState, useCallback, useMemo, useReducer } from 'react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -261,13 +261,13 @@ var DatePickerInput = ({
|
|
|
261
261
|
locale,
|
|
262
262
|
className
|
|
263
263
|
}) => {
|
|
264
|
-
const inputId =
|
|
264
|
+
const inputId = React6.useId();
|
|
265
265
|
const errorId = `${inputId}-error`;
|
|
266
|
-
const placeholder =
|
|
266
|
+
const placeholder = React6.useMemo(() => {
|
|
267
267
|
if (locale == null ? void 0 : locale.startsWith("vi")) return "DD/MM/YYYY";
|
|
268
268
|
return "MM/DD/YYYY";
|
|
269
269
|
}, [locale]);
|
|
270
|
-
const handleKeyDown =
|
|
270
|
+
const handleKeyDown = React6.useCallback(
|
|
271
271
|
(e) => {
|
|
272
272
|
if (e.key === "Enter") {
|
|
273
273
|
const parsed = parseDateInput(value);
|
|
@@ -276,11 +276,11 @@ var DatePickerInput = ({
|
|
|
276
276
|
},
|
|
277
277
|
[value, onCommit]
|
|
278
278
|
);
|
|
279
|
-
const handleBlur =
|
|
279
|
+
const handleBlur = React6.useCallback(() => {
|
|
280
280
|
const parsed = parseDateInput(value);
|
|
281
281
|
onCommit(parsed);
|
|
282
282
|
}, [value, onCommit]);
|
|
283
|
-
const handleChange =
|
|
283
|
+
const handleChange = React6.useCallback(
|
|
284
284
|
(e) => {
|
|
285
285
|
let raw = e.target.value.replace(/\D/g, "");
|
|
286
286
|
if (raw.length > 8) raw = raw.slice(0, 8);
|
|
@@ -374,11 +374,11 @@ var DayCell = ({
|
|
|
374
374
|
// Disabled
|
|
375
375
|
isDisabled && "opacity-[0.38]"
|
|
376
376
|
);
|
|
377
|
-
const handleClick =
|
|
377
|
+
const handleClick = React6.useCallback(() => {
|
|
378
378
|
if (isDisabled) return;
|
|
379
379
|
onSelect(utcMs);
|
|
380
380
|
}, [isDisabled, utcMs, onSelect]);
|
|
381
|
-
const handleKeyDown =
|
|
381
|
+
const handleKeyDown = React6.useCallback(
|
|
382
382
|
(e) => {
|
|
383
383
|
if (e.key === "Enter" || e.key === " ") {
|
|
384
384
|
e.preventDefault();
|
|
@@ -414,7 +414,7 @@ var DayCell = ({
|
|
|
414
414
|
};
|
|
415
415
|
DayCell.displayName = "DayCell";
|
|
416
416
|
var WeekdayRow = ({ locale }) => {
|
|
417
|
-
const names =
|
|
417
|
+
const names = React6.useMemo(() => getWeekdayNames(locale), [locale]);
|
|
418
418
|
return /* @__PURE__ */ jsx("tr", { className: "grid grid-cols-7 mb-1", children: names.map((name, i) => /* @__PURE__ */ jsx(
|
|
419
419
|
"th",
|
|
420
420
|
{
|
|
@@ -441,7 +441,7 @@ var CalendarGrid = ({
|
|
|
441
441
|
const d = new Date(displayedMonthMs);
|
|
442
442
|
const year = d.getUTCFullYear();
|
|
443
443
|
const month = d.getUTCMonth();
|
|
444
|
-
const weeks =
|
|
444
|
+
const weeks = React6.useMemo(
|
|
445
445
|
() => getWeeksInMonth(year, month, locale.weekStartsOn),
|
|
446
446
|
[year, month, locale.weekStartsOn]
|
|
447
447
|
);
|
|
@@ -543,11 +543,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
543
543
|
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";
|
|
544
544
|
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";
|
|
545
545
|
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";
|
|
546
|
-
var IndeterminateSvg =
|
|
546
|
+
var IndeterminateSvg = React6.memo(function IndeterminateSvg2({
|
|
547
547
|
size
|
|
548
548
|
}) {
|
|
549
|
-
const [ready, setReady] =
|
|
550
|
-
|
|
549
|
+
const [ready, setReady] = React6.useState(false);
|
|
550
|
+
React6.useEffect(() => {
|
|
551
551
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
552
552
|
return () => cancelAnimationFrame(raf);
|
|
553
553
|
}, []);
|
|
@@ -592,7 +592,7 @@ var IndeterminateSvg = React13.memo(function IndeterminateSvg2({
|
|
|
592
592
|
}
|
|
593
593
|
);
|
|
594
594
|
});
|
|
595
|
-
var DeterminateSvg =
|
|
595
|
+
var DeterminateSvg = React6.memo(function DeterminateSvg2({
|
|
596
596
|
size,
|
|
597
597
|
progress
|
|
598
598
|
}) {
|
|
@@ -617,7 +617,7 @@ var DeterminateSvg = React13.memo(function DeterminateSvg2({
|
|
|
617
617
|
}
|
|
618
618
|
);
|
|
619
619
|
});
|
|
620
|
-
var LoadingIndicator =
|
|
620
|
+
var LoadingIndicator = React6.forwardRef(
|
|
621
621
|
(_a, ref) => {
|
|
622
622
|
var _b = _a, {
|
|
623
623
|
variant = "uncontained",
|
|
@@ -712,7 +712,7 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
712
712
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
713
713
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
714
714
|
}
|
|
715
|
-
return d
|
|
715
|
+
return `${d} Z`;
|
|
716
716
|
}
|
|
717
717
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
718
718
|
if (startX >= endX) return "";
|
|
@@ -744,7 +744,15 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
744
744
|
}
|
|
745
745
|
return d;
|
|
746
746
|
}
|
|
747
|
-
var
|
|
747
|
+
var GLOBAL_ROTATION_DURATION = 6e3;
|
|
748
|
+
var GLOBAL_ROTATION_TARGET = 1080;
|
|
749
|
+
var ADDITIONAL_ROTATION_CYCLE = 1500;
|
|
750
|
+
var ADDITIONAL_ROTATION_STEP = 90;
|
|
751
|
+
var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
752
|
+
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
753
|
+
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
754
|
+
var PROGRESS_CYCLE_DURATION = 1500;
|
|
755
|
+
var CircularProgress = React6.forwardRef(
|
|
748
756
|
(_a, ref) => {
|
|
749
757
|
var _b = _a, {
|
|
750
758
|
value,
|
|
@@ -757,6 +765,10 @@ var CircularProgress = React13.forwardRef(
|
|
|
757
765
|
crawlerSpeed = 1,
|
|
758
766
|
color,
|
|
759
767
|
trackColor,
|
|
768
|
+
showTrack = "auto",
|
|
769
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
770
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
771
|
+
amplitudeRange,
|
|
760
772
|
className,
|
|
761
773
|
"aria-label": ariaLabel
|
|
762
774
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -770,6 +782,10 @@ var CircularProgress = React13.forwardRef(
|
|
|
770
782
|
"crawlerSpeed",
|
|
771
783
|
"color",
|
|
772
784
|
"trackColor",
|
|
785
|
+
"showTrack",
|
|
786
|
+
"minProgress",
|
|
787
|
+
"maxProgress",
|
|
788
|
+
"amplitudeRange",
|
|
773
789
|
"className",
|
|
774
790
|
"aria-label"
|
|
775
791
|
]);
|
|
@@ -780,17 +796,22 @@ var CircularProgress = React13.forwardRef(
|
|
|
780
796
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
781
797
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
782
798
|
const isWavy = shape === "wavy";
|
|
799
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
783
800
|
const BASELINE_SIZE = 48;
|
|
784
801
|
const scaleFactor = size / BASELINE_SIZE;
|
|
785
|
-
const effectiveAmplitude =
|
|
802
|
+
const effectiveAmplitude = React6.useMemo(
|
|
786
803
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
787
804
|
[amplitude, scaleFactor]
|
|
788
805
|
);
|
|
789
|
-
const effectiveWavelength =
|
|
806
|
+
const effectiveWavelength = React6.useMemo(
|
|
790
807
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
791
808
|
[wavelength, scaleFactor]
|
|
792
809
|
);
|
|
793
|
-
const
|
|
810
|
+
const resolvedAmplitudeRange = React6.useMemo(
|
|
811
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
812
|
+
[amplitudeRange, effectiveAmplitude]
|
|
813
|
+
);
|
|
814
|
+
const wavyActivePath = React6.useMemo(
|
|
794
815
|
() => isWavy ? generateWavyCircularPath(
|
|
795
816
|
center,
|
|
796
817
|
radius,
|
|
@@ -799,8 +820,8 @@ var CircularProgress = React13.forwardRef(
|
|
|
799
820
|
) : null,
|
|
800
821
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
801
822
|
);
|
|
802
|
-
const circumference =
|
|
803
|
-
const gapForTrack =
|
|
823
|
+
const circumference = React6.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
824
|
+
const gapForTrack = React6.useMemo(
|
|
804
825
|
() => (gapSize + trackHeight) / circumference,
|
|
805
826
|
[gapSize, trackHeight, circumference]
|
|
806
827
|
);
|
|
@@ -809,6 +830,145 @@ var CircularProgress = React13.forwardRef(
|
|
|
809
830
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
810
831
|
const ActiveCircleElem = m.circle;
|
|
811
832
|
const ActivePathElem = m.path;
|
|
833
|
+
const indeterminateSvgRef = React6.useRef(null);
|
|
834
|
+
const indeterminateTrackRef = React6.useRef(null);
|
|
835
|
+
const indeterminateActiveRef = React6.useRef(null);
|
|
836
|
+
const indeterminateWavyTrackPathRef = React6.useRef(null);
|
|
837
|
+
const indeterminateWavyActivePathRef = React6.useRef(null);
|
|
838
|
+
const cachedPathLengthRef = React6.useRef(0);
|
|
839
|
+
React6.useLayoutEffect(() => {
|
|
840
|
+
if (!isWavy || !wavyActivePath) {
|
|
841
|
+
cachedPathLengthRef.current = circumference;
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
const el = indeterminateActiveRef.current;
|
|
845
|
+
if (el && "getTotalLength" in el) {
|
|
846
|
+
try {
|
|
847
|
+
const len = el.getTotalLength();
|
|
848
|
+
if (len > 0) {
|
|
849
|
+
cachedPathLengthRef.current = len;
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
} catch (e) {
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
cachedPathLengthRef.current = circumference;
|
|
856
|
+
}, [isWavy, circumference, wavyActivePath]);
|
|
857
|
+
useAnimationFrame((time) => {
|
|
858
|
+
if (isDeterminate) return;
|
|
859
|
+
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
860
|
+
const scaledTime = time * safeCrawlerSpeed;
|
|
861
|
+
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
862
|
+
const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
|
|
863
|
+
const additionalFullCycles = Math.floor(
|
|
864
|
+
scaledTime / ADDITIONAL_ROTATION_CYCLE
|
|
865
|
+
);
|
|
866
|
+
const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
|
|
867
|
+
const additionalEaseT = Math.min(
|
|
868
|
+
1,
|
|
869
|
+
additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
|
|
870
|
+
);
|
|
871
|
+
const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
|
|
872
|
+
const totalRotation = globalAngle + additionalAngle;
|
|
873
|
+
if (indeterminateSvgRef.current) {
|
|
874
|
+
indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
|
|
875
|
+
}
|
|
876
|
+
const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
|
|
877
|
+
const progressCycleTime = scaledTime % progressFullCycle;
|
|
878
|
+
let progress;
|
|
879
|
+
if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
|
|
880
|
+
const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
|
|
881
|
+
progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
|
|
882
|
+
} else {
|
|
883
|
+
const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
|
|
884
|
+
progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
|
|
885
|
+
}
|
|
886
|
+
if (isWavy) {
|
|
887
|
+
const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
|
|
888
|
+
const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
|
|
889
|
+
const dynamicPath = generateWavyCircularPath(
|
|
890
|
+
center,
|
|
891
|
+
radius,
|
|
892
|
+
currentAmplitude,
|
|
893
|
+
effectiveWavelength
|
|
894
|
+
);
|
|
895
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
896
|
+
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
897
|
+
}
|
|
898
|
+
if (indeterminateWavyTrackPathRef.current) {
|
|
899
|
+
indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
900
|
+
}
|
|
901
|
+
const pathEl = indeterminateWavyActivePathRef.current;
|
|
902
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
903
|
+
if (pathEl) {
|
|
904
|
+
try {
|
|
905
|
+
const len = pathEl.getTotalLength();
|
|
906
|
+
if (len > 0) totalLen = len;
|
|
907
|
+
} catch (e) {
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
911
|
+
const activeLen = totalLen * progress;
|
|
912
|
+
const activeOff = 0;
|
|
913
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
914
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
915
|
+
"stroke-dasharray",
|
|
916
|
+
`${activeLen} ${totalLen}`
|
|
917
|
+
);
|
|
918
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
919
|
+
"stroke-dashoffset",
|
|
920
|
+
`${activeOff}`
|
|
921
|
+
);
|
|
922
|
+
}
|
|
923
|
+
if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
|
|
924
|
+
const trackStartFrac = progress + gapFrac;
|
|
925
|
+
const trackLen = Math.max(
|
|
926
|
+
1e-3,
|
|
927
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
928
|
+
);
|
|
929
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
930
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
931
|
+
"stroke-dasharray",
|
|
932
|
+
`${trackLen} ${totalLen}`
|
|
933
|
+
);
|
|
934
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
935
|
+
"stroke-dashoffset",
|
|
936
|
+
`${trackOff}`
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
} else {
|
|
940
|
+
const totalLen = circumference;
|
|
941
|
+
const activeLen = totalLen * progress;
|
|
942
|
+
const activeOff = 0;
|
|
943
|
+
if (indeterminateActiveRef.current) {
|
|
944
|
+
indeterminateActiveRef.current.setAttribute(
|
|
945
|
+
"stroke-dasharray",
|
|
946
|
+
`${activeLen} ${totalLen}`
|
|
947
|
+
);
|
|
948
|
+
indeterminateActiveRef.current.setAttribute(
|
|
949
|
+
"stroke-dashoffset",
|
|
950
|
+
`${activeOff}`
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
|
|
954
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
955
|
+
const trackStartFrac = progress + gapFrac;
|
|
956
|
+
const trackLen = Math.max(
|
|
957
|
+
1e-3,
|
|
958
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
959
|
+
);
|
|
960
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
961
|
+
indeterminateTrackRef.current.setAttribute(
|
|
962
|
+
"stroke-dasharray",
|
|
963
|
+
`${trackLen} ${totalLen}`
|
|
964
|
+
);
|
|
965
|
+
indeterminateTrackRef.current.setAttribute(
|
|
966
|
+
"stroke-dashoffset",
|
|
967
|
+
`${trackOff}`
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
});
|
|
812
972
|
return /* @__PURE__ */ jsx(
|
|
813
973
|
"div",
|
|
814
974
|
__spreadProps(__spreadValues({
|
|
@@ -885,9 +1045,10 @@ var CircularProgress = React13.forwardRef(
|
|
|
885
1045
|
]
|
|
886
1046
|
}
|
|
887
1047
|
),
|
|
888
|
-
!isDeterminate && /* @__PURE__ */
|
|
889
|
-
|
|
1048
|
+
!isDeterminate && /* @__PURE__ */ jsx(
|
|
1049
|
+
"svg",
|
|
890
1050
|
{
|
|
1051
|
+
ref: indeterminateSvgRef,
|
|
891
1052
|
width: size,
|
|
892
1053
|
height: size,
|
|
893
1054
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -896,84 +1057,60 @@ var CircularProgress = React13.forwardRef(
|
|
|
896
1057
|
position: "absolute",
|
|
897
1058
|
inset: 0,
|
|
898
1059
|
overflow: "visible",
|
|
899
|
-
transformOrigin: "center"
|
|
900
|
-
|
|
901
|
-
animate: { rotate: [0, 360] },
|
|
902
|
-
transition: {
|
|
903
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
904
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
905
|
-
ease: "linear"
|
|
1060
|
+
transformOrigin: "center",
|
|
1061
|
+
transform: "rotate(-90deg)"
|
|
906
1062
|
},
|
|
907
|
-
children: [
|
|
908
|
-
/* @__PURE__ */ jsx(
|
|
909
|
-
|
|
1063
|
+
children: isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1064
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
|
|
1065
|
+
"path",
|
|
910
1066
|
{
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
r: radius,
|
|
1067
|
+
ref: indeterminateWavyTrackPathRef,
|
|
1068
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
914
1069
|
fill: "none",
|
|
915
1070
|
stroke: bgTrackColor,
|
|
916
1071
|
strokeWidth: trackHeight,
|
|
917
|
-
strokeLinecap: "round"
|
|
918
|
-
animate: {
|
|
919
|
-
pathLength: [
|
|
920
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
921
|
-
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
922
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
923
|
-
],
|
|
924
|
-
pathOffset: [
|
|
925
|
-
0.1 + gapForTrack,
|
|
926
|
-
0.75 + gapForTrack,
|
|
927
|
-
0.1 + gapForTrack
|
|
928
|
-
]
|
|
929
|
-
},
|
|
930
|
-
transition: {
|
|
931
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
932
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
933
|
-
ease: [0.4, 0, 0.2, 1]
|
|
934
|
-
}
|
|
1072
|
+
strokeLinecap: "round"
|
|
935
1073
|
}
|
|
936
1074
|
),
|
|
937
|
-
|
|
938
|
-
|
|
1075
|
+
/* @__PURE__ */ jsx(
|
|
1076
|
+
"path",
|
|
939
1077
|
{
|
|
1078
|
+
ref: indeterminateWavyActivePathRef,
|
|
940
1079
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
941
1080
|
fill: "none",
|
|
942
1081
|
stroke: activeColor,
|
|
943
1082
|
strokeWidth: trackHeight,
|
|
944
|
-
strokeLinecap: "round"
|
|
945
|
-
animate: {
|
|
946
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
947
|
-
pathOffset: [0, 0.65, 1]
|
|
948
|
-
},
|
|
949
|
-
transition: {
|
|
950
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
951
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
952
|
-
ease: [0.4, 0, 0.2, 1]
|
|
953
|
-
}
|
|
1083
|
+
strokeLinecap: "round"
|
|
954
1084
|
}
|
|
955
|
-
)
|
|
956
|
-
|
|
1085
|
+
)
|
|
1086
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1087
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
|
|
1088
|
+
"circle",
|
|
1089
|
+
{
|
|
1090
|
+
ref: indeterminateTrackRef,
|
|
1091
|
+
cx: center,
|
|
1092
|
+
cy: center,
|
|
1093
|
+
r: radius,
|
|
1094
|
+
fill: "none",
|
|
1095
|
+
stroke: bgTrackColor,
|
|
1096
|
+
strokeWidth: trackHeight,
|
|
1097
|
+
strokeLinecap: "round"
|
|
1098
|
+
}
|
|
1099
|
+
),
|
|
1100
|
+
/* @__PURE__ */ jsx(
|
|
1101
|
+
"circle",
|
|
957
1102
|
{
|
|
1103
|
+
ref: indeterminateActiveRef,
|
|
958
1104
|
cx: center,
|
|
959
1105
|
cy: center,
|
|
960
1106
|
r: radius,
|
|
961
1107
|
fill: "none",
|
|
962
1108
|
stroke: activeColor,
|
|
963
1109
|
strokeWidth: trackHeight,
|
|
964
|
-
strokeLinecap: "round"
|
|
965
|
-
animate: {
|
|
966
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
967
|
-
pathOffset: [0, 0.65, 1]
|
|
968
|
-
},
|
|
969
|
-
transition: {
|
|
970
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
971
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
972
|
-
ease: [0.4, 0, 0.2, 1]
|
|
973
|
-
}
|
|
1110
|
+
strokeLinecap: "round"
|
|
974
1111
|
}
|
|
975
1112
|
)
|
|
976
|
-
]
|
|
1113
|
+
] })
|
|
977
1114
|
}
|
|
978
1115
|
)
|
|
979
1116
|
] })
|
|
@@ -983,9 +1120,9 @@ var CircularProgress = React13.forwardRef(
|
|
|
983
1120
|
);
|
|
984
1121
|
CircularProgress.displayName = "CircularProgress";
|
|
985
1122
|
function useContainerWidth() {
|
|
986
|
-
const [width, setWidth] =
|
|
987
|
-
const observerRef =
|
|
988
|
-
const ref =
|
|
1123
|
+
const [width, setWidth] = React6.useState(0);
|
|
1124
|
+
const observerRef = React6.useRef(null);
|
|
1125
|
+
const ref = React6.useCallback((node) => {
|
|
989
1126
|
if (observerRef.current) {
|
|
990
1127
|
observerRef.current.disconnect();
|
|
991
1128
|
observerRef.current = null;
|
|
@@ -999,7 +1136,7 @@ function useContainerWidth() {
|
|
|
999
1136
|
observerRef.current = obs;
|
|
1000
1137
|
}
|
|
1001
1138
|
}, []);
|
|
1002
|
-
|
|
1139
|
+
React6.useEffect(() => {
|
|
1003
1140
|
return () => {
|
|
1004
1141
|
if (observerRef.current) {
|
|
1005
1142
|
observerRef.current.disconnect();
|
|
@@ -1009,7 +1146,7 @@ function useContainerWidth() {
|
|
|
1009
1146
|
return [ref, width];
|
|
1010
1147
|
}
|
|
1011
1148
|
function useMergedRef(...refs) {
|
|
1012
|
-
return
|
|
1149
|
+
return React6.useCallback(
|
|
1013
1150
|
(node) => {
|
|
1014
1151
|
for (const ref of refs) {
|
|
1015
1152
|
if (typeof ref === "function") {
|
|
@@ -1023,7 +1160,7 @@ function useMergedRef(...refs) {
|
|
|
1023
1160
|
[refs]
|
|
1024
1161
|
);
|
|
1025
1162
|
}
|
|
1026
|
-
var FlatLinearTrack =
|
|
1163
|
+
var FlatLinearTrack = React6.memo(function FlatLinearTrack2({
|
|
1027
1164
|
trackHeight,
|
|
1028
1165
|
activeColor,
|
|
1029
1166
|
trackColor,
|
|
@@ -1099,7 +1236,7 @@ var FlatLinearTrack = React13.memo(function FlatLinearTrack2({
|
|
|
1099
1236
|
}
|
|
1100
1237
|
);
|
|
1101
1238
|
});
|
|
1102
|
-
var WavyLinearTrack =
|
|
1239
|
+
var WavyLinearTrack = React6.memo(function WavyLinearTrack2({
|
|
1103
1240
|
trackHeight,
|
|
1104
1241
|
svgHeight,
|
|
1105
1242
|
amplitude,
|
|
@@ -1118,13 +1255,13 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1118
1255
|
}) {
|
|
1119
1256
|
const isDeterminate = typeof value === "number";
|
|
1120
1257
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1121
|
-
const titleId =
|
|
1258
|
+
const titleId = React6.useId();
|
|
1122
1259
|
const [containerRef, width] = useContainerWidth();
|
|
1123
|
-
const activePathRef =
|
|
1124
|
-
const trackPathRef =
|
|
1260
|
+
const activePathRef = React6.useRef(null);
|
|
1261
|
+
const trackPathRef = React6.useRef(null);
|
|
1125
1262
|
const amplitudeMV = useMotionValue(amplitude);
|
|
1126
1263
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1127
|
-
|
|
1264
|
+
React6.useEffect(() => {
|
|
1128
1265
|
if (isDeterminate) {
|
|
1129
1266
|
const fraction = clampedValue / 100;
|
|
1130
1267
|
let targetAmp = amplitude;
|
|
@@ -1179,7 +1316,7 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1179
1316
|
currentAmp
|
|
1180
1317
|
);
|
|
1181
1318
|
} else if (fraction === 0) {
|
|
1182
|
-
activePathD =
|
|
1319
|
+
activePathD = "";
|
|
1183
1320
|
}
|
|
1184
1321
|
const trackStart = adjHead + totalGap;
|
|
1185
1322
|
if (trackStart < width - capWidth) {
|
|
@@ -1211,20 +1348,20 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1211
1348
|
activeLines.push({ tail: l1T, head: l1H });
|
|
1212
1349
|
activeLines.push({ tail: l2T, head: l2H });
|
|
1213
1350
|
}
|
|
1214
|
-
const
|
|
1215
|
-
const
|
|
1216
|
-
const
|
|
1351
|
+
const activeSegments = activeLines.map((line) => {
|
|
1352
|
+
const rawTail = line.tail * width;
|
|
1353
|
+
const rawHead = line.head * width;
|
|
1217
1354
|
const adjTail = Math.max(
|
|
1218
1355
|
capWidth,
|
|
1219
|
-
Math.min(width - capWidth,
|
|
1356
|
+
Math.min(width - capWidth, rawTail)
|
|
1220
1357
|
);
|
|
1221
1358
|
const adjHead = Math.max(
|
|
1222
1359
|
capWidth,
|
|
1223
|
-
Math.min(width - capWidth,
|
|
1360
|
+
Math.min(width - capWidth, rawHead)
|
|
1224
1361
|
);
|
|
1225
1362
|
return { adjTail, adjHead };
|
|
1226
1363
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
1227
|
-
activePathD =
|
|
1364
|
+
activePathD = activeSegments.map(
|
|
1228
1365
|
(seg) => getSinePath(
|
|
1229
1366
|
seg.adjTail,
|
|
1230
1367
|
seg.adjHead,
|
|
@@ -1233,13 +1370,24 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1233
1370
|
currentAmp
|
|
1234
1371
|
)
|
|
1235
1372
|
).join(" ");
|
|
1373
|
+
const validActiveLines = activeLines.filter(
|
|
1374
|
+
(line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
|
|
1375
|
+
).sort((a, b) => a.tail - b.tail);
|
|
1236
1376
|
let currentTrackX = capWidth;
|
|
1237
|
-
for (const
|
|
1238
|
-
const
|
|
1377
|
+
for (const line of validActiveLines) {
|
|
1378
|
+
const blockStart = line.tail * width - totalGap;
|
|
1379
|
+
const blockEnd = line.head * width + totalGap;
|
|
1380
|
+
const trackEnd = Math.min(width - capWidth, blockStart);
|
|
1239
1381
|
if (trackEnd > currentTrackX) {
|
|
1240
|
-
trackD += `${getSinePath(
|
|
1382
|
+
trackD += `${getSinePath(
|
|
1383
|
+
currentTrackX,
|
|
1384
|
+
trackEnd,
|
|
1385
|
+
phase,
|
|
1386
|
+
activeWavelength,
|
|
1387
|
+
trackAmp
|
|
1388
|
+
)} `;
|
|
1241
1389
|
}
|
|
1242
|
-
currentTrackX = Math.max(currentTrackX,
|
|
1390
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
1243
1391
|
}
|
|
1244
1392
|
if (currentTrackX < width - capWidth) {
|
|
1245
1393
|
trackD += getSinePath(
|
|
@@ -1252,9 +1400,9 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1252
1400
|
}
|
|
1253
1401
|
}
|
|
1254
1402
|
if (activePathRef.current)
|
|
1255
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
1403
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
1256
1404
|
if (trackPathRef.current)
|
|
1257
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
1405
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
1258
1406
|
});
|
|
1259
1407
|
return /* @__PURE__ */ jsx(
|
|
1260
1408
|
"div",
|
|
@@ -1301,7 +1449,7 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1301
1449
|
}
|
|
1302
1450
|
);
|
|
1303
1451
|
});
|
|
1304
|
-
var LinearProgress =
|
|
1452
|
+
var LinearProgress = React6.forwardRef(
|
|
1305
1453
|
(_a, ref) => {
|
|
1306
1454
|
var _b = _a, {
|
|
1307
1455
|
value,
|
|
@@ -1342,10 +1490,10 @@ var LinearProgress = React13.forwardRef(
|
|
|
1342
1490
|
]);
|
|
1343
1491
|
const isDeterminate = value !== void 0;
|
|
1344
1492
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1345
|
-
const containerRef =
|
|
1493
|
+
const containerRef = React6.useRef(null);
|
|
1346
1494
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1347
|
-
const [isRtl, setIsRtl] =
|
|
1348
|
-
|
|
1495
|
+
const [isRtl, setIsRtl] = React6.useState(false);
|
|
1496
|
+
React6.useEffect(() => {
|
|
1349
1497
|
if (containerRef.current) {
|
|
1350
1498
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1351
1499
|
setIsRtl(dir === "rtl");
|
|
@@ -1353,16 +1501,16 @@ var LinearProgress = React13.forwardRef(
|
|
|
1353
1501
|
}, []);
|
|
1354
1502
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1355
1503
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1356
|
-
const effectiveAmplitude =
|
|
1357
|
-
const svgHeight =
|
|
1504
|
+
const effectiveAmplitude = React6.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1505
|
+
const svgHeight = React6.useMemo(
|
|
1358
1506
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1359
1507
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1360
1508
|
);
|
|
1361
|
-
const shouldShowStop =
|
|
1509
|
+
const shouldShowStop = React6.useMemo(
|
|
1362
1510
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1363
1511
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1364
1512
|
);
|
|
1365
|
-
const stopSize =
|
|
1513
|
+
const stopSize = React6.useMemo(
|
|
1366
1514
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1367
1515
|
[trackHeight]
|
|
1368
1516
|
);
|
|
@@ -1437,14 +1585,14 @@ var LinearProgress = React13.forwardRef(
|
|
|
1437
1585
|
}
|
|
1438
1586
|
);
|
|
1439
1587
|
LinearProgress.displayName = "LinearProgress";
|
|
1440
|
-
var ProgressIndicator =
|
|
1588
|
+
var ProgressIndicator = React6.forwardRef((props, ref) => {
|
|
1441
1589
|
if (props.variant === "circular") {
|
|
1442
1590
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1443
1591
|
}
|
|
1444
1592
|
return /* @__PURE__ */ jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
1445
1593
|
});
|
|
1446
1594
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
1447
|
-
var RippleItem =
|
|
1595
|
+
var RippleItem = React6.memo(function RippleItem2({
|
|
1448
1596
|
ripple,
|
|
1449
1597
|
onDone
|
|
1450
1598
|
}) {
|
|
@@ -1488,8 +1636,8 @@ function Ripple({
|
|
|
1488
1636
|
}
|
|
1489
1637
|
function useRippleState(options = {}) {
|
|
1490
1638
|
const { disabled = false } = options;
|
|
1491
|
-
const [ripples, setRipples] =
|
|
1492
|
-
const onPointerDown =
|
|
1639
|
+
const [ripples, setRipples] = React6.useState([]);
|
|
1640
|
+
const onPointerDown = React6.useCallback(
|
|
1493
1641
|
(e) => {
|
|
1494
1642
|
if (disabled) return;
|
|
1495
1643
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1506,7 +1654,7 @@ function useRippleState(options = {}) {
|
|
|
1506
1654
|
},
|
|
1507
1655
|
[disabled]
|
|
1508
1656
|
);
|
|
1509
|
-
const removeRipple =
|
|
1657
|
+
const removeRipple = React6.useCallback((id) => {
|
|
1510
1658
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1511
1659
|
}, []);
|
|
1512
1660
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1654,7 +1802,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1654
1802
|
}
|
|
1655
1803
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1656
1804
|
}
|
|
1657
|
-
var IconButtonComponent =
|
|
1805
|
+
var IconButtonComponent = React6.forwardRef(
|
|
1658
1806
|
(_a, ref) => {
|
|
1659
1807
|
var _b = _a, {
|
|
1660
1808
|
className,
|
|
@@ -1696,18 +1844,18 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1696
1844
|
var _a2, _b2, _c, _d, _e;
|
|
1697
1845
|
const isToggle = variant === "toggle";
|
|
1698
1846
|
const isSelected = isToggle && !!selected;
|
|
1699
|
-
const resolvedColorClass =
|
|
1847
|
+
const resolvedColorClass = React6.useMemo(
|
|
1700
1848
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1701
1849
|
[isSelected, colorStyle]
|
|
1702
1850
|
);
|
|
1703
|
-
const outlineWidthClass =
|
|
1851
|
+
const outlineWidthClass = React6.useMemo(
|
|
1704
1852
|
() => {
|
|
1705
1853
|
var _a3;
|
|
1706
1854
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1707
1855
|
},
|
|
1708
1856
|
[colorStyle, isSelected, size]
|
|
1709
1857
|
);
|
|
1710
|
-
const disabledBgClass =
|
|
1858
|
+
const disabledBgClass = React6.useMemo(
|
|
1711
1859
|
() => resolveDisabledBgClass(colorStyle),
|
|
1712
1860
|
[colorStyle]
|
|
1713
1861
|
);
|
|
@@ -1730,7 +1878,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1730
1878
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1731
1879
|
disabled: loading
|
|
1732
1880
|
});
|
|
1733
|
-
const handleClick =
|
|
1881
|
+
const handleClick = React6.useCallback(
|
|
1734
1882
|
(e) => {
|
|
1735
1883
|
if (loading) {
|
|
1736
1884
|
e.preventDefault();
|
|
@@ -1740,7 +1888,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1740
1888
|
},
|
|
1741
1889
|
[loading, onClick]
|
|
1742
1890
|
);
|
|
1743
|
-
const handleKeyDown =
|
|
1891
|
+
const handleKeyDown = React6.useCallback(
|
|
1744
1892
|
(e) => {
|
|
1745
1893
|
if (loading) return;
|
|
1746
1894
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1796,7 +1944,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1796
1944
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1797
1945
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1798
1946
|
},
|
|
1799
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
1947
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React6.Children.only(children).props.children : children
|
|
1800
1948
|
}),
|
|
1801
1949
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1802
1950
|
) })
|
|
@@ -1813,7 +1961,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1813
1961
|
className
|
|
1814
1962
|
);
|
|
1815
1963
|
if (asChild) {
|
|
1816
|
-
const child =
|
|
1964
|
+
const child = React6.Children.only(children);
|
|
1817
1965
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1818
1966
|
Slot,
|
|
1819
1967
|
__spreadProps(__spreadValues({
|
|
@@ -1830,7 +1978,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1830
1978
|
}),
|
|
1831
1979
|
className: containerClassName
|
|
1832
1980
|
}, restProps), {
|
|
1833
|
-
children:
|
|
1981
|
+
children: React6.cloneElement(child, { children: innerContent })
|
|
1834
1982
|
})
|
|
1835
1983
|
) });
|
|
1836
1984
|
}
|
|
@@ -1858,13 +2006,13 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1858
2006
|
}
|
|
1859
2007
|
);
|
|
1860
2008
|
IconButtonComponent.displayName = "IconButton";
|
|
1861
|
-
var IconButton =
|
|
2009
|
+
var IconButton = React6.memo(IconButtonComponent);
|
|
1862
2010
|
var VARIANT_FONT = {
|
|
1863
2011
|
outlined: "'Material Symbols Outlined'",
|
|
1864
2012
|
rounded: "'Material Symbols Rounded'",
|
|
1865
2013
|
sharp: "'Material Symbols Sharp'"
|
|
1866
2014
|
};
|
|
1867
|
-
var IconComponent =
|
|
2015
|
+
var IconComponent = React6.forwardRef(
|
|
1868
2016
|
(_a, ref) => {
|
|
1869
2017
|
var _b = _a, {
|
|
1870
2018
|
name,
|
|
@@ -1930,7 +2078,7 @@ var IconComponent = React13.forwardRef(
|
|
|
1930
2078
|
}
|
|
1931
2079
|
);
|
|
1932
2080
|
IconComponent.displayName = "Icon";
|
|
1933
|
-
var Icon =
|
|
2081
|
+
var Icon = React6.memo(IconComponent);
|
|
1934
2082
|
var selectorClassName = "flex items-center gap-1 rounded-m3-full px-2 py-1 text-[length:var(--md-typescale-title-small-size,14px)] font-[number:var(--md-typescale-title-small-weight,500)] text-m3-on-surface transition-m3-fast-effects hover:bg-m3-on-surface/8 focus-visible:outline-2 focus-visible:outline-m3-primary";
|
|
1935
2083
|
var CalendarHeader = ({
|
|
1936
2084
|
displayedMonthMs,
|
|
@@ -2088,15 +2236,15 @@ var MonthPickerList = ({
|
|
|
2088
2236
|
locale,
|
|
2089
2237
|
onMonthSelect
|
|
2090
2238
|
}) => {
|
|
2091
|
-
const selectedRef =
|
|
2092
|
-
|
|
2239
|
+
const selectedRef = React6.useRef(null);
|
|
2240
|
+
React6.useEffect(() => {
|
|
2093
2241
|
var _a, _b;
|
|
2094
2242
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2095
2243
|
block: "center",
|
|
2096
2244
|
behavior: "instant"
|
|
2097
2245
|
});
|
|
2098
2246
|
}, []);
|
|
2099
|
-
const months =
|
|
2247
|
+
const months = React6.useMemo(
|
|
2100
2248
|
() => Array.from({ length: 12 }, (_, month) => month),
|
|
2101
2249
|
[]
|
|
2102
2250
|
);
|
|
@@ -2141,12 +2289,12 @@ var YearPickerList = ({
|
|
|
2141
2289
|
selectableDates,
|
|
2142
2290
|
onYearSelect
|
|
2143
2291
|
}) => {
|
|
2144
|
-
const selectedRef =
|
|
2145
|
-
const years =
|
|
2292
|
+
const selectedRef = React6.useRef(null);
|
|
2293
|
+
const years = React6.useMemo(() => {
|
|
2146
2294
|
const [min, max] = yearRange;
|
|
2147
2295
|
return Array.from({ length: max - min + 1 }, (_, index) => min + index);
|
|
2148
2296
|
}, [yearRange]);
|
|
2149
|
-
|
|
2297
|
+
React6.useEffect(() => {
|
|
2150
2298
|
var _a, _b;
|
|
2151
2299
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2152
2300
|
block: "center",
|
|
@@ -2217,17 +2365,17 @@ var DatePicker = ({
|
|
|
2217
2365
|
navigateToMonth,
|
|
2218
2366
|
setDisplayMode
|
|
2219
2367
|
} = state;
|
|
2220
|
-
const [activeSelector, setActiveSelector] =
|
|
2221
|
-
const [slideDirection, setSlideDirection] =
|
|
2222
|
-
const handlePrev =
|
|
2368
|
+
const [activeSelector, setActiveSelector] = React6.useState(null);
|
|
2369
|
+
const [slideDirection, setSlideDirection] = React6.useState(null);
|
|
2370
|
+
const handlePrev = React6.useCallback(() => {
|
|
2223
2371
|
setSlideDirection("prev");
|
|
2224
2372
|
navigateMonth2("prev");
|
|
2225
2373
|
}, [navigateMonth2]);
|
|
2226
|
-
const handleNext =
|
|
2374
|
+
const handleNext = React6.useCallback(() => {
|
|
2227
2375
|
setSlideDirection("next");
|
|
2228
2376
|
navigateMonth2("next");
|
|
2229
2377
|
}, [navigateMonth2]);
|
|
2230
|
-
const handleYearSelect =
|
|
2378
|
+
const handleYearSelect = React6.useCallback(
|
|
2231
2379
|
(year) => {
|
|
2232
2380
|
const d = new Date(displayedMonthMs);
|
|
2233
2381
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2235,7 +2383,7 @@ var DatePicker = ({
|
|
|
2235
2383
|
},
|
|
2236
2384
|
[displayedMonthMs, navigateToMonth]
|
|
2237
2385
|
);
|
|
2238
|
-
const handleMonthSelect =
|
|
2386
|
+
const handleMonthSelect = React6.useCallback(
|
|
2239
2387
|
(month) => {
|
|
2240
2388
|
const d = new Date(displayedMonthMs);
|
|
2241
2389
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2243,11 +2391,11 @@ var DatePicker = ({
|
|
|
2243
2391
|
},
|
|
2244
2392
|
[displayedMonthMs, navigateToMonth]
|
|
2245
2393
|
);
|
|
2246
|
-
const [inputValue, setInputValue] =
|
|
2394
|
+
const [inputValue, setInputValue] = React6.useState(
|
|
2247
2395
|
() => selectedDateMs !== null ? formatInputDate(selectedDateMs) : ""
|
|
2248
2396
|
);
|
|
2249
|
-
const [inputError, setInputError] =
|
|
2250
|
-
const handleInputCommit =
|
|
2397
|
+
const [inputError, setInputError] = React6.useState();
|
|
2398
|
+
const handleInputCommit = React6.useCallback(
|
|
2251
2399
|
(ms) => {
|
|
2252
2400
|
if (ms === null && inputValue.length > 0) {
|
|
2253
2401
|
setInputError("Invalid date");
|
|
@@ -2487,7 +2635,7 @@ var DP_CLASSES = {
|
|
|
2487
2635
|
/** Weekday header row */
|
|
2488
2636
|
weekdayRow: "text-[length:var(--md-typescale-body-large-size,14px)] text-m3-on-surface"
|
|
2489
2637
|
};
|
|
2490
|
-
var ScrollArea =
|
|
2638
|
+
var ScrollArea = React6.forwardRef(
|
|
2491
2639
|
(_a, ref) => {
|
|
2492
2640
|
var _b = _a, {
|
|
2493
2641
|
className,
|
|
@@ -2508,15 +2656,15 @@ var ScrollArea = React13.forwardRef(
|
|
|
2508
2656
|
"viewportRef",
|
|
2509
2657
|
"viewportProps"
|
|
2510
2658
|
]);
|
|
2511
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
2512
|
-
|
|
2659
|
+
const [isTouchDevice, setIsTouchDevice] = React6.useState(false);
|
|
2660
|
+
React6.useEffect(() => {
|
|
2513
2661
|
if (typeof window !== "undefined") {
|
|
2514
2662
|
setIsTouchDevice(
|
|
2515
2663
|
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
2516
2664
|
);
|
|
2517
2665
|
}
|
|
2518
2666
|
}, []);
|
|
2519
|
-
const resolvedType =
|
|
2667
|
+
const resolvedType = React6.useMemo(() => {
|
|
2520
2668
|
if (type === "hover" && isTouchDevice) {
|
|
2521
2669
|
return "scroll";
|
|
2522
2670
|
}
|
|
@@ -2567,7 +2715,7 @@ var ScrollArea = React13.forwardRef(
|
|
|
2567
2715
|
}
|
|
2568
2716
|
);
|
|
2569
2717
|
ScrollArea.displayName = "ScrollArea";
|
|
2570
|
-
var ScrollAreaScrollbar =
|
|
2718
|
+
var ScrollAreaScrollbar = React6.forwardRef((_a, ref) => {
|
|
2571
2719
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
2572
2720
|
return /* @__PURE__ */ jsx(
|
|
2573
2721
|
RadixScrollArea.Scrollbar,
|
|
@@ -2597,7 +2745,7 @@ var ScrollAreaScrollbar = React13.forwardRef((_a, ref) => {
|
|
|
2597
2745
|
);
|
|
2598
2746
|
});
|
|
2599
2747
|
ScrollAreaScrollbar.displayName = RadixScrollArea.Scrollbar.displayName;
|
|
2600
|
-
var ScrollAreaCorner =
|
|
2748
|
+
var ScrollAreaCorner = React6.forwardRef((_a, ref) => {
|
|
2601
2749
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2602
2750
|
return /* @__PURE__ */ jsx(
|
|
2603
2751
|
RadixScrollArea.Corner,
|
|
@@ -2639,9 +2787,9 @@ DialogTrigger.displayName = "DialogTrigger";
|
|
|
2639
2787
|
var DialogPortal = ({
|
|
2640
2788
|
open,
|
|
2641
2789
|
children
|
|
2642
|
-
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ?
|
|
2790
|
+
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ? React6.Children.toArray(children) : null }) });
|
|
2643
2791
|
DialogPortal.displayName = "DialogPortal";
|
|
2644
|
-
var DialogOverlay =
|
|
2792
|
+
var DialogOverlay = React6.forwardRef((_a, ref) => {
|
|
2645
2793
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2646
2794
|
return /* @__PURE__ */ jsx(RadixDialog.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsx(
|
|
2647
2795
|
m.div,
|
|
@@ -2652,7 +2800,7 @@ var DialogOverlay = React13.forwardRef((_a, ref) => {
|
|
|
2652
2800
|
) }));
|
|
2653
2801
|
});
|
|
2654
2802
|
DialogOverlay.displayName = "DialogOverlay";
|
|
2655
|
-
var DialogContent =
|
|
2803
|
+
var DialogContent = React6.forwardRef((_a, ref) => {
|
|
2656
2804
|
var _b = _a, { className, children, hideCloseButton = false } = _b, props = __objRest(_b, ["className", "children", "hideCloseButton"]);
|
|
2657
2805
|
return /* @__PURE__ */ jsx(
|
|
2658
2806
|
RadixDialog.Content,
|
|
@@ -2692,7 +2840,7 @@ var DialogContent = React13.forwardRef((_a, ref) => {
|
|
|
2692
2840
|
);
|
|
2693
2841
|
});
|
|
2694
2842
|
DialogContent.displayName = "DialogContent";
|
|
2695
|
-
var DialogIcon =
|
|
2843
|
+
var DialogIcon = React6.forwardRef((_a, ref) => {
|
|
2696
2844
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
2697
2845
|
return /* @__PURE__ */ jsx(
|
|
2698
2846
|
"div",
|
|
@@ -2706,7 +2854,7 @@ var DialogIcon = React13.forwardRef((_a, ref) => {
|
|
|
2706
2854
|
);
|
|
2707
2855
|
});
|
|
2708
2856
|
DialogIcon.displayName = "DialogIcon";
|
|
2709
|
-
var DialogTitle =
|
|
2857
|
+
var DialogTitle = React6.forwardRef((_a, ref) => {
|
|
2710
2858
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2711
2859
|
return /* @__PURE__ */ jsx(
|
|
2712
2860
|
RadixDialog.Title,
|
|
@@ -2721,7 +2869,7 @@ var DialogTitle = React13.forwardRef((_a, ref) => {
|
|
|
2721
2869
|
);
|
|
2722
2870
|
});
|
|
2723
2871
|
DialogTitle.displayName = "DialogTitle";
|
|
2724
|
-
var DialogDescription =
|
|
2872
|
+
var DialogDescription = React6.forwardRef((_a, ref) => {
|
|
2725
2873
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2726
2874
|
return /* @__PURE__ */ jsx(
|
|
2727
2875
|
RadixDialog.Description,
|
|
@@ -2733,7 +2881,7 @@ var DialogDescription = React13.forwardRef((_a, ref) => {
|
|
|
2733
2881
|
);
|
|
2734
2882
|
});
|
|
2735
2883
|
DialogDescription.displayName = "DialogDescription";
|
|
2736
|
-
var DialogBody =
|
|
2884
|
+
var DialogBody = React6.forwardRef((_a, ref) => {
|
|
2737
2885
|
var _b = _a, { className, children, dir } = _b, props = __objRest(_b, ["className", "children", "dir"]);
|
|
2738
2886
|
return /* @__PURE__ */ jsx(
|
|
2739
2887
|
ScrollArea,
|
|
@@ -2749,7 +2897,7 @@ var DialogBody = React13.forwardRef((_a, ref) => {
|
|
|
2749
2897
|
);
|
|
2750
2898
|
});
|
|
2751
2899
|
DialogBody.displayName = "DialogBody";
|
|
2752
|
-
var DialogFullScreenContent =
|
|
2900
|
+
var DialogFullScreenContent = React6.forwardRef(
|
|
2753
2901
|
(_a, ref) => {
|
|
2754
2902
|
var _b = _a, {
|
|
2755
2903
|
className,
|
|
@@ -2897,17 +3045,17 @@ var DateRangePicker = ({
|
|
|
2897
3045
|
navigateToMonth,
|
|
2898
3046
|
setDisplayMode
|
|
2899
3047
|
} = state;
|
|
2900
|
-
const [activeSelector, setActiveSelector] =
|
|
2901
|
-
const [slideDirection, setSlideDirection] =
|
|
2902
|
-
const handlePrev =
|
|
3048
|
+
const [activeSelector, setActiveSelector] = React6.useState(null);
|
|
3049
|
+
const [slideDirection, setSlideDirection] = React6.useState(null);
|
|
3050
|
+
const handlePrev = React6.useCallback(() => {
|
|
2903
3051
|
setSlideDirection("prev");
|
|
2904
3052
|
navigateMonth2("prev");
|
|
2905
3053
|
}, [navigateMonth2]);
|
|
2906
|
-
const handleNext =
|
|
3054
|
+
const handleNext = React6.useCallback(() => {
|
|
2907
3055
|
setSlideDirection("next");
|
|
2908
3056
|
navigateMonth2("next");
|
|
2909
3057
|
}, [navigateMonth2]);
|
|
2910
|
-
const handleYearSelect =
|
|
3058
|
+
const handleYearSelect = React6.useCallback(
|
|
2911
3059
|
(year) => {
|
|
2912
3060
|
const d = new Date(displayedMonthMs);
|
|
2913
3061
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2915,7 +3063,7 @@ var DateRangePicker = ({
|
|
|
2915
3063
|
},
|
|
2916
3064
|
[displayedMonthMs, navigateToMonth]
|
|
2917
3065
|
);
|
|
2918
|
-
const handleMonthSelect =
|
|
3066
|
+
const handleMonthSelect = React6.useCallback(
|
|
2919
3067
|
(month) => {
|
|
2920
3068
|
const d = new Date(displayedMonthMs);
|
|
2921
3069
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2923,7 +3071,7 @@ var DateRangePicker = ({
|
|
|
2923
3071
|
},
|
|
2924
3072
|
[displayedMonthMs, navigateToMonth]
|
|
2925
3073
|
);
|
|
2926
|
-
const formatShort =
|
|
3074
|
+
const formatShort = React6.useCallback(
|
|
2927
3075
|
(ms) => {
|
|
2928
3076
|
if (ms === null) return "\u2014";
|
|
2929
3077
|
return formatDate(ms, locale, {
|
|
@@ -3534,16 +3682,16 @@ var InputField = ({
|
|
|
3534
3682
|
onBlur,
|
|
3535
3683
|
className
|
|
3536
3684
|
}) => {
|
|
3537
|
-
const [inputText, setInputText] =
|
|
3685
|
+
const [inputText, setInputText] = React6.useState(
|
|
3538
3686
|
String(value).padStart(2, "0")
|
|
3539
3687
|
);
|
|
3540
|
-
const inputRef =
|
|
3541
|
-
|
|
3688
|
+
const inputRef = React6.useRef(null);
|
|
3689
|
+
React6.useEffect(() => {
|
|
3542
3690
|
if (!isFocused) {
|
|
3543
3691
|
setInputText(String(value).padStart(2, "0"));
|
|
3544
3692
|
}
|
|
3545
3693
|
}, [value, isFocused]);
|
|
3546
|
-
|
|
3694
|
+
React6.useEffect(() => {
|
|
3547
3695
|
var _a, _b;
|
|
3548
3696
|
if (isFocused) {
|
|
3549
3697
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -3633,7 +3781,7 @@ var InputField = ({
|
|
|
3633
3781
|
};
|
|
3634
3782
|
var TimeInput = ({ state, className }) => {
|
|
3635
3783
|
const { is24hour, setHourInput, setMinuteInput, setSelection } = state;
|
|
3636
|
-
const [focusedField, setFocusedField] =
|
|
3784
|
+
const [focusedField, setFocusedField] = React6.useState(null);
|
|
3637
3785
|
const handleHourAutoAdvance = () => {
|
|
3638
3786
|
setFocusedField("minute");
|
|
3639
3787
|
setSelection("minute");
|
|
@@ -3827,17 +3975,17 @@ var ClockDial = ({
|
|
|
3827
3975
|
setMinute,
|
|
3828
3976
|
setSelection
|
|
3829
3977
|
} = state;
|
|
3830
|
-
const displayAngle =
|
|
3978
|
+
const displayAngle = React6.useMemo(() => {
|
|
3831
3979
|
if (selection === "hour") {
|
|
3832
3980
|
return valueToAngle(hour, "hour");
|
|
3833
3981
|
}
|
|
3834
3982
|
return valueToAngle(minute, "minute");
|
|
3835
3983
|
}, [selection, hour, minute]);
|
|
3836
|
-
const selectorPos =
|
|
3984
|
+
const selectorPos = React6.useMemo(
|
|
3837
3985
|
() => getSelectorPosition(displayAngle, selection, is24hour, isPm),
|
|
3838
3986
|
[displayAngle, selection, is24hour, isPm]
|
|
3839
3987
|
);
|
|
3840
|
-
const trackEnd =
|
|
3988
|
+
const trackEnd = React6.useMemo(() => {
|
|
3841
3989
|
const dx = selectorPos.x - CENTER;
|
|
3842
3990
|
const dy = selectorPos.y - CENTER;
|
|
3843
3991
|
const length = Math.hypot(dx, dy);
|
|
@@ -3847,13 +3995,13 @@ var ClockDial = ({
|
|
|
3847
3995
|
y: selectorPos.y - dy / length * HANDLE_RADIUS
|
|
3848
3996
|
};
|
|
3849
3997
|
}, [selectorPos]);
|
|
3850
|
-
const numbers =
|
|
3998
|
+
const numbers = React6.useMemo(() => {
|
|
3851
3999
|
if (selection === "minute") return buildMinuteNumbers();
|
|
3852
4000
|
if (is24hour) return buildHour24Numbers();
|
|
3853
4001
|
return buildHour12Numbers();
|
|
3854
4002
|
}, [selection, is24hour]);
|
|
3855
|
-
const isDragging =
|
|
3856
|
-
const svgRef =
|
|
4003
|
+
const isDragging = React6.useRef(false);
|
|
4004
|
+
const svgRef = React6.useRef(null);
|
|
3857
4005
|
const getSVGPoint = (e) => {
|
|
3858
4006
|
const svg = svgRef.current;
|
|
3859
4007
|
if (!svg) return { x: e.clientX, y: e.clientY };
|
|
@@ -4003,8 +4151,8 @@ var getAutoLayout = () => {
|
|
|
4003
4151
|
return innerWidth >= 600 && innerHeight >= 300 && innerWidth >= innerHeight ? "horizontal" : "vertical";
|
|
4004
4152
|
};
|
|
4005
4153
|
var useResolvedLayout = (layout) => {
|
|
4006
|
-
const [autoLayout, setAutoLayout] =
|
|
4007
|
-
|
|
4154
|
+
const [autoLayout, setAutoLayout] = React6.useState("vertical");
|
|
4155
|
+
React6.useEffect(() => {
|
|
4008
4156
|
if (layout !== "auto") return;
|
|
4009
4157
|
const updateLayout = () => setAutoLayout(getAutoLayout());
|
|
4010
4158
|
updateLayout();
|