@fangzsx/component-library 0.0.41 → 0.0.42
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.
|
@@ -14,5 +14,6 @@ export interface CheckboxGroupProps {
|
|
|
14
14
|
onChange?: (checkedValues: string[]) => void;
|
|
15
15
|
sx?: any;
|
|
16
16
|
forceError?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
17
18
|
}
|
|
18
|
-
export declare function CheckboxGroup({ options, required, minChecked, maxChecked, errorMessage, helperText, onChange, sx, forceError, }: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function CheckboxGroup({ options, required, minChecked, maxChecked, errorMessage, helperText, onChange, sx, forceError, disabled, }: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { FormControl as
|
|
1
|
+
import { jsxs as G, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { FormControl as I, FormGroup as y, FormControlLabel as B, Checkbox as C, FormHelperText as p } from "@mui/material";
|
|
3
3
|
import { useState as d } from "react";
|
|
4
|
-
function
|
|
4
|
+
function S({
|
|
5
5
|
options: c,
|
|
6
|
-
required:
|
|
6
|
+
required: b = !1,
|
|
7
7
|
minChecked: r,
|
|
8
8
|
maxChecked: o,
|
|
9
9
|
errorMessage: m,
|
|
10
10
|
helperText: i,
|
|
11
11
|
onChange: u,
|
|
12
|
-
sx:
|
|
13
|
-
forceError:
|
|
12
|
+
sx: h,
|
|
13
|
+
forceError: g = !1,
|
|
14
|
+
disabled: f = !1
|
|
14
15
|
}) {
|
|
15
|
-
const [n,
|
|
16
|
+
const [n, F] = d(
|
|
16
17
|
c.reduce((e, t) => ({
|
|
17
18
|
...e,
|
|
18
19
|
[t.name]: t.defaultChecked || !1
|
|
19
20
|
}), {})
|
|
20
|
-
), [
|
|
21
|
-
|
|
21
|
+
), [v, j] = d(!1), L = (e) => {
|
|
22
|
+
j(!0);
|
|
22
23
|
const t = {
|
|
23
24
|
...n,
|
|
24
25
|
[e.target.name]: e.target.checked
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
(
|
|
27
|
+
F(t);
|
|
28
|
+
const $ = Object.keys(t).filter(
|
|
29
|
+
(x) => t[x]
|
|
29
30
|
);
|
|
30
|
-
u && u(
|
|
31
|
-
}, a = Object.values(n).filter(Boolean).length, s =
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
|
|
31
|
+
u && u($);
|
|
32
|
+
}, a = Object.values(n).filter(Boolean).length, s = !f && (g || v && (r !== void 0 && a < r || o !== void 0 && a > o)), M = () => m || (r !== void 0 && a < r ? `Please select at least ${r} option${r > 1 ? "s" : ""}` : o !== void 0 && a > o ? `Please select no more than ${o} option${o > 1 ? "s" : ""}` : "");
|
|
33
|
+
return /* @__PURE__ */ G(
|
|
34
|
+
I,
|
|
34
35
|
{
|
|
35
|
-
required:
|
|
36
|
+
required: b,
|
|
36
37
|
error: s,
|
|
38
|
+
disabled: f,
|
|
37
39
|
component: "fieldset",
|
|
38
40
|
sx: {
|
|
39
41
|
m: 0,
|
|
@@ -47,12 +49,12 @@ function P({
|
|
|
47
49
|
"& .MuiFormControlLabel-label": {
|
|
48
50
|
margin: "0 !important"
|
|
49
51
|
},
|
|
50
|
-
...
|
|
52
|
+
...h
|
|
51
53
|
},
|
|
52
54
|
variant: "standard",
|
|
53
55
|
children: [
|
|
54
|
-
/* @__PURE__ */ l(
|
|
55
|
-
|
|
56
|
+
/* @__PURE__ */ l(y, { children: c.map((e) => /* @__PURE__ */ l(
|
|
57
|
+
B,
|
|
56
58
|
{
|
|
57
59
|
sx: {
|
|
58
60
|
color: "#404A58",
|
|
@@ -61,10 +63,10 @@ function P({
|
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
65
|
control: /* @__PURE__ */ l(
|
|
64
|
-
|
|
66
|
+
C,
|
|
65
67
|
{
|
|
66
68
|
checked: n[e.name] || !1,
|
|
67
|
-
onChange:
|
|
69
|
+
onChange: L,
|
|
68
70
|
name: e.name,
|
|
69
71
|
color: s ? "error" : "primary"
|
|
70
72
|
}
|
|
@@ -73,11 +75,11 @@ function P({
|
|
|
73
75
|
},
|
|
74
76
|
e.name
|
|
75
77
|
)) }),
|
|
76
|
-
s ? /* @__PURE__ */ l(
|
|
78
|
+
s ? /* @__PURE__ */ l(p, { children: M() }) : i ? /* @__PURE__ */ l(p, { children: i }) : null
|
|
77
79
|
]
|
|
78
80
|
}
|
|
79
81
|
);
|
|
80
82
|
}
|
|
81
83
|
export {
|
|
82
|
-
|
|
84
|
+
S as CheckboxGroup
|
|
83
85
|
};
|
|
@@ -12,5 +12,6 @@ export interface TextFieldInputProps {
|
|
|
12
12
|
rows?: number;
|
|
13
13
|
sx?: any;
|
|
14
14
|
forceError?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
15
16
|
}
|
|
16
|
-
export declare function TextFieldInput({ label, placeholder, required, errorMessage, helperText, variant, onChange, defaultValue, type, multiline, rows, sx, forceError, }: TextFieldInputProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function TextFieldInput({ label, placeholder, required, errorMessage, helperText, variant, onChange, defaultValue, type, multiline, rows, sx, forceError, disabled, }: TextFieldInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as b, jsxs as de } from "react/jsx-runtime";
|
|
2
2
|
import * as me from "react";
|
|
3
3
|
import { useState as D } from "react";
|
|
4
4
|
import { g as fe, a as be, P as e } from "../../generateUtilityClasses-BCID9NF1.js";
|
|
5
5
|
import { u as Te, c as he, s as xe, a as ye } from "../../DefaultPropsProvider-DVX_ssOt.js";
|
|
6
|
-
import { u as
|
|
6
|
+
import { u as i } from "../../useSlot-DKccmcQE.js";
|
|
7
7
|
import { u as Pe } from "../../useId-CK6Kn3Tn.js";
|
|
8
8
|
import { O as Ie, F as Fe, I as ge, a as Oe, S as we } from "../../Select-BSsJnv6h.js";
|
|
9
9
|
import { F as Le, a as Se } from "../../FormHelperText-B-xlmRr4.js";
|
|
@@ -18,39 +18,39 @@ const Re = {
|
|
|
18
18
|
outlined: Ie
|
|
19
19
|
}, ve = (s) => {
|
|
20
20
|
const {
|
|
21
|
-
classes:
|
|
21
|
+
classes: a
|
|
22
22
|
} = s;
|
|
23
23
|
return ye({
|
|
24
24
|
root: ["root"]
|
|
25
|
-
}, je,
|
|
25
|
+
}, je, a);
|
|
26
26
|
}, He = xe(Se, {
|
|
27
27
|
name: "MuiTextField",
|
|
28
28
|
slot: "Root"
|
|
29
|
-
})({}), q = /* @__PURE__ */ me.forwardRef(function(
|
|
30
|
-
const
|
|
31
|
-
props:
|
|
29
|
+
})({}), q = /* @__PURE__ */ me.forwardRef(function(a, u) {
|
|
30
|
+
const T = Te({
|
|
31
|
+
props: a,
|
|
32
32
|
name: "MuiTextField"
|
|
33
33
|
}), {
|
|
34
|
-
autoComplete:
|
|
35
|
-
autoFocus:
|
|
36
|
-
children:
|
|
37
|
-
className:
|
|
38
|
-
color:
|
|
39
|
-
defaultValue:
|
|
40
|
-
disabled:
|
|
41
|
-
error:
|
|
42
|
-
FormHelperTextProps:
|
|
34
|
+
autoComplete: O,
|
|
35
|
+
autoFocus: h = !1,
|
|
36
|
+
children: c,
|
|
37
|
+
className: w,
|
|
38
|
+
color: x = "primary",
|
|
39
|
+
defaultValue: d,
|
|
40
|
+
disabled: y = !1,
|
|
41
|
+
error: P = !1,
|
|
42
|
+
FormHelperTextProps: L,
|
|
43
43
|
fullWidth: l = !1,
|
|
44
|
-
helperText:
|
|
45
|
-
id:
|
|
46
|
-
InputLabelProps:
|
|
47
|
-
inputProps:
|
|
48
|
-
InputProps:
|
|
49
|
-
inputRef:
|
|
44
|
+
helperText: p,
|
|
45
|
+
id: S,
|
|
46
|
+
InputLabelProps: C,
|
|
47
|
+
inputProps: j,
|
|
48
|
+
InputProps: R,
|
|
49
|
+
inputRef: v,
|
|
50
50
|
label: t,
|
|
51
|
-
maxRows:
|
|
52
|
-
minRows:
|
|
53
|
-
multiline:
|
|
51
|
+
maxRows: I,
|
|
52
|
+
minRows: H,
|
|
53
|
+
multiline: m = !1,
|
|
54
54
|
name: _,
|
|
55
55
|
onBlur: $,
|
|
56
56
|
onChange: z,
|
|
@@ -58,40 +58,40 @@ const Re = {
|
|
|
58
58
|
placeholder: G,
|
|
59
59
|
required: V = !1,
|
|
60
60
|
rows: J,
|
|
61
|
-
select:
|
|
62
|
-
SelectProps:
|
|
61
|
+
select: F = !1,
|
|
62
|
+
SelectProps: M,
|
|
63
63
|
slots: B = {},
|
|
64
64
|
slotProps: K = {},
|
|
65
65
|
type: Q,
|
|
66
66
|
value: U,
|
|
67
|
-
variant:
|
|
67
|
+
variant: g = "outlined",
|
|
68
68
|
...X
|
|
69
|
-
} =
|
|
70
|
-
...
|
|
71
|
-
autoFocus:
|
|
72
|
-
color:
|
|
73
|
-
disabled:
|
|
74
|
-
error:
|
|
69
|
+
} = T, o = {
|
|
70
|
+
...T,
|
|
71
|
+
autoFocus: h,
|
|
72
|
+
color: x,
|
|
73
|
+
disabled: y,
|
|
74
|
+
error: P,
|
|
75
75
|
fullWidth: l,
|
|
76
|
-
multiline:
|
|
76
|
+
multiline: m,
|
|
77
77
|
required: V,
|
|
78
|
-
select:
|
|
79
|
-
variant:
|
|
78
|
+
select: F,
|
|
79
|
+
variant: g
|
|
80
80
|
}, Y = ve(o);
|
|
81
|
-
process.env.NODE_ENV !== "production" &&
|
|
82
|
-
const n = Pe(
|
|
81
|
+
process.env.NODE_ENV !== "production" && F && !c && console.error("MUI: `children` must be passed when using the `TextField` component with `select`.");
|
|
82
|
+
const n = Pe(S), E = p && n ? `${n}-helper-text` : void 0, k = t && n ? `${n}-label` : void 0, Z = Re[g], r = {
|
|
83
83
|
slots: B,
|
|
84
84
|
slotProps: {
|
|
85
|
-
input:
|
|
86
|
-
inputLabel:
|
|
87
|
-
htmlInput:
|
|
88
|
-
formHelperText:
|
|
89
|
-
select:
|
|
85
|
+
input: R,
|
|
86
|
+
inputLabel: C,
|
|
87
|
+
htmlInput: j,
|
|
88
|
+
formHelperText: L,
|
|
89
|
+
select: M,
|
|
90
90
|
...K
|
|
91
91
|
}
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
const [ee, te] =
|
|
92
|
+
}, f = {}, N = r.slotProps.inputLabel;
|
|
93
|
+
g === "outlined" && (N && typeof N.shrink < "u" && (f.notched = N.shrink), f.label = t), F && ((!M || !M.native) && (f.id = void 0), f["aria-describedby"] = void 0);
|
|
94
|
+
const [ee, te] = i("root", {
|
|
95
95
|
elementType: He,
|
|
96
96
|
shouldForwardComponentProp: !0,
|
|
97
97
|
externalForwardedProps: {
|
|
@@ -99,52 +99,52 @@ const Re = {
|
|
|
99
99
|
...X
|
|
100
100
|
},
|
|
101
101
|
ownerState: o,
|
|
102
|
-
className: he(Y.root,
|
|
103
|
-
ref:
|
|
102
|
+
className: he(Y.root, w),
|
|
103
|
+
ref: u,
|
|
104
104
|
additionalProps: {
|
|
105
|
-
disabled:
|
|
106
|
-
error:
|
|
105
|
+
disabled: y,
|
|
106
|
+
error: P,
|
|
107
107
|
fullWidth: l,
|
|
108
108
|
required: V,
|
|
109
|
-
color:
|
|
110
|
-
variant:
|
|
109
|
+
color: x,
|
|
110
|
+
variant: g
|
|
111
111
|
}
|
|
112
|
-
}), [oe, ne] =
|
|
112
|
+
}), [oe, ne] = i("input", {
|
|
113
113
|
elementType: Z,
|
|
114
114
|
externalForwardedProps: r,
|
|
115
|
-
additionalProps:
|
|
115
|
+
additionalProps: f,
|
|
116
116
|
ownerState: o
|
|
117
|
-
}), [re, se] =
|
|
117
|
+
}), [re, se] = i("inputLabel", {
|
|
118
118
|
elementType: Oe,
|
|
119
119
|
externalForwardedProps: r,
|
|
120
120
|
ownerState: o
|
|
121
|
-
}), [le, pe] =
|
|
121
|
+
}), [le, pe] = i("htmlInput", {
|
|
122
122
|
elementType: "input",
|
|
123
123
|
externalForwardedProps: r,
|
|
124
124
|
ownerState: o
|
|
125
|
-
}), [ie, ae] =
|
|
125
|
+
}), [ie, ae] = i("formHelperText", {
|
|
126
126
|
elementType: Le,
|
|
127
127
|
externalForwardedProps: r,
|
|
128
128
|
ownerState: o
|
|
129
|
-
}), [ue, ce] =
|
|
129
|
+
}), [ue, ce] = i("select", {
|
|
130
130
|
elementType: we,
|
|
131
131
|
externalForwardedProps: r,
|
|
132
132
|
ownerState: o
|
|
133
|
-
}), W = /* @__PURE__ */
|
|
134
|
-
"aria-describedby":
|
|
135
|
-
autoComplete:
|
|
136
|
-
autoFocus:
|
|
137
|
-
defaultValue:
|
|
133
|
+
}), W = /* @__PURE__ */ b(oe, {
|
|
134
|
+
"aria-describedby": E,
|
|
135
|
+
autoComplete: O,
|
|
136
|
+
autoFocus: h,
|
|
137
|
+
defaultValue: d,
|
|
138
138
|
fullWidth: l,
|
|
139
|
-
multiline:
|
|
139
|
+
multiline: m,
|
|
140
140
|
name: _,
|
|
141
141
|
rows: J,
|
|
142
|
-
maxRows:
|
|
143
|
-
minRows:
|
|
142
|
+
maxRows: I,
|
|
143
|
+
minRows: H,
|
|
144
144
|
type: Q,
|
|
145
145
|
value: U,
|
|
146
146
|
id: n,
|
|
147
|
-
inputRef:
|
|
147
|
+
inputRef: v,
|
|
148
148
|
onBlur: $,
|
|
149
149
|
onChange: z,
|
|
150
150
|
onFocus: A,
|
|
@@ -157,23 +157,23 @@ const Re = {
|
|
|
157
157
|
});
|
|
158
158
|
return /* @__PURE__ */ de(ee, {
|
|
159
159
|
...te,
|
|
160
|
-
children: [t != null && t !== "" && /* @__PURE__ */
|
|
160
|
+
children: [t != null && t !== "" && /* @__PURE__ */ b(re, {
|
|
161
161
|
htmlFor: n,
|
|
162
162
|
id: k,
|
|
163
163
|
...se,
|
|
164
164
|
children: t
|
|
165
|
-
}),
|
|
166
|
-
"aria-describedby":
|
|
165
|
+
}), F ? /* @__PURE__ */ b(ue, {
|
|
166
|
+
"aria-describedby": E,
|
|
167
167
|
id: n,
|
|
168
168
|
labelId: k,
|
|
169
169
|
value: U,
|
|
170
170
|
input: W,
|
|
171
171
|
...ce,
|
|
172
|
-
children:
|
|
173
|
-
}) : W,
|
|
174
|
-
id:
|
|
172
|
+
children: c
|
|
173
|
+
}) : W, p && /* @__PURE__ */ b(ie, {
|
|
174
|
+
id: E,
|
|
175
175
|
...ae,
|
|
176
|
-
children:
|
|
176
|
+
children: p
|
|
177
177
|
})]
|
|
178
178
|
});
|
|
179
179
|
});
|
|
@@ -381,46 +381,48 @@ process.env.NODE_ENV !== "production" && (q.propTypes = {
|
|
|
381
381
|
});
|
|
382
382
|
function qe({
|
|
383
383
|
label: s,
|
|
384
|
-
placeholder:
|
|
385
|
-
required:
|
|
386
|
-
errorMessage:
|
|
387
|
-
helperText:
|
|
388
|
-
variant:
|
|
389
|
-
onChange:
|
|
390
|
-
defaultValue:
|
|
391
|
-
type:
|
|
392
|
-
multiline:
|
|
393
|
-
rows:
|
|
394
|
-
sx:
|
|
395
|
-
forceError:
|
|
384
|
+
placeholder: a,
|
|
385
|
+
required: u = !1,
|
|
386
|
+
errorMessage: T = "This field is required",
|
|
387
|
+
helperText: O,
|
|
388
|
+
variant: h = "outlined",
|
|
389
|
+
onChange: c,
|
|
390
|
+
defaultValue: w = "",
|
|
391
|
+
type: x = "text",
|
|
392
|
+
multiline: d = !1,
|
|
393
|
+
rows: y,
|
|
394
|
+
sx: P,
|
|
395
|
+
forceError: L = !1,
|
|
396
|
+
disabled: l = !1
|
|
396
397
|
}) {
|
|
397
|
-
const [
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
},
|
|
401
|
-
|
|
402
|
-
},
|
|
403
|
-
return /* @__PURE__ */
|
|
398
|
+
const [p, S] = D(w), [C, j] = D(!1), R = (H) => {
|
|
399
|
+
const m = H.target.value;
|
|
400
|
+
S(m), c && c(m);
|
|
401
|
+
}, v = () => {
|
|
402
|
+
j(!0);
|
|
403
|
+
}, t = String(p || "").trim() === "", I = !l && (L || C && u && t);
|
|
404
|
+
return /* @__PURE__ */ b(
|
|
404
405
|
q,
|
|
405
406
|
{
|
|
406
407
|
label: s,
|
|
407
|
-
placeholder:
|
|
408
|
-
value:
|
|
409
|
-
onChange:
|
|
410
|
-
onBlur:
|
|
411
|
-
error:
|
|
412
|
-
helperText:
|
|
413
|
-
variant:
|
|
414
|
-
required:
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
408
|
+
placeholder: a,
|
|
409
|
+
value: p,
|
|
410
|
+
onChange: R,
|
|
411
|
+
onBlur: v,
|
|
412
|
+
error: I,
|
|
413
|
+
helperText: I ? T : O || " ",
|
|
414
|
+
variant: h,
|
|
415
|
+
required: u,
|
|
416
|
+
disabled: l,
|
|
417
|
+
type: x,
|
|
418
|
+
multiline: d,
|
|
419
|
+
rows: y,
|
|
420
|
+
slotProps: {
|
|
421
|
+
inputLabel: { shrink: !0 }
|
|
420
422
|
},
|
|
421
423
|
sx: {
|
|
422
424
|
"& .MuiInputBase-root": {
|
|
423
|
-
height:
|
|
425
|
+
height: d ? "auto" : 40
|
|
424
426
|
},
|
|
425
427
|
"& .MuiInputLabel-root": {
|
|
426
428
|
transform: "translate(14px, -9px) scale(0.75)",
|
|
@@ -429,7 +431,7 @@ function qe({
|
|
|
429
431
|
}
|
|
430
432
|
},
|
|
431
433
|
"& .MuiOutlinedInput-input": {
|
|
432
|
-
padding:
|
|
434
|
+
padding: d ? "8.5px 14px" : "8px 14px"
|
|
433
435
|
},
|
|
434
436
|
"& .MuiFormHelperText-root": {
|
|
435
437
|
marginLeft: 0,
|
|
@@ -439,7 +441,7 @@ function qe({
|
|
|
439
441
|
border: "none !important",
|
|
440
442
|
outline: "none !important"
|
|
441
443
|
},
|
|
442
|
-
...
|
|
444
|
+
...P
|
|
443
445
|
},
|
|
444
446
|
fullWidth: !0
|
|
445
447
|
}
|