@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.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var react = require('motion/react');
|
|
5
|
-
var
|
|
5
|
+
var React6 = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -28,7 +28,7 @@ function _interopNamespace(e) {
|
|
|
28
28
|
return Object.freeze(n);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
|
|
32
32
|
var RadixDialog__namespace = /*#__PURE__*/_interopNamespace(RadixDialog);
|
|
33
33
|
var RadixScrollArea__namespace = /*#__PURE__*/_interopNamespace(RadixScrollArea);
|
|
34
34
|
|
|
@@ -284,13 +284,13 @@ var DatePickerInput = ({
|
|
|
284
284
|
locale,
|
|
285
285
|
className
|
|
286
286
|
}) => {
|
|
287
|
-
const inputId =
|
|
287
|
+
const inputId = React6__namespace.useId();
|
|
288
288
|
const errorId = `${inputId}-error`;
|
|
289
|
-
const placeholder =
|
|
289
|
+
const placeholder = React6__namespace.useMemo(() => {
|
|
290
290
|
if (locale == null ? void 0 : locale.startsWith("vi")) return "DD/MM/YYYY";
|
|
291
291
|
return "MM/DD/YYYY";
|
|
292
292
|
}, [locale]);
|
|
293
|
-
const handleKeyDown =
|
|
293
|
+
const handleKeyDown = React6__namespace.useCallback(
|
|
294
294
|
(e) => {
|
|
295
295
|
if (e.key === "Enter") {
|
|
296
296
|
const parsed = parseDateInput(value);
|
|
@@ -299,11 +299,11 @@ var DatePickerInput = ({
|
|
|
299
299
|
},
|
|
300
300
|
[value, onCommit]
|
|
301
301
|
);
|
|
302
|
-
const handleBlur =
|
|
302
|
+
const handleBlur = React6__namespace.useCallback(() => {
|
|
303
303
|
const parsed = parseDateInput(value);
|
|
304
304
|
onCommit(parsed);
|
|
305
305
|
}, [value, onCommit]);
|
|
306
|
-
const handleChange =
|
|
306
|
+
const handleChange = React6__namespace.useCallback(
|
|
307
307
|
(e) => {
|
|
308
308
|
let raw = e.target.value.replace(/\D/g, "");
|
|
309
309
|
if (raw.length > 8) raw = raw.slice(0, 8);
|
|
@@ -397,11 +397,11 @@ var DayCell = ({
|
|
|
397
397
|
// Disabled
|
|
398
398
|
isDisabled && "opacity-[0.38]"
|
|
399
399
|
);
|
|
400
|
-
const handleClick =
|
|
400
|
+
const handleClick = React6__namespace.useCallback(() => {
|
|
401
401
|
if (isDisabled) return;
|
|
402
402
|
onSelect(utcMs);
|
|
403
403
|
}, [isDisabled, utcMs, onSelect]);
|
|
404
|
-
const handleKeyDown =
|
|
404
|
+
const handleKeyDown = React6__namespace.useCallback(
|
|
405
405
|
(e) => {
|
|
406
406
|
if (e.key === "Enter" || e.key === " ") {
|
|
407
407
|
e.preventDefault();
|
|
@@ -437,7 +437,7 @@ var DayCell = ({
|
|
|
437
437
|
};
|
|
438
438
|
DayCell.displayName = "DayCell";
|
|
439
439
|
var WeekdayRow = ({ locale }) => {
|
|
440
|
-
const names =
|
|
440
|
+
const names = React6__namespace.useMemo(() => getWeekdayNames(locale), [locale]);
|
|
441
441
|
return /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "grid grid-cols-7 mb-1", children: names.map((name, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
442
442
|
"th",
|
|
443
443
|
{
|
|
@@ -464,7 +464,7 @@ var CalendarGrid = ({
|
|
|
464
464
|
const d = new Date(displayedMonthMs);
|
|
465
465
|
const year = d.getUTCFullYear();
|
|
466
466
|
const month = d.getUTCMonth();
|
|
467
|
-
const weeks =
|
|
467
|
+
const weeks = React6__namespace.useMemo(
|
|
468
468
|
() => getWeeksInMonth(year, month, locale.weekStartsOn),
|
|
469
469
|
[year, month, locale.weekStartsOn]
|
|
470
470
|
);
|
|
@@ -566,11 +566,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
566
566
|
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";
|
|
567
567
|
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";
|
|
568
568
|
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";
|
|
569
|
-
var IndeterminateSvg =
|
|
569
|
+
var IndeterminateSvg = React6__namespace.memo(function IndeterminateSvg2({
|
|
570
570
|
size
|
|
571
571
|
}) {
|
|
572
|
-
const [ready, setReady] =
|
|
573
|
-
|
|
572
|
+
const [ready, setReady] = React6__namespace.useState(false);
|
|
573
|
+
React6__namespace.useEffect(() => {
|
|
574
574
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
575
575
|
return () => cancelAnimationFrame(raf);
|
|
576
576
|
}, []);
|
|
@@ -615,7 +615,7 @@ var IndeterminateSvg = React13__namespace.memo(function IndeterminateSvg2({
|
|
|
615
615
|
}
|
|
616
616
|
);
|
|
617
617
|
});
|
|
618
|
-
var DeterminateSvg =
|
|
618
|
+
var DeterminateSvg = React6__namespace.memo(function DeterminateSvg2({
|
|
619
619
|
size,
|
|
620
620
|
progress
|
|
621
621
|
}) {
|
|
@@ -640,7 +640,7 @@ var DeterminateSvg = React13__namespace.memo(function DeterminateSvg2({
|
|
|
640
640
|
}
|
|
641
641
|
);
|
|
642
642
|
});
|
|
643
|
-
var LoadingIndicator =
|
|
643
|
+
var LoadingIndicator = React6__namespace.forwardRef(
|
|
644
644
|
(_a, ref) => {
|
|
645
645
|
var _b = _a, {
|
|
646
646
|
variant = "uncontained",
|
|
@@ -735,7 +735,7 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
735
735
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
736
736
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
737
737
|
}
|
|
738
|
-
return d
|
|
738
|
+
return `${d} Z`;
|
|
739
739
|
}
|
|
740
740
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
741
741
|
if (startX >= endX) return "";
|
|
@@ -767,7 +767,15 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
767
767
|
}
|
|
768
768
|
return d;
|
|
769
769
|
}
|
|
770
|
-
var
|
|
770
|
+
var GLOBAL_ROTATION_DURATION = 6e3;
|
|
771
|
+
var GLOBAL_ROTATION_TARGET = 1080;
|
|
772
|
+
var ADDITIONAL_ROTATION_CYCLE = 1500;
|
|
773
|
+
var ADDITIONAL_ROTATION_STEP = 90;
|
|
774
|
+
var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
775
|
+
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
776
|
+
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
777
|
+
var PROGRESS_CYCLE_DURATION = 1500;
|
|
778
|
+
var CircularProgress = React6__namespace.forwardRef(
|
|
771
779
|
(_a, ref) => {
|
|
772
780
|
var _b = _a, {
|
|
773
781
|
value,
|
|
@@ -780,6 +788,10 @@ var CircularProgress = React13__namespace.forwardRef(
|
|
|
780
788
|
crawlerSpeed = 1,
|
|
781
789
|
color,
|
|
782
790
|
trackColor,
|
|
791
|
+
showTrack = "auto",
|
|
792
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
793
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
794
|
+
amplitudeRange,
|
|
783
795
|
className,
|
|
784
796
|
"aria-label": ariaLabel
|
|
785
797
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -793,6 +805,10 @@ var CircularProgress = React13__namespace.forwardRef(
|
|
|
793
805
|
"crawlerSpeed",
|
|
794
806
|
"color",
|
|
795
807
|
"trackColor",
|
|
808
|
+
"showTrack",
|
|
809
|
+
"minProgress",
|
|
810
|
+
"maxProgress",
|
|
811
|
+
"amplitudeRange",
|
|
796
812
|
"className",
|
|
797
813
|
"aria-label"
|
|
798
814
|
]);
|
|
@@ -803,17 +819,22 @@ var CircularProgress = React13__namespace.forwardRef(
|
|
|
803
819
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
804
820
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
805
821
|
const isWavy = shape === "wavy";
|
|
822
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
806
823
|
const BASELINE_SIZE = 48;
|
|
807
824
|
const scaleFactor = size / BASELINE_SIZE;
|
|
808
|
-
const effectiveAmplitude =
|
|
825
|
+
const effectiveAmplitude = React6__namespace.useMemo(
|
|
809
826
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
810
827
|
[amplitude, scaleFactor]
|
|
811
828
|
);
|
|
812
|
-
const effectiveWavelength =
|
|
829
|
+
const effectiveWavelength = React6__namespace.useMemo(
|
|
813
830
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
814
831
|
[wavelength, scaleFactor]
|
|
815
832
|
);
|
|
816
|
-
const
|
|
833
|
+
const resolvedAmplitudeRange = React6__namespace.useMemo(
|
|
834
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
835
|
+
[amplitudeRange, effectiveAmplitude]
|
|
836
|
+
);
|
|
837
|
+
const wavyActivePath = React6__namespace.useMemo(
|
|
817
838
|
() => isWavy ? generateWavyCircularPath(
|
|
818
839
|
center,
|
|
819
840
|
radius,
|
|
@@ -822,8 +843,8 @@ var CircularProgress = React13__namespace.forwardRef(
|
|
|
822
843
|
) : null,
|
|
823
844
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
824
845
|
);
|
|
825
|
-
const circumference =
|
|
826
|
-
const gapForTrack =
|
|
846
|
+
const circumference = React6__namespace.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
847
|
+
const gapForTrack = React6__namespace.useMemo(
|
|
827
848
|
() => (gapSize + trackHeight) / circumference,
|
|
828
849
|
[gapSize, trackHeight, circumference]
|
|
829
850
|
);
|
|
@@ -832,6 +853,145 @@ var CircularProgress = React13__namespace.forwardRef(
|
|
|
832
853
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
833
854
|
const ActiveCircleElem = react.m.circle;
|
|
834
855
|
const ActivePathElem = react.m.path;
|
|
856
|
+
const indeterminateSvgRef = React6__namespace.useRef(null);
|
|
857
|
+
const indeterminateTrackRef = React6__namespace.useRef(null);
|
|
858
|
+
const indeterminateActiveRef = React6__namespace.useRef(null);
|
|
859
|
+
const indeterminateWavyTrackPathRef = React6__namespace.useRef(null);
|
|
860
|
+
const indeterminateWavyActivePathRef = React6__namespace.useRef(null);
|
|
861
|
+
const cachedPathLengthRef = React6__namespace.useRef(0);
|
|
862
|
+
React6__namespace.useLayoutEffect(() => {
|
|
863
|
+
if (!isWavy || !wavyActivePath) {
|
|
864
|
+
cachedPathLengthRef.current = circumference;
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
const el = indeterminateActiveRef.current;
|
|
868
|
+
if (el && "getTotalLength" in el) {
|
|
869
|
+
try {
|
|
870
|
+
const len = el.getTotalLength();
|
|
871
|
+
if (len > 0) {
|
|
872
|
+
cachedPathLengthRef.current = len;
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
} catch (e) {
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
cachedPathLengthRef.current = circumference;
|
|
879
|
+
}, [isWavy, circumference, wavyActivePath]);
|
|
880
|
+
react.useAnimationFrame((time) => {
|
|
881
|
+
if (isDeterminate) return;
|
|
882
|
+
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
883
|
+
const scaledTime = time * safeCrawlerSpeed;
|
|
884
|
+
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
885
|
+
const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
|
|
886
|
+
const additionalFullCycles = Math.floor(
|
|
887
|
+
scaledTime / ADDITIONAL_ROTATION_CYCLE
|
|
888
|
+
);
|
|
889
|
+
const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
|
|
890
|
+
const additionalEaseT = Math.min(
|
|
891
|
+
1,
|
|
892
|
+
additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
|
|
893
|
+
);
|
|
894
|
+
const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
|
|
895
|
+
const totalRotation = globalAngle + additionalAngle;
|
|
896
|
+
if (indeterminateSvgRef.current) {
|
|
897
|
+
indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
|
|
898
|
+
}
|
|
899
|
+
const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
|
|
900
|
+
const progressCycleTime = scaledTime % progressFullCycle;
|
|
901
|
+
let progress;
|
|
902
|
+
if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
|
|
903
|
+
const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
|
|
904
|
+
progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
|
|
905
|
+
} else {
|
|
906
|
+
const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
|
|
907
|
+
progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
|
|
908
|
+
}
|
|
909
|
+
if (isWavy) {
|
|
910
|
+
const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
|
|
911
|
+
const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
|
|
912
|
+
const dynamicPath = generateWavyCircularPath(
|
|
913
|
+
center,
|
|
914
|
+
radius,
|
|
915
|
+
currentAmplitude,
|
|
916
|
+
effectiveWavelength
|
|
917
|
+
);
|
|
918
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
919
|
+
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
920
|
+
}
|
|
921
|
+
if (indeterminateWavyTrackPathRef.current) {
|
|
922
|
+
indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
923
|
+
}
|
|
924
|
+
const pathEl = indeterminateWavyActivePathRef.current;
|
|
925
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
926
|
+
if (pathEl) {
|
|
927
|
+
try {
|
|
928
|
+
const len = pathEl.getTotalLength();
|
|
929
|
+
if (len > 0) totalLen = len;
|
|
930
|
+
} catch (e) {
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
934
|
+
const activeLen = totalLen * progress;
|
|
935
|
+
const activeOff = 0;
|
|
936
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
937
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
938
|
+
"stroke-dasharray",
|
|
939
|
+
`${activeLen} ${totalLen}`
|
|
940
|
+
);
|
|
941
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
942
|
+
"stroke-dashoffset",
|
|
943
|
+
`${activeOff}`
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
|
|
947
|
+
const trackStartFrac = progress + gapFrac;
|
|
948
|
+
const trackLen = Math.max(
|
|
949
|
+
1e-3,
|
|
950
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
951
|
+
);
|
|
952
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
953
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
954
|
+
"stroke-dasharray",
|
|
955
|
+
`${trackLen} ${totalLen}`
|
|
956
|
+
);
|
|
957
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
958
|
+
"stroke-dashoffset",
|
|
959
|
+
`${trackOff}`
|
|
960
|
+
);
|
|
961
|
+
}
|
|
962
|
+
} else {
|
|
963
|
+
const totalLen = circumference;
|
|
964
|
+
const activeLen = totalLen * progress;
|
|
965
|
+
const activeOff = 0;
|
|
966
|
+
if (indeterminateActiveRef.current) {
|
|
967
|
+
indeterminateActiveRef.current.setAttribute(
|
|
968
|
+
"stroke-dasharray",
|
|
969
|
+
`${activeLen} ${totalLen}`
|
|
970
|
+
);
|
|
971
|
+
indeterminateActiveRef.current.setAttribute(
|
|
972
|
+
"stroke-dashoffset",
|
|
973
|
+
`${activeOff}`
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
|
|
977
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
978
|
+
const trackStartFrac = progress + gapFrac;
|
|
979
|
+
const trackLen = Math.max(
|
|
980
|
+
1e-3,
|
|
981
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
982
|
+
);
|
|
983
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
984
|
+
indeterminateTrackRef.current.setAttribute(
|
|
985
|
+
"stroke-dasharray",
|
|
986
|
+
`${trackLen} ${totalLen}`
|
|
987
|
+
);
|
|
988
|
+
indeterminateTrackRef.current.setAttribute(
|
|
989
|
+
"stroke-dashoffset",
|
|
990
|
+
`${trackOff}`
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
});
|
|
835
995
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
836
996
|
"div",
|
|
837
997
|
__spreadProps(__spreadValues({
|
|
@@ -908,9 +1068,10 @@ var CircularProgress = React13__namespace.forwardRef(
|
|
|
908
1068
|
]
|
|
909
1069
|
}
|
|
910
1070
|
),
|
|
911
|
-
!isDeterminate && /* @__PURE__ */ jsxRuntime.
|
|
912
|
-
|
|
1071
|
+
!isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1072
|
+
"svg",
|
|
913
1073
|
{
|
|
1074
|
+
ref: indeterminateSvgRef,
|
|
914
1075
|
width: size,
|
|
915
1076
|
height: size,
|
|
916
1077
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -919,84 +1080,60 @@ var CircularProgress = React13__namespace.forwardRef(
|
|
|
919
1080
|
position: "absolute",
|
|
920
1081
|
inset: 0,
|
|
921
1082
|
overflow: "visible",
|
|
922
|
-
transformOrigin: "center"
|
|
923
|
-
|
|
924
|
-
animate: { rotate: [0, 360] },
|
|
925
|
-
transition: {
|
|
926
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
927
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
928
|
-
ease: "linear"
|
|
1083
|
+
transformOrigin: "center",
|
|
1084
|
+
transform: "rotate(-90deg)"
|
|
929
1085
|
},
|
|
930
|
-
children: [
|
|
931
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
932
|
-
|
|
1086
|
+
children: isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1087
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1088
|
+
"path",
|
|
933
1089
|
{
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
r: radius,
|
|
1090
|
+
ref: indeterminateWavyTrackPathRef,
|
|
1091
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
937
1092
|
fill: "none",
|
|
938
1093
|
stroke: bgTrackColor,
|
|
939
1094
|
strokeWidth: trackHeight,
|
|
940
|
-
strokeLinecap: "round"
|
|
941
|
-
animate: {
|
|
942
|
-
pathLength: [
|
|
943
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
944
|
-
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
945
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
946
|
-
],
|
|
947
|
-
pathOffset: [
|
|
948
|
-
0.1 + gapForTrack,
|
|
949
|
-
0.75 + gapForTrack,
|
|
950
|
-
0.1 + gapForTrack
|
|
951
|
-
]
|
|
952
|
-
},
|
|
953
|
-
transition: {
|
|
954
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
955
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
956
|
-
ease: [0.4, 0, 0.2, 1]
|
|
957
|
-
}
|
|
1095
|
+
strokeLinecap: "round"
|
|
958
1096
|
}
|
|
959
1097
|
),
|
|
960
|
-
|
|
961
|
-
|
|
1098
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1099
|
+
"path",
|
|
962
1100
|
{
|
|
1101
|
+
ref: indeterminateWavyActivePathRef,
|
|
963
1102
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
964
1103
|
fill: "none",
|
|
965
1104
|
stroke: activeColor,
|
|
966
1105
|
strokeWidth: trackHeight,
|
|
967
|
-
strokeLinecap: "round"
|
|
968
|
-
animate: {
|
|
969
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
970
|
-
pathOffset: [0, 0.65, 1]
|
|
971
|
-
},
|
|
972
|
-
transition: {
|
|
973
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
974
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
975
|
-
ease: [0.4, 0, 0.2, 1]
|
|
976
|
-
}
|
|
1106
|
+
strokeLinecap: "round"
|
|
977
1107
|
}
|
|
978
|
-
)
|
|
979
|
-
|
|
1108
|
+
)
|
|
1109
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1110
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1111
|
+
"circle",
|
|
1112
|
+
{
|
|
1113
|
+
ref: indeterminateTrackRef,
|
|
1114
|
+
cx: center,
|
|
1115
|
+
cy: center,
|
|
1116
|
+
r: radius,
|
|
1117
|
+
fill: "none",
|
|
1118
|
+
stroke: bgTrackColor,
|
|
1119
|
+
strokeWidth: trackHeight,
|
|
1120
|
+
strokeLinecap: "round"
|
|
1121
|
+
}
|
|
1122
|
+
),
|
|
1123
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1124
|
+
"circle",
|
|
980
1125
|
{
|
|
1126
|
+
ref: indeterminateActiveRef,
|
|
981
1127
|
cx: center,
|
|
982
1128
|
cy: center,
|
|
983
1129
|
r: radius,
|
|
984
1130
|
fill: "none",
|
|
985
1131
|
stroke: activeColor,
|
|
986
1132
|
strokeWidth: trackHeight,
|
|
987
|
-
strokeLinecap: "round"
|
|
988
|
-
animate: {
|
|
989
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
990
|
-
pathOffset: [0, 0.65, 1]
|
|
991
|
-
},
|
|
992
|
-
transition: {
|
|
993
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
994
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
995
|
-
ease: [0.4, 0, 0.2, 1]
|
|
996
|
-
}
|
|
1133
|
+
strokeLinecap: "round"
|
|
997
1134
|
}
|
|
998
1135
|
)
|
|
999
|
-
]
|
|
1136
|
+
] })
|
|
1000
1137
|
}
|
|
1001
1138
|
)
|
|
1002
1139
|
] })
|
|
@@ -1006,9 +1143,9 @@ var CircularProgress = React13__namespace.forwardRef(
|
|
|
1006
1143
|
);
|
|
1007
1144
|
CircularProgress.displayName = "CircularProgress";
|
|
1008
1145
|
function useContainerWidth() {
|
|
1009
|
-
const [width, setWidth] =
|
|
1010
|
-
const observerRef =
|
|
1011
|
-
const ref =
|
|
1146
|
+
const [width, setWidth] = React6__namespace.useState(0);
|
|
1147
|
+
const observerRef = React6__namespace.useRef(null);
|
|
1148
|
+
const ref = React6__namespace.useCallback((node) => {
|
|
1012
1149
|
if (observerRef.current) {
|
|
1013
1150
|
observerRef.current.disconnect();
|
|
1014
1151
|
observerRef.current = null;
|
|
@@ -1022,7 +1159,7 @@ function useContainerWidth() {
|
|
|
1022
1159
|
observerRef.current = obs;
|
|
1023
1160
|
}
|
|
1024
1161
|
}, []);
|
|
1025
|
-
|
|
1162
|
+
React6__namespace.useEffect(() => {
|
|
1026
1163
|
return () => {
|
|
1027
1164
|
if (observerRef.current) {
|
|
1028
1165
|
observerRef.current.disconnect();
|
|
@@ -1032,7 +1169,7 @@ function useContainerWidth() {
|
|
|
1032
1169
|
return [ref, width];
|
|
1033
1170
|
}
|
|
1034
1171
|
function useMergedRef(...refs) {
|
|
1035
|
-
return
|
|
1172
|
+
return React6__namespace.useCallback(
|
|
1036
1173
|
(node) => {
|
|
1037
1174
|
for (const ref of refs) {
|
|
1038
1175
|
if (typeof ref === "function") {
|
|
@@ -1046,7 +1183,7 @@ function useMergedRef(...refs) {
|
|
|
1046
1183
|
[refs]
|
|
1047
1184
|
);
|
|
1048
1185
|
}
|
|
1049
|
-
var FlatLinearTrack =
|
|
1186
|
+
var FlatLinearTrack = React6__namespace.memo(function FlatLinearTrack2({
|
|
1050
1187
|
trackHeight,
|
|
1051
1188
|
activeColor,
|
|
1052
1189
|
trackColor,
|
|
@@ -1122,7 +1259,7 @@ var FlatLinearTrack = React13__namespace.memo(function FlatLinearTrack2({
|
|
|
1122
1259
|
}
|
|
1123
1260
|
);
|
|
1124
1261
|
});
|
|
1125
|
-
var WavyLinearTrack =
|
|
1262
|
+
var WavyLinearTrack = React6__namespace.memo(function WavyLinearTrack2({
|
|
1126
1263
|
trackHeight,
|
|
1127
1264
|
svgHeight,
|
|
1128
1265
|
amplitude,
|
|
@@ -1141,13 +1278,13 @@ var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
|
|
|
1141
1278
|
}) {
|
|
1142
1279
|
const isDeterminate = typeof value === "number";
|
|
1143
1280
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1144
|
-
const titleId =
|
|
1281
|
+
const titleId = React6__namespace.useId();
|
|
1145
1282
|
const [containerRef, width] = useContainerWidth();
|
|
1146
|
-
const activePathRef =
|
|
1147
|
-
const trackPathRef =
|
|
1283
|
+
const activePathRef = React6__namespace.useRef(null);
|
|
1284
|
+
const trackPathRef = React6__namespace.useRef(null);
|
|
1148
1285
|
const amplitudeMV = react.useMotionValue(amplitude);
|
|
1149
1286
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1150
|
-
|
|
1287
|
+
React6__namespace.useEffect(() => {
|
|
1151
1288
|
if (isDeterminate) {
|
|
1152
1289
|
const fraction = clampedValue / 100;
|
|
1153
1290
|
let targetAmp = amplitude;
|
|
@@ -1202,7 +1339,7 @@ var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
|
|
|
1202
1339
|
currentAmp
|
|
1203
1340
|
);
|
|
1204
1341
|
} else if (fraction === 0) {
|
|
1205
|
-
activePathD =
|
|
1342
|
+
activePathD = "";
|
|
1206
1343
|
}
|
|
1207
1344
|
const trackStart = adjHead + totalGap;
|
|
1208
1345
|
if (trackStart < width - capWidth) {
|
|
@@ -1234,20 +1371,20 @@ var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
|
|
|
1234
1371
|
activeLines.push({ tail: l1T, head: l1H });
|
|
1235
1372
|
activeLines.push({ tail: l2T, head: l2H });
|
|
1236
1373
|
}
|
|
1237
|
-
const
|
|
1238
|
-
const
|
|
1239
|
-
const
|
|
1374
|
+
const activeSegments = activeLines.map((line) => {
|
|
1375
|
+
const rawTail = line.tail * width;
|
|
1376
|
+
const rawHead = line.head * width;
|
|
1240
1377
|
const adjTail = Math.max(
|
|
1241
1378
|
capWidth,
|
|
1242
|
-
Math.min(width - capWidth,
|
|
1379
|
+
Math.min(width - capWidth, rawTail)
|
|
1243
1380
|
);
|
|
1244
1381
|
const adjHead = Math.max(
|
|
1245
1382
|
capWidth,
|
|
1246
|
-
Math.min(width - capWidth,
|
|
1383
|
+
Math.min(width - capWidth, rawHead)
|
|
1247
1384
|
);
|
|
1248
1385
|
return { adjTail, adjHead };
|
|
1249
1386
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
1250
|
-
activePathD =
|
|
1387
|
+
activePathD = activeSegments.map(
|
|
1251
1388
|
(seg) => getSinePath(
|
|
1252
1389
|
seg.adjTail,
|
|
1253
1390
|
seg.adjHead,
|
|
@@ -1256,13 +1393,24 @@ var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
|
|
|
1256
1393
|
currentAmp
|
|
1257
1394
|
)
|
|
1258
1395
|
).join(" ");
|
|
1396
|
+
const validActiveLines = activeLines.filter(
|
|
1397
|
+
(line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
|
|
1398
|
+
).sort((a, b) => a.tail - b.tail);
|
|
1259
1399
|
let currentTrackX = capWidth;
|
|
1260
|
-
for (const
|
|
1261
|
-
const
|
|
1400
|
+
for (const line of validActiveLines) {
|
|
1401
|
+
const blockStart = line.tail * width - totalGap;
|
|
1402
|
+
const blockEnd = line.head * width + totalGap;
|
|
1403
|
+
const trackEnd = Math.min(width - capWidth, blockStart);
|
|
1262
1404
|
if (trackEnd > currentTrackX) {
|
|
1263
|
-
trackD += `${getSinePath(
|
|
1405
|
+
trackD += `${getSinePath(
|
|
1406
|
+
currentTrackX,
|
|
1407
|
+
trackEnd,
|
|
1408
|
+
phase,
|
|
1409
|
+
activeWavelength,
|
|
1410
|
+
trackAmp
|
|
1411
|
+
)} `;
|
|
1264
1412
|
}
|
|
1265
|
-
currentTrackX = Math.max(currentTrackX,
|
|
1413
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
1266
1414
|
}
|
|
1267
1415
|
if (currentTrackX < width - capWidth) {
|
|
1268
1416
|
trackD += getSinePath(
|
|
@@ -1275,9 +1423,9 @@ var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
|
|
|
1275
1423
|
}
|
|
1276
1424
|
}
|
|
1277
1425
|
if (activePathRef.current)
|
|
1278
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
1426
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
1279
1427
|
if (trackPathRef.current)
|
|
1280
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
1428
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
1281
1429
|
});
|
|
1282
1430
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1283
1431
|
"div",
|
|
@@ -1324,7 +1472,7 @@ var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
|
|
|
1324
1472
|
}
|
|
1325
1473
|
);
|
|
1326
1474
|
});
|
|
1327
|
-
var LinearProgress =
|
|
1475
|
+
var LinearProgress = React6__namespace.forwardRef(
|
|
1328
1476
|
(_a, ref) => {
|
|
1329
1477
|
var _b = _a, {
|
|
1330
1478
|
value,
|
|
@@ -1365,10 +1513,10 @@ var LinearProgress = React13__namespace.forwardRef(
|
|
|
1365
1513
|
]);
|
|
1366
1514
|
const isDeterminate = value !== void 0;
|
|
1367
1515
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1368
|
-
const containerRef =
|
|
1516
|
+
const containerRef = React6__namespace.useRef(null);
|
|
1369
1517
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1370
|
-
const [isRtl, setIsRtl] =
|
|
1371
|
-
|
|
1518
|
+
const [isRtl, setIsRtl] = React6__namespace.useState(false);
|
|
1519
|
+
React6__namespace.useEffect(() => {
|
|
1372
1520
|
if (containerRef.current) {
|
|
1373
1521
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1374
1522
|
setIsRtl(dir === "rtl");
|
|
@@ -1376,16 +1524,16 @@ var LinearProgress = React13__namespace.forwardRef(
|
|
|
1376
1524
|
}, []);
|
|
1377
1525
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1378
1526
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1379
|
-
const effectiveAmplitude =
|
|
1380
|
-
const svgHeight =
|
|
1527
|
+
const effectiveAmplitude = React6__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1528
|
+
const svgHeight = React6__namespace.useMemo(
|
|
1381
1529
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1382
1530
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1383
1531
|
);
|
|
1384
|
-
const shouldShowStop =
|
|
1532
|
+
const shouldShowStop = React6__namespace.useMemo(
|
|
1385
1533
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1386
1534
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1387
1535
|
);
|
|
1388
|
-
const stopSize =
|
|
1536
|
+
const stopSize = React6__namespace.useMemo(
|
|
1389
1537
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1390
1538
|
[trackHeight]
|
|
1391
1539
|
);
|
|
@@ -1460,14 +1608,14 @@ var LinearProgress = React13__namespace.forwardRef(
|
|
|
1460
1608
|
}
|
|
1461
1609
|
);
|
|
1462
1610
|
LinearProgress.displayName = "LinearProgress";
|
|
1463
|
-
var ProgressIndicator =
|
|
1611
|
+
var ProgressIndicator = React6__namespace.forwardRef((props, ref) => {
|
|
1464
1612
|
if (props.variant === "circular") {
|
|
1465
1613
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1466
1614
|
}
|
|
1467
1615
|
return /* @__PURE__ */ jsxRuntime.jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
1468
1616
|
});
|
|
1469
1617
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
1470
|
-
var RippleItem =
|
|
1618
|
+
var RippleItem = React6__namespace.memo(function RippleItem2({
|
|
1471
1619
|
ripple,
|
|
1472
1620
|
onDone
|
|
1473
1621
|
}) {
|
|
@@ -1511,8 +1659,8 @@ function Ripple({
|
|
|
1511
1659
|
}
|
|
1512
1660
|
function useRippleState(options = {}) {
|
|
1513
1661
|
const { disabled = false } = options;
|
|
1514
|
-
const [ripples, setRipples] =
|
|
1515
|
-
const onPointerDown =
|
|
1662
|
+
const [ripples, setRipples] = React6__namespace.useState([]);
|
|
1663
|
+
const onPointerDown = React6__namespace.useCallback(
|
|
1516
1664
|
(e) => {
|
|
1517
1665
|
if (disabled) return;
|
|
1518
1666
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1529,7 +1677,7 @@ function useRippleState(options = {}) {
|
|
|
1529
1677
|
},
|
|
1530
1678
|
[disabled]
|
|
1531
1679
|
);
|
|
1532
|
-
const removeRipple =
|
|
1680
|
+
const removeRipple = React6__namespace.useCallback((id) => {
|
|
1533
1681
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1534
1682
|
}, []);
|
|
1535
1683
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1677,7 +1825,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1677
1825
|
}
|
|
1678
1826
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1679
1827
|
}
|
|
1680
|
-
var IconButtonComponent =
|
|
1828
|
+
var IconButtonComponent = React6__namespace.forwardRef(
|
|
1681
1829
|
(_a, ref) => {
|
|
1682
1830
|
var _b = _a, {
|
|
1683
1831
|
className,
|
|
@@ -1719,18 +1867,18 @@ var IconButtonComponent = React13__namespace.forwardRef(
|
|
|
1719
1867
|
var _a2, _b2, _c, _d, _e;
|
|
1720
1868
|
const isToggle = variant === "toggle";
|
|
1721
1869
|
const isSelected = isToggle && !!selected;
|
|
1722
|
-
const resolvedColorClass =
|
|
1870
|
+
const resolvedColorClass = React6__namespace.useMemo(
|
|
1723
1871
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1724
1872
|
[isSelected, colorStyle]
|
|
1725
1873
|
);
|
|
1726
|
-
const outlineWidthClass =
|
|
1874
|
+
const outlineWidthClass = React6__namespace.useMemo(
|
|
1727
1875
|
() => {
|
|
1728
1876
|
var _a3;
|
|
1729
1877
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1730
1878
|
},
|
|
1731
1879
|
[colorStyle, isSelected, size]
|
|
1732
1880
|
);
|
|
1733
|
-
const disabledBgClass =
|
|
1881
|
+
const disabledBgClass = React6__namespace.useMemo(
|
|
1734
1882
|
() => resolveDisabledBgClass(colorStyle),
|
|
1735
1883
|
[colorStyle]
|
|
1736
1884
|
);
|
|
@@ -1753,7 +1901,7 @@ var IconButtonComponent = React13__namespace.forwardRef(
|
|
|
1753
1901
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1754
1902
|
disabled: loading
|
|
1755
1903
|
});
|
|
1756
|
-
const handleClick =
|
|
1904
|
+
const handleClick = React6__namespace.useCallback(
|
|
1757
1905
|
(e) => {
|
|
1758
1906
|
if (loading) {
|
|
1759
1907
|
e.preventDefault();
|
|
@@ -1763,7 +1911,7 @@ var IconButtonComponent = React13__namespace.forwardRef(
|
|
|
1763
1911
|
},
|
|
1764
1912
|
[loading, onClick]
|
|
1765
1913
|
);
|
|
1766
|
-
const handleKeyDown =
|
|
1914
|
+
const handleKeyDown = React6__namespace.useCallback(
|
|
1767
1915
|
(e) => {
|
|
1768
1916
|
if (loading) return;
|
|
1769
1917
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1819,7 +1967,7 @@ var IconButtonComponent = React13__namespace.forwardRef(
|
|
|
1819
1967
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1820
1968
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1821
1969
|
},
|
|
1822
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
1970
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React6__namespace.Children.only(children).props.children : children
|
|
1823
1971
|
}),
|
|
1824
1972
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1825
1973
|
) })
|
|
@@ -1836,7 +1984,7 @@ var IconButtonComponent = React13__namespace.forwardRef(
|
|
|
1836
1984
|
className
|
|
1837
1985
|
);
|
|
1838
1986
|
if (asChild) {
|
|
1839
|
-
const child =
|
|
1987
|
+
const child = React6__namespace.Children.only(children);
|
|
1840
1988
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1841
1989
|
reactSlot.Slot,
|
|
1842
1990
|
__spreadProps(__spreadValues({
|
|
@@ -1853,7 +2001,7 @@ var IconButtonComponent = React13__namespace.forwardRef(
|
|
|
1853
2001
|
}),
|
|
1854
2002
|
className: containerClassName
|
|
1855
2003
|
}, restProps), {
|
|
1856
|
-
children:
|
|
2004
|
+
children: React6__namespace.cloneElement(child, { children: innerContent })
|
|
1857
2005
|
})
|
|
1858
2006
|
) });
|
|
1859
2007
|
}
|
|
@@ -1881,13 +2029,13 @@ var IconButtonComponent = React13__namespace.forwardRef(
|
|
|
1881
2029
|
}
|
|
1882
2030
|
);
|
|
1883
2031
|
IconButtonComponent.displayName = "IconButton";
|
|
1884
|
-
var IconButton =
|
|
2032
|
+
var IconButton = React6__namespace.memo(IconButtonComponent);
|
|
1885
2033
|
var VARIANT_FONT = {
|
|
1886
2034
|
outlined: "'Material Symbols Outlined'",
|
|
1887
2035
|
rounded: "'Material Symbols Rounded'",
|
|
1888
2036
|
sharp: "'Material Symbols Sharp'"
|
|
1889
2037
|
};
|
|
1890
|
-
var IconComponent =
|
|
2038
|
+
var IconComponent = React6__namespace.forwardRef(
|
|
1891
2039
|
(_a, ref) => {
|
|
1892
2040
|
var _b = _a, {
|
|
1893
2041
|
name,
|
|
@@ -1953,7 +2101,7 @@ var IconComponent = React13__namespace.forwardRef(
|
|
|
1953
2101
|
}
|
|
1954
2102
|
);
|
|
1955
2103
|
IconComponent.displayName = "Icon";
|
|
1956
|
-
var Icon =
|
|
2104
|
+
var Icon = React6__namespace.memo(IconComponent);
|
|
1957
2105
|
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";
|
|
1958
2106
|
var CalendarHeader = ({
|
|
1959
2107
|
displayedMonthMs,
|
|
@@ -2111,15 +2259,15 @@ var MonthPickerList = ({
|
|
|
2111
2259
|
locale,
|
|
2112
2260
|
onMonthSelect
|
|
2113
2261
|
}) => {
|
|
2114
|
-
const selectedRef =
|
|
2115
|
-
|
|
2262
|
+
const selectedRef = React6__namespace.useRef(null);
|
|
2263
|
+
React6__namespace.useEffect(() => {
|
|
2116
2264
|
var _a, _b;
|
|
2117
2265
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2118
2266
|
block: "center",
|
|
2119
2267
|
behavior: "instant"
|
|
2120
2268
|
});
|
|
2121
2269
|
}, []);
|
|
2122
|
-
const months =
|
|
2270
|
+
const months = React6__namespace.useMemo(
|
|
2123
2271
|
() => Array.from({ length: 12 }, (_, month) => month),
|
|
2124
2272
|
[]
|
|
2125
2273
|
);
|
|
@@ -2164,12 +2312,12 @@ var YearPickerList = ({
|
|
|
2164
2312
|
selectableDates,
|
|
2165
2313
|
onYearSelect
|
|
2166
2314
|
}) => {
|
|
2167
|
-
const selectedRef =
|
|
2168
|
-
const years =
|
|
2315
|
+
const selectedRef = React6__namespace.useRef(null);
|
|
2316
|
+
const years = React6__namespace.useMemo(() => {
|
|
2169
2317
|
const [min, max] = yearRange;
|
|
2170
2318
|
return Array.from({ length: max - min + 1 }, (_, index) => min + index);
|
|
2171
2319
|
}, [yearRange]);
|
|
2172
|
-
|
|
2320
|
+
React6__namespace.useEffect(() => {
|
|
2173
2321
|
var _a, _b;
|
|
2174
2322
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2175
2323
|
block: "center",
|
|
@@ -2240,17 +2388,17 @@ var DatePicker = ({
|
|
|
2240
2388
|
navigateToMonth,
|
|
2241
2389
|
setDisplayMode
|
|
2242
2390
|
} = state;
|
|
2243
|
-
const [activeSelector, setActiveSelector] =
|
|
2244
|
-
const [slideDirection, setSlideDirection] =
|
|
2245
|
-
const handlePrev =
|
|
2391
|
+
const [activeSelector, setActiveSelector] = React6__namespace.useState(null);
|
|
2392
|
+
const [slideDirection, setSlideDirection] = React6__namespace.useState(null);
|
|
2393
|
+
const handlePrev = React6__namespace.useCallback(() => {
|
|
2246
2394
|
setSlideDirection("prev");
|
|
2247
2395
|
navigateMonth2("prev");
|
|
2248
2396
|
}, [navigateMonth2]);
|
|
2249
|
-
const handleNext =
|
|
2397
|
+
const handleNext = React6__namespace.useCallback(() => {
|
|
2250
2398
|
setSlideDirection("next");
|
|
2251
2399
|
navigateMonth2("next");
|
|
2252
2400
|
}, [navigateMonth2]);
|
|
2253
|
-
const handleYearSelect =
|
|
2401
|
+
const handleYearSelect = React6__namespace.useCallback(
|
|
2254
2402
|
(year) => {
|
|
2255
2403
|
const d = new Date(displayedMonthMs);
|
|
2256
2404
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2258,7 +2406,7 @@ var DatePicker = ({
|
|
|
2258
2406
|
},
|
|
2259
2407
|
[displayedMonthMs, navigateToMonth]
|
|
2260
2408
|
);
|
|
2261
|
-
const handleMonthSelect =
|
|
2409
|
+
const handleMonthSelect = React6__namespace.useCallback(
|
|
2262
2410
|
(month) => {
|
|
2263
2411
|
const d = new Date(displayedMonthMs);
|
|
2264
2412
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2266,11 +2414,11 @@ var DatePicker = ({
|
|
|
2266
2414
|
},
|
|
2267
2415
|
[displayedMonthMs, navigateToMonth]
|
|
2268
2416
|
);
|
|
2269
|
-
const [inputValue, setInputValue] =
|
|
2417
|
+
const [inputValue, setInputValue] = React6__namespace.useState(
|
|
2270
2418
|
() => selectedDateMs !== null ? formatInputDate(selectedDateMs) : ""
|
|
2271
2419
|
);
|
|
2272
|
-
const [inputError, setInputError] =
|
|
2273
|
-
const handleInputCommit =
|
|
2420
|
+
const [inputError, setInputError] = React6__namespace.useState();
|
|
2421
|
+
const handleInputCommit = React6__namespace.useCallback(
|
|
2274
2422
|
(ms) => {
|
|
2275
2423
|
if (ms === null && inputValue.length > 0) {
|
|
2276
2424
|
setInputError("Invalid date");
|
|
@@ -2510,7 +2658,7 @@ var DP_CLASSES = {
|
|
|
2510
2658
|
/** Weekday header row */
|
|
2511
2659
|
weekdayRow: "text-[length:var(--md-typescale-body-large-size,14px)] text-m3-on-surface"
|
|
2512
2660
|
};
|
|
2513
|
-
var ScrollArea =
|
|
2661
|
+
var ScrollArea = React6__namespace.forwardRef(
|
|
2514
2662
|
(_a, ref) => {
|
|
2515
2663
|
var _b = _a, {
|
|
2516
2664
|
className,
|
|
@@ -2531,15 +2679,15 @@ var ScrollArea = React13__namespace.forwardRef(
|
|
|
2531
2679
|
"viewportRef",
|
|
2532
2680
|
"viewportProps"
|
|
2533
2681
|
]);
|
|
2534
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
2535
|
-
|
|
2682
|
+
const [isTouchDevice, setIsTouchDevice] = React6__namespace.useState(false);
|
|
2683
|
+
React6__namespace.useEffect(() => {
|
|
2536
2684
|
if (typeof window !== "undefined") {
|
|
2537
2685
|
setIsTouchDevice(
|
|
2538
2686
|
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
2539
2687
|
);
|
|
2540
2688
|
}
|
|
2541
2689
|
}, []);
|
|
2542
|
-
const resolvedType =
|
|
2690
|
+
const resolvedType = React6__namespace.useMemo(() => {
|
|
2543
2691
|
if (type === "hover" && isTouchDevice) {
|
|
2544
2692
|
return "scroll";
|
|
2545
2693
|
}
|
|
@@ -2590,7 +2738,7 @@ var ScrollArea = React13__namespace.forwardRef(
|
|
|
2590
2738
|
}
|
|
2591
2739
|
);
|
|
2592
2740
|
ScrollArea.displayName = "ScrollArea";
|
|
2593
|
-
var ScrollAreaScrollbar =
|
|
2741
|
+
var ScrollAreaScrollbar = React6__namespace.forwardRef((_a, ref) => {
|
|
2594
2742
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
2595
2743
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2596
2744
|
RadixScrollArea__namespace.Scrollbar,
|
|
@@ -2620,7 +2768,7 @@ var ScrollAreaScrollbar = React13__namespace.forwardRef((_a, ref) => {
|
|
|
2620
2768
|
);
|
|
2621
2769
|
});
|
|
2622
2770
|
ScrollAreaScrollbar.displayName = RadixScrollArea__namespace.Scrollbar.displayName;
|
|
2623
|
-
var ScrollAreaCorner =
|
|
2771
|
+
var ScrollAreaCorner = React6__namespace.forwardRef((_a, ref) => {
|
|
2624
2772
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2625
2773
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2626
2774
|
RadixScrollArea__namespace.Corner,
|
|
@@ -2662,9 +2810,9 @@ DialogTrigger.displayName = "DialogTrigger";
|
|
|
2662
2810
|
var DialogPortal = ({
|
|
2663
2811
|
open,
|
|
2664
2812
|
children
|
|
2665
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { forceMount: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: open ?
|
|
2813
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { forceMount: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: open ? React6__namespace.Children.toArray(children) : null }) });
|
|
2666
2814
|
DialogPortal.displayName = "DialogPortal";
|
|
2667
|
-
var DialogOverlay =
|
|
2815
|
+
var DialogOverlay = React6__namespace.forwardRef((_a, ref) => {
|
|
2668
2816
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2669
2817
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2670
2818
|
react.m.div,
|
|
@@ -2675,7 +2823,7 @@ var DialogOverlay = React13__namespace.forwardRef((_a, ref) => {
|
|
|
2675
2823
|
) }));
|
|
2676
2824
|
});
|
|
2677
2825
|
DialogOverlay.displayName = "DialogOverlay";
|
|
2678
|
-
var DialogContent =
|
|
2826
|
+
var DialogContent = React6__namespace.forwardRef((_a, ref) => {
|
|
2679
2827
|
var _b = _a, { className, children, hideCloseButton = false } = _b, props = __objRest(_b, ["className", "children", "hideCloseButton"]);
|
|
2680
2828
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2681
2829
|
RadixDialog__namespace.Content,
|
|
@@ -2715,7 +2863,7 @@ var DialogContent = React13__namespace.forwardRef((_a, ref) => {
|
|
|
2715
2863
|
);
|
|
2716
2864
|
});
|
|
2717
2865
|
DialogContent.displayName = "DialogContent";
|
|
2718
|
-
var DialogIcon =
|
|
2866
|
+
var DialogIcon = React6__namespace.forwardRef((_a, ref) => {
|
|
2719
2867
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
2720
2868
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2721
2869
|
"div",
|
|
@@ -2729,7 +2877,7 @@ var DialogIcon = React13__namespace.forwardRef((_a, ref) => {
|
|
|
2729
2877
|
);
|
|
2730
2878
|
});
|
|
2731
2879
|
DialogIcon.displayName = "DialogIcon";
|
|
2732
|
-
var DialogTitle =
|
|
2880
|
+
var DialogTitle = React6__namespace.forwardRef((_a, ref) => {
|
|
2733
2881
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2734
2882
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2735
2883
|
RadixDialog__namespace.Title,
|
|
@@ -2744,7 +2892,7 @@ var DialogTitle = React13__namespace.forwardRef((_a, ref) => {
|
|
|
2744
2892
|
);
|
|
2745
2893
|
});
|
|
2746
2894
|
DialogTitle.displayName = "DialogTitle";
|
|
2747
|
-
var DialogDescription =
|
|
2895
|
+
var DialogDescription = React6__namespace.forwardRef((_a, ref) => {
|
|
2748
2896
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2749
2897
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2750
2898
|
RadixDialog__namespace.Description,
|
|
@@ -2756,7 +2904,7 @@ var DialogDescription = React13__namespace.forwardRef((_a, ref) => {
|
|
|
2756
2904
|
);
|
|
2757
2905
|
});
|
|
2758
2906
|
DialogDescription.displayName = "DialogDescription";
|
|
2759
|
-
var DialogBody =
|
|
2907
|
+
var DialogBody = React6__namespace.forwardRef((_a, ref) => {
|
|
2760
2908
|
var _b = _a, { className, children, dir } = _b, props = __objRest(_b, ["className", "children", "dir"]);
|
|
2761
2909
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2762
2910
|
ScrollArea,
|
|
@@ -2772,7 +2920,7 @@ var DialogBody = React13__namespace.forwardRef((_a, ref) => {
|
|
|
2772
2920
|
);
|
|
2773
2921
|
});
|
|
2774
2922
|
DialogBody.displayName = "DialogBody";
|
|
2775
|
-
var DialogFullScreenContent =
|
|
2923
|
+
var DialogFullScreenContent = React6__namespace.forwardRef(
|
|
2776
2924
|
(_a, ref) => {
|
|
2777
2925
|
var _b = _a, {
|
|
2778
2926
|
className,
|
|
@@ -2920,17 +3068,17 @@ var DateRangePicker = ({
|
|
|
2920
3068
|
navigateToMonth,
|
|
2921
3069
|
setDisplayMode
|
|
2922
3070
|
} = state;
|
|
2923
|
-
const [activeSelector, setActiveSelector] =
|
|
2924
|
-
const [slideDirection, setSlideDirection] =
|
|
2925
|
-
const handlePrev =
|
|
3071
|
+
const [activeSelector, setActiveSelector] = React6__namespace.useState(null);
|
|
3072
|
+
const [slideDirection, setSlideDirection] = React6__namespace.useState(null);
|
|
3073
|
+
const handlePrev = React6__namespace.useCallback(() => {
|
|
2926
3074
|
setSlideDirection("prev");
|
|
2927
3075
|
navigateMonth2("prev");
|
|
2928
3076
|
}, [navigateMonth2]);
|
|
2929
|
-
const handleNext =
|
|
3077
|
+
const handleNext = React6__namespace.useCallback(() => {
|
|
2930
3078
|
setSlideDirection("next");
|
|
2931
3079
|
navigateMonth2("next");
|
|
2932
3080
|
}, [navigateMonth2]);
|
|
2933
|
-
const handleYearSelect =
|
|
3081
|
+
const handleYearSelect = React6__namespace.useCallback(
|
|
2934
3082
|
(year) => {
|
|
2935
3083
|
const d = new Date(displayedMonthMs);
|
|
2936
3084
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2938,7 +3086,7 @@ var DateRangePicker = ({
|
|
|
2938
3086
|
},
|
|
2939
3087
|
[displayedMonthMs, navigateToMonth]
|
|
2940
3088
|
);
|
|
2941
|
-
const handleMonthSelect =
|
|
3089
|
+
const handleMonthSelect = React6__namespace.useCallback(
|
|
2942
3090
|
(month) => {
|
|
2943
3091
|
const d = new Date(displayedMonthMs);
|
|
2944
3092
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2946,7 +3094,7 @@ var DateRangePicker = ({
|
|
|
2946
3094
|
},
|
|
2947
3095
|
[displayedMonthMs, navigateToMonth]
|
|
2948
3096
|
);
|
|
2949
|
-
const formatShort =
|
|
3097
|
+
const formatShort = React6__namespace.useCallback(
|
|
2950
3098
|
(ms) => {
|
|
2951
3099
|
if (ms === null) return "\u2014";
|
|
2952
3100
|
return formatDate(ms, locale, {
|
|
@@ -3090,12 +3238,12 @@ var useDatePickerState = (options) => {
|
|
|
3090
3238
|
const selectableDates = (_d = options == null ? void 0 : options.selectableDates) != null ? _d : ALL_DATES_SELECTABLE;
|
|
3091
3239
|
const initialDisplayMode = (_e = options == null ? void 0 : options.initialDisplayMode) != null ? _e : DEFAULT_DISPLAY_MODE;
|
|
3092
3240
|
const locale = resolveLocale(options == null ? void 0 : options.locale);
|
|
3093
|
-
const [selectedDateMs, setSelectedDateMs] =
|
|
3241
|
+
const [selectedDateMs, setSelectedDateMs] = React6.useState(
|
|
3094
3242
|
initialSelectedMs !== null ? startOfDayUTC(initialSelectedMs) : null
|
|
3095
3243
|
);
|
|
3096
|
-
const [displayedMonthMs, setDisplayedMonthMs] =
|
|
3097
|
-
const [displayMode, setDisplayModeState] =
|
|
3098
|
-
const selectDate =
|
|
3244
|
+
const [displayedMonthMs, setDisplayedMonthMs] = React6.useState(initialMonthMs);
|
|
3245
|
+
const [displayMode, setDisplayModeState] = React6.useState(initialDisplayMode);
|
|
3246
|
+
const selectDate = React6.useCallback(
|
|
3099
3247
|
(ms) => {
|
|
3100
3248
|
if (ms === null) {
|
|
3101
3249
|
setSelectedDateMs(null);
|
|
@@ -3108,7 +3256,7 @@ var useDatePickerState = (options) => {
|
|
|
3108
3256
|
},
|
|
3109
3257
|
[selectableDates]
|
|
3110
3258
|
);
|
|
3111
|
-
const navigateMonthAction =
|
|
3259
|
+
const navigateMonthAction = React6.useCallback(
|
|
3112
3260
|
(direction) => {
|
|
3113
3261
|
setDisplayedMonthMs(
|
|
3114
3262
|
(prev) => {
|
|
@@ -3119,24 +3267,24 @@ var useDatePickerState = (options) => {
|
|
|
3119
3267
|
},
|
|
3120
3268
|
[yearRange, selectableDates]
|
|
3121
3269
|
);
|
|
3122
|
-
const navigateToMonth =
|
|
3270
|
+
const navigateToMonth = React6.useCallback(
|
|
3123
3271
|
(year, month) => {
|
|
3124
3272
|
if (!isMonthNavigable(year, yearRange, selectableDates)) return;
|
|
3125
3273
|
setDisplayedMonthMs(Date.UTC(year, month, 1));
|
|
3126
3274
|
},
|
|
3127
3275
|
[yearRange, selectableDates]
|
|
3128
3276
|
);
|
|
3129
|
-
const setDisplayMode =
|
|
3277
|
+
const setDisplayMode = React6.useCallback((mode) => {
|
|
3130
3278
|
setDisplayModeState(mode);
|
|
3131
3279
|
}, []);
|
|
3132
|
-
const reset =
|
|
3280
|
+
const reset = React6.useCallback(() => {
|
|
3133
3281
|
setSelectedDateMs(
|
|
3134
3282
|
initialSelectedMs !== null ? startOfDayUTC(initialSelectedMs) : null
|
|
3135
3283
|
);
|
|
3136
3284
|
setDisplayedMonthMs(initialMonthMs);
|
|
3137
3285
|
setDisplayModeState(initialDisplayMode);
|
|
3138
3286
|
}, [initialSelectedMs, initialMonthMs, initialDisplayMode]);
|
|
3139
|
-
return
|
|
3287
|
+
return React6.useMemo(
|
|
3140
3288
|
() => ({
|
|
3141
3289
|
selectedDateMs,
|
|
3142
3290
|
displayedMonthMs,
|
|
@@ -3195,13 +3343,13 @@ var useDateRangePickerState = (options) => {
|
|
|
3195
3343
|
const selectableDates = (_c = options == null ? void 0 : options.selectableDates) != null ? _c : ALL_DATES_SELECTABLE;
|
|
3196
3344
|
const initialDisplayMode = (_d = options == null ? void 0 : options.initialDisplayMode) != null ? _d : "picker";
|
|
3197
3345
|
const locale = resolveLocale(options == null ? void 0 : options.locale);
|
|
3198
|
-
const [{ startMs: selectedStartMs, endMs: selectedEndMs }, dispatch] =
|
|
3346
|
+
const [{ startMs: selectedStartMs, endMs: selectedEndMs }, dispatch] = React6.useReducer(rangeReducer, {
|
|
3199
3347
|
startMs: initialStartMs,
|
|
3200
3348
|
endMs: initialEndMs
|
|
3201
3349
|
});
|
|
3202
|
-
const [displayedMonthMs, setDisplayedMonthMs] =
|
|
3203
|
-
const [displayMode, setDisplayModeState] =
|
|
3204
|
-
const selectDate =
|
|
3350
|
+
const [displayedMonthMs, setDisplayedMonthMs] = React6.useState(initialMonthMs);
|
|
3351
|
+
const [displayMode, setDisplayModeState] = React6.useState(initialDisplayMode);
|
|
3352
|
+
const selectDate = React6.useCallback(
|
|
3205
3353
|
(ms) => {
|
|
3206
3354
|
const normalized = startOfDayUTC(ms);
|
|
3207
3355
|
if (!selectableDates.isSelectableDate(normalized)) return;
|
|
@@ -3209,10 +3357,10 @@ var useDateRangePickerState = (options) => {
|
|
|
3209
3357
|
},
|
|
3210
3358
|
[selectableDates]
|
|
3211
3359
|
);
|
|
3212
|
-
const clearRange =
|
|
3360
|
+
const clearRange = React6.useCallback(() => {
|
|
3213
3361
|
dispatch({ type: "CLEAR" });
|
|
3214
3362
|
}, []);
|
|
3215
|
-
const navigateMonthAction =
|
|
3363
|
+
const navigateMonthAction = React6.useCallback(
|
|
3216
3364
|
(direction) => {
|
|
3217
3365
|
setDisplayedMonthMs(
|
|
3218
3366
|
(prev) => {
|
|
@@ -3223,22 +3371,22 @@ var useDateRangePickerState = (options) => {
|
|
|
3223
3371
|
},
|
|
3224
3372
|
[yearRange, selectableDates]
|
|
3225
3373
|
);
|
|
3226
|
-
const navigateToMonth =
|
|
3374
|
+
const navigateToMonth = React6.useCallback(
|
|
3227
3375
|
(year, month) => {
|
|
3228
3376
|
if (!isMonthNavigable(year, yearRange, selectableDates)) return;
|
|
3229
3377
|
setDisplayedMonthMs(Date.UTC(year, month, 1));
|
|
3230
3378
|
},
|
|
3231
3379
|
[yearRange, selectableDates]
|
|
3232
3380
|
);
|
|
3233
|
-
const setDisplayMode =
|
|
3381
|
+
const setDisplayMode = React6.useCallback((mode) => {
|
|
3234
3382
|
setDisplayModeState(mode);
|
|
3235
3383
|
}, []);
|
|
3236
|
-
const reset =
|
|
3384
|
+
const reset = React6.useCallback(() => {
|
|
3237
3385
|
dispatch({ type: "RESET", startMs: initialStartMs, endMs: initialEndMs });
|
|
3238
3386
|
setDisplayedMonthMs(initialMonthMs);
|
|
3239
3387
|
setDisplayModeState(initialDisplayMode);
|
|
3240
3388
|
}, [initialStartMs, initialEndMs, initialMonthMs, initialDisplayMode]);
|
|
3241
|
-
return
|
|
3389
|
+
return React6.useMemo(
|
|
3242
3390
|
() => ({
|
|
3243
3391
|
selectedStartMs,
|
|
3244
3392
|
selectedEndMs,
|
|
@@ -3557,16 +3705,16 @@ var InputField = ({
|
|
|
3557
3705
|
onBlur,
|
|
3558
3706
|
className
|
|
3559
3707
|
}) => {
|
|
3560
|
-
const [inputText, setInputText] =
|
|
3708
|
+
const [inputText, setInputText] = React6__namespace.useState(
|
|
3561
3709
|
String(value).padStart(2, "0")
|
|
3562
3710
|
);
|
|
3563
|
-
const inputRef =
|
|
3564
|
-
|
|
3711
|
+
const inputRef = React6__namespace.useRef(null);
|
|
3712
|
+
React6__namespace.useEffect(() => {
|
|
3565
3713
|
if (!isFocused) {
|
|
3566
3714
|
setInputText(String(value).padStart(2, "0"));
|
|
3567
3715
|
}
|
|
3568
3716
|
}, [value, isFocused]);
|
|
3569
|
-
|
|
3717
|
+
React6__namespace.useEffect(() => {
|
|
3570
3718
|
var _a, _b;
|
|
3571
3719
|
if (isFocused) {
|
|
3572
3720
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -3656,7 +3804,7 @@ var InputField = ({
|
|
|
3656
3804
|
};
|
|
3657
3805
|
var TimeInput = ({ state, className }) => {
|
|
3658
3806
|
const { is24hour, setHourInput, setMinuteInput, setSelection } = state;
|
|
3659
|
-
const [focusedField, setFocusedField] =
|
|
3807
|
+
const [focusedField, setFocusedField] = React6__namespace.useState(null);
|
|
3660
3808
|
const handleHourAutoAdvance = () => {
|
|
3661
3809
|
setFocusedField("minute");
|
|
3662
3810
|
setSelection("minute");
|
|
@@ -3850,17 +3998,17 @@ var ClockDial = ({
|
|
|
3850
3998
|
setMinute,
|
|
3851
3999
|
setSelection
|
|
3852
4000
|
} = state;
|
|
3853
|
-
const displayAngle =
|
|
4001
|
+
const displayAngle = React6__namespace.useMemo(() => {
|
|
3854
4002
|
if (selection === "hour") {
|
|
3855
4003
|
return valueToAngle(hour, "hour");
|
|
3856
4004
|
}
|
|
3857
4005
|
return valueToAngle(minute, "minute");
|
|
3858
4006
|
}, [selection, hour, minute]);
|
|
3859
|
-
const selectorPos =
|
|
4007
|
+
const selectorPos = React6__namespace.useMemo(
|
|
3860
4008
|
() => getSelectorPosition(displayAngle, selection, is24hour, isPm),
|
|
3861
4009
|
[displayAngle, selection, is24hour, isPm]
|
|
3862
4010
|
);
|
|
3863
|
-
const trackEnd =
|
|
4011
|
+
const trackEnd = React6__namespace.useMemo(() => {
|
|
3864
4012
|
const dx = selectorPos.x - CENTER;
|
|
3865
4013
|
const dy = selectorPos.y - CENTER;
|
|
3866
4014
|
const length = Math.hypot(dx, dy);
|
|
@@ -3870,13 +4018,13 @@ var ClockDial = ({
|
|
|
3870
4018
|
y: selectorPos.y - dy / length * HANDLE_RADIUS
|
|
3871
4019
|
};
|
|
3872
4020
|
}, [selectorPos]);
|
|
3873
|
-
const numbers =
|
|
4021
|
+
const numbers = React6__namespace.useMemo(() => {
|
|
3874
4022
|
if (selection === "minute") return buildMinuteNumbers();
|
|
3875
4023
|
if (is24hour) return buildHour24Numbers();
|
|
3876
4024
|
return buildHour12Numbers();
|
|
3877
4025
|
}, [selection, is24hour]);
|
|
3878
|
-
const isDragging =
|
|
3879
|
-
const svgRef =
|
|
4026
|
+
const isDragging = React6__namespace.useRef(false);
|
|
4027
|
+
const svgRef = React6__namespace.useRef(null);
|
|
3880
4028
|
const getSVGPoint = (e) => {
|
|
3881
4029
|
const svg = svgRef.current;
|
|
3882
4030
|
if (!svg) return { x: e.clientX, y: e.clientY };
|
|
@@ -4026,8 +4174,8 @@ var getAutoLayout = () => {
|
|
|
4026
4174
|
return innerWidth >= 600 && innerHeight >= 300 && innerWidth >= innerHeight ? "horizontal" : "vertical";
|
|
4027
4175
|
};
|
|
4028
4176
|
var useResolvedLayout = (layout) => {
|
|
4029
|
-
const [autoLayout, setAutoLayout] =
|
|
4030
|
-
|
|
4177
|
+
const [autoLayout, setAutoLayout] = React6__namespace.useState("vertical");
|
|
4178
|
+
React6__namespace.useEffect(() => {
|
|
4031
4179
|
if (layout !== "auto") return;
|
|
4032
4180
|
const updateLayout = () => setAutoLayout(getAutoLayout());
|
|
4033
4181
|
updateLayout();
|
|
@@ -4221,18 +4369,18 @@ var useTimePickerState = (options) => {
|
|
|
4221
4369
|
const initialHour = clamp((_a = options == null ? void 0 : options.initialHour) != null ? _a : 0, 0, 23);
|
|
4222
4370
|
const initialMinute = clamp((_b = options == null ? void 0 : options.initialMinute) != null ? _b : 0, 0, 59);
|
|
4223
4371
|
const is24hour = (_c = options == null ? void 0 : options.is24hour) != null ? _c : false;
|
|
4224
|
-
const [hour, setHourState] =
|
|
4225
|
-
const [minute, setMinuteState] =
|
|
4226
|
-
const [hourInput, setHourInputState] =
|
|
4372
|
+
const [hour, setHourState] = React6.useState(initialHour);
|
|
4373
|
+
const [minute, setMinuteState] = React6.useState(initialMinute);
|
|
4374
|
+
const [hourInput, setHourInputState] = React6.useState(
|
|
4227
4375
|
is24hour ? initialHour : to12Hour(initialHour)
|
|
4228
4376
|
);
|
|
4229
|
-
const [minuteInput, setMinuteInputState] =
|
|
4230
|
-
const [selection, setSelectionState] =
|
|
4377
|
+
const [minuteInput, setMinuteInputState] = React6.useState(initialMinute);
|
|
4378
|
+
const [selection, setSelectionState] = React6.useState("hour");
|
|
4231
4379
|
const isPm = hour >= 12;
|
|
4232
4380
|
const isHourInputValid = isValidHourInput(hourInput, is24hour);
|
|
4233
4381
|
const isMinuteInputValid = isValidMinuteInput(minuteInput);
|
|
4234
4382
|
const isInputValid = isHourInputValid && isMinuteInputValid;
|
|
4235
|
-
const setHour =
|
|
4383
|
+
const setHour = React6.useCallback(
|
|
4236
4384
|
(h) => {
|
|
4237
4385
|
const clamped = clamp(h, 0, 23);
|
|
4238
4386
|
setHourState(clamped);
|
|
@@ -4240,12 +4388,12 @@ var useTimePickerState = (options) => {
|
|
|
4240
4388
|
},
|
|
4241
4389
|
[is24hour]
|
|
4242
4390
|
);
|
|
4243
|
-
const setMinute =
|
|
4391
|
+
const setMinute = React6.useCallback((m13) => {
|
|
4244
4392
|
const clamped = clamp(m13, 0, 59);
|
|
4245
4393
|
setMinuteState(clamped);
|
|
4246
4394
|
setMinuteInputState(clamped);
|
|
4247
4395
|
}, []);
|
|
4248
|
-
const setHourInput =
|
|
4396
|
+
const setHourInput = React6.useCallback(
|
|
4249
4397
|
(h) => {
|
|
4250
4398
|
setHourInputState(h);
|
|
4251
4399
|
if (isValidHourInput(h, is24hour)) {
|
|
@@ -4255,16 +4403,16 @@ var useTimePickerState = (options) => {
|
|
|
4255
4403
|
},
|
|
4256
4404
|
[is24hour, isPm]
|
|
4257
4405
|
);
|
|
4258
|
-
const setMinuteInput =
|
|
4406
|
+
const setMinuteInput = React6.useCallback((m13) => {
|
|
4259
4407
|
setMinuteInputState(m13);
|
|
4260
4408
|
if (isValidMinuteInput(m13)) {
|
|
4261
4409
|
setMinuteState(m13);
|
|
4262
4410
|
}
|
|
4263
4411
|
}, []);
|
|
4264
|
-
const setSelection =
|
|
4412
|
+
const setSelection = React6.useCallback((mode) => {
|
|
4265
4413
|
setSelectionState(mode);
|
|
4266
4414
|
}, []);
|
|
4267
|
-
const setIsPm =
|
|
4415
|
+
const setIsPm = React6.useCallback((pm) => {
|
|
4268
4416
|
setHourState((prev) => {
|
|
4269
4417
|
const wasAlreadyPm = prev >= 12;
|
|
4270
4418
|
if (pm === wasAlreadyPm) return prev;
|
|
@@ -4274,14 +4422,14 @@ var useTimePickerState = (options) => {
|
|
|
4274
4422
|
return clamped;
|
|
4275
4423
|
});
|
|
4276
4424
|
}, []);
|
|
4277
|
-
const reset =
|
|
4425
|
+
const reset = React6.useCallback(() => {
|
|
4278
4426
|
setHourState(initialHour);
|
|
4279
4427
|
setMinuteState(initialMinute);
|
|
4280
4428
|
setHourInputState(is24hour ? initialHour : to12Hour(initialHour));
|
|
4281
4429
|
setMinuteInputState(initialMinute);
|
|
4282
4430
|
setSelectionState("hour");
|
|
4283
4431
|
}, [initialHour, initialMinute, is24hour]);
|
|
4284
|
-
return
|
|
4432
|
+
return React6.useMemo(
|
|
4285
4433
|
() => ({
|
|
4286
4434
|
hour,
|
|
4287
4435
|
minute,
|