@legion-ui-kit/react-core
Version:
To install the package into your project:
3 lines (2 loc) • 2.1 kB
JavaScript
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useId as t}from"react";import l from"classnames";import i from"./styles/styles.module.scss.js";import a from"../Icon/index.js";import{kebabCase as n}from"../../helpers/typography.js";import{TEXT_FIELD_DEFAULT_PROPS as r,TEXT_FIELD_VARIANT as c,TEXT_FIELD_STATUS as o}from"./TextField.constant.js";import{ICON_NAME as p}from"../Icon/Icon.constant.js";const m=m=>{const{block:d,caption:f,captionClassName:h,captionStyle:u,className:y,disabled:N,hint:x,hintClassName:_,hintStyle:g,iconLeft:b,iconLeftClassName:C,iconLeftStyle:S,iconRight:w,iconRightClassName:j,iconRightStyle:v,id:I,inputClassName:L,inputStyle:R,inputWrapperClassName:k,inputWrapperStyle:z,label:F,labelClassName:W,labelStyle:T,placeholder:$,prefix:q,prefixClassName:A,prefixStyle:B,size:D=r.size,status:E=r.status,style:G,suffix:H,suffixClassName:J,suffixStyle:K,variant:M=r.variant,...O}=m,P=t(),Q=I||`legion_textfield_${n(P)}`,U=M===c.outline,V=l(i.legion_text_field,y,i[D],i[E],{[i.block]:d,[i.disabled]:N,[i[M]]:M}),X=l(i.text_field_caption,h),Y=l(i.text_field_hint,_),Z=l(i.text_field_input,L),ee=l(i.input_wrapper,k),se=l(i.text_field_label,W),te=l(i.icon_left,C),le=l(i.icon_right,j),ie=l(i.input_prefix,A),ae=l(i.input_suffix,J),ne=(e=>{switch(e){case o.error:return p["error-triangle"];case o.success:return p["success-circle"];default:return p["info-circle"]}})(E);return e("div",{className:V,style:G,children:[F&&s("label",{htmlFor:Q,className:se,style:T,children:F}),e("div",{className:ee,style:z,children:[q&&s("span",{className:ie,style:B,children:q}),b&&s("span",{className:te,style:S,children:b}),s("input",{className:Z,id:Q,placeholder:$,disabled:N,style:R,...O}),U&&s("svg",{xmlns:"http://www.w3.org/2000/svg",children:s("rect",{height:"100%",width:"100%",fill:"none"})}),w&&s("span",{className:le,style:v,children:w}),H&&s("span",{className:ae,style:K,children:H})]}),f&&e("p",{className:X,style:u,children:[s(a,{className:i.caption_icon,icon:ne}),f]}),x&&s("p",{className:Y,style:g,children:x})]})};export{m as default};
//# sourceMappingURL=index.js.map