@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/feedback.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useReducedMotion, LazyMotion, domMax, m, useMotionValue, animate,
|
|
3
|
-
import * as
|
|
2
|
+
import { useReducedMotion, LazyMotion, domMax, m, useAnimationFrame, useMotionValue, animate, AnimatePresence } from 'motion/react';
|
|
3
|
+
import * as React3 from 'react';
|
|
4
4
|
import { forwardRef, useState, useCallback, useEffect, useRef, useId, cloneElement, useLayoutEffect } from 'react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -78,9 +78,9 @@ function formatBadgeLabel(children, max) {
|
|
|
78
78
|
return "";
|
|
79
79
|
}
|
|
80
80
|
function detectBadgeHasContent(badge) {
|
|
81
|
-
return
|
|
81
|
+
return React3.isValidElement(badge) && badge.props.children != null;
|
|
82
82
|
}
|
|
83
|
-
var BadgeImpl =
|
|
83
|
+
var BadgeImpl = React3.forwardRef(
|
|
84
84
|
(_a, ref) => {
|
|
85
85
|
var _b = _a, {
|
|
86
86
|
children,
|
|
@@ -134,14 +134,14 @@ var BadgeImpl = React12.forwardRef(
|
|
|
134
134
|
}
|
|
135
135
|
);
|
|
136
136
|
BadgeImpl.displayName = "Badge";
|
|
137
|
-
var Badge =
|
|
137
|
+
var Badge = React3.memo(BadgeImpl);
|
|
138
138
|
function BadgedBox({
|
|
139
139
|
badge,
|
|
140
140
|
children,
|
|
141
141
|
className,
|
|
142
|
-
|
|
142
|
+
size
|
|
143
143
|
}) {
|
|
144
|
-
const isLarge =
|
|
144
|
+
const isLarge = size ? size === "lg" : detectBadgeHasContent(badge);
|
|
145
145
|
const badgePositionClass = isLarge ? "translate-x-[35%] -translate-y-[35%]" : "translate-x-[50%] -translate-y-[50%]";
|
|
146
146
|
return /* @__PURE__ */ jsxs("span", { className: cn("relative inline-flex", className), children: [
|
|
147
147
|
children,
|
|
@@ -200,11 +200,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
200
200
|
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";
|
|
201
201
|
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";
|
|
202
202
|
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";
|
|
203
|
-
var IndeterminateSvg =
|
|
203
|
+
var IndeterminateSvg = React3.memo(function IndeterminateSvg2({
|
|
204
204
|
size
|
|
205
205
|
}) {
|
|
206
|
-
const [ready, setReady] =
|
|
207
|
-
|
|
206
|
+
const [ready, setReady] = React3.useState(false);
|
|
207
|
+
React3.useEffect(() => {
|
|
208
208
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
209
209
|
return () => cancelAnimationFrame(raf);
|
|
210
210
|
}, []);
|
|
@@ -249,7 +249,7 @@ var IndeterminateSvg = React12.memo(function IndeterminateSvg2({
|
|
|
249
249
|
}
|
|
250
250
|
);
|
|
251
251
|
});
|
|
252
|
-
var DeterminateSvg =
|
|
252
|
+
var DeterminateSvg = React3.memo(function DeterminateSvg2({
|
|
253
253
|
size,
|
|
254
254
|
progress
|
|
255
255
|
}) {
|
|
@@ -274,7 +274,7 @@ var DeterminateSvg = React12.memo(function DeterminateSvg2({
|
|
|
274
274
|
}
|
|
275
275
|
);
|
|
276
276
|
});
|
|
277
|
-
var LoadingIndicator =
|
|
277
|
+
var LoadingIndicator = React3.forwardRef(
|
|
278
278
|
(_a, ref) => {
|
|
279
279
|
var _b = _a, {
|
|
280
280
|
variant = "uncontained",
|
|
@@ -369,7 +369,7 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
369
369
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
370
370
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
371
371
|
}
|
|
372
|
-
return d
|
|
372
|
+
return `${d} Z`;
|
|
373
373
|
}
|
|
374
374
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
375
375
|
if (startX >= endX) return "";
|
|
@@ -401,7 +401,15 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
401
401
|
}
|
|
402
402
|
return d;
|
|
403
403
|
}
|
|
404
|
-
var
|
|
404
|
+
var GLOBAL_ROTATION_DURATION = 6e3;
|
|
405
|
+
var GLOBAL_ROTATION_TARGET = 1080;
|
|
406
|
+
var ADDITIONAL_ROTATION_CYCLE = 1500;
|
|
407
|
+
var ADDITIONAL_ROTATION_STEP = 90;
|
|
408
|
+
var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
409
|
+
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
410
|
+
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
411
|
+
var PROGRESS_CYCLE_DURATION = 1500;
|
|
412
|
+
var CircularProgress = React3.forwardRef(
|
|
405
413
|
(_a, ref) => {
|
|
406
414
|
var _b = _a, {
|
|
407
415
|
value,
|
|
@@ -414,6 +422,10 @@ var CircularProgress = React12.forwardRef(
|
|
|
414
422
|
crawlerSpeed = 1,
|
|
415
423
|
color,
|
|
416
424
|
trackColor,
|
|
425
|
+
showTrack = "auto",
|
|
426
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
427
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
428
|
+
amplitudeRange,
|
|
417
429
|
className,
|
|
418
430
|
"aria-label": ariaLabel
|
|
419
431
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -427,6 +439,10 @@ var CircularProgress = React12.forwardRef(
|
|
|
427
439
|
"crawlerSpeed",
|
|
428
440
|
"color",
|
|
429
441
|
"trackColor",
|
|
442
|
+
"showTrack",
|
|
443
|
+
"minProgress",
|
|
444
|
+
"maxProgress",
|
|
445
|
+
"amplitudeRange",
|
|
430
446
|
"className",
|
|
431
447
|
"aria-label"
|
|
432
448
|
]);
|
|
@@ -437,17 +453,22 @@ var CircularProgress = React12.forwardRef(
|
|
|
437
453
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
438
454
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
439
455
|
const isWavy = shape === "wavy";
|
|
456
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
440
457
|
const BASELINE_SIZE = 48;
|
|
441
458
|
const scaleFactor = size / BASELINE_SIZE;
|
|
442
|
-
const effectiveAmplitude =
|
|
459
|
+
const effectiveAmplitude = React3.useMemo(
|
|
443
460
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
444
461
|
[amplitude, scaleFactor]
|
|
445
462
|
);
|
|
446
|
-
const effectiveWavelength =
|
|
463
|
+
const effectiveWavelength = React3.useMemo(
|
|
447
464
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
448
465
|
[wavelength, scaleFactor]
|
|
449
466
|
);
|
|
450
|
-
const
|
|
467
|
+
const resolvedAmplitudeRange = React3.useMemo(
|
|
468
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
469
|
+
[amplitudeRange, effectiveAmplitude]
|
|
470
|
+
);
|
|
471
|
+
const wavyActivePath = React3.useMemo(
|
|
451
472
|
() => isWavy ? generateWavyCircularPath(
|
|
452
473
|
center,
|
|
453
474
|
radius,
|
|
@@ -456,8 +477,8 @@ var CircularProgress = React12.forwardRef(
|
|
|
456
477
|
) : null,
|
|
457
478
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
458
479
|
);
|
|
459
|
-
const circumference =
|
|
460
|
-
const gapForTrack =
|
|
480
|
+
const circumference = React3.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
481
|
+
const gapForTrack = React3.useMemo(
|
|
461
482
|
() => (gapSize + trackHeight) / circumference,
|
|
462
483
|
[gapSize, trackHeight, circumference]
|
|
463
484
|
);
|
|
@@ -466,6 +487,145 @@ var CircularProgress = React12.forwardRef(
|
|
|
466
487
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
467
488
|
const ActiveCircleElem = m.circle;
|
|
468
489
|
const ActivePathElem = m.path;
|
|
490
|
+
const indeterminateSvgRef = React3.useRef(null);
|
|
491
|
+
const indeterminateTrackRef = React3.useRef(null);
|
|
492
|
+
const indeterminateActiveRef = React3.useRef(null);
|
|
493
|
+
const indeterminateWavyTrackPathRef = React3.useRef(null);
|
|
494
|
+
const indeterminateWavyActivePathRef = React3.useRef(null);
|
|
495
|
+
const cachedPathLengthRef = React3.useRef(0);
|
|
496
|
+
React3.useLayoutEffect(() => {
|
|
497
|
+
if (!isWavy || !wavyActivePath) {
|
|
498
|
+
cachedPathLengthRef.current = circumference;
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
const el = indeterminateActiveRef.current;
|
|
502
|
+
if (el && "getTotalLength" in el) {
|
|
503
|
+
try {
|
|
504
|
+
const len = el.getTotalLength();
|
|
505
|
+
if (len > 0) {
|
|
506
|
+
cachedPathLengthRef.current = len;
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
} catch (e) {
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
cachedPathLengthRef.current = circumference;
|
|
513
|
+
}, [isWavy, circumference, wavyActivePath]);
|
|
514
|
+
useAnimationFrame((time) => {
|
|
515
|
+
if (isDeterminate) return;
|
|
516
|
+
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
517
|
+
const scaledTime = time * safeCrawlerSpeed;
|
|
518
|
+
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
519
|
+
const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
|
|
520
|
+
const additionalFullCycles = Math.floor(
|
|
521
|
+
scaledTime / ADDITIONAL_ROTATION_CYCLE
|
|
522
|
+
);
|
|
523
|
+
const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
|
|
524
|
+
const additionalEaseT = Math.min(
|
|
525
|
+
1,
|
|
526
|
+
additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
|
|
527
|
+
);
|
|
528
|
+
const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
|
|
529
|
+
const totalRotation = globalAngle + additionalAngle;
|
|
530
|
+
if (indeterminateSvgRef.current) {
|
|
531
|
+
indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
|
|
532
|
+
}
|
|
533
|
+
const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
|
|
534
|
+
const progressCycleTime = scaledTime % progressFullCycle;
|
|
535
|
+
let progress;
|
|
536
|
+
if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
|
|
537
|
+
const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
|
|
538
|
+
progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
|
|
539
|
+
} else {
|
|
540
|
+
const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
|
|
541
|
+
progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
|
|
542
|
+
}
|
|
543
|
+
if (isWavy) {
|
|
544
|
+
const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
|
|
545
|
+
const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
|
|
546
|
+
const dynamicPath = generateWavyCircularPath(
|
|
547
|
+
center,
|
|
548
|
+
radius,
|
|
549
|
+
currentAmplitude,
|
|
550
|
+
effectiveWavelength
|
|
551
|
+
);
|
|
552
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
553
|
+
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
554
|
+
}
|
|
555
|
+
if (indeterminateWavyTrackPathRef.current) {
|
|
556
|
+
indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
557
|
+
}
|
|
558
|
+
const pathEl = indeterminateWavyActivePathRef.current;
|
|
559
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
560
|
+
if (pathEl) {
|
|
561
|
+
try {
|
|
562
|
+
const len = pathEl.getTotalLength();
|
|
563
|
+
if (len > 0) totalLen = len;
|
|
564
|
+
} catch (e) {
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
568
|
+
const activeLen = totalLen * progress;
|
|
569
|
+
const activeOff = 0;
|
|
570
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
571
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
572
|
+
"stroke-dasharray",
|
|
573
|
+
`${activeLen} ${totalLen}`
|
|
574
|
+
);
|
|
575
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
576
|
+
"stroke-dashoffset",
|
|
577
|
+
`${activeOff}`
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
|
|
581
|
+
const trackStartFrac = progress + gapFrac;
|
|
582
|
+
const trackLen = Math.max(
|
|
583
|
+
1e-3,
|
|
584
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
585
|
+
);
|
|
586
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
587
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
588
|
+
"stroke-dasharray",
|
|
589
|
+
`${trackLen} ${totalLen}`
|
|
590
|
+
);
|
|
591
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
592
|
+
"stroke-dashoffset",
|
|
593
|
+
`${trackOff}`
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
} else {
|
|
597
|
+
const totalLen = circumference;
|
|
598
|
+
const activeLen = totalLen * progress;
|
|
599
|
+
const activeOff = 0;
|
|
600
|
+
if (indeterminateActiveRef.current) {
|
|
601
|
+
indeterminateActiveRef.current.setAttribute(
|
|
602
|
+
"stroke-dasharray",
|
|
603
|
+
`${activeLen} ${totalLen}`
|
|
604
|
+
);
|
|
605
|
+
indeterminateActiveRef.current.setAttribute(
|
|
606
|
+
"stroke-dashoffset",
|
|
607
|
+
`${activeOff}`
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
|
|
611
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
612
|
+
const trackStartFrac = progress + gapFrac;
|
|
613
|
+
const trackLen = Math.max(
|
|
614
|
+
1e-3,
|
|
615
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
616
|
+
);
|
|
617
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
618
|
+
indeterminateTrackRef.current.setAttribute(
|
|
619
|
+
"stroke-dasharray",
|
|
620
|
+
`${trackLen} ${totalLen}`
|
|
621
|
+
);
|
|
622
|
+
indeterminateTrackRef.current.setAttribute(
|
|
623
|
+
"stroke-dashoffset",
|
|
624
|
+
`${trackOff}`
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
});
|
|
469
629
|
return /* @__PURE__ */ jsx(
|
|
470
630
|
"div",
|
|
471
631
|
__spreadProps(__spreadValues({
|
|
@@ -542,9 +702,10 @@ var CircularProgress = React12.forwardRef(
|
|
|
542
702
|
]
|
|
543
703
|
}
|
|
544
704
|
),
|
|
545
|
-
!isDeterminate && /* @__PURE__ */
|
|
546
|
-
|
|
705
|
+
!isDeterminate && /* @__PURE__ */ jsx(
|
|
706
|
+
"svg",
|
|
547
707
|
{
|
|
708
|
+
ref: indeterminateSvgRef,
|
|
548
709
|
width: size,
|
|
549
710
|
height: size,
|
|
550
711
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -553,84 +714,60 @@ var CircularProgress = React12.forwardRef(
|
|
|
553
714
|
position: "absolute",
|
|
554
715
|
inset: 0,
|
|
555
716
|
overflow: "visible",
|
|
556
|
-
transformOrigin: "center"
|
|
717
|
+
transformOrigin: "center",
|
|
718
|
+
transform: "rotate(-90deg)"
|
|
557
719
|
},
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
562
|
-
ease: "linear"
|
|
563
|
-
},
|
|
564
|
-
children: [
|
|
565
|
-
/* @__PURE__ */ jsx(
|
|
566
|
-
m.circle,
|
|
720
|
+
children: isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
721
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
|
|
722
|
+
"path",
|
|
567
723
|
{
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
r: radius,
|
|
724
|
+
ref: indeterminateWavyTrackPathRef,
|
|
725
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
571
726
|
fill: "none",
|
|
572
727
|
stroke: bgTrackColor,
|
|
573
728
|
strokeWidth: trackHeight,
|
|
574
|
-
strokeLinecap: "round"
|
|
575
|
-
animate: {
|
|
576
|
-
pathLength: [
|
|
577
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
578
|
-
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
579
|
-
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
580
|
-
],
|
|
581
|
-
pathOffset: [
|
|
582
|
-
0.1 + gapForTrack,
|
|
583
|
-
0.75 + gapForTrack,
|
|
584
|
-
0.1 + gapForTrack
|
|
585
|
-
]
|
|
586
|
-
},
|
|
587
|
-
transition: {
|
|
588
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
589
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
590
|
-
ease: [0.4, 0, 0.2, 1]
|
|
591
|
-
}
|
|
729
|
+
strokeLinecap: "round"
|
|
592
730
|
}
|
|
593
731
|
),
|
|
594
|
-
|
|
595
|
-
|
|
732
|
+
/* @__PURE__ */ jsx(
|
|
733
|
+
"path",
|
|
596
734
|
{
|
|
735
|
+
ref: indeterminateWavyActivePathRef,
|
|
597
736
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
598
737
|
fill: "none",
|
|
599
738
|
stroke: activeColor,
|
|
600
739
|
strokeWidth: trackHeight,
|
|
601
|
-
strokeLinecap: "round"
|
|
602
|
-
animate: {
|
|
603
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
604
|
-
pathOffset: [0, 0.65, 1]
|
|
605
|
-
},
|
|
606
|
-
transition: {
|
|
607
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
608
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
609
|
-
ease: [0.4, 0, 0.2, 1]
|
|
610
|
-
}
|
|
740
|
+
strokeLinecap: "round"
|
|
611
741
|
}
|
|
612
|
-
)
|
|
613
|
-
|
|
742
|
+
)
|
|
743
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
744
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
|
|
745
|
+
"circle",
|
|
614
746
|
{
|
|
747
|
+
ref: indeterminateTrackRef,
|
|
748
|
+
cx: center,
|
|
749
|
+
cy: center,
|
|
750
|
+
r: radius,
|
|
751
|
+
fill: "none",
|
|
752
|
+
stroke: bgTrackColor,
|
|
753
|
+
strokeWidth: trackHeight,
|
|
754
|
+
strokeLinecap: "round"
|
|
755
|
+
}
|
|
756
|
+
),
|
|
757
|
+
/* @__PURE__ */ jsx(
|
|
758
|
+
"circle",
|
|
759
|
+
{
|
|
760
|
+
ref: indeterminateActiveRef,
|
|
615
761
|
cx: center,
|
|
616
762
|
cy: center,
|
|
617
763
|
r: radius,
|
|
618
764
|
fill: "none",
|
|
619
765
|
stroke: activeColor,
|
|
620
766
|
strokeWidth: trackHeight,
|
|
621
|
-
strokeLinecap: "round"
|
|
622
|
-
animate: {
|
|
623
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
624
|
-
pathOffset: [0, 0.65, 1]
|
|
625
|
-
},
|
|
626
|
-
transition: {
|
|
627
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
628
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
629
|
-
ease: [0.4, 0, 0.2, 1]
|
|
630
|
-
}
|
|
767
|
+
strokeLinecap: "round"
|
|
631
768
|
}
|
|
632
769
|
)
|
|
633
|
-
]
|
|
770
|
+
] })
|
|
634
771
|
}
|
|
635
772
|
)
|
|
636
773
|
] })
|
|
@@ -640,9 +777,9 @@ var CircularProgress = React12.forwardRef(
|
|
|
640
777
|
);
|
|
641
778
|
CircularProgress.displayName = "CircularProgress";
|
|
642
779
|
function useContainerWidth() {
|
|
643
|
-
const [width, setWidth] =
|
|
644
|
-
const observerRef =
|
|
645
|
-
const ref =
|
|
780
|
+
const [width, setWidth] = React3.useState(0);
|
|
781
|
+
const observerRef = React3.useRef(null);
|
|
782
|
+
const ref = React3.useCallback((node) => {
|
|
646
783
|
if (observerRef.current) {
|
|
647
784
|
observerRef.current.disconnect();
|
|
648
785
|
observerRef.current = null;
|
|
@@ -656,7 +793,7 @@ function useContainerWidth() {
|
|
|
656
793
|
observerRef.current = obs;
|
|
657
794
|
}
|
|
658
795
|
}, []);
|
|
659
|
-
|
|
796
|
+
React3.useEffect(() => {
|
|
660
797
|
return () => {
|
|
661
798
|
if (observerRef.current) {
|
|
662
799
|
observerRef.current.disconnect();
|
|
@@ -666,7 +803,7 @@ function useContainerWidth() {
|
|
|
666
803
|
return [ref, width];
|
|
667
804
|
}
|
|
668
805
|
function useMergedRef(...refs) {
|
|
669
|
-
return
|
|
806
|
+
return React3.useCallback(
|
|
670
807
|
(node) => {
|
|
671
808
|
for (const ref of refs) {
|
|
672
809
|
if (typeof ref === "function") {
|
|
@@ -680,7 +817,7 @@ function useMergedRef(...refs) {
|
|
|
680
817
|
[refs]
|
|
681
818
|
);
|
|
682
819
|
}
|
|
683
|
-
var FlatLinearTrack =
|
|
820
|
+
var FlatLinearTrack = React3.memo(function FlatLinearTrack2({
|
|
684
821
|
trackHeight,
|
|
685
822
|
activeColor,
|
|
686
823
|
trackColor,
|
|
@@ -756,7 +893,7 @@ var FlatLinearTrack = React12.memo(function FlatLinearTrack2({
|
|
|
756
893
|
}
|
|
757
894
|
);
|
|
758
895
|
});
|
|
759
|
-
var WavyLinearTrack =
|
|
896
|
+
var WavyLinearTrack = React3.memo(function WavyLinearTrack2({
|
|
760
897
|
trackHeight,
|
|
761
898
|
svgHeight,
|
|
762
899
|
amplitude,
|
|
@@ -775,13 +912,13 @@ var WavyLinearTrack = React12.memo(function WavyLinearTrack2({
|
|
|
775
912
|
}) {
|
|
776
913
|
const isDeterminate = typeof value === "number";
|
|
777
914
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
778
|
-
const titleId =
|
|
915
|
+
const titleId = React3.useId();
|
|
779
916
|
const [containerRef, width] = useContainerWidth();
|
|
780
|
-
const activePathRef =
|
|
781
|
-
const trackPathRef =
|
|
917
|
+
const activePathRef = React3.useRef(null);
|
|
918
|
+
const trackPathRef = React3.useRef(null);
|
|
782
919
|
const amplitudeMV = useMotionValue(amplitude);
|
|
783
920
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
784
|
-
|
|
921
|
+
React3.useEffect(() => {
|
|
785
922
|
if (isDeterminate) {
|
|
786
923
|
const fraction = clampedValue / 100;
|
|
787
924
|
let targetAmp = amplitude;
|
|
@@ -836,7 +973,7 @@ var WavyLinearTrack = React12.memo(function WavyLinearTrack2({
|
|
|
836
973
|
currentAmp
|
|
837
974
|
);
|
|
838
975
|
} else if (fraction === 0) {
|
|
839
|
-
activePathD =
|
|
976
|
+
activePathD = "";
|
|
840
977
|
}
|
|
841
978
|
const trackStart = adjHead + totalGap;
|
|
842
979
|
if (trackStart < width - capWidth) {
|
|
@@ -868,20 +1005,20 @@ var WavyLinearTrack = React12.memo(function WavyLinearTrack2({
|
|
|
868
1005
|
activeLines.push({ tail: l1T, head: l1H });
|
|
869
1006
|
activeLines.push({ tail: l2T, head: l2H });
|
|
870
1007
|
}
|
|
871
|
-
const
|
|
872
|
-
const
|
|
873
|
-
const
|
|
1008
|
+
const activeSegments = activeLines.map((line) => {
|
|
1009
|
+
const rawTail = line.tail * width;
|
|
1010
|
+
const rawHead = line.head * width;
|
|
874
1011
|
const adjTail = Math.max(
|
|
875
1012
|
capWidth,
|
|
876
|
-
Math.min(width - capWidth,
|
|
1013
|
+
Math.min(width - capWidth, rawTail)
|
|
877
1014
|
);
|
|
878
1015
|
const adjHead = Math.max(
|
|
879
1016
|
capWidth,
|
|
880
|
-
Math.min(width - capWidth,
|
|
1017
|
+
Math.min(width - capWidth, rawHead)
|
|
881
1018
|
);
|
|
882
1019
|
return { adjTail, adjHead };
|
|
883
1020
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
884
|
-
activePathD =
|
|
1021
|
+
activePathD = activeSegments.map(
|
|
885
1022
|
(seg) => getSinePath(
|
|
886
1023
|
seg.adjTail,
|
|
887
1024
|
seg.adjHead,
|
|
@@ -890,13 +1027,24 @@ var WavyLinearTrack = React12.memo(function WavyLinearTrack2({
|
|
|
890
1027
|
currentAmp
|
|
891
1028
|
)
|
|
892
1029
|
).join(" ");
|
|
1030
|
+
const validActiveLines = activeLines.filter(
|
|
1031
|
+
(line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
|
|
1032
|
+
).sort((a, b) => a.tail - b.tail);
|
|
893
1033
|
let currentTrackX = capWidth;
|
|
894
|
-
for (const
|
|
895
|
-
const
|
|
1034
|
+
for (const line of validActiveLines) {
|
|
1035
|
+
const blockStart = line.tail * width - totalGap;
|
|
1036
|
+
const blockEnd = line.head * width + totalGap;
|
|
1037
|
+
const trackEnd = Math.min(width - capWidth, blockStart);
|
|
896
1038
|
if (trackEnd > currentTrackX) {
|
|
897
|
-
trackD += `${getSinePath(
|
|
1039
|
+
trackD += `${getSinePath(
|
|
1040
|
+
currentTrackX,
|
|
1041
|
+
trackEnd,
|
|
1042
|
+
phase,
|
|
1043
|
+
activeWavelength,
|
|
1044
|
+
trackAmp
|
|
1045
|
+
)} `;
|
|
898
1046
|
}
|
|
899
|
-
currentTrackX = Math.max(currentTrackX,
|
|
1047
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
900
1048
|
}
|
|
901
1049
|
if (currentTrackX < width - capWidth) {
|
|
902
1050
|
trackD += getSinePath(
|
|
@@ -909,9 +1057,9 @@ var WavyLinearTrack = React12.memo(function WavyLinearTrack2({
|
|
|
909
1057
|
}
|
|
910
1058
|
}
|
|
911
1059
|
if (activePathRef.current)
|
|
912
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
1060
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
913
1061
|
if (trackPathRef.current)
|
|
914
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
1062
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
915
1063
|
});
|
|
916
1064
|
return /* @__PURE__ */ jsx(
|
|
917
1065
|
"div",
|
|
@@ -958,7 +1106,7 @@ var WavyLinearTrack = React12.memo(function WavyLinearTrack2({
|
|
|
958
1106
|
}
|
|
959
1107
|
);
|
|
960
1108
|
});
|
|
961
|
-
var LinearProgress =
|
|
1109
|
+
var LinearProgress = React3.forwardRef(
|
|
962
1110
|
(_a, ref) => {
|
|
963
1111
|
var _b = _a, {
|
|
964
1112
|
value,
|
|
@@ -999,10 +1147,10 @@ var LinearProgress = React12.forwardRef(
|
|
|
999
1147
|
]);
|
|
1000
1148
|
const isDeterminate = value !== void 0;
|
|
1001
1149
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1002
|
-
const containerRef =
|
|
1150
|
+
const containerRef = React3.useRef(null);
|
|
1003
1151
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1004
|
-
const [isRtl, setIsRtl] =
|
|
1005
|
-
|
|
1152
|
+
const [isRtl, setIsRtl] = React3.useState(false);
|
|
1153
|
+
React3.useEffect(() => {
|
|
1006
1154
|
if (containerRef.current) {
|
|
1007
1155
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1008
1156
|
setIsRtl(dir === "rtl");
|
|
@@ -1010,16 +1158,16 @@ var LinearProgress = React12.forwardRef(
|
|
|
1010
1158
|
}, []);
|
|
1011
1159
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1012
1160
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1013
|
-
const effectiveAmplitude =
|
|
1014
|
-
const svgHeight =
|
|
1161
|
+
const effectiveAmplitude = React3.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1162
|
+
const svgHeight = React3.useMemo(
|
|
1015
1163
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1016
1164
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1017
1165
|
);
|
|
1018
|
-
const shouldShowStop =
|
|
1166
|
+
const shouldShowStop = React3.useMemo(
|
|
1019
1167
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1020
1168
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1021
1169
|
);
|
|
1022
|
-
const stopSize =
|
|
1170
|
+
const stopSize = React3.useMemo(
|
|
1023
1171
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1024
1172
|
[trackHeight]
|
|
1025
1173
|
);
|
|
@@ -1094,14 +1242,14 @@ var LinearProgress = React12.forwardRef(
|
|
|
1094
1242
|
}
|
|
1095
1243
|
);
|
|
1096
1244
|
LinearProgress.displayName = "LinearProgress";
|
|
1097
|
-
var ProgressIndicator =
|
|
1245
|
+
var ProgressIndicator = React3.forwardRef((props, ref) => {
|
|
1098
1246
|
if (props.variant === "circular") {
|
|
1099
1247
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1100
1248
|
}
|
|
1101
1249
|
return /* @__PURE__ */ jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
1102
1250
|
});
|
|
1103
1251
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
1104
|
-
var RippleItem =
|
|
1252
|
+
var RippleItem = React3.memo(function RippleItem2({
|
|
1105
1253
|
ripple,
|
|
1106
1254
|
onDone
|
|
1107
1255
|
}) {
|
|
@@ -1145,8 +1293,8 @@ function Ripple({
|
|
|
1145
1293
|
}
|
|
1146
1294
|
function useRippleState(options = {}) {
|
|
1147
1295
|
const { disabled = false } = options;
|
|
1148
|
-
const [ripples, setRipples] =
|
|
1149
|
-
const onPointerDown =
|
|
1296
|
+
const [ripples, setRipples] = React3.useState([]);
|
|
1297
|
+
const onPointerDown = React3.useCallback(
|
|
1150
1298
|
(e) => {
|
|
1151
1299
|
if (disabled) return;
|
|
1152
1300
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1163,7 +1311,7 @@ function useRippleState(options = {}) {
|
|
|
1163
1311
|
},
|
|
1164
1312
|
[disabled]
|
|
1165
1313
|
);
|
|
1166
|
-
const removeRipple =
|
|
1314
|
+
const removeRipple = React3.useCallback((id) => {
|
|
1167
1315
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1168
1316
|
}, []);
|
|
1169
1317
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1311,7 +1459,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
1311
1459
|
}
|
|
1312
1460
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
1313
1461
|
}
|
|
1314
|
-
var IconButtonComponent =
|
|
1462
|
+
var IconButtonComponent = React3.forwardRef(
|
|
1315
1463
|
(_a, ref) => {
|
|
1316
1464
|
var _b = _a, {
|
|
1317
1465
|
className,
|
|
@@ -1319,7 +1467,7 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1319
1467
|
variant = "default",
|
|
1320
1468
|
colorStyle = "standard",
|
|
1321
1469
|
size = "sm",
|
|
1322
|
-
|
|
1470
|
+
width = "default",
|
|
1323
1471
|
shape = "round",
|
|
1324
1472
|
selected,
|
|
1325
1473
|
selectedIcon,
|
|
@@ -1337,7 +1485,7 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1337
1485
|
"variant",
|
|
1338
1486
|
"colorStyle",
|
|
1339
1487
|
"size",
|
|
1340
|
-
"
|
|
1488
|
+
"width",
|
|
1341
1489
|
"shape",
|
|
1342
1490
|
"selected",
|
|
1343
1491
|
"selectedIcon",
|
|
@@ -1353,18 +1501,18 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1353
1501
|
var _a2, _b2, _c, _d, _e;
|
|
1354
1502
|
const isToggle = variant === "toggle";
|
|
1355
1503
|
const isSelected = isToggle && !!selected;
|
|
1356
|
-
const resolvedColorClass =
|
|
1504
|
+
const resolvedColorClass = React3.useMemo(
|
|
1357
1505
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
1358
1506
|
[isSelected, colorStyle]
|
|
1359
1507
|
);
|
|
1360
|
-
const outlineWidthClass =
|
|
1508
|
+
const outlineWidthClass = React3.useMemo(
|
|
1361
1509
|
() => {
|
|
1362
1510
|
var _a3;
|
|
1363
1511
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
1364
1512
|
},
|
|
1365
1513
|
[colorStyle, isSelected, size]
|
|
1366
1514
|
);
|
|
1367
|
-
const disabledBgClass =
|
|
1515
|
+
const disabledBgClass = React3.useMemo(
|
|
1368
1516
|
() => resolveDisabledBgClass(colorStyle),
|
|
1369
1517
|
[colorStyle]
|
|
1370
1518
|
);
|
|
@@ -1382,12 +1530,12 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1382
1530
|
const iconPx = iconSize != null ? iconSize : defaultIconPx;
|
|
1383
1531
|
const isCustomSize = iconSize != null && iconSize !== "inherit";
|
|
1384
1532
|
const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
|
|
1385
|
-
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[
|
|
1533
|
+
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[width]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
|
|
1386
1534
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1387
1535
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1388
1536
|
disabled: loading
|
|
1389
1537
|
});
|
|
1390
|
-
const handleClick =
|
|
1538
|
+
const handleClick = React3.useCallback(
|
|
1391
1539
|
(e) => {
|
|
1392
1540
|
if (loading) {
|
|
1393
1541
|
e.preventDefault();
|
|
@@ -1397,7 +1545,7 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1397
1545
|
},
|
|
1398
1546
|
[loading, onClick]
|
|
1399
1547
|
);
|
|
1400
|
-
const handleKeyDown =
|
|
1548
|
+
const handleKeyDown = React3.useCallback(
|
|
1401
1549
|
(e) => {
|
|
1402
1550
|
if (loading) return;
|
|
1403
1551
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -1453,7 +1601,7 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1453
1601
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1454
1602
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1455
1603
|
},
|
|
1456
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
1604
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React3.Children.only(children).props.children : children
|
|
1457
1605
|
}),
|
|
1458
1606
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1459
1607
|
) })
|
|
@@ -1470,7 +1618,7 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1470
1618
|
className
|
|
1471
1619
|
);
|
|
1472
1620
|
if (asChild) {
|
|
1473
|
-
const child =
|
|
1621
|
+
const child = React3.Children.only(children);
|
|
1474
1622
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1475
1623
|
Slot,
|
|
1476
1624
|
__spreadProps(__spreadValues({
|
|
@@ -1487,7 +1635,7 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1487
1635
|
}),
|
|
1488
1636
|
className: containerClassName
|
|
1489
1637
|
}, restProps), {
|
|
1490
|
-
children:
|
|
1638
|
+
children: React3.cloneElement(child, { children: innerContent })
|
|
1491
1639
|
})
|
|
1492
1640
|
) });
|
|
1493
1641
|
}
|
|
@@ -1515,13 +1663,13 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1515
1663
|
}
|
|
1516
1664
|
);
|
|
1517
1665
|
IconButtonComponent.displayName = "IconButton";
|
|
1518
|
-
var IconButton =
|
|
1666
|
+
var IconButton = React3.memo(IconButtonComponent);
|
|
1519
1667
|
var VARIANT_FONT = {
|
|
1520
1668
|
outlined: "'Material Symbols Outlined'",
|
|
1521
1669
|
rounded: "'Material Symbols Rounded'",
|
|
1522
1670
|
sharp: "'Material Symbols Sharp'"
|
|
1523
1671
|
};
|
|
1524
|
-
var IconComponent =
|
|
1672
|
+
var IconComponent = React3.forwardRef(
|
|
1525
1673
|
(_a, ref) => {
|
|
1526
1674
|
var _b = _a, {
|
|
1527
1675
|
name,
|
|
@@ -1587,7 +1735,7 @@ var IconComponent = React12.forwardRef(
|
|
|
1587
1735
|
}
|
|
1588
1736
|
);
|
|
1589
1737
|
IconComponent.displayName = "Icon";
|
|
1590
|
-
var Icon =
|
|
1738
|
+
var Icon = React3.memo(IconComponent);
|
|
1591
1739
|
var DURATION_MAP = {
|
|
1592
1740
|
short: 4e3,
|
|
1593
1741
|
long: 7e3
|
|
@@ -1629,9 +1777,9 @@ function toSnackbarData(item) {
|
|
|
1629
1777
|
return { id: generateId(), visuals: item.visuals, resolve: item.resolve };
|
|
1630
1778
|
}
|
|
1631
1779
|
function useSnackbarState() {
|
|
1632
|
-
const [current, setCurrent] =
|
|
1633
|
-
const queueRef =
|
|
1634
|
-
const showSnackbar =
|
|
1780
|
+
const [current, setCurrent] = React3.useState(null);
|
|
1781
|
+
const queueRef = React3.useRef([]);
|
|
1782
|
+
const showSnackbar = React3.useCallback(
|
|
1635
1783
|
(visuals) => {
|
|
1636
1784
|
return new Promise((resolve) => {
|
|
1637
1785
|
const item = { visuals, resolve };
|
|
@@ -1644,14 +1792,14 @@ function useSnackbarState() {
|
|
|
1644
1792
|
},
|
|
1645
1793
|
[]
|
|
1646
1794
|
);
|
|
1647
|
-
const _dismiss =
|
|
1795
|
+
const _dismiss = React3.useCallback((result) => {
|
|
1648
1796
|
setCurrent((prev) => {
|
|
1649
1797
|
if (prev) prev.resolve(result);
|
|
1650
1798
|
const next = queueRef.current.shift();
|
|
1651
1799
|
return next ? toSnackbarData(next) : null;
|
|
1652
1800
|
});
|
|
1653
1801
|
}, []);
|
|
1654
|
-
|
|
1802
|
+
React3.useEffect(() => {
|
|
1655
1803
|
return () => {
|
|
1656
1804
|
for (const item of queueRef.current) {
|
|
1657
1805
|
item.resolve(RESULT.DISMISSED);
|
|
@@ -1661,7 +1809,7 @@ function useSnackbarState() {
|
|
|
1661
1809
|
}, []);
|
|
1662
1810
|
return { current, showSnackbar, _dismiss };
|
|
1663
1811
|
}
|
|
1664
|
-
var Snackbar =
|
|
1812
|
+
var Snackbar = React3.memo(function Snackbar2({
|
|
1665
1813
|
data,
|
|
1666
1814
|
className
|
|
1667
1815
|
}) {
|
|
@@ -1675,15 +1823,15 @@ var Snackbar = React12.memo(function Snackbar2({
|
|
|
1675
1823
|
} = visuals;
|
|
1676
1824
|
const reducedMotion = useReducedMotion();
|
|
1677
1825
|
const durationMs = resolveDuration(duration);
|
|
1678
|
-
|
|
1826
|
+
React3.useEffect(() => {
|
|
1679
1827
|
const timer = setTimeout(() => resolve(RESULT.DISMISSED), durationMs);
|
|
1680
1828
|
return () => clearTimeout(timer);
|
|
1681
1829
|
}, [resolve, durationMs]);
|
|
1682
|
-
const handleAction =
|
|
1830
|
+
const handleAction = React3.useCallback(
|
|
1683
1831
|
() => resolve(RESULT.ACTION),
|
|
1684
1832
|
[resolve]
|
|
1685
1833
|
);
|
|
1686
|
-
const handleDismiss =
|
|
1834
|
+
const handleDismiss = React3.useCallback(
|
|
1687
1835
|
() => resolve(RESULT.DISMISSED),
|
|
1688
1836
|
[resolve]
|
|
1689
1837
|
);
|
|
@@ -1751,7 +1899,7 @@ var Snackbar = React12.memo(function Snackbar2({
|
|
|
1751
1899
|
Snackbar.displayName = "Snackbar";
|
|
1752
1900
|
function SnackbarHost({ state, className }) {
|
|
1753
1901
|
const { current, _dismiss } = state;
|
|
1754
|
-
const wrappedData =
|
|
1902
|
+
const wrappedData = React3.useMemo(() => {
|
|
1755
1903
|
if (!current) return null;
|
|
1756
1904
|
return __spreadProps(__spreadValues({}, current), { resolve: _dismiss });
|
|
1757
1905
|
}, [current, _dismiss]);
|
|
@@ -1769,12 +1917,12 @@ function SnackbarHost({ state, className }) {
|
|
|
1769
1917
|
) });
|
|
1770
1918
|
}
|
|
1771
1919
|
SnackbarHost.displayName = "SnackbarHost";
|
|
1772
|
-
var SnackbarContext =
|
|
1920
|
+
var SnackbarContext = React3.createContext(
|
|
1773
1921
|
null
|
|
1774
1922
|
);
|
|
1775
1923
|
function SnackbarProvider({ children }) {
|
|
1776
1924
|
const state = useSnackbarState();
|
|
1777
|
-
const contextValue =
|
|
1925
|
+
const contextValue = React3.useMemo(
|
|
1778
1926
|
() => ({ showSnackbar: state.showSnackbar }),
|
|
1779
1927
|
[state.showSnackbar]
|
|
1780
1928
|
);
|
|
@@ -1785,7 +1933,7 @@ function SnackbarProvider({ children }) {
|
|
|
1785
1933
|
}
|
|
1786
1934
|
SnackbarProvider.displayName = "SnackbarProvider";
|
|
1787
1935
|
function useSnackbar() {
|
|
1788
|
-
const ctx =
|
|
1936
|
+
const ctx = React3.useContext(SnackbarContext);
|
|
1789
1937
|
if (!ctx) {
|
|
1790
1938
|
throw new Error("useSnackbar must be used within a <SnackbarProvider>.");
|
|
1791
1939
|
}
|
|
@@ -2363,7 +2511,7 @@ function TooltipBox({
|
|
|
2363
2511
|
onKeyDown: handleKeyDown,
|
|
2364
2512
|
"aria-label": ariaLabel,
|
|
2365
2513
|
"aria-describedby": state.isVisible ? tooltipId : void 0,
|
|
2366
|
-
children:
|
|
2514
|
+
children: React3.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children })
|
|
2367
2515
|
}
|
|
2368
2516
|
),
|
|
2369
2517
|
mounted && createPortal(
|