@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/pickers.js
CHANGED
|
@@ -708,7 +708,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
|
|
|
708
708
|
function easeInOutCubic(x) {
|
|
709
709
|
return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
|
|
710
710
|
}
|
|
711
|
-
function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
711
|
+
function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
|
|
712
712
|
const circumference = 2 * Math.PI * radius;
|
|
713
713
|
const numWaves = Math.max(
|
|
714
714
|
3,
|
|
@@ -716,8 +716,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
716
716
|
);
|
|
717
717
|
const steps = numWaves * 4;
|
|
718
718
|
const dt = 2 * Math.PI / steps;
|
|
719
|
-
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
|
|
720
|
-
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
|
|
719
|
+
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
|
|
720
|
+
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
|
|
721
721
|
const xAt = (t) => center + rAt(t) * Math.cos(t);
|
|
722
722
|
const yAt = (t) => center + rAt(t) * Math.sin(t);
|
|
723
723
|
const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
|
|
@@ -782,15 +782,18 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
782
782
|
size = 48,
|
|
783
783
|
trackHeight = 4,
|
|
784
784
|
shape = "flat",
|
|
785
|
+
trackShape = "flat",
|
|
785
786
|
amplitude,
|
|
786
787
|
wavelength,
|
|
787
788
|
gapSize = 4,
|
|
789
|
+
waveSpeed = 1,
|
|
788
790
|
crawlerSpeed = 1,
|
|
789
791
|
color,
|
|
790
792
|
trackColor,
|
|
791
793
|
showTrack = "auto",
|
|
792
794
|
minProgress = DEFAULT_MIN_PROGRESS,
|
|
793
795
|
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
796
|
+
determinateAnimation = "md3",
|
|
794
797
|
amplitudeRange,
|
|
795
798
|
className,
|
|
796
799
|
"aria-label": ariaLabel
|
|
@@ -799,15 +802,18 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
799
802
|
"size",
|
|
800
803
|
"trackHeight",
|
|
801
804
|
"shape",
|
|
805
|
+
"trackShape",
|
|
802
806
|
"amplitude",
|
|
803
807
|
"wavelength",
|
|
804
808
|
"gapSize",
|
|
809
|
+
"waveSpeed",
|
|
805
810
|
"crawlerSpeed",
|
|
806
811
|
"color",
|
|
807
812
|
"trackColor",
|
|
808
813
|
"showTrack",
|
|
809
814
|
"minProgress",
|
|
810
815
|
"maxProgress",
|
|
816
|
+
"determinateAnimation",
|
|
811
817
|
"amplitudeRange",
|
|
812
818
|
"className",
|
|
813
819
|
"aria-label"
|
|
@@ -820,6 +826,7 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
820
826
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
821
827
|
const isWavy = shape === "wavy";
|
|
822
828
|
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
829
|
+
const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
|
|
823
830
|
const BASELINE_SIZE = 48;
|
|
824
831
|
const scaleFactor = size / BASELINE_SIZE;
|
|
825
832
|
const effectiveAmplitude = React6__namespace.useMemo(
|
|
@@ -852,19 +859,50 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
852
859
|
const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
|
|
853
860
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
854
861
|
const ActiveCircleElem = react.m.circle;
|
|
855
|
-
const ActivePathElem = react.m.path;
|
|
856
862
|
const indeterminateSvgRef = React6__namespace.useRef(null);
|
|
857
863
|
const indeterminateTrackRef = React6__namespace.useRef(null);
|
|
858
864
|
const indeterminateActiveRef = React6__namespace.useRef(null);
|
|
859
865
|
const indeterminateWavyTrackPathRef = React6__namespace.useRef(null);
|
|
860
866
|
const indeterminateWavyActivePathRef = React6__namespace.useRef(null);
|
|
867
|
+
const determinateWavyActivePathRef = React6__namespace.useRef(null);
|
|
868
|
+
const determinateWavyTrackPathRef = React6__namespace.useRef(null);
|
|
861
869
|
const cachedPathLengthRef = React6__namespace.useRef(0);
|
|
870
|
+
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 0);
|
|
871
|
+
const amplitudeMV = react.useMotionValue(isWavy ? effectiveAmplitude : 0);
|
|
872
|
+
React6__namespace.useEffect(() => {
|
|
873
|
+
if (isDeterminate) {
|
|
874
|
+
react.animate(fractionMV, clampedValue / 100, {
|
|
875
|
+
duration: 0.4,
|
|
876
|
+
ease: [0.2, 0, 0, 1]
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
}, [clampedValue, isDeterminate, fractionMV]);
|
|
880
|
+
React6__namespace.useEffect(() => {
|
|
881
|
+
if (!isDeterminate || !isWavy) return;
|
|
882
|
+
const fraction = clampedValue / 100;
|
|
883
|
+
let targetAmp = effectiveAmplitude;
|
|
884
|
+
if (determinateAnimation === "md3") {
|
|
885
|
+
targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
|
|
886
|
+
}
|
|
887
|
+
react.animate(amplitudeMV, targetAmp, {
|
|
888
|
+
type: "spring",
|
|
889
|
+
bounce: 0,
|
|
890
|
+
duration: 0.5
|
|
891
|
+
});
|
|
892
|
+
}, [
|
|
893
|
+
clampedValue,
|
|
894
|
+
isDeterminate,
|
|
895
|
+
isWavy,
|
|
896
|
+
effectiveAmplitude,
|
|
897
|
+
amplitudeMV,
|
|
898
|
+
determinateAnimation
|
|
899
|
+
]);
|
|
862
900
|
React6__namespace.useLayoutEffect(() => {
|
|
863
901
|
if (!isWavy || !wavyActivePath) {
|
|
864
902
|
cachedPathLengthRef.current = circumference;
|
|
865
903
|
return;
|
|
866
904
|
}
|
|
867
|
-
const el = indeterminateActiveRef.current;
|
|
905
|
+
const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
|
|
868
906
|
if (el && "getTotalLength" in el) {
|
|
869
907
|
try {
|
|
870
908
|
const len = el.getTotalLength();
|
|
@@ -878,7 +916,65 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
878
916
|
cachedPathLengthRef.current = circumference;
|
|
879
917
|
}, [isWavy, circumference, wavyActivePath]);
|
|
880
918
|
react.useAnimationFrame((time) => {
|
|
881
|
-
|
|
919
|
+
const safeWaveSpeed = Math.max(0.1, waveSpeed);
|
|
920
|
+
const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
|
|
921
|
+
if (isDeterminate) {
|
|
922
|
+
if (isWavy) {
|
|
923
|
+
const currentAmp = amplitudeMV.get();
|
|
924
|
+
const dynamicPath = generateWavyCircularPath(
|
|
925
|
+
center,
|
|
926
|
+
radius,
|
|
927
|
+
currentAmp,
|
|
928
|
+
effectiveWavelength,
|
|
929
|
+
wavePhase
|
|
930
|
+
);
|
|
931
|
+
if (determinateWavyActivePathRef.current) {
|
|
932
|
+
determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
933
|
+
}
|
|
934
|
+
if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
935
|
+
determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
936
|
+
}
|
|
937
|
+
const pathEl = determinateWavyActivePathRef.current;
|
|
938
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
939
|
+
if (pathEl) {
|
|
940
|
+
try {
|
|
941
|
+
const len = pathEl.getTotalLength();
|
|
942
|
+
if (len > 0) totalLen = len;
|
|
943
|
+
} catch (e) {
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
|
|
947
|
+
const activeLen = totalLen * activeFrac;
|
|
948
|
+
if (determinateWavyActivePathRef.current) {
|
|
949
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
950
|
+
"stroke-dasharray",
|
|
951
|
+
`${activeLen} ${totalLen}`
|
|
952
|
+
);
|
|
953
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
954
|
+
"stroke-dashoffset",
|
|
955
|
+
"0"
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
959
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
960
|
+
const trackStartFrac = activeFrac + gapFrac;
|
|
961
|
+
const trackLen = Math.max(
|
|
962
|
+
1e-3,
|
|
963
|
+
totalLen * (1 - activeFrac - 2 * gapFrac)
|
|
964
|
+
);
|
|
965
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
966
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
967
|
+
"stroke-dasharray",
|
|
968
|
+
`${trackLen} ${totalLen}`
|
|
969
|
+
);
|
|
970
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
971
|
+
"stroke-dashoffset",
|
|
972
|
+
`${trackOff}`
|
|
973
|
+
);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
882
978
|
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
883
979
|
const scaledTime = time * safeCrawlerSpeed;
|
|
884
980
|
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
@@ -913,7 +1009,8 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
913
1009
|
center,
|
|
914
1010
|
radius,
|
|
915
1011
|
currentAmplitude,
|
|
916
|
-
effectiveWavelength
|
|
1012
|
+
effectiveWavelength,
|
|
1013
|
+
wavePhase
|
|
917
1014
|
);
|
|
918
1015
|
if (indeterminateWavyActivePathRef.current) {
|
|
919
1016
|
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
@@ -1008,7 +1105,7 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
1008
1105
|
style: { width: size, height: size }
|
|
1009
1106
|
}, restProps), {
|
|
1010
1107
|
children: /* @__PURE__ */ jsxRuntime.jsxs(react.LazyMotion, { features: react.domMax, strict: true, children: [
|
|
1011
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1108
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1012
1109
|
"svg",
|
|
1013
1110
|
{
|
|
1014
1111
|
width: size,
|
|
@@ -1016,8 +1113,18 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
1016
1113
|
viewBox: `0 0 ${size} ${size}`,
|
|
1017
1114
|
"aria-hidden": "true",
|
|
1018
1115
|
style: { transform: "rotate(-90deg)", overflow: "visible" },
|
|
1019
|
-
children: [
|
|
1020
|
-
|
|
1116
|
+
children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1117
|
+
shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1118
|
+
"path",
|
|
1119
|
+
{
|
|
1120
|
+
ref: determinateWavyTrackPathRef,
|
|
1121
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
1122
|
+
fill: "none",
|
|
1123
|
+
stroke: bgTrackColor,
|
|
1124
|
+
strokeWidth: trackHeight,
|
|
1125
|
+
strokeLinecap: "round"
|
|
1126
|
+
}
|
|
1127
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1021
1128
|
react.m.circle,
|
|
1022
1129
|
{
|
|
1023
1130
|
cx: center,
|
|
@@ -1026,28 +1133,52 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
1026
1133
|
fill: "none",
|
|
1027
1134
|
stroke: bgTrackColor,
|
|
1028
1135
|
strokeWidth: trackHeight,
|
|
1029
|
-
initial: {
|
|
1030
|
-
|
|
1136
|
+
initial: {
|
|
1137
|
+
pathLength: trackLength,
|
|
1138
|
+
pathOffset: trackOffset
|
|
1139
|
+
},
|
|
1140
|
+
animate: {
|
|
1141
|
+
pathLength: trackLength,
|
|
1142
|
+
pathOffset: trackOffset
|
|
1143
|
+
},
|
|
1031
1144
|
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
1032
1145
|
strokeLinecap: "round"
|
|
1033
1146
|
}
|
|
1034
|
-
)
|
|
1035
|
-
|
|
1036
|
-
|
|
1147
|
+
)),
|
|
1148
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1149
|
+
"path",
|
|
1037
1150
|
{
|
|
1151
|
+
ref: determinateWavyActivePathRef,
|
|
1038
1152
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
1039
1153
|
fill: "none",
|
|
1040
1154
|
stroke: activeColor,
|
|
1041
1155
|
strokeWidth: trackHeight,
|
|
1042
|
-
strokeLinecap: "round"
|
|
1043
|
-
initial: { pathLength: 0 },
|
|
1044
|
-
animate: { pathLength: clampedValue / 100 },
|
|
1045
|
-
transition: {
|
|
1046
|
-
duration: 0.4,
|
|
1047
|
-
ease: [0.2, 0, 0, 1]
|
|
1048
|
-
}
|
|
1156
|
+
strokeLinecap: "round"
|
|
1049
1157
|
}
|
|
1050
|
-
)
|
|
1158
|
+
)
|
|
1159
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1160
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1161
|
+
react.m.circle,
|
|
1162
|
+
{
|
|
1163
|
+
cx: center,
|
|
1164
|
+
cy: center,
|
|
1165
|
+
r: radius,
|
|
1166
|
+
fill: "none",
|
|
1167
|
+
stroke: bgTrackColor,
|
|
1168
|
+
strokeWidth: trackHeight,
|
|
1169
|
+
initial: {
|
|
1170
|
+
pathLength: trackLength,
|
|
1171
|
+
pathOffset: trackOffset
|
|
1172
|
+
},
|
|
1173
|
+
animate: {
|
|
1174
|
+
pathLength: trackLength,
|
|
1175
|
+
pathOffset: trackOffset
|
|
1176
|
+
},
|
|
1177
|
+
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
1178
|
+
strokeLinecap: "round"
|
|
1179
|
+
}
|
|
1180
|
+
),
|
|
1181
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1051
1182
|
ActiveCircleElem,
|
|
1052
1183
|
{
|
|
1053
1184
|
cx: center,
|
|
@@ -1064,8 +1195,8 @@ var CircularProgress = React6__namespace.forwardRef(
|
|
|
1064
1195
|
ease: [0.2, 0, 0, 1]
|
|
1065
1196
|
}
|
|
1066
1197
|
}
|
|
1067
|
-
)
|
|
1068
|
-
]
|
|
1198
|
+
)
|
|
1199
|
+
] }) : null
|
|
1069
1200
|
}
|
|
1070
1201
|
),
|
|
1071
1202
|
!isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|