@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.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var react = require('motion/react');
|
|
5
|
-
var
|
|
5
|
+
var React13 = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
9
10
|
var RadixDialog = require('@radix-ui/react-dialog');
|
|
10
11
|
var RadixScrollArea = require('@radix-ui/react-scroll-area');
|
|
11
12
|
|
|
@@ -27,7 +28,7 @@ function _interopNamespace(e) {
|
|
|
27
28
|
return Object.freeze(n);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
var
|
|
31
|
+
var React13__namespace = /*#__PURE__*/_interopNamespace(React13);
|
|
31
32
|
var RadixDialog__namespace = /*#__PURE__*/_interopNamespace(RadixDialog);
|
|
32
33
|
var RadixScrollArea__namespace = /*#__PURE__*/_interopNamespace(RadixScrollArea);
|
|
33
34
|
|
|
@@ -66,6 +67,97 @@ function cn(...inputs) {
|
|
|
66
67
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
// src/ui/shared/motion-tokens.ts
|
|
71
|
+
var FAST_SPATIAL_SPRING = {
|
|
72
|
+
type: "spring",
|
|
73
|
+
stiffness: 800,
|
|
74
|
+
damping: 33.94
|
|
75
|
+
};
|
|
76
|
+
var DEFAULT_SPATIAL_SPRING = {
|
|
77
|
+
type: "spring",
|
|
78
|
+
stiffness: 380,
|
|
79
|
+
damping: 31.19
|
|
80
|
+
};
|
|
81
|
+
var FAST_EFFECTS_SPRING = {
|
|
82
|
+
type: "spring",
|
|
83
|
+
stiffness: 3800,
|
|
84
|
+
damping: 123.29
|
|
85
|
+
};
|
|
86
|
+
var DEFAULT_EFFECTS_SPRING = {
|
|
87
|
+
type: "spring",
|
|
88
|
+
stiffness: 1600,
|
|
89
|
+
damping: 80
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// src/ui/date-time-pickers/shared/animation-tokens.ts
|
|
93
|
+
var PICKER_OVERLAY_ANIM = {
|
|
94
|
+
initial: { opacity: 0 },
|
|
95
|
+
animate: {
|
|
96
|
+
opacity: 1,
|
|
97
|
+
transition: { duration: 0.2, ease: [0, 0, 0, 1] }
|
|
98
|
+
},
|
|
99
|
+
exit: {
|
|
100
|
+
opacity: 0,
|
|
101
|
+
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var PICKER_CONTENT_ANIM = {
|
|
105
|
+
initial: { opacity: 0, scale: 0.85, y: 16 },
|
|
106
|
+
animate: {
|
|
107
|
+
opacity: 1,
|
|
108
|
+
scale: 1,
|
|
109
|
+
y: 0,
|
|
110
|
+
transition: DEFAULT_SPATIAL_SPRING
|
|
111
|
+
},
|
|
112
|
+
exit: {
|
|
113
|
+
opacity: 0,
|
|
114
|
+
scale: 0.95,
|
|
115
|
+
y: 8,
|
|
116
|
+
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var CALENDAR_SLIDE_VARIANTS = {
|
|
120
|
+
enterFromRight: {
|
|
121
|
+
x: "100%",
|
|
122
|
+
opacity: 0
|
|
123
|
+
},
|
|
124
|
+
enterFromLeft: {
|
|
125
|
+
x: "-100%",
|
|
126
|
+
opacity: 0
|
|
127
|
+
},
|
|
128
|
+
center: {
|
|
129
|
+
x: 0,
|
|
130
|
+
opacity: 1,
|
|
131
|
+
transition: FAST_SPATIAL_SPRING
|
|
132
|
+
},
|
|
133
|
+
exitToLeft: {
|
|
134
|
+
x: "-100%",
|
|
135
|
+
opacity: 0,
|
|
136
|
+
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
137
|
+
},
|
|
138
|
+
exitToRight: {
|
|
139
|
+
x: "100%",
|
|
140
|
+
opacity: 0,
|
|
141
|
+
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var PICKER_SELECTOR_ANIM = {
|
|
145
|
+
initial: { opacity: 0, scale: 0.95, y: -6 },
|
|
146
|
+
animate: {
|
|
147
|
+
opacity: 1,
|
|
148
|
+
scale: 1,
|
|
149
|
+
y: 0,
|
|
150
|
+
transition: DEFAULT_SPATIAL_SPRING
|
|
151
|
+
},
|
|
152
|
+
exit: {
|
|
153
|
+
opacity: 0,
|
|
154
|
+
scale: 0.95,
|
|
155
|
+
y: 6,
|
|
156
|
+
transition: { duration: 0.1, ease: "easeIn" }
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var DAY_CELL_STATE_TRANSITION = FAST_EFFECTS_SPRING;
|
|
160
|
+
|
|
69
161
|
// src/ui/date-time-pickers/shared/calendar-model.ts
|
|
70
162
|
var startOfDayUTC = (ms) => {
|
|
71
163
|
const d = new Date(ms);
|
|
@@ -192,13 +284,13 @@ var DatePickerInput = ({
|
|
|
192
284
|
locale,
|
|
193
285
|
className
|
|
194
286
|
}) => {
|
|
195
|
-
const inputId =
|
|
287
|
+
const inputId = React13__namespace.useId();
|
|
196
288
|
const errorId = `${inputId}-error`;
|
|
197
|
-
const placeholder =
|
|
289
|
+
const placeholder = React13__namespace.useMemo(() => {
|
|
198
290
|
if (locale == null ? void 0 : locale.startsWith("vi")) return "DD/MM/YYYY";
|
|
199
291
|
return "MM/DD/YYYY";
|
|
200
292
|
}, [locale]);
|
|
201
|
-
const handleKeyDown =
|
|
293
|
+
const handleKeyDown = React13__namespace.useCallback(
|
|
202
294
|
(e) => {
|
|
203
295
|
if (e.key === "Enter") {
|
|
204
296
|
const parsed = parseDateInput(value);
|
|
@@ -207,11 +299,11 @@ var DatePickerInput = ({
|
|
|
207
299
|
},
|
|
208
300
|
[value, onCommit]
|
|
209
301
|
);
|
|
210
|
-
const handleBlur =
|
|
302
|
+
const handleBlur = React13__namespace.useCallback(() => {
|
|
211
303
|
const parsed = parseDateInput(value);
|
|
212
304
|
onCommit(parsed);
|
|
213
305
|
}, [value, onCommit]);
|
|
214
|
-
const handleChange =
|
|
306
|
+
const handleChange = React13__namespace.useCallback(
|
|
215
307
|
(e) => {
|
|
216
308
|
let raw = e.target.value.replace(/\D/g, "");
|
|
217
309
|
if (raw.length > 8) raw = raw.slice(0, 8);
|
|
@@ -257,82 +349,6 @@ var DatePickerInput = ({
|
|
|
257
349
|
] }) }) });
|
|
258
350
|
};
|
|
259
351
|
DatePickerInput.displayName = "DatePickerInput";
|
|
260
|
-
|
|
261
|
-
// src/ui/shared/motion-tokens.ts
|
|
262
|
-
var FAST_SPATIAL_SPRING = {
|
|
263
|
-
type: "spring",
|
|
264
|
-
stiffness: 800,
|
|
265
|
-
damping: 33.94
|
|
266
|
-
};
|
|
267
|
-
var DEFAULT_SPATIAL_SPRING = {
|
|
268
|
-
type: "spring",
|
|
269
|
-
stiffness: 380,
|
|
270
|
-
damping: 31.19
|
|
271
|
-
};
|
|
272
|
-
var FAST_EFFECTS_SPRING = {
|
|
273
|
-
type: "spring",
|
|
274
|
-
stiffness: 3800,
|
|
275
|
-
damping: 123.29
|
|
276
|
-
};
|
|
277
|
-
var DEFAULT_EFFECTS_SPRING = {
|
|
278
|
-
type: "spring",
|
|
279
|
-
stiffness: 1600,
|
|
280
|
-
damping: 80
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// src/ui/date-time-pickers/shared/animation-tokens.ts
|
|
284
|
-
var PICKER_OVERLAY_ANIM = {
|
|
285
|
-
initial: { opacity: 0 },
|
|
286
|
-
animate: {
|
|
287
|
-
opacity: 1,
|
|
288
|
-
transition: { duration: 0.2, ease: [0, 0, 0, 1] }
|
|
289
|
-
},
|
|
290
|
-
exit: {
|
|
291
|
-
opacity: 0,
|
|
292
|
-
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
var PICKER_CONTENT_ANIM = {
|
|
296
|
-
initial: { opacity: 0, scale: 0.85, y: 16 },
|
|
297
|
-
animate: {
|
|
298
|
-
opacity: 1,
|
|
299
|
-
scale: 1,
|
|
300
|
-
y: 0,
|
|
301
|
-
transition: DEFAULT_SPATIAL_SPRING
|
|
302
|
-
},
|
|
303
|
-
exit: {
|
|
304
|
-
opacity: 0,
|
|
305
|
-
scale: 0.95,
|
|
306
|
-
y: 8,
|
|
307
|
-
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
var CALENDAR_SLIDE_VARIANTS = {
|
|
311
|
-
enterFromRight: {
|
|
312
|
-
x: "100%",
|
|
313
|
-
opacity: 0
|
|
314
|
-
},
|
|
315
|
-
enterFromLeft: {
|
|
316
|
-
x: "-100%",
|
|
317
|
-
opacity: 0
|
|
318
|
-
},
|
|
319
|
-
center: {
|
|
320
|
-
x: 0,
|
|
321
|
-
opacity: 1,
|
|
322
|
-
transition: FAST_SPATIAL_SPRING
|
|
323
|
-
},
|
|
324
|
-
exitToLeft: {
|
|
325
|
-
x: "-100%",
|
|
326
|
-
opacity: 0,
|
|
327
|
-
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
328
|
-
},
|
|
329
|
-
exitToRight: {
|
|
330
|
-
x: "100%",
|
|
331
|
-
opacity: 0,
|
|
332
|
-
transition: { duration: 0.15, ease: [0.3, 0, 1, 1] }
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
var DAY_CELL_STATE_TRANSITION = FAST_EFFECTS_SPRING;
|
|
336
352
|
var DayCell = ({
|
|
337
353
|
day,
|
|
338
354
|
selectedMs,
|
|
@@ -381,11 +397,11 @@ var DayCell = ({
|
|
|
381
397
|
// Disabled
|
|
382
398
|
isDisabled && "opacity-[0.38]"
|
|
383
399
|
);
|
|
384
|
-
const handleClick =
|
|
400
|
+
const handleClick = React13__namespace.useCallback(() => {
|
|
385
401
|
if (isDisabled) return;
|
|
386
402
|
onSelect(utcMs);
|
|
387
403
|
}, [isDisabled, utcMs, onSelect]);
|
|
388
|
-
const handleKeyDown =
|
|
404
|
+
const handleKeyDown = React13__namespace.useCallback(
|
|
389
405
|
(e) => {
|
|
390
406
|
if (e.key === "Enter" || e.key === " ") {
|
|
391
407
|
e.preventDefault();
|
|
@@ -421,7 +437,7 @@ var DayCell = ({
|
|
|
421
437
|
};
|
|
422
438
|
DayCell.displayName = "DayCell";
|
|
423
439
|
var WeekdayRow = ({ locale }) => {
|
|
424
|
-
const names =
|
|
440
|
+
const names = React13__namespace.useMemo(() => getWeekdayNames(locale), [locale]);
|
|
425
441
|
return /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "grid grid-cols-7 mb-1", children: names.map((name, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
426
442
|
"th",
|
|
427
443
|
{
|
|
@@ -448,7 +464,7 @@ var CalendarGrid = ({
|
|
|
448
464
|
const d = new Date(displayedMonthMs);
|
|
449
465
|
const year = d.getUTCFullYear();
|
|
450
466
|
const month = d.getUTCMonth();
|
|
451
|
-
const weeks =
|
|
467
|
+
const weeks = React13__namespace.useMemo(
|
|
452
468
|
() => getWeeksInMonth(year, month, locale.weekStartsOn),
|
|
453
469
|
[year, month, locale.weekStartsOn]
|
|
454
470
|
);
|
|
@@ -550,11 +566,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
550
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";
|
|
551
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";
|
|
552
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";
|
|
553
|
-
var IndeterminateSvg =
|
|
569
|
+
var IndeterminateSvg = React13__namespace.memo(function IndeterminateSvg2({
|
|
554
570
|
size
|
|
555
571
|
}) {
|
|
556
|
-
const [ready, setReady] =
|
|
557
|
-
|
|
572
|
+
const [ready, setReady] = React13__namespace.useState(false);
|
|
573
|
+
React13__namespace.useEffect(() => {
|
|
558
574
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
559
575
|
return () => cancelAnimationFrame(raf);
|
|
560
576
|
}, []);
|
|
@@ -599,7 +615,7 @@ var IndeterminateSvg = React17__namespace.memo(function IndeterminateSvg2({
|
|
|
599
615
|
}
|
|
600
616
|
);
|
|
601
617
|
});
|
|
602
|
-
var DeterminateSvg =
|
|
618
|
+
var DeterminateSvg = React13__namespace.memo(function DeterminateSvg2({
|
|
603
619
|
size,
|
|
604
620
|
progress
|
|
605
621
|
}) {
|
|
@@ -624,7 +640,7 @@ var DeterminateSvg = React17__namespace.memo(function DeterminateSvg2({
|
|
|
624
640
|
}
|
|
625
641
|
);
|
|
626
642
|
});
|
|
627
|
-
var LoadingIndicator =
|
|
643
|
+
var LoadingIndicator = React13__namespace.forwardRef(
|
|
628
644
|
(_a, ref) => {
|
|
629
645
|
var _b = _a, {
|
|
630
646
|
variant = "uncontained",
|
|
@@ -739,7 +755,7 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
739
755
|
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
740
756
|
return d;
|
|
741
757
|
}
|
|
742
|
-
var CircularProgress =
|
|
758
|
+
var CircularProgress = React13__namespace.forwardRef(
|
|
743
759
|
(_a, ref) => {
|
|
744
760
|
var _b = _a, {
|
|
745
761
|
value,
|
|
@@ -777,15 +793,15 @@ var CircularProgress = React17__namespace.forwardRef(
|
|
|
777
793
|
const isWavy = shape === "wavy";
|
|
778
794
|
const BASELINE_SIZE = 48;
|
|
779
795
|
const scaleFactor = size / BASELINE_SIZE;
|
|
780
|
-
const effectiveAmplitude =
|
|
796
|
+
const effectiveAmplitude = React13__namespace.useMemo(
|
|
781
797
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
782
798
|
[amplitude, scaleFactor]
|
|
783
799
|
);
|
|
784
|
-
const effectiveWavelength =
|
|
800
|
+
const effectiveWavelength = React13__namespace.useMemo(
|
|
785
801
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
786
802
|
[wavelength, scaleFactor]
|
|
787
803
|
);
|
|
788
|
-
const wavyActivePath =
|
|
804
|
+
const wavyActivePath = React13__namespace.useMemo(
|
|
789
805
|
() => isWavy ? generateWavyCircularPath(
|
|
790
806
|
center,
|
|
791
807
|
radius,
|
|
@@ -794,8 +810,8 @@ var CircularProgress = React17__namespace.forwardRef(
|
|
|
794
810
|
) : null,
|
|
795
811
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
796
812
|
);
|
|
797
|
-
const circumference =
|
|
798
|
-
const gapForTrack =
|
|
813
|
+
const circumference = React13__namespace.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
814
|
+
const gapForTrack = React13__namespace.useMemo(
|
|
799
815
|
() => (gapSize + trackHeight) / circumference,
|
|
800
816
|
[gapSize, trackHeight, circumference]
|
|
801
817
|
);
|
|
@@ -984,9 +1000,9 @@ var CircularProgress = React17__namespace.forwardRef(
|
|
|
984
1000
|
);
|
|
985
1001
|
CircularProgress.displayName = "CircularProgress";
|
|
986
1002
|
function useContainerWidth() {
|
|
987
|
-
const [width, setWidth] =
|
|
988
|
-
const observerRef =
|
|
989
|
-
const ref =
|
|
1003
|
+
const [width, setWidth] = React13__namespace.useState(0);
|
|
1004
|
+
const observerRef = React13__namespace.useRef(null);
|
|
1005
|
+
const ref = React13__namespace.useCallback((node) => {
|
|
990
1006
|
if (observerRef.current) {
|
|
991
1007
|
observerRef.current.disconnect();
|
|
992
1008
|
observerRef.current = null;
|
|
@@ -1000,7 +1016,7 @@ function useContainerWidth() {
|
|
|
1000
1016
|
observerRef.current = obs;
|
|
1001
1017
|
}
|
|
1002
1018
|
}, []);
|
|
1003
|
-
|
|
1019
|
+
React13__namespace.useEffect(() => {
|
|
1004
1020
|
return () => {
|
|
1005
1021
|
if (observerRef.current) {
|
|
1006
1022
|
observerRef.current.disconnect();
|
|
@@ -1010,7 +1026,7 @@ function useContainerWidth() {
|
|
|
1010
1026
|
return [ref, width];
|
|
1011
1027
|
}
|
|
1012
1028
|
function useMergedRef(...refs) {
|
|
1013
|
-
return
|
|
1029
|
+
return React13__namespace.useCallback(
|
|
1014
1030
|
(node) => {
|
|
1015
1031
|
for (const ref of refs) {
|
|
1016
1032
|
if (typeof ref === "function") {
|
|
@@ -1024,7 +1040,7 @@ function useMergedRef(...refs) {
|
|
|
1024
1040
|
[refs]
|
|
1025
1041
|
);
|
|
1026
1042
|
}
|
|
1027
|
-
var FlatLinearTrack =
|
|
1043
|
+
var FlatLinearTrack = React13__namespace.memo(function FlatLinearTrack2({
|
|
1028
1044
|
trackHeight,
|
|
1029
1045
|
activeColor,
|
|
1030
1046
|
trackColor,
|
|
@@ -1100,7 +1116,7 @@ var FlatLinearTrack = React17__namespace.memo(function FlatLinearTrack2({
|
|
|
1100
1116
|
}
|
|
1101
1117
|
);
|
|
1102
1118
|
});
|
|
1103
|
-
var WavyLinearTrack =
|
|
1119
|
+
var WavyLinearTrack = React13__namespace.memo(function WavyLinearTrack2({
|
|
1104
1120
|
trackHeight,
|
|
1105
1121
|
svgHeight,
|
|
1106
1122
|
amplitude,
|
|
@@ -1119,13 +1135,13 @@ var WavyLinearTrack = React17__namespace.memo(function WavyLinearTrack2({
|
|
|
1119
1135
|
}) {
|
|
1120
1136
|
const isDeterminate = typeof value === "number";
|
|
1121
1137
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1122
|
-
const titleId =
|
|
1138
|
+
const titleId = React13__namespace.useId();
|
|
1123
1139
|
const [containerRef, width] = useContainerWidth();
|
|
1124
|
-
const activePathRef =
|
|
1125
|
-
const trackPathRef =
|
|
1140
|
+
const activePathRef = React13__namespace.useRef(null);
|
|
1141
|
+
const trackPathRef = React13__namespace.useRef(null);
|
|
1126
1142
|
const amplitudeMV = react.useMotionValue(amplitude);
|
|
1127
1143
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1128
|
-
|
|
1144
|
+
React13__namespace.useEffect(() => {
|
|
1129
1145
|
if (isDeterminate) {
|
|
1130
1146
|
const fraction = clampedValue / 100;
|
|
1131
1147
|
let targetAmp = amplitude;
|
|
@@ -1296,7 +1312,7 @@ var WavyLinearTrack = React17__namespace.memo(function WavyLinearTrack2({
|
|
|
1296
1312
|
}
|
|
1297
1313
|
);
|
|
1298
1314
|
});
|
|
1299
|
-
var LinearProgress =
|
|
1315
|
+
var LinearProgress = React13__namespace.forwardRef(
|
|
1300
1316
|
(_a, ref) => {
|
|
1301
1317
|
var _b = _a, {
|
|
1302
1318
|
value,
|
|
@@ -1337,10 +1353,10 @@ var LinearProgress = React17__namespace.forwardRef(
|
|
|
1337
1353
|
]);
|
|
1338
1354
|
const isDeterminate = value !== void 0;
|
|
1339
1355
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1340
|
-
const containerRef =
|
|
1356
|
+
const containerRef = React13__namespace.useRef(null);
|
|
1341
1357
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1342
|
-
const [isRtl, setIsRtl] =
|
|
1343
|
-
|
|
1358
|
+
const [isRtl, setIsRtl] = React13__namespace.useState(false);
|
|
1359
|
+
React13__namespace.useEffect(() => {
|
|
1344
1360
|
if (containerRef.current) {
|
|
1345
1361
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1346
1362
|
setIsRtl(dir === "rtl");
|
|
@@ -1348,16 +1364,16 @@ var LinearProgress = React17__namespace.forwardRef(
|
|
|
1348
1364
|
}, []);
|
|
1349
1365
|
const isWavy = shape === "wavy";
|
|
1350
1366
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1351
|
-
const effectiveAmplitude =
|
|
1352
|
-
const svgHeight =
|
|
1367
|
+
const effectiveAmplitude = React13__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1368
|
+
const svgHeight = React13__namespace.useMemo(
|
|
1353
1369
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1354
1370
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1355
1371
|
);
|
|
1356
|
-
const shouldShowStop =
|
|
1372
|
+
const shouldShowStop = React13__namespace.useMemo(
|
|
1357
1373
|
() => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
|
|
1358
1374
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1359
1375
|
);
|
|
1360
|
-
const stopSize =
|
|
1376
|
+
const stopSize = React13__namespace.useMemo(
|
|
1361
1377
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1362
1378
|
[trackHeight]
|
|
1363
1379
|
);
|
|
@@ -1430,14 +1446,14 @@ var LinearProgress = React17__namespace.forwardRef(
|
|
|
1430
1446
|
}
|
|
1431
1447
|
);
|
|
1432
1448
|
LinearProgress.displayName = "LinearProgress";
|
|
1433
|
-
var ProgressIndicator =
|
|
1449
|
+
var ProgressIndicator = React13__namespace.forwardRef((props, ref) => {
|
|
1434
1450
|
if (props.variant === "circular") {
|
|
1435
1451
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1436
1452
|
}
|
|
1437
1453
|
return /* @__PURE__ */ jsxRuntime.jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
1438
1454
|
});
|
|
1439
1455
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
1440
|
-
var RippleItem =
|
|
1456
|
+
var RippleItem = React13__namespace.memo(function RippleItem2({
|
|
1441
1457
|
ripple,
|
|
1442
1458
|
onDone
|
|
1443
1459
|
}) {
|
|
@@ -1481,14 +1497,17 @@ function Ripple({
|
|
|
1481
1497
|
}
|
|
1482
1498
|
function useRippleState(options = {}) {
|
|
1483
1499
|
const { disabled = false } = options;
|
|
1484
|
-
const [ripples, setRipples] =
|
|
1485
|
-
const onPointerDown =
|
|
1500
|
+
const [ripples, setRipples] = React13__namespace.useState([]);
|
|
1501
|
+
const onPointerDown = React13__namespace.useCallback(
|
|
1486
1502
|
(e) => {
|
|
1487
1503
|
if (disabled) return;
|
|
1488
1504
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
1489
1505
|
const x = e.clientX - rect.left;
|
|
1490
1506
|
const y = e.clientY - rect.top;
|
|
1491
|
-
const rippleSize = Math.
|
|
1507
|
+
const rippleSize = Math.max(
|
|
1508
|
+
Math.hypot(rect.width, rect.height) * 2.5,
|
|
1509
|
+
320
|
|
1510
|
+
);
|
|
1492
1511
|
setRipples((prev) => [
|
|
1493
1512
|
...prev,
|
|
1494
1513
|
{ id: Date.now(), x, y, size: rippleSize }
|
|
@@ -1496,7 +1515,7 @@ function useRippleState(options = {}) {
|
|
|
1496
1515
|
},
|
|
1497
1516
|
[disabled]
|
|
1498
1517
|
);
|
|
1499
|
-
const removeRipple =
|
|
1518
|
+
const removeRipple = React13__namespace.useCallback((id) => {
|
|
1500
1519
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1501
1520
|
}, []);
|
|
1502
1521
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1519,12 +1538,39 @@ function TouchTarget() {
|
|
|
1519
1538
|
}
|
|
1520
1539
|
);
|
|
1521
1540
|
}
|
|
1522
|
-
var
|
|
1523
|
-
xs: "h-8
|
|
1524
|
-
sm: "h-10
|
|
1525
|
-
md: "h-14
|
|
1526
|
-
lg: "h-24
|
|
1527
|
-
xl: "h-[8.5rem]
|
|
1541
|
+
var SIZE_HEIGHT_STYLES = {
|
|
1542
|
+
xs: "h-8",
|
|
1543
|
+
sm: "h-10",
|
|
1544
|
+
md: "h-14",
|
|
1545
|
+
lg: "h-24",
|
|
1546
|
+
xl: "h-[8.5rem]"
|
|
1547
|
+
};
|
|
1548
|
+
var WIDTH_SIZE_STYLES = {
|
|
1549
|
+
xs: {
|
|
1550
|
+
default: "w-8",
|
|
1551
|
+
narrow: "w-8",
|
|
1552
|
+
wide: "w-12"
|
|
1553
|
+
},
|
|
1554
|
+
sm: {
|
|
1555
|
+
default: "w-10",
|
|
1556
|
+
narrow: "w-12",
|
|
1557
|
+
wide: "w-[3.25rem]"
|
|
1558
|
+
},
|
|
1559
|
+
md: {
|
|
1560
|
+
default: "w-14",
|
|
1561
|
+
narrow: "w-12",
|
|
1562
|
+
wide: "w-[4.5rem]"
|
|
1563
|
+
},
|
|
1564
|
+
lg: {
|
|
1565
|
+
default: "w-24",
|
|
1566
|
+
narrow: "w-16",
|
|
1567
|
+
wide: "w-32"
|
|
1568
|
+
},
|
|
1569
|
+
xl: {
|
|
1570
|
+
default: "w-[8.5rem]",
|
|
1571
|
+
narrow: "w-[6.5rem]",
|
|
1572
|
+
wide: "w-[11.5rem]"
|
|
1573
|
+
}
|
|
1528
1574
|
};
|
|
1529
1575
|
var SIZE_ICON = {
|
|
1530
1576
|
xs: { cls: "size-5", px: 20 },
|
|
@@ -1617,7 +1663,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1617
1663
|
}
|
|
1618
1664
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1619
1665
|
}
|
|
1620
|
-
var IconButtonComponent =
|
|
1666
|
+
var IconButtonComponent = React13__namespace.forwardRef(
|
|
1621
1667
|
(_a, ref) => {
|
|
1622
1668
|
var _b = _a, {
|
|
1623
1669
|
className,
|
|
@@ -1625,11 +1671,14 @@ var IconButtonComponent = React17__namespace.forwardRef(
|
|
|
1625
1671
|
variant = "default",
|
|
1626
1672
|
colorStyle = "standard",
|
|
1627
1673
|
size = "sm",
|
|
1674
|
+
widthVariant = "default",
|
|
1628
1675
|
shape = "round",
|
|
1629
1676
|
selected,
|
|
1677
|
+
selectedIcon,
|
|
1630
1678
|
loading = false,
|
|
1631
1679
|
loadingVariant = "loading-indicator",
|
|
1632
1680
|
iconSize,
|
|
1681
|
+
asChild = false,
|
|
1633
1682
|
children,
|
|
1634
1683
|
onClick,
|
|
1635
1684
|
onKeyDown,
|
|
@@ -1640,31 +1689,34 @@ var IconButtonComponent = React17__namespace.forwardRef(
|
|
|
1640
1689
|
"variant",
|
|
1641
1690
|
"colorStyle",
|
|
1642
1691
|
"size",
|
|
1692
|
+
"widthVariant",
|
|
1643
1693
|
"shape",
|
|
1644
1694
|
"selected",
|
|
1695
|
+
"selectedIcon",
|
|
1645
1696
|
"loading",
|
|
1646
1697
|
"loadingVariant",
|
|
1647
1698
|
"iconSize",
|
|
1699
|
+
"asChild",
|
|
1648
1700
|
"children",
|
|
1649
1701
|
"onClick",
|
|
1650
1702
|
"onKeyDown",
|
|
1651
1703
|
"aria-label"
|
|
1652
1704
|
]);
|
|
1653
|
-
var _a2, _b2;
|
|
1705
|
+
var _a2, _b2, _c, _d, _e;
|
|
1654
1706
|
const isToggle = variant === "toggle";
|
|
1655
1707
|
const isSelected = isToggle && !!selected;
|
|
1656
|
-
const resolvedColorClass =
|
|
1708
|
+
const resolvedColorClass = React13__namespace.useMemo(
|
|
1657
1709
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1658
1710
|
[isSelected, colorStyle]
|
|
1659
1711
|
);
|
|
1660
|
-
const outlineWidthClass =
|
|
1712
|
+
const outlineWidthClass = React13__namespace.useMemo(
|
|
1661
1713
|
() => {
|
|
1662
1714
|
var _a3;
|
|
1663
1715
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1664
1716
|
},
|
|
1665
1717
|
[colorStyle, isSelected, size]
|
|
1666
1718
|
);
|
|
1667
|
-
const disabledBgClass =
|
|
1719
|
+
const disabledBgClass = React13__namespace.useMemo(
|
|
1668
1720
|
() => resolveDisabledBgClass(colorStyle),
|
|
1669
1721
|
[colorStyle]
|
|
1670
1722
|
);
|
|
@@ -1681,11 +1733,13 @@ var IconButtonComponent = React17__namespace.forwardRef(
|
|
|
1681
1733
|
const defaultIconPx = sizeIcon.px;
|
|
1682
1734
|
const iconPx = iconSize != null ? iconSize : defaultIconPx;
|
|
1683
1735
|
const isCustomSize = iconSize != null && iconSize !== "inherit";
|
|
1736
|
+
const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
|
|
1737
|
+
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[widthVariant]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
|
|
1684
1738
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1685
1739
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1686
1740
|
disabled: loading
|
|
1687
1741
|
});
|
|
1688
|
-
const handleClick =
|
|
1742
|
+
const handleClick = React13__namespace.useCallback(
|
|
1689
1743
|
(e) => {
|
|
1690
1744
|
if (loading) {
|
|
1691
1745
|
e.preventDefault();
|
|
@@ -1695,7 +1749,7 @@ var IconButtonComponent = React17__namespace.forwardRef(
|
|
|
1695
1749
|
},
|
|
1696
1750
|
[loading, onClick]
|
|
1697
1751
|
);
|
|
1698
|
-
const handleKeyDown =
|
|
1752
|
+
const handleKeyDown = React13__namespace.useCallback(
|
|
1699
1753
|
(e) => {
|
|
1700
1754
|
if (loading) return;
|
|
1701
1755
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1706,7 +1760,90 @@ var IconButtonComponent = React17__namespace.forwardRef(
|
|
|
1706
1760
|
},
|
|
1707
1761
|
[loading, onClick, onKeyDown]
|
|
1708
1762
|
);
|
|
1709
|
-
|
|
1763
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1764
|
+
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
1765
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
1766
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1767
|
+
react.m.span,
|
|
1768
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1769
|
+
transition: SPRING_TRANSITION,
|
|
1770
|
+
className: cn(
|
|
1771
|
+
"flex items-center justify-center shrink-0",
|
|
1772
|
+
iconSize != null ? void 0 : iconClass
|
|
1773
|
+
),
|
|
1774
|
+
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
1775
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1776
|
+
LoadingIndicator,
|
|
1777
|
+
{
|
|
1778
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1779
|
+
color: "currentColor",
|
|
1780
|
+
"aria-label": "Loading"
|
|
1781
|
+
}
|
|
1782
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1783
|
+
ProgressIndicator,
|
|
1784
|
+
{
|
|
1785
|
+
variant: "circular",
|
|
1786
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1787
|
+
color: "currentColor",
|
|
1788
|
+
trackColor: "transparent",
|
|
1789
|
+
"aria-label": "Loading"
|
|
1790
|
+
}
|
|
1791
|
+
)
|
|
1792
|
+
}),
|
|
1793
|
+
"loading"
|
|
1794
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1795
|
+
react.m.span,
|
|
1796
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1797
|
+
transition: SPRING_TRANSITION,
|
|
1798
|
+
"aria-hidden": "true",
|
|
1799
|
+
className: cn(
|
|
1800
|
+
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]",
|
|
1801
|
+
iconSize != null ? void 0 : iconClass
|
|
1802
|
+
),
|
|
1803
|
+
style: {
|
|
1804
|
+
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
1805
|
+
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1806
|
+
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1807
|
+
},
|
|
1808
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React13__namespace.Children.only(children).props.children : children
|
|
1809
|
+
}),
|
|
1810
|
+
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1811
|
+
) })
|
|
1812
|
+
] });
|
|
1813
|
+
const containerClassName = cn(
|
|
1814
|
+
baseIconButtonClasses,
|
|
1815
|
+
resolvedColorClass,
|
|
1816
|
+
outlineWidthClass,
|
|
1817
|
+
disabledBgClass,
|
|
1818
|
+
"overflow-hidden",
|
|
1819
|
+
heightClass,
|
|
1820
|
+
widthClass,
|
|
1821
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
1822
|
+
className
|
|
1823
|
+
);
|
|
1824
|
+
if (asChild) {
|
|
1825
|
+
const child = React13__namespace.Children.only(children);
|
|
1826
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1827
|
+
reactSlot.Slot,
|
|
1828
|
+
__spreadProps(__spreadValues({
|
|
1829
|
+
ref,
|
|
1830
|
+
"aria-pressed": isToggle ? isSelected : void 0,
|
|
1831
|
+
"aria-label": ariaLabel,
|
|
1832
|
+
"aria-busy": loading || void 0,
|
|
1833
|
+
"aria-disabled": loading || restProps.disabled,
|
|
1834
|
+
onClick: handleClick,
|
|
1835
|
+
onPointerDown,
|
|
1836
|
+
onKeyDown: handleKeyDown,
|
|
1837
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
1838
|
+
borderRadius: `${animateRadius}px`
|
|
1839
|
+
}),
|
|
1840
|
+
className: containerClassName
|
|
1841
|
+
}, restProps), {
|
|
1842
|
+
children: React13__namespace.cloneElement(child, { children: innerContent })
|
|
1843
|
+
})
|
|
1844
|
+
) });
|
|
1845
|
+
}
|
|
1846
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1710
1847
|
react.m.button,
|
|
1711
1848
|
__spreadProps(__spreadValues({
|
|
1712
1849
|
ref,
|
|
@@ -1722,79 +1859,21 @@ var IconButtonComponent = React17__namespace.forwardRef(
|
|
|
1722
1859
|
animate: { borderRadius: animateRadius },
|
|
1723
1860
|
whileTap: { borderRadius: pressedRadius },
|
|
1724
1861
|
transition: { borderRadius: SPRING_TRANSITION_FAST },
|
|
1725
|
-
className:
|
|
1726
|
-
baseIconButtonClasses,
|
|
1727
|
-
resolvedColorClass,
|
|
1728
|
-
outlineWidthClass,
|
|
1729
|
-
disabledBgClass,
|
|
1730
|
-
"overflow-hidden",
|
|
1731
|
-
SIZE_STYLES[size],
|
|
1732
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
1733
|
-
className
|
|
1734
|
-
)
|
|
1862
|
+
className: containerClassName
|
|
1735
1863
|
}, restProps), {
|
|
1736
|
-
children:
|
|
1737
|
-
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
1738
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
1739
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1740
|
-
react.m.span,
|
|
1741
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1742
|
-
transition: SPRING_TRANSITION,
|
|
1743
|
-
className: cn(
|
|
1744
|
-
"flex items-center justify-center shrink-0",
|
|
1745
|
-
iconSize != null ? void 0 : iconClass
|
|
1746
|
-
),
|
|
1747
|
-
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
1748
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1749
|
-
LoadingIndicator,
|
|
1750
|
-
{
|
|
1751
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1752
|
-
color: "currentColor",
|
|
1753
|
-
"aria-label": "Loading"
|
|
1754
|
-
}
|
|
1755
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1756
|
-
ProgressIndicator,
|
|
1757
|
-
{
|
|
1758
|
-
variant: "circular",
|
|
1759
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1760
|
-
color: "currentColor",
|
|
1761
|
-
trackColor: "transparent",
|
|
1762
|
-
"aria-label": "Loading"
|
|
1763
|
-
}
|
|
1764
|
-
)
|
|
1765
|
-
}),
|
|
1766
|
-
"loading"
|
|
1767
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1768
|
-
react.m.span,
|
|
1769
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1770
|
-
transition: SPRING_TRANSITION,
|
|
1771
|
-
"aria-hidden": "true",
|
|
1772
|
-
className: cn(
|
|
1773
|
-
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
1774
|
-
iconSize != null ? void 0 : iconClass
|
|
1775
|
-
),
|
|
1776
|
-
style: {
|
|
1777
|
-
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
1778
|
-
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1779
|
-
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1780
|
-
},
|
|
1781
|
-
children
|
|
1782
|
-
}),
|
|
1783
|
-
"content"
|
|
1784
|
-
) })
|
|
1785
|
-
]
|
|
1864
|
+
children: innerContent
|
|
1786
1865
|
})
|
|
1787
1866
|
) });
|
|
1788
1867
|
}
|
|
1789
1868
|
);
|
|
1790
1869
|
IconButtonComponent.displayName = "IconButton";
|
|
1791
|
-
var IconButton =
|
|
1870
|
+
var IconButton = React13__namespace.memo(IconButtonComponent);
|
|
1792
1871
|
var VARIANT_FONT = {
|
|
1793
1872
|
outlined: "'Material Symbols Outlined'",
|
|
1794
1873
|
rounded: "'Material Symbols Rounded'",
|
|
1795
1874
|
sharp: "'Material Symbols Sharp'"
|
|
1796
1875
|
};
|
|
1797
|
-
var IconComponent =
|
|
1876
|
+
var IconComponent = React13__namespace.forwardRef(
|
|
1798
1877
|
(_a, ref) => {
|
|
1799
1878
|
var _b = _a, {
|
|
1800
1879
|
name,
|
|
@@ -1860,7 +1939,7 @@ var IconComponent = React17__namespace.forwardRef(
|
|
|
1860
1939
|
}
|
|
1861
1940
|
);
|
|
1862
1941
|
IconComponent.displayName = "Icon";
|
|
1863
|
-
var Icon =
|
|
1942
|
+
var Icon = React13__namespace.memo(IconComponent);
|
|
1864
1943
|
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";
|
|
1865
1944
|
var CalendarHeader = ({
|
|
1866
1945
|
displayedMonthMs,
|
|
@@ -1888,16 +1967,16 @@ var CalendarHeader = ({
|
|
|
1888
1967
|
}).format(date);
|
|
1889
1968
|
const yearLabel = String(date.getUTCFullYear());
|
|
1890
1969
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 px-6 pb-4 pt-5", children: [
|
|
1891
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-
|
|
1892
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2 leading-tight text-
|
|
1893
|
-
displayMode === "picker" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
1970
|
+
/* @__PURE__ */ jsxRuntime.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 }),
|
|
1971
|
+
/* @__PURE__ */ jsxRuntime.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 }),
|
|
1972
|
+
displayMode === "picker" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-10 items-center gap-0.5", children: [
|
|
1894
1973
|
activeSelector === null && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1895
1974
|
IconButton,
|
|
1896
1975
|
{
|
|
1897
1976
|
onClick: onPrev,
|
|
1898
1977
|
"aria-label": "Previous month",
|
|
1899
1978
|
disabled: !canNavigatePrev,
|
|
1900
|
-
size: "
|
|
1979
|
+
size: "xs",
|
|
1901
1980
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "chevron_left" })
|
|
1902
1981
|
}
|
|
1903
1982
|
),
|
|
@@ -1919,7 +1998,7 @@ var CalendarHeader = ({
|
|
|
1919
1998
|
{
|
|
1920
1999
|
name: "arrow_drop_down",
|
|
1921
2000
|
className: cn(
|
|
1922
|
-
"text-[20px]",
|
|
2001
|
+
"text-[20px] transition-transform duration-200",
|
|
1923
2002
|
activeSelector === "month" && "rotate-180"
|
|
1924
2003
|
)
|
|
1925
2004
|
}
|
|
@@ -1933,7 +2012,7 @@ var CalendarHeader = ({
|
|
|
1933
2012
|
onClick: onNext,
|
|
1934
2013
|
"aria-label": "Next month",
|
|
1935
2014
|
disabled: !canNavigateNext,
|
|
1936
|
-
size: "
|
|
2015
|
+
size: "xs",
|
|
1937
2016
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "chevron_right" })
|
|
1938
2017
|
}
|
|
1939
2018
|
),
|
|
@@ -1944,7 +2023,7 @@ var CalendarHeader = ({
|
|
|
1944
2023
|
onClick: onPreviousYear,
|
|
1945
2024
|
"aria-label": "Previous year",
|
|
1946
2025
|
disabled: !canNavigatePreviousYear,
|
|
1947
|
-
size: "
|
|
2026
|
+
size: "xs",
|
|
1948
2027
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "chevron_left" })
|
|
1949
2028
|
}
|
|
1950
2029
|
),
|
|
@@ -1966,7 +2045,7 @@ var CalendarHeader = ({
|
|
|
1966
2045
|
{
|
|
1967
2046
|
name: "arrow_drop_down",
|
|
1968
2047
|
className: cn(
|
|
1969
|
-
"text-[20px]",
|
|
2048
|
+
"text-[20px] transition-transform duration-200",
|
|
1970
2049
|
activeSelector === "year" && "rotate-180"
|
|
1971
2050
|
)
|
|
1972
2051
|
}
|
|
@@ -1980,7 +2059,7 @@ var CalendarHeader = ({
|
|
|
1980
2059
|
onClick: onNextYear,
|
|
1981
2060
|
"aria-label": "Next year",
|
|
1982
2061
|
disabled: !canNavigateNextYear,
|
|
1983
|
-
size: "
|
|
2062
|
+
size: "xs",
|
|
1984
2063
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "chevron_right" })
|
|
1985
2064
|
}
|
|
1986
2065
|
),
|
|
@@ -1989,7 +2068,7 @@ var CalendarHeader = ({
|
|
|
1989
2068
|
{
|
|
1990
2069
|
onClick: onToggleMode,
|
|
1991
2070
|
"aria-label": "Switch to text input",
|
|
1992
|
-
size: "
|
|
2071
|
+
size: "xs",
|
|
1993
2072
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "keyboard" })
|
|
1994
2073
|
}
|
|
1995
2074
|
)
|
|
@@ -2000,7 +2079,7 @@ var CalendarHeader = ({
|
|
|
2000
2079
|
{
|
|
2001
2080
|
onClick: onToggleMode,
|
|
2002
2081
|
"aria-label": "Switch to calendar",
|
|
2003
|
-
size: "
|
|
2082
|
+
size: "xs",
|
|
2004
2083
|
className: "self-end",
|
|
2005
2084
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "calendar_month" })
|
|
2006
2085
|
}
|
|
@@ -2018,15 +2097,15 @@ var MonthPickerList = ({
|
|
|
2018
2097
|
locale,
|
|
2019
2098
|
onMonthSelect
|
|
2020
2099
|
}) => {
|
|
2021
|
-
const selectedRef =
|
|
2022
|
-
|
|
2100
|
+
const selectedRef = React13__namespace.useRef(null);
|
|
2101
|
+
React13__namespace.useEffect(() => {
|
|
2023
2102
|
var _a, _b;
|
|
2024
2103
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2025
2104
|
block: "center",
|
|
2026
2105
|
behavior: "instant"
|
|
2027
2106
|
});
|
|
2028
2107
|
}, []);
|
|
2029
|
-
const months =
|
|
2108
|
+
const months = React13__namespace.useMemo(
|
|
2030
2109
|
() => Array.from({ length: 12 }, (_, month) => month),
|
|
2031
2110
|
[]
|
|
2032
2111
|
);
|
|
@@ -2071,12 +2150,12 @@ var YearPickerList = ({
|
|
|
2071
2150
|
selectableDates,
|
|
2072
2151
|
onYearSelect
|
|
2073
2152
|
}) => {
|
|
2074
|
-
const selectedRef =
|
|
2075
|
-
const years =
|
|
2153
|
+
const selectedRef = React13__namespace.useRef(null);
|
|
2154
|
+
const years = React13__namespace.useMemo(() => {
|
|
2076
2155
|
const [min, max] = yearRange;
|
|
2077
2156
|
return Array.from({ length: max - min + 1 }, (_, index) => min + index);
|
|
2078
2157
|
}, [yearRange]);
|
|
2079
|
-
|
|
2158
|
+
React13__namespace.useEffect(() => {
|
|
2080
2159
|
var _a, _b;
|
|
2081
2160
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2082
2161
|
block: "center",
|
|
@@ -2147,17 +2226,17 @@ var DatePicker = ({
|
|
|
2147
2226
|
navigateToMonth,
|
|
2148
2227
|
setDisplayMode
|
|
2149
2228
|
} = state;
|
|
2150
|
-
const [activeSelector, setActiveSelector] =
|
|
2151
|
-
const [slideDirection, setSlideDirection] =
|
|
2152
|
-
const handlePrev =
|
|
2229
|
+
const [activeSelector, setActiveSelector] = React13__namespace.useState(null);
|
|
2230
|
+
const [slideDirection, setSlideDirection] = React13__namespace.useState(null);
|
|
2231
|
+
const handlePrev = React13__namespace.useCallback(() => {
|
|
2153
2232
|
setSlideDirection("prev");
|
|
2154
2233
|
navigateMonth2("prev");
|
|
2155
2234
|
}, [navigateMonth2]);
|
|
2156
|
-
const handleNext =
|
|
2235
|
+
const handleNext = React13__namespace.useCallback(() => {
|
|
2157
2236
|
setSlideDirection("next");
|
|
2158
2237
|
navigateMonth2("next");
|
|
2159
2238
|
}, [navigateMonth2]);
|
|
2160
|
-
const handleYearSelect =
|
|
2239
|
+
const handleYearSelect = React13__namespace.useCallback(
|
|
2161
2240
|
(year) => {
|
|
2162
2241
|
const d = new Date(displayedMonthMs);
|
|
2163
2242
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2165,7 +2244,7 @@ var DatePicker = ({
|
|
|
2165
2244
|
},
|
|
2166
2245
|
[displayedMonthMs, navigateToMonth]
|
|
2167
2246
|
);
|
|
2168
|
-
const handleMonthSelect =
|
|
2247
|
+
const handleMonthSelect = React13__namespace.useCallback(
|
|
2169
2248
|
(month) => {
|
|
2170
2249
|
const d = new Date(displayedMonthMs);
|
|
2171
2250
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2173,11 +2252,11 @@ var DatePicker = ({
|
|
|
2173
2252
|
},
|
|
2174
2253
|
[displayedMonthMs, navigateToMonth]
|
|
2175
2254
|
);
|
|
2176
|
-
const [inputValue, setInputValue] =
|
|
2255
|
+
const [inputValue, setInputValue] = React13__namespace.useState(
|
|
2177
2256
|
() => selectedDateMs !== null ? formatInputDate(selectedDateMs) : ""
|
|
2178
2257
|
);
|
|
2179
|
-
const [inputError, setInputError] =
|
|
2180
|
-
const handleInputCommit =
|
|
2258
|
+
const [inputError, setInputError] = React13__namespace.useState();
|
|
2259
|
+
const handleInputCommit = React13__namespace.useCallback(
|
|
2181
2260
|
(ms) => {
|
|
2182
2261
|
if (ms === null && inputValue.length > 0) {
|
|
2183
2262
|
setInputError("Invalid date");
|
|
@@ -2263,9 +2342,12 @@ var DatePicker = ({
|
|
|
2263
2342
|
"input-mode"
|
|
2264
2343
|
)
|
|
2265
2344
|
) : activeSelector === "month" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2266
|
-
|
|
2345
|
+
react.m.div,
|
|
2267
2346
|
{
|
|
2268
2347
|
id: "date-picker-selection",
|
|
2348
|
+
initial: PICKER_SELECTOR_ANIM.initial,
|
|
2349
|
+
animate: PICKER_SELECTOR_ANIM.animate,
|
|
2350
|
+
exit: PICKER_SELECTOR_ANIM.exit,
|
|
2269
2351
|
className: "absolute inset-0",
|
|
2270
2352
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2271
2353
|
MonthPickerList,
|
|
@@ -2278,9 +2360,12 @@ var DatePicker = ({
|
|
|
2278
2360
|
},
|
|
2279
2361
|
"month-list"
|
|
2280
2362
|
) : activeSelector === "year" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2281
|
-
|
|
2363
|
+
react.m.div,
|
|
2282
2364
|
{
|
|
2283
2365
|
id: "date-picker-selection",
|
|
2366
|
+
initial: PICKER_SELECTOR_ANIM.initial,
|
|
2367
|
+
animate: PICKER_SELECTOR_ANIM.animate,
|
|
2368
|
+
exit: PICKER_SELECTOR_ANIM.exit,
|
|
2284
2369
|
className: "absolute inset-0",
|
|
2285
2370
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2286
2371
|
YearPickerList,
|
|
@@ -2411,7 +2496,7 @@ var DP_CLASSES = {
|
|
|
2411
2496
|
/** Weekday header row */
|
|
2412
2497
|
weekdayRow: "text-[length:var(--md-typescale-body-large-size,14px)] text-m3-on-surface"
|
|
2413
2498
|
};
|
|
2414
|
-
var ScrollArea =
|
|
2499
|
+
var ScrollArea = React13__namespace.forwardRef(
|
|
2415
2500
|
(_a, ref) => {
|
|
2416
2501
|
var _b = _a, {
|
|
2417
2502
|
className,
|
|
@@ -2432,15 +2517,15 @@ var ScrollArea = React17__namespace.forwardRef(
|
|
|
2432
2517
|
"viewportRef",
|
|
2433
2518
|
"viewportProps"
|
|
2434
2519
|
]);
|
|
2435
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
2436
|
-
|
|
2520
|
+
const [isTouchDevice, setIsTouchDevice] = React13__namespace.useState(false);
|
|
2521
|
+
React13__namespace.useEffect(() => {
|
|
2437
2522
|
if (typeof window !== "undefined") {
|
|
2438
2523
|
setIsTouchDevice(
|
|
2439
2524
|
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
2440
2525
|
);
|
|
2441
2526
|
}
|
|
2442
2527
|
}, []);
|
|
2443
|
-
const resolvedType =
|
|
2528
|
+
const resolvedType = React13__namespace.useMemo(() => {
|
|
2444
2529
|
if (type === "hover" && isTouchDevice) {
|
|
2445
2530
|
return "scroll";
|
|
2446
2531
|
}
|
|
@@ -2491,7 +2576,7 @@ var ScrollArea = React17__namespace.forwardRef(
|
|
|
2491
2576
|
}
|
|
2492
2577
|
);
|
|
2493
2578
|
ScrollArea.displayName = "ScrollArea";
|
|
2494
|
-
var ScrollAreaScrollbar =
|
|
2579
|
+
var ScrollAreaScrollbar = React13__namespace.forwardRef((_a, ref) => {
|
|
2495
2580
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
2496
2581
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2497
2582
|
RadixScrollArea__namespace.Scrollbar,
|
|
@@ -2521,7 +2606,7 @@ var ScrollAreaScrollbar = React17__namespace.forwardRef((_a, ref) => {
|
|
|
2521
2606
|
);
|
|
2522
2607
|
});
|
|
2523
2608
|
ScrollAreaScrollbar.displayName = RadixScrollArea__namespace.Scrollbar.displayName;
|
|
2524
|
-
var ScrollAreaCorner =
|
|
2609
|
+
var ScrollAreaCorner = React13__namespace.forwardRef((_a, ref) => {
|
|
2525
2610
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2526
2611
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2527
2612
|
RadixScrollArea__namespace.Corner,
|
|
@@ -2563,9 +2648,9 @@ DialogTrigger.displayName = "DialogTrigger";
|
|
|
2563
2648
|
var DialogPortal = ({
|
|
2564
2649
|
open,
|
|
2565
2650
|
children
|
|
2566
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { forceMount: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: open ?
|
|
2651
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { forceMount: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: open ? React13__namespace.Children.toArray(children) : null }) });
|
|
2567
2652
|
DialogPortal.displayName = "DialogPortal";
|
|
2568
|
-
var DialogOverlay =
|
|
2653
|
+
var DialogOverlay = React13__namespace.forwardRef((_a, ref) => {
|
|
2569
2654
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2570
2655
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2571
2656
|
react.m.div,
|
|
@@ -2576,7 +2661,7 @@ var DialogOverlay = React17__namespace.forwardRef((_a, ref) => {
|
|
|
2576
2661
|
) }));
|
|
2577
2662
|
});
|
|
2578
2663
|
DialogOverlay.displayName = "DialogOverlay";
|
|
2579
|
-
var DialogContent =
|
|
2664
|
+
var DialogContent = React13__namespace.forwardRef((_a, ref) => {
|
|
2580
2665
|
var _b = _a, { className, children, hideCloseButton = false } = _b, props = __objRest(_b, ["className", "children", "hideCloseButton"]);
|
|
2581
2666
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2582
2667
|
RadixDialog__namespace.Content,
|
|
@@ -2616,7 +2701,7 @@ var DialogContent = React17__namespace.forwardRef((_a, ref) => {
|
|
|
2616
2701
|
);
|
|
2617
2702
|
});
|
|
2618
2703
|
DialogContent.displayName = "DialogContent";
|
|
2619
|
-
var DialogIcon =
|
|
2704
|
+
var DialogIcon = React13__namespace.forwardRef((_a, ref) => {
|
|
2620
2705
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
2621
2706
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2622
2707
|
"div",
|
|
@@ -2630,7 +2715,7 @@ var DialogIcon = React17__namespace.forwardRef((_a, ref) => {
|
|
|
2630
2715
|
);
|
|
2631
2716
|
});
|
|
2632
2717
|
DialogIcon.displayName = "DialogIcon";
|
|
2633
|
-
var DialogTitle =
|
|
2718
|
+
var DialogTitle = React13__namespace.forwardRef((_a, ref) => {
|
|
2634
2719
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2635
2720
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2636
2721
|
RadixDialog__namespace.Title,
|
|
@@ -2645,7 +2730,7 @@ var DialogTitle = React17__namespace.forwardRef((_a, ref) => {
|
|
|
2645
2730
|
);
|
|
2646
2731
|
});
|
|
2647
2732
|
DialogTitle.displayName = "DialogTitle";
|
|
2648
|
-
var DialogDescription =
|
|
2733
|
+
var DialogDescription = React13__namespace.forwardRef((_a, ref) => {
|
|
2649
2734
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2650
2735
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2651
2736
|
RadixDialog__namespace.Description,
|
|
@@ -2657,7 +2742,7 @@ var DialogDescription = React17__namespace.forwardRef((_a, ref) => {
|
|
|
2657
2742
|
);
|
|
2658
2743
|
});
|
|
2659
2744
|
DialogDescription.displayName = "DialogDescription";
|
|
2660
|
-
var DialogBody =
|
|
2745
|
+
var DialogBody = React13__namespace.forwardRef((_a, ref) => {
|
|
2661
2746
|
var _b = _a, { className, children, dir } = _b, props = __objRest(_b, ["className", "children", "dir"]);
|
|
2662
2747
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2663
2748
|
ScrollArea,
|
|
@@ -2673,7 +2758,7 @@ var DialogBody = React17__namespace.forwardRef((_a, ref) => {
|
|
|
2673
2758
|
);
|
|
2674
2759
|
});
|
|
2675
2760
|
DialogBody.displayName = "DialogBody";
|
|
2676
|
-
var DialogFullScreenContent =
|
|
2761
|
+
var DialogFullScreenContent = React13__namespace.forwardRef(
|
|
2677
2762
|
(_a, ref) => {
|
|
2678
2763
|
var _b = _a, {
|
|
2679
2764
|
className,
|
|
@@ -2821,17 +2906,17 @@ var DateRangePicker = ({
|
|
|
2821
2906
|
navigateToMonth,
|
|
2822
2907
|
setDisplayMode
|
|
2823
2908
|
} = state;
|
|
2824
|
-
const [activeSelector, setActiveSelector] =
|
|
2825
|
-
const [slideDirection, setSlideDirection] =
|
|
2826
|
-
const handlePrev =
|
|
2909
|
+
const [activeSelector, setActiveSelector] = React13__namespace.useState(null);
|
|
2910
|
+
const [slideDirection, setSlideDirection] = React13__namespace.useState(null);
|
|
2911
|
+
const handlePrev = React13__namespace.useCallback(() => {
|
|
2827
2912
|
setSlideDirection("prev");
|
|
2828
2913
|
navigateMonth2("prev");
|
|
2829
2914
|
}, [navigateMonth2]);
|
|
2830
|
-
const handleNext =
|
|
2915
|
+
const handleNext = React13__namespace.useCallback(() => {
|
|
2831
2916
|
setSlideDirection("next");
|
|
2832
2917
|
navigateMonth2("next");
|
|
2833
2918
|
}, [navigateMonth2]);
|
|
2834
|
-
const handleYearSelect =
|
|
2919
|
+
const handleYearSelect = React13__namespace.useCallback(
|
|
2835
2920
|
(year) => {
|
|
2836
2921
|
const d = new Date(displayedMonthMs);
|
|
2837
2922
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2839,7 +2924,7 @@ var DateRangePicker = ({
|
|
|
2839
2924
|
},
|
|
2840
2925
|
[displayedMonthMs, navigateToMonth]
|
|
2841
2926
|
);
|
|
2842
|
-
const handleMonthSelect =
|
|
2927
|
+
const handleMonthSelect = React13__namespace.useCallback(
|
|
2843
2928
|
(month) => {
|
|
2844
2929
|
const d = new Date(displayedMonthMs);
|
|
2845
2930
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2847,7 +2932,7 @@ var DateRangePicker = ({
|
|
|
2847
2932
|
},
|
|
2848
2933
|
[displayedMonthMs, navigateToMonth]
|
|
2849
2934
|
);
|
|
2850
|
-
const formatShort =
|
|
2935
|
+
const formatShort = React13__namespace.useCallback(
|
|
2851
2936
|
(ms) => {
|
|
2852
2937
|
if (ms === null) return "\u2014";
|
|
2853
2938
|
return formatDate(ms, locale, {
|
|
@@ -2913,9 +2998,12 @@ var DateRangePicker = ({
|
|
|
2913
2998
|
className: "relative flex-1 overflow-hidden",
|
|
2914
2999
|
style: { minHeight: "296px" },
|
|
2915
3000
|
children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", children: activeSelector === "month" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2916
|
-
|
|
3001
|
+
react.m.div,
|
|
2917
3002
|
{
|
|
2918
3003
|
id: "date-picker-selection",
|
|
3004
|
+
initial: PICKER_SELECTOR_ANIM.initial,
|
|
3005
|
+
animate: PICKER_SELECTOR_ANIM.animate,
|
|
3006
|
+
exit: PICKER_SELECTOR_ANIM.exit,
|
|
2919
3007
|
className: "absolute inset-0",
|
|
2920
3008
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2921
3009
|
MonthPickerList,
|
|
@@ -2928,9 +3016,12 @@ var DateRangePicker = ({
|
|
|
2928
3016
|
},
|
|
2929
3017
|
"month-list"
|
|
2930
3018
|
) : activeSelector === "year" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2931
|
-
|
|
3019
|
+
react.m.div,
|
|
2932
3020
|
{
|
|
2933
3021
|
id: "date-picker-selection",
|
|
3022
|
+
initial: PICKER_SELECTOR_ANIM.initial,
|
|
3023
|
+
animate: PICKER_SELECTOR_ANIM.animate,
|
|
3024
|
+
exit: PICKER_SELECTOR_ANIM.exit,
|
|
2934
3025
|
className: "absolute inset-0",
|
|
2935
3026
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2936
3027
|
YearPickerList,
|
|
@@ -2985,12 +3076,12 @@ var useDatePickerState = (options) => {
|
|
|
2985
3076
|
const selectableDates = (_d = options == null ? void 0 : options.selectableDates) != null ? _d : ALL_DATES_SELECTABLE;
|
|
2986
3077
|
const initialDisplayMode = (_e = options == null ? void 0 : options.initialDisplayMode) != null ? _e : DEFAULT_DISPLAY_MODE;
|
|
2987
3078
|
const locale = resolveLocale(options == null ? void 0 : options.locale);
|
|
2988
|
-
const [selectedDateMs, setSelectedDateMs] =
|
|
3079
|
+
const [selectedDateMs, setSelectedDateMs] = React13.useState(
|
|
2989
3080
|
initialSelectedMs !== null ? startOfDayUTC(initialSelectedMs) : null
|
|
2990
3081
|
);
|
|
2991
|
-
const [displayedMonthMs, setDisplayedMonthMs] =
|
|
2992
|
-
const [displayMode, setDisplayModeState] =
|
|
2993
|
-
const selectDate =
|
|
3082
|
+
const [displayedMonthMs, setDisplayedMonthMs] = React13.useState(initialMonthMs);
|
|
3083
|
+
const [displayMode, setDisplayModeState] = React13.useState(initialDisplayMode);
|
|
3084
|
+
const selectDate = React13.useCallback(
|
|
2994
3085
|
(ms) => {
|
|
2995
3086
|
if (ms === null) {
|
|
2996
3087
|
setSelectedDateMs(null);
|
|
@@ -3003,7 +3094,7 @@ var useDatePickerState = (options) => {
|
|
|
3003
3094
|
},
|
|
3004
3095
|
[selectableDates]
|
|
3005
3096
|
);
|
|
3006
|
-
const navigateMonthAction =
|
|
3097
|
+
const navigateMonthAction = React13.useCallback(
|
|
3007
3098
|
(direction) => {
|
|
3008
3099
|
setDisplayedMonthMs(
|
|
3009
3100
|
(prev) => {
|
|
@@ -3014,24 +3105,24 @@ var useDatePickerState = (options) => {
|
|
|
3014
3105
|
},
|
|
3015
3106
|
[yearRange, selectableDates]
|
|
3016
3107
|
);
|
|
3017
|
-
const navigateToMonth =
|
|
3108
|
+
const navigateToMonth = React13.useCallback(
|
|
3018
3109
|
(year, month) => {
|
|
3019
3110
|
if (!isMonthNavigable(year, yearRange, selectableDates)) return;
|
|
3020
3111
|
setDisplayedMonthMs(Date.UTC(year, month, 1));
|
|
3021
3112
|
},
|
|
3022
3113
|
[yearRange, selectableDates]
|
|
3023
3114
|
);
|
|
3024
|
-
const setDisplayMode =
|
|
3115
|
+
const setDisplayMode = React13.useCallback((mode) => {
|
|
3025
3116
|
setDisplayModeState(mode);
|
|
3026
3117
|
}, []);
|
|
3027
|
-
const reset =
|
|
3118
|
+
const reset = React13.useCallback(() => {
|
|
3028
3119
|
setSelectedDateMs(
|
|
3029
3120
|
initialSelectedMs !== null ? startOfDayUTC(initialSelectedMs) : null
|
|
3030
3121
|
);
|
|
3031
3122
|
setDisplayedMonthMs(initialMonthMs);
|
|
3032
3123
|
setDisplayModeState(initialDisplayMode);
|
|
3033
3124
|
}, [initialSelectedMs, initialMonthMs, initialDisplayMode]);
|
|
3034
|
-
return
|
|
3125
|
+
return React13.useMemo(
|
|
3035
3126
|
() => ({
|
|
3036
3127
|
selectedDateMs,
|
|
3037
3128
|
displayedMonthMs,
|
|
@@ -3090,13 +3181,13 @@ var useDateRangePickerState = (options) => {
|
|
|
3090
3181
|
const selectableDates = (_c = options == null ? void 0 : options.selectableDates) != null ? _c : ALL_DATES_SELECTABLE;
|
|
3091
3182
|
const initialDisplayMode = (_d = options == null ? void 0 : options.initialDisplayMode) != null ? _d : "picker";
|
|
3092
3183
|
const locale = resolveLocale(options == null ? void 0 : options.locale);
|
|
3093
|
-
const [{ startMs: selectedStartMs, endMs: selectedEndMs }, dispatch] =
|
|
3184
|
+
const [{ startMs: selectedStartMs, endMs: selectedEndMs }, dispatch] = React13.useReducer(rangeReducer, {
|
|
3094
3185
|
startMs: initialStartMs,
|
|
3095
3186
|
endMs: initialEndMs
|
|
3096
3187
|
});
|
|
3097
|
-
const [displayedMonthMs, setDisplayedMonthMs] =
|
|
3098
|
-
const [displayMode, setDisplayModeState] =
|
|
3099
|
-
const selectDate =
|
|
3188
|
+
const [displayedMonthMs, setDisplayedMonthMs] = React13.useState(initialMonthMs);
|
|
3189
|
+
const [displayMode, setDisplayModeState] = React13.useState(initialDisplayMode);
|
|
3190
|
+
const selectDate = React13.useCallback(
|
|
3100
3191
|
(ms) => {
|
|
3101
3192
|
const normalized = startOfDayUTC(ms);
|
|
3102
3193
|
if (!selectableDates.isSelectableDate(normalized)) return;
|
|
@@ -3104,10 +3195,10 @@ var useDateRangePickerState = (options) => {
|
|
|
3104
3195
|
},
|
|
3105
3196
|
[selectableDates]
|
|
3106
3197
|
);
|
|
3107
|
-
const clearRange =
|
|
3198
|
+
const clearRange = React13.useCallback(() => {
|
|
3108
3199
|
dispatch({ type: "CLEAR" });
|
|
3109
3200
|
}, []);
|
|
3110
|
-
const navigateMonthAction =
|
|
3201
|
+
const navigateMonthAction = React13.useCallback(
|
|
3111
3202
|
(direction) => {
|
|
3112
3203
|
setDisplayedMonthMs(
|
|
3113
3204
|
(prev) => {
|
|
@@ -3118,22 +3209,22 @@ var useDateRangePickerState = (options) => {
|
|
|
3118
3209
|
},
|
|
3119
3210
|
[yearRange, selectableDates]
|
|
3120
3211
|
);
|
|
3121
|
-
const navigateToMonth =
|
|
3212
|
+
const navigateToMonth = React13.useCallback(
|
|
3122
3213
|
(year, month) => {
|
|
3123
3214
|
if (!isMonthNavigable(year, yearRange, selectableDates)) return;
|
|
3124
3215
|
setDisplayedMonthMs(Date.UTC(year, month, 1));
|
|
3125
3216
|
},
|
|
3126
3217
|
[yearRange, selectableDates]
|
|
3127
3218
|
);
|
|
3128
|
-
const setDisplayMode =
|
|
3219
|
+
const setDisplayMode = React13.useCallback((mode) => {
|
|
3129
3220
|
setDisplayModeState(mode);
|
|
3130
3221
|
}, []);
|
|
3131
|
-
const reset =
|
|
3222
|
+
const reset = React13.useCallback(() => {
|
|
3132
3223
|
dispatch({ type: "RESET", startMs: initialStartMs, endMs: initialEndMs });
|
|
3133
3224
|
setDisplayedMonthMs(initialMonthMs);
|
|
3134
3225
|
setDisplayModeState(initialDisplayMode);
|
|
3135
3226
|
}, [initialStartMs, initialEndMs, initialMonthMs, initialDisplayMode]);
|
|
3136
|
-
return
|
|
3227
|
+
return React13.useMemo(
|
|
3137
3228
|
() => ({
|
|
3138
3229
|
selectedStartMs,
|
|
3139
3230
|
selectedEndMs,
|
|
@@ -3452,16 +3543,16 @@ var InputField = ({
|
|
|
3452
3543
|
onBlur,
|
|
3453
3544
|
className
|
|
3454
3545
|
}) => {
|
|
3455
|
-
const [inputText, setInputText] =
|
|
3546
|
+
const [inputText, setInputText] = React13__namespace.useState(
|
|
3456
3547
|
String(value).padStart(2, "0")
|
|
3457
3548
|
);
|
|
3458
|
-
const inputRef =
|
|
3459
|
-
|
|
3549
|
+
const inputRef = React13__namespace.useRef(null);
|
|
3550
|
+
React13__namespace.useEffect(() => {
|
|
3460
3551
|
if (!isFocused) {
|
|
3461
3552
|
setInputText(String(value).padStart(2, "0"));
|
|
3462
3553
|
}
|
|
3463
3554
|
}, [value, isFocused]);
|
|
3464
|
-
|
|
3555
|
+
React13__namespace.useEffect(() => {
|
|
3465
3556
|
var _a, _b;
|
|
3466
3557
|
if (isFocused) {
|
|
3467
3558
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -3551,7 +3642,7 @@ var InputField = ({
|
|
|
3551
3642
|
};
|
|
3552
3643
|
var TimeInput = ({ state, className }) => {
|
|
3553
3644
|
const { is24hour, setHourInput, setMinuteInput, setSelection } = state;
|
|
3554
|
-
const [focusedField, setFocusedField] =
|
|
3645
|
+
const [focusedField, setFocusedField] = React13__namespace.useState(null);
|
|
3555
3646
|
const handleHourAutoAdvance = () => {
|
|
3556
3647
|
setFocusedField("minute");
|
|
3557
3648
|
setSelection("minute");
|
|
@@ -3745,17 +3836,17 @@ var ClockDial = ({
|
|
|
3745
3836
|
setMinute,
|
|
3746
3837
|
setSelection
|
|
3747
3838
|
} = state;
|
|
3748
|
-
const displayAngle =
|
|
3839
|
+
const displayAngle = React13__namespace.useMemo(() => {
|
|
3749
3840
|
if (selection === "hour") {
|
|
3750
3841
|
return valueToAngle(hour, "hour");
|
|
3751
3842
|
}
|
|
3752
3843
|
return valueToAngle(minute, "minute");
|
|
3753
3844
|
}, [selection, hour, minute]);
|
|
3754
|
-
const selectorPos =
|
|
3845
|
+
const selectorPos = React13__namespace.useMemo(
|
|
3755
3846
|
() => getSelectorPosition(displayAngle, selection, is24hour, isPm),
|
|
3756
3847
|
[displayAngle, selection, is24hour, isPm]
|
|
3757
3848
|
);
|
|
3758
|
-
const trackEnd =
|
|
3849
|
+
const trackEnd = React13__namespace.useMemo(() => {
|
|
3759
3850
|
const dx = selectorPos.x - CENTER;
|
|
3760
3851
|
const dy = selectorPos.y - CENTER;
|
|
3761
3852
|
const length = Math.hypot(dx, dy);
|
|
@@ -3765,13 +3856,13 @@ var ClockDial = ({
|
|
|
3765
3856
|
y: selectorPos.y - dy / length * HANDLE_RADIUS
|
|
3766
3857
|
};
|
|
3767
3858
|
}, [selectorPos]);
|
|
3768
|
-
const numbers =
|
|
3859
|
+
const numbers = React13__namespace.useMemo(() => {
|
|
3769
3860
|
if (selection === "minute") return buildMinuteNumbers();
|
|
3770
3861
|
if (is24hour) return buildHour24Numbers();
|
|
3771
3862
|
return buildHour12Numbers();
|
|
3772
3863
|
}, [selection, is24hour]);
|
|
3773
|
-
const isDragging =
|
|
3774
|
-
const svgRef =
|
|
3864
|
+
const isDragging = React13__namespace.useRef(false);
|
|
3865
|
+
const svgRef = React13__namespace.useRef(null);
|
|
3775
3866
|
const getSVGPoint = (e) => {
|
|
3776
3867
|
const svg = svgRef.current;
|
|
3777
3868
|
if (!svg) return { x: e.clientX, y: e.clientY };
|
|
@@ -3921,8 +4012,8 @@ var getAutoLayout = () => {
|
|
|
3921
4012
|
return innerWidth >= 600 && innerHeight >= 300 && innerWidth >= innerHeight ? "horizontal" : "vertical";
|
|
3922
4013
|
};
|
|
3923
4014
|
var useResolvedLayout = (layout) => {
|
|
3924
|
-
const [autoLayout, setAutoLayout] =
|
|
3925
|
-
|
|
4015
|
+
const [autoLayout, setAutoLayout] = React13__namespace.useState("vertical");
|
|
4016
|
+
React13__namespace.useEffect(() => {
|
|
3926
4017
|
if (layout !== "auto") return;
|
|
3927
4018
|
const updateLayout = () => setAutoLayout(getAutoLayout());
|
|
3928
4019
|
updateLayout();
|
|
@@ -4099,7 +4190,7 @@ var TimePickerDialog = ({
|
|
|
4099
4190
|
TimePickerDialog.displayName = "TimePickerDialog";
|
|
4100
4191
|
var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
4101
4192
|
var isValidHourInput = (h, is24hour) => is24hour ? h >= 0 && h <= 23 : h >= 1 && h <= 12;
|
|
4102
|
-
var isValidMinuteInput = (
|
|
4193
|
+
var isValidMinuteInput = (m13) => m13 >= 0 && m13 <= 59;
|
|
4103
4194
|
var to24Hour = (hour12, isPm) => {
|
|
4104
4195
|
if (isPm) {
|
|
4105
4196
|
return hour12 === 12 ? 12 : hour12 + 12;
|
|
@@ -4116,18 +4207,18 @@ var useTimePickerState = (options) => {
|
|
|
4116
4207
|
const initialHour = clamp((_a = options == null ? void 0 : options.initialHour) != null ? _a : 0, 0, 23);
|
|
4117
4208
|
const initialMinute = clamp((_b = options == null ? void 0 : options.initialMinute) != null ? _b : 0, 0, 59);
|
|
4118
4209
|
const is24hour = (_c = options == null ? void 0 : options.is24hour) != null ? _c : false;
|
|
4119
|
-
const [hour, setHourState] =
|
|
4120
|
-
const [minute, setMinuteState] =
|
|
4121
|
-
const [hourInput, setHourInputState] =
|
|
4210
|
+
const [hour, setHourState] = React13.useState(initialHour);
|
|
4211
|
+
const [minute, setMinuteState] = React13.useState(initialMinute);
|
|
4212
|
+
const [hourInput, setHourInputState] = React13.useState(
|
|
4122
4213
|
is24hour ? initialHour : to12Hour(initialHour)
|
|
4123
4214
|
);
|
|
4124
|
-
const [minuteInput, setMinuteInputState] =
|
|
4125
|
-
const [selection, setSelectionState] =
|
|
4215
|
+
const [minuteInput, setMinuteInputState] = React13.useState(initialMinute);
|
|
4216
|
+
const [selection, setSelectionState] = React13.useState("hour");
|
|
4126
4217
|
const isPm = hour >= 12;
|
|
4127
4218
|
const isHourInputValid = isValidHourInput(hourInput, is24hour);
|
|
4128
4219
|
const isMinuteInputValid = isValidMinuteInput(minuteInput);
|
|
4129
4220
|
const isInputValid = isHourInputValid && isMinuteInputValid;
|
|
4130
|
-
const setHour =
|
|
4221
|
+
const setHour = React13.useCallback(
|
|
4131
4222
|
(h) => {
|
|
4132
4223
|
const clamped = clamp(h, 0, 23);
|
|
4133
4224
|
setHourState(clamped);
|
|
@@ -4135,12 +4226,12 @@ var useTimePickerState = (options) => {
|
|
|
4135
4226
|
},
|
|
4136
4227
|
[is24hour]
|
|
4137
4228
|
);
|
|
4138
|
-
const setMinute =
|
|
4139
|
-
const clamped = clamp(
|
|
4229
|
+
const setMinute = React13.useCallback((m13) => {
|
|
4230
|
+
const clamped = clamp(m13, 0, 59);
|
|
4140
4231
|
setMinuteState(clamped);
|
|
4141
4232
|
setMinuteInputState(clamped);
|
|
4142
4233
|
}, []);
|
|
4143
|
-
const setHourInput =
|
|
4234
|
+
const setHourInput = React13.useCallback(
|
|
4144
4235
|
(h) => {
|
|
4145
4236
|
setHourInputState(h);
|
|
4146
4237
|
if (isValidHourInput(h, is24hour)) {
|
|
@@ -4150,16 +4241,16 @@ var useTimePickerState = (options) => {
|
|
|
4150
4241
|
},
|
|
4151
4242
|
[is24hour, isPm]
|
|
4152
4243
|
);
|
|
4153
|
-
const setMinuteInput =
|
|
4154
|
-
setMinuteInputState(
|
|
4155
|
-
if (isValidMinuteInput(
|
|
4156
|
-
setMinuteState(
|
|
4244
|
+
const setMinuteInput = React13.useCallback((m13) => {
|
|
4245
|
+
setMinuteInputState(m13);
|
|
4246
|
+
if (isValidMinuteInput(m13)) {
|
|
4247
|
+
setMinuteState(m13);
|
|
4157
4248
|
}
|
|
4158
4249
|
}, []);
|
|
4159
|
-
const setSelection =
|
|
4250
|
+
const setSelection = React13.useCallback((mode) => {
|
|
4160
4251
|
setSelectionState(mode);
|
|
4161
4252
|
}, []);
|
|
4162
|
-
const setIsPm =
|
|
4253
|
+
const setIsPm = React13.useCallback((pm) => {
|
|
4163
4254
|
setHourState((prev) => {
|
|
4164
4255
|
const wasAlreadyPm = prev >= 12;
|
|
4165
4256
|
if (pm === wasAlreadyPm) return prev;
|
|
@@ -4169,14 +4260,14 @@ var useTimePickerState = (options) => {
|
|
|
4169
4260
|
return clamped;
|
|
4170
4261
|
});
|
|
4171
4262
|
}, []);
|
|
4172
|
-
const reset =
|
|
4263
|
+
const reset = React13.useCallback(() => {
|
|
4173
4264
|
setHourState(initialHour);
|
|
4174
4265
|
setMinuteState(initialMinute);
|
|
4175
4266
|
setHourInputState(is24hour ? initialHour : to12Hour(initialHour));
|
|
4176
4267
|
setMinuteInputState(initialMinute);
|
|
4177
4268
|
setSelectionState("hour");
|
|
4178
4269
|
}, [initialHour, initialMinute, is24hour]);
|
|
4179
|
-
return
|
|
4270
|
+
return React13.useMemo(
|
|
4180
4271
|
() => ({
|
|
4181
4272
|
hour,
|
|
4182
4273
|
minute,
|