@bug-on/m3-expressive 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/buttons.d.mts +26 -5
- package/dist/buttons.d.ts +26 -5
- package/dist/buttons.js +1074 -765
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +1066 -765
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +133 -69
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +133 -69
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +132 -69
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +132 -69
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +2 -2
- package/dist/forms.d.ts +2 -2
- package/dist/forms.js +74 -9
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +74 -9
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-CSsDmuQC.d.mts} +19 -0
- package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-CSsDmuQC.d.ts} +19 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2204 -1464
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2056 -1324
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +18 -1
- package/dist/layout.d.ts +18 -1
- package/dist/layout.js +80 -15
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +80 -15
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.d.mts +134 -9
- package/dist/navigation.d.ts +134 -9
- package/dist/navigation.js +461 -101
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +455 -102
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +261 -197
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +223 -159
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +392 -301
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +361 -270
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-C-qQlyZx.d.ts} +118 -25
- package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DHJqNeq_.d.mts} +118 -25
- package/dist/{text-field-eAIpz9z1.d.mts → text-field-T4Rg-9Bw.d.mts} +7 -0
- package/dist/{text-field-eAIpz9z1.d.ts → text-field-T4Rg-9Bw.d.ts} +7 -0
- package/package.json +3 -3
package/dist/buttons.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var reactSlot = require('@radix-ui/react-slot');
|
|
5
5
|
var react = require('motion/react');
|
|
6
|
-
var
|
|
6
|
+
var React16 = require('react');
|
|
7
7
|
var clsx = require('clsx');
|
|
8
8
|
var tailwindMerge = require('tailwind-merge');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -28,7 +28,7 @@ function _interopNamespace(e) {
|
|
|
28
28
|
return Object.freeze(n);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var React16__namespace = /*#__PURE__*/_interopNamespace(React16);
|
|
32
32
|
|
|
33
33
|
var __defProp = Object.defineProperty;
|
|
34
34
|
var __defProps = Object.defineProperties;
|
|
@@ -109,11 +109,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
109
109
|
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";
|
|
110
110
|
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";
|
|
111
111
|
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";
|
|
112
|
-
var IndeterminateSvg =
|
|
112
|
+
var IndeterminateSvg = React16__namespace.memo(function IndeterminateSvg2({
|
|
113
113
|
size
|
|
114
114
|
}) {
|
|
115
|
-
const [ready, setReady] =
|
|
116
|
-
|
|
115
|
+
const [ready, setReady] = React16__namespace.useState(false);
|
|
116
|
+
React16__namespace.useEffect(() => {
|
|
117
117
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
118
118
|
return () => cancelAnimationFrame(raf);
|
|
119
119
|
}, []);
|
|
@@ -158,7 +158,7 @@ var IndeterminateSvg = React11__namespace.memo(function IndeterminateSvg2({
|
|
|
158
158
|
}
|
|
159
159
|
);
|
|
160
160
|
});
|
|
161
|
-
var DeterminateSvg =
|
|
161
|
+
var DeterminateSvg = React16__namespace.memo(function DeterminateSvg2({
|
|
162
162
|
size,
|
|
163
163
|
progress
|
|
164
164
|
}) {
|
|
@@ -183,7 +183,7 @@ var DeterminateSvg = React11__namespace.memo(function DeterminateSvg2({
|
|
|
183
183
|
}
|
|
184
184
|
);
|
|
185
185
|
});
|
|
186
|
-
var LoadingIndicator =
|
|
186
|
+
var LoadingIndicator = React16__namespace.forwardRef(
|
|
187
187
|
(_a, ref) => {
|
|
188
188
|
var _b = _a, {
|
|
189
189
|
variant = "uncontained",
|
|
@@ -298,7 +298,7 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
298
298
|
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
299
299
|
return d;
|
|
300
300
|
}
|
|
301
|
-
var CircularProgress =
|
|
301
|
+
var CircularProgress = React16__namespace.forwardRef(
|
|
302
302
|
(_a, ref) => {
|
|
303
303
|
var _b = _a, {
|
|
304
304
|
value,
|
|
@@ -336,15 +336,15 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
336
336
|
const isWavy = shape === "wavy";
|
|
337
337
|
const BASELINE_SIZE = 48;
|
|
338
338
|
const scaleFactor = size / BASELINE_SIZE;
|
|
339
|
-
const effectiveAmplitude =
|
|
339
|
+
const effectiveAmplitude = React16__namespace.useMemo(
|
|
340
340
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
341
341
|
[amplitude, scaleFactor]
|
|
342
342
|
);
|
|
343
|
-
const effectiveWavelength =
|
|
343
|
+
const effectiveWavelength = React16__namespace.useMemo(
|
|
344
344
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
345
345
|
[wavelength, scaleFactor]
|
|
346
346
|
);
|
|
347
|
-
const wavyActivePath =
|
|
347
|
+
const wavyActivePath = React16__namespace.useMemo(
|
|
348
348
|
() => isWavy ? generateWavyCircularPath(
|
|
349
349
|
center,
|
|
350
350
|
radius,
|
|
@@ -353,8 +353,8 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
353
353
|
) : null,
|
|
354
354
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
355
355
|
);
|
|
356
|
-
const circumference =
|
|
357
|
-
const gapForTrack =
|
|
356
|
+
const circumference = React16__namespace.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
357
|
+
const gapForTrack = React16__namespace.useMemo(
|
|
358
358
|
() => (gapSize + trackHeight) / circumference,
|
|
359
359
|
[gapSize, trackHeight, circumference]
|
|
360
360
|
);
|
|
@@ -543,9 +543,9 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
543
543
|
);
|
|
544
544
|
CircularProgress.displayName = "CircularProgress";
|
|
545
545
|
function useContainerWidth() {
|
|
546
|
-
const [width, setWidth] =
|
|
547
|
-
const observerRef =
|
|
548
|
-
const ref =
|
|
546
|
+
const [width, setWidth] = React16__namespace.useState(0);
|
|
547
|
+
const observerRef = React16__namespace.useRef(null);
|
|
548
|
+
const ref = React16__namespace.useCallback((node) => {
|
|
549
549
|
if (observerRef.current) {
|
|
550
550
|
observerRef.current.disconnect();
|
|
551
551
|
observerRef.current = null;
|
|
@@ -559,7 +559,7 @@ function useContainerWidth() {
|
|
|
559
559
|
observerRef.current = obs;
|
|
560
560
|
}
|
|
561
561
|
}, []);
|
|
562
|
-
|
|
562
|
+
React16__namespace.useEffect(() => {
|
|
563
563
|
return () => {
|
|
564
564
|
if (observerRef.current) {
|
|
565
565
|
observerRef.current.disconnect();
|
|
@@ -569,7 +569,7 @@ function useContainerWidth() {
|
|
|
569
569
|
return [ref, width];
|
|
570
570
|
}
|
|
571
571
|
function useMergedRef(...refs) {
|
|
572
|
-
return
|
|
572
|
+
return React16__namespace.useCallback(
|
|
573
573
|
(node) => {
|
|
574
574
|
for (const ref of refs) {
|
|
575
575
|
if (typeof ref === "function") {
|
|
@@ -583,7 +583,7 @@ function useMergedRef(...refs) {
|
|
|
583
583
|
[refs]
|
|
584
584
|
);
|
|
585
585
|
}
|
|
586
|
-
var FlatLinearTrack =
|
|
586
|
+
var FlatLinearTrack = React16__namespace.memo(function FlatLinearTrack2({
|
|
587
587
|
trackHeight,
|
|
588
588
|
activeColor,
|
|
589
589
|
trackColor,
|
|
@@ -659,7 +659,7 @@ var FlatLinearTrack = React11__namespace.memo(function FlatLinearTrack2({
|
|
|
659
659
|
}
|
|
660
660
|
);
|
|
661
661
|
});
|
|
662
|
-
var WavyLinearTrack =
|
|
662
|
+
var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
663
663
|
trackHeight,
|
|
664
664
|
svgHeight,
|
|
665
665
|
amplitude,
|
|
@@ -678,13 +678,13 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
678
678
|
}) {
|
|
679
679
|
const isDeterminate = typeof value === "number";
|
|
680
680
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
681
|
-
const titleId =
|
|
681
|
+
const titleId = React16__namespace.useId();
|
|
682
682
|
const [containerRef, width] = useContainerWidth();
|
|
683
|
-
const activePathRef =
|
|
684
|
-
const trackPathRef =
|
|
683
|
+
const activePathRef = React16__namespace.useRef(null);
|
|
684
|
+
const trackPathRef = React16__namespace.useRef(null);
|
|
685
685
|
const amplitudeMV = react.useMotionValue(amplitude);
|
|
686
686
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
687
|
-
|
|
687
|
+
React16__namespace.useEffect(() => {
|
|
688
688
|
if (isDeterminate) {
|
|
689
689
|
const fraction = clampedValue / 100;
|
|
690
690
|
let targetAmp = amplitude;
|
|
@@ -855,7 +855,7 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
855
855
|
}
|
|
856
856
|
);
|
|
857
857
|
});
|
|
858
|
-
var LinearProgress =
|
|
858
|
+
var LinearProgress = React16__namespace.forwardRef(
|
|
859
859
|
(_a, ref) => {
|
|
860
860
|
var _b = _a, {
|
|
861
861
|
value,
|
|
@@ -896,10 +896,10 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
896
896
|
]);
|
|
897
897
|
const isDeterminate = value !== void 0;
|
|
898
898
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
899
|
-
const containerRef =
|
|
899
|
+
const containerRef = React16__namespace.useRef(null);
|
|
900
900
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
901
|
-
const [isRtl, setIsRtl] =
|
|
902
|
-
|
|
901
|
+
const [isRtl, setIsRtl] = React16__namespace.useState(false);
|
|
902
|
+
React16__namespace.useEffect(() => {
|
|
903
903
|
if (containerRef.current) {
|
|
904
904
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
905
905
|
setIsRtl(dir === "rtl");
|
|
@@ -907,16 +907,16 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
907
907
|
}, []);
|
|
908
908
|
const isWavy = shape === "wavy";
|
|
909
909
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
910
|
-
const effectiveAmplitude =
|
|
911
|
-
const svgHeight =
|
|
910
|
+
const effectiveAmplitude = React16__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
911
|
+
const svgHeight = React16__namespace.useMemo(
|
|
912
912
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
913
913
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
914
914
|
);
|
|
915
|
-
const shouldShowStop =
|
|
915
|
+
const shouldShowStop = React16__namespace.useMemo(
|
|
916
916
|
() => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
|
|
917
917
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
918
918
|
);
|
|
919
|
-
const stopSize =
|
|
919
|
+
const stopSize = React16__namespace.useMemo(
|
|
920
920
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
921
921
|
[trackHeight]
|
|
922
922
|
);
|
|
@@ -989,14 +989,14 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
989
989
|
}
|
|
990
990
|
);
|
|
991
991
|
LinearProgress.displayName = "LinearProgress";
|
|
992
|
-
var ProgressIndicator =
|
|
992
|
+
var ProgressIndicator = React16__namespace.forwardRef((props, ref) => {
|
|
993
993
|
if (props.variant === "circular") {
|
|
994
994
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
995
995
|
}
|
|
996
996
|
return /* @__PURE__ */ jsxRuntime.jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
997
997
|
});
|
|
998
998
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
999
|
-
var RippleItem =
|
|
999
|
+
var RippleItem = React16__namespace.memo(function RippleItem2({
|
|
1000
1000
|
ripple,
|
|
1001
1001
|
onDone
|
|
1002
1002
|
}) {
|
|
@@ -1040,14 +1040,17 @@ function Ripple({
|
|
|
1040
1040
|
}
|
|
1041
1041
|
function useRippleState(options = {}) {
|
|
1042
1042
|
const { disabled = false } = options;
|
|
1043
|
-
const [ripples, setRipples] =
|
|
1044
|
-
const onPointerDown =
|
|
1043
|
+
const [ripples, setRipples] = React16__namespace.useState([]);
|
|
1044
|
+
const onPointerDown = React16__namespace.useCallback(
|
|
1045
1045
|
(e) => {
|
|
1046
1046
|
if (disabled) return;
|
|
1047
1047
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
1048
1048
|
const x = e.clientX - rect.left;
|
|
1049
1049
|
const y = e.clientY - rect.top;
|
|
1050
|
-
const rippleSize = Math.
|
|
1050
|
+
const rippleSize = Math.max(
|
|
1051
|
+
Math.hypot(rect.width, rect.height) * 2.5,
|
|
1052
|
+
320
|
|
1053
|
+
);
|
|
1051
1054
|
setRipples((prev) => [
|
|
1052
1055
|
...prev,
|
|
1053
1056
|
{ id: Date.now(), x, y, size: rippleSize }
|
|
@@ -1055,7 +1058,7 @@ function useRippleState(options = {}) {
|
|
|
1055
1058
|
},
|
|
1056
1059
|
[disabled]
|
|
1057
1060
|
);
|
|
1058
|
-
const removeRipple =
|
|
1061
|
+
const removeRipple = React16__namespace.useCallback((id) => {
|
|
1059
1062
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1060
1063
|
}, []);
|
|
1061
1064
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1311,7 +1314,7 @@ function AnimatedIconSlot({
|
|
|
1311
1314
|
}
|
|
1312
1315
|
);
|
|
1313
1316
|
}
|
|
1314
|
-
var ButtonComponent =
|
|
1317
|
+
var ButtonComponent = React16__namespace.forwardRef(
|
|
1315
1318
|
(_a, ref) => {
|
|
1316
1319
|
var _b = _a, {
|
|
1317
1320
|
className,
|
|
@@ -1323,6 +1326,7 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1323
1326
|
shape = "round",
|
|
1324
1327
|
selected,
|
|
1325
1328
|
icon,
|
|
1329
|
+
selectedIcon,
|
|
1326
1330
|
iconPosition = "leading",
|
|
1327
1331
|
loading = false,
|
|
1328
1332
|
loadingVariant = "loading-indicator",
|
|
@@ -1344,6 +1348,7 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1344
1348
|
"shape",
|
|
1345
1349
|
"selected",
|
|
1346
1350
|
"icon",
|
|
1351
|
+
"selectedIcon",
|
|
1347
1352
|
"iconPosition",
|
|
1348
1353
|
"loading",
|
|
1349
1354
|
"loadingVariant",
|
|
@@ -1373,9 +1378,9 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1373
1378
|
borderWidth: outlineWidth != null ? outlineWidth : colorStyle === "outlined" ? sizeTokens.outlineWidth : 0,
|
|
1374
1379
|
borderStyle: colorStyle === "outlined" ? "solid" : void 0
|
|
1375
1380
|
}, style);
|
|
1376
|
-
const labelText =
|
|
1381
|
+
const labelText = React16__namespace.useMemo(() => {
|
|
1377
1382
|
if (asChild) {
|
|
1378
|
-
const child =
|
|
1383
|
+
const child = React16__namespace.Children.only(children);
|
|
1379
1384
|
return child.props.children;
|
|
1380
1385
|
}
|
|
1381
1386
|
return children;
|
|
@@ -1383,8 +1388,8 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1383
1388
|
const computedAriaLabel = ariaLabelProp || (typeof children === "string" ? children : void 0);
|
|
1384
1389
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1385
1390
|
const motionRadius = react.useMotionValue(animateRadius);
|
|
1386
|
-
const asChildRef =
|
|
1387
|
-
const mergedRef =
|
|
1391
|
+
const asChildRef = React16__namespace.useRef(null);
|
|
1392
|
+
const mergedRef = React16__namespace.useCallback(
|
|
1388
1393
|
(node) => {
|
|
1389
1394
|
asChildRef.current = node;
|
|
1390
1395
|
if (typeof ref === "function") ref(node);
|
|
@@ -1393,14 +1398,14 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1393
1398
|
},
|
|
1394
1399
|
[ref]
|
|
1395
1400
|
);
|
|
1396
|
-
|
|
1401
|
+
React16__namespace.useEffect(() => {
|
|
1397
1402
|
if (!asChild) return;
|
|
1398
1403
|
return motionRadius.on("change", (v) => {
|
|
1399
1404
|
if (asChildRef.current)
|
|
1400
1405
|
asChildRef.current.style.borderRadius = `${v}px`;
|
|
1401
1406
|
});
|
|
1402
1407
|
}, [motionRadius, asChild]);
|
|
1403
|
-
|
|
1408
|
+
React16__namespace.useEffect(() => {
|
|
1404
1409
|
if (!asChild) return;
|
|
1405
1410
|
const controls = springAnimate(motionRadius, animateRadius);
|
|
1406
1411
|
return () => controls.stop();
|
|
@@ -1408,14 +1413,14 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1408
1413
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1409
1414
|
disabled: loading
|
|
1410
1415
|
});
|
|
1411
|
-
const handleClick =
|
|
1416
|
+
const handleClick = React16__namespace.useCallback(
|
|
1412
1417
|
(e) => {
|
|
1413
1418
|
if (loading) return e.preventDefault();
|
|
1414
1419
|
onClick == null ? void 0 : onClick(e);
|
|
1415
1420
|
},
|
|
1416
1421
|
[loading, onClick]
|
|
1417
1422
|
);
|
|
1418
|
-
const handleKeyDown =
|
|
1423
|
+
const handleKeyDown = React16__namespace.useCallback(
|
|
1419
1424
|
(e) => {
|
|
1420
1425
|
if (loading) return;
|
|
1421
1426
|
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
@@ -1443,10 +1448,11 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1443
1448
|
layout: BUTTON_SHAPE_MORPH_SPRING,
|
|
1444
1449
|
default: SPRING_TRANSITION
|
|
1445
1450
|
};
|
|
1451
|
+
const activeIcon = isSelected && selectedIcon ? selectedIcon : icon;
|
|
1446
1452
|
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1447
1453
|
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
1448
1454
|
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
1449
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, mode: "
|
|
1455
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, mode: "wait", children: (loading || activeIcon && iconPosition === "leading") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1450
1456
|
AnimatedIconSlot,
|
|
1451
1457
|
{
|
|
1452
1458
|
iconSize: sizeTokens.iconSize,
|
|
@@ -1468,8 +1474,9 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1468
1474
|
trackColor: "transparent",
|
|
1469
1475
|
"aria-label": "Loading"
|
|
1470
1476
|
}
|
|
1471
|
-
) :
|
|
1472
|
-
}
|
|
1477
|
+
) : activeIcon
|
|
1478
|
+
},
|
|
1479
|
+
isSelected && selectedIcon ? "selected-icon" : "icon"
|
|
1473
1480
|
) }),
|
|
1474
1481
|
labelText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1475
1482
|
react.m.span,
|
|
@@ -1480,27 +1487,28 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1480
1487
|
children: labelText
|
|
1481
1488
|
}
|
|
1482
1489
|
),
|
|
1483
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, mode: "
|
|
1490
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, mode: "wait", children: !loading && activeIcon && iconPosition === "trailing" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1484
1491
|
AnimatedIconSlot,
|
|
1485
1492
|
{
|
|
1486
1493
|
iconSize: sizeTokens.iconSize,
|
|
1487
1494
|
ariaHidden: true,
|
|
1488
1495
|
transition: sharedTransition,
|
|
1489
|
-
children:
|
|
1490
|
-
}
|
|
1496
|
+
children: activeIcon
|
|
1497
|
+
},
|
|
1498
|
+
isSelected && selectedIcon ? "selected-icon" : "icon"
|
|
1491
1499
|
) })
|
|
1492
1500
|
] });
|
|
1493
|
-
const handleAsChildPointerDown =
|
|
1501
|
+
const handleAsChildPointerDown = React16__namespace.useCallback(
|
|
1494
1502
|
(e) => {
|
|
1495
1503
|
springAnimate(motionRadius, pressedRadius);
|
|
1496
1504
|
onPointerDown == null ? void 0 : onPointerDown(e);
|
|
1497
1505
|
},
|
|
1498
1506
|
[motionRadius, pressedRadius, onPointerDown]
|
|
1499
1507
|
);
|
|
1500
|
-
const handleAsChildPointerUp =
|
|
1508
|
+
const handleAsChildPointerUp = React16__namespace.useCallback(() => {
|
|
1501
1509
|
springAnimate(motionRadius, animateRadius);
|
|
1502
1510
|
}, [motionRadius, animateRadius]);
|
|
1503
|
-
const handlePointerDown =
|
|
1511
|
+
const handlePointerDown = React16__namespace.useCallback(
|
|
1504
1512
|
(e) => {
|
|
1505
1513
|
onPointerDown(e);
|
|
1506
1514
|
},
|
|
@@ -1510,7 +1518,7 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1510
1518
|
const strippedProps = __spreadValues({}, restProps);
|
|
1511
1519
|
for (const key of MOTION_PROP_KEYS) delete strippedProps[key];
|
|
1512
1520
|
const htmlProps = strippedProps;
|
|
1513
|
-
const child =
|
|
1521
|
+
const child = React16__namespace.Children.only(children);
|
|
1514
1522
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1515
1523
|
reactSlot.Slot,
|
|
1516
1524
|
__spreadProps(__spreadValues({
|
|
@@ -1527,7 +1535,7 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1527
1535
|
}),
|
|
1528
1536
|
className: buttonClassName
|
|
1529
1537
|
}, htmlProps), {
|
|
1530
|
-
children:
|
|
1538
|
+
children: React16__namespace.cloneElement(child, { children: innerContent })
|
|
1531
1539
|
})
|
|
1532
1540
|
) });
|
|
1533
1541
|
}
|
|
@@ -1556,13 +1564,343 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1556
1564
|
}
|
|
1557
1565
|
);
|
|
1558
1566
|
ButtonComponent.displayName = "Button";
|
|
1559
|
-
var Button =
|
|
1567
|
+
var Button = React16__namespace.memo(ButtonComponent);
|
|
1568
|
+
|
|
1569
|
+
// src/ui/buttons/button-distribute/button-distribute-tokens.ts
|
|
1570
|
+
var DISTRIBUTE_SPRING_TRANSITION = {
|
|
1571
|
+
type: "spring",
|
|
1572
|
+
stiffness: 300,
|
|
1573
|
+
damping: 30,
|
|
1574
|
+
mass: 0.8
|
|
1575
|
+
};
|
|
1576
|
+
var DISTRIBUTE_EASING_BEZIER = "cubic-bezier(0.2, 0.0, 0.0, 1.0)";
|
|
1577
|
+
var DISTRIBUTE_DURATION_MS = 350;
|
|
1578
|
+
var DEFAULT_EXPAND_RATIO = 0.3;
|
|
1579
|
+
var DEFAULT_FIXED_SIZE = 48;
|
|
1580
|
+
var DEFAULT_GAP = "0.5rem";
|
|
1581
|
+
var DISTRIBUTE_RADIUS_TOKENS = {
|
|
1582
|
+
xs: { circleRadius: 16, pillRadius: 16, pressedRadius: 8 },
|
|
1583
|
+
sm: { circleRadius: 20, pillRadius: 20, pressedRadius: 10 },
|
|
1584
|
+
md: { circleRadius: 28, pillRadius: 28, pressedRadius: 16 },
|
|
1585
|
+
lg: { circleRadius: 48, pillRadius: 48, pressedRadius: 28 },
|
|
1586
|
+
xl: { circleRadius: 68, pillRadius: 68, pressedRadius: 40 }
|
|
1587
|
+
};
|
|
1588
|
+
var DISTRIBUTE_HEIGHT_TOKENS = {
|
|
1589
|
+
xs: "h-8",
|
|
1590
|
+
sm: "h-10",
|
|
1591
|
+
md: "h-14",
|
|
1592
|
+
lg: "h-24",
|
|
1593
|
+
xl: "h-[8.5rem]"
|
|
1594
|
+
};
|
|
1595
|
+
function useDistributeWeights({
|
|
1596
|
+
count,
|
|
1597
|
+
weights,
|
|
1598
|
+
activeIndex,
|
|
1599
|
+
expandRatio = DEFAULT_EXPAND_RATIO,
|
|
1600
|
+
mode = "dynamic",
|
|
1601
|
+
isTextItem
|
|
1602
|
+
}) {
|
|
1603
|
+
return React16__namespace.useMemo(() => {
|
|
1604
|
+
if (count <= 0) return [];
|
|
1605
|
+
if (mode === "mixed") {
|
|
1606
|
+
const baseWeights2 = new Array(count).fill(0).map((_, idx) => {
|
|
1607
|
+
if (idx === 0 || idx === count - 1) return 0;
|
|
1608
|
+
return weights && weights[idx] !== void 0 ? weights[idx] : 1;
|
|
1609
|
+
});
|
|
1610
|
+
if (activeIndex === null || activeIndex < 0 || activeIndex >= count || count === 1) {
|
|
1611
|
+
return baseWeights2;
|
|
1612
|
+
}
|
|
1613
|
+
const result2 = [...baseWeights2];
|
|
1614
|
+
const expandAmount2 = expandRatio * 1.5;
|
|
1615
|
+
if (activeIndex === 0) {
|
|
1616
|
+
result2[0] = expandAmount2;
|
|
1617
|
+
for (let i = 1; i < count - 1; i++) {
|
|
1618
|
+
result2[i] = Math.max(0.5, baseWeights2[i] - expandRatio * 0.4);
|
|
1619
|
+
}
|
|
1620
|
+
} else if (activeIndex === count - 1) {
|
|
1621
|
+
result2[count - 1] = expandAmount2;
|
|
1622
|
+
for (let i = 1; i < count - 1; i++) {
|
|
1623
|
+
result2[i] = Math.max(0.5, baseWeights2[i] - expandRatio * 0.4);
|
|
1624
|
+
}
|
|
1625
|
+
} else {
|
|
1626
|
+
result2[activeIndex] = baseWeights2[activeIndex] + expandRatio;
|
|
1627
|
+
for (let i = 1; i < count - 1; i++) {
|
|
1628
|
+
if (i !== activeIndex) {
|
|
1629
|
+
result2[i] = Math.max(0.5, baseWeights2[i] - expandRatio * 0.5);
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
return result2;
|
|
1634
|
+
}
|
|
1635
|
+
let baseWeights;
|
|
1636
|
+
if (weights && weights.length === count) {
|
|
1637
|
+
baseWeights = [...weights];
|
|
1638
|
+
} else if (mode === "dynamic" && count === 3) {
|
|
1639
|
+
baseWeights = [1, 2, 1];
|
|
1640
|
+
} else {
|
|
1641
|
+
baseWeights = new Array(count).fill(1);
|
|
1642
|
+
}
|
|
1643
|
+
if (activeIndex === null || activeIndex < 0 || activeIndex >= count || count === 1) {
|
|
1644
|
+
return baseWeights;
|
|
1645
|
+
}
|
|
1646
|
+
const totalWeight = baseWeights.reduce((acc, w) => acc + w, 0);
|
|
1647
|
+
const activeBaseWeight = baseWeights[activeIndex];
|
|
1648
|
+
const expandAmount = expandRatio * totalWeight;
|
|
1649
|
+
const minWeights = baseWeights.map((w, idx) => {
|
|
1650
|
+
if (isTextItem == null ? void 0 : isTextItem[idx]) {
|
|
1651
|
+
return Math.max(0.75, w * 0.65);
|
|
1652
|
+
}
|
|
1653
|
+
return 0.4;
|
|
1654
|
+
});
|
|
1655
|
+
const shrinkCapacity = baseWeights.map(
|
|
1656
|
+
(w, idx) => idx === activeIndex ? 0 : Math.max(0, w - minWeights[idx])
|
|
1657
|
+
);
|
|
1658
|
+
const totalCapacity = shrinkCapacity.reduce((acc, cap) => acc + cap, 0);
|
|
1659
|
+
const result = [...baseWeights];
|
|
1660
|
+
if (totalCapacity > 0) {
|
|
1661
|
+
const actualExpand = Math.min(expandAmount, totalCapacity);
|
|
1662
|
+
result[activeIndex] = activeBaseWeight + actualExpand;
|
|
1663
|
+
for (let i = 0; i < count; i++) {
|
|
1664
|
+
if (i !== activeIndex) {
|
|
1665
|
+
const shrinkAmount = actualExpand * (shrinkCapacity[i] / totalCapacity);
|
|
1666
|
+
result[i] = Math.max(minWeights[i], baseWeights[i] - shrinkAmount);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
return result;
|
|
1671
|
+
}, [count, weights, activeIndex, expandRatio, mode, isTextItem]);
|
|
1672
|
+
}
|
|
1673
|
+
var ButtonDistribute = React16__namespace.forwardRef(
|
|
1674
|
+
(_a, ref) => {
|
|
1675
|
+
var _b = _a, {
|
|
1676
|
+
className,
|
|
1677
|
+
style,
|
|
1678
|
+
mode = "dynamic",
|
|
1679
|
+
weights,
|
|
1680
|
+
expandRatio = 0.3,
|
|
1681
|
+
expandOnHover = false,
|
|
1682
|
+
fixedSize = 48,
|
|
1683
|
+
leadingSize,
|
|
1684
|
+
trailingSize,
|
|
1685
|
+
gap = "0.5rem",
|
|
1686
|
+
size = "sm",
|
|
1687
|
+
itemClassName,
|
|
1688
|
+
children,
|
|
1689
|
+
onMouseLeave
|
|
1690
|
+
} = _b, restProps = __objRest(_b, [
|
|
1691
|
+
"className",
|
|
1692
|
+
"style",
|
|
1693
|
+
"mode",
|
|
1694
|
+
"weights",
|
|
1695
|
+
"expandRatio",
|
|
1696
|
+
"expandOnHover",
|
|
1697
|
+
"fixedSize",
|
|
1698
|
+
"leadingSize",
|
|
1699
|
+
"trailingSize",
|
|
1700
|
+
"gap",
|
|
1701
|
+
"size",
|
|
1702
|
+
"itemClassName",
|
|
1703
|
+
"children",
|
|
1704
|
+
"onMouseLeave"
|
|
1705
|
+
]);
|
|
1706
|
+
var _a2, _b2;
|
|
1707
|
+
const [activeIndex, setActiveIndex] = React16__namespace.useState(null);
|
|
1708
|
+
const [pressedIndex, setPressedIndex] = React16__namespace.useState(null);
|
|
1709
|
+
const childrenArray = React16__namespace.useMemo(
|
|
1710
|
+
() => React16__namespace.Children.toArray(children).filter(React16__namespace.isValidElement),
|
|
1711
|
+
[children]
|
|
1712
|
+
);
|
|
1713
|
+
const count = childrenArray.length;
|
|
1714
|
+
const isTextItem = React16__namespace.useMemo(() => {
|
|
1715
|
+
return childrenArray.map((child) => {
|
|
1716
|
+
const childEl = child;
|
|
1717
|
+
if (typeof childEl.props.children === "string") return true;
|
|
1718
|
+
if (Array.isArray(childEl.props.children)) {
|
|
1719
|
+
return childEl.props.children.some(
|
|
1720
|
+
(c) => typeof c === "string" && c.trim().length > 0
|
|
1721
|
+
);
|
|
1722
|
+
}
|
|
1723
|
+
return false;
|
|
1724
|
+
});
|
|
1725
|
+
}, [childrenArray]);
|
|
1726
|
+
const calculatedWeights = useDistributeWeights({
|
|
1727
|
+
count,
|
|
1728
|
+
weights,
|
|
1729
|
+
activeIndex,
|
|
1730
|
+
expandRatio,
|
|
1731
|
+
mode,
|
|
1732
|
+
isTextItem
|
|
1733
|
+
});
|
|
1734
|
+
const handleGroupMouseLeave = React16__namespace.useCallback(
|
|
1735
|
+
(e) => {
|
|
1736
|
+
setActiveIndex(null);
|
|
1737
|
+
setPressedIndex(null);
|
|
1738
|
+
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
1739
|
+
},
|
|
1740
|
+
[onMouseLeave]
|
|
1741
|
+
);
|
|
1742
|
+
const resolvedGap = typeof gap === "number" ? `${gap}px` : gap;
|
|
1743
|
+
const effectiveLeadingSize = typeof (leadingSize != null ? leadingSize : fixedSize) === "number" ? `${leadingSize != null ? leadingSize : fixedSize}px` : leadingSize != null ? leadingSize : fixedSize;
|
|
1744
|
+
const effectiveTrailingSize = typeof (trailingSize != null ? trailingSize : fixedSize) === "number" ? `${trailingSize != null ? trailingSize : fixedSize}px` : trailingSize != null ? trailingSize : fixedSize;
|
|
1745
|
+
const radiusTokens = (_a2 = DISTRIBUTE_RADIUS_TOKENS[size]) != null ? _a2 : DISTRIBUTE_RADIUS_TOKENS.sm;
|
|
1746
|
+
const heightClass = (_b2 = DISTRIBUTE_HEIGHT_TOKENS[size]) != null ? _b2 : DISTRIBUTE_HEIGHT_TOKENS.sm;
|
|
1747
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1748
|
+
"fieldset",
|
|
1749
|
+
__spreadProps(__spreadValues({
|
|
1750
|
+
ref,
|
|
1751
|
+
onMouseLeave: handleGroupMouseLeave,
|
|
1752
|
+
onPointerCancel: () => setPressedIndex(null),
|
|
1753
|
+
className: cn(
|
|
1754
|
+
"inline-flex flex-row items-center border-none p-0 m-0 box-border overflow-hidden select-none w-full",
|
|
1755
|
+
heightClass,
|
|
1756
|
+
className
|
|
1757
|
+
),
|
|
1758
|
+
style: __spreadValues({
|
|
1759
|
+
gap: resolvedGap
|
|
1760
|
+
}, style)
|
|
1761
|
+
}, restProps), {
|
|
1762
|
+
children: childrenArray.map((child, index) => {
|
|
1763
|
+
var _a3, _b3, _c, _d, _e, _f;
|
|
1764
|
+
const isFirst = index === 0;
|
|
1765
|
+
const isLast = index === count - 1;
|
|
1766
|
+
const childElement = child;
|
|
1767
|
+
const isActive = activeIndex === index;
|
|
1768
|
+
const isPressed = pressedIndex === index;
|
|
1769
|
+
const isSquish = isActive || isPressed;
|
|
1770
|
+
let flexStyle = {};
|
|
1771
|
+
let targetFlexBasis = 0;
|
|
1772
|
+
const parsePx = (val) => {
|
|
1773
|
+
if (typeof val === "number") return val;
|
|
1774
|
+
const parsed = Number.parseFloat(val);
|
|
1775
|
+
return Number.isNaN(parsed) ? 48 : parsed;
|
|
1776
|
+
};
|
|
1777
|
+
const leadingPx = parsePx(effectiveLeadingSize);
|
|
1778
|
+
const trailingPx = parsePx(effectiveTrailingSize);
|
|
1779
|
+
const leadingCompressedPx = Math.max(
|
|
1780
|
+
40,
|
|
1781
|
+
Math.round(leadingPx * (1 - expandRatio))
|
|
1782
|
+
);
|
|
1783
|
+
const trailingCompressedPx = Math.max(
|
|
1784
|
+
40,
|
|
1785
|
+
Math.round(trailingPx * (1 - expandRatio))
|
|
1786
|
+
);
|
|
1787
|
+
if (mode === "dynamic" || mode === "fixed") {
|
|
1788
|
+
const currentWeight = (_a3 = calculatedWeights[index]) != null ? _a3 : 1;
|
|
1789
|
+
flexStyle = {
|
|
1790
|
+
flexGrow: currentWeight,
|
|
1791
|
+
flexShrink: 1,
|
|
1792
|
+
flexBasis: 0,
|
|
1793
|
+
minWidth: 0
|
|
1794
|
+
};
|
|
1795
|
+
targetFlexBasis = 0;
|
|
1796
|
+
} else if (mode === "mixed") {
|
|
1797
|
+
const currentWeight = (_b3 = calculatedWeights[index]) != null ? _b3 : 0;
|
|
1798
|
+
if (isFirst) {
|
|
1799
|
+
targetFlexBasis = activeIndex !== null && activeIndex > 0 ? `${leadingCompressedPx}px` : effectiveLeadingSize;
|
|
1800
|
+
flexStyle = {
|
|
1801
|
+
flexBasis: targetFlexBasis,
|
|
1802
|
+
flexGrow: currentWeight,
|
|
1803
|
+
flexShrink: 0,
|
|
1804
|
+
minWidth: 0
|
|
1805
|
+
};
|
|
1806
|
+
} else if (isLast) {
|
|
1807
|
+
targetFlexBasis = activeIndex !== null && activeIndex < count - 1 ? `${trailingCompressedPx}px` : effectiveTrailingSize;
|
|
1808
|
+
flexStyle = {
|
|
1809
|
+
flexBasis: targetFlexBasis,
|
|
1810
|
+
flexGrow: currentWeight,
|
|
1811
|
+
flexShrink: 0,
|
|
1812
|
+
minWidth: 0
|
|
1813
|
+
};
|
|
1814
|
+
} else {
|
|
1815
|
+
targetFlexBasis = 0;
|
|
1816
|
+
flexStyle = {
|
|
1817
|
+
flexBasis: 0,
|
|
1818
|
+
flexGrow: (_c = calculatedWeights[index]) != null ? _c : 1,
|
|
1819
|
+
flexShrink: 1,
|
|
1820
|
+
minWidth: 0
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
const handleMouseEnter = (e) => {
|
|
1825
|
+
var _a4, _b4;
|
|
1826
|
+
if (expandOnHover) {
|
|
1827
|
+
setActiveIndex(index);
|
|
1828
|
+
}
|
|
1829
|
+
(_b4 = (_a4 = childElement.props).onMouseEnter) == null ? void 0 : _b4.call(_a4, e);
|
|
1830
|
+
};
|
|
1831
|
+
const handleFocus = (e) => {
|
|
1832
|
+
var _a4, _b4;
|
|
1833
|
+
setActiveIndex(index);
|
|
1834
|
+
(_b4 = (_a4 = childElement.props).onFocus) == null ? void 0 : _b4.call(_a4, e);
|
|
1835
|
+
};
|
|
1836
|
+
const handlePointerDown = (e) => {
|
|
1837
|
+
var _a4, _b4;
|
|
1838
|
+
setPressedIndex(index);
|
|
1839
|
+
setActiveIndex(index);
|
|
1840
|
+
(_b4 = (_a4 = childElement.props).onPointerDown) == null ? void 0 : _b4.call(_a4, e);
|
|
1841
|
+
};
|
|
1842
|
+
const handlePointerUp = (e) => {
|
|
1843
|
+
var _a4, _b4;
|
|
1844
|
+
setPressedIndex(null);
|
|
1845
|
+
if (!expandOnHover) {
|
|
1846
|
+
setActiveIndex(null);
|
|
1847
|
+
}
|
|
1848
|
+
(_b4 = (_a4 = childElement.props).onPointerUp) == null ? void 0 : _b4.call(_a4, e);
|
|
1849
|
+
};
|
|
1850
|
+
const handleClick = (e) => {
|
|
1851
|
+
var _a4, _b4;
|
|
1852
|
+
setPressedIndex(null);
|
|
1853
|
+
if (!expandOnHover) {
|
|
1854
|
+
setActiveIndex(null);
|
|
1855
|
+
}
|
|
1856
|
+
(_b4 = (_a4 = childElement.props).onClick) == null ? void 0 : _b4.call(_a4, e);
|
|
1857
|
+
};
|
|
1858
|
+
const clonedChild = React16__namespace.cloneElement(childElement, {
|
|
1859
|
+
size: (_d = childElement.props.size) != null ? _d : size,
|
|
1860
|
+
className: cn(
|
|
1861
|
+
"w-full! h-full! justify-center items-center flex-1 rounded-[inherit]! px-3! sm:px-4!",
|
|
1862
|
+
childElement.props.className
|
|
1863
|
+
)
|
|
1864
|
+
});
|
|
1865
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1866
|
+
react.m.div,
|
|
1867
|
+
{
|
|
1868
|
+
layout: true,
|
|
1869
|
+
initial: false,
|
|
1870
|
+
animate: {
|
|
1871
|
+
flexGrow: (_f = flexStyle.flexGrow) != null ? _f : 1,
|
|
1872
|
+
flexBasis: targetFlexBasis,
|
|
1873
|
+
borderRadius: isSquish ? radiusTokens.pressedRadius : radiusTokens.pillRadius
|
|
1874
|
+
},
|
|
1875
|
+
transition: __spreadProps(__spreadValues({}, DISTRIBUTE_SPRING_TRANSITION), {
|
|
1876
|
+
borderRadius: BUTTON_RADIUS_SPRING
|
|
1877
|
+
}),
|
|
1878
|
+
onMouseEnter: handleMouseEnter,
|
|
1879
|
+
onFocus: handleFocus,
|
|
1880
|
+
onPointerDown: handlePointerDown,
|
|
1881
|
+
onPointerUp: handlePointerUp,
|
|
1882
|
+
onClick: handleClick,
|
|
1883
|
+
className: cn(
|
|
1884
|
+
"relative inline-flex items-center justify-center shrink-0 min-w-0 overflow-hidden h-full",
|
|
1885
|
+
itemClassName
|
|
1886
|
+
),
|
|
1887
|
+
style: flexStyle,
|
|
1888
|
+
children: clonedChild
|
|
1889
|
+
},
|
|
1890
|
+
(_e = childElement.key) != null ? _e : index
|
|
1891
|
+
);
|
|
1892
|
+
})
|
|
1893
|
+
})
|
|
1894
|
+
) });
|
|
1895
|
+
}
|
|
1896
|
+
);
|
|
1897
|
+
ButtonDistribute.displayName = "ButtonDistribute";
|
|
1560
1898
|
var VARIANT_FONT = {
|
|
1561
1899
|
outlined: "'Material Symbols Outlined'",
|
|
1562
1900
|
rounded: "'Material Symbols Rounded'",
|
|
1563
1901
|
sharp: "'Material Symbols Sharp'"
|
|
1564
1902
|
};
|
|
1565
|
-
var IconComponent =
|
|
1903
|
+
var IconComponent = React16__namespace.forwardRef(
|
|
1566
1904
|
(_a, ref) => {
|
|
1567
1905
|
var _b = _a, {
|
|
1568
1906
|
name,
|
|
@@ -1628,7 +1966,7 @@ var IconComponent = React11__namespace.forwardRef(
|
|
|
1628
1966
|
}
|
|
1629
1967
|
);
|
|
1630
1968
|
IconComponent.displayName = "Icon";
|
|
1631
|
-
var Icon =
|
|
1969
|
+
var Icon = React16__namespace.memo(IconComponent);
|
|
1632
1970
|
var BUTTON_GROUP_TOKENS = {
|
|
1633
1971
|
standard: {
|
|
1634
1972
|
betweenSpace: 12,
|
|
@@ -1684,7 +2022,6 @@ function buildConnectedShapes(size, defaultCorners, pressedCorners) {
|
|
|
1684
2022
|
};
|
|
1685
2023
|
}
|
|
1686
2024
|
var ButtonGroupDefaults = {
|
|
1687
|
-
expandedRatio: 0.15,
|
|
1688
2025
|
connectedLeadingButtonShapes: (size) => buildConnectedShapes(
|
|
1689
2026
|
size,
|
|
1690
2027
|
(o, i) => ({ tl: o, tr: i, br: i, bl: o }),
|
|
@@ -1713,8 +2050,6 @@ var ButtonGroupDefaults = {
|
|
|
1713
2050
|
)
|
|
1714
2051
|
};
|
|
1715
2052
|
var PILL_BORDER_RADIUS = 9999;
|
|
1716
|
-
var MIN_FLEX_GROW = 0.01;
|
|
1717
|
-
var PADDING_EXPAND_MULTIPLIER = 4;
|
|
1718
2053
|
var CHECK_ICON_SIZE = 24;
|
|
1719
2054
|
var CHECK_ICON = /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "check", variant: "rounded", size: CHECK_ICON_SIZE, weight: 700 });
|
|
1720
2055
|
var CHECK_ICON_GAP_MAP = {
|
|
@@ -1730,19 +2065,7 @@ var CHECK_ICON_MOTION = {
|
|
|
1730
2065
|
damping: 34,
|
|
1731
2066
|
mass: 0.75
|
|
1732
2067
|
};
|
|
1733
|
-
var
|
|
1734
|
-
type: "spring",
|
|
1735
|
-
stiffness: 360,
|
|
1736
|
-
damping: 38,
|
|
1737
|
-
mass: 0.85
|
|
1738
|
-
};
|
|
1739
|
-
var NAVBAR_EXPRESSIVE_SPRING = {
|
|
1740
|
-
type: "spring",
|
|
1741
|
-
stiffness: 430,
|
|
1742
|
-
damping: 38,
|
|
1743
|
-
mass: 0.8
|
|
1744
|
-
};
|
|
1745
|
-
var AnimatedCheckLabel = React11__namespace.memo(function AnimatedCheckLabel2({
|
|
2068
|
+
var AnimatedCheckLabel = React16__namespace.memo(function AnimatedCheckLabel2({
|
|
1746
2069
|
selected,
|
|
1747
2070
|
size,
|
|
1748
2071
|
children
|
|
@@ -1779,23 +2102,6 @@ var AnimatedCheckLabel = React11__namespace.memo(function AnimatedCheckLabel2({
|
|
|
1779
2102
|
}
|
|
1780
2103
|
);
|
|
1781
2104
|
});
|
|
1782
|
-
var AnimatedNavbarLabel = React11__namespace.memo(function AnimatedNavbarLabel2({
|
|
1783
|
-
show,
|
|
1784
|
-
children
|
|
1785
|
-
}) {
|
|
1786
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, mode: "popLayout", children: show && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1787
|
-
react.m.span,
|
|
1788
|
-
{
|
|
1789
|
-
initial: { width: 0, opacity: 0, scale: 0.8 },
|
|
1790
|
-
animate: { width: "auto", opacity: 1, scale: 1 },
|
|
1791
|
-
exit: { width: 0, opacity: 0, scale: 0.8 },
|
|
1792
|
-
transition: NAVBAR_EXPRESSIVE_SPRING,
|
|
1793
|
-
className: "overflow-hidden whitespace-nowrap text-sm font-semibold tracking-[0.01em] ml-1.5",
|
|
1794
|
-
children
|
|
1795
|
-
},
|
|
1796
|
-
"navbar-label"
|
|
1797
|
-
) });
|
|
1798
|
-
});
|
|
1799
2105
|
function resolveConnectedShapes(variant, orientation, isFirst, isLast, itemSize) {
|
|
1800
2106
|
const defaults = ButtonGroupDefaults.connectedLeadingButtonShapes(itemSize);
|
|
1801
2107
|
if (variant !== "connected") return defaults;
|
|
@@ -1816,7 +2122,7 @@ function resolveConnectedShapes(variant, orientation, isFirst, isLast, itemSize)
|
|
|
1816
2122
|
}
|
|
1817
2123
|
return defaults;
|
|
1818
2124
|
}
|
|
1819
|
-
function resolveIconAndLabel(element, isSelected, itemSize,
|
|
2125
|
+
function resolveIconAndLabel(element, isSelected, itemSize, showCheck, iconBehavior, labelBehavior) {
|
|
1820
2126
|
let icon = element.props.icon;
|
|
1821
2127
|
let label = element.props.children;
|
|
1822
2128
|
const animateCheckInLabel = showCheck && iconBehavior !== "none" && iconBehavior !== "selected" && label !== void 0;
|
|
@@ -1832,51 +2138,12 @@ function resolveIconAndLabel(element, isSelected, itemSize, variant, showCheck,
|
|
|
1832
2138
|
}
|
|
1833
2139
|
if (animateCheckInLabel && label !== void 0) {
|
|
1834
2140
|
label = /* @__PURE__ */ jsxRuntime.jsx(AnimatedCheckLabel, { selected: isSelected, size: itemSize, children: label });
|
|
1835
|
-
} else if (variant === "navbar" && label !== void 0) {
|
|
1836
|
-
const showLabel = !labelBehavior || labelBehavior === "all" || labelBehavior === "selected" && isSelected;
|
|
1837
|
-
label = /* @__PURE__ */ jsxRuntime.jsx(AnimatedNavbarLabel, { show: showLabel, children: label });
|
|
1838
2141
|
}
|
|
1839
2142
|
return { icon, label };
|
|
1840
2143
|
}
|
|
1841
|
-
function
|
|
1842
|
-
const increment = expandedRatio * PADDING_EXPAND_MULTIPLIER;
|
|
1843
|
-
if (activeMorphing) {
|
|
1844
|
-
const isFlexLayout = fullWidth || variant === "connected" && orientation === "horizontal";
|
|
1845
|
-
if (isFlexLayout) {
|
|
1846
|
-
if (isSelected) return { flexGrow: 1 + expandedRatio };
|
|
1847
|
-
if (hasSelected && count > 1)
|
|
1848
|
-
return {
|
|
1849
|
-
flexGrow: Math.max(MIN_FLEX_GROW, 1 - expandedRatio / (count - 1))
|
|
1850
|
-
};
|
|
1851
|
-
return { flexGrow: 1 };
|
|
1852
|
-
}
|
|
1853
|
-
if (isSelected)
|
|
1854
|
-
return { paddingInline: `calc(${basePx} + ${increment}rem)` };
|
|
1855
|
-
if (hasSelected && count > 1) {
|
|
1856
|
-
const decrement = increment / (count - 1);
|
|
1857
|
-
return { paddingInline: `calc(${basePx} - ${decrement}rem)` };
|
|
1858
|
-
}
|
|
1859
|
-
return { paddingInline: basePx };
|
|
1860
|
-
}
|
|
1861
|
-
if (morphingWidth && variant === "standard") {
|
|
1862
|
-
if (fullWidth) return { flexGrow: isPressed ? 1 + expandedRatio : 1 };
|
|
1863
|
-
return {
|
|
1864
|
-
paddingInline: isPressed ? `calc(${basePx} + ${increment}rem)` : basePx
|
|
1865
|
-
};
|
|
1866
|
-
}
|
|
1867
|
-
return {};
|
|
1868
|
-
}
|
|
1869
|
-
function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex, existingAnimate, existingWhileTap) {
|
|
2144
|
+
function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, existingAnimate, existingWhileTap) {
|
|
1870
2145
|
var _a, _b;
|
|
1871
2146
|
const props = { animate: __spreadValues({}, existingAnimate) };
|
|
1872
|
-
if (variant !== "navbar") {
|
|
1873
|
-
if (flex.flexGrow !== void 0) {
|
|
1874
|
-
props.animate.flexGrow = flex.flexGrow;
|
|
1875
|
-
}
|
|
1876
|
-
if (flex.paddingInline !== void 0) {
|
|
1877
|
-
props.animate.paddingInline = flex.paddingInline;
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
2147
|
if (variant === "standard") {
|
|
1881
2148
|
const pressedRadius = (_a = PRESSED_RADIUS_MAP[itemSize]) != null ? _a : PRESSED_RADIUS_MAP.sm;
|
|
1882
2149
|
const itemSizeTokens = (_b = BUTTON_SIZE_TOKENS[itemSize]) != null ? _b : BUTTON_SIZE_TOKENS.sm;
|
|
@@ -1887,9 +2154,6 @@ function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex
|
|
|
1887
2154
|
}, existingWhileTap);
|
|
1888
2155
|
props.transition = {
|
|
1889
2156
|
borderRadius: BUTTON_RADIUS_SPRING,
|
|
1890
|
-
flexGrow: WIDTH_MORPH_SPRING,
|
|
1891
|
-
paddingInline: WIDTH_MORPH_SPRING,
|
|
1892
|
-
layout: WIDTH_MORPH_SPRING,
|
|
1893
2157
|
default: BUTTON_SHAPE_MORPH_SPRING
|
|
1894
2158
|
};
|
|
1895
2159
|
props.layout = true;
|
|
@@ -1916,26 +2180,16 @@ function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex
|
|
|
1916
2180
|
borderBottomLeftRadius: shapes.pressed.bl
|
|
1917
2181
|
}, existingWhileTap);
|
|
1918
2182
|
props.transition = __spreadProps(__spreadValues({}, BUTTON_SHAPE_MORPH_SPRING), {
|
|
1919
|
-
flexGrow: WIDTH_MORPH_SPRING,
|
|
1920
|
-
paddingInline: WIDTH_MORPH_SPRING,
|
|
1921
2183
|
borderTopLeftRadius: BUTTON_RADIUS_SPRING,
|
|
1922
2184
|
borderTopRightRadius: BUTTON_RADIUS_SPRING,
|
|
1923
2185
|
borderBottomRightRadius: BUTTON_RADIUS_SPRING,
|
|
1924
|
-
borderBottomLeftRadius: BUTTON_RADIUS_SPRING
|
|
1925
|
-
layout: WIDTH_MORPH_SPRING
|
|
2186
|
+
borderBottomLeftRadius: BUTTON_RADIUS_SPRING
|
|
1926
2187
|
});
|
|
1927
2188
|
props.layout = true;
|
|
1928
2189
|
}
|
|
1929
|
-
if (variant === "navbar") {
|
|
1930
|
-
props.layout = true;
|
|
1931
|
-
props.transition = {
|
|
1932
|
-
layout: WIDTH_MORPH_SPRING,
|
|
1933
|
-
default: BUTTON_SHAPE_MORPH_SPRING
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
2190
|
return props;
|
|
1937
2191
|
}
|
|
1938
|
-
var ButtonGroupComponent =
|
|
2192
|
+
var ButtonGroupComponent = React16__namespace.forwardRef(
|
|
1939
2193
|
(_a, ref) => {
|
|
1940
2194
|
var _b = _a, {
|
|
1941
2195
|
className,
|
|
@@ -1943,10 +2197,7 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
1943
2197
|
orientation = "horizontal",
|
|
1944
2198
|
fullWidth = false,
|
|
1945
2199
|
size,
|
|
1946
|
-
morphingWidth = true,
|
|
1947
|
-
activeMorphing = false,
|
|
1948
2200
|
itemClassName,
|
|
1949
|
-
expandedRatio = ButtonGroupDefaults.expandedRatio,
|
|
1950
2201
|
showCheck = false,
|
|
1951
2202
|
children,
|
|
1952
2203
|
iconBehavior,
|
|
@@ -1958,126 +2209,50 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
1958
2209
|
"orientation",
|
|
1959
2210
|
"fullWidth",
|
|
1960
2211
|
"size",
|
|
1961
|
-
"morphingWidth",
|
|
1962
|
-
"activeMorphing",
|
|
1963
2212
|
"itemClassName",
|
|
1964
|
-
"expandedRatio",
|
|
1965
2213
|
"showCheck",
|
|
1966
2214
|
"children",
|
|
1967
2215
|
"iconBehavior",
|
|
1968
2216
|
"labelBehavior",
|
|
1969
2217
|
"style"
|
|
1970
2218
|
]);
|
|
1971
|
-
const [pressedIndex, setPressedIndex] =
|
|
1972
|
-
const
|
|
1973
|
-
|
|
1974
|
-
);
|
|
1975
|
-
const layoutIdGroup = React11__namespace.useId();
|
|
1976
|
-
const rootRef = React11__namespace.useRef(null);
|
|
1977
|
-
const setRootRef = React11__namespace.useCallback(
|
|
1978
|
-
(node) => {
|
|
1979
|
-
rootRef.current = node;
|
|
1980
|
-
if (typeof ref === "function") {
|
|
1981
|
-
ref(node);
|
|
1982
|
-
} else if (ref) {
|
|
1983
|
-
ref.current = node;
|
|
1984
|
-
}
|
|
1985
|
-
},
|
|
1986
|
-
[ref]
|
|
1987
|
-
);
|
|
1988
|
-
const childrenArray = React11__namespace.useMemo(
|
|
1989
|
-
() => React11__namespace.Children.toArray(children).filter(React11__namespace.isValidElement),
|
|
2219
|
+
const [pressedIndex, setPressedIndex] = React16__namespace.useState(null);
|
|
2220
|
+
const childrenArray = React16__namespace.useMemo(
|
|
2221
|
+
() => React16__namespace.Children.toArray(children).filter(React16__namespace.isValidElement),
|
|
1990
2222
|
[children]
|
|
1991
2223
|
);
|
|
1992
2224
|
const count = childrenArray.length;
|
|
1993
|
-
const
|
|
1994
|
-
() => `${childrenArray.map((child, index) => {
|
|
1995
|
-
var _a2, _b2, _c, _d, _e;
|
|
1996
|
-
const element = child;
|
|
1997
|
-
const label = typeof element.props.children === "string" || typeof element.props.children === "number" ? element.props.children : (_a2 = element.key) != null ? _a2 : index;
|
|
1998
|
-
return [
|
|
1999
|
-
(_b2 = element.key) != null ? _b2 : index,
|
|
2000
|
-
(_d = (_c = element.props.size) != null ? _c : size) != null ? _d : "",
|
|
2001
|
-
label,
|
|
2002
|
-
Boolean(element.props.icon),
|
|
2003
|
-
(_e = element.props.className) != null ? _e : ""
|
|
2004
|
-
].join(":");
|
|
2005
|
-
}).join("|")}|${variant}|${orientation}|${showCheck}`,
|
|
2006
|
-
[childrenArray, orientation, showCheck, size, variant]
|
|
2007
|
-
);
|
|
2008
|
-
const groupSizeSignatureRef = React11__namespace.useRef(groupSizeSignature);
|
|
2009
|
-
React11__namespace.useLayoutEffect(() => {
|
|
2010
|
-
if (groupSizeSignatureRef.current !== groupSizeSignature) {
|
|
2011
|
-
groupSizeSignatureRef.current = groupSizeSignature;
|
|
2012
|
-
setLockedGroupSize(null);
|
|
2013
|
-
}
|
|
2014
|
-
}, [groupSizeSignature]);
|
|
2015
|
-
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;
|
|
2016
|
-
const shouldLockGroupSize = activeMorphing && !fullWidth && !hasExplicitGroupSize && count > 1;
|
|
2017
|
-
React11__namespace.useLayoutEffect(() => {
|
|
2018
|
-
if (!shouldLockGroupSize) {
|
|
2019
|
-
if (lockedGroupSize !== null) setLockedGroupSize(null);
|
|
2020
|
-
return;
|
|
2021
|
-
}
|
|
2022
|
-
if (lockedGroupSize !== null) return;
|
|
2023
|
-
const node = rootRef.current;
|
|
2024
|
-
if (!node) return;
|
|
2025
|
-
const rect = node.getBoundingClientRect();
|
|
2026
|
-
const nextSize = orientation === "horizontal" ? rect.width : rect.height;
|
|
2027
|
-
if (nextSize > 0) {
|
|
2028
|
-
setLockedGroupSize(Math.ceil(nextSize * 100) / 100);
|
|
2029
|
-
}
|
|
2030
|
-
}, [lockedGroupSize, orientation, shouldLockGroupSize]);
|
|
2031
|
-
const groupStyle = React11__namespace.useMemo(() => {
|
|
2032
|
-
const nextStyle = __spreadValues({}, style);
|
|
2033
|
-
if (shouldLockGroupSize && lockedGroupSize !== null) {
|
|
2034
|
-
if (orientation === "horizontal") {
|
|
2035
|
-
nextStyle.inlineSize = `${lockedGroupSize}px`;
|
|
2036
|
-
} else {
|
|
2037
|
-
nextStyle.blockSize = `${lockedGroupSize}px`;
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
return nextStyle;
|
|
2041
|
-
}, [lockedGroupSize, orientation, shouldLockGroupSize, style]);
|
|
2042
|
-
const hasSelected = React11__namespace.useMemo(
|
|
2043
|
-
() => childrenArray.some(
|
|
2044
|
-
(child) => child.props.selected
|
|
2045
|
-
),
|
|
2046
|
-
[childrenArray]
|
|
2047
|
-
);
|
|
2048
|
-
const handlePointerLeaveAndUp = React11__namespace.useCallback(() => {
|
|
2225
|
+
const handlePointerLeaveAndUp = React16__namespace.useCallback(() => {
|
|
2049
2226
|
setPressedIndex(null);
|
|
2050
2227
|
}, []);
|
|
2051
2228
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2052
2229
|
"fieldset",
|
|
2053
2230
|
__spreadProps(__spreadValues({
|
|
2054
|
-
ref
|
|
2231
|
+
ref,
|
|
2055
2232
|
className: cn(
|
|
2056
2233
|
"inline-flex p-0 m-0 border-none max-w-full [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2057
2234
|
orientation === "vertical" ? "flex-col items-stretch overflow-y-auto overflow-x-hidden" : "flex-row overflow-x-auto overflow-y-hidden",
|
|
2058
|
-
variant === "standard" ? "gap-3" :
|
|
2235
|
+
variant === "standard" ? "gap-3" : "gap-0.5",
|
|
2059
2236
|
fullWidth && "w-full",
|
|
2060
2237
|
fullWidth && orientation === "vertical" && "h-full",
|
|
2061
2238
|
className
|
|
2062
2239
|
),
|
|
2063
|
-
style
|
|
2240
|
+
style,
|
|
2064
2241
|
onPointerLeave: handlePointerLeaveAndUp,
|
|
2065
2242
|
onPointerUp: handlePointerLeaveAndUp
|
|
2066
2243
|
}, props), {
|
|
2067
2244
|
children: childrenArray.map((child, index) => {
|
|
2068
|
-
var _a2
|
|
2245
|
+
var _a2;
|
|
2069
2246
|
const element = child;
|
|
2070
2247
|
const isSelected = element.props.selected === true;
|
|
2071
2248
|
const isFirst = index === 0;
|
|
2072
2249
|
const isLast = index === count - 1;
|
|
2073
2250
|
const itemSize = size || element.props.size || "sm";
|
|
2074
|
-
const basePx = ((_a2 = BUTTON_SIZE_TOKENS[itemSize]) == null ? void 0 : _a2.leadingSpace) || "1rem";
|
|
2075
2251
|
const isPressed = pressedIndex === index;
|
|
2076
2252
|
const { icon: explicitIcon, label: explicitLabel } = resolveIconAndLabel(
|
|
2077
2253
|
element,
|
|
2078
2254
|
isSelected,
|
|
2079
2255
|
itemSize,
|
|
2080
|
-
variant,
|
|
2081
2256
|
showCheck,
|
|
2082
2257
|
iconBehavior,
|
|
2083
2258
|
labelBehavior
|
|
@@ -2089,25 +2264,6 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2089
2264
|
isLast,
|
|
2090
2265
|
itemSize
|
|
2091
2266
|
);
|
|
2092
|
-
const flex = resolveFlexTargets(
|
|
2093
|
-
variant,
|
|
2094
|
-
orientation,
|
|
2095
|
-
isSelected,
|
|
2096
|
-
isPressed,
|
|
2097
|
-
hasSelected,
|
|
2098
|
-
count,
|
|
2099
|
-
fullWidth,
|
|
2100
|
-
activeMorphing,
|
|
2101
|
-
morphingWidth,
|
|
2102
|
-
expandedRatio,
|
|
2103
|
-
basePx
|
|
2104
|
-
);
|
|
2105
|
-
const dynamicStyle = __spreadValues({}, element.props.style);
|
|
2106
|
-
if (variant !== "navbar" && flex.flexGrow !== void 0 && fullWidth) {
|
|
2107
|
-
dynamicStyle.flexBasis = 0;
|
|
2108
|
-
dynamicStyle.flexShrink = 1;
|
|
2109
|
-
dynamicStyle.minWidth = 0;
|
|
2110
|
-
}
|
|
2111
2267
|
const existingAnimate = typeof element.props.animate === "object" && !Array.isArray(element.props.animate) ? element.props.animate : {};
|
|
2112
2268
|
const existingWhileTap = typeof element.props.whileTap === "object" && !Array.isArray(element.props.whileTap) ? element.props.whileTap : {};
|
|
2113
2269
|
const motionProps = buildMotionProps(
|
|
@@ -2116,19 +2272,12 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2116
2272
|
isPressed,
|
|
2117
2273
|
itemSize,
|
|
2118
2274
|
shapes,
|
|
2119
|
-
flex,
|
|
2120
2275
|
existingAnimate,
|
|
2121
2276
|
existingWhileTap
|
|
2122
2277
|
);
|
|
2123
2278
|
const connectedClasses = variant === "connected" && isSelected ? "z-20" : "";
|
|
2124
|
-
const
|
|
2125
|
-
|
|
2126
|
-
flexShrink: fullWidth ? 1 : 0,
|
|
2127
|
-
flexGrow: flex.flexGrow,
|
|
2128
|
-
minWidth: labelBehavior !== "selected" ? 0 : "fit-content"
|
|
2129
|
-
} : {};
|
|
2130
|
-
const clonedElement = React11__namespace.cloneElement(element, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
2131
|
-
key: (_b2 = element.key) != null ? _b2 : index,
|
|
2279
|
+
const clonedElement = React16__namespace.cloneElement(element, __spreadValues(__spreadProps(__spreadValues({
|
|
2280
|
+
key: (_a2 = element.key) != null ? _a2 : index,
|
|
2132
2281
|
tabIndex: isFirst ? 0 : -1,
|
|
2133
2282
|
size: size || element.props.size,
|
|
2134
2283
|
icon: explicitIcon,
|
|
@@ -2136,71 +2285,20 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2136
2285
|
}, variant === "connected" && {
|
|
2137
2286
|
colorStyle: element.props.colorStyle || "tonal",
|
|
2138
2287
|
selectedColorStyle: element.props.selectedColorStyle || "filled"
|
|
2139
|
-
}),
|
|
2140
|
-
colorStyle: "text",
|
|
2141
|
-
selectedColorStyle: "text",
|
|
2142
|
-
className: cn(
|
|
2143
|
-
element.props.className,
|
|
2144
|
-
"w-full! h-full! px-3! min-w-0! relative z-20 flex items-center justify-center",
|
|
2145
|
-
isSelected ? "text-m3-on-secondary-container! hover:bg-transparent! active:bg-transparent!" : "text-m3-on-surface-variant! hover:bg-transparent! active:bg-transparent!",
|
|
2146
|
-
itemClassName
|
|
2147
|
-
)
|
|
2148
|
-
}), variant !== "navbar" && {
|
|
2288
|
+
}), {
|
|
2149
2289
|
className: cn(
|
|
2150
2290
|
element.props.className,
|
|
2151
2291
|
connectedClasses,
|
|
2152
2292
|
"focus-visible:z-10 hover:z-10 relative min-w-0",
|
|
2153
2293
|
orientation === "vertical" && "w-full",
|
|
2294
|
+
fullWidth && "flex-1",
|
|
2154
2295
|
itemClassName
|
|
2155
|
-
)
|
|
2156
|
-
}), {
|
|
2157
|
-
style: variant === "navbar" ? __spreadProps(__spreadValues({}, dynamicStyle), { minWidth: 0 }) : dynamicStyle,
|
|
2296
|
+
),
|
|
2158
2297
|
onPointerDown: (e) => {
|
|
2159
2298
|
setPressedIndex(index);
|
|
2160
2299
|
if (element.props.onPointerDown) element.props.onPointerDown(e);
|
|
2161
2300
|
}
|
|
2162
2301
|
}), motionProps));
|
|
2163
|
-
if (variant === "navbar") {
|
|
2164
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2165
|
-
react.m.div,
|
|
2166
|
-
{
|
|
2167
|
-
layout: true,
|
|
2168
|
-
whileTap: { scale: 0.96 },
|
|
2169
|
-
transition: NAVBAR_EXPRESSIVE_SPRING,
|
|
2170
|
-
className: "group relative h-full flex items-center justify-center min-w-0",
|
|
2171
|
-
style: navbarFlexStyle,
|
|
2172
|
-
children: [
|
|
2173
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2174
|
-
"div",
|
|
2175
|
-
{
|
|
2176
|
-
className: "absolute inset-x-1 inset-y-0 m-auto flex items-center justify-center pointer-events-none",
|
|
2177
|
-
style: { zIndex: 1 },
|
|
2178
|
-
children: [
|
|
2179
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2180
|
-
"div",
|
|
2181
|
-
{
|
|
2182
|
-
className: "w-full h-[40px] bg-m3-on-surface-variant/8 opacity-0 group-hover:opacity-100 transition-opacity duration-200",
|
|
2183
|
-
style: { borderRadius: PILL_BORDER_RADIUS }
|
|
2184
|
-
}
|
|
2185
|
-
),
|
|
2186
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2187
|
-
react.m.div,
|
|
2188
|
-
{
|
|
2189
|
-
layoutId: `navbar-active-indicator-${layoutIdGroup}`,
|
|
2190
|
-
className: "absolute inset-0 m-auto w-full h-[40px] bg-m3-secondary-container",
|
|
2191
|
-
style: { borderRadius: PILL_BORDER_RADIUS },
|
|
2192
|
-
transition: NAVBAR_EXPRESSIVE_SPRING
|
|
2193
|
-
}
|
|
2194
|
-
) })
|
|
2195
|
-
]
|
|
2196
|
-
}
|
|
2197
|
-
),
|
|
2198
|
-
clonedElement
|
|
2199
|
-
]
|
|
2200
|
-
},
|
|
2201
|
-
(_c = element.key) != null ? _c : index
|
|
2202
|
-
);
|
|
2203
|
-
}
|
|
2204
2302
|
return clonedElement;
|
|
2205
2303
|
})
|
|
2206
2304
|
})
|
|
@@ -2208,7 +2306,7 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2208
2306
|
}
|
|
2209
2307
|
);
|
|
2210
2308
|
ButtonGroupComponent.displayName = "ButtonGroup";
|
|
2211
|
-
var ButtonGroup =
|
|
2309
|
+
var ButtonGroup = React16__namespace.memo(ButtonGroupComponent);
|
|
2212
2310
|
var SIZE_HEIGHT = {
|
|
2213
2311
|
sm: "h-14",
|
|
2214
2312
|
md: "h-20",
|
|
@@ -2263,9 +2361,9 @@ var COLOR_CLASSES = {
|
|
|
2263
2361
|
}
|
|
2264
2362
|
};
|
|
2265
2363
|
function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
2266
|
-
const [collapsed, setCollapsed] =
|
|
2267
|
-
const lastScrollY =
|
|
2268
|
-
|
|
2364
|
+
const [collapsed, setCollapsed] = React16__namespace.useState(false);
|
|
2365
|
+
const lastScrollY = React16__namespace.useRef(0);
|
|
2366
|
+
React16__namespace.useEffect(() => {
|
|
2269
2367
|
if (!enabled || typeof window === "undefined") return;
|
|
2270
2368
|
lastScrollY.current = window.scrollY;
|
|
2271
2369
|
const handleScroll = () => {
|
|
@@ -2288,7 +2386,7 @@ function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
|
2288
2386
|
}, [enabled, scrollThreshold, collapsed, onCollapsedChange]);
|
|
2289
2387
|
return collapsed;
|
|
2290
2388
|
}
|
|
2291
|
-
var ExtendedFABComponent =
|
|
2389
|
+
var ExtendedFABComponent = React16__namespace.forwardRef(
|
|
2292
2390
|
(_a, ref) => {
|
|
2293
2391
|
var _b = _a, {
|
|
2294
2392
|
className,
|
|
@@ -2305,6 +2403,8 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2305
2403
|
scrollThreshold = 50,
|
|
2306
2404
|
collapsed,
|
|
2307
2405
|
onCollapsedChange,
|
|
2406
|
+
asChild = false,
|
|
2407
|
+
children,
|
|
2308
2408
|
onClick,
|
|
2309
2409
|
onKeyDown,
|
|
2310
2410
|
layoutId,
|
|
@@ -2324,16 +2424,18 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2324
2424
|
"scrollThreshold",
|
|
2325
2425
|
"collapsed",
|
|
2326
2426
|
"onCollapsedChange",
|
|
2427
|
+
"asChild",
|
|
2428
|
+
"children",
|
|
2327
2429
|
"onClick",
|
|
2328
2430
|
"onKeyDown",
|
|
2329
2431
|
"layoutId",
|
|
2330
2432
|
"aria-label"
|
|
2331
2433
|
]);
|
|
2332
2434
|
var _a2, _b2, _c, _d;
|
|
2333
|
-
const localRef =
|
|
2334
|
-
|
|
2335
|
-
const [dir, setDir] =
|
|
2336
|
-
|
|
2435
|
+
const localRef = React16__namespace.useRef(null);
|
|
2436
|
+
React16__namespace.useImperativeHandle(ref, () => localRef.current);
|
|
2437
|
+
const [dir, setDir] = React16__namespace.useState("ltr");
|
|
2438
|
+
React16__namespace.useEffect(() => {
|
|
2337
2439
|
var _a3;
|
|
2338
2440
|
if (!localRef.current) return;
|
|
2339
2441
|
const closestDir = (_a3 = localRef.current.closest("[dir]")) == null ? void 0 : _a3.getAttribute("dir");
|
|
@@ -2354,7 +2456,7 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2354
2456
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2355
2457
|
disabled: loading
|
|
2356
2458
|
});
|
|
2357
|
-
const handleClick =
|
|
2459
|
+
const handleClick = React16__namespace.useCallback(
|
|
2358
2460
|
(e) => {
|
|
2359
2461
|
if (loading) {
|
|
2360
2462
|
e.preventDefault();
|
|
@@ -2364,7 +2466,7 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2364
2466
|
},
|
|
2365
2467
|
[loading, onClick]
|
|
2366
2468
|
);
|
|
2367
|
-
const handleKeyDown =
|
|
2469
|
+
const handleKeyDown = React16__namespace.useCallback(
|
|
2368
2470
|
(e) => {
|
|
2369
2471
|
if (loading) return;
|
|
2370
2472
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2375,7 +2477,109 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2375
2477
|
},
|
|
2376
2478
|
[loading, onClick, onKeyDown]
|
|
2377
2479
|
);
|
|
2378
|
-
|
|
2480
|
+
const containerClassName = cn(
|
|
2481
|
+
"relative shrink-0 inline-flex items-center select-none cursor-pointer overflow-hidden",
|
|
2482
|
+
"transition-[box-shadow,filter] duration-200",
|
|
2483
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2484
|
+
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2485
|
+
colors.bg,
|
|
2486
|
+
colors.text,
|
|
2487
|
+
lowered ? "shadow-sm" : "shadow-md",
|
|
2488
|
+
(_d = SIZE_HEIGHT[size]) != null ? _d : "h-14",
|
|
2489
|
+
SIZE_TEXT[size],
|
|
2490
|
+
isCollapsed ? cn("px-0 justify-center", SIZE_WIDTH_COLLAPSED[size]) : cn(
|
|
2491
|
+
hasIcon ? "justify-start" : "justify-center",
|
|
2492
|
+
SIZE_PADDING[size],
|
|
2493
|
+
hasIcon && SIZE_GAP[size]
|
|
2494
|
+
),
|
|
2495
|
+
dir === "rtl" || restProps.dir === "rtl" ? "flex-row-reverse" : "flex-row",
|
|
2496
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2497
|
+
className
|
|
2498
|
+
);
|
|
2499
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2500
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2501
|
+
hasIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2502
|
+
react.m.span,
|
|
2503
|
+
{
|
|
2504
|
+
layout: "position",
|
|
2505
|
+
className: cn(
|
|
2506
|
+
"flex items-center justify-center shrink-0",
|
|
2507
|
+
sizeIcon.cls
|
|
2508
|
+
),
|
|
2509
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2510
|
+
react.m.span,
|
|
2511
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2512
|
+
transition: SPRING_TRANSITION,
|
|
2513
|
+
className: "flex items-center justify-center shrink-0 w-full h-full",
|
|
2514
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2515
|
+
LoadingIndicator,
|
|
2516
|
+
{
|
|
2517
|
+
size: sizeIcon.px,
|
|
2518
|
+
color: "currentColor",
|
|
2519
|
+
"aria-label": "Loading"
|
|
2520
|
+
}
|
|
2521
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2522
|
+
ProgressIndicator,
|
|
2523
|
+
{
|
|
2524
|
+
variant: "circular",
|
|
2525
|
+
size: sizeIcon.px,
|
|
2526
|
+
color: "currentColor",
|
|
2527
|
+
trackColor: "transparent",
|
|
2528
|
+
"aria-label": "Loading"
|
|
2529
|
+
}
|
|
2530
|
+
)
|
|
2531
|
+
}),
|
|
2532
|
+
"loading"
|
|
2533
|
+
) : icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2534
|
+
react.m.span,
|
|
2535
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2536
|
+
transition: SPRING_TRANSITION,
|
|
2537
|
+
"aria-hidden": "true",
|
|
2538
|
+
className: "flex items-center justify-center shrink-0 w-full h-full [&>svg]:w-full [&>svg]:h-full",
|
|
2539
|
+
children: icon
|
|
2540
|
+
}),
|
|
2541
|
+
"icon"
|
|
2542
|
+
) })
|
|
2543
|
+
}
|
|
2544
|
+
),
|
|
2545
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: !isCollapsed && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2546
|
+
react.m.span,
|
|
2547
|
+
{
|
|
2548
|
+
layout: "position",
|
|
2549
|
+
initial: { opacity: 0, width: 0 },
|
|
2550
|
+
animate: { opacity: 1, width: "auto" },
|
|
2551
|
+
exit: { opacity: 0, width: 0 },
|
|
2552
|
+
transition: {
|
|
2553
|
+
opacity: { duration: 0.15, ease: "linear" },
|
|
2554
|
+
width: SPRING_TRANSITION
|
|
2555
|
+
},
|
|
2556
|
+
className: "overflow-hidden whitespace-nowrap",
|
|
2557
|
+
children: label
|
|
2558
|
+
},
|
|
2559
|
+
"label"
|
|
2560
|
+
) })
|
|
2561
|
+
] });
|
|
2562
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: visible && !(isCollapsed && !hasIcon) && (asChild ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2563
|
+
reactSlot.Slot,
|
|
2564
|
+
__spreadProps(__spreadValues({
|
|
2565
|
+
ref: localRef,
|
|
2566
|
+
"aria-label": ariaLabel || label,
|
|
2567
|
+
"aria-busy": loading || void 0,
|
|
2568
|
+
"aria-disabled": loading || restProps.disabled,
|
|
2569
|
+
onClick: handleClick,
|
|
2570
|
+
onPointerDown,
|
|
2571
|
+
onKeyDown: handleKeyDown,
|
|
2572
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
2573
|
+
borderRadius: `${radiusConfig.default}px`
|
|
2574
|
+
}),
|
|
2575
|
+
className: containerClassName
|
|
2576
|
+
}, restProps), {
|
|
2577
|
+
children: React16__namespace.cloneElement(
|
|
2578
|
+
React16__namespace.Children.only(children),
|
|
2579
|
+
{ children: innerContent }
|
|
2580
|
+
)
|
|
2581
|
+
})
|
|
2582
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2379
2583
|
react.m.button,
|
|
2380
2584
|
__spreadProps(__spreadValues({
|
|
2381
2585
|
ref: localRef,
|
|
@@ -2407,95 +2611,15 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2407
2611
|
opacity: { duration: 0.2, ease: "linear" },
|
|
2408
2612
|
layout: SPRING_TRANSITION
|
|
2409
2613
|
},
|
|
2410
|
-
className:
|
|
2411
|
-
"relative shrink-0 inline-flex items-center select-none cursor-pointer overflow-hidden",
|
|
2412
|
-
"transition-[box-shadow,filter] duration-200",
|
|
2413
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2414
|
-
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2415
|
-
colors.bg,
|
|
2416
|
-
colors.text,
|
|
2417
|
-
lowered ? "shadow-sm" : "shadow-md",
|
|
2418
|
-
(_d = SIZE_HEIGHT[size]) != null ? _d : "h-14",
|
|
2419
|
-
SIZE_TEXT[size],
|
|
2420
|
-
isCollapsed ? cn("px-0 justify-center", SIZE_WIDTH_COLLAPSED[size]) : cn(
|
|
2421
|
-
hasIcon ? "justify-start" : "justify-center",
|
|
2422
|
-
SIZE_PADDING[size],
|
|
2423
|
-
hasIcon && SIZE_GAP[size]
|
|
2424
|
-
),
|
|
2425
|
-
dir === "rtl" || restProps.dir === "rtl" ? "flex-row-reverse" : "flex-row",
|
|
2426
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2427
|
-
className
|
|
2428
|
-
)
|
|
2614
|
+
className: containerClassName
|
|
2429
2615
|
}, restProps), {
|
|
2430
|
-
children:
|
|
2431
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2432
|
-
hasIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2433
|
-
react.m.span,
|
|
2434
|
-
{
|
|
2435
|
-
layout: "position",
|
|
2436
|
-
className: cn(
|
|
2437
|
-
"flex items-center justify-center shrink-0",
|
|
2438
|
-
sizeIcon.cls
|
|
2439
|
-
),
|
|
2440
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2441
|
-
react.m.span,
|
|
2442
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2443
|
-
transition: SPRING_TRANSITION,
|
|
2444
|
-
className: "flex items-center justify-center shrink-0 w-full h-full",
|
|
2445
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2446
|
-
LoadingIndicator,
|
|
2447
|
-
{
|
|
2448
|
-
size: sizeIcon.px,
|
|
2449
|
-
color: "currentColor",
|
|
2450
|
-
"aria-label": "Loading"
|
|
2451
|
-
}
|
|
2452
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2453
|
-
ProgressIndicator,
|
|
2454
|
-
{
|
|
2455
|
-
variant: "circular",
|
|
2456
|
-
size: sizeIcon.px,
|
|
2457
|
-
color: "currentColor",
|
|
2458
|
-
trackColor: "transparent",
|
|
2459
|
-
"aria-label": "Loading"
|
|
2460
|
-
}
|
|
2461
|
-
)
|
|
2462
|
-
}),
|
|
2463
|
-
"loading"
|
|
2464
|
-
) : icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2465
|
-
react.m.span,
|
|
2466
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2467
|
-
transition: SPRING_TRANSITION,
|
|
2468
|
-
"aria-hidden": "true",
|
|
2469
|
-
className: "flex items-center justify-center shrink-0 w-full h-full [&>svg]:w-full [&>svg]:h-full",
|
|
2470
|
-
children: icon
|
|
2471
|
-
}),
|
|
2472
|
-
"icon"
|
|
2473
|
-
) })
|
|
2474
|
-
}
|
|
2475
|
-
),
|
|
2476
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: !isCollapsed && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2477
|
-
react.m.span,
|
|
2478
|
-
{
|
|
2479
|
-
layout: "position",
|
|
2480
|
-
initial: { opacity: 0, width: 0 },
|
|
2481
|
-
animate: { opacity: 1, width: "auto" },
|
|
2482
|
-
exit: { opacity: 0, width: 0 },
|
|
2483
|
-
transition: {
|
|
2484
|
-
opacity: { duration: 0.15, ease: "linear" },
|
|
2485
|
-
width: SPRING_TRANSITION
|
|
2486
|
-
},
|
|
2487
|
-
className: "overflow-hidden whitespace-nowrap",
|
|
2488
|
-
children: label
|
|
2489
|
-
},
|
|
2490
|
-
"label"
|
|
2491
|
-
) })
|
|
2492
|
-
]
|
|
2616
|
+
children: innerContent
|
|
2493
2617
|
})
|
|
2494
|
-
) }) });
|
|
2618
|
+
)) }) });
|
|
2495
2619
|
}
|
|
2496
2620
|
);
|
|
2497
2621
|
ExtendedFABComponent.displayName = "ExtendedFAB";
|
|
2498
|
-
var ExtendedFAB =
|
|
2622
|
+
var ExtendedFAB = React16__namespace.memo(ExtendedFABComponent);
|
|
2499
2623
|
var SIZE_STYLES = {
|
|
2500
2624
|
sm: "h-10 w-10",
|
|
2501
2625
|
md: "h-14 w-14",
|
|
@@ -2566,7 +2690,7 @@ function FABPosition({
|
|
|
2566
2690
|
}
|
|
2567
2691
|
);
|
|
2568
2692
|
}
|
|
2569
|
-
var FABComponent =
|
|
2693
|
+
var FABComponent = React16__namespace.forwardRef(
|
|
2570
2694
|
(_a, ref) => {
|
|
2571
2695
|
var _b = _a, {
|
|
2572
2696
|
className,
|
|
@@ -2580,6 +2704,7 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2580
2704
|
loading = false,
|
|
2581
2705
|
loadingVariant = "loading-indicator",
|
|
2582
2706
|
visible = true,
|
|
2707
|
+
asChild = false,
|
|
2583
2708
|
onClick,
|
|
2584
2709
|
onKeyDown,
|
|
2585
2710
|
"aria-label": ariaLabel
|
|
@@ -2595,6 +2720,7 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2595
2720
|
"loading",
|
|
2596
2721
|
"loadingVariant",
|
|
2597
2722
|
"visible",
|
|
2723
|
+
"asChild",
|
|
2598
2724
|
"onClick",
|
|
2599
2725
|
"onKeyDown",
|
|
2600
2726
|
"aria-label"
|
|
@@ -2611,7 +2737,7 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2611
2737
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2612
2738
|
disabled: loading
|
|
2613
2739
|
});
|
|
2614
|
-
const handleClick =
|
|
2740
|
+
const handleClick = React16__namespace.useCallback(
|
|
2615
2741
|
(e) => {
|
|
2616
2742
|
if (loading) {
|
|
2617
2743
|
e.preventDefault();
|
|
@@ -2621,7 +2747,7 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2621
2747
|
},
|
|
2622
2748
|
[loading, onClick]
|
|
2623
2749
|
);
|
|
2624
|
-
const handleKeyDown =
|
|
2750
|
+
const handleKeyDown = React16__namespace.useCallback(
|
|
2625
2751
|
(e) => {
|
|
2626
2752
|
if (loading) return;
|
|
2627
2753
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2632,19 +2758,116 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2632
2758
|
},
|
|
2633
2759
|
[loading, onClick, onKeyDown]
|
|
2634
2760
|
);
|
|
2635
|
-
|
|
2761
|
+
const labelContent = asChild ? React16__namespace.Children.only(children).props.children : children;
|
|
2762
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2763
|
+
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
2764
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2765
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2766
|
+
react.m.span,
|
|
2767
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2768
|
+
transition: SPRING_TRANSITION,
|
|
2769
|
+
className: cn(
|
|
2770
|
+
"flex items-center justify-center shrink-0",
|
|
2771
|
+
iconClass
|
|
2772
|
+
),
|
|
2773
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2774
|
+
LoadingIndicator,
|
|
2775
|
+
{
|
|
2776
|
+
size: iconPx,
|
|
2777
|
+
color: "currentColor",
|
|
2778
|
+
"aria-label": "Loading"
|
|
2779
|
+
}
|
|
2780
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2781
|
+
ProgressIndicator,
|
|
2782
|
+
{
|
|
2783
|
+
variant: "circular",
|
|
2784
|
+
size: iconPx,
|
|
2785
|
+
color: "currentColor",
|
|
2786
|
+
trackColor: "transparent",
|
|
2787
|
+
"aria-label": "Loading"
|
|
2788
|
+
}
|
|
2789
|
+
)
|
|
2790
|
+
}),
|
|
2791
|
+
"loading"
|
|
2792
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2793
|
+
react.m.span,
|
|
2794
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2795
|
+
transition: SPRING_TRANSITION,
|
|
2796
|
+
"aria-hidden": "true",
|
|
2797
|
+
className: cn(
|
|
2798
|
+
"flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
2799
|
+
iconClass
|
|
2800
|
+
),
|
|
2801
|
+
children: icon
|
|
2802
|
+
}),
|
|
2803
|
+
"icon"
|
|
2804
|
+
) }),
|
|
2805
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: extended && labelContent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2806
|
+
react.m.span,
|
|
2807
|
+
{
|
|
2808
|
+
initial: { width: 0, opacity: 0 },
|
|
2809
|
+
animate: { width: "auto", opacity: 1 },
|
|
2810
|
+
exit: { width: 0, opacity: 0 },
|
|
2811
|
+
transition: SPRING_TRANSITION,
|
|
2812
|
+
className: "overflow-hidden whitespace-nowrap ml-3",
|
|
2813
|
+
children: labelContent
|
|
2814
|
+
},
|
|
2815
|
+
"label"
|
|
2816
|
+
) })
|
|
2817
|
+
] });
|
|
2818
|
+
const containerClassName = cn(
|
|
2819
|
+
"relative shrink-0 inline-flex items-center justify-center",
|
|
2820
|
+
"select-none cursor-pointer overflow-hidden",
|
|
2821
|
+
"transition-[box-shadow,opacity,filter] duration-200",
|
|
2822
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2823
|
+
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2824
|
+
colors.bg,
|
|
2825
|
+
colors.text,
|
|
2826
|
+
lowered ? "shadow-sm" : colors.shadow,
|
|
2827
|
+
(_d = SIZE_STYLES[size]) != null ? _d : "h-14 w-14",
|
|
2828
|
+
extended && "w-auto px-6",
|
|
2829
|
+
SIZE_TEXT_CLASS[size],
|
|
2830
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2831
|
+
className
|
|
2832
|
+
);
|
|
2833
|
+
const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
|
|
2834
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: visible && (asChild ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2835
|
+
reactSlot.Slot,
|
|
2836
|
+
__spreadProps(__spreadValues({
|
|
2837
|
+
ref,
|
|
2838
|
+
"aria-label": computedAriaLabel,
|
|
2839
|
+
"aria-busy": loading || void 0,
|
|
2840
|
+
"aria-disabled": loading || restProps.disabled,
|
|
2841
|
+
onClick: handleClick,
|
|
2842
|
+
onPointerDown,
|
|
2843
|
+
onKeyDown: handleKeyDown,
|
|
2844
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
2845
|
+
borderRadius: `${animateRadius}px`
|
|
2846
|
+
}),
|
|
2847
|
+
className: containerClassName
|
|
2848
|
+
}, restProps), {
|
|
2849
|
+
children: React16__namespace.cloneElement(
|
|
2850
|
+
React16__namespace.Children.only(children),
|
|
2851
|
+
{ children: innerContent }
|
|
2852
|
+
)
|
|
2853
|
+
})
|
|
2854
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2636
2855
|
react.m.button,
|
|
2637
2856
|
__spreadProps(__spreadValues({
|
|
2638
2857
|
ref,
|
|
2639
2858
|
type: "button",
|
|
2640
|
-
"aria-label":
|
|
2859
|
+
"aria-label": computedAriaLabel,
|
|
2641
2860
|
"aria-busy": loading || void 0,
|
|
2642
2861
|
"aria-disabled": loading || restProps.disabled,
|
|
2643
2862
|
onClick: handleClick,
|
|
2644
2863
|
onPointerDown,
|
|
2645
2864
|
onKeyDown: handleKeyDown,
|
|
2646
2865
|
style,
|
|
2647
|
-
initial: {
|
|
2866
|
+
initial: {
|
|
2867
|
+
scale: 0.5,
|
|
2868
|
+
opacity: 0,
|
|
2869
|
+
borderRadius: animateRadius
|
|
2870
|
+
},
|
|
2648
2871
|
animate: { scale: 1, opacity: 1, borderRadius: animateRadius },
|
|
2649
2872
|
exit: { scale: 0.5, opacity: 0 },
|
|
2650
2873
|
whileTap: { borderRadius: pressedRadius },
|
|
@@ -2653,84 +2876,15 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2653
2876
|
scale: SPRING_TRANSITION,
|
|
2654
2877
|
opacity: { duration: 0.25, ease: "easeOut" }
|
|
2655
2878
|
},
|
|
2656
|
-
className:
|
|
2657
|
-
"relative shrink-0 inline-flex items-center justify-center",
|
|
2658
|
-
"select-none cursor-pointer overflow-hidden",
|
|
2659
|
-
"transition-[box-shadow,opacity,filter] duration-200",
|
|
2660
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2661
|
-
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2662
|
-
colors.bg,
|
|
2663
|
-
colors.text,
|
|
2664
|
-
lowered ? "shadow-sm" : colors.shadow,
|
|
2665
|
-
(_d = SIZE_STYLES[size]) != null ? _d : "h-14 w-14",
|
|
2666
|
-
extended && "w-auto px-6",
|
|
2667
|
-
SIZE_TEXT_CLASS[size],
|
|
2668
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2669
|
-
className
|
|
2670
|
-
)
|
|
2879
|
+
className: containerClassName
|
|
2671
2880
|
}, restProps), {
|
|
2672
|
-
children:
|
|
2673
|
-
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
2674
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2675
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2676
|
-
react.m.span,
|
|
2677
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2678
|
-
transition: SPRING_TRANSITION,
|
|
2679
|
-
className: cn(
|
|
2680
|
-
"flex items-center justify-center shrink-0",
|
|
2681
|
-
iconClass
|
|
2682
|
-
),
|
|
2683
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2684
|
-
LoadingIndicator,
|
|
2685
|
-
{
|
|
2686
|
-
size: iconPx,
|
|
2687
|
-
color: "currentColor",
|
|
2688
|
-
"aria-label": "Loading"
|
|
2689
|
-
}
|
|
2690
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2691
|
-
ProgressIndicator,
|
|
2692
|
-
{
|
|
2693
|
-
variant: "circular",
|
|
2694
|
-
size: iconPx,
|
|
2695
|
-
color: "currentColor",
|
|
2696
|
-
trackColor: "transparent",
|
|
2697
|
-
"aria-label": "Loading"
|
|
2698
|
-
}
|
|
2699
|
-
)
|
|
2700
|
-
}),
|
|
2701
|
-
"loading"
|
|
2702
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2703
|
-
react.m.span,
|
|
2704
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2705
|
-
transition: SPRING_TRANSITION,
|
|
2706
|
-
"aria-hidden": "true",
|
|
2707
|
-
className: cn(
|
|
2708
|
-
"flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
2709
|
-
iconClass
|
|
2710
|
-
),
|
|
2711
|
-
children: icon
|
|
2712
|
-
}),
|
|
2713
|
-
"icon"
|
|
2714
|
-
) }),
|
|
2715
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: extended && children && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2716
|
-
react.m.span,
|
|
2717
|
-
{
|
|
2718
|
-
initial: { width: 0, opacity: 0 },
|
|
2719
|
-
animate: { width: "auto", opacity: 1 },
|
|
2720
|
-
exit: { width: 0, opacity: 0 },
|
|
2721
|
-
transition: SPRING_TRANSITION,
|
|
2722
|
-
className: "overflow-hidden whitespace-nowrap ml-3",
|
|
2723
|
-
children
|
|
2724
|
-
},
|
|
2725
|
-
"label"
|
|
2726
|
-
) })
|
|
2727
|
-
]
|
|
2881
|
+
children: innerContent
|
|
2728
2882
|
})
|
|
2729
|
-
) }) });
|
|
2883
|
+
)) }) });
|
|
2730
2884
|
}
|
|
2731
2885
|
);
|
|
2732
2886
|
FABComponent.displayName = "FAB";
|
|
2733
|
-
var FAB =
|
|
2887
|
+
var FAB = React16__namespace.memo(FABComponent);
|
|
2734
2888
|
var SPRING_NORMAL = { stiffness: 700, damping: 40 };
|
|
2735
2889
|
var SPRING_REDUCED = { stiffness: 1e4, damping: 100 };
|
|
2736
2890
|
var FOCUS_DELAY_MS = 50;
|
|
@@ -2838,7 +2992,7 @@ function CloseIcon() {
|
|
|
2838
2992
|
function defaultFabIcon(progress) {
|
|
2839
2993
|
return progress > 0.5 ? /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(AddIcon, {});
|
|
2840
2994
|
}
|
|
2841
|
-
var ToggleFABComponent =
|
|
2995
|
+
var ToggleFABComponent = React16__namespace.forwardRef(
|
|
2842
2996
|
({
|
|
2843
2997
|
expanded,
|
|
2844
2998
|
onToggle,
|
|
@@ -2856,7 +3010,7 @@ var ToggleFABComponent = React11__namespace.forwardRef(
|
|
|
2856
3010
|
const sizeTokens = (_b = TOGGLE_FAB_SIZES[fabSize]) != null ? _b : TOGGLE_FAB_SIZES.baseline;
|
|
2857
3011
|
const springConfig = prefersReduced ? SPRING_REDUCED : SPRING_NORMAL;
|
|
2858
3012
|
const checkedProgress = react.useSpring(expanded ? 1 : 0, springConfig);
|
|
2859
|
-
|
|
3013
|
+
React16__namespace.useEffect(() => {
|
|
2860
3014
|
checkedProgress.set(expanded ? 1 : 0);
|
|
2861
3015
|
}, [expanded, checkedProgress]);
|
|
2862
3016
|
const borderRadius = react.useTransform(
|
|
@@ -2864,12 +3018,12 @@ var ToggleFABComponent = React11__namespace.forwardRef(
|
|
|
2864
3018
|
[0, 1],
|
|
2865
3019
|
[`${sizeTokens.initialRadius}px`, `${sizeTokens.finalRadius}px`]
|
|
2866
3020
|
);
|
|
2867
|
-
const [iconProgress, setIconProgress] =
|
|
2868
|
-
|
|
3021
|
+
const [iconProgress, setIconProgress] = React16__namespace.useState(expanded ? 1 : 0);
|
|
3022
|
+
React16__namespace.useEffect(() => {
|
|
2869
3023
|
return checkedProgress.on("change", setIconProgress);
|
|
2870
3024
|
}, [checkedProgress]);
|
|
2871
3025
|
const { ripples, onPointerDown, removeRipple } = useRippleState();
|
|
2872
|
-
const handleClick =
|
|
3026
|
+
const handleClick = React16__namespace.useCallback(() => {
|
|
2873
3027
|
onToggle(!expanded);
|
|
2874
3028
|
}, [expanded, onToggle]);
|
|
2875
3029
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2918,7 +3072,7 @@ var ToggleFABComponent = React11__namespace.forwardRef(
|
|
|
2918
3072
|
}
|
|
2919
3073
|
);
|
|
2920
3074
|
ToggleFABComponent.displayName = "ToggleFAB";
|
|
2921
|
-
var ToggleFAB =
|
|
3075
|
+
var ToggleFAB = React16__namespace.memo(ToggleFABComponent);
|
|
2922
3076
|
function FABMenuItem({
|
|
2923
3077
|
icon,
|
|
2924
3078
|
label,
|
|
@@ -2926,12 +3080,14 @@ function FABMenuItem({
|
|
|
2926
3080
|
disabled = false,
|
|
2927
3081
|
colorVariant = "primary",
|
|
2928
3082
|
className,
|
|
2929
|
-
tabIndex = 0
|
|
3083
|
+
tabIndex = 0,
|
|
3084
|
+
asChild = false,
|
|
3085
|
+
children
|
|
2930
3086
|
}) {
|
|
2931
3087
|
var _a;
|
|
2932
3088
|
const colors = (_a = MENU_ITEM_COLORS[colorVariant]) != null ? _a : MENU_ITEM_COLORS.primary;
|
|
2933
3089
|
const { ripples, onPointerDown, removeRipple } = useRippleState({ disabled });
|
|
2934
|
-
const handleClick =
|
|
3090
|
+
const handleClick = React16__namespace.useCallback(
|
|
2935
3091
|
(e) => {
|
|
2936
3092
|
if (disabled) {
|
|
2937
3093
|
e.preventDefault();
|
|
@@ -2941,7 +3097,7 @@ function FABMenuItem({
|
|
|
2941
3097
|
},
|
|
2942
3098
|
[disabled, onClick]
|
|
2943
3099
|
);
|
|
2944
|
-
const handleKeyDown =
|
|
3100
|
+
const handleKeyDown = React16__namespace.useCallback(
|
|
2945
3101
|
(e) => {
|
|
2946
3102
|
if (disabled) return;
|
|
2947
3103
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -2951,48 +3107,68 @@ function FABMenuItem({
|
|
|
2951
3107
|
},
|
|
2952
3108
|
[disabled, onClick]
|
|
2953
3109
|
);
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
{
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
3110
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3111
|
+
/* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
3112
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3113
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3114
|
+
"span",
|
|
3115
|
+
{
|
|
3116
|
+
"aria-hidden": "true",
|
|
3117
|
+
className: "relative z-10 flex items-center justify-center size-6 shrink-0 [&>svg]:w-full [&>svg]:h-full pointer-events-none",
|
|
3118
|
+
children: icon
|
|
3119
|
+
}
|
|
3120
|
+
),
|
|
3121
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10 text-base font-medium leading-none pointer-events-none", children: label })
|
|
3122
|
+
] });
|
|
3123
|
+
const containerClassName = cn(
|
|
3124
|
+
"relative inline-flex flex-row items-center",
|
|
3125
|
+
"select-none cursor-pointer overflow-hidden",
|
|
3126
|
+
"whitespace-nowrap",
|
|
3127
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-1",
|
|
3128
|
+
MENU_ITEM_STYLES.size,
|
|
3129
|
+
MENU_ITEM_STYLES.gap,
|
|
3130
|
+
label ? MENU_ITEM_STYLES.padding : "px-4",
|
|
3131
|
+
!label && "justify-center",
|
|
3132
|
+
colors.bg,
|
|
3133
|
+
colors.text,
|
|
3134
|
+
disabled && "opacity-[0.38] pointer-events-none",
|
|
3135
|
+
className
|
|
3136
|
+
);
|
|
3137
|
+
const containerStyle = {
|
|
3138
|
+
transformOrigin: "right",
|
|
3139
|
+
borderRadius: `${MENU_ITEM_STYLES.cornerRadius}px`
|
|
3140
|
+
};
|
|
3141
|
+
if (asChild) {
|
|
3142
|
+
const child = React16__namespace.Children.only(children);
|
|
3143
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.m.div, { variants: MENU_ITEM_VARIANTS, style: containerStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3144
|
+
reactSlot.Slot,
|
|
3145
|
+
{
|
|
3146
|
+
role: "menuitem",
|
|
3147
|
+
tabIndex,
|
|
3148
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
3149
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
3150
|
+
onClick: handleClick,
|
|
3151
|
+
onPointerDown,
|
|
3152
|
+
onKeyDown: handleKeyDown,
|
|
3153
|
+
className: containerClassName,
|
|
3154
|
+
children: React16__namespace.cloneElement(child, { children: innerContent })
|
|
3155
|
+
}
|
|
3156
|
+
) });
|
|
3157
|
+
}
|
|
3158
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3159
|
+
react.m.div,
|
|
3160
|
+
{
|
|
3161
|
+
role: "menuitem",
|
|
3162
|
+
tabIndex,
|
|
3163
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
3164
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
3165
|
+
onClick: handleClick,
|
|
3166
|
+
onPointerDown,
|
|
3167
|
+
onKeyDown: handleKeyDown,
|
|
3168
|
+
variants: MENU_ITEM_VARIANTS,
|
|
3169
|
+
style: containerStyle,
|
|
3170
|
+
className: containerClassName,
|
|
3171
|
+
children: innerContent
|
|
2996
3172
|
}
|
|
2997
3173
|
);
|
|
2998
3174
|
}
|
|
@@ -3008,13 +3184,13 @@ function FABMenu({
|
|
|
3008
3184
|
focusLast = true,
|
|
3009
3185
|
"aria-label": ariaLabel
|
|
3010
3186
|
}) {
|
|
3011
|
-
const fabId =
|
|
3012
|
-
const menuId =
|
|
3013
|
-
const toggleRef =
|
|
3014
|
-
const itemRefs =
|
|
3015
|
-
const [focusedIndex, setFocusedIndex] =
|
|
3016
|
-
const reversedItems =
|
|
3017
|
-
const focusItem =
|
|
3187
|
+
const fabId = React16__namespace.useId();
|
|
3188
|
+
const menuId = React16__namespace.useId();
|
|
3189
|
+
const toggleRef = React16__namespace.useRef(null);
|
|
3190
|
+
const itemRefs = React16__namespace.useRef([]);
|
|
3191
|
+
const [focusedIndex, setFocusedIndex] = React16__namespace.useState(-1);
|
|
3192
|
+
const reversedItems = React16__namespace.useMemo(() => [...items].reverse(), [items]);
|
|
3193
|
+
const focusItem = React16__namespace.useCallback((index) => {
|
|
3018
3194
|
var _a;
|
|
3019
3195
|
const clampedIndex = Math.max(
|
|
3020
3196
|
0,
|
|
@@ -3023,8 +3199,8 @@ function FABMenu({
|
|
|
3023
3199
|
setFocusedIndex(clampedIndex);
|
|
3024
3200
|
(_a = itemRefs.current[clampedIndex]) == null ? void 0 : _a.focus();
|
|
3025
3201
|
}, []);
|
|
3026
|
-
const wasExpandedRef =
|
|
3027
|
-
|
|
3202
|
+
const wasExpandedRef = React16__namespace.useRef(false);
|
|
3203
|
+
React16__namespace.useEffect(() => {
|
|
3028
3204
|
var _a;
|
|
3029
3205
|
if (expanded) {
|
|
3030
3206
|
wasExpandedRef.current = true;
|
|
@@ -3039,7 +3215,7 @@ function FABMenu({
|
|
|
3039
3215
|
wasExpandedRef.current = false;
|
|
3040
3216
|
setFocusedIndex(-1);
|
|
3041
3217
|
}, [expanded, focusLast, items.length, focusItem]);
|
|
3042
|
-
const handleMenuKeyDown =
|
|
3218
|
+
const handleMenuKeyDown = React16__namespace.useCallback(
|
|
3043
3219
|
(e) => {
|
|
3044
3220
|
if (!expanded) return;
|
|
3045
3221
|
const lastIndex = items.length - 1;
|
|
@@ -3163,12 +3339,39 @@ function FABMenu({
|
|
|
3163
3339
|
)
|
|
3164
3340
|
] });
|
|
3165
3341
|
}
|
|
3166
|
-
var
|
|
3167
|
-
xs: "h-8
|
|
3168
|
-
sm: "h-10
|
|
3169
|
-
md: "h-14
|
|
3170
|
-
lg: "h-24
|
|
3171
|
-
xl: "h-[8.5rem]
|
|
3342
|
+
var SIZE_HEIGHT_STYLES = {
|
|
3343
|
+
xs: "h-8",
|
|
3344
|
+
sm: "h-10",
|
|
3345
|
+
md: "h-14",
|
|
3346
|
+
lg: "h-24",
|
|
3347
|
+
xl: "h-[8.5rem]"
|
|
3348
|
+
};
|
|
3349
|
+
var WIDTH_SIZE_STYLES = {
|
|
3350
|
+
xs: {
|
|
3351
|
+
default: "w-8",
|
|
3352
|
+
narrow: "w-8",
|
|
3353
|
+
wide: "w-12"
|
|
3354
|
+
},
|
|
3355
|
+
sm: {
|
|
3356
|
+
default: "w-10",
|
|
3357
|
+
narrow: "w-12",
|
|
3358
|
+
wide: "w-[3.25rem]"
|
|
3359
|
+
},
|
|
3360
|
+
md: {
|
|
3361
|
+
default: "w-14",
|
|
3362
|
+
narrow: "w-12",
|
|
3363
|
+
wide: "w-[4.5rem]"
|
|
3364
|
+
},
|
|
3365
|
+
lg: {
|
|
3366
|
+
default: "w-24",
|
|
3367
|
+
narrow: "w-16",
|
|
3368
|
+
wide: "w-32"
|
|
3369
|
+
},
|
|
3370
|
+
xl: {
|
|
3371
|
+
default: "w-[8.5rem]",
|
|
3372
|
+
narrow: "w-[6.5rem]",
|
|
3373
|
+
wide: "w-[11.5rem]"
|
|
3374
|
+
}
|
|
3172
3375
|
};
|
|
3173
3376
|
var SIZE_ICON3 = {
|
|
3174
3377
|
xs: { cls: "size-5", px: 20 },
|
|
@@ -3261,7 +3464,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
3261
3464
|
}
|
|
3262
3465
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
3263
3466
|
}
|
|
3264
|
-
var IconButtonComponent =
|
|
3467
|
+
var IconButtonComponent = React16__namespace.forwardRef(
|
|
3265
3468
|
(_a, ref) => {
|
|
3266
3469
|
var _b = _a, {
|
|
3267
3470
|
className,
|
|
@@ -3269,11 +3472,14 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3269
3472
|
variant = "default",
|
|
3270
3473
|
colorStyle = "standard",
|
|
3271
3474
|
size = "sm",
|
|
3475
|
+
widthVariant = "default",
|
|
3272
3476
|
shape = "round",
|
|
3273
3477
|
selected,
|
|
3478
|
+
selectedIcon,
|
|
3274
3479
|
loading = false,
|
|
3275
3480
|
loadingVariant = "loading-indicator",
|
|
3276
3481
|
iconSize,
|
|
3482
|
+
asChild = false,
|
|
3277
3483
|
children,
|
|
3278
3484
|
onClick,
|
|
3279
3485
|
onKeyDown,
|
|
@@ -3284,31 +3490,34 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3284
3490
|
"variant",
|
|
3285
3491
|
"colorStyle",
|
|
3286
3492
|
"size",
|
|
3493
|
+
"widthVariant",
|
|
3287
3494
|
"shape",
|
|
3288
3495
|
"selected",
|
|
3496
|
+
"selectedIcon",
|
|
3289
3497
|
"loading",
|
|
3290
3498
|
"loadingVariant",
|
|
3291
3499
|
"iconSize",
|
|
3500
|
+
"asChild",
|
|
3292
3501
|
"children",
|
|
3293
3502
|
"onClick",
|
|
3294
3503
|
"onKeyDown",
|
|
3295
3504
|
"aria-label"
|
|
3296
3505
|
]);
|
|
3297
|
-
var _a2, _b2;
|
|
3506
|
+
var _a2, _b2, _c, _d, _e;
|
|
3298
3507
|
const isToggle = variant === "toggle";
|
|
3299
3508
|
const isSelected = isToggle && !!selected;
|
|
3300
|
-
const resolvedColorClass =
|
|
3509
|
+
const resolvedColorClass = React16__namespace.useMemo(
|
|
3301
3510
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
3302
3511
|
[isSelected, colorStyle]
|
|
3303
3512
|
);
|
|
3304
|
-
const outlineWidthClass =
|
|
3513
|
+
const outlineWidthClass = React16__namespace.useMemo(
|
|
3305
3514
|
() => {
|
|
3306
3515
|
var _a3;
|
|
3307
3516
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
3308
3517
|
},
|
|
3309
3518
|
[colorStyle, isSelected, size]
|
|
3310
3519
|
);
|
|
3311
|
-
const disabledBgClass =
|
|
3520
|
+
const disabledBgClass = React16__namespace.useMemo(
|
|
3312
3521
|
() => resolveDisabledBgClass(colorStyle),
|
|
3313
3522
|
[colorStyle]
|
|
3314
3523
|
);
|
|
@@ -3325,11 +3534,13 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3325
3534
|
const defaultIconPx = sizeIcon.px;
|
|
3326
3535
|
const iconPx = iconSize != null ? iconSize : defaultIconPx;
|
|
3327
3536
|
const isCustomSize = iconSize != null && iconSize !== "inherit";
|
|
3537
|
+
const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
|
|
3538
|
+
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[widthVariant]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
|
|
3328
3539
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
3329
3540
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
3330
3541
|
disabled: loading
|
|
3331
3542
|
});
|
|
3332
|
-
const handleClick =
|
|
3543
|
+
const handleClick = React16__namespace.useCallback(
|
|
3333
3544
|
(e) => {
|
|
3334
3545
|
if (loading) {
|
|
3335
3546
|
e.preventDefault();
|
|
@@ -3339,7 +3550,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3339
3550
|
},
|
|
3340
3551
|
[loading, onClick]
|
|
3341
3552
|
);
|
|
3342
|
-
const handleKeyDown =
|
|
3553
|
+
const handleKeyDown = React16__namespace.useCallback(
|
|
3343
3554
|
(e) => {
|
|
3344
3555
|
if (loading) return;
|
|
3345
3556
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -3350,7 +3561,90 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3350
3561
|
},
|
|
3351
3562
|
[loading, onClick, onKeyDown]
|
|
3352
3563
|
);
|
|
3353
|
-
|
|
3564
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3565
|
+
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
3566
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3567
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3568
|
+
react.m.span,
|
|
3569
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3570
|
+
transition: SPRING_TRANSITION,
|
|
3571
|
+
className: cn(
|
|
3572
|
+
"flex items-center justify-center shrink-0",
|
|
3573
|
+
iconSize != null ? void 0 : iconClass
|
|
3574
|
+
),
|
|
3575
|
+
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
3576
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3577
|
+
LoadingIndicator,
|
|
3578
|
+
{
|
|
3579
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3580
|
+
color: "currentColor",
|
|
3581
|
+
"aria-label": "Loading"
|
|
3582
|
+
}
|
|
3583
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3584
|
+
ProgressIndicator,
|
|
3585
|
+
{
|
|
3586
|
+
variant: "circular",
|
|
3587
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3588
|
+
color: "currentColor",
|
|
3589
|
+
trackColor: "transparent",
|
|
3590
|
+
"aria-label": "Loading"
|
|
3591
|
+
}
|
|
3592
|
+
)
|
|
3593
|
+
}),
|
|
3594
|
+
"loading"
|
|
3595
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3596
|
+
react.m.span,
|
|
3597
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3598
|
+
transition: SPRING_TRANSITION,
|
|
3599
|
+
"aria-hidden": "true",
|
|
3600
|
+
className: cn(
|
|
3601
|
+
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]",
|
|
3602
|
+
iconSize != null ? void 0 : iconClass
|
|
3603
|
+
),
|
|
3604
|
+
style: {
|
|
3605
|
+
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
3606
|
+
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
3607
|
+
height: isCustomSize ? `${iconSize}px` : void 0
|
|
3608
|
+
},
|
|
3609
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React16__namespace.Children.only(children).props.children : children
|
|
3610
|
+
}),
|
|
3611
|
+
isSelected && selectedIcon ? "selected-content" : "content"
|
|
3612
|
+
) })
|
|
3613
|
+
] });
|
|
3614
|
+
const containerClassName = cn(
|
|
3615
|
+
baseIconButtonClasses,
|
|
3616
|
+
resolvedColorClass,
|
|
3617
|
+
outlineWidthClass,
|
|
3618
|
+
disabledBgClass,
|
|
3619
|
+
"overflow-hidden",
|
|
3620
|
+
heightClass,
|
|
3621
|
+
widthClass,
|
|
3622
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
3623
|
+
className
|
|
3624
|
+
);
|
|
3625
|
+
if (asChild) {
|
|
3626
|
+
const child = React16__namespace.Children.only(children);
|
|
3627
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3628
|
+
reactSlot.Slot,
|
|
3629
|
+
__spreadProps(__spreadValues({
|
|
3630
|
+
ref,
|
|
3631
|
+
"aria-pressed": isToggle ? isSelected : void 0,
|
|
3632
|
+
"aria-label": ariaLabel,
|
|
3633
|
+
"aria-busy": loading || void 0,
|
|
3634
|
+
"aria-disabled": loading || restProps.disabled,
|
|
3635
|
+
onClick: handleClick,
|
|
3636
|
+
onPointerDown,
|
|
3637
|
+
onKeyDown: handleKeyDown,
|
|
3638
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
3639
|
+
borderRadius: `${animateRadius}px`
|
|
3640
|
+
}),
|
|
3641
|
+
className: containerClassName
|
|
3642
|
+
}, restProps), {
|
|
3643
|
+
children: React16__namespace.cloneElement(child, { children: innerContent })
|
|
3644
|
+
})
|
|
3645
|
+
) });
|
|
3646
|
+
}
|
|
3647
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3354
3648
|
react.m.button,
|
|
3355
3649
|
__spreadProps(__spreadValues({
|
|
3356
3650
|
ref,
|
|
@@ -3366,78 +3660,20 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3366
3660
|
animate: { borderRadius: animateRadius },
|
|
3367
3661
|
whileTap: { borderRadius: pressedRadius },
|
|
3368
3662
|
transition: { borderRadius: SPRING_TRANSITION_FAST },
|
|
3369
|
-
className:
|
|
3370
|
-
baseIconButtonClasses,
|
|
3371
|
-
resolvedColorClass,
|
|
3372
|
-
outlineWidthClass,
|
|
3373
|
-
disabledBgClass,
|
|
3374
|
-
"overflow-hidden",
|
|
3375
|
-
SIZE_STYLES2[size],
|
|
3376
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
3377
|
-
className
|
|
3378
|
-
)
|
|
3663
|
+
className: containerClassName
|
|
3379
3664
|
}, restProps), {
|
|
3380
|
-
children:
|
|
3381
|
-
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
3382
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3383
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3384
|
-
react.m.span,
|
|
3385
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3386
|
-
transition: SPRING_TRANSITION,
|
|
3387
|
-
className: cn(
|
|
3388
|
-
"flex items-center justify-center shrink-0",
|
|
3389
|
-
iconSize != null ? void 0 : iconClass
|
|
3390
|
-
),
|
|
3391
|
-
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
3392
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3393
|
-
LoadingIndicator,
|
|
3394
|
-
{
|
|
3395
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3396
|
-
color: "currentColor",
|
|
3397
|
-
"aria-label": "Loading"
|
|
3398
|
-
}
|
|
3399
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3400
|
-
ProgressIndicator,
|
|
3401
|
-
{
|
|
3402
|
-
variant: "circular",
|
|
3403
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3404
|
-
color: "currentColor",
|
|
3405
|
-
trackColor: "transparent",
|
|
3406
|
-
"aria-label": "Loading"
|
|
3407
|
-
}
|
|
3408
|
-
)
|
|
3409
|
-
}),
|
|
3410
|
-
"loading"
|
|
3411
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3412
|
-
react.m.span,
|
|
3413
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3414
|
-
transition: SPRING_TRANSITION,
|
|
3415
|
-
"aria-hidden": "true",
|
|
3416
|
-
className: cn(
|
|
3417
|
-
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
3418
|
-
iconSize != null ? void 0 : iconClass
|
|
3419
|
-
),
|
|
3420
|
-
style: {
|
|
3421
|
-
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
3422
|
-
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
3423
|
-
height: isCustomSize ? `${iconSize}px` : void 0
|
|
3424
|
-
},
|
|
3425
|
-
children
|
|
3426
|
-
}),
|
|
3427
|
-
"content"
|
|
3428
|
-
) })
|
|
3429
|
-
]
|
|
3665
|
+
children: innerContent
|
|
3430
3666
|
})
|
|
3431
3667
|
) });
|
|
3432
3668
|
}
|
|
3433
3669
|
);
|
|
3434
3670
|
IconButtonComponent.displayName = "IconButton";
|
|
3435
|
-
var IconButton =
|
|
3436
|
-
var SplitButtonContext =
|
|
3671
|
+
var IconButton = React16__namespace.memo(IconButtonComponent);
|
|
3672
|
+
var SplitButtonContext = React16__namespace.createContext(null);
|
|
3437
3673
|
function useSplitButtonContext() {
|
|
3438
|
-
return
|
|
3674
|
+
return React16__namespace.useContext(SplitButtonContext);
|
|
3439
3675
|
}
|
|
3440
|
-
var SplitButtonLayoutComponent =
|
|
3676
|
+
var SplitButtonLayoutComponent = React16__namespace.forwardRef(
|
|
3441
3677
|
(_a, ref) => {
|
|
3442
3678
|
var _b = _a, {
|
|
3443
3679
|
leadingButton,
|
|
@@ -3454,10 +3690,10 @@ var SplitButtonLayoutComponent = React11__namespace.forwardRef(
|
|
|
3454
3690
|
"variant",
|
|
3455
3691
|
"size"
|
|
3456
3692
|
]);
|
|
3457
|
-
const leadingProps =
|
|
3693
|
+
const leadingProps = React16__namespace.isValidElement(leadingButton) ? leadingButton.props : {};
|
|
3458
3694
|
const size = layoutSize || leadingProps.size;
|
|
3459
3695
|
const variant = layoutVariant || leadingProps.variant;
|
|
3460
|
-
const contextValue =
|
|
3696
|
+
const contextValue = React16__namespace.useMemo(
|
|
3461
3697
|
() => ({
|
|
3462
3698
|
size,
|
|
3463
3699
|
variant
|
|
@@ -3483,8 +3719,8 @@ var SplitButtonLayoutComponent = React11__namespace.forwardRef(
|
|
|
3483
3719
|
}
|
|
3484
3720
|
);
|
|
3485
3721
|
SplitButtonLayoutComponent.displayName = "SplitButtonLayout";
|
|
3486
|
-
var SplitButtonLayout =
|
|
3487
|
-
var StateLayer =
|
|
3722
|
+
var SplitButtonLayout = React16__namespace.memo(SplitButtonLayoutComponent);
|
|
3723
|
+
var StateLayer = React16__namespace.forwardRef(
|
|
3488
3724
|
(_a, ref) => {
|
|
3489
3725
|
var _b = _a, { className, hovered, focused, pressed } = _b, props = __objRest(_b, ["className", "hovered", "focused", "pressed"]);
|
|
3490
3726
|
let opacity = 0;
|
|
@@ -3736,7 +3972,7 @@ var splitButtonVariants = classVarianceAuthority.cva(
|
|
|
3736
3972
|
}
|
|
3737
3973
|
}
|
|
3738
3974
|
);
|
|
3739
|
-
var SplitButtonLeadingComponent =
|
|
3975
|
+
var SplitButtonLeadingComponent = React16__namespace.forwardRef(
|
|
3740
3976
|
(_a, ref) => {
|
|
3741
3977
|
var _b = _a, {
|
|
3742
3978
|
className,
|
|
@@ -3746,6 +3982,7 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3746
3982
|
icon,
|
|
3747
3983
|
children,
|
|
3748
3984
|
disabled,
|
|
3985
|
+
asChild = false,
|
|
3749
3986
|
onClick,
|
|
3750
3987
|
onPointerDown,
|
|
3751
3988
|
onPointerUp,
|
|
@@ -3761,6 +3998,7 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3761
3998
|
"icon",
|
|
3762
3999
|
"children",
|
|
3763
4000
|
"disabled",
|
|
4001
|
+
"asChild",
|
|
3764
4002
|
"onClick",
|
|
3765
4003
|
"onPointerDown",
|
|
3766
4004
|
"onPointerUp",
|
|
@@ -3773,9 +4011,9 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3773
4011
|
const context = useSplitButtonContext();
|
|
3774
4012
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
3775
4013
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
3776
|
-
const [isHovered, setIsHovered] =
|
|
3777
|
-
const [isFocused, setIsFocused] =
|
|
3778
|
-
const [isPressed, setIsPressed] =
|
|
4014
|
+
const [isHovered, setIsHovered] = React16__namespace.useState(false);
|
|
4015
|
+
const [isFocused, setIsFocused] = React16__namespace.useState(false);
|
|
4016
|
+
const [isPressed, setIsPressed] = React16__namespace.useState(false);
|
|
3779
4017
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
3780
4018
|
const typographyClass = (_c = BUTTON_TYPOGRAPHY_TOKENS[actualSize]) != null ? _c : BUTTON_TYPOGRAPHY_TOKENS.sm;
|
|
3781
4019
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -3787,7 +4025,7 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3787
4025
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
3788
4026
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
3789
4027
|
const borderRadius = `${outerRadius}px ${innerCornerRadius}px ${innerCornerRadius}px ${outerRadius}px`;
|
|
3790
|
-
const handleClick =
|
|
4028
|
+
const handleClick = React16__namespace.useCallback(
|
|
3791
4029
|
(e) => {
|
|
3792
4030
|
if (disabled) {
|
|
3793
4031
|
e.preventDefault();
|
|
@@ -3797,7 +4035,7 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3797
4035
|
},
|
|
3798
4036
|
[disabled, onClick]
|
|
3799
4037
|
);
|
|
3800
|
-
const handlePointerDown =
|
|
4038
|
+
const handlePointerDown = React16__namespace.useCallback(
|
|
3801
4039
|
(e) => {
|
|
3802
4040
|
onRipplePointerDown(e);
|
|
3803
4041
|
setIsPressed(true);
|
|
@@ -3805,19 +4043,19 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3805
4043
|
},
|
|
3806
4044
|
[onRipplePointerDown, onPointerDown]
|
|
3807
4045
|
);
|
|
3808
|
-
const handlePointerUp =
|
|
4046
|
+
const handlePointerUp = React16__namespace.useCallback(
|
|
3809
4047
|
(e) => {
|
|
3810
4048
|
setIsPressed(false);
|
|
3811
4049
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
3812
4050
|
},
|
|
3813
4051
|
[onPointerUp]
|
|
3814
4052
|
);
|
|
3815
|
-
const handlePointerEnter =
|
|
4053
|
+
const handlePointerEnter = React16__namespace.useCallback(() => {
|
|
3816
4054
|
if (!disabled) {
|
|
3817
4055
|
setIsHovered(true);
|
|
3818
4056
|
}
|
|
3819
4057
|
}, [disabled]);
|
|
3820
|
-
const handlePointerLeave =
|
|
4058
|
+
const handlePointerLeave = React16__namespace.useCallback(
|
|
3821
4059
|
(e) => {
|
|
3822
4060
|
setIsHovered(false);
|
|
3823
4061
|
setIsPressed(false);
|
|
@@ -3825,21 +4063,21 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3825
4063
|
},
|
|
3826
4064
|
[onPointerLeave]
|
|
3827
4065
|
);
|
|
3828
|
-
const handlePointerCancel =
|
|
4066
|
+
const handlePointerCancel = React16__namespace.useCallback(
|
|
3829
4067
|
(e) => {
|
|
3830
4068
|
setIsPressed(false);
|
|
3831
4069
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
3832
4070
|
},
|
|
3833
4071
|
[onPointerCancel]
|
|
3834
4072
|
);
|
|
3835
|
-
const handleFocus =
|
|
4073
|
+
const handleFocus = React16__namespace.useCallback(
|
|
3836
4074
|
(e) => {
|
|
3837
4075
|
if (!disabled) setIsFocused(true);
|
|
3838
4076
|
onFocus == null ? void 0 : onFocus(e);
|
|
3839
4077
|
},
|
|
3840
4078
|
[disabled, onFocus]
|
|
3841
4079
|
);
|
|
3842
|
-
const handleBlur =
|
|
4080
|
+
const handleBlur = React16__namespace.useCallback(
|
|
3843
4081
|
(e) => {
|
|
3844
4082
|
setIsFocused(false);
|
|
3845
4083
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -3847,12 +4085,73 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3847
4085
|
[onBlur]
|
|
3848
4086
|
);
|
|
3849
4087
|
const leadingIconSize = LEADING_ICON_SIZE_FOR_SIZE[actualSize];
|
|
3850
|
-
|
|
4088
|
+
const labelContent = asChild ? React16__namespace.Children.only(children).props.children : children;
|
|
4089
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4090
|
+
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
4091
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4092
|
+
StateLayer,
|
|
4093
|
+
{
|
|
4094
|
+
hovered: isHovered,
|
|
4095
|
+
focused: isFocused,
|
|
4096
|
+
pressed: isPressed
|
|
4097
|
+
}
|
|
4098
|
+
),
|
|
4099
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
4100
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4101
|
+
"span",
|
|
4102
|
+
{
|
|
4103
|
+
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full overflow-hidden [&_.md-icon]:text-[length:inherit]!",
|
|
4104
|
+
style: {
|
|
4105
|
+
fontSize: leadingIconSize,
|
|
4106
|
+
width: leadingIconSize,
|
|
4107
|
+
height: leadingIconSize
|
|
4108
|
+
},
|
|
4109
|
+
children: icon
|
|
4110
|
+
}
|
|
4111
|
+
),
|
|
4112
|
+
labelContent && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center h-full gap-[inherit]", children: labelContent })
|
|
4113
|
+
] });
|
|
4114
|
+
const containerClassName = cn(
|
|
4115
|
+
splitButtonVariants({
|
|
4116
|
+
variant: actualVariant,
|
|
4117
|
+
size: actualSize,
|
|
4118
|
+
disabled
|
|
4119
|
+
}),
|
|
4120
|
+
typographyClass,
|
|
4121
|
+
className
|
|
4122
|
+
);
|
|
4123
|
+
const mergedStyle = __spreadValues({
|
|
4124
|
+
paddingInlineStart: tokens.leadingPadding.start,
|
|
4125
|
+
paddingInlineEnd: tokens.leadingPadding.end,
|
|
4126
|
+
gap: "8px",
|
|
4127
|
+
borderRadius
|
|
4128
|
+
}, style);
|
|
4129
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: asChild ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4130
|
+
reactSlot.Slot,
|
|
4131
|
+
__spreadProps(__spreadValues({
|
|
4132
|
+
ref,
|
|
4133
|
+
"aria-disabled": disabled || void 0,
|
|
4134
|
+
onClick: handleClick,
|
|
4135
|
+
onPointerDown: handlePointerDown,
|
|
4136
|
+
onPointerUp: handlePointerUp,
|
|
4137
|
+
onPointerEnter: handlePointerEnter,
|
|
4138
|
+
onPointerLeave: handlePointerLeave,
|
|
4139
|
+
onPointerCancel: handlePointerCancel,
|
|
4140
|
+
onFocus: handleFocus,
|
|
4141
|
+
onBlur: handleBlur,
|
|
4142
|
+
style: mergedStyle,
|
|
4143
|
+
className: containerClassName
|
|
4144
|
+
}, restProps), {
|
|
4145
|
+
children: React16__namespace.cloneElement(
|
|
4146
|
+
React16__namespace.Children.only(children),
|
|
4147
|
+
{ children: innerContent }
|
|
4148
|
+
)
|
|
4149
|
+
})
|
|
4150
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3851
4151
|
react.m.button,
|
|
3852
4152
|
__spreadProps(__spreadValues({
|
|
3853
4153
|
ref,
|
|
3854
4154
|
type: "button",
|
|
3855
|
-
"aria-disabled": disabled,
|
|
3856
4155
|
disabled,
|
|
3857
4156
|
onClick: handleClick,
|
|
3858
4157
|
onPointerDown: handlePointerDown,
|
|
@@ -3869,56 +4168,24 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3869
4168
|
paddingInlineEnd: tokens.leadingPadding.end,
|
|
3870
4169
|
gap: "8px"
|
|
3871
4170
|
}, style),
|
|
3872
|
-
className:
|
|
3873
|
-
splitButtonVariants({
|
|
3874
|
-
variant: actualVariant,
|
|
3875
|
-
size: actualSize,
|
|
3876
|
-
disabled
|
|
3877
|
-
}),
|
|
3878
|
-
typographyClass,
|
|
3879
|
-
className
|
|
3880
|
-
)
|
|
4171
|
+
className: containerClassName
|
|
3881
4172
|
}, restProps), {
|
|
3882
|
-
children:
|
|
3883
|
-
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
3884
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3885
|
-
StateLayer,
|
|
3886
|
-
{
|
|
3887
|
-
hovered: isHovered,
|
|
3888
|
-
focused: isFocused,
|
|
3889
|
-
pressed: isPressed
|
|
3890
|
-
}
|
|
3891
|
-
),
|
|
3892
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3893
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3894
|
-
"span",
|
|
3895
|
-
{
|
|
3896
|
-
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full overflow-hidden [&_.md-icon]:text-[length:inherit]!",
|
|
3897
|
-
style: {
|
|
3898
|
-
fontSize: leadingIconSize,
|
|
3899
|
-
width: leadingIconSize,
|
|
3900
|
-
height: leadingIconSize
|
|
3901
|
-
},
|
|
3902
|
-
children: icon
|
|
3903
|
-
}
|
|
3904
|
-
),
|
|
3905
|
-
children && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center h-full gap-[inherit]", children })
|
|
3906
|
-
]
|
|
4173
|
+
children: innerContent
|
|
3907
4174
|
})
|
|
3908
4175
|
) });
|
|
3909
4176
|
}
|
|
3910
4177
|
);
|
|
3911
4178
|
SplitButtonLeadingComponent.displayName = "SplitButtonLeading";
|
|
3912
|
-
var SplitButtonLeading =
|
|
3913
|
-
var FilledSplitButtonLeading =
|
|
4179
|
+
var SplitButtonLeading = React16__namespace.memo(SplitButtonLeadingComponent);
|
|
4180
|
+
var FilledSplitButtonLeading = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "filled" }, props)));
|
|
3914
4181
|
FilledSplitButtonLeading.displayName = "FilledSplitButtonLeading";
|
|
3915
|
-
var TonalSplitButtonLeading =
|
|
4182
|
+
var TonalSplitButtonLeading = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
3916
4183
|
TonalSplitButtonLeading.displayName = "TonalSplitButtonLeading";
|
|
3917
|
-
var ElevatedSplitButtonLeading =
|
|
4184
|
+
var ElevatedSplitButtonLeading = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
3918
4185
|
ElevatedSplitButtonLeading.displayName = "ElevatedSplitButtonLeading";
|
|
3919
|
-
var OutlinedSplitButtonLeading =
|
|
4186
|
+
var OutlinedSplitButtonLeading = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
3920
4187
|
OutlinedSplitButtonLeading.displayName = "OutlinedSplitButtonLeading";
|
|
3921
|
-
var SplitButtonTrailingComponent =
|
|
4188
|
+
var SplitButtonTrailingComponent = React16__namespace.forwardRef(
|
|
3922
4189
|
(_a, ref) => {
|
|
3923
4190
|
var _b = _a, {
|
|
3924
4191
|
className,
|
|
@@ -3935,6 +4202,8 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
3935
4202
|
onPointerCancel,
|
|
3936
4203
|
onFocus,
|
|
3937
4204
|
onBlur,
|
|
4205
|
+
asChild = false,
|
|
4206
|
+
children,
|
|
3938
4207
|
"aria-label": ariaLabel
|
|
3939
4208
|
} = _b, restProps = __objRest(_b, [
|
|
3940
4209
|
"className",
|
|
@@ -3951,15 +4220,17 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
3951
4220
|
"onPointerCancel",
|
|
3952
4221
|
"onFocus",
|
|
3953
4222
|
"onBlur",
|
|
4223
|
+
"asChild",
|
|
4224
|
+
"children",
|
|
3954
4225
|
"aria-label"
|
|
3955
4226
|
]);
|
|
3956
4227
|
var _a2, _b2;
|
|
3957
4228
|
const context = useSplitButtonContext();
|
|
3958
4229
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
3959
4230
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
3960
|
-
const [isHovered, setIsHovered] =
|
|
3961
|
-
const [isFocused, setIsFocused] =
|
|
3962
|
-
const [isPressed, setIsPressed] =
|
|
4231
|
+
const [isHovered, setIsHovered] = React16__namespace.useState(false);
|
|
4232
|
+
const [isFocused, setIsFocused] = React16__namespace.useState(false);
|
|
4233
|
+
const [isPressed, setIsPressed] = React16__namespace.useState(false);
|
|
3963
4234
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
3964
4235
|
const prefersReducedMotion = react.useReducedMotion();
|
|
3965
4236
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -3971,12 +4242,12 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
3971
4242
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
3972
4243
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
3973
4244
|
const borderRadius = checked ? `${outerRadius}px ${outerRadius}px ${outerRadius}px ${outerRadius}px` : `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
3974
|
-
const handleToggle =
|
|
4245
|
+
const handleToggle = React16__namespace.useCallback(() => {
|
|
3975
4246
|
if (!disabled) {
|
|
3976
4247
|
onCheckedChange(!checked);
|
|
3977
4248
|
}
|
|
3978
4249
|
}, [disabled, checked, onCheckedChange]);
|
|
3979
|
-
const handlePointerDown =
|
|
4250
|
+
const handlePointerDown = React16__namespace.useCallback(
|
|
3980
4251
|
(e) => {
|
|
3981
4252
|
onRipplePointerDown(e);
|
|
3982
4253
|
setIsPressed(true);
|
|
@@ -3984,19 +4255,19 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
3984
4255
|
},
|
|
3985
4256
|
[onRipplePointerDown, onPointerDown]
|
|
3986
4257
|
);
|
|
3987
|
-
const handlePointerUp =
|
|
4258
|
+
const handlePointerUp = React16__namespace.useCallback(
|
|
3988
4259
|
(e) => {
|
|
3989
4260
|
setIsPressed(false);
|
|
3990
4261
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
3991
4262
|
},
|
|
3992
4263
|
[onPointerUp]
|
|
3993
4264
|
);
|
|
3994
|
-
const handlePointerEnter =
|
|
4265
|
+
const handlePointerEnter = React16__namespace.useCallback(() => {
|
|
3995
4266
|
if (!disabled) {
|
|
3996
4267
|
setIsHovered(true);
|
|
3997
4268
|
}
|
|
3998
4269
|
}, [disabled]);
|
|
3999
|
-
const handlePointerLeave =
|
|
4270
|
+
const handlePointerLeave = React16__namespace.useCallback(
|
|
4000
4271
|
(e) => {
|
|
4001
4272
|
setIsHovered(false);
|
|
4002
4273
|
setIsPressed(false);
|
|
@@ -4004,35 +4275,102 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
4004
4275
|
},
|
|
4005
4276
|
[onPointerLeave]
|
|
4006
4277
|
);
|
|
4007
|
-
const handlePointerCancel =
|
|
4278
|
+
const handlePointerCancel = React16__namespace.useCallback(
|
|
4008
4279
|
(e) => {
|
|
4009
4280
|
setIsPressed(false);
|
|
4010
4281
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
4011
4282
|
},
|
|
4012
4283
|
[onPointerCancel]
|
|
4013
4284
|
);
|
|
4014
|
-
const handleFocus =
|
|
4285
|
+
const handleFocus = React16__namespace.useCallback(
|
|
4015
4286
|
(e) => {
|
|
4016
4287
|
if (!disabled) setIsFocused(true);
|
|
4017
4288
|
onFocus == null ? void 0 : onFocus(e);
|
|
4018
4289
|
},
|
|
4019
4290
|
[disabled, onFocus]
|
|
4020
4291
|
);
|
|
4021
|
-
const handleBlur =
|
|
4292
|
+
const handleBlur = React16__namespace.useCallback(
|
|
4022
4293
|
(e) => {
|
|
4023
4294
|
setIsFocused(false);
|
|
4024
4295
|
onBlur == null ? void 0 : onBlur(e);
|
|
4025
4296
|
},
|
|
4026
4297
|
[onBlur]
|
|
4027
4298
|
);
|
|
4028
|
-
|
|
4299
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4300
|
+
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
4301
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4302
|
+
StateLayer,
|
|
4303
|
+
{
|
|
4304
|
+
hovered: isHovered,
|
|
4305
|
+
focused: isFocused,
|
|
4306
|
+
pressed: isPressed
|
|
4307
|
+
}
|
|
4308
|
+
),
|
|
4309
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
4310
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4311
|
+
react.m.div,
|
|
4312
|
+
{
|
|
4313
|
+
animate: {
|
|
4314
|
+
rotate: checked ? 180 : 0,
|
|
4315
|
+
x: checked ? 0 : tokens.opticalCenterOffset
|
|
4316
|
+
},
|
|
4317
|
+
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_CHEVRON_SPRING,
|
|
4318
|
+
className: "flex items-center justify-center shrink-0",
|
|
4319
|
+
children: icon != null ? icon : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4320
|
+
Icon,
|
|
4321
|
+
{
|
|
4322
|
+
name: "arrow_drop_down",
|
|
4323
|
+
size: tokens.trailingIconSize,
|
|
4324
|
+
opticalSize: 24
|
|
4325
|
+
}
|
|
4326
|
+
)
|
|
4327
|
+
}
|
|
4328
|
+
)
|
|
4329
|
+
] });
|
|
4330
|
+
const containerClassName = cn(
|
|
4331
|
+
splitButtonVariants({
|
|
4332
|
+
variant: actualVariant,
|
|
4333
|
+
size: actualSize,
|
|
4334
|
+
disabled
|
|
4335
|
+
}),
|
|
4336
|
+
className
|
|
4337
|
+
);
|
|
4338
|
+
const mergedStyle = __spreadValues({
|
|
4339
|
+
paddingInlineStart: tokens.trailingPadding.start,
|
|
4340
|
+
paddingInlineEnd: tokens.trailingPadding.end,
|
|
4341
|
+
borderRadius
|
|
4342
|
+
}, style);
|
|
4343
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: asChild ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4344
|
+
reactSlot.Slot,
|
|
4345
|
+
__spreadProps(__spreadValues({
|
|
4346
|
+
ref,
|
|
4347
|
+
"aria-label": ariaLabel,
|
|
4348
|
+
"aria-expanded": checked,
|
|
4349
|
+
"aria-disabled": disabled,
|
|
4350
|
+
onClick: handleToggle,
|
|
4351
|
+
onPointerDown: handlePointerDown,
|
|
4352
|
+
onPointerUp: handlePointerUp,
|
|
4353
|
+
onPointerEnter: handlePointerEnter,
|
|
4354
|
+
onPointerLeave: handlePointerLeave,
|
|
4355
|
+
onPointerCancel: handlePointerCancel,
|
|
4356
|
+
onFocus: handleFocus,
|
|
4357
|
+
onBlur: handleBlur,
|
|
4358
|
+
style: mergedStyle,
|
|
4359
|
+
className: containerClassName
|
|
4360
|
+
}, restProps), {
|
|
4361
|
+
children: React16__namespace.cloneElement(
|
|
4362
|
+
React16__namespace.Children.only(children),
|
|
4363
|
+
{ children: innerContent }
|
|
4364
|
+
)
|
|
4365
|
+
})
|
|
4366
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4029
4367
|
react.m.button,
|
|
4030
4368
|
__spreadProps(__spreadValues({
|
|
4031
4369
|
ref,
|
|
4032
4370
|
type: "button",
|
|
4033
|
-
"aria-pressed": checked,
|
|
4034
|
-
"aria-expanded": checked,
|
|
4035
4371
|
"aria-label": ariaLabel,
|
|
4372
|
+
"aria-expanded": checked,
|
|
4373
|
+
"aria-disabled": disabled,
|
|
4036
4374
|
disabled,
|
|
4037
4375
|
onClick: handleToggle,
|
|
4038
4376
|
onPointerDown: handlePointerDown,
|
|
@@ -4048,61 +4386,24 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
4048
4386
|
paddingInlineStart: tokens.trailingPadding.start,
|
|
4049
4387
|
paddingInlineEnd: tokens.trailingPadding.end
|
|
4050
4388
|
}, style),
|
|
4051
|
-
className:
|
|
4052
|
-
splitButtonVariants({
|
|
4053
|
-
variant: actualVariant,
|
|
4054
|
-
size: actualSize,
|
|
4055
|
-
disabled
|
|
4056
|
-
}),
|
|
4057
|
-
className
|
|
4058
|
-
)
|
|
4389
|
+
className: containerClassName
|
|
4059
4390
|
}, restProps), {
|
|
4060
|
-
children:
|
|
4061
|
-
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
4062
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4063
|
-
StateLayer,
|
|
4064
|
-
{
|
|
4065
|
-
hovered: isHovered,
|
|
4066
|
-
focused: isFocused,
|
|
4067
|
-
pressed: isPressed
|
|
4068
|
-
}
|
|
4069
|
-
),
|
|
4070
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
4071
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4072
|
-
react.m.div,
|
|
4073
|
-
{
|
|
4074
|
-
animate: {
|
|
4075
|
-
rotate: checked ? 180 : 0,
|
|
4076
|
-
x: checked ? 0 : tokens.opticalCenterOffset
|
|
4077
|
-
},
|
|
4078
|
-
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_CHEVRON_SPRING,
|
|
4079
|
-
className: "flex items-center justify-center shrink-0",
|
|
4080
|
-
children: icon != null ? icon : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4081
|
-
Icon,
|
|
4082
|
-
{
|
|
4083
|
-
name: "arrow_drop_down",
|
|
4084
|
-
size: tokens.trailingIconSize,
|
|
4085
|
-
opticalSize: 24
|
|
4086
|
-
}
|
|
4087
|
-
)
|
|
4088
|
-
}
|
|
4089
|
-
)
|
|
4090
|
-
]
|
|
4391
|
+
children: innerContent
|
|
4091
4392
|
})
|
|
4092
4393
|
) });
|
|
4093
4394
|
}
|
|
4094
4395
|
);
|
|
4095
4396
|
SplitButtonTrailingComponent.displayName = "SplitButtonTrailing";
|
|
4096
|
-
var SplitButtonTrailing =
|
|
4097
|
-
var FilledSplitButtonTrailing =
|
|
4397
|
+
var SplitButtonTrailing = React16__namespace.memo(SplitButtonTrailingComponent);
|
|
4398
|
+
var FilledSplitButtonTrailing = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "filled" }, props)));
|
|
4098
4399
|
FilledSplitButtonTrailing.displayName = "FilledSplitButtonTrailing";
|
|
4099
|
-
var TonalSplitButtonTrailing =
|
|
4400
|
+
var TonalSplitButtonTrailing = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4100
4401
|
TonalSplitButtonTrailing.displayName = "TonalSplitButtonTrailing";
|
|
4101
|
-
var ElevatedSplitButtonTrailing =
|
|
4402
|
+
var ElevatedSplitButtonTrailing = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4102
4403
|
ElevatedSplitButtonTrailing.displayName = "ElevatedSplitButtonTrailing";
|
|
4103
|
-
var OutlinedSplitButtonTrailing =
|
|
4404
|
+
var OutlinedSplitButtonTrailing = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4104
4405
|
OutlinedSplitButtonTrailing.displayName = "OutlinedSplitButtonTrailing";
|
|
4105
|
-
var SplitButtonTrailingUncheckableComponent =
|
|
4406
|
+
var SplitButtonTrailingUncheckableComponent = React16__namespace.forwardRef(
|
|
4106
4407
|
(_a, ref) => {
|
|
4107
4408
|
var _b = _a, {
|
|
4108
4409
|
className,
|
|
@@ -4139,9 +4440,9 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4139
4440
|
const context = useSplitButtonContext();
|
|
4140
4441
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
4141
4442
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
4142
|
-
const [isHovered, setIsHovered] =
|
|
4143
|
-
const [isFocused, setIsFocused] =
|
|
4144
|
-
const [isPressed, setIsPressed] =
|
|
4443
|
+
const [isHovered, setIsHovered] = React16__namespace.useState(false);
|
|
4444
|
+
const [isFocused, setIsFocused] = React16__namespace.useState(false);
|
|
4445
|
+
const [isPressed, setIsPressed] = React16__namespace.useState(false);
|
|
4145
4446
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
4146
4447
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
4147
4448
|
const {
|
|
@@ -4152,7 +4453,7 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4152
4453
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
4153
4454
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
4154
4455
|
const borderRadius = `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
4155
|
-
const handlePointerDown =
|
|
4456
|
+
const handlePointerDown = React16__namespace.useCallback(
|
|
4156
4457
|
(e) => {
|
|
4157
4458
|
onRipplePointerDown(e);
|
|
4158
4459
|
setIsPressed(true);
|
|
@@ -4160,19 +4461,19 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4160
4461
|
},
|
|
4161
4462
|
[onRipplePointerDown, onPointerDown]
|
|
4162
4463
|
);
|
|
4163
|
-
const handlePointerUp =
|
|
4464
|
+
const handlePointerUp = React16__namespace.useCallback(
|
|
4164
4465
|
(e) => {
|
|
4165
4466
|
setIsPressed(false);
|
|
4166
4467
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
4167
4468
|
},
|
|
4168
4469
|
[onPointerUp]
|
|
4169
4470
|
);
|
|
4170
|
-
const handlePointerEnter =
|
|
4471
|
+
const handlePointerEnter = React16__namespace.useCallback(() => {
|
|
4171
4472
|
if (!disabled) {
|
|
4172
4473
|
setIsHovered(true);
|
|
4173
4474
|
}
|
|
4174
4475
|
}, [disabled]);
|
|
4175
|
-
const handlePointerLeave =
|
|
4476
|
+
const handlePointerLeave = React16__namespace.useCallback(
|
|
4176
4477
|
(e) => {
|
|
4177
4478
|
setIsHovered(false);
|
|
4178
4479
|
setIsPressed(false);
|
|
@@ -4180,21 +4481,21 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4180
4481
|
},
|
|
4181
4482
|
[onPointerLeave]
|
|
4182
4483
|
);
|
|
4183
|
-
const handlePointerCancel =
|
|
4484
|
+
const handlePointerCancel = React16__namespace.useCallback(
|
|
4184
4485
|
(e) => {
|
|
4185
4486
|
setIsPressed(false);
|
|
4186
4487
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
4187
4488
|
},
|
|
4188
4489
|
[onPointerCancel]
|
|
4189
4490
|
);
|
|
4190
|
-
const handleFocus =
|
|
4491
|
+
const handleFocus = React16__namespace.useCallback(
|
|
4191
4492
|
(e) => {
|
|
4192
4493
|
if (!disabled) setIsFocused(true);
|
|
4193
4494
|
onFocus == null ? void 0 : onFocus(e);
|
|
4194
4495
|
},
|
|
4195
4496
|
[disabled, onFocus]
|
|
4196
4497
|
);
|
|
4197
|
-
const handleBlur =
|
|
4498
|
+
const handleBlur = React16__namespace.useCallback(
|
|
4198
4499
|
(e) => {
|
|
4199
4500
|
setIsFocused(false);
|
|
4200
4501
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -4261,24 +4562,32 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4261
4562
|
}
|
|
4262
4563
|
);
|
|
4263
4564
|
SplitButtonTrailingUncheckableComponent.displayName = "SplitButtonTrailingUncheckable";
|
|
4264
|
-
var SplitButtonTrailingUncheckable =
|
|
4565
|
+
var SplitButtonTrailingUncheckable = React16__namespace.memo(
|
|
4265
4566
|
SplitButtonTrailingUncheckableComponent
|
|
4266
4567
|
);
|
|
4267
|
-
var FilledSplitButtonTrailingUncheckable =
|
|
4568
|
+
var FilledSplitButtonTrailingUncheckable = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "filled" }, props)));
|
|
4268
4569
|
FilledSplitButtonTrailingUncheckable.displayName = "FilledSplitButtonTrailingUncheckable";
|
|
4269
|
-
var TonalSplitButtonTrailingUncheckable =
|
|
4570
|
+
var TonalSplitButtonTrailingUncheckable = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4270
4571
|
TonalSplitButtonTrailingUncheckable.displayName = "TonalSplitButtonTrailingUncheckable";
|
|
4271
|
-
var ElevatedSplitButtonTrailingUncheckable =
|
|
4572
|
+
var ElevatedSplitButtonTrailingUncheckable = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4272
4573
|
ElevatedSplitButtonTrailingUncheckable.displayName = "ElevatedSplitButtonTrailingUncheckable";
|
|
4273
|
-
var OutlinedSplitButtonTrailingUncheckable =
|
|
4574
|
+
var OutlinedSplitButtonTrailingUncheckable = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4274
4575
|
OutlinedSplitButtonTrailingUncheckable.displayName = "OutlinedSplitButtonTrailingUncheckable";
|
|
4275
4576
|
|
|
4276
4577
|
exports.BUTTON_COLOR_TOKENS = BUTTON_COLOR_TOKENS;
|
|
4277
4578
|
exports.BUTTON_GROUP_TOKENS = BUTTON_GROUP_TOKENS;
|
|
4278
4579
|
exports.BUTTON_SIZE_TOKENS = BUTTON_SIZE_TOKENS;
|
|
4279
4580
|
exports.Button = Button;
|
|
4581
|
+
exports.ButtonDistribute = ButtonDistribute;
|
|
4280
4582
|
exports.ButtonGroup = ButtonGroup;
|
|
4281
4583
|
exports.ButtonGroupDefaults = ButtonGroupDefaults;
|
|
4584
|
+
exports.DEFAULT_EXPAND_RATIO = DEFAULT_EXPAND_RATIO;
|
|
4585
|
+
exports.DEFAULT_FIXED_SIZE = DEFAULT_FIXED_SIZE;
|
|
4586
|
+
exports.DEFAULT_GAP = DEFAULT_GAP;
|
|
4587
|
+
exports.DISTRIBUTE_DURATION_MS = DISTRIBUTE_DURATION_MS;
|
|
4588
|
+
exports.DISTRIBUTE_EASING_BEZIER = DISTRIBUTE_EASING_BEZIER;
|
|
4589
|
+
exports.DISTRIBUTE_RADIUS_TOKENS = DISTRIBUTE_RADIUS_TOKENS;
|
|
4590
|
+
exports.DISTRIBUTE_SPRING_TRANSITION = DISTRIBUTE_SPRING_TRANSITION;
|
|
4282
4591
|
exports.ElevatedSplitButtonLeading = ElevatedSplitButtonLeading;
|
|
4283
4592
|
exports.ElevatedSplitButtonTrailing = ElevatedSplitButtonTrailing;
|
|
4284
4593
|
exports.ElevatedSplitButtonTrailingUncheckable = ElevatedSplitButtonTrailingUncheckable;
|