@solostylist/ui-kit 1.0.20 → 1.0.22
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.
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { SelectProps } from '@mui/material';
|
|
2
|
-
type BaseOption = string | number |
|
|
3
|
-
[key: string]: unknown;
|
|
4
|
-
};
|
|
2
|
+
type BaseOption = string | number | Record<string, any>;
|
|
5
3
|
export type SSelectProps<T extends BaseOption = string> = Omit<SelectProps, 'error' | 'variant'> & {
|
|
6
4
|
options?: T[];
|
|
7
5
|
optionLabel?: T extends object ? keyof T : never;
|
|
@@ -1,56 +1,59 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { j as u } from "../jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { forwardRef as m, useState as b, useEffect as V } from "react";
|
|
3
3
|
import { Select as E, MenuItem as O } from "@mui/material";
|
|
4
4
|
import R from "../s-form/s-form.js";
|
|
5
|
-
const M =
|
|
5
|
+
const M = m(
|
|
6
6
|
({
|
|
7
|
-
options:
|
|
8
|
-
optionLabel:
|
|
9
|
-
optionValue:
|
|
10
|
-
placeholder:
|
|
7
|
+
options: t = [],
|
|
8
|
+
optionLabel: c = "name",
|
|
9
|
+
optionValue: i = "id",
|
|
10
|
+
placeholder: d,
|
|
11
11
|
label: v = "",
|
|
12
12
|
error: x,
|
|
13
13
|
required: y = !1,
|
|
14
14
|
variant: $ = "outlined",
|
|
15
15
|
simple: g = !1,
|
|
16
|
-
htmlFor:
|
|
17
|
-
...
|
|
16
|
+
htmlFor: o,
|
|
17
|
+
...n
|
|
18
18
|
}, j) => {
|
|
19
|
-
const [
|
|
19
|
+
const [p, S] = b(n.value ?? null);
|
|
20
20
|
V(() => {
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
const
|
|
24
|
-
return /* @__PURE__ */
|
|
21
|
+
S(n.value ?? null);
|
|
22
|
+
}, [n.value]);
|
|
23
|
+
const a = (e) => String(typeof e == "string" || typeof e == "number" ? e : e[c]), l = (e) => typeof e == "string" || typeof e == "number" ? e : e[i];
|
|
24
|
+
return /* @__PURE__ */ u.jsx(R, { error: x, label: v, required: y, htmlFor: o, children: /* @__PURE__ */ u.jsx(
|
|
25
25
|
E,
|
|
26
26
|
{
|
|
27
|
-
id:
|
|
27
|
+
id: o,
|
|
28
28
|
displayEmpty: !0,
|
|
29
29
|
fullWidth: !0,
|
|
30
30
|
defaultValue: "",
|
|
31
31
|
ref: j,
|
|
32
|
-
renderValue:
|
|
33
|
-
const
|
|
34
|
-
return
|
|
35
|
-
|
|
32
|
+
renderValue: n.multiple ? (e) => {
|
|
33
|
+
const r = e;
|
|
34
|
+
return r.length === 0 ? /* @__PURE__ */ u.jsx("span", { style: { color: "var(--mui-palette-text-secondary)" }, children: d }) : r.map((f) => {
|
|
35
|
+
const s = t.find((h) => l(h) === l(f));
|
|
36
|
+
return s ? a(s) : "";
|
|
37
|
+
}).filter(Boolean).join(", ");
|
|
38
|
+
} : (e) => {
|
|
36
39
|
const r = e;
|
|
37
40
|
if (r == null || r === "")
|
|
38
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ u.jsx("span", { style: { color: "var(--mui-palette-text-secondary)" }, children: d });
|
|
39
42
|
if (g)
|
|
40
|
-
return
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
+
return a(r);
|
|
44
|
+
const f = t.find((s) => l(s) === l(r));
|
|
45
|
+
return f ? a(f) : "";
|
|
43
46
|
},
|
|
44
|
-
...
|
|
45
|
-
value:
|
|
46
|
-
children:
|
|
47
|
+
...n,
|
|
48
|
+
value: t.length ? p ?? "" : "",
|
|
49
|
+
children: t == null ? void 0 : t.map((e, r) => /* @__PURE__ */ u.jsx(
|
|
47
50
|
O,
|
|
48
51
|
{
|
|
49
52
|
disabled: (e == null ? void 0 : e.disabled) ?? !1,
|
|
50
|
-
value:
|
|
51
|
-
children:
|
|
53
|
+
value: l(e),
|
|
54
|
+
children: a(e)
|
|
52
55
|
},
|
|
53
|
-
`${
|
|
56
|
+
`${l(e)}-${r}`
|
|
54
57
|
))
|
|
55
58
|
}
|
|
56
59
|
) });
|
|
@@ -12,8 +12,13 @@ export default SSnackbarMessage;
|
|
|
12
12
|
export interface SnackbarMessageOpenOptions {
|
|
13
13
|
message: string;
|
|
14
14
|
}
|
|
15
|
+
export interface handleOpenParams {
|
|
16
|
+
snackbarMessageOptions: SnackbarMessageOpenOptions;
|
|
17
|
+
snackbarProps?: SnackbarProps;
|
|
18
|
+
alertProps?: AlertProps;
|
|
19
|
+
}
|
|
15
20
|
export interface SnackbarMessageContextProps {
|
|
16
|
-
handleOpen: (snackbarMessageOptions
|
|
21
|
+
handleOpen: ({ snackbarMessageOptions, snackbarProps, alertProps }: handleOpenParams) => void;
|
|
17
22
|
handleClose: () => void;
|
|
18
23
|
open: boolean;
|
|
19
24
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as t } from "../jsx-runtime-C5mzlN2N.js";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import { Snackbar as
|
|
4
|
-
import { useDialog as
|
|
5
|
-
const
|
|
3
|
+
import { Snackbar as h, Alert as S } from "@mui/material";
|
|
4
|
+
import { useDialog as k } from "../hooks/use-dialog.js";
|
|
5
|
+
const x = ({
|
|
6
6
|
message: s,
|
|
7
7
|
onClose: e = () => {
|
|
8
8
|
},
|
|
@@ -10,23 +10,23 @@ const k = ({
|
|
|
10
10
|
snackbarProps: n,
|
|
11
11
|
alertProps: o
|
|
12
12
|
}) => /* @__PURE__ */ t.jsx(
|
|
13
|
-
|
|
13
|
+
h,
|
|
14
14
|
{
|
|
15
15
|
open: r,
|
|
16
16
|
autoHideDuration: 1e4,
|
|
17
17
|
onClose: e,
|
|
18
18
|
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
19
19
|
...n,
|
|
20
|
-
children: /* @__PURE__ */ t.jsx(
|
|
20
|
+
children: /* @__PURE__ */ t.jsx(S, { onClose: e, severity: "error", sx: { width: "100%" }, ...o, children: s })
|
|
21
21
|
}
|
|
22
|
-
), c = a.createContext(null),
|
|
23
|
-
const e =
|
|
22
|
+
), c = a.createContext(null), M = ({ children: s }) => {
|
|
23
|
+
const e = k(), [r, n] = a.useState({
|
|
24
24
|
message: ""
|
|
25
25
|
}), [o, l] = a.useState({}), [i, u] = a.useState({}), p = {
|
|
26
26
|
handleOpen: a.useCallback(
|
|
27
|
-
(d, g = {}, m = {}) => {
|
|
28
|
-
const { message:
|
|
29
|
-
n({ message:
|
|
27
|
+
({ snackbarMessageOptions: d, snackbarProps: g = {}, alertProps: m = {} }) => {
|
|
28
|
+
const { message: b } = d;
|
|
29
|
+
n({ message: b }), l(g), u(m), e.handleOpen();
|
|
30
30
|
},
|
|
31
31
|
[e]
|
|
32
32
|
),
|
|
@@ -35,7 +35,7 @@ const k = ({
|
|
|
35
35
|
};
|
|
36
36
|
return /* @__PURE__ */ t.jsxs(c.Provider, { value: p, children: [
|
|
37
37
|
/* @__PURE__ */ t.jsx(
|
|
38
|
-
|
|
38
|
+
x,
|
|
39
39
|
{
|
|
40
40
|
open: e.open,
|
|
41
41
|
message: r == null ? void 0 : r.message,
|
|
@@ -53,7 +53,7 @@ const k = ({
|
|
|
53
53
|
return s;
|
|
54
54
|
};
|
|
55
55
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
M as SnackbarMessageProvider,
|
|
57
|
+
x as default,
|
|
58
58
|
j as useSnackbarMessage
|
|
59
59
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { j as l } from "../../jsx-runtime-C5mzlN2N.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as i from "react";
|
|
3
3
|
import { c as p } from "../../createSvgIcon-CFj_BoDp.js";
|
|
4
4
|
import { gray as r, brand as n } from "../theme-primitives.js";
|
|
5
|
-
import { d as c, m as
|
|
5
|
+
import { d as c, m as e } from "../../menuItemClasses-D9_8SIPH.js";
|
|
6
6
|
import { g as b } from "../../generateUtilityClasses-DStZbN71.js";
|
|
7
7
|
import { s } from "../../selectClasses-BDdGqseQ.js";
|
|
8
8
|
import { b as u } from "../../buttonBaseClasses-D9p3ujfW.js";
|
|
9
|
-
import { a
|
|
9
|
+
import { a } from "../../createTheme-DkVAXJiq.js";
|
|
10
10
|
const x = p(/* @__PURE__ */ l.jsx("path", {
|
|
11
11
|
d: "m12 5.83 2.46 2.46c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41L12.7 3.7a.996.996 0 0 0-1.41 0L8.12 6.88c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0zm0 12.34-2.46-2.46a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l3.17 3.18c.39.39 1.02.39 1.41 0l3.17-3.17c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0z"
|
|
12
12
|
}), "UnfoldMoreRounded"), t = b("MuiTab", ["root", "labelIcon", "textColorInherit", "textColorPrimary", "textColorSecondary", "selected", "disabled", "fullWidth", "wrapped", "iconWrapper", "icon"]), R = {
|
|
@@ -15,12 +15,12 @@ const x = p(/* @__PURE__ */ l.jsx("path", {
|
|
|
15
15
|
root: ({ theme: o }) => ({
|
|
16
16
|
borderRadius: (o.vars || o).shape.borderRadius,
|
|
17
17
|
padding: "6px 8px",
|
|
18
|
-
[`&.${
|
|
18
|
+
[`&.${e.focusVisible}`]: {
|
|
19
19
|
backgroundColor: "transparent"
|
|
20
20
|
},
|
|
21
|
-
[`&.${
|
|
22
|
-
[`&.${
|
|
23
|
-
backgroundColor:
|
|
21
|
+
[`&.${e.selected}`]: {
|
|
22
|
+
[`&.${e.focusVisible}`]: {
|
|
23
|
+
backgroundColor: a(o.palette.action.selected, 0.3)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
})
|
|
@@ -43,7 +43,7 @@ const x = p(/* @__PURE__ */ l.jsx("path", {
|
|
|
43
43
|
boxShadow: "hsla(220, 30%, 5%, 0.07) 0px 4px 16px 0px, hsla(220, 25%, 10%, 0.07) 0px 8px 16px -5px",
|
|
44
44
|
[`& .${u.root}`]: {
|
|
45
45
|
"&.Mui-selected": {
|
|
46
|
-
backgroundColor:
|
|
46
|
+
backgroundColor: a(o.palette.action.selected, 0.3)
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
...o.applyStyles("dark", {
|
|
@@ -55,7 +55,7 @@ const x = p(/* @__PURE__ */ l.jsx("path", {
|
|
|
55
55
|
},
|
|
56
56
|
MuiSelect: {
|
|
57
57
|
defaultProps: {
|
|
58
|
-
IconComponent:
|
|
58
|
+
IconComponent: i.forwardRef((o, d) => /* @__PURE__ */ l.jsx(x, { fontSize: "small", ...o, ref: d }))
|
|
59
59
|
},
|
|
60
60
|
styleOverrides: {
|
|
61
61
|
root: ({ theme: o }) => ({
|
|
@@ -80,9 +80,9 @@ const x = p(/* @__PURE__ */ l.jsx("path", {
|
|
|
80
80
|
borderRadius: (o.vars || o).shape.borderRadius,
|
|
81
81
|
borderColor: r[700],
|
|
82
82
|
backgroundColor: (o.vars || o).palette.background.paper,
|
|
83
|
-
boxShadow: `inset 0 1px 0 1px ${
|
|
83
|
+
boxShadow: `inset 0 1px 0 1px ${a(r[700], 0.15)}, inset 0 -1px 0 1px hsla(220, 0%, 0%, 0.7)`,
|
|
84
84
|
"&:hover": {
|
|
85
|
-
borderColor:
|
|
85
|
+
borderColor: a(r[700], 0.7),
|
|
86
86
|
backgroundColor: (o.vars || o).palette.background.paper,
|
|
87
87
|
boxShadow: "none"
|
|
88
88
|
},
|
|
@@ -96,11 +96,7 @@ const x = p(/* @__PURE__ */ l.jsx("path", {
|
|
|
96
96
|
})
|
|
97
97
|
}),
|
|
98
98
|
select: ({ theme: o }) => ({
|
|
99
|
-
display: "flex",
|
|
100
|
-
alignItems: "center",
|
|
101
99
|
...o.applyStyles("dark", {
|
|
102
|
-
display: "flex",
|
|
103
|
-
alignItems: "center",
|
|
104
100
|
"&:focus-visible": {
|
|
105
101
|
backgroundColor: r[900]
|
|
106
102
|
}
|
|
@@ -134,7 +130,7 @@ const x = p(/* @__PURE__ */ l.jsx("path", {
|
|
|
134
130
|
width: 0
|
|
135
131
|
},
|
|
136
132
|
"&:focus-visible": {
|
|
137
|
-
outline: `3px solid ${
|
|
133
|
+
outline: `3px solid ${a(n[500], 0.5)}`,
|
|
138
134
|
outlineOffset: "4px",
|
|
139
135
|
borderRadius: "2px"
|
|
140
136
|
}
|
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.22",
|
|
7
7
|
"description": "advanced ui kit for solostylist",
|
|
8
8
|
"private": false,
|
|
9
9
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
20
20
|
"lint:fix": "eslint --fix . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
21
21
|
"preview": "vite preview",
|
|
22
|
-
"app:publish": "npm run build
|
|
22
|
+
"app:publish": "npm run build && npm publish --access public",
|
|
23
23
|
"format:write": "prettier --write \"**/*.{js,jsx,mjs,ts,tsx,mdx}\" --cache",
|
|
24
24
|
"format:check": "prettier --check \"**/*.{js,jsx,mjs,ts,tsx,mdx}\" --cache",
|
|
25
25
|
"prepare": "husky"
|