@fangzsx/component-library 0.0.14 → 0.0.16

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.
Files changed (27) hide show
  1. package/dist/{ButtonBase-qMhxbNdC.js → ButtonBase-DxZEqM87.js} +15 -14
  2. package/dist/{FormLabel-DKoCtSGZ.js → FormLabel-DLyFlUyL.js} +7 -6
  3. package/dist/{Paper-DyRh03We.js → Paper-DZg6u5tT.js} +50 -77
  4. package/dist/{SwitchBase-DStPyUhD.js → SwitchBase-BPRcMkqu.js} +23 -21
  5. package/dist/{Typography-B0rSrz7H.js → Typography-DMROEdKW.js} +5 -4
  6. package/dist/components/AppBarPublic/index.js +8 -7
  7. package/dist/components/Button/index.js +1 -1
  8. package/dist/components/Checkbox/index.js +23 -22
  9. package/dist/components/CheckboxGroup/index.js +47 -34
  10. package/dist/components/MediaCardWithAction/index.js +7 -6
  11. package/dist/components/RadioButtonGroup/index.js +20 -18
  12. package/dist/components/Stepper/index.d.ts +11 -0
  13. package/dist/components/Stepper/index.js +607 -0
  14. package/dist/components/TextFieldInput/index.js +503 -482
  15. package/dist/{createSvgIcon-Dj0SJuc1.js → createSvgIcon-ChKzptBc.js} +2 -1
  16. package/dist/{index-o1i1vy-V.js → index-1CH5DDiw.js} +1 -1
  17. package/dist/{index-CoBGCD2e.js → index-B08hLYdM.js} +24 -23
  18. package/dist/integerPropType-BihGt2aU.js +31 -0
  19. package/dist/main.d.ts +1 -0
  20. package/dist/main.js +7 -5
  21. package/dist/{mergeSlotProps-C-n2ing7.js → mergeSlotProps-CADAqXOb.js} +1 -1
  22. package/dist/{useTimeout-BWi4JTOH.js → useForkRef-gLJikozA.js} +170 -277
  23. package/dist/useFormControl-BGLuGvqS.js +38 -0
  24. package/dist/useSlot-jPRhj-MO.js +125 -0
  25. package/dist/useTimeout-DmOXPFt0.js +111 -0
  26. package/package.json +1 -1
  27. package/dist/useSlot-S2pEBHE8.js +0 -161
@@ -0,0 +1,38 @@
1
+ import * as e from "react";
2
+ function m(c) {
3
+ const {
4
+ controlled: n,
5
+ default: r,
6
+ name: o,
7
+ state: s = "value"
8
+ } = c, {
9
+ current: t
10
+ } = e.useRef(n !== void 0), [u, a] = e.useState(r), d = t ? n : u;
11
+ if (process.env.NODE_ENV !== "production") {
12
+ e.useEffect(() => {
13
+ t !== (n !== void 0) && console.error([`MUI: A component is changing the ${t ? "" : "un"}controlled ${s} state of ${o} to be ${t ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${o} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
14
+ `));
15
+ }, [s, o, n]);
16
+ const {
17
+ current: l
18
+ } = e.useRef(r);
19
+ e.useEffect(() => {
20
+ !t && JSON.stringify(r) !== JSON.stringify(l) && console.error([`MUI: A component is changing the default ${s} state of an uncontrolled ${o} after being initialized. To suppress this warning opt to use a controlled ${o}.`].join(`
21
+ `));
22
+ }, [JSON.stringify(r)]);
23
+ }
24
+ const f = e.useCallback((l) => {
25
+ t || a(l);
26
+ }, []);
27
+ return [d, f];
28
+ }
29
+ const i = /* @__PURE__ */ e.createContext(void 0);
30
+ process.env.NODE_ENV !== "production" && (i.displayName = "FormControlContext");
31
+ function p() {
32
+ return e.useContext(i);
33
+ }
34
+ export {
35
+ i as F,
36
+ p as a,
37
+ m as u
38
+ };
@@ -0,0 +1,125 @@
1
+ import { c as S, b as x } from "./useForkRef-gLJikozA.js";
2
+ function v(e) {
3
+ return typeof e == "string";
4
+ }
5
+ function E(e, n, t) {
6
+ return e === void 0 || v(e) ? n : {
7
+ ...n,
8
+ ownerState: {
9
+ ...n.ownerState,
10
+ ...t
11
+ }
12
+ };
13
+ }
14
+ function F(e, n, t) {
15
+ return typeof e == "function" ? e(n, t) : e;
16
+ }
17
+ function H(e, n = []) {
18
+ if (e === void 0)
19
+ return {};
20
+ const t = {};
21
+ return Object.keys(e).filter((s) => s.match(/^on[A-Z]/) && typeof e[s] == "function" && !n.includes(s)).forEach((s) => {
22
+ t[s] = e[s];
23
+ }), t;
24
+ }
25
+ function h(e) {
26
+ if (e === void 0)
27
+ return {};
28
+ const n = {};
29
+ return Object.keys(e).filter((t) => !(t.match(/^on[A-Z]/) && typeof e[t] == "function")).forEach((t) => {
30
+ n[t] = e[t];
31
+ }), n;
32
+ }
33
+ function k(e) {
34
+ const {
35
+ getSlotProps: n,
36
+ additionalProps: t,
37
+ externalSlotProps: s,
38
+ externalForwardedProps: o,
39
+ className: d
40
+ } = e;
41
+ if (!n) {
42
+ const i = S(t?.className, d, o?.className, s?.className), f = {
43
+ ...t?.style,
44
+ ...o?.style,
45
+ ...s?.style
46
+ }, a = {
47
+ ...t,
48
+ ...o,
49
+ ...s
50
+ };
51
+ return i.length > 0 && (a.className = i), Object.keys(f).length > 0 && (a.style = f), {
52
+ props: a,
53
+ internalRef: void 0
54
+ };
55
+ }
56
+ const u = H({
57
+ ...o,
58
+ ...s
59
+ }), p = h(s), P = h(o), r = n(u), l = S(r?.className, t?.className, d, o?.className, s?.className), m = {
60
+ ...r?.style,
61
+ ...t?.style,
62
+ ...o?.style,
63
+ ...s?.style
64
+ }, c = {
65
+ ...r,
66
+ ...t,
67
+ ...P,
68
+ ...p
69
+ };
70
+ return l.length > 0 && (c.className = l), Object.keys(m).length > 0 && (c.style = m), {
71
+ props: c,
72
+ internalRef: r.ref
73
+ };
74
+ }
75
+ function R(e, n) {
76
+ const {
77
+ className: t,
78
+ elementType: s,
79
+ ownerState: o,
80
+ externalForwardedProps: d,
81
+ internalForwardedProps: u,
82
+ shouldForwardComponentProp: p = !1,
83
+ ...P
84
+ } = n, {
85
+ component: r,
86
+ slots: l = {
87
+ [e]: void 0
88
+ },
89
+ slotProps: m = {
90
+ [e]: void 0
91
+ },
92
+ ...c
93
+ } = d, i = l[e] || s, f = F(m[e], o), {
94
+ props: {
95
+ component: a,
96
+ ...N
97
+ },
98
+ internalRef: g
99
+ } = k({
100
+ className: t,
101
+ ...P,
102
+ externalForwardedProps: e === "root" ? c : void 0,
103
+ externalSlotProps: f
104
+ }), w = x(g, f?.ref, n.ref), y = e === "root" ? a || r : a, C = E(i, {
105
+ ...e === "root" && !r && !l[e] && u,
106
+ ...e !== "root" && !l[e] && u,
107
+ ...N,
108
+ ...y && !p && {
109
+ as: y
110
+ },
111
+ ...y && p && {
112
+ component: y
113
+ },
114
+ ref: w
115
+ }, o);
116
+ return [i, C];
117
+ }
118
+ export {
119
+ E as a,
120
+ H as e,
121
+ v as i,
122
+ k as m,
123
+ F as r,
124
+ R as u
125
+ };
@@ -0,0 +1,111 @@
1
+ import * as o from "react";
2
+ import d from "react";
3
+ import { P as i } from "./generateUtilityClasses-BCID9NF1.js";
4
+ const y = typeof window < "u" ? o.useLayoutEffect : o.useEffect;
5
+ function v(e) {
6
+ const t = o.useRef(e);
7
+ return y(() => {
8
+ t.current = e;
9
+ }), o.useRef((...n) => (
10
+ // @ts-expect-error hide `this`
11
+ (0, t.current)(...n)
12
+ )).current;
13
+ }
14
+ function m(e) {
15
+ return typeof e.main == "string";
16
+ }
17
+ function h(e, t = []) {
18
+ if (!m(e))
19
+ return !1;
20
+ for (const n of t)
21
+ if (!e.hasOwnProperty(n) || typeof e[n] != "string")
22
+ return !1;
23
+ return !0;
24
+ }
25
+ function g(e = []) {
26
+ return ([, t]) => t && h(t, e);
27
+ }
28
+ function E(e, t) {
29
+ return process.env.NODE_ENV === "production" ? () => null : function(...r) {
30
+ return e(...r) || t(...r);
31
+ };
32
+ }
33
+ const C = i.oneOfType([i.func, i.object]);
34
+ function P(e) {
35
+ const {
36
+ prototype: t = {}
37
+ } = e;
38
+ return !!t.isReactComponent;
39
+ }
40
+ function T(e, t, n, r, l) {
41
+ const u = e[t], p = l || t;
42
+ if (u == null || // When server-side rendering React doesn't warn either.
43
+ // This is not an accurate check for SSR.
44
+ // This is only in place for emotion compat.
45
+ // TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
46
+ typeof window > "u")
47
+ return null;
48
+ let c;
49
+ return typeof u == "function" && !P(u) && (c = "Did you accidentally provide a plain function component instead?"), u === o.Fragment && (c = "Did you accidentally provide a React.Fragment instead?"), c !== void 0 ? new Error(`Invalid ${r} \`${p}\` supplied to \`${n}\`. Expected an element type that can hold a ref. ${c} For more information see https://mui.com/r/caveat-with-refs-guide`) : null;
50
+ }
51
+ const b = E(i.elementType, T), f = {};
52
+ function O(e, t) {
53
+ const n = o.useRef(f);
54
+ return n.current === f && (n.current = e(t)), n;
55
+ }
56
+ function x(e, t) {
57
+ if (e == null) return {};
58
+ var n = {};
59
+ for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
60
+ if (t.indexOf(r) !== -1) continue;
61
+ n[r] = e[r];
62
+ }
63
+ return n;
64
+ }
65
+ function s(e, t) {
66
+ return s = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
67
+ return n.__proto__ = r, n;
68
+ }, s(e, t);
69
+ }
70
+ function L(e, t) {
71
+ e.prototype = Object.create(t.prototype), e.prototype.constructor = e, s(e, t);
72
+ }
73
+ const $ = d.createContext(null), I = [];
74
+ function w(e) {
75
+ o.useEffect(e, I);
76
+ }
77
+ class a {
78
+ static create() {
79
+ return new a();
80
+ }
81
+ currentId = null;
82
+ /**
83
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
84
+ */
85
+ start(t, n) {
86
+ this.clear(), this.currentId = setTimeout(() => {
87
+ this.currentId = null, n();
88
+ }, t);
89
+ }
90
+ clear = () => {
91
+ this.currentId !== null && (clearTimeout(this.currentId), this.currentId = null);
92
+ };
93
+ disposeEffect = () => this.clear;
94
+ }
95
+ function D() {
96
+ const e = O(a.create).current;
97
+ return w(e.disposeEffect), e;
98
+ }
99
+ export {
100
+ $ as T,
101
+ L as _,
102
+ E as a,
103
+ x as b,
104
+ g as c,
105
+ D as d,
106
+ v as e,
107
+ b as f,
108
+ y as g,
109
+ C as r,
110
+ O as u
111
+ };
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.14",
5
+ "version": "0.0.16",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",
@@ -1,161 +0,0 @@
1
- import * as i from "react";
2
- import { c as C, h as x } from "./useTimeout-BWi4JTOH.js";
3
- function V(e) {
4
- const {
5
- controlled: o,
6
- default: t,
7
- name: n,
8
- state: s = "value"
9
- } = e, {
10
- current: r
11
- } = i.useRef(o !== void 0), [c, f] = i.useState(t), d = r ? o : c;
12
- if (process.env.NODE_ENV !== "production") {
13
- i.useEffect(() => {
14
- r !== (o !== void 0) && console.error([`MUI: A component is changing the ${r ? "" : "un"}controlled ${s} state of ${n} to be ${r ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
15
- `));
16
- }, [s, n, o]);
17
- const {
18
- current: l
19
- } = i.useRef(t);
20
- i.useEffect(() => {
21
- !r && JSON.stringify(t) !== JSON.stringify(l) && console.error([`MUI: A component is changing the default ${s} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
22
- `));
23
- }, [JSON.stringify(t)]);
24
- }
25
- const a = i.useCallback((l) => {
26
- r || f(l);
27
- }, []);
28
- return [d, a];
29
- }
30
- const S = /* @__PURE__ */ i.createContext(void 0);
31
- process.env.NODE_ENV !== "production" && (S.displayName = "FormControlContext");
32
- function b() {
33
- return i.useContext(S);
34
- }
35
- function F(e) {
36
- return typeof e == "string";
37
- }
38
- function O(e, o, t) {
39
- return e === void 0 || F(e) ? o : {
40
- ...o,
41
- ownerState: {
42
- ...o.ownerState,
43
- ...t
44
- }
45
- };
46
- }
47
- function $(e, o, t) {
48
- return typeof e == "function" ? e(o, t) : e;
49
- }
50
- function R(e, o = []) {
51
- if (e === void 0)
52
- return {};
53
- const t = {};
54
- return Object.keys(e).filter((n) => n.match(/^on[A-Z]/) && typeof e[n] == "function" && !o.includes(n)).forEach((n) => {
55
- t[n] = e[n];
56
- }), t;
57
- }
58
- function N(e) {
59
- if (e === void 0)
60
- return {};
61
- const o = {};
62
- return Object.keys(e).filter((t) => !(t.match(/^on[A-Z]/) && typeof e[t] == "function")).forEach((t) => {
63
- o[t] = e[t];
64
- }), o;
65
- }
66
- function k(e) {
67
- const {
68
- getSlotProps: o,
69
- additionalProps: t,
70
- externalSlotProps: n,
71
- externalForwardedProps: s,
72
- className: r
73
- } = e;
74
- if (!o) {
75
- const m = C(t?.className, r, s?.className, n?.className), h = {
76
- ...t?.style,
77
- ...s?.style,
78
- ...n?.style
79
- }, u = {
80
- ...t,
81
- ...s,
82
- ...n
83
- };
84
- return m.length > 0 && (u.className = m), Object.keys(h).length > 0 && (u.style = h), {
85
- props: u,
86
- internalRef: void 0
87
- };
88
- }
89
- const c = R({
90
- ...s,
91
- ...n
92
- }), f = N(n), d = N(s), a = o(c), l = C(a?.className, t?.className, r, s?.className, n?.className), y = {
93
- ...a?.style,
94
- ...t?.style,
95
- ...s?.style,
96
- ...n?.style
97
- }, p = {
98
- ...a,
99
- ...t,
100
- ...d,
101
- ...f
102
- };
103
- return l.length > 0 && (p.className = l), Object.keys(y).length > 0 && (p.style = y), {
104
- props: p,
105
- internalRef: a.ref
106
- };
107
- }
108
- function A(e, o) {
109
- const {
110
- className: t,
111
- elementType: n,
112
- ownerState: s,
113
- externalForwardedProps: r,
114
- internalForwardedProps: c,
115
- shouldForwardComponentProp: f = !1,
116
- ...d
117
- } = o, {
118
- component: a,
119
- slots: l = {
120
- [e]: void 0
121
- },
122
- slotProps: y = {
123
- [e]: void 0
124
- },
125
- ...p
126
- } = r, m = l[e] || n, h = $(y[e], s), {
127
- props: {
128
- component: u,
129
- ...P
130
- },
131
- internalRef: v
132
- } = k({
133
- className: t,
134
- ...d,
135
- externalForwardedProps: e === "root" ? p : void 0,
136
- externalSlotProps: h
137
- }), E = x(v, h?.ref, o.ref), g = e === "root" ? u || a : u, w = O(m, {
138
- ...e === "root" && !a && !l[e] && c,
139
- ...e !== "root" && !l[e] && c,
140
- ...P,
141
- ...g && !f && {
142
- as: g
143
- },
144
- ...g && f && {
145
- component: g
146
- },
147
- ref: E
148
- }, s);
149
- return [m, w];
150
- }
151
- export {
152
- S as F,
153
- b as a,
154
- A as b,
155
- O as c,
156
- R as e,
157
- F as i,
158
- k as m,
159
- $ as r,
160
- V as u
161
- };