@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,499 @@
|
|
|
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, reducedMotionMedia as i } from "../theme/components/action-styles.js";
|
|
4
|
+
import { SLazyImage as a } from "../s-lazy-image/s-lazy-image.js";
|
|
5
|
+
import { SIconButton as o } from "../s-icon-button/s-icon-button.js";
|
|
6
|
+
import { SSwatch as ee } from "../s-swatch/s-swatch.js";
|
|
7
|
+
import { SRating as te } from "../s-rating/s-rating.js";
|
|
8
|
+
import { SInteractiveCard as s } from "../s-interactive-card/s-interactive-card.js";
|
|
9
|
+
import * as c from "react";
|
|
10
|
+
import { createElement as ne } from "react";
|
|
11
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
12
|
+
import { Box as d, CardActionArea as re, CardContent as f, CardMedia as p, Typography as m, styled as h, useThemeProps as ie } from "@mui/material";
|
|
13
|
+
import { mergeSlotProps as g, useControlled as ae, useEventCallback as oe, useForkRef as se } from "@mui/material/utils";
|
|
14
|
+
import _ from "@mui/utils/appendOwnerState";
|
|
15
|
+
import ce from "@mui/icons-material/Favorite";
|
|
16
|
+
import le from "@mui/icons-material/FavoriteBorder";
|
|
17
|
+
//#region lib/s-product-card/s-product-card.tsx
|
|
18
|
+
var v = "clamp(180px, 38%, 240px)", ue = 220, de = 18, fe = 2, y = (e) => ({ [n]: { "&:hover": e } }), b = (...e) => ({ ownerState: t }) => e.includes(t.variant), pe = h(s, {
|
|
19
|
+
name: "SProductCard",
|
|
20
|
+
slot: "Root",
|
|
21
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
22
|
+
})(({ ownerState: e, theme: t }) => ({
|
|
23
|
+
"--SProductCard-hoverActionsOpacity": "1",
|
|
24
|
+
"--SProductCard-hoverActionsShift": "0px",
|
|
25
|
+
"--SProductCard-hoverImageOpacity": "0",
|
|
26
|
+
"--SProductCard-imageScale": "1",
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexDirection: "column",
|
|
29
|
+
gap: 0,
|
|
30
|
+
height: "100%",
|
|
31
|
+
position: "relative",
|
|
32
|
+
...e.interactive && !e.disabled && { "@media (hover: hover) and (pointer: fine)": {
|
|
33
|
+
"--SProductCard-hoverActionsOpacity": "0",
|
|
34
|
+
"--SProductCard-hoverActionsShift": `calc(${t.spacing(1.5)} * -1)`,
|
|
35
|
+
"&:hover, &:has(.Mui-focusVisible)": {
|
|
36
|
+
"--SProductCard-hoverActionsOpacity": "1",
|
|
37
|
+
"--SProductCard-hoverActionsShift": "0px"
|
|
38
|
+
}
|
|
39
|
+
} },
|
|
40
|
+
variants: [
|
|
41
|
+
{
|
|
42
|
+
props: b("list"),
|
|
43
|
+
style: {
|
|
44
|
+
flexDirection: "row",
|
|
45
|
+
[t.breakpoints.down("sm")]: { flexDirection: "column" }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
props: b("overlay"),
|
|
50
|
+
style: {
|
|
51
|
+
backgroundColor: "transparent",
|
|
52
|
+
backgroundImage: "none",
|
|
53
|
+
border: 0,
|
|
54
|
+
boxShadow: "none"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
props: ({ ownerState: e }) => e.interactive && !e.disabled && e.mediaZoom,
|
|
59
|
+
style: y({ "--SProductCard-imageScale": String(e.mediaZoomScale) })
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
props: ({ ownerState: e }) => e.interactive && !e.disabled && !!e.hoverImage,
|
|
63
|
+
style: y({ "--SProductCard-hoverImageOpacity": "1" })
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
props: ({ ownerState: e }) => e.disabled,
|
|
67
|
+
style: {
|
|
68
|
+
"--SProductCard-hoverActionsOpacity": "0",
|
|
69
|
+
"--SProductCard-hoverImageOpacity": "0",
|
|
70
|
+
"--SProductCard-imageScale": "1",
|
|
71
|
+
borderColor: (t.vars ?? t).palette.divider,
|
|
72
|
+
boxShadow: "none"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
})), me = h(re, {
|
|
77
|
+
name: "SProductCard",
|
|
78
|
+
slot: "Link",
|
|
79
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
80
|
+
})(({ theme: e }) => ({
|
|
81
|
+
borderRadius: "inherit",
|
|
82
|
+
inset: 0,
|
|
83
|
+
position: "absolute",
|
|
84
|
+
zIndex: 1,
|
|
85
|
+
"&.Mui-focusVisible": {
|
|
86
|
+
...r(e),
|
|
87
|
+
outlineOffset: -2
|
|
88
|
+
}
|
|
89
|
+
})), he = h(p, {
|
|
90
|
+
name: "SProductCard",
|
|
91
|
+
slot: "Media",
|
|
92
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
93
|
+
})(({ ownerState: e, theme: t }) => ({
|
|
94
|
+
aspectRatio: e.mediaHeight == null ? String(e.aspectRatio) : void 0,
|
|
95
|
+
backgroundColor: (t.vars ?? t).palette.background.paper,
|
|
96
|
+
display: "grid",
|
|
97
|
+
flexShrink: 0,
|
|
98
|
+
gridTemplateAreas: "\"media\"",
|
|
99
|
+
height: e.mediaHeight,
|
|
100
|
+
overflow: "hidden",
|
|
101
|
+
position: "relative",
|
|
102
|
+
width: "100%",
|
|
103
|
+
"& > *": {
|
|
104
|
+
gridArea: "media",
|
|
105
|
+
minWidth: 0
|
|
106
|
+
},
|
|
107
|
+
variants: [{
|
|
108
|
+
props: b("list"),
|
|
109
|
+
style: {
|
|
110
|
+
aspectRatio: "auto",
|
|
111
|
+
height: e.mediaHeight ?? "auto",
|
|
112
|
+
width: e.mediaWidth ?? v,
|
|
113
|
+
[t.breakpoints.down("sm")]: {
|
|
114
|
+
height: e.mediaHeight ?? ue,
|
|
115
|
+
width: "100%"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
props: b("overlay"),
|
|
120
|
+
style: {
|
|
121
|
+
borderEndEndRadius: 0,
|
|
122
|
+
borderEndStartRadius: 0,
|
|
123
|
+
borderStartEndRadius: t.radius.md,
|
|
124
|
+
borderStartStartRadius: t.radius.md
|
|
125
|
+
}
|
|
126
|
+
}]
|
|
127
|
+
})), x = h(a, {
|
|
128
|
+
name: "SProductCard",
|
|
129
|
+
slot: "Image",
|
|
130
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
131
|
+
})(({ theme: e }) => ({
|
|
132
|
+
height: "100%",
|
|
133
|
+
width: "100%",
|
|
134
|
+
"& img": {
|
|
135
|
+
objectFit: "cover",
|
|
136
|
+
objectPosition: "center",
|
|
137
|
+
transform: "scale(var(--SProductCard-imageScale))",
|
|
138
|
+
transition: e.transitions.create("transform", {
|
|
139
|
+
duration: e.transitions.duration.complex,
|
|
140
|
+
easing: e.transitions.easing.easeOut
|
|
141
|
+
}),
|
|
142
|
+
[i]: {
|
|
143
|
+
transform: "none",
|
|
144
|
+
transition: "none"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
})), ge = h(x, {
|
|
148
|
+
name: "SProductCard",
|
|
149
|
+
slot: "HoverImage",
|
|
150
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
151
|
+
})(({ theme: e }) => ({
|
|
152
|
+
opacity: "var(--SProductCard-hoverImageOpacity)",
|
|
153
|
+
transition: e.transitions.create("opacity", { duration: e.transitions.duration.shorter }),
|
|
154
|
+
[i]: { transition: "none" }
|
|
155
|
+
})), _e = h(d, {
|
|
156
|
+
name: "SProductCard",
|
|
157
|
+
slot: "Badge",
|
|
158
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
159
|
+
})(({ theme: e }) => ({
|
|
160
|
+
gridArea: "auto",
|
|
161
|
+
position: "absolute",
|
|
162
|
+
pointerEvents: "none",
|
|
163
|
+
zIndex: 2,
|
|
164
|
+
variants: [
|
|
165
|
+
{
|
|
166
|
+
props: ({ ownerState: e }) => e.badgePlacement.startsWith("top"),
|
|
167
|
+
style: { insetBlockStart: e.spacing(2) }
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
props: ({ ownerState: e }) => e.badgePlacement.startsWith("bottom"),
|
|
171
|
+
style: { insetBlockEnd: e.spacing(2) }
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
props: ({ ownerState: e }) => e.badgePlacement.endsWith("start"),
|
|
175
|
+
style: { insetInlineStart: e.spacing(2) }
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
props: ({ ownerState: e }) => e.badgePlacement.endsWith("end"),
|
|
179
|
+
style: { insetInlineEnd: e.spacing(2) }
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
})), ve = h(d, {
|
|
183
|
+
name: "SProductCard",
|
|
184
|
+
slot: "HoverActions",
|
|
185
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
186
|
+
})(({ theme: e }) => ({
|
|
187
|
+
alignItems: "center",
|
|
188
|
+
display: "flex",
|
|
189
|
+
flexDirection: "column",
|
|
190
|
+
gap: e.spacing(1),
|
|
191
|
+
gridArea: "auto",
|
|
192
|
+
opacity: "var(--SProductCard-hoverActionsOpacity)",
|
|
193
|
+
position: "absolute",
|
|
194
|
+
insetBlockStart: e.spacing(2),
|
|
195
|
+
insetInlineEnd: e.spacing(2),
|
|
196
|
+
transform: "translateY(var(--SProductCard-hoverActionsShift))",
|
|
197
|
+
transition: e.transitions.create(["opacity", "transform"], { duration: e.transitions.duration.shorter }),
|
|
198
|
+
zIndex: 2,
|
|
199
|
+
[i]: {
|
|
200
|
+
transform: "none",
|
|
201
|
+
transition: "none"
|
|
202
|
+
}
|
|
203
|
+
})), ye = h(f, {
|
|
204
|
+
name: "SProductCard",
|
|
205
|
+
slot: "Content",
|
|
206
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
207
|
+
})(({ theme: e }) => ({
|
|
208
|
+
display: "flex",
|
|
209
|
+
flex: 1,
|
|
210
|
+
flexDirection: "column",
|
|
211
|
+
gap: e.spacing(1),
|
|
212
|
+
minWidth: 0,
|
|
213
|
+
padding: e.spacing(2),
|
|
214
|
+
position: "relative",
|
|
215
|
+
"&:last-child": { paddingBottom: e.spacing(2) },
|
|
216
|
+
variants: [
|
|
217
|
+
{
|
|
218
|
+
props: b("grid"),
|
|
219
|
+
style: { borderTop: `1px solid ${(e.vars ?? e).palette.divider}` }
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
props: b("mini"),
|
|
223
|
+
style: {
|
|
224
|
+
backgroundColor: (e.vars ?? e).palette.background.paper,
|
|
225
|
+
borderTopLeftRadius: e.radius.xl,
|
|
226
|
+
borderTopRightRadius: e.radius.xl,
|
|
227
|
+
marginTop: e.spacing(-3.5),
|
|
228
|
+
zIndex: 1
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
props: b("overlay"),
|
|
233
|
+
style: { textAlign: "center" }
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
})), be = h(m, {
|
|
237
|
+
name: "SProductCard",
|
|
238
|
+
slot: "Title",
|
|
239
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
240
|
+
})({
|
|
241
|
+
display: "-webkit-box",
|
|
242
|
+
overflow: "hidden",
|
|
243
|
+
WebkitBoxOrient: "vertical",
|
|
244
|
+
WebkitLineClamp: fe
|
|
245
|
+
}), xe = h(d, {
|
|
246
|
+
name: "SProductCard",
|
|
247
|
+
slot: "Rating",
|
|
248
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
249
|
+
})(({ theme: e }) => ({
|
|
250
|
+
alignItems: "center",
|
|
251
|
+
display: "flex",
|
|
252
|
+
gap: e.spacing(.5),
|
|
253
|
+
variants: [{
|
|
254
|
+
props: b("overlay"),
|
|
255
|
+
style: { justifyContent: "center" }
|
|
256
|
+
}]
|
|
257
|
+
})), Se = h(d, {
|
|
258
|
+
name: "SProductCard",
|
|
259
|
+
slot: "Meta",
|
|
260
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
261
|
+
})(({ theme: e }) => ({
|
|
262
|
+
color: (e.vars ?? e).palette.text.secondary,
|
|
263
|
+
minWidth: 0,
|
|
264
|
+
...e.typography.body2
|
|
265
|
+
})), Ce = h(d, {
|
|
266
|
+
name: "SProductCard",
|
|
267
|
+
slot: "Swatches",
|
|
268
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
269
|
+
})(({ theme: e }) => ({
|
|
270
|
+
alignItems: "center",
|
|
271
|
+
display: "flex",
|
|
272
|
+
flexWrap: "wrap",
|
|
273
|
+
gap: e.spacing(.5),
|
|
274
|
+
pointerEvents: "none",
|
|
275
|
+
position: "relative",
|
|
276
|
+
zIndex: 2,
|
|
277
|
+
variants: [{
|
|
278
|
+
props: b("overlay"),
|
|
279
|
+
style: { justifyContent: "center" }
|
|
280
|
+
}]
|
|
281
|
+
})), we = h(d, {
|
|
282
|
+
name: "SProductCard",
|
|
283
|
+
slot: "Footer",
|
|
284
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
285
|
+
})(({ theme: e }) => ({
|
|
286
|
+
alignItems: "center",
|
|
287
|
+
display: "flex",
|
|
288
|
+
gap: e.spacing(1),
|
|
289
|
+
justifyContent: "space-between",
|
|
290
|
+
marginTop: "auto",
|
|
291
|
+
variants: [{
|
|
292
|
+
props: b("overlay"),
|
|
293
|
+
style: { justifyContent: "center" }
|
|
294
|
+
}]
|
|
295
|
+
})), Te = h(m, {
|
|
296
|
+
name: "SProductCard",
|
|
297
|
+
slot: "Price",
|
|
298
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
299
|
+
})(({ theme: e }) => ({
|
|
300
|
+
alignItems: "center",
|
|
301
|
+
color: (e.vars ?? e).palette.primary.main,
|
|
302
|
+
display: "flex",
|
|
303
|
+
gap: e.spacing(1),
|
|
304
|
+
minWidth: 0
|
|
305
|
+
})), Ee = h(d, {
|
|
306
|
+
name: "SProductCard",
|
|
307
|
+
slot: "OriginalPrice",
|
|
308
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
309
|
+
})(({ theme: e }) => ({
|
|
310
|
+
color: (e.vars ?? e).palette.text.secondary,
|
|
311
|
+
textDecoration: "line-through",
|
|
312
|
+
...e.typography.body2
|
|
313
|
+
})), De = h(d, {
|
|
314
|
+
name: "SProductCard",
|
|
315
|
+
slot: "Actions",
|
|
316
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
317
|
+
})(({ theme: e }) => ({
|
|
318
|
+
alignItems: "center",
|
|
319
|
+
display: "flex",
|
|
320
|
+
flexShrink: 0,
|
|
321
|
+
gap: e.spacing(.5),
|
|
322
|
+
position: "relative",
|
|
323
|
+
zIndex: 2
|
|
324
|
+
})), Oe = h(o, {
|
|
325
|
+
name: "SProductCard",
|
|
326
|
+
slot: "FavoriteButton",
|
|
327
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
328
|
+
})(({ theme: e }) => ({ variants: [{
|
|
329
|
+
props: ({ ownerState: e }) => e.favorite,
|
|
330
|
+
style: { color: (e.vars ?? e).palette.error.main }
|
|
331
|
+
}] })), S = c.forwardRef(function(n, r) {
|
|
332
|
+
let i = ie({
|
|
333
|
+
props: n,
|
|
334
|
+
name: "SProductCard"
|
|
335
|
+
}), { actions: a, alt: o = "", aspectRatio: s = 1, badge: d, badgePlacement: re = "top-start", defaultFavorite: f = !1, disableLift: p = !1, disabled: h = !1, favorite: v, favoriteActiveIcon: ue = /* @__PURE__ */ l(ce, { fontSize: "inherit" }), favoriteActiveLabel: fe = "Remove from wishlist", favoriteIcon: y = /* @__PURE__ */ l(le, { fontSize: "inherit" }), favoriteLabel: b = "Add to wishlist", footerContent: S, hoverActions: C, hoverImage: w, href: T, image: E, interactive: D = !0, linkLabel: O, maxSwatches: k = 5, media: A, mediaHeight: ke, mediaWidth: Ae, mediaZoom: je = !0, mediaZoomScale: Me = 1.08, meta: j, onClick: M, onFavoriteChange: Ne, originalPrice: N, price: P, rating: F, sheen: I = !1, showFavorite: L = !1, slotProps: R, slots: z, swatches: B, swatchesLabel: V, sx: Pe, title: H, variant: U = "grid", ...Fe } = i, [W, Ie] = ae({
|
|
336
|
+
controlled: v,
|
|
337
|
+
default: f,
|
|
338
|
+
name: "SProductCard",
|
|
339
|
+
state: "favorite"
|
|
340
|
+
}), G = Number.isFinite(k) ? Math.max(1, Math.floor(k)) : 5, K = !h && (T !== void 0 || M !== void 0), q = {
|
|
341
|
+
...i,
|
|
342
|
+
alt: o,
|
|
343
|
+
aspectRatio: s,
|
|
344
|
+
badgePlacement: re,
|
|
345
|
+
clickable: K,
|
|
346
|
+
disableLift: p,
|
|
347
|
+
disabled: h,
|
|
348
|
+
favorite: W,
|
|
349
|
+
interactive: D,
|
|
350
|
+
maxSwatches: G,
|
|
351
|
+
mediaHeight: ke,
|
|
352
|
+
mediaWidth: Ae,
|
|
353
|
+
mediaZoom: je,
|
|
354
|
+
mediaZoomScale: Me,
|
|
355
|
+
sheen: I,
|
|
356
|
+
showFavorite: L,
|
|
357
|
+
variant: U
|
|
358
|
+
}, J = z?.root ?? pe, Le = z?.link ?? me, Re = z?.media ?? he, ze = z?.image ?? x, Be = z?.hoverImage ?? ge, Ve = z?.badge ?? _e, He = z?.hoverActions ?? ve, Ue = z?.content ?? ye, We = z?.title ?? be, Ge = z?.rating ?? xe, Ke = z?.meta ?? Se, qe = z?.swatches ?? Ce, Je = z?.footer ?? we, Ye = z?.price ?? Te, Xe = z?.originalPrice ?? Ee, Ze = z?.actions ?? De, Qe = z?.favoriteButton ?? Oe, $e = `${c.useId()}-title`, et = oe((e) => {
|
|
359
|
+
if (h) return;
|
|
360
|
+
let t = !W;
|
|
361
|
+
Ie(t), Ne?.(e, t);
|
|
362
|
+
}), { ref: tt, sx: nt, ...rt } = _(J, {
|
|
363
|
+
...g(t(R?.root, q), Fe),
|
|
364
|
+
"aria-disabled": h || void 0,
|
|
365
|
+
disableLift: p,
|
|
366
|
+
disabled: h,
|
|
367
|
+
interactive: D,
|
|
368
|
+
sheen: I
|
|
369
|
+
}, q), it = se(tt, r), Y = (e, n) => _(n, t(e, q) ?? {}, q), at = Y(R?.media, Re), ot = _(ze, {
|
|
370
|
+
...g(t(R?.image, q), { variant: "rectangular" }),
|
|
371
|
+
alt: o,
|
|
372
|
+
src: E
|
|
373
|
+
}, q), st = _(Be, {
|
|
374
|
+
...g(t(R?.hoverImage, q), { variant: "rectangular" }),
|
|
375
|
+
alt: "",
|
|
376
|
+
src: w
|
|
377
|
+
}, q), ct = t(R?.badge, q) ?? {}, lt = _(Ve, {
|
|
378
|
+
...ct,
|
|
379
|
+
inert: h || ct.inert
|
|
380
|
+
}, q), ut = g(t(R?.hoverActions, q), { inert: h || void 0 }), dt = _(He, {
|
|
381
|
+
...ut,
|
|
382
|
+
inert: h || ut.inert
|
|
383
|
+
}, q), ft = Y(R?.content, Ue), pt = Y(R?.rating, Ge), mt = Y(R?.meta, Ke), ht = _(qe, g(t(R?.swatches, q), {
|
|
384
|
+
"aria-label": V,
|
|
385
|
+
role: V ? "group" : void 0
|
|
386
|
+
}), q), gt = Y(R?.footer, Je), _t = Y(R?.originalPrice, Xe), vt = g(t(R?.actions, q), { inert: h || void 0 }), yt = _(Ze, {
|
|
387
|
+
...vt,
|
|
388
|
+
inert: h || vt.inert
|
|
389
|
+
}, q), bt = _(We, g(t(R?.title, q), {
|
|
390
|
+
component: "h3",
|
|
391
|
+
id: $e,
|
|
392
|
+
variant: U === "list" ? "subtitle1" : "body1"
|
|
393
|
+
}), q), xt = bt.id ?? $e, X = t(R?.link, q), St = _(Le, {
|
|
394
|
+
...g(X, {
|
|
395
|
+
"aria-label": O,
|
|
396
|
+
"aria-labelledby": !(X?.["aria-label"] != null || X?.["aria-labelledby"] != null) && O == null && H != null ? xt : void 0
|
|
397
|
+
}),
|
|
398
|
+
component: T === void 0 ? "button" : "a",
|
|
399
|
+
href: T,
|
|
400
|
+
nativeButton: T === void 0,
|
|
401
|
+
onClick: M,
|
|
402
|
+
type: T === void 0 ? "button" : void 0
|
|
403
|
+
}, q), Ct = _(Ye, g(t(R?.price, q), {
|
|
404
|
+
component: "p",
|
|
405
|
+
variant: "subtitle1"
|
|
406
|
+
}), q), Z = g(t(R?.favoriteButton, q), {
|
|
407
|
+
"aria-label": W ? fe : b,
|
|
408
|
+
"aria-pressed": W,
|
|
409
|
+
onClick: et
|
|
410
|
+
}), wt = _(Qe, {
|
|
411
|
+
...Z,
|
|
412
|
+
disabled: h || Z.disabled,
|
|
413
|
+
size: Z.size ?? "medium"
|
|
414
|
+
}, q), Q = B?.slice(0, G) ?? [], Tt = (B?.length ?? 0) - Q.length, Et = P != null || N != null, $ = L || a != null, Dt = Et || $ || S != null;
|
|
415
|
+
return /* @__PURE__ */ u(J, {
|
|
416
|
+
...rt,
|
|
417
|
+
ref: it,
|
|
418
|
+
sx: [...e(Pe), ...e(nt)],
|
|
419
|
+
children: [
|
|
420
|
+
K ? /* @__PURE__ */ l(Le, { ...St }) : null,
|
|
421
|
+
A != null || E != null ? /* @__PURE__ */ u(Re, {
|
|
422
|
+
...at,
|
|
423
|
+
children: [
|
|
424
|
+
A,
|
|
425
|
+
A == null && E != null ? /* @__PURE__ */ l(ze, { ...ot }) : null,
|
|
426
|
+
A == null && w != null ? /* @__PURE__ */ l(Be, { ...st }) : null,
|
|
427
|
+
d == null ? null : /* @__PURE__ */ l(Ve, {
|
|
428
|
+
...lt,
|
|
429
|
+
children: d
|
|
430
|
+
}),
|
|
431
|
+
C == null ? null : /* @__PURE__ */ l(He, {
|
|
432
|
+
...dt,
|
|
433
|
+
children: C
|
|
434
|
+
})
|
|
435
|
+
]
|
|
436
|
+
}) : null,
|
|
437
|
+
/* @__PURE__ */ u(Ue, {
|
|
438
|
+
...ft,
|
|
439
|
+
children: [
|
|
440
|
+
H == null ? null : /* @__PURE__ */ l(We, {
|
|
441
|
+
...bt,
|
|
442
|
+
children: H
|
|
443
|
+
}),
|
|
444
|
+
F == null ? null : /* @__PURE__ */ l(Ge, {
|
|
445
|
+
...pt,
|
|
446
|
+
children: typeof F == "number" ? /* @__PURE__ */ l(te, {
|
|
447
|
+
precision: .5,
|
|
448
|
+
readOnly: !0,
|
|
449
|
+
size: "small",
|
|
450
|
+
value: F
|
|
451
|
+
}) : F
|
|
452
|
+
}),
|
|
453
|
+
j == null ? null : /* @__PURE__ */ l(Ke, {
|
|
454
|
+
...mt,
|
|
455
|
+
children: j
|
|
456
|
+
}),
|
|
457
|
+
Q.length > 0 ? /* @__PURE__ */ u(qe, {
|
|
458
|
+
...ht,
|
|
459
|
+
children: [Q.map((e) => /* @__PURE__ */ ne(ee, {
|
|
460
|
+
...e,
|
|
461
|
+
interactive: !1,
|
|
462
|
+
key: e.value,
|
|
463
|
+
shape: "square",
|
|
464
|
+
size: de
|
|
465
|
+
})), Tt > 0 ? /* @__PURE__ */ u(m, {
|
|
466
|
+
component: "span",
|
|
467
|
+
variant: "caption",
|
|
468
|
+
children: ["+", Tt]
|
|
469
|
+
}) : null]
|
|
470
|
+
}) : null,
|
|
471
|
+
Dt ? /* @__PURE__ */ u(Je, {
|
|
472
|
+
...gt,
|
|
473
|
+
children: [
|
|
474
|
+
Et ? /* @__PURE__ */ u(Ye, {
|
|
475
|
+
...Ct,
|
|
476
|
+
children: [P, N == null ? null : /* @__PURE__ */ l(Xe, {
|
|
477
|
+
component: "del",
|
|
478
|
+
..._t,
|
|
479
|
+
children: N
|
|
480
|
+
})]
|
|
481
|
+
}) : null,
|
|
482
|
+
S,
|
|
483
|
+
$ ? /* @__PURE__ */ u(Ze, {
|
|
484
|
+
...yt,
|
|
485
|
+
children: [L ? /* @__PURE__ */ l(Qe, {
|
|
486
|
+
...wt,
|
|
487
|
+
children: W ? ue : y
|
|
488
|
+
}) : null, a]
|
|
489
|
+
}) : null
|
|
490
|
+
]
|
|
491
|
+
}) : null
|
|
492
|
+
]
|
|
493
|
+
})
|
|
494
|
+
]
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
S.displayName = "SProductCard";
|
|
498
|
+
//#endregion
|
|
499
|
+
export { S as SProductCard, S as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default, default as SProductGallery } from './s-product-gallery';
|
|
2
|
+
export type { SProductGalleryCarouselSlotProps, SProductGalleryImageItem, SProductGalleryItem, SProductGalleryOwnerState, SProductGalleryProps, SProductGallerySlotProps, SProductGallerySlots, SProductGalleryThumbnailOwnerState, SProductGalleryVideoItem, } from './s-product-gallery';
|
|
3
|
+
export type {} from '../theme/component-augmentation';
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { BoxProps, ButtonBaseProps } from '@mui/material';
|
|
2
|
+
import { SCarouselProps } from '../s-carousel';
|
|
3
|
+
import { SLazyImageProps } from '../s-lazy-image';
|
|
4
|
+
import { OwnerStateSlotProps } from '../utils/slots';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
interface SProductGalleryItemBase {
|
|
7
|
+
/** Stable identity and the value reported by `onChange`. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Media URL. */
|
|
10
|
+
src: string;
|
|
11
|
+
}
|
|
12
|
+
/** An image item shown in the product gallery. */
|
|
13
|
+
export interface SProductGalleryImageItem extends SProductGalleryItemBase {
|
|
14
|
+
/** Accessible alternative text. Use an empty string only for a decorative image. */
|
|
15
|
+
alt: string;
|
|
16
|
+
/** Image shown in the thumbnail rail. Defaults to `src`. */
|
|
17
|
+
thumbnailSrc?: string;
|
|
18
|
+
type?: 'image';
|
|
19
|
+
}
|
|
20
|
+
interface SProductGalleryVideoItemBase extends SProductGalleryItemBase {
|
|
21
|
+
/** Accessible name applied to the native video element. */
|
|
22
|
+
ariaLabel: string;
|
|
23
|
+
type: 'video';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A video item. A poster or dedicated thumbnail is required so the thumbnail
|
|
27
|
+
* rail never attempts to render the video URL through an image element.
|
|
28
|
+
*/
|
|
29
|
+
export type SProductGalleryVideoItem = SProductGalleryVideoItemBase & ({
|
|
30
|
+
poster: string;
|
|
31
|
+
thumbnailSrc?: string;
|
|
32
|
+
} | {
|
|
33
|
+
poster?: string;
|
|
34
|
+
thumbnailSrc: string;
|
|
35
|
+
});
|
|
36
|
+
/** A single image or video in the product gallery. */
|
|
37
|
+
export type SProductGalleryItem = SProductGalleryImageItem | SProductGalleryVideoItem;
|
|
38
|
+
/** Props for <SProductGallery>. */
|
|
39
|
+
export interface SProductGalleryProps extends Omit<BoxProps, 'children' | 'component' | 'defaultValue' | 'onChange'> {
|
|
40
|
+
/**
|
|
41
|
+
* Stage aspect ratio (width / height). Keeping this fixed prevents layout shift
|
|
42
|
+
* when the selected media changes.
|
|
43
|
+
*/
|
|
44
|
+
aspectRatio?: number | string;
|
|
45
|
+
/** Initially selected item id, for uncontrolled usage. Defaults to the first item. */
|
|
46
|
+
defaultValue?: string;
|
|
47
|
+
/** Returns the accessible name for a thumbnail button. */
|
|
48
|
+
getThumbnailAriaLabel?: (item: SProductGalleryItem, index: number, total: number) => string;
|
|
49
|
+
/** Media shown in the stage and the thumbnail rail. */
|
|
50
|
+
items: readonly SProductGalleryItem[];
|
|
51
|
+
/** Called with the newly selected item id. */
|
|
52
|
+
onChange?: (event: React.SyntheticEvent, value: string) => void;
|
|
53
|
+
/** Components used for internal structural slots. */
|
|
54
|
+
slots?: SProductGallerySlots;
|
|
55
|
+
/** Props or owner-state callbacks for internal structural slots. */
|
|
56
|
+
slotProps?: SProductGallerySlotProps;
|
|
57
|
+
/** Accessible name for the thumbnail rail. */
|
|
58
|
+
thumbnailsLabel?: string;
|
|
59
|
+
/** Thumbnails visible at once on wide viewports. Halves below the `sm` breakpoint. */
|
|
60
|
+
thumbnailsToShow?: number;
|
|
61
|
+
/** Selected item id, for controlled usage. */
|
|
62
|
+
value?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface SProductGalleryOwnerState extends SProductGalleryProps {
|
|
65
|
+
/** Resolved fixed stage aspect ratio. */
|
|
66
|
+
aspectRatio: number | string;
|
|
67
|
+
/** The resolved active item, or `null` when there is nothing to show. */
|
|
68
|
+
activeItem: SProductGalleryItem | null;
|
|
69
|
+
/** Index of the active item, or `-1` when there is nothing to show. */
|
|
70
|
+
activeIndex: number;
|
|
71
|
+
thumbnailsLabel: string;
|
|
72
|
+
thumbnailsToShow: number;
|
|
73
|
+
value: string;
|
|
74
|
+
}
|
|
75
|
+
/** Owner state handed to the `thumbnail` slot. */
|
|
76
|
+
export interface SProductGalleryThumbnailOwnerState extends SProductGalleryOwnerState {
|
|
77
|
+
index: number;
|
|
78
|
+
item: SProductGalleryItem;
|
|
79
|
+
selected: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface SProductGallerySlots {
|
|
82
|
+
/** The embla-backed thumbnail carousel. */
|
|
83
|
+
carousel?: React.ElementType;
|
|
84
|
+
/** Shared media wrapper inside the stage. */
|
|
85
|
+
media?: React.ElementType;
|
|
86
|
+
/** Stage image renderer. */
|
|
87
|
+
image?: React.ElementType;
|
|
88
|
+
root?: React.ElementType;
|
|
89
|
+
/** Aspect-ratio box holding the active media. */
|
|
90
|
+
stage?: React.ElementType;
|
|
91
|
+
/** One thumbnail button. */
|
|
92
|
+
thumbnail?: React.ElementType;
|
|
93
|
+
/** Wrapper around the thumbnail rail. */
|
|
94
|
+
thumbnails?: React.ElementType;
|
|
95
|
+
/** Stage video renderer. */
|
|
96
|
+
video?: React.ElementType;
|
|
97
|
+
}
|
|
98
|
+
export type SProductGalleryCarouselSlotProps = Omit<SCarouselProps, 'apiRef' | 'autoplay' | 'autoplaySpeed' | 'centerMode' | 'centerPadding' | 'children' | 'infinite' | 'responsive' | 'slidesToShow' | 'spaceBetween'>;
|
|
99
|
+
export interface SProductGallerySlotProps {
|
|
100
|
+
carousel?: OwnerStateSlotProps<SProductGalleryCarouselSlotProps, SProductGalleryOwnerState>;
|
|
101
|
+
image?: OwnerStateSlotProps<Omit<SLazyImageProps, 'alt' | 'src'>, SProductGalleryOwnerState>;
|
|
102
|
+
media?: OwnerStateSlotProps<Omit<BoxProps, 'children'>, SProductGalleryOwnerState>;
|
|
103
|
+
root?: OwnerStateSlotProps<Omit<BoxProps, 'children' | 'component'>, SProductGalleryOwnerState>;
|
|
104
|
+
stage?: OwnerStateSlotProps<Omit<BoxProps, 'children'>, SProductGalleryOwnerState>;
|
|
105
|
+
thumbnail?: OwnerStateSlotProps<Omit<ButtonBaseProps, 'children'>, SProductGalleryThumbnailOwnerState>;
|
|
106
|
+
thumbnails?: OwnerStateSlotProps<Omit<BoxProps, 'children'>, SProductGalleryOwnerState>;
|
|
107
|
+
/** Native video props. `children` can provide caption or subtitle `<track>` elements. */
|
|
108
|
+
video?: OwnerStateSlotProps<Omit<React.ComponentPropsWithRef<'video'>, 'poster' | 'src'>, SProductGalleryOwnerState>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Product media viewer: one stage plus a scrollable thumbnail rail, with both
|
|
112
|
+
* controlled and uncontrolled selection. A sibling of `SGallery` rather than a
|
|
113
|
+
* replacement — `SGallery` stays the masonry/reorder surface.
|
|
114
|
+
*/
|
|
115
|
+
export declare const SProductGallery: React.ForwardRefExoticComponent<Omit<SProductGalleryProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
116
|
+
export default SProductGallery;
|