@fangzsx/component-library 0.0.36 → 0.0.38
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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as r } from "./createSvgIcon-C0YrvByi.js";
|
|
3
|
+
const c = r(/* @__PURE__ */ o("path", {
|
|
4
|
+
d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
5
|
+
}), "Close");
|
|
6
|
+
export {
|
|
7
|
+
c as C
|
|
8
|
+
};
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as i, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { C as x } from "../../Close-pjIlDyCW.js";
|
|
3
3
|
import { Slide as d, Dialog as u, DialogTitle as g, IconButton as h, DialogContent as D, DialogActions as C } from "@mui/material";
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
}), "Close"), y = S(function(i, e) {
|
|
8
|
-
return /* @__PURE__ */ t(d, { direction: "up", ref: e, ...i });
|
|
4
|
+
import { forwardRef as j } from "react";
|
|
5
|
+
const y = j(function(t, o) {
|
|
6
|
+
return /* @__PURE__ */ i(d, { direction: "up", ref: o, ...t });
|
|
9
7
|
});
|
|
10
|
-
function
|
|
11
|
-
open:
|
|
12
|
-
onClose:
|
|
13
|
-
title:
|
|
8
|
+
function w({
|
|
9
|
+
open: e,
|
|
10
|
+
onClose: t,
|
|
11
|
+
title: o,
|
|
14
12
|
children: l,
|
|
15
13
|
actions: r,
|
|
16
14
|
maxWidth: s = "sm",
|
|
17
15
|
fullWidth: a = !0,
|
|
18
16
|
showCloseButton: p = !0,
|
|
19
|
-
dividers:
|
|
20
|
-
fullScreen:
|
|
17
|
+
dividers: m = !0,
|
|
18
|
+
fullScreen: c = !1,
|
|
21
19
|
slideTransition: f = !1
|
|
22
20
|
}) {
|
|
23
21
|
return /* @__PURE__ */ n(
|
|
24
22
|
u,
|
|
25
23
|
{
|
|
26
|
-
open:
|
|
27
|
-
onClose:
|
|
24
|
+
open: e,
|
|
25
|
+
onClose: t,
|
|
28
26
|
maxWidth: s,
|
|
29
27
|
fullWidth: a,
|
|
30
|
-
fullScreen:
|
|
28
|
+
fullScreen: c,
|
|
31
29
|
scroll: "paper",
|
|
32
30
|
slots: f ? { transition: y } : void 0,
|
|
33
31
|
sx: {
|
|
@@ -49,23 +47,23 @@ function v({
|
|
|
49
47
|
fontSize: "19px",
|
|
50
48
|
pr: 1
|
|
51
49
|
}, children: [
|
|
52
|
-
|
|
53
|
-
p && /* @__PURE__ */
|
|
50
|
+
o,
|
|
51
|
+
p && /* @__PURE__ */ i(
|
|
54
52
|
h,
|
|
55
53
|
{
|
|
56
|
-
onClick:
|
|
54
|
+
onClick: t,
|
|
57
55
|
size: "small",
|
|
58
56
|
sx: { ml: 2 },
|
|
59
|
-
children: /* @__PURE__ */
|
|
57
|
+
children: /* @__PURE__ */ i(x, {})
|
|
60
58
|
}
|
|
61
59
|
)
|
|
62
60
|
] }),
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
r && /* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ i(D, { dividers: m, children: l }),
|
|
62
|
+
r && /* @__PURE__ */ i(C, { sx: { px: 3, py: 2 }, children: r })
|
|
65
63
|
]
|
|
66
64
|
}
|
|
67
65
|
);
|
|
68
66
|
}
|
|
69
67
|
export {
|
|
70
|
-
|
|
68
|
+
w as ScrollableDialog
|
|
71
69
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface ImageUploadProps {
|
|
2
|
+
label?: string;
|
|
3
|
+
required?: boolean;
|
|
4
|
+
maxSizeMB?: number;
|
|
5
|
+
acceptedFormats?: string[];
|
|
6
|
+
error?: string;
|
|
7
|
+
forceError?: boolean;
|
|
8
|
+
helperText?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onChange?: (file: File | null, error: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function ImageUpload({ label, required, maxSizeMB, acceptedFormats, error, forceError, helperText, disabled, onChange, }: ImageUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { C as H } from "../../Close-pjIlDyCW.js";
|
|
3
|
+
import { c as M } from "../../createSvgIcon-C0YrvByi.js";
|
|
4
|
+
import { FormControl as P, FormLabel as T, Box as i, Stack as U, Typography as l, IconButton as V, FormHelperText as E } from "@mui/material";
|
|
5
|
+
import { useState as g, useRef as q, useCallback as G } from "react";
|
|
6
|
+
const J = M(/* @__PURE__ */ e("path", {
|
|
7
|
+
d: "M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z"
|
|
8
|
+
}), "ImageOutlined");
|
|
9
|
+
function K(t) {
|
|
10
|
+
const a = t.lastIndexOf(".");
|
|
11
|
+
return a <= 0 ? { baseName: t, extension: "" } : {
|
|
12
|
+
baseName: t.slice(0, a),
|
|
13
|
+
extension: t.slice(a)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function rr({
|
|
17
|
+
label: t = "Logo",
|
|
18
|
+
required: a = !0,
|
|
19
|
+
maxSizeMB: u = 2,
|
|
20
|
+
acceptedFormats: c = ["png", "jpg", "jpeg"],
|
|
21
|
+
error: x = "",
|
|
22
|
+
forceError: y = !1,
|
|
23
|
+
helperText: b,
|
|
24
|
+
disabled: o = !1,
|
|
25
|
+
onChange: s
|
|
26
|
+
}) {
|
|
27
|
+
const [v, f] = g(!1), [p, k] = g(null), [O, D] = g(""), d = q(null), w = u * 1024 * 1024, R = c.map((r) => `.${r}`).join(","), C = c.map(
|
|
28
|
+
(r) => `image/${r === "jpg" ? "jpeg" : r}`
|
|
29
|
+
), j = G(
|
|
30
|
+
function(r) {
|
|
31
|
+
if (!r) return;
|
|
32
|
+
if (!C.some((h) => r.type === h)) {
|
|
33
|
+
s?.(null, `Only ${c.join(", ")} files are supported`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (r.size > w) {
|
|
37
|
+
s?.(null, `File size must be less than ${u}MB`);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const I = new FileReader();
|
|
41
|
+
I.onload = function(h) {
|
|
42
|
+
k(h.target?.result), D(r.name), s?.(r, "");
|
|
43
|
+
}, I.readAsDataURL(r);
|
|
44
|
+
},
|
|
45
|
+
[C, w, u, c, s]
|
|
46
|
+
);
|
|
47
|
+
function S(r) {
|
|
48
|
+
r.preventDefault(), !o && (f(!1), j(r.dataTransfer.files?.[0] ?? null));
|
|
49
|
+
}
|
|
50
|
+
function F(r) {
|
|
51
|
+
r.preventDefault(), o || f(!0);
|
|
52
|
+
}
|
|
53
|
+
function L() {
|
|
54
|
+
f(!1);
|
|
55
|
+
}
|
|
56
|
+
function W() {
|
|
57
|
+
o || d.current?.click();
|
|
58
|
+
}
|
|
59
|
+
function z(r) {
|
|
60
|
+
j(r.target.files?.[0] ?? null);
|
|
61
|
+
}
|
|
62
|
+
function N(r) {
|
|
63
|
+
r.stopPropagation(), k(null), D(""), s?.(null, ""), d.current && (d.current.value = "");
|
|
64
|
+
}
|
|
65
|
+
const m = !!x || y && !p, B = x || (y && !p ? `${t} can't be empty` : ""), { baseName: $, extension: A } = K(O);
|
|
66
|
+
return /* @__PURE__ */ n(P, { fullWidth: !0, error: m, disabled: o, children: [
|
|
67
|
+
t && /* @__PURE__ */ e(
|
|
68
|
+
T,
|
|
69
|
+
{
|
|
70
|
+
required: a,
|
|
71
|
+
sx: {
|
|
72
|
+
mb: 0.75,
|
|
73
|
+
fontSize: 14,
|
|
74
|
+
fontWeight: 500,
|
|
75
|
+
color: "text.primary",
|
|
76
|
+
"& .MuiFormLabel-asterisk": { color: "error.main" },
|
|
77
|
+
"&.Mui-focused": { color: "text.primary" },
|
|
78
|
+
"&.Mui-error": { color: "text.primary" }
|
|
79
|
+
},
|
|
80
|
+
children: t
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ n(
|
|
84
|
+
i,
|
|
85
|
+
{
|
|
86
|
+
onClick: W,
|
|
87
|
+
onDrop: S,
|
|
88
|
+
onDragOver: F,
|
|
89
|
+
onDragLeave: L,
|
|
90
|
+
sx: {
|
|
91
|
+
border: 2,
|
|
92
|
+
borderStyle: "dashed",
|
|
93
|
+
borderColor: m ? "error.main" : v ? "primary.main" : "grey.300",
|
|
94
|
+
borderRadius: 2,
|
|
95
|
+
p: p ? 1.5 : 4,
|
|
96
|
+
textAlign: "center",
|
|
97
|
+
cursor: o ? "default" : "pointer",
|
|
98
|
+
bgcolor: o ? "action.disabledBackground" : v ? "primary.50" : "grey.50",
|
|
99
|
+
transition: "all 0.2s ease",
|
|
100
|
+
opacity: o ? 0.6 : 1,
|
|
101
|
+
"&:hover": o ? {} : {
|
|
102
|
+
borderColor: m ? "error.main" : "primary.main",
|
|
103
|
+
bgcolor: "primary.50"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ e(
|
|
108
|
+
"input",
|
|
109
|
+
{
|
|
110
|
+
ref: d,
|
|
111
|
+
type: "file",
|
|
112
|
+
accept: R,
|
|
113
|
+
onChange: z,
|
|
114
|
+
hidden: !0,
|
|
115
|
+
disabled: o
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
p ? /* @__PURE__ */ n(U, { direction: "row", alignItems: "center", spacing: 2, children: [
|
|
119
|
+
/* @__PURE__ */ e(
|
|
120
|
+
i,
|
|
121
|
+
{
|
|
122
|
+
component: "img",
|
|
123
|
+
src: p,
|
|
124
|
+
alt: "Preview",
|
|
125
|
+
sx: {
|
|
126
|
+
width: 80,
|
|
127
|
+
height: 80,
|
|
128
|
+
objectFit: "contain",
|
|
129
|
+
borderRadius: 1.5,
|
|
130
|
+
border: 1,
|
|
131
|
+
borderColor: "grey.200"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ n(i, { sx: { flex: 1, minWidth: 0, textAlign: "left" }, children: [
|
|
136
|
+
/* @__PURE__ */ n(
|
|
137
|
+
l,
|
|
138
|
+
{
|
|
139
|
+
variant: "body2",
|
|
140
|
+
fontWeight: 500,
|
|
141
|
+
sx: {
|
|
142
|
+
display: "flex",
|
|
143
|
+
minWidth: 0
|
|
144
|
+
},
|
|
145
|
+
children: [
|
|
146
|
+
/* @__PURE__ */ e(
|
|
147
|
+
i,
|
|
148
|
+
{
|
|
149
|
+
component: "span",
|
|
150
|
+
sx: {
|
|
151
|
+
overflow: "hidden",
|
|
152
|
+
textOverflow: "ellipsis",
|
|
153
|
+
whiteSpace: "nowrap",
|
|
154
|
+
minWidth: 0
|
|
155
|
+
},
|
|
156
|
+
children: $
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ e(
|
|
160
|
+
i,
|
|
161
|
+
{
|
|
162
|
+
component: "span",
|
|
163
|
+
sx: {
|
|
164
|
+
flexShrink: 0
|
|
165
|
+
},
|
|
166
|
+
children: A
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ e(l, { variant: "caption", color: "text.secondary", children: "Click to replace" })
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ e(
|
|
175
|
+
V,
|
|
176
|
+
{
|
|
177
|
+
onClick: N,
|
|
178
|
+
size: "small",
|
|
179
|
+
color: "error",
|
|
180
|
+
sx: {
|
|
181
|
+
border: 1,
|
|
182
|
+
borderColor: "grey.200",
|
|
183
|
+
borderRadius: 1.5,
|
|
184
|
+
"&:hover": { bgcolor: "error.50", borderColor: "error.200" }
|
|
185
|
+
},
|
|
186
|
+
children: /* @__PURE__ */ e(H, { fontSize: "small" })
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] }) : /* @__PURE__ */ n(i, { children: [
|
|
190
|
+
/* @__PURE__ */ e(
|
|
191
|
+
J,
|
|
192
|
+
{
|
|
193
|
+
sx: { fontSize: 40, color: "primary.main", mb: 1.5 }
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ n(l, { variant: "body2", color: "text.secondary", gutterBottom: !0, children: [
|
|
197
|
+
"Drop image here or",
|
|
198
|
+
" ",
|
|
199
|
+
/* @__PURE__ */ e(
|
|
200
|
+
l,
|
|
201
|
+
{
|
|
202
|
+
component: "span",
|
|
203
|
+
variant: "body2",
|
|
204
|
+
color: "primary",
|
|
205
|
+
fontWeight: 600,
|
|
206
|
+
sx: { textDecoration: "underline" },
|
|
207
|
+
children: "click to browse"
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ n(l, { variant: "caption", color: "text.disabled", display: "block", children: [
|
|
212
|
+
"File size should be less than ",
|
|
213
|
+
u,
|
|
214
|
+
"MB"
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ n(l, { variant: "caption", color: "text.disabled", display: "block", children: [
|
|
217
|
+
"Supports ",
|
|
218
|
+
c.join(", ")
|
|
219
|
+
] })
|
|
220
|
+
] })
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
(m || b) && /* @__PURE__ */ e(E, { sx: { mt: 0.75, mx: 0 }, children: B || b })
|
|
225
|
+
] });
|
|
226
|
+
}
|
|
227
|
+
export {
|
|
228
|
+
rr as ImageUpload
|
|
229
|
+
};
|
package/dist/main.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { CheckboxGroup } from './components/CheckboxGroup';
|
|
|
7
7
|
export { Dropdown } from './components/Dropdown';
|
|
8
8
|
export { DropdownOptions } from './components/DropdownOptions';
|
|
9
9
|
export { FlatBanner } from './components/FlatBanner';
|
|
10
|
+
export { ImageUpload } from './components/ImageUpload';
|
|
10
11
|
export { Label } from './components/Label';
|
|
11
12
|
export { LinearProgress } from './components/LinearProgress';
|
|
12
13
|
export { MediaCardWithAction } from './components/MediaCardWithAction';
|
package/dist/main.js
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { AppBarPublic as e } from "./components/AppBarPublic/index.js";
|
|
2
2
|
import { Banner as p } from "./components/Banner/index.js";
|
|
3
3
|
import { B as m } from "./index-Dnsx2wLn.js";
|
|
4
|
-
import { CheckBox as
|
|
5
|
-
import { ScrollableDialog as
|
|
4
|
+
import { CheckBox as a } from "./components/Checkbox/index.js";
|
|
5
|
+
import { ScrollableDialog as d } from "./components/Dialog/index.js";
|
|
6
6
|
import { CheckboxGroup as l } from "./components/CheckboxGroup/index.js";
|
|
7
7
|
import { Dropdown as B } from "./components/Dropdown/index.js";
|
|
8
8
|
import { DropdownOptions as s } from "./components/DropdownOptions/index.js";
|
|
9
9
|
import { FlatBanner as D } from "./components/FlatBanner/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
10
|
+
import { ImageUpload as g } from "./components/ImageUpload/index.js";
|
|
11
|
+
import { Label as P } from "./components/Label/index.js";
|
|
12
|
+
import { LinearProgress as A } from "./components/LinearProgress/index.js";
|
|
13
|
+
import { MediaCardWithAction as F } from "./components/MediaCardWithAction/index.js";
|
|
14
|
+
import { PhoneAndCountryDropdown as I } from "./components/PhoneAndCountryDropdown/index.js";
|
|
15
|
+
import { PromoCode as S } from "./components/PromoCode/index.js";
|
|
16
|
+
import { RadioButtonGroup as y } from "./components/RadioButtonGroup/index.js";
|
|
17
|
+
import { Stepper as O } from "./components/Stepper/index.js";
|
|
18
|
+
import { Text as U } from "./components/Text/index.js";
|
|
19
|
+
import { TextFieldInput as j } from "./components/TextFieldInput/index.js";
|
|
19
20
|
export {
|
|
20
21
|
e as AppBarPublic,
|
|
21
22
|
p as Banner,
|
|
22
23
|
m as Button,
|
|
23
|
-
|
|
24
|
+
a as CheckBox,
|
|
24
25
|
l as CheckboxGroup,
|
|
25
|
-
|
|
26
|
+
d as Dialog,
|
|
26
27
|
B as Dropdown,
|
|
27
28
|
s as DropdownOptions,
|
|
28
29
|
D as FlatBanner,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
A as
|
|
32
|
-
F as
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
O as
|
|
37
|
-
|
|
30
|
+
g as ImageUpload,
|
|
31
|
+
P as Label,
|
|
32
|
+
A as LinearProgress,
|
|
33
|
+
F as MediaCardWithAction,
|
|
34
|
+
I as PhoneAndCountryDropdown,
|
|
35
|
+
S as PromoCode,
|
|
36
|
+
y as RadioButtonGroup,
|
|
37
|
+
O as Stepper,
|
|
38
|
+
U as Text,
|
|
39
|
+
j as TextFieldInput
|
|
38
40
|
};
|