@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.
- package/dist/s-language-switcher/s-language-switcher.d.ts +2 -1
- package/dist/s-language-switcher/s-language-switcher.js +174 -120
- package/dist/theme/components/icon-button.d.ts +3 -0
- package/dist/theme/components/icon-button.js +13 -10
- package/dist/theme/theme-primitives.d.ts +2 -0
- package/dist/theme/theme-primitives.js +2 -0
- package/package.json +3 -1
|
@@ -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
|
-
|
|
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
|
|
2
|
-
import * as
|
|
3
|
-
import x from "react";
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { usePopover as
|
|
6
|
-
import { SIconButton as
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { c as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
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:
|
|
18
|
-
classes:
|
|
19
|
-
} =
|
|
20
|
-
return
|
|
21
|
-
root: ["root",
|
|
22
|
-
},
|
|
23
|
-
},
|
|
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: (
|
|
25
|
+
overridesResolver: (e, t) => {
|
|
27
26
|
const {
|
|
28
|
-
ownerState:
|
|
29
|
-
} =
|
|
30
|
-
return [
|
|
27
|
+
ownerState: o
|
|
28
|
+
} = e;
|
|
29
|
+
return [t.root, o.alignItems === "flex-start" && t.alignItemsFlexStart];
|
|
31
30
|
}
|
|
32
|
-
})(
|
|
33
|
-
theme:
|
|
31
|
+
})(k(({
|
|
32
|
+
theme: e
|
|
34
33
|
}) => ({
|
|
35
34
|
minWidth: 56,
|
|
36
|
-
color: (
|
|
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__ */
|
|
48
|
-
const
|
|
49
|
-
props:
|
|
46
|
+
}))), j = /* @__PURE__ */ y.forwardRef(function(t, o) {
|
|
47
|
+
const n = P({
|
|
48
|
+
props: t,
|
|
50
49
|
name: "MuiListItemIcon"
|
|
51
50
|
}), {
|
|
52
|
-
className:
|
|
53
|
-
...
|
|
54
|
-
} =
|
|
55
|
-
...
|
|
56
|
-
alignItems:
|
|
57
|
-
},
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
className:
|
|
60
|
-
ownerState:
|
|
61
|
-
ref:
|
|
62
|
-
...
|
|
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:
|
|
73
|
+
children: a.node,
|
|
75
74
|
/**
|
|
76
75
|
* Override or extend the styles applied to the component.
|
|
77
76
|
*/
|
|
78
|
-
classes:
|
|
77
|
+
classes: a.object,
|
|
79
78
|
/**
|
|
80
79
|
* @ignore
|
|
81
80
|
*/
|
|
82
|
-
className:
|
|
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:
|
|
85
|
+
sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object])
|
|
87
86
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
|
102
|
-
(
|
|
103
|
-
|
|
147
|
+
const m = x.useCallback(
|
|
148
|
+
(s) => {
|
|
149
|
+
n?.(s), t?.();
|
|
104
150
|
},
|
|
105
|
-
[
|
|
151
|
+
[n, t]
|
|
106
152
|
);
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
|
|
153
|
+
return /* @__PURE__ */ c.jsx(
|
|
154
|
+
U,
|
|
109
155
|
{
|
|
110
|
-
anchorEl:
|
|
156
|
+
anchorEl: e,
|
|
111
157
|
anchorOrigin: { horizontal: "right", vertical: "bottom" },
|
|
112
|
-
onClose:
|
|
113
|
-
open:
|
|
114
|
-
slotProps: { paper: { sx: { width:
|
|
158
|
+
onClose: t,
|
|
159
|
+
open: o,
|
|
160
|
+
slotProps: { paper: { sx: { width: p } } },
|
|
115
161
|
transformOrigin: { horizontal: "right", vertical: "top" },
|
|
116
|
-
children:
|
|
117
|
-
const
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
-
|
|
162
|
+
children: r.map((s) => {
|
|
163
|
+
const d = i === s.code;
|
|
164
|
+
return /* @__PURE__ */ c.jsxs(
|
|
165
|
+
E,
|
|
120
166
|
{
|
|
121
167
|
onClick: () => {
|
|
122
|
-
|
|
168
|
+
m(s.code);
|
|
123
169
|
},
|
|
124
|
-
selected:
|
|
170
|
+
selected: d,
|
|
125
171
|
sx: { gap: 1 },
|
|
126
172
|
children: [
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
|
|
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
|
-
|
|
185
|
+
s.code
|
|
132
186
|
);
|
|
133
187
|
})
|
|
134
188
|
}
|
|
135
189
|
);
|
|
136
|
-
},
|
|
137
|
-
languages:
|
|
138
|
-
onLanguageChange:
|
|
139
|
-
currentLanguage:
|
|
140
|
-
tooltipText:
|
|
141
|
-
buttonFlagSize:
|
|
142
|
-
menuFlagSize:
|
|
143
|
-
menuWidth:
|
|
144
|
-
sx:
|
|
145
|
-
useI18n:
|
|
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:
|
|
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
|
-
|
|
203
|
+
t ? t(h) : d && d.changeLanguage(h);
|
|
150
204
|
},
|
|
151
|
-
[
|
|
152
|
-
),
|
|
153
|
-
return /* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
|
|
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:
|
|
158
|
-
ref:
|
|
159
|
-
sx: { display: { xs: "none", lg: "inline-flex" }, ...
|
|
211
|
+
onClick: u.handleOpen,
|
|
212
|
+
ref: u.anchorRef,
|
|
213
|
+
sx: { display: { xs: "none", lg: "inline-flex" }, ...l },
|
|
160
214
|
tooltipOptions: {
|
|
161
|
-
title:
|
|
215
|
+
title: O,
|
|
162
216
|
placement: "top"
|
|
163
217
|
},
|
|
164
|
-
children: /* @__PURE__ */
|
|
165
|
-
|
|
218
|
+
children: /* @__PURE__ */ c.jsx(
|
|
219
|
+
b,
|
|
166
220
|
{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
height:
|
|
170
|
-
|
|
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__ */
|
|
176
|
-
|
|
229
|
+
/* @__PURE__ */ c.jsx(
|
|
230
|
+
H,
|
|
177
231
|
{
|
|
178
|
-
anchorEl:
|
|
179
|
-
onClose:
|
|
180
|
-
open:
|
|
181
|
-
onLanguageChange:
|
|
182
|
-
languages:
|
|
183
|
-
currentLanguage:
|
|
184
|
-
menuWidth:
|
|
185
|
-
flagSize:
|
|
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
|
-
|
|
244
|
+
K.displayName = "SLanguageSwitcher";
|
|
191
245
|
export {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
246
|
+
H as SLanguagePopover,
|
|
247
|
+
K as SLanguageSwitcher,
|
|
248
|
+
K as default,
|
|
249
|
+
I as defaultLanguageOptions
|
|
196
250
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { alpha as
|
|
2
|
-
import { brand as
|
|
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:
|
|
6
|
+
backgroundColor: t(e[500], 0.12),
|
|
7
7
|
color: e[600]
|
|
8
8
|
},
|
|
9
9
|
"&:active": {
|
|
10
|
-
backgroundColor:
|
|
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:
|
|
19
|
+
backgroundColor: t(s[400], 0.12),
|
|
20
20
|
color: s[300]
|
|
21
21
|
},
|
|
22
22
|
"&:active": {
|
|
23
|
-
backgroundColor:
|
|
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
|
-
}),
|
|
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,
|
|
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,
|
|
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
|
-
|
|
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.
|
|
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",
|