@bug-on/m3-expressive 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/buttons.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- package/dist/buttons.js +708 -606
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +707 -605
- package/dist/buttons.mjs.map +1 -1
- package/dist/core-Bc5Wj_pc.d.ts +497 -0
- package/dist/core-D4048_K5.d.mts +497 -0
- package/dist/core.d.mts +6 -422
- package/dist/core.d.ts +6 -422
- package/dist/core.js +223 -129
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +224 -130
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +85 -61
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +85 -61
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +2 -2
- package/dist/forms.d.ts +2 -2
- package/dist/forms.js +70 -8
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +70 -8
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-sSt6PPLg.d.mts} +6 -0
- package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-sSt6PPLg.d.ts} +6 -0
- package/dist/index.css +6 -1
- package/dist/index.d.mts +68 -6
- package/dist/index.d.ts +68 -6
- package/dist/index.js +1177 -580
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1172 -583
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +18 -1
- package/dist/layout.d.ts +18 -1
- package/dist/layout.js +94 -8
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +94 -8
- package/dist/layout.mjs.map +1 -1
- package/dist/{md3-DFhj-NZj.d.mts → md3-Dty-Qcad.d.mts} +7 -1
- package/dist/{md3-DFhj-NZj.d.ts → md3-Dty-Qcad.d.ts} +7 -1
- package/dist/navigation.d.mts +134 -9
- package/dist/navigation.d.ts +134 -9
- package/dist/navigation.js +403 -93
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +397 -94
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +214 -189
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +176 -151
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +222 -197
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +189 -164
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-BRPuTqi1.d.mts → split-button-trailing-uncheckable-BcPD_7uK.d.ts} +73 -7
- package/dist/{split-button-trailing-uncheckable-CjOFCoyW.d.ts → split-button-trailing-uncheckable-DtFJkTFr.d.mts} +73 -7
- package/dist/{text-field-eAIpz9z1.d.mts → text-field-T4Rg-9Bw.d.mts} +7 -0
- package/dist/{text-field-eAIpz9z1.d.ts → text-field-T4Rg-9Bw.d.ts} +7 -0
- package/package.json +4 -4
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 React14 = 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 React14__namespace = /*#__PURE__*/_interopNamespace(React14);
|
|
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 = React14__namespace.memo(function IndeterminateSvg2({
|
|
113
113
|
size
|
|
114
114
|
}) {
|
|
115
|
-
const [ready, setReady] =
|
|
116
|
-
|
|
115
|
+
const [ready, setReady] = React14__namespace.useState(false);
|
|
116
|
+
React14__namespace.useEffect(() => {
|
|
117
117
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
118
118
|
return () => cancelAnimationFrame(raf);
|
|
119
119
|
}, []);
|
|
@@ -158,7 +158,7 @@ var IndeterminateSvg = React11__namespace.memo(function IndeterminateSvg2({
|
|
|
158
158
|
}
|
|
159
159
|
);
|
|
160
160
|
});
|
|
161
|
-
var DeterminateSvg =
|
|
161
|
+
var DeterminateSvg = React14__namespace.memo(function DeterminateSvg2({
|
|
162
162
|
size,
|
|
163
163
|
progress
|
|
164
164
|
}) {
|
|
@@ -183,7 +183,7 @@ var DeterminateSvg = React11__namespace.memo(function DeterminateSvg2({
|
|
|
183
183
|
}
|
|
184
184
|
);
|
|
185
185
|
});
|
|
186
|
-
var LoadingIndicator =
|
|
186
|
+
var LoadingIndicator = React14__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 = React14__namespace.forwardRef(
|
|
302
302
|
(_a, ref) => {
|
|
303
303
|
var _b = _a, {
|
|
304
304
|
value,
|
|
@@ -336,15 +336,15 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
336
336
|
const isWavy = shape === "wavy";
|
|
337
337
|
const BASELINE_SIZE = 48;
|
|
338
338
|
const scaleFactor = size / BASELINE_SIZE;
|
|
339
|
-
const effectiveAmplitude =
|
|
339
|
+
const effectiveAmplitude = React14__namespace.useMemo(
|
|
340
340
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
341
341
|
[amplitude, scaleFactor]
|
|
342
342
|
);
|
|
343
|
-
const effectiveWavelength =
|
|
343
|
+
const effectiveWavelength = React14__namespace.useMemo(
|
|
344
344
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
345
345
|
[wavelength, scaleFactor]
|
|
346
346
|
);
|
|
347
|
-
const wavyActivePath =
|
|
347
|
+
const wavyActivePath = React14__namespace.useMemo(
|
|
348
348
|
() => isWavy ? generateWavyCircularPath(
|
|
349
349
|
center,
|
|
350
350
|
radius,
|
|
@@ -353,8 +353,8 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
353
353
|
) : null,
|
|
354
354
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
355
355
|
);
|
|
356
|
-
const circumference =
|
|
357
|
-
const gapForTrack =
|
|
356
|
+
const circumference = React14__namespace.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
357
|
+
const gapForTrack = React14__namespace.useMemo(
|
|
358
358
|
() => (gapSize + trackHeight) / circumference,
|
|
359
359
|
[gapSize, trackHeight, circumference]
|
|
360
360
|
);
|
|
@@ -543,9 +543,9 @@ var CircularProgress = React11__namespace.forwardRef(
|
|
|
543
543
|
);
|
|
544
544
|
CircularProgress.displayName = "CircularProgress";
|
|
545
545
|
function useContainerWidth() {
|
|
546
|
-
const [width, setWidth] =
|
|
547
|
-
const observerRef =
|
|
548
|
-
const ref =
|
|
546
|
+
const [width, setWidth] = React14__namespace.useState(0);
|
|
547
|
+
const observerRef = React14__namespace.useRef(null);
|
|
548
|
+
const ref = React14__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
|
+
React14__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 React14__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 = React14__namespace.memo(function FlatLinearTrack2({
|
|
587
587
|
trackHeight,
|
|
588
588
|
activeColor,
|
|
589
589
|
trackColor,
|
|
@@ -659,7 +659,7 @@ var FlatLinearTrack = React11__namespace.memo(function FlatLinearTrack2({
|
|
|
659
659
|
}
|
|
660
660
|
);
|
|
661
661
|
});
|
|
662
|
-
var WavyLinearTrack =
|
|
662
|
+
var WavyLinearTrack = React14__namespace.memo(function WavyLinearTrack2({
|
|
663
663
|
trackHeight,
|
|
664
664
|
svgHeight,
|
|
665
665
|
amplitude,
|
|
@@ -678,13 +678,13 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
678
678
|
}) {
|
|
679
679
|
const isDeterminate = typeof value === "number";
|
|
680
680
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
681
|
-
const titleId =
|
|
681
|
+
const titleId = React14__namespace.useId();
|
|
682
682
|
const [containerRef, width] = useContainerWidth();
|
|
683
|
-
const activePathRef =
|
|
684
|
-
const trackPathRef =
|
|
683
|
+
const activePathRef = React14__namespace.useRef(null);
|
|
684
|
+
const trackPathRef = React14__namespace.useRef(null);
|
|
685
685
|
const amplitudeMV = react.useMotionValue(amplitude);
|
|
686
686
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
687
|
-
|
|
687
|
+
React14__namespace.useEffect(() => {
|
|
688
688
|
if (isDeterminate) {
|
|
689
689
|
const fraction = clampedValue / 100;
|
|
690
690
|
let targetAmp = amplitude;
|
|
@@ -855,7 +855,7 @@ var WavyLinearTrack = React11__namespace.memo(function WavyLinearTrack2({
|
|
|
855
855
|
}
|
|
856
856
|
);
|
|
857
857
|
});
|
|
858
|
-
var LinearProgress =
|
|
858
|
+
var LinearProgress = React14__namespace.forwardRef(
|
|
859
859
|
(_a, ref) => {
|
|
860
860
|
var _b = _a, {
|
|
861
861
|
value,
|
|
@@ -896,10 +896,10 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
896
896
|
]);
|
|
897
897
|
const isDeterminate = value !== void 0;
|
|
898
898
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
899
|
-
const containerRef =
|
|
899
|
+
const containerRef = React14__namespace.useRef(null);
|
|
900
900
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
901
|
-
const [isRtl, setIsRtl] =
|
|
902
|
-
|
|
901
|
+
const [isRtl, setIsRtl] = React14__namespace.useState(false);
|
|
902
|
+
React14__namespace.useEffect(() => {
|
|
903
903
|
if (containerRef.current) {
|
|
904
904
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
905
905
|
setIsRtl(dir === "rtl");
|
|
@@ -907,16 +907,16 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
907
907
|
}, []);
|
|
908
908
|
const isWavy = shape === "wavy";
|
|
909
909
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
910
|
-
const effectiveAmplitude =
|
|
911
|
-
const svgHeight =
|
|
910
|
+
const effectiveAmplitude = React14__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
911
|
+
const svgHeight = React14__namespace.useMemo(
|
|
912
912
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
913
913
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
914
914
|
);
|
|
915
|
-
const shouldShowStop =
|
|
915
|
+
const shouldShowStop = React14__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 = React14__namespace.useMemo(
|
|
920
920
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
921
921
|
[trackHeight]
|
|
922
922
|
);
|
|
@@ -989,14 +989,14 @@ var LinearProgress = React11__namespace.forwardRef(
|
|
|
989
989
|
}
|
|
990
990
|
);
|
|
991
991
|
LinearProgress.displayName = "LinearProgress";
|
|
992
|
-
var ProgressIndicator =
|
|
992
|
+
var ProgressIndicator = React14__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 = React14__namespace.memo(function RippleItem2({
|
|
1000
1000
|
ripple,
|
|
1001
1001
|
onDone
|
|
1002
1002
|
}) {
|
|
@@ -1040,8 +1040,8 @@ 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] = React14__namespace.useState([]);
|
|
1044
|
+
const onPointerDown = React14__namespace.useCallback(
|
|
1045
1045
|
(e) => {
|
|
1046
1046
|
if (disabled) return;
|
|
1047
1047
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1055,7 +1055,7 @@ function useRippleState(options = {}) {
|
|
|
1055
1055
|
},
|
|
1056
1056
|
[disabled]
|
|
1057
1057
|
);
|
|
1058
|
-
const removeRipple =
|
|
1058
|
+
const removeRipple = React14__namespace.useCallback((id) => {
|
|
1059
1059
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1060
1060
|
}, []);
|
|
1061
1061
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1231,6 +1231,35 @@ var BUTTON_COLOR_TOKENS = {
|
|
|
1231
1231
|
default: "bg-transparent text-m3-primary",
|
|
1232
1232
|
selected: "bg-transparent text-m3-primary",
|
|
1233
1233
|
unselected: "bg-transparent text-m3-primary"
|
|
1234
|
+
},
|
|
1235
|
+
// ── MD3 Expressive accent variants ──────────────────────────────────────
|
|
1236
|
+
/**
|
|
1237
|
+
* High-chroma tertiary tone. Use for hero CTAs and expressive moments where
|
|
1238
|
+
* a distinct accent beyond primary is needed (e.g., hero chip, highlight fab).
|
|
1239
|
+
*/
|
|
1240
|
+
tertiary: {
|
|
1241
|
+
default: "bg-m3-tertiary text-m3-on-tertiary",
|
|
1242
|
+
selected: "bg-m3-tertiary text-m3-on-tertiary",
|
|
1243
|
+
unselected: "bg-m3-tertiary-container text-m3-on-tertiary-container"
|
|
1244
|
+
},
|
|
1245
|
+
/**
|
|
1246
|
+
* Brand-stable primary fixed. Hue stays consistent across light and dark modes.
|
|
1247
|
+
* Ideal for badges, pill chips, and elements that must carry the brand color
|
|
1248
|
+
* regardless of the active theme.
|
|
1249
|
+
*/
|
|
1250
|
+
"primary-fixed": {
|
|
1251
|
+
default: "bg-m3-primary-fixed text-m3-on-primary-fixed",
|
|
1252
|
+
selected: "bg-m3-primary-fixed text-m3-on-primary-fixed",
|
|
1253
|
+
unselected: "bg-m3-primary-fixed text-m3-on-primary-fixed-variant"
|
|
1254
|
+
},
|
|
1255
|
+
/**
|
|
1256
|
+
* Brand-stable tertiary fixed. Use for special-state indicators, achievement
|
|
1257
|
+
* badges, or accent pills that need a fixed tertiary hue across themes.
|
|
1258
|
+
*/
|
|
1259
|
+
"tertiary-fixed": {
|
|
1260
|
+
default: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed",
|
|
1261
|
+
selected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed",
|
|
1262
|
+
unselected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed-variant"
|
|
1234
1263
|
}
|
|
1235
1264
|
};
|
|
1236
1265
|
var MOTION_PROP_KEYS = [
|
|
@@ -1282,7 +1311,7 @@ function AnimatedIconSlot({
|
|
|
1282
1311
|
}
|
|
1283
1312
|
);
|
|
1284
1313
|
}
|
|
1285
|
-
var ButtonComponent =
|
|
1314
|
+
var ButtonComponent = React14__namespace.forwardRef(
|
|
1286
1315
|
(_a, ref) => {
|
|
1287
1316
|
var _b = _a, {
|
|
1288
1317
|
className,
|
|
@@ -1344,9 +1373,9 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1344
1373
|
borderWidth: outlineWidth != null ? outlineWidth : colorStyle === "outlined" ? sizeTokens.outlineWidth : 0,
|
|
1345
1374
|
borderStyle: colorStyle === "outlined" ? "solid" : void 0
|
|
1346
1375
|
}, style);
|
|
1347
|
-
const labelText =
|
|
1376
|
+
const labelText = React14__namespace.useMemo(() => {
|
|
1348
1377
|
if (asChild) {
|
|
1349
|
-
const child =
|
|
1378
|
+
const child = React14__namespace.Children.only(children);
|
|
1350
1379
|
return child.props.children;
|
|
1351
1380
|
}
|
|
1352
1381
|
return children;
|
|
@@ -1354,8 +1383,8 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1354
1383
|
const computedAriaLabel = ariaLabelProp || (typeof children === "string" ? children : void 0);
|
|
1355
1384
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1356
1385
|
const motionRadius = react.useMotionValue(animateRadius);
|
|
1357
|
-
const asChildRef =
|
|
1358
|
-
const mergedRef =
|
|
1386
|
+
const asChildRef = React14__namespace.useRef(null);
|
|
1387
|
+
const mergedRef = React14__namespace.useCallback(
|
|
1359
1388
|
(node) => {
|
|
1360
1389
|
asChildRef.current = node;
|
|
1361
1390
|
if (typeof ref === "function") ref(node);
|
|
@@ -1364,14 +1393,14 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1364
1393
|
},
|
|
1365
1394
|
[ref]
|
|
1366
1395
|
);
|
|
1367
|
-
|
|
1396
|
+
React14__namespace.useEffect(() => {
|
|
1368
1397
|
if (!asChild) return;
|
|
1369
1398
|
return motionRadius.on("change", (v) => {
|
|
1370
1399
|
if (asChildRef.current)
|
|
1371
1400
|
asChildRef.current.style.borderRadius = `${v}px`;
|
|
1372
1401
|
});
|
|
1373
1402
|
}, [motionRadius, asChild]);
|
|
1374
|
-
|
|
1403
|
+
React14__namespace.useEffect(() => {
|
|
1375
1404
|
if (!asChild) return;
|
|
1376
1405
|
const controls = springAnimate(motionRadius, animateRadius);
|
|
1377
1406
|
return () => controls.stop();
|
|
@@ -1379,14 +1408,14 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1379
1408
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1380
1409
|
disabled: loading
|
|
1381
1410
|
});
|
|
1382
|
-
const handleClick =
|
|
1411
|
+
const handleClick = React14__namespace.useCallback(
|
|
1383
1412
|
(e) => {
|
|
1384
1413
|
if (loading) return e.preventDefault();
|
|
1385
1414
|
onClick == null ? void 0 : onClick(e);
|
|
1386
1415
|
},
|
|
1387
1416
|
[loading, onClick]
|
|
1388
1417
|
);
|
|
1389
|
-
const handleKeyDown =
|
|
1418
|
+
const handleKeyDown = React14__namespace.useCallback(
|
|
1390
1419
|
(e) => {
|
|
1391
1420
|
if (loading) return;
|
|
1392
1421
|
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
@@ -1461,17 +1490,17 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1461
1490
|
}
|
|
1462
1491
|
) })
|
|
1463
1492
|
] });
|
|
1464
|
-
const handleAsChildPointerDown =
|
|
1493
|
+
const handleAsChildPointerDown = React14__namespace.useCallback(
|
|
1465
1494
|
(e) => {
|
|
1466
1495
|
springAnimate(motionRadius, pressedRadius);
|
|
1467
1496
|
onPointerDown == null ? void 0 : onPointerDown(e);
|
|
1468
1497
|
},
|
|
1469
1498
|
[motionRadius, pressedRadius, onPointerDown]
|
|
1470
1499
|
);
|
|
1471
|
-
const handleAsChildPointerUp =
|
|
1500
|
+
const handleAsChildPointerUp = React14__namespace.useCallback(() => {
|
|
1472
1501
|
springAnimate(motionRadius, animateRadius);
|
|
1473
1502
|
}, [motionRadius, animateRadius]);
|
|
1474
|
-
const handlePointerDown =
|
|
1503
|
+
const handlePointerDown = React14__namespace.useCallback(
|
|
1475
1504
|
(e) => {
|
|
1476
1505
|
onPointerDown(e);
|
|
1477
1506
|
},
|
|
@@ -1481,7 +1510,7 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1481
1510
|
const strippedProps = __spreadValues({}, restProps);
|
|
1482
1511
|
for (const key of MOTION_PROP_KEYS) delete strippedProps[key];
|
|
1483
1512
|
const htmlProps = strippedProps;
|
|
1484
|
-
const child =
|
|
1513
|
+
const child = React14__namespace.Children.only(children);
|
|
1485
1514
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1486
1515
|
reactSlot.Slot,
|
|
1487
1516
|
__spreadProps(__spreadValues({
|
|
@@ -1498,7 +1527,7 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1498
1527
|
}),
|
|
1499
1528
|
className: buttonClassName
|
|
1500
1529
|
}, htmlProps), {
|
|
1501
|
-
children:
|
|
1530
|
+
children: React14__namespace.cloneElement(child, { children: innerContent })
|
|
1502
1531
|
})
|
|
1503
1532
|
) });
|
|
1504
1533
|
}
|
|
@@ -1527,13 +1556,13 @@ var ButtonComponent = React11__namespace.forwardRef(
|
|
|
1527
1556
|
}
|
|
1528
1557
|
);
|
|
1529
1558
|
ButtonComponent.displayName = "Button";
|
|
1530
|
-
var Button =
|
|
1559
|
+
var Button = React14__namespace.memo(ButtonComponent);
|
|
1531
1560
|
var VARIANT_FONT = {
|
|
1532
1561
|
outlined: "'Material Symbols Outlined'",
|
|
1533
1562
|
rounded: "'Material Symbols Rounded'",
|
|
1534
1563
|
sharp: "'Material Symbols Sharp'"
|
|
1535
1564
|
};
|
|
1536
|
-
var IconComponent =
|
|
1565
|
+
var IconComponent = React14__namespace.forwardRef(
|
|
1537
1566
|
(_a, ref) => {
|
|
1538
1567
|
var _b = _a, {
|
|
1539
1568
|
name,
|
|
@@ -1599,7 +1628,7 @@ var IconComponent = React11__namespace.forwardRef(
|
|
|
1599
1628
|
}
|
|
1600
1629
|
);
|
|
1601
1630
|
IconComponent.displayName = "Icon";
|
|
1602
|
-
var Icon =
|
|
1631
|
+
var Icon = React14__namespace.memo(IconComponent);
|
|
1603
1632
|
var BUTTON_GROUP_TOKENS = {
|
|
1604
1633
|
standard: {
|
|
1605
1634
|
betweenSpace: 12,
|
|
@@ -1687,7 +1716,7 @@ var PILL_BORDER_RADIUS = 9999;
|
|
|
1687
1716
|
var MIN_FLEX_GROW = 0.01;
|
|
1688
1717
|
var PADDING_EXPAND_MULTIPLIER = 4;
|
|
1689
1718
|
var CHECK_ICON_SIZE = 24;
|
|
1690
|
-
var CHECK_ICON = /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "check", size: CHECK_ICON_SIZE, weight: 700 });
|
|
1719
|
+
var CHECK_ICON = /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "check", variant: "rounded", size: CHECK_ICON_SIZE, weight: 700 });
|
|
1691
1720
|
var CHECK_ICON_GAP_MAP = {
|
|
1692
1721
|
xs: 6,
|
|
1693
1722
|
sm: 8,
|
|
@@ -1707,13 +1736,7 @@ var WIDTH_MORPH_SPRING = {
|
|
|
1707
1736
|
damping: 38,
|
|
1708
1737
|
mass: 0.85
|
|
1709
1738
|
};
|
|
1710
|
-
var
|
|
1711
|
-
type: "spring",
|
|
1712
|
-
stiffness: 430,
|
|
1713
|
-
damping: 38,
|
|
1714
|
-
mass: 0.8
|
|
1715
|
-
};
|
|
1716
|
-
var AnimatedCheckLabel = React11__namespace.memo(function AnimatedCheckLabel2({
|
|
1739
|
+
var AnimatedCheckLabel = React14__namespace.memo(function AnimatedCheckLabel2({
|
|
1717
1740
|
selected,
|
|
1718
1741
|
size,
|
|
1719
1742
|
children
|
|
@@ -1750,23 +1773,6 @@ var AnimatedCheckLabel = React11__namespace.memo(function AnimatedCheckLabel2({
|
|
|
1750
1773
|
}
|
|
1751
1774
|
);
|
|
1752
1775
|
});
|
|
1753
|
-
var AnimatedNavbarLabel = React11__namespace.memo(function AnimatedNavbarLabel2({
|
|
1754
|
-
show,
|
|
1755
|
-
children
|
|
1756
|
-
}) {
|
|
1757
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, mode: "popLayout", children: show && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1758
|
-
react.m.span,
|
|
1759
|
-
{
|
|
1760
|
-
initial: { width: 0, opacity: 0, scale: 0.8 },
|
|
1761
|
-
animate: { width: "auto", opacity: 1, scale: 1 },
|
|
1762
|
-
exit: { width: 0, opacity: 0, scale: 0.8 },
|
|
1763
|
-
transition: NAVBAR_EXPRESSIVE_SPRING,
|
|
1764
|
-
className: "overflow-hidden whitespace-nowrap text-sm font-semibold tracking-[0.01em] ml-1.5",
|
|
1765
|
-
children
|
|
1766
|
-
},
|
|
1767
|
-
"navbar-label"
|
|
1768
|
-
) });
|
|
1769
|
-
});
|
|
1770
1776
|
function resolveConnectedShapes(variant, orientation, isFirst, isLast, itemSize) {
|
|
1771
1777
|
const defaults = ButtonGroupDefaults.connectedLeadingButtonShapes(itemSize);
|
|
1772
1778
|
if (variant !== "connected") return defaults;
|
|
@@ -1787,7 +1793,7 @@ function resolveConnectedShapes(variant, orientation, isFirst, isLast, itemSize)
|
|
|
1787
1793
|
}
|
|
1788
1794
|
return defaults;
|
|
1789
1795
|
}
|
|
1790
|
-
function resolveIconAndLabel(element, isSelected, itemSize,
|
|
1796
|
+
function resolveIconAndLabel(element, isSelected, itemSize, showCheck, iconBehavior, labelBehavior) {
|
|
1791
1797
|
let icon = element.props.icon;
|
|
1792
1798
|
let label = element.props.children;
|
|
1793
1799
|
const animateCheckInLabel = showCheck && iconBehavior !== "none" && iconBehavior !== "selected" && label !== void 0;
|
|
@@ -1803,9 +1809,6 @@ function resolveIconAndLabel(element, isSelected, itemSize, variant, showCheck,
|
|
|
1803
1809
|
}
|
|
1804
1810
|
if (animateCheckInLabel && label !== void 0) {
|
|
1805
1811
|
label = /* @__PURE__ */ jsxRuntime.jsx(AnimatedCheckLabel, { selected: isSelected, size: itemSize, children: label });
|
|
1806
|
-
} else if (variant === "navbar" && label !== void 0) {
|
|
1807
|
-
const showLabel = !labelBehavior || labelBehavior === "all" || labelBehavior === "selected" && isSelected;
|
|
1808
|
-
label = /* @__PURE__ */ jsxRuntime.jsx(AnimatedNavbarLabel, { show: showLabel, children: label });
|
|
1809
1812
|
}
|
|
1810
1813
|
return { icon, label };
|
|
1811
1814
|
}
|
|
@@ -1840,13 +1843,11 @@ function resolveFlexTargets(variant, orientation, isSelected, isPressed, hasSele
|
|
|
1840
1843
|
function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex, existingAnimate, existingWhileTap) {
|
|
1841
1844
|
var _a, _b;
|
|
1842
1845
|
const props = { animate: __spreadValues({}, existingAnimate) };
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
props.animate.paddingInline = flex.paddingInline;
|
|
1849
|
-
}
|
|
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;
|
|
1850
1851
|
}
|
|
1851
1852
|
if (variant === "standard") {
|
|
1852
1853
|
const pressedRadius = (_a = PRESSED_RADIUS_MAP[itemSize]) != null ? _a : PRESSED_RADIUS_MAP.sm;
|
|
@@ -1897,16 +1898,9 @@ function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex
|
|
|
1897
1898
|
});
|
|
1898
1899
|
props.layout = true;
|
|
1899
1900
|
}
|
|
1900
|
-
if (variant === "navbar") {
|
|
1901
|
-
props.layout = true;
|
|
1902
|
-
props.transition = {
|
|
1903
|
-
layout: WIDTH_MORPH_SPRING,
|
|
1904
|
-
default: BUTTON_SHAPE_MORPH_SPRING
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
1901
|
return props;
|
|
1908
1902
|
}
|
|
1909
|
-
var ButtonGroupComponent =
|
|
1903
|
+
var ButtonGroupComponent = React14__namespace.forwardRef(
|
|
1910
1904
|
(_a, ref) => {
|
|
1911
1905
|
var _b = _a, {
|
|
1912
1906
|
className,
|
|
@@ -1939,13 +1933,12 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
1939
1933
|
"labelBehavior",
|
|
1940
1934
|
"style"
|
|
1941
1935
|
]);
|
|
1942
|
-
const [pressedIndex, setPressedIndex] =
|
|
1943
|
-
const [lockedGroupSize, setLockedGroupSize] =
|
|
1936
|
+
const [pressedIndex, setPressedIndex] = React14__namespace.useState(null);
|
|
1937
|
+
const [lockedGroupSize, setLockedGroupSize] = React14__namespace.useState(
|
|
1944
1938
|
null
|
|
1945
1939
|
);
|
|
1946
|
-
const
|
|
1947
|
-
const
|
|
1948
|
-
const setRootRef = React11__namespace.useCallback(
|
|
1940
|
+
const rootRef = React14__namespace.useRef(null);
|
|
1941
|
+
const setRootRef = React14__namespace.useCallback(
|
|
1949
1942
|
(node) => {
|
|
1950
1943
|
rootRef.current = node;
|
|
1951
1944
|
if (typeof ref === "function") {
|
|
@@ -1956,12 +1949,12 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
1956
1949
|
},
|
|
1957
1950
|
[ref]
|
|
1958
1951
|
);
|
|
1959
|
-
const childrenArray =
|
|
1960
|
-
() =>
|
|
1952
|
+
const childrenArray = React14__namespace.useMemo(
|
|
1953
|
+
() => React14__namespace.Children.toArray(children).filter(React14__namespace.isValidElement),
|
|
1961
1954
|
[children]
|
|
1962
1955
|
);
|
|
1963
1956
|
const count = childrenArray.length;
|
|
1964
|
-
const groupSizeSignature =
|
|
1957
|
+
const groupSizeSignature = React14__namespace.useMemo(
|
|
1965
1958
|
() => `${childrenArray.map((child, index) => {
|
|
1966
1959
|
var _a2, _b2, _c, _d, _e;
|
|
1967
1960
|
const element = child;
|
|
@@ -1976,8 +1969,8 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
1976
1969
|
}).join("|")}|${variant}|${orientation}|${showCheck}`,
|
|
1977
1970
|
[childrenArray, orientation, showCheck, size, variant]
|
|
1978
1971
|
);
|
|
1979
|
-
const groupSizeSignatureRef =
|
|
1980
|
-
|
|
1972
|
+
const groupSizeSignatureRef = React14__namespace.useRef(groupSizeSignature);
|
|
1973
|
+
React14__namespace.useLayoutEffect(() => {
|
|
1981
1974
|
if (groupSizeSignatureRef.current !== groupSizeSignature) {
|
|
1982
1975
|
groupSizeSignatureRef.current = groupSizeSignature;
|
|
1983
1976
|
setLockedGroupSize(null);
|
|
@@ -1985,7 +1978,7 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
1985
1978
|
}, [groupSizeSignature]);
|
|
1986
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;
|
|
1987
1980
|
const shouldLockGroupSize = activeMorphing && !fullWidth && !hasExplicitGroupSize && count > 1;
|
|
1988
|
-
|
|
1981
|
+
React14__namespace.useLayoutEffect(() => {
|
|
1989
1982
|
if (!shouldLockGroupSize) {
|
|
1990
1983
|
if (lockedGroupSize !== null) setLockedGroupSize(null);
|
|
1991
1984
|
return;
|
|
@@ -1999,7 +1992,7 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
1999
1992
|
setLockedGroupSize(Math.ceil(nextSize * 100) / 100);
|
|
2000
1993
|
}
|
|
2001
1994
|
}, [lockedGroupSize, orientation, shouldLockGroupSize]);
|
|
2002
|
-
const groupStyle =
|
|
1995
|
+
const groupStyle = React14__namespace.useMemo(() => {
|
|
2003
1996
|
const nextStyle = __spreadValues({}, style);
|
|
2004
1997
|
if (shouldLockGroupSize && lockedGroupSize !== null) {
|
|
2005
1998
|
if (orientation === "horizontal") {
|
|
@@ -2010,13 +2003,13 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2010
2003
|
}
|
|
2011
2004
|
return nextStyle;
|
|
2012
2005
|
}, [lockedGroupSize, orientation, shouldLockGroupSize, style]);
|
|
2013
|
-
const hasSelected =
|
|
2006
|
+
const hasSelected = React14__namespace.useMemo(
|
|
2014
2007
|
() => childrenArray.some(
|
|
2015
2008
|
(child) => child.props.selected
|
|
2016
2009
|
),
|
|
2017
2010
|
[childrenArray]
|
|
2018
2011
|
);
|
|
2019
|
-
const handlePointerLeaveAndUp =
|
|
2012
|
+
const handlePointerLeaveAndUp = React14__namespace.useCallback(() => {
|
|
2020
2013
|
setPressedIndex(null);
|
|
2021
2014
|
}, []);
|
|
2022
2015
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2026,7 +2019,7 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2026
2019
|
className: cn(
|
|
2027
2020
|
"inline-flex p-0 m-0 border-none max-w-full [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2028
2021
|
orientation === "vertical" ? "flex-col items-stretch overflow-y-auto overflow-x-hidden" : "flex-row overflow-x-auto overflow-y-hidden",
|
|
2029
|
-
variant === "standard" ? "gap-3" :
|
|
2022
|
+
variant === "standard" ? "gap-3" : "gap-0.5",
|
|
2030
2023
|
fullWidth && "w-full",
|
|
2031
2024
|
fullWidth && orientation === "vertical" && "h-full",
|
|
2032
2025
|
className
|
|
@@ -2036,7 +2029,7 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2036
2029
|
onPointerUp: handlePointerLeaveAndUp
|
|
2037
2030
|
}, props), {
|
|
2038
2031
|
children: childrenArray.map((child, index) => {
|
|
2039
|
-
var _a2, _b2
|
|
2032
|
+
var _a2, _b2;
|
|
2040
2033
|
const element = child;
|
|
2041
2034
|
const isSelected = element.props.selected === true;
|
|
2042
2035
|
const isFirst = index === 0;
|
|
@@ -2048,7 +2041,6 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2048
2041
|
element,
|
|
2049
2042
|
isSelected,
|
|
2050
2043
|
itemSize,
|
|
2051
|
-
variant,
|
|
2052
2044
|
showCheck,
|
|
2053
2045
|
iconBehavior,
|
|
2054
2046
|
labelBehavior
|
|
@@ -2074,7 +2066,7 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2074
2066
|
basePx
|
|
2075
2067
|
);
|
|
2076
2068
|
const dynamicStyle = __spreadValues({}, element.props.style);
|
|
2077
|
-
if (
|
|
2069
|
+
if (flex.flexGrow !== void 0 && fullWidth) {
|
|
2078
2070
|
dynamicStyle.flexBasis = 0;
|
|
2079
2071
|
dynamicStyle.flexShrink = 1;
|
|
2080
2072
|
dynamicStyle.minWidth = 0;
|
|
@@ -2092,13 +2084,7 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2092
2084
|
existingWhileTap
|
|
2093
2085
|
);
|
|
2094
2086
|
const connectedClasses = variant === "connected" && isSelected ? "z-20" : "";
|
|
2095
|
-
const
|
|
2096
|
-
flexBasis: fullWidth && labelBehavior !== "selected" ? 0 : "auto",
|
|
2097
|
-
flexShrink: fullWidth ? 1 : 0,
|
|
2098
|
-
flexGrow: flex.flexGrow,
|
|
2099
|
-
minWidth: labelBehavior !== "selected" ? 0 : "fit-content"
|
|
2100
|
-
} : {};
|
|
2101
|
-
const clonedElement = React11__namespace.cloneElement(element, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
2087
|
+
const clonedElement = React14__namespace.cloneElement(element, __spreadValues(__spreadProps(__spreadValues({
|
|
2102
2088
|
key: (_b2 = element.key) != null ? _b2 : index,
|
|
2103
2089
|
tabIndex: isFirst ? 0 : -1,
|
|
2104
2090
|
size: size || element.props.size,
|
|
@@ -2107,71 +2093,20 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2107
2093
|
}, variant === "connected" && {
|
|
2108
2094
|
colorStyle: element.props.colorStyle || "tonal",
|
|
2109
2095
|
selectedColorStyle: element.props.selectedColorStyle || "filled"
|
|
2110
|
-
}),
|
|
2111
|
-
colorStyle: "text",
|
|
2112
|
-
selectedColorStyle: "text",
|
|
2113
|
-
className: cn(
|
|
2114
|
-
element.props.className,
|
|
2115
|
-
"w-full! h-full! px-3! min-w-0! relative z-20 flex items-center justify-center",
|
|
2116
|
-
isSelected ? "text-m3-on-secondary-container! hover:bg-transparent! active:bg-transparent!" : "text-m3-on-surface-variant! hover:bg-transparent! active:bg-transparent!",
|
|
2117
|
-
itemClassName
|
|
2118
|
-
)
|
|
2119
|
-
}), variant !== "navbar" && {
|
|
2096
|
+
}), {
|
|
2120
2097
|
className: cn(
|
|
2121
2098
|
element.props.className,
|
|
2122
2099
|
connectedClasses,
|
|
2123
2100
|
"focus-visible:z-10 hover:z-10 relative min-w-0",
|
|
2124
2101
|
orientation === "vertical" && "w-full",
|
|
2125
2102
|
itemClassName
|
|
2126
|
-
)
|
|
2127
|
-
|
|
2128
|
-
style: variant === "navbar" ? __spreadProps(__spreadValues({}, dynamicStyle), { minWidth: 0 }) : dynamicStyle,
|
|
2103
|
+
),
|
|
2104
|
+
style: dynamicStyle,
|
|
2129
2105
|
onPointerDown: (e) => {
|
|
2130
2106
|
setPressedIndex(index);
|
|
2131
2107
|
if (element.props.onPointerDown) element.props.onPointerDown(e);
|
|
2132
2108
|
}
|
|
2133
2109
|
}), motionProps));
|
|
2134
|
-
if (variant === "navbar") {
|
|
2135
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2136
|
-
react.m.div,
|
|
2137
|
-
{
|
|
2138
|
-
layout: true,
|
|
2139
|
-
whileTap: { scale: 0.96 },
|
|
2140
|
-
transition: NAVBAR_EXPRESSIVE_SPRING,
|
|
2141
|
-
className: "group relative h-full flex items-center justify-center min-w-0",
|
|
2142
|
-
style: navbarFlexStyle,
|
|
2143
|
-
children: [
|
|
2144
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2145
|
-
"div",
|
|
2146
|
-
{
|
|
2147
|
-
className: "absolute inset-x-1 inset-y-0 m-auto flex items-center justify-center pointer-events-none",
|
|
2148
|
-
style: { zIndex: 1 },
|
|
2149
|
-
children: [
|
|
2150
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2151
|
-
"div",
|
|
2152
|
-
{
|
|
2153
|
-
className: "w-full h-[40px] bg-m3-on-surface-variant/8 opacity-0 group-hover:opacity-100 transition-opacity duration-200",
|
|
2154
|
-
style: { borderRadius: PILL_BORDER_RADIUS }
|
|
2155
|
-
}
|
|
2156
|
-
),
|
|
2157
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2158
|
-
react.m.div,
|
|
2159
|
-
{
|
|
2160
|
-
layoutId: `navbar-active-indicator-${layoutIdGroup}`,
|
|
2161
|
-
className: "absolute inset-0 m-auto w-full h-[40px] bg-m3-secondary-container",
|
|
2162
|
-
style: { borderRadius: PILL_BORDER_RADIUS },
|
|
2163
|
-
transition: NAVBAR_EXPRESSIVE_SPRING
|
|
2164
|
-
}
|
|
2165
|
-
) })
|
|
2166
|
-
]
|
|
2167
|
-
}
|
|
2168
|
-
),
|
|
2169
|
-
clonedElement
|
|
2170
|
-
]
|
|
2171
|
-
},
|
|
2172
|
-
(_c = element.key) != null ? _c : index
|
|
2173
|
-
);
|
|
2174
|
-
}
|
|
2175
2110
|
return clonedElement;
|
|
2176
2111
|
})
|
|
2177
2112
|
})
|
|
@@ -2179,7 +2114,7 @@ var ButtonGroupComponent = React11__namespace.forwardRef(
|
|
|
2179
2114
|
}
|
|
2180
2115
|
);
|
|
2181
2116
|
ButtonGroupComponent.displayName = "ButtonGroup";
|
|
2182
|
-
var ButtonGroup =
|
|
2117
|
+
var ButtonGroup = React14__namespace.memo(ButtonGroupComponent);
|
|
2183
2118
|
var SIZE_HEIGHT = {
|
|
2184
2119
|
sm: "h-14",
|
|
2185
2120
|
md: "h-20",
|
|
@@ -2234,9 +2169,9 @@ var COLOR_CLASSES = {
|
|
|
2234
2169
|
}
|
|
2235
2170
|
};
|
|
2236
2171
|
function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
2237
|
-
const [collapsed, setCollapsed] =
|
|
2238
|
-
const lastScrollY =
|
|
2239
|
-
|
|
2172
|
+
const [collapsed, setCollapsed] = React14__namespace.useState(false);
|
|
2173
|
+
const lastScrollY = React14__namespace.useRef(0);
|
|
2174
|
+
React14__namespace.useEffect(() => {
|
|
2240
2175
|
if (!enabled || typeof window === "undefined") return;
|
|
2241
2176
|
lastScrollY.current = window.scrollY;
|
|
2242
2177
|
const handleScroll = () => {
|
|
@@ -2259,7 +2194,7 @@ function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
|
2259
2194
|
}, [enabled, scrollThreshold, collapsed, onCollapsedChange]);
|
|
2260
2195
|
return collapsed;
|
|
2261
2196
|
}
|
|
2262
|
-
var ExtendedFABComponent =
|
|
2197
|
+
var ExtendedFABComponent = React14__namespace.forwardRef(
|
|
2263
2198
|
(_a, ref) => {
|
|
2264
2199
|
var _b = _a, {
|
|
2265
2200
|
className,
|
|
@@ -2276,6 +2211,8 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2276
2211
|
scrollThreshold = 50,
|
|
2277
2212
|
collapsed,
|
|
2278
2213
|
onCollapsedChange,
|
|
2214
|
+
asChild = false,
|
|
2215
|
+
children,
|
|
2279
2216
|
onClick,
|
|
2280
2217
|
onKeyDown,
|
|
2281
2218
|
layoutId,
|
|
@@ -2295,16 +2232,18 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2295
2232
|
"scrollThreshold",
|
|
2296
2233
|
"collapsed",
|
|
2297
2234
|
"onCollapsedChange",
|
|
2235
|
+
"asChild",
|
|
2236
|
+
"children",
|
|
2298
2237
|
"onClick",
|
|
2299
2238
|
"onKeyDown",
|
|
2300
2239
|
"layoutId",
|
|
2301
2240
|
"aria-label"
|
|
2302
2241
|
]);
|
|
2303
2242
|
var _a2, _b2, _c, _d;
|
|
2304
|
-
const localRef =
|
|
2305
|
-
|
|
2306
|
-
const [dir, setDir] =
|
|
2307
|
-
|
|
2243
|
+
const localRef = React14__namespace.useRef(null);
|
|
2244
|
+
React14__namespace.useImperativeHandle(ref, () => localRef.current);
|
|
2245
|
+
const [dir, setDir] = React14__namespace.useState("ltr");
|
|
2246
|
+
React14__namespace.useEffect(() => {
|
|
2308
2247
|
var _a3;
|
|
2309
2248
|
if (!localRef.current) return;
|
|
2310
2249
|
const closestDir = (_a3 = localRef.current.closest("[dir]")) == null ? void 0 : _a3.getAttribute("dir");
|
|
@@ -2325,7 +2264,7 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2325
2264
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2326
2265
|
disabled: loading
|
|
2327
2266
|
});
|
|
2328
|
-
const handleClick =
|
|
2267
|
+
const handleClick = React14__namespace.useCallback(
|
|
2329
2268
|
(e) => {
|
|
2330
2269
|
if (loading) {
|
|
2331
2270
|
e.preventDefault();
|
|
@@ -2335,7 +2274,7 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2335
2274
|
},
|
|
2336
2275
|
[loading, onClick]
|
|
2337
2276
|
);
|
|
2338
|
-
const handleKeyDown =
|
|
2277
|
+
const handleKeyDown = React14__namespace.useCallback(
|
|
2339
2278
|
(e) => {
|
|
2340
2279
|
if (loading) return;
|
|
2341
2280
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2346,7 +2285,109 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2346
2285
|
},
|
|
2347
2286
|
[loading, onClick, onKeyDown]
|
|
2348
2287
|
);
|
|
2349
|
-
|
|
2288
|
+
const containerClassName = cn(
|
|
2289
|
+
"relative shrink-0 inline-flex items-center select-none cursor-pointer overflow-hidden",
|
|
2290
|
+
"transition-[box-shadow,filter] duration-200",
|
|
2291
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2292
|
+
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2293
|
+
colors.bg,
|
|
2294
|
+
colors.text,
|
|
2295
|
+
lowered ? "shadow-sm" : "shadow-md",
|
|
2296
|
+
(_d = SIZE_HEIGHT[size]) != null ? _d : "h-14",
|
|
2297
|
+
SIZE_TEXT[size],
|
|
2298
|
+
isCollapsed ? cn("px-0 justify-center", SIZE_WIDTH_COLLAPSED[size]) : cn(
|
|
2299
|
+
hasIcon ? "justify-start" : "justify-center",
|
|
2300
|
+
SIZE_PADDING[size],
|
|
2301
|
+
hasIcon && SIZE_GAP[size]
|
|
2302
|
+
),
|
|
2303
|
+
dir === "rtl" || restProps.dir === "rtl" ? "flex-row-reverse" : "flex-row",
|
|
2304
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2305
|
+
className
|
|
2306
|
+
);
|
|
2307
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2308
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2309
|
+
hasIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2310
|
+
react.m.span,
|
|
2311
|
+
{
|
|
2312
|
+
layout: "position",
|
|
2313
|
+
className: cn(
|
|
2314
|
+
"flex items-center justify-center shrink-0",
|
|
2315
|
+
sizeIcon.cls
|
|
2316
|
+
),
|
|
2317
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2318
|
+
react.m.span,
|
|
2319
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2320
|
+
transition: SPRING_TRANSITION,
|
|
2321
|
+
className: "flex items-center justify-center shrink-0 w-full h-full",
|
|
2322
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2323
|
+
LoadingIndicator,
|
|
2324
|
+
{
|
|
2325
|
+
size: sizeIcon.px,
|
|
2326
|
+
color: "currentColor",
|
|
2327
|
+
"aria-label": "Loading"
|
|
2328
|
+
}
|
|
2329
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2330
|
+
ProgressIndicator,
|
|
2331
|
+
{
|
|
2332
|
+
variant: "circular",
|
|
2333
|
+
size: sizeIcon.px,
|
|
2334
|
+
color: "currentColor",
|
|
2335
|
+
trackColor: "transparent",
|
|
2336
|
+
"aria-label": "Loading"
|
|
2337
|
+
}
|
|
2338
|
+
)
|
|
2339
|
+
}),
|
|
2340
|
+
"loading"
|
|
2341
|
+
) : icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2342
|
+
react.m.span,
|
|
2343
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2344
|
+
transition: SPRING_TRANSITION,
|
|
2345
|
+
"aria-hidden": "true",
|
|
2346
|
+
className: "flex items-center justify-center shrink-0 w-full h-full [&>svg]:w-full [&>svg]:h-full",
|
|
2347
|
+
children: icon
|
|
2348
|
+
}),
|
|
2349
|
+
"icon"
|
|
2350
|
+
) })
|
|
2351
|
+
}
|
|
2352
|
+
),
|
|
2353
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: !isCollapsed && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2354
|
+
react.m.span,
|
|
2355
|
+
{
|
|
2356
|
+
layout: "position",
|
|
2357
|
+
initial: { opacity: 0, width: 0 },
|
|
2358
|
+
animate: { opacity: 1, width: "auto" },
|
|
2359
|
+
exit: { opacity: 0, width: 0 },
|
|
2360
|
+
transition: {
|
|
2361
|
+
opacity: { duration: 0.15, ease: "linear" },
|
|
2362
|
+
width: SPRING_TRANSITION
|
|
2363
|
+
},
|
|
2364
|
+
className: "overflow-hidden whitespace-nowrap",
|
|
2365
|
+
children: label
|
|
2366
|
+
},
|
|
2367
|
+
"label"
|
|
2368
|
+
) })
|
|
2369
|
+
] });
|
|
2370
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: visible && !(isCollapsed && !hasIcon) && (asChild ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2371
|
+
reactSlot.Slot,
|
|
2372
|
+
__spreadProps(__spreadValues({
|
|
2373
|
+
ref: localRef,
|
|
2374
|
+
"aria-label": ariaLabel || label,
|
|
2375
|
+
"aria-busy": loading || void 0,
|
|
2376
|
+
"aria-disabled": loading || restProps.disabled,
|
|
2377
|
+
onClick: handleClick,
|
|
2378
|
+
onPointerDown,
|
|
2379
|
+
onKeyDown: handleKeyDown,
|
|
2380
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
2381
|
+
borderRadius: `${radiusConfig.default}px`
|
|
2382
|
+
}),
|
|
2383
|
+
className: containerClassName
|
|
2384
|
+
}, restProps), {
|
|
2385
|
+
children: React14__namespace.cloneElement(
|
|
2386
|
+
React14__namespace.Children.only(children),
|
|
2387
|
+
{ children: innerContent }
|
|
2388
|
+
)
|
|
2389
|
+
})
|
|
2390
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2350
2391
|
react.m.button,
|
|
2351
2392
|
__spreadProps(__spreadValues({
|
|
2352
2393
|
ref: localRef,
|
|
@@ -2378,95 +2419,15 @@ var ExtendedFABComponent = React11__namespace.forwardRef(
|
|
|
2378
2419
|
opacity: { duration: 0.2, ease: "linear" },
|
|
2379
2420
|
layout: SPRING_TRANSITION
|
|
2380
2421
|
},
|
|
2381
|
-
className:
|
|
2382
|
-
"relative shrink-0 inline-flex items-center select-none cursor-pointer overflow-hidden",
|
|
2383
|
-
"transition-[box-shadow,filter] duration-200",
|
|
2384
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2385
|
-
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2386
|
-
colors.bg,
|
|
2387
|
-
colors.text,
|
|
2388
|
-
lowered ? "shadow-sm" : "shadow-md",
|
|
2389
|
-
(_d = SIZE_HEIGHT[size]) != null ? _d : "h-14",
|
|
2390
|
-
SIZE_TEXT[size],
|
|
2391
|
-
isCollapsed ? cn("px-0 justify-center", SIZE_WIDTH_COLLAPSED[size]) : cn(
|
|
2392
|
-
hasIcon ? "justify-start" : "justify-center",
|
|
2393
|
-
SIZE_PADDING[size],
|
|
2394
|
-
hasIcon && SIZE_GAP[size]
|
|
2395
|
-
),
|
|
2396
|
-
dir === "rtl" || restProps.dir === "rtl" ? "flex-row-reverse" : "flex-row",
|
|
2397
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2398
|
-
className
|
|
2399
|
-
)
|
|
2422
|
+
className: containerClassName
|
|
2400
2423
|
}, restProps), {
|
|
2401
|
-
children:
|
|
2402
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2403
|
-
hasIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2404
|
-
react.m.span,
|
|
2405
|
-
{
|
|
2406
|
-
layout: "position",
|
|
2407
|
-
className: cn(
|
|
2408
|
-
"flex items-center justify-center shrink-0",
|
|
2409
|
-
sizeIcon.cls
|
|
2410
|
-
),
|
|
2411
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2412
|
-
react.m.span,
|
|
2413
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2414
|
-
transition: SPRING_TRANSITION,
|
|
2415
|
-
className: "flex items-center justify-center shrink-0 w-full h-full",
|
|
2416
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2417
|
-
LoadingIndicator,
|
|
2418
|
-
{
|
|
2419
|
-
size: sizeIcon.px,
|
|
2420
|
-
color: "currentColor",
|
|
2421
|
-
"aria-label": "Loading"
|
|
2422
|
-
}
|
|
2423
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2424
|
-
ProgressIndicator,
|
|
2425
|
-
{
|
|
2426
|
-
variant: "circular",
|
|
2427
|
-
size: sizeIcon.px,
|
|
2428
|
-
color: "currentColor",
|
|
2429
|
-
trackColor: "transparent",
|
|
2430
|
-
"aria-label": "Loading"
|
|
2431
|
-
}
|
|
2432
|
-
)
|
|
2433
|
-
}),
|
|
2434
|
-
"loading"
|
|
2435
|
-
) : icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2436
|
-
react.m.span,
|
|
2437
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2438
|
-
transition: SPRING_TRANSITION,
|
|
2439
|
-
"aria-hidden": "true",
|
|
2440
|
-
className: "flex items-center justify-center shrink-0 w-full h-full [&>svg]:w-full [&>svg]:h-full",
|
|
2441
|
-
children: icon
|
|
2442
|
-
}),
|
|
2443
|
-
"icon"
|
|
2444
|
-
) })
|
|
2445
|
-
}
|
|
2446
|
-
),
|
|
2447
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: !isCollapsed && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2448
|
-
react.m.span,
|
|
2449
|
-
{
|
|
2450
|
-
layout: "position",
|
|
2451
|
-
initial: { opacity: 0, width: 0 },
|
|
2452
|
-
animate: { opacity: 1, width: "auto" },
|
|
2453
|
-
exit: { opacity: 0, width: 0 },
|
|
2454
|
-
transition: {
|
|
2455
|
-
opacity: { duration: 0.15, ease: "linear" },
|
|
2456
|
-
width: SPRING_TRANSITION
|
|
2457
|
-
},
|
|
2458
|
-
className: "overflow-hidden whitespace-nowrap",
|
|
2459
|
-
children: label
|
|
2460
|
-
},
|
|
2461
|
-
"label"
|
|
2462
|
-
) })
|
|
2463
|
-
]
|
|
2424
|
+
children: innerContent
|
|
2464
2425
|
})
|
|
2465
|
-
) }) });
|
|
2426
|
+
)) }) });
|
|
2466
2427
|
}
|
|
2467
2428
|
);
|
|
2468
2429
|
ExtendedFABComponent.displayName = "ExtendedFAB";
|
|
2469
|
-
var ExtendedFAB =
|
|
2430
|
+
var ExtendedFAB = React14__namespace.memo(ExtendedFABComponent);
|
|
2470
2431
|
var SIZE_STYLES = {
|
|
2471
2432
|
sm: "h-10 w-10",
|
|
2472
2433
|
md: "h-14 w-14",
|
|
@@ -2537,7 +2498,7 @@ function FABPosition({
|
|
|
2537
2498
|
}
|
|
2538
2499
|
);
|
|
2539
2500
|
}
|
|
2540
|
-
var FABComponent =
|
|
2501
|
+
var FABComponent = React14__namespace.forwardRef(
|
|
2541
2502
|
(_a, ref) => {
|
|
2542
2503
|
var _b = _a, {
|
|
2543
2504
|
className,
|
|
@@ -2551,6 +2512,7 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2551
2512
|
loading = false,
|
|
2552
2513
|
loadingVariant = "loading-indicator",
|
|
2553
2514
|
visible = true,
|
|
2515
|
+
asChild = false,
|
|
2554
2516
|
onClick,
|
|
2555
2517
|
onKeyDown,
|
|
2556
2518
|
"aria-label": ariaLabel
|
|
@@ -2566,6 +2528,7 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2566
2528
|
"loading",
|
|
2567
2529
|
"loadingVariant",
|
|
2568
2530
|
"visible",
|
|
2531
|
+
"asChild",
|
|
2569
2532
|
"onClick",
|
|
2570
2533
|
"onKeyDown",
|
|
2571
2534
|
"aria-label"
|
|
@@ -2582,7 +2545,7 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2582
2545
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2583
2546
|
disabled: loading
|
|
2584
2547
|
});
|
|
2585
|
-
const handleClick =
|
|
2548
|
+
const handleClick = React14__namespace.useCallback(
|
|
2586
2549
|
(e) => {
|
|
2587
2550
|
if (loading) {
|
|
2588
2551
|
e.preventDefault();
|
|
@@ -2592,7 +2555,7 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2592
2555
|
},
|
|
2593
2556
|
[loading, onClick]
|
|
2594
2557
|
);
|
|
2595
|
-
const handleKeyDown =
|
|
2558
|
+
const handleKeyDown = React14__namespace.useCallback(
|
|
2596
2559
|
(e) => {
|
|
2597
2560
|
if (loading) return;
|
|
2598
2561
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2603,19 +2566,116 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2603
2566
|
},
|
|
2604
2567
|
[loading, onClick, onKeyDown]
|
|
2605
2568
|
);
|
|
2606
|
-
|
|
2569
|
+
const labelContent = asChild ? React14__namespace.Children.only(children).props.children : children;
|
|
2570
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2571
|
+
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
2572
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2573
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2574
|
+
react.m.span,
|
|
2575
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2576
|
+
transition: SPRING_TRANSITION,
|
|
2577
|
+
className: cn(
|
|
2578
|
+
"flex items-center justify-center shrink-0",
|
|
2579
|
+
iconClass
|
|
2580
|
+
),
|
|
2581
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2582
|
+
LoadingIndicator,
|
|
2583
|
+
{
|
|
2584
|
+
size: iconPx,
|
|
2585
|
+
color: "currentColor",
|
|
2586
|
+
"aria-label": "Loading"
|
|
2587
|
+
}
|
|
2588
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2589
|
+
ProgressIndicator,
|
|
2590
|
+
{
|
|
2591
|
+
variant: "circular",
|
|
2592
|
+
size: iconPx,
|
|
2593
|
+
color: "currentColor",
|
|
2594
|
+
trackColor: "transparent",
|
|
2595
|
+
"aria-label": "Loading"
|
|
2596
|
+
}
|
|
2597
|
+
)
|
|
2598
|
+
}),
|
|
2599
|
+
"loading"
|
|
2600
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2601
|
+
react.m.span,
|
|
2602
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2603
|
+
transition: SPRING_TRANSITION,
|
|
2604
|
+
"aria-hidden": "true",
|
|
2605
|
+
className: cn(
|
|
2606
|
+
"flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
2607
|
+
iconClass
|
|
2608
|
+
),
|
|
2609
|
+
children: icon
|
|
2610
|
+
}),
|
|
2611
|
+
"icon"
|
|
2612
|
+
) }),
|
|
2613
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: extended && labelContent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2614
|
+
react.m.span,
|
|
2615
|
+
{
|
|
2616
|
+
initial: { width: 0, opacity: 0 },
|
|
2617
|
+
animate: { width: "auto", opacity: 1 },
|
|
2618
|
+
exit: { width: 0, opacity: 0 },
|
|
2619
|
+
transition: SPRING_TRANSITION,
|
|
2620
|
+
className: "overflow-hidden whitespace-nowrap ml-3",
|
|
2621
|
+
children: labelContent
|
|
2622
|
+
},
|
|
2623
|
+
"label"
|
|
2624
|
+
) })
|
|
2625
|
+
] });
|
|
2626
|
+
const containerClassName = cn(
|
|
2627
|
+
"relative shrink-0 inline-flex items-center justify-center",
|
|
2628
|
+
"select-none cursor-pointer overflow-hidden",
|
|
2629
|
+
"transition-[box-shadow,opacity,filter] duration-200",
|
|
2630
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2631
|
+
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2632
|
+
colors.bg,
|
|
2633
|
+
colors.text,
|
|
2634
|
+
lowered ? "shadow-sm" : colors.shadow,
|
|
2635
|
+
(_d = SIZE_STYLES[size]) != null ? _d : "h-14 w-14",
|
|
2636
|
+
extended && "w-auto px-6",
|
|
2637
|
+
SIZE_TEXT_CLASS[size],
|
|
2638
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2639
|
+
className
|
|
2640
|
+
);
|
|
2641
|
+
const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
|
|
2642
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: visible && (asChild ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2643
|
+
reactSlot.Slot,
|
|
2644
|
+
__spreadProps(__spreadValues({
|
|
2645
|
+
ref,
|
|
2646
|
+
"aria-label": computedAriaLabel,
|
|
2647
|
+
"aria-busy": loading || void 0,
|
|
2648
|
+
"aria-disabled": loading || restProps.disabled,
|
|
2649
|
+
onClick: handleClick,
|
|
2650
|
+
onPointerDown,
|
|
2651
|
+
onKeyDown: handleKeyDown,
|
|
2652
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
2653
|
+
borderRadius: `${animateRadius}px`
|
|
2654
|
+
}),
|
|
2655
|
+
className: containerClassName
|
|
2656
|
+
}, restProps), {
|
|
2657
|
+
children: React14__namespace.cloneElement(
|
|
2658
|
+
React14__namespace.Children.only(children),
|
|
2659
|
+
{ children: innerContent }
|
|
2660
|
+
)
|
|
2661
|
+
})
|
|
2662
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2607
2663
|
react.m.button,
|
|
2608
2664
|
__spreadProps(__spreadValues({
|
|
2609
2665
|
ref,
|
|
2610
2666
|
type: "button",
|
|
2611
|
-
"aria-label":
|
|
2667
|
+
"aria-label": computedAriaLabel,
|
|
2612
2668
|
"aria-busy": loading || void 0,
|
|
2613
2669
|
"aria-disabled": loading || restProps.disabled,
|
|
2614
2670
|
onClick: handleClick,
|
|
2615
2671
|
onPointerDown,
|
|
2616
2672
|
onKeyDown: handleKeyDown,
|
|
2617
2673
|
style,
|
|
2618
|
-
initial: {
|
|
2674
|
+
initial: {
|
|
2675
|
+
scale: 0.5,
|
|
2676
|
+
opacity: 0,
|
|
2677
|
+
borderRadius: animateRadius
|
|
2678
|
+
},
|
|
2619
2679
|
animate: { scale: 1, opacity: 1, borderRadius: animateRadius },
|
|
2620
2680
|
exit: { scale: 0.5, opacity: 0 },
|
|
2621
2681
|
whileTap: { borderRadius: pressedRadius },
|
|
@@ -2624,84 +2684,15 @@ var FABComponent = React11__namespace.forwardRef(
|
|
|
2624
2684
|
scale: SPRING_TRANSITION,
|
|
2625
2685
|
opacity: { duration: 0.25, ease: "easeOut" }
|
|
2626
2686
|
},
|
|
2627
|
-
className:
|
|
2628
|
-
"relative shrink-0 inline-flex items-center justify-center",
|
|
2629
|
-
"select-none cursor-pointer overflow-hidden",
|
|
2630
|
-
"transition-[box-shadow,opacity,filter] duration-200",
|
|
2631
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2632
|
-
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2633
|
-
colors.bg,
|
|
2634
|
-
colors.text,
|
|
2635
|
-
lowered ? "shadow-sm" : colors.shadow,
|
|
2636
|
-
(_d = SIZE_STYLES[size]) != null ? _d : "h-14 w-14",
|
|
2637
|
-
extended && "w-auto px-6",
|
|
2638
|
-
SIZE_TEXT_CLASS[size],
|
|
2639
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2640
|
-
className
|
|
2641
|
-
)
|
|
2687
|
+
className: containerClassName
|
|
2642
2688
|
}, restProps), {
|
|
2643
|
-
children:
|
|
2644
|
-
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
2645
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2646
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2647
|
-
react.m.span,
|
|
2648
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2649
|
-
transition: SPRING_TRANSITION,
|
|
2650
|
-
className: cn(
|
|
2651
|
-
"flex items-center justify-center shrink-0",
|
|
2652
|
-
iconClass
|
|
2653
|
-
),
|
|
2654
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2655
|
-
LoadingIndicator,
|
|
2656
|
-
{
|
|
2657
|
-
size: iconPx,
|
|
2658
|
-
color: "currentColor",
|
|
2659
|
-
"aria-label": "Loading"
|
|
2660
|
-
}
|
|
2661
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2662
|
-
ProgressIndicator,
|
|
2663
|
-
{
|
|
2664
|
-
variant: "circular",
|
|
2665
|
-
size: iconPx,
|
|
2666
|
-
color: "currentColor",
|
|
2667
|
-
trackColor: "transparent",
|
|
2668
|
-
"aria-label": "Loading"
|
|
2669
|
-
}
|
|
2670
|
-
)
|
|
2671
|
-
}),
|
|
2672
|
-
"loading"
|
|
2673
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2674
|
-
react.m.span,
|
|
2675
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2676
|
-
transition: SPRING_TRANSITION,
|
|
2677
|
-
"aria-hidden": "true",
|
|
2678
|
-
className: cn(
|
|
2679
|
-
"flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
2680
|
-
iconClass
|
|
2681
|
-
),
|
|
2682
|
-
children: icon
|
|
2683
|
-
}),
|
|
2684
|
-
"icon"
|
|
2685
|
-
) }),
|
|
2686
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: extended && children && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2687
|
-
react.m.span,
|
|
2688
|
-
{
|
|
2689
|
-
initial: { width: 0, opacity: 0 },
|
|
2690
|
-
animate: { width: "auto", opacity: 1 },
|
|
2691
|
-
exit: { width: 0, opacity: 0 },
|
|
2692
|
-
transition: SPRING_TRANSITION,
|
|
2693
|
-
className: "overflow-hidden whitespace-nowrap ml-3",
|
|
2694
|
-
children
|
|
2695
|
-
},
|
|
2696
|
-
"label"
|
|
2697
|
-
) })
|
|
2698
|
-
]
|
|
2689
|
+
children: innerContent
|
|
2699
2690
|
})
|
|
2700
|
-
) }) });
|
|
2691
|
+
)) }) });
|
|
2701
2692
|
}
|
|
2702
2693
|
);
|
|
2703
2694
|
FABComponent.displayName = "FAB";
|
|
2704
|
-
var FAB =
|
|
2695
|
+
var FAB = React14__namespace.memo(FABComponent);
|
|
2705
2696
|
var SPRING_NORMAL = { stiffness: 700, damping: 40 };
|
|
2706
2697
|
var SPRING_REDUCED = { stiffness: 1e4, damping: 100 };
|
|
2707
2698
|
var FOCUS_DELAY_MS = 50;
|
|
@@ -2809,7 +2800,7 @@ function CloseIcon() {
|
|
|
2809
2800
|
function defaultFabIcon(progress) {
|
|
2810
2801
|
return progress > 0.5 ? /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(AddIcon, {});
|
|
2811
2802
|
}
|
|
2812
|
-
var ToggleFABComponent =
|
|
2803
|
+
var ToggleFABComponent = React14__namespace.forwardRef(
|
|
2813
2804
|
({
|
|
2814
2805
|
expanded,
|
|
2815
2806
|
onToggle,
|
|
@@ -2827,7 +2818,7 @@ var ToggleFABComponent = React11__namespace.forwardRef(
|
|
|
2827
2818
|
const sizeTokens = (_b = TOGGLE_FAB_SIZES[fabSize]) != null ? _b : TOGGLE_FAB_SIZES.baseline;
|
|
2828
2819
|
const springConfig = prefersReduced ? SPRING_REDUCED : SPRING_NORMAL;
|
|
2829
2820
|
const checkedProgress = react.useSpring(expanded ? 1 : 0, springConfig);
|
|
2830
|
-
|
|
2821
|
+
React14__namespace.useEffect(() => {
|
|
2831
2822
|
checkedProgress.set(expanded ? 1 : 0);
|
|
2832
2823
|
}, [expanded, checkedProgress]);
|
|
2833
2824
|
const borderRadius = react.useTransform(
|
|
@@ -2835,12 +2826,12 @@ var ToggleFABComponent = React11__namespace.forwardRef(
|
|
|
2835
2826
|
[0, 1],
|
|
2836
2827
|
[`${sizeTokens.initialRadius}px`, `${sizeTokens.finalRadius}px`]
|
|
2837
2828
|
);
|
|
2838
|
-
const [iconProgress, setIconProgress] =
|
|
2839
|
-
|
|
2829
|
+
const [iconProgress, setIconProgress] = React14__namespace.useState(expanded ? 1 : 0);
|
|
2830
|
+
React14__namespace.useEffect(() => {
|
|
2840
2831
|
return checkedProgress.on("change", setIconProgress);
|
|
2841
2832
|
}, [checkedProgress]);
|
|
2842
2833
|
const { ripples, onPointerDown, removeRipple } = useRippleState();
|
|
2843
|
-
const handleClick =
|
|
2834
|
+
const handleClick = React14__namespace.useCallback(() => {
|
|
2844
2835
|
onToggle(!expanded);
|
|
2845
2836
|
}, [expanded, onToggle]);
|
|
2846
2837
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2889,7 +2880,7 @@ var ToggleFABComponent = React11__namespace.forwardRef(
|
|
|
2889
2880
|
}
|
|
2890
2881
|
);
|
|
2891
2882
|
ToggleFABComponent.displayName = "ToggleFAB";
|
|
2892
|
-
var ToggleFAB =
|
|
2883
|
+
var ToggleFAB = React14__namespace.memo(ToggleFABComponent);
|
|
2893
2884
|
function FABMenuItem({
|
|
2894
2885
|
icon,
|
|
2895
2886
|
label,
|
|
@@ -2897,12 +2888,14 @@ function FABMenuItem({
|
|
|
2897
2888
|
disabled = false,
|
|
2898
2889
|
colorVariant = "primary",
|
|
2899
2890
|
className,
|
|
2900
|
-
tabIndex = 0
|
|
2891
|
+
tabIndex = 0,
|
|
2892
|
+
asChild = false,
|
|
2893
|
+
children
|
|
2901
2894
|
}) {
|
|
2902
2895
|
var _a;
|
|
2903
2896
|
const colors = (_a = MENU_ITEM_COLORS[colorVariant]) != null ? _a : MENU_ITEM_COLORS.primary;
|
|
2904
2897
|
const { ripples, onPointerDown, removeRipple } = useRippleState({ disabled });
|
|
2905
|
-
const handleClick =
|
|
2898
|
+
const handleClick = React14__namespace.useCallback(
|
|
2906
2899
|
(e) => {
|
|
2907
2900
|
if (disabled) {
|
|
2908
2901
|
e.preventDefault();
|
|
@@ -2912,7 +2905,7 @@ function FABMenuItem({
|
|
|
2912
2905
|
},
|
|
2913
2906
|
[disabled, onClick]
|
|
2914
2907
|
);
|
|
2915
|
-
const handleKeyDown =
|
|
2908
|
+
const handleKeyDown = React14__namespace.useCallback(
|
|
2916
2909
|
(e) => {
|
|
2917
2910
|
if (disabled) return;
|
|
2918
2911
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -2922,7 +2915,55 @@ function FABMenuItem({
|
|
|
2922
2915
|
},
|
|
2923
2916
|
[disabled, onClick]
|
|
2924
2917
|
);
|
|
2925
|
-
|
|
2918
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2919
|
+
/* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
2920
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2921
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2922
|
+
"span",
|
|
2923
|
+
{
|
|
2924
|
+
"aria-hidden": "true",
|
|
2925
|
+
className: "relative z-10 flex items-center justify-center size-6 shrink-0 [&>svg]:w-full [&>svg]:h-full pointer-events-none",
|
|
2926
|
+
children: icon
|
|
2927
|
+
}
|
|
2928
|
+
),
|
|
2929
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10 text-base font-medium leading-none pointer-events-none", children: label })
|
|
2930
|
+
] });
|
|
2931
|
+
const containerClassName = cn(
|
|
2932
|
+
"relative inline-flex flex-row items-center",
|
|
2933
|
+
"select-none cursor-pointer overflow-hidden",
|
|
2934
|
+
"whitespace-nowrap",
|
|
2935
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-1",
|
|
2936
|
+
MENU_ITEM_STYLES.size,
|
|
2937
|
+
MENU_ITEM_STYLES.gap,
|
|
2938
|
+
label ? MENU_ITEM_STYLES.padding : "px-4",
|
|
2939
|
+
!label && "justify-center",
|
|
2940
|
+
colors.bg,
|
|
2941
|
+
colors.text,
|
|
2942
|
+
disabled && "opacity-[0.38] pointer-events-none",
|
|
2943
|
+
className
|
|
2944
|
+
);
|
|
2945
|
+
const containerStyle = {
|
|
2946
|
+
transformOrigin: "right",
|
|
2947
|
+
borderRadius: `${MENU_ITEM_STYLES.cornerRadius}px`
|
|
2948
|
+
};
|
|
2949
|
+
if (asChild) {
|
|
2950
|
+
const child = React14__namespace.Children.only(children);
|
|
2951
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.m.div, { variants: MENU_ITEM_VARIANTS, style: containerStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2952
|
+
reactSlot.Slot,
|
|
2953
|
+
{
|
|
2954
|
+
role: "menuitem",
|
|
2955
|
+
tabIndex,
|
|
2956
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
2957
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
2958
|
+
onClick: handleClick,
|
|
2959
|
+
onPointerDown,
|
|
2960
|
+
onKeyDown: handleKeyDown,
|
|
2961
|
+
className: containerClassName,
|
|
2962
|
+
children: React14__namespace.cloneElement(child, { children: innerContent })
|
|
2963
|
+
}
|
|
2964
|
+
) });
|
|
2965
|
+
}
|
|
2966
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2926
2967
|
react.m.div,
|
|
2927
2968
|
{
|
|
2928
2969
|
role: "menuitem",
|
|
@@ -2933,37 +2974,9 @@ function FABMenuItem({
|
|
|
2933
2974
|
onPointerDown,
|
|
2934
2975
|
onKeyDown: handleKeyDown,
|
|
2935
2976
|
variants: MENU_ITEM_VARIANTS,
|
|
2936
|
-
style:
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
},
|
|
2940
|
-
className: cn(
|
|
2941
|
-
"relative inline-flex flex-row items-center",
|
|
2942
|
-
"select-none cursor-pointer overflow-hidden",
|
|
2943
|
-
"whitespace-nowrap",
|
|
2944
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-1",
|
|
2945
|
-
MENU_ITEM_STYLES.size,
|
|
2946
|
-
MENU_ITEM_STYLES.gap,
|
|
2947
|
-
label ? MENU_ITEM_STYLES.padding : "px-4",
|
|
2948
|
-
!label && "justify-center",
|
|
2949
|
-
colors.bg,
|
|
2950
|
-
colors.text,
|
|
2951
|
-
disabled && "opacity-[0.38] pointer-events-none",
|
|
2952
|
-
className
|
|
2953
|
-
),
|
|
2954
|
-
children: [
|
|
2955
|
-
/* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
2956
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2957
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2958
|
-
"span",
|
|
2959
|
-
{
|
|
2960
|
-
"aria-hidden": "true",
|
|
2961
|
-
className: "relative z-10 flex items-center justify-center size-6 shrink-0 [&>svg]:w-full [&>svg]:h-full pointer-events-none",
|
|
2962
|
-
children: icon
|
|
2963
|
-
}
|
|
2964
|
-
),
|
|
2965
|
-
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10 text-base font-medium leading-none pointer-events-none", children: label })
|
|
2966
|
-
]
|
|
2977
|
+
style: containerStyle,
|
|
2978
|
+
className: containerClassName,
|
|
2979
|
+
children: innerContent
|
|
2967
2980
|
}
|
|
2968
2981
|
);
|
|
2969
2982
|
}
|
|
@@ -2979,13 +2992,13 @@ function FABMenu({
|
|
|
2979
2992
|
focusLast = true,
|
|
2980
2993
|
"aria-label": ariaLabel
|
|
2981
2994
|
}) {
|
|
2982
|
-
const fabId =
|
|
2983
|
-
const menuId =
|
|
2984
|
-
const toggleRef =
|
|
2985
|
-
const itemRefs =
|
|
2986
|
-
const [focusedIndex, setFocusedIndex] =
|
|
2987
|
-
const reversedItems =
|
|
2988
|
-
const focusItem =
|
|
2995
|
+
const fabId = React14__namespace.useId();
|
|
2996
|
+
const menuId = React14__namespace.useId();
|
|
2997
|
+
const toggleRef = React14__namespace.useRef(null);
|
|
2998
|
+
const itemRefs = React14__namespace.useRef([]);
|
|
2999
|
+
const [focusedIndex, setFocusedIndex] = React14__namespace.useState(-1);
|
|
3000
|
+
const reversedItems = React14__namespace.useMemo(() => [...items].reverse(), [items]);
|
|
3001
|
+
const focusItem = React14__namespace.useCallback((index) => {
|
|
2989
3002
|
var _a;
|
|
2990
3003
|
const clampedIndex = Math.max(
|
|
2991
3004
|
0,
|
|
@@ -2994,8 +3007,8 @@ function FABMenu({
|
|
|
2994
3007
|
setFocusedIndex(clampedIndex);
|
|
2995
3008
|
(_a = itemRefs.current[clampedIndex]) == null ? void 0 : _a.focus();
|
|
2996
3009
|
}, []);
|
|
2997
|
-
const wasExpandedRef =
|
|
2998
|
-
|
|
3010
|
+
const wasExpandedRef = React14__namespace.useRef(false);
|
|
3011
|
+
React14__namespace.useEffect(() => {
|
|
2999
3012
|
var _a;
|
|
3000
3013
|
if (expanded) {
|
|
3001
3014
|
wasExpandedRef.current = true;
|
|
@@ -3010,7 +3023,7 @@ function FABMenu({
|
|
|
3010
3023
|
wasExpandedRef.current = false;
|
|
3011
3024
|
setFocusedIndex(-1);
|
|
3012
3025
|
}, [expanded, focusLast, items.length, focusItem]);
|
|
3013
|
-
const handleMenuKeyDown =
|
|
3026
|
+
const handleMenuKeyDown = React14__namespace.useCallback(
|
|
3014
3027
|
(e) => {
|
|
3015
3028
|
if (!expanded) return;
|
|
3016
3029
|
const lastIndex = items.length - 1;
|
|
@@ -3232,7 +3245,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
3232
3245
|
}
|
|
3233
3246
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
3234
3247
|
}
|
|
3235
|
-
var IconButtonComponent =
|
|
3248
|
+
var IconButtonComponent = React14__namespace.forwardRef(
|
|
3236
3249
|
(_a, ref) => {
|
|
3237
3250
|
var _b = _a, {
|
|
3238
3251
|
className,
|
|
@@ -3245,6 +3258,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3245
3258
|
loading = false,
|
|
3246
3259
|
loadingVariant = "loading-indicator",
|
|
3247
3260
|
iconSize,
|
|
3261
|
+
asChild = false,
|
|
3248
3262
|
children,
|
|
3249
3263
|
onClick,
|
|
3250
3264
|
onKeyDown,
|
|
@@ -3260,6 +3274,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3260
3274
|
"loading",
|
|
3261
3275
|
"loadingVariant",
|
|
3262
3276
|
"iconSize",
|
|
3277
|
+
"asChild",
|
|
3263
3278
|
"children",
|
|
3264
3279
|
"onClick",
|
|
3265
3280
|
"onKeyDown",
|
|
@@ -3268,18 +3283,18 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3268
3283
|
var _a2, _b2;
|
|
3269
3284
|
const isToggle = variant === "toggle";
|
|
3270
3285
|
const isSelected = isToggle && !!selected;
|
|
3271
|
-
const resolvedColorClass =
|
|
3286
|
+
const resolvedColorClass = React14__namespace.useMemo(
|
|
3272
3287
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
3273
3288
|
[isSelected, colorStyle]
|
|
3274
3289
|
);
|
|
3275
|
-
const outlineWidthClass =
|
|
3290
|
+
const outlineWidthClass = React14__namespace.useMemo(
|
|
3276
3291
|
() => {
|
|
3277
3292
|
var _a3;
|
|
3278
3293
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
3279
3294
|
},
|
|
3280
3295
|
[colorStyle, isSelected, size]
|
|
3281
3296
|
);
|
|
3282
|
-
const disabledBgClass =
|
|
3297
|
+
const disabledBgClass = React14__namespace.useMemo(
|
|
3283
3298
|
() => resolveDisabledBgClass(colorStyle),
|
|
3284
3299
|
[colorStyle]
|
|
3285
3300
|
);
|
|
@@ -3300,7 +3315,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3300
3315
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
3301
3316
|
disabled: loading
|
|
3302
3317
|
});
|
|
3303
|
-
const handleClick =
|
|
3318
|
+
const handleClick = React14__namespace.useCallback(
|
|
3304
3319
|
(e) => {
|
|
3305
3320
|
if (loading) {
|
|
3306
3321
|
e.preventDefault();
|
|
@@ -3310,7 +3325,7 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3310
3325
|
},
|
|
3311
3326
|
[loading, onClick]
|
|
3312
3327
|
);
|
|
3313
|
-
const handleKeyDown =
|
|
3328
|
+
const handleKeyDown = React14__namespace.useCallback(
|
|
3314
3329
|
(e) => {
|
|
3315
3330
|
if (loading) return;
|
|
3316
3331
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -3321,7 +3336,87 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3321
3336
|
},
|
|
3322
3337
|
[loading, onClick, onKeyDown]
|
|
3323
3338
|
);
|
|
3324
|
-
|
|
3339
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3340
|
+
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
3341
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3342
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3343
|
+
react.m.span,
|
|
3344
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3345
|
+
transition: SPRING_TRANSITION,
|
|
3346
|
+
className: cn(
|
|
3347
|
+
"flex items-center justify-center shrink-0",
|
|
3348
|
+
iconSize != null ? void 0 : iconClass
|
|
3349
|
+
),
|
|
3350
|
+
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
3351
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3352
|
+
LoadingIndicator,
|
|
3353
|
+
{
|
|
3354
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3355
|
+
color: "currentColor",
|
|
3356
|
+
"aria-label": "Loading"
|
|
3357
|
+
}
|
|
3358
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3359
|
+
ProgressIndicator,
|
|
3360
|
+
{
|
|
3361
|
+
variant: "circular",
|
|
3362
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3363
|
+
color: "currentColor",
|
|
3364
|
+
trackColor: "transparent",
|
|
3365
|
+
"aria-label": "Loading"
|
|
3366
|
+
}
|
|
3367
|
+
)
|
|
3368
|
+
}),
|
|
3369
|
+
"loading"
|
|
3370
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3371
|
+
react.m.span,
|
|
3372
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3373
|
+
transition: SPRING_TRANSITION,
|
|
3374
|
+
"aria-hidden": "true",
|
|
3375
|
+
className: cn(
|
|
3376
|
+
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
3377
|
+
iconSize != null ? void 0 : iconClass
|
|
3378
|
+
),
|
|
3379
|
+
style: {
|
|
3380
|
+
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
3381
|
+
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
3382
|
+
height: isCustomSize ? `${iconSize}px` : void 0
|
|
3383
|
+
},
|
|
3384
|
+
children: asChild ? React14__namespace.Children.only(children).props.children : children
|
|
3385
|
+
}),
|
|
3386
|
+
"content"
|
|
3387
|
+
) })
|
|
3388
|
+
] });
|
|
3389
|
+
const containerClassName = cn(
|
|
3390
|
+
baseIconButtonClasses,
|
|
3391
|
+
resolvedColorClass,
|
|
3392
|
+
outlineWidthClass,
|
|
3393
|
+
disabledBgClass,
|
|
3394
|
+
"overflow-hidden",
|
|
3395
|
+
SIZE_STYLES2[size],
|
|
3396
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
3397
|
+
className
|
|
3398
|
+
);
|
|
3399
|
+
if (asChild) {
|
|
3400
|
+
const child = React14__namespace.Children.only(children);
|
|
3401
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3402
|
+
reactSlot.Slot,
|
|
3403
|
+
__spreadProps(__spreadValues({
|
|
3404
|
+
ref,
|
|
3405
|
+
"aria-pressed": isToggle ? isSelected : void 0,
|
|
3406
|
+
"aria-label": ariaLabel,
|
|
3407
|
+
"aria-busy": loading || void 0,
|
|
3408
|
+
"aria-disabled": loading || restProps.disabled,
|
|
3409
|
+
onClick: handleClick,
|
|
3410
|
+
onPointerDown,
|
|
3411
|
+
onKeyDown: handleKeyDown,
|
|
3412
|
+
style: __spreadProps(__spreadValues({}, style), { borderRadius: `${animateRadius}px` }),
|
|
3413
|
+
className: containerClassName
|
|
3414
|
+
}, restProps), {
|
|
3415
|
+
children: React14__namespace.cloneElement(child, { children: innerContent })
|
|
3416
|
+
})
|
|
3417
|
+
) });
|
|
3418
|
+
}
|
|
3419
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3325
3420
|
react.m.button,
|
|
3326
3421
|
__spreadProps(__spreadValues({
|
|
3327
3422
|
ref,
|
|
@@ -3337,78 +3432,20 @@ var IconButtonComponent = React11__namespace.forwardRef(
|
|
|
3337
3432
|
animate: { borderRadius: animateRadius },
|
|
3338
3433
|
whileTap: { borderRadius: pressedRadius },
|
|
3339
3434
|
transition: { borderRadius: SPRING_TRANSITION_FAST },
|
|
3340
|
-
className:
|
|
3341
|
-
baseIconButtonClasses,
|
|
3342
|
-
resolvedColorClass,
|
|
3343
|
-
outlineWidthClass,
|
|
3344
|
-
disabledBgClass,
|
|
3345
|
-
"overflow-hidden",
|
|
3346
|
-
SIZE_STYLES2[size],
|
|
3347
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
3348
|
-
className
|
|
3349
|
-
)
|
|
3435
|
+
className: containerClassName
|
|
3350
3436
|
}, restProps), {
|
|
3351
|
-
children:
|
|
3352
|
-
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
3353
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3354
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3355
|
-
react.m.span,
|
|
3356
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3357
|
-
transition: SPRING_TRANSITION,
|
|
3358
|
-
className: cn(
|
|
3359
|
-
"flex items-center justify-center shrink-0",
|
|
3360
|
-
iconSize != null ? void 0 : iconClass
|
|
3361
|
-
),
|
|
3362
|
-
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
3363
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3364
|
-
LoadingIndicator,
|
|
3365
|
-
{
|
|
3366
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3367
|
-
color: "currentColor",
|
|
3368
|
-
"aria-label": "Loading"
|
|
3369
|
-
}
|
|
3370
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3371
|
-
ProgressIndicator,
|
|
3372
|
-
{
|
|
3373
|
-
variant: "circular",
|
|
3374
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3375
|
-
color: "currentColor",
|
|
3376
|
-
trackColor: "transparent",
|
|
3377
|
-
"aria-label": "Loading"
|
|
3378
|
-
}
|
|
3379
|
-
)
|
|
3380
|
-
}),
|
|
3381
|
-
"loading"
|
|
3382
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3383
|
-
react.m.span,
|
|
3384
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3385
|
-
transition: SPRING_TRANSITION,
|
|
3386
|
-
"aria-hidden": "true",
|
|
3387
|
-
className: cn(
|
|
3388
|
-
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
3389
|
-
iconSize != null ? void 0 : iconClass
|
|
3390
|
-
),
|
|
3391
|
-
style: {
|
|
3392
|
-
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
3393
|
-
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
3394
|
-
height: isCustomSize ? `${iconSize}px` : void 0
|
|
3395
|
-
},
|
|
3396
|
-
children
|
|
3397
|
-
}),
|
|
3398
|
-
"content"
|
|
3399
|
-
) })
|
|
3400
|
-
]
|
|
3437
|
+
children: innerContent
|
|
3401
3438
|
})
|
|
3402
3439
|
) });
|
|
3403
3440
|
}
|
|
3404
3441
|
);
|
|
3405
3442
|
IconButtonComponent.displayName = "IconButton";
|
|
3406
|
-
var IconButton =
|
|
3407
|
-
var SplitButtonContext =
|
|
3443
|
+
var IconButton = React14__namespace.memo(IconButtonComponent);
|
|
3444
|
+
var SplitButtonContext = React14__namespace.createContext(null);
|
|
3408
3445
|
function useSplitButtonContext() {
|
|
3409
|
-
return
|
|
3446
|
+
return React14__namespace.useContext(SplitButtonContext);
|
|
3410
3447
|
}
|
|
3411
|
-
var SplitButtonLayoutComponent =
|
|
3448
|
+
var SplitButtonLayoutComponent = React14__namespace.forwardRef(
|
|
3412
3449
|
(_a, ref) => {
|
|
3413
3450
|
var _b = _a, {
|
|
3414
3451
|
leadingButton,
|
|
@@ -3425,10 +3462,10 @@ var SplitButtonLayoutComponent = React11__namespace.forwardRef(
|
|
|
3425
3462
|
"variant",
|
|
3426
3463
|
"size"
|
|
3427
3464
|
]);
|
|
3428
|
-
const leadingProps =
|
|
3465
|
+
const leadingProps = React14__namespace.isValidElement(leadingButton) ? leadingButton.props : {};
|
|
3429
3466
|
const size = layoutSize || leadingProps.size;
|
|
3430
3467
|
const variant = layoutVariant || leadingProps.variant;
|
|
3431
|
-
const contextValue =
|
|
3468
|
+
const contextValue = React14__namespace.useMemo(
|
|
3432
3469
|
() => ({
|
|
3433
3470
|
size,
|
|
3434
3471
|
variant
|
|
@@ -3454,8 +3491,8 @@ var SplitButtonLayoutComponent = React11__namespace.forwardRef(
|
|
|
3454
3491
|
}
|
|
3455
3492
|
);
|
|
3456
3493
|
SplitButtonLayoutComponent.displayName = "SplitButtonLayout";
|
|
3457
|
-
var SplitButtonLayout =
|
|
3458
|
-
var StateLayer =
|
|
3494
|
+
var SplitButtonLayout = React14__namespace.memo(SplitButtonLayoutComponent);
|
|
3495
|
+
var StateLayer = React14__namespace.forwardRef(
|
|
3459
3496
|
(_a, ref) => {
|
|
3460
3497
|
var _b = _a, { className, hovered, focused, pressed } = _b, props = __objRest(_b, ["className", "hovered", "focused", "pressed"]);
|
|
3461
3498
|
let opacity = 0;
|
|
@@ -3707,7 +3744,7 @@ var splitButtonVariants = classVarianceAuthority.cva(
|
|
|
3707
3744
|
}
|
|
3708
3745
|
}
|
|
3709
3746
|
);
|
|
3710
|
-
var SplitButtonLeadingComponent =
|
|
3747
|
+
var SplitButtonLeadingComponent = React14__namespace.forwardRef(
|
|
3711
3748
|
(_a, ref) => {
|
|
3712
3749
|
var _b = _a, {
|
|
3713
3750
|
className,
|
|
@@ -3717,6 +3754,7 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3717
3754
|
icon,
|
|
3718
3755
|
children,
|
|
3719
3756
|
disabled,
|
|
3757
|
+
asChild = false,
|
|
3720
3758
|
onClick,
|
|
3721
3759
|
onPointerDown,
|
|
3722
3760
|
onPointerUp,
|
|
@@ -3732,6 +3770,7 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3732
3770
|
"icon",
|
|
3733
3771
|
"children",
|
|
3734
3772
|
"disabled",
|
|
3773
|
+
"asChild",
|
|
3735
3774
|
"onClick",
|
|
3736
3775
|
"onPointerDown",
|
|
3737
3776
|
"onPointerUp",
|
|
@@ -3744,9 +3783,9 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3744
3783
|
const context = useSplitButtonContext();
|
|
3745
3784
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
3746
3785
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
3747
|
-
const [isHovered, setIsHovered] =
|
|
3748
|
-
const [isFocused, setIsFocused] =
|
|
3749
|
-
const [isPressed, setIsPressed] =
|
|
3786
|
+
const [isHovered, setIsHovered] = React14__namespace.useState(false);
|
|
3787
|
+
const [isFocused, setIsFocused] = React14__namespace.useState(false);
|
|
3788
|
+
const [isPressed, setIsPressed] = React14__namespace.useState(false);
|
|
3750
3789
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
3751
3790
|
const typographyClass = (_c = BUTTON_TYPOGRAPHY_TOKENS[actualSize]) != null ? _c : BUTTON_TYPOGRAPHY_TOKENS.sm;
|
|
3752
3791
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -3758,7 +3797,7 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3758
3797
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
3759
3798
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
3760
3799
|
const borderRadius = `${outerRadius}px ${innerCornerRadius}px ${innerCornerRadius}px ${outerRadius}px`;
|
|
3761
|
-
const handleClick =
|
|
3800
|
+
const handleClick = React14__namespace.useCallback(
|
|
3762
3801
|
(e) => {
|
|
3763
3802
|
if (disabled) {
|
|
3764
3803
|
e.preventDefault();
|
|
@@ -3768,7 +3807,7 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3768
3807
|
},
|
|
3769
3808
|
[disabled, onClick]
|
|
3770
3809
|
);
|
|
3771
|
-
const handlePointerDown =
|
|
3810
|
+
const handlePointerDown = React14__namespace.useCallback(
|
|
3772
3811
|
(e) => {
|
|
3773
3812
|
onRipplePointerDown(e);
|
|
3774
3813
|
setIsPressed(true);
|
|
@@ -3776,19 +3815,19 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3776
3815
|
},
|
|
3777
3816
|
[onRipplePointerDown, onPointerDown]
|
|
3778
3817
|
);
|
|
3779
|
-
const handlePointerUp =
|
|
3818
|
+
const handlePointerUp = React14__namespace.useCallback(
|
|
3780
3819
|
(e) => {
|
|
3781
3820
|
setIsPressed(false);
|
|
3782
3821
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
3783
3822
|
},
|
|
3784
3823
|
[onPointerUp]
|
|
3785
3824
|
);
|
|
3786
|
-
const handlePointerEnter =
|
|
3825
|
+
const handlePointerEnter = React14__namespace.useCallback(() => {
|
|
3787
3826
|
if (!disabled) {
|
|
3788
3827
|
setIsHovered(true);
|
|
3789
3828
|
}
|
|
3790
3829
|
}, [disabled]);
|
|
3791
|
-
const handlePointerLeave =
|
|
3830
|
+
const handlePointerLeave = React14__namespace.useCallback(
|
|
3792
3831
|
(e) => {
|
|
3793
3832
|
setIsHovered(false);
|
|
3794
3833
|
setIsPressed(false);
|
|
@@ -3796,21 +3835,21 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3796
3835
|
},
|
|
3797
3836
|
[onPointerLeave]
|
|
3798
3837
|
);
|
|
3799
|
-
const handlePointerCancel =
|
|
3838
|
+
const handlePointerCancel = React14__namespace.useCallback(
|
|
3800
3839
|
(e) => {
|
|
3801
3840
|
setIsPressed(false);
|
|
3802
3841
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
3803
3842
|
},
|
|
3804
3843
|
[onPointerCancel]
|
|
3805
3844
|
);
|
|
3806
|
-
const handleFocus =
|
|
3845
|
+
const handleFocus = React14__namespace.useCallback(
|
|
3807
3846
|
(e) => {
|
|
3808
3847
|
if (!disabled) setIsFocused(true);
|
|
3809
3848
|
onFocus == null ? void 0 : onFocus(e);
|
|
3810
3849
|
},
|
|
3811
3850
|
[disabled, onFocus]
|
|
3812
3851
|
);
|
|
3813
|
-
const handleBlur =
|
|
3852
|
+
const handleBlur = React14__namespace.useCallback(
|
|
3814
3853
|
(e) => {
|
|
3815
3854
|
setIsFocused(false);
|
|
3816
3855
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -3818,12 +3857,73 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3818
3857
|
[onBlur]
|
|
3819
3858
|
);
|
|
3820
3859
|
const leadingIconSize = LEADING_ICON_SIZE_FOR_SIZE[actualSize];
|
|
3821
|
-
|
|
3860
|
+
const labelContent = asChild ? React14__namespace.Children.only(children).props.children : children;
|
|
3861
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3862
|
+
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
3863
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3864
|
+
StateLayer,
|
|
3865
|
+
{
|
|
3866
|
+
hovered: isHovered,
|
|
3867
|
+
focused: isFocused,
|
|
3868
|
+
pressed: isPressed
|
|
3869
|
+
}
|
|
3870
|
+
),
|
|
3871
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3872
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3873
|
+
"span",
|
|
3874
|
+
{
|
|
3875
|
+
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full overflow-hidden [&_.md-icon]:text-[length:inherit]!",
|
|
3876
|
+
style: {
|
|
3877
|
+
fontSize: leadingIconSize,
|
|
3878
|
+
width: leadingIconSize,
|
|
3879
|
+
height: leadingIconSize
|
|
3880
|
+
},
|
|
3881
|
+
children: icon
|
|
3882
|
+
}
|
|
3883
|
+
),
|
|
3884
|
+
labelContent && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center h-full gap-[inherit]", children: labelContent })
|
|
3885
|
+
] });
|
|
3886
|
+
const containerClassName = cn(
|
|
3887
|
+
splitButtonVariants({
|
|
3888
|
+
variant: actualVariant,
|
|
3889
|
+
size: actualSize,
|
|
3890
|
+
disabled
|
|
3891
|
+
}),
|
|
3892
|
+
typographyClass,
|
|
3893
|
+
className
|
|
3894
|
+
);
|
|
3895
|
+
const mergedStyle = __spreadValues({
|
|
3896
|
+
paddingInlineStart: tokens.leadingPadding.start,
|
|
3897
|
+
paddingInlineEnd: tokens.leadingPadding.end,
|
|
3898
|
+
gap: "8px",
|
|
3899
|
+
borderRadius
|
|
3900
|
+
}, style);
|
|
3901
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: asChild ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3902
|
+
reactSlot.Slot,
|
|
3903
|
+
__spreadProps(__spreadValues({
|
|
3904
|
+
ref,
|
|
3905
|
+
"aria-disabled": disabled || void 0,
|
|
3906
|
+
onClick: handleClick,
|
|
3907
|
+
onPointerDown: handlePointerDown,
|
|
3908
|
+
onPointerUp: handlePointerUp,
|
|
3909
|
+
onPointerEnter: handlePointerEnter,
|
|
3910
|
+
onPointerLeave: handlePointerLeave,
|
|
3911
|
+
onPointerCancel: handlePointerCancel,
|
|
3912
|
+
onFocus: handleFocus,
|
|
3913
|
+
onBlur: handleBlur,
|
|
3914
|
+
style: mergedStyle,
|
|
3915
|
+
className: containerClassName
|
|
3916
|
+
}, restProps), {
|
|
3917
|
+
children: React14__namespace.cloneElement(
|
|
3918
|
+
React14__namespace.Children.only(children),
|
|
3919
|
+
{ children: innerContent }
|
|
3920
|
+
)
|
|
3921
|
+
})
|
|
3922
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3822
3923
|
react.m.button,
|
|
3823
3924
|
__spreadProps(__spreadValues({
|
|
3824
3925
|
ref,
|
|
3825
3926
|
type: "button",
|
|
3826
|
-
"aria-disabled": disabled,
|
|
3827
3927
|
disabled,
|
|
3828
3928
|
onClick: handleClick,
|
|
3829
3929
|
onPointerDown: handlePointerDown,
|
|
@@ -3840,56 +3940,24 @@ var SplitButtonLeadingComponent = React11__namespace.forwardRef(
|
|
|
3840
3940
|
paddingInlineEnd: tokens.leadingPadding.end,
|
|
3841
3941
|
gap: "8px"
|
|
3842
3942
|
}, style),
|
|
3843
|
-
className:
|
|
3844
|
-
splitButtonVariants({
|
|
3845
|
-
variant: actualVariant,
|
|
3846
|
-
size: actualSize,
|
|
3847
|
-
disabled
|
|
3848
|
-
}),
|
|
3849
|
-
typographyClass,
|
|
3850
|
-
className
|
|
3851
|
-
)
|
|
3943
|
+
className: containerClassName
|
|
3852
3944
|
}, restProps), {
|
|
3853
|
-
children:
|
|
3854
|
-
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
3855
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3856
|
-
StateLayer,
|
|
3857
|
-
{
|
|
3858
|
-
hovered: isHovered,
|
|
3859
|
-
focused: isFocused,
|
|
3860
|
-
pressed: isPressed
|
|
3861
|
-
}
|
|
3862
|
-
),
|
|
3863
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3864
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3865
|
-
"span",
|
|
3866
|
-
{
|
|
3867
|
-
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full overflow-hidden [&_.md-icon]:text-[length:inherit]!",
|
|
3868
|
-
style: {
|
|
3869
|
-
fontSize: leadingIconSize,
|
|
3870
|
-
width: leadingIconSize,
|
|
3871
|
-
height: leadingIconSize
|
|
3872
|
-
},
|
|
3873
|
-
children: icon
|
|
3874
|
-
}
|
|
3875
|
-
),
|
|
3876
|
-
children && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center h-full gap-[inherit]", children })
|
|
3877
|
-
]
|
|
3945
|
+
children: innerContent
|
|
3878
3946
|
})
|
|
3879
3947
|
) });
|
|
3880
3948
|
}
|
|
3881
3949
|
);
|
|
3882
3950
|
SplitButtonLeadingComponent.displayName = "SplitButtonLeading";
|
|
3883
|
-
var SplitButtonLeading =
|
|
3884
|
-
var FilledSplitButtonLeading =
|
|
3951
|
+
var SplitButtonLeading = React14__namespace.memo(SplitButtonLeadingComponent);
|
|
3952
|
+
var FilledSplitButtonLeading = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "filled" }, props)));
|
|
3885
3953
|
FilledSplitButtonLeading.displayName = "FilledSplitButtonLeading";
|
|
3886
|
-
var TonalSplitButtonLeading =
|
|
3954
|
+
var TonalSplitButtonLeading = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
3887
3955
|
TonalSplitButtonLeading.displayName = "TonalSplitButtonLeading";
|
|
3888
|
-
var ElevatedSplitButtonLeading =
|
|
3956
|
+
var ElevatedSplitButtonLeading = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
3889
3957
|
ElevatedSplitButtonLeading.displayName = "ElevatedSplitButtonLeading";
|
|
3890
|
-
var OutlinedSplitButtonLeading =
|
|
3958
|
+
var OutlinedSplitButtonLeading = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonLeading, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
3891
3959
|
OutlinedSplitButtonLeading.displayName = "OutlinedSplitButtonLeading";
|
|
3892
|
-
var SplitButtonTrailingComponent =
|
|
3960
|
+
var SplitButtonTrailingComponent = React14__namespace.forwardRef(
|
|
3893
3961
|
(_a, ref) => {
|
|
3894
3962
|
var _b = _a, {
|
|
3895
3963
|
className,
|
|
@@ -3906,6 +3974,8 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
3906
3974
|
onPointerCancel,
|
|
3907
3975
|
onFocus,
|
|
3908
3976
|
onBlur,
|
|
3977
|
+
asChild = false,
|
|
3978
|
+
children,
|
|
3909
3979
|
"aria-label": ariaLabel
|
|
3910
3980
|
} = _b, restProps = __objRest(_b, [
|
|
3911
3981
|
"className",
|
|
@@ -3922,15 +3992,17 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
3922
3992
|
"onPointerCancel",
|
|
3923
3993
|
"onFocus",
|
|
3924
3994
|
"onBlur",
|
|
3995
|
+
"asChild",
|
|
3996
|
+
"children",
|
|
3925
3997
|
"aria-label"
|
|
3926
3998
|
]);
|
|
3927
3999
|
var _a2, _b2;
|
|
3928
4000
|
const context = useSplitButtonContext();
|
|
3929
4001
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
3930
4002
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
3931
|
-
const [isHovered, setIsHovered] =
|
|
3932
|
-
const [isFocused, setIsFocused] =
|
|
3933
|
-
const [isPressed, setIsPressed] =
|
|
4003
|
+
const [isHovered, setIsHovered] = React14__namespace.useState(false);
|
|
4004
|
+
const [isFocused, setIsFocused] = React14__namespace.useState(false);
|
|
4005
|
+
const [isPressed, setIsPressed] = React14__namespace.useState(false);
|
|
3934
4006
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
3935
4007
|
const prefersReducedMotion = react.useReducedMotion();
|
|
3936
4008
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -3942,12 +4014,12 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
3942
4014
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
3943
4015
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
3944
4016
|
const borderRadius = checked ? `${outerRadius}px ${outerRadius}px ${outerRadius}px ${outerRadius}px` : `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
3945
|
-
const handleToggle =
|
|
4017
|
+
const handleToggle = React14__namespace.useCallback(() => {
|
|
3946
4018
|
if (!disabled) {
|
|
3947
4019
|
onCheckedChange(!checked);
|
|
3948
4020
|
}
|
|
3949
4021
|
}, [disabled, checked, onCheckedChange]);
|
|
3950
|
-
const handlePointerDown =
|
|
4022
|
+
const handlePointerDown = React14__namespace.useCallback(
|
|
3951
4023
|
(e) => {
|
|
3952
4024
|
onRipplePointerDown(e);
|
|
3953
4025
|
setIsPressed(true);
|
|
@@ -3955,19 +4027,19 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
3955
4027
|
},
|
|
3956
4028
|
[onRipplePointerDown, onPointerDown]
|
|
3957
4029
|
);
|
|
3958
|
-
const handlePointerUp =
|
|
4030
|
+
const handlePointerUp = React14__namespace.useCallback(
|
|
3959
4031
|
(e) => {
|
|
3960
4032
|
setIsPressed(false);
|
|
3961
4033
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
3962
4034
|
},
|
|
3963
4035
|
[onPointerUp]
|
|
3964
4036
|
);
|
|
3965
|
-
const handlePointerEnter =
|
|
4037
|
+
const handlePointerEnter = React14__namespace.useCallback(() => {
|
|
3966
4038
|
if (!disabled) {
|
|
3967
4039
|
setIsHovered(true);
|
|
3968
4040
|
}
|
|
3969
4041
|
}, [disabled]);
|
|
3970
|
-
const handlePointerLeave =
|
|
4042
|
+
const handlePointerLeave = React14__namespace.useCallback(
|
|
3971
4043
|
(e) => {
|
|
3972
4044
|
setIsHovered(false);
|
|
3973
4045
|
setIsPressed(false);
|
|
@@ -3975,35 +4047,102 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
3975
4047
|
},
|
|
3976
4048
|
[onPointerLeave]
|
|
3977
4049
|
);
|
|
3978
|
-
const handlePointerCancel =
|
|
4050
|
+
const handlePointerCancel = React14__namespace.useCallback(
|
|
3979
4051
|
(e) => {
|
|
3980
4052
|
setIsPressed(false);
|
|
3981
4053
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
3982
4054
|
},
|
|
3983
4055
|
[onPointerCancel]
|
|
3984
4056
|
);
|
|
3985
|
-
const handleFocus =
|
|
4057
|
+
const handleFocus = React14__namespace.useCallback(
|
|
3986
4058
|
(e) => {
|
|
3987
4059
|
if (!disabled) setIsFocused(true);
|
|
3988
4060
|
onFocus == null ? void 0 : onFocus(e);
|
|
3989
4061
|
},
|
|
3990
4062
|
[disabled, onFocus]
|
|
3991
4063
|
);
|
|
3992
|
-
const handleBlur =
|
|
4064
|
+
const handleBlur = React14__namespace.useCallback(
|
|
3993
4065
|
(e) => {
|
|
3994
4066
|
setIsFocused(false);
|
|
3995
4067
|
onBlur == null ? void 0 : onBlur(e);
|
|
3996
4068
|
},
|
|
3997
4069
|
[onBlur]
|
|
3998
4070
|
);
|
|
3999
|
-
|
|
4071
|
+
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4072
|
+
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
4073
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4074
|
+
StateLayer,
|
|
4075
|
+
{
|
|
4076
|
+
hovered: isHovered,
|
|
4077
|
+
focused: isFocused,
|
|
4078
|
+
pressed: isPressed
|
|
4079
|
+
}
|
|
4080
|
+
),
|
|
4081
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
4082
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4083
|
+
react.m.div,
|
|
4084
|
+
{
|
|
4085
|
+
animate: {
|
|
4086
|
+
rotate: checked ? 180 : 0,
|
|
4087
|
+
x: checked ? 0 : tokens.opticalCenterOffset
|
|
4088
|
+
},
|
|
4089
|
+
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_CHEVRON_SPRING,
|
|
4090
|
+
className: "flex items-center justify-center shrink-0",
|
|
4091
|
+
children: icon != null ? icon : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4092
|
+
Icon,
|
|
4093
|
+
{
|
|
4094
|
+
name: "arrow_drop_down",
|
|
4095
|
+
size: tokens.trailingIconSize,
|
|
4096
|
+
opticalSize: 24
|
|
4097
|
+
}
|
|
4098
|
+
)
|
|
4099
|
+
}
|
|
4100
|
+
)
|
|
4101
|
+
] });
|
|
4102
|
+
const containerClassName = cn(
|
|
4103
|
+
splitButtonVariants({
|
|
4104
|
+
variant: actualVariant,
|
|
4105
|
+
size: actualSize,
|
|
4106
|
+
disabled
|
|
4107
|
+
}),
|
|
4108
|
+
className
|
|
4109
|
+
);
|
|
4110
|
+
const mergedStyle = __spreadValues({
|
|
4111
|
+
paddingInlineStart: tokens.trailingPadding.start,
|
|
4112
|
+
paddingInlineEnd: tokens.trailingPadding.end,
|
|
4113
|
+
borderRadius
|
|
4114
|
+
}, style);
|
|
4115
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: asChild ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4116
|
+
reactSlot.Slot,
|
|
4117
|
+
__spreadProps(__spreadValues({
|
|
4118
|
+
ref,
|
|
4119
|
+
"aria-label": ariaLabel,
|
|
4120
|
+
"aria-expanded": checked,
|
|
4121
|
+
"aria-disabled": disabled,
|
|
4122
|
+
onClick: handleToggle,
|
|
4123
|
+
onPointerDown: handlePointerDown,
|
|
4124
|
+
onPointerUp: handlePointerUp,
|
|
4125
|
+
onPointerEnter: handlePointerEnter,
|
|
4126
|
+
onPointerLeave: handlePointerLeave,
|
|
4127
|
+
onPointerCancel: handlePointerCancel,
|
|
4128
|
+
onFocus: handleFocus,
|
|
4129
|
+
onBlur: handleBlur,
|
|
4130
|
+
style: mergedStyle,
|
|
4131
|
+
className: containerClassName
|
|
4132
|
+
}, restProps), {
|
|
4133
|
+
children: React14__namespace.cloneElement(
|
|
4134
|
+
React14__namespace.Children.only(children),
|
|
4135
|
+
{ children: innerContent }
|
|
4136
|
+
)
|
|
4137
|
+
})
|
|
4138
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4000
4139
|
react.m.button,
|
|
4001
4140
|
__spreadProps(__spreadValues({
|
|
4002
4141
|
ref,
|
|
4003
4142
|
type: "button",
|
|
4004
|
-
"aria-pressed": checked,
|
|
4005
|
-
"aria-expanded": checked,
|
|
4006
4143
|
"aria-label": ariaLabel,
|
|
4144
|
+
"aria-expanded": checked,
|
|
4145
|
+
"aria-disabled": disabled,
|
|
4007
4146
|
disabled,
|
|
4008
4147
|
onClick: handleToggle,
|
|
4009
4148
|
onPointerDown: handlePointerDown,
|
|
@@ -4019,61 +4158,24 @@ var SplitButtonTrailingComponent = React11__namespace.forwardRef(
|
|
|
4019
4158
|
paddingInlineStart: tokens.trailingPadding.start,
|
|
4020
4159
|
paddingInlineEnd: tokens.trailingPadding.end
|
|
4021
4160
|
}, style),
|
|
4022
|
-
className:
|
|
4023
|
-
splitButtonVariants({
|
|
4024
|
-
variant: actualVariant,
|
|
4025
|
-
size: actualSize,
|
|
4026
|
-
disabled
|
|
4027
|
-
}),
|
|
4028
|
-
className
|
|
4029
|
-
)
|
|
4161
|
+
className: containerClassName
|
|
4030
4162
|
}, restProps), {
|
|
4031
|
-
children:
|
|
4032
|
-
needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
|
|
4033
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4034
|
-
StateLayer,
|
|
4035
|
-
{
|
|
4036
|
-
hovered: isHovered,
|
|
4037
|
-
focused: isFocused,
|
|
4038
|
-
pressed: isPressed
|
|
4039
|
-
}
|
|
4040
|
-
),
|
|
4041
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
4042
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4043
|
-
react.m.div,
|
|
4044
|
-
{
|
|
4045
|
-
animate: {
|
|
4046
|
-
rotate: checked ? 180 : 0,
|
|
4047
|
-
x: checked ? 0 : tokens.opticalCenterOffset
|
|
4048
|
-
},
|
|
4049
|
-
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_CHEVRON_SPRING,
|
|
4050
|
-
className: "flex items-center justify-center shrink-0",
|
|
4051
|
-
children: icon != null ? icon : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4052
|
-
Icon,
|
|
4053
|
-
{
|
|
4054
|
-
name: "arrow_drop_down",
|
|
4055
|
-
size: tokens.trailingIconSize,
|
|
4056
|
-
opticalSize: 24
|
|
4057
|
-
}
|
|
4058
|
-
)
|
|
4059
|
-
}
|
|
4060
|
-
)
|
|
4061
|
-
]
|
|
4163
|
+
children: innerContent
|
|
4062
4164
|
})
|
|
4063
4165
|
) });
|
|
4064
4166
|
}
|
|
4065
4167
|
);
|
|
4066
4168
|
SplitButtonTrailingComponent.displayName = "SplitButtonTrailing";
|
|
4067
|
-
var SplitButtonTrailing =
|
|
4068
|
-
var FilledSplitButtonTrailing =
|
|
4169
|
+
var SplitButtonTrailing = React14__namespace.memo(SplitButtonTrailingComponent);
|
|
4170
|
+
var FilledSplitButtonTrailing = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "filled" }, props)));
|
|
4069
4171
|
FilledSplitButtonTrailing.displayName = "FilledSplitButtonTrailing";
|
|
4070
|
-
var TonalSplitButtonTrailing =
|
|
4172
|
+
var TonalSplitButtonTrailing = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4071
4173
|
TonalSplitButtonTrailing.displayName = "TonalSplitButtonTrailing";
|
|
4072
|
-
var ElevatedSplitButtonTrailing =
|
|
4174
|
+
var ElevatedSplitButtonTrailing = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4073
4175
|
ElevatedSplitButtonTrailing.displayName = "ElevatedSplitButtonTrailing";
|
|
4074
|
-
var OutlinedSplitButtonTrailing =
|
|
4176
|
+
var OutlinedSplitButtonTrailing = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4075
4177
|
OutlinedSplitButtonTrailing.displayName = "OutlinedSplitButtonTrailing";
|
|
4076
|
-
var SplitButtonTrailingUncheckableComponent =
|
|
4178
|
+
var SplitButtonTrailingUncheckableComponent = React14__namespace.forwardRef(
|
|
4077
4179
|
(_a, ref) => {
|
|
4078
4180
|
var _b = _a, {
|
|
4079
4181
|
className,
|
|
@@ -4110,9 +4212,9 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4110
4212
|
const context = useSplitButtonContext();
|
|
4111
4213
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
4112
4214
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
4113
|
-
const [isHovered, setIsHovered] =
|
|
4114
|
-
const [isFocused, setIsFocused] =
|
|
4115
|
-
const [isPressed, setIsPressed] =
|
|
4215
|
+
const [isHovered, setIsHovered] = React14__namespace.useState(false);
|
|
4216
|
+
const [isFocused, setIsFocused] = React14__namespace.useState(false);
|
|
4217
|
+
const [isPressed, setIsPressed] = React14__namespace.useState(false);
|
|
4116
4218
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
4117
4219
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
4118
4220
|
const {
|
|
@@ -4123,7 +4225,7 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4123
4225
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
4124
4226
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
4125
4227
|
const borderRadius = `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
4126
|
-
const handlePointerDown =
|
|
4228
|
+
const handlePointerDown = React14__namespace.useCallback(
|
|
4127
4229
|
(e) => {
|
|
4128
4230
|
onRipplePointerDown(e);
|
|
4129
4231
|
setIsPressed(true);
|
|
@@ -4131,19 +4233,19 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4131
4233
|
},
|
|
4132
4234
|
[onRipplePointerDown, onPointerDown]
|
|
4133
4235
|
);
|
|
4134
|
-
const handlePointerUp =
|
|
4236
|
+
const handlePointerUp = React14__namespace.useCallback(
|
|
4135
4237
|
(e) => {
|
|
4136
4238
|
setIsPressed(false);
|
|
4137
4239
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
4138
4240
|
},
|
|
4139
4241
|
[onPointerUp]
|
|
4140
4242
|
);
|
|
4141
|
-
const handlePointerEnter =
|
|
4243
|
+
const handlePointerEnter = React14__namespace.useCallback(() => {
|
|
4142
4244
|
if (!disabled) {
|
|
4143
4245
|
setIsHovered(true);
|
|
4144
4246
|
}
|
|
4145
4247
|
}, [disabled]);
|
|
4146
|
-
const handlePointerLeave =
|
|
4248
|
+
const handlePointerLeave = React14__namespace.useCallback(
|
|
4147
4249
|
(e) => {
|
|
4148
4250
|
setIsHovered(false);
|
|
4149
4251
|
setIsPressed(false);
|
|
@@ -4151,21 +4253,21 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4151
4253
|
},
|
|
4152
4254
|
[onPointerLeave]
|
|
4153
4255
|
);
|
|
4154
|
-
const handlePointerCancel =
|
|
4256
|
+
const handlePointerCancel = React14__namespace.useCallback(
|
|
4155
4257
|
(e) => {
|
|
4156
4258
|
setIsPressed(false);
|
|
4157
4259
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
4158
4260
|
},
|
|
4159
4261
|
[onPointerCancel]
|
|
4160
4262
|
);
|
|
4161
|
-
const handleFocus =
|
|
4263
|
+
const handleFocus = React14__namespace.useCallback(
|
|
4162
4264
|
(e) => {
|
|
4163
4265
|
if (!disabled) setIsFocused(true);
|
|
4164
4266
|
onFocus == null ? void 0 : onFocus(e);
|
|
4165
4267
|
},
|
|
4166
4268
|
[disabled, onFocus]
|
|
4167
4269
|
);
|
|
4168
|
-
const handleBlur =
|
|
4270
|
+
const handleBlur = React14__namespace.useCallback(
|
|
4169
4271
|
(e) => {
|
|
4170
4272
|
setIsFocused(false);
|
|
4171
4273
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -4232,16 +4334,16 @@ var SplitButtonTrailingUncheckableComponent = React11__namespace.forwardRef(
|
|
|
4232
4334
|
}
|
|
4233
4335
|
);
|
|
4234
4336
|
SplitButtonTrailingUncheckableComponent.displayName = "SplitButtonTrailingUncheckable";
|
|
4235
|
-
var SplitButtonTrailingUncheckable =
|
|
4337
|
+
var SplitButtonTrailingUncheckable = React14__namespace.memo(
|
|
4236
4338
|
SplitButtonTrailingUncheckableComponent
|
|
4237
4339
|
);
|
|
4238
|
-
var FilledSplitButtonTrailingUncheckable =
|
|
4340
|
+
var FilledSplitButtonTrailingUncheckable = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "filled" }, props)));
|
|
4239
4341
|
FilledSplitButtonTrailingUncheckable.displayName = "FilledSplitButtonTrailingUncheckable";
|
|
4240
|
-
var TonalSplitButtonTrailingUncheckable =
|
|
4342
|
+
var TonalSplitButtonTrailingUncheckable = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4241
4343
|
TonalSplitButtonTrailingUncheckable.displayName = "TonalSplitButtonTrailingUncheckable";
|
|
4242
|
-
var ElevatedSplitButtonTrailingUncheckable =
|
|
4344
|
+
var ElevatedSplitButtonTrailingUncheckable = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4243
4345
|
ElevatedSplitButtonTrailingUncheckable.displayName = "ElevatedSplitButtonTrailingUncheckable";
|
|
4244
|
-
var OutlinedSplitButtonTrailingUncheckable =
|
|
4346
|
+
var OutlinedSplitButtonTrailingUncheckable = React14__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4245
4347
|
OutlinedSplitButtonTrailingUncheckable.displayName = "OutlinedSplitButtonTrailingUncheckable";
|
|
4246
4348
|
|
|
4247
4349
|
exports.BUTTON_COLOR_TOKENS = BUTTON_COLOR_TOKENS;
|