@s_mart/form 16.0.0 → 16.1.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.
- package/dist/creatable/creatable.d.ts +4 -0
- package/dist/{creatableV2/creatableV2.types.d.ts → creatable/creatable.types.d.ts} +5 -5
- package/dist/index.d.ts +15 -15
- package/dist/index.mjs +91 -91
- package/dist/index.mjs.map +1 -1
- package/dist/{searchableV2/searchableV2.d.ts → searchable/searchable.d.ts} +2 -2
- package/dist/{searchableV2/searchableV2.types.d.ts → searchable/searchable.types.d.ts} +1 -1
- package/dist/{selectV2/selectV2.d.ts → select/select.d.ts} +2 -2
- package/dist/{selectV2/selectV2.types.d.ts → select/select.types.d.ts} +4 -4
- package/dist/select/selectRenderValue.d.ts +3 -0
- package/package.json +17 -17
- package/dist/creatableV2/creatableV2.d.ts +0 -4
- package/dist/selectV2/selectV2RenderValue.d.ts +0 -3
- /package/dist/{creatableV2/creatableV2.styles.d.ts → creatable/creatable.styles.d.ts} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CreatableProps } from './creatable.types';
|
|
2
|
+
declare function Creatable<FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined>(props: CreatableProps<FieldValue, Multiple, DisableClearable, FreeSolo>): import("react").JSX.Element;
|
|
3
|
+
declare const _default: typeof Creatable;
|
|
4
|
+
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WithRequired } from '@s_mart/typed';
|
|
2
2
|
import { AutocompleteProps, AutocompleteValue, AutocompleteValueOrFreeSoloValueMapping, TextFieldProps } from '@mui/material';
|
|
3
3
|
import { UseControllerProps } from 'react-hook-form';
|
|
4
|
-
export type
|
|
4
|
+
export type CreatableProps<FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined> = WithRequired<Omit<AutocompleteProps<FieldValue, Multiple, DisableClearable, FreeSolo>, 'renderInput' | 'options' | 'size' | 'onInputChange' | 'onChange' | 'defaultValue' | 'value'>, 'getOptionKey' | 'getOptionLabel'> & UseControllerProps & {
|
|
5
5
|
options: FieldValue[];
|
|
6
6
|
slotProps?: AutocompleteProps<FieldValue, Multiple, DisableClearable, FreeSolo>['slotProps'] & Partial<{
|
|
7
7
|
textField: Omit<TextFieldProps<'outlined'>, 'variant'>;
|
|
@@ -12,7 +12,7 @@ export type CreatableV2Props<FieldValue, Multiple extends boolean | undefined =
|
|
|
12
12
|
* Define se mostra o botão para criar uma nova opção
|
|
13
13
|
* @default true
|
|
14
14
|
* @type {boolean}
|
|
15
|
-
* @memberof
|
|
15
|
+
* @memberof CreatableProps
|
|
16
16
|
*/
|
|
17
17
|
showCreatableButton?: boolean;
|
|
18
18
|
/**
|
|
@@ -20,14 +20,14 @@ export type CreatableV2Props<FieldValue, Multiple extends boolean | undefined =
|
|
|
20
20
|
* Só é possível utilizar se a prop `multiple` for `false | undefined`
|
|
21
21
|
* @default false
|
|
22
22
|
* @type {boolean}
|
|
23
|
-
* @memberof
|
|
23
|
+
* @memberof CreatableProps
|
|
24
24
|
*/
|
|
25
25
|
showEditableButton?: boolean;
|
|
26
26
|
/**
|
|
27
27
|
* Função que será executada quando o usuário clicar no botão de criar uma nova opção
|
|
28
28
|
* @default undefined
|
|
29
29
|
* @type {(value: string) => void}
|
|
30
|
-
* @memberof
|
|
30
|
+
* @memberof CreatableProps
|
|
31
31
|
*/
|
|
32
32
|
onCreateOption?: (value: string) => void;
|
|
33
33
|
/**
|
|
@@ -37,7 +37,7 @@ export type CreatableV2Props<FieldValue, Multiple extends boolean | undefined =
|
|
|
37
37
|
*
|
|
38
38
|
* @default undefined
|
|
39
39
|
* @type {(value: FieldValue) => Promise<void> | void}
|
|
40
|
-
* @memberof
|
|
40
|
+
* @memberof CreatableProps
|
|
41
41
|
*/
|
|
42
42
|
onEditOption?: (value: NonNullable<AutocompleteValue<FieldValue, Multiple, false, false>>) => Promise<void> | void;
|
|
43
43
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
export { default as Checkbox } from './checkbox/checkbox';
|
|
2
2
|
export type { CheckboxProps } from './checkbox/checkbox.types';
|
|
3
|
-
export { default as CreatableV2 } from './creatableV2/creatableV2';
|
|
4
|
-
export type { CreatableV2Props } from './creatableV2/creatableV2.types';
|
|
5
|
-
export { default as DatePicker } from './datePicker/datePicker';
|
|
6
|
-
export type { DatePickerProps } from './datePicker/datePicker.types';
|
|
7
|
-
export { default as FieldLabel } from './components/fieldLabel/fieldLabel';
|
|
8
|
-
export type { FieldLabelProps } from './components/fieldLabel/fieldLabel.types';
|
|
9
3
|
export { default as FieldError } from './components/fieldError/fieldError';
|
|
10
4
|
export type { FieldErrorProps } from './components/fieldError/fieldError.types';
|
|
11
5
|
export { default as FieldInfo } from './components/fieldInfo/fieldInfo';
|
|
12
6
|
export type { FieldInfoProps } from './components/fieldInfo/fieldInfo.types';
|
|
7
|
+
export { default as FieldLabel } from './components/fieldLabel/fieldLabel';
|
|
8
|
+
export type { FieldLabelProps } from './components/fieldLabel/fieldLabel.types';
|
|
9
|
+
export { default as Creatable } from './creatable/creatable';
|
|
10
|
+
export type { CreatableProps } from './creatable/creatable.types';
|
|
11
|
+
export { default as DatePicker } from './datePicker/datePicker';
|
|
12
|
+
export type { DatePickerProps } from './datePicker/datePicker.types';
|
|
13
13
|
export { default as Form } from './form/form';
|
|
14
|
-
export { default as useForm } from './form/useForm';
|
|
15
|
-
export { default as FormProvider } from './form/formProvider';
|
|
16
14
|
export type { IFormProps, IFormProviderProps, IUseFormProps } from './form/form.types';
|
|
17
|
-
export { default as
|
|
18
|
-
export
|
|
15
|
+
export { default as FormProvider } from './form/formProvider';
|
|
16
|
+
export { default as useForm } from './form/useForm';
|
|
19
17
|
export { default as RadioButton } from './radio/radioButton/radioButton';
|
|
20
18
|
export type { RadioProps } from './radio/radioButton/radioButton.types';
|
|
21
|
-
export { default as
|
|
22
|
-
export type {
|
|
23
|
-
export { default as
|
|
24
|
-
export type {
|
|
19
|
+
export { default as RadioGroup } from './radio/radioGroup/radioGroup';
|
|
20
|
+
export type { RadioGroupProps } from './radio/radioGroup/radioGroup.types';
|
|
21
|
+
export { default as Searchable } from './searchable/searchable';
|
|
22
|
+
export type { SearchableProps } from './searchable/searchable.types';
|
|
23
|
+
export { default as Select } from './select/select';
|
|
24
|
+
export type { FooterProps, SelectProps, SelectReturnValueProps } from './select/select.types';
|
|
25
25
|
export { default as Slider } from './slider/slider';
|
|
26
26
|
export type { SliderProps } from './slider/slider.types';
|
|
27
27
|
export { default as Switch } from './switch/switch';
|
|
28
28
|
export type { SwitchProps } from './switch/switch.types';
|
|
29
29
|
export { default as TextField } from './textField/textField';
|
|
30
|
-
export type {
|
|
30
|
+
export type { Masks, TextFieldProps } from './textField/textField.types';
|
|
31
31
|
export { default as TimePicker } from './timePicker/timePicker';
|
|
32
32
|
export type { TimePickerProps } from './timePicker/timePicker.types';
|
package/dist/index.mjs
CHANGED
|
@@ -3,19 +3,19 @@ import { Autocomplete as a, Button as o, Checkbox as s, Divider as c, FormContro
|
|
|
3
3
|
import { IconButton as T, Indicator as E, LIcon as D } from "@s_mart/core";
|
|
4
4
|
import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
5
5
|
import { toRem as j } from "@s_mart/utils";
|
|
6
|
-
import { createElement as M, forwardRef as N, memo as P, useCallback as F, useEffect as I, useRef as L, useState as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { composeValidators as
|
|
13
|
-
import { DatePicker as
|
|
14
|
-
import { AdapterDayjs as
|
|
15
|
-
import { LocalizationProvider as
|
|
16
|
-
import { ptBR as
|
|
6
|
+
import { createElement as M, forwardRef as N, memo as P, useCallback as F, useEffect as I, useRef as L, useState as ee } from "react";
|
|
7
|
+
import { lineEye as R, lineEyeSlash as te, lineInfoCircle as z, linePen as ne, linePlus as re } from "@s_mart/solid-icons";
|
|
8
|
+
import { colorPalette as B } from "@s_mart/tokens";
|
|
9
|
+
import ie from "lodash-es/isEmpty";
|
|
10
|
+
import ae from "lodash-es/isEqual";
|
|
11
|
+
import oe from "lodash-es/isObject";
|
|
12
|
+
import { composeValidators as V, date as H, time as U } from "@s_mart/rules";
|
|
13
|
+
import { DatePicker as se } from "@mui/x-date-pickers";
|
|
14
|
+
import { AdapterDayjs as W } from "@mui/x-date-pickers/AdapterDayjs";
|
|
15
|
+
import { LocalizationProvider as G } from "@mui/x-date-pickers/LocalizationProvider";
|
|
16
|
+
import { ptBR as ce } from "@mui/x-date-pickers/locales";
|
|
17
17
|
import "dayjs/locale/pt-br";
|
|
18
|
-
import { zodResolver as
|
|
18
|
+
import { zodResolver as K } from "@hookform/resolvers/zod";
|
|
19
19
|
import { lineTimes as le } from "@s_mart/regular-icons";
|
|
20
20
|
import * as q from "@s_mart/masks";
|
|
21
21
|
import { TimePicker as ue } from "@mui/x-date-pickers/TimePicker";
|
|
@@ -85,6 +85,16 @@ var J = (e, t) => t.replace(/[[\]]/g, "").split(".").reduce((e, t) => e?.[t], e)
|
|
|
85
85
|
disableIcon: f,
|
|
86
86
|
control: g
|
|
87
87
|
})] });
|
|
88
|
+
}), $ = ({ title: e }) => /* @__PURE__ */ k(x, {
|
|
89
|
+
title: e,
|
|
90
|
+
placement: "top",
|
|
91
|
+
children: /* @__PURE__ */ k("div", {
|
|
92
|
+
style: { width: "fit-content" },
|
|
93
|
+
children: /* @__PURE__ */ k(D, {
|
|
94
|
+
icon: z,
|
|
95
|
+
color: "#757575"
|
|
96
|
+
})
|
|
97
|
+
})
|
|
88
98
|
}), fe = C`
|
|
89
99
|
display: flex;
|
|
90
100
|
align-items: center;
|
|
@@ -118,45 +128,35 @@ var J = (e, t) => t.replace(/[[\]]/g, "").split(".").reduce((e, t) => e?.[t], e)
|
|
|
118
128
|
background-color: ${({ theme: e }) => e.palette.grey[400]};
|
|
119
129
|
}
|
|
120
130
|
}
|
|
121
|
-
|
|
122
|
-
title: e,
|
|
123
|
-
placement: "top",
|
|
124
|
-
children: /* @__PURE__ */ k("div", {
|
|
125
|
-
style: { width: "fit-content" },
|
|
126
|
-
children: /* @__PURE__ */ k(D, {
|
|
127
|
-
icon: V,
|
|
128
|
-
color: "#757575"
|
|
129
|
-
})
|
|
130
|
-
})
|
|
131
|
-
});
|
|
131
|
+
`;
|
|
132
132
|
//#endregion
|
|
133
|
-
//#region src/
|
|
133
|
+
//#region src/creatable/creatable.tsx
|
|
134
134
|
function me(e) {
|
|
135
|
-
let { name: n, rules: s, defaultValue: l, shouldUnregister: u, control: f, label: p, required: m, options: h, footer: g, showCreatableButton: _ = !0, showEditableButton: v, onEditOption: y, onCreateOption: x, getOptionKey: S, getOptionLabel: C, getOptionAfterLabel: w, getInputValueLabel: T, multiple: E, info: P, noOptionsText: I = "Nenhuma opção encontrada", onChange: L, onInputChange:
|
|
136
|
-
if (!
|
|
137
|
-
let
|
|
138
|
-
control:
|
|
135
|
+
let { name: n, rules: s, defaultValue: l, shouldUnregister: u, control: f, label: p, required: m, options: h, footer: g, showCreatableButton: _ = !0, showEditableButton: v, onEditOption: y, onCreateOption: x, getOptionKey: S, getOptionLabel: C, getOptionAfterLabel: w, getInputValueLabel: T, multiple: E, info: P, noOptionsText: I = "Nenhuma opção encontrada", onChange: L, onInputChange: R, placeholder: te, ...z } = e, [B, V] = ee(""), H = r()?.control, U = f ?? H;
|
|
136
|
+
if (!U) throw new Z("Creatable");
|
|
137
|
+
let se = J(i({
|
|
138
|
+
control: U,
|
|
139
139
|
name: n
|
|
140
|
-
}).errors, n),
|
|
140
|
+
}).errors, n), W = !_ || z.disabled, { field: G } = t({
|
|
141
141
|
name: n,
|
|
142
|
-
control:
|
|
142
|
+
control: U,
|
|
143
143
|
rules: s,
|
|
144
144
|
defaultValue: l,
|
|
145
145
|
shouldUnregister: u
|
|
146
|
-
}),
|
|
146
|
+
}), ce = (t) => {
|
|
147
147
|
let n = 0;
|
|
148
|
-
return e.slotProps?.textField?.slotProps?.input || (n += 2.5),
|
|
149
|
-
},
|
|
150
|
-
x !== void 0 && (x(
|
|
151
|
-
}, [
|
|
152
|
-
y?.(
|
|
153
|
-
}, [
|
|
154
|
-
n === "input" && (
|
|
155
|
-
}, [
|
|
156
|
-
|
|
157
|
-
}, [
|
|
158
|
-
|
|
159
|
-
}, [
|
|
148
|
+
return e.slotProps?.textField?.slotProps?.input || (n += 2.5), W || (n += 2.56, K(t) && (n += 2.56)), !z.disableClearable && !z.disabled && (n += 1.3), `${n}rem`;
|
|
149
|
+
}, K = (e) => !z.disabled && v && oe(e) && !ie(e), le = () => !z.disabled && _, q = F(() => {
|
|
150
|
+
x !== void 0 && (x(B), V(""));
|
|
151
|
+
}, [B, x]), ue = F(() => {
|
|
152
|
+
y?.(G.value);
|
|
153
|
+
}, [G.value, y]), Q = F((e, t, n) => {
|
|
154
|
+
n === "input" && (V(t), R?.(t));
|
|
155
|
+
}, [R]), de = F((e, t) => {
|
|
156
|
+
V(""), G.onChange(t), L?.(t);
|
|
157
|
+
}, [G.onChange, L]), fe = F((e) => {
|
|
158
|
+
z?.onBlur?.(e), V("");
|
|
159
|
+
}, [z?.onBlur]), me = G.value ? G.value : E ? [] : null;
|
|
160
160
|
return /* @__PURE__ */ A("div", {
|
|
161
161
|
style: {
|
|
162
162
|
display: "flex",
|
|
@@ -176,7 +176,7 @@ function me(e) {
|
|
|
176
176
|
onInputChange: Q,
|
|
177
177
|
onBlur: fe,
|
|
178
178
|
slotProps: {
|
|
179
|
-
...
|
|
179
|
+
...z.slotProps,
|
|
180
180
|
listbox: { component: N(function(e, t) {
|
|
181
181
|
return /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("ul", {
|
|
182
182
|
...e,
|
|
@@ -196,10 +196,10 @@ function me(e) {
|
|
|
196
196
|
value: me,
|
|
197
197
|
options: h,
|
|
198
198
|
multiple: E,
|
|
199
|
-
readOnly:
|
|
199
|
+
readOnly: z.disabled,
|
|
200
200
|
noOptionsText: /* @__PURE__ */ A(O, { children: [
|
|
201
201
|
I,
|
|
202
|
-
!
|
|
202
|
+
!W && /* @__PURE__ */ A(o, {
|
|
203
203
|
sx: {
|
|
204
204
|
justifyContent: "flex-start",
|
|
205
205
|
padding: `${j(6)} ${j(-16)}`,
|
|
@@ -208,8 +208,8 @@ function me(e) {
|
|
|
208
208
|
fullWidth: !0,
|
|
209
209
|
onClick: q,
|
|
210
210
|
variant: "text",
|
|
211
|
-
startIcon: /* @__PURE__ */ k(D, { icon:
|
|
212
|
-
children: ["Adicionar ", `"${
|
|
211
|
+
startIcon: /* @__PURE__ */ k(D, { icon: re }),
|
|
212
|
+
children: ["Adicionar ", `"${B}"`]
|
|
213
213
|
}),
|
|
214
214
|
g !== void 0 && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("div", {
|
|
215
215
|
style: {
|
|
@@ -219,7 +219,7 @@ function me(e) {
|
|
|
219
219
|
children: /* @__PURE__ */ k(c, {})
|
|
220
220
|
}), g()] })
|
|
221
221
|
] }),
|
|
222
|
-
isOptionEqualToValue: (e, t) =>
|
|
222
|
+
isOptionEqualToValue: (e, t) => ae(e, t),
|
|
223
223
|
getOptionLabel: w && T || C,
|
|
224
224
|
getOptionKey: S,
|
|
225
225
|
renderOption: typeof w == "function" ? (e, t) => {
|
|
@@ -236,28 +236,28 @@ function me(e) {
|
|
|
236
236
|
children: [/* @__PURE__ */ k("span", { children: C(t) }), typeof n == "string" ? /* @__PURE__ */ k("span", { children: n }) : n]
|
|
237
237
|
}));
|
|
238
238
|
} : void 0,
|
|
239
|
-
...
|
|
239
|
+
...z,
|
|
240
240
|
sx: {
|
|
241
|
-
"& div.MuiInputBase-root": { paddingRight: `${
|
|
242
|
-
...
|
|
241
|
+
"& div.MuiInputBase-root": { paddingRight: `${ce(G.value)} !important` },
|
|
242
|
+
...z.sx
|
|
243
243
|
},
|
|
244
244
|
renderInput: (t) => /* @__PURE__ */ k(b, {
|
|
245
|
-
placeholder:
|
|
245
|
+
placeholder: te,
|
|
246
246
|
...t,
|
|
247
|
-
error: !!
|
|
247
|
+
error: !!se,
|
|
248
248
|
...e.slotProps?.textField,
|
|
249
249
|
slotProps: {
|
|
250
250
|
...t.slotProps,
|
|
251
251
|
input: {
|
|
252
252
|
...t.slotProps.input,
|
|
253
253
|
...e.slotProps?.textField?.slotProps?.input,
|
|
254
|
-
inputRef:
|
|
254
|
+
inputRef: G.ref,
|
|
255
255
|
endAdornment: /* @__PURE__ */ A("div", {
|
|
256
256
|
className: "endAdornments",
|
|
257
257
|
children: [
|
|
258
258
|
t.slotProps.input.endAdornment,
|
|
259
259
|
e.slotProps?.textField?.slotProps?.input?.endAdornment ?? null,
|
|
260
|
-
|
|
260
|
+
K(G.value) ? /* @__PURE__ */ A("div", {
|
|
261
261
|
className: "editable",
|
|
262
262
|
children: [/* @__PURE__ */ k("div", { className: "divider" }), /* @__PURE__ */ k(d, {
|
|
263
263
|
size: "small",
|
|
@@ -265,7 +265,7 @@ function me(e) {
|
|
|
265
265
|
sx: { mx: "3px" },
|
|
266
266
|
tabIndex: -1,
|
|
267
267
|
children: /* @__PURE__ */ k(D, {
|
|
268
|
-
icon:
|
|
268
|
+
icon: ne,
|
|
269
269
|
size: "24px",
|
|
270
270
|
removeMargin: !0
|
|
271
271
|
})
|
|
@@ -279,7 +279,7 @@ function me(e) {
|
|
|
279
279
|
sx: { mx: "3px" },
|
|
280
280
|
tabIndex: -1,
|
|
281
281
|
children: /* @__PURE__ */ k(D, {
|
|
282
|
-
icon:
|
|
282
|
+
icon: re,
|
|
283
283
|
size: "24px",
|
|
284
284
|
removeMargin: !0
|
|
285
285
|
})
|
|
@@ -293,7 +293,7 @@ function me(e) {
|
|
|
293
293
|
}, n) }),
|
|
294
294
|
/* @__PURE__ */ k(Y, {
|
|
295
295
|
name: n,
|
|
296
|
-
control:
|
|
296
|
+
control: U
|
|
297
297
|
})
|
|
298
298
|
]
|
|
299
299
|
});
|
|
@@ -325,22 +325,22 @@ var he = Q(me), ge = (e) => {
|
|
|
325
325
|
let g = J(i({
|
|
326
326
|
control: h,
|
|
327
327
|
name: n
|
|
328
|
-
}).errors, n), _ = p?.format || "DD/MM/YYYY", y = e ?
|
|
328
|
+
}).errors, n), _ = p?.format || "DD/MM/YYYY", y = e ? V([H(_), e]) : H(_), { field: b } = t({
|
|
329
329
|
control: h,
|
|
330
330
|
name: n,
|
|
331
331
|
rules: y,
|
|
332
332
|
defaultValue: a,
|
|
333
333
|
shouldUnregister: o
|
|
334
334
|
});
|
|
335
|
-
return /* @__PURE__ */ k(
|
|
336
|
-
dateAdapter:
|
|
337
|
-
localeText:
|
|
335
|
+
return /* @__PURE__ */ k(G, {
|
|
336
|
+
dateAdapter: W,
|
|
337
|
+
localeText: ce.components.MuiLocalizationProvider.defaultProps.localeText,
|
|
338
338
|
children: /* @__PURE__ */ A(v, { children: [
|
|
339
339
|
c && /* @__PURE__ */ k(X, {
|
|
340
340
|
label: c,
|
|
341
341
|
required: l
|
|
342
342
|
}),
|
|
343
|
-
/* @__PURE__ */ M(
|
|
343
|
+
/* @__PURE__ */ M(se, {
|
|
344
344
|
...p,
|
|
345
345
|
key: n,
|
|
346
346
|
value: b.value ?? null,
|
|
@@ -393,7 +393,7 @@ function be({ children: t, style: n, onSubmit: r, ...i }) {
|
|
|
393
393
|
var xe = ({ disableDefaultValuesUpdate: e, onSubmit: t, ...r }) => {
|
|
394
394
|
let i = n({
|
|
395
395
|
...r,
|
|
396
|
-
resolver: r.schema &&
|
|
396
|
+
resolver: r.schema && K(r.schema)
|
|
397
397
|
});
|
|
398
398
|
return I(() => {
|
|
399
399
|
e || i.reset(r.defaultValues);
|
|
@@ -413,8 +413,18 @@ function Se({ children: e, style: t, ...n }) {
|
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
//#endregion
|
|
416
|
-
//#region src/radio/
|
|
417
|
-
var Ce = ({
|
|
416
|
+
//#region src/radio/radioButton/radioButton.tsx
|
|
417
|
+
var Ce = ({ label: e, labelPlacement: t, ...n }) => /* @__PURE__ */ k(u, {
|
|
418
|
+
sx: {
|
|
419
|
+
display: "flex",
|
|
420
|
+
flexDirection: "column"
|
|
421
|
+
},
|
|
422
|
+
children: /* @__PURE__ */ k(l, {
|
|
423
|
+
control: /* @__PURE__ */ k(m, { ...n }),
|
|
424
|
+
label: /* @__PURE__ */ k(X, { label: e }),
|
|
425
|
+
labelPlacement: t || "end"
|
|
426
|
+
})
|
|
427
|
+
}), we = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o, label: s, required: c, children: l, orientation: u = "row", disableIconError: d, ...f }) => {
|
|
418
428
|
let p = r()?.control, m = o ?? p;
|
|
419
429
|
if (!m) throw new Z("RadioGroup");
|
|
420
430
|
let { field: g } = t({
|
|
@@ -448,19 +458,9 @@ var Ce = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o,
|
|
|
448
458
|
control: m
|
|
449
459
|
})
|
|
450
460
|
] });
|
|
451
|
-
},
|
|
452
|
-
sx: {
|
|
453
|
-
display: "flex",
|
|
454
|
-
flexDirection: "column"
|
|
455
|
-
},
|
|
456
|
-
children: /* @__PURE__ */ k(l, {
|
|
457
|
-
control: /* @__PURE__ */ k(m, { ...n }),
|
|
458
|
-
label: /* @__PURE__ */ k(X, { label: e }),
|
|
459
|
-
labelPlacement: t || "end"
|
|
460
|
-
})
|
|
461
|
-
}), Te = Q((e) => {
|
|
461
|
+
}, Te = Q((e) => {
|
|
462
462
|
let { name: n, rules: o, defaultValue: s, shouldUnregister: l, control: u, label: d, required: f, options: p, textFieldProps: m, noOptionsText: h, footer: g, multiple: _, info: v, placeholder: y, onChange: x, onInputChange: S, getOptionAfterLabel: C, getOptionLabel: w, getInputValueLabel: T, getOptionKey: E, ...D } = e, j = r()?.control, P = u ?? j;
|
|
463
|
-
if (!P) throw new Z("
|
|
463
|
+
if (!P) throw new Z("Searchable");
|
|
464
464
|
let F = J(i({
|
|
465
465
|
control: P,
|
|
466
466
|
name: n
|
|
@@ -520,7 +520,7 @@ var Ce = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o,
|
|
|
520
520
|
},
|
|
521
521
|
children: /* @__PURE__ */ k(c, {})
|
|
522
522
|
}), g()] })] }),
|
|
523
|
-
isOptionEqualToValue: (e, t) =>
|
|
523
|
+
isOptionEqualToValue: (e, t) => ae(e, t),
|
|
524
524
|
getOptionLabel: C && T || w,
|
|
525
525
|
getOptionKey: E,
|
|
526
526
|
renderOption: typeof C == "function" ? (e, t) => {
|
|
@@ -553,11 +553,11 @@ var Ce = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o,
|
|
|
553
553
|
]
|
|
554
554
|
});
|
|
555
555
|
}), Ee = ({ value: e, placeholder: t, getOptionLabel: n }) => e === null || e?.length === 0 ? /* @__PURE__ */ k("p", {
|
|
556
|
-
style: { color:
|
|
556
|
+
style: { color: B.neutral[100] },
|
|
557
557
|
children: t
|
|
558
558
|
}) : n(e), De = Q((e) => {
|
|
559
|
-
let { name: n, rules: a, defaultValue: o, shouldUnregister: s, control: l, label: u, required: d, options: f, placeholder: m, clearable: h, info: _, footer: v, onChange: y, variant: b = "outlined", getOptionKey: x, getOptionLabel: S, getOptionAfterLabel: C, getInputValueLabel: w, getOptionIcon: E, ...j } = e, M = r()?.control, N = l ?? M, [P, F] =
|
|
560
|
-
if (!N) throw new Z("
|
|
559
|
+
let { name: n, rules: a, defaultValue: o, shouldUnregister: s, control: l, label: u, required: d, options: f, placeholder: m, clearable: h, info: _, footer: v, onChange: y, variant: b = "outlined", getOptionKey: x, getOptionLabel: S, getOptionAfterLabel: C, getInputValueLabel: w, getOptionIcon: E, ...j } = e, M = r()?.control, N = l ?? M, [P, F] = ee(!1);
|
|
560
|
+
if (!N) throw new Z("Select");
|
|
561
561
|
let I = J(i({
|
|
562
562
|
control: N,
|
|
563
563
|
name: n
|
|
@@ -618,7 +618,7 @@ var Ce = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o,
|
|
|
618
618
|
},
|
|
619
619
|
children: /* @__PURE__ */ k(D, {
|
|
620
620
|
icon: le,
|
|
621
|
-
color:
|
|
621
|
+
color: B.neutral[100],
|
|
622
622
|
size: "25px",
|
|
623
623
|
removeMargin: !0
|
|
624
624
|
})
|
|
@@ -698,7 +698,7 @@ var Ce = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o,
|
|
|
698
698
|
}, Ae = Q(({ name: e, rules: n, defaultValue: a, shouldUnregister: o, control: s, label: c, required: l, mask: u, variant: d = "outlined", info: p, parse: m, format: h, onInputChange: g, disableIconError: _, ...y }) => {
|
|
699
699
|
let S = r()?.control, C = s ?? S, w = L(a || void 0);
|
|
700
700
|
if (!C) throw new Z("TextField");
|
|
701
|
-
let [T, E] =
|
|
701
|
+
let [T, E] = ee(!1), O = (e) => {
|
|
702
702
|
let t = e;
|
|
703
703
|
return t = h?.(e) ?? e, u ? q?.[u]?.format(t) : t;
|
|
704
704
|
}, j = (e) => {
|
|
@@ -737,7 +737,7 @@ var Ce = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o,
|
|
|
737
737
|
children: /* @__PURE__ */ k("div", {
|
|
738
738
|
style: { width: "fit-content" },
|
|
739
739
|
children: /* @__PURE__ */ k(D, {
|
|
740
|
-
icon:
|
|
740
|
+
icon: z,
|
|
741
741
|
color: "#757575"
|
|
742
742
|
})
|
|
743
743
|
})
|
|
@@ -765,7 +765,7 @@ var Ce = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o,
|
|
|
765
765
|
onClick: () => E(!T),
|
|
766
766
|
style: { cursor: "pointer" },
|
|
767
767
|
children: /* @__PURE__ */ k(D, {
|
|
768
|
-
icon: T ?
|
|
768
|
+
icon: T ? R : te,
|
|
769
769
|
size: "24px",
|
|
770
770
|
removeMargin: !0
|
|
771
771
|
})
|
|
@@ -807,15 +807,15 @@ var Ce = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o,
|
|
|
807
807
|
let g = J(i({
|
|
808
808
|
control: h,
|
|
809
809
|
name: o
|
|
810
|
-
}).errors, o), _ = p.format || "HH:mm", y = e ?
|
|
810
|
+
}).errors, o), _ = p.format || "HH:mm", y = e ? V([U(_), e]) : U(_), { field: b } = t({
|
|
811
811
|
control: h,
|
|
812
812
|
name: o,
|
|
813
813
|
rules: y,
|
|
814
814
|
defaultValue: n,
|
|
815
815
|
shouldUnregister: a
|
|
816
816
|
});
|
|
817
|
-
return /* @__PURE__ */ k(
|
|
818
|
-
dateAdapter:
|
|
817
|
+
return /* @__PURE__ */ k(G, {
|
|
818
|
+
dateAdapter: W,
|
|
819
819
|
children: /* @__PURE__ */ A(v, { children: [
|
|
820
820
|
l && /* @__PURE__ */ k(X, {
|
|
821
821
|
label: l,
|
|
@@ -860,6 +860,6 @@ var Ce = ({ name: e, rules: n, defaultValue: i, shouldUnregister: a, control: o,
|
|
|
860
860
|
});
|
|
861
861
|
});
|
|
862
862
|
//#endregion
|
|
863
|
-
export { de as Checkbox, he as
|
|
863
|
+
export { de as Checkbox, he as Creatable, ye as DatePicker, Y as FieldError, $ as FieldInfo, X as FieldLabel, Se as Form, be as FormProvider, Ce as RadioButton, we as RadioGroup, Te as Searchable, De as Select, Oe as Slider, ke as Switch, Ae as TextField, Pe as TimePicker, xe as useForm };
|
|
864
864
|
|
|
865
865
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/utils/erroFieldFormatado.ts","../src/components/fieldError/fieldError.tsx","../src/components/fieldLabel/fieldLabel.tsx","../src/formComponentPrecisaDeControl.ts","../src/utils/typedMemo.ts","../src/checkbox/checkbox.tsx","../src/creatableV2/creatableV2.styles.ts","../src/components/fieldInfo/fieldInfo.tsx","../src/creatableV2/creatableV2.tsx","../src/datePicker/datePicker.styles.ts","../src/datePicker/datePicker.tsx","../src/form/formProvider.tsx","../src/form/useForm.ts","../src/form/form.tsx","../src/radio/radioGroup/radioGroup.tsx","../src/radio/radioButton/radioButton.tsx","../src/searchableV2/searchableV2.tsx","../src/selectV2/selectV2RenderValue.tsx","../src/selectV2/selectV2.tsx","../src/slider/slider.tsx","../src/switch/switch.tsx","../src/textField/textField.tsx","../src/timePicker/timePicker.styles.ts","../src/timePicker/timePicker.tsx"],"sourcesContent":["import type { FieldErrors, FieldValues } from 'react-hook-form';\n\nexport const erroFieldFormatado = (errors: FieldErrors<FieldValues>, name: string) => {\n const path = name.replace(/[[\\]]/g, '').split('.');\n\n return path.reduce((obj: Record<string, any>, key) => obj?.[key], errors);\n};\n","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","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","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","import { memo } from 'react';\n\nexport const typedMemo: <T>(c: T) => T = memo;\n","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","import { css, styled } from '@mui/material';\nimport { toRem } from '@s_mart/utils';\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","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","import {\n forwardRef,\n type KeyboardEventHandler,\n type LegacyRef,\n type MouseEventHandler,\n useCallback,\n useState,\n} from 'react';\nimport {\n type FieldPath,\n type FieldPathValue,\n type FieldValues,\n useController,\n useFormContext,\n useFormState,\n} from 'react-hook-form';\nimport isObject from 'lodash-es/isObject';\nimport isEmpty from 'lodash-es/isEmpty';\nimport isEqual from 'lodash-es/isEqual';\nimport {\n Autocomplete,\n TextField,\n Divider,\n Button,\n type AutocompleteValue,\n IconButton,\n type AutocompleteInputChangeReason,\n type AutocompleteChangeReason,\n type AutocompleteChangeDetails,\n} from '@mui/material';\nimport { LIcon } from '@s_mart/core';\nimport { colorPalette } from '@s_mart/tokens';\nimport { linePlus, linePen } from '@s_mart/solid-icons';\nimport { toRem } from '@s_mart/utils';\nimport type { CreatableV2Props } from './creatableV2.types';\nimport { SDivAutoComplete } from './creatableV2.styles';\nimport { FieldLabel } from '../components/fieldLabel';\nimport { FieldError } from '../components/fieldError';\nimport { erroFieldFormatado } from '../utils/erroFieldFormatado';\nimport { FieldInfo } from '../components/fieldInfo';\nimport { typedMemo } from '../utils/typedMemo';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\n\nfunction CreatableV2<\n FieldValue,\n Multiple extends boolean | undefined = undefined,\n DisableClearable extends boolean | undefined = undefined,\n FreeSolo extends boolean | undefined = undefined,\n>(props: CreatableV2Props<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('CreatableV2');\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 = (value: AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo>) => {\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 = (value: AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo>) => {\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 (_: React.SyntheticEvent, value: AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo>) => {\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={getOptionAfterLabel ? getInputValueLabel || getOptionLabel : getOptionLabel}\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>)?.endAdornment ?? null}\n {showEditButton(field.value) ? (\n <div className='editable'>\n <div className='divider' />\n <IconButton size='small' onClick={handleEditOption} sx={{ mx: '3px' }} tabIndex={-1}>\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 size='small' onClick={handleCreateOption} sx={{ mx: '3px' }} tabIndex={-1}>\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(CreatableV2);\n","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","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","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","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","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","import { RadioGroup as RadioGroupMui, Stack } from '@mui/material';\nimport { type FieldPath, type FieldValues, useController, useFormContext } from 'react-hook-form';\nimport { FieldError } from '../../components/fieldError';\nimport { FieldLabel } from '../../components/fieldLabel';\nimport type { RadioGroupProps } from './radioGroup.types';\nimport { FormComponentPrecisaDeControl } from '../../formComponentPrecisaDeControl';\n\nconst RadioGroup = ({\n // RHF\n name,\n rules,\n defaultValue,\n shouldUnregister,\n control: controlFromProps,\n // Component Props\n label,\n required,\n children,\n orientation = 'row',\n disableIconError,\n ...rest\n}: RadioGroupProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('RadioGroup');\n }\n\n const { field } = useController({\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n });\n\n return (\n <Stack>\n {label && <FieldLabel label={label} required={required} />}\n <RadioGroupMui\n key={name}\n value={field.value || ''}\n name={name}\n {...rest}\n onChange={(e) => {\n rest?.onChange?.(e, e.target?.value);\n field.onChange(e);\n }}\n style={{\n display: 'flex',\n flexDirection: orientation,\n }}\n >\n {children}\n </RadioGroupMui>\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </Stack>\n );\n};\n\nexport default RadioGroup;\n","import { FormControlLabel, Grid, Radio as RadioMui } from '@mui/material';\nimport type { RadioProps } from './radioButton.types';\nimport { FieldLabel } from '../../components/fieldLabel';\n\nconst RadioButton = ({ label, labelPlacement, ...rest }: RadioProps) => {\n return (\n <Grid\n sx={{\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <FormControlLabel\n control={<RadioMui {...rest} />}\n label={<FieldLabel label={label} />}\n labelPlacement={labelPlacement || 'end'}\n />\n </Grid>\n );\n};\n\nexport default RadioButton;\n","import { Autocomplete, Divider, TextField } from '@mui/material';\nimport { colorPalette } from '@s_mart/tokens';\nimport isEqual from 'lodash-es/isEqual';\nimport { forwardRef, type LegacyRef } from 'react';\nimport {\n type FieldPath,\n type FieldPathValue,\n type FieldValues,\n useController,\n useFormContext,\n useFormState,\n} from 'react-hook-form';\nimport { FieldError } from '../components/fieldError';\nimport { FieldInfo } from '../components/fieldInfo';\nimport { FieldLabel } from '../components/fieldLabel';\nimport { erroFieldFormatado } from '../utils/erroFieldFormatado';\nimport { typedMemo } from '../utils/typedMemo';\nimport type { SearchableV2Props } from './searchableV2.types';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\nimport type { AutocompleteValue } from '@mui/material';\n\nconst SearchableV2 = <\n FieldValue,\n Multiple extends boolean | undefined = undefined,\n DisableClearable extends boolean | undefined = undefined,\n FreeSolo extends boolean | undefined = undefined,\n>(\n props: SearchableV2Props<FieldValue, Multiple, DisableClearable, FreeSolo>,\n) => {\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 textFieldProps,\n noOptionsText,\n footer,\n multiple,\n info,\n placeholder,\n onChange: onChangeProp,\n onInputChange,\n getOptionAfterLabel,\n getOptionLabel,\n getInputValueLabel,\n getOptionKey,\n ...rest\n } = props;\n\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('SearchableV2');\n }\n\n const formState = useFormState({ control, name });\n\n const formattedError = erroFieldFormatado(formState.errors, name);\n\n const { field } = useController({\n name,\n control,\n rules,\n defaultValue,\n shouldUnregister,\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 <Autocomplete<FieldValue, Multiple, DisableClearable, FreeSolo>\n key={name}\n onChange={(_, value) => {\n field.onChange(value);\n onChangeProp?.(value);\n }}\n onInputChange={(_, value, reason) => {\n if (reason === 'input') {\n onInputChange?.(value);\n }\n }}\n value={fieldValue}\n options={options}\n multiple={multiple}\n readOnly={rest.disabled}\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='searchable-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 noOptionsText={\n <>\n {noOptionsText || 'Nenhuma opção encontrada'}\n {typeof footer !== 'undefined' ? (\n <>\n <div style={{ paddingTop: '0.5rem', paddingBottom: '0.5rem' }}>\n <Divider />\n </div>\n {footer()}\n </>\n ) : null}\n </>\n }\n isOptionEqualToValue={(option, value) => isEqual(option, value)}\n getOptionLabel={getOptionAfterLabel ? getInputValueLabel || getOptionLabel : getOptionLabel}\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 renderInput={(params) => {\n return (\n <TextField\n error={Boolean(formattedError)}\n placeholder={placeholder}\n {...params}\n {...textFieldProps}\n inputRef={field.ref}\n />\n );\n }}\n />\n <FieldError name={name} control={control} />\n </div>\n );\n};\n\nexport default typedMemo(SearchableV2);\n","import { colorPalette } from '@s_mart/tokens';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\nimport type { SelectV2ReturnValueProps } from './selectV2.types';\n\n\n\nexport const SelectV2RenderValue = <\n TFieldValues extends FieldValues = FieldValues,\n TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n value,\n placeholder,\n getOptionLabel,\n}: SelectV2ReturnValueProps<TFieldValues, TFieldName>) => {\n if (value === null || value?.length === 0) {\n return <p style={{ color: colorPalette.neutral[100] }}>{placeholder}</p>;\n }\n\n return getOptionLabel(value);\n};\n","import { useState } from 'react';\nimport {\n type FieldPath,\n type FieldPathValue,\n type FieldValues,\n useController,\n useFormContext,\n useFormState,\n} from 'react-hook-form';\nimport { IconButton, LIcon } from '@s_mart/core';\nimport { lineTimes } from '@s_mart/regular-icons';\nimport { colorPalette } from '@s_mart/tokens';\nimport { Select as SelectMui, MenuItem, Divider } from '@mui/material';\nimport { FieldLabel } from '../components/fieldLabel';\nimport { FieldError } from '../components/fieldError';\nimport { FieldInfo } from '../components/fieldInfo';\nimport { erroFieldFormatado } from '../utils/erroFieldFormatado';\nimport type { SelectV2Props } from './selectV2.types';\nimport { typedMemo } from '../utils/typedMemo';\nimport { SelectV2RenderValue } from './selectV2RenderValue';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\n\nconst SelectV2 = <FieldValue extends FieldValues | string | number>(props: SelectV2Props<FieldValue>) => {\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 placeholder,\n clearable,\n info,\n footer,\n onChange: onChangeProp,\n variant = 'outlined',\n getOptionKey,\n getOptionLabel,\n getOptionAfterLabel,\n getInputValueLabel,\n getOptionIcon,\n ...rest\n } = props;\n\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n const [showSelect, setShowSelect] = useState(false);\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('SelectV2');\n }\n\n const formState = useFormState({ control, name });\n\n const formattedError = erroFieldFormatado(formState.errors, name);\n\n const { field } = useController({\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n });\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 <SelectMui<FieldValue>\n key={name}\n open={showSelect}\n onOpen={() => setShowSelect(true)}\n onClose={() => setShowSelect(false)}\n displayEmpty={Boolean(placeholder)}\n variant={variant}\n autoComplete='off'\n value={field.value || null}\n renderValue={(value) => {\n return (\n <SelectV2RenderValue\n getOptionLabel={\n getOptionAfterLabel ? getInputValueLabel || getOptionLabel : getOptionLabel\n }\n placeholder={placeholder}\n value={value}\n />\n );\n }}\n onChange={(e) => {\n field.onChange(e.target.value);\n onChangeProp?.(e.target.value as FieldValue);\n }}\n error={Boolean(formattedError)}\n size={rest.size || 'medium'}\n inputRef={field.ref}\n {...rest}\n endAdornment={\n <>\n {rest.endAdornment}\n\n {Boolean(clearable && field.value) && (\n <IconButton\n variant='text'\n color='neutral'\n size='small'\n sx={{ borderRadius: '50%', position: 'absolute', right: '2rem' }}\n style={{ padding: 0 }}\n aria-label='Limpar'\n title='Limpar'\n onClick={() => {\n field.onChange(null);\n onChangeProp?.(null);\n }}\n >\n <LIcon icon={lineTimes} color={colorPalette.neutral[100]} size='25px' removeMargin />\n </IconButton>\n )}\n </>\n }\n >\n {options.map((option) => {\n const key = getOptionKey(option);\n const label = getOptionLabel(option);\n const icon = getOptionIcon?.(option);\n return (\n <MenuItem key={key} value={option as any}>\n <div style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>\n {icon !== undefined ? (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {icon}\n {label}\n </div>\n ) : (\n label\n )}\n <span>{getOptionAfterLabel?.(option) ?? null}</span>\n </div>\n </MenuItem>\n );\n })}\n {footer !== undefined && (\n <div key='footer'>\n <div key='footer-divider' style={{ padding: '8px 16px' }}>\n <Divider />\n </div>\n <div key='footer-content'>{footer({ closeSelect: () => setShowSelect(false) })}</div>\n </div>\n )}\n </SelectMui>\n <FieldError name={name} control={control} />\n </div>\n );\n};\n\nexport default typedMemo(SelectV2);\n","import { type FieldPath, type FieldValues, useController, useFormContext } from 'react-hook-form';\nimport type { SliderProps } from './slider.types';\nimport { Slider as SliderMui } from '@mui/material';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\n\nconst Slider = ({ name, rules, defaultValue, shouldUnregister, control: controlFromProps, ...rest }: SliderProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('Slider');\n }\n\n const { field } = useController({\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n });\n\n return (\n <SliderMui\n key={name}\n value={field.value || rest?.min || 0}\n onChange={field.onChange}\n valueLabelDisplay='auto'\n {...rest}\n />\n );\n};\n\nexport default Slider;\n","import { FormControlLabel, Stack, Switch as SwitchMui } from '@mui/material';\nimport { useController, useFormContext } from 'react-hook-form';\nimport { FieldError } from '../components/fieldError';\nimport { FieldLabel } from '../components/fieldLabel';\nimport type { SwitchProps } from './switch.types';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\nimport { typedMemo } from '../utils/typedMemo';\nimport { useCallback } from 'react';\n\nconst Switch = ({\n // RHF\n name,\n rules,\n defaultValue,\n defaultChecked,\n shouldUnregister,\n control: controlFromProps,\n // Component Props\n label,\n labelPlacement = 'end',\n disableIconError,\n onChange: onChangeProp,\n ...rest\n}: SwitchProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('Switch');\n }\n\n const { field } = useController<Record<string, boolean>>({\n control,\n name,\n rules,\n defaultValue: defaultChecked ?? defaultValue ?? false,\n shouldUnregister,\n });\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => {\n field.onChange(checked);\n onChangeProp?.(event, checked);\n },\n [field, onChangeProp],\n );\n\n return (\n <Stack>\n <FormControlLabel\n control={<SwitchMui {...rest} {...field} checked={Boolean(field.value)} onChange={handleChange} />}\n label={<FieldLabel label={label} />}\n labelPlacement={labelPlacement}\n />\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </Stack>\n );\n};\n\nexport default Switch;\n","import { Grid, InputAdornment, Stack, TextField as TextFieldMui, Tooltip } from '@mui/material';\nimport { LIcon } from '@s_mart/core';\nimport * as masks from '@s_mart/masks';\nimport { lineEye, lineEyeSlash, lineInfoCircle } from '@s_mart/solid-icons';\nimport { useRef, useState } from 'react';\nimport { type FieldPath, type FieldValues, useController, useFormContext, useFormState } from 'react-hook-form';\nimport { FieldError } from '../components/fieldError';\nimport { FieldLabel } from '../components/fieldLabel';\nimport { erroFieldFormatado } from '../utils/erroFieldFormatado';\nimport type { TextFieldProps } from './textField.types';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\nimport { typedMemo } from '../utils/typedMemo';\n\nconst TextField = ({\n // RHF\n name,\n rules,\n defaultValue,\n shouldUnregister,\n control: controlFromProps,\n // Component Props\n label,\n required,\n mask,\n variant = 'outlined',\n info,\n parse,\n format,\n onInputChange,\n disableIconError,\n ...rest\n}: TextFieldProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n const previousValue = useRef<string | undefined>(defaultValue || undefined);\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('TextField');\n }\n\n const [showPassword, setShowPassword] = useState(false);\n\n const _handleFormat = (value: string) => {\n let _value = value;\n\n _value = format?.(value) ?? value;\n\n if (mask) {\n return masks?.[mask]?.format(_value);\n }\n\n return _value;\n };\n\n const handleParse = (value: string) => {\n let _value = value;\n\n _value = parse?.(value) ?? _value;\n\n if (mask) {\n return masks?.[mask]?.parse(_value, previousValue.current);\n }\n return _value;\n };\n\n const onKeyDown = (event?: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>): void => {\n if (!event) return;\n\n if (mask !== 'porcentagem' && mask !== 'porcentagem0') {\n return;\n }\n\n event?.stopPropagation();\n\n const value = (event?.target as HTMLInputElement).value;\n\n if (value) {\n const str = String(value);\n\n if (str.length > 0) {\n const percentIndex = str.indexOf('%');\n\n if (percentIndex > -1) {\n event.currentTarget.selectionEnd = percentIndex;\n }\n }\n }\n };\n\n const { field } = useController({\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n });\n\n const formState = useFormState({ control, name });\n\n const formattedError = erroFieldFormatado(formState.errors, name);\n\n return (\n <Stack>\n <div style={{ display: 'flex' }}>\n {label && (\n <div>\n <FieldLabel label={label} required={required} />\n </div>\n )}\n {info && (\n <div>\n <Tooltip title={info} placement='top'>\n <div style={{ width: 'fit-content' }}>\n <LIcon icon={lineInfoCircle} color='#757575' />\n </div>\n </Tooltip>\n </div>\n )}\n </div>\n <TextFieldMui\n key={name}\n variant={variant}\n defaultValue={defaultValue}\n // biome-ignore lint/suspicious/noDoubleEquals: Comparamos com != pois pode ser que o valor seja '0' ou 0\n value={_handleFormat(field.value || (field.value != 0 ? '' : field.value))}\n onChange={(e) => {\n const parsedValue = handleParse(e?.target?.value);\n field.onChange(parsedValue);\n onInputChange?.(parsedValue);\n\n previousValue.current = e.target.value;\n }}\n error={Boolean(formattedError)}\n {...rest}\n type={rest.type === 'password' ? (showPassword ? 'text' : 'password') : rest.type}\n autoComplete={rest.autoComplete || 'off'}\n slotProps={{\n ...rest.slotProps,\n input: {\n onKeyDown,\n inputRef: field.ref,\n endAdornment: rest.type === 'password' && (\n <InputAdornment\n position='start'\n onClick={() => setShowPassword(!showPassword)}\n style={{ cursor: 'pointer' }}\n >\n <LIcon icon={showPassword ? lineEye : lineEyeSlash} size='24px' removeMargin />\n </InputAdornment>\n ),\n ...rest.slotProps?.input,\n },\n }}\n />\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </Stack>\n );\n};\n\nexport default typedMemo(TextField);\n","import { type BaseTextFieldProps, type IconButtonProps, styled } from '@mui/material';\nimport { IconButton } from '@mui/material';\n\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","import { composeValidators, time } from '@s_mart/rules';\n\nimport { Stack } from '@mui/material';\nimport { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport { TimePicker as TimePickerMui } from '@mui/x-date-pickers/TimePicker';\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 './timePicker.styles';\nimport type { TimePickerProps } from './timePicker.types';\n\nimport 'dayjs/locale/pt-br';\n\nconst TimePicker = ({\n // RHF\n rules,\n defaultValue,\n shouldUnregister,\n name,\n control: controlFromProps,\n // Component Props\n required,\n label,\n disabled,\n disableIconError,\n size,\n ...rest\n}: TimePickerProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('TimePicker');\n }\n\n const formState = useFormState({ control, name });\n\n const formattedError = erroFieldFormatado(formState.errors, name);\n\n const timeFormat = rest.format || 'HH:mm';\n const newRules = rules ? composeValidators([time(timeFormat), rules as any]) : time(timeFormat);\n\n const { field } = useController({\n control,\n name,\n rules: newRules,\n defaultValue,\n shouldUnregister,\n });\n\n return (\n <LocalizationProvider dateAdapter={AdapterDayjs}>\n <Stack>\n {label && <FieldLabel label={label} required={required} />}\n <TimePickerMui\n key={name}\n ampm={false}\n format={timeFormat}\n value={field.value ?? null}\n disabled={disabled}\n {...rest}\n onChange={(value, context) => {\n field.onChange(value, context);\n rest?.onChange?.(value, context);\n }}\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 actionBar: {\n actions: [],\n ...rest.slotProps?.actionBar,\n },\n }}\n />\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </Stack>\n </LocalizationProvider>\n );\n};\n\nexport default typedMemo(TimePicker);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,KAAsB,GAAkC,MACtD,EAAK,QAAQ,UAAU,EAAE,CAAC,CAAC,MAAM,GAEvC,CAAA,CAAK,QAAQ,GAA0B,MAAQ,IAAM,IAAM,CAAM,GCCpE,KAGJ,EACA,SACA,gBACA,iBACgD;CAGhD,IAAM,IAAO,EAFK,EAA2B;EAAE;EAAS;CAAK,CAE7B,CAAA,EAAW,QAAQ,CAAI;CAMvD,OAJK,IAKH,kBAAC,GAAD;EAAW,UAAS;EAAQ,MAAM,MAAsB,KAAA;EACrD,UAAA,GAAM;CACE,CAAA,IANJ;AAQX,GCvBM,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;IC3BG,IAAb,cAAmD,MAAM;CACvD,YAAY,GAAuB;EAIjC,AAHA,MACE,gBAAgB,EAAc,+GAChC,GACA,KAAK,OAAO;CACd;AACF,GCLa,IAA4B,GC6DzC,KAAe,GAvDG,EAEhB,SACA,UACA,iBACA,qBACA,SAAS,GAET,UACA,m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WAAW;QAClD,UAAU,EAAM;OAClB;MACF;KACF;KACA,WAAW;MACT,SAAS,CAAC;MACV,GAAG,EAAK,WAAW;KACrB;IACF;GACD,GAhCM,CAgCN;GACD,kBAAC,GAAD;IAAkB;IAAM,aAAa;IAA2B;GAAU,CAAA;EACrE,EAAA,CAAA;CACa,CAAA;AAE1B,CAEmC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/utils/erroFieldFormatado.ts","../src/components/fieldError/fieldError.tsx","../src/components/fieldLabel/fieldLabel.tsx","../src/formComponentPrecisaDeControl.ts","../src/utils/typedMemo.ts","../src/checkbox/checkbox.tsx","../src/components/fieldInfo/fieldInfo.tsx","../src/creatable/creatable.styles.ts","../src/creatable/creatable.tsx","../src/datePicker/datePicker.styles.ts","../src/datePicker/datePicker.tsx","../src/form/formProvider.tsx","../src/form/useForm.ts","../src/form/form.tsx","../src/radio/radioButton/radioButton.tsx","../src/radio/radioGroup/radioGroup.tsx","../src/searchable/searchable.tsx","../src/select/selectRenderValue.tsx","../src/select/select.tsx","../src/slider/slider.tsx","../src/switch/switch.tsx","../src/textField/textField.tsx","../src/timePicker/timePicker.styles.ts","../src/timePicker/timePicker.tsx"],"sourcesContent":["import type { FieldErrors, FieldValues } from 'react-hook-form';\n\nexport const erroFieldFormatado = (errors: FieldErrors<FieldValues>, name: string) => {\n const path = name.replace(/[[\\]]/g, '').split('.');\n\n return path.reduce((obj: Record<string, any>, key) => obj?.[key], errors);\n};\n","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","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","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","import { memo } from 'react';\n\nexport const typedMemo: <T>(c: T) => T = memo;\n","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","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","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","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","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","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","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","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","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","import { FormControlLabel, Grid, Radio as RadioMui } from '@mui/material';\nimport type { RadioProps } from './radioButton.types';\nimport { FieldLabel } from '../../components/fieldLabel';\n\nconst RadioButton = ({ label, labelPlacement, ...rest }: RadioProps) => {\n return (\n <Grid\n sx={{\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <FormControlLabel\n control={<RadioMui {...rest} />}\n label={<FieldLabel label={label} />}\n labelPlacement={labelPlacement || 'end'}\n />\n </Grid>\n );\n};\n\nexport default RadioButton;\n","import { RadioGroup as RadioGroupMui, Stack } from '@mui/material';\nimport { type FieldPath, type FieldValues, useController, useFormContext } from 'react-hook-form';\nimport { FieldError } from '../../components/fieldError';\nimport { FieldLabel } from '../../components/fieldLabel';\nimport type { RadioGroupProps } from './radioGroup.types';\nimport { FormComponentPrecisaDeControl } from '../../formComponentPrecisaDeControl';\n\nconst RadioGroup = ({\n // RHF\n name,\n rules,\n defaultValue,\n shouldUnregister,\n control: controlFromProps,\n // Component Props\n label,\n required,\n children,\n orientation = 'row',\n disableIconError,\n ...rest\n}: RadioGroupProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('RadioGroup');\n }\n\n const { field } = useController({\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n });\n\n return (\n <Stack>\n {label && <FieldLabel label={label} required={required} />}\n <RadioGroupMui\n key={name}\n value={field.value || ''}\n name={name}\n {...rest}\n onChange={(e) => {\n rest?.onChange?.(e, e.target?.value);\n field.onChange(e);\n }}\n style={{\n display: 'flex',\n flexDirection: orientation,\n }}\n >\n {children}\n </RadioGroupMui>\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </Stack>\n );\n};\n\nexport default RadioGroup;\n","import { forwardRef, type LegacyRef } from 'react';\n\nimport { colorPalette } from '@s_mart/tokens';\n\nimport type { AutocompleteValue } from '@mui/material';\nimport { Autocomplete, Divider, TextField } from '@mui/material';\nimport isEqual from 'lodash-es/isEqual';\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 type { SearchableProps } from './searchable.types';\n\nconst Searchable = <\n FieldValue,\n Multiple extends boolean | undefined = undefined,\n DisableClearable extends boolean | undefined = undefined,\n FreeSolo extends boolean | undefined = undefined,\n>(\n props: SearchableProps<FieldValue, Multiple, DisableClearable, FreeSolo>,\n) => {\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 textFieldProps,\n noOptionsText,\n footer,\n multiple,\n info,\n placeholder,\n onChange: onChangeProp,\n onInputChange,\n getOptionAfterLabel,\n getOptionLabel,\n getInputValueLabel,\n getOptionKey,\n ...rest\n } = props;\n\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('Searchable');\n }\n\n const formState = useFormState({ control, name });\n\n const formattedError = erroFieldFormatado(formState.errors, name);\n\n const { field } = useController({\n name,\n control,\n rules,\n defaultValue,\n shouldUnregister,\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 <Autocomplete<FieldValue, Multiple, DisableClearable, FreeSolo>\n key={name}\n onChange={(_, value) => {\n field.onChange(value);\n onChangeProp?.(value);\n }}\n onInputChange={(_, value, reason) => {\n if (reason === 'input') {\n onInputChange?.(value);\n }\n }}\n value={fieldValue}\n options={options}\n multiple={multiple}\n readOnly={rest.disabled}\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='searchable-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 noOptionsText={\n <>\n {noOptionsText || 'Nenhuma opção encontrada'}\n {typeof footer !== 'undefined' ? (\n <>\n <div style={{ paddingTop: '0.5rem', paddingBottom: '0.5rem' }}>\n <Divider />\n </div>\n {footer()}\n </>\n ) : null}\n </>\n }\n isOptionEqualToValue={(option, value) => isEqual(option, value)}\n getOptionLabel={getOptionAfterLabel ? getInputValueLabel || getOptionLabel : getOptionLabel}\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 renderInput={(params) => {\n return (\n <TextField\n error={Boolean(formattedError)}\n placeholder={placeholder}\n {...params}\n {...textFieldProps}\n inputRef={field.ref}\n />\n );\n }}\n />\n <FieldError name={name} control={control} />\n </div>\n );\n};\n\nexport default typedMemo(Searchable);\n","import { colorPalette } from '@s_mart/tokens';\n\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\nimport type { SelectReturnValueProps } from './select.types';\n\nexport const SelectRenderValue = <\n TFieldValues extends FieldValues = FieldValues,\n TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n value,\n placeholder,\n getOptionLabel,\n}: SelectReturnValueProps<TFieldValues, TFieldName>) => {\n if (value === null || value?.length === 0) {\n return <p style={{ color: colorPalette.neutral[100] }}>{placeholder}</p>;\n }\n\n return getOptionLabel(value);\n};\n","import { useState } from 'react';\n\nimport { IconButton, LIcon } from '@s_mart/core';\nimport { lineTimes } from '@s_mart/regular-icons';\nimport { colorPalette } from '@s_mart/tokens';\n\nimport { Divider, MenuItem, Select as SelectMui } from '@mui/material';\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 type { SelectProps } from './select.types';\nimport { SelectRenderValue } from './selectRenderValue';\n\nconst Select = <FieldValue extends FieldValues | string | number>(\n props: SelectProps<FieldValue>,\n) => {\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 placeholder,\n clearable,\n info,\n footer,\n onChange: onChangeProp,\n variant = 'outlined',\n getOptionKey,\n getOptionLabel,\n getOptionAfterLabel,\n getInputValueLabel,\n getOptionIcon,\n ...rest\n } = props;\n\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n const [showSelect, setShowSelect] = useState(false);\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('Select');\n }\n\n const formState = useFormState({ control, name });\n\n const formattedError = erroFieldFormatado(formState.errors, name);\n\n const { field } = useController({\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n });\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 <SelectMui<FieldValue>\n key={name}\n open={showSelect}\n onOpen={() => setShowSelect(true)}\n onClose={() => setShowSelect(false)}\n displayEmpty={Boolean(placeholder)}\n variant={variant}\n autoComplete='off'\n value={field.value || null}\n renderValue={(value) => {\n return (\n <SelectRenderValue\n getOptionLabel={\n getOptionAfterLabel ? getInputValueLabel || getOptionLabel : getOptionLabel\n }\n placeholder={placeholder}\n value={value}\n />\n );\n }}\n onChange={(e) => {\n field.onChange(e.target.value);\n onChangeProp?.(e.target.value as FieldValue);\n }}\n error={Boolean(formattedError)}\n size={rest.size || 'medium'}\n inputRef={field.ref}\n {...rest}\n endAdornment={\n <>\n {rest.endAdornment}\n\n {Boolean(clearable && field.value) && (\n <IconButton\n variant='text'\n color='neutral'\n size='small'\n sx={{ borderRadius: '50%', position: 'absolute', right: '2rem' }}\n style={{ padding: 0 }}\n aria-label='Limpar'\n title='Limpar'\n onClick={() => {\n field.onChange(null);\n onChangeProp?.(null);\n }}\n >\n <LIcon\n icon={lineTimes}\n color={colorPalette.neutral[100]}\n size='25px'\n removeMargin\n />\n </IconButton>\n )}\n </>\n }\n >\n {options.map((option) => {\n const key = getOptionKey(option);\n const label = getOptionLabel(option);\n const icon = getOptionIcon?.(option);\n return (\n <MenuItem key={key} value={option as any}>\n <div style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>\n {icon !== undefined ? (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {icon}\n {label}\n </div>\n ) : (\n label\n )}\n <span>{getOptionAfterLabel?.(option) ?? null}</span>\n </div>\n </MenuItem>\n );\n })}\n {footer !== undefined && (\n <div key='footer'>\n <div key='footer-divider' style={{ padding: '8px 16px' }}>\n <Divider />\n </div>\n <div key='footer-content'>{footer({ closeSelect: () => setShowSelect(false) })}</div>\n </div>\n )}\n </SelectMui>\n <FieldError name={name} control={control} />\n </div>\n );\n};\n\nexport default typedMemo(Select);\n","import { type FieldPath, type FieldValues, useController, useFormContext } from 'react-hook-form';\nimport type { SliderProps } from './slider.types';\nimport { Slider as SliderMui } from '@mui/material';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\n\nconst Slider = ({ name, rules, defaultValue, shouldUnregister, control: controlFromProps, ...rest }: SliderProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('Slider');\n }\n\n const { field } = useController({\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n });\n\n return (\n <SliderMui\n key={name}\n value={field.value || rest?.min || 0}\n onChange={field.onChange}\n valueLabelDisplay='auto'\n {...rest}\n />\n );\n};\n\nexport default Slider;\n","import { FormControlLabel, Stack, Switch as SwitchMui } from '@mui/material';\nimport { useController, useFormContext } from 'react-hook-form';\nimport { FieldError } from '../components/fieldError';\nimport { FieldLabel } from '../components/fieldLabel';\nimport type { SwitchProps } from './switch.types';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\nimport { typedMemo } from '../utils/typedMemo';\nimport { useCallback } from 'react';\n\nconst Switch = ({\n // RHF\n name,\n rules,\n defaultValue,\n defaultChecked,\n shouldUnregister,\n control: controlFromProps,\n // Component Props\n label,\n labelPlacement = 'end',\n disableIconError,\n onChange: onChangeProp,\n ...rest\n}: SwitchProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('Switch');\n }\n\n const { field } = useController<Record<string, boolean>>({\n control,\n name,\n rules,\n defaultValue: defaultChecked ?? defaultValue ?? false,\n shouldUnregister,\n });\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => {\n field.onChange(checked);\n onChangeProp?.(event, checked);\n },\n [field, onChangeProp],\n );\n\n return (\n <Stack>\n <FormControlLabel\n control={<SwitchMui {...rest} {...field} checked={Boolean(field.value)} onChange={handleChange} />}\n label={<FieldLabel label={label} />}\n labelPlacement={labelPlacement}\n />\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </Stack>\n );\n};\n\nexport default Switch;\n","import { Grid, InputAdornment, Stack, TextField as TextFieldMui, Tooltip } from '@mui/material';\nimport { LIcon } from '@s_mart/core';\nimport * as masks from '@s_mart/masks';\nimport { lineEye, lineEyeSlash, lineInfoCircle } from '@s_mart/solid-icons';\nimport { useRef, useState } from 'react';\nimport { type FieldPath, type FieldValues, useController, useFormContext, useFormState } from 'react-hook-form';\nimport { FieldError } from '../components/fieldError';\nimport { FieldLabel } from '../components/fieldLabel';\nimport { erroFieldFormatado } from '../utils/erroFieldFormatado';\nimport type { TextFieldProps } from './textField.types';\nimport { FormComponentPrecisaDeControl } from '../formComponentPrecisaDeControl';\nimport { typedMemo } from '../utils/typedMemo';\n\nconst TextField = ({\n // RHF\n name,\n rules,\n defaultValue,\n shouldUnregister,\n control: controlFromProps,\n // Component Props\n label,\n required,\n mask,\n variant = 'outlined',\n info,\n parse,\n format,\n onInputChange,\n disableIconError,\n ...rest\n}: TextFieldProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n const previousValue = useRef<string | undefined>(defaultValue || undefined);\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('TextField');\n }\n\n const [showPassword, setShowPassword] = useState(false);\n\n const _handleFormat = (value: string) => {\n let _value = value;\n\n _value = format?.(value) ?? value;\n\n if (mask) {\n return masks?.[mask]?.format(_value);\n }\n\n return _value;\n };\n\n const handleParse = (value: string) => {\n let _value = value;\n\n _value = parse?.(value) ?? _value;\n\n if (mask) {\n return masks?.[mask]?.parse(_value, previousValue.current);\n }\n return _value;\n };\n\n const onKeyDown = (event?: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>): void => {\n if (!event) return;\n\n if (mask !== 'porcentagem' && mask !== 'porcentagem0') {\n return;\n }\n\n event?.stopPropagation();\n\n const value = (event?.target as HTMLInputElement).value;\n\n if (value) {\n const str = String(value);\n\n if (str.length > 0) {\n const percentIndex = str.indexOf('%');\n\n if (percentIndex > -1) {\n event.currentTarget.selectionEnd = percentIndex;\n }\n }\n }\n };\n\n const { field } = useController({\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n });\n\n const formState = useFormState({ control, name });\n\n const formattedError = erroFieldFormatado(formState.errors, name);\n\n return (\n <Stack>\n <div style={{ display: 'flex' }}>\n {label && (\n <div>\n <FieldLabel label={label} required={required} />\n </div>\n )}\n {info && (\n <div>\n <Tooltip title={info} placement='top'>\n <div style={{ width: 'fit-content' }}>\n <LIcon icon={lineInfoCircle} color='#757575' />\n </div>\n </Tooltip>\n </div>\n )}\n </div>\n <TextFieldMui\n key={name}\n variant={variant}\n defaultValue={defaultValue}\n // biome-ignore lint/suspicious/noDoubleEquals: Comparamos com != pois pode ser que o valor seja '0' ou 0\n value={_handleFormat(field.value || (field.value != 0 ? '' : field.value))}\n onChange={(e) => {\n const parsedValue = handleParse(e?.target?.value);\n field.onChange(parsedValue);\n onInputChange?.(parsedValue);\n\n previousValue.current = e.target.value;\n }}\n error={Boolean(formattedError)}\n {...rest}\n type={rest.type === 'password' ? (showPassword ? 'text' : 'password') : rest.type}\n autoComplete={rest.autoComplete || 'off'}\n slotProps={{\n ...rest.slotProps,\n input: {\n onKeyDown,\n inputRef: field.ref,\n endAdornment: rest.type === 'password' && (\n <InputAdornment\n position='start'\n onClick={() => setShowPassword(!showPassword)}\n style={{ cursor: 'pointer' }}\n >\n <LIcon icon={showPassword ? lineEye : lineEyeSlash} size='24px' removeMargin />\n </InputAdornment>\n ),\n ...rest.slotProps?.input,\n },\n }}\n />\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </Stack>\n );\n};\n\nexport default typedMemo(TextField);\n","import { type BaseTextFieldProps, type IconButtonProps, styled } from '@mui/material';\nimport { IconButton } from '@mui/material';\n\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","import { composeValidators, time } from '@s_mart/rules';\n\nimport { Stack } from '@mui/material';\nimport { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport { TimePicker as TimePickerMui } from '@mui/x-date-pickers/TimePicker';\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 './timePicker.styles';\nimport type { TimePickerProps } from './timePicker.types';\n\nimport 'dayjs/locale/pt-br';\n\nconst TimePicker = ({\n // RHF\n rules,\n defaultValue,\n shouldUnregister,\n name,\n control: controlFromProps,\n // Component Props\n required,\n label,\n disabled,\n disableIconError,\n size,\n ...rest\n}: TimePickerProps) => {\n const controlFromContext = useFormContext()?.control;\n\n const control = controlFromProps ?? controlFromContext;\n\n if (!control) {\n throw new FormComponentPrecisaDeControl('TimePicker');\n }\n\n const formState = useFormState({ control, name });\n\n const formattedError = erroFieldFormatado(formState.errors, name);\n\n const timeFormat = rest.format || 'HH:mm';\n const newRules = rules ? composeValidators([time(timeFormat), rules as any]) : time(timeFormat);\n\n const { field } = useController({\n control,\n name,\n rules: newRules,\n defaultValue,\n shouldUnregister,\n });\n\n return (\n <LocalizationProvider dateAdapter={AdapterDayjs}>\n <Stack>\n {label && <FieldLabel label={label} required={required} />}\n <TimePickerMui\n key={name}\n ampm={false}\n format={timeFormat}\n value={field.value ?? null}\n disabled={disabled}\n {...rest}\n onChange={(value, context) => {\n field.onChange(value, context);\n rest?.onChange?.(value, context);\n }}\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 actionBar: {\n actions: [],\n ...rest.slotProps?.actionBar,\n },\n }}\n />\n <FieldError name={name} disableIcon={disableIconError} control={control} />\n </Stack>\n </LocalizationProvider>\n );\n};\n\nexport default typedMemo(TimePicker);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,KAAsB,GAAkC,MACtD,EAAK,QAAQ,UAAU,EAAE,CAAC,CAAC,MAAM,GAEvC,CAAA,CAAK,QAAQ,GAA0B,MAAQ,IAAM,IAAM,CAAM,GCCpE,KAGJ,EACA,SACA,gBACA,iBACgD;CAGhD,IAAM,IAAO,EAFK,EAA2B;EAAE;EAAS;CAAK,CAE7B,CAAA,EAAW,QAAQ,CAAI;CAMvD,OAJK,IAKH,kBAAC,GAAD;EAAW,UAAS;EAAQ,MAAM,MAAsB,KAAA;EACrD,UAAA,GAAM;CACE,CAAA,IANJ;AAQX,GCvBM,KAAc,EAAE,UAAO,aAAU,iBAEnC,kB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aAAa;EACjC,UAAA,kBAAC,GAAD,EAAA,UAAA;GACG,KAAS,kBAAC,GAAD;IAAmB;IAAiB;GAAW,CAAA;GACzD,kBAAC,IAAD;IAEE,MAAM;IACN,QAAQ;IACR,OAAO,EAAM,SAAS;IACZ;IACV,GAAI;IACJ,WAAW,GAAO,MAAY;KAE5B,AADA,EAAM,SAAS,GAAO,CAAO,GAC7B,GAAM,WAAW,GAAO,CAAO;IACjC;IACA,OAAO,EACL,kBAAkB,GACpB;IACA,WAAW;KACT,GAAG,EAAK;KACR,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;KACA,WAAW;MACT,SAAS,CAAC;MACV,GAAG,EAAK,WAAW;KACrB;IACF;GACD,GAhCM,CAgCN;GACD,kBAAC,GAAD;IAAkB;IAAM,aAAa;IAA2B;GAAU,CAAA;EACrE,EAAA,CAAA;CACa,CAAA;AAE1B,CAEmC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const _default: <FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined>(props:
|
|
1
|
+
import { SearchableProps } from './searchable.types';
|
|
2
|
+
declare const _default: <FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined>(props: SearchableProps<FieldValue, Multiple, DisableClearable, FreeSolo>) => import("react").JSX.Element;
|
|
3
3
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AutocompleteFreeSoloValueMapping, AutocompleteProps, AutocompleteValue, AutocompleteValueOrFreeSoloValueMapping, TextFieldProps } from '@mui/material';
|
|
2
2
|
import { UseControllerProps } from 'react-hook-form';
|
|
3
|
-
export type
|
|
3
|
+
export type SearchableProps<FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, AutocompleteFieldValue extends AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo> = AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo>> = Omit<AutocompleteProps<FieldValue, Multiple, DisableClearable, FreeSolo>, 'renderInput' | 'size' | 'options' | 'onInputChange' | 'onChange' | 'getOptionLabel' | 'getOptionKey' | 'defaultValue' | 'value'> & UseControllerProps & {
|
|
4
4
|
options: FieldValue[];
|
|
5
5
|
textFieldProps?: TextFieldProps;
|
|
6
6
|
label?: React.ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FieldValues } from 'react-hook-form';
|
|
2
|
-
import {
|
|
3
|
-
declare const _default: <FieldValue extends FieldValues | string | number>(props:
|
|
2
|
+
import { SelectProps } from './select.types';
|
|
3
|
+
declare const _default: <FieldValue extends FieldValues | string | number>(props: SelectProps<FieldValue>) => import("react").JSX.Element;
|
|
4
4
|
export default _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SelectProps as SelectPropsMui } from '@mui/material';
|
|
2
2
|
import { FieldPath, FieldPathValue, FieldValues, UseControllerProps } from 'react-hook-form';
|
|
3
|
-
export type
|
|
3
|
+
export type FooterProps = {
|
|
4
4
|
closeSelect: () => void;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
6
|
+
export type SelectProps<FieldValue extends FieldValues | string | number> = Omit<SelectPropsMui<FieldValue>, 'onChange' | 'multiple' | 'defaultValue' | 'variant'> & UseControllerProps & {
|
|
7
7
|
variant?: 'filled' | 'outlined' | 'standard';
|
|
8
8
|
/**
|
|
9
9
|
* As opções que serão renderizadas no select
|
|
@@ -20,7 +20,7 @@ export type SelectV2Props<FieldValue extends FieldValues | string | number> = Om
|
|
|
20
20
|
* )
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
footer?: (props:
|
|
23
|
+
footer?: (props: FooterProps) => React.ReactNode;
|
|
24
24
|
/**
|
|
25
25
|
* É o conteúdo passado para a tooltip que renderizará ao lado da label do campo,
|
|
26
26
|
* montada à tela como um ícone de informação.
|
|
@@ -61,7 +61,7 @@ export type SelectV2Props<FieldValue extends FieldValues | string | number> = Om
|
|
|
61
61
|
*/
|
|
62
62
|
getOptionIcon?: (option: FieldValue) => React.ReactNode;
|
|
63
63
|
};
|
|
64
|
-
export type
|
|
64
|
+
export type SelectReturnValueProps<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
|
|
65
65
|
value: FieldPathValue<TFieldValues, TFieldName> | null;
|
|
66
66
|
placeholder: string | undefined;
|
|
67
67
|
getOptionLabel: (option: FieldPathValue<TFieldValues, TFieldName>) => string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
2
|
+
import { SelectReturnValueProps } from './select.types';
|
|
3
|
+
export declare const SelectRenderValue: <TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ value, placeholder, getOptionLabel, }: SelectReturnValueProps<TFieldValues, TFieldName>) => string | import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_mart/form",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"@mui/material": "^9.3.1",
|
|
20
20
|
"@mui/system": "^9.3.0",
|
|
21
21
|
"@mui/x-date-pickers": "^9.12.0",
|
|
22
|
-
"@s_mart/core": "16.
|
|
23
|
-
"@s_mart/masks": "16.
|
|
24
|
-
"@s_mart/regular-icons": "16.
|
|
25
|
-
"@s_mart/rules": "16.
|
|
26
|
-
"@s_mart/solid-icons": "16.
|
|
27
|
-
"@s_mart/tokens": "16.
|
|
28
|
-
"@s_mart/typed": "16.
|
|
29
|
-
"@s_mart/utils": "16.
|
|
22
|
+
"@s_mart/core": "16.1.0",
|
|
23
|
+
"@s_mart/masks": "16.1.0",
|
|
24
|
+
"@s_mart/regular-icons": "16.1.0",
|
|
25
|
+
"@s_mart/rules": "16.1.0",
|
|
26
|
+
"@s_mart/solid-icons": "16.1.0",
|
|
27
|
+
"@s_mart/tokens": "16.1.0",
|
|
28
|
+
"@s_mart/typed": "16.1.0",
|
|
29
|
+
"@s_mart/utils": "16.1.0",
|
|
30
30
|
"@types/lodash-es": "^4.17.12",
|
|
31
31
|
"@types/react": "^19.2.18",
|
|
32
32
|
"@types/react-dom": "^19.2.5",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"@mui/material": "^9.0.0",
|
|
43
43
|
"@mui/system": "^9.0.0",
|
|
44
44
|
"@mui/x-date-pickers": "^9.0.0",
|
|
45
|
-
"@s_mart/core": "16.
|
|
46
|
-
"@s_mart/masks": "16.
|
|
47
|
-
"@s_mart/regular-icons": "16.
|
|
48
|
-
"@s_mart/rules": "16.
|
|
49
|
-
"@s_mart/solid-icons": "16.
|
|
50
|
-
"@s_mart/tokens": "16.
|
|
51
|
-
"@s_mart/typed": "16.
|
|
52
|
-
"@s_mart/utils": "16.
|
|
45
|
+
"@s_mart/core": "16.1.0",
|
|
46
|
+
"@s_mart/masks": "16.1.0",
|
|
47
|
+
"@s_mart/regular-icons": "16.1.0",
|
|
48
|
+
"@s_mart/rules": "16.1.0",
|
|
49
|
+
"@s_mart/solid-icons": "16.1.0",
|
|
50
|
+
"@s_mart/tokens": "16.1.0",
|
|
51
|
+
"@s_mart/typed": "16.1.0",
|
|
52
|
+
"@s_mart/utils": "16.1.0",
|
|
53
53
|
"@types/lodash-es": ">=4.17.12",
|
|
54
54
|
"@types/react": ">=18.3.12",
|
|
55
55
|
"@types/react-dom": ">=18.3.1",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { CreatableV2Props } from './creatableV2.types';
|
|
2
|
-
declare function CreatableV2<FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined>(props: CreatableV2Props<FieldValue, Multiple, DisableClearable, FreeSolo>): import("react").JSX.Element;
|
|
3
|
-
declare const _default: typeof CreatableV2;
|
|
4
|
-
export default _default;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
2
|
-
import { SelectV2ReturnValueProps } from './selectV2.types';
|
|
3
|
-
export declare const SelectV2RenderValue: <TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ value, placeholder, getOptionLabel, }: SelectV2ReturnValueProps<TFieldValues, TFieldName>) => string | import("react").JSX.Element;
|
|
File without changes
|