@bug-on/m3-expressive 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/buttons.d.mts +26 -5
- package/dist/buttons.d.ts +26 -5
- package/dist/buttons.js +1074 -765
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +1066 -765
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +133 -69
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +133 -69
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +132 -69
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +132 -69
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +2 -2
- package/dist/forms.d.ts +2 -2
- package/dist/forms.js +74 -9
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +74 -9
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-CSsDmuQC.d.mts} +19 -0
- package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-CSsDmuQC.d.ts} +19 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2204 -1464
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2056 -1324
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +18 -1
- package/dist/layout.d.ts +18 -1
- package/dist/layout.js +80 -15
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +80 -15
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.d.mts +134 -9
- package/dist/navigation.d.ts +134 -9
- package/dist/navigation.js +461 -101
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +455 -102
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +261 -197
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +223 -159
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +392 -301
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +361 -270
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-C-qQlyZx.d.ts} +118 -25
- package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DHJqNeq_.d.mts} +118 -25
- package/dist/{text-field-eAIpz9z1.d.mts → text-field-T4Rg-9Bw.d.mts} +7 -0
- package/dist/{text-field-eAIpz9z1.d.ts → text-field-T4Rg-9Bw.d.ts} +7 -0
- package/package.json +3 -3
package/dist/pickers.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { m, LazyMotion, domMax, useMotionValue, animate, useAnimationFrame, AnimatePresence, useReducedMotion } from 'motion/react';
|
|
3
|
-
import * as
|
|
3
|
+
import * as React13 from 'react';
|
|
4
4
|
import { useState, useCallback, useMemo, useReducer } from 'react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
8
9
|
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
9
10
|
import * as RadixScrollArea from '@radix-ui/react-scroll-area';
|
|
10
11
|
|
|
@@ -43,6 +44,97 @@ function cn(...inputs) {
|
|
|
43
44
|
return twMerge(clsx(inputs));
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
// src/ui/shared/motion-tokens.ts
|
|
48
|
+
var FAST_SPATIAL_SPRING = {
|
|
49
|
+
type: "spring",
|
|
50
|
+
stiffness: 800,
|
|
51
|
+
damping: 33.94
|
|
52
|
+
};
|
|
53
|
+
var DEFAULT_SPATIAL_SPRING = {
|
|
54
|
+
type: "spring",
|
|
55
|
+
stiffness: 380,
|
|
56
|
+
damping: 31.19
|
|
57
|
+
};
|
|
58
|
+
var FAST_EFFECTS_SPRING = {
|
|
59
|
+
type: "spring",
|
|
60
|
+
stiffness: 3800,
|
|
61
|
+
damping: 123.29
|
|
62
|
+
};
|
|
63
|
+
var DEFAULT_EFFECTS_SPRING = {
|
|
64
|
+
type: "spring",
|
|
65
|
+
stiffness: 1600,
|
|
66
|
+
damping: 80
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/ui/date-time-pickers/shared/animation-tokens.ts
|
|
70
|
+
var PICKER_OVERLAY_ANIM = {
|
|
71
|
+
initial: { opacity: 0 },
|
|
72
|
+
animate: {
|
|
73
|
+
opacity: 1,
|
|
74
|
+
transition: { duration: 0.2, ease: [0, 0, 0, 1] }
|
|
75
|
+
},
|
|
76
|
+
exit: {
|
|
77
|
+
opacity: 0,
|
|
78
|
+
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var PICKER_CONTENT_ANIM = {
|
|
82
|
+
initial: { opacity: 0, scale: 0.85, y: 16 },
|
|
83
|
+
animate: {
|
|
84
|
+
opacity: 1,
|
|
85
|
+
scale: 1,
|
|
86
|
+
y: 0,
|
|
87
|
+
transition: DEFAULT_SPATIAL_SPRING
|
|
88
|
+
},
|
|
89
|
+
exit: {
|
|
90
|
+
opacity: 0,
|
|
91
|
+
scale: 0.95,
|
|
92
|
+
y: 8,
|
|
93
|
+
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var CALENDAR_SLIDE_VARIANTS = {
|
|
97
|
+
enterFromRight: {
|
|
98
|
+
x: "100%",
|
|
99
|
+
opacity: 0
|
|
100
|
+
},
|
|
101
|
+
enterFromLeft: {
|
|
102
|
+
x: "-100%",
|
|
103
|
+
opacity: 0
|
|
104
|
+
},
|
|
105
|
+
center: {
|
|
106
|
+
x: 0,
|
|
107
|
+
opacity: 1,
|
|
108
|
+
transition: FAST_SPATIAL_SPRING
|
|
109
|
+
},
|
|
110
|
+
exitToLeft: {
|
|
111
|
+
x: "-100%",
|
|
112
|
+
opacity: 0,
|
|
113
|
+
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
114
|
+
},
|
|
115
|
+
exitToRight: {
|
|
116
|
+
x: "100%",
|
|
117
|
+
opacity: 0,
|
|
118
|
+
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var PICKER_SELECTOR_ANIM = {
|
|
122
|
+
initial: { opacity: 0, scale: 0.95, y: -6 },
|
|
123
|
+
animate: {
|
|
124
|
+
opacity: 1,
|
|
125
|
+
scale: 1,
|
|
126
|
+
y: 0,
|
|
127
|
+
transition: DEFAULT_SPATIAL_SPRING
|
|
128
|
+
},
|
|
129
|
+
exit: {
|
|
130
|
+
opacity: 0,
|
|
131
|
+
scale: 0.95,
|
|
132
|
+
y: 6,
|
|
133
|
+
transition: { duration: 0.1, ease: "easeIn" }
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var DAY_CELL_STATE_TRANSITION = FAST_EFFECTS_SPRING;
|
|
137
|
+
|
|
46
138
|
// src/ui/date-time-pickers/shared/calendar-model.ts
|
|
47
139
|
var startOfDayUTC = (ms) => {
|
|
48
140
|
const d = new Date(ms);
|
|
@@ -169,13 +261,13 @@ var DatePickerInput = ({
|
|
|
169
261
|
locale,
|
|
170
262
|
className
|
|
171
263
|
}) => {
|
|
172
|
-
const inputId =
|
|
264
|
+
const inputId = React13.useId();
|
|
173
265
|
const errorId = `${inputId}-error`;
|
|
174
|
-
const placeholder =
|
|
266
|
+
const placeholder = React13.useMemo(() => {
|
|
175
267
|
if (locale == null ? void 0 : locale.startsWith("vi")) return "DD/MM/YYYY";
|
|
176
268
|
return "MM/DD/YYYY";
|
|
177
269
|
}, [locale]);
|
|
178
|
-
const handleKeyDown =
|
|
270
|
+
const handleKeyDown = React13.useCallback(
|
|
179
271
|
(e) => {
|
|
180
272
|
if (e.key === "Enter") {
|
|
181
273
|
const parsed = parseDateInput(value);
|
|
@@ -184,11 +276,11 @@ var DatePickerInput = ({
|
|
|
184
276
|
},
|
|
185
277
|
[value, onCommit]
|
|
186
278
|
);
|
|
187
|
-
const handleBlur =
|
|
279
|
+
const handleBlur = React13.useCallback(() => {
|
|
188
280
|
const parsed = parseDateInput(value);
|
|
189
281
|
onCommit(parsed);
|
|
190
282
|
}, [value, onCommit]);
|
|
191
|
-
const handleChange =
|
|
283
|
+
const handleChange = React13.useCallback(
|
|
192
284
|
(e) => {
|
|
193
285
|
let raw = e.target.value.replace(/\D/g, "");
|
|
194
286
|
if (raw.length > 8) raw = raw.slice(0, 8);
|
|
@@ -234,82 +326,6 @@ var DatePickerInput = ({
|
|
|
234
326
|
] }) }) });
|
|
235
327
|
};
|
|
236
328
|
DatePickerInput.displayName = "DatePickerInput";
|
|
237
|
-
|
|
238
|
-
// src/ui/shared/motion-tokens.ts
|
|
239
|
-
var FAST_SPATIAL_SPRING = {
|
|
240
|
-
type: "spring",
|
|
241
|
-
stiffness: 800,
|
|
242
|
-
damping: 33.94
|
|
243
|
-
};
|
|
244
|
-
var DEFAULT_SPATIAL_SPRING = {
|
|
245
|
-
type: "spring",
|
|
246
|
-
stiffness: 380,
|
|
247
|
-
damping: 31.19
|
|
248
|
-
};
|
|
249
|
-
var FAST_EFFECTS_SPRING = {
|
|
250
|
-
type: "spring",
|
|
251
|
-
stiffness: 3800,
|
|
252
|
-
damping: 123.29
|
|
253
|
-
};
|
|
254
|
-
var DEFAULT_EFFECTS_SPRING = {
|
|
255
|
-
type: "spring",
|
|
256
|
-
stiffness: 1600,
|
|
257
|
-
damping: 80
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
// src/ui/date-time-pickers/shared/animation-tokens.ts
|
|
261
|
-
var PICKER_OVERLAY_ANIM = {
|
|
262
|
-
initial: { opacity: 0 },
|
|
263
|
-
animate: {
|
|
264
|
-
opacity: 1,
|
|
265
|
-
transition: { duration: 0.2, ease: [0, 0, 0, 1] }
|
|
266
|
-
},
|
|
267
|
-
exit: {
|
|
268
|
-
opacity: 0,
|
|
269
|
-
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
var PICKER_CONTENT_ANIM = {
|
|
273
|
-
initial: { opacity: 0, scale: 0.85, y: 16 },
|
|
274
|
-
animate: {
|
|
275
|
-
opacity: 1,
|
|
276
|
-
scale: 1,
|
|
277
|
-
y: 0,
|
|
278
|
-
transition: DEFAULT_SPATIAL_SPRING
|
|
279
|
-
},
|
|
280
|
-
exit: {
|
|
281
|
-
opacity: 0,
|
|
282
|
-
scale: 0.95,
|
|
283
|
-
y: 8,
|
|
284
|
-
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
var CALENDAR_SLIDE_VARIANTS = {
|
|
288
|
-
enterFromRight: {
|
|
289
|
-
x: "100%",
|
|
290
|
-
opacity: 0
|
|
291
|
-
},
|
|
292
|
-
enterFromLeft: {
|
|
293
|
-
x: "-100%",
|
|
294
|
-
opacity: 0
|
|
295
|
-
},
|
|
296
|
-
center: {
|
|
297
|
-
x: 0,
|
|
298
|
-
opacity: 1,
|
|
299
|
-
transition: FAST_SPATIAL_SPRING
|
|
300
|
-
},
|
|
301
|
-
exitToLeft: {
|
|
302
|
-
x: "-100%",
|
|
303
|
-
opacity: 0,
|
|
304
|
-
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
305
|
-
},
|
|
306
|
-
exitToRight: {
|
|
307
|
-
x: "100%",
|
|
308
|
-
opacity: 0,
|
|
309
|
-
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
var DAY_CELL_STATE_TRANSITION = FAST_EFFECTS_SPRING;
|
|
313
329
|
var DayCell = ({
|
|
314
330
|
day,
|
|
315
331
|
selectedMs,
|
|
@@ -358,11 +374,11 @@ var DayCell = ({
|
|
|
358
374
|
// Disabled
|
|
359
375
|
isDisabled && "opacity-[0.38]"
|
|
360
376
|
);
|
|
361
|
-
const handleClick =
|
|
377
|
+
const handleClick = React13.useCallback(() => {
|
|
362
378
|
if (isDisabled) return;
|
|
363
379
|
onSelect(utcMs);
|
|
364
380
|
}, [isDisabled, utcMs, onSelect]);
|
|
365
|
-
const handleKeyDown =
|
|
381
|
+
const handleKeyDown = React13.useCallback(
|
|
366
382
|
(e) => {
|
|
367
383
|
if (e.key === "Enter" || e.key === " ") {
|
|
368
384
|
e.preventDefault();
|
|
@@ -398,7 +414,7 @@ var DayCell = ({
|
|
|
398
414
|
};
|
|
399
415
|
DayCell.displayName = "DayCell";
|
|
400
416
|
var WeekdayRow = ({ locale }) => {
|
|
401
|
-
const names =
|
|
417
|
+
const names = React13.useMemo(() => getWeekdayNames(locale), [locale]);
|
|
402
418
|
return /* @__PURE__ */ jsx("tr", { className: "grid grid-cols-7 mb-1", children: names.map((name, i) => /* @__PURE__ */ jsx(
|
|
403
419
|
"th",
|
|
404
420
|
{
|
|
@@ -425,7 +441,7 @@ var CalendarGrid = ({
|
|
|
425
441
|
const d = new Date(displayedMonthMs);
|
|
426
442
|
const year = d.getUTCFullYear();
|
|
427
443
|
const month = d.getUTCMonth();
|
|
428
|
-
const weeks =
|
|
444
|
+
const weeks = React13.useMemo(
|
|
429
445
|
() => getWeeksInMonth(year, month, locale.weekStartsOn),
|
|
430
446
|
[year, month, locale.weekStartsOn]
|
|
431
447
|
);
|
|
@@ -527,11 +543,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
527
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";
|
|
528
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";
|
|
529
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";
|
|
530
|
-
var IndeterminateSvg =
|
|
546
|
+
var IndeterminateSvg = React13.memo(function IndeterminateSvg2({
|
|
531
547
|
size
|
|
532
548
|
}) {
|
|
533
|
-
const [ready, setReady] =
|
|
534
|
-
|
|
549
|
+
const [ready, setReady] = React13.useState(false);
|
|
550
|
+
React13.useEffect(() => {
|
|
535
551
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
536
552
|
return () => cancelAnimationFrame(raf);
|
|
537
553
|
}, []);
|
|
@@ -576,7 +592,7 @@ var IndeterminateSvg = React17.memo(function IndeterminateSvg2({
|
|
|
576
592
|
}
|
|
577
593
|
);
|
|
578
594
|
});
|
|
579
|
-
var DeterminateSvg =
|
|
595
|
+
var DeterminateSvg = React13.memo(function DeterminateSvg2({
|
|
580
596
|
size,
|
|
581
597
|
progress
|
|
582
598
|
}) {
|
|
@@ -601,7 +617,7 @@ var DeterminateSvg = React17.memo(function DeterminateSvg2({
|
|
|
601
617
|
}
|
|
602
618
|
);
|
|
603
619
|
});
|
|
604
|
-
var LoadingIndicator =
|
|
620
|
+
var LoadingIndicator = React13.forwardRef(
|
|
605
621
|
(_a, ref) => {
|
|
606
622
|
var _b = _a, {
|
|
607
623
|
variant = "uncontained",
|
|
@@ -716,7 +732,7 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
716
732
|
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
717
733
|
return d;
|
|
718
734
|
}
|
|
719
|
-
var CircularProgress =
|
|
735
|
+
var CircularProgress = React13.forwardRef(
|
|
720
736
|
(_a, ref) => {
|
|
721
737
|
var _b = _a, {
|
|
722
738
|
value,
|
|
@@ -754,15 +770,15 @@ var CircularProgress = React17.forwardRef(
|
|
|
754
770
|
const isWavy = shape === "wavy";
|
|
755
771
|
const BASELINE_SIZE = 48;
|
|
756
772
|
const scaleFactor = size / BASELINE_SIZE;
|
|
757
|
-
const effectiveAmplitude =
|
|
773
|
+
const effectiveAmplitude = React13.useMemo(
|
|
758
774
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
759
775
|
[amplitude, scaleFactor]
|
|
760
776
|
);
|
|
761
|
-
const effectiveWavelength =
|
|
777
|
+
const effectiveWavelength = React13.useMemo(
|
|
762
778
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
763
779
|
[wavelength, scaleFactor]
|
|
764
780
|
);
|
|
765
|
-
const wavyActivePath =
|
|
781
|
+
const wavyActivePath = React13.useMemo(
|
|
766
782
|
() => isWavy ? generateWavyCircularPath(
|
|
767
783
|
center,
|
|
768
784
|
radius,
|
|
@@ -771,8 +787,8 @@ var CircularProgress = React17.forwardRef(
|
|
|
771
787
|
) : null,
|
|
772
788
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
773
789
|
);
|
|
774
|
-
const circumference =
|
|
775
|
-
const gapForTrack =
|
|
790
|
+
const circumference = React13.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
791
|
+
const gapForTrack = React13.useMemo(
|
|
776
792
|
() => (gapSize + trackHeight) / circumference,
|
|
777
793
|
[gapSize, trackHeight, circumference]
|
|
778
794
|
);
|
|
@@ -961,9 +977,9 @@ var CircularProgress = React17.forwardRef(
|
|
|
961
977
|
);
|
|
962
978
|
CircularProgress.displayName = "CircularProgress";
|
|
963
979
|
function useContainerWidth() {
|
|
964
|
-
const [width, setWidth] =
|
|
965
|
-
const observerRef =
|
|
966
|
-
const ref =
|
|
980
|
+
const [width, setWidth] = React13.useState(0);
|
|
981
|
+
const observerRef = React13.useRef(null);
|
|
982
|
+
const ref = React13.useCallback((node) => {
|
|
967
983
|
if (observerRef.current) {
|
|
968
984
|
observerRef.current.disconnect();
|
|
969
985
|
observerRef.current = null;
|
|
@@ -977,7 +993,7 @@ function useContainerWidth() {
|
|
|
977
993
|
observerRef.current = obs;
|
|
978
994
|
}
|
|
979
995
|
}, []);
|
|
980
|
-
|
|
996
|
+
React13.useEffect(() => {
|
|
981
997
|
return () => {
|
|
982
998
|
if (observerRef.current) {
|
|
983
999
|
observerRef.current.disconnect();
|
|
@@ -987,7 +1003,7 @@ function useContainerWidth() {
|
|
|
987
1003
|
return [ref, width];
|
|
988
1004
|
}
|
|
989
1005
|
function useMergedRef(...refs) {
|
|
990
|
-
return
|
|
1006
|
+
return React13.useCallback(
|
|
991
1007
|
(node) => {
|
|
992
1008
|
for (const ref of refs) {
|
|
993
1009
|
if (typeof ref === "function") {
|
|
@@ -1001,7 +1017,7 @@ function useMergedRef(...refs) {
|
|
|
1001
1017
|
[refs]
|
|
1002
1018
|
);
|
|
1003
1019
|
}
|
|
1004
|
-
var FlatLinearTrack =
|
|
1020
|
+
var FlatLinearTrack = React13.memo(function FlatLinearTrack2({
|
|
1005
1021
|
trackHeight,
|
|
1006
1022
|
activeColor,
|
|
1007
1023
|
trackColor,
|
|
@@ -1077,7 +1093,7 @@ var FlatLinearTrack = React17.memo(function FlatLinearTrack2({
|
|
|
1077
1093
|
}
|
|
1078
1094
|
);
|
|
1079
1095
|
});
|
|
1080
|
-
var WavyLinearTrack =
|
|
1096
|
+
var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
1081
1097
|
trackHeight,
|
|
1082
1098
|
svgHeight,
|
|
1083
1099
|
amplitude,
|
|
@@ -1096,13 +1112,13 @@ var WavyLinearTrack = React17.memo(function WavyLinearTrack2({
|
|
|
1096
1112
|
}) {
|
|
1097
1113
|
const isDeterminate = typeof value === "number";
|
|
1098
1114
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1099
|
-
const titleId =
|
|
1115
|
+
const titleId = React13.useId();
|
|
1100
1116
|
const [containerRef, width] = useContainerWidth();
|
|
1101
|
-
const activePathRef =
|
|
1102
|
-
const trackPathRef =
|
|
1117
|
+
const activePathRef = React13.useRef(null);
|
|
1118
|
+
const trackPathRef = React13.useRef(null);
|
|
1103
1119
|
const amplitudeMV = useMotionValue(amplitude);
|
|
1104
1120
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1105
|
-
|
|
1121
|
+
React13.useEffect(() => {
|
|
1106
1122
|
if (isDeterminate) {
|
|
1107
1123
|
const fraction = clampedValue / 100;
|
|
1108
1124
|
let targetAmp = amplitude;
|
|
@@ -1273,7 +1289,7 @@ var WavyLinearTrack = React17.memo(function WavyLinearTrack2({
|
|
|
1273
1289
|
}
|
|
1274
1290
|
);
|
|
1275
1291
|
});
|
|
1276
|
-
var LinearProgress =
|
|
1292
|
+
var LinearProgress = React13.forwardRef(
|
|
1277
1293
|
(_a, ref) => {
|
|
1278
1294
|
var _b = _a, {
|
|
1279
1295
|
value,
|
|
@@ -1314,10 +1330,10 @@ var LinearProgress = React17.forwardRef(
|
|
|
1314
1330
|
]);
|
|
1315
1331
|
const isDeterminate = value !== void 0;
|
|
1316
1332
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1317
|
-
const containerRef =
|
|
1333
|
+
const containerRef = React13.useRef(null);
|
|
1318
1334
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1319
|
-
const [isRtl, setIsRtl] =
|
|
1320
|
-
|
|
1335
|
+
const [isRtl, setIsRtl] = React13.useState(false);
|
|
1336
|
+
React13.useEffect(() => {
|
|
1321
1337
|
if (containerRef.current) {
|
|
1322
1338
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1323
1339
|
setIsRtl(dir === "rtl");
|
|
@@ -1325,16 +1341,16 @@ var LinearProgress = React17.forwardRef(
|
|
|
1325
1341
|
}, []);
|
|
1326
1342
|
const isWavy = shape === "wavy";
|
|
1327
1343
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1328
|
-
const effectiveAmplitude =
|
|
1329
|
-
const svgHeight =
|
|
1344
|
+
const effectiveAmplitude = React13.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1345
|
+
const svgHeight = React13.useMemo(
|
|
1330
1346
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1331
1347
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1332
1348
|
);
|
|
1333
|
-
const shouldShowStop =
|
|
1349
|
+
const shouldShowStop = React13.useMemo(
|
|
1334
1350
|
() => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
|
|
1335
1351
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1336
1352
|
);
|
|
1337
|
-
const stopSize =
|
|
1353
|
+
const stopSize = React13.useMemo(
|
|
1338
1354
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1339
1355
|
[trackHeight]
|
|
1340
1356
|
);
|
|
@@ -1407,14 +1423,14 @@ var LinearProgress = React17.forwardRef(
|
|
|
1407
1423
|
}
|
|
1408
1424
|
);
|
|
1409
1425
|
LinearProgress.displayName = "LinearProgress";
|
|
1410
|
-
var ProgressIndicator =
|
|
1426
|
+
var ProgressIndicator = React13.forwardRef((props, ref) => {
|
|
1411
1427
|
if (props.variant === "circular") {
|
|
1412
1428
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1413
1429
|
}
|
|
1414
1430
|
return /* @__PURE__ */ jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
1415
1431
|
});
|
|
1416
1432
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
1417
|
-
var RippleItem =
|
|
1433
|
+
var RippleItem = React13.memo(function RippleItem2({
|
|
1418
1434
|
ripple,
|
|
1419
1435
|
onDone
|
|
1420
1436
|
}) {
|
|
@@ -1458,14 +1474,17 @@ function Ripple({
|
|
|
1458
1474
|
}
|
|
1459
1475
|
function useRippleState(options = {}) {
|
|
1460
1476
|
const { disabled = false } = options;
|
|
1461
|
-
const [ripples, setRipples] =
|
|
1462
|
-
const onPointerDown =
|
|
1477
|
+
const [ripples, setRipples] = React13.useState([]);
|
|
1478
|
+
const onPointerDown = React13.useCallback(
|
|
1463
1479
|
(e) => {
|
|
1464
1480
|
if (disabled) return;
|
|
1465
1481
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
1466
1482
|
const x = e.clientX - rect.left;
|
|
1467
1483
|
const y = e.clientY - rect.top;
|
|
1468
|
-
const rippleSize = Math.
|
|
1484
|
+
const rippleSize = Math.max(
|
|
1485
|
+
Math.hypot(rect.width, rect.height) * 2.5,
|
|
1486
|
+
320
|
|
1487
|
+
);
|
|
1469
1488
|
setRipples((prev) => [
|
|
1470
1489
|
...prev,
|
|
1471
1490
|
{ id: Date.now(), x, y, size: rippleSize }
|
|
@@ -1473,7 +1492,7 @@ function useRippleState(options = {}) {
|
|
|
1473
1492
|
},
|
|
1474
1493
|
[disabled]
|
|
1475
1494
|
);
|
|
1476
|
-
const removeRipple =
|
|
1495
|
+
const removeRipple = React13.useCallback((id) => {
|
|
1477
1496
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1478
1497
|
}, []);
|
|
1479
1498
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1496,12 +1515,39 @@ function TouchTarget() {
|
|
|
1496
1515
|
}
|
|
1497
1516
|
);
|
|
1498
1517
|
}
|
|
1499
|
-
var
|
|
1500
|
-
xs: "h-8
|
|
1501
|
-
sm: "h-10
|
|
1502
|
-
md: "h-14
|
|
1503
|
-
lg: "h-24
|
|
1504
|
-
xl: "h-[8.5rem]
|
|
1518
|
+
var SIZE_HEIGHT_STYLES = {
|
|
1519
|
+
xs: "h-8",
|
|
1520
|
+
sm: "h-10",
|
|
1521
|
+
md: "h-14",
|
|
1522
|
+
lg: "h-24",
|
|
1523
|
+
xl: "h-[8.5rem]"
|
|
1524
|
+
};
|
|
1525
|
+
var WIDTH_SIZE_STYLES = {
|
|
1526
|
+
xs: {
|
|
1527
|
+
default: "w-8",
|
|
1528
|
+
narrow: "w-8",
|
|
1529
|
+
wide: "w-12"
|
|
1530
|
+
},
|
|
1531
|
+
sm: {
|
|
1532
|
+
default: "w-10",
|
|
1533
|
+
narrow: "w-12",
|
|
1534
|
+
wide: "w-[3.25rem]"
|
|
1535
|
+
},
|
|
1536
|
+
md: {
|
|
1537
|
+
default: "w-14",
|
|
1538
|
+
narrow: "w-12",
|
|
1539
|
+
wide: "w-[4.5rem]"
|
|
1540
|
+
},
|
|
1541
|
+
lg: {
|
|
1542
|
+
default: "w-24",
|
|
1543
|
+
narrow: "w-16",
|
|
1544
|
+
wide: "w-32"
|
|
1545
|
+
},
|
|
1546
|
+
xl: {
|
|
1547
|
+
default: "w-[8.5rem]",
|
|
1548
|
+
narrow: "w-[6.5rem]",
|
|
1549
|
+
wide: "w-[11.5rem]"
|
|
1550
|
+
}
|
|
1505
1551
|
};
|
|
1506
1552
|
var SIZE_ICON = {
|
|
1507
1553
|
xs: { cls: "size-5", px: 20 },
|
|
@@ -1594,7 +1640,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1594
1640
|
}
|
|
1595
1641
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1596
1642
|
}
|
|
1597
|
-
var IconButtonComponent =
|
|
1643
|
+
var IconButtonComponent = React13.forwardRef(
|
|
1598
1644
|
(_a, ref) => {
|
|
1599
1645
|
var _b = _a, {
|
|
1600
1646
|
className,
|
|
@@ -1602,11 +1648,14 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1602
1648
|
variant = "default",
|
|
1603
1649
|
colorStyle = "standard",
|
|
1604
1650
|
size = "sm",
|
|
1651
|
+
widthVariant = "default",
|
|
1605
1652
|
shape = "round",
|
|
1606
1653
|
selected,
|
|
1654
|
+
selectedIcon,
|
|
1607
1655
|
loading = false,
|
|
1608
1656
|
loadingVariant = "loading-indicator",
|
|
1609
1657
|
iconSize,
|
|
1658
|
+
asChild = false,
|
|
1610
1659
|
children,
|
|
1611
1660
|
onClick,
|
|
1612
1661
|
onKeyDown,
|
|
@@ -1617,31 +1666,34 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1617
1666
|
"variant",
|
|
1618
1667
|
"colorStyle",
|
|
1619
1668
|
"size",
|
|
1669
|
+
"widthVariant",
|
|
1620
1670
|
"shape",
|
|
1621
1671
|
"selected",
|
|
1672
|
+
"selectedIcon",
|
|
1622
1673
|
"loading",
|
|
1623
1674
|
"loadingVariant",
|
|
1624
1675
|
"iconSize",
|
|
1676
|
+
"asChild",
|
|
1625
1677
|
"children",
|
|
1626
1678
|
"onClick",
|
|
1627
1679
|
"onKeyDown",
|
|
1628
1680
|
"aria-label"
|
|
1629
1681
|
]);
|
|
1630
|
-
var _a2, _b2;
|
|
1682
|
+
var _a2, _b2, _c, _d, _e;
|
|
1631
1683
|
const isToggle = variant === "toggle";
|
|
1632
1684
|
const isSelected = isToggle && !!selected;
|
|
1633
|
-
const resolvedColorClass =
|
|
1685
|
+
const resolvedColorClass = React13.useMemo(
|
|
1634
1686
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1635
1687
|
[isSelected, colorStyle]
|
|
1636
1688
|
);
|
|
1637
|
-
const outlineWidthClass =
|
|
1689
|
+
const outlineWidthClass = React13.useMemo(
|
|
1638
1690
|
() => {
|
|
1639
1691
|
var _a3;
|
|
1640
1692
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1641
1693
|
},
|
|
1642
1694
|
[colorStyle, isSelected, size]
|
|
1643
1695
|
);
|
|
1644
|
-
const disabledBgClass =
|
|
1696
|
+
const disabledBgClass = React13.useMemo(
|
|
1645
1697
|
() => resolveDisabledBgClass(colorStyle),
|
|
1646
1698
|
[colorStyle]
|
|
1647
1699
|
);
|
|
@@ -1658,11 +1710,13 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1658
1710
|
const defaultIconPx = sizeIcon.px;
|
|
1659
1711
|
const iconPx = iconSize != null ? iconSize : defaultIconPx;
|
|
1660
1712
|
const isCustomSize = iconSize != null && iconSize !== "inherit";
|
|
1713
|
+
const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
|
|
1714
|
+
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[widthVariant]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
|
|
1661
1715
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1662
1716
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1663
1717
|
disabled: loading
|
|
1664
1718
|
});
|
|
1665
|
-
const handleClick =
|
|
1719
|
+
const handleClick = React13.useCallback(
|
|
1666
1720
|
(e) => {
|
|
1667
1721
|
if (loading) {
|
|
1668
1722
|
e.preventDefault();
|
|
@@ -1672,7 +1726,7 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1672
1726
|
},
|
|
1673
1727
|
[loading, onClick]
|
|
1674
1728
|
);
|
|
1675
|
-
const handleKeyDown =
|
|
1729
|
+
const handleKeyDown = React13.useCallback(
|
|
1676
1730
|
(e) => {
|
|
1677
1731
|
if (loading) return;
|
|
1678
1732
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1683,7 +1737,90 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1683
1737
|
},
|
|
1684
1738
|
[loading, onClick, onKeyDown]
|
|
1685
1739
|
);
|
|
1686
|
-
|
|
1740
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1741
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
1742
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
1743
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
1744
|
+
m.span,
|
|
1745
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1746
|
+
transition: SPRING_TRANSITION,
|
|
1747
|
+
className: cn(
|
|
1748
|
+
"flex items-center justify-center shrink-0",
|
|
1749
|
+
iconSize != null ? void 0 : iconClass
|
|
1750
|
+
),
|
|
1751
|
+
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
1752
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
1753
|
+
LoadingIndicator,
|
|
1754
|
+
{
|
|
1755
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1756
|
+
color: "currentColor",
|
|
1757
|
+
"aria-label": "Loading"
|
|
1758
|
+
}
|
|
1759
|
+
) : /* @__PURE__ */ jsx(
|
|
1760
|
+
ProgressIndicator,
|
|
1761
|
+
{
|
|
1762
|
+
variant: "circular",
|
|
1763
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1764
|
+
color: "currentColor",
|
|
1765
|
+
trackColor: "transparent",
|
|
1766
|
+
"aria-label": "Loading"
|
|
1767
|
+
}
|
|
1768
|
+
)
|
|
1769
|
+
}),
|
|
1770
|
+
"loading"
|
|
1771
|
+
) : /* @__PURE__ */ jsx(
|
|
1772
|
+
m.span,
|
|
1773
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1774
|
+
transition: SPRING_TRANSITION,
|
|
1775
|
+
"aria-hidden": "true",
|
|
1776
|
+
className: cn(
|
|
1777
|
+
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]",
|
|
1778
|
+
iconSize != null ? void 0 : iconClass
|
|
1779
|
+
),
|
|
1780
|
+
style: {
|
|
1781
|
+
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
1782
|
+
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1783
|
+
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1784
|
+
},
|
|
1785
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React13.Children.only(children).props.children : children
|
|
1786
|
+
}),
|
|
1787
|
+
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1788
|
+
) })
|
|
1789
|
+
] });
|
|
1790
|
+
const containerClassName = cn(
|
|
1791
|
+
baseIconButtonClasses,
|
|
1792
|
+
resolvedColorClass,
|
|
1793
|
+
outlineWidthClass,
|
|
1794
|
+
disabledBgClass,
|
|
1795
|
+
"overflow-hidden",
|
|
1796
|
+
heightClass,
|
|
1797
|
+
widthClass,
|
|
1798
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
1799
|
+
className
|
|
1800
|
+
);
|
|
1801
|
+
if (asChild) {
|
|
1802
|
+
const child = React13.Children.only(children);
|
|
1803
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1804
|
+
Slot,
|
|
1805
|
+
__spreadProps(__spreadValues({
|
|
1806
|
+
ref,
|
|
1807
|
+
"aria-pressed": isToggle ? isSelected : void 0,
|
|
1808
|
+
"aria-label": ariaLabel,
|
|
1809
|
+
"aria-busy": loading || void 0,
|
|
1810
|
+
"aria-disabled": loading || restProps.disabled,
|
|
1811
|
+
onClick: handleClick,
|
|
1812
|
+
onPointerDown,
|
|
1813
|
+
onKeyDown: handleKeyDown,
|
|
1814
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
1815
|
+
borderRadius: `${animateRadius}px`
|
|
1816
|
+
}),
|
|
1817
|
+
className: containerClassName
|
|
1818
|
+
}, restProps), {
|
|
1819
|
+
children: React13.cloneElement(child, { children: innerContent })
|
|
1820
|
+
})
|
|
1821
|
+
) });
|
|
1822
|
+
}
|
|
1823
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1687
1824
|
m.button,
|
|
1688
1825
|
__spreadProps(__spreadValues({
|
|
1689
1826
|
ref,
|
|
@@ -1699,79 +1836,21 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1699
1836
|
animate: { borderRadius: animateRadius },
|
|
1700
1837
|
whileTap: { borderRadius: pressedRadius },
|
|
1701
1838
|
transition: { borderRadius: SPRING_TRANSITION_FAST },
|
|
1702
|
-
className:
|
|
1703
|
-
baseIconButtonClasses,
|
|
1704
|
-
resolvedColorClass,
|
|
1705
|
-
outlineWidthClass,
|
|
1706
|
-
disabledBgClass,
|
|
1707
|
-
"overflow-hidden",
|
|
1708
|
-
SIZE_STYLES[size],
|
|
1709
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
1710
|
-
className
|
|
1711
|
-
)
|
|
1839
|
+
className: containerClassName
|
|
1712
1840
|
}, restProps), {
|
|
1713
|
-
children:
|
|
1714
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
1715
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
1716
|
-
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
1717
|
-
m.span,
|
|
1718
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1719
|
-
transition: SPRING_TRANSITION,
|
|
1720
|
-
className: cn(
|
|
1721
|
-
"flex items-center justify-center shrink-0",
|
|
1722
|
-
iconSize != null ? void 0 : iconClass
|
|
1723
|
-
),
|
|
1724
|
-
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
1725
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
1726
|
-
LoadingIndicator,
|
|
1727
|
-
{
|
|
1728
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1729
|
-
color: "currentColor",
|
|
1730
|
-
"aria-label": "Loading"
|
|
1731
|
-
}
|
|
1732
|
-
) : /* @__PURE__ */ jsx(
|
|
1733
|
-
ProgressIndicator,
|
|
1734
|
-
{
|
|
1735
|
-
variant: "circular",
|
|
1736
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1737
|
-
color: "currentColor",
|
|
1738
|
-
trackColor: "transparent",
|
|
1739
|
-
"aria-label": "Loading"
|
|
1740
|
-
}
|
|
1741
|
-
)
|
|
1742
|
-
}),
|
|
1743
|
-
"loading"
|
|
1744
|
-
) : /* @__PURE__ */ jsx(
|
|
1745
|
-
m.span,
|
|
1746
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1747
|
-
transition: SPRING_TRANSITION,
|
|
1748
|
-
"aria-hidden": "true",
|
|
1749
|
-
className: cn(
|
|
1750
|
-
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
1751
|
-
iconSize != null ? void 0 : iconClass
|
|
1752
|
-
),
|
|
1753
|
-
style: {
|
|
1754
|
-
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
1755
|
-
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1756
|
-
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1757
|
-
},
|
|
1758
|
-
children
|
|
1759
|
-
}),
|
|
1760
|
-
"content"
|
|
1761
|
-
) })
|
|
1762
|
-
]
|
|
1841
|
+
children: innerContent
|
|
1763
1842
|
})
|
|
1764
1843
|
) });
|
|
1765
1844
|
}
|
|
1766
1845
|
);
|
|
1767
1846
|
IconButtonComponent.displayName = "IconButton";
|
|
1768
|
-
var IconButton =
|
|
1847
|
+
var IconButton = React13.memo(IconButtonComponent);
|
|
1769
1848
|
var VARIANT_FONT = {
|
|
1770
1849
|
outlined: "'Material Symbols Outlined'",
|
|
1771
1850
|
rounded: "'Material Symbols Rounded'",
|
|
1772
1851
|
sharp: "'Material Symbols Sharp'"
|
|
1773
1852
|
};
|
|
1774
|
-
var IconComponent =
|
|
1853
|
+
var IconComponent = React13.forwardRef(
|
|
1775
1854
|
(_a, ref) => {
|
|
1776
1855
|
var _b = _a, {
|
|
1777
1856
|
name,
|
|
@@ -1837,7 +1916,7 @@ var IconComponent = React17.forwardRef(
|
|
|
1837
1916
|
}
|
|
1838
1917
|
);
|
|
1839
1918
|
IconComponent.displayName = "Icon";
|
|
1840
|
-
var Icon =
|
|
1919
|
+
var Icon = React13.memo(IconComponent);
|
|
1841
1920
|
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";
|
|
1842
1921
|
var CalendarHeader = ({
|
|
1843
1922
|
displayedMonthMs,
|
|
@@ -1865,16 +1944,16 @@ var CalendarHeader = ({
|
|
|
1865
1944
|
}).format(date);
|
|
1866
1945
|
const yearLabel = String(date.getUTCFullYear());
|
|
1867
1946
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 px-6 pb-4 pt-5", children: [
|
|
1868
|
-
/* @__PURE__ */ jsx("div", { className: "text-
|
|
1869
|
-
/* @__PURE__ */ jsx("div", { className: "mb-2 leading-tight text-
|
|
1870
|
-
displayMode === "picker" && /* @__PURE__ */ jsxs("div", { className: "
|
|
1947
|
+
/* @__PURE__ */ jsx("div", { className: "text-(length:--md-typescale-label-large-size,14px) font-(--md-typescale-label-large-weight,500) text-m3-on-surface-variant", children: title }),
|
|
1948
|
+
/* @__PURE__ */ jsx("div", { className: "mb-2 leading-tight text-(length:--md-typescale-headline-large-size,32px) font-(--md-typescale-headline-large-weight,400) text-m3-on-surface-variant", children: headline }),
|
|
1949
|
+
displayMode === "picker" && /* @__PURE__ */ jsxs("div", { className: "flex min-h-10 items-center gap-0.5", children: [
|
|
1871
1950
|
activeSelector === null && /* @__PURE__ */ jsx(
|
|
1872
1951
|
IconButton,
|
|
1873
1952
|
{
|
|
1874
1953
|
onClick: onPrev,
|
|
1875
1954
|
"aria-label": "Previous month",
|
|
1876
1955
|
disabled: !canNavigatePrev,
|
|
1877
|
-
size: "
|
|
1956
|
+
size: "xs",
|
|
1878
1957
|
children: /* @__PURE__ */ jsx(Icon, { name: "chevron_left" })
|
|
1879
1958
|
}
|
|
1880
1959
|
),
|
|
@@ -1896,7 +1975,7 @@ var CalendarHeader = ({
|
|
|
1896
1975
|
{
|
|
1897
1976
|
name: "arrow_drop_down",
|
|
1898
1977
|
className: cn(
|
|
1899
|
-
"text-[20px]",
|
|
1978
|
+
"text-[20px] transition-transform duration-200",
|
|
1900
1979
|
activeSelector === "month" && "rotate-180"
|
|
1901
1980
|
)
|
|
1902
1981
|
}
|
|
@@ -1910,7 +1989,7 @@ var CalendarHeader = ({
|
|
|
1910
1989
|
onClick: onNext,
|
|
1911
1990
|
"aria-label": "Next month",
|
|
1912
1991
|
disabled: !canNavigateNext,
|
|
1913
|
-
size: "
|
|
1992
|
+
size: "xs",
|
|
1914
1993
|
children: /* @__PURE__ */ jsx(Icon, { name: "chevron_right" })
|
|
1915
1994
|
}
|
|
1916
1995
|
),
|
|
@@ -1921,7 +2000,7 @@ var CalendarHeader = ({
|
|
|
1921
2000
|
onClick: onPreviousYear,
|
|
1922
2001
|
"aria-label": "Previous year",
|
|
1923
2002
|
disabled: !canNavigatePreviousYear,
|
|
1924
|
-
size: "
|
|
2003
|
+
size: "xs",
|
|
1925
2004
|
children: /* @__PURE__ */ jsx(Icon, { name: "chevron_left" })
|
|
1926
2005
|
}
|
|
1927
2006
|
),
|
|
@@ -1943,7 +2022,7 @@ var CalendarHeader = ({
|
|
|
1943
2022
|
{
|
|
1944
2023
|
name: "arrow_drop_down",
|
|
1945
2024
|
className: cn(
|
|
1946
|
-
"text-[20px]",
|
|
2025
|
+
"text-[20px] transition-transform duration-200",
|
|
1947
2026
|
activeSelector === "year" && "rotate-180"
|
|
1948
2027
|
)
|
|
1949
2028
|
}
|
|
@@ -1957,7 +2036,7 @@ var CalendarHeader = ({
|
|
|
1957
2036
|
onClick: onNextYear,
|
|
1958
2037
|
"aria-label": "Next year",
|
|
1959
2038
|
disabled: !canNavigateNextYear,
|
|
1960
|
-
size: "
|
|
2039
|
+
size: "xs",
|
|
1961
2040
|
children: /* @__PURE__ */ jsx(Icon, { name: "chevron_right" })
|
|
1962
2041
|
}
|
|
1963
2042
|
),
|
|
@@ -1966,7 +2045,7 @@ var CalendarHeader = ({
|
|
|
1966
2045
|
{
|
|
1967
2046
|
onClick: onToggleMode,
|
|
1968
2047
|
"aria-label": "Switch to text input",
|
|
1969
|
-
size: "
|
|
2048
|
+
size: "xs",
|
|
1970
2049
|
children: /* @__PURE__ */ jsx(Icon, { name: "keyboard" })
|
|
1971
2050
|
}
|
|
1972
2051
|
)
|
|
@@ -1977,7 +2056,7 @@ var CalendarHeader = ({
|
|
|
1977
2056
|
{
|
|
1978
2057
|
onClick: onToggleMode,
|
|
1979
2058
|
"aria-label": "Switch to calendar",
|
|
1980
|
-
size: "
|
|
2059
|
+
size: "xs",
|
|
1981
2060
|
className: "self-end",
|
|
1982
2061
|
children: /* @__PURE__ */ jsx(Icon, { name: "calendar_month" })
|
|
1983
2062
|
}
|
|
@@ -1995,15 +2074,15 @@ var MonthPickerList = ({
|
|
|
1995
2074
|
locale,
|
|
1996
2075
|
onMonthSelect
|
|
1997
2076
|
}) => {
|
|
1998
|
-
const selectedRef =
|
|
1999
|
-
|
|
2077
|
+
const selectedRef = React13.useRef(null);
|
|
2078
|
+
React13.useEffect(() => {
|
|
2000
2079
|
var _a, _b;
|
|
2001
2080
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2002
2081
|
block: "center",
|
|
2003
2082
|
behavior: "instant"
|
|
2004
2083
|
});
|
|
2005
2084
|
}, []);
|
|
2006
|
-
const months =
|
|
2085
|
+
const months = React13.useMemo(
|
|
2007
2086
|
() => Array.from({ length: 12 }, (_, month) => month),
|
|
2008
2087
|
[]
|
|
2009
2088
|
);
|
|
@@ -2048,12 +2127,12 @@ var YearPickerList = ({
|
|
|
2048
2127
|
selectableDates,
|
|
2049
2128
|
onYearSelect
|
|
2050
2129
|
}) => {
|
|
2051
|
-
const selectedRef =
|
|
2052
|
-
const years =
|
|
2130
|
+
const selectedRef = React13.useRef(null);
|
|
2131
|
+
const years = React13.useMemo(() => {
|
|
2053
2132
|
const [min, max] = yearRange;
|
|
2054
2133
|
return Array.from({ length: max - min + 1 }, (_, index) => min + index);
|
|
2055
2134
|
}, [yearRange]);
|
|
2056
|
-
|
|
2135
|
+
React13.useEffect(() => {
|
|
2057
2136
|
var _a, _b;
|
|
2058
2137
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2059
2138
|
block: "center",
|
|
@@ -2124,17 +2203,17 @@ var DatePicker = ({
|
|
|
2124
2203
|
navigateToMonth,
|
|
2125
2204
|
setDisplayMode
|
|
2126
2205
|
} = state;
|
|
2127
|
-
const [activeSelector, setActiveSelector] =
|
|
2128
|
-
const [slideDirection, setSlideDirection] =
|
|
2129
|
-
const handlePrev =
|
|
2206
|
+
const [activeSelector, setActiveSelector] = React13.useState(null);
|
|
2207
|
+
const [slideDirection, setSlideDirection] = React13.useState(null);
|
|
2208
|
+
const handlePrev = React13.useCallback(() => {
|
|
2130
2209
|
setSlideDirection("prev");
|
|
2131
2210
|
navigateMonth2("prev");
|
|
2132
2211
|
}, [navigateMonth2]);
|
|
2133
|
-
const handleNext =
|
|
2212
|
+
const handleNext = React13.useCallback(() => {
|
|
2134
2213
|
setSlideDirection("next");
|
|
2135
2214
|
navigateMonth2("next");
|
|
2136
2215
|
}, [navigateMonth2]);
|
|
2137
|
-
const handleYearSelect =
|
|
2216
|
+
const handleYearSelect = React13.useCallback(
|
|
2138
2217
|
(year) => {
|
|
2139
2218
|
const d = new Date(displayedMonthMs);
|
|
2140
2219
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2142,7 +2221,7 @@ var DatePicker = ({
|
|
|
2142
2221
|
},
|
|
2143
2222
|
[displayedMonthMs, navigateToMonth]
|
|
2144
2223
|
);
|
|
2145
|
-
const handleMonthSelect =
|
|
2224
|
+
const handleMonthSelect = React13.useCallback(
|
|
2146
2225
|
(month) => {
|
|
2147
2226
|
const d = new Date(displayedMonthMs);
|
|
2148
2227
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2150,11 +2229,11 @@ var DatePicker = ({
|
|
|
2150
2229
|
},
|
|
2151
2230
|
[displayedMonthMs, navigateToMonth]
|
|
2152
2231
|
);
|
|
2153
|
-
const [inputValue, setInputValue] =
|
|
2232
|
+
const [inputValue, setInputValue] = React13.useState(
|
|
2154
2233
|
() => selectedDateMs !== null ? formatInputDate(selectedDateMs) : ""
|
|
2155
2234
|
);
|
|
2156
|
-
const [inputError, setInputError] =
|
|
2157
|
-
const handleInputCommit =
|
|
2235
|
+
const [inputError, setInputError] = React13.useState();
|
|
2236
|
+
const handleInputCommit = React13.useCallback(
|
|
2158
2237
|
(ms) => {
|
|
2159
2238
|
if (ms === null && inputValue.length > 0) {
|
|
2160
2239
|
setInputError("Invalid date");
|
|
@@ -2240,9 +2319,12 @@ var DatePicker = ({
|
|
|
2240
2319
|
"input-mode"
|
|
2241
2320
|
)
|
|
2242
2321
|
) : activeSelector === "month" ? /* @__PURE__ */ jsx(
|
|
2243
|
-
|
|
2322
|
+
m.div,
|
|
2244
2323
|
{
|
|
2245
2324
|
id: "date-picker-selection",
|
|
2325
|
+
initial: PICKER_SELECTOR_ANIM.initial,
|
|
2326
|
+
animate: PICKER_SELECTOR_ANIM.animate,
|
|
2327
|
+
exit: PICKER_SELECTOR_ANIM.exit,
|
|
2246
2328
|
className: "absolute inset-0",
|
|
2247
2329
|
children: /* @__PURE__ */ jsx(
|
|
2248
2330
|
MonthPickerList,
|
|
@@ -2255,9 +2337,12 @@ var DatePicker = ({
|
|
|
2255
2337
|
},
|
|
2256
2338
|
"month-list"
|
|
2257
2339
|
) : activeSelector === "year" ? /* @__PURE__ */ jsx(
|
|
2258
|
-
|
|
2340
|
+
m.div,
|
|
2259
2341
|
{
|
|
2260
2342
|
id: "date-picker-selection",
|
|
2343
|
+
initial: PICKER_SELECTOR_ANIM.initial,
|
|
2344
|
+
animate: PICKER_SELECTOR_ANIM.animate,
|
|
2345
|
+
exit: PICKER_SELECTOR_ANIM.exit,
|
|
2261
2346
|
className: "absolute inset-0",
|
|
2262
2347
|
children: /* @__PURE__ */ jsx(
|
|
2263
2348
|
YearPickerList,
|
|
@@ -2388,7 +2473,7 @@ var DP_CLASSES = {
|
|
|
2388
2473
|
/** Weekday header row */
|
|
2389
2474
|
weekdayRow: "text-[length:var(--md-typescale-body-large-size,14px)] text-m3-on-surface"
|
|
2390
2475
|
};
|
|
2391
|
-
var ScrollArea =
|
|
2476
|
+
var ScrollArea = React13.forwardRef(
|
|
2392
2477
|
(_a, ref) => {
|
|
2393
2478
|
var _b = _a, {
|
|
2394
2479
|
className,
|
|
@@ -2409,15 +2494,15 @@ var ScrollArea = React17.forwardRef(
|
|
|
2409
2494
|
"viewportRef",
|
|
2410
2495
|
"viewportProps"
|
|
2411
2496
|
]);
|
|
2412
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
2413
|
-
|
|
2497
|
+
const [isTouchDevice, setIsTouchDevice] = React13.useState(false);
|
|
2498
|
+
React13.useEffect(() => {
|
|
2414
2499
|
if (typeof window !== "undefined") {
|
|
2415
2500
|
setIsTouchDevice(
|
|
2416
2501
|
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
2417
2502
|
);
|
|
2418
2503
|
}
|
|
2419
2504
|
}, []);
|
|
2420
|
-
const resolvedType =
|
|
2505
|
+
const resolvedType = React13.useMemo(() => {
|
|
2421
2506
|
if (type === "hover" && isTouchDevice) {
|
|
2422
2507
|
return "scroll";
|
|
2423
2508
|
}
|
|
@@ -2468,7 +2553,7 @@ var ScrollArea = React17.forwardRef(
|
|
|
2468
2553
|
}
|
|
2469
2554
|
);
|
|
2470
2555
|
ScrollArea.displayName = "ScrollArea";
|
|
2471
|
-
var ScrollAreaScrollbar =
|
|
2556
|
+
var ScrollAreaScrollbar = React13.forwardRef((_a, ref) => {
|
|
2472
2557
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
2473
2558
|
return /* @__PURE__ */ jsx(
|
|
2474
2559
|
RadixScrollArea.Scrollbar,
|
|
@@ -2498,7 +2583,7 @@ var ScrollAreaScrollbar = React17.forwardRef((_a, ref) => {
|
|
|
2498
2583
|
);
|
|
2499
2584
|
});
|
|
2500
2585
|
ScrollAreaScrollbar.displayName = RadixScrollArea.Scrollbar.displayName;
|
|
2501
|
-
var ScrollAreaCorner =
|
|
2586
|
+
var ScrollAreaCorner = React13.forwardRef((_a, ref) => {
|
|
2502
2587
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2503
2588
|
return /* @__PURE__ */ jsx(
|
|
2504
2589
|
RadixScrollArea.Corner,
|
|
@@ -2540,9 +2625,9 @@ DialogTrigger.displayName = "DialogTrigger";
|
|
|
2540
2625
|
var DialogPortal = ({
|
|
2541
2626
|
open,
|
|
2542
2627
|
children
|
|
2543
|
-
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ?
|
|
2628
|
+
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ? React13.Children.toArray(children) : null }) });
|
|
2544
2629
|
DialogPortal.displayName = "DialogPortal";
|
|
2545
|
-
var DialogOverlay =
|
|
2630
|
+
var DialogOverlay = React13.forwardRef((_a, ref) => {
|
|
2546
2631
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2547
2632
|
return /* @__PURE__ */ jsx(RadixDialog.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsx(
|
|
2548
2633
|
m.div,
|
|
@@ -2553,7 +2638,7 @@ var DialogOverlay = React17.forwardRef((_a, ref) => {
|
|
|
2553
2638
|
) }));
|
|
2554
2639
|
});
|
|
2555
2640
|
DialogOverlay.displayName = "DialogOverlay";
|
|
2556
|
-
var DialogContent =
|
|
2641
|
+
var DialogContent = React13.forwardRef((_a, ref) => {
|
|
2557
2642
|
var _b = _a, { className, children, hideCloseButton = false } = _b, props = __objRest(_b, ["className", "children", "hideCloseButton"]);
|
|
2558
2643
|
return /* @__PURE__ */ jsx(
|
|
2559
2644
|
RadixDialog.Content,
|
|
@@ -2593,7 +2678,7 @@ var DialogContent = React17.forwardRef((_a, ref) => {
|
|
|
2593
2678
|
);
|
|
2594
2679
|
});
|
|
2595
2680
|
DialogContent.displayName = "DialogContent";
|
|
2596
|
-
var DialogIcon =
|
|
2681
|
+
var DialogIcon = React13.forwardRef((_a, ref) => {
|
|
2597
2682
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
2598
2683
|
return /* @__PURE__ */ jsx(
|
|
2599
2684
|
"div",
|
|
@@ -2607,7 +2692,7 @@ var DialogIcon = React17.forwardRef((_a, ref) => {
|
|
|
2607
2692
|
);
|
|
2608
2693
|
});
|
|
2609
2694
|
DialogIcon.displayName = "DialogIcon";
|
|
2610
|
-
var DialogTitle =
|
|
2695
|
+
var DialogTitle = React13.forwardRef((_a, ref) => {
|
|
2611
2696
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2612
2697
|
return /* @__PURE__ */ jsx(
|
|
2613
2698
|
RadixDialog.Title,
|
|
@@ -2622,7 +2707,7 @@ var DialogTitle = React17.forwardRef((_a, ref) => {
|
|
|
2622
2707
|
);
|
|
2623
2708
|
});
|
|
2624
2709
|
DialogTitle.displayName = "DialogTitle";
|
|
2625
|
-
var DialogDescription =
|
|
2710
|
+
var DialogDescription = React13.forwardRef((_a, ref) => {
|
|
2626
2711
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2627
2712
|
return /* @__PURE__ */ jsx(
|
|
2628
2713
|
RadixDialog.Description,
|
|
@@ -2634,7 +2719,7 @@ var DialogDescription = React17.forwardRef((_a, ref) => {
|
|
|
2634
2719
|
);
|
|
2635
2720
|
});
|
|
2636
2721
|
DialogDescription.displayName = "DialogDescription";
|
|
2637
|
-
var DialogBody =
|
|
2722
|
+
var DialogBody = React13.forwardRef((_a, ref) => {
|
|
2638
2723
|
var _b = _a, { className, children, dir } = _b, props = __objRest(_b, ["className", "children", "dir"]);
|
|
2639
2724
|
return /* @__PURE__ */ jsx(
|
|
2640
2725
|
ScrollArea,
|
|
@@ -2650,7 +2735,7 @@ var DialogBody = React17.forwardRef((_a, ref) => {
|
|
|
2650
2735
|
);
|
|
2651
2736
|
});
|
|
2652
2737
|
DialogBody.displayName = "DialogBody";
|
|
2653
|
-
var DialogFullScreenContent =
|
|
2738
|
+
var DialogFullScreenContent = React13.forwardRef(
|
|
2654
2739
|
(_a, ref) => {
|
|
2655
2740
|
var _b = _a, {
|
|
2656
2741
|
className,
|
|
@@ -2798,17 +2883,17 @@ var DateRangePicker = ({
|
|
|
2798
2883
|
navigateToMonth,
|
|
2799
2884
|
setDisplayMode
|
|
2800
2885
|
} = state;
|
|
2801
|
-
const [activeSelector, setActiveSelector] =
|
|
2802
|
-
const [slideDirection, setSlideDirection] =
|
|
2803
|
-
const handlePrev =
|
|
2886
|
+
const [activeSelector, setActiveSelector] = React13.useState(null);
|
|
2887
|
+
const [slideDirection, setSlideDirection] = React13.useState(null);
|
|
2888
|
+
const handlePrev = React13.useCallback(() => {
|
|
2804
2889
|
setSlideDirection("prev");
|
|
2805
2890
|
navigateMonth2("prev");
|
|
2806
2891
|
}, [navigateMonth2]);
|
|
2807
|
-
const handleNext =
|
|
2892
|
+
const handleNext = React13.useCallback(() => {
|
|
2808
2893
|
setSlideDirection("next");
|
|
2809
2894
|
navigateMonth2("next");
|
|
2810
2895
|
}, [navigateMonth2]);
|
|
2811
|
-
const handleYearSelect =
|
|
2896
|
+
const handleYearSelect = React13.useCallback(
|
|
2812
2897
|
(year) => {
|
|
2813
2898
|
const d = new Date(displayedMonthMs);
|
|
2814
2899
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2816,7 +2901,7 @@ var DateRangePicker = ({
|
|
|
2816
2901
|
},
|
|
2817
2902
|
[displayedMonthMs, navigateToMonth]
|
|
2818
2903
|
);
|
|
2819
|
-
const handleMonthSelect =
|
|
2904
|
+
const handleMonthSelect = React13.useCallback(
|
|
2820
2905
|
(month) => {
|
|
2821
2906
|
const d = new Date(displayedMonthMs);
|
|
2822
2907
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2824,7 +2909,7 @@ var DateRangePicker = ({
|
|
|
2824
2909
|
},
|
|
2825
2910
|
[displayedMonthMs, navigateToMonth]
|
|
2826
2911
|
);
|
|
2827
|
-
const formatShort =
|
|
2912
|
+
const formatShort = React13.useCallback(
|
|
2828
2913
|
(ms) => {
|
|
2829
2914
|
if (ms === null) return "\u2014";
|
|
2830
2915
|
return formatDate(ms, locale, {
|
|
@@ -2890,9 +2975,12 @@ var DateRangePicker = ({
|
|
|
2890
2975
|
className: "relative flex-1 overflow-hidden",
|
|
2891
2976
|
style: { minHeight: "296px" },
|
|
2892
2977
|
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: activeSelector === "month" ? /* @__PURE__ */ jsx(
|
|
2893
|
-
|
|
2978
|
+
m.div,
|
|
2894
2979
|
{
|
|
2895
2980
|
id: "date-picker-selection",
|
|
2981
|
+
initial: PICKER_SELECTOR_ANIM.initial,
|
|
2982
|
+
animate: PICKER_SELECTOR_ANIM.animate,
|
|
2983
|
+
exit: PICKER_SELECTOR_ANIM.exit,
|
|
2896
2984
|
className: "absolute inset-0",
|
|
2897
2985
|
children: /* @__PURE__ */ jsx(
|
|
2898
2986
|
MonthPickerList,
|
|
@@ -2905,9 +2993,12 @@ var DateRangePicker = ({
|
|
|
2905
2993
|
},
|
|
2906
2994
|
"month-list"
|
|
2907
2995
|
) : activeSelector === "year" ? /* @__PURE__ */ jsx(
|
|
2908
|
-
|
|
2996
|
+
m.div,
|
|
2909
2997
|
{
|
|
2910
2998
|
id: "date-picker-selection",
|
|
2999
|
+
initial: PICKER_SELECTOR_ANIM.initial,
|
|
3000
|
+
animate: PICKER_SELECTOR_ANIM.animate,
|
|
3001
|
+
exit: PICKER_SELECTOR_ANIM.exit,
|
|
2911
3002
|
className: "absolute inset-0",
|
|
2912
3003
|
children: /* @__PURE__ */ jsx(
|
|
2913
3004
|
YearPickerList,
|
|
@@ -3429,16 +3520,16 @@ var InputField = ({
|
|
|
3429
3520
|
onBlur,
|
|
3430
3521
|
className
|
|
3431
3522
|
}) => {
|
|
3432
|
-
const [inputText, setInputText] =
|
|
3523
|
+
const [inputText, setInputText] = React13.useState(
|
|
3433
3524
|
String(value).padStart(2, "0")
|
|
3434
3525
|
);
|
|
3435
|
-
const inputRef =
|
|
3436
|
-
|
|
3526
|
+
const inputRef = React13.useRef(null);
|
|
3527
|
+
React13.useEffect(() => {
|
|
3437
3528
|
if (!isFocused) {
|
|
3438
3529
|
setInputText(String(value).padStart(2, "0"));
|
|
3439
3530
|
}
|
|
3440
3531
|
}, [value, isFocused]);
|
|
3441
|
-
|
|
3532
|
+
React13.useEffect(() => {
|
|
3442
3533
|
var _a, _b;
|
|
3443
3534
|
if (isFocused) {
|
|
3444
3535
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -3528,7 +3619,7 @@ var InputField = ({
|
|
|
3528
3619
|
};
|
|
3529
3620
|
var TimeInput = ({ state, className }) => {
|
|
3530
3621
|
const { is24hour, setHourInput, setMinuteInput, setSelection } = state;
|
|
3531
|
-
const [focusedField, setFocusedField] =
|
|
3622
|
+
const [focusedField, setFocusedField] = React13.useState(null);
|
|
3532
3623
|
const handleHourAutoAdvance = () => {
|
|
3533
3624
|
setFocusedField("minute");
|
|
3534
3625
|
setSelection("minute");
|
|
@@ -3722,17 +3813,17 @@ var ClockDial = ({
|
|
|
3722
3813
|
setMinute,
|
|
3723
3814
|
setSelection
|
|
3724
3815
|
} = state;
|
|
3725
|
-
const displayAngle =
|
|
3816
|
+
const displayAngle = React13.useMemo(() => {
|
|
3726
3817
|
if (selection === "hour") {
|
|
3727
3818
|
return valueToAngle(hour, "hour");
|
|
3728
3819
|
}
|
|
3729
3820
|
return valueToAngle(minute, "minute");
|
|
3730
3821
|
}, [selection, hour, minute]);
|
|
3731
|
-
const selectorPos =
|
|
3822
|
+
const selectorPos = React13.useMemo(
|
|
3732
3823
|
() => getSelectorPosition(displayAngle, selection, is24hour, isPm),
|
|
3733
3824
|
[displayAngle, selection, is24hour, isPm]
|
|
3734
3825
|
);
|
|
3735
|
-
const trackEnd =
|
|
3826
|
+
const trackEnd = React13.useMemo(() => {
|
|
3736
3827
|
const dx = selectorPos.x - CENTER;
|
|
3737
3828
|
const dy = selectorPos.y - CENTER;
|
|
3738
3829
|
const length = Math.hypot(dx, dy);
|
|
@@ -3742,13 +3833,13 @@ var ClockDial = ({
|
|
|
3742
3833
|
y: selectorPos.y - dy / length * HANDLE_RADIUS
|
|
3743
3834
|
};
|
|
3744
3835
|
}, [selectorPos]);
|
|
3745
|
-
const numbers =
|
|
3836
|
+
const numbers = React13.useMemo(() => {
|
|
3746
3837
|
if (selection === "minute") return buildMinuteNumbers();
|
|
3747
3838
|
if (is24hour) return buildHour24Numbers();
|
|
3748
3839
|
return buildHour12Numbers();
|
|
3749
3840
|
}, [selection, is24hour]);
|
|
3750
|
-
const isDragging =
|
|
3751
|
-
const svgRef =
|
|
3841
|
+
const isDragging = React13.useRef(false);
|
|
3842
|
+
const svgRef = React13.useRef(null);
|
|
3752
3843
|
const getSVGPoint = (e) => {
|
|
3753
3844
|
const svg = svgRef.current;
|
|
3754
3845
|
if (!svg) return { x: e.clientX, y: e.clientY };
|
|
@@ -3898,8 +3989,8 @@ var getAutoLayout = () => {
|
|
|
3898
3989
|
return innerWidth >= 600 && innerHeight >= 300 && innerWidth >= innerHeight ? "horizontal" : "vertical";
|
|
3899
3990
|
};
|
|
3900
3991
|
var useResolvedLayout = (layout) => {
|
|
3901
|
-
const [autoLayout, setAutoLayout] =
|
|
3902
|
-
|
|
3992
|
+
const [autoLayout, setAutoLayout] = React13.useState("vertical");
|
|
3993
|
+
React13.useEffect(() => {
|
|
3903
3994
|
if (layout !== "auto") return;
|
|
3904
3995
|
const updateLayout = () => setAutoLayout(getAutoLayout());
|
|
3905
3996
|
updateLayout();
|
|
@@ -4076,7 +4167,7 @@ var TimePickerDialog = ({
|
|
|
4076
4167
|
TimePickerDialog.displayName = "TimePickerDialog";
|
|
4077
4168
|
var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
4078
4169
|
var isValidHourInput = (h, is24hour) => is24hour ? h >= 0 && h <= 23 : h >= 1 && h <= 12;
|
|
4079
|
-
var isValidMinuteInput = (
|
|
4170
|
+
var isValidMinuteInput = (m13) => m13 >= 0 && m13 <= 59;
|
|
4080
4171
|
var to24Hour = (hour12, isPm) => {
|
|
4081
4172
|
if (isPm) {
|
|
4082
4173
|
return hour12 === 12 ? 12 : hour12 + 12;
|
|
@@ -4112,8 +4203,8 @@ var useTimePickerState = (options) => {
|
|
|
4112
4203
|
},
|
|
4113
4204
|
[is24hour]
|
|
4114
4205
|
);
|
|
4115
|
-
const setMinute = useCallback((
|
|
4116
|
-
const clamped = clamp(
|
|
4206
|
+
const setMinute = useCallback((m13) => {
|
|
4207
|
+
const clamped = clamp(m13, 0, 59);
|
|
4117
4208
|
setMinuteState(clamped);
|
|
4118
4209
|
setMinuteInputState(clamped);
|
|
4119
4210
|
}, []);
|
|
@@ -4127,10 +4218,10 @@ var useTimePickerState = (options) => {
|
|
|
4127
4218
|
},
|
|
4128
4219
|
[is24hour, isPm]
|
|
4129
4220
|
);
|
|
4130
|
-
const setMinuteInput = useCallback((
|
|
4131
|
-
setMinuteInputState(
|
|
4132
|
-
if (isValidMinuteInput(
|
|
4133
|
-
setMinuteState(
|
|
4221
|
+
const setMinuteInput = useCallback((m13) => {
|
|
4222
|
+
setMinuteInputState(m13);
|
|
4223
|
+
if (isValidMinuteInput(m13)) {
|
|
4224
|
+
setMinuteState(m13);
|
|
4134
4225
|
}
|
|
4135
4226
|
}, []);
|
|
4136
4227
|
const setSelection = useCallback((mode) => {
|