@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 x, jsx as l } from "react/jsx-runtime";
2
- import { FormControl as G, FormGroup as I, FormControlLabel as y, Checkbox as B, FormHelperText as f } from "@mui/material";
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 P({
4
+ function S({
5
5
  options: c,
6
- required: p = !1,
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: b,
13
- forceError: h = !1
12
+ sx: h,
13
+ forceError: g = !1,
14
+ disabled: f = !1
14
15
  }) {
15
- const [n, g] = d(
16
+ const [n, F] = d(
16
17
  c.reduce((e, t) => ({
17
18
  ...e,
18
19
  [t.name]: t.defaultChecked || !1
19
20
  }), {})
20
- ), [F, v] = d(!1), j = (e) => {
21
- v(!0);
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
- g(t);
27
- const M = Object.keys(t).filter(
28
- ($) => t[$]
27
+ F(t);
28
+ const $ = Object.keys(t).filter(
29
+ (x) => t[x]
29
30
  );
30
- u && u(M);
31
- }, a = Object.values(n).filter(Boolean).length, s = h || F && (r !== void 0 && a < r || o !== void 0 && a > o), L = () => 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" : ""}` : "");
32
- return /* @__PURE__ */ x(
33
- G,
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: p,
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
- ...b
52
+ ...h
51
53
  },
52
54
  variant: "standard",
53
55
  children: [
54
- /* @__PURE__ */ l(I, { children: c.map((e) => /* @__PURE__ */ l(
55
- y,
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
- B,
66
+ C,
65
67
  {
66
68
  checked: n[e.name] || !1,
67
- onChange: j,
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(f, { children: L() }) : i ? /* @__PURE__ */ l(f, { children: i }) : null
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
- P as CheckboxGroup
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 f, jsxs as de } from "react/jsx-runtime";
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 p } from "../../useSlot-DKccmcQE.js";
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: i
21
+ classes: a
22
22
  } = s;
23
23
  return ye({
24
24
  root: ["root"]
25
- }, je, i);
25
+ }, je, a);
26
26
  }, He = xe(Se, {
27
27
  name: "MuiTextField",
28
28
  slot: "Root"
29
- })({}), q = /* @__PURE__ */ me.forwardRef(function(i, a) {
30
- const b = Te({
31
- props: i,
29
+ })({}), q = /* @__PURE__ */ me.forwardRef(function(a, u) {
30
+ const T = Te({
31
+ props: a,
32
32
  name: "MuiTextField"
33
33
  }), {
34
- autoComplete: g,
35
- autoFocus: T = !1,
36
- children: u,
37
- className: O,
38
- color: h = "primary",
39
- defaultValue: c,
40
- disabled: x = !1,
41
- error: y = !1,
42
- FormHelperTextProps: w,
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: d,
45
- id: L,
46
- InputLabelProps: S,
47
- inputProps: C,
48
- InputProps: j,
49
- inputRef: R,
44
+ helperText: p,
45
+ id: S,
46
+ InputLabelProps: C,
47
+ inputProps: j,
48
+ InputProps: R,
49
+ inputRef: v,
50
50
  label: t,
51
- maxRows: v,
52
- minRows: P,
53
- multiline: N = !1,
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: I = !1,
62
- SelectProps: H,
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: F = "outlined",
67
+ variant: g = "outlined",
68
68
  ...X
69
- } = b, o = {
70
- ...b,
71
- autoFocus: T,
72
- color: h,
73
- disabled: x,
74
- error: y,
69
+ } = T, o = {
70
+ ...T,
71
+ autoFocus: h,
72
+ color: x,
73
+ disabled: y,
74
+ error: P,
75
75
  fullWidth: l,
76
- multiline: N,
76
+ multiline: m,
77
77
  required: V,
78
- select: I,
79
- variant: F
78
+ select: F,
79
+ variant: g
80
80
  }, Y = ve(o);
81
- process.env.NODE_ENV !== "production" && I && !u && console.error("MUI: `children` must be passed when using the `TextField` component with `select`.");
82
- const n = Pe(L), M = d && n ? `${n}-helper-text` : void 0, k = t && n ? `${n}-label` : void 0, Z = Re[F], r = {
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: j,
86
- inputLabel: S,
87
- htmlInput: C,
88
- formHelperText: w,
89
- select: H,
85
+ input: R,
86
+ inputLabel: C,
87
+ htmlInput: j,
88
+ formHelperText: L,
89
+ select: M,
90
90
  ...K
91
91
  }
92
- }, m = {}, E = r.slotProps.inputLabel;
93
- F === "outlined" && (E && typeof E.shrink < "u" && (m.notched = E.shrink), m.label = t), I && ((!H || !H.native) && (m.id = void 0), m["aria-describedby"] = void 0);
94
- const [ee, te] = p("root", {
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, O),
103
- ref: a,
102
+ className: he(Y.root, w),
103
+ ref: u,
104
104
  additionalProps: {
105
- disabled: x,
106
- error: y,
105
+ disabled: y,
106
+ error: P,
107
107
  fullWidth: l,
108
108
  required: V,
109
- color: h,
110
- variant: F
109
+ color: x,
110
+ variant: g
111
111
  }
112
- }), [oe, ne] = p("input", {
112
+ }), [oe, ne] = i("input", {
113
113
  elementType: Z,
114
114
  externalForwardedProps: r,
115
- additionalProps: m,
115
+ additionalProps: f,
116
116
  ownerState: o
117
- }), [re, se] = p("inputLabel", {
117
+ }), [re, se] = i("inputLabel", {
118
118
  elementType: Oe,
119
119
  externalForwardedProps: r,
120
120
  ownerState: o
121
- }), [le, pe] = p("htmlInput", {
121
+ }), [le, pe] = i("htmlInput", {
122
122
  elementType: "input",
123
123
  externalForwardedProps: r,
124
124
  ownerState: o
125
- }), [ie, ae] = p("formHelperText", {
125
+ }), [ie, ae] = i("formHelperText", {
126
126
  elementType: Le,
127
127
  externalForwardedProps: r,
128
128
  ownerState: o
129
- }), [ue, ce] = p("select", {
129
+ }), [ue, ce] = i("select", {
130
130
  elementType: we,
131
131
  externalForwardedProps: r,
132
132
  ownerState: o
133
- }), W = /* @__PURE__ */ f(oe, {
134
- "aria-describedby": M,
135
- autoComplete: g,
136
- autoFocus: T,
137
- defaultValue: c,
133
+ }), W = /* @__PURE__ */ b(oe, {
134
+ "aria-describedby": E,
135
+ autoComplete: O,
136
+ autoFocus: h,
137
+ defaultValue: d,
138
138
  fullWidth: l,
139
- multiline: N,
139
+ multiline: m,
140
140
  name: _,
141
141
  rows: J,
142
- maxRows: v,
143
- minRows: P,
142
+ maxRows: I,
143
+ minRows: H,
144
144
  type: Q,
145
145
  value: U,
146
146
  id: n,
147
- inputRef: R,
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__ */ f(re, {
160
+ children: [t != null && t !== "" && /* @__PURE__ */ b(re, {
161
161
  htmlFor: n,
162
162
  id: k,
163
163
  ...se,
164
164
  children: t
165
- }), I ? /* @__PURE__ */ f(ue, {
166
- "aria-describedby": M,
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: u
173
- }) : W, d && /* @__PURE__ */ f(ie, {
174
- id: M,
172
+ children: c
173
+ }) : W, p && /* @__PURE__ */ b(ie, {
174
+ id: E,
175
175
  ...ae,
176
- children: d
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: i,
385
- required: a = !1,
386
- errorMessage: b = "This field is required",
387
- helperText: g,
388
- variant: T = "outlined",
389
- onChange: u,
390
- defaultValue: O = "",
391
- type: h = "text",
392
- multiline: c = !1,
393
- rows: x,
394
- sx: y,
395
- forceError: w = !1
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 [l, d] = D(O), [L, S] = D(!1), C = (v) => {
398
- const P = v.target.value;
399
- d(P), u && u(P);
400
- }, j = () => {
401
- S(!0);
402
- }, R = String(l || "").trim() === "", t = w || L && a && R;
403
- return /* @__PURE__ */ f(
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: i,
408
- value: l,
409
- onChange: C,
410
- onBlur: j,
411
- error: t,
412
- helperText: t ? b : g || " ",
413
- variant: T,
414
- required: a,
415
- type: h,
416
- multiline: c,
417
- rows: x,
418
- InputLabelProps: {
419
- shrink: !0
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: c ? "auto" : 40
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: c ? "8.5px 14px" : "8px 14px"
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
- ...y
444
+ ...P
443
445
  },
444
446
  fullWidth: !0
445
447
  }
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.41",
5
+ "version": "0.0.42",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",