@redpill-paris/quidol-ui
Version:
**quidol-ui** is a framework css create for the project Quidol Live.
3 lines (2 loc) • 1.42 kB
JavaScript
;function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),n=e(t),o=require("styled-components"),r=(e(o),require("../types/srcs/textInput.js")),u=require("../utils/index.js"),i=require("./WrapperTextInputStyle.js");module.exports=function(e){var l,s=t.useContext(o.ThemeContext),a=e.placeholder,c=e.label,d=e.name,p=e.setFocus,m=e.isFocused,x=e.value,f=void 0===x?"":x,v=e.step,h=void 0===v?"":v,y=e.onChange,C=e.error,I=e.isReset,E=e.setReset,S=e.maxLength,T=e.placeholderColor,g=e.onPressEnter,G=void 0===g?function(){}:g,b=e.type,F=void 0===b?"text":b,R=e.inputColor,q=void 0===R?s.text.main:R,N=e.lostFocusEnter,V=void 0===N||N,j=e.className,O=e.disabled,B=void 0!==O&&O,W=e.inputRef,L=void 0===W?null:W,k=((l={})[r.TextInputSVG.FOCUS]=s.text.main,l[r.TextInputSVG.CORRECT]=s.text.main,l[r.TextInputSVG.WRONG]=s.colors.main,l[r.TextInputSVG.NOTHING]=s.text.main,l);if(I){var w=document.getElementById(c);w&&w.focus()}return n.createElement(n.Fragment,null,n.createElement(i,{className:j,id:c,ref:L,onKeyDown:function(e){if("Enter"===e.key){var t=document.getElementById(c);if(G(),!t)return;V?(p(!1),t.blur()):(p(!0),t.focus())}},placeholder:a,label:c,step:h,onChange:y,inputSize:m,onBlur:function(){p(!1)},onFocus:function(){p(!0),E(!1)},color:q||k[u.isWhichSVG(m,C,f)],placeholderColor:T,value:f,name:d,maxLength:S,type:F,disabled:B}))};
//# sourceMappingURL=index.js.map