@bug-on/m3-expressive 1.2.7 → 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.
Files changed (62) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/buttons.d.mts +3 -3
  3. package/dist/buttons.d.ts +3 -3
  4. package/dist/buttons.js +195 -50
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +196 -51
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/{core-D4048_K5.d.mts → core-CAU8g2HY.d.mts} +1 -1
  9. package/dist/{core-Bc5Wj_pc.d.ts → core-DRrLnsnJ.d.ts} +1 -1
  10. package/dist/core.d.mts +2 -2
  11. package/dist/core.d.ts +2 -2
  12. package/dist/core.js +159 -28
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.mjs +160 -29
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/feedback.d.mts +28 -6
  17. package/dist/feedback.d.ts +28 -6
  18. package/dist/feedback.js +161 -30
  19. package/dist/feedback.js.map +1 -1
  20. package/dist/feedback.mjs +162 -31
  21. package/dist/feedback.mjs.map +1 -1
  22. package/dist/forms.d.mts +3 -2
  23. package/dist/forms.d.ts +3 -2
  24. package/dist/forms.js +88 -100
  25. package/dist/forms.js.map +1 -1
  26. package/dist/forms.mjs +88 -100
  27. package/dist/forms.mjs.map +1 -1
  28. package/dist/{icon-button-CSsDmuQC.d.mts → icon-button-CqdQBsRe.d.ts} +11 -5
  29. package/dist/{icon-button-CSsDmuQC.d.ts → icon-button-USJo7AqO.d.mts} +11 -5
  30. package/dist/index.d.mts +8 -8
  31. package/dist/index.d.ts +8 -8
  32. package/dist/index.js +570 -309
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.mjs +570 -310
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/layout.d.mts +1 -1
  37. package/dist/layout.d.ts +1 -1
  38. package/dist/layout.js +159 -60
  39. package/dist/layout.js.map +1 -1
  40. package/dist/layout.mjs +160 -61
  41. package/dist/layout.mjs.map +1 -1
  42. package/dist/{md3-Dty-Qcad.d.mts → md3-D0_Z7IXj.d.mts} +9 -1
  43. package/dist/{md3-Dty-Qcad.d.ts → md3-D0_Z7IXj.d.ts} +9 -1
  44. package/dist/navigation.d.mts +103 -33
  45. package/dist/navigation.d.ts +103 -33
  46. package/dist/navigation.js +443 -152
  47. package/dist/navigation.js.map +1 -1
  48. package/dist/navigation.mjs +444 -154
  49. package/dist/navigation.mjs.map +1 -1
  50. package/dist/overlays.js +159 -28
  51. package/dist/overlays.js.map +1 -1
  52. package/dist/overlays.mjs +160 -29
  53. package/dist/overlays.mjs.map +1 -1
  54. package/dist/pickers.js +159 -28
  55. package/dist/pickers.js.map +1 -1
  56. package/dist/pickers.mjs +160 -29
  57. package/dist/pickers.mjs.map +1 -1
  58. package/dist/{split-button-trailing-uncheckable-DPJL3bO6.d.mts → split-button-trailing-uncheckable-CIVEYgjY.d.mts} +12 -7
  59. package/dist/{split-button-trailing-uncheckable--BhNTEJw.d.ts → split-button-trailing-uncheckable-DTQJjzsB.d.ts} +12 -7
  60. package/dist/{text-field-DWC7qOvp.d.mts → text-field-CiOmDM_8.d.ts} +52 -51
  61. package/dist/{text-field-DWC7qOvp.d.ts → text-field-Ear3hCSq.d.mts} +52 -51
  62. package/package.json +3 -3
package/dist/layout.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Slot } from '@radix-ui/react-slot';
3
3
  import { cva } from 'class-variance-authority';
4
- import { m, LazyMotion, domMax, useAnimationFrame, useMotionValue, animate, AnimatePresence, useReducedMotion } from 'motion/react';
4
+ import { m, LazyMotion, domMax, useMotionValue, animate, useAnimationFrame, AnimatePresence, useReducedMotion } from 'motion/react';
5
5
  import * as React18 from 'react';
6
6
  import { createContext, useState, useCallback, useMemo, useEffect, useContext, createElement } from 'react';
7
7
  import { clsx } from 'clsx';
@@ -488,7 +488,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
488
488
  function easeInOutCubic(x) {
489
489
  return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
490
490
  }
491
- function generateWavyCircularPath(center, radius, amplitude, wavelength) {
491
+ function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
492
492
  const circumference = 2 * Math.PI * radius;
493
493
  const numWaves = Math.max(
494
494
  3,
@@ -496,8 +496,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
496
496
  );
497
497
  const steps = numWaves * 4;
498
498
  const dt = 2 * Math.PI / steps;
499
- const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
500
- const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
499
+ const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
500
+ const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
501
501
  const xAt = (t) => center + rAt(t) * Math.cos(t);
502
502
  const yAt = (t) => center + rAt(t) * Math.sin(t);
503
503
  const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
@@ -562,15 +562,18 @@ var CircularProgress = React18.forwardRef(
562
562
  size = 48,
563
563
  trackHeight = 4,
564
564
  shape = "flat",
565
+ trackShape = "flat",
565
566
  amplitude,
566
567
  wavelength,
567
568
  gapSize = 4,
569
+ waveSpeed = 1,
568
570
  crawlerSpeed = 1,
569
571
  color,
570
572
  trackColor,
571
573
  showTrack = "auto",
572
574
  minProgress = DEFAULT_MIN_PROGRESS,
573
575
  maxProgress = DEFAULT_MAX_PROGRESS,
576
+ determinateAnimation = "md3",
574
577
  amplitudeRange,
575
578
  className,
576
579
  "aria-label": ariaLabel
@@ -579,15 +582,18 @@ var CircularProgress = React18.forwardRef(
579
582
  "size",
580
583
  "trackHeight",
581
584
  "shape",
585
+ "trackShape",
582
586
  "amplitude",
583
587
  "wavelength",
584
588
  "gapSize",
589
+ "waveSpeed",
585
590
  "crawlerSpeed",
586
591
  "color",
587
592
  "trackColor",
588
593
  "showTrack",
589
594
  "minProgress",
590
595
  "maxProgress",
596
+ "determinateAnimation",
591
597
  "amplitudeRange",
592
598
  "className",
593
599
  "aria-label"
@@ -600,6 +606,7 @@ var CircularProgress = React18.forwardRef(
600
606
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
601
607
  const isWavy = shape === "wavy";
602
608
  const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
609
+ const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
603
610
  const BASELINE_SIZE = 48;
604
611
  const scaleFactor = size / BASELINE_SIZE;
605
612
  const effectiveAmplitude = React18.useMemo(
@@ -632,19 +639,50 @@ var CircularProgress = React18.forwardRef(
632
639
  const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
633
640
  const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
634
641
  const ActiveCircleElem = m.circle;
635
- const ActivePathElem = m.path;
636
642
  const indeterminateSvgRef = React18.useRef(null);
637
643
  const indeterminateTrackRef = React18.useRef(null);
638
644
  const indeterminateActiveRef = React18.useRef(null);
639
645
  const indeterminateWavyTrackPathRef = React18.useRef(null);
640
646
  const indeterminateWavyActivePathRef = React18.useRef(null);
647
+ const determinateWavyActivePathRef = React18.useRef(null);
648
+ const determinateWavyTrackPathRef = React18.useRef(null);
641
649
  const cachedPathLengthRef = React18.useRef(0);
650
+ const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 0);
651
+ const amplitudeMV = useMotionValue(isWavy ? effectiveAmplitude : 0);
652
+ React18.useEffect(() => {
653
+ if (isDeterminate) {
654
+ animate(fractionMV, clampedValue / 100, {
655
+ duration: 0.4,
656
+ ease: [0.2, 0, 0, 1]
657
+ });
658
+ }
659
+ }, [clampedValue, isDeterminate, fractionMV]);
660
+ React18.useEffect(() => {
661
+ if (!isDeterminate || !isWavy) return;
662
+ const fraction = clampedValue / 100;
663
+ let targetAmp = effectiveAmplitude;
664
+ if (determinateAnimation === "md3") {
665
+ targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
666
+ }
667
+ animate(amplitudeMV, targetAmp, {
668
+ type: "spring",
669
+ bounce: 0,
670
+ duration: 0.5
671
+ });
672
+ }, [
673
+ clampedValue,
674
+ isDeterminate,
675
+ isWavy,
676
+ effectiveAmplitude,
677
+ amplitudeMV,
678
+ determinateAnimation
679
+ ]);
642
680
  React18.useLayoutEffect(() => {
643
681
  if (!isWavy || !wavyActivePath) {
644
682
  cachedPathLengthRef.current = circumference;
645
683
  return;
646
684
  }
647
- const el = indeterminateActiveRef.current;
685
+ const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
648
686
  if (el && "getTotalLength" in el) {
649
687
  try {
650
688
  const len = el.getTotalLength();
@@ -658,7 +696,65 @@ var CircularProgress = React18.forwardRef(
658
696
  cachedPathLengthRef.current = circumference;
659
697
  }, [isWavy, circumference, wavyActivePath]);
660
698
  useAnimationFrame((time) => {
661
- if (isDeterminate) return;
699
+ const safeWaveSpeed = Math.max(0.1, waveSpeed);
700
+ const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
701
+ if (isDeterminate) {
702
+ if (isWavy) {
703
+ const currentAmp = amplitudeMV.get();
704
+ const dynamicPath = generateWavyCircularPath(
705
+ center,
706
+ radius,
707
+ currentAmp,
708
+ effectiveWavelength,
709
+ wavePhase
710
+ );
711
+ if (determinateWavyActivePathRef.current) {
712
+ determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
713
+ }
714
+ if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
715
+ determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
716
+ }
717
+ const pathEl = determinateWavyActivePathRef.current;
718
+ let totalLen = cachedPathLengthRef.current || circumference;
719
+ if (pathEl) {
720
+ try {
721
+ const len = pathEl.getTotalLength();
722
+ if (len > 0) totalLen = len;
723
+ } catch (e) {
724
+ }
725
+ }
726
+ const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
727
+ const activeLen = totalLen * activeFrac;
728
+ if (determinateWavyActivePathRef.current) {
729
+ determinateWavyActivePathRef.current.setAttribute(
730
+ "stroke-dasharray",
731
+ `${activeLen} ${totalLen}`
732
+ );
733
+ determinateWavyActivePathRef.current.setAttribute(
734
+ "stroke-dashoffset",
735
+ "0"
736
+ );
737
+ }
738
+ if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
739
+ const gapFrac = (gapSize + trackHeight) / totalLen;
740
+ const trackStartFrac = activeFrac + gapFrac;
741
+ const trackLen = Math.max(
742
+ 1e-3,
743
+ totalLen * (1 - activeFrac - 2 * gapFrac)
744
+ );
745
+ const trackOff = -totalLen * trackStartFrac;
746
+ determinateWavyTrackPathRef.current.setAttribute(
747
+ "stroke-dasharray",
748
+ `${trackLen} ${totalLen}`
749
+ );
750
+ determinateWavyTrackPathRef.current.setAttribute(
751
+ "stroke-dashoffset",
752
+ `${trackOff}`
753
+ );
754
+ }
755
+ }
756
+ return;
757
+ }
662
758
  const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
663
759
  const scaledTime = time * safeCrawlerSpeed;
664
760
  const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
@@ -693,7 +789,8 @@ var CircularProgress = React18.forwardRef(
693
789
  center,
694
790
  radius,
695
791
  currentAmplitude,
696
- effectiveWavelength
792
+ effectiveWavelength,
793
+ wavePhase
697
794
  );
698
795
  if (indeterminateWavyActivePathRef.current) {
699
796
  indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
@@ -788,7 +885,7 @@ var CircularProgress = React18.forwardRef(
788
885
  style: { width: size, height: size }
789
886
  }, restProps), {
790
887
  children: /* @__PURE__ */ jsxs(LazyMotion, { features: domMax, strict: true, children: [
791
- /* @__PURE__ */ jsxs(
888
+ /* @__PURE__ */ jsx(
792
889
  "svg",
793
890
  {
794
891
  width: size,
@@ -796,8 +893,18 @@ var CircularProgress = React18.forwardRef(
796
893
  viewBox: `0 0 ${size} ${size}`,
797
894
  "aria-hidden": "true",
798
895
  style: { transform: "rotate(-90deg)", overflow: "visible" },
799
- children: [
800
- isDeterminate ? /* @__PURE__ */ jsx(
896
+ children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
897
+ shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsx(
898
+ "path",
899
+ {
900
+ ref: determinateWavyTrackPathRef,
901
+ d: wavyActivePath != null ? wavyActivePath : "",
902
+ fill: "none",
903
+ stroke: bgTrackColor,
904
+ strokeWidth: trackHeight,
905
+ strokeLinecap: "round"
906
+ }
907
+ ) : /* @__PURE__ */ jsx(
801
908
  m.circle,
802
909
  {
803
910
  cx: center,
@@ -806,28 +913,52 @@ var CircularProgress = React18.forwardRef(
806
913
  fill: "none",
807
914
  stroke: bgTrackColor,
808
915
  strokeWidth: trackHeight,
809
- initial: { pathLength: trackLength, pathOffset: trackOffset },
810
- animate: { pathLength: trackLength, pathOffset: trackOffset },
916
+ initial: {
917
+ pathLength: trackLength,
918
+ pathOffset: trackOffset
919
+ },
920
+ animate: {
921
+ pathLength: trackLength,
922
+ pathOffset: trackOffset
923
+ },
811
924
  transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
812
925
  strokeLinecap: "round"
813
926
  }
814
- ) : null,
815
- isDeterminate && (isWavy ? /* @__PURE__ */ jsx(
816
- ActivePathElem,
927
+ )),
928
+ /* @__PURE__ */ jsx(
929
+ "path",
817
930
  {
931
+ ref: determinateWavyActivePathRef,
818
932
  d: wavyActivePath != null ? wavyActivePath : "",
819
933
  fill: "none",
820
934
  stroke: activeColor,
821
935
  strokeWidth: trackHeight,
822
- strokeLinecap: "round",
823
- initial: { pathLength: 0 },
824
- animate: { pathLength: clampedValue / 100 },
825
- transition: {
826
- duration: 0.4,
827
- ease: [0.2, 0, 0, 1]
828
- }
936
+ strokeLinecap: "round"
829
937
  }
830
- ) : /* @__PURE__ */ jsx(
938
+ )
939
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
940
+ /* @__PURE__ */ jsx(
941
+ m.circle,
942
+ {
943
+ cx: center,
944
+ cy: center,
945
+ r: radius,
946
+ fill: "none",
947
+ stroke: bgTrackColor,
948
+ strokeWidth: trackHeight,
949
+ initial: {
950
+ pathLength: trackLength,
951
+ pathOffset: trackOffset
952
+ },
953
+ animate: {
954
+ pathLength: trackLength,
955
+ pathOffset: trackOffset
956
+ },
957
+ transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
958
+ strokeLinecap: "round"
959
+ }
960
+ ),
961
+ /* @__PURE__ */ jsx(
831
962
  ActiveCircleElem,
832
963
  {
833
964
  cx: center,
@@ -844,8 +975,8 @@ var CircularProgress = React18.forwardRef(
844
975
  ease: [0.2, 0, 0, 1]
845
976
  }
846
977
  }
847
- ))
848
- ]
978
+ )
979
+ ] }) : null
849
980
  }
850
981
  ),
851
982
  !isDeterminate && /* @__PURE__ */ jsx(
@@ -2282,7 +2413,7 @@ var DividerImpl = React18.forwardRef(
2282
2413
  insetStart = "standard",
2283
2414
  waveConfig,
2284
2415
  decorative = false,
2285
- animate: animate3 = true,
2416
+ animate: animate4 = true,
2286
2417
  className,
2287
2418
  style
2288
2419
  } = _b, props = __objRest(_b, [
@@ -2298,7 +2429,7 @@ var DividerImpl = React18.forwardRef(
2298
2429
  ]);
2299
2430
  var _a2, _b2, _c;
2300
2431
  const reducedMotion = useReducedMotion();
2301
- const shouldAnimate = animate3 && !reducedMotion;
2432
+ const shouldAnimate = animate4 && !reducedMotion;
2302
2433
  const effectiveShape = shape === "wavy" && orientation === "vertical" ? "flat" : shape;
2303
2434
  if (shape === "wavy" && orientation === "vertical") {
2304
2435
  console.warn(
@@ -4435,39 +4566,7 @@ var typographyVariants = cva("m-0 p-0 text-m3-on-surface", {
4435
4566
  "label-sm": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
4436
4567
  "body-lg": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
4437
4568
  "body-md": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
4438
- "body-sm": "text-[12px] leading-[16px] font-normal tracking-[0.4px]",
4439
- // Full hyphenated aliases
4440
- "display-large": "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
4441
- "display-medium": "text-[45px] leading-[52px] font-normal tracking-[0px]",
4442
- "display-small": "text-[36px] leading-[44px] font-normal tracking-[0px]",
4443
- "headline-large": "text-[32px] leading-[40px] font-normal tracking-[0px]",
4444
- "headline-medium": "text-[28px] leading-[36px] font-normal tracking-[0px]",
4445
- "headline-small": "text-[24px] leading-[32px] font-normal tracking-[0px]",
4446
- "title-large": "text-[22px] leading-[28px] font-normal tracking-[0px]",
4447
- "title-medium": "text-[16px] leading-[24px] font-medium tracking-[0.15px]",
4448
- "title-small": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
4449
- "label-large": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
4450
- "label-medium": "text-[12px] leading-[16px] font-medium tracking-[0.5px]",
4451
- "label-small": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
4452
- "body-large": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
4453
- "body-medium": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
4454
- "body-small": "text-[12px] leading-[16px] font-normal tracking-[0.4px]",
4455
- // CamelCase aliases
4456
- displayLarge: "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
4457
- displayMedium: "text-[45px] leading-[52px] font-normal tracking-[0px]",
4458
- displaySmall: "text-[36px] leading-[44px] font-normal tracking-[0px]",
4459
- headlineLarge: "text-[32px] leading-[40px] font-normal tracking-[0px]",
4460
- headlineMedium: "text-[28px] leading-[36px] font-normal tracking-[0px]",
4461
- headlineSmall: "text-[24px] leading-[32px] font-normal tracking-[0px]",
4462
- titleLarge: "text-[22px] leading-[28px] font-normal tracking-[0px]",
4463
- titleMedium: "text-[16px] leading-[24px] font-medium tracking-[0.15px]",
4464
- titleSmall: "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
4465
- labelLarge: "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
4466
- labelMedium: "text-[12px] leading-[16px] font-medium tracking-[0.5px]",
4467
- labelSmall: "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
4468
- bodyLarge: "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
4469
- bodyMedium: "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
4470
- bodySmall: "text-[12px] leading-[16px] font-normal tracking-[0.4px]"
4569
+ "body-sm": "text-[12px] leading-[16px] font-normal tracking-[0.4px]"
4471
4570
  }
4472
4571
  },
4473
4572
  defaultVariants: {