@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.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
3
|
import { m, LazyMotion, domMax, useMotionValue, animate, useAnimationFrame, AnimatePresence, useReducedMotion, useSpring, useTransform } from 'motion/react';
|
|
4
|
-
import * as
|
|
4
|
+
import * as React14 from 'react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -87,11 +87,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
87
87
|
var ROTATE_VALUES = "0 24 24; 154 24 24; 309 24 24; 463 24 24; 617 24 24; 771 24 24; 926 24 24; 1080 24 24";
|
|
88
88
|
var DETERMINATE_CIRCLE = "M24 7 C34.49 7 41 13.51 41 24 C41 34.49 34.49 41 24 41 C13.51 41 7 34.49 7 24 C7 13.51 13.51 7 24 7 Z";
|
|
89
89
|
var DETERMINATE_SOFT_BURST = "M20.9 10.4 21.4 9.5 21.9 8.7 22.5 7.8 23.2 7.2 24.2 7 25.1 7.4 25.7 8.1 26.2 9 26.8 9.8 27.3 10.6 28.1 11.2 29 11.3 30 11 30.9 10.6 31.8 10.3 32.8 9.9 33.7 10 34.5 10.6 34.9 11.5 34.8 12.5 34.8 13.5 34.7 14.5 34.7 15.5 35.2 16.3 36 16.8 37 17.1 37.9 17.3 38.9 17.5 39.8 17.9 40.4 18.7 40.5 19.7 40 20.5 39.4 21.3 38.7 22 38.1 22.8 37.6 23.7 37.7 24.6 38.3 25.5 38.9 26.2 39.6 27 40.2 27.7 40.5 28.7 40.3 29.6 39.5 30.3 38.6 30.6 37.6 30.8 36.7 31 35.7 31.3 35 31.9 34.6 32.8 34.7 33.8 34.8 34.8 34.9 35.8 34.8 36.8 34.3 37.6 33.4 38.1 32.4 38 31.5 37.6 30.6 37.2 29.7 36.9 28.7 36.6 27.8 36.9 27.1 37.6 26.6 38.5 26.1 39.3 25.5 40.2 24.8 40.8 23.8 41 22.9 40.6 22.3 39.9 21.8 39 21.2 38.2 20.7 37.4 19.9 36.8 19 36.7 18 37 17.1 37.4 16.2 37.7 15.2 38.1 14.3 38 13.5 37.4 13.1 36.5 13.2 35.5 13.2 34.5 13.3 33.5 13.3 32.5 12.8 31.7 12 31.2 11 31 10.1 30.7 9.1 30.5 8.2 30.1 7.6 29.3 7.5 28.3 8 27.5 8.7 26.7 9.3 26 9.9 25.2 10.4 24.3 10.3 23.4 9.7 22.5 9.1 21.8 8.4 21 7.8 20.3 7.5 19.3 7.7 18.4 8.5 17.7 9.4 17.4 10.4 17.2 11.3 17 12.3 16.7 13 16.1 13.4 15.2 13.3 14.2 13.2 13.2 13.1 12.2 13.2 11.2 13.7 10.4 14.6 9.9 15.6 10 16.5 10.4 17.4 10.8 18.3 11.1 19.3 11.4 20.2 11.1Z";
|
|
90
|
-
var IndeterminateSvg =
|
|
90
|
+
var IndeterminateSvg = React14.memo(function IndeterminateSvg2({
|
|
91
91
|
size
|
|
92
92
|
}) {
|
|
93
|
-
const [ready, setReady] =
|
|
94
|
-
|
|
93
|
+
const [ready, setReady] = React14.useState(false);
|
|
94
|
+
React14.useEffect(() => {
|
|
95
95
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
96
96
|
return () => cancelAnimationFrame(raf);
|
|
97
97
|
}, []);
|
|
@@ -136,7 +136,7 @@ var IndeterminateSvg = React11.memo(function IndeterminateSvg2({
|
|
|
136
136
|
}
|
|
137
137
|
);
|
|
138
138
|
});
|
|
139
|
-
var DeterminateSvg =
|
|
139
|
+
var DeterminateSvg = React14.memo(function DeterminateSvg2({
|
|
140
140
|
size,
|
|
141
141
|
progress
|
|
142
142
|
}) {
|
|
@@ -161,7 +161,7 @@ var DeterminateSvg = React11.memo(function DeterminateSvg2({
|
|
|
161
161
|
}
|
|
162
162
|
);
|
|
163
163
|
});
|
|
164
|
-
var LoadingIndicator =
|
|
164
|
+
var LoadingIndicator = React14.forwardRef(
|
|
165
165
|
(_a, ref) => {
|
|
166
166
|
var _b = _a, {
|
|
167
167
|
variant = "uncontained",
|
|
@@ -276,7 +276,7 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
276
276
|
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
277
277
|
return d;
|
|
278
278
|
}
|
|
279
|
-
var CircularProgress =
|
|
279
|
+
var CircularProgress = React14.forwardRef(
|
|
280
280
|
(_a, ref) => {
|
|
281
281
|
var _b = _a, {
|
|
282
282
|
value,
|
|
@@ -314,15 +314,15 @@ var CircularProgress = React11.forwardRef(
|
|
|
314
314
|
const isWavy = shape === "wavy";
|
|
315
315
|
const BASELINE_SIZE = 48;
|
|
316
316
|
const scaleFactor = size / BASELINE_SIZE;
|
|
317
|
-
const effectiveAmplitude =
|
|
317
|
+
const effectiveAmplitude = React14.useMemo(
|
|
318
318
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
319
319
|
[amplitude, scaleFactor]
|
|
320
320
|
);
|
|
321
|
-
const effectiveWavelength =
|
|
321
|
+
const effectiveWavelength = React14.useMemo(
|
|
322
322
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
323
323
|
[wavelength, scaleFactor]
|
|
324
324
|
);
|
|
325
|
-
const wavyActivePath =
|
|
325
|
+
const wavyActivePath = React14.useMemo(
|
|
326
326
|
() => isWavy ? generateWavyCircularPath(
|
|
327
327
|
center,
|
|
328
328
|
radius,
|
|
@@ -331,8 +331,8 @@ var CircularProgress = React11.forwardRef(
|
|
|
331
331
|
) : null,
|
|
332
332
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
333
333
|
);
|
|
334
|
-
const circumference =
|
|
335
|
-
const gapForTrack =
|
|
334
|
+
const circumference = React14.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
335
|
+
const gapForTrack = React14.useMemo(
|
|
336
336
|
() => (gapSize + trackHeight) / circumference,
|
|
337
337
|
[gapSize, trackHeight, circumference]
|
|
338
338
|
);
|
|
@@ -521,9 +521,9 @@ var CircularProgress = React11.forwardRef(
|
|
|
521
521
|
);
|
|
522
522
|
CircularProgress.displayName = "CircularProgress";
|
|
523
523
|
function useContainerWidth() {
|
|
524
|
-
const [width, setWidth] =
|
|
525
|
-
const observerRef =
|
|
526
|
-
const ref =
|
|
524
|
+
const [width, setWidth] = React14.useState(0);
|
|
525
|
+
const observerRef = React14.useRef(null);
|
|
526
|
+
const ref = React14.useCallback((node) => {
|
|
527
527
|
if (observerRef.current) {
|
|
528
528
|
observerRef.current.disconnect();
|
|
529
529
|
observerRef.current = null;
|
|
@@ -537,7 +537,7 @@ function useContainerWidth() {
|
|
|
537
537
|
observerRef.current = obs;
|
|
538
538
|
}
|
|
539
539
|
}, []);
|
|
540
|
-
|
|
540
|
+
React14.useEffect(() => {
|
|
541
541
|
return () => {
|
|
542
542
|
if (observerRef.current) {
|
|
543
543
|
observerRef.current.disconnect();
|
|
@@ -547,7 +547,7 @@ function useContainerWidth() {
|
|
|
547
547
|
return [ref, width];
|
|
548
548
|
}
|
|
549
549
|
function useMergedRef(...refs) {
|
|
550
|
-
return
|
|
550
|
+
return React14.useCallback(
|
|
551
551
|
(node) => {
|
|
552
552
|
for (const ref of refs) {
|
|
553
553
|
if (typeof ref === "function") {
|
|
@@ -561,7 +561,7 @@ function useMergedRef(...refs) {
|
|
|
561
561
|
[refs]
|
|
562
562
|
);
|
|
563
563
|
}
|
|
564
|
-
var FlatLinearTrack =
|
|
564
|
+
var FlatLinearTrack = React14.memo(function FlatLinearTrack2({
|
|
565
565
|
trackHeight,
|
|
566
566
|
activeColor,
|
|
567
567
|
trackColor,
|
|
@@ -637,7 +637,7 @@ var FlatLinearTrack = React11.memo(function FlatLinearTrack2({
|
|
|
637
637
|
}
|
|
638
638
|
);
|
|
639
639
|
});
|
|
640
|
-
var WavyLinearTrack =
|
|
640
|
+
var WavyLinearTrack = React14.memo(function WavyLinearTrack2({
|
|
641
641
|
trackHeight,
|
|
642
642
|
svgHeight,
|
|
643
643
|
amplitude,
|
|
@@ -656,13 +656,13 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
|
|
|
656
656
|
}) {
|
|
657
657
|
const isDeterminate = typeof value === "number";
|
|
658
658
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
659
|
-
const titleId =
|
|
659
|
+
const titleId = React14.useId();
|
|
660
660
|
const [containerRef, width] = useContainerWidth();
|
|
661
|
-
const activePathRef =
|
|
662
|
-
const trackPathRef =
|
|
661
|
+
const activePathRef = React14.useRef(null);
|
|
662
|
+
const trackPathRef = React14.useRef(null);
|
|
663
663
|
const amplitudeMV = useMotionValue(amplitude);
|
|
664
664
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
665
|
-
|
|
665
|
+
React14.useEffect(() => {
|
|
666
666
|
if (isDeterminate) {
|
|
667
667
|
const fraction = clampedValue / 100;
|
|
668
668
|
let targetAmp = amplitude;
|
|
@@ -833,7 +833,7 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
|
|
|
833
833
|
}
|
|
834
834
|
);
|
|
835
835
|
});
|
|
836
|
-
var LinearProgress =
|
|
836
|
+
var LinearProgress = React14.forwardRef(
|
|
837
837
|
(_a, ref) => {
|
|
838
838
|
var _b = _a, {
|
|
839
839
|
value,
|
|
@@ -874,10 +874,10 @@ var LinearProgress = React11.forwardRef(
|
|
|
874
874
|
]);
|
|
875
875
|
const isDeterminate = value !== void 0;
|
|
876
876
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
877
|
-
const containerRef =
|
|
877
|
+
const containerRef = React14.useRef(null);
|
|
878
878
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
879
|
-
const [isRtl, setIsRtl] =
|
|
880
|
-
|
|
879
|
+
const [isRtl, setIsRtl] = React14.useState(false);
|
|
880
|
+
React14.useEffect(() => {
|
|
881
881
|
if (containerRef.current) {
|
|
882
882
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
883
883
|
setIsRtl(dir === "rtl");
|
|
@@ -885,16 +885,16 @@ var LinearProgress = React11.forwardRef(
|
|
|
885
885
|
}, []);
|
|
886
886
|
const isWavy = shape === "wavy";
|
|
887
887
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
888
|
-
const effectiveAmplitude =
|
|
889
|
-
const svgHeight =
|
|
888
|
+
const effectiveAmplitude = React14.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
889
|
+
const svgHeight = React14.useMemo(
|
|
890
890
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
891
891
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
892
892
|
);
|
|
893
|
-
const shouldShowStop =
|
|
893
|
+
const shouldShowStop = React14.useMemo(
|
|
894
894
|
() => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
|
|
895
895
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
896
896
|
);
|
|
897
|
-
const stopSize =
|
|
897
|
+
const stopSize = React14.useMemo(
|
|
898
898
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
899
899
|
[trackHeight]
|
|
900
900
|
);
|
|
@@ -967,14 +967,14 @@ var LinearProgress = React11.forwardRef(
|
|
|
967
967
|
}
|
|
968
968
|
);
|
|
969
969
|
LinearProgress.displayName = "LinearProgress";
|
|
970
|
-
var ProgressIndicator =
|
|
970
|
+
var ProgressIndicator = React14.forwardRef((props, ref) => {
|
|
971
971
|
if (props.variant === "circular") {
|
|
972
972
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
973
973
|
}
|
|
974
974
|
return /* @__PURE__ */ jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
975
975
|
});
|
|
976
976
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
977
|
-
var RippleItem =
|
|
977
|
+
var RippleItem = React14.memo(function RippleItem2({
|
|
978
978
|
ripple,
|
|
979
979
|
onDone
|
|
980
980
|
}) {
|
|
@@ -1018,8 +1018,8 @@ function Ripple({
|
|
|
1018
1018
|
}
|
|
1019
1019
|
function useRippleState(options = {}) {
|
|
1020
1020
|
const { disabled = false } = options;
|
|
1021
|
-
const [ripples, setRipples] =
|
|
1022
|
-
const onPointerDown =
|
|
1021
|
+
const [ripples, setRipples] = React14.useState([]);
|
|
1022
|
+
const onPointerDown = React14.useCallback(
|
|
1023
1023
|
(e) => {
|
|
1024
1024
|
if (disabled) return;
|
|
1025
1025
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1033,7 +1033,7 @@ function useRippleState(options = {}) {
|
|
|
1033
1033
|
},
|
|
1034
1034
|
[disabled]
|
|
1035
1035
|
);
|
|
1036
|
-
const removeRipple =
|
|
1036
|
+
const removeRipple = React14.useCallback((id) => {
|
|
1037
1037
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
1038
1038
|
}, []);
|
|
1039
1039
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -1209,6 +1209,35 @@ var BUTTON_COLOR_TOKENS = {
|
|
|
1209
1209
|
default: "bg-transparent text-m3-primary",
|
|
1210
1210
|
selected: "bg-transparent text-m3-primary",
|
|
1211
1211
|
unselected: "bg-transparent text-m3-primary"
|
|
1212
|
+
},
|
|
1213
|
+
// ── MD3 Expressive accent variants ──────────────────────────────────────
|
|
1214
|
+
/**
|
|
1215
|
+
* High-chroma tertiary tone. Use for hero CTAs and expressive moments where
|
|
1216
|
+
* a distinct accent beyond primary is needed (e.g., hero chip, highlight fab).
|
|
1217
|
+
*/
|
|
1218
|
+
tertiary: {
|
|
1219
|
+
default: "bg-m3-tertiary text-m3-on-tertiary",
|
|
1220
|
+
selected: "bg-m3-tertiary text-m3-on-tertiary",
|
|
1221
|
+
unselected: "bg-m3-tertiary-container text-m3-on-tertiary-container"
|
|
1222
|
+
},
|
|
1223
|
+
/**
|
|
1224
|
+
* Brand-stable primary fixed. Hue stays consistent across light and dark modes.
|
|
1225
|
+
* Ideal for badges, pill chips, and elements that must carry the brand color
|
|
1226
|
+
* regardless of the active theme.
|
|
1227
|
+
*/
|
|
1228
|
+
"primary-fixed": {
|
|
1229
|
+
default: "bg-m3-primary-fixed text-m3-on-primary-fixed",
|
|
1230
|
+
selected: "bg-m3-primary-fixed text-m3-on-primary-fixed",
|
|
1231
|
+
unselected: "bg-m3-primary-fixed text-m3-on-primary-fixed-variant"
|
|
1232
|
+
},
|
|
1233
|
+
/**
|
|
1234
|
+
* Brand-stable tertiary fixed. Use for special-state indicators, achievement
|
|
1235
|
+
* badges, or accent pills that need a fixed tertiary hue across themes.
|
|
1236
|
+
*/
|
|
1237
|
+
"tertiary-fixed": {
|
|
1238
|
+
default: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed",
|
|
1239
|
+
selected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed",
|
|
1240
|
+
unselected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed-variant"
|
|
1212
1241
|
}
|
|
1213
1242
|
};
|
|
1214
1243
|
var MOTION_PROP_KEYS = [
|
|
@@ -1260,7 +1289,7 @@ function AnimatedIconSlot({
|
|
|
1260
1289
|
}
|
|
1261
1290
|
);
|
|
1262
1291
|
}
|
|
1263
|
-
var ButtonComponent =
|
|
1292
|
+
var ButtonComponent = React14.forwardRef(
|
|
1264
1293
|
(_a, ref) => {
|
|
1265
1294
|
var _b = _a, {
|
|
1266
1295
|
className,
|
|
@@ -1322,9 +1351,9 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1322
1351
|
borderWidth: outlineWidth != null ? outlineWidth : colorStyle === "outlined" ? sizeTokens.outlineWidth : 0,
|
|
1323
1352
|
borderStyle: colorStyle === "outlined" ? "solid" : void 0
|
|
1324
1353
|
}, style);
|
|
1325
|
-
const labelText =
|
|
1354
|
+
const labelText = React14.useMemo(() => {
|
|
1326
1355
|
if (asChild) {
|
|
1327
|
-
const child =
|
|
1356
|
+
const child = React14.Children.only(children);
|
|
1328
1357
|
return child.props.children;
|
|
1329
1358
|
}
|
|
1330
1359
|
return children;
|
|
@@ -1332,8 +1361,8 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1332
1361
|
const computedAriaLabel = ariaLabelProp || (typeof children === "string" ? children : void 0);
|
|
1333
1362
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1334
1363
|
const motionRadius = useMotionValue(animateRadius);
|
|
1335
|
-
const asChildRef =
|
|
1336
|
-
const mergedRef =
|
|
1364
|
+
const asChildRef = React14.useRef(null);
|
|
1365
|
+
const mergedRef = React14.useCallback(
|
|
1337
1366
|
(node) => {
|
|
1338
1367
|
asChildRef.current = node;
|
|
1339
1368
|
if (typeof ref === "function") ref(node);
|
|
@@ -1342,14 +1371,14 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1342
1371
|
},
|
|
1343
1372
|
[ref]
|
|
1344
1373
|
);
|
|
1345
|
-
|
|
1374
|
+
React14.useEffect(() => {
|
|
1346
1375
|
if (!asChild) return;
|
|
1347
1376
|
return motionRadius.on("change", (v) => {
|
|
1348
1377
|
if (asChildRef.current)
|
|
1349
1378
|
asChildRef.current.style.borderRadius = `${v}px`;
|
|
1350
1379
|
});
|
|
1351
1380
|
}, [motionRadius, asChild]);
|
|
1352
|
-
|
|
1381
|
+
React14.useEffect(() => {
|
|
1353
1382
|
if (!asChild) return;
|
|
1354
1383
|
const controls = springAnimate(motionRadius, animateRadius);
|
|
1355
1384
|
return () => controls.stop();
|
|
@@ -1357,14 +1386,14 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1357
1386
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1358
1387
|
disabled: loading
|
|
1359
1388
|
});
|
|
1360
|
-
const handleClick =
|
|
1389
|
+
const handleClick = React14.useCallback(
|
|
1361
1390
|
(e) => {
|
|
1362
1391
|
if (loading) return e.preventDefault();
|
|
1363
1392
|
onClick == null ? void 0 : onClick(e);
|
|
1364
1393
|
},
|
|
1365
1394
|
[loading, onClick]
|
|
1366
1395
|
);
|
|
1367
|
-
const handleKeyDown =
|
|
1396
|
+
const handleKeyDown = React14.useCallback(
|
|
1368
1397
|
(e) => {
|
|
1369
1398
|
if (loading) return;
|
|
1370
1399
|
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
@@ -1439,17 +1468,17 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1439
1468
|
}
|
|
1440
1469
|
) })
|
|
1441
1470
|
] });
|
|
1442
|
-
const handleAsChildPointerDown =
|
|
1471
|
+
const handleAsChildPointerDown = React14.useCallback(
|
|
1443
1472
|
(e) => {
|
|
1444
1473
|
springAnimate(motionRadius, pressedRadius);
|
|
1445
1474
|
onPointerDown == null ? void 0 : onPointerDown(e);
|
|
1446
1475
|
},
|
|
1447
1476
|
[motionRadius, pressedRadius, onPointerDown]
|
|
1448
1477
|
);
|
|
1449
|
-
const handleAsChildPointerUp =
|
|
1478
|
+
const handleAsChildPointerUp = React14.useCallback(() => {
|
|
1450
1479
|
springAnimate(motionRadius, animateRadius);
|
|
1451
1480
|
}, [motionRadius, animateRadius]);
|
|
1452
|
-
const handlePointerDown =
|
|
1481
|
+
const handlePointerDown = React14.useCallback(
|
|
1453
1482
|
(e) => {
|
|
1454
1483
|
onPointerDown(e);
|
|
1455
1484
|
},
|
|
@@ -1459,7 +1488,7 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1459
1488
|
const strippedProps = __spreadValues({}, restProps);
|
|
1460
1489
|
for (const key of MOTION_PROP_KEYS) delete strippedProps[key];
|
|
1461
1490
|
const htmlProps = strippedProps;
|
|
1462
|
-
const child =
|
|
1491
|
+
const child = React14.Children.only(children);
|
|
1463
1492
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1464
1493
|
Slot,
|
|
1465
1494
|
__spreadProps(__spreadValues({
|
|
@@ -1476,7 +1505,7 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1476
1505
|
}),
|
|
1477
1506
|
className: buttonClassName
|
|
1478
1507
|
}, htmlProps), {
|
|
1479
|
-
children:
|
|
1508
|
+
children: React14.cloneElement(child, { children: innerContent })
|
|
1480
1509
|
})
|
|
1481
1510
|
) });
|
|
1482
1511
|
}
|
|
@@ -1505,13 +1534,13 @@ var ButtonComponent = React11.forwardRef(
|
|
|
1505
1534
|
}
|
|
1506
1535
|
);
|
|
1507
1536
|
ButtonComponent.displayName = "Button";
|
|
1508
|
-
var Button =
|
|
1537
|
+
var Button = React14.memo(ButtonComponent);
|
|
1509
1538
|
var VARIANT_FONT = {
|
|
1510
1539
|
outlined: "'Material Symbols Outlined'",
|
|
1511
1540
|
rounded: "'Material Symbols Rounded'",
|
|
1512
1541
|
sharp: "'Material Symbols Sharp'"
|
|
1513
1542
|
};
|
|
1514
|
-
var IconComponent =
|
|
1543
|
+
var IconComponent = React14.forwardRef(
|
|
1515
1544
|
(_a, ref) => {
|
|
1516
1545
|
var _b = _a, {
|
|
1517
1546
|
name,
|
|
@@ -1577,7 +1606,7 @@ var IconComponent = React11.forwardRef(
|
|
|
1577
1606
|
}
|
|
1578
1607
|
);
|
|
1579
1608
|
IconComponent.displayName = "Icon";
|
|
1580
|
-
var Icon =
|
|
1609
|
+
var Icon = React14.memo(IconComponent);
|
|
1581
1610
|
var BUTTON_GROUP_TOKENS = {
|
|
1582
1611
|
standard: {
|
|
1583
1612
|
betweenSpace: 12,
|
|
@@ -1665,7 +1694,7 @@ var PILL_BORDER_RADIUS = 9999;
|
|
|
1665
1694
|
var MIN_FLEX_GROW = 0.01;
|
|
1666
1695
|
var PADDING_EXPAND_MULTIPLIER = 4;
|
|
1667
1696
|
var CHECK_ICON_SIZE = 24;
|
|
1668
|
-
var CHECK_ICON = /* @__PURE__ */ jsx(Icon, { name: "check", size: CHECK_ICON_SIZE, weight: 700 });
|
|
1697
|
+
var CHECK_ICON = /* @__PURE__ */ jsx(Icon, { name: "check", variant: "rounded", size: CHECK_ICON_SIZE, weight: 700 });
|
|
1669
1698
|
var CHECK_ICON_GAP_MAP = {
|
|
1670
1699
|
xs: 6,
|
|
1671
1700
|
sm: 8,
|
|
@@ -1685,13 +1714,7 @@ var WIDTH_MORPH_SPRING = {
|
|
|
1685
1714
|
damping: 38,
|
|
1686
1715
|
mass: 0.85
|
|
1687
1716
|
};
|
|
1688
|
-
var
|
|
1689
|
-
type: "spring",
|
|
1690
|
-
stiffness: 430,
|
|
1691
|
-
damping: 38,
|
|
1692
|
-
mass: 0.8
|
|
1693
|
-
};
|
|
1694
|
-
var AnimatedCheckLabel = React11.memo(function AnimatedCheckLabel2({
|
|
1717
|
+
var AnimatedCheckLabel = React14.memo(function AnimatedCheckLabel2({
|
|
1695
1718
|
selected,
|
|
1696
1719
|
size,
|
|
1697
1720
|
children
|
|
@@ -1728,23 +1751,6 @@ var AnimatedCheckLabel = React11.memo(function AnimatedCheckLabel2({
|
|
|
1728
1751
|
}
|
|
1729
1752
|
);
|
|
1730
1753
|
});
|
|
1731
|
-
var AnimatedNavbarLabel = React11.memo(function AnimatedNavbarLabel2({
|
|
1732
|
-
show,
|
|
1733
|
-
children
|
|
1734
|
-
}) {
|
|
1735
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "popLayout", children: show && /* @__PURE__ */ jsx(
|
|
1736
|
-
m.span,
|
|
1737
|
-
{
|
|
1738
|
-
initial: { width: 0, opacity: 0, scale: 0.8 },
|
|
1739
|
-
animate: { width: "auto", opacity: 1, scale: 1 },
|
|
1740
|
-
exit: { width: 0, opacity: 0, scale: 0.8 },
|
|
1741
|
-
transition: NAVBAR_EXPRESSIVE_SPRING,
|
|
1742
|
-
className: "overflow-hidden whitespace-nowrap text-sm font-semibold tracking-[0.01em] ml-1.5",
|
|
1743
|
-
children
|
|
1744
|
-
},
|
|
1745
|
-
"navbar-label"
|
|
1746
|
-
) });
|
|
1747
|
-
});
|
|
1748
1754
|
function resolveConnectedShapes(variant, orientation, isFirst, isLast, itemSize) {
|
|
1749
1755
|
const defaults = ButtonGroupDefaults.connectedLeadingButtonShapes(itemSize);
|
|
1750
1756
|
if (variant !== "connected") return defaults;
|
|
@@ -1765,7 +1771,7 @@ function resolveConnectedShapes(variant, orientation, isFirst, isLast, itemSize)
|
|
|
1765
1771
|
}
|
|
1766
1772
|
return defaults;
|
|
1767
1773
|
}
|
|
1768
|
-
function resolveIconAndLabel(element, isSelected, itemSize,
|
|
1774
|
+
function resolveIconAndLabel(element, isSelected, itemSize, showCheck, iconBehavior, labelBehavior) {
|
|
1769
1775
|
let icon = element.props.icon;
|
|
1770
1776
|
let label = element.props.children;
|
|
1771
1777
|
const animateCheckInLabel = showCheck && iconBehavior !== "none" && iconBehavior !== "selected" && label !== void 0;
|
|
@@ -1781,9 +1787,6 @@ function resolveIconAndLabel(element, isSelected, itemSize, variant, showCheck,
|
|
|
1781
1787
|
}
|
|
1782
1788
|
if (animateCheckInLabel && label !== void 0) {
|
|
1783
1789
|
label = /* @__PURE__ */ jsx(AnimatedCheckLabel, { selected: isSelected, size: itemSize, children: label });
|
|
1784
|
-
} else if (variant === "navbar" && label !== void 0) {
|
|
1785
|
-
const showLabel = !labelBehavior || labelBehavior === "all" || labelBehavior === "selected" && isSelected;
|
|
1786
|
-
label = /* @__PURE__ */ jsx(AnimatedNavbarLabel, { show: showLabel, children: label });
|
|
1787
1790
|
}
|
|
1788
1791
|
return { icon, label };
|
|
1789
1792
|
}
|
|
@@ -1818,13 +1821,11 @@ function resolveFlexTargets(variant, orientation, isSelected, isPressed, hasSele
|
|
|
1818
1821
|
function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex, existingAnimate, existingWhileTap) {
|
|
1819
1822
|
var _a, _b;
|
|
1820
1823
|
const props = { animate: __spreadValues({}, existingAnimate) };
|
|
1821
|
-
if (
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
props.animate.paddingInline = flex.paddingInline;
|
|
1827
|
-
}
|
|
1824
|
+
if (flex.flexGrow !== void 0) {
|
|
1825
|
+
props.animate.flexGrow = flex.flexGrow;
|
|
1826
|
+
}
|
|
1827
|
+
if (flex.paddingInline !== void 0) {
|
|
1828
|
+
props.animate.paddingInline = flex.paddingInline;
|
|
1828
1829
|
}
|
|
1829
1830
|
if (variant === "standard") {
|
|
1830
1831
|
const pressedRadius = (_a = PRESSED_RADIUS_MAP[itemSize]) != null ? _a : PRESSED_RADIUS_MAP.sm;
|
|
@@ -1875,16 +1876,9 @@ function buildMotionProps(variant, isSelected, isPressed, itemSize, shapes, flex
|
|
|
1875
1876
|
});
|
|
1876
1877
|
props.layout = true;
|
|
1877
1878
|
}
|
|
1878
|
-
if (variant === "navbar") {
|
|
1879
|
-
props.layout = true;
|
|
1880
|
-
props.transition = {
|
|
1881
|
-
layout: WIDTH_MORPH_SPRING,
|
|
1882
|
-
default: BUTTON_SHAPE_MORPH_SPRING
|
|
1883
|
-
};
|
|
1884
|
-
}
|
|
1885
1879
|
return props;
|
|
1886
1880
|
}
|
|
1887
|
-
var ButtonGroupComponent =
|
|
1881
|
+
var ButtonGroupComponent = React14.forwardRef(
|
|
1888
1882
|
(_a, ref) => {
|
|
1889
1883
|
var _b = _a, {
|
|
1890
1884
|
className,
|
|
@@ -1917,13 +1911,12 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1917
1911
|
"labelBehavior",
|
|
1918
1912
|
"style"
|
|
1919
1913
|
]);
|
|
1920
|
-
const [pressedIndex, setPressedIndex] =
|
|
1921
|
-
const [lockedGroupSize, setLockedGroupSize] =
|
|
1914
|
+
const [pressedIndex, setPressedIndex] = React14.useState(null);
|
|
1915
|
+
const [lockedGroupSize, setLockedGroupSize] = React14.useState(
|
|
1922
1916
|
null
|
|
1923
1917
|
);
|
|
1924
|
-
const
|
|
1925
|
-
const
|
|
1926
|
-
const setRootRef = React11.useCallback(
|
|
1918
|
+
const rootRef = React14.useRef(null);
|
|
1919
|
+
const setRootRef = React14.useCallback(
|
|
1927
1920
|
(node) => {
|
|
1928
1921
|
rootRef.current = node;
|
|
1929
1922
|
if (typeof ref === "function") {
|
|
@@ -1934,12 +1927,12 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1934
1927
|
},
|
|
1935
1928
|
[ref]
|
|
1936
1929
|
);
|
|
1937
|
-
const childrenArray =
|
|
1938
|
-
() =>
|
|
1930
|
+
const childrenArray = React14.useMemo(
|
|
1931
|
+
() => React14.Children.toArray(children).filter(React14.isValidElement),
|
|
1939
1932
|
[children]
|
|
1940
1933
|
);
|
|
1941
1934
|
const count = childrenArray.length;
|
|
1942
|
-
const groupSizeSignature =
|
|
1935
|
+
const groupSizeSignature = React14.useMemo(
|
|
1943
1936
|
() => `${childrenArray.map((child, index) => {
|
|
1944
1937
|
var _a2, _b2, _c, _d, _e;
|
|
1945
1938
|
const element = child;
|
|
@@ -1954,8 +1947,8 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1954
1947
|
}).join("|")}|${variant}|${orientation}|${showCheck}`,
|
|
1955
1948
|
[childrenArray, orientation, showCheck, size, variant]
|
|
1956
1949
|
);
|
|
1957
|
-
const groupSizeSignatureRef =
|
|
1958
|
-
|
|
1950
|
+
const groupSizeSignatureRef = React14.useRef(groupSizeSignature);
|
|
1951
|
+
React14.useLayoutEffect(() => {
|
|
1959
1952
|
if (groupSizeSignatureRef.current !== groupSizeSignature) {
|
|
1960
1953
|
groupSizeSignatureRef.current = groupSizeSignature;
|
|
1961
1954
|
setLockedGroupSize(null);
|
|
@@ -1963,7 +1956,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1963
1956
|
}, [groupSizeSignature]);
|
|
1964
1957
|
const hasExplicitGroupSize = orientation === "horizontal" ? (style == null ? void 0 : style.width) !== void 0 || (style == null ? void 0 : style.inlineSize) !== void 0 : (style == null ? void 0 : style.height) !== void 0 || (style == null ? void 0 : style.blockSize) !== void 0;
|
|
1965
1958
|
const shouldLockGroupSize = activeMorphing && !fullWidth && !hasExplicitGroupSize && count > 1;
|
|
1966
|
-
|
|
1959
|
+
React14.useLayoutEffect(() => {
|
|
1967
1960
|
if (!shouldLockGroupSize) {
|
|
1968
1961
|
if (lockedGroupSize !== null) setLockedGroupSize(null);
|
|
1969
1962
|
return;
|
|
@@ -1977,7 +1970,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1977
1970
|
setLockedGroupSize(Math.ceil(nextSize * 100) / 100);
|
|
1978
1971
|
}
|
|
1979
1972
|
}, [lockedGroupSize, orientation, shouldLockGroupSize]);
|
|
1980
|
-
const groupStyle =
|
|
1973
|
+
const groupStyle = React14.useMemo(() => {
|
|
1981
1974
|
const nextStyle = __spreadValues({}, style);
|
|
1982
1975
|
if (shouldLockGroupSize && lockedGroupSize !== null) {
|
|
1983
1976
|
if (orientation === "horizontal") {
|
|
@@ -1988,13 +1981,13 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
1988
1981
|
}
|
|
1989
1982
|
return nextStyle;
|
|
1990
1983
|
}, [lockedGroupSize, orientation, shouldLockGroupSize, style]);
|
|
1991
|
-
const hasSelected =
|
|
1984
|
+
const hasSelected = React14.useMemo(
|
|
1992
1985
|
() => childrenArray.some(
|
|
1993
1986
|
(child) => child.props.selected
|
|
1994
1987
|
),
|
|
1995
1988
|
[childrenArray]
|
|
1996
1989
|
);
|
|
1997
|
-
const handlePointerLeaveAndUp =
|
|
1990
|
+
const handlePointerLeaveAndUp = React14.useCallback(() => {
|
|
1998
1991
|
setPressedIndex(null);
|
|
1999
1992
|
}, []);
|
|
2000
1993
|
return /* @__PURE__ */ jsx(
|
|
@@ -2004,7 +1997,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2004
1997
|
className: cn(
|
|
2005
1998
|
"inline-flex p-0 m-0 border-none max-w-full [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2006
1999
|
orientation === "vertical" ? "flex-col items-stretch overflow-y-auto overflow-x-hidden" : "flex-row overflow-x-auto overflow-y-hidden",
|
|
2007
|
-
variant === "standard" ? "gap-3" :
|
|
2000
|
+
variant === "standard" ? "gap-3" : "gap-0.5",
|
|
2008
2001
|
fullWidth && "w-full",
|
|
2009
2002
|
fullWidth && orientation === "vertical" && "h-full",
|
|
2010
2003
|
className
|
|
@@ -2014,7 +2007,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2014
2007
|
onPointerUp: handlePointerLeaveAndUp
|
|
2015
2008
|
}, props), {
|
|
2016
2009
|
children: childrenArray.map((child, index) => {
|
|
2017
|
-
var _a2, _b2
|
|
2010
|
+
var _a2, _b2;
|
|
2018
2011
|
const element = child;
|
|
2019
2012
|
const isSelected = element.props.selected === true;
|
|
2020
2013
|
const isFirst = index === 0;
|
|
@@ -2026,7 +2019,6 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2026
2019
|
element,
|
|
2027
2020
|
isSelected,
|
|
2028
2021
|
itemSize,
|
|
2029
|
-
variant,
|
|
2030
2022
|
showCheck,
|
|
2031
2023
|
iconBehavior,
|
|
2032
2024
|
labelBehavior
|
|
@@ -2052,7 +2044,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2052
2044
|
basePx
|
|
2053
2045
|
);
|
|
2054
2046
|
const dynamicStyle = __spreadValues({}, element.props.style);
|
|
2055
|
-
if (
|
|
2047
|
+
if (flex.flexGrow !== void 0 && fullWidth) {
|
|
2056
2048
|
dynamicStyle.flexBasis = 0;
|
|
2057
2049
|
dynamicStyle.flexShrink = 1;
|
|
2058
2050
|
dynamicStyle.minWidth = 0;
|
|
@@ -2070,13 +2062,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2070
2062
|
existingWhileTap
|
|
2071
2063
|
);
|
|
2072
2064
|
const connectedClasses = variant === "connected" && isSelected ? "z-20" : "";
|
|
2073
|
-
const
|
|
2074
|
-
flexBasis: fullWidth && labelBehavior !== "selected" ? 0 : "auto",
|
|
2075
|
-
flexShrink: fullWidth ? 1 : 0,
|
|
2076
|
-
flexGrow: flex.flexGrow,
|
|
2077
|
-
minWidth: labelBehavior !== "selected" ? 0 : "fit-content"
|
|
2078
|
-
} : {};
|
|
2079
|
-
const clonedElement = React11.cloneElement(element, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
2065
|
+
const clonedElement = React14.cloneElement(element, __spreadValues(__spreadProps(__spreadValues({
|
|
2080
2066
|
key: (_b2 = element.key) != null ? _b2 : index,
|
|
2081
2067
|
tabIndex: isFirst ? 0 : -1,
|
|
2082
2068
|
size: size || element.props.size,
|
|
@@ -2085,71 +2071,20 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2085
2071
|
}, variant === "connected" && {
|
|
2086
2072
|
colorStyle: element.props.colorStyle || "tonal",
|
|
2087
2073
|
selectedColorStyle: element.props.selectedColorStyle || "filled"
|
|
2088
|
-
}),
|
|
2089
|
-
colorStyle: "text",
|
|
2090
|
-
selectedColorStyle: "text",
|
|
2091
|
-
className: cn(
|
|
2092
|
-
element.props.className,
|
|
2093
|
-
"w-full! h-full! px-3! min-w-0! relative z-20 flex items-center justify-center",
|
|
2094
|
-
isSelected ? "text-m3-on-secondary-container! hover:bg-transparent! active:bg-transparent!" : "text-m3-on-surface-variant! hover:bg-transparent! active:bg-transparent!",
|
|
2095
|
-
itemClassName
|
|
2096
|
-
)
|
|
2097
|
-
}), variant !== "navbar" && {
|
|
2074
|
+
}), {
|
|
2098
2075
|
className: cn(
|
|
2099
2076
|
element.props.className,
|
|
2100
2077
|
connectedClasses,
|
|
2101
2078
|
"focus-visible:z-10 hover:z-10 relative min-w-0",
|
|
2102
2079
|
orientation === "vertical" && "w-full",
|
|
2103
2080
|
itemClassName
|
|
2104
|
-
)
|
|
2105
|
-
|
|
2106
|
-
style: variant === "navbar" ? __spreadProps(__spreadValues({}, dynamicStyle), { minWidth: 0 }) : dynamicStyle,
|
|
2081
|
+
),
|
|
2082
|
+
style: dynamicStyle,
|
|
2107
2083
|
onPointerDown: (e) => {
|
|
2108
2084
|
setPressedIndex(index);
|
|
2109
2085
|
if (element.props.onPointerDown) element.props.onPointerDown(e);
|
|
2110
2086
|
}
|
|
2111
2087
|
}), motionProps));
|
|
2112
|
-
if (variant === "navbar") {
|
|
2113
|
-
return /* @__PURE__ */ jsxs(
|
|
2114
|
-
m.div,
|
|
2115
|
-
{
|
|
2116
|
-
layout: true,
|
|
2117
|
-
whileTap: { scale: 0.96 },
|
|
2118
|
-
transition: NAVBAR_EXPRESSIVE_SPRING,
|
|
2119
|
-
className: "group relative h-full flex items-center justify-center min-w-0",
|
|
2120
|
-
style: navbarFlexStyle,
|
|
2121
|
-
children: [
|
|
2122
|
-
/* @__PURE__ */ jsxs(
|
|
2123
|
-
"div",
|
|
2124
|
-
{
|
|
2125
|
-
className: "absolute inset-x-1 inset-y-0 m-auto flex items-center justify-center pointer-events-none",
|
|
2126
|
-
style: { zIndex: 1 },
|
|
2127
|
-
children: [
|
|
2128
|
-
/* @__PURE__ */ jsx(
|
|
2129
|
-
"div",
|
|
2130
|
-
{
|
|
2131
|
-
className: "w-full h-[40px] bg-m3-on-surface-variant/8 opacity-0 group-hover:opacity-100 transition-opacity duration-200",
|
|
2132
|
-
style: { borderRadius: PILL_BORDER_RADIUS }
|
|
2133
|
-
}
|
|
2134
|
-
),
|
|
2135
|
-
/* @__PURE__ */ jsx(AnimatePresence, { children: isSelected && /* @__PURE__ */ jsx(
|
|
2136
|
-
m.div,
|
|
2137
|
-
{
|
|
2138
|
-
layoutId: `navbar-active-indicator-${layoutIdGroup}`,
|
|
2139
|
-
className: "absolute inset-0 m-auto w-full h-[40px] bg-m3-secondary-container",
|
|
2140
|
-
style: { borderRadius: PILL_BORDER_RADIUS },
|
|
2141
|
-
transition: NAVBAR_EXPRESSIVE_SPRING
|
|
2142
|
-
}
|
|
2143
|
-
) })
|
|
2144
|
-
]
|
|
2145
|
-
}
|
|
2146
|
-
),
|
|
2147
|
-
clonedElement
|
|
2148
|
-
]
|
|
2149
|
-
},
|
|
2150
|
-
(_c = element.key) != null ? _c : index
|
|
2151
|
-
);
|
|
2152
|
-
}
|
|
2153
2088
|
return clonedElement;
|
|
2154
2089
|
})
|
|
2155
2090
|
})
|
|
@@ -2157,7 +2092,7 @@ var ButtonGroupComponent = React11.forwardRef(
|
|
|
2157
2092
|
}
|
|
2158
2093
|
);
|
|
2159
2094
|
ButtonGroupComponent.displayName = "ButtonGroup";
|
|
2160
|
-
var ButtonGroup =
|
|
2095
|
+
var ButtonGroup = React14.memo(ButtonGroupComponent);
|
|
2161
2096
|
var SIZE_HEIGHT = {
|
|
2162
2097
|
sm: "h-14",
|
|
2163
2098
|
md: "h-20",
|
|
@@ -2212,9 +2147,9 @@ var COLOR_CLASSES = {
|
|
|
2212
2147
|
}
|
|
2213
2148
|
};
|
|
2214
2149
|
function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
2215
|
-
const [collapsed, setCollapsed] =
|
|
2216
|
-
const lastScrollY =
|
|
2217
|
-
|
|
2150
|
+
const [collapsed, setCollapsed] = React14.useState(false);
|
|
2151
|
+
const lastScrollY = React14.useRef(0);
|
|
2152
|
+
React14.useEffect(() => {
|
|
2218
2153
|
if (!enabled || typeof window === "undefined") return;
|
|
2219
2154
|
lastScrollY.current = window.scrollY;
|
|
2220
2155
|
const handleScroll = () => {
|
|
@@ -2237,7 +2172,7 @@ function useScrollCollapse(enabled, scrollThreshold, onCollapsedChange) {
|
|
|
2237
2172
|
}, [enabled, scrollThreshold, collapsed, onCollapsedChange]);
|
|
2238
2173
|
return collapsed;
|
|
2239
2174
|
}
|
|
2240
|
-
var ExtendedFABComponent =
|
|
2175
|
+
var ExtendedFABComponent = React14.forwardRef(
|
|
2241
2176
|
(_a, ref) => {
|
|
2242
2177
|
var _b = _a, {
|
|
2243
2178
|
className,
|
|
@@ -2254,6 +2189,8 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2254
2189
|
scrollThreshold = 50,
|
|
2255
2190
|
collapsed,
|
|
2256
2191
|
onCollapsedChange,
|
|
2192
|
+
asChild = false,
|
|
2193
|
+
children,
|
|
2257
2194
|
onClick,
|
|
2258
2195
|
onKeyDown,
|
|
2259
2196
|
layoutId,
|
|
@@ -2273,16 +2210,18 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2273
2210
|
"scrollThreshold",
|
|
2274
2211
|
"collapsed",
|
|
2275
2212
|
"onCollapsedChange",
|
|
2213
|
+
"asChild",
|
|
2214
|
+
"children",
|
|
2276
2215
|
"onClick",
|
|
2277
2216
|
"onKeyDown",
|
|
2278
2217
|
"layoutId",
|
|
2279
2218
|
"aria-label"
|
|
2280
2219
|
]);
|
|
2281
2220
|
var _a2, _b2, _c, _d;
|
|
2282
|
-
const localRef =
|
|
2283
|
-
|
|
2284
|
-
const [dir, setDir] =
|
|
2285
|
-
|
|
2221
|
+
const localRef = React14.useRef(null);
|
|
2222
|
+
React14.useImperativeHandle(ref, () => localRef.current);
|
|
2223
|
+
const [dir, setDir] = React14.useState("ltr");
|
|
2224
|
+
React14.useEffect(() => {
|
|
2286
2225
|
var _a3;
|
|
2287
2226
|
if (!localRef.current) return;
|
|
2288
2227
|
const closestDir = (_a3 = localRef.current.closest("[dir]")) == null ? void 0 : _a3.getAttribute("dir");
|
|
@@ -2303,7 +2242,7 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2303
2242
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2304
2243
|
disabled: loading
|
|
2305
2244
|
});
|
|
2306
|
-
const handleClick =
|
|
2245
|
+
const handleClick = React14.useCallback(
|
|
2307
2246
|
(e) => {
|
|
2308
2247
|
if (loading) {
|
|
2309
2248
|
e.preventDefault();
|
|
@@ -2313,7 +2252,7 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2313
2252
|
},
|
|
2314
2253
|
[loading, onClick]
|
|
2315
2254
|
);
|
|
2316
|
-
const handleKeyDown =
|
|
2255
|
+
const handleKeyDown = React14.useCallback(
|
|
2317
2256
|
(e) => {
|
|
2318
2257
|
if (loading) return;
|
|
2319
2258
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2324,7 +2263,109 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2324
2263
|
},
|
|
2325
2264
|
[loading, onClick, onKeyDown]
|
|
2326
2265
|
);
|
|
2327
|
-
|
|
2266
|
+
const containerClassName = cn(
|
|
2267
|
+
"relative shrink-0 inline-flex items-center select-none cursor-pointer overflow-hidden",
|
|
2268
|
+
"transition-[box-shadow,filter] duration-200",
|
|
2269
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2270
|
+
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2271
|
+
colors.bg,
|
|
2272
|
+
colors.text,
|
|
2273
|
+
lowered ? "shadow-sm" : "shadow-md",
|
|
2274
|
+
(_d = SIZE_HEIGHT[size]) != null ? _d : "h-14",
|
|
2275
|
+
SIZE_TEXT[size],
|
|
2276
|
+
isCollapsed ? cn("px-0 justify-center", SIZE_WIDTH_COLLAPSED[size]) : cn(
|
|
2277
|
+
hasIcon ? "justify-start" : "justify-center",
|
|
2278
|
+
SIZE_PADDING[size],
|
|
2279
|
+
hasIcon && SIZE_GAP[size]
|
|
2280
|
+
),
|
|
2281
|
+
dir === "rtl" || restProps.dir === "rtl" ? "flex-row-reverse" : "flex-row",
|
|
2282
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2283
|
+
className
|
|
2284
|
+
);
|
|
2285
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2286
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2287
|
+
hasIcon && /* @__PURE__ */ jsx(
|
|
2288
|
+
m.span,
|
|
2289
|
+
{
|
|
2290
|
+
layout: "position",
|
|
2291
|
+
className: cn(
|
|
2292
|
+
"flex items-center justify-center shrink-0",
|
|
2293
|
+
sizeIcon.cls
|
|
2294
|
+
),
|
|
2295
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
2296
|
+
m.span,
|
|
2297
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2298
|
+
transition: SPRING_TRANSITION,
|
|
2299
|
+
className: "flex items-center justify-center shrink-0 w-full h-full",
|
|
2300
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
2301
|
+
LoadingIndicator,
|
|
2302
|
+
{
|
|
2303
|
+
size: sizeIcon.px,
|
|
2304
|
+
color: "currentColor",
|
|
2305
|
+
"aria-label": "Loading"
|
|
2306
|
+
}
|
|
2307
|
+
) : /* @__PURE__ */ jsx(
|
|
2308
|
+
ProgressIndicator,
|
|
2309
|
+
{
|
|
2310
|
+
variant: "circular",
|
|
2311
|
+
size: sizeIcon.px,
|
|
2312
|
+
color: "currentColor",
|
|
2313
|
+
trackColor: "transparent",
|
|
2314
|
+
"aria-label": "Loading"
|
|
2315
|
+
}
|
|
2316
|
+
)
|
|
2317
|
+
}),
|
|
2318
|
+
"loading"
|
|
2319
|
+
) : icon && /* @__PURE__ */ jsx(
|
|
2320
|
+
m.span,
|
|
2321
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2322
|
+
transition: SPRING_TRANSITION,
|
|
2323
|
+
"aria-hidden": "true",
|
|
2324
|
+
className: "flex items-center justify-center shrink-0 w-full h-full [&>svg]:w-full [&>svg]:h-full",
|
|
2325
|
+
children: icon
|
|
2326
|
+
}),
|
|
2327
|
+
"icon"
|
|
2328
|
+
) })
|
|
2329
|
+
}
|
|
2330
|
+
),
|
|
2331
|
+
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: !isCollapsed && /* @__PURE__ */ jsx(
|
|
2332
|
+
m.span,
|
|
2333
|
+
{
|
|
2334
|
+
layout: "position",
|
|
2335
|
+
initial: { opacity: 0, width: 0 },
|
|
2336
|
+
animate: { opacity: 1, width: "auto" },
|
|
2337
|
+
exit: { opacity: 0, width: 0 },
|
|
2338
|
+
transition: {
|
|
2339
|
+
opacity: { duration: 0.15, ease: "linear" },
|
|
2340
|
+
width: SPRING_TRANSITION
|
|
2341
|
+
},
|
|
2342
|
+
className: "overflow-hidden whitespace-nowrap",
|
|
2343
|
+
children: label
|
|
2344
|
+
},
|
|
2345
|
+
"label"
|
|
2346
|
+
) })
|
|
2347
|
+
] });
|
|
2348
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: visible && !(isCollapsed && !hasIcon) && (asChild ? /* @__PURE__ */ jsx(
|
|
2349
|
+
Slot,
|
|
2350
|
+
__spreadProps(__spreadValues({
|
|
2351
|
+
ref: localRef,
|
|
2352
|
+
"aria-label": ariaLabel || label,
|
|
2353
|
+
"aria-busy": loading || void 0,
|
|
2354
|
+
"aria-disabled": loading || restProps.disabled,
|
|
2355
|
+
onClick: handleClick,
|
|
2356
|
+
onPointerDown,
|
|
2357
|
+
onKeyDown: handleKeyDown,
|
|
2358
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
2359
|
+
borderRadius: `${radiusConfig.default}px`
|
|
2360
|
+
}),
|
|
2361
|
+
className: containerClassName
|
|
2362
|
+
}, restProps), {
|
|
2363
|
+
children: React14.cloneElement(
|
|
2364
|
+
React14.Children.only(children),
|
|
2365
|
+
{ children: innerContent }
|
|
2366
|
+
)
|
|
2367
|
+
})
|
|
2368
|
+
) : /* @__PURE__ */ jsx(
|
|
2328
2369
|
m.button,
|
|
2329
2370
|
__spreadProps(__spreadValues({
|
|
2330
2371
|
ref: localRef,
|
|
@@ -2356,95 +2397,15 @@ var ExtendedFABComponent = React11.forwardRef(
|
|
|
2356
2397
|
opacity: { duration: 0.2, ease: "linear" },
|
|
2357
2398
|
layout: SPRING_TRANSITION
|
|
2358
2399
|
},
|
|
2359
|
-
className:
|
|
2360
|
-
"relative shrink-0 inline-flex items-center select-none cursor-pointer overflow-hidden",
|
|
2361
|
-
"transition-[box-shadow,filter] duration-200",
|
|
2362
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2363
|
-
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2364
|
-
colors.bg,
|
|
2365
|
-
colors.text,
|
|
2366
|
-
lowered ? "shadow-sm" : "shadow-md",
|
|
2367
|
-
(_d = SIZE_HEIGHT[size]) != null ? _d : "h-14",
|
|
2368
|
-
SIZE_TEXT[size],
|
|
2369
|
-
isCollapsed ? cn("px-0 justify-center", SIZE_WIDTH_COLLAPSED[size]) : cn(
|
|
2370
|
-
hasIcon ? "justify-start" : "justify-center",
|
|
2371
|
-
SIZE_PADDING[size],
|
|
2372
|
-
hasIcon && SIZE_GAP[size]
|
|
2373
|
-
),
|
|
2374
|
-
dir === "rtl" || restProps.dir === "rtl" ? "flex-row-reverse" : "flex-row",
|
|
2375
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2376
|
-
className
|
|
2377
|
-
)
|
|
2400
|
+
className: containerClassName
|
|
2378
2401
|
}, restProps), {
|
|
2379
|
-
children:
|
|
2380
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2381
|
-
hasIcon && /* @__PURE__ */ jsx(
|
|
2382
|
-
m.span,
|
|
2383
|
-
{
|
|
2384
|
-
layout: "position",
|
|
2385
|
-
className: cn(
|
|
2386
|
-
"flex items-center justify-center shrink-0",
|
|
2387
|
-
sizeIcon.cls
|
|
2388
|
-
),
|
|
2389
|
-
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
2390
|
-
m.span,
|
|
2391
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2392
|
-
transition: SPRING_TRANSITION,
|
|
2393
|
-
className: "flex items-center justify-center shrink-0 w-full h-full",
|
|
2394
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
2395
|
-
LoadingIndicator,
|
|
2396
|
-
{
|
|
2397
|
-
size: sizeIcon.px,
|
|
2398
|
-
color: "currentColor",
|
|
2399
|
-
"aria-label": "Loading"
|
|
2400
|
-
}
|
|
2401
|
-
) : /* @__PURE__ */ jsx(
|
|
2402
|
-
ProgressIndicator,
|
|
2403
|
-
{
|
|
2404
|
-
variant: "circular",
|
|
2405
|
-
size: sizeIcon.px,
|
|
2406
|
-
color: "currentColor",
|
|
2407
|
-
trackColor: "transparent",
|
|
2408
|
-
"aria-label": "Loading"
|
|
2409
|
-
}
|
|
2410
|
-
)
|
|
2411
|
-
}),
|
|
2412
|
-
"loading"
|
|
2413
|
-
) : icon && /* @__PURE__ */ jsx(
|
|
2414
|
-
m.span,
|
|
2415
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2416
|
-
transition: SPRING_TRANSITION,
|
|
2417
|
-
"aria-hidden": "true",
|
|
2418
|
-
className: "flex items-center justify-center shrink-0 w-full h-full [&>svg]:w-full [&>svg]:h-full",
|
|
2419
|
-
children: icon
|
|
2420
|
-
}),
|
|
2421
|
-
"icon"
|
|
2422
|
-
) })
|
|
2423
|
-
}
|
|
2424
|
-
),
|
|
2425
|
-
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: !isCollapsed && /* @__PURE__ */ jsx(
|
|
2426
|
-
m.span,
|
|
2427
|
-
{
|
|
2428
|
-
layout: "position",
|
|
2429
|
-
initial: { opacity: 0, width: 0 },
|
|
2430
|
-
animate: { opacity: 1, width: "auto" },
|
|
2431
|
-
exit: { opacity: 0, width: 0 },
|
|
2432
|
-
transition: {
|
|
2433
|
-
opacity: { duration: 0.15, ease: "linear" },
|
|
2434
|
-
width: SPRING_TRANSITION
|
|
2435
|
-
},
|
|
2436
|
-
className: "overflow-hidden whitespace-nowrap",
|
|
2437
|
-
children: label
|
|
2438
|
-
},
|
|
2439
|
-
"label"
|
|
2440
|
-
) })
|
|
2441
|
-
]
|
|
2402
|
+
children: innerContent
|
|
2442
2403
|
})
|
|
2443
|
-
) }) });
|
|
2404
|
+
)) }) });
|
|
2444
2405
|
}
|
|
2445
2406
|
);
|
|
2446
2407
|
ExtendedFABComponent.displayName = "ExtendedFAB";
|
|
2447
|
-
var ExtendedFAB =
|
|
2408
|
+
var ExtendedFAB = React14.memo(ExtendedFABComponent);
|
|
2448
2409
|
var SIZE_STYLES = {
|
|
2449
2410
|
sm: "h-10 w-10",
|
|
2450
2411
|
md: "h-14 w-14",
|
|
@@ -2515,7 +2476,7 @@ function FABPosition({
|
|
|
2515
2476
|
}
|
|
2516
2477
|
);
|
|
2517
2478
|
}
|
|
2518
|
-
var FABComponent =
|
|
2479
|
+
var FABComponent = React14.forwardRef(
|
|
2519
2480
|
(_a, ref) => {
|
|
2520
2481
|
var _b = _a, {
|
|
2521
2482
|
className,
|
|
@@ -2529,6 +2490,7 @@ var FABComponent = React11.forwardRef(
|
|
|
2529
2490
|
loading = false,
|
|
2530
2491
|
loadingVariant = "loading-indicator",
|
|
2531
2492
|
visible = true,
|
|
2493
|
+
asChild = false,
|
|
2532
2494
|
onClick,
|
|
2533
2495
|
onKeyDown,
|
|
2534
2496
|
"aria-label": ariaLabel
|
|
@@ -2544,6 +2506,7 @@ var FABComponent = React11.forwardRef(
|
|
|
2544
2506
|
"loading",
|
|
2545
2507
|
"loadingVariant",
|
|
2546
2508
|
"visible",
|
|
2509
|
+
"asChild",
|
|
2547
2510
|
"onClick",
|
|
2548
2511
|
"onKeyDown",
|
|
2549
2512
|
"aria-label"
|
|
@@ -2560,7 +2523,7 @@ var FABComponent = React11.forwardRef(
|
|
|
2560
2523
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
2561
2524
|
disabled: loading
|
|
2562
2525
|
});
|
|
2563
|
-
const handleClick =
|
|
2526
|
+
const handleClick = React14.useCallback(
|
|
2564
2527
|
(e) => {
|
|
2565
2528
|
if (loading) {
|
|
2566
2529
|
e.preventDefault();
|
|
@@ -2570,7 +2533,7 @@ var FABComponent = React11.forwardRef(
|
|
|
2570
2533
|
},
|
|
2571
2534
|
[loading, onClick]
|
|
2572
2535
|
);
|
|
2573
|
-
const handleKeyDown =
|
|
2536
|
+
const handleKeyDown = React14.useCallback(
|
|
2574
2537
|
(e) => {
|
|
2575
2538
|
if (loading) return;
|
|
2576
2539
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -2581,19 +2544,116 @@ var FABComponent = React11.forwardRef(
|
|
|
2581
2544
|
},
|
|
2582
2545
|
[loading, onClick, onKeyDown]
|
|
2583
2546
|
);
|
|
2584
|
-
|
|
2547
|
+
const labelContent = asChild ? React14.Children.only(children).props.children : children;
|
|
2548
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2549
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
2550
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2551
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
2552
|
+
m.span,
|
|
2553
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2554
|
+
transition: SPRING_TRANSITION,
|
|
2555
|
+
className: cn(
|
|
2556
|
+
"flex items-center justify-center shrink-0",
|
|
2557
|
+
iconClass
|
|
2558
|
+
),
|
|
2559
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
2560
|
+
LoadingIndicator,
|
|
2561
|
+
{
|
|
2562
|
+
size: iconPx,
|
|
2563
|
+
color: "currentColor",
|
|
2564
|
+
"aria-label": "Loading"
|
|
2565
|
+
}
|
|
2566
|
+
) : /* @__PURE__ */ jsx(
|
|
2567
|
+
ProgressIndicator,
|
|
2568
|
+
{
|
|
2569
|
+
variant: "circular",
|
|
2570
|
+
size: iconPx,
|
|
2571
|
+
color: "currentColor",
|
|
2572
|
+
trackColor: "transparent",
|
|
2573
|
+
"aria-label": "Loading"
|
|
2574
|
+
}
|
|
2575
|
+
)
|
|
2576
|
+
}),
|
|
2577
|
+
"loading"
|
|
2578
|
+
) : /* @__PURE__ */ jsx(
|
|
2579
|
+
m.span,
|
|
2580
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2581
|
+
transition: SPRING_TRANSITION,
|
|
2582
|
+
"aria-hidden": "true",
|
|
2583
|
+
className: cn(
|
|
2584
|
+
"flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
2585
|
+
iconClass
|
|
2586
|
+
),
|
|
2587
|
+
children: icon
|
|
2588
|
+
}),
|
|
2589
|
+
"icon"
|
|
2590
|
+
) }),
|
|
2591
|
+
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: extended && labelContent && /* @__PURE__ */ jsx(
|
|
2592
|
+
m.span,
|
|
2593
|
+
{
|
|
2594
|
+
initial: { width: 0, opacity: 0 },
|
|
2595
|
+
animate: { width: "auto", opacity: 1 },
|
|
2596
|
+
exit: { width: 0, opacity: 0 },
|
|
2597
|
+
transition: SPRING_TRANSITION,
|
|
2598
|
+
className: "overflow-hidden whitespace-nowrap ml-3",
|
|
2599
|
+
children: labelContent
|
|
2600
|
+
},
|
|
2601
|
+
"label"
|
|
2602
|
+
) })
|
|
2603
|
+
] });
|
|
2604
|
+
const containerClassName = cn(
|
|
2605
|
+
"relative shrink-0 inline-flex items-center justify-center",
|
|
2606
|
+
"select-none cursor-pointer overflow-hidden",
|
|
2607
|
+
"transition-[box-shadow,opacity,filter] duration-200",
|
|
2608
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2609
|
+
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2610
|
+
colors.bg,
|
|
2611
|
+
colors.text,
|
|
2612
|
+
lowered ? "shadow-sm" : colors.shadow,
|
|
2613
|
+
(_d = SIZE_STYLES[size]) != null ? _d : "h-14 w-14",
|
|
2614
|
+
extended && "w-auto px-6",
|
|
2615
|
+
SIZE_TEXT_CLASS[size],
|
|
2616
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2617
|
+
className
|
|
2618
|
+
);
|
|
2619
|
+
const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
|
|
2620
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: visible && (asChild ? /* @__PURE__ */ jsx(
|
|
2621
|
+
Slot,
|
|
2622
|
+
__spreadProps(__spreadValues({
|
|
2623
|
+
ref,
|
|
2624
|
+
"aria-label": computedAriaLabel,
|
|
2625
|
+
"aria-busy": loading || void 0,
|
|
2626
|
+
"aria-disabled": loading || restProps.disabled,
|
|
2627
|
+
onClick: handleClick,
|
|
2628
|
+
onPointerDown,
|
|
2629
|
+
onKeyDown: handleKeyDown,
|
|
2630
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
2631
|
+
borderRadius: `${animateRadius}px`
|
|
2632
|
+
}),
|
|
2633
|
+
className: containerClassName
|
|
2634
|
+
}, restProps), {
|
|
2635
|
+
children: React14.cloneElement(
|
|
2636
|
+
React14.Children.only(children),
|
|
2637
|
+
{ children: innerContent }
|
|
2638
|
+
)
|
|
2639
|
+
})
|
|
2640
|
+
) : /* @__PURE__ */ jsx(
|
|
2585
2641
|
m.button,
|
|
2586
2642
|
__spreadProps(__spreadValues({
|
|
2587
2643
|
ref,
|
|
2588
2644
|
type: "button",
|
|
2589
|
-
"aria-label":
|
|
2645
|
+
"aria-label": computedAriaLabel,
|
|
2590
2646
|
"aria-busy": loading || void 0,
|
|
2591
2647
|
"aria-disabled": loading || restProps.disabled,
|
|
2592
2648
|
onClick: handleClick,
|
|
2593
2649
|
onPointerDown,
|
|
2594
2650
|
onKeyDown: handleKeyDown,
|
|
2595
2651
|
style,
|
|
2596
|
-
initial: {
|
|
2652
|
+
initial: {
|
|
2653
|
+
scale: 0.5,
|
|
2654
|
+
opacity: 0,
|
|
2655
|
+
borderRadius: animateRadius
|
|
2656
|
+
},
|
|
2597
2657
|
animate: { scale: 1, opacity: 1, borderRadius: animateRadius },
|
|
2598
2658
|
exit: { scale: 0.5, opacity: 0 },
|
|
2599
2659
|
whileTap: { borderRadius: pressedRadius },
|
|
@@ -2602,84 +2662,15 @@ var FABComponent = React11.forwardRef(
|
|
|
2602
2662
|
scale: SPRING_TRANSITION,
|
|
2603
2663
|
opacity: { duration: 0.25, ease: "easeOut" }
|
|
2604
2664
|
},
|
|
2605
|
-
className:
|
|
2606
|
-
"relative shrink-0 inline-flex items-center justify-center",
|
|
2607
|
-
"select-none cursor-pointer overflow-hidden",
|
|
2608
|
-
"transition-[box-shadow,opacity,filter] duration-200",
|
|
2609
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-2",
|
|
2610
|
-
"disabled:pointer-events-none disabled:opacity-[0.38] disabled:shadow-none",
|
|
2611
|
-
colors.bg,
|
|
2612
|
-
colors.text,
|
|
2613
|
-
lowered ? "shadow-sm" : colors.shadow,
|
|
2614
|
-
(_d = SIZE_STYLES[size]) != null ? _d : "h-14 w-14",
|
|
2615
|
-
extended && "w-auto px-6",
|
|
2616
|
-
SIZE_TEXT_CLASS[size],
|
|
2617
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
2618
|
-
className
|
|
2619
|
-
)
|
|
2665
|
+
className: containerClassName
|
|
2620
2666
|
}, restProps), {
|
|
2621
|
-
children:
|
|
2622
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
2623
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2624
|
-
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
2625
|
-
m.span,
|
|
2626
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2627
|
-
transition: SPRING_TRANSITION,
|
|
2628
|
-
className: cn(
|
|
2629
|
-
"flex items-center justify-center shrink-0",
|
|
2630
|
-
iconClass
|
|
2631
|
-
),
|
|
2632
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
2633
|
-
LoadingIndicator,
|
|
2634
|
-
{
|
|
2635
|
-
size: iconPx,
|
|
2636
|
-
color: "currentColor",
|
|
2637
|
-
"aria-label": "Loading"
|
|
2638
|
-
}
|
|
2639
|
-
) : /* @__PURE__ */ jsx(
|
|
2640
|
-
ProgressIndicator,
|
|
2641
|
-
{
|
|
2642
|
-
variant: "circular",
|
|
2643
|
-
size: iconPx,
|
|
2644
|
-
color: "currentColor",
|
|
2645
|
-
trackColor: "transparent",
|
|
2646
|
-
"aria-label": "Loading"
|
|
2647
|
-
}
|
|
2648
|
-
)
|
|
2649
|
-
}),
|
|
2650
|
-
"loading"
|
|
2651
|
-
) : /* @__PURE__ */ jsx(
|
|
2652
|
-
m.span,
|
|
2653
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
2654
|
-
transition: SPRING_TRANSITION,
|
|
2655
|
-
"aria-hidden": "true",
|
|
2656
|
-
className: cn(
|
|
2657
|
-
"flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
2658
|
-
iconClass
|
|
2659
|
-
),
|
|
2660
|
-
children: icon
|
|
2661
|
-
}),
|
|
2662
|
-
"icon"
|
|
2663
|
-
) }),
|
|
2664
|
-
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: extended && children && /* @__PURE__ */ jsx(
|
|
2665
|
-
m.span,
|
|
2666
|
-
{
|
|
2667
|
-
initial: { width: 0, opacity: 0 },
|
|
2668
|
-
animate: { width: "auto", opacity: 1 },
|
|
2669
|
-
exit: { width: 0, opacity: 0 },
|
|
2670
|
-
transition: SPRING_TRANSITION,
|
|
2671
|
-
className: "overflow-hidden whitespace-nowrap ml-3",
|
|
2672
|
-
children
|
|
2673
|
-
},
|
|
2674
|
-
"label"
|
|
2675
|
-
) })
|
|
2676
|
-
]
|
|
2667
|
+
children: innerContent
|
|
2677
2668
|
})
|
|
2678
|
-
) }) });
|
|
2669
|
+
)) }) });
|
|
2679
2670
|
}
|
|
2680
2671
|
);
|
|
2681
2672
|
FABComponent.displayName = "FAB";
|
|
2682
|
-
var FAB =
|
|
2673
|
+
var FAB = React14.memo(FABComponent);
|
|
2683
2674
|
var SPRING_NORMAL = { stiffness: 700, damping: 40 };
|
|
2684
2675
|
var SPRING_REDUCED = { stiffness: 1e4, damping: 100 };
|
|
2685
2676
|
var FOCUS_DELAY_MS = 50;
|
|
@@ -2787,7 +2778,7 @@ function CloseIcon() {
|
|
|
2787
2778
|
function defaultFabIcon(progress) {
|
|
2788
2779
|
return progress > 0.5 ? /* @__PURE__ */ jsx(CloseIcon, {}) : /* @__PURE__ */ jsx(AddIcon, {});
|
|
2789
2780
|
}
|
|
2790
|
-
var ToggleFABComponent =
|
|
2781
|
+
var ToggleFABComponent = React14.forwardRef(
|
|
2791
2782
|
({
|
|
2792
2783
|
expanded,
|
|
2793
2784
|
onToggle,
|
|
@@ -2805,7 +2796,7 @@ var ToggleFABComponent = React11.forwardRef(
|
|
|
2805
2796
|
const sizeTokens = (_b = TOGGLE_FAB_SIZES[fabSize]) != null ? _b : TOGGLE_FAB_SIZES.baseline;
|
|
2806
2797
|
const springConfig = prefersReduced ? SPRING_REDUCED : SPRING_NORMAL;
|
|
2807
2798
|
const checkedProgress = useSpring(expanded ? 1 : 0, springConfig);
|
|
2808
|
-
|
|
2799
|
+
React14.useEffect(() => {
|
|
2809
2800
|
checkedProgress.set(expanded ? 1 : 0);
|
|
2810
2801
|
}, [expanded, checkedProgress]);
|
|
2811
2802
|
const borderRadius = useTransform(
|
|
@@ -2813,12 +2804,12 @@ var ToggleFABComponent = React11.forwardRef(
|
|
|
2813
2804
|
[0, 1],
|
|
2814
2805
|
[`${sizeTokens.initialRadius}px`, `${sizeTokens.finalRadius}px`]
|
|
2815
2806
|
);
|
|
2816
|
-
const [iconProgress, setIconProgress] =
|
|
2817
|
-
|
|
2807
|
+
const [iconProgress, setIconProgress] = React14.useState(expanded ? 1 : 0);
|
|
2808
|
+
React14.useEffect(() => {
|
|
2818
2809
|
return checkedProgress.on("change", setIconProgress);
|
|
2819
2810
|
}, [checkedProgress]);
|
|
2820
2811
|
const { ripples, onPointerDown, removeRipple } = useRippleState();
|
|
2821
|
-
const handleClick =
|
|
2812
|
+
const handleClick = React14.useCallback(() => {
|
|
2822
2813
|
onToggle(!expanded);
|
|
2823
2814
|
}, [expanded, onToggle]);
|
|
2824
2815
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2867,7 +2858,7 @@ var ToggleFABComponent = React11.forwardRef(
|
|
|
2867
2858
|
}
|
|
2868
2859
|
);
|
|
2869
2860
|
ToggleFABComponent.displayName = "ToggleFAB";
|
|
2870
|
-
var ToggleFAB =
|
|
2861
|
+
var ToggleFAB = React14.memo(ToggleFABComponent);
|
|
2871
2862
|
function FABMenuItem({
|
|
2872
2863
|
icon,
|
|
2873
2864
|
label,
|
|
@@ -2875,12 +2866,14 @@ function FABMenuItem({
|
|
|
2875
2866
|
disabled = false,
|
|
2876
2867
|
colorVariant = "primary",
|
|
2877
2868
|
className,
|
|
2878
|
-
tabIndex = 0
|
|
2869
|
+
tabIndex = 0,
|
|
2870
|
+
asChild = false,
|
|
2871
|
+
children
|
|
2879
2872
|
}) {
|
|
2880
2873
|
var _a;
|
|
2881
2874
|
const colors = (_a = MENU_ITEM_COLORS[colorVariant]) != null ? _a : MENU_ITEM_COLORS.primary;
|
|
2882
2875
|
const { ripples, onPointerDown, removeRipple } = useRippleState({ disabled });
|
|
2883
|
-
const handleClick =
|
|
2876
|
+
const handleClick = React14.useCallback(
|
|
2884
2877
|
(e) => {
|
|
2885
2878
|
if (disabled) {
|
|
2886
2879
|
e.preventDefault();
|
|
@@ -2890,7 +2883,7 @@ function FABMenuItem({
|
|
|
2890
2883
|
},
|
|
2891
2884
|
[disabled, onClick]
|
|
2892
2885
|
);
|
|
2893
|
-
const handleKeyDown =
|
|
2886
|
+
const handleKeyDown = React14.useCallback(
|
|
2894
2887
|
(e) => {
|
|
2895
2888
|
if (disabled) return;
|
|
2896
2889
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -2900,7 +2893,55 @@ function FABMenuItem({
|
|
|
2900
2893
|
},
|
|
2901
2894
|
[disabled, onClick]
|
|
2902
2895
|
);
|
|
2903
|
-
|
|
2896
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2897
|
+
/* @__PURE__ */ jsx(TouchTarget, {}),
|
|
2898
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2899
|
+
/* @__PURE__ */ jsx(
|
|
2900
|
+
"span",
|
|
2901
|
+
{
|
|
2902
|
+
"aria-hidden": "true",
|
|
2903
|
+
className: "relative z-10 flex items-center justify-center size-6 shrink-0 [&>svg]:w-full [&>svg]:h-full pointer-events-none",
|
|
2904
|
+
children: icon
|
|
2905
|
+
}
|
|
2906
|
+
),
|
|
2907
|
+
label && /* @__PURE__ */ jsx("span", { className: "relative z-10 text-base font-medium leading-none pointer-events-none", children: label })
|
|
2908
|
+
] });
|
|
2909
|
+
const containerClassName = cn(
|
|
2910
|
+
"relative inline-flex flex-row items-center",
|
|
2911
|
+
"select-none cursor-pointer overflow-hidden",
|
|
2912
|
+
"whitespace-nowrap",
|
|
2913
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-1",
|
|
2914
|
+
MENU_ITEM_STYLES.size,
|
|
2915
|
+
MENU_ITEM_STYLES.gap,
|
|
2916
|
+
label ? MENU_ITEM_STYLES.padding : "px-4",
|
|
2917
|
+
!label && "justify-center",
|
|
2918
|
+
colors.bg,
|
|
2919
|
+
colors.text,
|
|
2920
|
+
disabled && "opacity-[0.38] pointer-events-none",
|
|
2921
|
+
className
|
|
2922
|
+
);
|
|
2923
|
+
const containerStyle = {
|
|
2924
|
+
transformOrigin: "right",
|
|
2925
|
+
borderRadius: `${MENU_ITEM_STYLES.cornerRadius}px`
|
|
2926
|
+
};
|
|
2927
|
+
if (asChild) {
|
|
2928
|
+
const child = React14.Children.only(children);
|
|
2929
|
+
return /* @__PURE__ */ jsx(m.div, { variants: MENU_ITEM_VARIANTS, style: containerStyle, children: /* @__PURE__ */ jsx(
|
|
2930
|
+
Slot,
|
|
2931
|
+
{
|
|
2932
|
+
role: "menuitem",
|
|
2933
|
+
tabIndex,
|
|
2934
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
2935
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
2936
|
+
onClick: handleClick,
|
|
2937
|
+
onPointerDown,
|
|
2938
|
+
onKeyDown: handleKeyDown,
|
|
2939
|
+
className: containerClassName,
|
|
2940
|
+
children: React14.cloneElement(child, { children: innerContent })
|
|
2941
|
+
}
|
|
2942
|
+
) });
|
|
2943
|
+
}
|
|
2944
|
+
return /* @__PURE__ */ jsx(
|
|
2904
2945
|
m.div,
|
|
2905
2946
|
{
|
|
2906
2947
|
role: "menuitem",
|
|
@@ -2911,37 +2952,9 @@ function FABMenuItem({
|
|
|
2911
2952
|
onPointerDown,
|
|
2912
2953
|
onKeyDown: handleKeyDown,
|
|
2913
2954
|
variants: MENU_ITEM_VARIANTS,
|
|
2914
|
-
style:
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
},
|
|
2918
|
-
className: cn(
|
|
2919
|
-
"relative inline-flex flex-row items-center",
|
|
2920
|
-
"select-none cursor-pointer overflow-hidden",
|
|
2921
|
-
"whitespace-nowrap",
|
|
2922
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-1",
|
|
2923
|
-
MENU_ITEM_STYLES.size,
|
|
2924
|
-
MENU_ITEM_STYLES.gap,
|
|
2925
|
-
label ? MENU_ITEM_STYLES.padding : "px-4",
|
|
2926
|
-
!label && "justify-center",
|
|
2927
|
-
colors.bg,
|
|
2928
|
-
colors.text,
|
|
2929
|
-
disabled && "opacity-[0.38] pointer-events-none",
|
|
2930
|
-
className
|
|
2931
|
-
),
|
|
2932
|
-
children: [
|
|
2933
|
-
/* @__PURE__ */ jsx(TouchTarget, {}),
|
|
2934
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
2935
|
-
/* @__PURE__ */ jsx(
|
|
2936
|
-
"span",
|
|
2937
|
-
{
|
|
2938
|
-
"aria-hidden": "true",
|
|
2939
|
-
className: "relative z-10 flex items-center justify-center size-6 shrink-0 [&>svg]:w-full [&>svg]:h-full pointer-events-none",
|
|
2940
|
-
children: icon
|
|
2941
|
-
}
|
|
2942
|
-
),
|
|
2943
|
-
label && /* @__PURE__ */ jsx("span", { className: "relative z-10 text-base font-medium leading-none pointer-events-none", children: label })
|
|
2944
|
-
]
|
|
2955
|
+
style: containerStyle,
|
|
2956
|
+
className: containerClassName,
|
|
2957
|
+
children: innerContent
|
|
2945
2958
|
}
|
|
2946
2959
|
);
|
|
2947
2960
|
}
|
|
@@ -2957,13 +2970,13 @@ function FABMenu({
|
|
|
2957
2970
|
focusLast = true,
|
|
2958
2971
|
"aria-label": ariaLabel
|
|
2959
2972
|
}) {
|
|
2960
|
-
const fabId =
|
|
2961
|
-
const menuId =
|
|
2962
|
-
const toggleRef =
|
|
2963
|
-
const itemRefs =
|
|
2964
|
-
const [focusedIndex, setFocusedIndex] =
|
|
2965
|
-
const reversedItems =
|
|
2966
|
-
const focusItem =
|
|
2973
|
+
const fabId = React14.useId();
|
|
2974
|
+
const menuId = React14.useId();
|
|
2975
|
+
const toggleRef = React14.useRef(null);
|
|
2976
|
+
const itemRefs = React14.useRef([]);
|
|
2977
|
+
const [focusedIndex, setFocusedIndex] = React14.useState(-1);
|
|
2978
|
+
const reversedItems = React14.useMemo(() => [...items].reverse(), [items]);
|
|
2979
|
+
const focusItem = React14.useCallback((index) => {
|
|
2967
2980
|
var _a;
|
|
2968
2981
|
const clampedIndex = Math.max(
|
|
2969
2982
|
0,
|
|
@@ -2972,8 +2985,8 @@ function FABMenu({
|
|
|
2972
2985
|
setFocusedIndex(clampedIndex);
|
|
2973
2986
|
(_a = itemRefs.current[clampedIndex]) == null ? void 0 : _a.focus();
|
|
2974
2987
|
}, []);
|
|
2975
|
-
const wasExpandedRef =
|
|
2976
|
-
|
|
2988
|
+
const wasExpandedRef = React14.useRef(false);
|
|
2989
|
+
React14.useEffect(() => {
|
|
2977
2990
|
var _a;
|
|
2978
2991
|
if (expanded) {
|
|
2979
2992
|
wasExpandedRef.current = true;
|
|
@@ -2988,7 +3001,7 @@ function FABMenu({
|
|
|
2988
3001
|
wasExpandedRef.current = false;
|
|
2989
3002
|
setFocusedIndex(-1);
|
|
2990
3003
|
}, [expanded, focusLast, items.length, focusItem]);
|
|
2991
|
-
const handleMenuKeyDown =
|
|
3004
|
+
const handleMenuKeyDown = React14.useCallback(
|
|
2992
3005
|
(e) => {
|
|
2993
3006
|
if (!expanded) return;
|
|
2994
3007
|
const lastIndex = items.length - 1;
|
|
@@ -3210,7 +3223,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
3210
3223
|
}
|
|
3211
3224
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
3212
3225
|
}
|
|
3213
|
-
var IconButtonComponent =
|
|
3226
|
+
var IconButtonComponent = React14.forwardRef(
|
|
3214
3227
|
(_a, ref) => {
|
|
3215
3228
|
var _b = _a, {
|
|
3216
3229
|
className,
|
|
@@ -3223,6 +3236,7 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3223
3236
|
loading = false,
|
|
3224
3237
|
loadingVariant = "loading-indicator",
|
|
3225
3238
|
iconSize,
|
|
3239
|
+
asChild = false,
|
|
3226
3240
|
children,
|
|
3227
3241
|
onClick,
|
|
3228
3242
|
onKeyDown,
|
|
@@ -3238,6 +3252,7 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3238
3252
|
"loading",
|
|
3239
3253
|
"loadingVariant",
|
|
3240
3254
|
"iconSize",
|
|
3255
|
+
"asChild",
|
|
3241
3256
|
"children",
|
|
3242
3257
|
"onClick",
|
|
3243
3258
|
"onKeyDown",
|
|
@@ -3246,18 +3261,18 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3246
3261
|
var _a2, _b2;
|
|
3247
3262
|
const isToggle = variant === "toggle";
|
|
3248
3263
|
const isSelected = isToggle && !!selected;
|
|
3249
|
-
const resolvedColorClass =
|
|
3264
|
+
const resolvedColorClass = React14.useMemo(
|
|
3250
3265
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
3251
3266
|
[isSelected, colorStyle]
|
|
3252
3267
|
);
|
|
3253
|
-
const outlineWidthClass =
|
|
3268
|
+
const outlineWidthClass = React14.useMemo(
|
|
3254
3269
|
() => {
|
|
3255
3270
|
var _a3;
|
|
3256
3271
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
3257
3272
|
},
|
|
3258
3273
|
[colorStyle, isSelected, size]
|
|
3259
3274
|
);
|
|
3260
|
-
const disabledBgClass =
|
|
3275
|
+
const disabledBgClass = React14.useMemo(
|
|
3261
3276
|
() => resolveDisabledBgClass(colorStyle),
|
|
3262
3277
|
[colorStyle]
|
|
3263
3278
|
);
|
|
@@ -3278,7 +3293,7 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3278
3293
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
3279
3294
|
disabled: loading
|
|
3280
3295
|
});
|
|
3281
|
-
const handleClick =
|
|
3296
|
+
const handleClick = React14.useCallback(
|
|
3282
3297
|
(e) => {
|
|
3283
3298
|
if (loading) {
|
|
3284
3299
|
e.preventDefault();
|
|
@@ -3288,7 +3303,7 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3288
3303
|
},
|
|
3289
3304
|
[loading, onClick]
|
|
3290
3305
|
);
|
|
3291
|
-
const handleKeyDown =
|
|
3306
|
+
const handleKeyDown = React14.useCallback(
|
|
3292
3307
|
(e) => {
|
|
3293
3308
|
if (loading) return;
|
|
3294
3309
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -3299,7 +3314,87 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3299
3314
|
},
|
|
3300
3315
|
[loading, onClick, onKeyDown]
|
|
3301
3316
|
);
|
|
3302
|
-
|
|
3317
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3318
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
3319
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3320
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
3321
|
+
m.span,
|
|
3322
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3323
|
+
transition: SPRING_TRANSITION,
|
|
3324
|
+
className: cn(
|
|
3325
|
+
"flex items-center justify-center shrink-0",
|
|
3326
|
+
iconSize != null ? void 0 : iconClass
|
|
3327
|
+
),
|
|
3328
|
+
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
3329
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
3330
|
+
LoadingIndicator,
|
|
3331
|
+
{
|
|
3332
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3333
|
+
color: "currentColor",
|
|
3334
|
+
"aria-label": "Loading"
|
|
3335
|
+
}
|
|
3336
|
+
) : /* @__PURE__ */ jsx(
|
|
3337
|
+
ProgressIndicator,
|
|
3338
|
+
{
|
|
3339
|
+
variant: "circular",
|
|
3340
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3341
|
+
color: "currentColor",
|
|
3342
|
+
trackColor: "transparent",
|
|
3343
|
+
"aria-label": "Loading"
|
|
3344
|
+
}
|
|
3345
|
+
)
|
|
3346
|
+
}),
|
|
3347
|
+
"loading"
|
|
3348
|
+
) : /* @__PURE__ */ jsx(
|
|
3349
|
+
m.span,
|
|
3350
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3351
|
+
transition: SPRING_TRANSITION,
|
|
3352
|
+
"aria-hidden": "true",
|
|
3353
|
+
className: cn(
|
|
3354
|
+
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
3355
|
+
iconSize != null ? void 0 : iconClass
|
|
3356
|
+
),
|
|
3357
|
+
style: {
|
|
3358
|
+
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
3359
|
+
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
3360
|
+
height: isCustomSize ? `${iconSize}px` : void 0
|
|
3361
|
+
},
|
|
3362
|
+
children: asChild ? React14.Children.only(children).props.children : children
|
|
3363
|
+
}),
|
|
3364
|
+
"content"
|
|
3365
|
+
) })
|
|
3366
|
+
] });
|
|
3367
|
+
const containerClassName = cn(
|
|
3368
|
+
baseIconButtonClasses,
|
|
3369
|
+
resolvedColorClass,
|
|
3370
|
+
outlineWidthClass,
|
|
3371
|
+
disabledBgClass,
|
|
3372
|
+
"overflow-hidden",
|
|
3373
|
+
SIZE_STYLES2[size],
|
|
3374
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
3375
|
+
className
|
|
3376
|
+
);
|
|
3377
|
+
if (asChild) {
|
|
3378
|
+
const child = React14.Children.only(children);
|
|
3379
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
3380
|
+
Slot,
|
|
3381
|
+
__spreadProps(__spreadValues({
|
|
3382
|
+
ref,
|
|
3383
|
+
"aria-pressed": isToggle ? isSelected : void 0,
|
|
3384
|
+
"aria-label": ariaLabel,
|
|
3385
|
+
"aria-busy": loading || void 0,
|
|
3386
|
+
"aria-disabled": loading || restProps.disabled,
|
|
3387
|
+
onClick: handleClick,
|
|
3388
|
+
onPointerDown,
|
|
3389
|
+
onKeyDown: handleKeyDown,
|
|
3390
|
+
style: __spreadProps(__spreadValues({}, style), { borderRadius: `${animateRadius}px` }),
|
|
3391
|
+
className: containerClassName
|
|
3392
|
+
}, restProps), {
|
|
3393
|
+
children: React14.cloneElement(child, { children: innerContent })
|
|
3394
|
+
})
|
|
3395
|
+
) });
|
|
3396
|
+
}
|
|
3397
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
3303
3398
|
m.button,
|
|
3304
3399
|
__spreadProps(__spreadValues({
|
|
3305
3400
|
ref,
|
|
@@ -3315,78 +3410,20 @@ var IconButtonComponent = React11.forwardRef(
|
|
|
3315
3410
|
animate: { borderRadius: animateRadius },
|
|
3316
3411
|
whileTap: { borderRadius: pressedRadius },
|
|
3317
3412
|
transition: { borderRadius: SPRING_TRANSITION_FAST },
|
|
3318
|
-
className:
|
|
3319
|
-
baseIconButtonClasses,
|
|
3320
|
-
resolvedColorClass,
|
|
3321
|
-
outlineWidthClass,
|
|
3322
|
-
disabledBgClass,
|
|
3323
|
-
"overflow-hidden",
|
|
3324
|
-
SIZE_STYLES2[size],
|
|
3325
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
3326
|
-
className
|
|
3327
|
-
)
|
|
3413
|
+
className: containerClassName
|
|
3328
3414
|
}, restProps), {
|
|
3329
|
-
children:
|
|
3330
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
3331
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3332
|
-
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
3333
|
-
m.span,
|
|
3334
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3335
|
-
transition: SPRING_TRANSITION,
|
|
3336
|
-
className: cn(
|
|
3337
|
-
"flex items-center justify-center shrink-0",
|
|
3338
|
-
iconSize != null ? void 0 : iconClass
|
|
3339
|
-
),
|
|
3340
|
-
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
3341
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
3342
|
-
LoadingIndicator,
|
|
3343
|
-
{
|
|
3344
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3345
|
-
color: "currentColor",
|
|
3346
|
-
"aria-label": "Loading"
|
|
3347
|
-
}
|
|
3348
|
-
) : /* @__PURE__ */ jsx(
|
|
3349
|
-
ProgressIndicator,
|
|
3350
|
-
{
|
|
3351
|
-
variant: "circular",
|
|
3352
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
3353
|
-
color: "currentColor",
|
|
3354
|
-
trackColor: "transparent",
|
|
3355
|
-
"aria-label": "Loading"
|
|
3356
|
-
}
|
|
3357
|
-
)
|
|
3358
|
-
}),
|
|
3359
|
-
"loading"
|
|
3360
|
-
) : /* @__PURE__ */ jsx(
|
|
3361
|
-
m.span,
|
|
3362
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
3363
|
-
transition: SPRING_TRANSITION,
|
|
3364
|
-
"aria-hidden": "true",
|
|
3365
|
-
className: cn(
|
|
3366
|
-
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
3367
|
-
iconSize != null ? void 0 : iconClass
|
|
3368
|
-
),
|
|
3369
|
-
style: {
|
|
3370
|
-
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
3371
|
-
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
3372
|
-
height: isCustomSize ? `${iconSize}px` : void 0
|
|
3373
|
-
},
|
|
3374
|
-
children
|
|
3375
|
-
}),
|
|
3376
|
-
"content"
|
|
3377
|
-
) })
|
|
3378
|
-
]
|
|
3415
|
+
children: innerContent
|
|
3379
3416
|
})
|
|
3380
3417
|
) });
|
|
3381
3418
|
}
|
|
3382
3419
|
);
|
|
3383
3420
|
IconButtonComponent.displayName = "IconButton";
|
|
3384
|
-
var IconButton =
|
|
3385
|
-
var SplitButtonContext =
|
|
3421
|
+
var IconButton = React14.memo(IconButtonComponent);
|
|
3422
|
+
var SplitButtonContext = React14.createContext(null);
|
|
3386
3423
|
function useSplitButtonContext() {
|
|
3387
|
-
return
|
|
3424
|
+
return React14.useContext(SplitButtonContext);
|
|
3388
3425
|
}
|
|
3389
|
-
var SplitButtonLayoutComponent =
|
|
3426
|
+
var SplitButtonLayoutComponent = React14.forwardRef(
|
|
3390
3427
|
(_a, ref) => {
|
|
3391
3428
|
var _b = _a, {
|
|
3392
3429
|
leadingButton,
|
|
@@ -3403,10 +3440,10 @@ var SplitButtonLayoutComponent = React11.forwardRef(
|
|
|
3403
3440
|
"variant",
|
|
3404
3441
|
"size"
|
|
3405
3442
|
]);
|
|
3406
|
-
const leadingProps =
|
|
3443
|
+
const leadingProps = React14.isValidElement(leadingButton) ? leadingButton.props : {};
|
|
3407
3444
|
const size = layoutSize || leadingProps.size;
|
|
3408
3445
|
const variant = layoutVariant || leadingProps.variant;
|
|
3409
|
-
const contextValue =
|
|
3446
|
+
const contextValue = React14.useMemo(
|
|
3410
3447
|
() => ({
|
|
3411
3448
|
size,
|
|
3412
3449
|
variant
|
|
@@ -3432,8 +3469,8 @@ var SplitButtonLayoutComponent = React11.forwardRef(
|
|
|
3432
3469
|
}
|
|
3433
3470
|
);
|
|
3434
3471
|
SplitButtonLayoutComponent.displayName = "SplitButtonLayout";
|
|
3435
|
-
var SplitButtonLayout =
|
|
3436
|
-
var StateLayer =
|
|
3472
|
+
var SplitButtonLayout = React14.memo(SplitButtonLayoutComponent);
|
|
3473
|
+
var StateLayer = React14.forwardRef(
|
|
3437
3474
|
(_a, ref) => {
|
|
3438
3475
|
var _b = _a, { className, hovered, focused, pressed } = _b, props = __objRest(_b, ["className", "hovered", "focused", "pressed"]);
|
|
3439
3476
|
let opacity = 0;
|
|
@@ -3685,7 +3722,7 @@ var splitButtonVariants = cva(
|
|
|
3685
3722
|
}
|
|
3686
3723
|
}
|
|
3687
3724
|
);
|
|
3688
|
-
var SplitButtonLeadingComponent =
|
|
3725
|
+
var SplitButtonLeadingComponent = React14.forwardRef(
|
|
3689
3726
|
(_a, ref) => {
|
|
3690
3727
|
var _b = _a, {
|
|
3691
3728
|
className,
|
|
@@ -3695,6 +3732,7 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3695
3732
|
icon,
|
|
3696
3733
|
children,
|
|
3697
3734
|
disabled,
|
|
3735
|
+
asChild = false,
|
|
3698
3736
|
onClick,
|
|
3699
3737
|
onPointerDown,
|
|
3700
3738
|
onPointerUp,
|
|
@@ -3710,6 +3748,7 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3710
3748
|
"icon",
|
|
3711
3749
|
"children",
|
|
3712
3750
|
"disabled",
|
|
3751
|
+
"asChild",
|
|
3713
3752
|
"onClick",
|
|
3714
3753
|
"onPointerDown",
|
|
3715
3754
|
"onPointerUp",
|
|
@@ -3722,9 +3761,9 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3722
3761
|
const context = useSplitButtonContext();
|
|
3723
3762
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
3724
3763
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
3725
|
-
const [isHovered, setIsHovered] =
|
|
3726
|
-
const [isFocused, setIsFocused] =
|
|
3727
|
-
const [isPressed, setIsPressed] =
|
|
3764
|
+
const [isHovered, setIsHovered] = React14.useState(false);
|
|
3765
|
+
const [isFocused, setIsFocused] = React14.useState(false);
|
|
3766
|
+
const [isPressed, setIsPressed] = React14.useState(false);
|
|
3728
3767
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
3729
3768
|
const typographyClass = (_c = BUTTON_TYPOGRAPHY_TOKENS[actualSize]) != null ? _c : BUTTON_TYPOGRAPHY_TOKENS.sm;
|
|
3730
3769
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -3736,7 +3775,7 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3736
3775
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
3737
3776
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
3738
3777
|
const borderRadius = `${outerRadius}px ${innerCornerRadius}px ${innerCornerRadius}px ${outerRadius}px`;
|
|
3739
|
-
const handleClick =
|
|
3778
|
+
const handleClick = React14.useCallback(
|
|
3740
3779
|
(e) => {
|
|
3741
3780
|
if (disabled) {
|
|
3742
3781
|
e.preventDefault();
|
|
@@ -3746,7 +3785,7 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3746
3785
|
},
|
|
3747
3786
|
[disabled, onClick]
|
|
3748
3787
|
);
|
|
3749
|
-
const handlePointerDown =
|
|
3788
|
+
const handlePointerDown = React14.useCallback(
|
|
3750
3789
|
(e) => {
|
|
3751
3790
|
onRipplePointerDown(e);
|
|
3752
3791
|
setIsPressed(true);
|
|
@@ -3754,19 +3793,19 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3754
3793
|
},
|
|
3755
3794
|
[onRipplePointerDown, onPointerDown]
|
|
3756
3795
|
);
|
|
3757
|
-
const handlePointerUp =
|
|
3796
|
+
const handlePointerUp = React14.useCallback(
|
|
3758
3797
|
(e) => {
|
|
3759
3798
|
setIsPressed(false);
|
|
3760
3799
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
3761
3800
|
},
|
|
3762
3801
|
[onPointerUp]
|
|
3763
3802
|
);
|
|
3764
|
-
const handlePointerEnter =
|
|
3803
|
+
const handlePointerEnter = React14.useCallback(() => {
|
|
3765
3804
|
if (!disabled) {
|
|
3766
3805
|
setIsHovered(true);
|
|
3767
3806
|
}
|
|
3768
3807
|
}, [disabled]);
|
|
3769
|
-
const handlePointerLeave =
|
|
3808
|
+
const handlePointerLeave = React14.useCallback(
|
|
3770
3809
|
(e) => {
|
|
3771
3810
|
setIsHovered(false);
|
|
3772
3811
|
setIsPressed(false);
|
|
@@ -3774,21 +3813,21 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3774
3813
|
},
|
|
3775
3814
|
[onPointerLeave]
|
|
3776
3815
|
);
|
|
3777
|
-
const handlePointerCancel =
|
|
3816
|
+
const handlePointerCancel = React14.useCallback(
|
|
3778
3817
|
(e) => {
|
|
3779
3818
|
setIsPressed(false);
|
|
3780
3819
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
3781
3820
|
},
|
|
3782
3821
|
[onPointerCancel]
|
|
3783
3822
|
);
|
|
3784
|
-
const handleFocus =
|
|
3823
|
+
const handleFocus = React14.useCallback(
|
|
3785
3824
|
(e) => {
|
|
3786
3825
|
if (!disabled) setIsFocused(true);
|
|
3787
3826
|
onFocus == null ? void 0 : onFocus(e);
|
|
3788
3827
|
},
|
|
3789
3828
|
[disabled, onFocus]
|
|
3790
3829
|
);
|
|
3791
|
-
const handleBlur =
|
|
3830
|
+
const handleBlur = React14.useCallback(
|
|
3792
3831
|
(e) => {
|
|
3793
3832
|
setIsFocused(false);
|
|
3794
3833
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -3796,12 +3835,73 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3796
3835
|
[onBlur]
|
|
3797
3836
|
);
|
|
3798
3837
|
const leadingIconSize = LEADING_ICON_SIZE_FOR_SIZE[actualSize];
|
|
3799
|
-
|
|
3838
|
+
const labelContent = asChild ? React14.Children.only(children).props.children : children;
|
|
3839
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3840
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
3841
|
+
/* @__PURE__ */ jsx(
|
|
3842
|
+
StateLayer,
|
|
3843
|
+
{
|
|
3844
|
+
hovered: isHovered,
|
|
3845
|
+
focused: isFocused,
|
|
3846
|
+
pressed: isPressed
|
|
3847
|
+
}
|
|
3848
|
+
),
|
|
3849
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3850
|
+
icon && /* @__PURE__ */ jsx(
|
|
3851
|
+
"span",
|
|
3852
|
+
{
|
|
3853
|
+
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full overflow-hidden [&_.md-icon]:text-[length:inherit]!",
|
|
3854
|
+
style: {
|
|
3855
|
+
fontSize: leadingIconSize,
|
|
3856
|
+
width: leadingIconSize,
|
|
3857
|
+
height: leadingIconSize
|
|
3858
|
+
},
|
|
3859
|
+
children: icon
|
|
3860
|
+
}
|
|
3861
|
+
),
|
|
3862
|
+
labelContent && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center h-full gap-[inherit]", children: labelContent })
|
|
3863
|
+
] });
|
|
3864
|
+
const containerClassName = cn(
|
|
3865
|
+
splitButtonVariants({
|
|
3866
|
+
variant: actualVariant,
|
|
3867
|
+
size: actualSize,
|
|
3868
|
+
disabled
|
|
3869
|
+
}),
|
|
3870
|
+
typographyClass,
|
|
3871
|
+
className
|
|
3872
|
+
);
|
|
3873
|
+
const mergedStyle = __spreadValues({
|
|
3874
|
+
paddingInlineStart: tokens.leadingPadding.start,
|
|
3875
|
+
paddingInlineEnd: tokens.leadingPadding.end,
|
|
3876
|
+
gap: "8px",
|
|
3877
|
+
borderRadius
|
|
3878
|
+
}, style);
|
|
3879
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: asChild ? /* @__PURE__ */ jsx(
|
|
3880
|
+
Slot,
|
|
3881
|
+
__spreadProps(__spreadValues({
|
|
3882
|
+
ref,
|
|
3883
|
+
"aria-disabled": disabled || void 0,
|
|
3884
|
+
onClick: handleClick,
|
|
3885
|
+
onPointerDown: handlePointerDown,
|
|
3886
|
+
onPointerUp: handlePointerUp,
|
|
3887
|
+
onPointerEnter: handlePointerEnter,
|
|
3888
|
+
onPointerLeave: handlePointerLeave,
|
|
3889
|
+
onPointerCancel: handlePointerCancel,
|
|
3890
|
+
onFocus: handleFocus,
|
|
3891
|
+
onBlur: handleBlur,
|
|
3892
|
+
style: mergedStyle,
|
|
3893
|
+
className: containerClassName
|
|
3894
|
+
}, restProps), {
|
|
3895
|
+
children: React14.cloneElement(
|
|
3896
|
+
React14.Children.only(children),
|
|
3897
|
+
{ children: innerContent }
|
|
3898
|
+
)
|
|
3899
|
+
})
|
|
3900
|
+
) : /* @__PURE__ */ jsx(
|
|
3800
3901
|
m.button,
|
|
3801
3902
|
__spreadProps(__spreadValues({
|
|
3802
3903
|
ref,
|
|
3803
3904
|
type: "button",
|
|
3804
|
-
"aria-disabled": disabled,
|
|
3805
3905
|
disabled,
|
|
3806
3906
|
onClick: handleClick,
|
|
3807
3907
|
onPointerDown: handlePointerDown,
|
|
@@ -3818,56 +3918,24 @@ var SplitButtonLeadingComponent = React11.forwardRef(
|
|
|
3818
3918
|
paddingInlineEnd: tokens.leadingPadding.end,
|
|
3819
3919
|
gap: "8px"
|
|
3820
3920
|
}, style),
|
|
3821
|
-
className:
|
|
3822
|
-
splitButtonVariants({
|
|
3823
|
-
variant: actualVariant,
|
|
3824
|
-
size: actualSize,
|
|
3825
|
-
disabled
|
|
3826
|
-
}),
|
|
3827
|
-
typographyClass,
|
|
3828
|
-
className
|
|
3829
|
-
)
|
|
3921
|
+
className: containerClassName
|
|
3830
3922
|
}, restProps), {
|
|
3831
|
-
children:
|
|
3832
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
3833
|
-
/* @__PURE__ */ jsx(
|
|
3834
|
-
StateLayer,
|
|
3835
|
-
{
|
|
3836
|
-
hovered: isHovered,
|
|
3837
|
-
focused: isFocused,
|
|
3838
|
-
pressed: isPressed
|
|
3839
|
-
}
|
|
3840
|
-
),
|
|
3841
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
3842
|
-
icon && /* @__PURE__ */ jsx(
|
|
3843
|
-
"span",
|
|
3844
|
-
{
|
|
3845
|
-
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full overflow-hidden [&_.md-icon]:text-[length:inherit]!",
|
|
3846
|
-
style: {
|
|
3847
|
-
fontSize: leadingIconSize,
|
|
3848
|
-
width: leadingIconSize,
|
|
3849
|
-
height: leadingIconSize
|
|
3850
|
-
},
|
|
3851
|
-
children: icon
|
|
3852
|
-
}
|
|
3853
|
-
),
|
|
3854
|
-
children && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center h-full gap-[inherit]", children })
|
|
3855
|
-
]
|
|
3923
|
+
children: innerContent
|
|
3856
3924
|
})
|
|
3857
3925
|
) });
|
|
3858
3926
|
}
|
|
3859
3927
|
);
|
|
3860
3928
|
SplitButtonLeadingComponent.displayName = "SplitButtonLeading";
|
|
3861
|
-
var SplitButtonLeading =
|
|
3862
|
-
var FilledSplitButtonLeading =
|
|
3929
|
+
var SplitButtonLeading = React14.memo(SplitButtonLeadingComponent);
|
|
3930
|
+
var FilledSplitButtonLeading = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonLeading, __spreadValues({ ref, variant: "filled" }, props)));
|
|
3863
3931
|
FilledSplitButtonLeading.displayName = "FilledSplitButtonLeading";
|
|
3864
|
-
var TonalSplitButtonLeading =
|
|
3932
|
+
var TonalSplitButtonLeading = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonLeading, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
3865
3933
|
TonalSplitButtonLeading.displayName = "TonalSplitButtonLeading";
|
|
3866
|
-
var ElevatedSplitButtonLeading =
|
|
3934
|
+
var ElevatedSplitButtonLeading = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonLeading, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
3867
3935
|
ElevatedSplitButtonLeading.displayName = "ElevatedSplitButtonLeading";
|
|
3868
|
-
var OutlinedSplitButtonLeading =
|
|
3936
|
+
var OutlinedSplitButtonLeading = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonLeading, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
3869
3937
|
OutlinedSplitButtonLeading.displayName = "OutlinedSplitButtonLeading";
|
|
3870
|
-
var SplitButtonTrailingComponent =
|
|
3938
|
+
var SplitButtonTrailingComponent = React14.forwardRef(
|
|
3871
3939
|
(_a, ref) => {
|
|
3872
3940
|
var _b = _a, {
|
|
3873
3941
|
className,
|
|
@@ -3884,6 +3952,8 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3884
3952
|
onPointerCancel,
|
|
3885
3953
|
onFocus,
|
|
3886
3954
|
onBlur,
|
|
3955
|
+
asChild = false,
|
|
3956
|
+
children,
|
|
3887
3957
|
"aria-label": ariaLabel
|
|
3888
3958
|
} = _b, restProps = __objRest(_b, [
|
|
3889
3959
|
"className",
|
|
@@ -3900,15 +3970,17 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3900
3970
|
"onPointerCancel",
|
|
3901
3971
|
"onFocus",
|
|
3902
3972
|
"onBlur",
|
|
3973
|
+
"asChild",
|
|
3974
|
+
"children",
|
|
3903
3975
|
"aria-label"
|
|
3904
3976
|
]);
|
|
3905
3977
|
var _a2, _b2;
|
|
3906
3978
|
const context = useSplitButtonContext();
|
|
3907
3979
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
3908
3980
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
3909
|
-
const [isHovered, setIsHovered] =
|
|
3910
|
-
const [isFocused, setIsFocused] =
|
|
3911
|
-
const [isPressed, setIsPressed] =
|
|
3981
|
+
const [isHovered, setIsHovered] = React14.useState(false);
|
|
3982
|
+
const [isFocused, setIsFocused] = React14.useState(false);
|
|
3983
|
+
const [isPressed, setIsPressed] = React14.useState(false);
|
|
3912
3984
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
3913
3985
|
const prefersReducedMotion = useReducedMotion();
|
|
3914
3986
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
@@ -3920,12 +3992,12 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3920
3992
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
3921
3993
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
3922
3994
|
const borderRadius = checked ? `${outerRadius}px ${outerRadius}px ${outerRadius}px ${outerRadius}px` : `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
3923
|
-
const handleToggle =
|
|
3995
|
+
const handleToggle = React14.useCallback(() => {
|
|
3924
3996
|
if (!disabled) {
|
|
3925
3997
|
onCheckedChange(!checked);
|
|
3926
3998
|
}
|
|
3927
3999
|
}, [disabled, checked, onCheckedChange]);
|
|
3928
|
-
const handlePointerDown =
|
|
4000
|
+
const handlePointerDown = React14.useCallback(
|
|
3929
4001
|
(e) => {
|
|
3930
4002
|
onRipplePointerDown(e);
|
|
3931
4003
|
setIsPressed(true);
|
|
@@ -3933,19 +4005,19 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3933
4005
|
},
|
|
3934
4006
|
[onRipplePointerDown, onPointerDown]
|
|
3935
4007
|
);
|
|
3936
|
-
const handlePointerUp =
|
|
4008
|
+
const handlePointerUp = React14.useCallback(
|
|
3937
4009
|
(e) => {
|
|
3938
4010
|
setIsPressed(false);
|
|
3939
4011
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
3940
4012
|
},
|
|
3941
4013
|
[onPointerUp]
|
|
3942
4014
|
);
|
|
3943
|
-
const handlePointerEnter =
|
|
4015
|
+
const handlePointerEnter = React14.useCallback(() => {
|
|
3944
4016
|
if (!disabled) {
|
|
3945
4017
|
setIsHovered(true);
|
|
3946
4018
|
}
|
|
3947
4019
|
}, [disabled]);
|
|
3948
|
-
const handlePointerLeave =
|
|
4020
|
+
const handlePointerLeave = React14.useCallback(
|
|
3949
4021
|
(e) => {
|
|
3950
4022
|
setIsHovered(false);
|
|
3951
4023
|
setIsPressed(false);
|
|
@@ -3953,35 +4025,102 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3953
4025
|
},
|
|
3954
4026
|
[onPointerLeave]
|
|
3955
4027
|
);
|
|
3956
|
-
const handlePointerCancel =
|
|
4028
|
+
const handlePointerCancel = React14.useCallback(
|
|
3957
4029
|
(e) => {
|
|
3958
4030
|
setIsPressed(false);
|
|
3959
4031
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
3960
4032
|
},
|
|
3961
4033
|
[onPointerCancel]
|
|
3962
4034
|
);
|
|
3963
|
-
const handleFocus =
|
|
4035
|
+
const handleFocus = React14.useCallback(
|
|
3964
4036
|
(e) => {
|
|
3965
4037
|
if (!disabled) setIsFocused(true);
|
|
3966
4038
|
onFocus == null ? void 0 : onFocus(e);
|
|
3967
4039
|
},
|
|
3968
4040
|
[disabled, onFocus]
|
|
3969
4041
|
);
|
|
3970
|
-
const handleBlur =
|
|
4042
|
+
const handleBlur = React14.useCallback(
|
|
3971
4043
|
(e) => {
|
|
3972
4044
|
setIsFocused(false);
|
|
3973
4045
|
onBlur == null ? void 0 : onBlur(e);
|
|
3974
4046
|
},
|
|
3975
4047
|
[onBlur]
|
|
3976
4048
|
);
|
|
3977
|
-
|
|
4049
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4050
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
4051
|
+
/* @__PURE__ */ jsx(
|
|
4052
|
+
StateLayer,
|
|
4053
|
+
{
|
|
4054
|
+
hovered: isHovered,
|
|
4055
|
+
focused: isFocused,
|
|
4056
|
+
pressed: isPressed
|
|
4057
|
+
}
|
|
4058
|
+
),
|
|
4059
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
4060
|
+
/* @__PURE__ */ jsx(
|
|
4061
|
+
m.div,
|
|
4062
|
+
{
|
|
4063
|
+
animate: {
|
|
4064
|
+
rotate: checked ? 180 : 0,
|
|
4065
|
+
x: checked ? 0 : tokens.opticalCenterOffset
|
|
4066
|
+
},
|
|
4067
|
+
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_CHEVRON_SPRING,
|
|
4068
|
+
className: "flex items-center justify-center shrink-0",
|
|
4069
|
+
children: icon != null ? icon : /* @__PURE__ */ jsx(
|
|
4070
|
+
Icon,
|
|
4071
|
+
{
|
|
4072
|
+
name: "arrow_drop_down",
|
|
4073
|
+
size: tokens.trailingIconSize,
|
|
4074
|
+
opticalSize: 24
|
|
4075
|
+
}
|
|
4076
|
+
)
|
|
4077
|
+
}
|
|
4078
|
+
)
|
|
4079
|
+
] });
|
|
4080
|
+
const containerClassName = cn(
|
|
4081
|
+
splitButtonVariants({
|
|
4082
|
+
variant: actualVariant,
|
|
4083
|
+
size: actualSize,
|
|
4084
|
+
disabled
|
|
4085
|
+
}),
|
|
4086
|
+
className
|
|
4087
|
+
);
|
|
4088
|
+
const mergedStyle = __spreadValues({
|
|
4089
|
+
paddingInlineStart: tokens.trailingPadding.start,
|
|
4090
|
+
paddingInlineEnd: tokens.trailingPadding.end,
|
|
4091
|
+
borderRadius
|
|
4092
|
+
}, style);
|
|
4093
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: asChild ? /* @__PURE__ */ jsx(
|
|
4094
|
+
Slot,
|
|
4095
|
+
__spreadProps(__spreadValues({
|
|
4096
|
+
ref,
|
|
4097
|
+
"aria-label": ariaLabel,
|
|
4098
|
+
"aria-expanded": checked,
|
|
4099
|
+
"aria-disabled": disabled,
|
|
4100
|
+
onClick: handleToggle,
|
|
4101
|
+
onPointerDown: handlePointerDown,
|
|
4102
|
+
onPointerUp: handlePointerUp,
|
|
4103
|
+
onPointerEnter: handlePointerEnter,
|
|
4104
|
+
onPointerLeave: handlePointerLeave,
|
|
4105
|
+
onPointerCancel: handlePointerCancel,
|
|
4106
|
+
onFocus: handleFocus,
|
|
4107
|
+
onBlur: handleBlur,
|
|
4108
|
+
style: mergedStyle,
|
|
4109
|
+
className: containerClassName
|
|
4110
|
+
}, restProps), {
|
|
4111
|
+
children: React14.cloneElement(
|
|
4112
|
+
React14.Children.only(children),
|
|
4113
|
+
{ children: innerContent }
|
|
4114
|
+
)
|
|
4115
|
+
})
|
|
4116
|
+
) : /* @__PURE__ */ jsx(
|
|
3978
4117
|
m.button,
|
|
3979
4118
|
__spreadProps(__spreadValues({
|
|
3980
4119
|
ref,
|
|
3981
4120
|
type: "button",
|
|
3982
|
-
"aria-pressed": checked,
|
|
3983
|
-
"aria-expanded": checked,
|
|
3984
4121
|
"aria-label": ariaLabel,
|
|
4122
|
+
"aria-expanded": checked,
|
|
4123
|
+
"aria-disabled": disabled,
|
|
3985
4124
|
disabled,
|
|
3986
4125
|
onClick: handleToggle,
|
|
3987
4126
|
onPointerDown: handlePointerDown,
|
|
@@ -3997,61 +4136,24 @@ var SplitButtonTrailingComponent = React11.forwardRef(
|
|
|
3997
4136
|
paddingInlineStart: tokens.trailingPadding.start,
|
|
3998
4137
|
paddingInlineEnd: tokens.trailingPadding.end
|
|
3999
4138
|
}, style),
|
|
4000
|
-
className:
|
|
4001
|
-
splitButtonVariants({
|
|
4002
|
-
variant: actualVariant,
|
|
4003
|
-
size: actualSize,
|
|
4004
|
-
disabled
|
|
4005
|
-
}),
|
|
4006
|
-
className
|
|
4007
|
-
)
|
|
4139
|
+
className: containerClassName
|
|
4008
4140
|
}, restProps), {
|
|
4009
|
-
children:
|
|
4010
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
4011
|
-
/* @__PURE__ */ jsx(
|
|
4012
|
-
StateLayer,
|
|
4013
|
-
{
|
|
4014
|
-
hovered: isHovered,
|
|
4015
|
-
focused: isFocused,
|
|
4016
|
-
pressed: isPressed
|
|
4017
|
-
}
|
|
4018
|
-
),
|
|
4019
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
4020
|
-
/* @__PURE__ */ jsx(
|
|
4021
|
-
m.div,
|
|
4022
|
-
{
|
|
4023
|
-
animate: {
|
|
4024
|
-
rotate: checked ? 180 : 0,
|
|
4025
|
-
x: checked ? 0 : tokens.opticalCenterOffset
|
|
4026
|
-
},
|
|
4027
|
-
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_CHEVRON_SPRING,
|
|
4028
|
-
className: "flex items-center justify-center shrink-0",
|
|
4029
|
-
children: icon != null ? icon : /* @__PURE__ */ jsx(
|
|
4030
|
-
Icon,
|
|
4031
|
-
{
|
|
4032
|
-
name: "arrow_drop_down",
|
|
4033
|
-
size: tokens.trailingIconSize,
|
|
4034
|
-
opticalSize: 24
|
|
4035
|
-
}
|
|
4036
|
-
)
|
|
4037
|
-
}
|
|
4038
|
-
)
|
|
4039
|
-
]
|
|
4141
|
+
children: innerContent
|
|
4040
4142
|
})
|
|
4041
4143
|
) });
|
|
4042
4144
|
}
|
|
4043
4145
|
);
|
|
4044
4146
|
SplitButtonTrailingComponent.displayName = "SplitButtonTrailing";
|
|
4045
|
-
var SplitButtonTrailing =
|
|
4046
|
-
var FilledSplitButtonTrailing =
|
|
4147
|
+
var SplitButtonTrailing = React14.memo(SplitButtonTrailingComponent);
|
|
4148
|
+
var FilledSplitButtonTrailing = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "filled" }, props)));
|
|
4047
4149
|
FilledSplitButtonTrailing.displayName = "FilledSplitButtonTrailing";
|
|
4048
|
-
var TonalSplitButtonTrailing =
|
|
4150
|
+
var TonalSplitButtonTrailing = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4049
4151
|
TonalSplitButtonTrailing.displayName = "TonalSplitButtonTrailing";
|
|
4050
|
-
var ElevatedSplitButtonTrailing =
|
|
4152
|
+
var ElevatedSplitButtonTrailing = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4051
4153
|
ElevatedSplitButtonTrailing.displayName = "ElevatedSplitButtonTrailing";
|
|
4052
|
-
var OutlinedSplitButtonTrailing =
|
|
4154
|
+
var OutlinedSplitButtonTrailing = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailing, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4053
4155
|
OutlinedSplitButtonTrailing.displayName = "OutlinedSplitButtonTrailing";
|
|
4054
|
-
var SplitButtonTrailingUncheckableComponent =
|
|
4156
|
+
var SplitButtonTrailingUncheckableComponent = React14.forwardRef(
|
|
4055
4157
|
(_a, ref) => {
|
|
4056
4158
|
var _b = _a, {
|
|
4057
4159
|
className,
|
|
@@ -4088,9 +4190,9 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4088
4190
|
const context = useSplitButtonContext();
|
|
4089
4191
|
const actualSize = (_a2 = context == null ? void 0 : context.size) != null ? _a2 : size;
|
|
4090
4192
|
const actualVariant = (_b2 = context == null ? void 0 : context.variant) != null ? _b2 : variant;
|
|
4091
|
-
const [isHovered, setIsHovered] =
|
|
4092
|
-
const [isFocused, setIsFocused] =
|
|
4093
|
-
const [isPressed, setIsPressed] =
|
|
4193
|
+
const [isHovered, setIsHovered] = React14.useState(false);
|
|
4194
|
+
const [isFocused, setIsFocused] = React14.useState(false);
|
|
4195
|
+
const [isPressed, setIsPressed] = React14.useState(false);
|
|
4094
4196
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
4095
4197
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
4096
4198
|
const {
|
|
@@ -4101,7 +4203,7 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4101
4203
|
const innerCornerRadius = isPressed || isFocused ? tokens.innerCorner.pressed : isHovered ? tokens.innerCorner.hovered : tokens.innerCorner.default;
|
|
4102
4204
|
const outerRadius = tokens.containerHeight * tokens.outerCornerPercent / 100;
|
|
4103
4205
|
const borderRadius = `${innerCornerRadius}px ${outerRadius}px ${outerRadius}px ${innerCornerRadius}px`;
|
|
4104
|
-
const handlePointerDown =
|
|
4206
|
+
const handlePointerDown = React14.useCallback(
|
|
4105
4207
|
(e) => {
|
|
4106
4208
|
onRipplePointerDown(e);
|
|
4107
4209
|
setIsPressed(true);
|
|
@@ -4109,19 +4211,19 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4109
4211
|
},
|
|
4110
4212
|
[onRipplePointerDown, onPointerDown]
|
|
4111
4213
|
);
|
|
4112
|
-
const handlePointerUp =
|
|
4214
|
+
const handlePointerUp = React14.useCallback(
|
|
4113
4215
|
(e) => {
|
|
4114
4216
|
setIsPressed(false);
|
|
4115
4217
|
onPointerUp == null ? void 0 : onPointerUp(e);
|
|
4116
4218
|
},
|
|
4117
4219
|
[onPointerUp]
|
|
4118
4220
|
);
|
|
4119
|
-
const handlePointerEnter =
|
|
4221
|
+
const handlePointerEnter = React14.useCallback(() => {
|
|
4120
4222
|
if (!disabled) {
|
|
4121
4223
|
setIsHovered(true);
|
|
4122
4224
|
}
|
|
4123
4225
|
}, [disabled]);
|
|
4124
|
-
const handlePointerLeave =
|
|
4226
|
+
const handlePointerLeave = React14.useCallback(
|
|
4125
4227
|
(e) => {
|
|
4126
4228
|
setIsHovered(false);
|
|
4127
4229
|
setIsPressed(false);
|
|
@@ -4129,21 +4231,21 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4129
4231
|
},
|
|
4130
4232
|
[onPointerLeave]
|
|
4131
4233
|
);
|
|
4132
|
-
const handlePointerCancel =
|
|
4234
|
+
const handlePointerCancel = React14.useCallback(
|
|
4133
4235
|
(e) => {
|
|
4134
4236
|
setIsPressed(false);
|
|
4135
4237
|
onPointerCancel == null ? void 0 : onPointerCancel(e);
|
|
4136
4238
|
},
|
|
4137
4239
|
[onPointerCancel]
|
|
4138
4240
|
);
|
|
4139
|
-
const handleFocus =
|
|
4241
|
+
const handleFocus = React14.useCallback(
|
|
4140
4242
|
(e) => {
|
|
4141
4243
|
if (!disabled) setIsFocused(true);
|
|
4142
4244
|
onFocus == null ? void 0 : onFocus(e);
|
|
4143
4245
|
},
|
|
4144
4246
|
[disabled, onFocus]
|
|
4145
4247
|
);
|
|
4146
|
-
const handleBlur =
|
|
4248
|
+
const handleBlur = React14.useCallback(
|
|
4147
4249
|
(e) => {
|
|
4148
4250
|
setIsFocused(false);
|
|
4149
4251
|
onBlur == null ? void 0 : onBlur(e);
|
|
@@ -4210,16 +4312,16 @@ var SplitButtonTrailingUncheckableComponent = React11.forwardRef(
|
|
|
4210
4312
|
}
|
|
4211
4313
|
);
|
|
4212
4314
|
SplitButtonTrailingUncheckableComponent.displayName = "SplitButtonTrailingUncheckable";
|
|
4213
|
-
var SplitButtonTrailingUncheckable =
|
|
4315
|
+
var SplitButtonTrailingUncheckable = React14.memo(
|
|
4214
4316
|
SplitButtonTrailingUncheckableComponent
|
|
4215
4317
|
);
|
|
4216
|
-
var FilledSplitButtonTrailingUncheckable =
|
|
4318
|
+
var FilledSplitButtonTrailingUncheckable = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "filled" }, props)));
|
|
4217
4319
|
FilledSplitButtonTrailingUncheckable.displayName = "FilledSplitButtonTrailingUncheckable";
|
|
4218
|
-
var TonalSplitButtonTrailingUncheckable =
|
|
4320
|
+
var TonalSplitButtonTrailingUncheckable = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "tonal" }, props)));
|
|
4219
4321
|
TonalSplitButtonTrailingUncheckable.displayName = "TonalSplitButtonTrailingUncheckable";
|
|
4220
|
-
var ElevatedSplitButtonTrailingUncheckable =
|
|
4322
|
+
var ElevatedSplitButtonTrailingUncheckable = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "elevated" }, props)));
|
|
4221
4323
|
ElevatedSplitButtonTrailingUncheckable.displayName = "ElevatedSplitButtonTrailingUncheckable";
|
|
4222
|
-
var OutlinedSplitButtonTrailingUncheckable =
|
|
4324
|
+
var OutlinedSplitButtonTrailingUncheckable = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx(SplitButtonTrailingUncheckable, __spreadValues({ ref, variant: "outlined" }, props)));
|
|
4223
4325
|
OutlinedSplitButtonTrailingUncheckable.displayName = "OutlinedSplitButtonTrailingUncheckable";
|
|
4224
4326
|
|
|
4225
4327
|
export { BUTTON_COLOR_TOKENS, BUTTON_GROUP_TOKENS, BUTTON_SIZE_TOKENS, Button, ButtonGroup, ButtonGroupDefaults, ElevatedSplitButtonLeading, ElevatedSplitButtonTrailing, ElevatedSplitButtonTrailingUncheckable, ExtendedFAB, FAB, FABMenu, FABMenuItem, FABPosition, FilledSplitButtonLeading, FilledSplitButtonTrailing, FilledSplitButtonTrailingUncheckable, IconButton, LEADING_ICON_SIZE_FOR_SIZE, OutlinedSplitButtonLeading, OutlinedSplitButtonTrailing, OutlinedSplitButtonTrailingUncheckable, SPLIT_BUTTON_CHEVRON_SPRING, SPLIT_BUTTON_RADIUS_SPRING, SPLIT_BUTTON_TOKENS, SplitButtonLayout, SplitButtonLeading, SplitButtonTrailing, SplitButtonTrailingUncheckable, ToggleFAB, TonalSplitButtonLeading, TonalSplitButtonTrailing, TonalSplitButtonTrailingUncheckable, splitButtonVariants };
|