@bug-on/m3-expressive 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/buttons.d.mts +2 -2
- package/dist/buttons.d.ts +2 -2
- package/dist/buttons.js +678 -605
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +677 -604
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +86 -61
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +86 -61
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +85 -61
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +85 -61
- 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 +70 -8
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +70 -8
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-sSt6PPLg.d.mts} +6 -0
- package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-sSt6PPLg.d.ts} +6 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +973 -496
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +967 -497
- 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 +65 -8
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +65 -8
- 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 +403 -93
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +397 -94
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +214 -189
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +176 -151
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +222 -197
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +189 -164
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-BcPD_7uK.d.ts} +44 -6
- package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DtFJkTFr.d.mts} +44 -6
- 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 +1 -1
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
|
|
|
@@ -169,13 +170,13 @@ var DatePickerInput = ({
|
|
|
169
170
|
locale,
|
|
170
171
|
className
|
|
171
172
|
}) => {
|
|
172
|
-
const inputId =
|
|
173
|
+
const inputId = React13.useId();
|
|
173
174
|
const errorId = `${inputId}-error`;
|
|
174
|
-
const placeholder =
|
|
175
|
+
const placeholder = React13.useMemo(() => {
|
|
175
176
|
if (locale == null ? void 0 : locale.startsWith("vi")) return "DD/MM/YYYY";
|
|
176
177
|
return "MM/DD/YYYY";
|
|
177
178
|
}, [locale]);
|
|
178
|
-
const handleKeyDown =
|
|
179
|
+
const handleKeyDown = React13.useCallback(
|
|
179
180
|
(e) => {
|
|
180
181
|
if (e.key === "Enter") {
|
|
181
182
|
const parsed = parseDateInput(value);
|
|
@@ -184,11 +185,11 @@ var DatePickerInput = ({
|
|
|
184
185
|
},
|
|
185
186
|
[value, onCommit]
|
|
186
187
|
);
|
|
187
|
-
const handleBlur =
|
|
188
|
+
const handleBlur = React13.useCallback(() => {
|
|
188
189
|
const parsed = parseDateInput(value);
|
|
189
190
|
onCommit(parsed);
|
|
190
191
|
}, [value, onCommit]);
|
|
191
|
-
const handleChange =
|
|
192
|
+
const handleChange = React13.useCallback(
|
|
192
193
|
(e) => {
|
|
193
194
|
let raw = e.target.value.replace(/\D/g, "");
|
|
194
195
|
if (raw.length > 8) raw = raw.slice(0, 8);
|
|
@@ -358,11 +359,11 @@ var DayCell = ({
|
|
|
358
359
|
// Disabled
|
|
359
360
|
isDisabled && "opacity-[0.38]"
|
|
360
361
|
);
|
|
361
|
-
const handleClick =
|
|
362
|
+
const handleClick = React13.useCallback(() => {
|
|
362
363
|
if (isDisabled) return;
|
|
363
364
|
onSelect(utcMs);
|
|
364
365
|
}, [isDisabled, utcMs, onSelect]);
|
|
365
|
-
const handleKeyDown =
|
|
366
|
+
const handleKeyDown = React13.useCallback(
|
|
366
367
|
(e) => {
|
|
367
368
|
if (e.key === "Enter" || e.key === " ") {
|
|
368
369
|
e.preventDefault();
|
|
@@ -398,7 +399,7 @@ var DayCell = ({
|
|
|
398
399
|
};
|
|
399
400
|
DayCell.displayName = "DayCell";
|
|
400
401
|
var WeekdayRow = ({ locale }) => {
|
|
401
|
-
const names =
|
|
402
|
+
const names = React13.useMemo(() => getWeekdayNames(locale), [locale]);
|
|
402
403
|
return /* @__PURE__ */ jsx("tr", { className: "grid grid-cols-7 mb-1", children: names.map((name, i) => /* @__PURE__ */ jsx(
|
|
403
404
|
"th",
|
|
404
405
|
{
|
|
@@ -425,7 +426,7 @@ var CalendarGrid = ({
|
|
|
425
426
|
const d = new Date(displayedMonthMs);
|
|
426
427
|
const year = d.getUTCFullYear();
|
|
427
428
|
const month = d.getUTCMonth();
|
|
428
|
-
const weeks =
|
|
429
|
+
const weeks = React13.useMemo(
|
|
429
430
|
() => getWeeksInMonth(year, month, locale.weekStartsOn),
|
|
430
431
|
[year, month, locale.weekStartsOn]
|
|
431
432
|
);
|
|
@@ -527,11 +528,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
527
528
|
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
529
|
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
530
|
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 =
|
|
531
|
+
var IndeterminateSvg = React13.memo(function IndeterminateSvg2({
|
|
531
532
|
size
|
|
532
533
|
}) {
|
|
533
|
-
const [ready, setReady] =
|
|
534
|
-
|
|
534
|
+
const [ready, setReady] = React13.useState(false);
|
|
535
|
+
React13.useEffect(() => {
|
|
535
536
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
536
537
|
return () => cancelAnimationFrame(raf);
|
|
537
538
|
}, []);
|
|
@@ -576,7 +577,7 @@ var IndeterminateSvg = React17.memo(function IndeterminateSvg2({
|
|
|
576
577
|
}
|
|
577
578
|
);
|
|
578
579
|
});
|
|
579
|
-
var DeterminateSvg =
|
|
580
|
+
var DeterminateSvg = React13.memo(function DeterminateSvg2({
|
|
580
581
|
size,
|
|
581
582
|
progress
|
|
582
583
|
}) {
|
|
@@ -601,7 +602,7 @@ var DeterminateSvg = React17.memo(function DeterminateSvg2({
|
|
|
601
602
|
}
|
|
602
603
|
);
|
|
603
604
|
});
|
|
604
|
-
var LoadingIndicator =
|
|
605
|
+
var LoadingIndicator = React13.forwardRef(
|
|
605
606
|
(_a, ref) => {
|
|
606
607
|
var _b = _a, {
|
|
607
608
|
variant = "uncontained",
|
|
@@ -716,7 +717,7 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
716
717
|
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
717
718
|
return d;
|
|
718
719
|
}
|
|
719
|
-
var CircularProgress =
|
|
720
|
+
var CircularProgress = React13.forwardRef(
|
|
720
721
|
(_a, ref) => {
|
|
721
722
|
var _b = _a, {
|
|
722
723
|
value,
|
|
@@ -754,15 +755,15 @@ var CircularProgress = React17.forwardRef(
|
|
|
754
755
|
const isWavy = shape === "wavy";
|
|
755
756
|
const BASELINE_SIZE = 48;
|
|
756
757
|
const scaleFactor = size / BASELINE_SIZE;
|
|
757
|
-
const effectiveAmplitude =
|
|
758
|
+
const effectiveAmplitude = React13.useMemo(
|
|
758
759
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
759
760
|
[amplitude, scaleFactor]
|
|
760
761
|
);
|
|
761
|
-
const effectiveWavelength =
|
|
762
|
+
const effectiveWavelength = React13.useMemo(
|
|
762
763
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
763
764
|
[wavelength, scaleFactor]
|
|
764
765
|
);
|
|
765
|
-
const wavyActivePath =
|
|
766
|
+
const wavyActivePath = React13.useMemo(
|
|
766
767
|
() => isWavy ? generateWavyCircularPath(
|
|
767
768
|
center,
|
|
768
769
|
radius,
|
|
@@ -771,8 +772,8 @@ var CircularProgress = React17.forwardRef(
|
|
|
771
772
|
) : null,
|
|
772
773
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
773
774
|
);
|
|
774
|
-
const circumference =
|
|
775
|
-
const gapForTrack =
|
|
775
|
+
const circumference = React13.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
776
|
+
const gapForTrack = React13.useMemo(
|
|
776
777
|
() => (gapSize + trackHeight) / circumference,
|
|
777
778
|
[gapSize, trackHeight, circumference]
|
|
778
779
|
);
|
|
@@ -961,9 +962,9 @@ var CircularProgress = React17.forwardRef(
|
|
|
961
962
|
);
|
|
962
963
|
CircularProgress.displayName = "CircularProgress";
|
|
963
964
|
function useContainerWidth() {
|
|
964
|
-
const [width, setWidth] =
|
|
965
|
-
const observerRef =
|
|
966
|
-
const ref =
|
|
965
|
+
const [width, setWidth] = React13.useState(0);
|
|
966
|
+
const observerRef = React13.useRef(null);
|
|
967
|
+
const ref = React13.useCallback((node) => {
|
|
967
968
|
if (observerRef.current) {
|
|
968
969
|
observerRef.current.disconnect();
|
|
969
970
|
observerRef.current = null;
|
|
@@ -977,7 +978,7 @@ function useContainerWidth() {
|
|
|
977
978
|
observerRef.current = obs;
|
|
978
979
|
}
|
|
979
980
|
}, []);
|
|
980
|
-
|
|
981
|
+
React13.useEffect(() => {
|
|
981
982
|
return () => {
|
|
982
983
|
if (observerRef.current) {
|
|
983
984
|
observerRef.current.disconnect();
|
|
@@ -987,7 +988,7 @@ function useContainerWidth() {
|
|
|
987
988
|
return [ref, width];
|
|
988
989
|
}
|
|
989
990
|
function useMergedRef(...refs) {
|
|
990
|
-
return
|
|
991
|
+
return React13.useCallback(
|
|
991
992
|
(node) => {
|
|
992
993
|
for (const ref of refs) {
|
|
993
994
|
if (typeof ref === "function") {
|
|
@@ -1001,7 +1002,7 @@ function useMergedRef(...refs) {
|
|
|
1001
1002
|
[refs]
|
|
1002
1003
|
);
|
|
1003
1004
|
}
|
|
1004
|
-
var FlatLinearTrack =
|
|
1005
|
+
var FlatLinearTrack = React13.memo(function FlatLinearTrack2({
|
|
1005
1006
|
trackHeight,
|
|
1006
1007
|
activeColor,
|
|
1007
1008
|
trackColor,
|
|
@@ -1077,7 +1078,7 @@ var FlatLinearTrack = React17.memo(function FlatLinearTrack2({
|
|
|
1077
1078
|
}
|
|
1078
1079
|
);
|
|
1079
1080
|
});
|
|
1080
|
-
var WavyLinearTrack =
|
|
1081
|
+
var WavyLinearTrack = React13.memo(function WavyLinearTrack2({
|
|
1081
1082
|
trackHeight,
|
|
1082
1083
|
svgHeight,
|
|
1083
1084
|
amplitude,
|
|
@@ -1096,13 +1097,13 @@ var WavyLinearTrack = React17.memo(function WavyLinearTrack2({
|
|
|
1096
1097
|
}) {
|
|
1097
1098
|
const isDeterminate = typeof value === "number";
|
|
1098
1099
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1099
|
-
const titleId =
|
|
1100
|
+
const titleId = React13.useId();
|
|
1100
1101
|
const [containerRef, width] = useContainerWidth();
|
|
1101
|
-
const activePathRef =
|
|
1102
|
-
const trackPathRef =
|
|
1102
|
+
const activePathRef = React13.useRef(null);
|
|
1103
|
+
const trackPathRef = React13.useRef(null);
|
|
1103
1104
|
const amplitudeMV = useMotionValue(amplitude);
|
|
1104
1105
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1105
|
-
|
|
1106
|
+
React13.useEffect(() => {
|
|
1106
1107
|
if (isDeterminate) {
|
|
1107
1108
|
const fraction = clampedValue / 100;
|
|
1108
1109
|
let targetAmp = amplitude;
|
|
@@ -1273,7 +1274,7 @@ var WavyLinearTrack = React17.memo(function WavyLinearTrack2({
|
|
|
1273
1274
|
}
|
|
1274
1275
|
);
|
|
1275
1276
|
});
|
|
1276
|
-
var LinearProgress =
|
|
1277
|
+
var LinearProgress = React13.forwardRef(
|
|
1277
1278
|
(_a, ref) => {
|
|
1278
1279
|
var _b = _a, {
|
|
1279
1280
|
value,
|
|
@@ -1314,10 +1315,10 @@ var LinearProgress = React17.forwardRef(
|
|
|
1314
1315
|
]);
|
|
1315
1316
|
const isDeterminate = value !== void 0;
|
|
1316
1317
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1317
|
-
const containerRef =
|
|
1318
|
+
const containerRef = React13.useRef(null);
|
|
1318
1319
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1319
|
-
const [isRtl, setIsRtl] =
|
|
1320
|
-
|
|
1320
|
+
const [isRtl, setIsRtl] = React13.useState(false);
|
|
1321
|
+
React13.useEffect(() => {
|
|
1321
1322
|
if (containerRef.current) {
|
|
1322
1323
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1323
1324
|
setIsRtl(dir === "rtl");
|
|
@@ -1325,16 +1326,16 @@ var LinearProgress = React17.forwardRef(
|
|
|
1325
1326
|
}, []);
|
|
1326
1327
|
const isWavy = shape === "wavy";
|
|
1327
1328
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1328
|
-
const effectiveAmplitude =
|
|
1329
|
-
const svgHeight =
|
|
1329
|
+
const effectiveAmplitude = React13.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1330
|
+
const svgHeight = React13.useMemo(
|
|
1330
1331
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1331
1332
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1332
1333
|
);
|
|
1333
|
-
const shouldShowStop =
|
|
1334
|
+
const shouldShowStop = React13.useMemo(
|
|
1334
1335
|
() => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
|
|
1335
1336
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1336
1337
|
);
|
|
1337
|
-
const stopSize =
|
|
1338
|
+
const stopSize = React13.useMemo(
|
|
1338
1339
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1339
1340
|
[trackHeight]
|
|
1340
1341
|
);
|
|
@@ -1407,14 +1408,14 @@ var LinearProgress = React17.forwardRef(
|
|
|
1407
1408
|
}
|
|
1408
1409
|
);
|
|
1409
1410
|
LinearProgress.displayName = "LinearProgress";
|
|
1410
|
-
var ProgressIndicator =
|
|
1411
|
+
var ProgressIndicator = React13.forwardRef((props, ref) => {
|
|
1411
1412
|
if (props.variant === "circular") {
|
|
1412
1413
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1413
1414
|
}
|
|
1414
1415
|
return /* @__PURE__ */ jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
1415
1416
|
});
|
|
1416
1417
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
1417
|
-
var RippleItem =
|
|
1418
|
+
var RippleItem = React13.memo(function RippleItem2({
|
|
1418
1419
|
ripple,
|
|
1419
1420
|
onDone
|
|
1420
1421
|
}) {
|
|
@@ -1458,8 +1459,8 @@ function Ripple({
|
|
|
1458
1459
|
}
|
|
1459
1460
|
function useRippleState(options = {}) {
|
|
1460
1461
|
const { disabled = false } = options;
|
|
1461
|
-
const [ripples, setRipples] =
|
|
1462
|
-
const onPointerDown =
|
|
1462
|
+
const [ripples, setRipples] = React13.useState([]);
|
|
1463
|
+
const onPointerDown = React13.useCallback(
|
|
1463
1464
|
(e) => {
|
|
1464
1465
|
if (disabled) return;
|
|
1465
1466
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1473,7 +1474,7 @@ function useRippleState(options = {}) {
|
|
|
1473
1474
|
},
|
|
1474
1475
|
[disabled]
|
|
1475
1476
|
);
|
|
1476
|
-
const removeRipple =
|
|
1477
|
+
const removeRipple = React13.useCallback((id) => {
|
|
1477
1478
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1478
1479
|
}, []);
|
|
1479
1480
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1594,7 +1595,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1594
1595
|
}
|
|
1595
1596
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1596
1597
|
}
|
|
1597
|
-
var IconButtonComponent =
|
|
1598
|
+
var IconButtonComponent = React13.forwardRef(
|
|
1598
1599
|
(_a, ref) => {
|
|
1599
1600
|
var _b = _a, {
|
|
1600
1601
|
className,
|
|
@@ -1607,6 +1608,7 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1607
1608
|
loading = false,
|
|
1608
1609
|
loadingVariant = "loading-indicator",
|
|
1609
1610
|
iconSize,
|
|
1611
|
+
asChild = false,
|
|
1610
1612
|
children,
|
|
1611
1613
|
onClick,
|
|
1612
1614
|
onKeyDown,
|
|
@@ -1622,6 +1624,7 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1622
1624
|
"loading",
|
|
1623
1625
|
"loadingVariant",
|
|
1624
1626
|
"iconSize",
|
|
1627
|
+
"asChild",
|
|
1625
1628
|
"children",
|
|
1626
1629
|
"onClick",
|
|
1627
1630
|
"onKeyDown",
|
|
@@ -1630,18 +1633,18 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1630
1633
|
var _a2, _b2;
|
|
1631
1634
|
const isToggle = variant === "toggle";
|
|
1632
1635
|
const isSelected = isToggle && !!selected;
|
|
1633
|
-
const resolvedColorClass =
|
|
1636
|
+
const resolvedColorClass = React13.useMemo(
|
|
1634
1637
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1635
1638
|
[isSelected, colorStyle]
|
|
1636
1639
|
);
|
|
1637
|
-
const outlineWidthClass =
|
|
1640
|
+
const outlineWidthClass = React13.useMemo(
|
|
1638
1641
|
() => {
|
|
1639
1642
|
var _a3;
|
|
1640
1643
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1641
1644
|
},
|
|
1642
1645
|
[colorStyle, isSelected, size]
|
|
1643
1646
|
);
|
|
1644
|
-
const disabledBgClass =
|
|
1647
|
+
const disabledBgClass = React13.useMemo(
|
|
1645
1648
|
() => resolveDisabledBgClass(colorStyle),
|
|
1646
1649
|
[colorStyle]
|
|
1647
1650
|
);
|
|
@@ -1662,7 +1665,7 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1662
1665
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1663
1666
|
disabled: loading
|
|
1664
1667
|
});
|
|
1665
|
-
const handleClick =
|
|
1668
|
+
const handleClick = React13.useCallback(
|
|
1666
1669
|
(e) => {
|
|
1667
1670
|
if (loading) {
|
|
1668
1671
|
e.preventDefault();
|
|
@@ -1672,7 +1675,7 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1672
1675
|
},
|
|
1673
1676
|
[loading, onClick]
|
|
1674
1677
|
);
|
|
1675
|
-
const handleKeyDown =
|
|
1678
|
+
const handleKeyDown = React13.useCallback(
|
|
1676
1679
|
(e) => {
|
|
1677
1680
|
if (loading) return;
|
|
1678
1681
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1683,7 +1686,87 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1683
1686
|
},
|
|
1684
1687
|
[loading, onClick, onKeyDown]
|
|
1685
1688
|
);
|
|
1686
|
-
|
|
1689
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1690
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
1691
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
1692
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
1693
|
+
m.span,
|
|
1694
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1695
|
+
transition: SPRING_TRANSITION,
|
|
1696
|
+
className: cn(
|
|
1697
|
+
"flex items-center justify-center shrink-0",
|
|
1698
|
+
iconSize != null ? void 0 : iconClass
|
|
1699
|
+
),
|
|
1700
|
+
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
1701
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
1702
|
+
LoadingIndicator,
|
|
1703
|
+
{
|
|
1704
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1705
|
+
color: "currentColor",
|
|
1706
|
+
"aria-label": "Loading"
|
|
1707
|
+
}
|
|
1708
|
+
) : /* @__PURE__ */ jsx(
|
|
1709
|
+
ProgressIndicator,
|
|
1710
|
+
{
|
|
1711
|
+
variant: "circular",
|
|
1712
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1713
|
+
color: "currentColor",
|
|
1714
|
+
trackColor: "transparent",
|
|
1715
|
+
"aria-label": "Loading"
|
|
1716
|
+
}
|
|
1717
|
+
)
|
|
1718
|
+
}),
|
|
1719
|
+
"loading"
|
|
1720
|
+
) : /* @__PURE__ */ jsx(
|
|
1721
|
+
m.span,
|
|
1722
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1723
|
+
transition: SPRING_TRANSITION,
|
|
1724
|
+
"aria-hidden": "true",
|
|
1725
|
+
className: cn(
|
|
1726
|
+
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
1727
|
+
iconSize != null ? void 0 : iconClass
|
|
1728
|
+
),
|
|
1729
|
+
style: {
|
|
1730
|
+
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
1731
|
+
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1732
|
+
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1733
|
+
},
|
|
1734
|
+
children: asChild ? React13.Children.only(children).props.children : children
|
|
1735
|
+
}),
|
|
1736
|
+
"content"
|
|
1737
|
+
) })
|
|
1738
|
+
] });
|
|
1739
|
+
const containerClassName = cn(
|
|
1740
|
+
baseIconButtonClasses,
|
|
1741
|
+
resolvedColorClass,
|
|
1742
|
+
outlineWidthClass,
|
|
1743
|
+
disabledBgClass,
|
|
1744
|
+
"overflow-hidden",
|
|
1745
|
+
SIZE_STYLES[size],
|
|
1746
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
1747
|
+
className
|
|
1748
|
+
);
|
|
1749
|
+
if (asChild) {
|
|
1750
|
+
const child = React13.Children.only(children);
|
|
1751
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1752
|
+
Slot,
|
|
1753
|
+
__spreadProps(__spreadValues({
|
|
1754
|
+
ref,
|
|
1755
|
+
"aria-pressed": isToggle ? isSelected : void 0,
|
|
1756
|
+
"aria-label": ariaLabel,
|
|
1757
|
+
"aria-busy": loading || void 0,
|
|
1758
|
+
"aria-disabled": loading || restProps.disabled,
|
|
1759
|
+
onClick: handleClick,
|
|
1760
|
+
onPointerDown,
|
|
1761
|
+
onKeyDown: handleKeyDown,
|
|
1762
|
+
style: __spreadProps(__spreadValues({}, style), { borderRadius: `${animateRadius}px` }),
|
|
1763
|
+
className: containerClassName
|
|
1764
|
+
}, restProps), {
|
|
1765
|
+
children: React13.cloneElement(child, { children: innerContent })
|
|
1766
|
+
})
|
|
1767
|
+
) });
|
|
1768
|
+
}
|
|
1769
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1687
1770
|
m.button,
|
|
1688
1771
|
__spreadProps(__spreadValues({
|
|
1689
1772
|
ref,
|
|
@@ -1699,79 +1782,21 @@ var IconButtonComponent = React17.forwardRef(
|
|
|
1699
1782
|
animate: { borderRadius: animateRadius },
|
|
1700
1783
|
whileTap: { borderRadius: pressedRadius },
|
|
1701
1784
|
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
|
-
)
|
|
1785
|
+
className: containerClassName
|
|
1712
1786
|
}, 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
|
-
]
|
|
1787
|
+
children: innerContent
|
|
1763
1788
|
})
|
|
1764
1789
|
) });
|
|
1765
1790
|
}
|
|
1766
1791
|
);
|
|
1767
1792
|
IconButtonComponent.displayName = "IconButton";
|
|
1768
|
-
var IconButton =
|
|
1793
|
+
var IconButton = React13.memo(IconButtonComponent);
|
|
1769
1794
|
var VARIANT_FONT = {
|
|
1770
1795
|
outlined: "'Material Symbols Outlined'",
|
|
1771
1796
|
rounded: "'Material Symbols Rounded'",
|
|
1772
1797
|
sharp: "'Material Symbols Sharp'"
|
|
1773
1798
|
};
|
|
1774
|
-
var IconComponent =
|
|
1799
|
+
var IconComponent = React13.forwardRef(
|
|
1775
1800
|
(_a, ref) => {
|
|
1776
1801
|
var _b = _a, {
|
|
1777
1802
|
name,
|
|
@@ -1837,7 +1862,7 @@ var IconComponent = React17.forwardRef(
|
|
|
1837
1862
|
}
|
|
1838
1863
|
);
|
|
1839
1864
|
IconComponent.displayName = "Icon";
|
|
1840
|
-
var Icon =
|
|
1865
|
+
var Icon = React13.memo(IconComponent);
|
|
1841
1866
|
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
1867
|
var CalendarHeader = ({
|
|
1843
1868
|
displayedMonthMs,
|
|
@@ -1995,15 +2020,15 @@ var MonthPickerList = ({
|
|
|
1995
2020
|
locale,
|
|
1996
2021
|
onMonthSelect
|
|
1997
2022
|
}) => {
|
|
1998
|
-
const selectedRef =
|
|
1999
|
-
|
|
2023
|
+
const selectedRef = React13.useRef(null);
|
|
2024
|
+
React13.useEffect(() => {
|
|
2000
2025
|
var _a, _b;
|
|
2001
2026
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2002
2027
|
block: "center",
|
|
2003
2028
|
behavior: "instant"
|
|
2004
2029
|
});
|
|
2005
2030
|
}, []);
|
|
2006
|
-
const months =
|
|
2031
|
+
const months = React13.useMemo(
|
|
2007
2032
|
() => Array.from({ length: 12 }, (_, month) => month),
|
|
2008
2033
|
[]
|
|
2009
2034
|
);
|
|
@@ -2048,12 +2073,12 @@ var YearPickerList = ({
|
|
|
2048
2073
|
selectableDates,
|
|
2049
2074
|
onYearSelect
|
|
2050
2075
|
}) => {
|
|
2051
|
-
const selectedRef =
|
|
2052
|
-
const years =
|
|
2076
|
+
const selectedRef = React13.useRef(null);
|
|
2077
|
+
const years = React13.useMemo(() => {
|
|
2053
2078
|
const [min, max] = yearRange;
|
|
2054
2079
|
return Array.from({ length: max - min + 1 }, (_, index) => min + index);
|
|
2055
2080
|
}, [yearRange]);
|
|
2056
|
-
|
|
2081
|
+
React13.useEffect(() => {
|
|
2057
2082
|
var _a, _b;
|
|
2058
2083
|
(_b = (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, {
|
|
2059
2084
|
block: "center",
|
|
@@ -2124,17 +2149,17 @@ var DatePicker = ({
|
|
|
2124
2149
|
navigateToMonth,
|
|
2125
2150
|
setDisplayMode
|
|
2126
2151
|
} = state;
|
|
2127
|
-
const [activeSelector, setActiveSelector] =
|
|
2128
|
-
const [slideDirection, setSlideDirection] =
|
|
2129
|
-
const handlePrev =
|
|
2152
|
+
const [activeSelector, setActiveSelector] = React13.useState(null);
|
|
2153
|
+
const [slideDirection, setSlideDirection] = React13.useState(null);
|
|
2154
|
+
const handlePrev = React13.useCallback(() => {
|
|
2130
2155
|
setSlideDirection("prev");
|
|
2131
2156
|
navigateMonth2("prev");
|
|
2132
2157
|
}, [navigateMonth2]);
|
|
2133
|
-
const handleNext =
|
|
2158
|
+
const handleNext = React13.useCallback(() => {
|
|
2134
2159
|
setSlideDirection("next");
|
|
2135
2160
|
navigateMonth2("next");
|
|
2136
2161
|
}, [navigateMonth2]);
|
|
2137
|
-
const handleYearSelect =
|
|
2162
|
+
const handleYearSelect = React13.useCallback(
|
|
2138
2163
|
(year) => {
|
|
2139
2164
|
const d = new Date(displayedMonthMs);
|
|
2140
2165
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2142,7 +2167,7 @@ var DatePicker = ({
|
|
|
2142
2167
|
},
|
|
2143
2168
|
[displayedMonthMs, navigateToMonth]
|
|
2144
2169
|
);
|
|
2145
|
-
const handleMonthSelect =
|
|
2170
|
+
const handleMonthSelect = React13.useCallback(
|
|
2146
2171
|
(month) => {
|
|
2147
2172
|
const d = new Date(displayedMonthMs);
|
|
2148
2173
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2150,11 +2175,11 @@ var DatePicker = ({
|
|
|
2150
2175
|
},
|
|
2151
2176
|
[displayedMonthMs, navigateToMonth]
|
|
2152
2177
|
);
|
|
2153
|
-
const [inputValue, setInputValue] =
|
|
2178
|
+
const [inputValue, setInputValue] = React13.useState(
|
|
2154
2179
|
() => selectedDateMs !== null ? formatInputDate(selectedDateMs) : ""
|
|
2155
2180
|
);
|
|
2156
|
-
const [inputError, setInputError] =
|
|
2157
|
-
const handleInputCommit =
|
|
2181
|
+
const [inputError, setInputError] = React13.useState();
|
|
2182
|
+
const handleInputCommit = React13.useCallback(
|
|
2158
2183
|
(ms) => {
|
|
2159
2184
|
if (ms === null && inputValue.length > 0) {
|
|
2160
2185
|
setInputError("Invalid date");
|
|
@@ -2388,7 +2413,7 @@ var DP_CLASSES = {
|
|
|
2388
2413
|
/** Weekday header row */
|
|
2389
2414
|
weekdayRow: "text-[length:var(--md-typescale-body-large-size,14px)] text-m3-on-surface"
|
|
2390
2415
|
};
|
|
2391
|
-
var ScrollArea =
|
|
2416
|
+
var ScrollArea = React13.forwardRef(
|
|
2392
2417
|
(_a, ref) => {
|
|
2393
2418
|
var _b = _a, {
|
|
2394
2419
|
className,
|
|
@@ -2409,15 +2434,15 @@ var ScrollArea = React17.forwardRef(
|
|
|
2409
2434
|
"viewportRef",
|
|
2410
2435
|
"viewportProps"
|
|
2411
2436
|
]);
|
|
2412
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
2413
|
-
|
|
2437
|
+
const [isTouchDevice, setIsTouchDevice] = React13.useState(false);
|
|
2438
|
+
React13.useEffect(() => {
|
|
2414
2439
|
if (typeof window !== "undefined") {
|
|
2415
2440
|
setIsTouchDevice(
|
|
2416
2441
|
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
2417
2442
|
);
|
|
2418
2443
|
}
|
|
2419
2444
|
}, []);
|
|
2420
|
-
const resolvedType =
|
|
2445
|
+
const resolvedType = React13.useMemo(() => {
|
|
2421
2446
|
if (type === "hover" && isTouchDevice) {
|
|
2422
2447
|
return "scroll";
|
|
2423
2448
|
}
|
|
@@ -2468,7 +2493,7 @@ var ScrollArea = React17.forwardRef(
|
|
|
2468
2493
|
}
|
|
2469
2494
|
);
|
|
2470
2495
|
ScrollArea.displayName = "ScrollArea";
|
|
2471
|
-
var ScrollAreaScrollbar =
|
|
2496
|
+
var ScrollAreaScrollbar = React13.forwardRef((_a, ref) => {
|
|
2472
2497
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
2473
2498
|
return /* @__PURE__ */ jsx(
|
|
2474
2499
|
RadixScrollArea.Scrollbar,
|
|
@@ -2498,7 +2523,7 @@ var ScrollAreaScrollbar = React17.forwardRef((_a, ref) => {
|
|
|
2498
2523
|
);
|
|
2499
2524
|
});
|
|
2500
2525
|
ScrollAreaScrollbar.displayName = RadixScrollArea.Scrollbar.displayName;
|
|
2501
|
-
var ScrollAreaCorner =
|
|
2526
|
+
var ScrollAreaCorner = React13.forwardRef((_a, ref) => {
|
|
2502
2527
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2503
2528
|
return /* @__PURE__ */ jsx(
|
|
2504
2529
|
RadixScrollArea.Corner,
|
|
@@ -2540,9 +2565,9 @@ DialogTrigger.displayName = "DialogTrigger";
|
|
|
2540
2565
|
var DialogPortal = ({
|
|
2541
2566
|
open,
|
|
2542
2567
|
children
|
|
2543
|
-
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ?
|
|
2568
|
+
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ? React13.Children.toArray(children) : null }) });
|
|
2544
2569
|
DialogPortal.displayName = "DialogPortal";
|
|
2545
|
-
var DialogOverlay =
|
|
2570
|
+
var DialogOverlay = React13.forwardRef((_a, ref) => {
|
|
2546
2571
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2547
2572
|
return /* @__PURE__ */ jsx(RadixDialog.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsx(
|
|
2548
2573
|
m.div,
|
|
@@ -2553,7 +2578,7 @@ var DialogOverlay = React17.forwardRef((_a, ref) => {
|
|
|
2553
2578
|
) }));
|
|
2554
2579
|
});
|
|
2555
2580
|
DialogOverlay.displayName = "DialogOverlay";
|
|
2556
|
-
var DialogContent =
|
|
2581
|
+
var DialogContent = React13.forwardRef((_a, ref) => {
|
|
2557
2582
|
var _b = _a, { className, children, hideCloseButton = false } = _b, props = __objRest(_b, ["className", "children", "hideCloseButton"]);
|
|
2558
2583
|
return /* @__PURE__ */ jsx(
|
|
2559
2584
|
RadixDialog.Content,
|
|
@@ -2593,7 +2618,7 @@ var DialogContent = React17.forwardRef((_a, ref) => {
|
|
|
2593
2618
|
);
|
|
2594
2619
|
});
|
|
2595
2620
|
DialogContent.displayName = "DialogContent";
|
|
2596
|
-
var DialogIcon =
|
|
2621
|
+
var DialogIcon = React13.forwardRef((_a, ref) => {
|
|
2597
2622
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
2598
2623
|
return /* @__PURE__ */ jsx(
|
|
2599
2624
|
"div",
|
|
@@ -2607,7 +2632,7 @@ var DialogIcon = React17.forwardRef((_a, ref) => {
|
|
|
2607
2632
|
);
|
|
2608
2633
|
});
|
|
2609
2634
|
DialogIcon.displayName = "DialogIcon";
|
|
2610
|
-
var DialogTitle =
|
|
2635
|
+
var DialogTitle = React13.forwardRef((_a, ref) => {
|
|
2611
2636
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2612
2637
|
return /* @__PURE__ */ jsx(
|
|
2613
2638
|
RadixDialog.Title,
|
|
@@ -2622,7 +2647,7 @@ var DialogTitle = React17.forwardRef((_a, ref) => {
|
|
|
2622
2647
|
);
|
|
2623
2648
|
});
|
|
2624
2649
|
DialogTitle.displayName = "DialogTitle";
|
|
2625
|
-
var DialogDescription =
|
|
2650
|
+
var DialogDescription = React13.forwardRef((_a, ref) => {
|
|
2626
2651
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
2627
2652
|
return /* @__PURE__ */ jsx(
|
|
2628
2653
|
RadixDialog.Description,
|
|
@@ -2634,7 +2659,7 @@ var DialogDescription = React17.forwardRef((_a, ref) => {
|
|
|
2634
2659
|
);
|
|
2635
2660
|
});
|
|
2636
2661
|
DialogDescription.displayName = "DialogDescription";
|
|
2637
|
-
var DialogBody =
|
|
2662
|
+
var DialogBody = React13.forwardRef((_a, ref) => {
|
|
2638
2663
|
var _b = _a, { className, children, dir } = _b, props = __objRest(_b, ["className", "children", "dir"]);
|
|
2639
2664
|
return /* @__PURE__ */ jsx(
|
|
2640
2665
|
ScrollArea,
|
|
@@ -2650,7 +2675,7 @@ var DialogBody = React17.forwardRef((_a, ref) => {
|
|
|
2650
2675
|
);
|
|
2651
2676
|
});
|
|
2652
2677
|
DialogBody.displayName = "DialogBody";
|
|
2653
|
-
var DialogFullScreenContent =
|
|
2678
|
+
var DialogFullScreenContent = React13.forwardRef(
|
|
2654
2679
|
(_a, ref) => {
|
|
2655
2680
|
var _b = _a, {
|
|
2656
2681
|
className,
|
|
@@ -2798,17 +2823,17 @@ var DateRangePicker = ({
|
|
|
2798
2823
|
navigateToMonth,
|
|
2799
2824
|
setDisplayMode
|
|
2800
2825
|
} = state;
|
|
2801
|
-
const [activeSelector, setActiveSelector] =
|
|
2802
|
-
const [slideDirection, setSlideDirection] =
|
|
2803
|
-
const handlePrev =
|
|
2826
|
+
const [activeSelector, setActiveSelector] = React13.useState(null);
|
|
2827
|
+
const [slideDirection, setSlideDirection] = React13.useState(null);
|
|
2828
|
+
const handlePrev = React13.useCallback(() => {
|
|
2804
2829
|
setSlideDirection("prev");
|
|
2805
2830
|
navigateMonth2("prev");
|
|
2806
2831
|
}, [navigateMonth2]);
|
|
2807
|
-
const handleNext =
|
|
2832
|
+
const handleNext = React13.useCallback(() => {
|
|
2808
2833
|
setSlideDirection("next");
|
|
2809
2834
|
navigateMonth2("next");
|
|
2810
2835
|
}, [navigateMonth2]);
|
|
2811
|
-
const handleYearSelect =
|
|
2836
|
+
const handleYearSelect = React13.useCallback(
|
|
2812
2837
|
(year) => {
|
|
2813
2838
|
const d = new Date(displayedMonthMs);
|
|
2814
2839
|
navigateToMonth(year, d.getUTCMonth());
|
|
@@ -2816,7 +2841,7 @@ var DateRangePicker = ({
|
|
|
2816
2841
|
},
|
|
2817
2842
|
[displayedMonthMs, navigateToMonth]
|
|
2818
2843
|
);
|
|
2819
|
-
const handleMonthSelect =
|
|
2844
|
+
const handleMonthSelect = React13.useCallback(
|
|
2820
2845
|
(month) => {
|
|
2821
2846
|
const d = new Date(displayedMonthMs);
|
|
2822
2847
|
navigateToMonth(d.getUTCFullYear(), month);
|
|
@@ -2824,7 +2849,7 @@ var DateRangePicker = ({
|
|
|
2824
2849
|
},
|
|
2825
2850
|
[displayedMonthMs, navigateToMonth]
|
|
2826
2851
|
);
|
|
2827
|
-
const formatShort =
|
|
2852
|
+
const formatShort = React13.useCallback(
|
|
2828
2853
|
(ms) => {
|
|
2829
2854
|
if (ms === null) return "\u2014";
|
|
2830
2855
|
return formatDate(ms, locale, {
|
|
@@ -3429,16 +3454,16 @@ var InputField = ({
|
|
|
3429
3454
|
onBlur,
|
|
3430
3455
|
className
|
|
3431
3456
|
}) => {
|
|
3432
|
-
const [inputText, setInputText] =
|
|
3457
|
+
const [inputText, setInputText] = React13.useState(
|
|
3433
3458
|
String(value).padStart(2, "0")
|
|
3434
3459
|
);
|
|
3435
|
-
const inputRef =
|
|
3436
|
-
|
|
3460
|
+
const inputRef = React13.useRef(null);
|
|
3461
|
+
React13.useEffect(() => {
|
|
3437
3462
|
if (!isFocused) {
|
|
3438
3463
|
setInputText(String(value).padStart(2, "0"));
|
|
3439
3464
|
}
|
|
3440
3465
|
}, [value, isFocused]);
|
|
3441
|
-
|
|
3466
|
+
React13.useEffect(() => {
|
|
3442
3467
|
var _a, _b;
|
|
3443
3468
|
if (isFocused) {
|
|
3444
3469
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -3528,7 +3553,7 @@ var InputField = ({
|
|
|
3528
3553
|
};
|
|
3529
3554
|
var TimeInput = ({ state, className }) => {
|
|
3530
3555
|
const { is24hour, setHourInput, setMinuteInput, setSelection } = state;
|
|
3531
|
-
const [focusedField, setFocusedField] =
|
|
3556
|
+
const [focusedField, setFocusedField] = React13.useState(null);
|
|
3532
3557
|
const handleHourAutoAdvance = () => {
|
|
3533
3558
|
setFocusedField("minute");
|
|
3534
3559
|
setSelection("minute");
|
|
@@ -3722,17 +3747,17 @@ var ClockDial = ({
|
|
|
3722
3747
|
setMinute,
|
|
3723
3748
|
setSelection
|
|
3724
3749
|
} = state;
|
|
3725
|
-
const displayAngle =
|
|
3750
|
+
const displayAngle = React13.useMemo(() => {
|
|
3726
3751
|
if (selection === "hour") {
|
|
3727
3752
|
return valueToAngle(hour, "hour");
|
|
3728
3753
|
}
|
|
3729
3754
|
return valueToAngle(minute, "minute");
|
|
3730
3755
|
}, [selection, hour, minute]);
|
|
3731
|
-
const selectorPos =
|
|
3756
|
+
const selectorPos = React13.useMemo(
|
|
3732
3757
|
() => getSelectorPosition(displayAngle, selection, is24hour, isPm),
|
|
3733
3758
|
[displayAngle, selection, is24hour, isPm]
|
|
3734
3759
|
);
|
|
3735
|
-
const trackEnd =
|
|
3760
|
+
const trackEnd = React13.useMemo(() => {
|
|
3736
3761
|
const dx = selectorPos.x - CENTER;
|
|
3737
3762
|
const dy = selectorPos.y - CENTER;
|
|
3738
3763
|
const length = Math.hypot(dx, dy);
|
|
@@ -3742,13 +3767,13 @@ var ClockDial = ({
|
|
|
3742
3767
|
y: selectorPos.y - dy / length * HANDLE_RADIUS
|
|
3743
3768
|
};
|
|
3744
3769
|
}, [selectorPos]);
|
|
3745
|
-
const numbers =
|
|
3770
|
+
const numbers = React13.useMemo(() => {
|
|
3746
3771
|
if (selection === "minute") return buildMinuteNumbers();
|
|
3747
3772
|
if (is24hour) return buildHour24Numbers();
|
|
3748
3773
|
return buildHour12Numbers();
|
|
3749
3774
|
}, [selection, is24hour]);
|
|
3750
|
-
const isDragging =
|
|
3751
|
-
const svgRef =
|
|
3775
|
+
const isDragging = React13.useRef(false);
|
|
3776
|
+
const svgRef = React13.useRef(null);
|
|
3752
3777
|
const getSVGPoint = (e) => {
|
|
3753
3778
|
const svg = svgRef.current;
|
|
3754
3779
|
if (!svg) return { x: e.clientX, y: e.clientY };
|
|
@@ -3898,8 +3923,8 @@ var getAutoLayout = () => {
|
|
|
3898
3923
|
return innerWidth >= 600 && innerHeight >= 300 && innerWidth >= innerHeight ? "horizontal" : "vertical";
|
|
3899
3924
|
};
|
|
3900
3925
|
var useResolvedLayout = (layout) => {
|
|
3901
|
-
const [autoLayout, setAutoLayout] =
|
|
3902
|
-
|
|
3926
|
+
const [autoLayout, setAutoLayout] = React13.useState("vertical");
|
|
3927
|
+
React13.useEffect(() => {
|
|
3903
3928
|
if (layout !== "auto") return;
|
|
3904
3929
|
const updateLayout = () => setAutoLayout(getAutoLayout());
|
|
3905
3930
|
updateLayout();
|