@kosdev-code/base-ui-components 0.1.0-dev.5596 → 0.1.0-dev.5605
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.
|
@@ -2,11 +2,11 @@ import { BaseFormFieldProps } from '../common/types';
|
|
|
2
2
|
import { InputProps } from '../../../atoms';
|
|
3
3
|
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
4
|
|
|
5
|
-
export type FormInputProps<T extends FieldValues = FieldValues, N extends FieldPath<T> = FieldPath<T>> = BaseFormFieldProps<T, N> & Pick<InputProps, "type" | "className" | "placeholder" | "prefixIconId" | "prefixIconColor" | "suffixIconColor" | "suffixIconId" | "autoFocus"> & {
|
|
5
|
+
export type FormInputProps<T extends FieldValues = FieldValues, N extends FieldPath<T> = FieldPath<T>> = BaseFormFieldProps<T, N> & Pick<InputProps, "type" | "className" | "placeholder" | "prefixIconId" | "prefixIconColor" | "suffixIconColor" | "suffixIconId" | "suffixIcon" | "autoFocus"> & {
|
|
6
6
|
autoTrim?: boolean;
|
|
7
7
|
bold?: boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare const FormInput: <T extends FieldValues = FieldValues, N extends FieldPath<T> = FieldPath<T>>(props: BaseFormFieldProps<T, N> & Pick<InputProps, "autoFocus" | "className" | "placeholder" | "type" | "prefixIconId" | "prefixIconColor" | "suffixIconColor" | "suffixIconId"> & {
|
|
9
|
+
export declare const FormInput: <T extends FieldValues = FieldValues, N extends FieldPath<T> = FieldPath<T>>(props: BaseFormFieldProps<T, N> & Pick<InputProps, "autoFocus" | "className" | "placeholder" | "type" | "prefixIconId" | "prefixIconColor" | "suffixIconColor" | "suffixIcon" | "suffixIconId"> & {
|
|
10
10
|
autoTrim?: boolean | undefined;
|
|
11
11
|
bold?: boolean | undefined;
|
|
12
12
|
} & import('react').RefAttributes<HTMLInputElement>) => import('react').ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-input.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/libraries/base-ui-components/src/components/molecules/form/components/form-input.tsx"],"names":[],"mappings":";AAIA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,MAAM,cAAc,CACxB,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,IACnC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,IAAI,CACF,UAAU,EACR,MAAM,GACN,WAAW,GACX,aAAa,GACb,cAAc,GACd,iBAAiB,GACjB,iBAAiB,GACjB,cAAc,GACd,WAAW,CACd,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"form-input.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/libraries/base-ui-components/src/components/molecules/form/components/form-input.tsx"],"names":[],"mappings":";AAIA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,MAAM,cAAc,CACxB,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,IACnC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,IAAI,CACF,UAAU,EACR,MAAM,GACN,WAAW,GACX,aAAa,GACb,cAAc,GACd,iBAAiB,GACjB,iBAAiB,GACjB,cAAc,GACd,YAAY,GACZ,WAAW,CACd,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAyF7C,eAAO,MAAM,SAAS;;;iFAAoC,CAAC"}
|
package/index.cjs
CHANGED
|
@@ -1308,7 +1308,7 @@
|
|
|
1308
1308
|
width: 100%;
|
|
1309
1309
|
border-bottom: ${sr("border-width")} solid
|
|
1310
1310
|
${sr("border-color")};
|
|
1311
|
-
`,[ne]=z(["input"]),It=d.forwardRef(({className:e,type:t,prefixIconId:o,prefixIconColor:n,prefixSize:r,isSmall:s,autoCapitalize:l="off",autoComplete:a="off",autoCorrect:u="off",suffixIconColor:h,suffixIcon:p,suffixIconId:f,suffixSize:m,onSuffixIconClick:x,onEnter:b,onKeyDown:y,onClear:w,...v},$)=>{const C=t==="password",[S,k]=d.useState(!1),[I,j]=d.useState(t),_=d.useCallback(()=>{j(S?"password":"text"),k(!S)},[S]),B=U=>{U.key==="Enter"&&(b==null||b()),y==null||y(U)};if(d.useEffect(()=>{j(t)},[t]),w&&C)throw new Error("Password inputs cannot have an onClear handler.");if(p&&C)throw new Error("Password inputs cannot have a suffix icon.");if(w&&p)throw new Error("Inputs with an onClear handler cannot have a suffix icon.");return i.jsx(M.ClassNames,{children:({cx:U})=>i.jsxs(Fd,{children:[i.jsx(Ad,{type:I,className:U(e,{isSmall:s,hasLeftIcon:!!o,hasRightIcon:!!C||!!f}),ref:$,autoCapitalize:C?"off":l,autoComplete:C?"current-password":a,autoCorrect:C?"off":u,onKeyDown:B,...v}),o&&i.jsx(Ld,{iconId:o,color:n||"black",size:r||"sm"}),(C||!!f||!!p||w&&!!v.value)&&i.jsx(Bd,{children:p||(f?i.jsx(F,{iconId:f,color:h??"black",size:m||"sm",onClick:x}):w?i.jsx(ie,{iconId:"Close",size:"sm",color:"black",onClick:w}):i.jsx(ie,{onClick:_,iconId:S?"Eye":"EyeInvisible",size:"sm",color:n??"black"}))})]})})}),Fd=g.div`
|
|
1311
|
+
`,[ne]=z(["input"]),It=d.forwardRef(({className:e,type:t,prefixIconId:o,prefixIconColor:n,prefixSize:r,isSmall:s,autoCapitalize:l="off",autoComplete:a="off",autoCorrect:u="off",suffixIconColor:h,suffixIcon:p,suffixIconId:f,suffixSize:m,onSuffixIconClick:x,onEnter:b,onKeyDown:y,onClear:w,...v},$)=>{const C=t==="password",[S,k]=d.useState(!1),[I,j]=d.useState(t),_=d.useCallback(()=>{j(S?"password":"text"),k(!S)},[S]),B=U=>{U.key==="Enter"&&(b==null||b()),y==null||y(U)};if(d.useEffect(()=>{j(t)},[t]),w&&C)throw new Error("Password inputs cannot have an onClear handler.");if(p&&C)throw new Error("Password inputs cannot have a suffix icon.");if(w&&p)throw new Error("Inputs with an onClear handler cannot have a suffix icon.");return i.jsx(M.ClassNames,{children:({cx:U})=>i.jsxs(Fd,{children:[i.jsx(Ad,{type:I,className:U(e,{isSmall:s,hasLeftIcon:!!o,hasRightIcon:!!C||!!f||!!p}),ref:$,autoCapitalize:C?"off":l,autoComplete:C?"current-password":a,autoCorrect:C?"off":u,onKeyDown:B,...v}),o&&i.jsx(Ld,{iconId:o,color:n||"black",size:r||"sm"}),(C||!!f||!!p||w&&!!v.value)&&i.jsx(Bd,{children:p||(f?i.jsx(F,{iconId:f,color:h??"black",size:m||"sm",onClick:x}):w?i.jsx(ie,{iconId:"Close",size:"sm",color:"black",onClick:w}):i.jsx(ie,{onClick:_,iconId:S?"Eye":"EyeInvisible",size:"sm",color:n??"black"}))})]})})}),Fd=g.div`
|
|
1312
1312
|
width: 100%;
|
|
1313
1313
|
height: fit-content;
|
|
1314
1314
|
position: relative;
|
|
@@ -2126,7 +2126,7 @@
|
|
|
2126
2126
|
-webkit-user-select: none;
|
|
2127
2127
|
`,xp=g(_t)`
|
|
2128
2128
|
max-height: 300px;
|
|
2129
|
-
`,yp=({name:e,disabled:t,label:o,handleError:n,children:r,placeholder:s,prefixIcon:l,prefixIconColor:a,className:u,readOnly:h,onSelectionChange:p,...f})=>{const{control:m}=q.useFormContext(),{field:{ref:x,...b},fieldState:{error:y}}=q.useController({name:e,control:m,rules:f,disabled:t}),w=d.useId(),{onChange:v}=b,$=d.useCallback(C=>{v(C),p&&p(C)},[v,p]);return i.jsx(M.ClassNames,{children:({cx:C})=>i.jsxs(nt,{children:[i.jsxs(Ue,{className:C({hasLabel:!!o}),children:[o&&i.jsx(Ce,{formItemId:w,isValid:!y,required:!!f.required,children:o}),i.jsx(ti,{disabled:t||h,onSelect:$,className:u,id:w,value:b.value,children:r})]}),!!n&&i.jsx(Ve,{handleError:n,name:e,hasLabel:!!o}),i.jsx(Dn,{ref:x,...b})]})})},vp=({name:e,disabled:t,label:o,placeholder:n,type:r,className:s,handleError:l,prefixIconId:a,prefixIconColor:u,suffixIconColor:h,suffixIconId:p,
|
|
2129
|
+
`,yp=({name:e,disabled:t,label:o,handleError:n,children:r,placeholder:s,prefixIcon:l,prefixIconColor:a,className:u,readOnly:h,onSelectionChange:p,...f})=>{const{control:m}=q.useFormContext(),{field:{ref:x,...b},fieldState:{error:y}}=q.useController({name:e,control:m,rules:f,disabled:t}),w=d.useId(),{onChange:v}=b,$=d.useCallback(C=>{v(C),p&&p(C)},[v,p]);return i.jsx(M.ClassNames,{children:({cx:C})=>i.jsxs(nt,{children:[i.jsxs(Ue,{className:C({hasLabel:!!o}),children:[o&&i.jsx(Ce,{formItemId:w,isValid:!y,required:!!f.required,children:o}),i.jsx(ti,{disabled:t||h,onSelect:$,className:u,id:w,value:b.value,children:r})]}),!!n&&i.jsx(Ve,{handleError:n,name:e,hasLabel:!!o}),i.jsx(Dn,{ref:x,...b})]})})},vp=({name:e,disabled:t,label:o,placeholder:n,type:r,className:s,handleError:l,prefixIconId:a,prefixIconColor:u,suffixIconColor:h,suffixIconId:p,suffixIcon:f,autoFocus:m,readOnly:x,bold:b,...y},w)=>{const{control:v}=q.useFormContext(),{field:{ref:$,...C},fieldState:{error:S}}=q.useController({name:e,control:v,rules:y,disabled:t}),k=d.useId(),I=O.useMergeRefs([$,w]);return i.jsx(M.ClassNames,{children:({cx:j})=>i.jsxs(nt,{children:[i.jsxs(Ue,{className:j({hasLabel:!!o}),children:[o&&i.jsx(Ce,{formItemId:k,isValid:!S,required:!!y.required,children:o}),i.jsx(It,{...C,onChange:_=>{y.autoTrim?C.onChange(_.target.value.trim()):C.onChange(_.target.value)},id:k,type:r,autoFocus:m,placeholder:n,ref:I,autoComplete:"off",prefixIconColor:u,prefixIconId:a,suffixIconId:p,suffixIconColor:h,suffixIcon:f,className:j(s,"form-input"),"aria-invalid":!!S,readOnly:x})]}),!!l&&i.jsx(Ve,{handleError:l,name:e,hasLabel:!!o})]})})},En=$t(vp),kp=({areaField:e,name:t,disabled:o,readOnly:n,label:r,handleError:s,children:l,className:a,...u})=>{const{control:h}=q.useFormContext(),{field:p,fieldState:{error:f,...m}}=q.useController({name:t,control:h,rules:u,disabled:o}),x=d.useId(),b=e?ei:Ue;return i.jsx(M.ClassNames,{children:({cx:y})=>i.jsxs(nt,{className:a,children:[i.jsxs(b,{className:y("form-input-wrapper",{hasLabel:!!r}),children:[r&&i.jsx(Ce,{formItemId:x,isValid:!f,required:!!u.required,children:r}),l(p,{error:f,readOnly:n,...m})]}),!!s&&i.jsx(Ve,{handleError:s,name:t,hasLabel:!!r})]})})},wp=({name:e,disabled:t,label:o,className:n,handleError:r,readOnly:s,...l},a)=>{const{control:u}=q.useFormContext(),{field:{ref:h,...p},fieldState:{error:f}}=q.useController({name:e,control:u,rules:l,disabled:t}),m=d.useId(),x=O.useMergeRefs([h,a]),b=d.useCallback(y=>{y.target.blur(),p.onChange(y)},[p]);return i.jsx(M.ClassNames,{children:({cx:y})=>i.jsxs(nt,{children:[i.jsxs(Ue,{className:y({hasLabel:!!o}),children:[o&&i.jsx(Ce,{formItemId:m,isValid:!f,required:!!l.required,children:o}),i.jsx(jt,{checked:!!p.value,disabled:p.disabled||s,onChange:b,id:m,ref:x,className:y(n,"form-checkbox"),"aria-invalid":!!f})]}),!!r&&i.jsx(Ve,{handleError:r,name:e,hasLabel:!!o})]})})},Cp=$t(wp),[Pt]=z(["form"]),mr=({control:e,name:t,t:o,readOnly:n})=>{const{field:{onChange:r,value:s,disabled:l}}=q.useController({name:t,control:e,rules:{},disabled:!1}),a=d.useId();return i.jsxs($p,{children:[i.jsx(Sp,{isValid:!0,formItemId:a,children:(o==null?void 0:o(`access.${t==="locked"?"lock":"hide"}Label`))??t==="locked"?"Lock":"Hide"}),i.jsx(bo,{checked:s,readOnly:l||n,onChange:r,id:a})]})},$p=g.div`
|
|
2130
2130
|
display: flex;
|
|
2131
2131
|
align-items: center;
|
|
2132
2132
|
justify-content: flex-start;
|