@solostylist/ui-kit 1.0.185 → 1.0.186

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.
@@ -3,7 +3,8 @@ import { SxProps, Theme } from '@mui/material/styles';
3
3
  export interface SLanguageOption {
4
4
  code: string;
5
5
  label: string;
6
- icon: string;
6
+ /** ISO 3166-1 alpha-2 country code for the flag (e.g., 'US', 'GB', 'VN') */
7
+ countryCode: string;
7
8
  }
8
9
  export declare const defaultLanguageOptions: SLanguageOption[];
9
10
  export interface SLanguagePopoverProps {
@@ -1,39 +1,38 @@
1
- import { j as n } from "../jsx-runtime-tc70JA_2.js";
2
- import * as I from "react";
3
- import x from "react";
4
- import { useTranslation as b } from "react-i18next";
5
- import { usePopover as O } from "../hooks/use-popover.js";
6
- import { SIconButton as w } from "../s-icon-button/s-icon-button.js";
7
- import v from "../s-lazy-image/s-lazy-image.js";
8
- import { L as C, M as R } from "../Menu-_ZW9WiF2.js";
9
- import { g as T, M as k } from "../MenuItem-DTapLhin.js";
10
- import { P as s } from "../createTheme-CIXJrNxb.js";
11
- import { c as M } from "../clsx-OuTLNxxd.js";
12
- import { u as N, c as P, m as E } from "../DefaultPropsProvider-2MEHB2yv.js";
13
- import { s as _ } from "../styled-BR6UL29H.js";
14
- import { T as z } from "../Typography-Cum5_Ehu.js";
15
- const D = (t) => {
1
+ import { j as c } from "../jsx-runtime-tc70JA_2.js";
2
+ import * as y from "react";
3
+ import x, { createElement as C } from "react";
4
+ import { useTranslation as L } from "react-i18next";
5
+ import { usePopover as w } from "../hooks/use-popover.js";
6
+ import { SIconButton as R } from "../s-icon-button/s-icon-button.js";
7
+ import { L as T, M as U } from "../Menu-_ZW9WiF2.js";
8
+ import { g as F, M as E } from "../MenuItem-DTapLhin.js";
9
+ import { P as a } from "../createTheme-CIXJrNxb.js";
10
+ import { c as N } from "../clsx-OuTLNxxd.js";
11
+ import { u as P, c as _, m as k } from "../DefaultPropsProvider-2MEHB2yv.js";
12
+ import { s as D } from "../styled-BR6UL29H.js";
13
+ import { T as M } from "../Typography-Cum5_Ehu.js";
14
+ const A = (e) => {
16
15
  const {
17
- alignItems: e,
18
- classes: r
19
- } = t;
20
- return P({
21
- root: ["root", e === "flex-start" && "alignItemsFlexStart"]
22
- }, T, r);
23
- }, F = _("div", {
16
+ alignItems: t,
17
+ classes: o
18
+ } = e;
19
+ return _({
20
+ root: ["root", t === "flex-start" && "alignItemsFlexStart"]
21
+ }, F, o);
22
+ }, V = D("div", {
24
23
  name: "MuiListItemIcon",
25
24
  slot: "Root",
26
- overridesResolver: (t, e) => {
25
+ overridesResolver: (e, t) => {
27
26
  const {
28
- ownerState: r
29
- } = t;
30
- return [e.root, r.alignItems === "flex-start" && e.alignItemsFlexStart];
27
+ ownerState: o
28
+ } = e;
29
+ return [t.root, o.alignItems === "flex-start" && t.alignItemsFlexStart];
31
30
  }
32
- })(E(({
33
- theme: t
31
+ })(k(({
32
+ theme: e
34
33
  }) => ({
35
34
  minWidth: 56,
36
- color: (t.vars || t).palette.action.active,
35
+ color: (e.vars || e).palette.action.active,
37
36
  flexShrink: 0,
38
37
  display: "inline-flex",
39
38
  variants: [{
@@ -44,22 +43,22 @@ const D = (t) => {
44
43
  marginTop: 8
45
44
  }
46
45
  }]
47
- }))), j = /* @__PURE__ */ I.forwardRef(function(e, r) {
48
- const a = N({
49
- props: e,
46
+ }))), j = /* @__PURE__ */ y.forwardRef(function(t, o) {
47
+ const n = P({
48
+ props: t,
50
49
  name: "MuiListItemIcon"
51
50
  }), {
52
- className: c,
53
- ...p
54
- } = a, m = I.useContext(C), i = {
55
- ...a,
56
- alignItems: m.alignItems
57
- }, f = D(i);
58
- return /* @__PURE__ */ n.jsx(F, {
59
- className: M(f.root, c),
60
- ownerState: i,
61
- ref: r,
62
- ...p
51
+ className: r,
52
+ ...i
53
+ } = n, p = y.useContext(T), l = {
54
+ ...n,
55
+ alignItems: p.alignItems
56
+ }, m = A(l);
57
+ return /* @__PURE__ */ c.jsx(V, {
58
+ className: N(m.root, r),
59
+ ownerState: l,
60
+ ref: o,
61
+ ...i
63
62
  });
64
63
  });
65
64
  process.env.NODE_ENV !== "production" && (j.propTypes = {
@@ -71,126 +70,181 @@ process.env.NODE_ENV !== "production" && (j.propTypes = {
71
70
  * The content of the component, normally `Icon`, `SvgIcon`,
72
71
  * or a `@mui/icons-material` SVG icon element.
73
72
  */
74
- children: s.node,
73
+ children: a.node,
75
74
  /**
76
75
  * Override or extend the styles applied to the component.
77
76
  */
78
- classes: s.object,
77
+ classes: a.object,
79
78
  /**
80
79
  * @ignore
81
80
  */
82
- className: s.string,
81
+ className: a.string,
83
82
  /**
84
83
  * The system prop that allows defining system overrides as well as additional CSS styles.
85
84
  */
86
- sx: s.oneOfType([s.arrayOf(s.oneOfType([s.func, s.object, s.bool])), s.func, s.object])
85
+ sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object])
87
86
  });
88
- const y = [
89
- { code: "en", label: "English", icon: "/assets/flag-uk.svg" },
90
- { code: "vi", label: "Vietnamese", icon: "/assets/flag-vi.svg" }
91
- ], U = ({
92
- anchorEl: t,
93
- onClose: e,
94
- open: r = !1,
95
- onLanguageChange: a,
96
- languages: c = y,
97
- currentLanguage: p,
98
- menuWidth: m = "220px",
99
- flagSize: i = 28
87
+ function v() {
88
+ return v = Object.assign ? Object.assign.bind() : function(e) {
89
+ for (var t = 1; t < arguments.length; t++) {
90
+ var o = arguments[t];
91
+ for (var n in o)
92
+ Object.prototype.hasOwnProperty.call(o, n) && (e[n] = o[n]);
93
+ }
94
+ return e;
95
+ }, v.apply(this, arguments);
96
+ }
97
+ function $(e, t) {
98
+ if (e == null) return {};
99
+ var o = {}, n = Object.keys(e), r, i;
100
+ for (i = 0; i < n.length; i++)
101
+ r = n[i], !(t.indexOf(r) >= 0) && (o[r] = e[r]);
102
+ return o;
103
+ }
104
+ var z = ["cdnSuffix", "cdnUrl", "countryCode", "style", "svg"], B = "https://cdn.jsdelivr.net/gh/lipis/flag-icons/flags/4x3/", W = "svg", G = 127397, b = function(t) {
105
+ var o = t.cdnSuffix, n = o === void 0 ? W : o, r = t.cdnUrl, i = r === void 0 ? B : r, p = t.countryCode, l = t.style, m = t.svg, s = m === void 0 ? !1 : m, d = $(t, z);
106
+ if (typeof p != "string")
107
+ return null;
108
+ if (s) {
109
+ var u = "" + i + p.toLowerCase() + "." + n;
110
+ return C("img", Object.assign({}, d, {
111
+ src: u,
112
+ style: v({
113
+ display: "inline-block",
114
+ width: "1em",
115
+ height: "1em",
116
+ verticalAlign: "middle"
117
+ }, l)
118
+ }));
119
+ }
120
+ var f = p.toUpperCase().replace(/./g, function(g) {
121
+ return String.fromCodePoint(g.charCodeAt(0) + G);
122
+ });
123
+ return C("span", Object.assign({
124
+ role: "img"
125
+ }, d, {
126
+ style: v({
127
+ display: "inline-block",
128
+ fontSize: "1em",
129
+ lineHeight: "1em",
130
+ verticalAlign: "middle"
131
+ }, l)
132
+ }), f);
133
+ };
134
+ const I = [
135
+ { code: "en", label: "English", countryCode: "GB" },
136
+ { code: "vi", label: "Vietnamese", countryCode: "VN" }
137
+ ], H = ({
138
+ anchorEl: e,
139
+ onClose: t,
140
+ open: o = !1,
141
+ onLanguageChange: n,
142
+ languages: r = I,
143
+ currentLanguage: i,
144
+ menuWidth: p = "220px",
145
+ flagSize: l = 28
100
146
  }) => {
101
- const f = x.useCallback(
102
- (o) => {
103
- a?.(o), e?.();
147
+ const m = x.useCallback(
148
+ (s) => {
149
+ n?.(s), t?.();
104
150
  },
105
- [a, e]
151
+ [n, t]
106
152
  );
107
- return /* @__PURE__ */ n.jsx(
108
- R,
153
+ return /* @__PURE__ */ c.jsx(
154
+ U,
109
155
  {
110
- anchorEl: t,
156
+ anchorEl: e,
111
157
  anchorOrigin: { horizontal: "right", vertical: "bottom" },
112
- onClose: e,
113
- open: r,
114
- slotProps: { paper: { sx: { width: m } } },
158
+ onClose: t,
159
+ open: o,
160
+ slotProps: { paper: { sx: { width: p } } },
115
161
  transformOrigin: { horizontal: "right", vertical: "top" },
116
- children: c.map((o) => {
117
- const l = p === o.code;
118
- return /* @__PURE__ */ n.jsxs(
119
- k,
162
+ children: r.map((s) => {
163
+ const d = i === s.code;
164
+ return /* @__PURE__ */ c.jsxs(
165
+ E,
120
166
  {
121
167
  onClick: () => {
122
- f(o.code);
168
+ m(s.code);
123
169
  },
124
- selected: l,
170
+ selected: d,
125
171
  sx: { gap: 1 },
126
172
  children: [
127
- /* @__PURE__ */ n.jsx(j, { children: /* @__PURE__ */ n.jsx(v, { alt: o.label, src: o.icon, height: i, width: i }) }),
128
- /* @__PURE__ */ n.jsx(z, { variant: "subtitle2", children: o.label })
173
+ /* @__PURE__ */ c.jsx(j, { children: /* @__PURE__ */ c.jsx(
174
+ b,
175
+ {
176
+ countryCode: s.countryCode,
177
+ svg: !0,
178
+ style: { width: l, height: l },
179
+ title: s.label
180
+ }
181
+ ) }),
182
+ /* @__PURE__ */ c.jsx(M, { variant: "subtitle2", children: s.label })
129
183
  ]
130
184
  },
131
- o.code
185
+ s.code
132
186
  );
133
187
  })
134
188
  }
135
189
  );
136
- }, V = ({
137
- languages: t = y,
138
- onLanguageChange: e,
139
- currentLanguage: r,
140
- tooltipText: a,
141
- buttonFlagSize: c = 24,
142
- menuFlagSize: p = 28,
143
- menuWidth: m = "220px",
144
- sx: i,
145
- useI18n: f = !0
190
+ }, K = ({
191
+ languages: e = I,
192
+ onLanguageChange: t,
193
+ currentLanguage: o,
194
+ tooltipText: n,
195
+ buttonFlagSize: r = 24,
196
+ menuFlagSize: i = 28,
197
+ menuWidth: p = "220px",
198
+ sx: l,
199
+ useI18n: m = !0
146
200
  }) => {
147
- const { t: o, i18n: l } = f ? b() : { t: null, i18n: null }, d = O(), u = r || (l?.language ?? t[0]?.code ?? "en"), g = t.find((h) => h.code === u) || t[0], L = x.useCallback(
201
+ const { t: s, i18n: d } = m ? L() : { t: null, i18n: null }, u = w(), f = o || (d?.language ?? e[0]?.code ?? "en"), g = e.find((h) => h.code === f) || e[0], S = x.useCallback(
148
202
  (h) => {
149
- e ? e(h) : l && l.changeLanguage(h);
203
+ t ? t(h) : d && d.changeLanguage(h);
150
204
  },
151
- [e, l]
152
- ), S = a || (o ? o("header:language.tooltip") : "Change language");
153
- return /* @__PURE__ */ n.jsxs(x.Fragment, { children: [
154
- /* @__PURE__ */ n.jsx(
155
- w,
205
+ [t, d]
206
+ ), O = n || (s ? s("header:language.tooltip") : "Change language");
207
+ return /* @__PURE__ */ c.jsxs(x.Fragment, { children: [
208
+ /* @__PURE__ */ c.jsx(
209
+ R,
156
210
  {
157
- onClick: d.handleOpen,
158
- ref: d.anchorRef,
159
- sx: { display: { xs: "none", lg: "inline-flex" }, ...i },
211
+ onClick: u.handleOpen,
212
+ ref: u.anchorRef,
213
+ sx: { display: { xs: "none", lg: "inline-flex" }, ...l },
160
214
  tooltipOptions: {
161
- title: S,
215
+ title: O,
162
216
  placement: "top"
163
217
  },
164
- children: /* @__PURE__ */ n.jsx(
165
- v,
218
+ children: /* @__PURE__ */ c.jsx(
219
+ b,
166
220
  {
167
- alt: g?.label || u,
168
- src: g?.icon || "",
169
- height: c,
170
- width: c
221
+ countryCode: g?.countryCode || "US",
222
+ svg: !0,
223
+ style: { width: r, height: r },
224
+ title: g?.label || f
171
225
  }
172
226
  )
173
227
  }
174
228
  ),
175
- /* @__PURE__ */ n.jsx(
176
- U,
229
+ /* @__PURE__ */ c.jsx(
230
+ H,
177
231
  {
178
- anchorEl: d.anchorRef.current,
179
- onClose: d.handleClose,
180
- open: d.open,
181
- onLanguageChange: L,
182
- languages: t,
183
- currentLanguage: u,
184
- menuWidth: m,
185
- flagSize: p
232
+ anchorEl: u.anchorRef.current,
233
+ onClose: u.handleClose,
234
+ open: u.open,
235
+ onLanguageChange: S,
236
+ languages: e,
237
+ currentLanguage: f,
238
+ menuWidth: p,
239
+ flagSize: i
186
240
  }
187
241
  )
188
242
  ] });
189
243
  };
190
- V.displayName = "SLanguageSwitcher";
244
+ K.displayName = "SLanguageSwitcher";
191
245
  export {
192
- U as SLanguagePopover,
193
- V as SLanguageSwitcher,
194
- V as default,
195
- y as defaultLanguageOptions
246
+ H as SLanguagePopover,
247
+ K as SLanguageSwitcher,
248
+ K as default,
249
+ I as defaultLanguageOptions
196
250
  };
@@ -11,6 +11,9 @@ export declare const MuiIconButton: {
11
11
  theme: Theme;
12
12
  }) => {
13
13
  transition: "all 0.2s ease-in-out";
14
+ flexShrink: number;
15
+ width: string;
16
+ color: "inherit";
14
17
  variants: ({
15
18
  props: {
16
19
  size: "small";
@@ -1,13 +1,13 @@
1
- import { alpha as l } from "@mui/material";
2
- import { brand as t, lightBrand as i, purple as n, lightPurple as p, green as a, lightGreen as c, red as y, lightRed as u, blue as g, lightBlue as d, orange as f, lightOrange as m } from "../theme-primitives.js";
1
+ import { alpha as t } from "@mui/material";
2
+ import { brand as l, lightBrand as i, purple as n, lightPurple as p, green as c, lightGreen as a, red as y, lightRed as u, blue as g, lightBlue as d, orange as f, lightOrange as m } from "../theme-primitives.js";
3
3
  const r = (o, e, s) => ({
4
4
  color: e[500],
5
5
  "&:hover": {
6
- backgroundColor: l(e[500], 0.12),
6
+ backgroundColor: t(e[500], 0.12),
7
7
  color: e[600]
8
8
  },
9
9
  "&:active": {
10
- backgroundColor: l(e[500], 0.2)
10
+ backgroundColor: t(e[500], 0.2)
11
11
  },
12
12
  "&.Mui-disabled": {
13
13
  color: e[300],
@@ -16,22 +16,25 @@ const r = (o, e, s) => ({
16
16
  ...o.applyStyles("dark", {
17
17
  color: s[400],
18
18
  "&:hover": {
19
- backgroundColor: l(s[400], 0.12),
19
+ backgroundColor: t(s[400], 0.12),
20
20
  color: s[300]
21
21
  },
22
22
  "&:active": {
23
- backgroundColor: l(s[400], 0.2)
23
+ backgroundColor: t(s[400], 0.2)
24
24
  },
25
25
  "&.Mui-disabled": {
26
26
  color: s[700],
27
27
  opacity: 0.5
28
28
  }
29
29
  })
30
- }), b = {
30
+ }), S = {
31
31
  styleOverrides: {
32
32
  root: ({ theme: o }) => ({
33
33
  // borderRadius: (theme.vars || theme).shape.borderRadius,
34
34
  transition: "all 0.2s ease-in-out",
35
+ flexShrink: 0,
36
+ width: "fit-content",
37
+ color: "inherit",
35
38
  variants: [
36
39
  {
37
40
  props: {
@@ -77,7 +80,7 @@ const r = (o, e, s) => ({
77
80
  color: "primary"
78
81
  },
79
82
  style: {
80
- ...r(o, i, t)
83
+ ...r(o, i, l)
81
84
  }
82
85
  },
83
86
  {
@@ -93,7 +96,7 @@ const r = (o, e, s) => ({
93
96
  color: "success"
94
97
  },
95
98
  style: {
96
- ...r(o, c, a)
99
+ ...r(o, a, c)
97
100
  }
98
101
  },
99
102
  {
@@ -125,5 +128,5 @@ const r = (o, e, s) => ({
125
128
  }
126
129
  };
127
130
  export {
128
- b as MuiIconButton
131
+ S as MuiIconButton
129
132
  };
@@ -121,6 +121,7 @@ export declare const colorSchemes: {
121
121
  secondary: string;
122
122
  };
123
123
  action: {
124
+ active: string;
124
125
  hover: string;
125
126
  selected: string;
126
127
  };
@@ -190,6 +191,7 @@ export declare const colorSchemes: {
190
191
  secondary: string;
191
192
  };
192
193
  action: {
194
+ active: string;
193
195
  hover: string;
194
196
  selected: string;
195
197
  };
@@ -256,6 +256,7 @@ const r = {
256
256
  secondary: t[400]
257
257
  },
258
258
  action: {
259
+ active: t[50],
259
260
  hover: e(t[600], 0.2),
260
261
  selected: e(t[600], 0.3)
261
262
  },
@@ -324,6 +325,7 @@ const r = {
324
325
  secondary: a[600]
325
326
  },
326
327
  action: {
328
+ active: a[900],
327
329
  hover: e(a[300], 0.2),
328
330
  selected: e(a[300], 0.3)
329
331
  },
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org"
5
5
  },
6
- "version": "1.0.185",
6
+ "version": "1.0.186",
7
7
  "description": "advanced ui kit for solostylist",
8
8
  "type": "module",
9
9
  "main": "dist/main.js",
@@ -146,6 +146,7 @@
146
146
  "i18next-http-backend": "^3.0.2",
147
147
  "overlayscrollbars-react": "^0.5.6",
148
148
  "react": "^19.2.3",
149
+ "react-country-flag": "^3.1.0",
149
150
  "react-dom": "^19.2.3",
150
151
  "react-dropzone": "^14.3.8",
151
152
  "react-i18next": "^16.5.3",
@@ -203,6 +204,7 @@
203
204
  "overlayscrollbars-react": "^0.5.6",
204
205
  "prettier": "^3.8.1",
205
206
  "react": "^19.2.3",
207
+ "react-country-flag": "^3.1.0",
206
208
  "react-dom": "^19.2.3",
207
209
  "react-dropzone": "^14.3.8",
208
210
  "react-i18next": "^16.5.3",