@solostylist/ui-kit 2.0.6 → 2.0.7

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 (101) hide show
  1. package/dist/components-DWGB2MCO.js +148 -0
  2. package/dist/{gradients-DSnBONEQ.js → gradients-CUC4WH9i.js} +1 -1
  3. package/dist/main.js +1 -1
  4. package/dist/palettes/index.js +1 -1
  5. package/dist/{palettes-CJLuEy1m.js → palettes-B1trNROL.js} +2 -2
  6. package/dist/s-brand-logo/index.js +1 -1
  7. package/dist/s-brand-logo/s-brand-logo.js +1 -1
  8. package/dist/s-chat-message/s-chat-message.js +1 -1
  9. package/dist/s-comment-message/s-comment-message.js +1 -1
  10. package/dist/s-file-dropzone/s-file-dropzone.js +1 -1
  11. package/dist/s-image-viewer/image-viewer-thumbnail-dock.js +1 -1
  12. package/dist/s-product-gallery/index.d.ts +1 -1
  13. package/dist/s-product-gallery/s-product-gallery.d.ts +28 -11
  14. package/dist/s-product-gallery/s-product-gallery.js +302 -246
  15. package/dist/s-review/s-review.js +1 -1
  16. package/dist/s-segmented-control/s-segmented-control.js +3 -3
  17. package/dist/s-stripe/stripe-input.js +1 -1
  18. package/dist/s-theme-demo/theme-demo-color-ramps-section.js +1 -1
  19. package/dist/s-theme-provider/s-theme-provider.js +10 -10
  20. package/dist/theme/component-augmentation.d.ts +1 -1
  21. package/dist/theme/components/accordion-details.d.ts +2 -8
  22. package/dist/theme/components/accordion-summary.d.ts +2 -1036
  23. package/dist/theme/components/accordion.d.ts +2 -43
  24. package/dist/theme/components/alert.d.ts +2 -4160
  25. package/dist/theme/components/app-bar.d.ts +2 -24
  26. package/dist/theme/components/autocomplete.d.ts +2 -78
  27. package/dist/theme/components/avatar.d.ts +2 -19
  28. package/dist/theme/components/backdrop.d.ts +2 -12
  29. package/dist/theme/components/button-base.d.ts +2 -7
  30. package/dist/theme/components/button.d.ts +2 -1117
  31. package/dist/theme/components/card-actions.d.ts +2 -7
  32. package/dist/theme/components/card-content.d.ts +2 -7
  33. package/dist/theme/components/card-header.d.ts +2 -7
  34. package/dist/theme/components/card.d.ts +2 -2046
  35. package/dist/theme/components/card.js +1 -1
  36. package/dist/theme/components/checkbox.d.ts +2 -1038
  37. package/dist/theme/components/checkbox.js +1 -1
  38. package/dist/theme/components/chip.d.ts +2 -2
  39. package/dist/theme/components/components.d.ts +68 -0
  40. package/dist/theme/components/components.js +2 -73
  41. package/dist/theme/components/container.d.ts +2 -5
  42. package/dist/theme/components/css-baseline.d.ts +2 -9
  43. package/dist/theme/components/date-calendar.d.ts +2 -13
  44. package/dist/theme/components/day-calendar.d.ts +2 -25
  45. package/dist/theme/components/dialog-actions.d.ts +2 -12
  46. package/dist/theme/components/dialog-content.d.ts +2 -13
  47. package/dist/theme/components/dialog-title.d.ts +2 -21
  48. package/dist/theme/components/dialog.d.ts +2 -25
  49. package/dist/theme/components/drawer.d.ts +2 -13
  50. package/dist/theme/components/form-control.d.ts +2 -7
  51. package/dist/theme/components/form-label.d.ts +2 -20
  52. package/dist/theme/components/icon-button.d.ts +2 -1100
  53. package/dist/theme/components/icon.d.ts +2 -17
  54. package/dist/theme/components/input-adornment.d.ts +2 -19
  55. package/dist/theme/components/input-base.d.ts +2 -18
  56. package/dist/theme/components/linear-progress.d.ts +2 -1023
  57. package/dist/theme/components/link.d.ts +2 -42
  58. package/dist/theme/components/list-item-button.d.ts +2 -120
  59. package/dist/theme/components/list-item-icon.d.ts +2 -7
  60. package/dist/theme/components/list-item-text.d.ts +2 -22
  61. package/dist/theme/components/list-item.d.ts +2 -129
  62. package/dist/theme/components/list-subheader.d.ts +2 -20
  63. package/dist/theme/components/list.d.ts +2 -10
  64. package/dist/theme/components/menu-item.d.ts +2 -8
  65. package/dist/theme/components/menu.d.ts +2 -20
  66. package/dist/theme/components/month-calendar.d.ts +2 -1088
  67. package/dist/theme/components/multi-section-digital-clock-section.d.ts +2 -2
  68. package/dist/theme/components/outlined-input.d.ts +2 -113
  69. package/dist/theme/components/pagination-item.d.ts +2 -1085
  70. package/dist/theme/components/pagination.d.ts +2 -14
  71. package/dist/theme/components/paper.d.ts +2 -5
  72. package/dist/theme/components/picker-day.d.ts +2 -1055
  73. package/dist/theme/components/pickers-arrow-switcher.d.ts +2 -12
  74. package/dist/theme/components/pickers-calendar-header.d.ts +2 -83
  75. package/dist/theme/components/popover.d.ts +2 -18
  76. package/dist/theme/components/rating.d.ts +2 -19
  77. package/dist/theme/components/select.d.ts +2 -31
  78. package/dist/theme/components/skeleton.d.ts +2 -2
  79. package/dist/theme/components/slider.d.ts +2 -0
  80. package/dist/theme/components/slot.d.ts +7 -0
  81. package/dist/theme/components/slot.js +0 -0
  82. package/dist/theme/components/step-connector.d.ts +2 -12
  83. package/dist/theme/components/step-icon.d.ts +2 -1034
  84. package/dist/theme/components/step-label.d.ts +2 -1025
  85. package/dist/theme/components/svg-icon.d.ts +2 -31
  86. package/dist/theme/components/switch.d.ts +2 -1027
  87. package/dist/theme/components/tab.d.ts +2 -30
  88. package/dist/theme/components/table-cell.d.ts +2 -12
  89. package/dist/theme/components/table-pagination.d.ts +2 -14
  90. package/dist/theme/components/tabs.d.ts +2 -36
  91. package/dist/theme/components/toggle-button-group.d.ts +2 -12
  92. package/dist/theme/components/toggle-button.d.ts +2 -1148
  93. package/dist/theme/components/tooltip.d.ts +2 -3
  94. package/dist/theme/components/year-calendar.d.ts +2 -1090
  95. package/dist/theme/theme-primitives.d.ts +2 -0
  96. package/dist/theme/theme-primitives.js +1 -1
  97. package/dist/{theme-primitives-CRfnMsNy.js → theme-primitives-DXekeATD.js} +29 -26
  98. package/package.json +4 -2
  99. /package/dist/{colors-CNjL5fhq.js → colors-DscJqo7m.js} +0 -0
  100. /package/dist/{s-brand-logo-CErW9Slg.js → s-brand-logo-Gi1MKnv9.js} +0 -0
  101. /package/dist/{utils-CMeAWSRO.js → utils-CXRJYVCd.js} +0 -0
@@ -2,31 +2,42 @@ import { toSxArray as e } from "../utils/sx.js";
2
2
  import { resolveOwnerStateSlotProps as t } from "../utils/slots.js";
3
3
  import { SLazyImage as n } from "../s-lazy-image/s-lazy-image.js";
4
4
  import { SIconButton as r } from "../s-icon-button/s-icon-button.js";
5
- import { SCarousel as i } from "../s-carousel/s-carousel.js";
6
- import * as a from "react";
7
- import { createElement as o } from "react";
8
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
- import { Box as l, ButtonBase as u, CircularProgress as d, styled as f, useTheme as ee, useThemeProps as te } from "@mui/material";
10
- import { mergeSlotProps as p, useControlled as ne, useEventCallback as m, useForkRef as h } from "@mui/material/utils";
5
+ import * as i from "react";
6
+ import { createElement as a } from "react";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ import { Box as c, ButtonBase as l, CircularProgress as u, Typography as d, styled as f, useThemeProps as ee } from "@mui/material";
9
+ import { mergeSlotProps as p, setRef as te, useControlled as ne, useEventCallback as m, useForkRef as h } from "@mui/material/utils";
11
10
  import g from "@mui/utils/appendOwnerState";
11
+ import re from "@mui/icons-material/ImageOutlined";
12
12
  import _ from "@mui/icons-material/PlayArrowRounded";
13
13
  //#region lib/s-product-gallery/s-product-gallery.tsx
14
- var re = f(l, {
14
+ var v = (e) => e === "start" || e === "end", y = (e, t) => `calc(${t ? e.spacing(5.5) : e.spacing(8)} + 4px)`, b = (e, t) => t ? e.spacing(1) : e.spacing(1.5), ie = f(c, {
15
15
  name: "SProductGallery",
16
16
  slot: "Root",
17
17
  shouldForwardProp: (e) => e !== "ownerState"
18
- })({ width: "100%" }), ie = f(l, {
18
+ })(({ ownerState: e, theme: t }) => {
19
+ let n = v(e.thumbnailsPosition), r = e.thumbnailsPosition === "end", i = e.variant === "compact";
20
+ return {
21
+ width: "100%",
22
+ ...n && { [t.breakpoints.up("sm")]: {
23
+ position: "relative",
24
+ [r ? "paddingInlineEnd" : "paddingInlineStart"]: `calc(${y(t, i)} + ${b(t, i)})`
25
+ } }
26
+ };
27
+ }), ae = f(c, {
19
28
  name: "SProductGallery",
20
29
  slot: "Stage",
21
30
  shouldForwardProp: (e) => e !== "ownerState"
22
31
  })(({ ownerState: e, theme: t }) => ({
23
32
  aspectRatio: String(e.aspectRatio),
24
33
  backgroundColor: (t.vars ?? t).palette.background.paper,
25
- borderRadius: t.radius.md,
34
+ borderRadius: e.variant === "compact" ? t.radius.sm : t.radius.md,
35
+ flex: 1,
36
+ minWidth: 0,
26
37
  overflow: "hidden",
27
38
  position: "relative",
28
39
  width: "100%"
29
- })), ae = f(l, {
40
+ })), oe = f(c, {
30
41
  name: "SProductGallery",
31
42
  slot: "Media",
32
43
  shouldForwardProp: (e) => e !== "ownerState"
@@ -40,14 +51,10 @@ var re = f(l, {
40
51
  gridArea: "1 / 1",
41
52
  minWidth: 0
42
53
  }
43
- }), oe = f(n, {
54
+ }), se = f(n, {
44
55
  name: "SProductGallery",
45
56
  slot: "Image",
46
57
  shouldForwardProp: (e) => e !== "ownerState"
47
- })({}), se = f(i, {
48
- name: "SProductGallery",
49
- slot: "Carousel",
50
- shouldForwardProp: (e) => e !== "ownerState"
51
58
  })({}), ce = f("video", {
52
59
  name: "SProductGallery",
53
60
  slot: "Video",
@@ -61,9 +68,10 @@ var re = f(l, {
61
68
  objectFit: "cover",
62
69
  position: "absolute",
63
70
  width: "100%"
64
- }), le = f(l, {
71
+ }), le = f(c, {
65
72
  name: "SProductGallery",
66
- slot: "VideoFrame"
73
+ slot: "VideoFrame",
74
+ shouldForwardProp: (e) => e !== "ownerState"
67
75
  })({
68
76
  height: "100%",
69
77
  minHeight: 0,
@@ -71,7 +79,8 @@ var re = f(l, {
71
79
  width: "100%"
72
80
  }), ue = f(r, {
73
81
  name: "SProductGallery",
74
- slot: "VideoPlayButton"
82
+ slot: "VideoPlayButton",
83
+ shouldForwardProp: (e) => e !== "ownerState"
75
84
  })(({ theme: e }) => {
76
85
  let t = (e.vars ?? e).palette;
77
86
  return {
@@ -88,68 +97,96 @@ var re = f(l, {
88
97
  },
89
98
  "& svg": { fontSize: e.typography.pxToRem(32) }
90
99
  };
91
- }), de = f(l, {
100
+ }), de = f(c, {
92
101
  name: "SProductGallery",
93
102
  slot: "Thumbnails",
94
103
  shouldForwardProp: (e) => e !== "ownerState"
95
- })(({ theme: e }) => ({
96
- marginTop: e.spacing(1),
97
- width: "100%"
98
- })), fe = f(u, {
104
+ })(({ ownerState: e, theme: t }) => {
105
+ let n = v(e.thumbnailsPosition), r = e.thumbnailsPosition === "end", i = e.variant === "compact";
106
+ return {
107
+ display: "flex",
108
+ flexDirection: "row",
109
+ gap: i ? t.spacing(.5) : t.spacing(1),
110
+ marginTop: i ? t.spacing(.75) : t.spacing(1),
111
+ maxWidth: "100%",
112
+ overflowX: "auto",
113
+ overflowY: "hidden",
114
+ padding: "2px",
115
+ scrollbarWidth: "none",
116
+ width: "100%",
117
+ "&::-webkit-scrollbar": { display: "none" },
118
+ ...n && { [t.breakpoints.up("sm")]: {
119
+ flexDirection: "column",
120
+ gap: i ? t.spacing(.5) : t.spacing(.75),
121
+ insetBlock: 0,
122
+ [r ? "insetInlineEnd" : "insetInlineStart"]: 0,
123
+ marginTop: 0,
124
+ maxWidth: "none",
125
+ overflowX: "hidden",
126
+ overflowY: "auto",
127
+ position: "absolute",
128
+ width: y(t, i)
129
+ } }
130
+ };
131
+ }), fe = f(l, {
99
132
  name: "SProductGallery",
100
133
  slot: "Thumbnail",
101
134
  shouldForwardProp: (e) => e !== "ownerState"
102
- })(({ theme: e }) => ({
103
- backgroundColor: (e.vars ?? e).palette.background.paper,
104
- boxSizing: "border-box",
105
- borderRadius: e.radius.md,
106
- display: "block",
107
- height: e.spacing(7),
108
- minHeight: e.spacing(5.5),
109
- minWidth: e.spacing(5.5),
110
- opacity: .72,
111
- overflow: "hidden",
112
- padding: 0,
113
- position: "relative",
114
- transition: e.transitions.create("opacity"),
115
- marginInline: e.spacing(.5),
116
- width: `calc(100% - ${e.spacing(1)})`,
117
- [e.breakpoints.down("sm")]: { height: e.spacing(6.5) },
118
- "&.Mui-focusVisible": {
119
- outline: 0,
120
- boxShadow: `0 0 0 2px ${(e.vars ?? e).palette.primary.main}`,
121
- zIndex: 2
122
- },
123
- "&::after": {
124
- border: "2px solid transparent",
125
- borderRadius: "inherit",
126
- content: "\"\"",
127
- inset: 0,
128
- pointerEvents: "none",
129
- position: "absolute",
130
- transition: e.transitions.create("border-color"),
131
- zIndex: 1
132
- },
133
- "@media (hover: hover) and (pointer: fine)": { "&:hover": { opacity: 1 } },
134
- "@media (prefers-reduced-motion: reduce)": {
135
- transition: "none",
136
- "&::after": { transition: "none" }
137
- },
138
- variants: [{
139
- props: ({ ownerState: e }) => e.selected,
140
- style: {
141
- "&::after": { borderColor: (e.vars ?? e).palette.primary.main },
142
- opacity: 1
143
- }
144
- }]
145
- })), pe = f(l, {
135
+ })(({ ownerState: e, theme: t }) => {
136
+ let n = e.variant === "compact", r = n ? t.spacing(5.5) : t.spacing(8);
137
+ return {
138
+ aspectRatio: "1",
139
+ backgroundColor: (t.vars ?? t).palette.background.paper,
140
+ borderRadius: n ? t.radius.sm : t.radius.md,
141
+ boxSizing: "border-box",
142
+ display: "block",
143
+ flexShrink: 0,
144
+ height: r,
145
+ minHeight: r,
146
+ minWidth: r,
147
+ opacity: t.interaction.mediaIdleOpacity,
148
+ overflow: "hidden",
149
+ padding: 0,
150
+ position: "relative",
151
+ transition: t.transitions.create(["opacity", "box-shadow"]),
152
+ width: r,
153
+ "&.Mui-focusVisible": {
154
+ boxShadow: `0 0 0 2px ${(t.vars ?? t).palette.primary.main}`,
155
+ outline: 0,
156
+ zIndex: 2
157
+ },
158
+ "&::after": {
159
+ border: "2px solid transparent",
160
+ borderRadius: "inherit",
161
+ content: "\"\"",
162
+ inset: 0,
163
+ pointerEvents: "none",
164
+ position: "absolute",
165
+ transition: t.transitions.create("border-color"),
166
+ zIndex: 1
167
+ },
168
+ "@media (hover: hover) and (pointer: fine)": { "&:hover": { opacity: 1 } },
169
+ "@media (prefers-reduced-motion: reduce)": {
170
+ transition: "none",
171
+ "&::after": { transition: "none" }
172
+ },
173
+ variants: [{
174
+ props: ({ ownerState: e }) => e.selected,
175
+ style: {
176
+ "&::after": { borderColor: (t.vars ?? t).palette.primary.main },
177
+ opacity: 1
178
+ }
179
+ }]
180
+ };
181
+ }), pe = f(c, {
146
182
  name: "SProductGallery",
147
- slot: "VideoIndicator"
183
+ slot: "VideoIndicator",
184
+ shouldForwardProp: (e) => e !== "ownerState"
148
185
  })(({ theme: e }) => {
149
186
  let t = (e.vars ?? e).palette;
150
187
  return {
151
188
  alignItems: "center",
152
- backgroundColor: e.alpha(t.common.black, .58),
189
+ backgroundColor: t.blackAlpha.medium,
153
190
  borderRadius: e.radius.full,
154
191
  boxShadow: e.shadows[2],
155
192
  color: t.common.white,
@@ -165,151 +202,182 @@ var re = f(l, {
165
202
  zIndex: 2,
166
203
  "& svg": { fontSize: e.typography.pxToRem(20) }
167
204
  };
168
- }), v = 1, me = 6;
169
- function he(e, t) {
205
+ }), me = f(c, {
206
+ name: "SProductGallery",
207
+ slot: "Empty",
208
+ shouldForwardProp: (e) => e !== "ownerState"
209
+ })(({ theme: e }) => {
210
+ let t = (e.vars ?? e).palette;
211
+ return {
212
+ alignItems: "center",
213
+ color: t.text.secondary,
214
+ display: "flex",
215
+ flexDirection: "column",
216
+ height: "100%",
217
+ inset: 0,
218
+ justifyContent: "center",
219
+ padding: e.spacing(2),
220
+ position: "absolute",
221
+ width: "100%",
222
+ "& svg": {
223
+ color: t.action.disabled,
224
+ fontSize: e.typography.pxToRem(40),
225
+ marginBottom: e.spacing(.5)
226
+ }
227
+ };
228
+ }), x = 1;
229
+ function S(e, t) {
170
230
  return e !== void 0 && Number.isFinite(e) && e > 0 ? e : t;
171
231
  }
172
- function ge(e, t) {
173
- return typeof e == "number" ? he(e, typeof t == "number" ? t : v) : typeof e == "string" && e.trim() ? e : t;
232
+ function he(e, t) {
233
+ return typeof e == "number" ? S(e, typeof t == "number" ? t : x) : typeof e == "string" && e.trim() ? e : t;
174
234
  }
175
- function _e(e) {
235
+ function ge(e) {
176
236
  return e.type === "video" ? e.thumbnailSrc ?? e.poster ?? "" : e.thumbnailSrc ?? e.src;
177
237
  }
178
- function y(e) {
238
+ function C(e) {
179
239
  return e.type === "video" ? e.ariaLabel : e.alt;
180
240
  }
181
- function b(e) {
241
+ function w(e) {
182
242
  return e ? `${e.type ?? "image"}:${e.id}:${e.src}` : "";
183
243
  }
184
- var ve = (e, t, n) => {
185
- let r = y(e);
244
+ var _e = (e, t, n) => {
245
+ let r = C(e);
186
246
  return r ? `Show ${r}, ${t + 1} of ${n}` : `Show ${e.type === "video" ? "video" : "image"} ${t + 1} of ${n}`;
187
247
  };
188
- function ye(e, t, n) {
189
- return `${y(e) || (e.type === "video" ? "Product video" : "Product image")} ${t + 1} of ${n}`;
248
+ function ve(e, t, n) {
249
+ return `${C(e) || (e.type === "video" ? "Product video" : "Product image")} ${t + 1} of ${n}`;
190
250
  }
191
- function be(e, t) {
192
- typeof e == "function" ? e(t) : e && (e.current = t);
193
- }
194
- var x = a.forwardRef(function(r, i) {
195
- let { aspectRatio: l = v, defaultValue: u, getThumbnailAriaLabel: f = ve, items: y, onChange: x, slotProps: S, slots: C, sx: w, thumbnailsLabel: T = "Choose product media", thumbnailsToShow: xe = me, value: E, ...D } = te({
251
+ var T = i.forwardRef(function(r, c) {
252
+ let { aspectRatio: l = x, defaultValue: f, emptyText: v = "No product media", getThumbnailAriaLabel: y = _e, items: b, onChange: S, slotProps: C, slots: T, sx: E, thumbnailsLabel: D = "Choose product media", thumbnailsPosition: ye = "bottom", value: O, variant: be = "standard", ...k } = ee({
196
253
  props: r,
197
254
  name: "SProductGallery"
198
- }), Se = ee(), Ce = ge(l, v), O = Math.max(1, Math.floor(he(xe, me))), we = a.useRef(y[0]?.id ?? ""), Te = a.useRef(u === void 0), [k, A] = ne({
199
- controlled: E,
200
- default: u ?? we.current,
255
+ }), xe = he(l, x), Se = i.useRef(b[0]?.id ?? ""), Ce = i.useRef(f === void 0), [A, j] = ne({
256
+ controlled: O,
257
+ default: f ?? Se.current,
201
258
  name: "SProductGallery",
202
259
  state: "value"
203
- }), j = E !== void 0, M = y.findIndex((e) => e.id === k), Ee = !j && y.length > 0 && M < 0 && (k !== "" || Te.current), N = M >= 0 ? M : Ee ? 0 : -1, P = y[N] ?? null, F = P?.id ?? "", De = b(P), I = P?.type === "video" ? De : "", L = a.useRef(null), R = a.useRef(null), z = a.useRef(!1), [B, V] = a.useState({
260
+ }), M = O !== void 0, N = b.findIndex((e) => e.id === A), we = !M && b.length > 0 && N < 0 && (A !== "" || Ce.current), P = N >= 0 ? N : we ? 0 : -1, F = b[P] ?? null, I = F?.id ?? "", Te = w(F), L = F?.type === "video" ? Te : "", R = i.useRef([]), z = i.useRef(!1), B = i.useRef(null), V = i.useRef(!1), [H, U] = i.useState({
204
261
  mediaKey: "",
205
262
  loading: !1,
206
263
  started: !1
207
- }), H = B.mediaKey === I ? B : null, U = H?.loading ?? !1, W = H?.started ?? !1, G = a.useId(), K = {
208
- ...D,
209
- aspectRatio: Ce,
210
- activeItem: P,
211
- activeIndex: N,
212
- defaultValue: u,
213
- getThumbnailAriaLabel: f,
214
- items: y,
215
- onChange: x,
216
- sx: w,
217
- thumbnailsLabel: T,
218
- thumbnailsToShow: O,
219
- value: F
220
- }, q = t(S?.video, K), Oe = h(R, q?.ref);
221
- a.useEffect(() => {
222
- !j && P && k !== F && A(F);
264
+ }), W = H.mediaKey === L ? H : null, G = W?.loading ?? !1, K = W?.started ?? !1, q = i.useId(), J = {
265
+ ...k,
266
+ aspectRatio: xe,
267
+ activeItem: F,
268
+ activeIndex: P,
269
+ defaultValue: f,
270
+ emptyText: v,
271
+ getThumbnailAriaLabel: y,
272
+ items: b,
273
+ onChange: S,
274
+ sx: E,
275
+ thumbnailsLabel: D,
276
+ thumbnailsPosition: ye,
277
+ value: I,
278
+ variant: be
279
+ }, Y = t(C?.video, J), Ee = h(B, Y?.ref);
280
+ i.useEffect(() => {
281
+ !M && F && A !== I && j(I);
223
282
  }, [
224
- P,
225
283
  F,
284
+ I,
285
+ M,
226
286
  j,
227
- A,
228
- k
229
- ]), a.useEffect(() => {
230
- N >= 0 && L.current?.scrollTo(N);
231
- }, [N]), a.useEffect(() => {
232
- z.current = !1;
233
- }, [I]);
234
- let ke = m((e, t) => {
235
- let n = y[t];
236
- !n || n.id === P?.id || (A(n.id), x?.(e, n.id));
237
- }), Ae = m(() => {
238
- let e = R.current;
239
- if (!e || P?.type !== "video") return;
240
- let t = b(P);
241
- z.current = !0, V({
287
+ A
288
+ ]), i.useEffect(() => {
289
+ if (P < 0) return;
290
+ if (!z.current) {
291
+ z.current = !0;
292
+ return;
293
+ }
294
+ let e = typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
295
+ R.current[P]?.scrollIntoView?.({
296
+ block: "nearest",
297
+ inline: "nearest",
298
+ behavior: e ? "auto" : "smooth"
299
+ });
300
+ }, [P]), i.useEffect(() => {
301
+ V.current = !1, U({
302
+ mediaKey: "",
303
+ loading: !1,
304
+ started: !1
305
+ });
306
+ }, [L]);
307
+ let De = m((e, t) => {
308
+ let n = b[t];
309
+ !n || n.id === F?.id || (j(n.id), S?.(e, n.id));
310
+ }), Oe = m(() => {
311
+ let e = B.current;
312
+ if (!e || F?.type !== "video") return;
313
+ let t = w(F);
314
+ V.current = !0, U({
242
315
  mediaKey: t,
243
316
  loading: !0,
244
317
  started: !1
245
318
  }), e.play().catch(() => {
246
- z.current = !1, V((n) => R.current === e && n.mediaKey === t ? {
319
+ V.current = !1, U((n) => B.current === e && n.mediaKey === t ? {
247
320
  ...n,
248
321
  loading: !1,
249
322
  started: !1
250
323
  } : n);
251
324
  });
252
- }), je = C?.root ?? re, Me = C?.stage ?? ie, Ne = C?.media ?? ae, Pe = C?.image ?? oe, Fe = C?.video ?? ce, J = C?.thumbnails ?? de, Ie = C?.carousel ?? se, Le = C?.thumbnail ?? fe, { ref: Re, sx: ze, ...Y } = g(je, p(t(S?.root, K), D), K), Be = h(Re, i), X = g(Me, t(S?.stage, K) ?? {}, K), Ve = g(Ne, t(S?.media, K) ?? {}, K), Z = g(J, t(S?.thumbnails, K) ?? {}, K), He = t(S?.carousel, K), Q = Math.min(y.length, O), $ = He?.slotProps, Ue = g(Ie, p(He, {
253
- arrows: y.length > Q,
254
- slotProps: {
255
- ...$,
256
- viewport: {
257
- ...$?.viewport,
258
- sx: [{ py: .5 }, ...e($?.viewport?.sx)]
259
- }
260
- }
261
- }), K), We = () => {
262
- if (!P) return null;
263
- if (P.type === "video") {
264
- let e = b(P), t = (e) => e.currentTarget === R.current, { children: n, controls: r = !0, ...i } = g(Fe, p(q, {
325
+ }), ke = T?.root ?? ie, Ae = T?.stage ?? ae, je = T?.media ?? oe, Me = T?.image ?? se, Ne = T?.video ?? ce, X = T?.videoFrame ?? le, Pe = T?.videoPlayButton ?? ue, Fe = T?.videoIndicator ?? pe, Ie = T?.thumbnails ?? de, Le = T?.thumbnail ?? fe, Re = T?.empty ?? me, { ref: ze, sx: Be, ...Z } = g(ke, p(t(C?.root, J), k), J), Ve = h(ze, c), Q = g(Ae, t(C?.stage, J) ?? {}, J), He = g(je, t(C?.media, J) ?? {}, J), $ = g(Ie, t(C?.thumbnails, J) ?? {}, J), Ue = g(Re, t(C?.empty, J) ?? {}, J), We = t(C?.videoFrame, J), Ge = t(C?.videoPlayButton, J), Ke = t(C?.videoIndicator, J), qe = () => {
326
+ if (!F) return /* @__PURE__ */ s(Re, {
327
+ ...Ue,
328
+ children: [/* @__PURE__ */ o(re, {}), /* @__PURE__ */ o(d, {
329
+ variant: "body2",
330
+ children: v
331
+ })]
332
+ });
333
+ if (F.type === "video") {
334
+ let e = w(F), t = (e) => e.currentTarget === B.current, { children: n, controls: r = !0, ...i } = g(Ne, p(Y, {
265
335
  controls: !0,
266
336
  onCanPlay: (n) => {
267
- t(n) && V((t) => t.mediaKey === e && t.started ? {
337
+ t(n) && U((t) => t.mediaKey === e && t.started ? {
268
338
  ...t,
269
339
  loading: !1
270
340
  } : t);
271
341
  },
272
342
  onEnded: (n) => {
273
- t(n) && (z.current = !1, V({
274
- mediaKey: e,
275
- loading: !1,
276
- started: !1
277
- }));
343
+ t(n) && (V.current = !1, U((t) => t.mediaKey === e ? {
344
+ ...t,
345
+ loading: !1
346
+ } : t));
278
347
  },
279
348
  onError: (n) => {
280
- t(n) && (z.current = !1, V({
349
+ t(n) && (V.current = !1, U({
281
350
  mediaKey: e,
282
351
  loading: !1,
283
352
  started: !1
284
353
  }));
285
354
  },
286
355
  onPause: (n) => {
287
- t(n) && (z.current = !1, V({
288
- mediaKey: e,
289
- loading: !1,
290
- started: !1
291
- }));
356
+ t(n) && (V.current = !1, U((t) => t.mediaKey === e ? {
357
+ ...t,
358
+ loading: !1
359
+ } : t));
292
360
  },
293
361
  onPlay: (n) => {
294
- t(n) && V({
362
+ t(n) && U((t) => ({
295
363
  mediaKey: e,
296
364
  loading: !0,
297
- started: !1
298
- });
365
+ started: t.mediaKey === e ? t.started : !1
366
+ }));
299
367
  },
300
368
  onPlaying: (n) => {
301
369
  if (!t(n)) return;
302
- let r = n.currentTarget, i = z.current;
303
- z.current = !1, V({
370
+ let r = n.currentTarget, i = V.current;
371
+ V.current = !1, U({
304
372
  mediaKey: e,
305
373
  loading: !1,
306
374
  started: !0
307
375
  }), i && requestAnimationFrame(() => {
308
- R.current === r && r.focus({ preventScroll: !0 });
376
+ B.current === r && r.focus({ preventScroll: !0 });
309
377
  });
310
378
  },
311
379
  onWaiting: (n) => {
312
- t(n) && V((t) => ({
380
+ t(n) && U((t) => ({
313
381
  mediaKey: e,
314
382
  loading: !0,
315
383
  started: t.mediaKey === e && t.started
@@ -317,111 +385,99 @@ var x = a.forwardRef(function(r, i) {
317
385
  },
318
386
  playsInline: !0,
319
387
  preload: "metadata"
320
- }), K);
321
- return /* @__PURE__ */ c(le, {
322
- "aria-busy": U || void 0,
323
- children: [/* @__PURE__ */ s(Fe, {
388
+ }), J), a = g(X, p(We, { "aria-busy": G || void 0 }), J), c = g(Pe, p(Ge, {
389
+ "aria-busy": G || void 0,
390
+ "aria-label": G ? `Loading ${F.ariaLabel}` : `Play ${F.ariaLabel}`,
391
+ disabled: G,
392
+ onClick: Oe,
393
+ variant: "overlay"
394
+ }), J);
395
+ return /* @__PURE__ */ s(X, {
396
+ ...a,
397
+ children: [/* @__PURE__ */ o(Ne, {
324
398
  ...i,
325
- "aria-label": P.ariaLabel,
326
- controls: r && W,
327
- poster: P.poster,
328
- ref: Oe,
329
- src: P.src,
399
+ "aria-label": F.ariaLabel,
400
+ controls: r && K,
401
+ poster: F.poster,
402
+ ref: Ee,
403
+ src: F.src,
330
404
  children: n
331
- }), !W || U ? /* @__PURE__ */ s(ue, {
332
- "aria-busy": U || void 0,
333
- "aria-label": U ? `Loading ${P.ariaLabel}` : `Play ${P.ariaLabel}`,
334
- disabled: U,
335
- onClick: Ae,
336
- variant: "overlay",
337
- children: U ? /* @__PURE__ */ s(d, {
338
- "aria-label": `Loading ${P.ariaLabel}`,
405
+ }), K ? null : /* @__PURE__ */ o(Pe, {
406
+ ...c,
407
+ children: G ? /* @__PURE__ */ o(u, {
408
+ "aria-label": `Loading ${F.ariaLabel}`,
339
409
  color: "inherit",
340
- size: 28
341
- }) : /* @__PURE__ */ s(_, {})
342
- }) : null]
343
- }, `${P.type}:${P.id}:${P.src}`);
410
+ size: 32
411
+ }) : /* @__PURE__ */ o(_, {})
412
+ })]
413
+ }, e);
344
414
  }
345
- let { slotProps: e, ...n } = p(t(S?.image, K), { variant: "rectangular" }), r = g(Pe, n, K), i = {
415
+ let { slotProps: e, ...n } = p(t(C?.image, J), { variant: "rectangular" }), r = g(Me, n, J), i = {
346
416
  ...e,
347
417
  image: p(e?.image, { sx: { objectFit: "cover" } })
348
418
  };
349
- return /* @__PURE__ */ o(Pe, {
419
+ return /* @__PURE__ */ a(Me, {
350
420
  ...r,
351
- alt: P.alt,
352
- key: `${P.type ?? "image"}:${P.id}:${P.src}`,
421
+ alt: F.alt,
422
+ key: `${F.type ?? "image"}:${F.id}:${F.src}`,
353
423
  slotProps: i,
354
- src: P.src
424
+ src: F.src
355
425
  });
426
+ }, Je = (e, r) => {
427
+ let i = r === P, a = {
428
+ ...J,
429
+ index: r,
430
+ item: e,
431
+ selected: i
432
+ }, c = t(C?.thumbnail, a), { ref: l, ...u } = g(Le, c ?? {}, a), d = `${q}-thumbnail-${r}`, f = g(Fe, p(Ke, { "aria-hidden": !0 }), J);
433
+ return /* @__PURE__ */ s(Le, {
434
+ "aria-controls": q,
435
+ "aria-label": y(e, r, b.length),
436
+ "aria-pressed": i,
437
+ id: d,
438
+ ...u,
439
+ onClick: (e) => {
440
+ c?.onClick?.(e), e.defaultPrevented || De(e, r);
441
+ },
442
+ ref: (e) => {
443
+ R.current[r] = e, te(l, e);
444
+ },
445
+ children: [/* @__PURE__ */ o(n, {
446
+ alt: "",
447
+ src: ge(e),
448
+ variant: "rectangular",
449
+ slotProps: { image: { sx: { objectFit: "cover" } } }
450
+ }), e.type === "video" ? /* @__PURE__ */ o(Fe, {
451
+ ...f,
452
+ children: /* @__PURE__ */ o(_, {})
453
+ }) : null]
454
+ }, e.id);
356
455
  };
357
- return /* @__PURE__ */ c(je, {
358
- ...Y,
359
- "aria-label": Y["aria-label"] ?? "Product media gallery",
360
- "aria-roledescription": Y["aria-roledescription"] ?? "carousel",
361
- ref: Be,
362
- role: Y.role ?? "group",
363
- sx: [...e(ze), ...e(w)],
364
- children: [/* @__PURE__ */ s(Me, {
365
- ...X,
366
- "aria-hidden": X["aria-hidden"] ?? !P,
367
- "aria-label": X["aria-label"] ?? (P ? ye(P, N, y.length) : void 0),
368
- "aria-roledescription": X["aria-roledescription"] ?? (P ? "slide" : void 0),
369
- id: G,
370
- role: X.role ?? (P ? "group" : void 0),
371
- children: /* @__PURE__ */ s(Ne, {
372
- ...Ve,
373
- children: We()
374
- })
375
- }), y.length > 1 ? /* @__PURE__ */ s(J, {
376
- ...Z,
377
- "aria-label": Z["aria-label"] ?? T,
378
- role: Z.role ?? "group",
379
- children: /* @__PURE__ */ s(Ie, {
380
- ...Ue,
381
- apiRef: L,
382
- autoplay: !1,
383
- centerMode: !1,
384
- infinite: !1,
385
- responsive: [{
386
- breakpoint: Se.breakpoints.values.sm,
387
- settings: { slidesToShow: Math.max(Math.ceil(Q / 2), 1) }
388
- }],
389
- slidesToShow: Q,
390
- spaceBetween: 0,
391
- children: y.map((e, r) => {
392
- let i = r === N, a = {
393
- ...K,
394
- index: r,
395
- item: e,
396
- selected: i
397
- }, o = t(S?.thumbnail, a), { ref: l, ...u } = g(Le, o ?? {}, a), d = `${G}-thumbnail-${r}`;
398
- return /* @__PURE__ */ c(Le, {
399
- ...u,
400
- "aria-controls": G,
401
- "aria-label": f(e, r, y.length),
402
- "aria-pressed": i,
403
- id: d,
404
- onClick: (e) => {
405
- o?.onClick?.(e), e.defaultPrevented || ke(e, r);
406
- },
407
- ref: (e) => {
408
- be(l, e);
409
- },
410
- children: [/* @__PURE__ */ s(n, {
411
- alt: "",
412
- src: _e(e),
413
- variant: "rectangular",
414
- slotProps: { image: { sx: { objectFit: "cover" } } }
415
- }), e.type === "video" ? /* @__PURE__ */ s(pe, {
416
- "aria-hidden": !0,
417
- children: /* @__PURE__ */ s(_, {})
418
- }) : null]
419
- }, e.id);
420
- })
456
+ return /* @__PURE__ */ s(ke, {
457
+ ...Z,
458
+ "aria-label": Z["aria-label"] ?? "Product media gallery",
459
+ "aria-roledescription": Z["aria-roledescription"] ?? "carousel",
460
+ ref: Ve,
461
+ role: Z.role ?? "group",
462
+ sx: [...e(Be), ...e(E)],
463
+ children: [/* @__PURE__ */ o(Ae, {
464
+ ...Q,
465
+ "aria-label": Q["aria-label"] ?? (F ? ve(F, P, b.length) : void 0),
466
+ "aria-roledescription": Q["aria-roledescription"] ?? (F ? "slide" : void 0),
467
+ id: q,
468
+ role: Q.role ?? (F ? "group" : void 0),
469
+ children: /* @__PURE__ */ o(je, {
470
+ ...He,
471
+ children: qe()
421
472
  })
473
+ }), b.length > 1 ? /* @__PURE__ */ o(Ie, {
474
+ ...$,
475
+ "aria-label": $["aria-label"] ?? D,
476
+ role: $.role ?? "group",
477
+ children: b.map((e, t) => Je(e, t))
422
478
  }) : null]
423
479
  });
424
480
  });
425
- x.displayName = "SProductGallery";
481
+ T.displayName = "SProductGallery";
426
482
  //#endregion
427
- export { x as SProductGallery, x as default };
483
+ export { T as SProductGallery, T as default };