@bug-on/m3-expressive 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/buttons.d.mts +1 -1
- package/dist/buttons.d.ts +1 -1
- package/dist/buttons.js +185 -40
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +186 -41
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +156 -25
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +157 -26
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +20 -0
- package/dist/feedback.d.ts +20 -0
- package/dist/feedback.js +156 -25
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +157 -26
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +3 -2
- package/dist/forms.d.ts +3 -2
- package/dist/forms.js +88 -100
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +88 -100
- package/dist/forms.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +279 -146
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +280 -147
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +158 -27
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +159 -28
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.js +156 -25
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +157 -26
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +156 -25
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +157 -26
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +156 -25
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +157 -26
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-26qlZvKT.d.mts → split-button-trailing-uncheckable-CIVEYgjY.d.mts} +2 -0
- package/dist/{split-button-trailing-uncheckable-CXUVrH64.d.ts → split-button-trailing-uncheckable-DTQJjzsB.d.ts} +2 -0
- package/dist/{text-field-DWC7qOvp.d.mts → text-field-CiOmDM_8.d.ts} +52 -51
- package/dist/{text-field-DWC7qOvp.d.ts → text-field-Ear3hCSq.d.mts} +52 -51
- package/package.json +3 -3
package/dist/buttons.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import { m,
|
|
3
|
+
import { m, useMotionValue, animate, useAnimationFrame, LazyMotion, domMax, AnimatePresence, useReducedMotion, useSpring, useTransform } from 'motion/react';
|
|
4
4
|
import * as React16 from 'react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -229,7 +229,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
|
|
|
229
229
|
function easeInOutCubic(x) {
|
|
230
230
|
return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
|
|
231
231
|
}
|
|
232
|
-
function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
232
|
+
function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
|
|
233
233
|
const circumference = 2 * Math.PI * radius;
|
|
234
234
|
const numWaves = Math.max(
|
|
235
235
|
3,
|
|
@@ -237,8 +237,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
237
237
|
);
|
|
238
238
|
const steps = numWaves * 4;
|
|
239
239
|
const dt = 2 * Math.PI / steps;
|
|
240
|
-
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
|
|
241
|
-
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
|
|
240
|
+
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
|
|
241
|
+
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
|
|
242
242
|
const xAt = (t) => center + rAt(t) * Math.cos(t);
|
|
243
243
|
const yAt = (t) => center + rAt(t) * Math.sin(t);
|
|
244
244
|
const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
|
|
@@ -303,15 +303,18 @@ var CircularProgress = React16.forwardRef(
|
|
|
303
303
|
size = 48,
|
|
304
304
|
trackHeight = 4,
|
|
305
305
|
shape = "flat",
|
|
306
|
+
trackShape = "flat",
|
|
306
307
|
amplitude,
|
|
307
308
|
wavelength,
|
|
308
309
|
gapSize = 4,
|
|
310
|
+
waveSpeed = 1,
|
|
309
311
|
crawlerSpeed = 1,
|
|
310
312
|
color,
|
|
311
313
|
trackColor,
|
|
312
314
|
showTrack = "auto",
|
|
313
315
|
minProgress = DEFAULT_MIN_PROGRESS,
|
|
314
316
|
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
317
|
+
determinateAnimation = "md3",
|
|
315
318
|
amplitudeRange,
|
|
316
319
|
className,
|
|
317
320
|
"aria-label": ariaLabel
|
|
@@ -320,15 +323,18 @@ var CircularProgress = React16.forwardRef(
|
|
|
320
323
|
"size",
|
|
321
324
|
"trackHeight",
|
|
322
325
|
"shape",
|
|
326
|
+
"trackShape",
|
|
323
327
|
"amplitude",
|
|
324
328
|
"wavelength",
|
|
325
329
|
"gapSize",
|
|
330
|
+
"waveSpeed",
|
|
326
331
|
"crawlerSpeed",
|
|
327
332
|
"color",
|
|
328
333
|
"trackColor",
|
|
329
334
|
"showTrack",
|
|
330
335
|
"minProgress",
|
|
331
336
|
"maxProgress",
|
|
337
|
+
"determinateAnimation",
|
|
332
338
|
"amplitudeRange",
|
|
333
339
|
"className",
|
|
334
340
|
"aria-label"
|
|
@@ -341,6 +347,7 @@ var CircularProgress = React16.forwardRef(
|
|
|
341
347
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
342
348
|
const isWavy = shape === "wavy";
|
|
343
349
|
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
350
|
+
const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
|
|
344
351
|
const BASELINE_SIZE = 48;
|
|
345
352
|
const scaleFactor = size / BASELINE_SIZE;
|
|
346
353
|
const effectiveAmplitude = React16.useMemo(
|
|
@@ -373,19 +380,50 @@ var CircularProgress = React16.forwardRef(
|
|
|
373
380
|
const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
|
|
374
381
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
375
382
|
const ActiveCircleElem = m.circle;
|
|
376
|
-
const ActivePathElem = m.path;
|
|
377
383
|
const indeterminateSvgRef = React16.useRef(null);
|
|
378
384
|
const indeterminateTrackRef = React16.useRef(null);
|
|
379
385
|
const indeterminateActiveRef = React16.useRef(null);
|
|
380
386
|
const indeterminateWavyTrackPathRef = React16.useRef(null);
|
|
381
387
|
const indeterminateWavyActivePathRef = React16.useRef(null);
|
|
388
|
+
const determinateWavyActivePathRef = React16.useRef(null);
|
|
389
|
+
const determinateWavyTrackPathRef = React16.useRef(null);
|
|
382
390
|
const cachedPathLengthRef = React16.useRef(0);
|
|
391
|
+
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 0);
|
|
392
|
+
const amplitudeMV = useMotionValue(isWavy ? effectiveAmplitude : 0);
|
|
393
|
+
React16.useEffect(() => {
|
|
394
|
+
if (isDeterminate) {
|
|
395
|
+
animate(fractionMV, clampedValue / 100, {
|
|
396
|
+
duration: 0.4,
|
|
397
|
+
ease: [0.2, 0, 0, 1]
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}, [clampedValue, isDeterminate, fractionMV]);
|
|
401
|
+
React16.useEffect(() => {
|
|
402
|
+
if (!isDeterminate || !isWavy) return;
|
|
403
|
+
const fraction = clampedValue / 100;
|
|
404
|
+
let targetAmp = effectiveAmplitude;
|
|
405
|
+
if (determinateAnimation === "md3") {
|
|
406
|
+
targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
|
|
407
|
+
}
|
|
408
|
+
animate(amplitudeMV, targetAmp, {
|
|
409
|
+
type: "spring",
|
|
410
|
+
bounce: 0,
|
|
411
|
+
duration: 0.5
|
|
412
|
+
});
|
|
413
|
+
}, [
|
|
414
|
+
clampedValue,
|
|
415
|
+
isDeterminate,
|
|
416
|
+
isWavy,
|
|
417
|
+
effectiveAmplitude,
|
|
418
|
+
amplitudeMV,
|
|
419
|
+
determinateAnimation
|
|
420
|
+
]);
|
|
383
421
|
React16.useLayoutEffect(() => {
|
|
384
422
|
if (!isWavy || !wavyActivePath) {
|
|
385
423
|
cachedPathLengthRef.current = circumference;
|
|
386
424
|
return;
|
|
387
425
|
}
|
|
388
|
-
const el = indeterminateActiveRef.current;
|
|
426
|
+
const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
|
|
389
427
|
if (el && "getTotalLength" in el) {
|
|
390
428
|
try {
|
|
391
429
|
const len = el.getTotalLength();
|
|
@@ -399,7 +437,65 @@ var CircularProgress = React16.forwardRef(
|
|
|
399
437
|
cachedPathLengthRef.current = circumference;
|
|
400
438
|
}, [isWavy, circumference, wavyActivePath]);
|
|
401
439
|
useAnimationFrame((time) => {
|
|
402
|
-
|
|
440
|
+
const safeWaveSpeed = Math.max(0.1, waveSpeed);
|
|
441
|
+
const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
|
|
442
|
+
if (isDeterminate) {
|
|
443
|
+
if (isWavy) {
|
|
444
|
+
const currentAmp = amplitudeMV.get();
|
|
445
|
+
const dynamicPath = generateWavyCircularPath(
|
|
446
|
+
center,
|
|
447
|
+
radius,
|
|
448
|
+
currentAmp,
|
|
449
|
+
effectiveWavelength,
|
|
450
|
+
wavePhase
|
|
451
|
+
);
|
|
452
|
+
if (determinateWavyActivePathRef.current) {
|
|
453
|
+
determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
454
|
+
}
|
|
455
|
+
if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
456
|
+
determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
457
|
+
}
|
|
458
|
+
const pathEl = determinateWavyActivePathRef.current;
|
|
459
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
460
|
+
if (pathEl) {
|
|
461
|
+
try {
|
|
462
|
+
const len = pathEl.getTotalLength();
|
|
463
|
+
if (len > 0) totalLen = len;
|
|
464
|
+
} catch (e) {
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
|
|
468
|
+
const activeLen = totalLen * activeFrac;
|
|
469
|
+
if (determinateWavyActivePathRef.current) {
|
|
470
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
471
|
+
"stroke-dasharray",
|
|
472
|
+
`${activeLen} ${totalLen}`
|
|
473
|
+
);
|
|
474
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
475
|
+
"stroke-dashoffset",
|
|
476
|
+
"0"
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
480
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
481
|
+
const trackStartFrac = activeFrac + gapFrac;
|
|
482
|
+
const trackLen = Math.max(
|
|
483
|
+
1e-3,
|
|
484
|
+
totalLen * (1 - activeFrac - 2 * gapFrac)
|
|
485
|
+
);
|
|
486
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
487
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
488
|
+
"stroke-dasharray",
|
|
489
|
+
`${trackLen} ${totalLen}`
|
|
490
|
+
);
|
|
491
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
492
|
+
"stroke-dashoffset",
|
|
493
|
+
`${trackOff}`
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
403
499
|
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
404
500
|
const scaledTime = time * safeCrawlerSpeed;
|
|
405
501
|
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
@@ -434,7 +530,8 @@ var CircularProgress = React16.forwardRef(
|
|
|
434
530
|
center,
|
|
435
531
|
radius,
|
|
436
532
|
currentAmplitude,
|
|
437
|
-
effectiveWavelength
|
|
533
|
+
effectiveWavelength,
|
|
534
|
+
wavePhase
|
|
438
535
|
);
|
|
439
536
|
if (indeterminateWavyActivePathRef.current) {
|
|
440
537
|
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
@@ -529,7 +626,7 @@ var CircularProgress = React16.forwardRef(
|
|
|
529
626
|
style: { width: size, height: size }
|
|
530
627
|
}, restProps), {
|
|
531
628
|
children: /* @__PURE__ */ jsxs(LazyMotion, { features: domMax, strict: true, children: [
|
|
532
|
-
/* @__PURE__ */
|
|
629
|
+
/* @__PURE__ */ jsx(
|
|
533
630
|
"svg",
|
|
534
631
|
{
|
|
535
632
|
width: size,
|
|
@@ -537,8 +634,18 @@ var CircularProgress = React16.forwardRef(
|
|
|
537
634
|
viewBox: `0 0 ${size} ${size}`,
|
|
538
635
|
"aria-hidden": "true",
|
|
539
636
|
style: { transform: "rotate(-90deg)", overflow: "visible" },
|
|
540
|
-
children: [
|
|
541
|
-
|
|
637
|
+
children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
638
|
+
shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsx(
|
|
639
|
+
"path",
|
|
640
|
+
{
|
|
641
|
+
ref: determinateWavyTrackPathRef,
|
|
642
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
643
|
+
fill: "none",
|
|
644
|
+
stroke: bgTrackColor,
|
|
645
|
+
strokeWidth: trackHeight,
|
|
646
|
+
strokeLinecap: "round"
|
|
647
|
+
}
|
|
648
|
+
) : /* @__PURE__ */ jsx(
|
|
542
649
|
m.circle,
|
|
543
650
|
{
|
|
544
651
|
cx: center,
|
|
@@ -547,28 +654,52 @@ var CircularProgress = React16.forwardRef(
|
|
|
547
654
|
fill: "none",
|
|
548
655
|
stroke: bgTrackColor,
|
|
549
656
|
strokeWidth: trackHeight,
|
|
550
|
-
initial: {
|
|
551
|
-
|
|
657
|
+
initial: {
|
|
658
|
+
pathLength: trackLength,
|
|
659
|
+
pathOffset: trackOffset
|
|
660
|
+
},
|
|
661
|
+
animate: {
|
|
662
|
+
pathLength: trackLength,
|
|
663
|
+
pathOffset: trackOffset
|
|
664
|
+
},
|
|
552
665
|
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
553
666
|
strokeLinecap: "round"
|
|
554
667
|
}
|
|
555
|
-
)
|
|
556
|
-
|
|
557
|
-
|
|
668
|
+
)),
|
|
669
|
+
/* @__PURE__ */ jsx(
|
|
670
|
+
"path",
|
|
558
671
|
{
|
|
672
|
+
ref: determinateWavyActivePathRef,
|
|
559
673
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
560
674
|
fill: "none",
|
|
561
675
|
stroke: activeColor,
|
|
562
676
|
strokeWidth: trackHeight,
|
|
563
|
-
strokeLinecap: "round"
|
|
564
|
-
initial: { pathLength: 0 },
|
|
565
|
-
animate: { pathLength: clampedValue / 100 },
|
|
566
|
-
transition: {
|
|
567
|
-
duration: 0.4,
|
|
568
|
-
ease: [0.2, 0, 0, 1]
|
|
569
|
-
}
|
|
677
|
+
strokeLinecap: "round"
|
|
570
678
|
}
|
|
571
|
-
)
|
|
679
|
+
)
|
|
680
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
681
|
+
/* @__PURE__ */ jsx(
|
|
682
|
+
m.circle,
|
|
683
|
+
{
|
|
684
|
+
cx: center,
|
|
685
|
+
cy: center,
|
|
686
|
+
r: radius,
|
|
687
|
+
fill: "none",
|
|
688
|
+
stroke: bgTrackColor,
|
|
689
|
+
strokeWidth: trackHeight,
|
|
690
|
+
initial: {
|
|
691
|
+
pathLength: trackLength,
|
|
692
|
+
pathOffset: trackOffset
|
|
693
|
+
},
|
|
694
|
+
animate: {
|
|
695
|
+
pathLength: trackLength,
|
|
696
|
+
pathOffset: trackOffset
|
|
697
|
+
},
|
|
698
|
+
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
699
|
+
strokeLinecap: "round"
|
|
700
|
+
}
|
|
701
|
+
),
|
|
702
|
+
/* @__PURE__ */ jsx(
|
|
572
703
|
ActiveCircleElem,
|
|
573
704
|
{
|
|
574
705
|
cx: center,
|
|
@@ -585,8 +716,8 @@ var CircularProgress = React16.forwardRef(
|
|
|
585
716
|
ease: [0.2, 0, 0, 1]
|
|
586
717
|
}
|
|
587
718
|
}
|
|
588
|
-
)
|
|
589
|
-
]
|
|
719
|
+
)
|
|
720
|
+
] }) : null
|
|
590
721
|
}
|
|
591
722
|
),
|
|
592
723
|
!isDeterminate && /* @__PURE__ */ jsx(
|
|
@@ -3863,11 +3994,12 @@ var SplitButtonLayoutComponent = React16.forwardRef(
|
|
|
3863
3994
|
"div",
|
|
3864
3995
|
__spreadProps(__spreadValues({
|
|
3865
3996
|
ref,
|
|
3997
|
+
role: "group",
|
|
3866
3998
|
className: cn(
|
|
3867
3999
|
"inline-flex flex-row items-stretch justify-center w-fit shrink-0 relative",
|
|
3868
4000
|
className
|
|
3869
4001
|
),
|
|
3870
|
-
style: { gap: `${spacing}px` }
|
|
4002
|
+
style: __spreadValues({ gap: `${spacing}px` }, restProps.style)
|
|
3871
4003
|
}, restProps), {
|
|
3872
4004
|
children: [
|
|
3873
4005
|
leadingButton,
|
|
@@ -4080,11 +4212,11 @@ var LEADING_ICON_SIZE_FOR_SIZE = {
|
|
|
4080
4212
|
xl: 40
|
|
4081
4213
|
};
|
|
4082
4214
|
var splitButtonSizeVariants = {
|
|
4083
|
-
xs: "min-h-[32px]",
|
|
4084
|
-
sm: "min-h-[40px]",
|
|
4085
|
-
md: "min-h-[56px]",
|
|
4086
|
-
lg: "min-h-[96px]",
|
|
4087
|
-
xl: "min-h-[136px]"
|
|
4215
|
+
xs: "h-[32px] min-h-[32px]",
|
|
4216
|
+
sm: "h-[40px] min-h-[40px]",
|
|
4217
|
+
md: "h-[56px] min-h-[56px]",
|
|
4218
|
+
lg: "h-[96px] min-h-[96px]",
|
|
4219
|
+
xl: "h-[136px] min-h-[136px]"
|
|
4088
4220
|
};
|
|
4089
4221
|
var splitButtonVariants = cva(
|
|
4090
4222
|
"group relative w-fit shrink-0 inline-flex flex-row items-center justify-center whitespace-nowrap select-none cursor-pointer transition-[background-color,color,border-color,box-shadow,opacity,filter] duration-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-m3-primary z-10 overflow-hidden",
|
|
@@ -4268,7 +4400,7 @@ var SplitButtonLeadingComponent = React16.forwardRef(
|
|
|
4268
4400
|
children: icon
|
|
4269
4401
|
}
|
|
4270
4402
|
),
|
|
4271
|
-
labelContent && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center
|
|
4403
|
+
labelContent && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center gap-[inherit]", children: labelContent })
|
|
4272
4404
|
] });
|
|
4273
4405
|
const containerClassName = cn(
|
|
4274
4406
|
splitButtonVariants({
|
|
@@ -4276,19 +4408,20 @@ var SplitButtonLeadingComponent = React16.forwardRef(
|
|
|
4276
4408
|
size: actualSize,
|
|
4277
4409
|
disabled
|
|
4278
4410
|
}),
|
|
4411
|
+
"gap-2",
|
|
4279
4412
|
typographyClass,
|
|
4280
4413
|
className
|
|
4281
4414
|
);
|
|
4282
4415
|
const mergedStyle = __spreadValues({
|
|
4283
4416
|
paddingInlineStart: tokens.leadingPadding.start,
|
|
4284
4417
|
paddingInlineEnd: tokens.leadingPadding.end,
|
|
4285
|
-
gap: "8px",
|
|
4286
4418
|
borderRadius
|
|
4287
4419
|
}, style);
|
|
4288
4420
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: asChild ? /* @__PURE__ */ jsx(
|
|
4289
4421
|
Slot,
|
|
4290
4422
|
__spreadProps(__spreadValues({
|
|
4291
4423
|
ref,
|
|
4424
|
+
"data-split-button-part": "leading",
|
|
4292
4425
|
"aria-disabled": disabled || void 0,
|
|
4293
4426
|
onClick: handleClick,
|
|
4294
4427
|
onPointerDown: handlePointerDown,
|
|
@@ -4311,6 +4444,7 @@ var SplitButtonLeadingComponent = React16.forwardRef(
|
|
|
4311
4444
|
__spreadProps(__spreadValues({
|
|
4312
4445
|
ref,
|
|
4313
4446
|
type: "button",
|
|
4447
|
+
"data-split-button-part": "leading",
|
|
4314
4448
|
disabled,
|
|
4315
4449
|
onClick: handleClick,
|
|
4316
4450
|
onPointerDown: handlePointerDown,
|
|
@@ -4324,8 +4458,7 @@ var SplitButtonLeadingComponent = React16.forwardRef(
|
|
|
4324
4458
|
transition: SPLIT_BUTTON_RADIUS_SPRING,
|
|
4325
4459
|
style: __spreadValues({
|
|
4326
4460
|
paddingInlineStart: tokens.leadingPadding.start,
|
|
4327
|
-
paddingInlineEnd: tokens.leadingPadding.end
|
|
4328
|
-
gap: "8px"
|
|
4461
|
+
paddingInlineEnd: tokens.leadingPadding.end
|
|
4329
4462
|
}, style),
|
|
4330
4463
|
className: containerClassName
|
|
4331
4464
|
}, restProps), {
|
|
@@ -4363,7 +4496,8 @@ var SplitButtonTrailingComponent = React16.forwardRef(
|
|
|
4363
4496
|
onBlur,
|
|
4364
4497
|
asChild = false,
|
|
4365
4498
|
children,
|
|
4366
|
-
"aria-label": ariaLabel
|
|
4499
|
+
"aria-label": ariaLabel,
|
|
4500
|
+
"aria-haspopup": ariaHaspopup = "menu"
|
|
4367
4501
|
} = _b, restProps = __objRest(_b, [
|
|
4368
4502
|
"className",
|
|
4369
4503
|
"style",
|
|
@@ -4381,7 +4515,8 @@ var SplitButtonTrailingComponent = React16.forwardRef(
|
|
|
4381
4515
|
"onBlur",
|
|
4382
4516
|
"asChild",
|
|
4383
4517
|
"children",
|
|
4384
|
-
"aria-label"
|
|
4518
|
+
"aria-label",
|
|
4519
|
+
"aria-haspopup"
|
|
4385
4520
|
]);
|
|
4386
4521
|
var _a2, _b2;
|
|
4387
4522
|
const context = useSplitButtonContext();
|
|
@@ -4474,7 +4609,11 @@ var SplitButtonTrailingComponent = React16.forwardRef(
|
|
|
4474
4609
|
x: checked ? 0 : tokens.opticalCenterOffset
|
|
4475
4610
|
},
|
|
4476
4611
|
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_CHEVRON_SPRING,
|
|
4477
|
-
className: "flex items-center justify-center shrink-0",
|
|
4612
|
+
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
4613
|
+
style: {
|
|
4614
|
+
width: tokens.trailingIconSize,
|
|
4615
|
+
height: tokens.trailingIconSize
|
|
4616
|
+
},
|
|
4478
4617
|
children: icon != null ? icon : /* @__PURE__ */ jsx(
|
|
4479
4618
|
Icon,
|
|
4480
4619
|
{
|
|
@@ -4503,8 +4642,10 @@ var SplitButtonTrailingComponent = React16.forwardRef(
|
|
|
4503
4642
|
Slot,
|
|
4504
4643
|
__spreadProps(__spreadValues({
|
|
4505
4644
|
ref,
|
|
4645
|
+
"data-split-button-part": "trailing",
|
|
4506
4646
|
"aria-label": ariaLabel,
|
|
4507
4647
|
"aria-expanded": checked,
|
|
4648
|
+
"aria-haspopup": ariaHaspopup,
|
|
4508
4649
|
"aria-disabled": disabled,
|
|
4509
4650
|
onClick: handleToggle,
|
|
4510
4651
|
onPointerDown: handlePointerDown,
|
|
@@ -4527,8 +4668,10 @@ var SplitButtonTrailingComponent = React16.forwardRef(
|
|
|
4527
4668
|
__spreadProps(__spreadValues({
|
|
4528
4669
|
ref,
|
|
4529
4670
|
type: "button",
|
|
4671
|
+
"data-split-button-part": "trailing",
|
|
4530
4672
|
"aria-label": ariaLabel,
|
|
4531
4673
|
"aria-expanded": checked,
|
|
4674
|
+
"aria-haspopup": ariaHaspopup,
|
|
4532
4675
|
"aria-disabled": disabled,
|
|
4533
4676
|
disabled,
|
|
4534
4677
|
onClick: handleToggle,
|
|
@@ -4603,6 +4746,7 @@ var SplitButtonTrailingUncheckableComponent = React16.forwardRef(
|
|
|
4603
4746
|
const [isFocused, setIsFocused] = React16.useState(false);
|
|
4604
4747
|
const [isPressed, setIsPressed] = React16.useState(false);
|
|
4605
4748
|
const tokens = SPLIT_BUTTON_TOKENS[actualSize];
|
|
4749
|
+
const prefersReducedMotion = useReducedMotion();
|
|
4606
4750
|
const needsTouchTarget = actualSize === "xs" || actualSize === "sm";
|
|
4607
4751
|
const {
|
|
4608
4752
|
ripples,
|
|
@@ -4666,6 +4810,7 @@ var SplitButtonTrailingUncheckableComponent = React16.forwardRef(
|
|
|
4666
4810
|
__spreadProps(__spreadValues({
|
|
4667
4811
|
ref,
|
|
4668
4812
|
type: "button",
|
|
4813
|
+
"data-split-button-part": "trailing",
|
|
4669
4814
|
"aria-label": ariaLabel,
|
|
4670
4815
|
disabled,
|
|
4671
4816
|
onClick,
|
|
@@ -4677,7 +4822,7 @@ var SplitButtonTrailingUncheckableComponent = React16.forwardRef(
|
|
|
4677
4822
|
onFocus: handleFocus,
|
|
4678
4823
|
onBlur: handleBlur,
|
|
4679
4824
|
animate: { borderRadius },
|
|
4680
|
-
transition: SPLIT_BUTTON_RADIUS_SPRING,
|
|
4825
|
+
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_RADIUS_SPRING,
|
|
4681
4826
|
style: __spreadValues({
|
|
4682
4827
|
paddingInlineStart: tokens.trailingPadding.start,
|
|
4683
4828
|
paddingInlineEnd: tokens.trailingPadding.end
|
|
@@ -4706,7 +4851,7 @@ var SplitButtonTrailingUncheckableComponent = React16.forwardRef(
|
|
|
4706
4851
|
m.div,
|
|
4707
4852
|
{
|
|
4708
4853
|
animate: { x: tokens.opticalCenterOffset },
|
|
4709
|
-
transition: SPLIT_BUTTON_RADIUS_SPRING,
|
|
4854
|
+
transition: prefersReducedMotion ? { duration: 0 } : SPLIT_BUTTON_RADIUS_SPRING,
|
|
4710
4855
|
className: "flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full",
|
|
4711
4856
|
style: {
|
|
4712
4857
|
width: tokens.trailingIconSize,
|