@fangzsx/component-library 0.0.35 → 0.0.37

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
+ };
@@ -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: "M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"
5
+ }), "KeyboardArrowDown");
6
+ export {
7
+ c as K
8
+ };
@@ -1,33 +1,31 @@
1
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
- import { c as x } from "../../createSvgIcon-C0YrvByi.js";
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 S } from "react";
5
- const j = x(/* @__PURE__ */ t("path", {
6
- 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"
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 v({
11
- open: o,
12
- onClose: i,
13
- title: e,
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: c = !0,
20
- fullScreen: m = !1,
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: o,
27
- onClose: i,
24
+ open: e,
25
+ onClose: t,
28
26
  maxWidth: s,
29
27
  fullWidth: a,
30
- fullScreen: m,
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
- e,
53
- p && /* @__PURE__ */ t(
50
+ o,
51
+ p && /* @__PURE__ */ i(
54
52
  h,
55
53
  {
56
- onClick: i,
54
+ onClick: t,
57
55
  size: "small",
58
56
  sx: { ml: 2 },
59
- children: /* @__PURE__ */ t(j, {})
57
+ children: /* @__PURE__ */ i(x, {})
60
58
  }
61
59
  )
62
60
  ] }),
63
- /* @__PURE__ */ t(D, { dividers: c, children: l }),
64
- r && /* @__PURE__ */ t(C, { sx: { px: 3, py: 2 }, children: r })
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
- v as ScrollableDialog
68
+ w as ScrollableDialog
71
69
  };
@@ -1,23 +1,24 @@
1
- import { jsx as i, jsxs as E } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as E } from "react/jsx-runtime";
2
2
  import * as T from "react";
3
- import { useState as V, useCallback as q } from "react";
4
- import { a as A, F as _ } from "../../FormHelperText-B-xlmRr4.js";
5
- import { L as N, a as J, S as K } from "../../Select-BSsJnv6h.js";
6
- import { a as $, g as Q, P as o } from "../../generateUtilityClasses-BCID9NF1.js";
7
- import { u as X, s as Y, c as F, a as Z, r as ee, m as oe } from "../../DefaultPropsProvider-DVX_ssOt.js";
8
- import { u as te } from "../../useTimeout-UzNJH-cm.js";
9
- import { u as re } from "../../useForkRef-9kN4DArm.js";
10
- import { B as se } from "../../ButtonBase-CSQZHD_g.js";
11
- const H = $("MuiDivider", ["root", "absolute", "fullWidth", "inset", "middle", "flexItem", "light", "vertical", "withChildren", "withChildrenVertical", "textAlignRight", "textAlignLeft", "wrapper", "wrapperVertical"]), P = $("MuiListItemIcon", ["root", "alignItemsFlexStart"]), D = $("MuiListItemText", ["root", "multiline", "dense", "inset", "primary", "secondary"]);
12
- function ae(e) {
13
- return Q("MuiMenuItem", e);
3
+ import { useState as V, useCallback as W } from "react";
4
+ import { K as q } from "../../KeyboardArrowDown-D4mY-2qw.js";
5
+ import { a as K, F as _ } from "../../FormHelperText-B-xlmRr4.js";
6
+ import { L as N, a as J, S as Q } from "../../Select-BSsJnv6h.js";
7
+ import { a as w, g as X, P as o } from "../../generateUtilityClasses-BCID9NF1.js";
8
+ import { u as Y, s as Z, c as F, a as ee, r as oe, m as te } from "../../DefaultPropsProvider-DVX_ssOt.js";
9
+ import { u as re } from "../../useTimeout-UzNJH-cm.js";
10
+ import { u as se } from "../../useForkRef-9kN4DArm.js";
11
+ import { B as ae } from "../../ButtonBase-CSQZHD_g.js";
12
+ const D = w("MuiDivider", ["root", "absolute", "fullWidth", "inset", "middle", "flexItem", "light", "vertical", "withChildren", "withChildrenVertical", "textAlignRight", "textAlignLeft", "wrapper", "wrapperVertical"]), H = w("MuiListItemIcon", ["root", "alignItemsFlexStart"]), P = w("MuiListItemText", ["root", "multiline", "dense", "inset", "primary", "secondary"]);
13
+ function ne(e) {
14
+ return X("MuiMenuItem", e);
14
15
  }
15
- const y = $("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divider", "gutters", "selected"]), ne = (e, t) => {
16
+ const y = w("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divider", "gutters", "selected"]), ie = (e, t) => {
16
17
  const {
17
18
  ownerState: a
18
19
  } = e;
19
20
  return [t.root, a.dense && t.dense, a.divider && t.divider, !a.disableGutters && t.gutters];
20
- }, ie = (e) => {
21
+ }, le = (e) => {
21
22
  const {
22
23
  disabled: t,
23
24
  dense: a,
@@ -25,19 +26,19 @@ const y = $("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divide
25
26
  disableGutters: l,
26
27
  selected: u,
27
28
  classes: d
28
- } = e, n = Z({
29
+ } = e, i = ee({
29
30
  root: ["root", a && "dense", t && "disabled", !l && "gutters", s && "divider", u && "selected"]
30
- }, ae, d);
31
+ }, ne, d);
31
32
  return {
32
33
  ...d,
33
- ...n
34
+ ...i
34
35
  };
35
- }, le = Y(se, {
36
- shouldForwardProp: (e) => ee(e) || e === "classes",
36
+ }, de = Z(ae, {
37
+ shouldForwardProp: (e) => oe(e) || e === "classes",
37
38
  name: "MuiMenuItem",
38
39
  slot: "Root",
39
- overridesResolver: ne
40
- })(oe(({
40
+ overridesResolver: ie
41
+ })(te(({
41
42
  theme: e
42
43
  }) => ({
43
44
  ...e.typography.body1,
@@ -78,21 +79,21 @@ const y = $("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divide
78
79
  [`&.${y.disabled}`]: {
79
80
  opacity: (e.vars || e).palette.action.disabledOpacity
80
81
  },
81
- [`& + .${H.root}`]: {
82
+ [`& + .${D.root}`]: {
82
83
  marginTop: e.spacing(1),
83
84
  marginBottom: e.spacing(1)
84
85
  },
85
- [`& + .${H.inset}`]: {
86
+ [`& + .${D.inset}`]: {
86
87
  marginLeft: 52
87
88
  },
88
- [`& .${D.root}`]: {
89
+ [`& .${P.root}`]: {
89
90
  marginTop: 0,
90
91
  marginBottom: 0
91
92
  },
92
- [`& .${D.inset}`]: {
93
+ [`& .${P.inset}`]: {
93
94
  paddingLeft: 36
94
95
  },
95
- [`& .${P.root}`]: {
96
+ [`& .${H.root}`]: {
96
97
  minWidth: 36
97
98
  },
98
99
  variants: [{
@@ -130,13 +131,13 @@ const y = $("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divide
130
131
  paddingTop: 4,
131
132
  paddingBottom: 4,
132
133
  ...e.typography.body2,
133
- [`& .${P.root} svg`]: {
134
+ [`& .${H.root} svg`]: {
134
135
  fontSize: "1.25rem"
135
136
  }
136
137
  }
137
138
  }]
138
139
  }))), L = /* @__PURE__ */ T.forwardRef(function(t, a) {
139
- const s = X({
140
+ const s = Y({
140
141
  props: t,
141
142
  name: "MuiMenuItem"
142
143
  }), {
@@ -144,7 +145,7 @@ const y = $("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divide
144
145
  component: u = "li",
145
146
  dense: d = !1,
146
147
  divider: p = !1,
147
- disableGutters: n = !1,
148
+ disableGutters: i = !1,
148
149
  focusVisibleClassName: m,
149
150
  role: b = "menuitem",
150
151
  tabIndex: C,
@@ -152,21 +153,21 @@ const y = $("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divide
152
153
  ...h
153
154
  } = s, f = T.useContext(N), M = T.useMemo(() => ({
154
155
  dense: d || f.dense || !1,
155
- disableGutters: n
156
- }), [f.dense, d, n]), g = T.useRef(null);
157
- te(() => {
156
+ disableGutters: i
157
+ }), [f.dense, d, i]), g = T.useRef(null);
158
+ re(() => {
158
159
  l && (g.current ? g.current.focus() : process.env.NODE_ENV !== "production" && console.error("MUI: Unable to set focus to a MenuItem whose component has not been rendered."));
159
160
  }, [l]);
160
- const k = {
161
+ const $ = {
161
162
  ...s,
162
163
  dense: M.dense,
163
164
  divider: p,
164
- disableGutters: n
165
- }, v = ie(s), O = re(g, a);
165
+ disableGutters: i
166
+ }, v = le(s), O = se(g, a);
166
167
  let x;
167
- return s.disabled || (x = C !== void 0 ? C : -1), /* @__PURE__ */ i(N.Provider, {
168
+ return s.disabled || (x = C !== void 0 ? C : -1), /* @__PURE__ */ n(N.Provider, {
168
169
  value: M,
169
- children: /* @__PURE__ */ i(le, {
170
+ children: /* @__PURE__ */ n(de, {
170
171
  ref: O,
171
172
  role: b,
172
173
  tabIndex: x,
@@ -174,7 +175,7 @@ const y = $("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divide
174
175
  focusVisibleClassName: F(v.focusVisible, m),
175
176
  className: F(v.root, I),
176
177
  ...h,
177
- ownerState: k,
178
+ ownerState: $,
178
179
  classes: v
179
180
  })
180
181
  });
@@ -254,7 +255,7 @@ process.env.NODE_ENV !== "production" && (L.propTypes = {
254
255
  */
255
256
  tabIndex: o.number
256
257
  });
257
- function xe(e) {
258
+ function Ce(e) {
258
259
  const {
259
260
  className: t,
260
261
  sx: a,
@@ -263,7 +264,7 @@ function xe(e) {
263
264
  value: u = "",
264
265
  onChange: d,
265
266
  required: p = !1,
266
- disabled: n = !1,
267
+ disabled: i = !1,
267
268
  forceError: m = !1,
268
269
  errorMessage: b = "This field is required",
269
270
  helperText: C,
@@ -272,36 +273,36 @@ function xe(e) {
272
273
  customValidation: f,
273
274
  size: M,
274
275
  variant: g = "outlined",
275
- fullWidth: k = !0,
276
+ fullWidth: $ = !0,
276
277
  ...v
277
- } = e, [O, x] = V(!1), [R, w] = V(!1), [j, S] = V(""), B = q(
278
+ } = e, [O, x] = V(!1), [R, k] = V(!1), [j, S] = V(""), B = W(
278
279
  (r) => {
279
280
  if (p && !r) {
280
- w(!0), S(b);
281
+ k(!0), S(b);
281
282
  return;
282
283
  }
283
284
  if (f) {
284
285
  const c = f(r);
285
286
  if (c) {
286
- w(!0), S(c);
287
+ k(!0), S(c);
287
288
  return;
288
289
  }
289
290
  }
290
- w(!1), S("");
291
+ k(!1), S("");
291
292
  },
292
293
  [p, b, f]
293
294
  ), U = m || O && R, G = m ? b : O && R ? j : C || " ", z = (r) => {
294
295
  const c = r.target.value;
295
296
  x(!0), B(c), d?.(c);
296
- }, W = () => {
297
+ }, A = () => {
297
298
  x(!0), B(u);
298
299
  };
299
300
  return /* @__PURE__ */ E(
300
- A,
301
+ K,
301
302
  {
302
- fullWidth: k,
303
+ fullWidth: $,
303
304
  error: U,
304
- disabled: n,
305
+ disabled: i,
305
306
  required: p,
306
307
  size: M,
307
308
  variant: g,
@@ -326,19 +327,27 @@ function xe(e) {
326
327
  ...h?.sx
327
328
  },
328
329
  children: [
329
- s && /* @__PURE__ */ i(J, { shrink: !0, children: s }),
330
+ s && /* @__PURE__ */ n(J, { shrink: !0, children: s }),
330
331
  /* @__PURE__ */ E(
331
- K,
332
+ Q,
332
333
  {
333
334
  className: t,
334
335
  value: u,
335
336
  label: s || void 0,
336
337
  onChange: z,
337
- onBlur: W,
338
- disabled: n,
338
+ onBlur: A,
339
+ disabled: i,
339
340
  notched: !!s,
340
341
  displayEmpty: !0,
341
- renderValue: (r) => r ? l.find((c) => c.value === r)?.label ?? r : /* @__PURE__ */ i("em", { style: { color: "#9e9e9e" }, children: I }),
342
+ IconComponent: (r) => /* @__PURE__ */ n(
343
+ q,
344
+ {
345
+ ...r,
346
+ fontSize: "small",
347
+ sx: { color: "action.active" }
348
+ }
349
+ ),
350
+ renderValue: (r) => r ? l.find((c) => c.value === r)?.label ?? r : /* @__PURE__ */ n("em", { style: { color: "#9e9e9e" }, children: I }),
342
351
  ...v,
343
352
  sx: {
344
353
  ...m && {
@@ -355,16 +364,16 @@ function xe(e) {
355
364
  ...a
356
365
  },
357
366
  children: [
358
- /* @__PURE__ */ i(L, { value: "", disabled: !0, children: /* @__PURE__ */ i("em", { children: I }) }),
359
- l.map((r) => /* @__PURE__ */ i(L, { value: r.value, children: r.label }, r.value))
367
+ /* @__PURE__ */ n(L, { value: "", disabled: !0, children: /* @__PURE__ */ n("em", { children: I }) }),
368
+ l.map((r) => /* @__PURE__ */ n(L, { value: r.value, children: r.label }, r.value))
360
369
  ]
361
370
  }
362
371
  ),
363
- /* @__PURE__ */ i(_, { children: G })
372
+ /* @__PURE__ */ n(_, { children: G })
364
373
  ]
365
374
  }
366
375
  );
367
376
  }
368
377
  export {
369
- xe as DropdownOptions
378
+ Ce as DropdownOptions
370
379
  };
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+
3
+ interface ImageUploadProps {
4
+ label?: string;
5
+ required?: boolean;
6
+ maxSizeMB?: number;
7
+ acceptedFormats?: string[];
8
+ error?: string;
9
+ forceError?: boolean;
10
+ helperText?: string;
11
+ disabled?: boolean;
12
+ onChange?: (file: File | null, error: string) => void;
13
+ }
14
+ declare const ImageUpload: React.FC<ImageUploadProps>;
15
+ export default ImageUpload;
@@ -0,0 +1,218 @@
1
+ import { jsx as e, jsxs as t } 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"), K = (n) => {
9
+ const a = n.lastIndexOf(".");
10
+ return a <= 0 ? { baseName: n, extension: "" } : {
11
+ baseName: n.slice(0, a),
12
+ extension: n.slice(a)
13
+ };
14
+ }, rr = ({
15
+ label: n = "Logo",
16
+ required: a = !0,
17
+ maxSizeMB: d = 2,
18
+ acceptedFormats: s = ["png", "jpg", "jpeg"],
19
+ error: x = "",
20
+ forceError: y = !1,
21
+ helperText: b,
22
+ disabled: o = !1,
23
+ onChange: c
24
+ }) => {
25
+ const [v, h] = g(!1), [p, k] = g(null), [O, D] = g(""), m = q(null), w = d * 1024 * 1024, R = s.map((r) => `.${r}`).join(","), C = s.map(
26
+ (r) => `image/${r === "jpg" ? "jpeg" : r}`
27
+ ), j = G(
28
+ (r) => {
29
+ if (!r) return;
30
+ if (!C.some((f) => r.type === f)) {
31
+ c?.(null, `Only ${s.join(", ")} files are supported`);
32
+ return;
33
+ }
34
+ if (r.size > w) {
35
+ c?.(null, `File size must be less than ${d}MB`);
36
+ return;
37
+ }
38
+ const I = new FileReader();
39
+ I.onload = (f) => {
40
+ k(f.target?.result), D(r.name), c?.(r, "");
41
+ }, I.readAsDataURL(r);
42
+ },
43
+ [C, w, d, s, c]
44
+ ), S = (r) => {
45
+ r.preventDefault(), !o && (h(!1), j(r.dataTransfer.files?.[0] ?? null));
46
+ }, F = (r) => {
47
+ r.preventDefault(), o || h(!0);
48
+ }, L = () => h(!1), W = () => {
49
+ o || m.current?.click();
50
+ }, z = (r) => {
51
+ j(r.target.files?.[0] ?? null);
52
+ }, N = (r) => {
53
+ r.stopPropagation(), k(null), D(""), c?.(null, ""), m.current && (m.current.value = "");
54
+ }, u = !!x || y && !p, B = x || (y && !p ? `${n} can't be empty` : ""), { baseName: $, extension: A } = K(O);
55
+ return /* @__PURE__ */ t(P, { fullWidth: !0, error: u, disabled: o, children: [
56
+ n && /* @__PURE__ */ e(
57
+ T,
58
+ {
59
+ required: a,
60
+ sx: {
61
+ mb: 0.75,
62
+ fontSize: 14,
63
+ fontWeight: 500,
64
+ color: "text.primary",
65
+ "& .MuiFormLabel-asterisk": { color: "error.main" },
66
+ "&.Mui-focused": { color: "text.primary" },
67
+ "&.Mui-error": { color: "text.primary" }
68
+ },
69
+ children: n
70
+ }
71
+ ),
72
+ /* @__PURE__ */ t(
73
+ i,
74
+ {
75
+ onClick: W,
76
+ onDrop: S,
77
+ onDragOver: F,
78
+ onDragLeave: L,
79
+ sx: {
80
+ border: 2,
81
+ borderStyle: "dashed",
82
+ borderColor: u ? "error.main" : v ? "primary.main" : "grey.300",
83
+ borderRadius: 2,
84
+ p: p ? 1.5 : 4,
85
+ textAlign: "center",
86
+ cursor: o ? "default" : "pointer",
87
+ bgcolor: o ? "action.disabledBackground" : v ? "primary.50" : "grey.50",
88
+ transition: "all 0.2s ease",
89
+ opacity: o ? 0.6 : 1,
90
+ "&:hover": o ? {} : {
91
+ borderColor: u ? "error.main" : "primary.main",
92
+ bgcolor: "primary.50"
93
+ }
94
+ },
95
+ children: [
96
+ /* @__PURE__ */ e(
97
+ "input",
98
+ {
99
+ ref: m,
100
+ type: "file",
101
+ accept: R,
102
+ onChange: z,
103
+ hidden: !0,
104
+ disabled: o
105
+ }
106
+ ),
107
+ p ? /* @__PURE__ */ t(U, { direction: "row", alignItems: "center", spacing: 2, children: [
108
+ /* @__PURE__ */ e(
109
+ i,
110
+ {
111
+ component: "img",
112
+ src: p,
113
+ alt: "Preview",
114
+ sx: {
115
+ width: 80,
116
+ height: 80,
117
+ objectFit: "contain",
118
+ borderRadius: 1.5,
119
+ border: 1,
120
+ borderColor: "grey.200"
121
+ }
122
+ }
123
+ ),
124
+ /* @__PURE__ */ t(i, { sx: { flex: 1, minWidth: 0, textAlign: "left" }, children: [
125
+ /* @__PURE__ */ t(
126
+ l,
127
+ {
128
+ variant: "body2",
129
+ fontWeight: 500,
130
+ sx: {
131
+ display: "flex",
132
+ minWidth: 0
133
+ },
134
+ children: [
135
+ /* @__PURE__ */ e(
136
+ i,
137
+ {
138
+ component: "span",
139
+ sx: {
140
+ overflow: "hidden",
141
+ textOverflow: "ellipsis",
142
+ whiteSpace: "nowrap",
143
+ minWidth: 0
144
+ },
145
+ children: $
146
+ }
147
+ ),
148
+ /* @__PURE__ */ e(
149
+ i,
150
+ {
151
+ component: "span",
152
+ sx: {
153
+ flexShrink: 0
154
+ },
155
+ children: A
156
+ }
157
+ )
158
+ ]
159
+ }
160
+ ),
161
+ /* @__PURE__ */ e(l, { variant: "caption", color: "text.secondary", children: "Click to replace" })
162
+ ] }),
163
+ /* @__PURE__ */ e(
164
+ V,
165
+ {
166
+ onClick: N,
167
+ size: "small",
168
+ color: "error",
169
+ sx: {
170
+ border: 1,
171
+ borderColor: "grey.200",
172
+ borderRadius: 1.5,
173
+ "&:hover": { bgcolor: "error.50", borderColor: "error.200" }
174
+ },
175
+ children: /* @__PURE__ */ e(H, { fontSize: "small" })
176
+ }
177
+ )
178
+ ] }) : /* @__PURE__ */ t(i, { children: [
179
+ /* @__PURE__ */ e(
180
+ J,
181
+ {
182
+ sx: { fontSize: 40, color: "primary.main", mb: 1.5 }
183
+ }
184
+ ),
185
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", gutterBottom: !0, children: [
186
+ "Drop image here or",
187
+ " ",
188
+ /* @__PURE__ */ e(
189
+ l,
190
+ {
191
+ component: "span",
192
+ variant: "body2",
193
+ color: "primary",
194
+ fontWeight: 600,
195
+ sx: { textDecoration: "underline" },
196
+ children: "click to browse"
197
+ }
198
+ )
199
+ ] }),
200
+ /* @__PURE__ */ t(l, { variant: "caption", color: "text.disabled", display: "block", children: [
201
+ "File size should be less than ",
202
+ d,
203
+ "MB"
204
+ ] }),
205
+ /* @__PURE__ */ t(l, { variant: "caption", color: "text.disabled", display: "block", children: [
206
+ "Supports ",
207
+ s.join(", ")
208
+ ] })
209
+ ] })
210
+ ]
211
+ }
212
+ ),
213
+ (u || b) && /* @__PURE__ */ e(E, { sx: { mt: 0.75, mx: 0 }, children: B || b })
214
+ ] });
215
+ };
216
+ export {
217
+ rr as default
218
+ };
@@ -1,17 +1,16 @@
1
- import { jsx as e, jsxs as t, Fragment as _ } from "react/jsx-runtime";
2
- import { c as B } from "../../createSvgIcon-C0YrvByi.js";
1
+ import { jsx as e, jsxs as t, Fragment as Y } from "react/jsx-runtime";
2
+ import { K as k } from "../../KeyboardArrowDown-D4mY-2qw.js";
3
+ import { c as _ } from "../../createSvgIcon-C0YrvByi.js";
3
4
  import { Box as a, Typography as u, TextField as G, Popper as J, ClickAwayListener as Q, Paper as V, InputBase as X, InputAdornment as Z, List as $, ListItemButton as ee, ListItemIcon as oe, ListItemText as re } from "@mui/material";
4
- import { useState as v, useRef as q, useEffect as ne, useMemo as te } from "react";
5
- const R = B(/* @__PURE__ */ e("path", {
6
- d: "M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"
7
- }), "KeyboardArrowDown"), ie = B(/* @__PURE__ */ e("path", {
5
+ import { useState as v, useRef as B, useEffect as ne, useMemo as te } from "react";
6
+ const ie = _(/* @__PURE__ */ e("path", {
8
7
  d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"
9
8
  }), "Search"), se = {
10
9
  iso: "PH",
11
10
  country: "Philippines",
12
11
  code: "63",
13
12
  countryCode: "PH"
14
- }, k = (n) => n.replace(/-/g, "");
13
+ }, A = (n) => n.replace(/-/g, "");
15
14
  function ce(n) {
16
15
  return n.toUpperCase().split("").map((c) => String.fromCodePoint(127397 + c.charCodeAt(0))).join("");
17
16
  }
@@ -38,19 +37,19 @@ function E({
38
37
  searchValue: r,
39
38
  onSearchChange: w,
40
39
  onSelect: x,
41
- onClose: y,
42
- showcode: m,
40
+ onClose: m,
41
+ showcode: y,
43
42
  searchPlaceholder: i = "Search country or code",
44
43
  renderFlag: d
45
44
  }) {
46
- const p = q(null);
45
+ const p = B(null);
47
46
  ne(() => {
48
47
  c && setTimeout(() => p.current?.focus(), 50);
49
48
  }, [c]);
50
49
  const f = te(() => {
51
- const o = r.toLowerCase(), C = k(o);
50
+ const o = r.toLowerCase(), C = A(o);
52
51
  return h.filter(
53
- (s) => s.country.toLowerCase().includes(o) || s.code.includes(o) || k(s.code).includes(C) || s.iso.toLowerCase().includes(o)
52
+ (s) => s.country.toLowerCase().includes(o) || s.code.includes(o) || A(s.code).includes(C) || s.iso.toLowerCase().includes(o)
54
53
  );
55
54
  }, [h, r]);
56
55
  return !c || !n ? null : /* @__PURE__ */ e(
@@ -68,7 +67,7 @@ function E({
68
67
  { name: "offset", options: { offset: [0, 4] } },
69
68
  { name: "preventOverflow", options: { boundary: "viewport" } }
70
69
  ],
71
- children: /* @__PURE__ */ e(Q, { onClickAway: y, children: /* @__PURE__ */ t(V, { elevation: 4, sx: { borderRadius: 1.5, overflow: "hidden" }, children: [
70
+ children: /* @__PURE__ */ e(Q, { onClickAway: m, children: /* @__PURE__ */ t(V, { elevation: 4, sx: { borderRadius: 1.5, overflow: "hidden" }, children: [
72
71
  /* @__PURE__ */ e(a, { sx: { px: 1.5, py: 1, borderBottom: "1px solid", borderColor: "divider" }, children: /* @__PURE__ */ e(
73
72
  X,
74
73
  {
@@ -106,7 +105,7 @@ function E({
106
105
  primaryTypographyProps: { fontSize: 14 }
107
106
  }
108
107
  ),
109
- m && /* @__PURE__ */ t(u, { variant: "body2", color: "text.secondary", sx: { ml: 1, whiteSpace: "nowrap" }, children: [
108
+ y && /* @__PURE__ */ t(u, { variant: "body2", color: "text.secondary", sx: { ml: 1, whiteSpace: "nowrap" }, children: [
110
109
  "+",
111
110
  o.code
112
111
  ] })
@@ -121,19 +120,19 @@ function E({
121
120
  }
122
121
  );
123
122
  }
124
- function pe(n) {
123
+ function fe(n) {
125
124
  const {
126
125
  mode: c,
127
126
  options: h,
128
127
  value: r = se,
129
128
  onChange: w,
130
129
  searchPlaceholder: x,
131
- error: y = !1,
132
- helperText: m,
130
+ error: m = !1,
131
+ helperText: y,
133
132
  disabled: i = !1,
134
133
  renderFlag: d = le,
135
134
  forceError: p = !1
136
- } = n, [f, o] = v(!1), [C, s] = v(""), [D, F] = v(!1), [M, S] = v(!1), b = q(null), g = M || p, P = (l) => {
135
+ } = n, [f, o] = v(!1), [C, s] = v(""), [q, F] = v(!1), [O, S] = v(!1), b = B(null), g = O || p, P = (l) => {
137
136
  w({
138
137
  iso: l.iso,
139
138
  country: l.country,
@@ -146,11 +145,11 @@ function pe(n) {
146
145
  if (c === "phone") {
147
146
  const {
148
147
  phoneNumber: l,
149
- onPhoneChange: O,
150
- phoneError: W,
151
- phoneHelperText: j,
152
- forcePhoneError: N = !1
153
- } = n, L = D || N || p, K = W || L && !l.trim(), A = j || (L && !l.trim() ? "Phone number is required" : void 0), U = y || g && !r.iso, H = m || (g && !r.iso ? "Country is required" : void 0);
148
+ onPhoneChange: W,
149
+ phoneError: j,
150
+ phoneHelperText: D,
151
+ forcePhoneError: M = !1
152
+ } = n, H = q || M || p, N = j || H && !l.trim(), L = D || (H && !l.trim() ? "Phone number is required" : void 0), K = m || g && !r.iso, R = y || (g && !r.iso ? "Country is required" : void 0);
154
153
  return /* @__PURE__ */ t(a, { sx: { position: "relative" }, children: [
155
154
  /* @__PURE__ */ t(a, { sx: { display: "flex" }, children: [
156
155
  /* @__PURE__ */ t(
@@ -167,7 +166,7 @@ function pe(n) {
167
166
  px: 1.5,
168
167
  height: 40,
169
168
  border: "1px solid",
170
- borderColor: U ? "error.main" : "rgba(0,0,0,0.23)",
169
+ borderColor: K ? "error.main" : "rgba(0,0,0,0.23)",
171
170
  borderRight: "none",
172
171
  borderRadius: "4px 0 0 4px",
173
172
  cursor: i ? "default" : "pointer",
@@ -179,7 +178,7 @@ function pe(n) {
179
178
  outline: "none"
180
179
  },
181
180
  children: [
182
- r.iso && /* @__PURE__ */ t(_, { children: [
181
+ r.iso && /* @__PURE__ */ t(Y, { children: [
183
182
  d(r.iso),
184
183
  /* @__PURE__ */ t(u, { variant: "body2", sx: { whiteSpace: "nowrap" }, children: [
185
184
  "+",
@@ -187,7 +186,7 @@ function pe(n) {
187
186
  ] })
188
187
  ] }),
189
188
  /* @__PURE__ */ e(
190
- R,
189
+ k,
191
190
  {
192
191
  fontSize: "small",
193
192
  sx: { ml: "auto", color: "action.active" }
@@ -203,10 +202,10 @@ function pe(n) {
203
202
  size: "small",
204
203
  type: "tel",
205
204
  value: l,
206
- onChange: (Y) => O(Y.target.value),
205
+ onChange: (U) => W(U.target.value),
207
206
  onBlur: () => F(!0),
208
207
  disabled: i,
209
- error: K,
208
+ error: N,
210
209
  sx: {
211
210
  "& .MuiOutlinedInput-root": {
212
211
  borderRadius: "0 4px 4px 0"
@@ -215,13 +214,13 @@ function pe(n) {
215
214
  }
216
215
  )
217
216
  ] }),
218
- (H || A) && /* @__PURE__ */ e(
217
+ (R || L) && /* @__PURE__ */ e(
219
218
  u,
220
219
  {
221
220
  variant: "caption",
222
221
  color: "error",
223
222
  sx: { display: "block", mt: 0.5, ml: 0 },
224
- children: H || A
223
+ children: R || L
225
224
  }
226
225
  ),
227
226
  /* @__PURE__ */ e(
@@ -241,7 +240,7 @@ function pe(n) {
241
240
  )
242
241
  ] });
243
242
  }
244
- const T = y || g && !r.iso, z = m || (g && !r.iso ? "Country is required" : void 0);
243
+ const T = m || g && !r.iso, z = y || (g && !r.iso ? "Country is required" : void 0);
245
244
  return /* @__PURE__ */ t(a, { sx: { position: "relative" }, children: [
246
245
  /* @__PURE__ */ t(
247
246
  a,
@@ -274,7 +273,7 @@ function pe(n) {
274
273
  children: r.country ?? "Select country"
275
274
  }
276
275
  ),
277
- /* @__PURE__ */ e(R, { fontSize: "small", sx: { color: "action.active" } })
276
+ /* @__PURE__ */ e(k, { fontSize: "small", sx: { color: "action.active" } })
278
277
  ]
279
278
  }
280
279
  ),
@@ -298,5 +297,5 @@ function pe(n) {
298
297
  }
299
298
  export {
300
299
  se as PH_DEFAULT,
301
- pe as PhoneAndCountryDropdown
300
+ fe as PhoneAndCountryDropdown
302
301
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fangzsx/component-library",
3
3
  "author": "Jay Gilbert Garzon",
4
4
  "private": false,
5
- "version": "0.0.35",
5
+ "version": "0.0.37",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",