@bug-on/m3-expressive 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/buttons.d.mts +2 -2
- package/dist/buttons.d.ts +2 -2
- package/dist/buttons.js +678 -605
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +677 -604
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +86 -61
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +86 -61
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +85 -61
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +85 -61
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +2 -2
- package/dist/forms.d.ts +2 -2
- package/dist/forms.js +70 -8
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +70 -8
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-sSt6PPLg.d.mts} +6 -0
- package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-sSt6PPLg.d.ts} +6 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +973 -496
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +967 -497
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +18 -1
- package/dist/layout.d.ts +18 -1
- package/dist/layout.js +65 -8
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +65 -8
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.d.mts +134 -9
- package/dist/navigation.d.ts +134 -9
- package/dist/navigation.js +403 -93
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +397 -94
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +214 -189
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +176 -151
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +222 -197
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +189 -164
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-BcPD_7uK.d.ts} +44 -6
- package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DtFJkTFr.d.mts} +44 -6
- package/dist/{text-field-eAIpz9z1.d.mts → text-field-T4Rg-9Bw.d.mts} +7 -0
- package/dist/{text-field-eAIpz9z1.d.ts → text-field-T4Rg-9Bw.d.ts} +7 -0
- package/package.json +1 -1
package/dist/buttons.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
3
|
import { m, LazyMotion, domMax, useMotionValue, animate, useAnimationFrame, AnimatePresence, useReducedMotion, useSpring, useTransform } from 'motion/react';
|
|
4
|
-
import * as
|
|
4
|
+
import * as React14 from 'react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -87,11 +87,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
87
87
|
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";
|
|
88
88
|
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";
|
|
89
89
|
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";
|
|
90
|
-
var IndeterminateSvg =
|
|
90
|
+
var IndeterminateSvg = React14.memo(function IndeterminateSvg2({
|
|
91
91
|
size
|
|
92
92
|
}) {
|
|
93
|
-
const [ready, setReady] =
|
|
94
|
-
|
|
93
|
+
const [ready, setReady] = React14.useState(false);
|
|
94
|
+
React14.useEffect(() => {
|
|
95
95
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
96
96
|
return () => cancelAnimationFrame(raf);
|
|
97
97
|
}, []);
|
|
@@ -136,7 +136,7 @@ var IndeterminateSvg = React11.memo(function IndeterminateSvg2({
|
|
|
136
136
|
}
|
|
137
137
|
);
|
|
138
138
|
});
|
|
139
|
-
var DeterminateSvg =
|
|
139
|
+
var DeterminateSvg = React14.memo(function DeterminateSvg2({
|
|
140
140
|
size,
|
|
141
141
|
progress
|
|
142
142
|
}) {
|
|
@@ -161,7 +161,7 @@ var DeterminateSvg = React11.memo(function DeterminateSvg2({
|
|
|
161
161
|
}
|
|
162
162
|
);
|
|
163
163
|
});
|
|
164
|
-
var LoadingIndicator =
|
|
164
|
+
var LoadingIndicator = React14.forwardRef(
|
|
165
165
|
(_a, ref) => {
|
|
166
166
|
var _b = _a, {
|
|
167
167
|
variant = "uncontained",
|
|
@@ -276,7 +276,7 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
276
276
|
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
277
277
|
return d;
|
|
278
278
|
}
|
|
279
|
-
var CircularProgress =
|
|
279
|
+
var CircularProgress = React14.forwardRef(
|
|
280
280
|
(_a, ref) => {
|
|
281
281
|
var _b = _a, {
|
|
282
282
|
value,
|
|
@@ -314,15 +314,15 @@ var CircularProgress = React11.forwardRef(
|
|
|
314
314
|
const isWavy = shape === "wavy";
|
|
315
315
|
const BASELINE_SIZE = 48;
|
|
316
316
|
const scaleFactor = size / BASELINE_SIZE;
|
|
317
|
-
const effectiveAmplitude =
|
|
317
|
+
const effectiveAmplitude = React14.useMemo(
|
|
318
318
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
319
319
|
[amplitude, scaleFactor]
|
|
320
320
|
);
|
|
321
|
-
const effectiveWavelength =
|
|
321
|
+
const effectiveWavelength = React14.useMemo(
|
|
322
322
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
323
323
|
[wavelength, scaleFactor]
|
|
324
324
|
);
|
|
325
|
-
const wavyActivePath =
|
|
325
|
+
const wavyActivePath = React14.useMemo(
|
|
326
326
|
() => isWavy ? generateWavyCircularPath(
|
|
327
327
|
center,
|
|
328
328
|
radius,
|
|
@@ -331,8 +331,8 @@ var CircularProgress = React11.forwardRef(
|
|
|
331
331
|
) : null,
|
|
332
332
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
333
333
|
);
|
|
334
|
-
const circumference =
|
|
335
|
-
const gapForTrack =
|
|
334
|
+
const circumference = React14.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
335
|
+
const gapForTrack = React14.useMemo(
|
|
336
336
|
() => (gapSize + trackHeight) / circumference,
|
|
337
337
|
[gapSize, trackHeight, circumference]
|
|
338
338
|
);
|
|
@@ -521,9 +521,9 @@ var CircularProgress = React11.forwardRef(
|
|
|
521
521
|
);
|
|
522
522
|
CircularProgress.displayName = "CircularProgress";
|
|
523
523
|
function useContainerWidth() {
|
|
524
|
-
const [width, setWidth] =
|
|
525
|
-
const observerRef =
|
|
526
|
-
const ref =
|
|
524
|
+
const [width, setWidth] = React14.useState(0);
|
|
525
|
+
const observerRef = React14.useRef(null);
|
|
526
|
+
const ref = React14.useCallback((node) => {
|
|
527
527
|
if (observerRef.current) {
|
|
528
528
|
observerRef.current.disconnect();
|
|
529
529
|
observerRef.current = null;
|
|
@@ -537,7 +537,7 @@ function useContainerWidth() {
|
|
|
537
537
|
observerRef.current = obs;
|
|
538
538
|
}
|
|
539
539
|
}, []);
|
|
540
|
-
|
|
540
|
+
React14.useEffect(() => {
|
|
541
541
|
return () => {
|
|
542
542
|
if (observerRef.current) {
|
|
543
543
|
observerRef.current.disconnect();
|
|
@@ -547,7 +547,7 @@ function useContainerWidth() {
|
|
|
547
547
|
return [ref, width];
|
|
548
548
|
}
|
|
549
549
|
function useMergedRef(...refs) {
|
|
550
|
-
return
|
|
550
|
+
return React14.useCallback(
|
|
551
551
|
(node) => {
|
|
552
552
|
for (const ref of refs) {
|
|
553
553
|
if (typeof ref === "function") {
|
|
@@ -561,7 +561,7 @@ function useMergedRef(...refs) {
|
|
|
561
561
|
[refs]
|
|
562
562
|
);
|
|
563
563
|
}
|
|
564
|
-
var FlatLinearTrack =
|
|
564
|
+
var FlatLinearTrack = React14.memo(function FlatLinearTrack2({
|
|
565
565
|
trackHeight,
|
|
566
566
|
activeColor,
|
|
567
567
|
trackColor,
|
|
@@ -637,7 +637,7 @@ var FlatLinearTrack = React11.memo(function FlatLinearTrack2({
|
|
|
637
637
|
}
|
|
638
638
|
);
|
|
639
639
|
});
|
|
640
|
-
var WavyLinearTrack =
|
|
640
|
+
var WavyLinearTrack = React14.memo(function WavyLinearTrack2({
|
|
641
641
|
trackHeight,
|
|
642
642
|
svgHeight,
|
|
643
643
|
amplitude,
|
|
@@ -656,13 +656,13 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
|
|
|
656
656
|
}) {
|
|
657
657
|
const isDeterminate = typeof value === "number";
|
|
658
658
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
659
|
-
const titleId =
|
|
659
|
+
const titleId = React14.useId();
|
|
660
660
|
const [containerRef, width] = useContainerWidth();
|
|
661
|
-
const activePathRef =
|
|
662
|
-
const trackPathRef =
|
|
661
|
+
const activePathRef = React14.useRef(null);
|
|
662
|
+
const trackPathRef = React14.useRef(null);
|
|
663
663
|
const amplitudeMV = useMotionValue(amplitude);
|
|
664
664
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
665
|
-
|
|
665
|
+
React14.useEffect(() => {
|
|
666
666
|
if (isDeterminate) {
|
|
667
667
|
const fraction = clampedValue / 100;
|
|
668
668
|
let targetAmp = amplitude;
|
|
@@ -833,7 +833,7 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
|
|
|
833
833
|
}
|
|
834
834
|
);
|
|
835
835
|
});
|
|
836
|
-
var LinearProgress =
|
|
836
|
+
var LinearProgress = React14.forwardRef(
|
|
837
837
|
(_a, ref) => {
|
|
838
838
|
var _b = _a, {
|
|
839
839
|
value,
|
|
@@ -874,10 +874,10 @@ var LinearProgress = React11.forwardRef(
|
|
|
874
874
|
]);
|
|
875
875
|
const isDeterminate = value !== void 0;
|
|
876
876
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
877
|
-
const containerRef =
|
|
877
|
+
const containerRef = React14.useRef(null);
|
|
878
878
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
879
|
-
const [isRtl, setIsRtl] =
|
|
880
|
-
|
|
879
|
+
const [isRtl, setIsRtl] = React14.useState(false);
|
|
880
|
+
React14.useEffect(() => {
|
|
881
881
|
if (containerRef.current) {
|
|
882
882
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
883
883
|
setIsRtl(dir === "rtl");
|
|
@@ -885,16 +885,16 @@ var LinearProgress = React11.forwardRef(
|
|
|
885
885
|
}, []);
|
|
886
886
|
const isWavy = shape === "wavy";
|
|
887
887
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
888
|
-
const effectiveAmplitude =
|
|
889
|
-
const svgHeight =
|
|
888
|
+
const effectiveAmplitude = React14.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
889
|
+
const svgHeight = React14.useMemo(
|
|
890
890
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
891
891
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
892
892
|
);
|
|
893
|
-
const shouldShowStop =
|
|
893
|
+
const shouldShowStop = React14.useMemo(
|
|
894
894
|
() => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
|
|
895
895
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
896
896
|
);
|
|
897
|
-
const stopSize =
|
|
897
|
+
const stopSize = React14.useMemo(
|
|
898
898
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
899
899
|
[trackHeight]
|
|
900
900
|
);
|
|
@@ -967,14 +967,14 @@ var LinearProgress = React11.forwardRef(
|
|
|
967
967
|
}
|
|
968
968
|
);
|
|
969
969
|
LinearProgress.displayName = "LinearProgress";
|
|
970
|
-
var ProgressIndicator =
|
|
970
|
+
var ProgressIndicator = React14.forwardRef((props, ref) => {
|
|
971
971
|
if (props.variant === "circular") {
|
|
972
972
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
973
973
|
}
|
|
974
974
|
return /* @__PURE__ */ jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
975
975
|
});
|
|
976
976
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
977
|
-
var RippleItem =
|
|
977
|
+
var RippleItem = React14.memo(function RippleItem2({
|
|
978
978
|
ripple,
|
|
979
979
|
onDone
|
|
980
980
|
}) {
|
|
@@ -1018,8 +1018,8 @@ function Ripple({
|
|
|
1018
1018
|
}
|
|
1019
1019
|
function useRippleState(options = {}) {
|
|
1020
1020
|
const { disabled = false } = options;
|
|
1021
|
-
const [ripples, setRipples] =
|
|
1022
|
-
const onPointerDown =
|
|
1021
|
+
const [ripples, setRipples] = React14.useState([]);
|
|
1022
|
+
const onPointerDown = React14.useCallback(
|
|
1023
1023
|
(e) => {
|
|
1024
1024
|
if (disabled) return;
|
|
1025
1025
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1033,7 +1033,7 @@ function useRippleState(options = {}) {
|
|
|
1033
1033
|
},
|
|
1034
1034
|
[disabled]
|
|
1035
1035
|
);
|
|
1036
|
-
const removeRipple =
|
|
1036
|
+
const removeRipple = React14.useCallback((id) => {
|
|
1037
1037
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1038
1038
|
}, []);
|
|
1039
1039
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1289,7 +1289,7 @@ function AnimatedIconSlot({
|
|
|
1289
1289
|
}
|
|
1290
1290
|
);
|
|
1291
1291
|
}
|
|
1292
|
-
var ButtonComponent =
|
|
1292
|
+
var ButtonComponent = React14.forwardRef(
|
|
1293
1293
|
(_a, ref) => {
|
|
1294
1294
|
var _b = _a, {
|
|
1295
1295
|
className,
|
|
@@ -1351,9 +1351,9 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1351
1351
|
borderWidth: outlineWidth != null ? outlineWidth : colorStyle === "outlined" ? sizeTokens.outlineWidth : 0,
|
|
1352
1352
|
borderStyle: colorStyle === "outlined" ? "solid" : void 0
|
|
1353
1353
|
}, style);
|
|
1354
|
-
const labelText =
|
|
1354
|
+
const labelText = React14.useMemo(() => {
|
|
1355
1355
|
if (asChild) {
|
|
1356
|
-
const child =
|
|
1356
|
+
const child = React14.Children.only(children);
|
|
1357
1357
|
return child.props.children;
|
|
1358
1358
|
}
|
|
1359
1359
|
return children;
|
|
@@ -1361,8 +1361,8 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1361
1361
|
const computedAriaLabel = ariaLabelProp || (typeof children === "string" ? children : void 0);
|
|
1362
1362
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1363
1363
|
const motionRadius = useMotionValue(animateRadius);
|
|
1364
|
-
const asChildRef =
|
|
1365
|
-
const mergedRef =
|
|
1364
|
+
const asChildRef = React14.useRef(null);
|
|
1365
|
+
const mergedRef = React14.useCallback(
|
|
1366
1366
|
(node) => {
|
|
1367
1367
|
asChildRef.current = node;
|
|
1368
1368
|
if (typeof ref === "function") ref(node);
|
|
@@ -1371,14 +1371,14 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1371
1371
|
},
|
|
1372
1372
|
[ref]
|
|
1373
1373
|
);
|
|
1374
|
-
|
|
1374
|
+
React14.useEffect(() => {
|
|
1375
1375
|
if (!asChild) return;
|
|
1376
1376
|
return motionRadius.on("change", (v) => {
|
|
1377
1377
|
if (asChildRef.current)
|
|
1378
1378
|
asChildRef.current.style.borderRadius = `${v}px`;
|
|
1379
1379
|
});
|
|
1380
1380
|
}, [motionRadius, asChild]);
|
|
1381
|
-
|
|
1381
|
+
React14.useEffect(() => {
|
|
1382
1382
|
if (!asChild) return;
|
|
1383
1383
|
const controls = springAnimate(motionRadius, animateRadius);
|
|
1384
1384
|
return () => controls.stop();
|
|
@@ -1386,14 +1386,14 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1386
1386
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1387
1387
|
disabled: loading
|
|
1388
1388
|
});
|
|
1389
|
-
const handleClick =
|
|
1389
|
+
const handleClick = React14.useCallback(
|
|
1390
1390
|
(e) => {
|
|
1391
1391
|
if (loading) return e.preventDefault();
|
|
1392
1392
|
onClick == null ? void 0 : onClick(e);
|
|
1393
1393
|
},
|
|
1394
1394
|
[loading, onClick]
|
|
1395
1395
|
);
|
|
1396
|
-
const handleKeyDown =
|
|
1396
|
+
const handleKeyDown = React14.useCallback(
|
|
1397
1397
|
(e) => {
|
|
1398
1398
|
if (loading) return;
|
|
1399
1399
|
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
@@ -1468,17 +1468,17 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1468
1468
|
}
|
|
1469
1469
|
) })
|
|
1470
1470
|
] });
|
|
1471
|
-
const handleAsChildPointerDown =
|
|
1471
|
+
const handleAsChildPointerDown = React14.useCallback(
|
|
1472
1472
|
(e) => {
|
|
1473
1473
|
springAnimate(motionRadius, pressedRadius);
|
|
1474
1474
|
onPointerDown == null ? void 0 : onPointerDown(e);
|
|
1475
1475
|
},
|
|
1476
1476
|
[motionRadius, pressedRadius, onPointerDown]
|
|
1477
1477
|
);
|
|
1478
|
-
const handleAsChildPointerUp =
|
|
1478
|
+
const handleAsChildPointerUp = React14.useCallback(() => {
|
|
1479
1479
|
springAnimate(motionRadius, animateRadius);
|
|
1480
1480
|
}, [motionRadius, animateRadius]);
|
|
1481
|
-
const handlePointerDown =
|
|
1481
|
+
const handlePointerDown = React14.useCallback(
|
|
1482
1482
|
(e) => {
|
|
1483
1483
|
onPointerDown(e);
|
|
1484
1484
|
},
|
|
@@ -1488,7 +1488,7 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1488
1488
|
const strippedProps = __spreadValues({}, restProps);
|
|
1489
1489
|
for (const key of MOTION_PROP_KEYS) delete strippedProps[key];
|
|
1490
1490
|
const htmlProps = strippedProps;
|
|
1491
|
-
const child =
|
|
1491
|
+
const child = React14.Children.only(children);
|
|
1492
1492
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1493
1493
|
Slot,
|
|
1494
1494
|
__spreadProps(__spreadValues({
|
|
@@ -1505,7 +1505,7 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1505
1505
|
}),
|
|
1506
1506
|
className: buttonClassName
|
|
1507
1507
|
}, htmlProps), {
|
|
1508
|
-
children:
|
|
1508
|
+
children: React14.cloneElement(child, { children: innerContent })
|
|
1509
1509
|
})
|
|
1510
1510
|
) });
|
|
1511
1511
|
}
|
|
@@ -1534,13 +1534,13 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1534
1534
|
}
|
|
1535
1535
|
);
|
|
1536
1536
|
ButtonComponent.displayName = "Button";
|
|
1537
|
-
var Button =
|
|
1537
|
+
var Button = React14.memo(ButtonComponent);
|
|
1538
1538
|
var VARIANT_FONT = {
|
|
1539
1539
|
outlined: "'Material Symbols Outlined'",
|
|
1540
1540
|
rounded: "'Material Symbols Rounded'",
|
|
1541
1541
|
sharp: "'Material Symbols Sharp'"
|
|
1542
1542
|
};
|
|
1543
|
-
var IconComponent =
|
|
1543
|
+
var IconComponent = React14.forwardRef(
|
|
1544
1544
|
(_a, ref) => {
|
|
1545
1545
|
var _b = _a, {
|
|
1546
1546
|
name,
|
|
@@ -1606,7 +1606,7 @@ var IconComponent = React11.forwardRef(
|
|
|
1606
1606
|
}
|
|
1607
1607
|
);
|
|
1608
1608
|
IconComponent.displayName = "Icon";
|
|
1609
|
-
var Icon =
|
|
1609
|
+
var Icon = React14.memo(IconComponent);
|
|
1610
1610
|
var BUTTON_GROUP_TOKENS = {
|
|
1611
1611
|
standard: {
|
|
1612
1612
|
betweenSpace: 12,
|
|
@@ -1714,13 +1714,7 @@ var WIDTH_MORPH_SPRING = {
|
|
|
1714
1714
|
damping: 38,
|
|
1715
1715
|
mass: 0.85
|
|
1716
1716
|
};
|
|
1717
|
-
var
|
|
1718
|
-
type: "spring",
|
|
1719
|
-
stiffness: 430,
|
|
1720
|
-
damping: 38,
|
|
1721
|
-
mass: 0.8
|
|
1722
|
-
};
|
|
1723
|
-
var AnimatedCheckLabel = React11.memo(function AnimatedCheckLabel2({
|
|
1717
|
+
var AnimatedCheckLabel = React14.memo(function AnimatedCheckLabel2({
|
|
1724
1718
|
selected,
|
|
1725
1719
|
size,
|
|
1726
1720
|
children
|
|
@@ -1757,23 +1751,6 @@ var AnimatedCheckLabel = React11.memo(function AnimatedCheckLabel2({
|
|
|
1757
1751
|
}
|
|
1758
1752
|
);
|
|
1759
1753
|
});
|
|
1760
|
-
var AnimatedNavbarLabel = React11.memo(function AnimatedNavbarLabel2({
|
|
1761
|
-
show,
|
|
1762
|
-
children
|
|
1763
|
-
}) {
|
|
1764
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "popLayout", children: show && /* @__PURE__ */ jsx(
|
|
1765
|
-
m.span,
|
|
1766
|
-
{
|
|
1767
|
-
initial: { width: 0, opacity: 0, scale: 0.8 },
|
|
1768
|
-
animate: { width: "auto", opacity: 1, scale: 1 },
|
|
1769
|
-
exit: { width: 0, opacity: 0, scale: 0.8 },
|
|
1770
|
-
transition: NAVBAR_EXPRESSIVE_SPRING,
|
|
1771
|
-
className: "overflow-hidden whitespace-nowrap text-sm font-semibold tracking-[0.01em] ml-1.5",
|
|
1772
|
-
children
|
|
1773
|
-
},
|
|
1774
|
-
"navbar-label"
|
|
1775
|
-
) });
|
|
1776
|
-
});
|
|
1777
1754
|
function resolveConnectedShapes(variant, orientation, isFirst, isLast, itemSize) {
|
|
1778
1755
|
const defaults = ButtonGroupDefaults.connectedLeadingButtonShapes(itemSize);
|
|
1779
1756
|
if (variant !== "connected") return defaults;
|
|
@@ -1794,7 +1771,7 @@ function resolveConnectedShapes(variant, orientation, isFirst, isLast, itemSize)
|
|
|
1794
1771
|
}
|
|
1795
1772
|
return defaults;
|
|
1796
1773
|
}
|
|
1797
|
-
function resolveIconAndLabel(element, isSelected, itemSize,
|
|
1774
|
+
function resolveIconAndLabel(element, isSelected, itemSize, showCheck, iconBehavior, labelBehavior) {
|
|
1798
1775
|
let icon = element.props.icon;
|
|
1799
1776
|
let label = element.props.children;
|
|
1800
1777
|
const animateCheckInLabel = showCheck && iconBehavior !== "none" && iconBehavior !== "selected" && label !== void 0;
|
|
@@ -1810,9 +1787,6 @@ function resolveIconAndLabel(element, isSelected, itemSize, variant, showCheck,
|
|
|
1810
1787
|
}
|
|
1811
1788
|
if (animateCheckInLabel && label !== void 0) {
|
|
1812
1789
|
label = /* @__PURE__ */ jsx(AnimatedCheckLabel, { selected: isSelected, size: itemSize, children: label });
|
|
1813
|
-
} else if (variant === "navbar" && label !== void 0) {
|
|
1814
|
-
const showLabel = !labelBehavior || labelBehavior === "all" || labelBehavior === "selected" && isSelected;
|
|
1815
|
-
label = /* @__PURE__ */ jsx(AnimatedNavbarLabel, { show: showLabel, children: label });
|
|
1816
1790
|
}
|
|
1817
1791
|
return { icon, label };
|
|
1818
1792
|
}
|
|
@@ -1847,13 +1821,11 @@ function resolveFlexTargets(variant, orientation, isSelected, isPressed, hasSele
|
|
|
1847
1821
|
function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex, existingAnimate, existingWhileTap) {
|
|
1848
1822
|
var _a, _b;
|
|
1849
1823
|
const props = { animate: __spreadValues({}, existingAnimate) };
|
|
1850
|
-
if (
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
props.animate.paddingInline = flex.paddingInline;
|
|
1856
|
-
}
|
|
1824
|
+
if (flex.flexGrow !== void 0) {
|
|
1825
|
+
props.animate.flexGrow = flex.flexGrow;
|
|
1826
|
+
}
|
|
1827
|
+
if (flex.paddingInline !== void 0) {
|
|
1828
|
+
props.animate.paddingInline = flex.paddingInline;
|
|
1857
1829
|
}
|
|
1858
1830
|
if (variant === "standard") {
|
|
1859
1831
|
const pressedRadius = (_a = PRESSED_RADIUS_MAP[itemSize]) != null ? _a : PRESSED_RADIUS_MAP.sm;
|
|
@@ -1904,16 +1876,9 @@ function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex
|
|
|
1904
1876
|
});
|
|
1905
1877
|
props.layout = true;
|
|
1906
1878
|
}
|
|
1907
|
-
if (variant === "navbar") {
|
|
1908
|
-
props.layout = true;
|
|
1909
|
-
props.transition = {
|
|
1910
|
-
layout: WIDTH_MORPH_SPRING,
|
|
1911
|
-
default: BUTTON_SHAPE_MORPH_SPRING
|
|
1912
|
-
};
|
|
1913
|
-
}
|
|
1914
1879
|
return props;
|
|
1915
1880
|
}
|
|
1916
|
-
var ButtonGroupComponent =
|
|
1881
|
+
var ButtonGroupComponent = React14.forwardRef(
|
|
1917
1882
|
(_a, ref) => {
|
|
1918
1883
|
var _b = _a, {
|
|
1919
1884
|
className,
|
|
@@ -1946,13 +1911,12 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1946
1911
|
"labelBehavior",
|
|
1947
1912
|
"style"
|
|
1948
1913
|
]);
|
|
1949
|
-
const [pressedIndex, setPressedIndex] =
|
|
1950
|
-
const [lockedGroupSize, setLockedGroupSize] =
|
|
1914
|
+
const [pressedIndex, setPressedIndex] = React14.useState(null);
|
|
1915
|
+
const [lockedGroupSize, setLockedGroupSize] = React14.useState(
|
|
1951
1916
|
null
|
|
1952
1917
|
);
|
|
1953
|
-
const
|
|
1954
|
-
const
|
|
1955
|
-
const setRootRef = React11.useCallback(
|
|
1918
|
+
const rootRef = React14.useRef(null);
|
|
1919
|
+
const setRootRef = React14.useCallback(
|
|
1956
1920
|
(node) => {
|
|
1957
1921
|
rootRef.current = node;
|
|
1958
1922
|
if (typeof ref === "function") {
|
|
@@ -1963,12 +1927,12 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1963
1927
|
},
|
|
1964
1928
|
[ref]
|
|
1965
1929
|
);
|
|
1966
|
-
const childrenArray =
|
|
1967
|
-
() =>
|
|
1930
|
+
const childrenArray = React14.useMemo(
|
|
1931
|
+
() => React14.Children.toArray(children).filter(React14.isValidElement),
|
|
1968
1932
|
[children]
|
|
1969
1933
|
);
|
|
1970
1934
|
const count = childrenArray.length;
|
|
1971
|
-
const groupSizeSignature =
|
|
1935
|
+
const groupSizeSignature = React14.useMemo(
|
|
1972
1936
|
() => `${childrenArray.map((child, index) => {
|
|
1973
1937
|
var _a2, _b2, _c, _d, _e;
|
|
1974
1938
|
const element = child;
|
|
@@ -1983,8 +1947,8 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1983
1947
|
}).join("|")}|${variant}|${orientation}|${showCheck}`,
|
|
1984
1948
|
[childrenArray, orientation, showCheck, size, variant]
|
|
1985
1949
|
);
|
|
1986
|
-
const groupSizeSignatureRef =
|
|
1987
|
-
|
|
1950
|
+
const groupSizeSignatureRef = React14.useRef(groupSizeSignature);
|
|
1951
|
+
React14.useLayoutEffect(() => {
|
|
1988
1952
|
if (groupSizeSignatureRef.current !== groupSizeSignature) {
|
|
1989
1953
|
groupSizeSignatureRef.current = groupSizeSignature;
|
|
1990
1954
|
setLockedGroupSize(null);
|
|
@@ -1992,7 +1956,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1992
1956
|
}, [groupSizeSignature]);
|
|
1993
1957
|
const hasExplicitGroupSize = orientation === "horizontal" ? (style == null ? void 0 : style.width) !== void 0 || (style == null ? void 0 : style.inlineSize) !== void 0 : (style == null ? void 0 : style.height) !== void 0 || (style == null ? void 0 : style.blockSize) !== void 0;
|
|
1994
1958
|
const shouldLockGroupSize = activeMorphing && !fullWidth && !hasExplicitGroupSize && count > 1;
|
|
1995
|
-
|
|
1959
|
+
React14.useLayoutEffect(() => {
|
|
1996
1960
|
if (!shouldLockGroupSize) {
|
|
1997
1961
|
if (lockedGroupSize !== null) setLockedGroupSize(null);
|
|
1998
1962
|
return;
|
|
@@ -2006,7 +1970,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2006
1970
|
setLockedGroupSize(Math.ceil(nextSize * 100) / 100);
|
|
2007
1971
|
}
|
|
2008
1972
|
}, [lockedGroupSize, orientation, shouldLockGroupSize]);
|
|
2009
|
-
const groupStyle =
|
|
1973
|
+
const groupStyle = React14.useMemo(() => {
|
|
2010
1974
|
const nextStyle = __spreadValues({}, style);
|
|
2011
1975
|
if (shouldLockGroupSize && lockedGroupSize !== null) {
|
|
2012
1976
|
if (orientation === "horizontal") {
|
|
@@ -2017,13 +1981,13 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2017
1981
|
}
|
|
2018
1982
|
return nextStyle;
|
|
2019
1983
|
}, [lockedGroupSize, orientation, shouldLockGroupSize, style]);
|
|
2020
|
-
const hasSelected =
|
|
1984
|
+
const hasSelected = React14.useMemo(
|
|
2021
1985
|
() => childrenArray.some(
|
|
2022
1986
|
(child) => child.props.selected
|
|
2023
1987
|
),
|
|
2024
1988
|
[childrenArray]
|
|
2025
1989
|
);
|
|
2026
|
-
const handlePointerLeaveAndUp =
|
|
1990
|
+
const handlePointerLeaveAndUp = React14.useCallback(() => {
|
|
2027
1991
|
setPressedIndex(null);
|
|
2028
1992
|
}, []);
|
|
2029
1993
|
return /* @__PURE__ */ jsx(
|
|
@@ -2033,7 +1997,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2033
1997
|
className: cn(
|
|
2034
1998
|
"inline-flex p-0 m-0 border-none max-w-full [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2035
1999
|
orientation === "vertical" ? "flex-col items-stretch overflow-y-auto overflow-x-hidden" : "flex-row overflow-x-auto overflow-y-hidden",
|
|
2036
|
-
variant === "standard" ? "gap-3" :
|
|
2000
|
+
variant === "standard" ? "gap-3" : "gap-0.5",
|
|
2037
2001
|
fullWidth && "w-full",
|
|
2038
2002
|
fullWidth && orientation === "vertical" && "h-full",
|
|
2039
2003
|
className
|
|
@@ -2043,7 +2007,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2043
2007
|
onPointerUp: handlePointerLeaveAndUp
|
|
2044
2008
|
}, props), {
|
|
2045
2009
|
children: childrenArray.map((child, index) => {
|
|
2046
|
-
var _a2, _b2
|
|
2010
|
+
var _a2, _b2;
|
|
2047
2011
|
const element = child;
|
|
2048
2012
|
const isSelected = element.props.selected === true;
|
|
2049
2013
|
const isFirst = index === 0;
|
|
@@ -2055,7 +2019,6 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2055
2019
|
element,
|
|
2056
2020
|
isSelected,
|
|
2057
2021
|
itemSize,
|
|
2058
|
-
variant,
|
|
2059
2022
|
showCheck,
|
|
2060
2023
|
iconBehavior,
|
|
2061
2024
|
labelBehavior
|
|
@@ -2081,7 +2044,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2081
2044
|
basePx
|
|
2082
2045
|
);
|
|
2083
2046
|
const dynamicStyle = __spreadValues({}, element.props.style);
|
|
2084
|
-
if (
|
|
2047
|
+
if (flex.flexGrow !== void 0 && fullWidth) {
|
|
2085
2048
|
dynamicStyle.flexBasis = 0;
|
|
2086
2049
|
dynamicStyle.flexShrink = 1;
|
|
2087
2050
|
dynamicStyle.minWidth = 0;
|
|
@@ -2099,13 +2062,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2099
2062
|
existingWhileTap
|
|
2100
2063
|
);
|
|
2101
2064
|
const connectedClasses = variant === "connected" && isSelected ? "z-20" : "";
|
|
2102
|
-
const
|
|
2103
|
-
flexBasis: fullWidth && labelBehavior !== "selected" ? 0 : "auto",
|
|
2104
|
-
flexShrink: fullWidth ? 1 : 0,
|
|
2105
|
-
flexGrow: flex.flexGrow,
|
|
2106
|
-
minWidth: labelBehavior !== "selected" ? 0 : "fit-content"
|
|
2107
|
-
} : {};
|
|
2108
|
-
const clonedElement = React11.cloneElement(element, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
2065
|
+
const clonedElement = React14.cloneElement(element, __spreadValues(__spreadProps(__spreadValues({
|
|
2109
2066
|
key: (_b2 = element.key) != null ? _b2 : index,
|
|
2110
2067
|
tabIndex: isFirst ? 0 : -1,
|
|
2111
2068
|
size: size || element.props.size,
|
|
@@ -2114,71 +2071,20 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2114
2071
|
}, variant === "connected" && {
|
|
2115
2072
|
colorStyle: element.props.colorStyle || "tonal",
|
|
2116
2073
|
selectedColorStyle: element.props.selectedColorStyle || "filled"
|
|
2117
|
-
}),
|
|
2118
|
-
colorStyle: "text",
|
|
2119
|
-
selectedColorStyle: "text",
|
|
2120
|
-
className: cn(
|
|
2121
|
-
element.props.className,
|
|
2122
|
-
"w-full! h-full! px-3! min-w-0! relative z-20 flex items-center justify-center",
|
|
2123
|
-
isSelected ? "text-m3-on-secondary-container! hover:bg-transparent! active:bg-transparent!" : "text-m3-on-surface-variant! hover:bg-transparent! active:bg-transparent!",
|
|
2124
|
-
itemClassName
|
|
2125
|
-
)
|
|
2126
|
-
}), variant !== "navbar" && {
|
|
2074
|
+
}), {
|
|
2127
2075
|
className: cn(
|
|
2128
2076
|
element.props.className,
|
|
2129
2077
|
connectedClasses,
|
|
2130
2078
|
"focus-visible:z-10 hover:z-10 relative min-w-0",
|
|
2131
2079
|
orientation === "vertical" && "w-full",
|
|
2132
2080
|
itemClassName
|
|
2133
|
-
)
|
|
2134
|
-
|
|
2135
|
-
style: variant === "navbar" ? __spreadProps(__spreadValues({}, dynamicStyle), { minWidth: 0 }) : dynamicStyle,
|
|
2081
|
+
),
|
|
2082
|
+
style: dynamicStyle,
|
|
2136
2083
|
onPointerDown: (e) => {
|
|
2137
2084
|
setPressedIndex(index);
|
|
2138
2085
|
if (element.props.onPointerDown) element.props.onPointerDown(e);
|
|
2139
2086
|
}
|
|
2140
2087
|
}), motionProps));
|
|
2141
|
-
if (variant === "navbar") {
|
|
2142
|
-
return /* @__PURE__ */ jsxs(
|
|
2143
|
-
m.div,
|
|
2144
|
-
{
|
|
2145
|
-
layout: true,
|
|
2146
|
-
whileTap: { scale: 0.96 },
|
|
2147
|
-
transition: NAVBAR_EXPRESSIVE_SPRING,
|
|
2148
|
-
className: "group relative h-full flex items-center justify-center min-w-0",
|
|
2149
|
-
style: navbarFlexStyle,
|
|
2150
|
-
children: [
|
|
2151
|
-
/* @__PURE__ */ jsxs(
|
|
2152
|
-
"div",
|
|
2153
|
-
{
|
|
2154
|
-
className: "absolute inset-x-1 inset-y-0 m-auto flex items-center justify-center pointer-events-none",
|
|
2155
|
-
style: { zIndex: 1 },
|
|
2156
|
-
children: [
|
|
2157
|
-
/* @__PURE__ */ jsx(
|
|
2158
|
-
"div",
|
|
2159
|
-
{
|
|
2160
|
-
className: "w-full h-[40px] bg-m3-on-surface-variant/8 opacity-0 group-hover:opacity-100 transition-opacity duration-200",
|
|
2161
|
-
style: { borderRadius: PILL_BORDER_RADIUS }
|
|
2162
|
-
}
|
|
2163
|
-
),
|
|
2164
|
-
/* @__PURE__ */ jsx(AnimatePresence, { children: isSelected && /* @__PURE__ */ jsx(
|
|
2165
|
-
m.div,
|
|
2166
|
-
{
|
|
2167
|
-
layoutId: `navbar-active-indicator-${layoutIdGroup}`,
|
|
2168
|
-
className: "absolute inset-0 m-auto w-full h-[40px] bg-m3-secondary-container",
|
|
2169
|
-
style: { borderRadius: PILL_BORDER_RADIUS },
|
|
2170
|
-
transition: NAVBAR_EXPRESSIVE_SPRING
|
|
2171
|
-
}
|
|
2172
|
-
) })
|
|
2173
|
-
]
|
|
2174
|
-
}
|
|
2175
|
-
),
|
|
2176
|
-
clonedElement
|
|
2177
|
-
]
|
|
2178
|
-
},
|
|
2179
|
-
(_c = element.key) != null ? _c : index
|
|
2180
|
-
);
|
|
2181
|
-
}
|
|
2182
2088
|
return clonedElement;
|
|
2183
2089
|
})
|
|
2184
2090
|
})
|
|
@@ -2186,7 +2092,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2186
2092
|
}
|
|
2187
2093
|
);
|
|
2188
2094
|
ButtonGroupComponent.displayName = "ButtonGroup";
|
|
2189
|
-
var ButtonGroup =
|
|
2095
|
+
var ButtonGroup = React14.memo(ButtonGroupComponent);
|
|
2190
2096
|
var SIZE_HEIGHT = {
|
|
2191
2097
|
sm: "h-14",
|
|
2192
2098
|
md: "h-20",
|
|
@@ -2241,9 +2147,9 @@ var COLOR_CLASSES = {
|
|
|
2241
2147
|
}
|
|
2242
2148
|
};
|
|
2243
2149
|
function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
2244
|
-
const [collapsed, setCollapsed] =
|
|
2245
|
-
const lastScrollY =
|
|
2246
|
-
|
|
2150
|
+
const [collapsed, setCollapsed] = React14.useState(false);
|
|
2151
|
+
const lastScrollY = React14.useRef(0);
|
|
2152
|
+
React14.useEffect(() => {
|
|
2247
2153
|
if (!enabled || typeof window === "undefined") return;
|
|
2248
2154
|
lastScrollY.current = window.scrollY;
|
|
2249
2155
|
const handleScroll = () => {
|
|
@@ -2266,7 +2172,7 @@ function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
|
2266
2172
|
}, [enabled, scrollThreshold, collapsed, onCollapsedChange]);
|
|
2267
2173
|
return collapsed;
|
|
2268
2174
|
}
|
|
2269
|
-
var ExtendedFABComponent =
|
|
2175
|
+
var ExtendedFABComponent = React14.forwardRef(
|
|
2270
2176
|
(_a, ref) => {
|
|
2271
2177
|
var _b = _a, {
|
|
2272
2178
|
className,
|
|
@@ -2283,6 +2189,8 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2283
2189
|
scrollThreshold = 50,
|
|
2284
2190
|
collapsed,
|
|
2285
2191
|
onCollapsedChange,
|
|
2192
|
+
asChild = false,
|
|
2193
|
+
children,
|
|
2286
2194
|
onClick,
|
|
2287
2195
|
onKeyDown,
|
|
2288
2196
|
layoutId,
|
|
@@ -2302,16 +2210,18 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2302
2210
|
"scrollThreshold",
|
|
2303
2211
|
"collapsed",
|
|
2304
2212
|
"onCollapsedChange",
|
|
2213
|
+
"asChild",
|
|
2214
|
+
"children",
|
|
2305
2215
|
"onClick",
|
|
2306
2216
|
"onKeyDown",
|
|
2307
2217
|
"layoutId",
|
|
2308
2218
|
"aria-label"
|
|
2309
2219
|
]);
|
|
2310
2220
|
var _a2, _b2, _c, _d;
|
|
2311
|
-
const localRef =
|
|
2312
|
-
|
|
2313
|
-
const [dir, setDir] =
|
|
2314
|
-
|
|
2221
|
+
const localRef = React14.useRef(null);
|
|
2222
|
+
React14.useImperativeHandle(ref, () => localRef.current);
|
|
2223
|
+
const [dir, setDir] = React14.useState("ltr");
|
|
2224
|
+
React14.useEffect(() => {
|
|
2315
2225
|
var _a3;
|
|
2316
2226
|
if (!localRef.current) return;
|
|
2317
2227
|
const closestDir = (_a3 = localRef.current.closest("[dir]")) == null ? void 0 : _a3.getAttribute("dir");
|
|
@@ -2332,7 +2242,7 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2332
2242
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2333
2243
|
disabled: loading
|
|
2334
2244
|
});
|
|
2335
|
-
const handleClick =
|
|
2245
|
+
const handleClick = React14.useCallback(
|
|
2336
2246
|
(e) => {
|
|
2337
2247
|
if (loading) {
|
|
2338
2248
|
e.preventDefault();
|
|
@@ -2342,7 +2252,7 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2342
2252
|
},
|
|
2343
2253
|
[loading, onClick]
|
|
2344
2254
|
);
|
|
2345
|
-
const handleKeyDown =
|
|
2255
|
+
const handleKeyDown = React14.useCallback(
|
|
2346
2256
|
(e) => {
|
|
2347
2257
|
if (loading) return;
|
|
2348
2258
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2353,7 +2263,109 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2353
2263
|
},
|
|
2354
2264
|
[loading, onClick, onKeyDown]
|
|
2355
2265
|
);
|
|
2356
|
-
|
|
2266
|
+
const containerClassName = cn(
|
|
2267
|
+
"relative shrink-0 inline-flex items-center select-none cursor-pointer overflow-hidden",
|
|
2268
|
+
"transition-[box-shadow,filter] duration-200",
|
|
2269
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2270
|
+
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2271
|
+
colors.bg,
|
|
2272
|
+
colors.text,
|
|
2273
|
+
lowered ? "shadow-sm" : "shadow-md",
|
|
2274
|
+
(_d = SIZE_HEIGHT[size]) != null ? _d : "h-14",
|
|
2275
|
+
SIZE_TEXT[size],
|
|
2276
|
+
isCollapsed ? cn("px-0 justify-center", SIZE_WIDTH_COLLAPSED[size]) : cn(
|
|
2277
|
+
hasIcon ? "justify-start" : "justify-center",
|
|
2278
|
+
SIZE_PADDING[size],
|
|
2279
|
+
hasIcon && SIZE_GAP[size]
|
|
2280
|
+
),
|
|
2281
|
+
dir === "rtl" || restProps.dir === "rtl" ? "flex-row-reverse" : "flex-row",
|
|
2282
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2283
|
+
className
|
|
2284
|
+
);
|
|
2285
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2286
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2287
|
+
hasIcon && /* @__PURE__ */ jsx(
|
|
2288
|
+
m.span,
|
|
2289
|
+
{
|
|
2290
|
+
layout: "position",
|
|
2291
|
+
className: cn(
|
|
2292
|
+
"flex items-center justify-center shrink-0",
|
|
2293
|
+
sizeIcon.cls
|
|
2294
|
+
),
|
|
2295
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
2296
|
+
m.span,
|
|
2297
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2298
|
+
transition: SPRING_TRANSITION,
|
|
2299
|
+
className: "flex items-center justify-center shrink-0 w-full h-full",
|
|
2300
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
2301
|
+
LoadingIndicator,
|
|
2302
|
+
{
|
|
2303
|
+
size: sizeIcon.px,
|
|
2304
|
+
color: "currentColor",
|
|
2305
|
+
"aria-label": "Loading"
|
|
2306
|
+
}
|
|
2307
|
+
) : /* @__PURE__ */ jsx(
|
|
2308
|
+
ProgressIndicator,
|
|
2309
|
+
{
|
|
2310
|
+
variant: "circular",
|
|
2311
|
+
size: sizeIcon.px,
|
|
2312
|
+
color: "currentColor",
|
|
2313
|
+
trackColor: "transparent",
|
|
2314
|
+
"aria-label": "Loading"
|
|
2315
|
+
}
|
|
2316
|
+
)
|
|
2317
|
+
}),
|
|
2318
|
+
"loading"
|
|
2319
|
+
) : icon && /* @__PURE__ */ jsx(
|
|
2320
|
+
m.span,
|
|
2321
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2322
|
+
transition: SPRING_TRANSITION,
|
|
2323
|
+
"aria-hidden": "true",
|
|
2324
|
+
className: "flex items-center justify-center shrink-0 w-full h-full [&>svg]:w-full [&>svg]:h-full",
|
|
2325
|
+
children: icon
|
|
2326
|
+
}),
|
|
2327
|
+
"icon"
|
|
2328
|
+
) })
|
|
2329
|
+
}
|
|
2330
|
+
),
|
|
2331
|
+
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: !isCollapsed && /* @__PURE__ */ jsx(
|
|
2332
|
+
m.span,
|
|
2333
|
+
{
|
|
2334
|
+
layout: "position",
|
|
2335
|
+
initial: { opacity: 0, width: 0 },
|
|
2336
|
+
animate: { opacity: 1, width: "auto" },
|
|
2337
|
+
exit: { opacity: 0, width: 0 },
|
|
2338
|
+
transition: {
|
|
2339
|
+
opacity: { duration: 0.15, ease: "linear" },
|
|
2340
|
+
width: SPRING_TRANSITION
|
|
2341
|
+
},
|
|
2342
|
+
className: "overflow-hidden whitespace-nowrap",
|
|
2343
|
+
children: label
|
|
2344
|
+
},
|
|
2345
|
+
"label"
|
|
2346
|
+
) })
|
|
2347
|
+
] });
|
|
2348
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: visible && !(isCollapsed && !hasIcon) && (asChild ? /* @__PURE__ */ jsx(
|
|
2349
|
+
Slot,
|
|
2350
|
+
__spreadProps(__spreadValues({
|
|
2351
|
+
ref: localRef,
|
|
2352
|
+
"aria-label": ariaLabel || label,
|
|
2353
|
+
"aria-busy": loading || void 0,
|
|
2354
|
+
"aria-disabled": loading || restProps.disabled,
|
|
2355
|
+
onClick: handleClick,
|
|
2356
|
+
onPointerDown,
|
|
2357
|
+
onKeyDown: handleKeyDown,
|
|
2358
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
2359
|
+
borderRadius: `${radiusConfig.default}px`
|
|
2360
|
+
}),
|
|
2361
|
+
className: containerClassName
|
|
2362
|
+
}, restProps), {
|
|
2363
|
+
children: React14.cloneElement(
|
|
2364
|
+
React14.Children.only(children),
|
|
2365
|
+
{ children: innerContent }
|
|
2366
|
+
)
|
|
2367
|
+
})
|
|
2368
|
+
) : /* @__PURE__ */ jsx(
|
|
2357
2369
|
m.button,
|
|
2358
2370
|
__spreadProps(__spreadValues({
|
|
2359
2371
|
ref: localRef,
|
|
@@ -2385,95 +2397,15 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2385
2397
|
opacity: { duration: 0.2, ease: "linear" },
|
|
2386
2398
|
layout: SPRING_TRANSITION
|
|
2387
2399
|
},
|
|
2388
|
-
className:
|
|
2389
|
-
"relative shrink-0 inline-flex items-center select-none cursor-pointer overflow-hidden",
|
|
2390
|
-
"transition-[box-shadow,filter] duration-200",
|
|
2391
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2392
|
-
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2393
|
-
colors.bg,
|
|
2394
|
-
colors.text,
|
|
2395
|
-
lowered ? "shadow-sm" : "shadow-md",
|
|
2396
|
-
(_d = SIZE_HEIGHT[size]) != null ? _d : "h-14",
|
|
2397
|
-
SIZE_TEXT[size],
|
|
2398
|
-
isCollapsed ? cn("px-0 justify-center", SIZE_WIDTH_COLLAPSED[size]) : cn(
|
|
2399
|
-
hasIcon ? "justify-start" : "justify-center",
|
|
2400
|
-
SIZE_PADDING[size],
|
|
2401
|
-
hasIcon && SIZE_GAP[size]
|
|
2402
|
-
),
|
|
2403
|
-
dir === "rtl" || restProps.dir === "rtl" ? "flex-row-reverse" : "flex-row",
|
|
2404
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2405
|
-
className
|
|
2406
|
-
)
|
|
2400
|
+
className: containerClassName
|
|
2407
2401
|
}, restProps), {
|
|
2408
|
-
children:
|
|
2409
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2410
|
-
hasIcon && /* @__PURE__ */ jsx(
|
|
2411
|
-
m.span,
|
|
2412
|
-
{
|
|
2413
|
-
layout: "position",
|
|
2414
|
-
className: cn(
|
|
2415
|
-
"flex items-center justify-center shrink-0",
|
|
2416
|
-
sizeIcon.cls
|
|
2417
|
-
),
|
|
2418
|
-
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
2419
|
-
m.span,
|
|
2420
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2421
|
-
transition: SPRING_TRANSITION,
|
|
2422
|
-
className: "flex items-center justify-center shrink-0 w-full h-full",
|
|
2423
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
2424
|
-
LoadingIndicator,
|
|
2425
|
-
{
|
|
2426
|
-
size: sizeIcon.px,
|
|
2427
|
-
color: "currentColor",
|
|
2428
|
-
"aria-label": "Loading"
|
|
2429
|
-
}
|
|
2430
|
-
) : /* @__PURE__ */ jsx(
|
|
2431
|
-
ProgressIndicator,
|
|
2432
|
-
{
|
|
2433
|
-
variant: "circular",
|
|
2434
|
-
size: sizeIcon.px,
|
|
2435
|
-
color: "currentColor",
|
|
2436
|
-
trackColor: "transparent",
|
|
2437
|
-
"aria-label": "Loading"
|
|
2438
|
-
}
|
|
2439
|
-
)
|
|
2440
|
-
}),
|
|
2441
|
-
"loading"
|
|
2442
|
-
) : icon && /* @__PURE__ */ jsx(
|
|
2443
|
-
m.span,
|
|
2444
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2445
|
-
transition: SPRING_TRANSITION,
|
|
2446
|
-
"aria-hidden": "true",
|
|
2447
|
-
className: "flex items-center justify-center shrink-0 w-full h-full [&>svg]:w-full [&>svg]:h-full",
|
|
2448
|
-
children: icon
|
|
2449
|
-
}),
|
|
2450
|
-
"icon"
|
|
2451
|
-
) })
|
|
2452
|
-
}
|
|
2453
|
-
),
|
|
2454
|
-
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: !isCollapsed && /* @__PURE__ */ jsx(
|
|
2455
|
-
m.span,
|
|
2456
|
-
{
|
|
2457
|
-
layout: "position",
|
|
2458
|
-
initial: { opacity: 0, width: 0 },
|
|
2459
|
-
animate: { opacity: 1, width: "auto" },
|
|
2460
|
-
exit: { opacity: 0, width: 0 },
|
|
2461
|
-
transition: {
|
|
2462
|
-
opacity: { duration: 0.15, ease: "linear" },
|
|
2463
|
-
width: SPRING_TRANSITION
|
|
2464
|
-
},
|
|
2465
|
-
className: "overflow-hidden whitespace-nowrap",
|
|
2466
|
-
children: label
|
|
2467
|
-
},
|
|
2468
|
-
"label"
|
|
2469
|
-
) })
|
|
2470
|
-
]
|
|
2402
|
+
children: innerContent
|
|
2471
2403
|
})
|
|
2472
|
-
) }) });
|
|
2404
|
+
)) }) });
|
|
2473
2405
|
}
|
|
2474
2406
|
);
|
|
2475
2407
|
ExtendedFABComponent.displayName = "ExtendedFAB";
|
|
2476
|
-
var ExtendedFAB =
|
|
2408
|
+
var ExtendedFAB = React14.memo(ExtendedFABComponent);
|
|
2477
2409
|
var SIZE_STYLES = {
|
|
2478
2410
|
sm: "h-10 w-10",
|
|
2479
2411
|
md: "h-14 w-14",
|
|
@@ -2544,7 +2476,7 @@ function FABPosition({
|
|
|
2544
2476
|
}
|
|
2545
2477
|
);
|
|
2546
2478
|
}
|
|
2547
|
-
var FABComponent =
|
|
2479
|
+
var FABComponent = React14.forwardRef(
|
|
2548
2480
|
(_a, ref) => {
|
|
2549
2481
|
var _b = _a, {
|
|
2550
2482
|
className,
|
|
@@ -2558,6 +2490,7 @@ var FABComponent = React11.forwardRef(
|
|
|
2558
2490
|
loading = false,
|
|
2559
2491
|
loadingVariant = "loading-indicator",
|
|
2560
2492
|
visible = true,
|
|
2493
|
+
asChild = false,
|
|
2561
2494
|
onClick,
|
|
2562
2495
|
onKeyDown,
|
|
2563
2496
|
"aria-label": ariaLabel
|
|
@@ -2573,6 +2506,7 @@ var FABComponent = React11.forwardRef(
|
|
|
2573
2506
|
"loading",
|
|
2574
2507
|
"loadingVariant",
|
|
2575
2508
|
"visible",
|
|
2509
|
+
"asChild",
|
|
2576
2510
|
"onClick",
|
|
2577
2511
|
"onKeyDown",
|
|
2578
2512
|
"aria-label"
|
|
@@ -2589,7 +2523,7 @@ var FABComponent = React11.forwardRef(
|
|
|
2589
2523
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2590
2524
|
disabled: loading
|
|
2591
2525
|
});
|
|
2592
|
-
const handleClick =
|
|
2526
|
+
const handleClick = React14.useCallback(
|
|
2593
2527
|
(e) => {
|
|
2594
2528
|
if (loading) {
|
|
2595
2529
|
e.preventDefault();
|
|
@@ -2599,7 +2533,7 @@ var FABComponent = React11.forwardRef(
|
|
|
2599
2533
|
},
|
|
2600
2534
|
[loading, onClick]
|
|
2601
2535
|
);
|
|
2602
|
-
const handleKeyDown =
|
|
2536
|
+
const handleKeyDown = React14.useCallback(
|
|
2603
2537
|
(e) => {
|
|
2604
2538
|
if (loading) return;
|
|
2605
2539
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2610,19 +2544,116 @@ var FABComponent = React11.forwardRef(
|
|
|
2610
2544
|
},
|
|
2611
2545
|
[loading, onClick, onKeyDown]
|
|
2612
2546
|
);
|
|
2613
|
-
|
|
2547
|
+
const labelContent = asChild ? React14.Children.only(children).props.children : children;
|
|
2548
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2549
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
2550
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2551
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
2552
|
+
m.span,
|
|
2553
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2554
|
+
transition: SPRING_TRANSITION,
|
|
2555
|
+
className: cn(
|
|
2556
|
+
"flex items-center justify-center shrink-0",
|
|
2557
|
+
iconClass
|
|
2558
|
+
),
|
|
2559
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
2560
|
+
LoadingIndicator,
|
|
2561
|
+
{
|
|
2562
|
+
size: iconPx,
|
|
2563
|
+
color: "currentColor",
|
|
2564
|
+
"aria-label": "Loading"
|
|
2565
|
+
}
|
|
2566
|
+
) : /* @__PURE__ */ jsx(
|
|
2567
|
+
ProgressIndicator,
|
|
2568
|
+
{
|
|
2569
|
+
variant: "circular",
|
|
2570
|
+
size: iconPx,
|
|
2571
|
+
color: "currentColor",
|
|
2572
|
+
trackColor: "transparent",
|
|
2573
|
+
"aria-label": "Loading"
|
|
2574
|
+
}
|
|
2575
|
+
)
|
|
2576
|
+
}),
|
|
2577
|
+
"loading"
|
|
2578
|
+
) : /* @__PURE__ */ jsx(
|
|
2579
|
+
m.span,
|
|
2580
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2581
|
+
transition: SPRING_TRANSITION,
|
|
2582
|
+
"aria-hidden": "true",
|
|
2583
|
+
className: cn(
|
|
2584
|
+
"flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
2585
|
+
iconClass
|
|
2586
|
+
),
|
|
2587
|
+
children: icon
|
|
2588
|
+
}),
|
|
2589
|
+
"icon"
|
|
2590
|
+
) }),
|
|
2591
|
+
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: extended && labelContent && /* @__PURE__ */ jsx(
|
|
2592
|
+
m.span,
|
|
2593
|
+
{
|
|
2594
|
+
initial: { width: 0, opacity: 0 },
|
|
2595
|
+
animate: { width: "auto", opacity: 1 },
|
|
2596
|
+
exit: { width: 0, opacity: 0 },
|
|
2597
|
+
transition: SPRING_TRANSITION,
|
|
2598
|
+
className: "overflow-hidden whitespace-nowrap ml-3",
|
|
2599
|
+
children: labelContent
|
|
2600
|
+
},
|
|
2601
|
+
"label"
|
|
2602
|
+
) })
|
|
2603
|
+
] });
|
|
2604
|
+
const containerClassName = cn(
|
|
2605
|
+
"relative shrink-0 inline-flex items-center justify-center",
|
|
2606
|
+
"select-none cursor-pointer overflow-hidden",
|
|
2607
|
+
"transition-[box-shadow,opacity,filter] duration-200",
|
|
2608
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2609
|
+
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2610
|
+
colors.bg,
|
|
2611
|
+
colors.text,
|
|
2612
|
+
lowered ? "shadow-sm" : colors.shadow,
|
|
2613
|
+
(_d = SIZE_STYLES[size]) != null ? _d : "h-14 w-14",
|
|
2614
|
+
extended && "w-auto px-6",
|
|
2615
|
+
SIZE_TEXT_CLASS[size],
|
|
2616
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2617
|
+
className
|
|
2618
|
+
);
|
|
2619
|
+
const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
|
|
2620
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: visible && (asChild ? /* @__PURE__ */ jsx(
|
|
2621
|
+
Slot,
|
|
2622
|
+
__spreadProps(__spreadValues({
|
|
2623
|
+
ref,
|
|
2624
|
+
"aria-label": computedAriaLabel,
|
|
2625
|
+
"aria-busy": loading || void 0,
|
|
2626
|
+
"aria-disabled": loading || restProps.disabled,
|
|
2627
|
+
onClick: handleClick,
|
|
2628
|
+
onPointerDown,
|
|
2629
|
+
onKeyDown: handleKeyDown,
|
|
2630
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
2631
|
+
borderRadius: `${animateRadius}px`
|
|
2632
|
+
}),
|
|
2633
|
+
className: containerClassName
|
|
2634
|
+
}, restProps), {
|
|
2635
|
+
children: React14.cloneElement(
|
|
2636
|
+
React14.Children.only(children),
|
|
2637
|
+
{ children: innerContent }
|
|
2638
|
+
)
|
|
2639
|
+
})
|
|
2640
|
+
) : /* @__PURE__ */ jsx(
|
|
2614
2641
|
m.button,
|
|
2615
2642
|
__spreadProps(__spreadValues({
|
|
2616
2643
|
ref,
|
|
2617
2644
|
type: "button",
|
|
2618
|
-
"aria-label":
|
|
2645
|
+
"aria-label": computedAriaLabel,
|
|
2619
2646
|
"aria-busy": loading || void 0,
|
|
2620
2647
|
"aria-disabled": loading || restProps.disabled,
|
|
2621
2648
|
onClick: handleClick,
|
|
2622
2649
|
onPointerDown,
|
|
2623
2650
|
onKeyDown: handleKeyDown,
|
|
2624
2651
|
style,
|
|
2625
|
-
initial: {
|
|
2652
|
+
initial: {
|
|
2653
|
+
scale: 0.5,
|
|
2654
|
+
opacity: 0,
|
|
2655
|
+
borderRadius: animateRadius
|
|
2656
|
+
},
|
|
2626
2657
|
animate: { scale: 1, opacity: 1, borderRadius: animateRadius },
|
|
2627
2658
|
exit: { scale: 0.5, opacity: 0 },
|
|
2628
2659
|
whileTap: { borderRadius: pressedRadius },
|
|
@@ -2631,84 +2662,15 @@ var FABComponent = React11.forwardRef(
|
|
|
2631
2662
|
scale: SPRING_TRANSITION,
|
|
2632
2663
|
opacity: { duration: 0.25, ease: "easeOut" }
|
|
2633
2664
|
},
|
|
2634
|
-
className:
|
|
2635
|
-
"relative shrink-0 inline-flex items-center justify-center",
|
|
2636
|
-
"select-none cursor-pointer overflow-hidden",
|
|
2637
|
-
"transition-[box-shadow,opacity,filter] duration-200",
|
|
2638
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2639
|
-
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2640
|
-
colors.bg,
|
|
2641
|
-
colors.text,
|
|
2642
|
-
lowered ? "shadow-sm" : colors.shadow,
|
|
2643
|
-
(_d = SIZE_STYLES[size]) != null ? _d : "h-14 w-14",
|
|
2644
|
-
extended && "w-auto px-6",
|
|
2645
|
-
SIZE_TEXT_CLASS[size],
|
|
2646
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2647
|
-
className
|
|
2648
|
-
)
|
|
2665
|
+
className: containerClassName
|
|
2649
2666
|
}, restProps), {
|
|
2650
|
-
children:
|
|
2651
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
2652
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2653
|
-
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
2654
|
-
m.span,
|
|
2655
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2656
|
-
transition: SPRING_TRANSITION,
|
|
2657
|
-
className: cn(
|
|
2658
|
-
"flex items-center justify-center shrink-0",
|
|
2659
|
-
iconClass
|
|
2660
|
-
),
|
|
2661
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
2662
|
-
LoadingIndicator,
|
|
2663
|
-
{
|
|
2664
|
-
size: iconPx,
|
|
2665
|
-
color: "currentColor",
|
|
2666
|
-
"aria-label": "Loading"
|
|
2667
|
-
}
|
|
2668
|
-
) : /* @__PURE__ */ jsx(
|
|
2669
|
-
ProgressIndicator,
|
|
2670
|
-
{
|
|
2671
|
-
variant: "circular",
|
|
2672
|
-
size: iconPx,
|
|
2673
|
-
color: "currentColor",
|
|
2674
|
-
trackColor: "transparent",
|
|
2675
|
-
"aria-label": "Loading"
|
|
2676
|
-
}
|
|
2677
|
-
)
|
|
2678
|
-
}),
|
|
2679
|
-
"loading"
|
|
2680
|
-
) : /* @__PURE__ */ jsx(
|
|
2681
|
-
m.span,
|
|
2682
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2683
|
-
transition: SPRING_TRANSITION,
|
|
2684
|
-
"aria-hidden": "true",
|
|
2685
|
-
className: cn(
|
|
2686
|
-
"flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
2687
|
-
iconClass
|
|
2688
|
-
),
|
|
2689
|
-
children: icon
|
|
2690
|
-
}),
|
|
2691
|
-
"icon"
|
|
2692
|
-
) }),
|
|
2693
|
-
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: extended && children && /* @__PURE__ */ jsx(
|
|
2694
|
-
m.span,
|
|
2695
|
-
{
|
|
2696
|
-
initial: { width: 0, opacity: 0 },
|
|
2697
|
-
animate: { width: "auto", opacity: 1 },
|
|
2698
|
-
exit: { width: 0, opacity: 0 },
|
|
2699
|
-
transition: SPRING_TRANSITION,
|
|
2700
|
-
className: "overflow-hidden whitespace-nowrap ml-3",
|
|
2701
|
-
children
|
|
2702
|
-
},
|
|
2703
|
-
"label"
|
|
2704
|
-
) })
|
|
2705
|
-
]
|
|
2667
|
+
children: innerContent
|
|
2706
2668
|
})
|
|
2707
|
-
) }) });
|
|
2669
|
+
)) }) });
|
|
2708
2670
|
}
|
|
2709
2671
|
);
|
|
2710
2672
|
FABComponent.displayName = "FAB";
|
|
2711
|
-
var FAB =
|
|
2673
|
+
var FAB = React14.memo(FABComponent);
|
|
2712
2674
|
var SPRING_NORMAL = { stiffness: 700, damping: 40 };
|
|
2713
2675
|
var SPRING_REDUCED = { stiffness: 1e4, damping: 100 };
|
|
2714
2676
|
var FOCUS_DELAY_MS = 50;
|
|
@@ -2816,7 +2778,7 @@ function CloseIcon() {
|
|
|
2816
2778
|
function defaultFabIcon(progress) {
|
|
2817
2779
|
return progress > 0.5 ? /* @__PURE__ */ jsx(CloseIcon, {}) : /* @__PURE__ */ jsx(AddIcon, {});
|
|
2818
2780
|
}
|
|
2819
|
-
var ToggleFABComponent =
|
|
2781
|
+
var ToggleFABComponent = React14.forwardRef(
|
|
2820
2782
|
({
|
|
2821
2783
|
expanded,
|
|
2822
2784
|
onToggle,
|
|
@@ -2834,7 +2796,7 @@ var ToggleFABComponent = React11.forwardRef(
|
|
|
2834
2796
|
const sizeTokens = (_b = TOGGLE_FAB_SIZES[fabSize]) != null ? _b : TOGGLE_FAB_SIZES.baseline;
|
|
2835
2797
|
const springConfig = prefersReduced ? SPRING_REDUCED : SPRING_NORMAL;
|
|
2836
2798
|
const checkedProgress = useSpring(expanded ? 1 : 0, springConfig);
|
|
2837
|
-
|
|
2799
|
+
React14.useEffect(() => {
|
|
2838
2800
|
checkedProgress.set(expanded ? 1 : 0);
|
|
2839
2801
|
}, [expanded, checkedProgress]);
|
|
2840
2802
|
const borderRadius = useTransform(
|
|
@@ -2842,12 +2804,12 @@ var ToggleFABComponent = React11.forwardRef(
|
|
|
2842
2804
|
[0, 1],
|
|
2843
2805
|
[`${sizeTokens.initialRadius}px`, `${sizeTokens.finalRadius}px`]
|
|
2844
2806
|
);
|
|
2845
|
-
const [iconProgress, setIconProgress] =
|
|
2846
|
-
|
|
2807
|
+
const [iconProgress, setIconProgress] = React14.useState(expanded ? 1 : 0);
|
|
2808
|
+
React14.useEffect(() => {
|
|
2847
2809
|
return checkedProgress.on("change", setIconProgress);
|
|
2848
2810
|
}, [checkedProgress]);
|
|
2849
2811
|
const { ripples, onPointerDown, removeRipple } = useRippleState();
|
|
2850
|
-
const handleClick =
|
|
2812
|
+
const handleClick = React14.useCallback(() => {
|
|
2851
2813
|
onToggle(!expanded);
|
|
2852
2814
|
}, [expanded, onToggle]);
|
|
2853
2815
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2896,7 +2858,7 @@ var ToggleFABComponent = React11.forwardRef(
|
|
|
2896
2858
|
}
|
|
2897
2859
|
);
|
|
2898
2860
|
ToggleFABComponent.displayName = "ToggleFAB";
|
|
2899
|
-
var ToggleFAB =
|
|
2861
|
+
var ToggleFAB = React14.memo(ToggleFABComponent);
|
|
2900
2862
|
function FABMenuItem({
|
|
2901
2863
|
icon,
|
|
2902
2864
|
label,
|
|
@@ -2904,12 +2866,14 @@ function FABMenuItem({
|
|
|
2904
2866
|
disabled = false,
|
|
2905
2867
|
colorVariant = "primary",
|
|
2906
2868
|
className,
|
|
2907
|
-
tabIndex = 0
|
|
2869
|
+
tabIndex = 0,
|
|
2870
|
+
asChild = false,
|
|
2871
|
+
children
|
|
2908
2872
|
}) {
|
|
2909
2873
|
var _a;
|
|
2910
2874
|
const colors = (_a = MENU_ITEM_COLORS[colorVariant]) != null ? _a : MENU_ITEM_COLORS.primary;
|
|
2911
2875
|
const { ripples, onPointerDown, removeRipple } = useRippleState({ disabled });
|
|
2912
|
-
const handleClick =
|
|
2876
|
+
const handleClick = React14.useCallback(
|
|
2913
2877
|
(e) => {
|
|
2914
2878
|
if (disabled) {
|
|
2915
2879
|
e.preventDefault();
|
|
@@ -2919,7 +2883,7 @@ function FABMenuItem({
|
|
|
2919
2883
|
},
|
|
2920
2884
|
[disabled, onClick]
|
|
2921
2885
|
);
|
|
2922
|
-
const handleKeyDown =
|
|
2886
|
+
const handleKeyDown = React14.useCallback(
|
|
2923
2887
|
(e) => {
|
|
2924
2888
|
if (disabled) return;
|
|
2925
2889
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -2929,7 +2893,55 @@ function FABMenuItem({
|
|
|
2929
2893
|
},
|
|
2930
2894
|
[disabled, onClick]
|
|
2931
2895
|
);
|
|
2932
|
-
|
|
2896
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2897
|
+
/* @__PURE__ */ jsx(TouchTarget, {}),
|
|
2898
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2899
|
+
/* @__PURE__ */ jsx(
|
|
2900
|
+
"span",
|
|
2901
|
+
{
|
|
2902
|
+
"aria-hidden": "true",
|
|
2903
|
+
className: "relative z-10 flex items-center justify-center size-6 shrink-0 [&>svg]:w-full [&>svg]:h-full pointer-events-none",
|
|
2904
|
+
children: icon
|
|
2905
|
+
}
|
|
2906
|
+
),
|
|
2907
|
+
label && /* @__PURE__ */ jsx("span", { className: "relative z-10 text-base font-medium leading-none pointer-events-none", children: label })
|
|
2908
|
+
] });
|
|
2909
|
+
const containerClassName = cn(
|
|
2910
|
+
"relative inline-flex flex-row items-center",
|
|
2911
|
+
"select-none cursor-pointer overflow-hidden",
|
|
2912
|
+
"whitespace-nowrap",
|
|
2913
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-1",
|
|
2914
|
+
MENU_ITEM_STYLES.size,
|
|
2915
|
+
MENU_ITEM_STYLES.gap,
|
|
2916
|
+
label ? MENU_ITEM_STYLES.padding : "px-4",
|
|
2917
|
+
!label && "justify-center",
|
|
2918
|
+
colors.bg,
|
|
2919
|
+
colors.text,
|
|
2920
|
+
disabled && "opacity-[0.38] pointer-events-none",
|
|
2921
|
+
className
|
|
2922
|
+
);
|
|
2923
|
+
const containerStyle = {
|
|
2924
|
+
transformOrigin: "right",
|
|
2925
|
+
borderRadius: `${MENU_ITEM_STYLES.cornerRadius}px`
|
|
2926
|
+
};
|
|
2927
|
+
if (asChild) {
|
|
2928
|
+
const child = React14.Children.only(children);
|
|
2929
|
+
return /* @__PURE__ */ jsx(m.div, { variants: MENU_ITEM_VARIANTS, style: containerStyle, children: /* @__PURE__ */ jsx(
|
|
2930
|
+
Slot,
|
|
2931
|
+
{
|
|
2932
|
+
role: "menuitem",
|
|
2933
|
+
tabIndex,
|
|
2934
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
2935
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
2936
|
+
onClick: handleClick,
|
|
2937
|
+
onPointerDown,
|
|
2938
|
+
onKeyDown: handleKeyDown,
|
|
2939
|
+
className: containerClassName,
|
|
2940
|
+
children: React14.cloneElement(child, { children: innerContent })
|
|
2941
|
+
}
|
|
2942
|
+
) });
|
|
2943
|
+
}
|
|
2944
|
+
return /* @__PURE__ */ jsx(
|
|
2933
2945
|
m.div,
|
|
2934
2946
|
{
|
|
2935
2947
|
role: "menuitem",
|
|
@@ -2940,37 +2952,9 @@ function FABMenuItem({
|
|
|
2940
2952
|
onPointerDown,
|
|
2941
2953
|
onKeyDown: handleKeyDown,
|
|
2942
2954
|
variants: MENU_ITEM_VARIANTS,
|
|
2943
|
-
style:
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
},
|
|
2947
|
-
className: cn(
|
|
2948
|
-
"relative inline-flex flex-row items-center",
|
|
2949
|
-
"select-none cursor-pointer overflow-hidden",
|
|
2950
|
-
"whitespace-nowrap",
|
|
2951
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-1",
|
|
2952
|
-
MENU_ITEM_STYLES.size,
|
|
2953
|
-
MENU_ITEM_STYLES.gap,
|
|
2954
|
-
label ? MENU_ITEM_STYLES.padding : "px-4",
|
|
2955
|
-
!label && "justify-center",
|
|
2956
|
-
colors.bg,
|
|
2957
|
-
colors.text,
|
|
2958
|
-
disabled && "opacity-[0.38] pointer-events-none",
|
|
2959
|
-
className
|
|
2960
|
-
),
|
|
2961
|
-
children: [
|
|
2962
|
-
/* @__PURE__ */ jsx(TouchTarget, {}),
|
|
2963
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2964
|
-
/* @__PURE__ */ jsx(
|
|
2965
|
-
"span",
|
|
2966
|
-
{
|
|
2967
|
-
"aria-hidden": "true",
|
|
2968
|
-
className: "relative z-10 flex items-center justify-center size-6 shrink-0 [&>svg]:w-full [&>svg]:h-full pointer-events-none",
|
|
2969
|
-
children: icon
|
|
2970
|
-
}
|
|
2971
|
-
),
|
|
2972
|
-
label && /* @__PURE__ */ jsx("span", { className: "relative z-10 text-base font-medium leading-none pointer-events-none", children: label })
|
|
2973
|
-
]
|
|
2955
|
+
style: containerStyle,
|
|
2956
|
+
className: containerClassName,
|
|
2957
|
+
children: innerContent
|
|
2974
2958
|
}
|
|
2975
2959
|
);
|
|
2976
2960
|
}
|
|
@@ -2986,13 +2970,13 @@ function FABMenu({
|
|
|
2986
2970
|
focusLast = true,
|
|
2987
2971
|
"aria-label": ariaLabel
|
|
2988
2972
|
}) {
|
|
2989
|
-
const fabId =
|
|
2990
|
-
const menuId =
|
|
2991
|
-
const toggleRef =
|
|
2992
|
-
const itemRefs =
|
|
2993
|
-
const [focusedIndex, setFocusedIndex] =
|
|
2994
|
-
const reversedItems =
|
|
2995
|
-
const focusItem =
|
|
2973
|
+
const fabId = React14.useId();
|
|
2974
|
+
const menuId = React14.useId();
|
|
2975
|
+
const toggleRef = React14.useRef(null);
|
|
2976
|
+
const itemRefs = React14.useRef([]);
|
|
2977
|
+
const [focusedIndex, setFocusedIndex] = React14.useState(-1);
|
|
2978
|
+
const reversedItems = React14.useMemo(() => [...items].reverse(), [items]);
|
|
2979
|
+
const focusItem = React14.useCallback((index) => {
|
|
2996
2980
|
var _a;
|
|
2997
2981
|
const clampedIndex = Math.max(
|
|
2998
2982
|
0,
|
|
@@ -3001,8 +2985,8 @@ function FABMenu({
|
|
|
3001
2985
|
setFocusedIndex(clampedIndex);
|
|
3002
2986
|
(_a = itemRefs.current[clampedIndex]) == null ? void 0 : _a.focus();
|
|
3003
2987
|
}, []);
|
|
3004
|
-
const wasExpandedRef =
|
|
3005
|
-
|
|
2988
|
+
const wasExpandedRef = React14.useRef(false);
|
|
2989
|
+
React14.useEffect(() => {
|
|
3006
2990
|
var _a;
|
|
3007
2991
|
if (expanded) {
|
|
3008
2992
|
wasExpandedRef.current = true;
|
|
@@ -3017,7 +3001,7 @@ function FABMenu({
|
|
|
3017
3001
|
wasExpandedRef.current = false;
|
|
3018
3002
|
setFocusedIndex(-1);
|
|
3019
3003
|
}, [expanded, focusLast, items.length, focusItem]);
|
|
3020
|
-
const handleMenuKeyDown =
|
|
3004
|
+
const handleMenuKeyDown = React14.useCallback(
|
|
3021
3005
|
(e) => {
|
|
3022
3006
|
if (!expanded) return;
|
|
3023
3007
|
const lastIndex = items.length - 1;
|
|
@@ -3239,7 +3223,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
3239
3223
|
}
|
|
3240
3224
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
3241
3225
|
}
|
|
3242
|
-
var IconButtonComponent =
|
|
3226
|
+
var IconButtonComponent = React14.forwardRef(
|
|
3243
3227
|
(_a, ref) => {
|
|
3244
3228
|
var _b = _a, {
|
|
3245
3229
|
className,
|
|
@@ -3252,6 +3236,7 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3252
3236
|
loading = false,
|
|
3253
3237
|
loadingVariant = "loading-indicator",
|
|
3254
3238
|
iconSize,
|
|
3239
|
+
asChild = false,
|
|
3255
3240
|
children,
|
|
3256
3241
|
onClick,
|
|
3257
3242
|
onKeyDown,
|
|
@@ -3267,6 +3252,7 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3267
3252
|
"loading",
|
|
3268
3253
|
"loadingVariant",
|
|
3269
3254
|
"iconSize",
|
|
3255
|
+
"asChild",
|
|
3270
3256
|
"children",
|
|
3271
3257
|
"onClick",
|
|
3272
3258
|
"onKeyDown",
|
|
@@ -3275,18 +3261,18 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3275
3261
|
var _a2, _b2;
|
|
3276
3262
|
const isToggle = variant === "toggle";
|
|
3277
3263
|
const isSelected = isToggle && !!selected;
|
|
3278
|
-
const resolvedColorClass =
|
|
3264
|
+
const resolvedColorClass = React14.useMemo(
|
|
3279
3265
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
3280
3266
|
[isSelected, colorStyle]
|
|
3281
3267
|
);
|
|
3282
|
-
const outlineWidthClass =
|
|
3268
|
+
const outlineWidthClass = React14.useMemo(
|
|
3283
3269
|
() => {
|
|
3284
3270
|
var _a3;
|
|
3285
3271
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
3286
3272
|
},
|
|
3287
3273
|
[colorStyle, isSelected, size]
|
|
3288
3274
|
);
|
|
3289
|
-
const disabledBgClass =
|
|
3275
|
+
const disabledBgClass = React14.useMemo(
|
|
3290
3276
|
() => resolveDisabledBgClass(colorStyle),
|
|
3291
3277
|
[colorStyle]
|
|
3292
3278
|
);
|
|
@@ -3307,7 +3293,7 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3307
3293
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
3308
3294
|
disabled: loading
|
|
3309
3295
|
});
|
|
3310
|
-
const handleClick =
|
|
3296
|
+
const handleClick = React14.useCallback(
|
|
3311
3297
|
(e) => {
|
|
3312
3298
|
if (loading) {
|
|
3313
3299
|
e.preventDefault();
|
|
@@ -3317,7 +3303,7 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3317
3303
|
},
|
|
3318
3304
|
[loading, onClick]
|
|
3319
3305
|
);
|
|
3320
|
-
const handleKeyDown =
|
|
3306
|
+
const handleKeyDown = React14.useCallback(
|
|
3321
3307
|
(e) => {
|
|
3322
3308
|
if (loading) return;
|
|
3323
3309
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -3328,7 +3314,87 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3328
3314
|
},
|
|
3329
3315
|
[loading, onClick, onKeyDown]
|
|
3330
3316
|
);
|
|
3331
|
-
|
|
3317
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3318
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
3319
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3320
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
3321
|
+
m.span,
|
|
3322
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3323
|
+
transition: SPRING_TRANSITION,
|
|
3324
|
+
className: cn(
|
|
3325
|
+
"flex items-center justify-center shrink-0",
|
|
3326
|
+
iconSize != null ? void 0 : iconClass
|
|
3327
|
+
),
|
|
3328
|
+
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
3329
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
3330
|
+
LoadingIndicator,
|
|
3331
|
+
{
|
|
3332
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3333
|
+
color: "currentColor",
|
|
3334
|
+
"aria-label": "Loading"
|
|
3335
|
+
}
|
|
3336
|
+
) : /* @__PURE__ */ jsx(
|
|
3337
|
+
ProgressIndicator,
|
|
3338
|
+
{
|
|
3339
|
+
variant: "circular",
|
|
3340
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3341
|
+
color: "currentColor",
|
|
3342
|
+
trackColor: "transparent",
|
|
3343
|
+
"aria-label": "Loading"
|
|
3344
|
+
}
|
|
3345
|
+
)
|
|
3346
|
+
}),
|
|
3347
|
+
"loading"
|
|
3348
|
+
) : /* @__PURE__ */ jsx(
|
|
3349
|
+
m.span,
|
|
3350
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3351
|
+
transition: SPRING_TRANSITION,
|
|
3352
|
+
"aria-hidden": "true",
|
|
3353
|
+
className: cn(
|
|
3354
|
+
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
3355
|
+
iconSize != null ? void 0 : iconClass
|
|
3356
|
+
),
|
|
3357
|
+
style: {
|
|
3358
|
+
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
3359
|
+
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
3360
|
+
height: isCustomSize ? `${iconSize}px` : void 0
|
|
3361
|
+
},
|
|
3362
|
+
children: asChild ? React14.Children.only(children).props.children : children
|
|
3363
|
+
}),
|
|
3364
|
+
"content"
|
|
3365
|
+
) })
|
|
3366
|
+
] });
|
|
3367
|
+
const containerClassName = cn(
|
|
3368
|
+
baseIconButtonClasses,
|
|
3369
|
+
resolvedColorClass,
|
|
3370
|
+
outlineWidthClass,
|
|
3371
|
+
disabledBgClass,
|
|
3372
|
+
"overflow-hidden",
|
|
3373
|
+
SIZE_STYLES2[size],
|
|
3374
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
3375
|
+
className
|
|
3376
|
+
);
|
|
3377
|
+
if (asChild) {
|
|
3378
|
+
const child = React14.Children.only(children);
|
|
3379
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
3380
|
+
Slot,
|
|
3381
|
+
__spreadProps(__spreadValues({
|
|
3382
|
+
ref,
|
|
3383
|
+
"aria-pressed": isToggle ? isSelected : void 0,
|
|
3384
|
+
"aria-label": ariaLabel,
|
|
3385
|
+
"aria-busy": loading || void 0,
|
|
3386
|
+
"aria-disabled": loading || restProps.disabled,
|
|
3387
|
+
onClick: handleClick,
|
|
3388
|
+
onPointerDown,
|
|
3389
|
+
onKeyDown: handleKeyDown,
|
|
3390
|
+
style: __spreadProps(__spreadValues({}, style), { borderRadius: `${animateRadius}px` }),
|
|
3391
|
+
className: containerClassName
|
|
3392
|
+
}, restProps), {
|
|
3393
|
+
children: React14.cloneElement(child, { children: innerContent })
|
|
3394
|
+
})
|
|
3395
|
+
) });
|
|
3396
|
+
}
|
|
3397
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
3332
3398
|
m.button,
|
|
3333
3399
|
__spreadProps(__spreadValues({
|
|
3334
3400
|
ref,
|
|
@@ -3344,78 +3410,20 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3344
3410
|
animate: { borderRadius: animateRadius },
|
|
3345
3411
|
whileTap: { borderRadius: pressedRadius },
|
|
3346
3412
|
transition: { borderRadius: SPRING_TRANSITION_FAST },
|
|
3347
|
-
className:
|
|
3348
|
-
baseIconButtonClasses,
|
|
3349
|
-
resolvedColorClass,
|
|
3350
|
-
outlineWidthClass,
|
|
3351
|
-
disabledBgClass,
|
|
3352
|
-
"overflow-hidden",
|
|
3353
|
-
SIZE_STYLES2[size],
|
|
3354
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
3355
|
-
className
|
|
3356
|
-
)
|
|
3413
|
+
className: containerClassName
|
|
3357
3414
|
}, restProps), {
|
|
3358
|
-
children:
|
|
3359
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
3360
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3361
|
-
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
3362
|
-
m.span,
|
|
3363
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3364
|
-
transition: SPRING_TRANSITION,
|
|
3365
|
-
className: cn(
|
|
3366
|
-
"flex items-center justify-center shrink-0",
|
|
3367
|
-
iconSize != null ? void 0 : iconClass
|
|
3368
|
-
),
|
|
3369
|
-
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
3370
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
3371
|
-
LoadingIndicator,
|
|
3372
|
-
{
|
|
3373
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3374
|
-
color: "currentColor",
|
|
3375
|
-
"aria-label": "Loading"
|
|
3376
|
-
}
|
|
3377
|
-
) : /* @__PURE__ */ jsx(
|
|
3378
|
-
ProgressIndicator,
|
|
3379
|
-
{
|
|
3380
|
-
variant: "circular",
|
|
3381
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3382
|
-
color: "currentColor",
|
|
3383
|
-
trackColor: "transparent",
|
|
3384
|
-
"aria-label": "Loading"
|
|
3385
|
-
}
|
|
3386
|
-
)
|
|
3387
|
-
}),
|
|
3388
|
-
"loading"
|
|
3389
|
-
) : /* @__PURE__ */ jsx(
|
|
3390
|
-
m.span,
|
|
3391
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3392
|
-
transition: SPRING_TRANSITION,
|
|
3393
|
-
"aria-hidden": "true",
|
|
3394
|
-
className: cn(
|
|
3395
|
-
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
3396
|
-
iconSize != null ? void 0 : iconClass
|
|
3397
|
-
),
|
|
3398
|
-
style: {
|
|
3399
|
-
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
3400
|
-
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
3401
|
-
height: isCustomSize ? `${iconSize}px` : void 0
|
|
3402
|
-
},
|
|
3403
|
-
children
|
|
3404
|
-
}),
|
|
3405
|
-
"content"
|
|
3406
|
-
) })
|
|
3407
|
-
]
|
|
3415
|
+
children: innerContent
|
|
3408
3416
|
})
|
|
3409
3417
|
) });
|
|
3410
3418
|
}
|
|
3411
3419
|
);
|
|
3412
3420
|
IconButtonComponent.displayName = "IconButton";
|
|
3413
|
-
var IconButton =
|
|
3414
|
-
var SplitButtonContext =
|
|
3421
|
+
var IconButton = React14.memo(IconButtonComponent);
|
|
3422
|
+
var SplitButtonContext = React14.createContext(null);
|
|
3415
3423
|
function useSplitButtonContext() {
|
|
3416
|
-
return
|
|
3424
|
+
return React14.useContext(SplitButtonContext);
|
|
3417
3425
|
}
|
|
3418
|
-
var SplitButtonLayoutComponent =
|
|
3426
|
+
var SplitButtonLayoutComponent = React14.forwardRef(
|
|
3419
3427
|
(_a, ref) => {
|
|
3420
3428
|
var _b = _a, {
|
|
3421
3429
|
leadingButton,
|
|
@@ -3432,10 +3440,10 @@ var SplitButtonLayoutComponent = React11.forwardRef(
|
|
|
3432
3440
|
"variant",
|
|
3433
3441
|
"size"
|
|
3434
3442
|
]);
|
|
3435
|
-
const leadingProps =
|
|
3443
|
+
const leadingProps = React14.isValidElement(leadingButton) ? leadingButton.props : {};
|
|
3436
3444
|
const size = layoutSize || leadingProps.size;
|
|
3437
3445
|
const variant = layoutVariant || leadingProps.variant;
|
|
3438
|
-
const contextValue =
|
|
3446
|
+
const contextValue = React14.useMemo(
|
|
3439
3447
|
() => ({
|
|
3440
3448
|
size,
|
|
3441
3449
|
variant
|
|
@@ -3461,8 +3469,8 @@ var SplitButtonLayoutComponent = React11.forwardRef(
|
|
|
3461
3469
|
}
|
|
3462
3470
|
);
|
|
3463
3471
|
SplitButtonLayoutComponent.displayName = "SplitButtonLayout";
|
|
3464
|
-
var SplitButtonLayout =
|
|
3465
|
-
var StateLayer =
|
|
3472
|
+
var SplitButtonLayout = React14.memo(SplitButtonLayoutComponent);
|
|
3473
|
+
var StateLayer = React14.forwardRef(
|
|
3466
3474
|
(_a, ref) => {
|
|
3467
3475
|
var _b = _a, { className, hovered, focused, pressed } = _b, props = __objRest(_b, ["className", "hovered", "focused", "pressed"]);
|
|
3468
3476
|
let opacity = 0;
|
|
@@ -3714,7 +3722,7 @@ var splitButtonVariants = cva(
|
|
|
3714
3722
|
}
|
|
3715
3723
|
}
|
|
3716
3724
|
);
|
|
3717
|
-
var SplitButtonLeadingComponent =
|
|
3725
|
+
var SplitButtonLeadingComponent = React14.forwardRef(
|
|
3718
3726
|
(_a, ref) => {
|
|
3719
3727
|
var _b = _a, {
|
|
3720
3728
|
className,
|
|
@@ -3724,6 +3732,7 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3724
3732
|
icon,
|
|
3725
3733
|
children,
|
|
3726
3734
|
disabled,
|
|
3735
|
+
asChild = false,
|
|
3727
3736
|
onClick,
|
|
3728
3737
|
onPointerDown,
|
|
3729
3738
|
onPointerUp,
|
|
@@ -3739,6 +3748,7 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3739
3748
|
"icon",
|
|
3740
3749
|
"children",
|
|
3741
3750
|
"disabled",
|
|
3751
|
+
"asChild",
|
|
3742
3752
|
"onClick",
|
|
3743
3753
|
"onPointerDown",
|
|
3744
3754
|
"onPointerUp",
|
|
@@ -3751,9 +3761,9 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3751
3761
|
const context = useSplitButtonContext();
|
|
3752
3762
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
3753
3763
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
3754
|
-
const [isHovered, setIsHovered] =
|
|
3755
|
-
const [isFocused, setIsFocused] =
|
|
3756
|
-
const [isPressed, setIsPressed] =
|
|
3764
|
+
const [isHovered, setIsHovered] = React14.useState(false);
|
|
3765
|
+
const [isFocused, setIsFocused] = React14.useState(false);
|
|
3766
|
+
const [isPressed, setIsPressed] = React14.useState(false);
|
|
3757
3767
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
3758
3768
|
const typographyClass = (_c = BUTTON_TYPOGRAPHY_TOKENS[actualSize]) != null ? _c : BUTTON_TYPOGRAPHY_TOKENS.sm;
|
|
3759
3769
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -3765,7 +3775,7 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3765
3775
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
3766
3776
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
3767
3777
|
const borderRadius = `${outerRadius}px ${innerCornerRadius}px ${innerCornerRadius}px ${outerRadius}px`;
|
|
3768
|
-
const handleClick =
|
|
3778
|
+
const handleClick = React14.useCallback(
|
|
3769
3779
|
(e) => {
|
|
3770
3780
|
if (disabled) {
|
|
3771
3781
|
e.preventDefault();
|
|
@@ -3775,7 +3785,7 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3775
3785
|
},
|
|
3776
3786
|
[disabled, onClick]
|
|
3777
3787
|
);
|
|
3778
|
-
const handlePointerDown =
|
|
3788
|
+
const handlePointerDown = React14.useCallback(
|
|
3779
3789
|
(e) => {
|
|
3780
3790
|
onRipplePointerDown(e);
|
|
3781
3791
|
setIsPressed(true);
|
|
@@ -3783,19 +3793,19 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3783
3793
|
},
|
|
3784
3794
|
[onRipplePointerDown, onPointerDown]
|
|
3785
3795
|
);
|
|
3786
|
-
const handlePointerUp =
|
|
3796
|
+
const handlePointerUp = React14.useCallback(
|
|
3787
3797
|
(e) => {
|
|
3788
3798
|
setIsPressed(false);
|
|
3789
3799
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
3790
3800
|
},
|
|
3791
3801
|
[onPointerUp]
|
|
3792
3802
|
);
|
|
3793
|
-
const handlePointerEnter =
|
|
3803
|
+
const handlePointerEnter = React14.useCallback(() => {
|
|
3794
3804
|
if (!disabled) {
|
|
3795
3805
|
setIsHovered(true);
|
|
3796
3806
|
}
|
|
3797
3807
|
}, [disabled]);
|
|
3798
|
-
const handlePointerLeave =
|
|
3808
|
+
const handlePointerLeave = React14.useCallback(
|
|
3799
3809
|
(e) => {
|
|
3800
3810
|
setIsHovered(false);
|
|
3801
3811
|
setIsPressed(false);
|
|
@@ -3803,21 +3813,21 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3803
3813
|
},
|
|
3804
3814
|
[onPointerLeave]
|
|
3805
3815
|
);
|
|
3806
|
-
const handlePointerCancel =
|
|
3816
|
+
const handlePointerCancel = React14.useCallback(
|
|
3807
3817
|
(e) => {
|
|
3808
3818
|
setIsPressed(false);
|
|
3809
3819
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
3810
3820
|
},
|
|
3811
3821
|
[onPointerCancel]
|
|
3812
3822
|
);
|
|
3813
|
-
const handleFocus =
|
|
3823
|
+
const handleFocus = React14.useCallback(
|
|
3814
3824
|
(e) => {
|
|
3815
3825
|
if (!disabled) setIsFocused(true);
|
|
3816
3826
|
onFocus == null ? void 0 : onFocus(e);
|
|
3817
3827
|
},
|
|
3818
3828
|
[disabled, onFocus]
|
|
3819
3829
|
);
|
|
3820
|
-
const handleBlur =
|
|
3830
|
+
const handleBlur = React14.useCallback(
|
|
3821
3831
|
(e) => {
|
|
3822
3832
|
setIsFocused(false);
|
|
3823
3833
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -3825,12 +3835,73 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3825
3835
|
[onBlur]
|
|
3826
3836
|
);
|
|
3827
3837
|
const leadingIconSize = LEADING_ICON_SIZE_FOR_SIZE[actualSize];
|
|
3828
|
-
|
|
3838
|
+
const labelContent = asChild ? React14.Children.only(children).props.children : children;
|
|
3839
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3840
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
3841
|
+
/* @__PURE__ */ jsx(
|
|
3842
|
+
StateLayer,
|
|
3843
|
+
{
|
|
3844
|
+
hovered: isHovered,
|
|
3845
|
+
focused: isFocused,
|
|
3846
|
+
pressed: isPressed
|
|
3847
|
+
}
|
|
3848
|
+
),
|
|
3849
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3850
|
+
icon && /* @__PURE__ */ jsx(
|
|
3851
|
+
"span",
|
|
3852
|
+
{
|
|
3853
|
+
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full overflow-hidden [&_.md-icon]:text-[length:inherit]!",
|
|
3854
|
+
style: {
|
|
3855
|
+
fontSize: leadingIconSize,
|
|
3856
|
+
width: leadingIconSize,
|
|
3857
|
+
height: leadingIconSize
|
|
3858
|
+
},
|
|
3859
|
+
children: icon
|
|
3860
|
+
}
|
|
3861
|
+
),
|
|
3862
|
+
labelContent && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center h-full gap-[inherit]", children: labelContent })
|
|
3863
|
+
] });
|
|
3864
|
+
const containerClassName = cn(
|
|
3865
|
+
splitButtonVariants({
|
|
3866
|
+
variant: actualVariant,
|
|
3867
|
+
size: actualSize,
|
|
3868
|
+
disabled
|
|
3869
|
+
}),
|
|
3870
|
+
typographyClass,
|
|
3871
|
+
className
|
|
3872
|
+
);
|
|
3873
|
+
const mergedStyle = __spreadValues({
|
|
3874
|
+
paddingInlineStart: tokens.leadingPadding.start,
|
|
3875
|
+
paddingInlineEnd: tokens.leadingPadding.end,
|
|
3876
|
+
gap: "8px",
|
|
3877
|
+
borderRadius
|
|
3878
|
+
}, style);
|
|
3879
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: asChild ? /* @__PURE__ */ jsx(
|
|
3880
|
+
Slot,
|
|
3881
|
+
__spreadProps(__spreadValues({
|
|
3882
|
+
ref,
|
|
3883
|
+
"aria-disabled": disabled || void 0,
|
|
3884
|
+
onClick: handleClick,
|
|
3885
|
+
onPointerDown: handlePointerDown,
|
|
3886
|
+
onPointerUp: handlePointerUp,
|
|
3887
|
+
onPointerEnter: handlePointerEnter,
|
|
3888
|
+
onPointerLeave: handlePointerLeave,
|
|
3889
|
+
onPointerCancel: handlePointerCancel,
|
|
3890
|
+
onFocus: handleFocus,
|
|
3891
|
+
onBlur: handleBlur,
|
|
3892
|
+
style: mergedStyle,
|
|
3893
|
+
className: containerClassName
|
|
3894
|
+
}, restProps), {
|
|
3895
|
+
children: React14.cloneElement(
|
|
3896
|
+
React14.Children.only(children),
|
|
3897
|
+
{ children: innerContent }
|
|
3898
|
+
)
|
|
3899
|
+
})
|
|
3900
|
+
) : /* @__PURE__ */ jsx(
|
|
3829
3901
|
m.button,
|
|
3830
3902
|
__spreadProps(__spreadValues({
|
|
3831
3903
|
ref,
|
|
3832
3904
|
type: "button",
|
|
3833
|
-
"aria-disabled": disabled,
|
|
3834
3905
|
disabled,
|
|
3835
3906
|
onClick: handleClick,
|
|
3836
3907
|
onPointerDown: handlePointerDown,
|
|
@@ -3847,56 +3918,24 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3847
3918
|
paddingInlineEnd: tokens.leadingPadding.end,
|
|
3848
3919
|
gap: "8px"
|
|
3849
3920
|
}, style),
|
|
3850
|
-
className:
|
|
3851
|
-
splitButtonVariants({
|
|
3852
|
-
variant: actualVariant,
|
|
3853
|
-
size: actualSize,
|
|
3854
|
-
disabled
|
|
3855
|
-
}),
|
|
3856
|
-
typographyClass,
|
|
3857
|
-
className
|
|
3858
|
-
)
|
|
3921
|
+
className: containerClassName
|
|
3859
3922
|
}, restProps), {
|
|
3860
|
-
children:
|
|
3861
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
3862
|
-
/* @__PURE__ */ jsx(
|
|
3863
|
-
StateLayer,
|
|
3864
|
-
{
|
|
3865
|
-
hovered: isHovered,
|
|
3866
|
-
focused: isFocused,
|
|
3867
|
-
pressed: isPressed
|
|
3868
|
-
}
|
|
3869
|
-
),
|
|
3870
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3871
|
-
icon && /* @__PURE__ */ jsx(
|
|
3872
|
-
"span",
|
|
3873
|
-
{
|
|
3874
|
-
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full overflow-hidden [&_.md-icon]:text-[length:inherit]!",
|
|
3875
|
-
style: {
|
|
3876
|
-
fontSize: leadingIconSize,
|
|
3877
|
-
width: leadingIconSize,
|
|
3878
|
-
height: leadingIconSize
|
|
3879
|
-
},
|
|
3880
|
-
children: icon
|
|
3881
|
-
}
|
|
3882
|
-
),
|
|
3883
|
-
children && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center h-full gap-[inherit]", children })
|
|
3884
|
-
]
|
|
3923
|
+
children: innerContent
|
|
3885
3924
|
})
|
|
3886
3925
|
) });
|
|
3887
3926
|
}
|
|
3888
3927
|
);
|
|
3889
3928
|
SplitButtonLeadingComponent.displayName = "SplitButtonLeading";
|
|
3890
|
-
var SplitButtonLeading =
|
|
3891
|
-
var FilledSplitButtonLeading =
|
|
3929
|
+
var SplitButtonLeading = React14.memo(SplitButtonLeadingComponent);
|
|
3930
|
+
var FilledSplitButtonLeading = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonLeading, __spreadValues({ ref, variant: "filled" }, props)));
|
|
3892
3931
|
FilledSplitButtonLeading.displayName = "FilledSplitButtonLeading";
|
|
3893
|
-
var TonalSplitButtonLeading =
|
|
3932
|
+
var TonalSplitButtonLeading = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonLeading, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
3894
3933
|
TonalSplitButtonLeading.displayName = "TonalSplitButtonLeading";
|
|
3895
|
-
var ElevatedSplitButtonLeading =
|
|
3934
|
+
var ElevatedSplitButtonLeading = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonLeading, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
3896
3935
|
ElevatedSplitButtonLeading.displayName = "ElevatedSplitButtonLeading";
|
|
3897
|
-
var OutlinedSplitButtonLeading =
|
|
3936
|
+
var OutlinedSplitButtonLeading = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonLeading, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
3898
3937
|
OutlinedSplitButtonLeading.displayName = "OutlinedSplitButtonLeading";
|
|
3899
|
-
var SplitButtonTrailingComponent =
|
|
3938
|
+
var SplitButtonTrailingComponent = React14.forwardRef(
|
|
3900
3939
|
(_a, ref) => {
|
|
3901
3940
|
var _b = _a, {
|
|
3902
3941
|
className,
|
|
@@ -3913,6 +3952,8 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3913
3952
|
onPointerCancel,
|
|
3914
3953
|
onFocus,
|
|
3915
3954
|
onBlur,
|
|
3955
|
+
asChild = false,
|
|
3956
|
+
children,
|
|
3916
3957
|
"aria-label": ariaLabel
|
|
3917
3958
|
} = _b, restProps = __objRest(_b, [
|
|
3918
3959
|
"className",
|
|
@@ -3929,15 +3970,17 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3929
3970
|
"onPointerCancel",
|
|
3930
3971
|
"onFocus",
|
|
3931
3972
|
"onBlur",
|
|
3973
|
+
"asChild",
|
|
3974
|
+
"children",
|
|
3932
3975
|
"aria-label"
|
|
3933
3976
|
]);
|
|
3934
3977
|
var _a2, _b2;
|
|
3935
3978
|
const context = useSplitButtonContext();
|
|
3936
3979
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
3937
3980
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
3938
|
-
const [isHovered, setIsHovered] =
|
|
3939
|
-
const [isFocused, setIsFocused] =
|
|
3940
|
-
const [isPressed, setIsPressed] =
|
|
3981
|
+
const [isHovered, setIsHovered] = React14.useState(false);
|
|
3982
|
+
const [isFocused, setIsFocused] = React14.useState(false);
|
|
3983
|
+
const [isPressed, setIsPressed] = React14.useState(false);
|
|
3941
3984
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
3942
3985
|
const prefersReducedMotion = useReducedMotion();
|
|
3943
3986
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -3949,12 +3992,12 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3949
3992
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
3950
3993
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
3951
3994
|
const borderRadius = checked ? `${outerRadius}px ${outerRadius}px ${outerRadius}px ${outerRadius}px` : `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
3952
|
-
const handleToggle =
|
|
3995
|
+
const handleToggle = React14.useCallback(() => {
|
|
3953
3996
|
if (!disabled) {
|
|
3954
3997
|
onCheckedChange(!checked);
|
|
3955
3998
|
}
|
|
3956
3999
|
}, [disabled, checked, onCheckedChange]);
|
|
3957
|
-
const handlePointerDown =
|
|
4000
|
+
const handlePointerDown = React14.useCallback(
|
|
3958
4001
|
(e) => {
|
|
3959
4002
|
onRipplePointerDown(e);
|
|
3960
4003
|
setIsPressed(true);
|
|
@@ -3962,19 +4005,19 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3962
4005
|
},
|
|
3963
4006
|
[onRipplePointerDown, onPointerDown]
|
|
3964
4007
|
);
|
|
3965
|
-
const handlePointerUp =
|
|
4008
|
+
const handlePointerUp = React14.useCallback(
|
|
3966
4009
|
(e) => {
|
|
3967
4010
|
setIsPressed(false);
|
|
3968
4011
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
3969
4012
|
},
|
|
3970
4013
|
[onPointerUp]
|
|
3971
4014
|
);
|
|
3972
|
-
const handlePointerEnter =
|
|
4015
|
+
const handlePointerEnter = React14.useCallback(() => {
|
|
3973
4016
|
if (!disabled) {
|
|
3974
4017
|
setIsHovered(true);
|
|
3975
4018
|
}
|
|
3976
4019
|
}, [disabled]);
|
|
3977
|
-
const handlePointerLeave =
|
|
4020
|
+
const handlePointerLeave = React14.useCallback(
|
|
3978
4021
|
(e) => {
|
|
3979
4022
|
setIsHovered(false);
|
|
3980
4023
|
setIsPressed(false);
|
|
@@ -3982,35 +4025,102 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3982
4025
|
},
|
|
3983
4026
|
[onPointerLeave]
|
|
3984
4027
|
);
|
|
3985
|
-
const handlePointerCancel =
|
|
4028
|
+
const handlePointerCancel = React14.useCallback(
|
|
3986
4029
|
(e) => {
|
|
3987
4030
|
setIsPressed(false);
|
|
3988
4031
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
3989
4032
|
},
|
|
3990
4033
|
[onPointerCancel]
|
|
3991
4034
|
);
|
|
3992
|
-
const handleFocus =
|
|
4035
|
+
const handleFocus = React14.useCallback(
|
|
3993
4036
|
(e) => {
|
|
3994
4037
|
if (!disabled) setIsFocused(true);
|
|
3995
4038
|
onFocus == null ? void 0 : onFocus(e);
|
|
3996
4039
|
},
|
|
3997
4040
|
[disabled, onFocus]
|
|
3998
4041
|
);
|
|
3999
|
-
const handleBlur =
|
|
4042
|
+
const handleBlur = React14.useCallback(
|
|
4000
4043
|
(e) => {
|
|
4001
4044
|
setIsFocused(false);
|
|
4002
4045
|
onBlur == null ? void 0 : onBlur(e);
|
|
4003
4046
|
},
|
|
4004
4047
|
[onBlur]
|
|
4005
4048
|
);
|
|
4006
|
-
|
|
4049
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4050
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
4051
|
+
/* @__PURE__ */ jsx(
|
|
4052
|
+
StateLayer,
|
|
4053
|
+
{
|
|
4054
|
+
hovered: isHovered,
|
|
4055
|
+
focused: isFocused,
|
|
4056
|
+
pressed: isPressed
|
|
4057
|
+
}
|
|
4058
|
+
),
|
|
4059
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
4060
|
+
/* @__PURE__ */ jsx(
|
|
4061
|
+
m.div,
|
|
4062
|
+
{
|
|
4063
|
+
animate: {
|
|
4064
|
+
rotate: checked ? 180 : 0,
|
|
4065
|
+
x: checked ? 0 : tokens.opticalCenterOffset
|
|
4066
|
+
},
|
|
4067
|
+
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_CHEVRON_SPRING,
|
|
4068
|
+
className: "flex items-center justify-center shrink-0",
|
|
4069
|
+
children: icon != null ? icon : /* @__PURE__ */ jsx(
|
|
4070
|
+
Icon,
|
|
4071
|
+
{
|
|
4072
|
+
name: "arrow_drop_down",
|
|
4073
|
+
size: tokens.trailingIconSize,
|
|
4074
|
+
opticalSize: 24
|
|
4075
|
+
}
|
|
4076
|
+
)
|
|
4077
|
+
}
|
|
4078
|
+
)
|
|
4079
|
+
] });
|
|
4080
|
+
const containerClassName = cn(
|
|
4081
|
+
splitButtonVariants({
|
|
4082
|
+
variant: actualVariant,
|
|
4083
|
+
size: actualSize,
|
|
4084
|
+
disabled
|
|
4085
|
+
}),
|
|
4086
|
+
className
|
|
4087
|
+
);
|
|
4088
|
+
const mergedStyle = __spreadValues({
|
|
4089
|
+
paddingInlineStart: tokens.trailingPadding.start,
|
|
4090
|
+
paddingInlineEnd: tokens.trailingPadding.end,
|
|
4091
|
+
borderRadius
|
|
4092
|
+
}, style);
|
|
4093
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: asChild ? /* @__PURE__ */ jsx(
|
|
4094
|
+
Slot,
|
|
4095
|
+
__spreadProps(__spreadValues({
|
|
4096
|
+
ref,
|
|
4097
|
+
"aria-label": ariaLabel,
|
|
4098
|
+
"aria-expanded": checked,
|
|
4099
|
+
"aria-disabled": disabled,
|
|
4100
|
+
onClick: handleToggle,
|
|
4101
|
+
onPointerDown: handlePointerDown,
|
|
4102
|
+
onPointerUp: handlePointerUp,
|
|
4103
|
+
onPointerEnter: handlePointerEnter,
|
|
4104
|
+
onPointerLeave: handlePointerLeave,
|
|
4105
|
+
onPointerCancel: handlePointerCancel,
|
|
4106
|
+
onFocus: handleFocus,
|
|
4107
|
+
onBlur: handleBlur,
|
|
4108
|
+
style: mergedStyle,
|
|
4109
|
+
className: containerClassName
|
|
4110
|
+
}, restProps), {
|
|
4111
|
+
children: React14.cloneElement(
|
|
4112
|
+
React14.Children.only(children),
|
|
4113
|
+
{ children: innerContent }
|
|
4114
|
+
)
|
|
4115
|
+
})
|
|
4116
|
+
) : /* @__PURE__ */ jsx(
|
|
4007
4117
|
m.button,
|
|
4008
4118
|
__spreadProps(__spreadValues({
|
|
4009
4119
|
ref,
|
|
4010
4120
|
type: "button",
|
|
4011
|
-
"aria-pressed": checked,
|
|
4012
|
-
"aria-expanded": checked,
|
|
4013
4121
|
"aria-label": ariaLabel,
|
|
4122
|
+
"aria-expanded": checked,
|
|
4123
|
+
"aria-disabled": disabled,
|
|
4014
4124
|
disabled,
|
|
4015
4125
|
onClick: handleToggle,
|
|
4016
4126
|
onPointerDown: handlePointerDown,
|
|
@@ -4026,61 +4136,24 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
4026
4136
|
paddingInlineStart: tokens.trailingPadding.start,
|
|
4027
4137
|
paddingInlineEnd: tokens.trailingPadding.end
|
|
4028
4138
|
}, style),
|
|
4029
|
-
className:
|
|
4030
|
-
splitButtonVariants({
|
|
4031
|
-
variant: actualVariant,
|
|
4032
|
-
size: actualSize,
|
|
4033
|
-
disabled
|
|
4034
|
-
}),
|
|
4035
|
-
className
|
|
4036
|
-
)
|
|
4139
|
+
className: containerClassName
|
|
4037
4140
|
}, restProps), {
|
|
4038
|
-
children:
|
|
4039
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
4040
|
-
/* @__PURE__ */ jsx(
|
|
4041
|
-
StateLayer,
|
|
4042
|
-
{
|
|
4043
|
-
hovered: isHovered,
|
|
4044
|
-
focused: isFocused,
|
|
4045
|
-
pressed: isPressed
|
|
4046
|
-
}
|
|
4047
|
-
),
|
|
4048
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
4049
|
-
/* @__PURE__ */ jsx(
|
|
4050
|
-
m.div,
|
|
4051
|
-
{
|
|
4052
|
-
animate: {
|
|
4053
|
-
rotate: checked ? 180 : 0,
|
|
4054
|
-
x: checked ? 0 : tokens.opticalCenterOffset
|
|
4055
|
-
},
|
|
4056
|
-
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_CHEVRON_SPRING,
|
|
4057
|
-
className: "flex items-center justify-center shrink-0",
|
|
4058
|
-
children: icon != null ? icon : /* @__PURE__ */ jsx(
|
|
4059
|
-
Icon,
|
|
4060
|
-
{
|
|
4061
|
-
name: "arrow_drop_down",
|
|
4062
|
-
size: tokens.trailingIconSize,
|
|
4063
|
-
opticalSize: 24
|
|
4064
|
-
}
|
|
4065
|
-
)
|
|
4066
|
-
}
|
|
4067
|
-
)
|
|
4068
|
-
]
|
|
4141
|
+
children: innerContent
|
|
4069
4142
|
})
|
|
4070
4143
|
) });
|
|
4071
4144
|
}
|
|
4072
4145
|
);
|
|
4073
4146
|
SplitButtonTrailingComponent.displayName = "SplitButtonTrailing";
|
|
4074
|
-
var SplitButtonTrailing =
|
|
4075
|
-
var FilledSplitButtonTrailing =
|
|
4147
|
+
var SplitButtonTrailing = React14.memo(SplitButtonTrailingComponent);
|
|
4148
|
+
var FilledSplitButtonTrailing = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "filled" }, props)));
|
|
4076
4149
|
FilledSplitButtonTrailing.displayName = "FilledSplitButtonTrailing";
|
|
4077
|
-
var TonalSplitButtonTrailing =
|
|
4150
|
+
var TonalSplitButtonTrailing = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4078
4151
|
TonalSplitButtonTrailing.displayName = "TonalSplitButtonTrailing";
|
|
4079
|
-
var ElevatedSplitButtonTrailing =
|
|
4152
|
+
var ElevatedSplitButtonTrailing = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4080
4153
|
ElevatedSplitButtonTrailing.displayName = "ElevatedSplitButtonTrailing";
|
|
4081
|
-
var OutlinedSplitButtonTrailing =
|
|
4154
|
+
var OutlinedSplitButtonTrailing = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4082
4155
|
OutlinedSplitButtonTrailing.displayName = "OutlinedSplitButtonTrailing";
|
|
4083
|
-
var SplitButtonTrailingUncheckableComponent =
|
|
4156
|
+
var SplitButtonTrailingUncheckableComponent = React14.forwardRef(
|
|
4084
4157
|
(_a, ref) => {
|
|
4085
4158
|
var _b = _a, {
|
|
4086
4159
|
className,
|
|
@@ -4117,9 +4190,9 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4117
4190
|
const context = useSplitButtonContext();
|
|
4118
4191
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
4119
4192
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
4120
|
-
const [isHovered, setIsHovered] =
|
|
4121
|
-
const [isFocused, setIsFocused] =
|
|
4122
|
-
const [isPressed, setIsPressed] =
|
|
4193
|
+
const [isHovered, setIsHovered] = React14.useState(false);
|
|
4194
|
+
const [isFocused, setIsFocused] = React14.useState(false);
|
|
4195
|
+
const [isPressed, setIsPressed] = React14.useState(false);
|
|
4123
4196
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
4124
4197
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
4125
4198
|
const {
|
|
@@ -4130,7 +4203,7 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4130
4203
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
4131
4204
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
4132
4205
|
const borderRadius = `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
4133
|
-
const handlePointerDown =
|
|
4206
|
+
const handlePointerDown = React14.useCallback(
|
|
4134
4207
|
(e) => {
|
|
4135
4208
|
onRipplePointerDown(e);
|
|
4136
4209
|
setIsPressed(true);
|
|
@@ -4138,19 +4211,19 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4138
4211
|
},
|
|
4139
4212
|
[onRipplePointerDown, onPointerDown]
|
|
4140
4213
|
);
|
|
4141
|
-
const handlePointerUp =
|
|
4214
|
+
const handlePointerUp = React14.useCallback(
|
|
4142
4215
|
(e) => {
|
|
4143
4216
|
setIsPressed(false);
|
|
4144
4217
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
4145
4218
|
},
|
|
4146
4219
|
[onPointerUp]
|
|
4147
4220
|
);
|
|
4148
|
-
const handlePointerEnter =
|
|
4221
|
+
const handlePointerEnter = React14.useCallback(() => {
|
|
4149
4222
|
if (!disabled) {
|
|
4150
4223
|
setIsHovered(true);
|
|
4151
4224
|
}
|
|
4152
4225
|
}, [disabled]);
|
|
4153
|
-
const handlePointerLeave =
|
|
4226
|
+
const handlePointerLeave = React14.useCallback(
|
|
4154
4227
|
(e) => {
|
|
4155
4228
|
setIsHovered(false);
|
|
4156
4229
|
setIsPressed(false);
|
|
@@ -4158,21 +4231,21 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4158
4231
|
},
|
|
4159
4232
|
[onPointerLeave]
|
|
4160
4233
|
);
|
|
4161
|
-
const handlePointerCancel =
|
|
4234
|
+
const handlePointerCancel = React14.useCallback(
|
|
4162
4235
|
(e) => {
|
|
4163
4236
|
setIsPressed(false);
|
|
4164
4237
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
4165
4238
|
},
|
|
4166
4239
|
[onPointerCancel]
|
|
4167
4240
|
);
|
|
4168
|
-
const handleFocus =
|
|
4241
|
+
const handleFocus = React14.useCallback(
|
|
4169
4242
|
(e) => {
|
|
4170
4243
|
if (!disabled) setIsFocused(true);
|
|
4171
4244
|
onFocus == null ? void 0 : onFocus(e);
|
|
4172
4245
|
},
|
|
4173
4246
|
[disabled, onFocus]
|
|
4174
4247
|
);
|
|
4175
|
-
const handleBlur =
|
|
4248
|
+
const handleBlur = React14.useCallback(
|
|
4176
4249
|
(e) => {
|
|
4177
4250
|
setIsFocused(false);
|
|
4178
4251
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -4239,16 +4312,16 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4239
4312
|
}
|
|
4240
4313
|
);
|
|
4241
4314
|
SplitButtonTrailingUncheckableComponent.displayName = "SplitButtonTrailingUncheckable";
|
|
4242
|
-
var SplitButtonTrailingUncheckable =
|
|
4315
|
+
var SplitButtonTrailingUncheckable = React14.memo(
|
|
4243
4316
|
SplitButtonTrailingUncheckableComponent
|
|
4244
4317
|
);
|
|
4245
|
-
var FilledSplitButtonTrailingUncheckable =
|
|
4318
|
+
var FilledSplitButtonTrailingUncheckable = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "filled" }, props)));
|
|
4246
4319
|
FilledSplitButtonTrailingUncheckable.displayName = "FilledSplitButtonTrailingUncheckable";
|
|
4247
|
-
var TonalSplitButtonTrailingUncheckable =
|
|
4320
|
+
var TonalSplitButtonTrailingUncheckable = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4248
4321
|
TonalSplitButtonTrailingUncheckable.displayName = "TonalSplitButtonTrailingUncheckable";
|
|
4249
|
-
var ElevatedSplitButtonTrailingUncheckable =
|
|
4322
|
+
var ElevatedSplitButtonTrailingUncheckable = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4250
4323
|
ElevatedSplitButtonTrailingUncheckable.displayName = "ElevatedSplitButtonTrailingUncheckable";
|
|
4251
|
-
var OutlinedSplitButtonTrailingUncheckable =
|
|
4324
|
+
var OutlinedSplitButtonTrailingUncheckable = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4252
4325
|
OutlinedSplitButtonTrailingUncheckable.displayName = "OutlinedSplitButtonTrailingUncheckable";
|
|
4253
4326
|
|
|
4254
4327
|
export { BUTTON_COLOR_TOKENS, BUTTON_GROUP_TOKENS, BUTTON_SIZE_TOKENS, Button, ButtonGroup, ButtonGroupDefaults, ElevatedSplitButtonLeading, ElevatedSplitButtonTrailing, ElevatedSplitButtonTrailingUncheckable, ExtendedFAB, FAB, FABMenu, FABMenuItem, FABPosition, FilledSplitButtonLeading, FilledSplitButtonTrailing, FilledSplitButtonTrailingUncheckable, IconButton, LEADING_ICON_SIZE_FOR_SIZE, OutlinedSplitButtonLeading, OutlinedSplitButtonTrailing, OutlinedSplitButtonTrailingUncheckable, SPLIT_BUTTON_CHEVRON_SPRING, SPLIT_BUTTON_RADIUS_SPRING, SPLIT_BUTTON_TOKENS, SplitButtonLayout, SplitButtonLeading, SplitButtonTrailing, SplitButtonTrailingUncheckable, ToggleFAB, TonalSplitButtonLeading, TonalSplitButtonTrailing, TonalSplitButtonTrailingUncheckable, splitButtonVariants };
|