@solostylist/ui-kit 2.0.1 → 2.0.3
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/dist/s-animated-gradient-text/index.d.ts +2 -0
- package/dist/s-animated-gradient-text/index.js +2 -0
- package/dist/s-animated-gradient-text/s-animated-gradient-text.d.ts +64 -0
- package/dist/s-animated-gradient-text/s-animated-gradient-text.js +92 -0
- package/dist/s-announcement-bar/index.d.ts +2 -0
- package/dist/s-announcement-bar/index.js +2 -0
- package/dist/s-announcement-bar/s-announcement-bar.d.ts +113 -0
- package/dist/s-announcement-bar/s-announcement-bar.js +272 -0
- package/dist/s-carousel/s-carousel.d.ts +2 -0
- package/dist/s-carousel/s-carousel.js +52 -50
- package/dist/s-date-picker/s-date-picker.js +1 -1
- package/dist/s-datetime-picker/s-datetime-picker.js +1 -1
- package/dist/s-drawer/index.d.ts +3 -0
- package/dist/s-drawer/index.js +2 -0
- package/dist/s-drawer/s-drawer.d.ts +70 -0
- package/dist/s-drawer/s-drawer.js +139 -0
- package/dist/s-gradient-blob-pulse/index.d.ts +2 -0
- package/dist/s-gradient-blob-pulse/index.js +2 -0
- package/dist/s-gradient-blob-pulse/s-gradient-blob-pulse.d.ts +62 -0
- package/dist/s-gradient-blob-pulse/s-gradient-blob-pulse.js +236 -0
- package/dist/s-gradient-icon/index.d.ts +1 -1
- package/dist/s-gradient-icon/s-gradient-icon.d.ts +4 -4
- package/dist/s-gradient-icon/s-gradient-icon.js +2 -2
- package/dist/s-icon-button/s-icon-button.d.ts +6 -2
- package/dist/s-interactive-card/index.d.ts +3 -0
- package/dist/s-interactive-card/index.js +2 -0
- package/dist/s-interactive-card/s-interactive-card.d.ts +57 -0
- package/dist/s-interactive-card/s-interactive-card.js +150 -0
- package/dist/s-language-switcher/s-language-switcher.js +66 -71
- package/dist/s-list-action-item/index.d.ts +2 -0
- package/dist/s-list-action-item/index.js +2 -0
- package/dist/s-list-action-item/s-list-action-item.d.ts +89 -0
- package/dist/s-list-action-item/s-list-action-item.js +149 -0
- package/dist/s-mega-menu/index.d.ts +3 -0
- package/dist/s-mega-menu/index.js +2 -0
- package/dist/s-mega-menu/mega-menu-panel.d.ts +38 -0
- package/dist/s-mega-menu/mega-menu-panel.js +251 -0
- package/dist/s-mega-menu/mega-menu-slots.d.ts +65 -0
- package/dist/s-mega-menu/mega-menu-slots.js +232 -0
- package/dist/s-mega-menu/mega-menu-trigger.d.ts +35 -0
- package/dist/s-mega-menu/mega-menu-trigger.js +49 -0
- package/dist/s-mega-menu/s-mega-menu.d.ts +23 -0
- package/dist/s-mega-menu/s-mega-menu.js +225 -0
- package/dist/s-mega-menu/types.d.ts +188 -0
- package/dist/s-mega-menu/types.js +0 -0
- package/dist/s-mega-menu/utils.d.ts +51 -0
- package/dist/s-mega-menu/utils.js +51 -0
- package/dist/s-mobile-dock/index.d.ts +3 -0
- package/dist/s-mobile-dock/index.js +2 -0
- package/dist/s-mobile-dock/s-mobile-dock.d.ts +96 -0
- package/dist/s-mobile-dock/s-mobile-dock.js +145 -0
- package/dist/s-nav-item/index.d.ts +1 -1
- package/dist/s-nav-item/s-nav-item.d.ts +35 -16
- package/dist/s-nav-item/s-nav-item.js +55 -77
- package/dist/s-nav-items/s-nav-items.js +68 -112
- package/dist/s-number-range/index.d.ts +3 -0
- package/dist/s-number-range/index.js +2 -0
- package/dist/s-number-range/s-number-range.d.ts +109 -0
- package/dist/s-number-range/s-number-range.js +250 -0
- package/dist/s-popover/index.d.ts +5 -0
- package/dist/s-popover/index.js +3 -0
- package/dist/s-popover/placement.d.ts +14 -0
- package/dist/s-popover/placement.js +65 -0
- package/dist/s-popover/s-popover-content.d.ts +22 -0
- package/dist/s-popover/s-popover-content.js +21 -0
- package/dist/s-popover/s-popover.d.ts +59 -0
- package/dist/s-popover/s-popover.js +66 -0
- package/dist/s-product-card/index.d.ts +3 -0
- package/dist/s-product-card/index.js +2 -0
- package/dist/s-product-card/s-product-card.d.ts +216 -0
- package/dist/s-product-card/s-product-card.js +499 -0
- package/dist/s-product-gallery/index.d.ts +3 -0
- package/dist/s-product-gallery/index.js +2 -0
- package/dist/s-product-gallery/s-product-gallery.d.ts +116 -0
- package/dist/s-product-gallery/s-product-gallery.js +427 -0
- package/dist/s-scroll-to-top/s-scroll-to-top.d.ts +1 -1
- package/dist/s-segmented-control/index.d.ts +3 -0
- package/dist/s-segmented-control/index.js +2 -0
- package/dist/s-segmented-control/s-segmented-control.d.ts +94 -0
- package/dist/s-segmented-control/s-segmented-control.js +298 -0
- package/dist/s-stepper/index.d.ts +3 -0
- package/dist/s-stepper/index.js +2 -0
- package/dist/s-stepper/s-stepper.d.ts +90 -0
- package/dist/s-stepper/s-stepper.js +102 -0
- package/dist/s-swatch/index.d.ts +3 -0
- package/dist/s-swatch/index.js +2 -0
- package/dist/s-swatch/s-swatch.d.ts +235 -0
- package/dist/s-swatch/s-swatch.js +218 -0
- package/dist/s-text-editor/s-text-editor-toolbar.js +105 -108
- package/dist/s-tool-item/s-tool-item.d.ts +10 -6
- package/dist/s-tool-item/s-tool-item.js +12 -12
- package/dist/theme/component-augmentation.d.ts +65 -1
- package/dist/theme/components/drawer.d.ts +1 -0
- package/dist/theme/components/drawer.js +4 -1
- package/dist/theme/components/slider.js +18 -1
- package/dist/theme/components/step-connector.d.ts +0 -3
- package/dist/theme/components/step-connector.js +1 -6
- package/dist/theme/components/step-icon.d.ts +3 -12
- package/dist/theme/components/step-icon.js +3 -14
- package/package.json +7 -2
- package/dist/theme/components/components.d.ts +0 -2
- package/dist/theme/components/slider.d.ts +0 -34
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { toSxArray as e } from "../utils/sx.js";
|
|
2
|
+
import { resolveOwnerStateSlotProps as t } from "../utils/slots.js";
|
|
3
|
+
import { actionHoverMedia as n, getFocusVisibleStyle as r, getSemanticActionTokens as i, reducedPressMotionStyle as a } from "../theme/components/action-styles.js";
|
|
4
|
+
import * as o from "react";
|
|
5
|
+
import { createElement as s } from "react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
import { Box as u, ButtonBase as d, Typography as f, styled as p, useThemeProps as m } from "@mui/material";
|
|
8
|
+
import { mergeSlotProps as h, unstable_useEnhancedEffect as g, useControlled as _, useEventCallback as v, useForkRef as y } from "@mui/material/utils";
|
|
9
|
+
import b from "@mui/utils/appendOwnerState";
|
|
10
|
+
//#region lib/s-segmented-control/s-segmented-control.tsx
|
|
11
|
+
var x = [
|
|
12
|
+
"ArrowDown",
|
|
13
|
+
"ArrowLeft",
|
|
14
|
+
"ArrowRight",
|
|
15
|
+
"ArrowUp",
|
|
16
|
+
"End",
|
|
17
|
+
"Home"
|
|
18
|
+
], S = {
|
|
19
|
+
medium: 40,
|
|
20
|
+
small: 36
|
|
21
|
+
}, C = p(u, {
|
|
22
|
+
name: "SSegmentedControl",
|
|
23
|
+
slot: "Root",
|
|
24
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
25
|
+
})(({ theme: e }) => ({
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
backgroundColor: (e.vars ?? e).palette.action.hover,
|
|
28
|
+
borderRadius: e.radius.full,
|
|
29
|
+
display: "inline-flex",
|
|
30
|
+
gap: e.spacing(.5),
|
|
31
|
+
isolation: "isolate",
|
|
32
|
+
minHeight: S.medium + 8,
|
|
33
|
+
padding: e.spacing(.5),
|
|
34
|
+
position: "relative",
|
|
35
|
+
width: "fit-content",
|
|
36
|
+
variants: [{
|
|
37
|
+
props: ({ ownerState: e }) => e.size === "small",
|
|
38
|
+
style: {
|
|
39
|
+
gap: e.spacing(.25),
|
|
40
|
+
minHeight: S.small + 8
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
props: ({ ownerState: e }) => e.fullWidth,
|
|
44
|
+
style: {
|
|
45
|
+
display: "flex",
|
|
46
|
+
width: "100%"
|
|
47
|
+
}
|
|
48
|
+
}]
|
|
49
|
+
})), w = p(u, {
|
|
50
|
+
name: "SSegmentedControl",
|
|
51
|
+
slot: "Indicator",
|
|
52
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
53
|
+
})(({ theme: e }) => {
|
|
54
|
+
let t = (e.vars ?? e).palette, n = i(e, "primary");
|
|
55
|
+
return {
|
|
56
|
+
backgroundColor: n.light.containedBackground,
|
|
57
|
+
borderRadius: e.radius.full,
|
|
58
|
+
left: 0,
|
|
59
|
+
pointerEvents: "none",
|
|
60
|
+
position: "absolute",
|
|
61
|
+
top: 0,
|
|
62
|
+
transition: e.transitions.create([
|
|
63
|
+
"height",
|
|
64
|
+
"opacity",
|
|
65
|
+
"transform",
|
|
66
|
+
"width"
|
|
67
|
+
], {
|
|
68
|
+
duration: e.transitions.duration.standard,
|
|
69
|
+
easing: e.transitions.easing.easeInOut
|
|
70
|
+
}),
|
|
71
|
+
zIndex: 0,
|
|
72
|
+
...e.applyStyles("dark", { backgroundColor: n.dark.containedBackground }),
|
|
73
|
+
variants: [{
|
|
74
|
+
props: ({ ownerState: e }) => e.disabled || e.selectedDisabled,
|
|
75
|
+
style: {
|
|
76
|
+
backgroundColor: t.action.disabledBackground,
|
|
77
|
+
boxShadow: "none"
|
|
78
|
+
}
|
|
79
|
+
}],
|
|
80
|
+
"@media (prefers-reduced-motion: reduce)": { transition: "none" }
|
|
81
|
+
};
|
|
82
|
+
}), T = p(d, {
|
|
83
|
+
name: "SSegmentedControl",
|
|
84
|
+
slot: "Option",
|
|
85
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
86
|
+
})(({ theme: e }) => {
|
|
87
|
+
let t = (e.vars ?? e).palette, o = i(e, "primary");
|
|
88
|
+
return {
|
|
89
|
+
borderRadius: e.radius.full,
|
|
90
|
+
color: t.text.secondary,
|
|
91
|
+
flex: "0 0 auto",
|
|
92
|
+
fontWeight: e.typography.fontWeightRegular,
|
|
93
|
+
gap: e.spacing(1),
|
|
94
|
+
minHeight: S.medium,
|
|
95
|
+
minWidth: 0,
|
|
96
|
+
padding: e.spacing(0, 2),
|
|
97
|
+
position: "relative",
|
|
98
|
+
transition: e.transitions.create(["background-color", "color"], { duration: e.transitions.duration.shorter }),
|
|
99
|
+
zIndex: 1,
|
|
100
|
+
[n]: { "&:hover:not(.Mui-disabled)": {
|
|
101
|
+
backgroundColor: t.action.hover,
|
|
102
|
+
color: t.text.primary
|
|
103
|
+
} },
|
|
104
|
+
"&:active:not(.Mui-disabled)": { backgroundColor: t.action.selected },
|
|
105
|
+
"&.Mui-focusVisible": r(e),
|
|
106
|
+
"&.Mui-disabled": { color: t.action.disabled },
|
|
107
|
+
...a,
|
|
108
|
+
variants: [
|
|
109
|
+
{
|
|
110
|
+
props: ({ ownerState: e }) => e.size === "small",
|
|
111
|
+
style: {
|
|
112
|
+
gap: e.spacing(.75),
|
|
113
|
+
minHeight: S.small,
|
|
114
|
+
padding: e.spacing(0, 1.5)
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
props: ({ ownerState: e }) => e.fullWidth,
|
|
119
|
+
style: { flex: "1 1 0" }
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
props: ({ ownerState: e }) => e.selected,
|
|
123
|
+
style: {
|
|
124
|
+
color: o.light.containedColor,
|
|
125
|
+
fontWeight: e.typography.fontWeightMedium,
|
|
126
|
+
[n]: { "&:hover:not(.Mui-disabled)": {
|
|
127
|
+
backgroundColor: "transparent",
|
|
128
|
+
color: o.light.containedColor
|
|
129
|
+
} },
|
|
130
|
+
"&:active:not(.Mui-disabled)": { backgroundColor: "transparent" },
|
|
131
|
+
...e.applyStyles("dark", {
|
|
132
|
+
color: o.dark.containedColor,
|
|
133
|
+
[n]: { "&:hover:not(.Mui-disabled)": { color: o.dark.containedColor } }
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
};
|
|
139
|
+
}), E = p(u, {
|
|
140
|
+
name: "SSegmentedControl",
|
|
141
|
+
slot: "Icon",
|
|
142
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
143
|
+
})({
|
|
144
|
+
alignItems: "center",
|
|
145
|
+
display: "inline-flex",
|
|
146
|
+
flex: "0 0 auto",
|
|
147
|
+
fontSize: 20,
|
|
148
|
+
"& > *": { fontSize: "inherit" },
|
|
149
|
+
variants: [{
|
|
150
|
+
props: ({ ownerState: e }) => e.size === "small",
|
|
151
|
+
style: { fontSize: 18 }
|
|
152
|
+
}]
|
|
153
|
+
}), D = p(f, {
|
|
154
|
+
name: "SSegmentedControl",
|
|
155
|
+
slot: "Label",
|
|
156
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
157
|
+
})({
|
|
158
|
+
color: "inherit",
|
|
159
|
+
fontWeight: "inherit",
|
|
160
|
+
minWidth: 0
|
|
161
|
+
}), O = p(u, {
|
|
162
|
+
name: "SSegmentedControl",
|
|
163
|
+
slot: "Badge",
|
|
164
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
165
|
+
})({
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
display: "inline-flex",
|
|
168
|
+
flex: "0 0 auto"
|
|
169
|
+
});
|
|
170
|
+
function k(n, r) {
|
|
171
|
+
let i = m({
|
|
172
|
+
props: n,
|
|
173
|
+
name: "SSegmentedControl"
|
|
174
|
+
}), { defaultValue: a, disabled: u = !1, fullWidth: d = !1, onChange: f, options: p, size: S = "medium", slotProps: k, slots: A, sx: j, value: M, ...N } = i, [P, F] = _({
|
|
175
|
+
controlled: M,
|
|
176
|
+
default: a,
|
|
177
|
+
name: "SSegmentedControl",
|
|
178
|
+
state: "value"
|
|
179
|
+
}), I = p.some((e) => e.value === P && e.disabled), L = {
|
|
180
|
+
...i,
|
|
181
|
+
disabled: u,
|
|
182
|
+
fullWidth: d,
|
|
183
|
+
selectedDisabled: I,
|
|
184
|
+
size: S
|
|
185
|
+
}, R = o.useRef(null), z = o.useRef(/* @__PURE__ */ new Map()), [B, V] = o.useState(null), H = o.useId();
|
|
186
|
+
g(() => {
|
|
187
|
+
let e = R.current;
|
|
188
|
+
if (!e) return;
|
|
189
|
+
let t = () => {
|
|
190
|
+
let t = P === void 0 ? void 0 : z.current.get(P);
|
|
191
|
+
if (!t) {
|
|
192
|
+
V((e) => e === null ? e : null);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
|
|
196
|
+
height: r.height,
|
|
197
|
+
left: r.left - n.left,
|
|
198
|
+
top: r.top - n.top,
|
|
199
|
+
width: r.width
|
|
200
|
+
};
|
|
201
|
+
V((e) => e && e.height === i.height && e.left === i.left && e.top === i.top && e.width === i.width ? e : i);
|
|
202
|
+
};
|
|
203
|
+
if (t(), window.addEventListener("resize", t), typeof ResizeObserver > "u") return () => window.removeEventListener("resize", t);
|
|
204
|
+
let n = new ResizeObserver(t);
|
|
205
|
+
return n.observe(e), z.current.forEach((e) => n.observe(e)), () => {
|
|
206
|
+
n.disconnect(), window.removeEventListener("resize", t);
|
|
207
|
+
};
|
|
208
|
+
}, [
|
|
209
|
+
d,
|
|
210
|
+
JSON.stringify(p.map((e) => [
|
|
211
|
+
typeof e.value,
|
|
212
|
+
String(e.value),
|
|
213
|
+
!!e.disabled
|
|
214
|
+
])),
|
|
215
|
+
S,
|
|
216
|
+
P
|
|
217
|
+
]);
|
|
218
|
+
let U = v((e, t) => {
|
|
219
|
+
e !== P && (F(e), f?.(t, e));
|
|
220
|
+
}), W = v((e) => {
|
|
221
|
+
if (!x.includes(e.key)) return;
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
let t = p.filter((e) => !e.disabled);
|
|
224
|
+
if (t.length === 0) return;
|
|
225
|
+
let n = t.findIndex((e) => e.value === P), r;
|
|
226
|
+
if (e.key === "Home") r = 0;
|
|
227
|
+
else if (e.key === "End") r = t.length - 1;
|
|
228
|
+
else {
|
|
229
|
+
let i = e.key === "ArrowLeft" || e.key === "ArrowUp" ? -1 : 1;
|
|
230
|
+
r = ((n === -1 ? i === 1 ? -1 : 0 : n) + i + t.length) % t.length;
|
|
231
|
+
}
|
|
232
|
+
let i = t[r];
|
|
233
|
+
i && (U(i.value, e), z.current.get(i.value)?.focus());
|
|
234
|
+
}), G = p.filter((e) => !e.disabled).map((e) => e.value), K = P !== void 0 && G.includes(P) ? P : G[0] ?? void 0, q = A?.root ?? C, J = A?.indicator ?? w, Y = A?.option ?? T, X = A?.icon ?? E, Z = A?.label ?? D, Q = A?.badge ?? O, { ref: $, sx: ee, ...te } = b(q, h(t(k?.root, L), N), L), ne = y($, R, r), { style: re, ...ie } = t(k?.indicator, L) ?? {}, ae = b(J, ie, L);
|
|
235
|
+
return /* @__PURE__ */ l(q, {
|
|
236
|
+
...te,
|
|
237
|
+
"aria-disabled": u || void 0,
|
|
238
|
+
ref: ne,
|
|
239
|
+
role: "radiogroup",
|
|
240
|
+
sx: [...e(j), ...e(ee)],
|
|
241
|
+
children: [/* @__PURE__ */ c(J, {
|
|
242
|
+
"aria-hidden": !0,
|
|
243
|
+
...ae,
|
|
244
|
+
style: {
|
|
245
|
+
height: B?.height ?? 0,
|
|
246
|
+
opacity: +!!B,
|
|
247
|
+
transform: `translate3d(${B?.left ?? 0}px, ${B?.top ?? 0}px, 0)`,
|
|
248
|
+
width: B?.width ?? 0,
|
|
249
|
+
...re
|
|
250
|
+
}
|
|
251
|
+
}), p.map((e, n) => {
|
|
252
|
+
let r = e.value === P, i = `${H}-${n}`, a = `${i}-label`, o = `${i}-description`, l = e.badge != null, d = {
|
|
253
|
+
...L,
|
|
254
|
+
option: e,
|
|
255
|
+
selected: r
|
|
256
|
+
}, f = b(Y, t(k?.option, d) ?? {}, d), p = b(X, t(k?.icon, d) ?? {}, d), m = t(k?.label, d) ?? {}, h = b(Z, {
|
|
257
|
+
component: "span",
|
|
258
|
+
noWrap: !0,
|
|
259
|
+
variant: S === "small" ? "body2" : "body1",
|
|
260
|
+
...m
|
|
261
|
+
}, d), g = b(Q, {
|
|
262
|
+
component: "span",
|
|
263
|
+
...t(k?.badge, d) ?? {}
|
|
264
|
+
}, d);
|
|
265
|
+
return /* @__PURE__ */ s(Y, {
|
|
266
|
+
...f,
|
|
267
|
+
"aria-checked": r,
|
|
268
|
+
"aria-describedby": l ? o : void 0,
|
|
269
|
+
"aria-labelledby": a,
|
|
270
|
+
disabled: u || e.disabled,
|
|
271
|
+
key: e.value,
|
|
272
|
+
onClick: (t) => U(e.value, t),
|
|
273
|
+
onKeyDown: W,
|
|
274
|
+
ref: (t) => {
|
|
275
|
+
t ? z.current.set(e.value, t) : z.current.delete(e.value);
|
|
276
|
+
},
|
|
277
|
+
role: "radio",
|
|
278
|
+
tabIndex: e.value === K ? 0 : -1
|
|
279
|
+
}, e.icon ? /* @__PURE__ */ c(X, {
|
|
280
|
+
"aria-hidden": !0,
|
|
281
|
+
...p,
|
|
282
|
+
children: e.icon
|
|
283
|
+
}) : null, /* @__PURE__ */ c(Z, {
|
|
284
|
+
...h,
|
|
285
|
+
id: a,
|
|
286
|
+
children: e.label
|
|
287
|
+
}), l ? /* @__PURE__ */ c(Q, {
|
|
288
|
+
...g,
|
|
289
|
+
id: o,
|
|
290
|
+
children: e.badge
|
|
291
|
+
}) : null);
|
|
292
|
+
})]
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
var A = o.forwardRef(k);
|
|
296
|
+
A.displayName = "SSegmentedControl";
|
|
297
|
+
//#endregion
|
|
298
|
+
export { A as SSegmentedControl, A as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default, default as SStepper } from './s-stepper';
|
|
2
|
+
export type { SStepperOwnProps, SStepperOwnerState, SStepperProps, SStepperSlotProps, SStepperSlots, SStepperStep, SStepperStepState, SStepperTypeMap, } from './s-stepper';
|
|
3
|
+
export type {} from '../theme/component-augmentation';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { OverridableComponent, OverrideProps } from '@mui/material/OverridableComponent';
|
|
2
|
+
import { StepProps } from '@mui/material/Step';
|
|
3
|
+
import { StepConnectorProps } from '@mui/material/StepConnector';
|
|
4
|
+
import { StepIconProps } from '@mui/material/StepIcon';
|
|
5
|
+
import { StepLabelProps } from '@mui/material/StepLabel';
|
|
6
|
+
import { StepperOwnProps, StepperProps } from '@mui/material/Stepper';
|
|
7
|
+
import { OwnerStateSlotProps as MuiOwnerStateSlotProps } from '../utils/slots';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
/** A single step in the progress indicator. */
|
|
10
|
+
export interface SStepperStep {
|
|
11
|
+
/** Marks the step as done regardless of its position. Linear steppers complete preceding steps by default. */
|
|
12
|
+
completed?: boolean;
|
|
13
|
+
/** Secondary inline text rendered under the label. */
|
|
14
|
+
description?: number | string;
|
|
15
|
+
/** Passes the disabled state to MUI Step and dims its label and icon. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Replaces the default step icon. */
|
|
18
|
+
icon?: React.ReactNode;
|
|
19
|
+
/** Unique step key. */
|
|
20
|
+
key: string;
|
|
21
|
+
/** Visible step label. */
|
|
22
|
+
label: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/** Props owned by the reusable step/progress indicator. */
|
|
25
|
+
export interface SStepperOwnProps extends Omit<StepperOwnProps, 'children' | 'connector' | 'elevation' | 'square' | 'variant'> {
|
|
26
|
+
/**
|
|
27
|
+
* Zero-based index of the active step.
|
|
28
|
+
*
|
|
29
|
+
* Use `-1` to disable every step without an explicit override in linear
|
|
30
|
+
* mode. In non-linear mode, `-1` leaves every step inactive and preserves
|
|
31
|
+
* explicit per-step states.
|
|
32
|
+
* @default 0
|
|
33
|
+
*/
|
|
34
|
+
activeStep?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Places labels below their icons in horizontal orientation.
|
|
37
|
+
*
|
|
38
|
+
* MUI does not support alternative labels for vertical steppers, so this
|
|
39
|
+
* prop is ignored when `orientation="vertical"`.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
alternativeLabel?: boolean;
|
|
43
|
+
/** Steps rendered in order. */
|
|
44
|
+
steps: SStepperStep[];
|
|
45
|
+
/** Components used for internal structural slots. */
|
|
46
|
+
slots?: SStepperSlots;
|
|
47
|
+
/** Props or step-state callbacks for internal structural slots. */
|
|
48
|
+
slotProps?: SStepperSlotProps;
|
|
49
|
+
}
|
|
50
|
+
export interface SStepperTypeMap<AdditionalProps = object, RootComponent extends React.ElementType = 'ol'> {
|
|
51
|
+
props: AdditionalProps & SStepperOwnProps;
|
|
52
|
+
defaultComponent: RootComponent;
|
|
53
|
+
}
|
|
54
|
+
export type SStepperProps<RootComponent extends React.ElementType = SStepperTypeMap['defaultComponent'], AdditionalProps = object> = OverrideProps<SStepperTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
|
55
|
+
component?: React.ElementType;
|
|
56
|
+
};
|
|
57
|
+
export interface SStepperOwnerState extends Omit<SStepperOwnProps, 'slotProps' | 'slots'> {
|
|
58
|
+
activeStep: number;
|
|
59
|
+
alternativeLabel: boolean;
|
|
60
|
+
component?: React.ElementType;
|
|
61
|
+
nonLinear: boolean;
|
|
62
|
+
orientation: NonNullable<StepperProps['orientation']>;
|
|
63
|
+
}
|
|
64
|
+
export interface SStepperStepState extends SStepperOwnerState {
|
|
65
|
+
active: boolean;
|
|
66
|
+
completed: boolean;
|
|
67
|
+
disabled: boolean;
|
|
68
|
+
index: number;
|
|
69
|
+
step: SStepperStep;
|
|
70
|
+
}
|
|
71
|
+
type RootSlotProps<Props> = MuiOwnerStateSlotProps<Props, SStepperOwnerState>;
|
|
72
|
+
type StepSlotProps<Props> = MuiOwnerStateSlotProps<Props, SStepperStepState>;
|
|
73
|
+
export interface SStepperSlots {
|
|
74
|
+
connector?: React.ElementType;
|
|
75
|
+
icon?: React.ElementType;
|
|
76
|
+
label?: React.ElementType;
|
|
77
|
+
root?: React.ElementType;
|
|
78
|
+
step?: React.ElementType;
|
|
79
|
+
}
|
|
80
|
+
export interface SStepperSlotProps {
|
|
81
|
+
connector?: RootSlotProps<StepConnectorProps>;
|
|
82
|
+
icon?: StepSlotProps<Partial<StepIconProps>>;
|
|
83
|
+
label?: StepSlotProps<Omit<StepLabelProps, 'children' | 'icon' | 'optional'>>;
|
|
84
|
+
root?: RootSlotProps<Omit<StepperProps, 'children' | 'connector' | 'elevation' | 'square' | 'variant'>>;
|
|
85
|
+
step?: StepSlotProps<Omit<StepProps, 'active' | 'children' | 'completed' | 'disabled'>>;
|
|
86
|
+
}
|
|
87
|
+
export declare const SStepper: OverridableComponent<SStepperTypeMap<object, "ol">> & {
|
|
88
|
+
displayName: string;
|
|
89
|
+
};
|
|
90
|
+
export default SStepper;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { resolveOwnerStateSlotProps as e } from "../utils/slots.js";
|
|
2
|
+
import { styled as t, useThemeProps as n } from "@mui/material/styles";
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import { createElement as i } from "react";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
+
import o from "@mui/material/Typography";
|
|
7
|
+
import { mergeSlotProps as s } from "@mui/material/utils";
|
|
8
|
+
import c from "@mui/utils/appendOwnerState";
|
|
9
|
+
import l from "@mui/material/Step";
|
|
10
|
+
import u, { stepConnectorClasses as d } from "@mui/material/StepConnector";
|
|
11
|
+
import f from "@mui/material/StepIcon";
|
|
12
|
+
import p, { stepLabelClasses as m } from "@mui/material/StepLabel";
|
|
13
|
+
import h from "@mui/material/Stepper";
|
|
14
|
+
//#region lib/s-stepper/s-stepper.tsx
|
|
15
|
+
var g = t(h, {
|
|
16
|
+
name: "SStepper",
|
|
17
|
+
slot: "Root",
|
|
18
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
19
|
+
})(({ theme: e }) => ({
|
|
20
|
+
width: "100%",
|
|
21
|
+
[`& .${m.labelContainer}`]: { minWidth: 0 },
|
|
22
|
+
[`& .${m.label}`]: { overflowWrap: "anywhere" },
|
|
23
|
+
variants: [{
|
|
24
|
+
props: ({ ownerState: e }) => e.orientation === "vertical",
|
|
25
|
+
style: { [`& .${m.root}`]: { paddingBlock: e.spacing(1) } }
|
|
26
|
+
}]
|
|
27
|
+
})), _ = t(l, {
|
|
28
|
+
name: "SStepper",
|
|
29
|
+
slot: "Step"
|
|
30
|
+
})({ minWidth: 0 }), v = t(p, {
|
|
31
|
+
name: "SStepper",
|
|
32
|
+
slot: "Label"
|
|
33
|
+
})(({ theme: e }) => ({ [`& .${m.label}`]: { [`&.${m.active}`]: {
|
|
34
|
+
color: (e.vars ?? e).palette.text.primary,
|
|
35
|
+
fontWeight: e.typography.fontWeightMedium
|
|
36
|
+
} } })), y = t(f, {
|
|
37
|
+
name: "SStepper",
|
|
38
|
+
slot: "Icon"
|
|
39
|
+
})({}), b = t(u, {
|
|
40
|
+
name: "SStepper",
|
|
41
|
+
slot: "Connector"
|
|
42
|
+
})(({ theme: e }) => ({
|
|
43
|
+
[`&.${d.active} .${d.line}`]: {
|
|
44
|
+
borderColor: (e.vars ?? e).palette.primary.main,
|
|
45
|
+
...e.applyStyles("dark", { borderColor: (e.vars ?? e).palette.primary.light })
|
|
46
|
+
},
|
|
47
|
+
[`&.${d.completed} .${d.line}`]: { borderColor: (e.vars ?? e).palette.success.main }
|
|
48
|
+
})), x = Object.assign(r.forwardRef(function(t, r) {
|
|
49
|
+
let l = n({
|
|
50
|
+
props: t,
|
|
51
|
+
name: "SStepper"
|
|
52
|
+
}), { activeStep: u = 0, alternativeLabel: d = !1, nonLinear: f = !1, orientation: p = "horizontal", slotProps: m, slots: h, steps: x, ...S } = l, C = p === "horizontal" && d, w = {
|
|
53
|
+
...l,
|
|
54
|
+
activeStep: u,
|
|
55
|
+
alternativeLabel: C,
|
|
56
|
+
nonLinear: f,
|
|
57
|
+
orientation: p
|
|
58
|
+
}, T = h?.root ?? g, E = h?.step ?? _, D = h?.label ?? v, O = h?.connector ?? b, k = h?.icon ?? y, A = c(T, s(e(m?.root, w), {
|
|
59
|
+
...S,
|
|
60
|
+
activeStep: u,
|
|
61
|
+
alternativeLabel: C,
|
|
62
|
+
nonLinear: f,
|
|
63
|
+
orientation: p
|
|
64
|
+
}), w), j = c(O, e(m?.connector, w) ?? {}, w);
|
|
65
|
+
return /* @__PURE__ */ a(T, {
|
|
66
|
+
...A,
|
|
67
|
+
ref: r,
|
|
68
|
+
connector: /* @__PURE__ */ a(O, { ...j }),
|
|
69
|
+
children: x.map((t, n) => {
|
|
70
|
+
let r = n === u, s = t.completed ?? (!f && n < u), l = t.disabled ?? (!f && n > u), d = {
|
|
71
|
+
...w,
|
|
72
|
+
active: r,
|
|
73
|
+
completed: s,
|
|
74
|
+
disabled: l,
|
|
75
|
+
index: n,
|
|
76
|
+
step: t
|
|
77
|
+
}, p = c(E, e(m?.step, d) ?? {}, d), h = c(D, e(m?.label, d) ?? {}, d), g = e(m?.icon, d);
|
|
78
|
+
return /* @__PURE__ */ i(E, {
|
|
79
|
+
...p,
|
|
80
|
+
active: r,
|
|
81
|
+
"aria-current": r ? "step" : void 0,
|
|
82
|
+
completed: s,
|
|
83
|
+
disabled: l,
|
|
84
|
+
key: t.key
|
|
85
|
+
}, /* @__PURE__ */ a(D, {
|
|
86
|
+
...h,
|
|
87
|
+
icon: t.icon,
|
|
88
|
+
optional: t.description == null ? void 0 : /* @__PURE__ */ a(o, {
|
|
89
|
+
component: "span",
|
|
90
|
+
variant: "body2",
|
|
91
|
+
sx: { color: "text.secondary" },
|
|
92
|
+
children: t.description
|
|
93
|
+
}),
|
|
94
|
+
slotProps: { stepIcon: g },
|
|
95
|
+
slots: { stepIcon: k },
|
|
96
|
+
children: t.label
|
|
97
|
+
}));
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}), { displayName: "SStepper" });
|
|
101
|
+
//#endregion
|
|
102
|
+
export { x as SStepper, x as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default, default as SSwatch } from './s-swatch';
|
|
2
|
+
export type { SSwatchAccessibleNameProps, SSwatchBaseProps, SSwatchOwnerState, SSwatchProps, SSwatchShape, SSwatchSize, SSwatchSlotProps, SSwatchSlots, SSwatchVisualProps, } from './s-swatch';
|
|
3
|
+
export type {} from '../theme/component-augmentation';
|