@bug-on/m3-expressive 1.2.5 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/buttons.js +260 -98
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +261 -99
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +338 -176
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +321 -159
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +32 -0
- package/dist/feedback.d.ts +32 -0
- package/dist/feedback.js +348 -186
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +326 -164
- package/dist/feedback.mjs.map +1 -1
- package/dist/index.js +261 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +262 -100
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +261 -99
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +262 -100
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.js +260 -98
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +261 -99
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +391 -229
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +354 -192
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +399 -237
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +367 -205
- package/dist/pickers.mjs.map +1 -1
- package/package.json +1 -1
package/dist/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,27 +712,47 @@ 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
|
-
d
|
|
716
|
-
return d;
|
|
715
|
+
return `${d} Z`;
|
|
717
716
|
}
|
|
718
717
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
719
718
|
if (startX >= endX) return "";
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
719
|
+
if (amp <= 0.01) {
|
|
720
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
721
|
+
}
|
|
722
|
+
const safeWl = Math.max(1, wl);
|
|
723
|
+
const k = 2 * Math.PI / safeWl;
|
|
724
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
725
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
726
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
727
|
+
const step = safeWl / 4;
|
|
728
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
729
|
+
let currentX = startX;
|
|
730
|
+
while (currentX < endX) {
|
|
731
|
+
const nextX = Math.min(endX, currentX + step);
|
|
732
|
+
const dx = nextX - currentX;
|
|
733
|
+
const scale = dx / 3;
|
|
734
|
+
const y0 = yAt(currentX);
|
|
735
|
+
const dy0 = dyAt(currentX);
|
|
736
|
+
const y1 = yAt(nextX);
|
|
737
|
+
const dy1 = dyAt(nextX);
|
|
738
|
+
const cp1x = currentX + scale;
|
|
739
|
+
const cp1y = y0 + scale * dy0;
|
|
740
|
+
const cp2x = nextX - scale;
|
|
741
|
+
const cp2y = y1 - scale * dy1;
|
|
742
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
743
|
+
currentX = nextX;
|
|
730
744
|
}
|
|
731
|
-
const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
|
|
732
|
-
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
733
745
|
return d;
|
|
734
746
|
}
|
|
735
|
-
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(
|
|
736
756
|
(_a, ref) => {
|
|
737
757
|
var _b = _a, {
|
|
738
758
|
value,
|
|
@@ -745,6 +765,10 @@ var CircularProgress = React13.forwardRef(
|
|
|
745
765
|
crawlerSpeed = 1,
|
|
746
766
|
color,
|
|
747
767
|
trackColor,
|
|
768
|
+
showTrack = "auto",
|
|
769
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
770
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
771
|
+
amplitudeRange,
|
|
748
772
|
className,
|
|
749
773
|
"aria-label": ariaLabel
|
|
750
774
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -758,6 +782,10 @@ var CircularProgress = React13.forwardRef(
|
|
|
758
782
|
"crawlerSpeed",
|
|
759
783
|
"color",
|
|
760
784
|
"trackColor",
|
|
785
|
+
"showTrack",
|
|
786
|
+
"minProgress",
|
|
787
|
+
"maxProgress",
|
|
788
|
+
"amplitudeRange",
|
|
761
789
|
"className",
|
|
762
790
|
"aria-label"
|
|
763
791
|
]);
|
|
@@ -768,17 +796,22 @@ var CircularProgress = React13.forwardRef(
|
|
|
768
796
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
769
797
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
770
798
|
const isWavy = shape === "wavy";
|
|
799
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
771
800
|
const BASELINE_SIZE = 48;
|
|
772
801
|
const scaleFactor = size / BASELINE_SIZE;
|
|
773
|
-
const effectiveAmplitude =
|
|
802
|
+
const effectiveAmplitude = React6.useMemo(
|
|
774
803
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
775
804
|
[amplitude, scaleFactor]
|
|
776
805
|
);
|
|
777
|
-
const effectiveWavelength =
|
|
806
|
+
const effectiveWavelength = React6.useMemo(
|
|
778
807
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
779
808
|
[wavelength, scaleFactor]
|
|
780
809
|
);
|
|
781
|
-
const
|
|
810
|
+
const resolvedAmplitudeRange = React6.useMemo(
|
|
811
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
812
|
+
[amplitudeRange, effectiveAmplitude]
|
|
813
|
+
);
|
|
814
|
+
const wavyActivePath = React6.useMemo(
|
|
782
815
|
() => isWavy ? generateWavyCircularPath(
|
|
783
816
|
center,
|
|
784
817
|
radius,
|
|
@@ -787,8 +820,8 @@ var CircularProgress = React13.forwardRef(
|
|
|
787
820
|
) : null,
|
|
788
821
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
789
822
|
);
|
|
790
|
-
const circumference =
|
|
791
|
-
const gapForTrack =
|
|
823
|
+
const circumference = React6.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
824
|
+
const gapForTrack = React6.useMemo(
|
|
792
825
|
() => (gapSize + trackHeight) / circumference,
|
|
793
826
|
[gapSize, trackHeight, circumference]
|
|
794
827
|
);
|
|
@@ -797,6 +830,145 @@ var CircularProgress = React13.forwardRef(
|
|
|
797
830
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
798
831
|
const ActiveCircleElem = m.circle;
|
|
799
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
|
+
});
|
|
800
972
|
return /* @__PURE__ */ jsx(
|
|
801
973
|
"div",
|
|
802
974
|
__spreadProps(__spreadValues({
|
|
@@ -873,9 +1045,10 @@ var CircularProgress = React13.forwardRef(
|
|
|
873
1045
|
]
|
|
874
1046
|
}
|
|
875
1047
|
),
|
|
876
|
-
!isDeterminate && /* @__PURE__ */
|
|
877
|
-
|
|
1048
|
+
!isDeterminate && /* @__PURE__ */ jsx(
|
|
1049
|
+
"svg",
|
|
878
1050
|
{
|
|
1051
|
+
ref: indeterminateSvgRef,
|
|
879
1052
|
width: size,
|
|
880
1053
|
height: size,
|
|
881
1054
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -884,90 +1057,60 @@ var CircularProgress = React13.forwardRef(
|
|
|
884
1057
|
position: "absolute",
|
|
885
1058
|
inset: 0,
|
|
886
1059
|
overflow: "visible",
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
},
|
|
890
|
-
animate: { rotate: ["-90deg", "270deg"] },
|
|
891
|
-
transition: {
|
|
892
|
-
rotate: {
|
|
893
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
894
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
895
|
-
ease: "linear"
|
|
896
|
-
}
|
|
1060
|
+
transformOrigin: "center",
|
|
1061
|
+
transform: "rotate(-90deg)"
|
|
897
1062
|
},
|
|
898
|
-
children: [
|
|
899
|
-
/* @__PURE__ */ jsx(
|
|
900
|
-
|
|
1063
|
+
children: isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1064
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
|
|
1065
|
+
"path",
|
|
901
1066
|
{
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
r: radius,
|
|
1067
|
+
ref: indeterminateWavyTrackPathRef,
|
|
1068
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
905
1069
|
fill: "none",
|
|
906
1070
|
stroke: bgTrackColor,
|
|
907
1071
|
strokeWidth: trackHeight,
|
|
908
|
-
strokeLinecap: "round"
|
|
909
|
-
style: { originX: "50%", originY: "50%" },
|
|
910
|
-
animate: {
|
|
911
|
-
pathLength: [
|
|
912
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
|
|
913
|
-
Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
|
|
914
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
|
|
915
|
-
],
|
|
916
|
-
rotate: [
|
|
917
|
-
`${(0.1 + gapForTrack) * 360}deg`,
|
|
918
|
-
`${(1 + gapForTrack) * 360}deg`,
|
|
919
|
-
`${(1.1 + gapForTrack) * 360}deg`
|
|
920
|
-
]
|
|
921
|
-
},
|
|
922
|
-
transition: {
|
|
923
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
924
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
925
|
-
ease: [0.4, 0, 0.2, 1]
|
|
926
|
-
}
|
|
1072
|
+
strokeLinecap: "round"
|
|
927
1073
|
}
|
|
928
1074
|
),
|
|
929
|
-
|
|
930
|
-
|
|
1075
|
+
/* @__PURE__ */ jsx(
|
|
1076
|
+
"path",
|
|
931
1077
|
{
|
|
1078
|
+
ref: indeterminateWavyActivePathRef,
|
|
932
1079
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
933
1080
|
fill: "none",
|
|
934
1081
|
stroke: activeColor,
|
|
935
1082
|
strokeWidth: trackHeight,
|
|
936
|
-
strokeLinecap: "round"
|
|
937
|
-
style: { originX: "50%", originY: "50%" },
|
|
938
|
-
animate: {
|
|
939
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
940
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
941
|
-
},
|
|
942
|
-
transition: {
|
|
943
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
944
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
945
|
-
ease: [0.4, 0, 0.2, 1]
|
|
946
|
-
}
|
|
1083
|
+
strokeLinecap: "round"
|
|
947
1084
|
}
|
|
948
|
-
)
|
|
949
|
-
|
|
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",
|
|
950
1102
|
{
|
|
1103
|
+
ref: indeterminateActiveRef,
|
|
951
1104
|
cx: center,
|
|
952
1105
|
cy: center,
|
|
953
1106
|
r: radius,
|
|
954
1107
|
fill: "none",
|
|
955
1108
|
stroke: activeColor,
|
|
956
1109
|
strokeWidth: trackHeight,
|
|
957
|
-
strokeLinecap: "round"
|
|
958
|
-
style: { originX: "50%", originY: "50%" },
|
|
959
|
-
animate: {
|
|
960
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
961
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
962
|
-
},
|
|
963
|
-
transition: {
|
|
964
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
965
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
966
|
-
ease: [0.4, 0, 0.2, 1]
|
|
967
|
-
}
|
|
1110
|
+
strokeLinecap: "round"
|
|
968
1111
|
}
|
|
969
1112
|
)
|
|
970
|
-
]
|
|
1113
|
+
] })
|
|
971
1114
|
}
|
|
972
1115
|
)
|
|
973
1116
|
] })
|
|
@@ -977,9 +1120,9 @@ var CircularProgress = React13.forwardRef(
|
|
|
977
1120
|
);
|
|
978
1121
|
CircularProgress.displayName = "CircularProgress";
|
|
979
1122
|
function useContainerWidth() {
|
|
980
|
-
const [width, setWidth] =
|
|
981
|
-
const observerRef =
|
|
982
|
-
const ref =
|
|
1123
|
+
const [width, setWidth] = React6.useState(0);
|
|
1124
|
+
const observerRef = React6.useRef(null);
|
|
1125
|
+
const ref = React6.useCallback((node) => {
|
|
983
1126
|
if (observerRef.current) {
|
|
984
1127
|
observerRef.current.disconnect();
|
|
985
1128
|
observerRef.current = null;
|
|
@@ -993,7 +1136,7 @@ function useContainerWidth() {
|
|
|
993
1136
|
observerRef.current = obs;
|
|
994
1137
|
}
|
|
995
1138
|
}, []);
|
|
996
|
-
|
|
1139
|
+
React6.useEffect(() => {
|
|
997
1140
|
return () => {
|
|
998
1141
|
if (observerRef.current) {
|
|
999
1142
|
observerRef.current.disconnect();
|
|
@@ -1003,7 +1146,7 @@ function useContainerWidth() {
|
|
|
1003
1146
|
return [ref, width];
|
|
1004
1147
|
}
|
|
1005
1148
|
function useMergedRef(...refs) {
|
|
1006
|
-
return
|
|
1149
|
+
return React6.useCallback(
|
|
1007
1150
|
(node) => {
|
|
1008
1151
|
for (const ref of refs) {
|
|
1009
1152
|
if (typeof ref === "function") {
|
|
@@ -1017,7 +1160,7 @@ function useMergedRef(...refs) {
|
|
|
1017
1160
|
[refs]
|
|
1018
1161
|
);
|
|
1019
1162
|
}
|
|
1020
|
-
var FlatLinearTrack =
|
|
1163
|
+
var FlatLinearTrack = React6.memo(function FlatLinearTrack2({
|
|
1021
1164
|
trackHeight,
|
|
1022
1165
|
activeColor,
|
|
1023
1166
|
trackColor,
|
|
@@ -1093,7 +1236,7 @@ var FlatLinearTrack = React13.memo(function FlatLinearTrack2({
|
|
|
1093
1236
|
}
|
|
1094
1237
|
);
|
|
1095
1238
|
});
|
|
1096
|
-
var WavyLinearTrack =
|
|
1239
|
+
var WavyLinearTrack = React6.memo(function WavyLinearTrack2({
|
|
1097
1240
|
trackHeight,
|
|
1098
1241
|
svgHeight,
|
|
1099
1242
|
amplitude,
|
|
@@ -1112,13 +1255,13 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1112
1255
|
}) {
|
|
1113
1256
|
const isDeterminate = typeof value === "number";
|
|
1114
1257
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1115
|
-
const titleId =
|
|
1258
|
+
const titleId = React6.useId();
|
|
1116
1259
|
const [containerRef, width] = useContainerWidth();
|
|
1117
|
-
const activePathRef =
|
|
1118
|
-
const trackPathRef =
|
|
1260
|
+
const activePathRef = React6.useRef(null);
|
|
1261
|
+
const trackPathRef = React6.useRef(null);
|
|
1119
1262
|
const amplitudeMV = useMotionValue(amplitude);
|
|
1120
1263
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1121
|
-
|
|
1264
|
+
React6.useEffect(() => {
|
|
1122
1265
|
if (isDeterminate) {
|
|
1123
1266
|
const fraction = clampedValue / 100;
|
|
1124
1267
|
let targetAmp = amplitude;
|
|
@@ -1131,6 +1274,12 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1131
1274
|
duration: 0.5
|
|
1132
1275
|
});
|
|
1133
1276
|
animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
1277
|
+
} else {
|
|
1278
|
+
animate(amplitudeMV, amplitude, {
|
|
1279
|
+
type: "spring",
|
|
1280
|
+
bounce: 0,
|
|
1281
|
+
duration: 0.5
|
|
1282
|
+
});
|
|
1134
1283
|
}
|
|
1135
1284
|
}, [
|
|
1136
1285
|
clampedValue,
|
|
@@ -1144,10 +1293,10 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1144
1293
|
1,
|
|
1145
1294
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
1146
1295
|
);
|
|
1147
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
1148
1296
|
useAnimationFrame((time) => {
|
|
1149
1297
|
if (width === 0) return;
|
|
1150
1298
|
const currentAmp = amplitudeMV.get();
|
|
1299
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
1151
1300
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
1152
1301
|
const capWidth = trackHeight / 2;
|
|
1153
1302
|
let activePathD = "";
|
|
@@ -1167,7 +1316,7 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1167
1316
|
currentAmp
|
|
1168
1317
|
);
|
|
1169
1318
|
} else if (fraction === 0) {
|
|
1170
|
-
activePathD =
|
|
1319
|
+
activePathD = "";
|
|
1171
1320
|
}
|
|
1172
1321
|
const trackStart = adjHead + totalGap;
|
|
1173
1322
|
if (trackStart < width - capWidth) {
|
|
@@ -1199,20 +1348,20 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1199
1348
|
activeLines.push({ tail: l1T, head: l1H });
|
|
1200
1349
|
activeLines.push({ tail: l2T, head: l2H });
|
|
1201
1350
|
}
|
|
1202
|
-
const
|
|
1203
|
-
const
|
|
1204
|
-
const
|
|
1351
|
+
const activeSegments = activeLines.map((line) => {
|
|
1352
|
+
const rawTail = line.tail * width;
|
|
1353
|
+
const rawHead = line.head * width;
|
|
1205
1354
|
const adjTail = Math.max(
|
|
1206
1355
|
capWidth,
|
|
1207
|
-
Math.min(width - capWidth,
|
|
1356
|
+
Math.min(width - capWidth, rawTail)
|
|
1208
1357
|
);
|
|
1209
1358
|
const adjHead = Math.max(
|
|
1210
1359
|
capWidth,
|
|
1211
|
-
Math.min(width - capWidth,
|
|
1360
|
+
Math.min(width - capWidth, rawHead)
|
|
1212
1361
|
);
|
|
1213
1362
|
return { adjTail, adjHead };
|
|
1214
1363
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
1215
|
-
activePathD =
|
|
1364
|
+
activePathD = activeSegments.map(
|
|
1216
1365
|
(seg) => getSinePath(
|
|
1217
1366
|
seg.adjTail,
|
|
1218
1367
|
seg.adjHead,
|
|
@@ -1221,13 +1370,24 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1221
1370
|
currentAmp
|
|
1222
1371
|
)
|
|
1223
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);
|
|
1224
1376
|
let currentTrackX = capWidth;
|
|
1225
|
-
for (const
|
|
1226
|
-
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);
|
|
1227
1381
|
if (trackEnd > currentTrackX) {
|
|
1228
|
-
trackD += `${getSinePath(
|
|
1382
|
+
trackD += `${getSinePath(
|
|
1383
|
+
currentTrackX,
|
|
1384
|
+
trackEnd,
|
|
1385
|
+
phase,
|
|
1386
|
+
activeWavelength,
|
|
1387
|
+
trackAmp
|
|
1388
|
+
)} `;
|
|
1229
1389
|
}
|
|
1230
|
-
currentTrackX = Math.max(currentTrackX,
|
|
1390
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
1231
1391
|
}
|
|
1232
1392
|
if (currentTrackX < width - capWidth) {
|
|
1233
1393
|
trackD += getSinePath(
|
|
@@ -1240,15 +1400,15 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1240
1400
|
}
|
|
1241
1401
|
}
|
|
1242
1402
|
if (activePathRef.current)
|
|
1243
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
1403
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
1244
1404
|
if (trackPathRef.current)
|
|
1245
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
1405
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
1246
1406
|
});
|
|
1247
1407
|
return /* @__PURE__ */ jsx(
|
|
1248
1408
|
"div",
|
|
1249
1409
|
{
|
|
1250
1410
|
ref: containerRef,
|
|
1251
|
-
className: "relative w-full
|
|
1411
|
+
className: "relative w-full",
|
|
1252
1412
|
style: { height: svgHeight },
|
|
1253
1413
|
children: width > 0 && /* @__PURE__ */ jsxs(
|
|
1254
1414
|
"svg",
|
|
@@ -1289,7 +1449,7 @@ var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
|
1289
1449
|
}
|
|
1290
1450
|
);
|
|
1291
1451
|
});
|
|
1292
|
-
var LinearProgress =
|
|
1452
|
+
var LinearProgress = React6.forwardRef(
|
|
1293
1453
|
(_a, ref) => {
|
|
1294
1454
|
var _b = _a, {
|
|
1295
1455
|
value,
|
|
@@ -1302,7 +1462,7 @@ var LinearProgress = React13.forwardRef(
|
|
|
1302
1462
|
waveSpeed = 1,
|
|
1303
1463
|
crawlerSpeed = 1,
|
|
1304
1464
|
determinateAnimation = "md3",
|
|
1305
|
-
indeterminateAnimation = "
|
|
1465
|
+
indeterminateAnimation = "md3",
|
|
1306
1466
|
gapSize = 4,
|
|
1307
1467
|
showStopIndicator = "auto",
|
|
1308
1468
|
color,
|
|
@@ -1330,33 +1490,35 @@ var LinearProgress = React13.forwardRef(
|
|
|
1330
1490
|
]);
|
|
1331
1491
|
const isDeterminate = value !== void 0;
|
|
1332
1492
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1333
|
-
const containerRef =
|
|
1493
|
+
const containerRef = React6.useRef(null);
|
|
1334
1494
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1335
|
-
const [isRtl, setIsRtl] =
|
|
1336
|
-
|
|
1495
|
+
const [isRtl, setIsRtl] = React6.useState(false);
|
|
1496
|
+
React6.useEffect(() => {
|
|
1337
1497
|
if (containerRef.current) {
|
|
1338
1498
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1339
1499
|
setIsRtl(dir === "rtl");
|
|
1340
1500
|
}
|
|
1341
1501
|
}, []);
|
|
1342
|
-
const isWavy = shape === "wavy";
|
|
1343
1502
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1344
|
-
const
|
|
1345
|
-
const
|
|
1503
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1504
|
+
const effectiveAmplitude = React6.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1505
|
+
const svgHeight = React6.useMemo(
|
|
1346
1506
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1347
1507
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1348
1508
|
);
|
|
1349
|
-
const shouldShowStop =
|
|
1350
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
1509
|
+
const shouldShowStop = React6.useMemo(
|
|
1510
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1351
1511
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1352
1512
|
);
|
|
1353
|
-
const stopSize =
|
|
1513
|
+
const stopSize = React6.useMemo(
|
|
1354
1514
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1355
1515
|
[trackHeight]
|
|
1356
1516
|
);
|
|
1357
1517
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
1358
1518
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
1359
1519
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
1520
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
1521
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
1360
1522
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
1361
1523
|
"div",
|
|
1362
1524
|
__spreadProps(__spreadValues({
|
|
@@ -1373,12 +1535,12 @@ var LinearProgress = React13.forwardRef(
|
|
|
1373
1535
|
style: { height: svgHeight }
|
|
1374
1536
|
}, restProps), {
|
|
1375
1537
|
children: [
|
|
1376
|
-
|
|
1538
|
+
useWavyTrack ? /* @__PURE__ */ jsx(
|
|
1377
1539
|
WavyLinearTrack,
|
|
1378
1540
|
{
|
|
1379
1541
|
trackHeight,
|
|
1380
1542
|
svgHeight,
|
|
1381
|
-
amplitude:
|
|
1543
|
+
amplitude: trackAmp,
|
|
1382
1544
|
wavelength,
|
|
1383
1545
|
indeterminateWavelength,
|
|
1384
1546
|
activeColor,
|
|
@@ -1423,14 +1585,14 @@ var LinearProgress = React13.forwardRef(
|
|
|
1423
1585
|
}
|
|
1424
1586
|
);
|
|
1425
1587
|
LinearProgress.displayName = "LinearProgress";
|
|
1426
|
-
var ProgressIndicator =
|
|
1588
|
+
var ProgressIndicator = React6.forwardRef((props, ref) => {
|
|
1427
1589
|
if (props.variant === "circular") {
|
|
1428
1590
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1429
1591
|
}
|
|
1430
1592
|
return /* @__PURE__ */ jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
1431
1593
|
});
|
|
1432
1594
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
1433
|
-
var RippleItem =
|
|
1595
|
+
var RippleItem = React6.memo(function RippleItem2({
|
|
1434
1596
|
ripple,
|
|
1435
1597
|
onDone
|
|
1436
1598
|
}) {
|
|
@@ -1474,8 +1636,8 @@ function Ripple({
|
|
|
1474
1636
|
}
|
|
1475
1637
|
function useRippleState(options = {}) {
|
|
1476
1638
|
const { disabled = false } = options;
|
|
1477
|
-
const [ripples, setRipples] =
|
|
1478
|
-
const onPointerDown =
|
|
1639
|
+
const [ripples, setRipples] = React6.useState([]);
|
|
1640
|
+
const onPointerDown = React6.useCallback(
|
|
1479
1641
|
(e) => {
|
|
1480
1642
|
if (disabled) return;
|
|
1481
1643
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1492,7 +1654,7 @@ function useRippleState(options = {}) {
|
|
|
1492
1654
|
},
|
|
1493
1655
|
[disabled]
|
|
1494
1656
|
);
|
|
1495
|
-
const removeRipple =
|
|
1657
|
+
const removeRipple = React6.useCallback((id) => {
|
|
1496
1658
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1497
1659
|
}, []);
|
|
1498
1660
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1640,7 +1802,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1640
1802
|
}
|
|
1641
1803
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1642
1804
|
}
|
|
1643
|
-
var IconButtonComponent =
|
|
1805
|
+
var IconButtonComponent = React6.forwardRef(
|
|
1644
1806
|
(_a, ref) => {
|
|
1645
1807
|
var _b = _a, {
|
|
1646
1808
|
className,
|
|
@@ -1682,18 +1844,18 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1682
1844
|
var _a2, _b2, _c, _d, _e;
|
|
1683
1845
|
const isToggle = variant === "toggle";
|
|
1684
1846
|
const isSelected = isToggle && !!selected;
|
|
1685
|
-
const resolvedColorClass =
|
|
1847
|
+
const resolvedColorClass = React6.useMemo(
|
|
1686
1848
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1687
1849
|
[isSelected, colorStyle]
|
|
1688
1850
|
);
|
|
1689
|
-
const outlineWidthClass =
|
|
1851
|
+
const outlineWidthClass = React6.useMemo(
|
|
1690
1852
|
() => {
|
|
1691
1853
|
var _a3;
|
|
1692
1854
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1693
1855
|
},
|
|
1694
1856
|
[colorStyle, isSelected, size]
|
|
1695
1857
|
);
|
|
1696
|
-
const disabledBgClass =
|
|
1858
|
+
const disabledBgClass = React6.useMemo(
|
|
1697
1859
|
() => resolveDisabledBgClass(colorStyle),
|
|
1698
1860
|
[colorStyle]
|
|
1699
1861
|
);
|
|
@@ -1716,7 +1878,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1716
1878
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1717
1879
|
disabled: loading
|
|
1718
1880
|
});
|
|
1719
|
-
const handleClick =
|
|
1881
|
+
const handleClick = React6.useCallback(
|
|
1720
1882
|
(e) => {
|
|
1721
1883
|
if (loading) {
|
|
1722
1884
|
e.preventDefault();
|
|
@@ -1726,7 +1888,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1726
1888
|
},
|
|
1727
1889
|
[loading, onClick]
|
|
1728
1890
|
);
|
|
1729
|
-
const handleKeyDown =
|
|
1891
|
+
const handleKeyDown = React6.useCallback(
|
|
1730
1892
|
(e) => {
|
|
1731
1893
|
if (loading) return;
|
|
1732
1894
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1782,7 +1944,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1782
1944
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1783
1945
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1784
1946
|
},
|
|
1785
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
1947
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React6.Children.only(children).props.children : children
|
|
1786
1948
|
}),
|
|
1787
1949
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1788
1950
|
) })
|
|
@@ -1799,7 +1961,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1799
1961
|
className
|
|
1800
1962
|
);
|
|
1801
1963
|
if (asChild) {
|
|
1802
|
-
const child =
|
|
1964
|
+
const child = React6.Children.only(children);
|
|
1803
1965
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1804
1966
|
Slot,
|
|
1805
1967
|
__spreadProps(__spreadValues({
|
|
@@ -1816,7 +1978,7 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1816
1978
|
}),
|
|
1817
1979
|
className: containerClassName
|
|
1818
1980
|
}, restProps), {
|
|
1819
|
-
children:
|
|
1981
|
+
children: React6.cloneElement(child, { children: innerContent })
|
|
1820
1982
|
})
|
|
1821
1983
|
) });
|
|
1822
1984
|
}
|
|
@@ -1844,13 +2006,13 @@ var IconButtonComponent = React13.forwardRef(
|
|
|
1844
2006
|
}
|
|
1845
2007
|
);
|
|
1846
2008
|
IconButtonComponent.displayName = "IconButton";
|
|
1847
|
-
var IconButton =
|
|
2009
|
+
var IconButton = React6.memo(IconButtonComponent);
|
|
1848
2010
|
var VARIANT_FONT = {
|
|
1849
2011
|
outlined: "'Material Symbols Outlined'",
|
|
1850
2012
|
rounded: "'Material Symbols Rounded'",
|
|
1851
2013
|
sharp: "'Material Symbols Sharp'"
|
|
1852
2014
|
};
|
|
1853
|
-
var IconComponent =
|
|
2015
|
+
var IconComponent = React6.forwardRef(
|
|
1854
2016
|
(_a, ref) => {
|
|
1855
2017
|
var _b = _a, {
|
|
1856
2018
|
name,
|
|
@@ -1916,7 +2078,7 @@ var IconComponent = React13.forwardRef(
|
|
|
1916
2078
|
}
|
|
1917
2079
|
);
|
|
1918
2080
|
IconComponent.displayName = "Icon";
|
|
1919
|
-
var Icon =
|
|
2081
|
+
var Icon = React6.memo(IconComponent);
|
|
1920
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";
|
|
1921
2083
|
var CalendarHeader = ({
|
|
1922
2084
|
displayedMonthMs,
|
|
@@ -2074,15 +2236,15 @@ var MonthPickerList = ({
|
|
|
2074
2236
|
locale,
|
|
2075
2237
|
onMonthSelect
|
|
2076
2238
|
}) => {
|
|
2077
|
-
const selectedRef =
|
|
2078
|
-
|
|
2239
|
+
const selectedRef = React6.useRef(null);
|
|
2240
|
+
React6.useEffect(() => {
|
|
2079
2241
|
var _a, _b;
|
|
2080
2242
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2081
2243
|
block: "center",
|
|
2082
2244
|
behavior: "instant"
|
|
2083
2245
|
});
|
|
2084
2246
|
}, []);
|
|
2085
|
-
const months =
|
|
2247
|
+
const months = React6.useMemo(
|
|
2086
2248
|
() => Array.from({ length: 12 }, (_, month) => month),
|
|
2087
2249
|
[]
|
|
2088
2250
|
);
|
|
@@ -2127,12 +2289,12 @@ var YearPickerList = ({
|
|
|
2127
2289
|
selectableDates,
|
|
2128
2290
|
onYearSelect
|
|
2129
2291
|
}) => {
|
|
2130
|
-
const selectedRef =
|
|
2131
|
-
const years =
|
|
2292
|
+
const selectedRef = React6.useRef(null);
|
|
2293
|
+
const years = React6.useMemo(() => {
|
|
2132
2294
|
const [min, max] = yearRange;
|
|
2133
2295
|
return Array.from({ length: max - min + 1 }, (_, index) => min + index);
|
|
2134
2296
|
}, [yearRange]);
|
|
2135
|
-
|
|
2297
|
+
React6.useEffect(() => {
|
|
2136
2298
|
var _a, _b;
|
|
2137
2299
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2138
2300
|
block: "center",
|
|
@@ -2203,17 +2365,17 @@ var DatePicker = ({
|
|
|
2203
2365
|
navigateToMonth,
|
|
2204
2366
|
setDisplayMode
|
|
2205
2367
|
} = state;
|
|
2206
|
-
const [activeSelector, setActiveSelector] =
|
|
2207
|
-
const [slideDirection, setSlideDirection] =
|
|
2208
|
-
const handlePrev =
|
|
2368
|
+
const [activeSelector, setActiveSelector] = React6.useState(null);
|
|
2369
|
+
const [slideDirection, setSlideDirection] = React6.useState(null);
|
|
2370
|
+
const handlePrev = React6.useCallback(() => {
|
|
2209
2371
|
setSlideDirection("prev");
|
|
2210
2372
|
navigateMonth2("prev");
|
|
2211
2373
|
}, [navigateMonth2]);
|
|
2212
|
-
const handleNext =
|
|
2374
|
+
const handleNext = React6.useCallback(() => {
|
|
2213
2375
|
setSlideDirection("next");
|
|
2214
2376
|
navigateMonth2("next");
|
|
2215
2377
|
}, [navigateMonth2]);
|
|
2216
|
-
const handleYearSelect =
|
|
2378
|
+
const handleYearSelect = React6.useCallback(
|
|
2217
2379
|
(year) => {
|
|
2218
2380
|
const d = new Date(displayedMonthMs);
|
|
2219
2381
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2221,7 +2383,7 @@ var DatePicker = ({
|
|
|
2221
2383
|
},
|
|
2222
2384
|
[displayedMonthMs, navigateToMonth]
|
|
2223
2385
|
);
|
|
2224
|
-
const handleMonthSelect =
|
|
2386
|
+
const handleMonthSelect = React6.useCallback(
|
|
2225
2387
|
(month) => {
|
|
2226
2388
|
const d = new Date(displayedMonthMs);
|
|
2227
2389
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2229,11 +2391,11 @@ var DatePicker = ({
|
|
|
2229
2391
|
},
|
|
2230
2392
|
[displayedMonthMs, navigateToMonth]
|
|
2231
2393
|
);
|
|
2232
|
-
const [inputValue, setInputValue] =
|
|
2394
|
+
const [inputValue, setInputValue] = React6.useState(
|
|
2233
2395
|
() => selectedDateMs !== null ? formatInputDate(selectedDateMs) : ""
|
|
2234
2396
|
);
|
|
2235
|
-
const [inputError, setInputError] =
|
|
2236
|
-
const handleInputCommit =
|
|
2397
|
+
const [inputError, setInputError] = React6.useState();
|
|
2398
|
+
const handleInputCommit = React6.useCallback(
|
|
2237
2399
|
(ms) => {
|
|
2238
2400
|
if (ms === null && inputValue.length > 0) {
|
|
2239
2401
|
setInputError("Invalid date");
|
|
@@ -2473,7 +2635,7 @@ var DP_CLASSES = {
|
|
|
2473
2635
|
/** Weekday header row */
|
|
2474
2636
|
weekdayRow: "text-[length:var(--md-typescale-body-large-size,14px)] text-m3-on-surface"
|
|
2475
2637
|
};
|
|
2476
|
-
var ScrollArea =
|
|
2638
|
+
var ScrollArea = React6.forwardRef(
|
|
2477
2639
|
(_a, ref) => {
|
|
2478
2640
|
var _b = _a, {
|
|
2479
2641
|
className,
|
|
@@ -2494,15 +2656,15 @@ var ScrollArea = React13.forwardRef(
|
|
|
2494
2656
|
"viewportRef",
|
|
2495
2657
|
"viewportProps"
|
|
2496
2658
|
]);
|
|
2497
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
2498
|
-
|
|
2659
|
+
const [isTouchDevice, setIsTouchDevice] = React6.useState(false);
|
|
2660
|
+
React6.useEffect(() => {
|
|
2499
2661
|
if (typeof window !== "undefined") {
|
|
2500
2662
|
setIsTouchDevice(
|
|
2501
2663
|
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
2502
2664
|
);
|
|
2503
2665
|
}
|
|
2504
2666
|
}, []);
|
|
2505
|
-
const resolvedType =
|
|
2667
|
+
const resolvedType = React6.useMemo(() => {
|
|
2506
2668
|
if (type === "hover" && isTouchDevice) {
|
|
2507
2669
|
return "scroll";
|
|
2508
2670
|
}
|
|
@@ -2553,7 +2715,7 @@ var ScrollArea = React13.forwardRef(
|
|
|
2553
2715
|
}
|
|
2554
2716
|
);
|
|
2555
2717
|
ScrollArea.displayName = "ScrollArea";
|
|
2556
|
-
var ScrollAreaScrollbar =
|
|
2718
|
+
var ScrollAreaScrollbar = React6.forwardRef((_a, ref) => {
|
|
2557
2719
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
2558
2720
|
return /* @__PURE__ */ jsx(
|
|
2559
2721
|
RadixScrollArea.Scrollbar,
|
|
@@ -2583,7 +2745,7 @@ var ScrollAreaScrollbar = React13.forwardRef((_a, ref) => {
|
|
|
2583
2745
|
);
|
|
2584
2746
|
});
|
|
2585
2747
|
ScrollAreaScrollbar.displayName = RadixScrollArea.Scrollbar.displayName;
|
|
2586
|
-
var ScrollAreaCorner =
|
|
2748
|
+
var ScrollAreaCorner = React6.forwardRef((_a, ref) => {
|
|
2587
2749
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2588
2750
|
return /* @__PURE__ */ jsx(
|
|
2589
2751
|
RadixScrollArea.Corner,
|
|
@@ -2625,9 +2787,9 @@ DialogTrigger.displayName = "DialogTrigger";
|
|
|
2625
2787
|
var DialogPortal = ({
|
|
2626
2788
|
open,
|
|
2627
2789
|
children
|
|
2628
|
-
}) => /* @__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 }) });
|
|
2629
2791
|
DialogPortal.displayName = "DialogPortal";
|
|
2630
|
-
var DialogOverlay =
|
|
2792
|
+
var DialogOverlay = React6.forwardRef((_a, ref) => {
|
|
2631
2793
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2632
2794
|
return /* @__PURE__ */ jsx(RadixDialog.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsx(
|
|
2633
2795
|
m.div,
|
|
@@ -2638,7 +2800,7 @@ var DialogOverlay = React13.forwardRef((_a, ref) => {
|
|
|
2638
2800
|
) }));
|
|
2639
2801
|
});
|
|
2640
2802
|
DialogOverlay.displayName = "DialogOverlay";
|
|
2641
|
-
var DialogContent =
|
|
2803
|
+
var DialogContent = React6.forwardRef((_a, ref) => {
|
|
2642
2804
|
var _b = _a, { className, children, hideCloseButton = false } = _b, props = __objRest(_b, ["className", "children", "hideCloseButton"]);
|
|
2643
2805
|
return /* @__PURE__ */ jsx(
|
|
2644
2806
|
RadixDialog.Content,
|
|
@@ -2678,7 +2840,7 @@ var DialogContent = React13.forwardRef((_a, ref) => {
|
|
|
2678
2840
|
);
|
|
2679
2841
|
});
|
|
2680
2842
|
DialogContent.displayName = "DialogContent";
|
|
2681
|
-
var DialogIcon =
|
|
2843
|
+
var DialogIcon = React6.forwardRef((_a, ref) => {
|
|
2682
2844
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
2683
2845
|
return /* @__PURE__ */ jsx(
|
|
2684
2846
|
"div",
|
|
@@ -2692,7 +2854,7 @@ var DialogIcon = React13.forwardRef((_a, ref) => {
|
|
|
2692
2854
|
);
|
|
2693
2855
|
});
|
|
2694
2856
|
DialogIcon.displayName = "DialogIcon";
|
|
2695
|
-
var DialogTitle =
|
|
2857
|
+
var DialogTitle = React6.forwardRef((_a, ref) => {
|
|
2696
2858
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2697
2859
|
return /* @__PURE__ */ jsx(
|
|
2698
2860
|
RadixDialog.Title,
|
|
@@ -2707,7 +2869,7 @@ var DialogTitle = React13.forwardRef((_a, ref) => {
|
|
|
2707
2869
|
);
|
|
2708
2870
|
});
|
|
2709
2871
|
DialogTitle.displayName = "DialogTitle";
|
|
2710
|
-
var DialogDescription =
|
|
2872
|
+
var DialogDescription = React6.forwardRef((_a, ref) => {
|
|
2711
2873
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2712
2874
|
return /* @__PURE__ */ jsx(
|
|
2713
2875
|
RadixDialog.Description,
|
|
@@ -2719,7 +2881,7 @@ var DialogDescription = React13.forwardRef((_a, ref) => {
|
|
|
2719
2881
|
);
|
|
2720
2882
|
});
|
|
2721
2883
|
DialogDescription.displayName = "DialogDescription";
|
|
2722
|
-
var DialogBody =
|
|
2884
|
+
var DialogBody = React6.forwardRef((_a, ref) => {
|
|
2723
2885
|
var _b = _a, { className, children, dir } = _b, props = __objRest(_b, ["className", "children", "dir"]);
|
|
2724
2886
|
return /* @__PURE__ */ jsx(
|
|
2725
2887
|
ScrollArea,
|
|
@@ -2735,7 +2897,7 @@ var DialogBody = React13.forwardRef((_a, ref) => {
|
|
|
2735
2897
|
);
|
|
2736
2898
|
});
|
|
2737
2899
|
DialogBody.displayName = "DialogBody";
|
|
2738
|
-
var DialogFullScreenContent =
|
|
2900
|
+
var DialogFullScreenContent = React6.forwardRef(
|
|
2739
2901
|
(_a, ref) => {
|
|
2740
2902
|
var _b = _a, {
|
|
2741
2903
|
className,
|
|
@@ -2883,17 +3045,17 @@ var DateRangePicker = ({
|
|
|
2883
3045
|
navigateToMonth,
|
|
2884
3046
|
setDisplayMode
|
|
2885
3047
|
} = state;
|
|
2886
|
-
const [activeSelector, setActiveSelector] =
|
|
2887
|
-
const [slideDirection, setSlideDirection] =
|
|
2888
|
-
const handlePrev =
|
|
3048
|
+
const [activeSelector, setActiveSelector] = React6.useState(null);
|
|
3049
|
+
const [slideDirection, setSlideDirection] = React6.useState(null);
|
|
3050
|
+
const handlePrev = React6.useCallback(() => {
|
|
2889
3051
|
setSlideDirection("prev");
|
|
2890
3052
|
navigateMonth2("prev");
|
|
2891
3053
|
}, [navigateMonth2]);
|
|
2892
|
-
const handleNext =
|
|
3054
|
+
const handleNext = React6.useCallback(() => {
|
|
2893
3055
|
setSlideDirection("next");
|
|
2894
3056
|
navigateMonth2("next");
|
|
2895
3057
|
}, [navigateMonth2]);
|
|
2896
|
-
const handleYearSelect =
|
|
3058
|
+
const handleYearSelect = React6.useCallback(
|
|
2897
3059
|
(year) => {
|
|
2898
3060
|
const d = new Date(displayedMonthMs);
|
|
2899
3061
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2901,7 +3063,7 @@ var DateRangePicker = ({
|
|
|
2901
3063
|
},
|
|
2902
3064
|
[displayedMonthMs, navigateToMonth]
|
|
2903
3065
|
);
|
|
2904
|
-
const handleMonthSelect =
|
|
3066
|
+
const handleMonthSelect = React6.useCallback(
|
|
2905
3067
|
(month) => {
|
|
2906
3068
|
const d = new Date(displayedMonthMs);
|
|
2907
3069
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2909,7 +3071,7 @@ var DateRangePicker = ({
|
|
|
2909
3071
|
},
|
|
2910
3072
|
[displayedMonthMs, navigateToMonth]
|
|
2911
3073
|
);
|
|
2912
|
-
const formatShort =
|
|
3074
|
+
const formatShort = React6.useCallback(
|
|
2913
3075
|
(ms) => {
|
|
2914
3076
|
if (ms === null) return "\u2014";
|
|
2915
3077
|
return formatDate(ms, locale, {
|
|
@@ -3520,16 +3682,16 @@ var InputField = ({
|
|
|
3520
3682
|
onBlur,
|
|
3521
3683
|
className
|
|
3522
3684
|
}) => {
|
|
3523
|
-
const [inputText, setInputText] =
|
|
3685
|
+
const [inputText, setInputText] = React6.useState(
|
|
3524
3686
|
String(value).padStart(2, "0")
|
|
3525
3687
|
);
|
|
3526
|
-
const inputRef =
|
|
3527
|
-
|
|
3688
|
+
const inputRef = React6.useRef(null);
|
|
3689
|
+
React6.useEffect(() => {
|
|
3528
3690
|
if (!isFocused) {
|
|
3529
3691
|
setInputText(String(value).padStart(2, "0"));
|
|
3530
3692
|
}
|
|
3531
3693
|
}, [value, isFocused]);
|
|
3532
|
-
|
|
3694
|
+
React6.useEffect(() => {
|
|
3533
3695
|
var _a, _b;
|
|
3534
3696
|
if (isFocused) {
|
|
3535
3697
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -3619,7 +3781,7 @@ var InputField = ({
|
|
|
3619
3781
|
};
|
|
3620
3782
|
var TimeInput = ({ state, className }) => {
|
|
3621
3783
|
const { is24hour, setHourInput, setMinuteInput, setSelection } = state;
|
|
3622
|
-
const [focusedField, setFocusedField] =
|
|
3784
|
+
const [focusedField, setFocusedField] = React6.useState(null);
|
|
3623
3785
|
const handleHourAutoAdvance = () => {
|
|
3624
3786
|
setFocusedField("minute");
|
|
3625
3787
|
setSelection("minute");
|
|
@@ -3813,17 +3975,17 @@ var ClockDial = ({
|
|
|
3813
3975
|
setMinute,
|
|
3814
3976
|
setSelection
|
|
3815
3977
|
} = state;
|
|
3816
|
-
const displayAngle =
|
|
3978
|
+
const displayAngle = React6.useMemo(() => {
|
|
3817
3979
|
if (selection === "hour") {
|
|
3818
3980
|
return valueToAngle(hour, "hour");
|
|
3819
3981
|
}
|
|
3820
3982
|
return valueToAngle(minute, "minute");
|
|
3821
3983
|
}, [selection, hour, minute]);
|
|
3822
|
-
const selectorPos =
|
|
3984
|
+
const selectorPos = React6.useMemo(
|
|
3823
3985
|
() => getSelectorPosition(displayAngle, selection, is24hour, isPm),
|
|
3824
3986
|
[displayAngle, selection, is24hour, isPm]
|
|
3825
3987
|
);
|
|
3826
|
-
const trackEnd =
|
|
3988
|
+
const trackEnd = React6.useMemo(() => {
|
|
3827
3989
|
const dx = selectorPos.x - CENTER;
|
|
3828
3990
|
const dy = selectorPos.y - CENTER;
|
|
3829
3991
|
const length = Math.hypot(dx, dy);
|
|
@@ -3833,13 +3995,13 @@ var ClockDial = ({
|
|
|
3833
3995
|
y: selectorPos.y - dy / length * HANDLE_RADIUS
|
|
3834
3996
|
};
|
|
3835
3997
|
}, [selectorPos]);
|
|
3836
|
-
const numbers =
|
|
3998
|
+
const numbers = React6.useMemo(() => {
|
|
3837
3999
|
if (selection === "minute") return buildMinuteNumbers();
|
|
3838
4000
|
if (is24hour) return buildHour24Numbers();
|
|
3839
4001
|
return buildHour12Numbers();
|
|
3840
4002
|
}, [selection, is24hour]);
|
|
3841
|
-
const isDragging =
|
|
3842
|
-
const svgRef =
|
|
4003
|
+
const isDragging = React6.useRef(false);
|
|
4004
|
+
const svgRef = React6.useRef(null);
|
|
3843
4005
|
const getSVGPoint = (e) => {
|
|
3844
4006
|
const svg = svgRef.current;
|
|
3845
4007
|
if (!svg) return { x: e.clientX, y: e.clientY };
|
|
@@ -3989,8 +4151,8 @@ var getAutoLayout = () => {
|
|
|
3989
4151
|
return innerWidth >= 600 && innerHeight >= 300 && innerWidth >= innerHeight ? "horizontal" : "vertical";
|
|
3990
4152
|
};
|
|
3991
4153
|
var useResolvedLayout = (layout) => {
|
|
3992
|
-
const [autoLayout, setAutoLayout] =
|
|
3993
|
-
|
|
4154
|
+
const [autoLayout, setAutoLayout] = React6.useState("vertical");
|
|
4155
|
+
React6.useEffect(() => {
|
|
3994
4156
|
if (layout !== "auto") return;
|
|
3995
4157
|
const updateLayout = () => setAutoLayout(getAutoLayout());
|
|
3996
4158
|
updateLayout();
|