@fangzsx/component-library 0.0.31 → 0.0.33

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,370 @@
1
+ import { jsx as i, jsxs as E } from "react/jsx-runtime";
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);
14
+ }
15
+ const y = $("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divider", "gutters", "selected"]), ne = (e, t) => {
16
+ const {
17
+ ownerState: a
18
+ } = e;
19
+ return [t.root, a.dense && t.dense, a.divider && t.divider, !a.disableGutters && t.gutters];
20
+ }, ie = (e) => {
21
+ const {
22
+ disabled: t,
23
+ dense: a,
24
+ divider: s,
25
+ disableGutters: l,
26
+ selected: u,
27
+ classes: d
28
+ } = e, n = Z({
29
+ root: ["root", a && "dense", t && "disabled", !l && "gutters", s && "divider", u && "selected"]
30
+ }, ae, d);
31
+ return {
32
+ ...d,
33
+ ...n
34
+ };
35
+ }, le = Y(se, {
36
+ shouldForwardProp: (e) => ee(e) || e === "classes",
37
+ name: "MuiMenuItem",
38
+ slot: "Root",
39
+ overridesResolver: ne
40
+ })(oe(({
41
+ theme: e
42
+ }) => ({
43
+ ...e.typography.body1,
44
+ display: "flex",
45
+ justifyContent: "flex-start",
46
+ alignItems: "center",
47
+ position: "relative",
48
+ textDecoration: "none",
49
+ minHeight: 48,
50
+ paddingTop: 6,
51
+ paddingBottom: 6,
52
+ boxSizing: "border-box",
53
+ whiteSpace: "nowrap",
54
+ "&:hover": {
55
+ textDecoration: "none",
56
+ backgroundColor: (e.vars || e).palette.action.hover,
57
+ // Reset on touch devices, it doesn't add specificity
58
+ "@media (hover: none)": {
59
+ backgroundColor: "transparent"
60
+ }
61
+ },
62
+ [`&.${y.selected}`]: {
63
+ backgroundColor: e.alpha((e.vars || e).palette.primary.main, (e.vars || e).palette.action.selectedOpacity),
64
+ [`&.${y.focusVisible}`]: {
65
+ backgroundColor: e.alpha((e.vars || e).palette.primary.main, `${(e.vars || e).palette.action.selectedOpacity} + ${(e.vars || e).palette.action.focusOpacity}`)
66
+ }
67
+ },
68
+ [`&.${y.selected}:hover`]: {
69
+ backgroundColor: e.alpha((e.vars || e).palette.primary.main, `${(e.vars || e).palette.action.selectedOpacity} + ${(e.vars || e).palette.action.hoverOpacity}`),
70
+ // Reset on touch devices, it doesn't add specificity
71
+ "@media (hover: none)": {
72
+ backgroundColor: e.alpha((e.vars || e).palette.primary.main, (e.vars || e).palette.action.selectedOpacity)
73
+ }
74
+ },
75
+ [`&.${y.focusVisible}`]: {
76
+ backgroundColor: (e.vars || e).palette.action.focus
77
+ },
78
+ [`&.${y.disabled}`]: {
79
+ opacity: (e.vars || e).palette.action.disabledOpacity
80
+ },
81
+ [`& + .${H.root}`]: {
82
+ marginTop: e.spacing(1),
83
+ marginBottom: e.spacing(1)
84
+ },
85
+ [`& + .${H.inset}`]: {
86
+ marginLeft: 52
87
+ },
88
+ [`& .${D.root}`]: {
89
+ marginTop: 0,
90
+ marginBottom: 0
91
+ },
92
+ [`& .${D.inset}`]: {
93
+ paddingLeft: 36
94
+ },
95
+ [`& .${P.root}`]: {
96
+ minWidth: 36
97
+ },
98
+ variants: [{
99
+ props: ({
100
+ ownerState: t
101
+ }) => !t.disableGutters,
102
+ style: {
103
+ paddingLeft: 16,
104
+ paddingRight: 16
105
+ }
106
+ }, {
107
+ props: ({
108
+ ownerState: t
109
+ }) => t.divider,
110
+ style: {
111
+ borderBottom: `1px solid ${(e.vars || e).palette.divider}`,
112
+ backgroundClip: "padding-box"
113
+ }
114
+ }, {
115
+ props: ({
116
+ ownerState: t
117
+ }) => !t.dense,
118
+ style: {
119
+ [e.breakpoints.up("sm")]: {
120
+ minHeight: "auto"
121
+ }
122
+ }
123
+ }, {
124
+ props: ({
125
+ ownerState: t
126
+ }) => t.dense,
127
+ style: {
128
+ minHeight: 32,
129
+ // https://m2.material.io/components/menus#specs > Dense
130
+ paddingTop: 4,
131
+ paddingBottom: 4,
132
+ ...e.typography.body2,
133
+ [`& .${P.root} svg`]: {
134
+ fontSize: "1.25rem"
135
+ }
136
+ }
137
+ }]
138
+ }))), L = /* @__PURE__ */ T.forwardRef(function(t, a) {
139
+ const s = X({
140
+ props: t,
141
+ name: "MuiMenuItem"
142
+ }), {
143
+ autoFocus: l = !1,
144
+ component: u = "li",
145
+ dense: d = !1,
146
+ divider: p = !1,
147
+ disableGutters: n = !1,
148
+ focusVisibleClassName: m,
149
+ role: b = "menuitem",
150
+ tabIndex: C,
151
+ className: I,
152
+ ...h
153
+ } = s, f = T.useContext(N), M = T.useMemo(() => ({
154
+ dense: d || f.dense || !1,
155
+ disableGutters: n
156
+ }), [f.dense, d, n]), g = T.useRef(null);
157
+ te(() => {
158
+ 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
+ }, [l]);
160
+ const k = {
161
+ ...s,
162
+ dense: M.dense,
163
+ divider: p,
164
+ disableGutters: n
165
+ }, v = ie(s), O = re(g, a);
166
+ let x;
167
+ return s.disabled || (x = C !== void 0 ? C : -1), /* @__PURE__ */ i(N.Provider, {
168
+ value: M,
169
+ children: /* @__PURE__ */ i(le, {
170
+ ref: O,
171
+ role: b,
172
+ tabIndex: x,
173
+ component: u,
174
+ focusVisibleClassName: F(v.focusVisible, m),
175
+ className: F(v.root, I),
176
+ ...h,
177
+ ownerState: k,
178
+ classes: v
179
+ })
180
+ });
181
+ });
182
+ process.env.NODE_ENV !== "production" && (L.propTypes = {
183
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
184
+ // │ These PropTypes are generated from the TypeScript type definitions. │
185
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
186
+ // └─────────────────────────────────────────────────────────────────────┘
187
+ /**
188
+ * If `true`, the list item is focused during the first mount.
189
+ * Focus will also be triggered if the value changes from false to true.
190
+ * @default false
191
+ */
192
+ autoFocus: o.bool,
193
+ /**
194
+ * The content of the component.
195
+ */
196
+ children: o.node,
197
+ /**
198
+ * Override or extend the styles applied to the component.
199
+ */
200
+ classes: o.object,
201
+ /**
202
+ * @ignore
203
+ */
204
+ className: o.string,
205
+ /**
206
+ * The component used for the root node.
207
+ * Either a string to use a HTML element or a component.
208
+ */
209
+ component: o.elementType,
210
+ /**
211
+ * If `true`, compact vertical padding designed for keyboard and mouse input is used.
212
+ * The prop defaults to the value inherited from the parent Menu component.
213
+ * @default false
214
+ */
215
+ dense: o.bool,
216
+ /**
217
+ * @ignore
218
+ */
219
+ disabled: o.bool,
220
+ /**
221
+ * If `true`, the left and right padding is removed.
222
+ * @default false
223
+ */
224
+ disableGutters: o.bool,
225
+ /**
226
+ * If `true`, a 1px light border is added to the bottom of the menu item.
227
+ * @default false
228
+ */
229
+ divider: o.bool,
230
+ /**
231
+ * This prop can help identify which element has keyboard focus.
232
+ * The class name will be applied when the element gains the focus through keyboard interaction.
233
+ * It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
234
+ * The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
235
+ * A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
236
+ * if needed.
237
+ */
238
+ focusVisibleClassName: o.string,
239
+ /**
240
+ * @ignore
241
+ */
242
+ role: o.string,
243
+ /**
244
+ * If `true`, the component is selected.
245
+ * @default false
246
+ */
247
+ selected: o.bool,
248
+ /**
249
+ * The system prop that allows defining system overrides as well as additional CSS styles.
250
+ */
251
+ sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object]),
252
+ /**
253
+ * @default 0
254
+ */
255
+ tabIndex: o.number
256
+ });
257
+ function xe(e) {
258
+ const {
259
+ className: t,
260
+ sx: a,
261
+ label: s = "",
262
+ options: l = [],
263
+ value: u = "",
264
+ onChange: d,
265
+ required: p = !1,
266
+ disabled: n = !1,
267
+ forceError: m = !1,
268
+ errorMessage: b = "This field is required",
269
+ helperText: C,
270
+ placeholder: I = "Select an option",
271
+ formControlProps: h,
272
+ customValidation: f,
273
+ size: M,
274
+ variant: g = "outlined",
275
+ fullWidth: k = !0,
276
+ ...v
277
+ } = e, [O, x] = V(!1), [R, w] = V(!1), [j, S] = V(""), B = q(
278
+ (r) => {
279
+ if (p && !r) {
280
+ w(!0), S(b);
281
+ return;
282
+ }
283
+ if (f) {
284
+ const c = f(r);
285
+ if (c) {
286
+ w(!0), S(c);
287
+ return;
288
+ }
289
+ }
290
+ w(!1), S("");
291
+ },
292
+ [p, b, f]
293
+ ), U = m || O && R, G = m ? b : O && R ? j : C || " ", z = (r) => {
294
+ const c = r.target.value;
295
+ x(!0), B(c), d?.(c);
296
+ }, W = () => {
297
+ x(!0), B(u);
298
+ };
299
+ return /* @__PURE__ */ E(
300
+ A,
301
+ {
302
+ fullWidth: k,
303
+ error: U,
304
+ disabled: n,
305
+ required: p,
306
+ size: M,
307
+ variant: g,
308
+ ...h,
309
+ sx: {
310
+ "& .MuiInputBase-root": {
311
+ height: 40
312
+ },
313
+ "& .MuiInputLabel-root": {
314
+ transform: "translate(14px, -9px) scale(0.75)",
315
+ "&.MuiInputLabel-shrink": {
316
+ transform: "translate(14px, -9px) scale(0.75)"
317
+ }
318
+ },
319
+ "& .MuiSelect-select": {
320
+ padding: "8px 14px"
321
+ },
322
+ "& .MuiFormHelperText-root": {
323
+ marginLeft: 0,
324
+ marginRight: 0
325
+ },
326
+ ...h?.sx
327
+ },
328
+ children: [
329
+ s && /* @__PURE__ */ i(J, { shrink: !0, children: s }),
330
+ /* @__PURE__ */ E(
331
+ K,
332
+ {
333
+ className: t,
334
+ value: u,
335
+ label: s || void 0,
336
+ onChange: z,
337
+ onBlur: W,
338
+ disabled: n,
339
+ notched: !!s,
340
+ displayEmpty: !0,
341
+ renderValue: (r) => r ? l.find((c) => c.value === r)?.label ?? r : /* @__PURE__ */ i("em", { style: { color: "#9e9e9e" }, children: I }),
342
+ ...v,
343
+ sx: {
344
+ ...m && {
345
+ "& .MuiOutlinedInput-notchedOutline": {
346
+ borderColor: "error.main"
347
+ },
348
+ "&:hover .MuiOutlinedInput-notchedOutline": {
349
+ borderColor: "error.dark"
350
+ },
351
+ "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
352
+ borderColor: "error.main"
353
+ }
354
+ },
355
+ ...a
356
+ },
357
+ 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))
360
+ ]
361
+ }
362
+ ),
363
+ /* @__PURE__ */ i(_, { children: G })
364
+ ]
365
+ }
366
+ );
367
+ }
368
+ export {
369
+ xe as DropdownOptions
370
+ };
@@ -1,11 +1,11 @@
1
1
  import { jsx as d, jsxs as x } from "react/jsx-runtime";
2
- import { B as A } from "../../index-CS-LWC7Z.js";
2
+ import { B as A } from "../../index-Dnsx2wLn.js";
3
3
  import * as u from "react";
4
4
  import { g as m, a as f, P as e } from "../../generateUtilityClasses-BCID9NF1.js";
5
5
  import { u as C, s as g, c as y, a as b } from "../../DefaultPropsProvider-DVX_ssOt.js";
6
- import { P as U } from "../../Paper-oafkOzNM.js";
7
- import { a as N } from "../../useTimeout-DmOXPFt0.js";
8
- import { T as v } from "../../Typography-CTrRb9FL.js";
6
+ import { P as U } from "../../Paper-Cz0ZdEav.js";
7
+ import { a as N } from "../../useTimeout-UzNJH-cm.js";
8
+ import { T as v } from "../../Typography-Cro52PHG.js";
9
9
  function I(o) {
10
10
  return m("MuiCard", o);
11
11
  }
@@ -1,16 +1,16 @@
1
1
  import { jsx as n, jsxs as I } from "react/jsx-runtime";
2
2
  import * as m from "react";
3
3
  import { useState as Z } from "react";
4
- import { f as X, c as lo, F as io, a as co, b as po } from "../../FormLabel-D4ON51Wt.js";
4
+ import { f as X, c as lo, a as io, b as co, F as po } from "../../FormHelperText-B-xlmRr4.js";
5
5
  import { a as $, g as B, c as M, P as o } from "../../generateUtilityClasses-BCID9NF1.js";
6
6
  import { u as _, c as G, s as N, a as L, m as V, r as Y } from "../../DefaultPropsProvider-DVX_ssOt.js";
7
7
  import { a as A, u as uo } from "../../useFormControl-BGLuGvqS.js";
8
8
  import { u as fo } from "../../useForkRef-9kN4DArm.js";
9
9
  import { u as mo } from "../../useId-CK6Kn3Tn.js";
10
10
  import { u as oo } from "../../useSlot-DKccmcQE.js";
11
- import { T as J } from "../../Typography-CTrRb9FL.js";
12
- import { r as eo, c as K } from "../../useTimeout-DmOXPFt0.js";
13
- import { S as bo } from "../../SwitchBase-V2UoemN5.js";
11
+ import { T as J } from "../../Typography-Cro52PHG.js";
12
+ import { r as eo, c as K } from "../../useTimeout-UzNJH-cm.js";
13
+ import { S as bo } from "../../SwitchBase-DWe26Qyv.js";
14
14
  import { c as ro } from "../../createSvgIcon-C0YrvByi.js";
15
15
  function yo(e) {
16
16
  return B("MuiFormControlLabel", e);
@@ -11,5 +11,6 @@ export interface TextFieldInputProps {
11
11
  multiline?: boolean;
12
12
  rows?: number;
13
13
  sx?: any;
14
+ forceError?: boolean;
14
15
  }
15
- export declare function TextFieldInput({ label, placeholder, required, errorMessage, helperText, variant, onChange, defaultValue, type, multiline, rows, sx, }: TextFieldInputProps): import("react/jsx-runtime").JSX.Element;
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;