@bug-on/m3-expressive 1.2.1 → 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 +6 -0
- package/dist/buttons.d.mts +26 -5
- package/dist/buttons.d.ts +26 -5
- package/dist/buttons.js +581 -345
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +573 -345
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +52 -13
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +52 -13
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +52 -13
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +52 -13
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.js +4 -1
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +4 -1
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-sSt6PPLg.d.mts → icon-button-CSsDmuQC.d.mts} +13 -0
- package/dist/{icon-button-sSt6PPLg.d.ts → icon-button-CSsDmuQC.d.ts} +13 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1268 -1005
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1127 -865
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +15 -7
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +15 -7
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.d.mts +1 -1
- package/dist/navigation.d.ts +1 -1
- package/dist/navigation.js +66 -16
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +66 -16
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +52 -13
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +52 -13
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +177 -111
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +177 -111
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-BcPD_7uK.d.ts → split-button-trailing-uncheckable-C-qQlyZx.d.ts} +74 -19
- package/dist/{split-button-trailing-uncheckable-DtFJkTFr.d.mts → split-button-trailing-uncheckable-DHJqNeq_.d.mts} +74 -19
- 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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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 = React14__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,13 +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 AnimatedCheckLabel = React14__namespace.memo(function AnimatedCheckLabel2({
|
|
2068
|
+
var AnimatedCheckLabel = React16__namespace.memo(function AnimatedCheckLabel2({
|
|
1740
2069
|
selected,
|
|
1741
2070
|
size,
|
|
1742
2071
|
children
|
|
@@ -1812,43 +2141,9 @@ function resolveIconAndLabel(element, isSelected, itemSize, showCheck, iconBehav
|
|
|
1812
2141
|
}
|
|
1813
2142
|
return { icon, label };
|
|
1814
2143
|
}
|
|
1815
|
-
function
|
|
1816
|
-
const increment = expandedRatio * PADDING_EXPAND_MULTIPLIER;
|
|
1817
|
-
if (activeMorphing) {
|
|
1818
|
-
const isFlexLayout = fullWidth || variant === "connected" && orientation === "horizontal";
|
|
1819
|
-
if (isFlexLayout) {
|
|
1820
|
-
if (isSelected) return { flexGrow: 1 + expandedRatio };
|
|
1821
|
-
if (hasSelected && count > 1)
|
|
1822
|
-
return {
|
|
1823
|
-
flexGrow: Math.max(MIN_FLEX_GROW, 1 - expandedRatio / (count - 1))
|
|
1824
|
-
};
|
|
1825
|
-
return { flexGrow: 1 };
|
|
1826
|
-
}
|
|
1827
|
-
if (isSelected)
|
|
1828
|
-
return { paddingInline: `calc(${basePx} + ${increment}rem)` };
|
|
1829
|
-
if (hasSelected && count > 1) {
|
|
1830
|
-
const decrement = increment / (count - 1);
|
|
1831
|
-
return { paddingInline: `calc(${basePx} - ${decrement}rem)` };
|
|
1832
|
-
}
|
|
1833
|
-
return { paddingInline: basePx };
|
|
1834
|
-
}
|
|
1835
|
-
if (morphingWidth && variant === "standard") {
|
|
1836
|
-
if (fullWidth) return { flexGrow: isPressed ? 1 + expandedRatio : 1 };
|
|
1837
|
-
return {
|
|
1838
|
-
paddingInline: isPressed ? `calc(${basePx} + ${increment}rem)` : basePx
|
|
1839
|
-
};
|
|
1840
|
-
}
|
|
1841
|
-
return {};
|
|
1842
|
-
}
|
|
1843
|
-
function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex, existingAnimate, existingWhileTap) {
|
|
2144
|
+
function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, existingAnimate, existingWhileTap) {
|
|
1844
2145
|
var _a, _b;
|
|
1845
2146
|
const props = { animate: __spreadValues({}, existingAnimate) };
|
|
1846
|
-
if (flex.flexGrow !== void 0) {
|
|
1847
|
-
props.animate.flexGrow = flex.flexGrow;
|
|
1848
|
-
}
|
|
1849
|
-
if (flex.paddingInline !== void 0) {
|
|
1850
|
-
props.animate.paddingInline = flex.paddingInline;
|
|
1851
|
-
}
|
|
1852
2147
|
if (variant === "standard") {
|
|
1853
2148
|
const pressedRadius = (_a = PRESSED_RADIUS_MAP[itemSize]) != null ? _a : PRESSED_RADIUS_MAP.sm;
|
|
1854
2149
|
const itemSizeTokens = (_b = BUTTON_SIZE_TOKENS[itemSize]) != null ? _b : BUTTON_SIZE_TOKENS.sm;
|
|
@@ -1859,9 +2154,6 @@ function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex
|
|
|
1859
2154
|
}, existingWhileTap);
|
|
1860
2155
|
props.transition = {
|
|
1861
2156
|
borderRadius: BUTTON_RADIUS_SPRING,
|
|
1862
|
-
flexGrow: WIDTH_MORPH_SPRING,
|
|
1863
|
-
paddingInline: WIDTH_MORPH_SPRING,
|
|
1864
|
-
layout: WIDTH_MORPH_SPRING,
|
|
1865
2157
|
default: BUTTON_SHAPE_MORPH_SPRING
|
|
1866
2158
|
};
|
|
1867
2159
|
props.layout = true;
|
|
@@ -1888,19 +2180,16 @@ function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex
|
|
|
1888
2180
|
borderBottomLeftRadius: shapes.pressed.bl
|
|
1889
2181
|
}, existingWhileTap);
|
|
1890
2182
|
props.transition = __spreadProps(__spreadValues({}, BUTTON_SHAPE_MORPH_SPRING), {
|
|
1891
|
-
flexGrow: WIDTH_MORPH_SPRING,
|
|
1892
|
-
paddingInline: WIDTH_MORPH_SPRING,
|
|
1893
2183
|
borderTopLeftRadius: BUTTON_RADIUS_SPRING,
|
|
1894
2184
|
borderTopRightRadius: BUTTON_RADIUS_SPRING,
|
|
1895
2185
|
borderBottomRightRadius: BUTTON_RADIUS_SPRING,
|
|
1896
|
-
borderBottomLeftRadius: BUTTON_RADIUS_SPRING
|
|
1897
|
-
layout: WIDTH_MORPH_SPRING
|
|
2186
|
+
borderBottomLeftRadius: BUTTON_RADIUS_SPRING
|
|
1898
2187
|
});
|
|
1899
2188
|
props.layout = true;
|
|
1900
2189
|
}
|
|
1901
2190
|
return props;
|
|
1902
2191
|
}
|
|
1903
|
-
var ButtonGroupComponent =
|
|
2192
|
+
var ButtonGroupComponent = React16__namespace.forwardRef(
|
|
1904
2193
|
(_a, ref) => {
|
|
1905
2194
|
var _b = _a, {
|
|
1906
2195
|
className,
|
|
@@ -1908,10 +2197,7 @@ var ButtonGroupComponent = React14__namespace.forwardRef(
|
|
|
1908
2197
|
orientation = "horizontal",
|
|
1909
2198
|
fullWidth = false,
|
|
1910
2199
|
size,
|
|
1911
|
-
morphingWidth = true,
|
|
1912
|
-
activeMorphing = false,
|
|
1913
2200
|
itemClassName,
|
|
1914
|
-
expandedRatio = ButtonGroupDefaults.expandedRatio,
|
|
1915
2201
|
showCheck = false,
|
|
1916
2202
|
children,
|
|
1917
2203
|
iconBehavior,
|
|
@@ -1923,99 +2209,26 @@ var ButtonGroupComponent = React14__namespace.forwardRef(
|
|
|
1923
2209
|
"orientation",
|
|
1924
2210
|
"fullWidth",
|
|
1925
2211
|
"size",
|
|
1926
|
-
"morphingWidth",
|
|
1927
|
-
"activeMorphing",
|
|
1928
2212
|
"itemClassName",
|
|
1929
|
-
"expandedRatio",
|
|
1930
2213
|
"showCheck",
|
|
1931
2214
|
"children",
|
|
1932
2215
|
"iconBehavior",
|
|
1933
2216
|
"labelBehavior",
|
|
1934
2217
|
"style"
|
|
1935
2218
|
]);
|
|
1936
|
-
const [pressedIndex, setPressedIndex] =
|
|
1937
|
-
const
|
|
1938
|
-
|
|
1939
|
-
);
|
|
1940
|
-
const rootRef = React14__namespace.useRef(null);
|
|
1941
|
-
const setRootRef = React14__namespace.useCallback(
|
|
1942
|
-
(node) => {
|
|
1943
|
-
rootRef.current = node;
|
|
1944
|
-
if (typeof ref === "function") {
|
|
1945
|
-
ref(node);
|
|
1946
|
-
} else if (ref) {
|
|
1947
|
-
ref.current = node;
|
|
1948
|
-
}
|
|
1949
|
-
},
|
|
1950
|
-
[ref]
|
|
1951
|
-
);
|
|
1952
|
-
const childrenArray = React14__namespace.useMemo(
|
|
1953
|
-
() => React14__namespace.Children.toArray(children).filter(React14__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),
|
|
1954
2222
|
[children]
|
|
1955
2223
|
);
|
|
1956
2224
|
const count = childrenArray.length;
|
|
1957
|
-
const
|
|
1958
|
-
() => `${childrenArray.map((child, index) => {
|
|
1959
|
-
var _a2, _b2, _c, _d, _e;
|
|
1960
|
-
const element = child;
|
|
1961
|
-
const label = typeof element.props.children === "string" || typeof element.props.children === "number" ? element.props.children : (_a2 = element.key) != null ? _a2 : index;
|
|
1962
|
-
return [
|
|
1963
|
-
(_b2 = element.key) != null ? _b2 : index,
|
|
1964
|
-
(_d = (_c = element.props.size) != null ? _c : size) != null ? _d : "",
|
|
1965
|
-
label,
|
|
1966
|
-
Boolean(element.props.icon),
|
|
1967
|
-
(_e = element.props.className) != null ? _e : ""
|
|
1968
|
-
].join(":");
|
|
1969
|
-
}).join("|")}|${variant}|${orientation}|${showCheck}`,
|
|
1970
|
-
[childrenArray, orientation, showCheck, size, variant]
|
|
1971
|
-
);
|
|
1972
|
-
const groupSizeSignatureRef = React14__namespace.useRef(groupSizeSignature);
|
|
1973
|
-
React14__namespace.useLayoutEffect(() => {
|
|
1974
|
-
if (groupSizeSignatureRef.current !== groupSizeSignature) {
|
|
1975
|
-
groupSizeSignatureRef.current = groupSizeSignature;
|
|
1976
|
-
setLockedGroupSize(null);
|
|
1977
|
-
}
|
|
1978
|
-
}, [groupSizeSignature]);
|
|
1979
|
-
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;
|
|
1980
|
-
const shouldLockGroupSize = activeMorphing && !fullWidth && !hasExplicitGroupSize && count > 1;
|
|
1981
|
-
React14__namespace.useLayoutEffect(() => {
|
|
1982
|
-
if (!shouldLockGroupSize) {
|
|
1983
|
-
if (lockedGroupSize !== null) setLockedGroupSize(null);
|
|
1984
|
-
return;
|
|
1985
|
-
}
|
|
1986
|
-
if (lockedGroupSize !== null) return;
|
|
1987
|
-
const node = rootRef.current;
|
|
1988
|
-
if (!node) return;
|
|
1989
|
-
const rect = node.getBoundingClientRect();
|
|
1990
|
-
const nextSize = orientation === "horizontal" ? rect.width : rect.height;
|
|
1991
|
-
if (nextSize > 0) {
|
|
1992
|
-
setLockedGroupSize(Math.ceil(nextSize * 100) / 100);
|
|
1993
|
-
}
|
|
1994
|
-
}, [lockedGroupSize, orientation, shouldLockGroupSize]);
|
|
1995
|
-
const groupStyle = React14__namespace.useMemo(() => {
|
|
1996
|
-
const nextStyle = __spreadValues({}, style);
|
|
1997
|
-
if (shouldLockGroupSize && lockedGroupSize !== null) {
|
|
1998
|
-
if (orientation === "horizontal") {
|
|
1999
|
-
nextStyle.inlineSize = `${lockedGroupSize}px`;
|
|
2000
|
-
} else {
|
|
2001
|
-
nextStyle.blockSize = `${lockedGroupSize}px`;
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
return nextStyle;
|
|
2005
|
-
}, [lockedGroupSize, orientation, shouldLockGroupSize, style]);
|
|
2006
|
-
const hasSelected = React14__namespace.useMemo(
|
|
2007
|
-
() => childrenArray.some(
|
|
2008
|
-
(child) => child.props.selected
|
|
2009
|
-
),
|
|
2010
|
-
[childrenArray]
|
|
2011
|
-
);
|
|
2012
|
-
const handlePointerLeaveAndUp = React14__namespace.useCallback(() => {
|
|
2225
|
+
const handlePointerLeaveAndUp = React16__namespace.useCallback(() => {
|
|
2013
2226
|
setPressedIndex(null);
|
|
2014
2227
|
}, []);
|
|
2015
2228
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2016
2229
|
"fieldset",
|
|
2017
2230
|
__spreadProps(__spreadValues({
|
|
2018
|
-
ref
|
|
2231
|
+
ref,
|
|
2019
2232
|
className: cn(
|
|
2020
2233
|
"inline-flex p-0 m-0 border-none max-w-full [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2021
2234
|
orientation === "vertical" ? "flex-col items-stretch overflow-y-auto overflow-x-hidden" : "flex-row overflow-x-auto overflow-y-hidden",
|
|
@@ -2024,18 +2237,17 @@ var ButtonGroupComponent = React14__namespace.forwardRef(
|
|
|
2024
2237
|
fullWidth && orientation === "vertical" && "h-full",
|
|
2025
2238
|
className
|
|
2026
2239
|
),
|
|
2027
|
-
style
|
|
2240
|
+
style,
|
|
2028
2241
|
onPointerLeave: handlePointerLeaveAndUp,
|
|
2029
2242
|
onPointerUp: handlePointerLeaveAndUp
|
|
2030
2243
|
}, props), {
|
|
2031
2244
|
children: childrenArray.map((child, index) => {
|
|
2032
|
-
var _a2
|
|
2245
|
+
var _a2;
|
|
2033
2246
|
const element = child;
|
|
2034
2247
|
const isSelected = element.props.selected === true;
|
|
2035
2248
|
const isFirst = index === 0;
|
|
2036
2249
|
const isLast = index === count - 1;
|
|
2037
2250
|
const itemSize = size || element.props.size || "sm";
|
|
2038
|
-
const basePx = ((_a2 = BUTTON_SIZE_TOKENS[itemSize]) == null ? void 0 : _a2.leadingSpace) || "1rem";
|
|
2039
2251
|
const isPressed = pressedIndex === index;
|
|
2040
2252
|
const { icon: explicitIcon, label: explicitLabel } = resolveIconAndLabel(
|
|
2041
2253
|
element,
|
|
@@ -2052,25 +2264,6 @@ var ButtonGroupComponent = React14__namespace.forwardRef(
|
|
|
2052
2264
|
isLast,
|
|
2053
2265
|
itemSize
|
|
2054
2266
|
);
|
|
2055
|
-
const flex = resolveFlexTargets(
|
|
2056
|
-
variant,
|
|
2057
|
-
orientation,
|
|
2058
|
-
isSelected,
|
|
2059
|
-
isPressed,
|
|
2060
|
-
hasSelected,
|
|
2061
|
-
count,
|
|
2062
|
-
fullWidth,
|
|
2063
|
-
activeMorphing,
|
|
2064
|
-
morphingWidth,
|
|
2065
|
-
expandedRatio,
|
|
2066
|
-
basePx
|
|
2067
|
-
);
|
|
2068
|
-
const dynamicStyle = __spreadValues({}, element.props.style);
|
|
2069
|
-
if (flex.flexGrow !== void 0 && fullWidth) {
|
|
2070
|
-
dynamicStyle.flexBasis = 0;
|
|
2071
|
-
dynamicStyle.flexShrink = 1;
|
|
2072
|
-
dynamicStyle.minWidth = 0;
|
|
2073
|
-
}
|
|
2074
2267
|
const existingAnimate = typeof element.props.animate === "object" && !Array.isArray(element.props.animate) ? element.props.animate : {};
|
|
2075
2268
|
const existingWhileTap = typeof element.props.whileTap === "object" && !Array.isArray(element.props.whileTap) ? element.props.whileTap : {};
|
|
2076
2269
|
const motionProps = buildMotionProps(
|
|
@@ -2079,13 +2272,12 @@ var ButtonGroupComponent = React14__namespace.forwardRef(
|
|
|
2079
2272
|
isPressed,
|
|
2080
2273
|
itemSize,
|
|
2081
2274
|
shapes,
|
|
2082
|
-
flex,
|
|
2083
2275
|
existingAnimate,
|
|
2084
2276
|
existingWhileTap
|
|
2085
2277
|
);
|
|
2086
2278
|
const connectedClasses = variant === "connected" && isSelected ? "z-20" : "";
|
|
2087
|
-
const clonedElement =
|
|
2088
|
-
key: (
|
|
2279
|
+
const clonedElement = React16__namespace.cloneElement(element, __spreadValues(__spreadProps(__spreadValues({
|
|
2280
|
+
key: (_a2 = element.key) != null ? _a2 : index,
|
|
2089
2281
|
tabIndex: isFirst ? 0 : -1,
|
|
2090
2282
|
size: size || element.props.size,
|
|
2091
2283
|
icon: explicitIcon,
|
|
@@ -2099,9 +2291,9 @@ var ButtonGroupComponent = React14__namespace.forwardRef(
|
|
|
2099
2291
|
connectedClasses,
|
|
2100
2292
|
"focus-visible:z-10 hover:z-10 relative min-w-0",
|
|
2101
2293
|
orientation === "vertical" && "w-full",
|
|
2294
|
+
fullWidth && "flex-1",
|
|
2102
2295
|
itemClassName
|
|
2103
2296
|
),
|
|
2104
|
-
style: dynamicStyle,
|
|
2105
2297
|
onPointerDown: (e) => {
|
|
2106
2298
|
setPressedIndex(index);
|
|
2107
2299
|
if (element.props.onPointerDown) element.props.onPointerDown(e);
|
|
@@ -2114,7 +2306,7 @@ var ButtonGroupComponent = React14__namespace.forwardRef(
|
|
|
2114
2306
|
}
|
|
2115
2307
|
);
|
|
2116
2308
|
ButtonGroupComponent.displayName = "ButtonGroup";
|
|
2117
|
-
var ButtonGroup =
|
|
2309
|
+
var ButtonGroup = React16__namespace.memo(ButtonGroupComponent);
|
|
2118
2310
|
var SIZE_HEIGHT = {
|
|
2119
2311
|
sm: "h-14",
|
|
2120
2312
|
md: "h-20",
|
|
@@ -2169,9 +2361,9 @@ var COLOR_CLASSES = {
|
|
|
2169
2361
|
}
|
|
2170
2362
|
};
|
|
2171
2363
|
function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
2172
|
-
const [collapsed, setCollapsed] =
|
|
2173
|
-
const lastScrollY =
|
|
2174
|
-
|
|
2364
|
+
const [collapsed, setCollapsed] = React16__namespace.useState(false);
|
|
2365
|
+
const lastScrollY = React16__namespace.useRef(0);
|
|
2366
|
+
React16__namespace.useEffect(() => {
|
|
2175
2367
|
if (!enabled || typeof window === "undefined") return;
|
|
2176
2368
|
lastScrollY.current = window.scrollY;
|
|
2177
2369
|
const handleScroll = () => {
|
|
@@ -2194,7 +2386,7 @@ function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
|
2194
2386
|
}, [enabled, scrollThreshold, collapsed, onCollapsedChange]);
|
|
2195
2387
|
return collapsed;
|
|
2196
2388
|
}
|
|
2197
|
-
var ExtendedFABComponent =
|
|
2389
|
+
var ExtendedFABComponent = React16__namespace.forwardRef(
|
|
2198
2390
|
(_a, ref) => {
|
|
2199
2391
|
var _b = _a, {
|
|
2200
2392
|
className,
|
|
@@ -2240,10 +2432,10 @@ var ExtendedFABComponent = React14__namespace.forwardRef(
|
|
|
2240
2432
|
"aria-label"
|
|
2241
2433
|
]);
|
|
2242
2434
|
var _a2, _b2, _c, _d;
|
|
2243
|
-
const localRef =
|
|
2244
|
-
|
|
2245
|
-
const [dir, setDir] =
|
|
2246
|
-
|
|
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(() => {
|
|
2247
2439
|
var _a3;
|
|
2248
2440
|
if (!localRef.current) return;
|
|
2249
2441
|
const closestDir = (_a3 = localRef.current.closest("[dir]")) == null ? void 0 : _a3.getAttribute("dir");
|
|
@@ -2264,7 +2456,7 @@ var ExtendedFABComponent = React14__namespace.forwardRef(
|
|
|
2264
2456
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2265
2457
|
disabled: loading
|
|
2266
2458
|
});
|
|
2267
|
-
const handleClick =
|
|
2459
|
+
const handleClick = React16__namespace.useCallback(
|
|
2268
2460
|
(e) => {
|
|
2269
2461
|
if (loading) {
|
|
2270
2462
|
e.preventDefault();
|
|
@@ -2274,7 +2466,7 @@ var ExtendedFABComponent = React14__namespace.forwardRef(
|
|
|
2274
2466
|
},
|
|
2275
2467
|
[loading, onClick]
|
|
2276
2468
|
);
|
|
2277
|
-
const handleKeyDown =
|
|
2469
|
+
const handleKeyDown = React16__namespace.useCallback(
|
|
2278
2470
|
(e) => {
|
|
2279
2471
|
if (loading) return;
|
|
2280
2472
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2382,8 +2574,8 @@ var ExtendedFABComponent = React14__namespace.forwardRef(
|
|
|
2382
2574
|
}),
|
|
2383
2575
|
className: containerClassName
|
|
2384
2576
|
}, restProps), {
|
|
2385
|
-
children:
|
|
2386
|
-
|
|
2577
|
+
children: React16__namespace.cloneElement(
|
|
2578
|
+
React16__namespace.Children.only(children),
|
|
2387
2579
|
{ children: innerContent }
|
|
2388
2580
|
)
|
|
2389
2581
|
})
|
|
@@ -2427,7 +2619,7 @@ var ExtendedFABComponent = React14__namespace.forwardRef(
|
|
|
2427
2619
|
}
|
|
2428
2620
|
);
|
|
2429
2621
|
ExtendedFABComponent.displayName = "ExtendedFAB";
|
|
2430
|
-
var ExtendedFAB =
|
|
2622
|
+
var ExtendedFAB = React16__namespace.memo(ExtendedFABComponent);
|
|
2431
2623
|
var SIZE_STYLES = {
|
|
2432
2624
|
sm: "h-10 w-10",
|
|
2433
2625
|
md: "h-14 w-14",
|
|
@@ -2498,7 +2690,7 @@ function FABPosition({
|
|
|
2498
2690
|
}
|
|
2499
2691
|
);
|
|
2500
2692
|
}
|
|
2501
|
-
var FABComponent =
|
|
2693
|
+
var FABComponent = React16__namespace.forwardRef(
|
|
2502
2694
|
(_a, ref) => {
|
|
2503
2695
|
var _b = _a, {
|
|
2504
2696
|
className,
|
|
@@ -2545,7 +2737,7 @@ var FABComponent = React14__namespace.forwardRef(
|
|
|
2545
2737
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2546
2738
|
disabled: loading
|
|
2547
2739
|
});
|
|
2548
|
-
const handleClick =
|
|
2740
|
+
const handleClick = React16__namespace.useCallback(
|
|
2549
2741
|
(e) => {
|
|
2550
2742
|
if (loading) {
|
|
2551
2743
|
e.preventDefault();
|
|
@@ -2555,7 +2747,7 @@ var FABComponent = React14__namespace.forwardRef(
|
|
|
2555
2747
|
},
|
|
2556
2748
|
[loading, onClick]
|
|
2557
2749
|
);
|
|
2558
|
-
const handleKeyDown =
|
|
2750
|
+
const handleKeyDown = React16__namespace.useCallback(
|
|
2559
2751
|
(e) => {
|
|
2560
2752
|
if (loading) return;
|
|
2561
2753
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2566,7 +2758,7 @@ var FABComponent = React14__namespace.forwardRef(
|
|
|
2566
2758
|
},
|
|
2567
2759
|
[loading, onClick, onKeyDown]
|
|
2568
2760
|
);
|
|
2569
|
-
const labelContent = asChild ?
|
|
2761
|
+
const labelContent = asChild ? React16__namespace.Children.only(children).props.children : children;
|
|
2570
2762
|
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2571
2763
|
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
2572
2764
|
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
@@ -2654,8 +2846,8 @@ var FABComponent = React14__namespace.forwardRef(
|
|
|
2654
2846
|
}),
|
|
2655
2847
|
className: containerClassName
|
|
2656
2848
|
}, restProps), {
|
|
2657
|
-
children:
|
|
2658
|
-
|
|
2849
|
+
children: React16__namespace.cloneElement(
|
|
2850
|
+
React16__namespace.Children.only(children),
|
|
2659
2851
|
{ children: innerContent }
|
|
2660
2852
|
)
|
|
2661
2853
|
})
|
|
@@ -2692,7 +2884,7 @@ var FABComponent = React14__namespace.forwardRef(
|
|
|
2692
2884
|
}
|
|
2693
2885
|
);
|
|
2694
2886
|
FABComponent.displayName = "FAB";
|
|
2695
|
-
var FAB =
|
|
2887
|
+
var FAB = React16__namespace.memo(FABComponent);
|
|
2696
2888
|
var SPRING_NORMAL = { stiffness: 700, damping: 40 };
|
|
2697
2889
|
var SPRING_REDUCED = { stiffness: 1e4, damping: 100 };
|
|
2698
2890
|
var FOCUS_DELAY_MS = 50;
|
|
@@ -2800,7 +2992,7 @@ function CloseIcon() {
|
|
|
2800
2992
|
function defaultFabIcon(progress) {
|
|
2801
2993
|
return progress > 0.5 ? /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(AddIcon, {});
|
|
2802
2994
|
}
|
|
2803
|
-
var ToggleFABComponent =
|
|
2995
|
+
var ToggleFABComponent = React16__namespace.forwardRef(
|
|
2804
2996
|
({
|
|
2805
2997
|
expanded,
|
|
2806
2998
|
onToggle,
|
|
@@ -2818,7 +3010,7 @@ var ToggleFABComponent = React14__namespace.forwardRef(
|
|
|
2818
3010
|
const sizeTokens = (_b = TOGGLE_FAB_SIZES[fabSize]) != null ? _b : TOGGLE_FAB_SIZES.baseline;
|
|
2819
3011
|
const springConfig = prefersReduced ? SPRING_REDUCED : SPRING_NORMAL;
|
|
2820
3012
|
const checkedProgress = react.useSpring(expanded ? 1 : 0, springConfig);
|
|
2821
|
-
|
|
3013
|
+
React16__namespace.useEffect(() => {
|
|
2822
3014
|
checkedProgress.set(expanded ? 1 : 0);
|
|
2823
3015
|
}, [expanded, checkedProgress]);
|
|
2824
3016
|
const borderRadius = react.useTransform(
|
|
@@ -2826,12 +3018,12 @@ var ToggleFABComponent = React14__namespace.forwardRef(
|
|
|
2826
3018
|
[0, 1],
|
|
2827
3019
|
[`${sizeTokens.initialRadius}px`, `${sizeTokens.finalRadius}px`]
|
|
2828
3020
|
);
|
|
2829
|
-
const [iconProgress, setIconProgress] =
|
|
2830
|
-
|
|
3021
|
+
const [iconProgress, setIconProgress] = React16__namespace.useState(expanded ? 1 : 0);
|
|
3022
|
+
React16__namespace.useEffect(() => {
|
|
2831
3023
|
return checkedProgress.on("change", setIconProgress);
|
|
2832
3024
|
}, [checkedProgress]);
|
|
2833
3025
|
const { ripples, onPointerDown, removeRipple } = useRippleState();
|
|
2834
|
-
const handleClick =
|
|
3026
|
+
const handleClick = React16__namespace.useCallback(() => {
|
|
2835
3027
|
onToggle(!expanded);
|
|
2836
3028
|
}, [expanded, onToggle]);
|
|
2837
3029
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2880,7 +3072,7 @@ var ToggleFABComponent = React14__namespace.forwardRef(
|
|
|
2880
3072
|
}
|
|
2881
3073
|
);
|
|
2882
3074
|
ToggleFABComponent.displayName = "ToggleFAB";
|
|
2883
|
-
var ToggleFAB =
|
|
3075
|
+
var ToggleFAB = React16__namespace.memo(ToggleFABComponent);
|
|
2884
3076
|
function FABMenuItem({
|
|
2885
3077
|
icon,
|
|
2886
3078
|
label,
|
|
@@ -2895,7 +3087,7 @@ function FABMenuItem({
|
|
|
2895
3087
|
var _a;
|
|
2896
3088
|
const colors = (_a = MENU_ITEM_COLORS[colorVariant]) != null ? _a : MENU_ITEM_COLORS.primary;
|
|
2897
3089
|
const { ripples, onPointerDown, removeRipple } = useRippleState({ disabled });
|
|
2898
|
-
const handleClick =
|
|
3090
|
+
const handleClick = React16__namespace.useCallback(
|
|
2899
3091
|
(e) => {
|
|
2900
3092
|
if (disabled) {
|
|
2901
3093
|
e.preventDefault();
|
|
@@ -2905,7 +3097,7 @@ function FABMenuItem({
|
|
|
2905
3097
|
},
|
|
2906
3098
|
[disabled, onClick]
|
|
2907
3099
|
);
|
|
2908
|
-
const handleKeyDown =
|
|
3100
|
+
const handleKeyDown = React16__namespace.useCallback(
|
|
2909
3101
|
(e) => {
|
|
2910
3102
|
if (disabled) return;
|
|
2911
3103
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -2947,7 +3139,7 @@ function FABMenuItem({
|
|
|
2947
3139
|
borderRadius: `${MENU_ITEM_STYLES.cornerRadius}px`
|
|
2948
3140
|
};
|
|
2949
3141
|
if (asChild) {
|
|
2950
|
-
const child =
|
|
3142
|
+
const child = React16__namespace.Children.only(children);
|
|
2951
3143
|
return /* @__PURE__ */ jsxRuntime.jsx(react.m.div, { variants: MENU_ITEM_VARIANTS, style: containerStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2952
3144
|
reactSlot.Slot,
|
|
2953
3145
|
{
|
|
@@ -2959,7 +3151,7 @@ function FABMenuItem({
|
|
|
2959
3151
|
onPointerDown,
|
|
2960
3152
|
onKeyDown: handleKeyDown,
|
|
2961
3153
|
className: containerClassName,
|
|
2962
|
-
children:
|
|
3154
|
+
children: React16__namespace.cloneElement(child, { children: innerContent })
|
|
2963
3155
|
}
|
|
2964
3156
|
) });
|
|
2965
3157
|
}
|
|
@@ -2992,13 +3184,13 @@ function FABMenu({
|
|
|
2992
3184
|
focusLast = true,
|
|
2993
3185
|
"aria-label": ariaLabel
|
|
2994
3186
|
}) {
|
|
2995
|
-
const fabId =
|
|
2996
|
-
const menuId =
|
|
2997
|
-
const toggleRef =
|
|
2998
|
-
const itemRefs =
|
|
2999
|
-
const [focusedIndex, setFocusedIndex] =
|
|
3000
|
-
const reversedItems =
|
|
3001
|
-
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) => {
|
|
3002
3194
|
var _a;
|
|
3003
3195
|
const clampedIndex = Math.max(
|
|
3004
3196
|
0,
|
|
@@ -3007,8 +3199,8 @@ function FABMenu({
|
|
|
3007
3199
|
setFocusedIndex(clampedIndex);
|
|
3008
3200
|
(_a = itemRefs.current[clampedIndex]) == null ? void 0 : _a.focus();
|
|
3009
3201
|
}, []);
|
|
3010
|
-
const wasExpandedRef =
|
|
3011
|
-
|
|
3202
|
+
const wasExpandedRef = React16__namespace.useRef(false);
|
|
3203
|
+
React16__namespace.useEffect(() => {
|
|
3012
3204
|
var _a;
|
|
3013
3205
|
if (expanded) {
|
|
3014
3206
|
wasExpandedRef.current = true;
|
|
@@ -3023,7 +3215,7 @@ function FABMenu({
|
|
|
3023
3215
|
wasExpandedRef.current = false;
|
|
3024
3216
|
setFocusedIndex(-1);
|
|
3025
3217
|
}, [expanded, focusLast, items.length, focusItem]);
|
|
3026
|
-
const handleMenuKeyDown =
|
|
3218
|
+
const handleMenuKeyDown = React16__namespace.useCallback(
|
|
3027
3219
|
(e) => {
|
|
3028
3220
|
if (!expanded) return;
|
|
3029
3221
|
const lastIndex = items.length - 1;
|
|
@@ -3147,12 +3339,39 @@ function FABMenu({
|
|
|
3147
3339
|
)
|
|
3148
3340
|
] });
|
|
3149
3341
|
}
|
|
3150
|
-
var
|
|
3151
|
-
xs: "h-8
|
|
3152
|
-
sm: "h-10
|
|
3153
|
-
md: "h-14
|
|
3154
|
-
lg: "h-24
|
|
3155
|
-
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
|
+
}
|
|
3156
3375
|
};
|
|
3157
3376
|
var SIZE_ICON3 = {
|
|
3158
3377
|
xs: { cls: "size-5", px: 20 },
|
|
@@ -3245,7 +3464,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
3245
3464
|
}
|
|
3246
3465
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
3247
3466
|
}
|
|
3248
|
-
var IconButtonComponent =
|
|
3467
|
+
var IconButtonComponent = React16__namespace.forwardRef(
|
|
3249
3468
|
(_a, ref) => {
|
|
3250
3469
|
var _b = _a, {
|
|
3251
3470
|
className,
|
|
@@ -3253,8 +3472,10 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3253
3472
|
variant = "default",
|
|
3254
3473
|
colorStyle = "standard",
|
|
3255
3474
|
size = "sm",
|
|
3475
|
+
widthVariant = "default",
|
|
3256
3476
|
shape = "round",
|
|
3257
3477
|
selected,
|
|
3478
|
+
selectedIcon,
|
|
3258
3479
|
loading = false,
|
|
3259
3480
|
loadingVariant = "loading-indicator",
|
|
3260
3481
|
iconSize,
|
|
@@ -3269,8 +3490,10 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3269
3490
|
"variant",
|
|
3270
3491
|
"colorStyle",
|
|
3271
3492
|
"size",
|
|
3493
|
+
"widthVariant",
|
|
3272
3494
|
"shape",
|
|
3273
3495
|
"selected",
|
|
3496
|
+
"selectedIcon",
|
|
3274
3497
|
"loading",
|
|
3275
3498
|
"loadingVariant",
|
|
3276
3499
|
"iconSize",
|
|
@@ -3280,21 +3503,21 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3280
3503
|
"onKeyDown",
|
|
3281
3504
|
"aria-label"
|
|
3282
3505
|
]);
|
|
3283
|
-
var _a2, _b2;
|
|
3506
|
+
var _a2, _b2, _c, _d, _e;
|
|
3284
3507
|
const isToggle = variant === "toggle";
|
|
3285
3508
|
const isSelected = isToggle && !!selected;
|
|
3286
|
-
const resolvedColorClass =
|
|
3509
|
+
const resolvedColorClass = React16__namespace.useMemo(
|
|
3287
3510
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
3288
3511
|
[isSelected, colorStyle]
|
|
3289
3512
|
);
|
|
3290
|
-
const outlineWidthClass =
|
|
3513
|
+
const outlineWidthClass = React16__namespace.useMemo(
|
|
3291
3514
|
() => {
|
|
3292
3515
|
var _a3;
|
|
3293
3516
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
3294
3517
|
},
|
|
3295
3518
|
[colorStyle, isSelected, size]
|
|
3296
3519
|
);
|
|
3297
|
-
const disabledBgClass =
|
|
3520
|
+
const disabledBgClass = React16__namespace.useMemo(
|
|
3298
3521
|
() => resolveDisabledBgClass(colorStyle),
|
|
3299
3522
|
[colorStyle]
|
|
3300
3523
|
);
|
|
@@ -3311,11 +3534,13 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3311
3534
|
const defaultIconPx = sizeIcon.px;
|
|
3312
3535
|
const iconPx = iconSize != null ? iconSize : defaultIconPx;
|
|
3313
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;
|
|
3314
3539
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
3315
3540
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
3316
3541
|
disabled: loading
|
|
3317
3542
|
});
|
|
3318
|
-
const handleClick =
|
|
3543
|
+
const handleClick = React16__namespace.useCallback(
|
|
3319
3544
|
(e) => {
|
|
3320
3545
|
if (loading) {
|
|
3321
3546
|
e.preventDefault();
|
|
@@ -3325,7 +3550,7 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3325
3550
|
},
|
|
3326
3551
|
[loading, onClick]
|
|
3327
3552
|
);
|
|
3328
|
-
const handleKeyDown =
|
|
3553
|
+
const handleKeyDown = React16__namespace.useCallback(
|
|
3329
3554
|
(e) => {
|
|
3330
3555
|
if (loading) return;
|
|
3331
3556
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -3373,7 +3598,7 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3373
3598
|
transition: SPRING_TRANSITION,
|
|
3374
3599
|
"aria-hidden": "true",
|
|
3375
3600
|
className: cn(
|
|
3376
|
-
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]
|
|
3601
|
+
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]",
|
|
3377
3602
|
iconSize != null ? void 0 : iconClass
|
|
3378
3603
|
),
|
|
3379
3604
|
style: {
|
|
@@ -3381,9 +3606,9 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3381
3606
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
3382
3607
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
3383
3608
|
},
|
|
3384
|
-
children: asChild ?
|
|
3609
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React16__namespace.Children.only(children).props.children : children
|
|
3385
3610
|
}),
|
|
3386
|
-
"content"
|
|
3611
|
+
isSelected && selectedIcon ? "selected-content" : "content"
|
|
3387
3612
|
) })
|
|
3388
3613
|
] });
|
|
3389
3614
|
const containerClassName = cn(
|
|
@@ -3392,12 +3617,13 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3392
3617
|
outlineWidthClass,
|
|
3393
3618
|
disabledBgClass,
|
|
3394
3619
|
"overflow-hidden",
|
|
3395
|
-
|
|
3620
|
+
heightClass,
|
|
3621
|
+
widthClass,
|
|
3396
3622
|
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
3397
3623
|
className
|
|
3398
3624
|
);
|
|
3399
3625
|
if (asChild) {
|
|
3400
|
-
const child =
|
|
3626
|
+
const child = React16__namespace.Children.only(children);
|
|
3401
3627
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3402
3628
|
reactSlot.Slot,
|
|
3403
3629
|
__spreadProps(__spreadValues({
|
|
@@ -3409,10 +3635,12 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3409
3635
|
onClick: handleClick,
|
|
3410
3636
|
onPointerDown,
|
|
3411
3637
|
onKeyDown: handleKeyDown,
|
|
3412
|
-
style: __spreadProps(__spreadValues({}, style), {
|
|
3638
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
3639
|
+
borderRadius: `${animateRadius}px`
|
|
3640
|
+
}),
|
|
3413
3641
|
className: containerClassName
|
|
3414
3642
|
}, restProps), {
|
|
3415
|
-
children:
|
|
3643
|
+
children: React16__namespace.cloneElement(child, { children: innerContent })
|
|
3416
3644
|
})
|
|
3417
3645
|
) });
|
|
3418
3646
|
}
|
|
@@ -3440,12 +3668,12 @@ var IconButtonComponent = React14__namespace.forwardRef(
|
|
|
3440
3668
|
}
|
|
3441
3669
|
);
|
|
3442
3670
|
IconButtonComponent.displayName = "IconButton";
|
|
3443
|
-
var IconButton =
|
|
3444
|
-
var SplitButtonContext =
|
|
3671
|
+
var IconButton = React16__namespace.memo(IconButtonComponent);
|
|
3672
|
+
var SplitButtonContext = React16__namespace.createContext(null);
|
|
3445
3673
|
function useSplitButtonContext() {
|
|
3446
|
-
return
|
|
3674
|
+
return React16__namespace.useContext(SplitButtonContext);
|
|
3447
3675
|
}
|
|
3448
|
-
var SplitButtonLayoutComponent =
|
|
3676
|
+
var SplitButtonLayoutComponent = React16__namespace.forwardRef(
|
|
3449
3677
|
(_a, ref) => {
|
|
3450
3678
|
var _b = _a, {
|
|
3451
3679
|
leadingButton,
|
|
@@ -3462,10 +3690,10 @@ var SplitButtonLayoutComponent = React14__namespace.forwardRef(
|
|
|
3462
3690
|
"variant",
|
|
3463
3691
|
"size"
|
|
3464
3692
|
]);
|
|
3465
|
-
const leadingProps =
|
|
3693
|
+
const leadingProps = React16__namespace.isValidElement(leadingButton) ? leadingButton.props : {};
|
|
3466
3694
|
const size = layoutSize || leadingProps.size;
|
|
3467
3695
|
const variant = layoutVariant || leadingProps.variant;
|
|
3468
|
-
const contextValue =
|
|
3696
|
+
const contextValue = React16__namespace.useMemo(
|
|
3469
3697
|
() => ({
|
|
3470
3698
|
size,
|
|
3471
3699
|
variant
|
|
@@ -3491,8 +3719,8 @@ var SplitButtonLayoutComponent = React14__namespace.forwardRef(
|
|
|
3491
3719
|
}
|
|
3492
3720
|
);
|
|
3493
3721
|
SplitButtonLayoutComponent.displayName = "SplitButtonLayout";
|
|
3494
|
-
var SplitButtonLayout =
|
|
3495
|
-
var StateLayer =
|
|
3722
|
+
var SplitButtonLayout = React16__namespace.memo(SplitButtonLayoutComponent);
|
|
3723
|
+
var StateLayer = React16__namespace.forwardRef(
|
|
3496
3724
|
(_a, ref) => {
|
|
3497
3725
|
var _b = _a, { className, hovered, focused, pressed } = _b, props = __objRest(_b, ["className", "hovered", "focused", "pressed"]);
|
|
3498
3726
|
let opacity = 0;
|
|
@@ -3744,7 +3972,7 @@ var splitButtonVariants = classVarianceAuthority.cva(
|
|
|
3744
3972
|
}
|
|
3745
3973
|
}
|
|
3746
3974
|
);
|
|
3747
|
-
var SplitButtonLeadingComponent =
|
|
3975
|
+
var SplitButtonLeadingComponent = React16__namespace.forwardRef(
|
|
3748
3976
|
(_a, ref) => {
|
|
3749
3977
|
var _b = _a, {
|
|
3750
3978
|
className,
|
|
@@ -3783,9 +4011,9 @@ var SplitButtonLeadingComponent = React14__namespace.forwardRef(
|
|
|
3783
4011
|
const context = useSplitButtonContext();
|
|
3784
4012
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
3785
4013
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
3786
|
-
const [isHovered, setIsHovered] =
|
|
3787
|
-
const [isFocused, setIsFocused] =
|
|
3788
|
-
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);
|
|
3789
4017
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
3790
4018
|
const typographyClass = (_c = BUTTON_TYPOGRAPHY_TOKENS[actualSize]) != null ? _c : BUTTON_TYPOGRAPHY_TOKENS.sm;
|
|
3791
4019
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -3797,7 +4025,7 @@ var SplitButtonLeadingComponent = React14__namespace.forwardRef(
|
|
|
3797
4025
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
3798
4026
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
3799
4027
|
const borderRadius = `${outerRadius}px ${innerCornerRadius}px ${innerCornerRadius}px ${outerRadius}px`;
|
|
3800
|
-
const handleClick =
|
|
4028
|
+
const handleClick = React16__namespace.useCallback(
|
|
3801
4029
|
(e) => {
|
|
3802
4030
|
if (disabled) {
|
|
3803
4031
|
e.preventDefault();
|
|
@@ -3807,7 +4035,7 @@ var SplitButtonLeadingComponent = React14__namespace.forwardRef(
|
|
|
3807
4035
|
},
|
|
3808
4036
|
[disabled, onClick]
|
|
3809
4037
|
);
|
|
3810
|
-
const handlePointerDown =
|
|
4038
|
+
const handlePointerDown = React16__namespace.useCallback(
|
|
3811
4039
|
(e) => {
|
|
3812
4040
|
onRipplePointerDown(e);
|
|
3813
4041
|
setIsPressed(true);
|
|
@@ -3815,19 +4043,19 @@ var SplitButtonLeadingComponent = React14__namespace.forwardRef(
|
|
|
3815
4043
|
},
|
|
3816
4044
|
[onRipplePointerDown, onPointerDown]
|
|
3817
4045
|
);
|
|
3818
|
-
const handlePointerUp =
|
|
4046
|
+
const handlePointerUp = React16__namespace.useCallback(
|
|
3819
4047
|
(e) => {
|
|
3820
4048
|
setIsPressed(false);
|
|
3821
4049
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
3822
4050
|
},
|
|
3823
4051
|
[onPointerUp]
|
|
3824
4052
|
);
|
|
3825
|
-
const handlePointerEnter =
|
|
4053
|
+
const handlePointerEnter = React16__namespace.useCallback(() => {
|
|
3826
4054
|
if (!disabled) {
|
|
3827
4055
|
setIsHovered(true);
|
|
3828
4056
|
}
|
|
3829
4057
|
}, [disabled]);
|
|
3830
|
-
const handlePointerLeave =
|
|
4058
|
+
const handlePointerLeave = React16__namespace.useCallback(
|
|
3831
4059
|
(e) => {
|
|
3832
4060
|
setIsHovered(false);
|
|
3833
4061
|
setIsPressed(false);
|
|
@@ -3835,21 +4063,21 @@ var SplitButtonLeadingComponent = React14__namespace.forwardRef(
|
|
|
3835
4063
|
},
|
|
3836
4064
|
[onPointerLeave]
|
|
3837
4065
|
);
|
|
3838
|
-
const handlePointerCancel =
|
|
4066
|
+
const handlePointerCancel = React16__namespace.useCallback(
|
|
3839
4067
|
(e) => {
|
|
3840
4068
|
setIsPressed(false);
|
|
3841
4069
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
3842
4070
|
},
|
|
3843
4071
|
[onPointerCancel]
|
|
3844
4072
|
);
|
|
3845
|
-
const handleFocus =
|
|
4073
|
+
const handleFocus = React16__namespace.useCallback(
|
|
3846
4074
|
(e) => {
|
|
3847
4075
|
if (!disabled) setIsFocused(true);
|
|
3848
4076
|
onFocus == null ? void 0 : onFocus(e);
|
|
3849
4077
|
},
|
|
3850
4078
|
[disabled, onFocus]
|
|
3851
4079
|
);
|
|
3852
|
-
const handleBlur =
|
|
4080
|
+
const handleBlur = React16__namespace.useCallback(
|
|
3853
4081
|
(e) => {
|
|
3854
4082
|
setIsFocused(false);
|
|
3855
4083
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -3857,7 +4085,7 @@ var SplitButtonLeadingComponent = React14__namespace.forwardRef(
|
|
|
3857
4085
|
[onBlur]
|
|
3858
4086
|
);
|
|
3859
4087
|
const leadingIconSize = LEADING_ICON_SIZE_FOR_SIZE[actualSize];
|
|
3860
|
-
const labelContent = asChild ?
|
|
4088
|
+
const labelContent = asChild ? React16__namespace.Children.only(children).props.children : children;
|
|
3861
4089
|
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3862
4090
|
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
3863
4091
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3914,8 +4142,8 @@ var SplitButtonLeadingComponent = React14__namespace.forwardRef(
|
|
|
3914
4142
|
style: mergedStyle,
|
|
3915
4143
|
className: containerClassName
|
|
3916
4144
|
}, restProps), {
|
|
3917
|
-
children:
|
|
3918
|
-
|
|
4145
|
+
children: React16__namespace.cloneElement(
|
|
4146
|
+
React16__namespace.Children.only(children),
|
|
3919
4147
|
{ children: innerContent }
|
|
3920
4148
|
)
|
|
3921
4149
|
})
|
|
@@ -3948,16 +4176,16 @@ var SplitButtonLeadingComponent = React14__namespace.forwardRef(
|
|
|
3948
4176
|
}
|
|
3949
4177
|
);
|
|
3950
4178
|
SplitButtonLeadingComponent.displayName = "SplitButtonLeading";
|
|
3951
|
-
var SplitButtonLeading =
|
|
3952
|
-
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)));
|
|
3953
4181
|
FilledSplitButtonLeading.displayName = "FilledSplitButtonLeading";
|
|
3954
|
-
var TonalSplitButtonLeading =
|
|
4182
|
+
var TonalSplitButtonLeading = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
3955
4183
|
TonalSplitButtonLeading.displayName = "TonalSplitButtonLeading";
|
|
3956
|
-
var ElevatedSplitButtonLeading =
|
|
4184
|
+
var ElevatedSplitButtonLeading = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
3957
4185
|
ElevatedSplitButtonLeading.displayName = "ElevatedSplitButtonLeading";
|
|
3958
|
-
var OutlinedSplitButtonLeading =
|
|
4186
|
+
var OutlinedSplitButtonLeading = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
3959
4187
|
OutlinedSplitButtonLeading.displayName = "OutlinedSplitButtonLeading";
|
|
3960
|
-
var SplitButtonTrailingComponent =
|
|
4188
|
+
var SplitButtonTrailingComponent = React16__namespace.forwardRef(
|
|
3961
4189
|
(_a, ref) => {
|
|
3962
4190
|
var _b = _a, {
|
|
3963
4191
|
className,
|
|
@@ -4000,9 +4228,9 @@ var SplitButtonTrailingComponent = React14__namespace.forwardRef(
|
|
|
4000
4228
|
const context = useSplitButtonContext();
|
|
4001
4229
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
4002
4230
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
4003
|
-
const [isHovered, setIsHovered] =
|
|
4004
|
-
const [isFocused, setIsFocused] =
|
|
4005
|
-
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);
|
|
4006
4234
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
4007
4235
|
const prefersReducedMotion = react.useReducedMotion();
|
|
4008
4236
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -4014,12 +4242,12 @@ var SplitButtonTrailingComponent = React14__namespace.forwardRef(
|
|
|
4014
4242
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
4015
4243
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
4016
4244
|
const borderRadius = checked ? `${outerRadius}px ${outerRadius}px ${outerRadius}px ${outerRadius}px` : `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
4017
|
-
const handleToggle =
|
|
4245
|
+
const handleToggle = React16__namespace.useCallback(() => {
|
|
4018
4246
|
if (!disabled) {
|
|
4019
4247
|
onCheckedChange(!checked);
|
|
4020
4248
|
}
|
|
4021
4249
|
}, [disabled, checked, onCheckedChange]);
|
|
4022
|
-
const handlePointerDown =
|
|
4250
|
+
const handlePointerDown = React16__namespace.useCallback(
|
|
4023
4251
|
(e) => {
|
|
4024
4252
|
onRipplePointerDown(e);
|
|
4025
4253
|
setIsPressed(true);
|
|
@@ -4027,19 +4255,19 @@ var SplitButtonTrailingComponent = React14__namespace.forwardRef(
|
|
|
4027
4255
|
},
|
|
4028
4256
|
[onRipplePointerDown, onPointerDown]
|
|
4029
4257
|
);
|
|
4030
|
-
const handlePointerUp =
|
|
4258
|
+
const handlePointerUp = React16__namespace.useCallback(
|
|
4031
4259
|
(e) => {
|
|
4032
4260
|
setIsPressed(false);
|
|
4033
4261
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
4034
4262
|
},
|
|
4035
4263
|
[onPointerUp]
|
|
4036
4264
|
);
|
|
4037
|
-
const handlePointerEnter =
|
|
4265
|
+
const handlePointerEnter = React16__namespace.useCallback(() => {
|
|
4038
4266
|
if (!disabled) {
|
|
4039
4267
|
setIsHovered(true);
|
|
4040
4268
|
}
|
|
4041
4269
|
}, [disabled]);
|
|
4042
|
-
const handlePointerLeave =
|
|
4270
|
+
const handlePointerLeave = React16__namespace.useCallback(
|
|
4043
4271
|
(e) => {
|
|
4044
4272
|
setIsHovered(false);
|
|
4045
4273
|
setIsPressed(false);
|
|
@@ -4047,21 +4275,21 @@ var SplitButtonTrailingComponent = React14__namespace.forwardRef(
|
|
|
4047
4275
|
},
|
|
4048
4276
|
[onPointerLeave]
|
|
4049
4277
|
);
|
|
4050
|
-
const handlePointerCancel =
|
|
4278
|
+
const handlePointerCancel = React16__namespace.useCallback(
|
|
4051
4279
|
(e) => {
|
|
4052
4280
|
setIsPressed(false);
|
|
4053
4281
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
4054
4282
|
},
|
|
4055
4283
|
[onPointerCancel]
|
|
4056
4284
|
);
|
|
4057
|
-
const handleFocus =
|
|
4285
|
+
const handleFocus = React16__namespace.useCallback(
|
|
4058
4286
|
(e) => {
|
|
4059
4287
|
if (!disabled) setIsFocused(true);
|
|
4060
4288
|
onFocus == null ? void 0 : onFocus(e);
|
|
4061
4289
|
},
|
|
4062
4290
|
[disabled, onFocus]
|
|
4063
4291
|
);
|
|
4064
|
-
const handleBlur =
|
|
4292
|
+
const handleBlur = React16__namespace.useCallback(
|
|
4065
4293
|
(e) => {
|
|
4066
4294
|
setIsFocused(false);
|
|
4067
4295
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -4130,8 +4358,8 @@ var SplitButtonTrailingComponent = React14__namespace.forwardRef(
|
|
|
4130
4358
|
style: mergedStyle,
|
|
4131
4359
|
className: containerClassName
|
|
4132
4360
|
}, restProps), {
|
|
4133
|
-
children:
|
|
4134
|
-
|
|
4361
|
+
children: React16__namespace.cloneElement(
|
|
4362
|
+
React16__namespace.Children.only(children),
|
|
4135
4363
|
{ children: innerContent }
|
|
4136
4364
|
)
|
|
4137
4365
|
})
|
|
@@ -4166,16 +4394,16 @@ var SplitButtonTrailingComponent = React14__namespace.forwardRef(
|
|
|
4166
4394
|
}
|
|
4167
4395
|
);
|
|
4168
4396
|
SplitButtonTrailingComponent.displayName = "SplitButtonTrailing";
|
|
4169
|
-
var SplitButtonTrailing =
|
|
4170
|
-
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)));
|
|
4171
4399
|
FilledSplitButtonTrailing.displayName = "FilledSplitButtonTrailing";
|
|
4172
|
-
var TonalSplitButtonTrailing =
|
|
4400
|
+
var TonalSplitButtonTrailing = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4173
4401
|
TonalSplitButtonTrailing.displayName = "TonalSplitButtonTrailing";
|
|
4174
|
-
var ElevatedSplitButtonTrailing =
|
|
4402
|
+
var ElevatedSplitButtonTrailing = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4175
4403
|
ElevatedSplitButtonTrailing.displayName = "ElevatedSplitButtonTrailing";
|
|
4176
|
-
var OutlinedSplitButtonTrailing =
|
|
4404
|
+
var OutlinedSplitButtonTrailing = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4177
4405
|
OutlinedSplitButtonTrailing.displayName = "OutlinedSplitButtonTrailing";
|
|
4178
|
-
var SplitButtonTrailingUncheckableComponent =
|
|
4406
|
+
var SplitButtonTrailingUncheckableComponent = React16__namespace.forwardRef(
|
|
4179
4407
|
(_a, ref) => {
|
|
4180
4408
|
var _b = _a, {
|
|
4181
4409
|
className,
|
|
@@ -4212,9 +4440,9 @@ var SplitButtonTrailingUncheckableComponent = React14__namespace.forwardRef(
|
|
|
4212
4440
|
const context = useSplitButtonContext();
|
|
4213
4441
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
4214
4442
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
4215
|
-
const [isHovered, setIsHovered] =
|
|
4216
|
-
const [isFocused, setIsFocused] =
|
|
4217
|
-
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);
|
|
4218
4446
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
4219
4447
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
4220
4448
|
const {
|
|
@@ -4225,7 +4453,7 @@ var SplitButtonTrailingUncheckableComponent = React14__namespace.forwardRef(
|
|
|
4225
4453
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
4226
4454
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
4227
4455
|
const borderRadius = `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
4228
|
-
const handlePointerDown =
|
|
4456
|
+
const handlePointerDown = React16__namespace.useCallback(
|
|
4229
4457
|
(e) => {
|
|
4230
4458
|
onRipplePointerDown(e);
|
|
4231
4459
|
setIsPressed(true);
|
|
@@ -4233,19 +4461,19 @@ var SplitButtonTrailingUncheckableComponent = React14__namespace.forwardRef(
|
|
|
4233
4461
|
},
|
|
4234
4462
|
[onRipplePointerDown, onPointerDown]
|
|
4235
4463
|
);
|
|
4236
|
-
const handlePointerUp =
|
|
4464
|
+
const handlePointerUp = React16__namespace.useCallback(
|
|
4237
4465
|
(e) => {
|
|
4238
4466
|
setIsPressed(false);
|
|
4239
4467
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
4240
4468
|
},
|
|
4241
4469
|
[onPointerUp]
|
|
4242
4470
|
);
|
|
4243
|
-
const handlePointerEnter =
|
|
4471
|
+
const handlePointerEnter = React16__namespace.useCallback(() => {
|
|
4244
4472
|
if (!disabled) {
|
|
4245
4473
|
setIsHovered(true);
|
|
4246
4474
|
}
|
|
4247
4475
|
}, [disabled]);
|
|
4248
|
-
const handlePointerLeave =
|
|
4476
|
+
const handlePointerLeave = React16__namespace.useCallback(
|
|
4249
4477
|
(e) => {
|
|
4250
4478
|
setIsHovered(false);
|
|
4251
4479
|
setIsPressed(false);
|
|
@@ -4253,21 +4481,21 @@ var SplitButtonTrailingUncheckableComponent = React14__namespace.forwardRef(
|
|
|
4253
4481
|
},
|
|
4254
4482
|
[onPointerLeave]
|
|
4255
4483
|
);
|
|
4256
|
-
const handlePointerCancel =
|
|
4484
|
+
const handlePointerCancel = React16__namespace.useCallback(
|
|
4257
4485
|
(e) => {
|
|
4258
4486
|
setIsPressed(false);
|
|
4259
4487
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
4260
4488
|
},
|
|
4261
4489
|
[onPointerCancel]
|
|
4262
4490
|
);
|
|
4263
|
-
const handleFocus =
|
|
4491
|
+
const handleFocus = React16__namespace.useCallback(
|
|
4264
4492
|
(e) => {
|
|
4265
4493
|
if (!disabled) setIsFocused(true);
|
|
4266
4494
|
onFocus == null ? void 0 : onFocus(e);
|
|
4267
4495
|
},
|
|
4268
4496
|
[disabled, onFocus]
|
|
4269
4497
|
);
|
|
4270
|
-
const handleBlur =
|
|
4498
|
+
const handleBlur = React16__namespace.useCallback(
|
|
4271
4499
|
(e) => {
|
|
4272
4500
|
setIsFocused(false);
|
|
4273
4501
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -4334,24 +4562,32 @@ var SplitButtonTrailingUncheckableComponent = React14__namespace.forwardRef(
|
|
|
4334
4562
|
}
|
|
4335
4563
|
);
|
|
4336
4564
|
SplitButtonTrailingUncheckableComponent.displayName = "SplitButtonTrailingUncheckable";
|
|
4337
|
-
var SplitButtonTrailingUncheckable =
|
|
4565
|
+
var SplitButtonTrailingUncheckable = React16__namespace.memo(
|
|
4338
4566
|
SplitButtonTrailingUncheckableComponent
|
|
4339
4567
|
);
|
|
4340
|
-
var FilledSplitButtonTrailingUncheckable =
|
|
4568
|
+
var FilledSplitButtonTrailingUncheckable = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "filled" }, props)));
|
|
4341
4569
|
FilledSplitButtonTrailingUncheckable.displayName = "FilledSplitButtonTrailingUncheckable";
|
|
4342
|
-
var TonalSplitButtonTrailingUncheckable =
|
|
4570
|
+
var TonalSplitButtonTrailingUncheckable = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4343
4571
|
TonalSplitButtonTrailingUncheckable.displayName = "TonalSplitButtonTrailingUncheckable";
|
|
4344
|
-
var ElevatedSplitButtonTrailingUncheckable =
|
|
4572
|
+
var ElevatedSplitButtonTrailingUncheckable = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4345
4573
|
ElevatedSplitButtonTrailingUncheckable.displayName = "ElevatedSplitButtonTrailingUncheckable";
|
|
4346
|
-
var OutlinedSplitButtonTrailingUncheckable =
|
|
4574
|
+
var OutlinedSplitButtonTrailingUncheckable = React16__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4347
4575
|
OutlinedSplitButtonTrailingUncheckable.displayName = "OutlinedSplitButtonTrailingUncheckable";
|
|
4348
4576
|
|
|
4349
4577
|
exports.BUTTON_COLOR_TOKENS = BUTTON_COLOR_TOKENS;
|
|
4350
4578
|
exports.BUTTON_GROUP_TOKENS = BUTTON_GROUP_TOKENS;
|
|
4351
4579
|
exports.BUTTON_SIZE_TOKENS = BUTTON_SIZE_TOKENS;
|
|
4352
4580
|
exports.Button = Button;
|
|
4581
|
+
exports.ButtonDistribute = ButtonDistribute;
|
|
4353
4582
|
exports.ButtonGroup = ButtonGroup;
|
|
4354
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;
|
|
4355
4591
|
exports.ElevatedSplitButtonLeading = ElevatedSplitButtonLeading;
|
|
4356
4592
|
exports.ElevatedSplitButtonTrailing = ElevatedSplitButtonTrailing;
|
|
4357
4593
|
exports.ElevatedSplitButtonTrailingUncheckable = ElevatedSplitButtonTrailingUncheckable;
|