@s_mart/form 2.0.1 → 2.1.2
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/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -125,7 +125,7 @@ declare type CheckboxProps = CheckboxProps$1 & ControllerCheckbox & {
|
|
|
125
125
|
* @type string
|
|
126
126
|
* @memberof CheckboxProps
|
|
127
127
|
*/
|
|
128
|
-
label?:
|
|
128
|
+
label?: React.ReactNode;
|
|
129
129
|
/**
|
|
130
130
|
* Posição do label em relação ao checkbox
|
|
131
131
|
* @default 'end'
|
|
@@ -158,7 +158,7 @@ declare type SwitchProps = SwitchProps$1 & ControllerSwitch & {
|
|
|
158
158
|
labelPlacement?: 'start' | 'end' | 'top' | 'bottom';
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
declare const Switch: ({ name, rules, defaultValue, shouldUnregister, label, labelPlacement,
|
|
161
|
+
declare const Switch: ({ name, rules, defaultValue, shouldUnregister, label, labelPlacement, ...rest }: SwitchProps) => JSX.Element;
|
|
162
162
|
|
|
163
163
|
declare type RadioProps = RadioProps$1 & {
|
|
164
164
|
/**
|
|
@@ -239,6 +239,6 @@ declare type SliderProps = SliderProps$1 & ControllerSlider & {
|
|
|
239
239
|
labelPlacement?: 'start' | 'end' | 'top' | 'bottom';
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
-
declare const Slider: ({ name, rules, defaultValue, shouldUnregister,
|
|
242
|
+
declare const Slider: ({ name, rules, defaultValue, shouldUnregister, ...rest }: SliderProps) => JSX.Element;
|
|
243
243
|
|
|
244
244
|
export { Checkbox, CheckboxProps, Creatable, CreatableOption, CreatableProps, Form, RadioButton, RadioGroup, RadioGroupProps, RadioProps, Searchable, SearchableOption, SearchableProps, Select, SelectOption, SelectProps, Slider, SliderProps, Switch, SwitchProps, TextField };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var h2=Object.create;var E=Object.defineProperty;var x2=Object.getOwnPropertyDescriptor;var b2=Object.getOwnPropertyNames;var y2=Object.getPrototypeOf,F2=Object.prototype.hasOwnProperty;var w2=(C,i)=>{for(var e in i)E(C,e,{get:i[e],enumerable:!0})},j=(C,i,e,H)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of b2(i))!F2.call(C,o)&&o!==e&&E(C,o,{get:()=>i[o],enumerable:!(H=x2(i,o))||H.enumerable});return C};var C2=(C,i,e)=>(e=C!=null?h2(y2(C)):{},j(i||!C||!C.__esModule?E(e,"default",{value:C,enumerable:!0}):e,C)),P2=C=>j(E({},"__esModule",{value:!0}),C);var U2={};w2(U2,{Checkbox:()=>a2,Creatable:()=>c2,Form:()=>i2,RadioButton:()=>m2,RadioGroup:()=>u2,Searchable:()=>L2,Select:()=>V2,Slider:()=>g2,Switch:()=>p2,TextField:()=>l2});module.exports=P2(U2);var D=require("react-hook-form"),K=require("react/jsx-runtime");function k2({children:C,onSubmit:i,...e}){let H=(0,D.useForm)(e);return(0,K.jsx)(D.FormProvider,{...H,children:(0,K.jsx)("form",{onSubmit:H.handleSubmit(i),children:C})})}var i2=k2;var I=require("react-hook-form"),G=require("@mui/material");var Q=require("@mui/material"),e2=require("@s_mart/utils"),T=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var h2=Object.create;var E=Object.defineProperty;var x2=Object.getOwnPropertyDescriptor;var b2=Object.getOwnPropertyNames;var y2=Object.getPrototypeOf,F2=Object.prototype.hasOwnProperty;var w2=(C,i)=>{for(var e in i)E(C,e,{get:i[e],enumerable:!0})},j=(C,i,e,H)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of b2(i))!F2.call(C,o)&&o!==e&&E(C,o,{get:()=>i[o],enumerable:!(H=x2(i,o))||H.enumerable});return C};var C2=(C,i,e)=>(e=C!=null?h2(y2(C)):{},j(i||!C||!C.__esModule?E(e,"default",{value:C,enumerable:!0}):e,C)),P2=C=>j(E({},"__esModule",{value:!0}),C);var U2={};w2(U2,{Checkbox:()=>a2,Creatable:()=>c2,Form:()=>i2,RadioButton:()=>m2,RadioGroup:()=>u2,Searchable:()=>L2,Select:()=>V2,Slider:()=>g2,Switch:()=>p2,TextField:()=>l2});module.exports=P2(U2);var D=require("react-hook-form"),K=require("react/jsx-runtime");function k2({children:C,onSubmit:i,...e}){let H=(0,D.useForm)(e);return(0,K.jsx)(D.FormProvider,{...H,children:(0,K.jsx)("form",{onSubmit:H.handleSubmit(i),children:C})})}var i2=k2;var I=require("react-hook-form"),G=require("@mui/material");var Q=require("@mui/material"),e2=require("@s_mart/utils"),T=require("react/jsx-runtime"),s=({label:C,required:i,regular:e})=>(0,T.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,e2.toRem)(2)},children:[(0,T.jsx)(Q.Typography,{variant:"caption",fontWeight:e?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&(0,T.jsx)(Q.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var o2=require("react-hook-form"),H2=require("@s_mart/core"),r2=require("react/jsx-runtime"),Z=({name:C})=>{var e,H,o;let i=(0,o2.useFormContext)();return(H=(e=i==null?void 0:i.formState)==null?void 0:e.errors)!=null&&H[C]?(0,r2.jsx)(H2.Indicator,{severity:"error",children:(o=i.formState.errors[C])==null?void 0:o.message}):null};var n2=C2(require("@s_mart/masks")),b=require("react/jsx-runtime"),v2=({name:C,rules:i,defaultValue:e,shouldUnregister:H,label:o,required:d,mask:n,...l})=>{let V=(0,I.useFormContext)();if(!V)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let L=r=>n?n2[n].format(r):r,a=r=>n?n2[n].parse(r):r,c=r=>{if(!r||n!=="porcentagem")return;r==null||r.stopPropagation();let t=(r==null?void 0:r.target).value;if(t){let x=String(t);if(x.length>0){let S=x.indexOf("%");S>-1&&(r.currentTarget.selectionEnd=S)}}};return(0,b.jsx)(I.Controller,{control:V.control,name:C,rules:i,defaultValue:e,shouldUnregister:H,render:({field:{value:r,onChange:t}})=>(0,b.jsxs)(G.Grid,{display:"flex",flexDirection:"column",children:[o&&(0,b.jsx)(s,{label:o,required:d}),(0,b.jsx)(G.TextField,{size:"small",variant:"outlined",autoComplete:"off",defaultValue:e,value:L(r||""),onChange:x=>t(a(x.target.value)),InputProps:{onKeyDown:c},...l}),(0,b.jsx)(Z,{name:C})]})})},l2=v2;var R=require("react-hook-form"),F=require("@mui/material");var m=require("react/jsx-runtime"),S2=({name:C,rules:i,defaultValue:e,shouldUnregister:H,label:o,required:d,options:n,...l})=>{let V=(0,R.useFormContext)();if(!V)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,m.jsx)(R.Controller,{control:V.control,name:C,rules:i,defaultValue:e,shouldUnregister:H,render:({field:{value:L,onChange:a}})=>(0,m.jsxs)(F.Grid,{display:"flex",flexDirection:"column",children:[o&&(0,m.jsx)(s,{label:o,required:d}),(0,m.jsx)(F.Select,{size:"small",variant:"outlined",autoComplete:"off",value:L||"",onChange:a,...l,children:n==null?void 0:n.map((c,r)=>(0,m.jsx)(F.MenuItem,{value:c.value,children:c.label},r))}),(0,m.jsx)(Z,{name:C})]})})},V2=S2;var U=require("react-hook-form"),w=require("@mui/material");var u=require("react/jsx-runtime"),B2=({name:C,rules:i,defaultValue:e,shouldUnregister:H,label:o,required:d,options:n,textFieldProps:l,...V})=>{let L=(0,U.useFormContext)();if(!L)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,u.jsx)(U.Controller,{control:L.control,name:C,rules:i,defaultValue:e,shouldUnregister:H,render:({field:{onChange:a}})=>(0,u.jsxs)(w.Grid,{display:"flex",flexDirection:"column",children:[o&&(0,u.jsx)(s,{label:o,required:d}),(0,u.jsx)(w.Autocomplete,{size:"small",onChange:(c,r)=>a(r),options:n,noOptionsText:"Nenhuma op\xE7\xE3o encontrada",...V,renderInput:c=>(0,u.jsx)(w.TextField,{...c,...l})}),(0,u.jsx)(Z,{name:C})]})})},L2=B2;var q=require("react-hook-form"),f=require("@mui/material"),Z2=require("@s_mart/core");var d2={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};var p=require("@s_mart/utils"),Y=C2(require("@emotion/styled")),J=require("@emotion/react"),t2=J.css`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -57,4 +57,4 @@
|
|
|
57
57
|
transition: background-color 0.2s ease-in-out;
|
|
58
58
|
background-color: ${({theme:C})=>C.palette.grey[100]};
|
|
59
59
|
}
|
|
60
|
-
`;var
|
|
60
|
+
`;var M=require("react/jsx-runtime"),A2=({name:C,rules:i,defaultValue:e,shouldUnregister:H,label:o,required:d,options:n,onCreateOption:l,textFieldProps:V,hideAddButton:L,...a})=>{let c=(0,q.useFormContext)();if(!c)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let r=t=>{l?l(t):console.error("onCreateOption n\xE3o foi definido")};return(0,M.jsx)(q.Controller,{control:c.control,name:C,rules:i,defaultValue:e,shouldUnregister:H,render:({field:{value:t,onChange:x}})=>{let S=(t==null?void 0:t.label)||(t==null?void 0:t.value)||t;return(0,M.jsxs)(f.Grid,{display:"flex",flexDirection:"column",children:[o&&(0,M.jsx)(s,{label:o,required:d}),(0,M.jsx)(s2,{hideAddButton:L,children:(0,M.jsx)(f.Autocomplete,{size:"small",fullWidth:!0,onChange:(B,_)=>x(_),options:n,noOptionsText:(0,M.jsx)(M2,{onClick:()=>r(t),children:(0,M.jsxs)(f.Typography,{children:["Adicionar ",S&&`"${S}"`]})}),...a,renderInput:B=>{let _=L?B.InputProps:{...B.InputProps,endAdornment:(0,M.jsxs)("div",{className:"endAdornments",children:[B.InputProps.endAdornment,(0,M.jsxs)("div",{className:"creatable",children:[(0,M.jsx)("div",{className:"divider"}),(0,M.jsx)("div",{className:"button",onClick:()=>r(t),children:(0,M.jsx)(Z2.LIcon,{icon:d2,size:"24"})})]})]})};return(0,M.jsx)(f.TextField,{...B,onChange:x,InputProps:_,...V})}})}),(0,M.jsx)(Z,{name:C})]})}})},c2=A2;var $=require("react-hook-form"),P=require("@mui/material");var g=require("react/jsx-runtime"),E2=({name:C,rules:i,defaultValue:e,shouldUnregister:H,label:o,labelPlacement:d,required:n,...l})=>{let V=(0,$.useFormContext)();if(!V)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,g.jsx)($.Controller,{control:V.control,name:C,rules:i,defaultValue:e,shouldUnregister:H,render:({field:{value:L,onChange:a}})=>(0,g.jsxs)(P.Grid,{display:"flex",flexDirection:"column",children:[(0,g.jsx)(P.FormControlLabel,{control:(0,g.jsx)(P.Checkbox,{value:L??"",defaultValue:L,onChange:a,...l}),label:(0,g.jsx)(s,{label:o,required:n,regular:!0}),labelPlacement:d||"end"}),(0,g.jsx)(Z,{name:C})]})})},a2=E2;var O=require("react-hook-form"),k=require("@mui/material");var h=require("react/jsx-runtime"),D2=({name:C,rules:i,defaultValue:e,shouldUnregister:H,label:o,labelPlacement:d,...n})=>{let l=(0,O.useFormContext)();if(!l)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,h.jsx)(O.Controller,{control:l.control,name:C,rules:i,defaultValue:e,shouldUnregister:H,render:({field:{value:V,onChange:L}})=>(0,h.jsxs)(k.Grid,{display:"flex",flexDirection:"column",children:[(0,h.jsx)(k.FormControlLabel,{control:(0,h.jsx)(k.Switch,{value:V??"",defaultValue:V,onChange:L,...n}),label:(0,h.jsx)(s,{label:o}),labelPlacement:d||"end"}),(0,h.jsx)(Z,{name:C})]})})},p2=D2;var v=require("@mui/material");var A=require("react/jsx-runtime"),I2=({label:C,labelPlacement:i,...e})=>(0,A.jsx)(v.Grid,{display:"flex",flexDirection:"column",children:(0,A.jsx)(v.FormControlLabel,{control:(0,A.jsx)(v.Radio,{...e}),label:(0,A.jsx)(s,{label:C}),labelPlacement:i||"end"})}),m2=I2;var N=require("react-hook-form"),W=require("@mui/material");var y=require("react/jsx-runtime"),G2=({name:C,rules:i,defaultValue:e,shouldUnregister:H,label:o,required:d,children:n,orientation:l="row",...V})=>{let L=(0,N.useFormContext)();if(!L)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,y.jsx)(N.Controller,{control:L.control,name:C,rules:i,defaultValue:e,shouldUnregister:H,render:({field:{value:a,onChange:c}})=>(0,y.jsxs)(W.Grid,{display:"flex",flexDirection:"column",children:[o&&(0,y.jsx)(s,{label:o,required:d}),(0,y.jsx)(W.RadioGroup,{value:a||"",onChange:c,name:C,...V,style:{display:"flex",flexDirection:l},children:n}),(0,y.jsx)(Z,{name:C})]})})},u2=G2;var z=require("react-hook-form"),f2=require("@mui/material"),X=require("react/jsx-runtime"),R2=({name:C,rules:i,defaultValue:e,shouldUnregister:H,...o})=>{let d=(0,z.useFormContext)();if(!d)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,X.jsx)(z.Controller,{control:d.control,name:C,rules:i,defaultValue:e,shouldUnregister:H,render:({field:{value:n,onChange:l}})=>(0,X.jsx)(f2.Slider,{value:n||(o==null?void 0:o.min)||0,onChange:l,valueLabelDisplay:"auto",...o})})},g2=R2;0&&(module.exports={Checkbox,Creatable,Form,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField});
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{FormProvider as q,useForm as $}from"react-hook-form";import{jsx as v}from"react/jsx-runtime";function O({children:C,onSubmit:i,...
|
|
1
|
+
import{FormProvider as q,useForm as $}from"react-hook-form";import{jsx as v}from"react/jsx-runtime";function O({children:C,onSubmit:i,...o}){let r=$(o);return v(q,{...r,children:v("form",{onSubmit:r.handleSubmit(i),children:C})})}var N=O;import{Controller as Y,useFormContext as J}from"react-hook-form";import{Grid as X,TextField as j}from"@mui/material";import{Typography as S}from"@mui/material";import{toRem as W}from"@s_mart/utils";import{jsx as B,jsxs as z}from"react/jsx-runtime";var s=({label:C,required:i,regular:o})=>z("span",{style:{display:"flex",alignItems:"center",gap:W(2)},children:[B(S,{variant:"caption",fontWeight:o?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&B(S,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as _}from"react-hook-form";import{Indicator as K}from"@s_mart/core";import{jsx as Q}from"react/jsx-runtime";var M=({name:C})=>{var o,r,e;let i=_();return(r=(o=i==null?void 0:i.formState)==null?void 0:o.errors)!=null&&r[C]?Q(K,{severity:"error",children:(e=i.formState.errors[C])==null?void 0:e.message}):null};import*as T from"@s_mart/masks";import{jsx as y,jsxs as e2}from"react/jsx-runtime";var C2=({name:C,rules:i,defaultValue:o,shouldUnregister:r,label:e,required:d,mask:n,...l})=>{let V=J();if(!V)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let L=H=>n?T[n].format(H):H,c=H=>n?T[n].parse(H):H,Z=H=>{if(!H||n!=="porcentagem")return;H==null||H.stopPropagation();let t=(H==null?void 0:H.target).value;if(t){let m=String(t);if(m.length>0){let u=m.indexOf("%");u>-1&&(H.currentTarget.selectionEnd=u)}}};return y(Y,{control:V.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:H,onChange:t}})=>e2(X,{display:"flex",flexDirection:"column",children:[e&&y(s,{label:e,required:d}),y(j,{size:"small",variant:"outlined",autoComplete:"off",defaultValue:o,value:L(H||""),onChange:m=>t(c(m.target.value)),InputProps:{onKeyDown:Z},...l}),y(M,{name:C})]})})},i2=C2;import{Controller as o2,useFormContext as H2}from"react-hook-form";import{Grid as r2,Select as n2,MenuItem as l2}from"@mui/material";import{jsx as g,jsxs as d2}from"react/jsx-runtime";var V2=({name:C,rules:i,defaultValue:o,shouldUnregister:r,label:e,required:d,options:n,...l})=>{let V=H2();if(!V)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return g(o2,{control:V.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:L,onChange:c}})=>d2(r2,{display:"flex",flexDirection:"column",children:[e&&g(s,{label:e,required:d}),g(n2,{size:"small",variant:"outlined",autoComplete:"off",value:L||"",onChange:c,...l,children:n==null?void 0:n.map((Z,H)=>g(l2,{value:Z.value,children:Z.label},H))}),g(M,{name:C})]})})},L2=V2;import{Controller as t2,useFormContext as s2}from"react-hook-form";import{Grid as M2,Autocomplete as Z2,TextField as c2}from"@mui/material";import{jsx as h,jsxs as m2}from"react/jsx-runtime";var a2=({name:C,rules:i,defaultValue:o,shouldUnregister:r,label:e,required:d,options:n,textFieldProps:l,...V})=>{let L=s2();if(!L)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return h(t2,{control:L.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{onChange:c}})=>m2(M2,{display:"flex",flexDirection:"column",children:[e&&h(s,{label:e,required:d}),h(Z2,{size:"small",onChange:(Z,H)=>c(H),options:n,noOptionsText:"Nenhuma op\xE7\xE3o encontrada",...V,renderInput:Z=>h(c2,{...Z,...l})}),h(M,{name:C})]})})},p2=a2;import{Controller as f2,useFormContext as g2}from"react-hook-form";import{Grid as h2,Autocomplete as x2,TextField as b2,Typography as y2}from"@mui/material";import{LIcon as F2}from"@s_mart/core";var A={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};import{toRem as p}from"@s_mart/utils";import E from"@emotion/styled";import{css as D}from"@emotion/react";var I=D`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -57,4 +57,4 @@ import{FormProvider as q,useForm as $}from"react-hook-form";import{jsx as v}from
|
|
|
57
57
|
transition: background-color 0.2s ease-in-out;
|
|
58
58
|
background-color: ${({theme:C})=>C.palette.grey[100]};
|
|
59
59
|
}
|
|
60
|
-
`;import{jsx as a,jsxs as F}from"react/jsx-runtime";var w2=({name:C,rules:i,defaultValue:
|
|
60
|
+
`;import{jsx as a,jsxs as F}from"react/jsx-runtime";var w2=({name:C,rules:i,defaultValue:o,shouldUnregister:r,label:e,required:d,options:n,onCreateOption:l,textFieldProps:V,hideAddButton:L,...c})=>{let Z=g2();if(!Z)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let H=t=>{l?l(t):console.error("onCreateOption n\xE3o foi definido")};return a(f2,{control:Z.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:t,onChange:m}})=>{let u=(t==null?void 0:t.label)||(t==null?void 0:t.value)||t;return F(h2,{display:"flex",flexDirection:"column",children:[e&&a(s,{label:e,required:d}),a(G,{hideAddButton:L,children:a(x2,{size:"small",fullWidth:!0,onChange:(f,k)=>m(k),options:n,noOptionsText:a(R,{onClick:()=>H(t),children:F(y2,{children:["Adicionar ",u&&`"${u}"`]})}),...c,renderInput:f=>{let k=L?f.InputProps:{...f.InputProps,endAdornment:F("div",{className:"endAdornments",children:[f.InputProps.endAdornment,F("div",{className:"creatable",children:[a("div",{className:"divider"}),a("div",{className:"button",onClick:()=>H(t),children:a(F2,{icon:A,size:"24"})})]})]})};return a(b2,{...f,onChange:m,InputProps:k,...V})}})}),a(M,{name:C})]})}})},P2=w2;import{Controller as k2,useFormContext as v2}from"react-hook-form";import{Grid as S2,Checkbox as B2,FormControlLabel as T2}from"@mui/material";import{jsx as x,jsxs as D2}from"react/jsx-runtime";var A2=({name:C,rules:i,defaultValue:o,shouldUnregister:r,label:e,labelPlacement:d,required:n,...l})=>{let V=v2();if(!V)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return x(k2,{control:V.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:L,onChange:c}})=>D2(S2,{display:"flex",flexDirection:"column",children:[x(T2,{control:x(B2,{value:L??"",defaultValue:L,onChange:c,...l}),label:x(s,{label:e,required:n,regular:!0}),labelPlacement:d||"end"}),x(M,{name:C})]})})},E2=A2;import{Controller as I2,useFormContext as G2}from"react-hook-form";import{Grid as R2,Switch as U2,FormControlLabel as q2}from"@mui/material";import{jsx as b,jsxs as N2}from"react/jsx-runtime";var $2=({name:C,rules:i,defaultValue:o,shouldUnregister:r,label:e,labelPlacement:d,...n})=>{let l=G2();if(!l)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return b(I2,{control:l.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:V,onChange:L}})=>N2(R2,{display:"flex",flexDirection:"column",children:[b(q2,{control:b(U2,{value:V??"",defaultValue:V,onChange:L,...n}),label:b(s,{label:e}),labelPlacement:d||"end"}),b(M,{name:C})]})})},O2=$2;import{Grid as W2,Radio as z2,FormControlLabel as _2}from"@mui/material";import{jsx as w}from"react/jsx-runtime";var K2=({label:C,labelPlacement:i,...o})=>w(W2,{display:"flex",flexDirection:"column",children:w(_2,{control:w(z2,{...o}),label:w(s,{label:C}),labelPlacement:i||"end"})}),Q2=K2;import{Controller as Y2,useFormContext as J2}from"react-hook-form";import{Grid as X2,RadioGroup as j2}from"@mui/material";import{jsx as P,jsxs as e3}from"react/jsx-runtime";var C3=({name:C,rules:i,defaultValue:o,shouldUnregister:r,label:e,required:d,children:n,orientation:l="row",...V})=>{let L=J2();if(!L)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return P(Y2,{control:L.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:c,onChange:Z}})=>e3(X2,{display:"flex",flexDirection:"column",children:[e&&P(s,{label:e,required:d}),P(j2,{value:c||"",onChange:Z,name:C,...V,style:{display:"flex",flexDirection:l},children:n}),P(M,{name:C})]})})},i3=C3;import{Controller as o3,useFormContext as H3}from"react-hook-form";import{Slider as r3}from"@mui/material";import{jsx as U}from"react/jsx-runtime";var n3=({name:C,rules:i,defaultValue:o,shouldUnregister:r,...e})=>{let d=H3();if(!d)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return U(o3,{control:d.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:n,onChange:l}})=>U(r3,{value:n||(e==null?void 0:e.min)||0,onChange:l,valueLabelDisplay:"auto",...e})})},l3=n3;export{E2 as Checkbox,P2 as Creatable,N as Form,Q2 as RadioButton,i3 as RadioGroup,p2 as Searchable,L2 as Select,l3 as Slider,O2 as Switch,i2 as TextField};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_mart/form",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"@types/react-dom": ">=18.0.6",
|
|
35
35
|
"@emotion/react": ">=11.10.4",
|
|
36
36
|
"@emotion/styled": ">=11.10.4",
|
|
37
|
-
"@s_mart/core": "
|
|
37
|
+
"@s_mart/core": ">=2.1.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@s_mart/eslint
|
|
40
|
+
"@s_mart/eslint": "*",
|
|
41
41
|
"@s_mart/tsconfig": "*",
|
|
42
42
|
"eslint": "^8.15.0"
|
|
43
43
|
}
|