@s_mart/form 16.1.2 → 16.1.3
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.
- package/dist/checkbox/checkbox.mjs +43 -0
- package/dist/checkbox/checkbox.mjs.map +1 -0
- package/dist/components/fieldError/fieldError.mjs +20 -0
- package/dist/components/fieldError/fieldError.mjs.map +1 -0
- package/dist/components/fieldInfo/fieldInfo.mjs +20 -0
- package/dist/components/fieldInfo/fieldInfo.mjs.map +1 -0
- package/dist/components/fieldLabel/fieldLabel.mjs +29 -0
- package/dist/components/fieldLabel/fieldLabel.mjs.map +1 -0
- package/dist/creatable/creatable.mjs +191 -0
- package/dist/creatable/creatable.mjs.map +1 -0
- package/dist/creatable/creatable.styles.mjs +41 -0
- package/dist/creatable/creatable.styles.mjs.map +1 -0
- package/dist/datePicker/datePicker.mjs +75 -0
- package/dist/datePicker/datePicker.mjs.map +1 -0
- package/dist/datePicker/datePicker.styles.mjs +29 -0
- package/dist/datePicker/datePicker.styles.mjs.map +1 -0
- package/dist/form/form.mjs +16 -0
- package/dist/form/form.mjs.map +1 -0
- package/dist/form/formProvider.mjs +19 -0
- package/dist/form/formProvider.mjs.map +1 -0
- package/dist/form/useForm.mjs +20 -0
- package/dist/form/useForm.mjs.map +1 -0
- package/dist/formComponentPrecisaDeControl.mjs +10 -0
- package/dist/formComponentPrecisaDeControl.mjs.map +1 -0
- package/dist/index.mjs +18 -865
- package/dist/radio/radioButton/radioButton.mjs +19 -0
- package/dist/radio/radioButton/radioButton.mjs.map +1 -0
- package/dist/radio/radioGroup/radioGroup.mjs +46 -0
- package/dist/radio/radioGroup/radioGroup.mjs.map +1 -0
- package/dist/searchable/searchable.mjs +111 -0
- package/dist/searchable/searchable.mjs.map +1 -0
- package/dist/select/select.mjs +117 -0
- package/dist/select/select.mjs.map +1 -0
- package/dist/select/selectRenderValue.mjs +11 -0
- package/dist/select/selectRenderValue.mjs.map +1 -0
- package/dist/slider/slider.mjs +26 -0
- package/dist/slider/slider.mjs.map +1 -0
- package/dist/switch/switch.mjs +39 -0
- package/dist/switch/switch.mjs.map +1 -0
- package/dist/textField/textField.mjs +102 -0
- package/dist/textField/textField.mjs.map +1 -0
- package/dist/timePicker/timePicker.mjs +76 -0
- package/dist/timePicker/timePicker.mjs.map +1 -0
- package/dist/timePicker/timePicker.styles.mjs +29 -0
- package/dist/timePicker/timePicker.styles.mjs.map +1 -0
- package/dist/utils/erroFieldFormatado.mjs +6 -0
- package/dist/utils/erroFieldFormatado.mjs.map +1 -0
- package/dist/utils/typedMemo.mjs +7 -0
- package/dist/utils/typedMemo.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import e from "../components/fieldError/fieldError.mjs";
|
|
2
|
+
import t from "../components/fieldLabel/fieldLabel.mjs";
|
|
3
|
+
import { FormComponentPrecisaDeControl as n } from "../formComponentPrecisaDeControl.mjs";
|
|
4
|
+
import { typedMemo as r } from "../utils/typedMemo.mjs";
|
|
5
|
+
import { useController as i, useFormContext as a } from "react-hook-form";
|
|
6
|
+
import { Checkbox as o, FormControlLabel as s } from "@mui/material";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
var u = r(({ name: r, rules: u, defaultValue: d, shouldUnregister: f, control: p, label: m, labelPlacement: h, required: g, disableIconError: _, onChange: v, ...y }) => {
|
|
9
|
+
let b = a()?.control, x = p ?? b;
|
|
10
|
+
if (!x) throw new n("Checkbox");
|
|
11
|
+
let { field: S } = i({
|
|
12
|
+
control: x,
|
|
13
|
+
name: r,
|
|
14
|
+
rules: u,
|
|
15
|
+
defaultValue: d,
|
|
16
|
+
shouldUnregister: f
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ l("span", { children: [/* @__PURE__ */ c(s, {
|
|
19
|
+
control: /* @__PURE__ */ c(o, {
|
|
20
|
+
checked: !!S.value,
|
|
21
|
+
value: S.value ?? "",
|
|
22
|
+
defaultValue: S.value,
|
|
23
|
+
onChange: (e, t) => {
|
|
24
|
+
S.onChange(e, t), v?.(e, t);
|
|
25
|
+
},
|
|
26
|
+
...y
|
|
27
|
+
}, r),
|
|
28
|
+
label: /* @__PURE__ */ c(t, {
|
|
29
|
+
label: m,
|
|
30
|
+
required: g,
|
|
31
|
+
regular: !0
|
|
32
|
+
}),
|
|
33
|
+
labelPlacement: h || "end"
|
|
34
|
+
}), /* @__PURE__ */ c(e, {
|
|
35
|
+
name: r,
|
|
36
|
+
disableIcon: _,
|
|
37
|
+
control: x
|
|
38
|
+
})] });
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export { u as default };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=checkbox.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.mjs","names":[],"sources":["../../src/checkbox/checkbox.tsx"],"sourcesContent":["import { type FieldPath, type FieldValues, useController, useFormContext } from 'react-hook-form';\nimport type { CheckboxProps } from './checkbox.types';\nimport { Checkbox as CheckboxMui, FormControlLabel } from '@mui/material';\nimport { FieldError } from '../components/fieldError';\nimport { FieldLabel } from '../components/fieldLabel';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\nimport { typedMemo } from '../utils/typedMemo';\n\nconst Checkbox = ({\n // RHF\n name,\n rules,\n defaultValue,\n shouldUnregister,\n control: controlFromProps,\n // Component Props\n label,\n labelPlacement,\n required,\n disableIconError,\n onChange: onChangeProp,\n ...rest\n}: CheckboxProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('Checkbox');\n }\n\n const { field } = useController({\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n });\n\n return (\n <span>\n <FormControlLabel\n control={\n <CheckboxMui\n key={name}\n checked={Boolean(field.value)}\n value={field.value ?? ''}\n defaultValue={field.value}\n onChange={(event, checked) => {\n field.onChange(event, checked);\n onChangeProp?.(event, checked);\n }}\n {...rest}\n />\n }\n label={<FieldLabel label={label} required={required} regular />}\n labelPlacement={labelPlacement || 'end'}\n />\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </span>\n );\n};\n\nexport default typedMemo(Checkbox);\n"],"mappings":";;;;;;;AA+DA,IAAA,IAAe,GAvDG,EAEhB,SACA,UACA,iBACA,qBACA,SAAS,GAET,UACA,mBACA,aACA,qBACA,UAAU,GACV,GAAG,QACgB;CACnB,IAAM,IAAqB,EAAe,CAAC,EAAE,SAEvC,IAAU,KAAoB;CAEpC,IAAI,CAAC,GACH,MAAM,IAAI,EAA8B,UAAU;CAGpD,IAAM,EAAE,aAAU,EAAc;EAC9B;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,kBAAC,QAAD,EAAA,UAAA,CACE,kBAAC,GAAD;EACE,SACE,kBAAC,GAAD;GAEE,SAAS,EAAQ,EAAM;GACvB,OAAO,EAAM,SAAS;GACtB,cAAc,EAAM;GACpB,WAAW,GAAO,MAAY;IAE5B,AADA,EAAM,SAAS,GAAO,CAAO,GAC7B,IAAe,GAAO,CAAO;GAC/B;GACA,GAAI;EACL,GATM,CASN;EAEH,OAAO,kBAAC,GAAD;GAAmB;GAAiB;GAAU,SAAA;EAAS,CAAA;EAC9D,gBAAgB,KAAkB;CACnC,CAAA,GACD,kBAAC,GAAD;EAAkB;EAAM,aAAa;EAA2B;CAAU,CAAA,CACtE,EAAA,CAAA;AAEV,CAEiC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { erroFieldFormatado as e } from "../../utils/erroFieldFormatado.mjs";
|
|
2
|
+
import { useFormState as t } from "react-hook-form";
|
|
3
|
+
import { Indicator as n } from "@s_mart/core";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/fieldError/fieldError.tsx
|
|
6
|
+
var i = ({ name: i, disableIcon: a, control: o }) => {
|
|
7
|
+
let s = t({
|
|
8
|
+
control: o,
|
|
9
|
+
name: i
|
|
10
|
+
}), c = e(s?.errors, i);
|
|
11
|
+
return c ? /* @__PURE__ */ r(n, {
|
|
12
|
+
severity: "error",
|
|
13
|
+
icon: !a && void 0,
|
|
14
|
+
children: c?.message
|
|
15
|
+
}) : null;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { i as default };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=fieldError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldError.mjs","names":[],"sources":["../../../src/components/fieldError/fieldError.tsx"],"sourcesContent":["import { Indicator } from '@s_mart/core';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\nimport { useFormState } from 'react-hook-form';\nimport { erroFieldFormatado } from '../../utils/erroFieldFormatado';\nimport type { FieldErrorProps } from './fieldError.types';\n\nconst FieldError = <\n TFieldValues extends FieldValues = FieldValues,\n TFieldNames extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n name,\n disableIcon,\n control,\n}: FieldErrorProps<TFieldValues, TFieldNames>) => {\n const formState = useFormState<TFieldValues>({ control, name });\n\n const erro = erroFieldFormatado(formState?.errors, name);\n\n if (!erro) {\n return null;\n }\n\n return (\n <Indicator severity='error' icon={disableIcon ? false : undefined}>\n {erro?.message}\n </Indicator>\n );\n};\n\nexport default FieldError;\n"],"mappings":";;;;;AAMA,IAAM,KAGJ,EACA,SACA,gBACA,iBACgD;CAChD,IAAM,IAAY,EAA2B;EAAE;EAAS;CAAK,CAAC,GAExD,IAAO,EAAmB,GAAW,QAAQ,CAAI;CAMvD,OAJK,IAKH,kBAAC,GAAD;EAAW,UAAS;EAAQ,MAAM,MAAsB,KAAA;EACrD,UAAA,GAAM;CACE,CAAA,IANJ;AAQX"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Tooltip as e } from "@mui/material";
|
|
2
|
+
import { LIcon as t } from "@s_mart/core";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { lineInfoCircle as r } from "@s_mart/solid-icons";
|
|
5
|
+
//#region src/components/fieldInfo/fieldInfo.tsx
|
|
6
|
+
var i = ({ title: i }) => /* @__PURE__ */ n(e, {
|
|
7
|
+
title: i,
|
|
8
|
+
placement: "top",
|
|
9
|
+
children: /* @__PURE__ */ n("div", {
|
|
10
|
+
style: { width: "fit-content" },
|
|
11
|
+
children: /* @__PURE__ */ n(t, {
|
|
12
|
+
icon: r,
|
|
13
|
+
color: "#757575"
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { i as default };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=fieldInfo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldInfo.mjs","names":[],"sources":["../../../src/components/fieldInfo/fieldInfo.tsx"],"sourcesContent":["import { Tooltip } from '@mui/material';\nimport { LIcon } from '@s_mart/core';\nimport { lineInfoCircle } from '@s_mart/solid-icons';\nimport type { FieldInfoProps } from './fieldInfo.types';\n\nconst FieldInfo = ({ title }: FieldInfoProps) => {\n return (\n <Tooltip title={title} placement='top'>\n <div style={{ width: 'fit-content' }}>\n <LIcon icon={lineInfoCircle} color='#757575' />\n </div>\n </Tooltip>\n );\n};\n\nexport default FieldInfo;\n"],"mappings":";;;;;AAKA,IAAM,KAAa,EAAE,eAEjB,kBAAC,GAAD;CAAgB;CAAO,WAAU;CAC/B,UAAA,kBAAC,OAAD;EAAK,OAAO,EAAE,OAAO,cAAc;EACjC,UAAA,kBAAC,GAAD;GAAO,MAAM;GAAgB,OAAM;EAAW,CAAA;CAC3C,CAAA;AACE,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Typography as e } from "@mui/material";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { toRem as r } from "@s_mart/utils";
|
|
4
|
+
//#region src/components/fieldLabel/fieldLabel.tsx
|
|
5
|
+
var i = ({ label: i, required: a, regular: o }) => /* @__PURE__ */ n("span", {
|
|
6
|
+
style: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
gap: r(2)
|
|
10
|
+
},
|
|
11
|
+
children: [/* @__PURE__ */ t(e, {
|
|
12
|
+
variant: "caption",
|
|
13
|
+
style: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
alignItems: "center"
|
|
16
|
+
},
|
|
17
|
+
sx: { fontWeight: o ? 400 : 700 },
|
|
18
|
+
children: i
|
|
19
|
+
}), a && /* @__PURE__ */ t(e, {
|
|
20
|
+
variant: "caption",
|
|
21
|
+
color: "error",
|
|
22
|
+
sx: { fontWeight: 900 },
|
|
23
|
+
children: "*"
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { i as default };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=fieldLabel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldLabel.mjs","names":[],"sources":["../../../src/components/fieldLabel/fieldLabel.tsx"],"sourcesContent":["import { Typography } from '@mui/material';\nimport { toRem } from '@s_mart/utils';\nimport type { FieldLabelProps } from './fieldLabel.types';\n\nconst FieldLabel = ({ label, required, regular }: FieldLabelProps) => {\n return (\n <span style={{ display: 'flex', alignItems: 'center', gap: toRem(2) }}>\n <Typography\n variant='caption'\n style={{ display: 'flex', alignItems: 'center' }}\n sx={{\n fontWeight: regular ? 400 : 700,\n }}\n >\n {label}\n </Typography>\n {required && (\n <Typography\n variant='caption'\n color='error'\n sx={{\n fontWeight: 900,\n }}\n >\n *\n </Typography>\n )}\n </span>\n );\n};\n\nexport default FieldLabel;\n"],"mappings":";;;;AAIA,IAAM,KAAc,EAAE,UAAO,aAAU,iBAEnC,kBAAC,QAAD;CAAM,OAAO;EAAE,SAAS;EAAQ,YAAY;EAAU,KAAK,EAAM,CAAC;CAAE;CAApE,UAAA,CACE,kBAAC,GAAD;EACE,SAAQ;EACR,OAAO;GAAE,SAAS;GAAQ,YAAY;EAAS;EAC/C,IAAI,EACF,YAAY,IAAU,MAAM,IAC9B;EAEC,UAAA;CACS,CAAA,GACX,KACC,kBAAC,GAAD;EACE,SAAQ;EACR,OAAM;EACN,IAAI,EACF,YAAY,IACd;EACD,UAAA;CAEW,CAAA,CAEV"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { erroFieldFormatado as e } from "../utils/erroFieldFormatado.mjs";
|
|
2
|
+
import t from "../components/fieldError/fieldError.mjs";
|
|
3
|
+
import n from "../components/fieldLabel/fieldLabel.mjs";
|
|
4
|
+
import { FormComponentPrecisaDeControl as r } from "../formComponentPrecisaDeControl.mjs";
|
|
5
|
+
import { typedMemo as i } from "../utils/typedMemo.mjs";
|
|
6
|
+
import a from "../components/fieldInfo/fieldInfo.mjs";
|
|
7
|
+
import { SDivAutoComplete as o } from "./creatable.styles.mjs";
|
|
8
|
+
import { useController as s, useFormContext as c, useFormState as ee } from "react-hook-form";
|
|
9
|
+
import { Autocomplete as te, Button as l, Divider as u, IconButton as d, TextField as f } from "@mui/material";
|
|
10
|
+
import { LIcon as p } from "@s_mart/core";
|
|
11
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
import { toRem as _ } from "@s_mart/utils";
|
|
13
|
+
import { createElement as ne, forwardRef as v, useCallback as y, useState as b } from "react";
|
|
14
|
+
import { linePen as x, linePlus as S } from "@s_mart/solid-icons";
|
|
15
|
+
import "@s_mart/tokens";
|
|
16
|
+
import C from "lodash-es/isEmpty";
|
|
17
|
+
import w from "lodash-es/isEqual";
|
|
18
|
+
import T from "lodash-es/isObject";
|
|
19
|
+
//#region src/creatable/creatable.tsx
|
|
20
|
+
function E(i) {
|
|
21
|
+
let { name: E, rules: D, defaultValue: O, shouldUnregister: re, control: k, label: A, required: ie, options: ae, footer: j, showCreatableButton: M = !0, showEditableButton: N, onEditOption: P, onCreateOption: F, getOptionKey: I, getOptionLabel: L, getOptionAfterLabel: R, getInputValueLabel: z, multiple: B, info: V, noOptionsText: H = "Nenhuma opção encontrada", onChange: U, onInputChange: W, placeholder: G, ...K } = i, [q, J] = b(""), oe = c()?.control, Y = k ?? oe;
|
|
22
|
+
if (!Y) throw new r("Creatable");
|
|
23
|
+
let se = ee({
|
|
24
|
+
control: Y,
|
|
25
|
+
name: E
|
|
26
|
+
}), ce = e(se.errors, E), X = !M || K.disabled, { field: Z } = s({
|
|
27
|
+
name: E,
|
|
28
|
+
control: Y,
|
|
29
|
+
rules: D,
|
|
30
|
+
defaultValue: O,
|
|
31
|
+
shouldUnregister: re
|
|
32
|
+
}), le = (e) => {
|
|
33
|
+
let t = 0;
|
|
34
|
+
return i.slotProps?.textField?.slotProps?.input || (t += 2.5), X || (t += 2.56, Q(e) && (t += 2.56)), !K.disableClearable && !K.disabled && (t += 1.3), `${t}rem`;
|
|
35
|
+
}, Q = (e) => !K.disabled && N && T(e) && !C(e), ue = () => !K.disabled && M, $ = y(() => {
|
|
36
|
+
F !== void 0 && (F(q), J(""));
|
|
37
|
+
}, [q, F]), de = y(() => {
|
|
38
|
+
P?.(Z.value);
|
|
39
|
+
}, [Z.value, P]), fe = y((e, t, n) => {
|
|
40
|
+
n === "input" && (J(t), W?.(t));
|
|
41
|
+
}, [W]), pe = y((e, t) => {
|
|
42
|
+
J(""), Z.onChange(t), U?.(t);
|
|
43
|
+
}, [Z.onChange, U]), me = y((e) => {
|
|
44
|
+
K?.onBlur?.(e), J("");
|
|
45
|
+
}, [K?.onBlur]), he = Z.value ? Z.value : B ? [] : null;
|
|
46
|
+
return /* @__PURE__ */ g("div", {
|
|
47
|
+
style: {
|
|
48
|
+
display: "flex",
|
|
49
|
+
flexDirection: "column"
|
|
50
|
+
},
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ g("div", {
|
|
53
|
+
style: { display: "flex" },
|
|
54
|
+
children: [A && /* @__PURE__ */ h(n, {
|
|
55
|
+
label: A,
|
|
56
|
+
required: ie
|
|
57
|
+
}), V && /* @__PURE__ */ h(a, { title: V })]
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ h(o, { children: /* @__PURE__ */ h(te, {
|
|
60
|
+
fullWidth: !0,
|
|
61
|
+
onChange: pe,
|
|
62
|
+
onInputChange: fe,
|
|
63
|
+
onBlur: me,
|
|
64
|
+
slotProps: {
|
|
65
|
+
...K.slotProps,
|
|
66
|
+
listbox: { component: v(function(e, t) {
|
|
67
|
+
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("ul", {
|
|
68
|
+
...e,
|
|
69
|
+
ref: t
|
|
70
|
+
}), j === void 0 ? null : /* @__PURE__ */ g("div", {
|
|
71
|
+
...e,
|
|
72
|
+
children: [/* @__PURE__ */ h("div", {
|
|
73
|
+
style: {
|
|
74
|
+
paddingTop: "0.5rem",
|
|
75
|
+
paddingBottom: "0.5rem"
|
|
76
|
+
},
|
|
77
|
+
children: /* @__PURE__ */ h(u, {})
|
|
78
|
+
}), j()]
|
|
79
|
+
}, "creatable-footer")] });
|
|
80
|
+
}) }
|
|
81
|
+
},
|
|
82
|
+
value: he,
|
|
83
|
+
options: ae,
|
|
84
|
+
multiple: B,
|
|
85
|
+
readOnly: K.disabled,
|
|
86
|
+
noOptionsText: /* @__PURE__ */ g(m, { children: [
|
|
87
|
+
H,
|
|
88
|
+
!X && /* @__PURE__ */ g(l, {
|
|
89
|
+
sx: {
|
|
90
|
+
justifyContent: "flex-start",
|
|
91
|
+
padding: `${_(6)} ${_(-16)}`,
|
|
92
|
+
margin: 0
|
|
93
|
+
},
|
|
94
|
+
fullWidth: !0,
|
|
95
|
+
onClick: $,
|
|
96
|
+
variant: "text",
|
|
97
|
+
startIcon: /* @__PURE__ */ h(p, { icon: S }),
|
|
98
|
+
children: ["Adicionar ", `"${q}"`]
|
|
99
|
+
}),
|
|
100
|
+
j !== void 0 && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
|
|
101
|
+
style: {
|
|
102
|
+
paddingTop: "0.5rem",
|
|
103
|
+
paddingBottom: "0.5rem"
|
|
104
|
+
},
|
|
105
|
+
children: /* @__PURE__ */ h(u, {})
|
|
106
|
+
}), j()] })
|
|
107
|
+
] }),
|
|
108
|
+
isOptionEqualToValue: (e, t) => w(e, t),
|
|
109
|
+
getOptionLabel: R && z || L,
|
|
110
|
+
getOptionKey: I,
|
|
111
|
+
renderOption: typeof R == "function" ? (e, t) => {
|
|
112
|
+
let n = R(t), r = I(t);
|
|
113
|
+
return /* @__PURE__ */ ne("li", {
|
|
114
|
+
...e,
|
|
115
|
+
key: r
|
|
116
|
+
}, /* @__PURE__ */ g("div", {
|
|
117
|
+
style: {
|
|
118
|
+
display: "flex",
|
|
119
|
+
flexDirection: "column",
|
|
120
|
+
flex: 1
|
|
121
|
+
},
|
|
122
|
+
children: [/* @__PURE__ */ h("span", { children: L(t) }), typeof n == "string" ? /* @__PURE__ */ h("span", { children: n }) : n]
|
|
123
|
+
}));
|
|
124
|
+
} : void 0,
|
|
125
|
+
...K,
|
|
126
|
+
sx: {
|
|
127
|
+
"& div.MuiInputBase-root": { paddingRight: `${le(Z.value)} !important` },
|
|
128
|
+
...K.sx
|
|
129
|
+
},
|
|
130
|
+
renderInput: (e) => /* @__PURE__ */ h(f, {
|
|
131
|
+
placeholder: G,
|
|
132
|
+
...e,
|
|
133
|
+
error: !!ce,
|
|
134
|
+
...i.slotProps?.textField,
|
|
135
|
+
slotProps: {
|
|
136
|
+
...e.slotProps,
|
|
137
|
+
input: {
|
|
138
|
+
...e.slotProps.input,
|
|
139
|
+
...i.slotProps?.textField?.slotProps?.input,
|
|
140
|
+
inputRef: Z.ref,
|
|
141
|
+
endAdornment: /* @__PURE__ */ g("div", {
|
|
142
|
+
className: "endAdornments",
|
|
143
|
+
children: [
|
|
144
|
+
e.slotProps.input.endAdornment,
|
|
145
|
+
i.slotProps?.textField?.slotProps?.input?.endAdornment ?? null,
|
|
146
|
+
Q(Z.value) ? /* @__PURE__ */ g("div", {
|
|
147
|
+
className: "editable",
|
|
148
|
+
children: [/* @__PURE__ */ h("div", { className: "divider" }), /* @__PURE__ */ h(d, {
|
|
149
|
+
size: "small",
|
|
150
|
+
onClick: de,
|
|
151
|
+
sx: { mx: "3px" },
|
|
152
|
+
tabIndex: -1,
|
|
153
|
+
children: /* @__PURE__ */ h(p, {
|
|
154
|
+
icon: x,
|
|
155
|
+
size: "24px",
|
|
156
|
+
removeMargin: !0
|
|
157
|
+
})
|
|
158
|
+
})]
|
|
159
|
+
}) : null,
|
|
160
|
+
ue() && /* @__PURE__ */ g("div", {
|
|
161
|
+
className: "creatable",
|
|
162
|
+
children: [/* @__PURE__ */ h("div", { className: "divider" }), /* @__PURE__ */ h(d, {
|
|
163
|
+
size: "small",
|
|
164
|
+
onClick: $,
|
|
165
|
+
sx: { mx: "3px" },
|
|
166
|
+
tabIndex: -1,
|
|
167
|
+
children: /* @__PURE__ */ h(p, {
|
|
168
|
+
icon: S,
|
|
169
|
+
size: "24px",
|
|
170
|
+
removeMargin: !0
|
|
171
|
+
})
|
|
172
|
+
})]
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
}, E) }),
|
|
180
|
+
/* @__PURE__ */ h(t, {
|
|
181
|
+
name: E,
|
|
182
|
+
control: Y
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
var D = i(E);
|
|
188
|
+
//#endregion
|
|
189
|
+
export { D as default };
|
|
190
|
+
|
|
191
|
+
//# sourceMappingURL=creatable.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creatable.mjs","names":[],"sources":["../../src/creatable/creatable.tsx"],"sourcesContent":["import {\n forwardRef,\n type KeyboardEventHandler,\n type LegacyRef,\n type MouseEventHandler,\n useCallback,\n useState,\n} from 'react';\n\nimport { LIcon } from '@s_mart/core';\nimport { linePen, linePlus } from '@s_mart/solid-icons';\nimport { colorPalette } from '@s_mart/tokens';\nimport { toRem } from '@s_mart/utils';\n\nimport {\n Autocomplete,\n type AutocompleteChangeDetails,\n type AutocompleteChangeReason,\n type AutocompleteInputChangeReason,\n type AutocompleteValue,\n Button,\n Divider,\n IconButton,\n TextField,\n} from '@mui/material';\nimport isEmpty from 'lodash-es/isEmpty';\nimport isEqual from 'lodash-es/isEqual';\nimport isObject from 'lodash-es/isObject';\nimport {\n type FieldPath,\n type FieldPathValue,\n type FieldValues,\n useController,\n useFormContext,\n useFormState,\n} from 'react-hook-form';\n\nimport { FieldError } from '../components/fieldError';\nimport { FieldInfo } from '../components/fieldInfo';\nimport { FieldLabel } from '../components/fieldLabel';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\nimport { erroFieldFormatado } from '../utils/erroFieldFormatado';\nimport { typedMemo } from '../utils/typedMemo';\nimport { SDivAutoComplete } from './creatable.styles';\nimport type { CreatableProps } from './creatable.types';\n\nfunction Creatable<\n FieldValue,\n Multiple extends boolean | undefined = undefined,\n DisableClearable extends boolean | undefined = undefined,\n FreeSolo extends boolean | undefined = undefined,\n>(props: CreatableProps<FieldValue, Multiple, DisableClearable, FreeSolo>) {\n const {\n // RHF\n name,\n rules,\n defaultValue,\n shouldUnregister,\n control: controlFromProps,\n // Component Props\n label,\n required,\n options,\n footer,\n showCreatableButton = true,\n showEditableButton,\n onEditOption,\n onCreateOption,\n getOptionKey,\n getOptionLabel,\n getOptionAfterLabel,\n getInputValueLabel,\n multiple,\n info,\n noOptionsText = 'Nenhuma opção encontrada',\n onChange: onChangeProp,\n onInputChange,\n placeholder,\n ...rest\n } = props;\n\n const [curText, setCurText] = useState('');\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('Creatable');\n }\n\n const formState = useFormState({ control, name });\n\n const formattedError = erroFieldFormatado(formState.errors, name);\n const hideAddButton = !showCreatableButton || rest.disabled;\n\n const { field } = useController({\n name,\n control,\n rules,\n defaultValue,\n shouldUnregister,\n });\n\n const getRootRightPadding = (\n value: AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo>,\n ) => {\n let padding = 0;\n\n if (!props.slotProps?.textField?.slotProps?.input) padding += 2.5;\n\n if (!hideAddButton) {\n padding += 2.56;\n\n if (showEditButton(value)) padding += 2.56;\n }\n\n if (!rest.disableClearable && !rest.disabled) padding += 1.3;\n\n return `${padding}rem`;\n };\n\n const showEditButton = (\n value: AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo>,\n ) => {\n if (rest.disabled) return false;\n\n return showEditableButton && isObject(value) && !isEmpty(value);\n };\n\n const showCreateButton = () => {\n if (rest.disabled) return false;\n\n return showCreatableButton;\n };\n\n const handleCreateOption: MouseEventHandler<HTMLButtonElement> = useCallback(() => {\n if (typeof onCreateOption !== 'undefined') {\n onCreateOption(curText);\n setCurText('');\n }\n }, [curText, onCreateOption]);\n\n const handleEditOption: MouseEventHandler<HTMLButtonElement> = useCallback(() => {\n onEditOption?.(field.value);\n }, [field.value, onEditOption]);\n\n const handleInputChange = useCallback(\n (event: React.SyntheticEvent, value: string, reason: AutocompleteInputChangeReason) => {\n if (reason === 'input') {\n setCurText(value);\n onInputChange?.(value);\n }\n },\n [onInputChange],\n );\n\n const handleChange = useCallback(\n (\n _: React.SyntheticEvent,\n value: AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo>,\n ) => {\n setCurText('');\n field.onChange(value);\n onChangeProp?.(value);\n },\n [field.onChange, onChangeProp],\n );\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLDivElement, Element>) => {\n rest?.onBlur?.(event);\n setCurText('');\n },\n [rest?.onBlur],\n );\n\n const fieldValue = !field.value ? (multiple ? [] : null) : field.value;\n\n return (\n <div style={{ display: 'flex', flexDirection: 'column' }}>\n <div style={{ display: 'flex' }}>\n {label && <FieldLabel label={label} required={required} />}\n {info && <FieldInfo title={info} />}\n </div>\n <SDivAutoComplete>\n <Autocomplete<FieldValue, Multiple, DisableClearable, FreeSolo>\n key={name}\n fullWidth\n onChange={handleChange}\n onInputChange={handleInputChange}\n onBlur={handleBlur}\n slotProps={{\n ...rest.slotProps,\n\n listbox: {\n component: forwardRef(function Ul(props, ref: LegacyRef<HTMLUListElement>) {\n return (\n <>\n <ul {...props} ref={ref} />\n\n {typeof footer !== 'undefined' ? (\n <div key='creatable-footer' {...props}>\n <div style={{ paddingTop: '0.5rem', paddingBottom: '0.5rem' }}>\n <Divider />\n </div>\n {footer()}\n </div>\n ) : null}\n </>\n );\n }),\n },\n }}\n value={fieldValue}\n options={options}\n multiple={multiple}\n readOnly={rest.disabled}\n noOptionsText={\n <>\n {noOptionsText}\n {!hideAddButton && (\n <Button\n sx={{\n justifyContent: 'flex-start',\n padding: `${toRem(6)} ${toRem(-16)}`,\n margin: 0,\n }}\n fullWidth\n onClick={handleCreateOption}\n variant='text'\n startIcon={<LIcon icon={linePlus} />}\n >\n Adicionar {`\"${curText}\"`}\n </Button>\n )}\n\n {typeof footer !== 'undefined' && (\n <>\n <div style={{ paddingTop: '0.5rem', paddingBottom: '0.5rem' }}>\n <Divider />\n </div>\n {footer()}\n </>\n )}\n </>\n }\n isOptionEqualToValue={(option, value) => isEqual(option, value)}\n getOptionLabel={\n getOptionAfterLabel ? getInputValueLabel || getOptionLabel : getOptionLabel\n }\n getOptionKey={getOptionKey}\n renderOption={\n typeof getOptionAfterLabel === 'function'\n ? (props, option) => {\n const afterlabel = getOptionAfterLabel(option);\n const key = getOptionKey(option);\n return (\n <li {...props} key={key}>\n <div style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>\n <span>{getOptionLabel(option)}</span>\n {typeof afterlabel === 'string' ? <span>{afterlabel}</span> : afterlabel}\n </div>\n </li>\n );\n }\n : undefined\n }\n {...rest}\n sx={{\n '& div.MuiInputBase-root': {\n paddingRight: `${getRootRightPadding(field.value)} !important`,\n },\n ...rest.sx,\n }}\n renderInput={(params) => (\n <TextField\n placeholder={placeholder}\n {...params}\n error={Boolean(formattedError)}\n {...props.slotProps?.textField}\n slotProps={{\n ...params.slotProps,\n\n input: {\n ...params.slotProps.input,\n ...props.slotProps?.textField?.slotProps?.input,\n inputRef: field.ref,\n\n endAdornment: (\n <div className='endAdornments'>\n {params.slotProps.input.endAdornment}\n\n {/* biome-ignore lint/suspicious/noExplicitAny: A tipagem do MUI não funciona com props, porém ao usar o componente, a tipagem é inferida corretamente */}\n {(props.slotProps?.textField?.slotProps?.input as Record<string, any>)\n ?.endAdornment ?? null}\n {showEditButton(field.value) ? (\n <div className='editable'>\n <div className='divider' />\n <IconButton\n size='small'\n onClick={handleEditOption}\n sx={{ mx: '3px' }}\n tabIndex={-1}\n >\n <LIcon icon={linePen} size='24px' removeMargin />\n </IconButton>\n </div>\n ) : null}\n {showCreateButton() && (\n <div className='creatable'>\n <div className='divider' />\n <IconButton\n size='small'\n onClick={handleCreateOption}\n sx={{ mx: '3px' }}\n tabIndex={-1}\n >\n <LIcon icon={linePlus} size='24px' removeMargin />\n </IconButton>\n </div>\n )}\n </div>\n ),\n },\n }}\n />\n )}\n />\n </SDivAutoComplete>\n <FieldError name={name} control={control} />\n </div>\n );\n}\n\nexport default typedMemo(Creatable);\n"],"mappings":"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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { css as e, styled as t } from "@mui/material";
|
|
2
|
+
import { toRem as n } from "@s_mart/utils";
|
|
3
|
+
//#region src/creatable/creatable.styles.ts
|
|
4
|
+
var r = e`
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
`, i = t("div")`
|
|
9
|
+
display: flex;
|
|
10
|
+
|
|
11
|
+
div.endAdornments {
|
|
12
|
+
position: absolute;
|
|
13
|
+
right: 0;
|
|
14
|
+
|
|
15
|
+
${r}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.MuiAutocomplete-endAdornment {
|
|
19
|
+
position: relative;
|
|
20
|
+
right: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.endAdornments > .MuiAutocomplete-endAdornment {
|
|
24
|
+
transform: translate(0, 0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.creatable,
|
|
28
|
+
.editable {
|
|
29
|
+
${r}
|
|
30
|
+
|
|
31
|
+
.divider {
|
|
32
|
+
width: 1px;
|
|
33
|
+
height: ${n(20)};
|
|
34
|
+
background-color: ${({ theme: e }) => e.palette.grey[400]};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { i as SDivAutoComplete };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=creatable.styles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creatable.styles.mjs","names":[],"sources":["../../src/creatable/creatable.styles.ts"],"sourcesContent":["import { toRem } from '@s_mart/utils';\n\nimport { css, styled } from '@mui/material';\n\nconst flexCenter = css`\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nexport const SDivAutoComplete = styled('div')`\n display: flex;\n\n div.endAdornments {\n position: absolute;\n right: 0;\n\n ${flexCenter}\n }\n\n .MuiAutocomplete-endAdornment {\n position: relative;\n right: 0;\n }\n\n .endAdornments > .MuiAutocomplete-endAdornment {\n transform: translate(0, 0);\n }\n\n .creatable,\n .editable {\n ${flexCenter}\n\n .divider {\n width: 1px;\n height: ${toRem(20)};\n background-color: ${({ theme }) => theme.palette.grey[400]};\n }\n }\n`;\n"],"mappings":";;;AAIA,IAAM,IAAa,CAAG;;;;GAMT,IAAmB,EAAO,KAAK,CAAC;;;;;;;MAOvC,EAAW;;;;;;;;;;;;;;MAcX,EAAW;;;;gBAID,EAAM,EAAE,EAAE;2BACC,EAAE,eAAY,EAAM,QAAQ,KAAK,KAAK"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { erroFieldFormatado as e } from "../utils/erroFieldFormatado.mjs";
|
|
2
|
+
import t from "../components/fieldError/fieldError.mjs";
|
|
3
|
+
import n from "../components/fieldLabel/fieldLabel.mjs";
|
|
4
|
+
import { FormComponentPrecisaDeControl as r } from "../formComponentPrecisaDeControl.mjs";
|
|
5
|
+
import { typedMemo as i } from "../utils/typedMemo.mjs";
|
|
6
|
+
import { SIconButton as a } from "./datePicker.styles.mjs";
|
|
7
|
+
import { useController as o, useFormContext as s, useFormState as c } from "react-hook-form";
|
|
8
|
+
import { Stack as l } from "@mui/material";
|
|
9
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
10
|
+
import { createElement as f } from "react";
|
|
11
|
+
import { composeValidators as p, date as m } from "@s_mart/rules";
|
|
12
|
+
import { DatePicker as h } from "@mui/x-date-pickers";
|
|
13
|
+
import { AdapterDayjs as g } from "@mui/x-date-pickers/AdapterDayjs";
|
|
14
|
+
import { LocalizationProvider as _ } from "@mui/x-date-pickers/LocalizationProvider";
|
|
15
|
+
import { ptBR as v } from "@mui/x-date-pickers/locales";
|
|
16
|
+
import "dayjs/locale/pt-br";
|
|
17
|
+
var y = i(({ rules: i, name: y, defaultValue: b, shouldUnregister: x, control: S, label: C, required: w, disabled: T, disableIconError: E, size: D, ...O }) => {
|
|
18
|
+
let k = s()?.control, A = S ?? k;
|
|
19
|
+
if (!A) throw new r("DatePicker");
|
|
20
|
+
let j = c({
|
|
21
|
+
control: A,
|
|
22
|
+
name: y
|
|
23
|
+
}), M = e(j.errors, y), N = O?.format || "DD/MM/YYYY", P = i ? p([m(N), i]) : m(N), { field: F } = o({
|
|
24
|
+
control: A,
|
|
25
|
+
name: y,
|
|
26
|
+
rules: P,
|
|
27
|
+
defaultValue: b,
|
|
28
|
+
shouldUnregister: x
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ u(_, {
|
|
31
|
+
dateAdapter: g,
|
|
32
|
+
localeText: v.components.MuiLocalizationProvider.defaultProps.localeText,
|
|
33
|
+
children: /* @__PURE__ */ d(l, { children: [
|
|
34
|
+
C && /* @__PURE__ */ u(n, {
|
|
35
|
+
label: C,
|
|
36
|
+
required: w
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ f(h, {
|
|
39
|
+
...O,
|
|
40
|
+
key: y,
|
|
41
|
+
value: F.value ?? null,
|
|
42
|
+
format: N,
|
|
43
|
+
onChange: (e, t) => {
|
|
44
|
+
F.onChange(e, t), O?.onChange?.(e, t);
|
|
45
|
+
},
|
|
46
|
+
disabled: T,
|
|
47
|
+
slots: { openPickerButton: a },
|
|
48
|
+
slotProps: {
|
|
49
|
+
...O?.slotProps,
|
|
50
|
+
textField: {
|
|
51
|
+
error: !!M,
|
|
52
|
+
size: D,
|
|
53
|
+
...O.slotProps?.textField,
|
|
54
|
+
slotProps: {
|
|
55
|
+
...O.slotProps?.textField?.slotProps,
|
|
56
|
+
input: {
|
|
57
|
+
...(O.slotProps?.textField)?.slotProps?.input,
|
|
58
|
+
inputRef: F.ref
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ u(t, {
|
|
65
|
+
name: y,
|
|
66
|
+
disableIcon: E,
|
|
67
|
+
control: A
|
|
68
|
+
})
|
|
69
|
+
] })
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//#endregion
|
|
73
|
+
export { y as default };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=datePicker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datePicker.mjs","names":[],"sources":["../../src/datePicker/datePicker.tsx"],"sourcesContent":["import { composeValidators, date } from '@s_mart/rules';\n\nimport { Stack } from '@mui/material';\nimport { DatePicker as DatePickerMui } from '@mui/x-date-pickers';\nimport { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport { ptBR } from '@mui/x-date-pickers/locales';\nimport { useController, useFormContext, useFormState } from 'react-hook-form';\n\nimport { FieldError } from '../components/fieldError';\nimport { FieldLabel } from '../components/fieldLabel';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\nimport { erroFieldFormatado } from '../utils/erroFieldFormatado';\nimport { typedMemo } from '../utils/typedMemo';\nimport { SIconButton } from './datePicker.styles';\nimport type { DatePickerProps } from './datePicker.types';\n\nimport 'dayjs/locale/pt-br';\n\nconst DatePicker = ({\n // RHF\n rules,\n name,\n defaultValue,\n shouldUnregister,\n control: controlFromProps,\n // Component Props\n label,\n required,\n disabled,\n disableIconError,\n size,\n ...rest\n}: DatePickerProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('DatePicker');\n }\n\n const formState = useFormState({ control, name });\n const formattedError = erroFieldFormatado(formState.errors, name);\n const dateFormat = rest?.format || 'DD/MM/YYYY';\n const newRules = rules ? composeValidators([date(dateFormat), rules as any]) : date(dateFormat);\n\n const { field } = useController({\n control,\n name,\n rules: newRules,\n defaultValue,\n shouldUnregister,\n });\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDayjs}\n localeText={ptBR.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <Stack>\n {label && <FieldLabel label={label} required={required} />}\n <DatePickerMui\n {...rest}\n key={name}\n value={field.value ?? null}\n format={dateFormat}\n onChange={(value, context) => {\n field.onChange(value, context);\n rest?.onChange?.(value, context);\n }}\n disabled={disabled}\n slots={{\n openPickerButton: SIconButton,\n }}\n slotProps={{\n ...rest?.slotProps,\n textField: {\n error: Boolean(formattedError),\n size,\n ...rest.slotProps?.textField,\n slotProps: {\n ...(rest.slotProps?.textField as any)?.slotProps,\n input: {\n ...(rest.slotProps?.textField as any)?.slotProps?.input,\n inputRef: field.ref,\n },\n },\n },\n }}\n />\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </Stack>\n </LocalizationProvider>\n );\n};\n\nexport default typedMemo(DatePicker);\n"],"mappings":";;;;;;;;;;;;;;;;AAiGA,IAAA,IAAe,GA9EK,EAElB,UACA,SACA,iBACA,qBACA,SAAS,GAET,UACA,aACA,aACA,qBACA,SACA,GAAG,QACkB;CACrB,IAAM,IAAqB,EAAe,CAAC,EAAE,SAEvC,IAAU,KAAoB;CAEpC,IAAI,CAAC,GACH,MAAM,IAAI,EAA8B,YAAY;CAGtD,IAAM,IAAY,EAAa;EAAE;EAAS;CAAK,CAAC,GAC1C,IAAiB,EAAmB,EAAU,QAAQ,CAAI,GAC1D,IAAa,GAAM,UAAU,cAC7B,IAAW,IAAQ,EAAkB,CAAC,EAAK,CAAU,GAAG,CAAY,CAAC,IAAI,EAAK,CAAU,GAExF,EAAE,aAAU,EAAc;EAC9B;EACA;EACA,OAAO;EACP;EACA;CACF,CAAC;CAED,OACE,kBAAC,GAAD;EACE,aAAa;EACb,YAAY,EAAK,WAAW,wBAAwB,aAAa;EAEjE,UAAA,kBAAC,GAAD,EAAA,UAAA;GACG,KAAS,kBAAC,GAAD;IAAmB;IAAiB;GAAW,CAAA;GACzD,kBAAC,GAAD;IACE,GAAI;IACJ,KAAK;IACL,OAAO,EAAM,SAAS;IACtB,QAAQ;IACR,WAAW,GAAO,MAAY;KAE5B,AADA,EAAM,SAAS,GAAO,CAAO,GAC7B,GAAM,WAAW,GAAO,CAAO;IACjC;IACU;IACV,OAAO,EACL,kBAAkB,EACpB;IACA,WAAW;KACT,GAAG,GAAM;KACT,WAAW;MACT,OAAO,EAAQ;MACf;MACA,GAAG,EAAK,WAAW;MACnB,WAAW;OACT,GAAI,EAAK,WAAW,WAAmB;OACvC,OAAO;QACL,IAAI,EAAK,WAAW,UAAA,EAAmB,WAAW;QAClD,UAAU,EAAM;OAClB;MACF;KACF;IACF;GACD,CAAA;GACD,kBAAC,GAAD;IAAkB;IAAM,aAAa;IAA2B;GAAU,CAAA;EACrE,EAAA,CAAA;CACa,CAAA;AAE1B,CAEmC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IconButton as e, styled as t } from "@mui/material";
|
|
2
|
+
import { toRem as n } from "@s_mart/utils";
|
|
3
|
+
//#region src/datePicker/datePicker.styles.ts
|
|
4
|
+
var r = (e) => {
|
|
5
|
+
switch (e) {
|
|
6
|
+
case "small": return n(16);
|
|
7
|
+
case "large": return n(24);
|
|
8
|
+
default: return n(20);
|
|
9
|
+
}
|
|
10
|
+
}, i = (e) => {
|
|
11
|
+
switch (e) {
|
|
12
|
+
case "small": return `${n(2)} ${n(8)}`;
|
|
13
|
+
case "large": return `${n(10)}`;
|
|
14
|
+
default: return `${n(6)} ${n(8)}`;
|
|
15
|
+
}
|
|
16
|
+
}, a = t(e)`
|
|
17
|
+
margin: 0px;
|
|
18
|
+
|
|
19
|
+
padding: ${({ size: e }) => i(e)};
|
|
20
|
+
border-radius: 0 ${n(4)} ${n(4)} 0;
|
|
21
|
+
|
|
22
|
+
svg {
|
|
23
|
+
width: ${({ size: e }) => r(e)} !important;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { a as SIconButton };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=datePicker.styles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datePicker.styles.mjs","names":[],"sources":["../../src/datePicker/datePicker.styles.ts"],"sourcesContent":["import { type IconButtonProps, IconButton, styled } from '@mui/material';\nimport { toRem } from '@s_mart/utils';\n\nconst _svgSize = (size: IconButtonProps['size']) => {\n switch (size) {\n case 'small':\n return toRem(16);\n case 'large':\n return toRem(24);\n default:\n return toRem(20);\n }\n};\n\nconst _padding = (size: IconButtonProps['size']) => {\n switch (size) {\n case 'small':\n return `${toRem(2)} ${toRem(8)}`;\n case 'large':\n return `${toRem(10)}`;\n default:\n return `${toRem(6)} ${toRem(8)}`;\n }\n};\n\nexport const SIconButton = styled(IconButton)`\n margin: 0px;\n\n padding: ${({ size }) => _padding(size)};\n border-radius: 0 ${toRem(4)} ${toRem(4)} 0;\n\n svg {\n width: ${({ size }) => _svgSize(size)} !important;\n }\n`;\n"],"mappings":";;;AAGA,IAAM,KAAY,MAAkC;CAClD,QAAQ,GAAR;EACE,KAAK,SACH,OAAO,EAAM,EAAE;EACjB,KAAK,SACH,OAAO,EAAM,EAAE;EACjB,SACE,OAAO,EAAM,EAAE;CACnB;AACF,GAEM,KAAY,MAAkC;CAClD,QAAQ,GAAR;EACE,KAAK,SACH,OAAO,GAAG,EAAM,CAAC,EAAE,GAAG,EAAM,CAAC;EAC/B,KAAK,SACH,OAAO,GAAG,EAAM,EAAE;EACpB,SACE,OAAO,GAAG,EAAM,CAAC,EAAE,GAAG,EAAM,CAAC;CACjC;AACF,GAEa,IAAc,EAAO,CAAU,CAAC;;;cAG/B,EAAE,cAAW,EAAS,CAAI,EAAE;qBACrB,EAAM,CAAC,EAAE,GAAG,EAAM,CAAC,EAAE;;;cAG5B,EAAE,cAAW,EAAS,CAAI,EAAE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import e from "./formProvider.mjs";
|
|
2
|
+
import t from "./useForm.mjs";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/form/form.tsx
|
|
5
|
+
function r({ children: r, style: i, ...a }) {
|
|
6
|
+
let o = t(a);
|
|
7
|
+
return /* @__PURE__ */ n(e, {
|
|
8
|
+
...o,
|
|
9
|
+
style: i,
|
|
10
|
+
children: typeof r == "function" ? r(o) : r
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { r as default };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=form.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.mjs","names":[],"sources":["../../src/form/form.tsx"],"sourcesContent":["import type { JSX } from 'react';\n\nimport type { FieldValues } from 'react-hook-form';\n\nimport type { IFormProps } from './form.types';\nimport FormProvider from './formProvider';\nimport useForm from './useForm';\n\n/**\n * Utilizado overloading para poder passar uma tipagem para o Componente\n * @example\n * // Não passar uma tipagem, todas as props terão o funcionamento normal, sem tipagem\n * <Form onSubmit={({email}) => {}}>\n * ...\n * </Form>\n * @example\n * // Passar uma tipagem, todas as props derivadas do react-hook-form terão a tipagem passada no generic\n * type Cadastro = {\n * email: string;\n * }\n * <Form<Cadastro> onSubmit={({email}) => {}}>\n * ...\n * </Form>\n */\nfunction Form(props: IFormProps<any>): JSX.Element;\nfunction Form<T extends FieldValues>(props: IFormProps<T>): JSX.Element;\n\nfunction Form<T extends FieldValues>({ children, style, ...useFormProps }: IFormProps<T>) {\n const methods = useForm<T>(useFormProps);\n\n return (\n <FormProvider {...methods} style={style}>\n {typeof children === 'function' ? children(methods) : children}\n </FormProvider>\n );\n}\n\nexport default Form;\n"],"mappings":";;;;AA2BA,SAAS,EAA4B,EAAE,aAAU,UAAO,GAAG,KAA+B;CACxF,IAAM,IAAU,EAAW,CAAY;CAEvC,OACE,kBAAC,GAAD;EAAc,GAAI;EAAgB;EAC/B,UAAA,OAAO,KAAa,aAAa,EAAS,CAAO,IAAI;CAC1C,CAAA;AAElB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormProvider as e } from "react-hook-form";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/form/formProvider.tsx
|
|
4
|
+
function n({ children: n, style: r, onSubmit: i, ...a }) {
|
|
5
|
+
return /* @__PURE__ */ t(e, {
|
|
6
|
+
...a,
|
|
7
|
+
children: /* @__PURE__ */ t("form", {
|
|
8
|
+
onSubmit: (e) => {
|
|
9
|
+
e.preventDefault(), e.stopPropagation(), i(e);
|
|
10
|
+
},
|
|
11
|
+
style: r,
|
|
12
|
+
children: n
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { n as default };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=formProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formProvider.mjs","names":[],"sources":["../../src/form/formProvider.tsx"],"sourcesContent":["import { type FieldValues, FormProvider as HookFormProvider } from 'react-hook-form';\n\nimport type { IFormProviderProps } from './form.types';\n\nfunction FormProvider<TFieldValues extends FieldValues>({\n children,\n style,\n onSubmit,\n ...methods\n}: IFormProviderProps<TFieldValues>) {\n return (\n <HookFormProvider<TFieldValues> {...methods}>\n <form\n onSubmit={(e) => {\n e.preventDefault();\n e.stopPropagation();\n onSubmit(e);\n }}\n style={style}\n >\n {children}\n </form>\n </HookFormProvider>\n );\n}\n\nexport default FormProvider;\n"],"mappings":";;;AAIA,SAAS,EAA+C,EACtD,aACA,UACA,aACA,GAAG,KACgC;CACnC,OACE,kBAAC,GAAD;EAAgC,GAAI;EAClC,UAAA,kBAAC,QAAD;GACE,WAAW,MAAM;IAGf,AAFA,EAAE,eAAe,GACjB,EAAE,gBAAgB,GAClB,EAAS,CAAC;GACZ;GACO;GAEN;EACG,CAAA;CACU,CAAA;AAEtB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useForm as e } from "react-hook-form";
|
|
2
|
+
import { useEffect as t } from "react";
|
|
3
|
+
import { zodResolver as n } from "@hookform/resolvers/zod";
|
|
4
|
+
//#region src/form/useForm.ts
|
|
5
|
+
var r = ({ disableDefaultValuesUpdate: r, onSubmit: i, ...a }) => {
|
|
6
|
+
let o = e({
|
|
7
|
+
...a,
|
|
8
|
+
resolver: a.schema && n(a.schema)
|
|
9
|
+
});
|
|
10
|
+
return t(() => {
|
|
11
|
+
r || o.reset(a.defaultValues);
|
|
12
|
+
}, [a.defaultValues, o.reset]), {
|
|
13
|
+
...o,
|
|
14
|
+
onSubmit: o.handleSubmit((e) => i(e, o))
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as default };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=useForm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForm.mjs","names":[],"sources":["../../src/form/useForm.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { type FieldValues, type Resolver, type UseFormReturn, useForm as useHookForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\n\nimport type { IUseFormProps } from './form.types';\n\nconst useForm = <TValues extends FieldValues>({\n disableDefaultValuesUpdate,\n onSubmit,\n ...rest\n}: IUseFormProps<TValues>): UseFormReturn<TValues> & { onSubmit: (e?: React.BaseSyntheticEvent) => Promise<void> } => {\n const methods = useHookForm<TValues>({\n ...rest,\n resolver: rest.schema && (zodResolver(rest.schema) as unknown as Resolver<TValues>),\n });\n\n useEffect(() => {\n if (!disableDefaultValuesUpdate) methods.reset(rest.defaultValues as TValues);\n }, [rest.defaultValues, methods.reset]);\n\n return { ...methods, onSubmit: methods.handleSubmit((data) => onSubmit(data, methods)) };\n};\n\nexport default useForm;\n"],"mappings":";;;;AAOA,IAAM,KAAwC,EAC5C,+BACA,aACA,GAAG,QACiH;CACpH,IAAM,IAAU,EAAqB;EACnC,GAAG;EACH,UAAU,EAAK,UAAW,EAAY,EAAK,MAAM;CACnD,CAAC;CAMD,OAJA,QAAgB;EACd,AAAK,KAA4B,EAAQ,MAAM,EAAK,aAAwB;CAC9E,GAAG,CAAC,EAAK,eAAe,EAAQ,KAAK,CAAC,GAE/B;EAAE,GAAG;EAAS,UAAU,EAAQ,cAAc,MAAS,EAAS,GAAM,CAAO,CAAC;CAAE;AACzF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/formComponentPrecisaDeControl.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
constructor(e) {
|
|
4
|
+
super(`O componente ${e} precisa de um control para funcionar. Passe o control como prop ou coloque o componente dentro de um <Form />`), this.name = "FormComponentPrecisaDeControl";
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { e as FormComponentPrecisaDeControl };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=formComponentPrecisaDeControl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formComponentPrecisaDeControl.mjs","names":[],"sources":["../src/formComponentPrecisaDeControl.ts"],"sourcesContent":["export class FormComponentPrecisaDeControl extends Error {\n constructor(componentName: string) {\n super(\n `O componente ${componentName} precisa de um control para funcionar. Passe o control como prop ou coloque o componente dentro de um <Form />`,\n );\n this.name = 'FormComponentPrecisaDeControl';\n }\n}\n"],"mappings":";AAAA,IAAa,IAAb,cAAmD,MAAM;CACvD,YAAY,GAAuB;EAIjC,AAHA,MACE,gBAAgB,EAAc,+GAChC,GACA,KAAK,OAAO;CACd;AACF"}
|