@bug-on/m3-expressive 1.2.6 → 1.3.0
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 +3 -3
- package/dist/buttons.d.ts +3 -3
- package/dist/buttons.js +230 -82
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +231 -83
- package/dist/buttons.mjs.map +1 -1
- package/dist/{core-D4048_K5.d.mts → core-CAU8g2HY.d.mts} +1 -1
- package/dist/{core-Bc5Wj_pc.d.ts → core-DRrLnsnJ.d.ts} +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +300 -152
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +283 -135
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +40 -6
- package/dist/feedback.d.ts +40 -6
- package/dist/feedback.js +313 -165
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +291 -143
- package/dist/feedback.mjs.map +1 -1
- package/dist/{icon-button-CSsDmuQC.d.mts → icon-button-CqdQBsRe.d.ts} +11 -5
- package/dist/{icon-button-CSsDmuQC.d.ts → icon-button-USJo7AqO.d.mts} +11 -5
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +511 -235
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +511 -236
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +1 -1
- package/dist/layout.d.ts +1 -1
- package/dist/layout.js +221 -105
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +222 -106
- package/dist/layout.mjs.map +1 -1
- package/dist/{md3-Dty-Qcad.d.mts → md3-D0_Z7IXj.d.mts} +9 -1
- package/dist/{md3-Dty-Qcad.d.ts → md3-D0_Z7IXj.d.ts} +9 -1
- package/dist/navigation.d.mts +103 -33
- package/dist/navigation.d.ts +103 -33
- package/dist/navigation.js +507 -199
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +508 -201
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +354 -206
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +317 -169
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +362 -214
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +330 -182
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-DPJL3bO6.d.mts → split-button-trailing-uncheckable-26qlZvKT.d.mts} +10 -7
- package/dist/{split-button-trailing-uncheckable--BhNTEJw.d.ts → split-button-trailing-uncheckable-CXUVrH64.d.ts} +10 -7
- package/package.json +1 -1
package/dist/overlays.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var RadixDialog = require('@radix-ui/react-dialog');
|
|
5
5
|
var react = require('motion/react');
|
|
6
|
-
var
|
|
6
|
+
var React2 = require('react');
|
|
7
7
|
var clsx = require('clsx');
|
|
8
8
|
var tailwindMerge = require('tailwind-merge');
|
|
9
9
|
var reactSlot = require('@radix-ui/react-slot');
|
|
@@ -30,7 +30,7 @@ function _interopNamespace(e) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
var RadixDialog__namespace = /*#__PURE__*/_interopNamespace(RadixDialog);
|
|
33
|
-
var
|
|
33
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
34
34
|
var RadixScrollArea__namespace = /*#__PURE__*/_interopNamespace(RadixScrollArea);
|
|
35
35
|
|
|
36
36
|
var __defProp = Object.defineProperty;
|
|
@@ -112,11 +112,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
112
112
|
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";
|
|
113
113
|
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";
|
|
114
114
|
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";
|
|
115
|
-
var IndeterminateSvg =
|
|
115
|
+
var IndeterminateSvg = React2__namespace.memo(function IndeterminateSvg2({
|
|
116
116
|
size
|
|
117
117
|
}) {
|
|
118
|
-
const [ready, setReady] =
|
|
119
|
-
|
|
118
|
+
const [ready, setReady] = React2__namespace.useState(false);
|
|
119
|
+
React2__namespace.useEffect(() => {
|
|
120
120
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
121
121
|
return () => cancelAnimationFrame(raf);
|
|
122
122
|
}, []);
|
|
@@ -161,7 +161,7 @@ var IndeterminateSvg = React9__namespace.memo(function IndeterminateSvg2({
|
|
|
161
161
|
}
|
|
162
162
|
);
|
|
163
163
|
});
|
|
164
|
-
var DeterminateSvg =
|
|
164
|
+
var DeterminateSvg = React2__namespace.memo(function DeterminateSvg2({
|
|
165
165
|
size,
|
|
166
166
|
progress
|
|
167
167
|
}) {
|
|
@@ -186,7 +186,7 @@ var DeterminateSvg = React9__namespace.memo(function DeterminateSvg2({
|
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
188
|
});
|
|
189
|
-
var LoadingIndicator =
|
|
189
|
+
var LoadingIndicator = React2__namespace.forwardRef(
|
|
190
190
|
(_a, ref) => {
|
|
191
191
|
var _b = _a, {
|
|
192
192
|
variant = "uncontained",
|
|
@@ -281,7 +281,7 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
281
281
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
282
282
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
283
283
|
}
|
|
284
|
-
return d
|
|
284
|
+
return `${d} Z`;
|
|
285
285
|
}
|
|
286
286
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
287
287
|
if (startX >= endX) return "";
|
|
@@ -313,7 +313,15 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
313
313
|
}
|
|
314
314
|
return d;
|
|
315
315
|
}
|
|
316
|
-
var
|
|
316
|
+
var GLOBAL_ROTATION_DURATION = 6e3;
|
|
317
|
+
var GLOBAL_ROTATION_TARGET = 1080;
|
|
318
|
+
var ADDITIONAL_ROTATION_CYCLE = 1500;
|
|
319
|
+
var ADDITIONAL_ROTATION_STEP = 90;
|
|
320
|
+
var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
321
|
+
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
322
|
+
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
323
|
+
var PROGRESS_CYCLE_DURATION = 1500;
|
|
324
|
+
var CircularProgress = React2__namespace.forwardRef(
|
|
317
325
|
(_a, ref) => {
|
|
318
326
|
var _b = _a, {
|
|
319
327
|
value,
|
|
@@ -326,6 +334,10 @@ var CircularProgress = React9__namespace.forwardRef(
|
|
|
326
334
|
crawlerSpeed = 1,
|
|
327
335
|
color,
|
|
328
336
|
trackColor,
|
|
337
|
+
showTrack = "auto",
|
|
338
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
339
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
340
|
+
amplitudeRange,
|
|
329
341
|
className,
|
|
330
342
|
"aria-label": ariaLabel
|
|
331
343
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -339,6 +351,10 @@ var CircularProgress = React9__namespace.forwardRef(
|
|
|
339
351
|
"crawlerSpeed",
|
|
340
352
|
"color",
|
|
341
353
|
"trackColor",
|
|
354
|
+
"showTrack",
|
|
355
|
+
"minProgress",
|
|
356
|
+
"maxProgress",
|
|
357
|
+
"amplitudeRange",
|
|
342
358
|
"className",
|
|
343
359
|
"aria-label"
|
|
344
360
|
]);
|
|
@@ -349,17 +365,22 @@ var CircularProgress = React9__namespace.forwardRef(
|
|
|
349
365
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
350
366
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
351
367
|
const isWavy = shape === "wavy";
|
|
368
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
352
369
|
const BASELINE_SIZE = 48;
|
|
353
370
|
const scaleFactor = size / BASELINE_SIZE;
|
|
354
|
-
const effectiveAmplitude =
|
|
371
|
+
const effectiveAmplitude = React2__namespace.useMemo(
|
|
355
372
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
356
373
|
[amplitude, scaleFactor]
|
|
357
374
|
);
|
|
358
|
-
const effectiveWavelength =
|
|
375
|
+
const effectiveWavelength = React2__namespace.useMemo(
|
|
359
376
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
360
377
|
[wavelength, scaleFactor]
|
|
361
378
|
);
|
|
362
|
-
const
|
|
379
|
+
const resolvedAmplitudeRange = React2__namespace.useMemo(
|
|
380
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
381
|
+
[amplitudeRange, effectiveAmplitude]
|
|
382
|
+
);
|
|
383
|
+
const wavyActivePath = React2__namespace.useMemo(
|
|
363
384
|
() => isWavy ? generateWavyCircularPath(
|
|
364
385
|
center,
|
|
365
386
|
radius,
|
|
@@ -368,8 +389,8 @@ var CircularProgress = React9__namespace.forwardRef(
|
|
|
368
389
|
) : null,
|
|
369
390
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
370
391
|
);
|
|
371
|
-
const circumference =
|
|
372
|
-
const gapForTrack =
|
|
392
|
+
const circumference = React2__namespace.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
393
|
+
const gapForTrack = React2__namespace.useMemo(
|
|
373
394
|
() => (gapSize + trackHeight) / circumference,
|
|
374
395
|
[gapSize, trackHeight, circumference]
|
|
375
396
|
);
|
|
@@ -378,6 +399,145 @@ var CircularProgress = React9__namespace.forwardRef(
|
|
|
378
399
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
379
400
|
const ActiveCircleElem = react.m.circle;
|
|
380
401
|
const ActivePathElem = react.m.path;
|
|
402
|
+
const indeterminateSvgRef = React2__namespace.useRef(null);
|
|
403
|
+
const indeterminateTrackRef = React2__namespace.useRef(null);
|
|
404
|
+
const indeterminateActiveRef = React2__namespace.useRef(null);
|
|
405
|
+
const indeterminateWavyTrackPathRef = React2__namespace.useRef(null);
|
|
406
|
+
const indeterminateWavyActivePathRef = React2__namespace.useRef(null);
|
|
407
|
+
const cachedPathLengthRef = React2__namespace.useRef(0);
|
|
408
|
+
React2__namespace.useLayoutEffect(() => {
|
|
409
|
+
if (!isWavy || !wavyActivePath) {
|
|
410
|
+
cachedPathLengthRef.current = circumference;
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const el = indeterminateActiveRef.current;
|
|
414
|
+
if (el && "getTotalLength" in el) {
|
|
415
|
+
try {
|
|
416
|
+
const len = el.getTotalLength();
|
|
417
|
+
if (len > 0) {
|
|
418
|
+
cachedPathLengthRef.current = len;
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
} catch (e) {
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
cachedPathLengthRef.current = circumference;
|
|
425
|
+
}, [isWavy, circumference, wavyActivePath]);
|
|
426
|
+
react.useAnimationFrame((time) => {
|
|
427
|
+
if (isDeterminate) return;
|
|
428
|
+
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
429
|
+
const scaledTime = time * safeCrawlerSpeed;
|
|
430
|
+
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
431
|
+
const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
|
|
432
|
+
const additionalFullCycles = Math.floor(
|
|
433
|
+
scaledTime / ADDITIONAL_ROTATION_CYCLE
|
|
434
|
+
);
|
|
435
|
+
const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
|
|
436
|
+
const additionalEaseT = Math.min(
|
|
437
|
+
1,
|
|
438
|
+
additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
|
|
439
|
+
);
|
|
440
|
+
const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
|
|
441
|
+
const totalRotation = globalAngle + additionalAngle;
|
|
442
|
+
if (indeterminateSvgRef.current) {
|
|
443
|
+
indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
|
|
444
|
+
}
|
|
445
|
+
const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
|
|
446
|
+
const progressCycleTime = scaledTime % progressFullCycle;
|
|
447
|
+
let progress;
|
|
448
|
+
if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
|
|
449
|
+
const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
|
|
450
|
+
progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
|
|
451
|
+
} else {
|
|
452
|
+
const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
|
|
453
|
+
progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
|
|
454
|
+
}
|
|
455
|
+
if (isWavy) {
|
|
456
|
+
const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
|
|
457
|
+
const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
|
|
458
|
+
const dynamicPath = generateWavyCircularPath(
|
|
459
|
+
center,
|
|
460
|
+
radius,
|
|
461
|
+
currentAmplitude,
|
|
462
|
+
effectiveWavelength
|
|
463
|
+
);
|
|
464
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
465
|
+
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
466
|
+
}
|
|
467
|
+
if (indeterminateWavyTrackPathRef.current) {
|
|
468
|
+
indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
469
|
+
}
|
|
470
|
+
const pathEl = indeterminateWavyActivePathRef.current;
|
|
471
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
472
|
+
if (pathEl) {
|
|
473
|
+
try {
|
|
474
|
+
const len = pathEl.getTotalLength();
|
|
475
|
+
if (len > 0) totalLen = len;
|
|
476
|
+
} catch (e) {
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
480
|
+
const activeLen = totalLen * progress;
|
|
481
|
+
const activeOff = 0;
|
|
482
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
483
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
484
|
+
"stroke-dasharray",
|
|
485
|
+
`${activeLen} ${totalLen}`
|
|
486
|
+
);
|
|
487
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
488
|
+
"stroke-dashoffset",
|
|
489
|
+
`${activeOff}`
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
|
|
493
|
+
const trackStartFrac = progress + gapFrac;
|
|
494
|
+
const trackLen = Math.max(
|
|
495
|
+
1e-3,
|
|
496
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
497
|
+
);
|
|
498
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
499
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
500
|
+
"stroke-dasharray",
|
|
501
|
+
`${trackLen} ${totalLen}`
|
|
502
|
+
);
|
|
503
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
504
|
+
"stroke-dashoffset",
|
|
505
|
+
`${trackOff}`
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
} else {
|
|
509
|
+
const totalLen = circumference;
|
|
510
|
+
const activeLen = totalLen * progress;
|
|
511
|
+
const activeOff = 0;
|
|
512
|
+
if (indeterminateActiveRef.current) {
|
|
513
|
+
indeterminateActiveRef.current.setAttribute(
|
|
514
|
+
"stroke-dasharray",
|
|
515
|
+
`${activeLen} ${totalLen}`
|
|
516
|
+
);
|
|
517
|
+
indeterminateActiveRef.current.setAttribute(
|
|
518
|
+
"stroke-dashoffset",
|
|
519
|
+
`${activeOff}`
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
|
|
523
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
524
|
+
const trackStartFrac = progress + gapFrac;
|
|
525
|
+
const trackLen = Math.max(
|
|
526
|
+
1e-3,
|
|
527
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
528
|
+
);
|
|
529
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
530
|
+
indeterminateTrackRef.current.setAttribute(
|
|
531
|
+
"stroke-dasharray",
|
|
532
|
+
`${trackLen} ${totalLen}`
|
|
533
|
+
);
|
|
534
|
+
indeterminateTrackRef.current.setAttribute(
|
|
535
|
+
"stroke-dashoffset",
|
|
536
|
+
`${trackOff}`
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
});
|
|
381
541
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
382
542
|
"div",
|
|
383
543
|
__spreadProps(__spreadValues({
|
|
@@ -454,9 +614,10 @@ var CircularProgress = React9__namespace.forwardRef(
|
|
|
454
614
|
]
|
|
455
615
|
}
|
|
456
616
|
),
|
|
457
|
-
!isDeterminate && /* @__PURE__ */ jsxRuntime.
|
|
458
|
-
|
|
617
|
+
!isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
618
|
+
"svg",
|
|
459
619
|
{
|
|
620
|
+
ref: indeterminateSvgRef,
|
|
460
621
|
width: size,
|
|
461
622
|
height: size,
|
|
462
623
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -465,84 +626,60 @@ var CircularProgress = React9__namespace.forwardRef(
|
|
|
465
626
|
position: "absolute",
|
|
466
627
|
inset: 0,
|
|
467
628
|
overflow: "visible",
|
|
468
|
-
transformOrigin: "center"
|
|
469
|
-
|
|
470
|
-
animate: { rotate: [0, 360] },
|
|
471
|
-
transition: {
|
|
472
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
473
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
474
|
-
ease: "linear"
|
|
629
|
+
transformOrigin: "center",
|
|
630
|
+
transform: "rotate(-90deg)"
|
|
475
631
|
},
|
|
476
|
-
children: [
|
|
477
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
478
|
-
|
|
632
|
+
children: isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
633
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
634
|
+
"path",
|
|
479
635
|
{
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
r: radius,
|
|
636
|
+
ref: indeterminateWavyTrackPathRef,
|
|
637
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
483
638
|
fill: "none",
|
|
484
639
|
stroke: bgTrackColor,
|
|
485
640
|
strokeWidth: trackHeight,
|
|
486
|
-
strokeLinecap: "round"
|
|
487
|
-
animate: {
|
|
488
|
-
pathLength: [
|
|
489
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
490
|
-
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
491
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
492
|
-
],
|
|
493
|
-
pathOffset: [
|
|
494
|
-
0.1 + gapForTrack,
|
|
495
|
-
0.75 + gapForTrack,
|
|
496
|
-
0.1 + gapForTrack
|
|
497
|
-
]
|
|
498
|
-
},
|
|
499
|
-
transition: {
|
|
500
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
501
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
502
|
-
ease: [0.4, 0, 0.2, 1]
|
|
503
|
-
}
|
|
641
|
+
strokeLinecap: "round"
|
|
504
642
|
}
|
|
505
643
|
),
|
|
506
|
-
|
|
507
|
-
|
|
644
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
645
|
+
"path",
|
|
508
646
|
{
|
|
647
|
+
ref: indeterminateWavyActivePathRef,
|
|
509
648
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
510
649
|
fill: "none",
|
|
511
650
|
stroke: activeColor,
|
|
512
651
|
strokeWidth: trackHeight,
|
|
513
|
-
strokeLinecap: "round"
|
|
514
|
-
animate: {
|
|
515
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
516
|
-
pathOffset: [0, 0.65, 1]
|
|
517
|
-
},
|
|
518
|
-
transition: {
|
|
519
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
520
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
521
|
-
ease: [0.4, 0, 0.2, 1]
|
|
522
|
-
}
|
|
652
|
+
strokeLinecap: "round"
|
|
523
653
|
}
|
|
524
|
-
)
|
|
525
|
-
|
|
654
|
+
)
|
|
655
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
656
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
657
|
+
"circle",
|
|
526
658
|
{
|
|
659
|
+
ref: indeterminateTrackRef,
|
|
660
|
+
cx: center,
|
|
661
|
+
cy: center,
|
|
662
|
+
r: radius,
|
|
663
|
+
fill: "none",
|
|
664
|
+
stroke: bgTrackColor,
|
|
665
|
+
strokeWidth: trackHeight,
|
|
666
|
+
strokeLinecap: "round"
|
|
667
|
+
}
|
|
668
|
+
),
|
|
669
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
670
|
+
"circle",
|
|
671
|
+
{
|
|
672
|
+
ref: indeterminateActiveRef,
|
|
527
673
|
cx: center,
|
|
528
674
|
cy: center,
|
|
529
675
|
r: radius,
|
|
530
676
|
fill: "none",
|
|
531
677
|
stroke: activeColor,
|
|
532
678
|
strokeWidth: trackHeight,
|
|
533
|
-
strokeLinecap: "round"
|
|
534
|
-
animate: {
|
|
535
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
536
|
-
pathOffset: [0, 0.65, 1]
|
|
537
|
-
},
|
|
538
|
-
transition: {
|
|
539
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
540
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
541
|
-
ease: [0.4, 0, 0.2, 1]
|
|
542
|
-
}
|
|
679
|
+
strokeLinecap: "round"
|
|
543
680
|
}
|
|
544
681
|
)
|
|
545
|
-
]
|
|
682
|
+
] })
|
|
546
683
|
}
|
|
547
684
|
)
|
|
548
685
|
] })
|
|
@@ -552,9 +689,9 @@ var CircularProgress = React9__namespace.forwardRef(
|
|
|
552
689
|
);
|
|
553
690
|
CircularProgress.displayName = "CircularProgress";
|
|
554
691
|
function useContainerWidth() {
|
|
555
|
-
const [width, setWidth] =
|
|
556
|
-
const observerRef =
|
|
557
|
-
const ref =
|
|
692
|
+
const [width, setWidth] = React2__namespace.useState(0);
|
|
693
|
+
const observerRef = React2__namespace.useRef(null);
|
|
694
|
+
const ref = React2__namespace.useCallback((node) => {
|
|
558
695
|
if (observerRef.current) {
|
|
559
696
|
observerRef.current.disconnect();
|
|
560
697
|
observerRef.current = null;
|
|
@@ -568,7 +705,7 @@ function useContainerWidth() {
|
|
|
568
705
|
observerRef.current = obs;
|
|
569
706
|
}
|
|
570
707
|
}, []);
|
|
571
|
-
|
|
708
|
+
React2__namespace.useEffect(() => {
|
|
572
709
|
return () => {
|
|
573
710
|
if (observerRef.current) {
|
|
574
711
|
observerRef.current.disconnect();
|
|
@@ -578,7 +715,7 @@ function useContainerWidth() {
|
|
|
578
715
|
return [ref, width];
|
|
579
716
|
}
|
|
580
717
|
function useMergedRef(...refs) {
|
|
581
|
-
return
|
|
718
|
+
return React2__namespace.useCallback(
|
|
582
719
|
(node) => {
|
|
583
720
|
for (const ref of refs) {
|
|
584
721
|
if (typeof ref === "function") {
|
|
@@ -592,7 +729,7 @@ function useMergedRef(...refs) {
|
|
|
592
729
|
[refs]
|
|
593
730
|
);
|
|
594
731
|
}
|
|
595
|
-
var FlatLinearTrack =
|
|
732
|
+
var FlatLinearTrack = React2__namespace.memo(function FlatLinearTrack2({
|
|
596
733
|
trackHeight,
|
|
597
734
|
activeColor,
|
|
598
735
|
trackColor,
|
|
@@ -668,7 +805,7 @@ var FlatLinearTrack = React9__namespace.memo(function FlatLinearTrack2({
|
|
|
668
805
|
}
|
|
669
806
|
);
|
|
670
807
|
});
|
|
671
|
-
var WavyLinearTrack =
|
|
808
|
+
var WavyLinearTrack = React2__namespace.memo(function WavyLinearTrack2({
|
|
672
809
|
trackHeight,
|
|
673
810
|
svgHeight,
|
|
674
811
|
amplitude,
|
|
@@ -687,13 +824,13 @@ var WavyLinearTrack = React9__namespace.memo(function WavyLinearTrack2({
|
|
|
687
824
|
}) {
|
|
688
825
|
const isDeterminate = typeof value === "number";
|
|
689
826
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
690
|
-
const titleId =
|
|
827
|
+
const titleId = React2__namespace.useId();
|
|
691
828
|
const [containerRef, width] = useContainerWidth();
|
|
692
|
-
const activePathRef =
|
|
693
|
-
const trackPathRef =
|
|
829
|
+
const activePathRef = React2__namespace.useRef(null);
|
|
830
|
+
const trackPathRef = React2__namespace.useRef(null);
|
|
694
831
|
const amplitudeMV = react.useMotionValue(amplitude);
|
|
695
832
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
696
|
-
|
|
833
|
+
React2__namespace.useEffect(() => {
|
|
697
834
|
if (isDeterminate) {
|
|
698
835
|
const fraction = clampedValue / 100;
|
|
699
836
|
let targetAmp = amplitude;
|
|
@@ -748,7 +885,7 @@ var WavyLinearTrack = React9__namespace.memo(function WavyLinearTrack2({
|
|
|
748
885
|
currentAmp
|
|
749
886
|
);
|
|
750
887
|
} else if (fraction === 0) {
|
|
751
|
-
activePathD =
|
|
888
|
+
activePathD = "";
|
|
752
889
|
}
|
|
753
890
|
const trackStart = adjHead + totalGap;
|
|
754
891
|
if (trackStart < width - capWidth) {
|
|
@@ -780,20 +917,20 @@ var WavyLinearTrack = React9__namespace.memo(function WavyLinearTrack2({
|
|
|
780
917
|
activeLines.push({ tail: l1T, head: l1H });
|
|
781
918
|
activeLines.push({ tail: l2T, head: l2H });
|
|
782
919
|
}
|
|
783
|
-
const
|
|
784
|
-
const
|
|
785
|
-
const
|
|
920
|
+
const activeSegments = activeLines.map((line) => {
|
|
921
|
+
const rawTail = line.tail * width;
|
|
922
|
+
const rawHead = line.head * width;
|
|
786
923
|
const adjTail = Math.max(
|
|
787
924
|
capWidth,
|
|
788
|
-
Math.min(width - capWidth,
|
|
925
|
+
Math.min(width - capWidth, rawTail)
|
|
789
926
|
);
|
|
790
927
|
const adjHead = Math.max(
|
|
791
928
|
capWidth,
|
|
792
|
-
Math.min(width - capWidth,
|
|
929
|
+
Math.min(width - capWidth, rawHead)
|
|
793
930
|
);
|
|
794
931
|
return { adjTail, adjHead };
|
|
795
932
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
796
|
-
activePathD =
|
|
933
|
+
activePathD = activeSegments.map(
|
|
797
934
|
(seg) => getSinePath(
|
|
798
935
|
seg.adjTail,
|
|
799
936
|
seg.adjHead,
|
|
@@ -802,13 +939,24 @@ var WavyLinearTrack = React9__namespace.memo(function WavyLinearTrack2({
|
|
|
802
939
|
currentAmp
|
|
803
940
|
)
|
|
804
941
|
).join(" ");
|
|
942
|
+
const validActiveLines = activeLines.filter(
|
|
943
|
+
(line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
|
|
944
|
+
).sort((a, b) => a.tail - b.tail);
|
|
805
945
|
let currentTrackX = capWidth;
|
|
806
|
-
for (const
|
|
807
|
-
const
|
|
946
|
+
for (const line of validActiveLines) {
|
|
947
|
+
const blockStart = line.tail * width - totalGap;
|
|
948
|
+
const blockEnd = line.head * width + totalGap;
|
|
949
|
+
const trackEnd = Math.min(width - capWidth, blockStart);
|
|
808
950
|
if (trackEnd > currentTrackX) {
|
|
809
|
-
trackD += `${getSinePath(
|
|
951
|
+
trackD += `${getSinePath(
|
|
952
|
+
currentTrackX,
|
|
953
|
+
trackEnd,
|
|
954
|
+
phase,
|
|
955
|
+
activeWavelength,
|
|
956
|
+
trackAmp
|
|
957
|
+
)} `;
|
|
810
958
|
}
|
|
811
|
-
currentTrackX = Math.max(currentTrackX,
|
|
959
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
812
960
|
}
|
|
813
961
|
if (currentTrackX < width - capWidth) {
|
|
814
962
|
trackD += getSinePath(
|
|
@@ -821,9 +969,9 @@ var WavyLinearTrack = React9__namespace.memo(function WavyLinearTrack2({
|
|
|
821
969
|
}
|
|
822
970
|
}
|
|
823
971
|
if (activePathRef.current)
|
|
824
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
972
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
825
973
|
if (trackPathRef.current)
|
|
826
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
974
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
827
975
|
});
|
|
828
976
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
829
977
|
"div",
|
|
@@ -870,7 +1018,7 @@ var WavyLinearTrack = React9__namespace.memo(function WavyLinearTrack2({
|
|
|
870
1018
|
}
|
|
871
1019
|
);
|
|
872
1020
|
});
|
|
873
|
-
var LinearProgress =
|
|
1021
|
+
var LinearProgress = React2__namespace.forwardRef(
|
|
874
1022
|
(_a, ref) => {
|
|
875
1023
|
var _b = _a, {
|
|
876
1024
|
value,
|
|
@@ -911,10 +1059,10 @@ var LinearProgress = React9__namespace.forwardRef(
|
|
|
911
1059
|
]);
|
|
912
1060
|
const isDeterminate = value !== void 0;
|
|
913
1061
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
914
|
-
const containerRef =
|
|
1062
|
+
const containerRef = React2__namespace.useRef(null);
|
|
915
1063
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
916
|
-
const [isRtl, setIsRtl] =
|
|
917
|
-
|
|
1064
|
+
const [isRtl, setIsRtl] = React2__namespace.useState(false);
|
|
1065
|
+
React2__namespace.useEffect(() => {
|
|
918
1066
|
if (containerRef.current) {
|
|
919
1067
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
920
1068
|
setIsRtl(dir === "rtl");
|
|
@@ -922,16 +1070,16 @@ var LinearProgress = React9__namespace.forwardRef(
|
|
|
922
1070
|
}, []);
|
|
923
1071
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
924
1072
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
925
|
-
const effectiveAmplitude =
|
|
926
|
-
const svgHeight =
|
|
1073
|
+
const effectiveAmplitude = React2__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1074
|
+
const svgHeight = React2__namespace.useMemo(
|
|
927
1075
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
928
1076
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
929
1077
|
);
|
|
930
|
-
const shouldShowStop =
|
|
1078
|
+
const shouldShowStop = React2__namespace.useMemo(
|
|
931
1079
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
932
1080
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
933
1081
|
);
|
|
934
|
-
const stopSize =
|
|
1082
|
+
const stopSize = React2__namespace.useMemo(
|
|
935
1083
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
936
1084
|
[trackHeight]
|
|
937
1085
|
);
|
|
@@ -1006,14 +1154,14 @@ var LinearProgress = React9__namespace.forwardRef(
|
|
|
1006
1154
|
}
|
|
1007
1155
|
);
|
|
1008
1156
|
LinearProgress.displayName = "LinearProgress";
|
|
1009
|
-
var ProgressIndicator =
|
|
1157
|
+
var ProgressIndicator = React2__namespace.forwardRef((props, ref) => {
|
|
1010
1158
|
if (props.variant === "circular") {
|
|
1011
1159
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1012
1160
|
}
|
|
1013
1161
|
return /* @__PURE__ */ jsxRuntime.jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
1014
1162
|
});
|
|
1015
1163
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
1016
|
-
var RippleItem =
|
|
1164
|
+
var RippleItem = React2__namespace.memo(function RippleItem2({
|
|
1017
1165
|
ripple,
|
|
1018
1166
|
onDone
|
|
1019
1167
|
}) {
|
|
@@ -1057,8 +1205,8 @@ function Ripple({
|
|
|
1057
1205
|
}
|
|
1058
1206
|
function useRippleState(options = {}) {
|
|
1059
1207
|
const { disabled = false } = options;
|
|
1060
|
-
const [ripples, setRipples] =
|
|
1061
|
-
const onPointerDown =
|
|
1208
|
+
const [ripples, setRipples] = React2__namespace.useState([]);
|
|
1209
|
+
const onPointerDown = React2__namespace.useCallback(
|
|
1062
1210
|
(e) => {
|
|
1063
1211
|
if (disabled) return;
|
|
1064
1212
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1075,7 +1223,7 @@ function useRippleState(options = {}) {
|
|
|
1075
1223
|
},
|
|
1076
1224
|
[disabled]
|
|
1077
1225
|
);
|
|
1078
|
-
const removeRipple =
|
|
1226
|
+
const removeRipple = React2__namespace.useCallback((id) => {
|
|
1079
1227
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1080
1228
|
}, []);
|
|
1081
1229
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1310,7 +1458,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1310
1458
|
}
|
|
1311
1459
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1312
1460
|
}
|
|
1313
|
-
var IconButtonComponent =
|
|
1461
|
+
var IconButtonComponent = React2__namespace.forwardRef(
|
|
1314
1462
|
(_a, ref) => {
|
|
1315
1463
|
var _b = _a, {
|
|
1316
1464
|
className,
|
|
@@ -1318,7 +1466,7 @@ var IconButtonComponent = React9__namespace.forwardRef(
|
|
|
1318
1466
|
variant = "default",
|
|
1319
1467
|
colorStyle = "standard",
|
|
1320
1468
|
size = "sm",
|
|
1321
|
-
|
|
1469
|
+
width = "default",
|
|
1322
1470
|
shape = "round",
|
|
1323
1471
|
selected,
|
|
1324
1472
|
selectedIcon,
|
|
@@ -1336,7 +1484,7 @@ var IconButtonComponent = React9__namespace.forwardRef(
|
|
|
1336
1484
|
"variant",
|
|
1337
1485
|
"colorStyle",
|
|
1338
1486
|
"size",
|
|
1339
|
-
"
|
|
1487
|
+
"width",
|
|
1340
1488
|
"shape",
|
|
1341
1489
|
"selected",
|
|
1342
1490
|
"selectedIcon",
|
|
@@ -1352,18 +1500,18 @@ var IconButtonComponent = React9__namespace.forwardRef(
|
|
|
1352
1500
|
var _a2, _b2, _c, _d, _e;
|
|
1353
1501
|
const isToggle = variant === "toggle";
|
|
1354
1502
|
const isSelected = isToggle && !!selected;
|
|
1355
|
-
const resolvedColorClass =
|
|
1503
|
+
const resolvedColorClass = React2__namespace.useMemo(
|
|
1356
1504
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1357
1505
|
[isSelected, colorStyle]
|
|
1358
1506
|
);
|
|
1359
|
-
const outlineWidthClass =
|
|
1507
|
+
const outlineWidthClass = React2__namespace.useMemo(
|
|
1360
1508
|
() => {
|
|
1361
1509
|
var _a3;
|
|
1362
1510
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1363
1511
|
},
|
|
1364
1512
|
[colorStyle, isSelected, size]
|
|
1365
1513
|
);
|
|
1366
|
-
const disabledBgClass =
|
|
1514
|
+
const disabledBgClass = React2__namespace.useMemo(
|
|
1367
1515
|
() => resolveDisabledBgClass(colorStyle),
|
|
1368
1516
|
[colorStyle]
|
|
1369
1517
|
);
|
|
@@ -1381,12 +1529,12 @@ var IconButtonComponent = React9__namespace.forwardRef(
|
|
|
1381
1529
|
const iconPx = iconSize != null ? iconSize : defaultIconPx;
|
|
1382
1530
|
const isCustomSize = iconSize != null && iconSize !== "inherit";
|
|
1383
1531
|
const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
|
|
1384
|
-
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[
|
|
1532
|
+
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[width]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
|
|
1385
1533
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1386
1534
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1387
1535
|
disabled: loading
|
|
1388
1536
|
});
|
|
1389
|
-
const handleClick =
|
|
1537
|
+
const handleClick = React2__namespace.useCallback(
|
|
1390
1538
|
(e) => {
|
|
1391
1539
|
if (loading) {
|
|
1392
1540
|
e.preventDefault();
|
|
@@ -1396,7 +1544,7 @@ var IconButtonComponent = React9__namespace.forwardRef(
|
|
|
1396
1544
|
},
|
|
1397
1545
|
[loading, onClick]
|
|
1398
1546
|
);
|
|
1399
|
-
const handleKeyDown =
|
|
1547
|
+
const handleKeyDown = React2__namespace.useCallback(
|
|
1400
1548
|
(e) => {
|
|
1401
1549
|
if (loading) return;
|
|
1402
1550
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1452,7 +1600,7 @@ var IconButtonComponent = React9__namespace.forwardRef(
|
|
|
1452
1600
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1453
1601
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1454
1602
|
},
|
|
1455
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
1603
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React2__namespace.Children.only(children).props.children : children
|
|
1456
1604
|
}),
|
|
1457
1605
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1458
1606
|
) })
|
|
@@ -1469,7 +1617,7 @@ var IconButtonComponent = React9__namespace.forwardRef(
|
|
|
1469
1617
|
className
|
|
1470
1618
|
);
|
|
1471
1619
|
if (asChild) {
|
|
1472
|
-
const child =
|
|
1620
|
+
const child = React2__namespace.Children.only(children);
|
|
1473
1621
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1474
1622
|
reactSlot.Slot,
|
|
1475
1623
|
__spreadProps(__spreadValues({
|
|
@@ -1486,7 +1634,7 @@ var IconButtonComponent = React9__namespace.forwardRef(
|
|
|
1486
1634
|
}),
|
|
1487
1635
|
className: containerClassName
|
|
1488
1636
|
}, restProps), {
|
|
1489
|
-
children:
|
|
1637
|
+
children: React2__namespace.cloneElement(child, { children: innerContent })
|
|
1490
1638
|
})
|
|
1491
1639
|
) });
|
|
1492
1640
|
}
|
|
@@ -1514,13 +1662,13 @@ var IconButtonComponent = React9__namespace.forwardRef(
|
|
|
1514
1662
|
}
|
|
1515
1663
|
);
|
|
1516
1664
|
IconButtonComponent.displayName = "IconButton";
|
|
1517
|
-
var IconButton =
|
|
1665
|
+
var IconButton = React2__namespace.memo(IconButtonComponent);
|
|
1518
1666
|
var VARIANT_FONT = {
|
|
1519
1667
|
outlined: "'Material Symbols Outlined'",
|
|
1520
1668
|
rounded: "'Material Symbols Rounded'",
|
|
1521
1669
|
sharp: "'Material Symbols Sharp'"
|
|
1522
1670
|
};
|
|
1523
|
-
var IconComponent =
|
|
1671
|
+
var IconComponent = React2__namespace.forwardRef(
|
|
1524
1672
|
(_a, ref) => {
|
|
1525
1673
|
var _b = _a, {
|
|
1526
1674
|
name,
|
|
@@ -1586,8 +1734,8 @@ var IconComponent = React9__namespace.forwardRef(
|
|
|
1586
1734
|
}
|
|
1587
1735
|
);
|
|
1588
1736
|
IconComponent.displayName = "Icon";
|
|
1589
|
-
var Icon =
|
|
1590
|
-
var ScrollArea =
|
|
1737
|
+
var Icon = React2__namespace.memo(IconComponent);
|
|
1738
|
+
var ScrollArea = React2__namespace.forwardRef(
|
|
1591
1739
|
(_a, ref) => {
|
|
1592
1740
|
var _b = _a, {
|
|
1593
1741
|
className,
|
|
@@ -1608,15 +1756,15 @@ var ScrollArea = React9__namespace.forwardRef(
|
|
|
1608
1756
|
"viewportRef",
|
|
1609
1757
|
"viewportProps"
|
|
1610
1758
|
]);
|
|
1611
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
1612
|
-
|
|
1759
|
+
const [isTouchDevice, setIsTouchDevice] = React2__namespace.useState(false);
|
|
1760
|
+
React2__namespace.useEffect(() => {
|
|
1613
1761
|
if (typeof window !== "undefined") {
|
|
1614
1762
|
setIsTouchDevice(
|
|
1615
1763
|
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
1616
1764
|
);
|
|
1617
1765
|
}
|
|
1618
1766
|
}, []);
|
|
1619
|
-
const resolvedType =
|
|
1767
|
+
const resolvedType = React2__namespace.useMemo(() => {
|
|
1620
1768
|
if (type === "hover" && isTouchDevice) {
|
|
1621
1769
|
return "scroll";
|
|
1622
1770
|
}
|
|
@@ -1667,7 +1815,7 @@ var ScrollArea = React9__namespace.forwardRef(
|
|
|
1667
1815
|
}
|
|
1668
1816
|
);
|
|
1669
1817
|
ScrollArea.displayName = "ScrollArea";
|
|
1670
|
-
var ScrollAreaScrollbar =
|
|
1818
|
+
var ScrollAreaScrollbar = React2__namespace.forwardRef((_a, ref) => {
|
|
1671
1819
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
1672
1820
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1673
1821
|
RadixScrollArea__namespace.Scrollbar,
|
|
@@ -1697,7 +1845,7 @@ var ScrollAreaScrollbar = React9__namespace.forwardRef((_a, ref) => {
|
|
|
1697
1845
|
);
|
|
1698
1846
|
});
|
|
1699
1847
|
ScrollAreaScrollbar.displayName = RadixScrollArea__namespace.Scrollbar.displayName;
|
|
1700
|
-
var ScrollAreaCorner =
|
|
1848
|
+
var ScrollAreaCorner = React2__namespace.forwardRef((_a, ref) => {
|
|
1701
1849
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1702
1850
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1703
1851
|
RadixScrollArea__namespace.Corner,
|
|
@@ -1739,9 +1887,9 @@ DialogTrigger.displayName = "DialogTrigger";
|
|
|
1739
1887
|
var DialogPortal = ({
|
|
1740
1888
|
open,
|
|
1741
1889
|
children
|
|
1742
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { forceMount: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: open ?
|
|
1890
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { forceMount: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: open ? React2__namespace.Children.toArray(children) : null }) });
|
|
1743
1891
|
DialogPortal.displayName = "DialogPortal";
|
|
1744
|
-
var DialogOverlay =
|
|
1892
|
+
var DialogOverlay = React2__namespace.forwardRef((_a, ref) => {
|
|
1745
1893
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1746
1894
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1747
1895
|
react.m.div,
|
|
@@ -1752,7 +1900,7 @@ var DialogOverlay = React9__namespace.forwardRef((_a, ref) => {
|
|
|
1752
1900
|
) }));
|
|
1753
1901
|
});
|
|
1754
1902
|
DialogOverlay.displayName = "DialogOverlay";
|
|
1755
|
-
var DialogContent =
|
|
1903
|
+
var DialogContent = React2__namespace.forwardRef((_a, ref) => {
|
|
1756
1904
|
var _b = _a, { className, children, hideCloseButton = false } = _b, props = __objRest(_b, ["className", "children", "hideCloseButton"]);
|
|
1757
1905
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1758
1906
|
RadixDialog__namespace.Content,
|
|
@@ -1792,7 +1940,7 @@ var DialogContent = React9__namespace.forwardRef((_a, ref) => {
|
|
|
1792
1940
|
);
|
|
1793
1941
|
});
|
|
1794
1942
|
DialogContent.displayName = "DialogContent";
|
|
1795
|
-
var DialogIcon =
|
|
1943
|
+
var DialogIcon = React2__namespace.forwardRef((_a, ref) => {
|
|
1796
1944
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
1797
1945
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1798
1946
|
"div",
|
|
@@ -1815,7 +1963,7 @@ var DialogHeader = (_a) => {
|
|
|
1815
1963
|
return /* @__PURE__ */ jsxRuntime.jsx("div", __spreadValues({ className: cn("flex flex-col gap-2 mb-4", className) }, props));
|
|
1816
1964
|
};
|
|
1817
1965
|
DialogHeader.displayName = "DialogHeader";
|
|
1818
|
-
var DialogTitle =
|
|
1966
|
+
var DialogTitle = React2__namespace.forwardRef((_a, ref) => {
|
|
1819
1967
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
1820
1968
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1821
1969
|
RadixDialog__namespace.Title,
|
|
@@ -1830,7 +1978,7 @@ var DialogTitle = React9__namespace.forwardRef((_a, ref) => {
|
|
|
1830
1978
|
);
|
|
1831
1979
|
});
|
|
1832
1980
|
DialogTitle.displayName = "DialogTitle";
|
|
1833
|
-
var DialogDescription =
|
|
1981
|
+
var DialogDescription = React2__namespace.forwardRef((_a, ref) => {
|
|
1834
1982
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
1835
1983
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1836
1984
|
RadixDialog__namespace.Description,
|
|
@@ -1842,7 +1990,7 @@ var DialogDescription = React9__namespace.forwardRef((_a, ref) => {
|
|
|
1842
1990
|
);
|
|
1843
1991
|
});
|
|
1844
1992
|
DialogDescription.displayName = "DialogDescription";
|
|
1845
|
-
var DialogBody =
|
|
1993
|
+
var DialogBody = React2__namespace.forwardRef((_a, ref) => {
|
|
1846
1994
|
var _b = _a, { className, children, dir } = _b, props = __objRest(_b, ["className", "children", "dir"]);
|
|
1847
1995
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1848
1996
|
ScrollArea,
|
|
@@ -1873,7 +2021,7 @@ var DialogFooter = (_a) => {
|
|
|
1873
2021
|
};
|
|
1874
2022
|
DialogFooter.displayName = "DialogFooter";
|
|
1875
2023
|
var DialogClose = RadixDialog__namespace.Close;
|
|
1876
|
-
var DialogFullScreenContent =
|
|
2024
|
+
var DialogFullScreenContent = React2__namespace.forwardRef(
|
|
1877
2025
|
(_a, ref) => {
|
|
1878
2026
|
var _b = _a, {
|
|
1879
2027
|
className,
|
|
@@ -1970,7 +2118,7 @@ var DrawerPortal = ({
|
|
|
1970
2118
|
open,
|
|
1971
2119
|
children
|
|
1972
2120
|
}) => /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { forceMount: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", children: open && children }) });
|
|
1973
|
-
var DrawerOverlay =
|
|
2121
|
+
var DrawerOverlay = React2__namespace.forwardRef((_a, ref) => {
|
|
1974
2122
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1975
2123
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1976
2124
|
react.m.div,
|
|
@@ -1981,7 +2129,7 @@ var DrawerOverlay = React9__namespace.forwardRef((_a, ref) => {
|
|
|
1981
2129
|
) }));
|
|
1982
2130
|
});
|
|
1983
2131
|
DrawerOverlay.displayName = "DrawerOverlay";
|
|
1984
|
-
var DrawerContent =
|
|
2132
|
+
var DrawerContent = React2__namespace.forwardRef(
|
|
1985
2133
|
(_a, ref) => {
|
|
1986
2134
|
var _b = _a, {
|
|
1987
2135
|
className,
|
|
@@ -2060,7 +2208,7 @@ var DrawerFooter = (_a) => {
|
|
|
2060
2208
|
return /* @__PURE__ */ jsxRuntime.jsx("div", __spreadValues({ className: cn("flex flex-col gap-2 mt-4", className) }, props));
|
|
2061
2209
|
};
|
|
2062
2210
|
DrawerFooter.displayName = "DrawerFooter";
|
|
2063
|
-
var DrawerTitle =
|
|
2211
|
+
var DrawerTitle = React2__namespace.forwardRef((_a, ref) => {
|
|
2064
2212
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2065
2213
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2066
2214
|
RadixDialog__namespace.Title,
|
|
@@ -2074,7 +2222,7 @@ var DrawerTitle = React9__namespace.forwardRef((_a, ref) => {
|
|
|
2074
2222
|
);
|
|
2075
2223
|
});
|
|
2076
2224
|
DrawerTitle.displayName = "DrawerTitle";
|
|
2077
|
-
var DrawerDescription =
|
|
2225
|
+
var DrawerDescription = React2__namespace.forwardRef((_a, ref) => {
|
|
2078
2226
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2079
2227
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2080
2228
|
RadixDialog__namespace.Description,
|
|
@@ -2086,7 +2234,7 @@ var DrawerDescription = React9__namespace.forwardRef((_a, ref) => {
|
|
|
2086
2234
|
});
|
|
2087
2235
|
DrawerDescription.displayName = "DrawerDescription";
|
|
2088
2236
|
var INDICATOR = "h-1 w-8 rounded-full bg-m3-on-surface-variant/40";
|
|
2089
|
-
var DragHandle =
|
|
2237
|
+
var DragHandle = React2__namespace.forwardRef(
|
|
2090
2238
|
({ className, onCycle, "aria-label": ariaLabel }, ref) => {
|
|
2091
2239
|
const isInteractive = Boolean(onCycle);
|
|
2092
2240
|
if (isInteractive) {
|
|
@@ -2147,7 +2295,7 @@ function buildSideSheetAnim(edge) {
|
|
|
2147
2295
|
};
|
|
2148
2296
|
}
|
|
2149
2297
|
var DEFAULT_SHEET_BG = "bg-m3-surface-container-low";
|
|
2150
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
2298
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React2.useLayoutEffect : React2.useEffect;
|
|
2151
2299
|
var DISMISS_THRESHOLD = 0.4;
|
|
2152
2300
|
var DISMISS_VELOCITY_THRESHOLD = 600;
|
|
2153
2301
|
var DEFAULT_SAFE_AREA_OFFSET = 56;
|
|
@@ -2196,9 +2344,9 @@ function useBottomSheet({
|
|
|
2196
2344
|
isModal = false,
|
|
2197
2345
|
maxHeight
|
|
2198
2346
|
}) {
|
|
2199
|
-
const [scopeNode, setScopeNode] =
|
|
2200
|
-
const scopeNodeRef =
|
|
2201
|
-
const scope =
|
|
2347
|
+
const [scopeNode, setScopeNode] = React2.useState(null);
|
|
2348
|
+
const scopeNodeRef = React2.useRef(null);
|
|
2349
|
+
const scope = React2.useCallback((node) => {
|
|
2202
2350
|
scopeNodeRef.current = node;
|
|
2203
2351
|
setScopeNode(node);
|
|
2204
2352
|
}, []);
|
|
@@ -2212,13 +2360,13 @@ function useBottomSheet({
|
|
|
2212
2360
|
const y = react.useMotionValue(
|
|
2213
2361
|
typeof window !== "undefined" ? window.visualViewport ? window.visualViewport.height : window.innerHeight : 800
|
|
2214
2362
|
);
|
|
2215
|
-
const [dimensions, setDimensions] =
|
|
2363
|
+
const [dimensions, setDimensions] = React2.useState({
|
|
2216
2364
|
viewportHeight: typeof window !== "undefined" ? window.visualViewport ? window.visualViewport.height : window.innerHeight : 800,
|
|
2217
2365
|
naturalHeight: 0,
|
|
2218
2366
|
safeAreaOffset: DEFAULT_SAFE_AREA_OFFSET
|
|
2219
2367
|
});
|
|
2220
|
-
const hasMeasuredAfterOpen =
|
|
2221
|
-
const measureDimensions =
|
|
2368
|
+
const hasMeasuredAfterOpen = React2.useRef(false);
|
|
2369
|
+
const measureDimensions = React2.useCallback(() => {
|
|
2222
2370
|
const node = scopeNodeRef.current;
|
|
2223
2371
|
if (!node) return;
|
|
2224
2372
|
const viewportHeight2 = window.visualViewport ? window.visualViewport.height : window.innerHeight;
|
|
@@ -2278,7 +2426,7 @@ function useBottomSheet({
|
|
|
2278
2426
|
return () => vv.removeEventListener("resize", handleResize);
|
|
2279
2427
|
}, [isOpen, measureDimensions]);
|
|
2280
2428
|
const { viewportHeight, naturalHeight, safeAreaOffset } = dimensions;
|
|
2281
|
-
const parsedMaxHeight =
|
|
2429
|
+
const parsedMaxHeight = React2.useMemo(() => {
|
|
2282
2430
|
if (!maxHeight) return viewportHeight - safeAreaOffset;
|
|
2283
2431
|
if (maxHeight.endsWith("px")) return parseFloat(maxHeight);
|
|
2284
2432
|
if (maxHeight.endsWith("dvh") || maxHeight.endsWith("vh")) {
|
|
@@ -2289,13 +2437,13 @@ function useBottomSheet({
|
|
|
2289
2437
|
}
|
|
2290
2438
|
return parseFloat(maxHeight) || viewportHeight - safeAreaOffset;
|
|
2291
2439
|
}, [maxHeight, viewportHeight, safeAreaOffset]);
|
|
2292
|
-
const snaps =
|
|
2440
|
+
const snaps = React2.useMemo(() => {
|
|
2293
2441
|
if (snapPoints) return snapPoints;
|
|
2294
2442
|
if (isModal) return ["partiallyExpanded", "full"];
|
|
2295
2443
|
return ["fit"];
|
|
2296
2444
|
}, [snapPoints, isModal]);
|
|
2297
2445
|
const allowsViewportSnapExpansion = snapPoints !== void 0 || snaps.length > 1;
|
|
2298
|
-
const snapHeights =
|
|
2446
|
+
const snapHeights = React2.useMemo(
|
|
2299
2447
|
() => snaps.map(
|
|
2300
2448
|
(snap) => parseSnapPoint(
|
|
2301
2449
|
snap,
|
|
@@ -2315,15 +2463,15 @@ function useBottomSheet({
|
|
|
2315
2463
|
allowsViewportSnapExpansion
|
|
2316
2464
|
]
|
|
2317
2465
|
);
|
|
2318
|
-
const maxSheetHeight =
|
|
2466
|
+
const maxSheetHeight = React2.useMemo(
|
|
2319
2467
|
() => viewportHeight - safeAreaOffset,
|
|
2320
2468
|
[viewportHeight, safeAreaOffset]
|
|
2321
2469
|
);
|
|
2322
|
-
const snapYValues =
|
|
2470
|
+
const snapYValues = React2.useMemo(
|
|
2323
2471
|
() => snapHeights.map((h) => Math.max(0, maxSheetHeight - h)),
|
|
2324
2472
|
[snapHeights, maxSheetHeight]
|
|
2325
2473
|
);
|
|
2326
|
-
const sortedSnaps =
|
|
2474
|
+
const sortedSnaps = React2.useMemo(() => {
|
|
2327
2475
|
const combined = snaps.map((point, idx) => ({
|
|
2328
2476
|
point,
|
|
2329
2477
|
height: snapHeights[idx],
|
|
@@ -2331,31 +2479,31 @@ function useBottomSheet({
|
|
|
2331
2479
|
}));
|
|
2332
2480
|
return combined.sort((a, b) => b.y - a.y);
|
|
2333
2481
|
}, [snaps, snapHeights, snapYValues]);
|
|
2334
|
-
const [activeSnapIndex, setActiveSnapIndex] =
|
|
2335
|
-
const activeSnapPoint =
|
|
2482
|
+
const [activeSnapIndex, setActiveSnapIndex] = React2.useState(0);
|
|
2483
|
+
const activeSnapPoint = React2.useMemo(
|
|
2336
2484
|
() => {
|
|
2337
2485
|
var _a, _b;
|
|
2338
2486
|
return (_b = (_a = sortedSnaps[activeSnapIndex]) == null ? void 0 : _a.point) != null ? _b : "fit";
|
|
2339
2487
|
},
|
|
2340
2488
|
[sortedSnaps, activeSnapIndex]
|
|
2341
2489
|
);
|
|
2342
|
-
const isContentScrollable =
|
|
2490
|
+
const isContentScrollable = React2.useMemo(
|
|
2343
2491
|
() => sortedSnaps.length <= 1 || activeSnapIndex === sortedSnaps.length - 1,
|
|
2344
2492
|
[sortedSnaps, activeSnapIndex]
|
|
2345
2493
|
);
|
|
2346
|
-
const lowestSnapY =
|
|
2494
|
+
const lowestSnapY = React2.useMemo(() => {
|
|
2347
2495
|
var _a, _b;
|
|
2348
2496
|
return (_b = (_a = sortedSnaps[0]) == null ? void 0 : _a.y) != null ? _b : 300;
|
|
2349
2497
|
}, [sortedSnaps]);
|
|
2350
2498
|
const scrimOpacity = react.useTransform(y, [lowestSnapY, maxSheetHeight], [1, 0]);
|
|
2351
|
-
const defaultSnap =
|
|
2499
|
+
const defaultSnap = React2.useMemo(
|
|
2352
2500
|
() => {
|
|
2353
2501
|
var _a;
|
|
2354
2502
|
return (_a = defaultSnapPoint != null ? defaultSnapPoint : snaps[0]) != null ? _a : "fit";
|
|
2355
2503
|
},
|
|
2356
2504
|
[defaultSnapPoint, snaps]
|
|
2357
2505
|
);
|
|
2358
|
-
const prevIsOpen =
|
|
2506
|
+
const prevIsOpen = React2.useRef(isOpen);
|
|
2359
2507
|
useIsomorphicLayoutEffect(() => {
|
|
2360
2508
|
if (isOpen && !prevIsOpen.current) {
|
|
2361
2509
|
y.set(viewportHeight);
|
|
@@ -2372,7 +2520,7 @@ function useBottomSheet({
|
|
|
2372
2520
|
}
|
|
2373
2521
|
prevIsOpen.current = isOpen;
|
|
2374
2522
|
}, [isOpen, y, viewportHeight, sortedSnaps, defaultSnap]);
|
|
2375
|
-
|
|
2523
|
+
React2.useEffect(() => {
|
|
2376
2524
|
var _a;
|
|
2377
2525
|
if (!isOpen || sortedSnaps.length === 0 || naturalHeight === 0) return;
|
|
2378
2526
|
if (!hasMeasuredAfterOpen.current) return;
|
|
@@ -2380,7 +2528,7 @@ function useBottomSheet({
|
|
|
2380
2528
|
if (targetY === void 0) return;
|
|
2381
2529
|
void react.animate(y, targetY, { type: "spring", stiffness: 300, damping: 30 });
|
|
2382
2530
|
}, [isOpen, sortedSnaps, activeSnapIndex, y, naturalHeight]);
|
|
2383
|
-
const snapTo =
|
|
2531
|
+
const snapTo = React2.useCallback(
|
|
2384
2532
|
(snapPoint) => {
|
|
2385
2533
|
const idx = sortedSnaps.findIndex((s) => s.point === snapPoint);
|
|
2386
2534
|
if (idx === -1) return;
|
|
@@ -2394,7 +2542,7 @@ function useBottomSheet({
|
|
|
2394
2542
|
},
|
|
2395
2543
|
[sortedSnaps, y, onSnapChange]
|
|
2396
2544
|
);
|
|
2397
|
-
const cycleSnapPoint =
|
|
2545
|
+
const cycleSnapPoint = React2.useCallback(() => {
|
|
2398
2546
|
const nextIdx = activeSnapIndex + 1;
|
|
2399
2547
|
if (nextIdx >= sortedSnaps.length) {
|
|
2400
2548
|
onClose();
|
|
@@ -2408,7 +2556,7 @@ function useBottomSheet({
|
|
|
2408
2556
|
onSnapChange == null ? void 0 : onSnapChange(sortedSnaps[nextIdx].point);
|
|
2409
2557
|
}
|
|
2410
2558
|
}, [activeSnapIndex, sortedSnaps, y, onClose, onSnapChange]);
|
|
2411
|
-
const dragConstraints =
|
|
2559
|
+
const dragConstraints = React2.useMemo(
|
|
2412
2560
|
() => {
|
|
2413
2561
|
var _a, _b;
|
|
2414
2562
|
return {
|
|
@@ -2418,7 +2566,7 @@ function useBottomSheet({
|
|
|
2418
2566
|
},
|
|
2419
2567
|
[sortedSnaps, viewportHeight]
|
|
2420
2568
|
);
|
|
2421
|
-
|
|
2569
|
+
React2.useEffect(() => {
|
|
2422
2570
|
if (!isOpen || !gesturesEnabled || !scopeNode) return;
|
|
2423
2571
|
const node = scopeNode;
|
|
2424
2572
|
const viewport = node.querySelector(
|
|
@@ -2639,7 +2787,7 @@ function resolveMaxHeight(maxHeight, snapPoints) {
|
|
|
2639
2787
|
return ABSOLUTE_MAX_HEIGHT;
|
|
2640
2788
|
return maxHeight;
|
|
2641
2789
|
}
|
|
2642
|
-
var BottomSheet =
|
|
2790
|
+
var BottomSheet = React2__namespace.forwardRef(
|
|
2643
2791
|
({
|
|
2644
2792
|
isOpen,
|
|
2645
2793
|
onClose,
|
|
@@ -2672,27 +2820,27 @@ var BottomSheet = React9__namespace.forwardRef(
|
|
|
2672
2820
|
isModal: false,
|
|
2673
2821
|
maxHeight: resolveMaxHeight(maxHeight, snapPoints)
|
|
2674
2822
|
});
|
|
2675
|
-
|
|
2823
|
+
React2__namespace.useEffect(() => {
|
|
2676
2824
|
const node = scope.current;
|
|
2677
2825
|
if (node) {
|
|
2678
2826
|
node.snapTo = snapTo;
|
|
2679
2827
|
}
|
|
2680
2828
|
}, [snapTo, scope]);
|
|
2681
|
-
const [mounted, setMounted] =
|
|
2682
|
-
|
|
2829
|
+
const [mounted, setMounted] = React2__namespace.useState(false);
|
|
2830
|
+
React2__namespace.useEffect(() => {
|
|
2683
2831
|
setMounted(true);
|
|
2684
2832
|
}, []);
|
|
2685
|
-
const resolvedDividers =
|
|
2833
|
+
const resolvedDividers = React2__namespace.useMemo(
|
|
2686
2834
|
() => resolveDividers(divider),
|
|
2687
2835
|
[divider]
|
|
2688
2836
|
);
|
|
2689
|
-
const resolvedSheetMaxWidth =
|
|
2837
|
+
const resolvedSheetMaxWidth = React2__namespace.useMemo(() => {
|
|
2690
2838
|
if (sheetMaxWidth === void 0)
|
|
2691
2839
|
return "var(--m3-bottom-sheet-max-width, 640px)";
|
|
2692
2840
|
if (typeof sheetMaxWidth === "number") return `${sheetMaxWidth}px`;
|
|
2693
2841
|
return sheetMaxWidth;
|
|
2694
2842
|
}, [sheetMaxWidth]);
|
|
2695
|
-
const mergedRef =
|
|
2843
|
+
const mergedRef = React2__namespace.useCallback(
|
|
2696
2844
|
(node) => {
|
|
2697
2845
|
scope(node);
|
|
2698
2846
|
if (typeof ref === "function") ref(node);
|
|
@@ -2776,7 +2924,7 @@ var SCRIM_ANIM = {
|
|
|
2776
2924
|
},
|
|
2777
2925
|
exit: { opacity: 0, transition: { duration: 0.18, ease: "easeIn" } }
|
|
2778
2926
|
};
|
|
2779
|
-
var Scrim =
|
|
2927
|
+
var Scrim = React2__namespace.forwardRef(
|
|
2780
2928
|
({ onClick, className, style }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2781
2929
|
react.m.div,
|
|
2782
2930
|
__spreadValues({
|
|
@@ -2808,7 +2956,7 @@ function resolveSheetMaxWidth(value) {
|
|
|
2808
2956
|
if (typeof value === "number") return `${value}px`;
|
|
2809
2957
|
return value;
|
|
2810
2958
|
}
|
|
2811
|
-
var BottomSheetModal =
|
|
2959
|
+
var BottomSheetModal = React2__namespace.forwardRef(
|
|
2812
2960
|
({
|
|
2813
2961
|
isOpen,
|
|
2814
2962
|
onClose,
|
|
@@ -2847,21 +2995,21 @@ var BottomSheetModal = React9__namespace.forwardRef(
|
|
|
2847
2995
|
isModal: true,
|
|
2848
2996
|
maxHeight: resolveMaxHeight2(maxHeight, snapPoints)
|
|
2849
2997
|
});
|
|
2850
|
-
|
|
2998
|
+
React2__namespace.useEffect(() => {
|
|
2851
2999
|
const node = scope.current;
|
|
2852
3000
|
if (node) {
|
|
2853
3001
|
node.snapTo = snapTo;
|
|
2854
3002
|
}
|
|
2855
3003
|
}, [snapTo, scope]);
|
|
2856
|
-
const resolvedDividers =
|
|
3004
|
+
const resolvedDividers = React2__namespace.useMemo(
|
|
2857
3005
|
() => resolveDividers(divider),
|
|
2858
3006
|
[divider]
|
|
2859
3007
|
);
|
|
2860
|
-
const resolvedSheetMaxWidth =
|
|
3008
|
+
const resolvedSheetMaxWidth = React2__namespace.useMemo(
|
|
2861
3009
|
() => resolveSheetMaxWidth(sheetMaxWidth),
|
|
2862
3010
|
[sheetMaxWidth]
|
|
2863
3011
|
);
|
|
2864
|
-
const mergedRef =
|
|
3012
|
+
const mergedRef = React2__namespace.useCallback(
|
|
2865
3013
|
(node) => {
|
|
2866
3014
|
scope(node);
|
|
2867
3015
|
if (typeof ref === "function") ref(node);
|
|
@@ -2960,17 +3108,17 @@ function useBottomSheetScaffold({
|
|
|
2960
3108
|
onStateChange,
|
|
2961
3109
|
initialState = "partiallyExpanded"
|
|
2962
3110
|
} = {}) {
|
|
2963
|
-
const [containerHeight, setContainerHeight] =
|
|
3111
|
+
const [containerHeight, setContainerHeight] = React2.useState(
|
|
2964
3112
|
typeof window !== "undefined" ? window.innerHeight : 800
|
|
2965
3113
|
);
|
|
2966
|
-
const containerNodeRef =
|
|
2967
|
-
const containerRef =
|
|
3114
|
+
const containerNodeRef = React2.useRef(null);
|
|
3115
|
+
const containerRef = React2.useCallback((node) => {
|
|
2968
3116
|
containerNodeRef.current = node;
|
|
2969
3117
|
if (node) {
|
|
2970
3118
|
setContainerHeight(node.offsetHeight || window.innerHeight);
|
|
2971
3119
|
}
|
|
2972
3120
|
}, []);
|
|
2973
|
-
|
|
3121
|
+
React2.useEffect(() => {
|
|
2974
3122
|
const node = containerNodeRef.current;
|
|
2975
3123
|
if (!node) return;
|
|
2976
3124
|
const observer = new ResizeObserver(() => {
|
|
@@ -2982,34 +3130,34 @@ function useBottomSheetScaffold({
|
|
|
2982
3130
|
const expandedY = 0;
|
|
2983
3131
|
const partialY = containerHeight - peekHeight;
|
|
2984
3132
|
const y = react.useMotionValue(initialState === "expanded" ? expandedY : partialY);
|
|
2985
|
-
const [sheetState, setSheetState] =
|
|
3133
|
+
const [sheetState, setSheetState] = React2.useState(
|
|
2986
3134
|
initialState
|
|
2987
3135
|
);
|
|
2988
|
-
const [isScrollDisablingDrag, setIsScrollDisablingDrag] =
|
|
3136
|
+
const [isScrollDisablingDrag, setIsScrollDisablingDrag] = React2.useState(false);
|
|
2989
3137
|
const isDragEnabled = swipeEnabled && !isScrollDisablingDrag;
|
|
2990
|
-
const dragConstraints =
|
|
3138
|
+
const dragConstraints = React2.useMemo(
|
|
2991
3139
|
() => ({ top: 0, bottom: partialY }),
|
|
2992
3140
|
[partialY]
|
|
2993
3141
|
);
|
|
2994
|
-
|
|
3142
|
+
React2.useEffect(() => {
|
|
2995
3143
|
const targetY = sheetState === "expanded" ? 0 : partialY;
|
|
2996
3144
|
void react.animate(y, targetY, SPRING);
|
|
2997
3145
|
}, [partialY, sheetState, y]);
|
|
2998
|
-
const expand =
|
|
3146
|
+
const expand = React2.useCallback(() => {
|
|
2999
3147
|
setSheetState("expanded");
|
|
3000
3148
|
void react.animate(y, 0, SPRING);
|
|
3001
3149
|
onStateChange == null ? void 0 : onStateChange("expanded");
|
|
3002
3150
|
}, [y, onStateChange]);
|
|
3003
|
-
const partialExpand =
|
|
3151
|
+
const partialExpand = React2.useCallback(() => {
|
|
3004
3152
|
setSheetState("partiallyExpanded");
|
|
3005
3153
|
void react.animate(y, partialY, SPRING);
|
|
3006
3154
|
onStateChange == null ? void 0 : onStateChange("partiallyExpanded");
|
|
3007
3155
|
}, [y, partialY, onStateChange]);
|
|
3008
|
-
const toggle =
|
|
3156
|
+
const toggle = React2.useCallback(() => {
|
|
3009
3157
|
if (sheetState === "expanded") partialExpand();
|
|
3010
3158
|
else expand();
|
|
3011
3159
|
}, [sheetState, expand, partialExpand]);
|
|
3012
|
-
const handleDragEnd =
|
|
3160
|
+
const handleDragEnd = React2.useCallback(
|
|
3013
3161
|
(_event, info) => {
|
|
3014
3162
|
const rawY = y.get();
|
|
3015
3163
|
let velocity = info.velocity.y;
|
|
@@ -3034,7 +3182,7 @@ function useBottomSheetScaffold({
|
|
|
3034
3182
|
},
|
|
3035
3183
|
[y, partialY, expand, partialExpand]
|
|
3036
3184
|
);
|
|
3037
|
-
const handleContentScroll =
|
|
3185
|
+
const handleContentScroll = React2.useCallback(
|
|
3038
3186
|
(e) => {
|
|
3039
3187
|
if (sheetState !== "expanded") {
|
|
3040
3188
|
e.currentTarget.scrollTop = 0;
|
|
@@ -3060,7 +3208,7 @@ function useBottomSheetScaffold({
|
|
|
3060
3208
|
containerRef
|
|
3061
3209
|
};
|
|
3062
3210
|
}
|
|
3063
|
-
var BottomSheetScaffold =
|
|
3211
|
+
var BottomSheetScaffold = React2__namespace.forwardRef(
|
|
3064
3212
|
({
|
|
3065
3213
|
sheetContent,
|
|
3066
3214
|
children,
|
|
@@ -3089,13 +3237,13 @@ var BottomSheetScaffold = React9__namespace.forwardRef(
|
|
|
3089
3237
|
onStateChange: onSheetStateChange,
|
|
3090
3238
|
initialState: initialSheetState
|
|
3091
3239
|
});
|
|
3092
|
-
const resolvedSheetMaxWidth =
|
|
3240
|
+
const resolvedSheetMaxWidth = React2__namespace.useMemo(() => {
|
|
3093
3241
|
if (sheetMaxWidth === void 0)
|
|
3094
3242
|
return "var(--m3-bottom-sheet-max-width, 640px)";
|
|
3095
3243
|
if (typeof sheetMaxWidth === "number") return `${sheetMaxWidth}px`;
|
|
3096
3244
|
return sheetMaxWidth;
|
|
3097
3245
|
}, [sheetMaxWidth]);
|
|
3098
|
-
const mergedRef =
|
|
3246
|
+
const mergedRef = React2__namespace.useCallback(
|
|
3099
3247
|
(node) => {
|
|
3100
3248
|
containerRef(node);
|
|
3101
3249
|
if (typeof ref === "function") ref(node);
|
|
@@ -3103,7 +3251,7 @@ var BottomSheetScaffold = React9__namespace.forwardRef(
|
|
|
3103
3251
|
},
|
|
3104
3252
|
[containerRef, ref]
|
|
3105
3253
|
);
|
|
3106
|
-
const resolvedDragHandle =
|
|
3254
|
+
const resolvedDragHandle = React2__namespace.useMemo(() => {
|
|
3107
3255
|
if (sheetDragHandle === null) return null;
|
|
3108
3256
|
if (sheetDragHandle !== void 0) return sheetDragHandle;
|
|
3109
3257
|
return /* @__PURE__ */ jsxRuntime.jsx(DragHandle, { onCycle: toggle });
|
|
@@ -3166,7 +3314,7 @@ var BottomSheetScaffold = React9__namespace.forwardRef(
|
|
|
3166
3314
|
);
|
|
3167
3315
|
BottomSheetScaffold.displayName = "BottomSheetScaffold";
|
|
3168
3316
|
var COPLANAR_TRANSITION = `margin ${getMotionTransitionCSS("default", "spatial")}`;
|
|
3169
|
-
var SideSheet =
|
|
3317
|
+
var SideSheet = React2__namespace.forwardRef(
|
|
3170
3318
|
({
|
|
3171
3319
|
isOpen,
|
|
3172
3320
|
children,
|
|
@@ -3182,16 +3330,16 @@ var SideSheet = React9__namespace.forwardRef(
|
|
|
3182
3330
|
divider,
|
|
3183
3331
|
scrollAreaProps
|
|
3184
3332
|
}, ref) => {
|
|
3185
|
-
const sheetAnim =
|
|
3186
|
-
const [mounted, setMounted] =
|
|
3187
|
-
|
|
3333
|
+
const sheetAnim = React2__namespace.useMemo(() => buildSideSheetAnim(edge), [edge]);
|
|
3334
|
+
const [mounted, setMounted] = React2__namespace.useState(false);
|
|
3335
|
+
React2__namespace.useEffect(() => {
|
|
3188
3336
|
setMounted(true);
|
|
3189
3337
|
}, []);
|
|
3190
|
-
const resolvedDividers =
|
|
3338
|
+
const resolvedDividers = React2__namespace.useMemo(
|
|
3191
3339
|
() => resolveDividers(divider),
|
|
3192
3340
|
[divider]
|
|
3193
3341
|
);
|
|
3194
|
-
|
|
3342
|
+
React2__namespace.useEffect(() => {
|
|
3195
3343
|
const sibling = coplanarSiblingRef == null ? void 0 : coplanarSiblingRef.current;
|
|
3196
3344
|
if (!sibling) return;
|
|
3197
3345
|
sibling.style.transition = COPLANAR_TRANSITION;
|
|
@@ -3255,7 +3403,7 @@ var SideSheet = React9__namespace.forwardRef(
|
|
|
3255
3403
|
}
|
|
3256
3404
|
);
|
|
3257
3405
|
SideSheet.displayName = "SideSheet";
|
|
3258
|
-
var SideSheetModal =
|
|
3406
|
+
var SideSheetModal = React2__namespace.forwardRef(
|
|
3259
3407
|
({
|
|
3260
3408
|
isOpen,
|
|
3261
3409
|
onClose,
|
|
@@ -3270,8 +3418,8 @@ var SideSheetModal = React9__namespace.forwardRef(
|
|
|
3270
3418
|
divider,
|
|
3271
3419
|
scrollAreaProps
|
|
3272
3420
|
}, ref) => {
|
|
3273
|
-
const sheetAnim =
|
|
3274
|
-
const resolvedDividers =
|
|
3421
|
+
const sheetAnim = React2__namespace.useMemo(() => buildSideSheetAnim(edge), [edge]);
|
|
3422
|
+
const resolvedDividers = React2__namespace.useMemo(
|
|
3275
3423
|
() => resolveDividers(divider),
|
|
3276
3424
|
[divider]
|
|
3277
3425
|
);
|