@loopr-ai/craft 0.8.2 → 0.9.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 (53) 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.js +54 -1524
  20. package/dist/components/organ/Form/Label/Label.styles.d.ts +14 -0
  21. package/dist/components/organ/Form/Label/Label.styles.js +16 -0
  22. package/dist/components/organ/Form/Label/index.d.ts +10 -0
  23. package/dist/components/organ/Form/Label/index.js +17 -0
  24. package/dist/components/organ/Form/RadioInput/RadioInput.styles.d.ts +17 -0
  25. package/dist/components/organ/Form/RadioInput/RadioInput.styles.js +20 -0
  26. package/dist/components/organ/Form/RadioInput/index.d.ts +16 -0
  27. package/dist/components/organ/Form/RadioInput/index.js +1053 -0
  28. package/dist/components/organ/Form/TextfieldInput/TextfieldInput.styles.d.ts +75 -0
  29. package/dist/components/organ/Form/TextfieldInput/TextfieldInput.styles.js +66 -0
  30. package/dist/components/organ/Form/TextfieldInput/index.d.ts +23 -0
  31. package/dist/components/organ/Form/TextfieldInput/index.js +525 -0
  32. package/dist/components/organ/Form/index.js +136 -148
  33. package/dist/components/organ/ZoomControlWithDrag/ZoomControllers.js +2 -2
  34. package/dist/components/organ/ZoomControlWithDrag/index.js +29 -35
  35. package/dist/{createSvgIcon-45340b5e.js → createSvgIcon-59e7bc15.js} +3195 -3245
  36. package/dist/{createSvgIcon-5aac746d.js → createSvgIcon-b444ce70.js} +5 -5
  37. package/dist/{createTheme-759a022d.js → createTheme-d2329909.js} +4 -4
  38. package/dist/dividerClasses-9354a5c9.js +10 -0
  39. package/dist/{exactProp-23d6a154.js → exactProp-3ee21234.js} +1 -1
  40. package/dist/{extendSxProp-cf8fd923.js → extendSxProp-f6cb682b.js} +1 -1
  41. package/dist/global/colors.d.ts +1 -0
  42. package/dist/global/colors.js +5 -4
  43. package/dist/global/theme.js +1 -1
  44. package/dist/{index-c9c32237.js → index-ae3eb123.js} +8 -8
  45. package/dist/main.js +1 -1
  46. package/dist/providers/CraftThemeProvider.js +2 -2
  47. package/dist/{styled-78608e1f.js → styled-8f7db30d.js} +39 -39
  48. package/dist/useControlled-4e337b2f.js +54 -0
  49. package/dist/useFormControl-b25c5813.js +19 -0
  50. package/dist/{useTheme-8906bd79.js → useTheme-21caf71b.js} +1 -1
  51. package/package.json +1 -1
  52. package/dist/Tooltip-e797a425.js +0 -2022
  53. 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,23 @@
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
+ }
22
+ declare const TextfieldInput: CraftFC<TextfieldInputProps>;
23
+ export default TextfieldInput;
@@ -0,0 +1,525 @@
1
+ import ee, { jsx as d, jsxs as q } from "react/jsx-runtime";
2
+ import { r as te, i as oe } from "../../../../createSvgIcon-59e7bc15.js";
3
+ import * as $ from "react";
4
+ import { useState as se, useMemo as V, useCallback as ne, useEffect as ae } from "react";
5
+ import { customColors as O } from "../../../../global/colors.js";
6
+ import re from "../ErrorMessage/index.js";
7
+ import ie from "../Form.styles.js";
8
+ import le from "../Label/index.js";
9
+ import N from "./TextfieldInput.styles.js";
10
+ import { B as ce } from "../../../../Box-96e795c4.js";
11
+ import { L as B, T as de } from "../../../../TextField-df89b641.js";
12
+ import { g as W, a as I, _ as K, P as t, b as R, f as S } from "../../../../createTheme-d2329909.js";
13
+ import { g as j, s as H, b as J, c as w, e as Q, r as pe } from "../../../../styled-8f7db30d.js";
14
+ import { u as ue, F as me } from "../../../../useFormControl-b25c5813.js";
15
+ import { M as fe } from "../../../../index-ae3eb123.js";
16
+ import { B as be } from "../../../../ButtonBase-46c20f20.js";
17
+ import { d as k } from "../../../../dividerClasses-9354a5c9.js";
18
+ import { c as ve, u as ge } from "../../../../TransitionGroupContext-21923db7.js";
19
+ function ye(e) {
20
+ return W("MuiInputAdornment", e);
21
+ }
22
+ const Ie = j("MuiInputAdornment", ["root", "filled", "standard", "outlined", "positionStart", "positionEnd", "disablePointerEvents", "hiddenLabel", "sizeSmall"]), D = Ie;
23
+ var z;
24
+ const xe = ["children", "className", "component", "disablePointerEvents", "disableTypography", "position", "variant"], Ce = (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
+ }, $e = (e) => {
30
+ const {
31
+ classes: o,
32
+ disablePointerEvents: s,
33
+ hiddenLabel: n,
34
+ position: r,
35
+ size: l,
36
+ variant: c
37
+ } = e, g = {
38
+ root: ["root", s && "disablePointerEvents", r && `position${R(r)}`, c, n && "hiddenLabel", l && `size${R(l)}`]
39
+ };
40
+ return Q(g, ye, o);
41
+ }, he = H("div", {
42
+ name: "MuiInputAdornment",
43
+ slot: "Root",
44
+ overridesResolver: Ce
45
+ })(({
46
+ theme: e,
47
+ ownerState: o
48
+ }) => I({
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
+ })), X = /* @__PURE__ */ $.forwardRef(function(o, s) {
71
+ const n = J({
72
+ props: o,
73
+ name: "MuiInputAdornment"
74
+ }), {
75
+ children: r,
76
+ className: l,
77
+ component: c = "div",
78
+ disablePointerEvents: g = !1,
79
+ disableTypography: m = !1,
80
+ position: f,
81
+ variant: v
82
+ } = n, p = K(n, xe), b = ue() || {};
83
+ let i = v;
84
+ v && b.variant && process.env.NODE_ENV !== "production" && v === b.variant && console.error("MUI: The `InputAdornment` variant infers the variant prop you do not have to provide one."), b && !i && (i = b.variant);
85
+ const x = I({}, n, {
86
+ hiddenLabel: b.hiddenLabel,
87
+ size: b.size,
88
+ disablePointerEvents: g,
89
+ position: f,
90
+ variant: i
91
+ }), u = $e(x);
92
+ return /* @__PURE__ */ d(me.Provider, {
93
+ value: null,
94
+ children: /* @__PURE__ */ d(he, I({
95
+ as: c,
96
+ ownerState: x,
97
+ className: w(u.root, l),
98
+ ref: s
99
+ }, p, {
100
+ children: typeof r == "string" && !m ? /* @__PURE__ */ d(fe, {
101
+ color: "text.secondary",
102
+ children: r
103
+ }) : /* @__PURE__ */ q($.Fragment, {
104
+ children: [f === "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" && (X.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 = X, Me = j("MuiListItemIcon", ["root", "alignItemsFlexStart"]), U = Me, Oe = j("MuiListItemText", ["root", "multiline", "dense", "inset", "primary", "secondary"]), G = Oe;
164
+ function Te(e) {
165
+ return W("MuiMenuItem", e);
166
+ }
167
+ const Ee = j("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divider", "gutters", "selected"]), T = Ee, Pe = ["autoFocus", "component", "dense", "divider", "disableGutters", "focusVisibleClassName", "role", "tabIndex", "className"], Ne = (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, m = Q({
181
+ root: ["root", s && "dense", o && "disabled", !r && "gutters", n && "divider", l && "selected"]
182
+ }, Te, c);
183
+ return I({}, c, m);
184
+ }, je = H(be, {
185
+ shouldForwardProp: (e) => pe(e) || e === "classes",
186
+ name: "MuiMenuItem",
187
+ slot: "Root",
188
+ overridesResolver: Ne
189
+ })(({
190
+ theme: e,
191
+ ownerState: o
192
+ }) => I({}, 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})` : S(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}))` : S(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}))` : S(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})` : S(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 && I({
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
+ }))), Y = /* @__PURE__ */ $.forwardRef(function(o, s) {
268
+ const n = J({
269
+ props: o,
270
+ name: "MuiMenuItem"
271
+ }), {
272
+ autoFocus: r = !1,
273
+ component: l = "li",
274
+ dense: c = !1,
275
+ divider: g = !1,
276
+ disableGutters: m = !1,
277
+ focusVisibleClassName: f,
278
+ role: v = "menuitem",
279
+ tabIndex: p,
280
+ className: b
281
+ } = n, i = K(n, Pe), x = $.useContext(B), u = $.useMemo(() => ({
282
+ dense: c || x.dense || !1,
283
+ disableGutters: m
284
+ }), [x.dense, c, m]), h = $.useRef(null);
285
+ ve(() => {
286
+ r && (h.current ? h.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 E = I({}, n, {
289
+ dense: u.dense,
290
+ divider: g,
291
+ disableGutters: m
292
+ }), M = Se(n), L = ge(h, s);
293
+ let P;
294
+ return n.disabled || (P = p !== void 0 ? p : -1), /* @__PURE__ */ d(B.Provider, {
295
+ value: u,
296
+ children: /* @__PURE__ */ d(je, I({
297
+ ref: L,
298
+ role: v,
299
+ tabIndex: P,
300
+ component: l,
301
+ focusVisibleClassName: w(M.focusVisible, f),
302
+ className: w(M.root, b)
303
+ }, i, {
304
+ ownerState: E,
305
+ classes: M
306
+ }))
307
+ });
308
+ });
309
+ process.env.NODE_ENV !== "production" && (Y.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 Le = Y;
385
+ var F = {}, Re = oe;
386
+ Object.defineProperty(F, "__esModule", {
387
+ value: !0
388
+ });
389
+ var Z = F.default = void 0, we = Re(te()), Fe = ee, _e = (0, we.default)(/* @__PURE__ */ (0, Fe.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
+ Z = F.default = _e;
393
+ const et = ({
394
+ name: e,
395
+ label: o,
396
+ type: s,
397
+ value: n,
398
+ handleInputChange: r,
399
+ placeholder: l,
400
+ required: c,
401
+ disabled: g,
402
+ options: m,
403
+ optionsResponseHandler: f,
404
+ api_endpoint: v,
405
+ error: p,
406
+ helperText: b,
407
+ inputAdornments: i,
408
+ autofocus: x
409
+ }) => {
410
+ const [u, h] = se([]), E = V(
411
+ () => ({
412
+ "& .MuiSelect-select > span::before": {
413
+ content: `'${l || ""}'`,
414
+ color: O.grey
415
+ }
416
+ }),
417
+ [l]
418
+ ), M = V(
419
+ () => ({
420
+ ...N.textfield,
421
+ "&.Mui-focused": {
422
+ "& fieldset": {
423
+ borderColor: p ? O.redLight : O.primary
424
+ }
425
+ },
426
+ "& fieldset": {
427
+ borderColor: p ? O.redLight : "#BEBAC4"
428
+ },
429
+ "& input::placeholder": {
430
+ color: p ? O.redMedium : "grey"
431
+ },
432
+ ...s === "select" && E
433
+ }),
434
+ [p, s, E]
435
+ );
436
+ function L(a) {
437
+ const y = u == null ? void 0 : u.find(
438
+ (C) => typeof C == "object" ? C.value === a : C === a
439
+ );
440
+ return typeof y == "object" ? y.name : y;
441
+ }
442
+ const P = ne(async () => {
443
+ var a;
444
+ return s !== "select" ? [] : m || (v && f ? (a = (await (await fetch(v)).json())[f.key]) == null ? void 0 : a.map((_) => ({
445
+ name: _[f.name],
446
+ value: _[f.value]
447
+ })) : []);
448
+ }, [s, f, v]);
449
+ return ae(() => {
450
+ P().then((a) => h(a));
451
+ }, []), /* @__PURE__ */ q(ce, { sx: ie.inputWrapper, children: [
452
+ /* @__PURE__ */ d(
453
+ le,
454
+ {
455
+ name: e,
456
+ label: o,
457
+ required: c,
458
+ inputAdornments: i
459
+ }
460
+ ),
461
+ /* @__PURE__ */ d(
462
+ de,
463
+ {
464
+ id: `form-input-${e}`,
465
+ autoFocus: x,
466
+ name: e,
467
+ type: s,
468
+ select: s === "select",
469
+ value: n,
470
+ onChange: r,
471
+ placeholder: l,
472
+ required: c,
473
+ disabled: g,
474
+ error: p,
475
+ InputProps: {
476
+ startAdornment: /* @__PURE__ */ d(
477
+ A,
478
+ {
479
+ position: "start",
480
+ sx: N.inputAdornment,
481
+ children: i == null ? void 0 : i.beforeInput
482
+ }
483
+ ),
484
+ endAdornment: /* @__PURE__ */ d(
485
+ A,
486
+ {
487
+ position: "end",
488
+ sx: N.inputAdornment,
489
+ children: i == null ? void 0 : i.afterInput
490
+ }
491
+ )
492
+ },
493
+ SelectProps: {
494
+ renderValue: L,
495
+ IconComponent: Z,
496
+ MenuProps: {
497
+ sx: N.selectDropdown
498
+ }
499
+ },
500
+ sx: M,
501
+ children: s === "select" && (u == null ? void 0 : u.map((a) => {
502
+ const y = typeof a == "object", C = {
503
+ display: "flex",
504
+ justifyContent: "space-between",
505
+ alignItems: "center",
506
+ gap: "1rem"
507
+ };
508
+ return /* @__PURE__ */ d(
509
+ Le,
510
+ {
511
+ value: y ? a.value : a,
512
+ sx: C,
513
+ children: y ? a.name : a
514
+ },
515
+ y ? a.name : a
516
+ );
517
+ }))
518
+ }
519
+ ),
520
+ p && /* @__PURE__ */ d(re, { message: b || "" })
521
+ ] });
522
+ };
523
+ export {
524
+ et as default
525
+ };