@loopr-ai/craft 0.8.3 → 0.10.0

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 (55) hide show
  1. package/dist/Box-96e795c4.js +58 -0
  2. package/dist/{ButtonBase-08b16b61.js → ButtonBase-46c20f20.js} +3 -3
  3. package/dist/{TextField-f61d210a.js → TextField-df89b641.js} +373 -387
  4. package/dist/{TransitionGroupContext-0e899f4c.js → TransitionGroupContext-21923db7.js} +1 -1
  5. package/dist/ZoomControllers-657c8b74.js +3383 -0
  6. package/dist/components/cell/AvatarGroup/index.js +3 -3
  7. package/dist/components/cell/Button/index.js +3 -3
  8. package/dist/components/cell/Chip/index.js +5 -5
  9. package/dist/components/cell/ProgressBar/index.js +3 -3
  10. package/dist/components/cell/Search/index.js +2 -2
  11. package/dist/components/cell/Typography/index.js +1 -1
  12. package/dist/components/organ/Form/ErrorMessage/ErrorMessage.styles.d.ts +14 -0
  13. package/dist/components/organ/Form/ErrorMessage/ErrorMessage.styles.js +16 -0
  14. package/dist/components/organ/Form/ErrorMessage/index.d.ts +6 -0
  15. package/dist/components/organ/Form/ErrorMessage/index.js +14 -0
  16. package/dist/components/organ/Form/Form.interfaces.d.ts +4 -2
  17. package/dist/components/organ/Form/Form.styles.d.ts +6 -99
  18. package/dist/components/organ/Form/Form.styles.js +8 -102
  19. package/dist/components/organ/Form/FormInput.d.ts +1 -0
  20. package/dist/components/organ/Form/FormInput.js +57 -1525
  21. package/dist/components/organ/Form/Label/Label.styles.d.ts +14 -0
  22. package/dist/components/organ/Form/Label/Label.styles.js +16 -0
  23. package/dist/components/organ/Form/Label/index.d.ts +10 -0
  24. package/dist/components/organ/Form/Label/index.js +17 -0
  25. package/dist/components/organ/Form/RadioInput/RadioInput.styles.d.ts +17 -0
  26. package/dist/components/organ/Form/RadioInput/RadioInput.styles.js +20 -0
  27. package/dist/components/organ/Form/RadioInput/index.d.ts +16 -0
  28. package/dist/components/organ/Form/RadioInput/index.js +1053 -0
  29. package/dist/components/organ/Form/TextfieldInput/TextfieldInput.styles.d.ts +75 -0
  30. package/dist/components/organ/Form/TextfieldInput/TextfieldInput.styles.js +66 -0
  31. package/dist/components/organ/Form/TextfieldInput/index.d.ts +24 -0
  32. package/dist/components/organ/Form/TextfieldInput/index.js +536 -0
  33. package/dist/components/organ/Form/index.d.ts +3 -1
  34. package/dist/components/organ/Form/index.js +139 -149
  35. package/dist/components/organ/ZoomControlWithDrag/ZoomControllers.js +2 -2
  36. package/dist/components/organ/ZoomControlWithDrag/index.js +2 -2
  37. package/dist/{createSvgIcon-45340b5e.js → createSvgIcon-59e7bc15.js} +3195 -3245
  38. package/dist/{createSvgIcon-5aac746d.js → createSvgIcon-b444ce70.js} +5 -5
  39. package/dist/{createTheme-759a022d.js → createTheme-d2329909.js} +4 -4
  40. package/dist/dividerClasses-9354a5c9.js +10 -0
  41. package/dist/{exactProp-23d6a154.js → exactProp-3ee21234.js} +1 -1
  42. package/dist/{extendSxProp-cf8fd923.js → extendSxProp-f6cb682b.js} +1 -1
  43. package/dist/global/colors.d.ts +1 -0
  44. package/dist/global/colors.js +5 -4
  45. package/dist/global/theme.js +1 -1
  46. package/dist/{index-c9c32237.js → index-ae3eb123.js} +8 -8
  47. package/dist/main.js +1 -1
  48. package/dist/providers/CraftThemeProvider.js +2 -2
  49. package/dist/{styled-78608e1f.js → styled-8f7db30d.js} +39 -39
  50. package/dist/useControlled-4e337b2f.js +54 -0
  51. package/dist/useFormControl-b25c5813.js +19 -0
  52. package/dist/{useTheme-8906bd79.js → useTheme-21caf71b.js} +1 -1
  53. package/package.json +1 -1
  54. package/dist/Tooltip-e797a425.js +0 -2022
  55. package/dist/ZoomControllers-d04c25f8.js +0 -1432
@@ -0,0 +1,75 @@
1
+ declare const textfieldInputStyles: {
2
+ textfield: {
3
+ width: string;
4
+ "& .MuiInputBase-root": {
5
+ borderRadius: string;
6
+ background: string;
7
+ padding: string;
8
+ "& input": {
9
+ fontFamily: string;
10
+ padding: number;
11
+ "&::placeholder": {
12
+ color: string;
13
+ opacity: number;
14
+ };
15
+ };
16
+ "& textarea": {
17
+ fontFamily: string;
18
+ padding: number;
19
+ "&::placeholder": {
20
+ color: string;
21
+ opacity: number;
22
+ };
23
+ };
24
+ "& > svg": {
25
+ color: string;
26
+ };
27
+ };
28
+ "& .MuiSelect-select": {
29
+ paddingRight: string;
30
+ textAlign: string;
31
+ fontFamily: string;
32
+ padding: number;
33
+ "&::placeholder": {
34
+ color: string;
35
+ opacity: number;
36
+ };
37
+ };
38
+ };
39
+ selectDropdown: {
40
+ "& .MuiPaper-root": {
41
+ border: string;
42
+ borderRadius: string;
43
+ marginTop: string;
44
+ boxShadow: string;
45
+ fontFamily: string;
46
+ "& ul": {
47
+ padding: string;
48
+ "&::-webkit-scrollbar-thumb": {
49
+ background: string;
50
+ borderRadius: string;
51
+ "&:hover": {
52
+ background: string;
53
+ };
54
+ };
55
+ "&::-webkit-scrollbar-track": {
56
+ background: string;
57
+ borderRadius: string;
58
+ };
59
+ "& li": {
60
+ display: string;
61
+ gap: string;
62
+ alignItems: string;
63
+ fontFamily: string;
64
+ };
65
+ };
66
+ };
67
+ };
68
+ inputAdornment: {
69
+ "& .MuiTypography-root": {
70
+ fontFamily: string;
71
+ color: string;
72
+ };
73
+ };
74
+ };
75
+ export default textfieldInputStyles;
@@ -0,0 +1,66 @@
1
+ import { customColors as r } from "../../../../global/colors.js";
2
+ const e = {
3
+ fontFamily: "DM Sans, sans-serif",
4
+ padding: 0,
5
+ "&::placeholder": {
6
+ color: r.grey,
7
+ opacity: 1
8
+ }
9
+ }, a = {
10
+ textfield: {
11
+ width: "100%",
12
+ "& .MuiInputBase-root": {
13
+ borderRadius: "0.25rem",
14
+ background: "white",
15
+ padding: "0.5rem 0.75rem",
16
+ "& input": e,
17
+ "& textarea": e,
18
+ "& > svg": {
19
+ color: "black"
20
+ }
21
+ },
22
+ "& .MuiSelect-select": {
23
+ ...e,
24
+ paddingRight: "2rem",
25
+ textAlign: "left"
26
+ }
27
+ },
28
+ selectDropdown: {
29
+ "& .MuiPaper-root": {
30
+ border: " 1px solid #BEBAC4",
31
+ borderRadius: "6px",
32
+ marginTop: "0.25rem",
33
+ boxShadow: "0 2px 4px rgba(0, 0, 0, 0.2)",
34
+ fontFamily: "DM Sans, sans-serif",
35
+ "& ul": {
36
+ padding: "0.25rem",
37
+ "&::-webkit-scrollbar-thumb": {
38
+ background: "#00000050",
39
+ borderRadius: "0.25rem",
40
+ "&:hover": {
41
+ background: r.grey
42
+ }
43
+ },
44
+ "&::-webkit-scrollbar-track": {
45
+ background: r.greyDark,
46
+ borderRadius: "0.25rem"
47
+ },
48
+ "& li": {
49
+ display: "flex",
50
+ gap: "0.5rem",
51
+ alignItems: "center",
52
+ fontFamily: "DM Sans, sans-serif"
53
+ }
54
+ }
55
+ }
56
+ },
57
+ inputAdornment: {
58
+ "& .MuiTypography-root": {
59
+ fontFamily: "DM Sans, sans-serif",
60
+ color: r.grey
61
+ }
62
+ }
63
+ };
64
+ export {
65
+ a as default
66
+ };
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import { SelectChangeEvent } from "@mui/material";
3
+ import { CraftFC } from "../../../../global/interfaces";
4
+ import { InputAdornments, OptionsResponseHandler, OptionsType } from "../Form.interfaces";
5
+ interface TextfieldInputProps {
6
+ name: string;
7
+ label: string;
8
+ type: string;
9
+ value: string;
10
+ handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement> | SelectChangeEvent<string>) => void;
11
+ placeholder?: string;
12
+ required?: boolean;
13
+ disabled?: boolean;
14
+ options?: OptionsType;
15
+ optionsResponseHandler?: OptionsResponseHandler;
16
+ api_endpoint?: string;
17
+ error?: boolean;
18
+ helperText?: string;
19
+ inputAdornments?: InputAdornments;
20
+ autofocus?: boolean;
21
+ authHeader?: string;
22
+ }
23
+ declare const TextfieldInput: CraftFC<TextfieldInputProps>;
24
+ export default TextfieldInput;
@@ -0,0 +1,536 @@
1
+ import te, { jsx as d, jsxs as q } from "react/jsx-runtime";
2
+ import { r as oe, i as se } from "../../../../createSvgIcon-59e7bc15.js";
3
+ import * as M from "react";
4
+ import { useState as ne, useMemo as V, useCallback as ae, useEffect as re } from "react";
5
+ import { customColors as O } from "../../../../global/colors.js";
6
+ import ie from "../ErrorMessage/index.js";
7
+ import le from "../Form.styles.js";
8
+ import ce from "../Label/index.js";
9
+ import P from "./TextfieldInput.styles.js";
10
+ import { B as de } from "../../../../Box-96e795c4.js";
11
+ import { L as B, T as pe } from "../../../../TextField-df89b641.js";
12
+ import { g as W, a as x, _ as K, P as t, b as R, f as N } from "../../../../createTheme-d2329909.js";
13
+ import { g as j, s as J, b as Q, c as w, e as X, r as ue } from "../../../../styled-8f7db30d.js";
14
+ import { u as me, F as fe } from "../../../../useFormControl-b25c5813.js";
15
+ import { M as be } from "../../../../index-ae3eb123.js";
16
+ import { B as ve } from "../../../../ButtonBase-46c20f20.js";
17
+ import { d as k } from "../../../../dividerClasses-9354a5c9.js";
18
+ import { c as ge, u as ye } from "../../../../TransitionGroupContext-21923db7.js";
19
+ function Ie(e) {
20
+ return W("MuiInputAdornment", e);
21
+ }
22
+ const xe = j("MuiInputAdornment", ["root", "filled", "standard", "outlined", "positionStart", "positionEnd", "disablePointerEvents", "hiddenLabel", "sizeSmall"]), D = xe;
23
+ var z;
24
+ const Ce = ["children", "className", "component", "disablePointerEvents", "disableTypography", "position", "variant"], $e = (e, o) => {
25
+ const {
26
+ ownerState: s
27
+ } = e;
28
+ return [o.root, o[`position${R(s.position)}`], s.disablePointerEvents === !0 && o.disablePointerEvents, o[s.variant]];
29
+ }, he = (e) => {
30
+ const {
31
+ classes: o,
32
+ disablePointerEvents: s,
33
+ hiddenLabel: n,
34
+ position: r,
35
+ size: l,
36
+ variant: c
37
+ } = e, y = {
38
+ root: ["root", s && "disablePointerEvents", r && `position${R(r)}`, c, n && "hiddenLabel", l && `size${R(l)}`]
39
+ };
40
+ return X(y, Ie, o);
41
+ }, Me = J("div", {
42
+ name: "MuiInputAdornment",
43
+ slot: "Root",
44
+ overridesResolver: $e
45
+ })(({
46
+ theme: e,
47
+ ownerState: o
48
+ }) => x({
49
+ display: "flex",
50
+ height: "0.01em",
51
+ // Fix IE11 flexbox alignment. To remove at some point.
52
+ maxHeight: "2em",
53
+ alignItems: "center",
54
+ whiteSpace: "nowrap",
55
+ color: (e.vars || e).palette.action.active
56
+ }, o.variant === "filled" && {
57
+ // Styles applied to the root element if `variant="filled"`.
58
+ [`&.${D.positionStart}&:not(.${D.hiddenLabel})`]: {
59
+ marginTop: 16
60
+ }
61
+ }, o.position === "start" && {
62
+ // Styles applied to the root element if `position="start"`.
63
+ marginRight: 8
64
+ }, o.position === "end" && {
65
+ // Styles applied to the root element if `position="end"`.
66
+ marginLeft: 8
67
+ }, o.disablePointerEvents === !0 && {
68
+ // Styles applied to the root element if `disablePointerEvents={true}`.
69
+ pointerEvents: "none"
70
+ })), Y = /* @__PURE__ */ M.forwardRef(function(o, s) {
71
+ const n = Q({
72
+ props: o,
73
+ name: "MuiInputAdornment"
74
+ }), {
75
+ children: r,
76
+ className: l,
77
+ component: c = "div",
78
+ disablePointerEvents: y = !1,
79
+ disableTypography: u = !1,
80
+ position: m,
81
+ variant: g
82
+ } = n, p = K(n, Ce), f = me() || {};
83
+ let i = g;
84
+ g && f.variant && process.env.NODE_ENV !== "production" && g === f.variant && console.error("MUI: The `InputAdornment` variant infers the variant prop you do not have to provide one."), f && !i && (i = f.variant);
85
+ const C = x({}, n, {
86
+ hiddenLabel: f.hiddenLabel,
87
+ size: f.size,
88
+ disablePointerEvents: y,
89
+ position: m,
90
+ variant: i
91
+ }), I = he(C);
92
+ return /* @__PURE__ */ d(fe.Provider, {
93
+ value: null,
94
+ children: /* @__PURE__ */ d(Me, x({
95
+ as: c,
96
+ ownerState: C,
97
+ className: w(I.root, l),
98
+ ref: s
99
+ }, p, {
100
+ children: typeof r == "string" && !u ? /* @__PURE__ */ d(be, {
101
+ color: "text.secondary",
102
+ children: r
103
+ }) : /* @__PURE__ */ q(M.Fragment, {
104
+ children: [m === "start" ? (
105
+ /* notranslate needed while Google Translate will not fix zero-width space issue */
106
+ z || (z = /* @__PURE__ */ d("span", {
107
+ className: "notranslate",
108
+ children: "​"
109
+ }))
110
+ ) : null, r]
111
+ })
112
+ }))
113
+ });
114
+ });
115
+ process.env.NODE_ENV !== "production" && (Y.propTypes = {
116
+ // ----------------------------- Warning --------------------------------
117
+ // | These PropTypes are generated from the TypeScript type definitions |
118
+ // | To update them edit the d.ts file and run "yarn proptypes" |
119
+ // ----------------------------------------------------------------------
120
+ /**
121
+ * The content of the component, normally an `IconButton` or string.
122
+ */
123
+ children: t.node,
124
+ /**
125
+ * Override or extend the styles applied to the component.
126
+ */
127
+ classes: t.object,
128
+ /**
129
+ * @ignore
130
+ */
131
+ className: t.string,
132
+ /**
133
+ * The component used for the root node.
134
+ * Either a string to use a HTML element or a component.
135
+ */
136
+ component: t.elementType,
137
+ /**
138
+ * Disable pointer events on the root.
139
+ * This allows for the content of the adornment to focus the `input` on click.
140
+ * @default false
141
+ */
142
+ disablePointerEvents: t.bool,
143
+ /**
144
+ * If children is a string then disable wrapping in a Typography component.
145
+ * @default false
146
+ */
147
+ disableTypography: t.bool,
148
+ /**
149
+ * The position this adornment should appear relative to the `Input`.
150
+ */
151
+ position: t.oneOf(["end", "start"]).isRequired,
152
+ /**
153
+ * The system prop that allows defining system overrides as well as additional CSS styles.
154
+ */
155
+ sx: t.oneOfType([t.arrayOf(t.oneOfType([t.func, t.object, t.bool])), t.func, t.object]),
156
+ /**
157
+ * The variant to use.
158
+ * Note: If you are using the `TextField` component or the `FormControl` component
159
+ * you do not have to set this manually.
160
+ */
161
+ variant: t.oneOf(["filled", "outlined", "standard"])
162
+ });
163
+ const A = Y, Oe = j("MuiListItemIcon", ["root", "alignItemsFlexStart"]), U = Oe, Te = j("MuiListItemText", ["root", "multiline", "dense", "inset", "primary", "secondary"]), G = Te;
164
+ function Ee(e) {
165
+ return W("MuiMenuItem", e);
166
+ }
167
+ const Pe = j("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divider", "gutters", "selected"]), T = Pe, Ne = ["autoFocus", "component", "dense", "divider", "disableGutters", "focusVisibleClassName", "role", "tabIndex", "className"], je = (e, o) => {
168
+ const {
169
+ ownerState: s
170
+ } = e;
171
+ return [o.root, s.dense && o.dense, s.divider && o.divider, !s.disableGutters && o.gutters];
172
+ }, Se = (e) => {
173
+ const {
174
+ disabled: o,
175
+ dense: s,
176
+ divider: n,
177
+ disableGutters: r,
178
+ selected: l,
179
+ classes: c
180
+ } = e, u = X({
181
+ root: ["root", s && "dense", o && "disabled", !r && "gutters", n && "divider", l && "selected"]
182
+ }, Ee, c);
183
+ return x({}, c, u);
184
+ }, Le = J(ve, {
185
+ shouldForwardProp: (e) => ue(e) || e === "classes",
186
+ name: "MuiMenuItem",
187
+ slot: "Root",
188
+ overridesResolver: je
189
+ })(({
190
+ theme: e,
191
+ ownerState: o
192
+ }) => x({}, e.typography.body1, {
193
+ display: "flex",
194
+ justifyContent: "flex-start",
195
+ alignItems: "center",
196
+ position: "relative",
197
+ textDecoration: "none",
198
+ minHeight: 48,
199
+ paddingTop: 6,
200
+ paddingBottom: 6,
201
+ boxSizing: "border-box",
202
+ whiteSpace: "nowrap"
203
+ }, !o.disableGutters && {
204
+ paddingLeft: 16,
205
+ paddingRight: 16
206
+ }, o.divider && {
207
+ borderBottom: `1px solid ${(e.vars || e).palette.divider}`,
208
+ backgroundClip: "padding-box"
209
+ }, {
210
+ "&:hover": {
211
+ textDecoration: "none",
212
+ backgroundColor: (e.vars || e).palette.action.hover,
213
+ // Reset on touch devices, it doesn't add specificity
214
+ "@media (hover: none)": {
215
+ backgroundColor: "transparent"
216
+ }
217
+ },
218
+ [`&.${T.selected}`]: {
219
+ backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : N(e.palette.primary.main, e.palette.action.selectedOpacity),
220
+ [`&.${T.focusVisible}`]: {
221
+ backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))` : N(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.focusOpacity)
222
+ }
223
+ },
224
+ [`&.${T.selected}:hover`]: {
225
+ backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))` : N(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.hoverOpacity),
226
+ // Reset on touch devices, it doesn't add specificity
227
+ "@media (hover: none)": {
228
+ backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : N(e.palette.primary.main, e.palette.action.selectedOpacity)
229
+ }
230
+ },
231
+ [`&.${T.focusVisible}`]: {
232
+ backgroundColor: (e.vars || e).palette.action.focus
233
+ },
234
+ [`&.${T.disabled}`]: {
235
+ opacity: (e.vars || e).palette.action.disabledOpacity
236
+ },
237
+ [`& + .${k.root}`]: {
238
+ marginTop: e.spacing(1),
239
+ marginBottom: e.spacing(1)
240
+ },
241
+ [`& + .${k.inset}`]: {
242
+ marginLeft: 52
243
+ },
244
+ [`& .${G.root}`]: {
245
+ marginTop: 0,
246
+ marginBottom: 0
247
+ },
248
+ [`& .${G.inset}`]: {
249
+ paddingLeft: 36
250
+ },
251
+ [`& .${U.root}`]: {
252
+ minWidth: 36
253
+ }
254
+ }, !o.dense && {
255
+ [e.breakpoints.up("sm")]: {
256
+ minHeight: "auto"
257
+ }
258
+ }, o.dense && x({
259
+ minHeight: 32,
260
+ // https://m2.material.io/components/menus#specs > Dense
261
+ paddingTop: 4,
262
+ paddingBottom: 4
263
+ }, e.typography.body2, {
264
+ [`& .${U.root} svg`]: {
265
+ fontSize: "1.25rem"
266
+ }
267
+ }))), Z = /* @__PURE__ */ M.forwardRef(function(o, s) {
268
+ const n = Q({
269
+ props: o,
270
+ name: "MuiMenuItem"
271
+ }), {
272
+ autoFocus: r = !1,
273
+ component: l = "li",
274
+ dense: c = !1,
275
+ divider: y = !1,
276
+ disableGutters: u = !1,
277
+ focusVisibleClassName: m,
278
+ role: g = "menuitem",
279
+ tabIndex: p,
280
+ className: f
281
+ } = n, i = K(n, Ne), C = M.useContext(B), I = M.useMemo(() => ({
282
+ dense: c || C.dense || !1,
283
+ disableGutters: u
284
+ }), [C.dense, c, u]), b = M.useRef(null);
285
+ ge(() => {
286
+ r && (b.current ? b.current.focus() : process.env.NODE_ENV !== "production" && console.error("MUI: Unable to set focus to a MenuItem whose component has not been rendered."));
287
+ }, [r]);
288
+ const S = x({}, n, {
289
+ dense: I.dense,
290
+ divider: y,
291
+ disableGutters: u
292
+ }), $ = Se(n), L = ye(b, s);
293
+ let E;
294
+ return n.disabled || (E = p !== void 0 ? p : -1), /* @__PURE__ */ d(B.Provider, {
295
+ value: I,
296
+ children: /* @__PURE__ */ d(Le, x({
297
+ ref: L,
298
+ role: g,
299
+ tabIndex: E,
300
+ component: l,
301
+ focusVisibleClassName: w($.focusVisible, m),
302
+ className: w($.root, f)
303
+ }, i, {
304
+ ownerState: S,
305
+ classes: $
306
+ }))
307
+ });
308
+ });
309
+ process.env.NODE_ENV !== "production" && (Z.propTypes = {
310
+ // ----------------------------- Warning --------------------------------
311
+ // | These PropTypes are generated from the TypeScript type definitions |
312
+ // | To update them edit the d.ts file and run "yarn proptypes" |
313
+ // ----------------------------------------------------------------------
314
+ /**
315
+ * If `true`, the list item is focused during the first mount.
316
+ * Focus will also be triggered if the value changes from false to true.
317
+ * @default false
318
+ */
319
+ autoFocus: t.bool,
320
+ /**
321
+ * The content of the component.
322
+ */
323
+ children: t.node,
324
+ /**
325
+ * Override or extend the styles applied to the component.
326
+ */
327
+ classes: t.object,
328
+ /**
329
+ * @ignore
330
+ */
331
+ className: t.string,
332
+ /**
333
+ * The component used for the root node.
334
+ * Either a string to use a HTML element or a component.
335
+ */
336
+ component: t.elementType,
337
+ /**
338
+ * If `true`, compact vertical padding designed for keyboard and mouse input is used.
339
+ * The prop defaults to the value inherited from the parent Menu component.
340
+ * @default false
341
+ */
342
+ dense: t.bool,
343
+ /**
344
+ * @ignore
345
+ */
346
+ disabled: t.bool,
347
+ /**
348
+ * If `true`, the left and right padding is removed.
349
+ * @default false
350
+ */
351
+ disableGutters: t.bool,
352
+ /**
353
+ * If `true`, a 1px light border is added to the bottom of the menu item.
354
+ * @default false
355
+ */
356
+ divider: t.bool,
357
+ /**
358
+ * This prop can help identify which element has keyboard focus.
359
+ * The class name will be applied when the element gains the focus through keyboard interaction.
360
+ * It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
361
+ * The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
362
+ * A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
363
+ * if needed.
364
+ */
365
+ focusVisibleClassName: t.string,
366
+ /**
367
+ * @ignore
368
+ */
369
+ role: t.string,
370
+ /**
371
+ * If `true`, the component is selected.
372
+ * @default false
373
+ */
374
+ selected: t.bool,
375
+ /**
376
+ * The system prop that allows defining system overrides as well as additional CSS styles.
377
+ */
378
+ sx: t.oneOfType([t.arrayOf(t.oneOfType([t.func, t.object, t.bool])), t.func, t.object]),
379
+ /**
380
+ * @default 0
381
+ */
382
+ tabIndex: t.number
383
+ });
384
+ const Re = Z;
385
+ var F = {}, we = se;
386
+ Object.defineProperty(F, "__esModule", {
387
+ value: !0
388
+ });
389
+ var H = F.default = void 0, Fe = we(oe()), _e = te, Ve = (0, Fe.default)(/* @__PURE__ */ (0, _e.jsx)("path", {
390
+ d: "M8.12 9.29 12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7a.9959.9959 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0z"
391
+ }), "KeyboardArrowDownRounded");
392
+ H = F.default = Ve;
393
+ const ot = ({
394
+ name: e,
395
+ label: o,
396
+ type: s,
397
+ value: n,
398
+ handleInputChange: r,
399
+ placeholder: l,
400
+ required: c,
401
+ disabled: y,
402
+ options: u,
403
+ optionsResponseHandler: m,
404
+ api_endpoint: g,
405
+ error: p,
406
+ helperText: f,
407
+ inputAdornments: i,
408
+ autofocus: C,
409
+ authHeader: I
410
+ }) => {
411
+ const [b, S] = ne([]), $ = V(
412
+ () => ({
413
+ "& .MuiSelect-select > span::before": {
414
+ content: `'${l || ""}'`,
415
+ color: O.grey
416
+ }
417
+ }),
418
+ [l]
419
+ ), L = V(
420
+ () => ({
421
+ ...P.textfield,
422
+ "&.Mui-focused": {
423
+ "& fieldset": {
424
+ borderColor: p ? O.redLight : O.primary
425
+ }
426
+ },
427
+ "& fieldset": {
428
+ borderColor: p ? O.redLight : "#BEBAC4"
429
+ },
430
+ "& input::placeholder": {
431
+ color: p ? O.redMedium : "grey"
432
+ },
433
+ ...s === "select" && $
434
+ }),
435
+ [p, s, $]
436
+ );
437
+ function E(a) {
438
+ const v = b == null ? void 0 : b.find(
439
+ (h) => typeof h == "object" ? h.value === a : h === a
440
+ );
441
+ return typeof v == "object" ? v.name : v;
442
+ }
443
+ const ee = ae(async () => {
444
+ var a;
445
+ if (s !== "select")
446
+ return [];
447
+ if (u)
448
+ return u;
449
+ if (g && m) {
450
+ const v = {
451
+ "Content-Type": "application/json"
452
+ };
453
+ return I && (v.Authorization = I), (a = (await (await fetch(g, { headers: v })).json())[m.key]) == null ? void 0 : a.map((_) => ({
454
+ name: _[m.name],
455
+ value: _[m.value]
456
+ }));
457
+ }
458
+ return [];
459
+ }, [s, m, g, I]);
460
+ return re(() => {
461
+ ee().then((a) => S(a));
462
+ }, []), /* @__PURE__ */ q(de, { sx: le.inputWrapper, children: [
463
+ /* @__PURE__ */ d(
464
+ ce,
465
+ {
466
+ name: e,
467
+ label: o,
468
+ required: c,
469
+ inputAdornments: i
470
+ }
471
+ ),
472
+ /* @__PURE__ */ d(
473
+ pe,
474
+ {
475
+ id: `form-input-${e}`,
476
+ autoFocus: C,
477
+ name: e,
478
+ type: s,
479
+ select: s === "select",
480
+ value: n,
481
+ onChange: r,
482
+ placeholder: l,
483
+ required: c,
484
+ disabled: y,
485
+ error: p,
486
+ InputProps: {
487
+ startAdornment: /* @__PURE__ */ d(
488
+ A,
489
+ {
490
+ position: "start",
491
+ sx: P.inputAdornment,
492
+ children: i == null ? void 0 : i.beforeInput
493
+ }
494
+ ),
495
+ endAdornment: /* @__PURE__ */ d(
496
+ A,
497
+ {
498
+ position: "end",
499
+ sx: P.inputAdornment,
500
+ children: i == null ? void 0 : i.afterInput
501
+ }
502
+ )
503
+ },
504
+ SelectProps: {
505
+ renderValue: E,
506
+ IconComponent: H,
507
+ MenuProps: {
508
+ sx: P.selectDropdown
509
+ }
510
+ },
511
+ sx: L,
512
+ children: s === "select" && (b == null ? void 0 : b.map((a) => {
513
+ const v = typeof a == "object", h = {
514
+ display: "flex",
515
+ justifyContent: "space-between",
516
+ alignItems: "center",
517
+ gap: "1rem"
518
+ };
519
+ return /* @__PURE__ */ d(
520
+ Re,
521
+ {
522
+ value: v ? a.value : a,
523
+ sx: h,
524
+ children: v ? a.name : a
525
+ },
526
+ v ? a.name : a
527
+ );
528
+ }))
529
+ }
530
+ ),
531
+ p && /* @__PURE__ */ d(ie, { message: f || "" })
532
+ ] });
533
+ };
534
+ export {
535
+ ot as default
536
+ };