@arkyn/components 1.2.4 → 1.3.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/bundle.js +1053 -767
- package/dist/bundle.umd.cjs +11 -11
- package/dist/components/Checkbox/index.d.ts +5 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/Checkbox/index.js +20 -0
- package/dist/components/Input/CpfCpnjInput/getConfig.d.ts +1 -1
- package/dist/components/Input/CpfCpnjInput/getConfig.d.ts.map +1 -1
- package/dist/components/Input/CpfCpnjInput/getConfig.js +12 -1
- package/dist/components/Input/CpfCpnjInput/index.d.ts.map +1 -1
- package/dist/components/Input/CpfCpnjInput/index.js +2 -2
- package/dist/components/Input/CurrencyInput/index.js +1 -1
- package/dist/components/Input/MaskInput/getConfig.js +1 -1
- package/dist/components/Input/MaskInput/index.d.ts.map +1 -1
- package/dist/components/Input/MaskInput/index.js +34 -58
- package/dist/components/Select/getConfig.d.ts +313 -0
- package/dist/components/Select/getConfig.d.ts.map +1 -0
- package/dist/components/Select/getConfig.js +30 -0
- package/dist/components/Select/index.d.ts +5 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Select/index.js +71 -0
- package/dist/components/Select/utils/morpheme.d.ts +4 -0
- package/dist/components/Select/utils/morpheme.d.ts.map +1 -0
- package/dist/components/Select/utils/morpheme.js +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/style.css +1 -1
- package/package.json +6 -6
- package/src/components/Checkbox/index.tsx +52 -0
- package/src/components/Checkbox/styles.css +66 -0
- package/src/components/Input/CpfCpnjInput/getConfig.tsx +15 -0
- package/src/components/Input/CpfCpnjInput/index.tsx +3 -4
- package/src/components/Input/CurrencyInput/index.tsx +1 -1
- package/src/components/Input/MaskInput/getConfig.tsx +1 -1
- package/src/components/Input/MaskInput/index.tsx +81 -68
- package/src/components/Select/getConfig.tsx +52 -0
- package/src/components/Select/index.tsx +161 -0
- package/src/components/Select/styles.css +305 -0
- package/src/components/Select/utils/morpheme.tsx +19 -0
- package/src/index.ts +2 -0
package/dist/bundle.umd.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
(function(
|
1
|
+
(function(I,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("react"),require("lucide-react"),require("@remix-run/react"),require("@react-input/mask"),require("framer-motion")):typeof define=="function"&&define.amd?define(["exports","react","lucide-react","@remix-run/react","@react-input/mask","framer-motion"],j):(I=typeof globalThis<"u"?globalThis:I||self,j(I["@arkyn/components"]={},I.require$$0,I.lucideReact,I.react,I.mask,I.framerMotion))})(this,function(I,j,H,ve,rn,Ce){"use strict";var ke={exports:{}},fe={};/**
|
2
2
|
* @license React
|
3
3
|
* react-jsx-runtime.production.min.js
|
4
4
|
*
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/var
|
9
|
+
*/var Te;function tn(){if(Te)return fe;Te=1;var n=j,r=Symbol.for("react.element"),t=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function f(a,d,h){var p,x={},C=null,k=null;h!==void 0&&(C=""+h),d.key!==void 0&&(C=""+d.key),d.ref!==void 0&&(k=d.ref);for(p in d)i.call(d,p)&&!u.hasOwnProperty(p)&&(x[p]=d[p]);if(a&&a.defaultProps)for(p in d=a.defaultProps,d)x[p]===void 0&&(x[p]=d[p]);return{$$typeof:r,type:a,key:C,ref:k,props:x,_owner:l.current}}return fe.Fragment=t,fe.jsx=f,fe.jsxs=f,fe}var de={};/**
|
10
10
|
* @license React
|
11
11
|
* react-jsx-runtime.development.js
|
12
12
|
*
|
@@ -14,19 +14,19 @@
|
|
14
14
|
*
|
15
15
|
* This source code is licensed under the MIT license found in the
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
17
|
-
*/var
|
18
|
-
`+
|
19
|
-
`),
|
20
|
-
`),
|
21
|
-
`+
|
17
|
+
*/var Oe;function sn(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&function(){var n=j,r=Symbol.for("react.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),a=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),k=Symbol.for("react.offscreen"),N=Symbol.iterator,E="@@iterator";function R(e){if(e===null||typeof e!="object")return null;var s=N&&e[N]||e[E];return typeof s=="function"?s:null}var g=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var s=arguments.length,c=new Array(s>1?s-1:0),m=1;m<s;m++)c[m-1]=arguments[m];w("error",e,c)}}function w(e,s,c){{var m=g.ReactDebugCurrentFrame,_=m.getStackAddendum();_!==""&&(s+="%s",c=c.concat([_]));var P=c.map(function(S){return String(S)});P.unshift("Warning: "+s),Function.prototype.apply.call(console[e],console,P)}}var F=!1,T=!1,D=!1,O=!1,W=!1,Y;Y=Symbol.for("react.module.reference");function U(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===u||W||e===l||e===h||e===p||O||e===k||F||T||D||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===x||e.$$typeof===f||e.$$typeof===a||e.$$typeof===d||e.$$typeof===Y||e.getModuleId!==void 0))}function L(e,s,c){var m=e.displayName;if(m)return m;var _=s.displayName||s.name||"";return _!==""?c+"("+_+")":c}function K(e){return e.displayName||"Context"}function y(e){if(e==null)return null;if(typeof e.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case t:return"Portal";case u:return"Profiler";case l:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case a:var s=e;return K(s)+".Consumer";case f:var c=e;return K(c._context)+".Provider";case d:return L(e,e.render,"ForwardRef");case x:var m=e.displayName||null;return m!==null?m:y(e.type)||"Memo";case C:{var _=e,P=_._payload,S=_._init;try{return y(S(P))}catch{return null}}}return null}var B=Object.assign,$=0,M,ee,oe,ie,ae,ne,A;function Z(){}Z.__reactDisabledLog=!0;function Q(){{if($===0){M=console.log,ee=console.info,oe=console.warn,ie=console.error,ae=console.group,ne=console.groupCollapsed,A=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Z,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}$++}}function he(){{if($--,$===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},e,{value:M}),info:B({},e,{value:ee}),warn:B({},e,{value:oe}),error:B({},e,{value:ie}),group:B({},e,{value:ae}),groupCollapsed:B({},e,{value:ne}),groupEnd:B({},e,{value:A})})}$<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var G=g.ReactCurrentDispatcher,re;function xe(e,s,c){{if(re===void 0)try{throw Error()}catch(_){var m=_.stack.trim().match(/\n( *(at )?)/);re=m&&m[1]||""}return`
|
18
|
+
`+re+e}}var Ee=!1,ye;{var Un=typeof WeakMap=="function"?WeakMap:Map;ye=new Un}function Ve(e,s){if(!e||Ee)return"";{var c=ye.get(e);if(c!==void 0)return c}var m;Ee=!0;var _=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var P;P=G.current,G.current=null,Q();try{if(s){var S=function(){throw Error()};if(Object.defineProperty(S.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(S,[])}catch(X){m=X}Reflect.construct(e,[],S)}else{try{S.call()}catch(X){m=X}e.call(S.prototype)}}else{try{throw Error()}catch(X){m=X}e()}}catch(X){if(X&&m&&typeof X.stack=="string"){for(var b=X.stack.split(`
|
19
|
+
`),J=m.stack.split(`
|
20
|
+
`),z=b.length-1,V=J.length-1;z>=1&&V>=0&&b[z]!==J[V];)V--;for(;z>=1&&V>=0;z--,V--)if(b[z]!==J[V]){if(z!==1||V!==1)do if(z--,V--,V<0||b[z]!==J[V]){var q=`
|
21
|
+
`+b[z].replace(" at new "," at ");return e.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",e.displayName)),typeof e=="function"&&ye.set(e,q),q}while(z>=1&&V>=0);break}}}finally{Ee=!1,G.current=P,he(),Error.prepareStackTrace=_}var ue=e?e.displayName||e.name:"",ce=ue?xe(ue):"";return typeof e=="function"&&ye.set(e,ce),ce}function Kn(e,s,c){return Ve(e,!1)}function Jn(e){var s=e.prototype;return!!(s&&s.isReactComponent)}function be(e,s,c){if(e==null)return"";if(typeof e=="function")return Ve(e,Jn(e));if(typeof e=="string")return xe(e);switch(e){case h:return xe("Suspense");case p:return xe("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Kn(e.render);case x:return be(e.type,s,c);case C:{var m=e,_=m._payload,P=m._init;try{return be(P(_),s,c)}catch{}}}return""}var me=Object.prototype.hasOwnProperty,Me={},Ye=g.ReactDebugCurrentFrame;function Se(e){if(e){var s=e._owner,c=be(e.type,e._source,s?s.type:null);Ye.setExtraStackFrame(c)}else Ye.setExtraStackFrame(null)}function Gn(e,s,c,m,_){{var P=Function.call.bind(me);for(var S in e)if(P(e,S)){var b=void 0;try{if(typeof e[S]!="function"){var J=Error((m||"React class")+": "+c+" type `"+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[S]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw J.name="Invariant Violation",J}b=e[S](s,S,m,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(z){b=z}b&&!(b instanceof Error)&&(Se(_),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",m||"React class",c,S,typeof b),Se(null)),b instanceof Error&&!(b.message in Me)&&(Me[b.message]=!0,Se(_),v("Failed %s type: %s",c,b.message),Se(null))}}}var Xn=Array.isArray;function Re(e){return Xn(e)}function Hn(e){{var s=typeof Symbol=="function"&&Symbol.toStringTag,c=s&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c}}function Zn(e){try{return Ue(e),!1}catch{return!0}}function Ue(e){return""+e}function Ke(e){if(Zn(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Hn(e)),Ue(e)}var pe=g.ReactCurrentOwner,Qn={key:!0,ref:!0,__self:!0,__source:!0},Je,Ge,Ne;Ne={};function qn(e){if(me.call(e,"ref")){var s=Object.getOwnPropertyDescriptor(e,"ref").get;if(s&&s.isReactWarning)return!1}return e.ref!==void 0}function er(e){if(me.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function nr(e,s){if(typeof e.ref=="string"&&pe.current&&s&&pe.current.stateNode!==s){var c=y(pe.current.type);Ne[c]||(v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',y(pe.current.type),e.ref),Ne[c]=!0)}}function rr(e,s){{var c=function(){Je||(Je=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}}function tr(e,s){{var c=function(){Ge||(Ge=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};c.isReactWarning=!0,Object.defineProperty(e,"ref",{get:c,configurable:!0})}}var sr=function(e,s,c,m,_,P,S){var b={$$typeof:r,type:e,key:s,ref:c,props:S,_owner:P};return b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(b,"_self",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.defineProperty(b,"_source",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b};function or(e,s,c,m,_){{var P,S={},b=null,J=null;c!==void 0&&(Ke(c),b=""+c),er(s)&&(Ke(s.key),b=""+s.key),qn(s)&&(J=s.ref,nr(s,_));for(P in s)me.call(s,P)&&!Qn.hasOwnProperty(P)&&(S[P]=s[P]);if(e&&e.defaultProps){var z=e.defaultProps;for(P in z)S[P]===void 0&&(S[P]=z[P])}if(b||J){var V=typeof e=="function"?e.displayName||e.name||"Unknown":e;b&&rr(S,V),J&&tr(S,V)}return sr(e,b,J,_,m,pe.current,S)}}var Pe=g.ReactCurrentOwner,Xe=g.ReactDebugCurrentFrame;function le(e){if(e){var s=e._owner,c=be(e.type,e._source,s?s.type:null);Xe.setExtraStackFrame(c)}else Xe.setExtraStackFrame(null)}var Ie;Ie=!1;function we(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function He(){{if(Pe.current){var e=y(Pe.current.type);if(e)return`
|
22
22
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function
|
23
|
+
Check the render method of \``+e+"`."}return""}}function ir(e){{if(e!==void 0){var s=e.fileName.replace(/^.*[\\\/]/,""),c=e.lineNumber;return`
|
24
24
|
|
25
|
-
Check your code at `+
|
25
|
+
Check your code at `+s+":"+c+"."}return""}}var Ze={};function ar(e){{var s=He();if(!s){var c=typeof e=="string"?e:e.displayName||e.name;c&&(s=`
|
26
26
|
|
27
|
-
Check the top-level render call using <`+
|
27
|
+
Check the top-level render call using <`+c+">.")}return s}}function Qe(e,s){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=ar(s);if(Ze[c])return;Ze[c]=!0;var m="";e&&e._owner&&e._owner!==Pe.current&&(m=" It was passed a child from "+y(e._owner.type)+"."),le(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,m),le(null)}}function qe(e,s){{if(typeof e!="object")return;if(Re(e))for(var c=0;c<e.length;c++){var m=e[c];we(m)&&Qe(m,s)}else if(we(e))e._store&&(e._store.validated=!0);else if(e){var _=R(e);if(typeof _=="function"&&_!==e.entries)for(var P=_.call(e),S;!(S=P.next()).done;)we(S.value)&&Qe(S.value,s)}}}function cr(e){{var s=e.type;if(s==null||typeof s=="string")return;var c;if(typeof s=="function")c=s.propTypes;else if(typeof s=="object"&&(s.$$typeof===d||s.$$typeof===x))c=s.propTypes;else return;if(c){var m=y(s);Gn(c,e.props,"prop",m,e)}else if(s.PropTypes!==void 0&&!Ie){Ie=!0;var _=y(s);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_||"Unknown")}typeof s.getDefaultProps=="function"&&!s.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function lr(e){{for(var s=Object.keys(e.props),c=0;c<s.length;c++){var m=s[c];if(m!=="children"&&m!=="key"){le(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",m),le(null);break}}e.ref!==null&&(le(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}}var en={};function nn(e,s,c,m,_,P){{var S=U(e);if(!S){var b="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(b+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var J=ir(_);J?b+=J:b+=He();var z;e===null?z="null":Re(e)?z="array":e!==void 0&&e.$$typeof===r?(z="<"+(y(e.type)||"Unknown")+" />",b=" Did you accidentally export a JSX literal instead of a component?"):z=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",z,b)}var V=or(e,s,c,_,P);if(V==null)return V;if(S){var q=s.children;if(q!==void 0)if(m)if(Re(q)){for(var ue=0;ue<q.length;ue++)qe(q[ue],e);Object.freeze&&Object.freeze(q)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else qe(q,e)}if(me.call(s,"key")){var ce=y(e),X=Object.keys(s).filter(function(pr){return pr!=="key"}),Fe=X.length>0?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}";if(!en[ce+Fe]){var mr=X.length>0?"{"+X.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
28
28
|
let props = %s;
|
29
29
|
<%s {...props} />
|
30
30
|
React keys must be passed directly to JSX without using spread:
|
31
31
|
let props = %s;
|
32
|
-
<%s key={someKey} {...props} />`,we,q,cn,q),Qe[q+we]=!0}}return e===o?nn(w):rn(w),w}}function tn(e,r,a){return qe(e,r,a,!0)}function sn(e,r,a){return qe(e,r,a,!1)}var an=sn,on=tn;ue.Fragment=o,ue.jsx=an,ue.jsxs=on}()),ue}process.env.NODE_ENV==="production"?xe.exports=rr():xe.exports=nr();var i=xe.exports;function he(n,s){return s?i.jsx(s,{size:n,strokeWidth:2.5}):i.jsx(i.Fragment,{})}function tr(n){const{variant:s="ghost",scheme:t="primary",size:o="md",leftIcon:c,rightIcon:u,className:d="",children:l,...m}=n,p={md:12,lg:14}[o];return{className:`arkyn_badge ${s} ${t} ${o} ${d}`.trim(),children:l,leftIcon:he(p,c),rightIcon:he(p,u),...m}}function sr(n){const{leftIcon:s,children:t,rightIcon:o,...c}=tr(n);return i.jsxs("div",{...c,children:[s,t,o]})}function ar(n){const{className:s,orientation:t="horizontal",...o}=n,c=`arkyn_divider ${t} ${s}`;return i.jsx("div",{className:c,...o})}function ir({className:n,...s}){const t="arkyn_skeleton "+n;return i.jsx("div",{className:t.trim(),...s})}function or(n){const{isLoading:s=!1,scheme:t="primary",variant:o="solid",loadingText:c,size:u="md",leftIcon:d,rightIcon:l,disabled:m,className:h="",children:p,...x}=n,P={xs:12,sm:16,md:20,lg:24}[u];return{className:`arkyn_button loading_text_${!!c} ${o} ${t} ${u} loading_${s} ${h}`.trim(),loadingText:c,children:p,iconSize:P,disabled:m||s,leftIcon:he(P,d),rightIcon:he(P,l),...x}}function cr(n){const{leftIcon:s,rightIcon:t,iconSize:o,children:c,loadingText:u,...d}=or(n);return i.jsxs("button",{...d,children:[i.jsxs("div",{className:"spinner",children:[i.jsx(Q.Loader2,{size:o,strokeWidth:2.5}),u&&u]}),i.jsxs("div",{className:"content",children:[s,c,t]})]})}const Oe=N.createContext({});function ur({children:n,...s}){var l,m;const t=me.useActionData(),o=N.useRef(null),c=((l=o.current)==null?void 0:l.name)||"",u=((m=t==null?void 0:t.fieldErrors)==null?void 0:m[c])||null,d=N.useId();return i.jsx(Oe.Provider,{value:{error:u,id:d,inputRef:o},children:i.jsx("section",{className:"arkyn_form_controller",...s,children:n})})}function le(){return N.useContext(Oe)}function lr({children:n}){const{error:s}=le();return n?i.jsx("strong",{className:"arkyn_form_error",children:n}):s?i.jsx("strong",{className:"arkyn_form_error",children:s}):i.jsx(i.Fragment,{})}function fr(n){const{showAsterisk:s=!1,className:t="",...o}=n;return{className:`arkyn_form_label ${s?"show-asterisk":""} ${t}`.trim(),...o}}function dr(n){const{id:s}=le();return i.jsx("label",{...fr(n),htmlFor:s})}const Fe={xs:12,sm:16,md:20,lg:24};function mr(n){const{isLoading:s=!1,scheme:t="primary",variant:o="solid",size:c="md",icon:u,disabled:d,className:l="",...m}=n,h=`arkyn_icon_button ${o} ${t} ${c} loading_${s} ${l}`;return i.jsxs("button",{disabled:d||s,className:h.trim(),...m,children:[i.jsx("div",{className:"spinner",children:i.jsx(Q.Loader2,{size:Fe[c],strokeWidth:2.5})}),i.jsx("div",{className:"content "+c,children:i.jsx(u,{size:Fe[c],strokeWidth:2.5})})]})}function ee(n,s,t){if(!n)return i.jsx(i.Fragment,{});if(typeof n=="string")return i.jsx("p",{className:t,children:n});const o=n;return i.jsx("p",{className:t,children:i.jsx(o,{color:"var(--secondary-600)",size:s,strokeWidth:2.5})})}function hr(n,s){const{isLoading:t,isError:o,size:c="md",className:u="",variant:d="solid",prefix:l,sufix:m,leftIcon:h,rightIcon:p,disabled:x,readOnly:E,onFocus:P,onBlur:T,title:$,style:L,onChange:R,...y}=n,j=p?"right":"left",O=`arkyn_input ${l?"hasPrefix":""} ${m?"hasSufix":""} ${d} ${c} ${x||E||t?"opacity":""} ${o?"errored":""} ${s?"focused":""} ${u}`,I={md:20,lg:20}[c];return{isLoading:t,className:O,prefix:ee(l,I,"prefix"),sufix:ee(m,I,"sufix"),LeftIcon:h,RightIcon:p,disabled:x,readOnly:E,onFocus:P,onBlur:T,title:$,style:L,onChange:R,loadingPosition:j,iconSize:I,Spinner:i.jsx(Q.Loader2,{className:"spinner",size:I,strokeWidth:2.5}),...y}}function _e(n){return n&&n.replace(/[^0-9]/g,"")}function vr(n,s){let t="",o=0;return Array.from(n).forEach((c,u)=>{s[u+o].match(/[0-9]/)||(t+=s[u+o],o++),t+=c}),t}function gr(n){return n.length>11?"CNPJ":"CPF"}const $e={CPF:"999.999.999-999",CNPJ:"99.999.999/9999-99"},pr=_e($e.CNPJ).length;function yr(n){const[s,t]=N.useState(!1),[o,c]=N.useState(_e((n==null?void 0:n.defaultValue)||"")),u=N.useRef(null),{inputRef:d,id:l,error:m}=le(),h=d||u,p=n.isError||!!m,{disabled:x,title:E,style:P,className:T,prefix:$,sufix:L,iconSize:R,loadingPosition:y,isLoading:j,LeftIcon:z,readOnly:V,onFocus:A,onBlur:W,RightIcon:Y,Spinner:O,onChange:K,value:I,defaultValue:Z="",...C}=hr({...n,id:l,isError:p},s),B=z&&!j,J=Y&&!j,X=y==="left"&&j,re=y==="right"&&j;function ne(){x||!(h!=null&&h.current)||(t(!0),h.current.focus())}function te(M){let G=_e(M.target.value);const H=gr(G);G.length>pr||(G=vr(G,$e[H]),M.target.value=G,c(G),K&&K(M))}function se(M){t(!0),A&&A(M)}function ae(M){t(!1),W&&W(M)}return i.jsxs("section",{title:E,style:P,onClick:ne,className:T,children:[$,X&&O,B&&i.jsx(z,{size:R,strokeWidth:2.5}),i.jsx("input",{disabled:x||j,readOnly:V,ref:h,value:I||o,onFocus:se,onChange:te,onBlur:ae,...C}),J&&i.jsx(Y,{size:R,strokeWidth:2.5}),re&&O,L]})}function br(n,s){const{isLoading:t,isError:o,size:c="md",className:u="",variant:d="solid",prefix:l,sufix:m,leftIcon:h,rightIcon:p,disabled:x,readOnly:E,onFocus:P,onBlur:T,title:$,style:L,showCents:R=!1,max:y=1e9,onChange:j,...z}=n,V=p?"right":"left",I=`arkyn_input ${l?"hasPrefix":""} ${m?"hasSufix":""} ${d} ${c} ${x||E||t?"opacity":""} ${o?"errored":""} ${s?"focused":""} ${u}`,C={md:20,lg:20}[c];return{isLoading:t,className:I,prefix:ee(l,C,"prefix"),sufix:ee(m,C,"sufix"),LeftIcon:h,RightIcon:p,disabled:x,readOnly:E,onFocus:P,onBlur:T,title:$,style:L,max:y,onChange:j,showCents:R,loadingPosition:V,iconSize:C,Spinner:i.jsx(Q.Loader2,{className:"spinner",size:C,strokeWidth:2.5}),...z}}const xr=/^[1-9]{1}$/,_r=/^[0-9]{1}$/,Le=8;function Sr(n,s){if(n===0)return"";const t=(n/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"});return s?t:t.replace("R$","").trim()}function Rr(n){const{currencyValue:s,event:t,max:o,setCurrencyValue:c}=n,{key:u,keyCode:d}=t;if(s===0&&!xr.test(u)||s!==0&&!_r.test(u)&&d!==Le)return;const l=s.toString();let m;if(d!==Le){const h=s===0?u:`${l}${u}`;m=Number.parseInt(h,10)}else{const h=l.slice(0,-1);m=h===""?0:Number.parseInt(h,10)}m>Number(o)||c(m)}function Er(n){const[s,t]=N.useState(!1),[o,c]=N.useState(n.defaultValue||0),u=N.useRef(null),{inputRef:d,id:l,error:m}=le(),h=d||u,p=n.isError||!!m,{disabled:x,title:E,style:P,className:T,prefix:$,sufix:L,iconSize:R,loadingPosition:y,isLoading:j,LeftIcon:z,readOnly:V,onFocus:A,onBlur:W,RightIcon:Y,Spinner:O,value:K,max:I,onKeyDown:Z,onChange:C,showCents:B,...J}=br({...n,id:l,isError:p},s),X=z&&!j,re=Y&&!j,ne=y==="left"&&j,te=y==="right"&&j;function se(){x||!(h!=null&&h.current)||(t(!0),h.current.focus())}function ae(H){Rr({currencyValue:o,event:H,max:I,setCurrencyValue:c}),C&&C(o),Z&&Z(H)}function M(H){t(!0),A&&A(H)}function G(H){t(!1),W&&W(H)}return i.jsxs("section",{title:E,style:P,onClick:se,className:T,children:[$,ne&&O,X&&i.jsx(z,{size:R,strokeWidth:2.5}),i.jsx("input",{value:Sr(K||o,B),onKeyDown:ae,disabled:x||j,readOnly:V,ref:h,onFocus:M,onChange:()=>{},onBlur:G,...J}),te&&O,re&&i.jsx(Y,{size:R,strokeWidth:2.5}),L]})}function Cr(n,s){const{isLoading:t,isError:o,size:c="md",className:u="",variant:d="solid",prefix:l,sufix:m,leftIcon:h,rightIcon:p,disabled:x,readOnly:E,onFocus:P,onBlur:T,title:$,style:L,onChange:R,...y}=n,j=p?"right":"left",O=`arkyn_input ${l?"hasPrefix":""} ${m?"hasSufix":""} ${d} ${c} ${x||E||t?"opacity":""} ${o?"errored":""} ${s?"focused":""} ${u}`,I={md:20,lg:20}[c];return{isLoading:t,className:O,prefix:ee(l,I,"prefix"),sufix:ee(m,I,"sufix"),LeftIcon:h,RightIcon:p,disabled:x,readOnly:E,onFocus:P,onBlur:T,title:$,style:L,onChange:R,loadingPosition:j,iconSize:I,Spinner:i.jsx(Q.Loader2,{className:"spinner",size:I,strokeWidth:2.5}),...y}}function ze(n){const[s,t]=N.useState(!1),o=N.useRef(null),{inputRef:c,id:u,error:d}=le(),l=c||o,m=n.isError||!!d,{disabled:h,title:p,style:x,className:E,prefix:P,sufix:T,iconSize:$,loadingPosition:L,isLoading:R,LeftIcon:y,readOnly:j,onFocus:z,onBlur:V,RightIcon:A,Spinner:W,...Y}=Cr({...n,id:u,isError:m},s),O=y&&!R,K=A&&!R,I=L==="left"&&R,Z=L==="right"&&R;function C(){h||!(l!=null&&l.current)||(t(!0),l.current.focus())}function B(X){t(!0),z&&z(X)}function J(X){t(!1),V&&V(X)}return i.jsxs("section",{title:p,style:x,onClick:C,className:E,children:[P,I&&W,O&&i.jsx(y,{size:$,strokeWidth:2.5}),i.jsx("input",{disabled:h||R,readOnly:j,ref:l,onFocus:B,onBlur:J,...Y}),K&&i.jsx(A,{size:$,strokeWidth:2.5}),Z&&W,T]})}function jr(n){return i.jsx(er.InputMask,{component:ze,...n,type:"text"})}function kr(n){return n.type==="currency"?i.jsx(Er,{...n}):n.type==="masked"?i.jsx(jr,{...n}):n.type==="cpf-cpnj"?i.jsx(yr,{...n}):i.jsx(ze,{...n})}function Nr(n){const{className:s="",...t}=n;return{className:`arkyn_breadcrumb ${s}`.trim(),...t}}function Pr(n){const{pathname:s}=me.useLocation(),{className:t="",disabled:o=!1,to:c,...u}=n,d=s===c?"active":"inactive",l=`arkyn_breadcrumb_link ${d} ${t}`;return{to:c,className:l.trim(),disabled:o||d==="active",...u}}function wr(n){const{className:s,...t}=Nr(n);return i.jsx("nav",{className:s,...t})}function Ir(n){const{children:s,className:t,disabled:o,...c}=Pr(n);return o?i.jsxs("p",{className:t,children:[i.jsx(Q.ChevronRight,{size:14,strokeWidth:2.5}),s]}):i.jsxs(me.Link,{className:t,...c,children:[i.jsx(Q.ChevronRight,{size:14,strokeWidth:2.5}),s]})}const De=N.createContext({});function Tr(n){const{isVisibled:s,makeInvisible:t,children:o,className:c="",...u}=n,l=`arkyn_modal_container ${s?"visible":""} ${c}`;return i.jsx(De.Provider,{value:{makeInvisible:t},children:i.jsx(be.AnimatePresence,{children:s&&i.jsxs("aside",{className:l.trim(),...u,children:[i.jsx(be.motion.div,{className:"overlay",transition:{duration:.15,ease:"easeOut"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t}),i.jsx(be.motion.div,{className:"content",transition:{duration:.15,ease:"easeOut"},initial:{opacity:0,scale:.75},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},children:o})]})})})}function Or(n){const{alignment:s="right",className:t,...o}=n,c=`arkyn_modal_footer ${s} ${t}`;return i.jsx("footer",{className:c.trim(),...o})}function Fr(n){const{showCloseButton:s,className:t,children:o,...c}=n,{makeInvisible:u}=N.useContext(De),l=`arkyn_modal_header ${s?"show-close":""} ${t}`;return i.jsxs("header",{className:l.trim(),...c,children:[o,i.jsx("button",{type:"button",onClick:u,children:i.jsx(Q.X,{size:24})})]})}const $r={Container:Tr,Header:Fr,Footer:Or};function Lr(n){const{text:s,size:t="lg",children:o,orientation:c="top",className:u,...d}=n;return i.jsxs("div",{className:`arkyn_tooltip ${t} ${c} ${u}`,...d,children:[o,i.jsx("div",{className:"arkyn_tooltip_text",children:s})]})}function zr(n=""){const s=me.useLocation(),t=new URLSearchParams(s.search),o=n?`${n}:`:"",c=u=>{Object.entries(u).forEach(([d,l])=>{l===void 0?t.delete(`${o}${d}`):t.set(`${o}${d}`,String(l))})};return{getParam:u=>t.get(`${o}${u}`),getScopedSearch:u=>{c(u);let d=t.toString();return d&&(d="?"+d),d}}}S.Badge=sr,S.Breadcrumb=wr,S.BreadcrumbLink=Ir,S.Button=cr,S.Divider=ar,S.FormController=ur,S.FormError=lr,S.FormLabel=dr,S.IconButton=mr,S.Input=kr,S.Modal=$r,S.Skeleton=ir,S.Tooltip=Lr,S.useScopedParams=zr,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
|
32
|
+
<%s key={someKey} {...props} />`,Fe,ce,mr,ce),en[ce+Fe]=!0}}return e===i?lr(V):cr(V),V}}function ur(e,s,c){return nn(e,s,c,!0)}function fr(e,s,c){return nn(e,s,c,!1)}var dr=fr,hr=ur;de.Fragment=i,de.jsx=dr,de.jsxs=hr}()),de}process.env.NODE_ENV==="production"?ke.exports=tn():ke.exports=sn();var o=ke.exports;function ge(n,r){return r?o.jsx(r,{size:n,strokeWidth:2.5}):o.jsx(o.Fragment,{})}function on(n){const{variant:r="ghost",scheme:t="primary",size:i="md",leftIcon:l,rightIcon:u,className:f="",children:a,...d}=n,p={md:12,lg:14}[i];return{className:`arkyn_badge ${r} ${t} ${i} ${f}`.trim(),children:a,leftIcon:ge(p,l),rightIcon:ge(p,u),...d}}function an(n){const{leftIcon:r,children:t,rightIcon:i,...l}=on(n);return o.jsxs("div",{...l,children:[r,t,i]})}function cn(n){const{className:r,orientation:t="horizontal",...i}=n,l=`arkyn_divider ${t} ${r}`;return o.jsx("div",{className:l,...i})}function ln({className:n,...r}){const t="arkyn_skeleton "+n;return o.jsx("div",{className:t.trim(),...r})}function un(n){const{isLoading:r=!1,scheme:t="primary",variant:i="solid",loadingText:l,size:u="md",leftIcon:f,rightIcon:a,disabled:d,className:h="",children:p,...x}=n,k={xs:12,sm:16,md:20,lg:24}[u];return{className:`arkyn_button loading_text_${!!l} ${i} ${t} ${u} loading_${r} ${h}`.trim(),loadingText:l,children:p,iconSize:k,disabled:d||r,leftIcon:ge(k,f),rightIcon:ge(k,a),...x}}function fn(n){const{leftIcon:r,rightIcon:t,iconSize:i,children:l,loadingText:u,...f}=un(n);return o.jsxs("button",{...f,children:[o.jsxs("div",{className:"spinner",children:[o.jsx(H.Loader2,{size:i,strokeWidth:2.5}),u&&u]}),o.jsxs("div",{className:"content",children:[r,l,t]})]})}const Le=j.createContext({});function dn({children:n,...r}){var a,d;const t=ve.useActionData(),i=j.useRef(null),l=((a=i.current)==null?void 0:a.name)||"",u=((d=t==null?void 0:t.fieldErrors)==null?void 0:d[l])||null,f=j.useId();return o.jsx(Le.Provider,{value:{error:u,id:f,inputRef:i},children:o.jsx("section",{className:"arkyn_form_controller",...r,children:n})})}function te(){return j.useContext(Le)}function hn(n){const{name:r,className:t="",size:i="md",isError:l,defaultChecked:u=!1,checked:f=null,onCheck:a,value:d,...h}=n,{id:p,inputRef:x,error:C}=te(),k=l||!!C,[N,E]=j.useState(u||!1),R=typeof f=="boolean"?f:N,g=`arkyn_checkbox ${i} ${k?"error":""} ${R?"checked":""} ${t}`;function v(){const w=N;E(!w),a&&a(w?"":d||"checked")}return o.jsxs("div",{className:g,onClick:v,...h,children:[o.jsx("input",{type:"hidden",name:r,id:p,ref:x,value:R?d||"checked":""}),o.jsx(H.Check,{})]})}function mn({children:n}){const{error:r}=te();return n?o.jsx("strong",{className:"arkyn_form_error",children:n}):r?o.jsx("strong",{className:"arkyn_form_error",children:r}):o.jsx(o.Fragment,{})}function pn(n){const{showAsterisk:r=!1,className:t="",...i}=n;return{className:`arkyn_form_label ${r?"show-asterisk":""} ${t}`.trim(),...i}}function vn(n){const{id:r}=te();return o.jsx("label",{...pn(n),htmlFor:r})}const $e={xs:12,sm:16,md:20,lg:24};function gn(n){const{isLoading:r=!1,scheme:t="primary",variant:i="solid",size:l="md",icon:u,disabled:f,className:a="",...d}=n,h=`arkyn_icon_button ${i} ${t} ${l} loading_${r} ${a}`;return o.jsxs("button",{disabled:f||r,className:h.trim(),...d,children:[o.jsx("div",{className:"spinner",children:o.jsx(H.Loader2,{size:$e[l],strokeWidth:2.5})}),o.jsx("div",{className:"content "+l,children:o.jsx(u,{size:$e[l],strokeWidth:2.5})})]})}function se(n,r,t){if(!n)return o.jsx(o.Fragment,{});if(typeof n=="string")return o.jsx("p",{className:t,children:n});const i=n;return o.jsx("p",{className:t,children:o.jsx(i,{color:"var(--secondary-600)",size:r,strokeWidth:2.5})})}function _e(n){return n&&n.replace(/[^0-9]/g,"")}function ze(n,r){let t="",i=0;return Array.from(n).forEach((l,u)=>{r[u+i].match(/[0-9]/)||(t+=r[u+i],i++),t+=l}),t}function De(n){return n.length>11?"CNPJ":"CPF"}const je={CPF:"999.999.999-999",CNPJ:"99.999.999/9999-99"},We=_e(je.CNPJ).length;function xn(n,r){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:a,sufix:d,leftIcon:h,rightIcon:p,disabled:x,defaultValue:C,readOnly:k,onFocus:N,onBlur:E,title:R,style:g,onChange:v,...w}=n;function F(B){let $=_e(B);const M=De($);if(!($.length>We))return $=ze($,je[M]),$}const T=p?"right":"left",L=`arkyn_input ${a?"hasPrefix":""} ${d?"hasSufix":""} ${f} ${l} ${x||k||t?"opacity":""} ${i?"errored":""} ${r?"focused":""} ${u}`,y={md:20,lg:20}[l];return{isLoading:t,className:L,prefix:se(a,y,"prefix"),sufix:se(d,y,"sufix"),LeftIcon:h,RightIcon:p,defaultValue:F(C||""),disabled:x,readOnly:k,onFocus:N,onBlur:E,title:R,style:g,onChange:v,loadingPosition:T,iconSize:y,Spinner:o.jsx(H.Loader2,{className:"spinner",size:y,strokeWidth:2.5}),...w}}function yn(n){const[r,t]=j.useState(!1),i=j.useRef(null),{inputRef:l,id:u,error:f}=te(),a=l||i,d=n.isError||!!f,{disabled:h,title:p,style:x,className:C,prefix:k,sufix:N,iconSize:E,loadingPosition:R,isLoading:g,LeftIcon:v,readOnly:w,onFocus:F,onBlur:T,RightIcon:D,Spinner:O,onChange:W,value:Y,defaultValue:U,...L}=xn({...n,id:u,isError:d},r),[K,y]=j.useState(U),B=v&&!g,$=D&&!g,M=R==="left"&&g,ee=R==="right"&&g;function oe(){h||!(a!=null&&a.current)||(t(!0),a.current.focus())}function ie(A){let Z=_e(A.target.value);const Q=De(Z);Z.length>We||(Z=ze(Z,je[Q]),A.target.value=Z,y(Z),W&&W(A))}function ae(A){t(!0),F&&F(A)}function ne(A){t(!1),T&&T(A)}return o.jsxs("section",{title:p,style:x,onClick:oe,className:C,children:[k,M&&O,B&&o.jsx(v,{size:E,strokeWidth:2.5}),o.jsx("input",{disabled:h||g,readOnly:w,ref:a,value:Y||K,onFocus:ae,onChange:ie,onBlur:ne,...L}),$&&o.jsx(D,{size:E,strokeWidth:2.5}),ee&&O,N]})}function bn(n,r){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:a,sufix:d,leftIcon:h,rightIcon:p,disabled:x,readOnly:C,onFocus:k,onBlur:N,title:E,style:R,showCents:g=!1,max:v=1e9,onChange:w,...F}=n,T=p?"right":"left",L=`arkyn_input ${a?"hasPrefix":""} ${d?"hasSufix":""} ${f} ${l} ${x||C||t?"opacity":""} ${i?"errored":""} ${r?"focused":""} ${u}`,y={md:20,lg:20}[l];return{isLoading:t,className:L,prefix:se(a,y,"prefix"),sufix:se(d,y,"sufix"),LeftIcon:h,RightIcon:p,disabled:x,readOnly:C,onFocus:k,onBlur:N,title:E,style:R,max:v,onChange:w,showCents:g,loadingPosition:T,iconSize:y,Spinner:o.jsx(H.Loader2,{className:"spinner",size:y,strokeWidth:2.5}),...F}}const Sn=/^[1-9]{1}$/,Cn=/^[0-9]{1}$/,Be=8;function kn(n,r){if(n===0)return"";const t=(n/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"});return r?t:t.replace("R$","").trim()}function _n(n){const{currencyValue:r,event:t,max:i,setCurrencyValue:l}=n,{key:u,keyCode:f}=t;if(r===0&&!Sn.test(u)||r!==0&&!Cn.test(u)&&f!==Be)return;const a=r.toString();let d;if(f!==Be){const h=r===0?u:`${a}${u}`;d=Number.parseInt(h,10)}else{const h=a.slice(0,-1);d=h===""?0:Number.parseInt(h,10)}d>Number(i)||l(d)}function jn(n){const[r,t]=j.useState(!1),[i,l]=j.useState(n.defaultValue||0),u=j.useRef(null),{inputRef:f,id:a,error:d}=te(),h=f||u,p=n.isError||!!d,{disabled:x,title:C,style:k,className:N,prefix:E,sufix:R,iconSize:g,loadingPosition:v,isLoading:w,LeftIcon:F,readOnly:T,onFocus:D,onBlur:O,RightIcon:W,Spinner:Y,value:U,max:L,onKeyDown:K,onChange:y,showCents:B,...$}=bn({...n,id:a,isError:p},r),M=F&&!w,ee=W&&!w,oe=v==="left"&&w,ie=v==="right"&&w;function ae(){x||!(h!=null&&h.current)||(t(!0),h.current.focus())}function ne(Q){_n({currencyValue:i,event:Q,max:L,setCurrencyValue:l}),y&&y(i),K&&K(Q)}function A(Q){t(!0),D&&D(Q)}function Z(Q){t(!1),O&&O(Q)}return o.jsxs("section",{title:C,style:k,onClick:ae,className:N,children:[E,oe&&Y,M&&o.jsx(F,{size:g,strokeWidth:2.5}),o.jsx("input",{value:kn(U||i,B),onKeyDown:ne,disabled:x||w,readOnly:T,ref:h,onFocus:A,onBlur:Z,onChange:()=>{},...$}),ie&&Y,ee&&o.jsx(W,{size:g,strokeWidth:2.5}),R]})}function En(n,r){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:a,sufix:d,leftIcon:h,rightIcon:p,disabled:x,readOnly:C,onFocus:k,onBlur:N,title:E,style:R,onChange:g,showMask:v=!1,type:w,...F}=n,T=p?"right":"left",L=`arkyn_input ${a?"hasPrefix":""} ${d?"hasSufix":""} ${f} ${l} ${x||C||t?"opacity":""} ${i?"errored":""} ${r?"focused":""} ${u}`,y={md:20,lg:20}[l];return{isLoading:t,className:L,prefix:se(a,y,"prefix"),sufix:se(d,y,"sufix"),LeftIcon:h,RightIcon:p,disabled:x,readOnly:C,onFocus:k,onBlur:N,title:E,style:R,onChange:g,loadingPosition:T,iconSize:y,showMask:v,Spinner:o.jsx(H.Loader2,{className:"spinner",size:y,strokeWidth:2.5}),...F}}const Rn=j.forwardRef((n,r)=>o.jsx("input",{ref:r,...n}));function Nn(n){const[r,t]=j.useState(!1),i=j.useRef(null),{inputRef:l,id:u,error:f}=te(),a=l||i,d=n.isError||!!f,{disabled:h,title:p,style:x,className:C,prefix:k,sufix:N,iconSize:E,loadingPosition:R,isLoading:g,LeftIcon:v,readOnly:w,onFocus:F,onBlur:T,RightIcon:D,Spinner:O,...W}=En({...n,id:u,isError:d},r),Y=v&&!g,U=D&&!g,L=R==="left"&&g,K=R==="right"&&g;function y(){h||!(a!=null&&a.current)||(t(!0),a.current.focus())}function B(M){t(!0),F&&F(M)}function $(M){t(!1),T&&T(M)}return o.jsxs("section",{title:p,style:x,onClick:y,className:C,children:[k,L&&O,Y&&o.jsx(v,{size:E,strokeWidth:2.5}),o.jsx(rn.InputMask,{component:Rn,ref:a,onFocus:B,onBlur:$,...W}),U&&o.jsx(D,{size:E,strokeWidth:2.5}),K&&O,N]})}function Pn(n,r){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:a,sufix:d,leftIcon:h,rightIcon:p,disabled:x,readOnly:C,onFocus:k,onBlur:N,title:E,style:R,onChange:g,...v}=n,w=p?"right":"left",Y=`arkyn_input ${a?"hasPrefix":""} ${d?"hasSufix":""} ${f} ${l} ${x||C||t?"opacity":""} ${i?"errored":""} ${r?"focused":""} ${u}`,L={md:20,lg:20}[l];return{isLoading:t,className:Y,prefix:se(a,L,"prefix"),sufix:se(d,L,"sufix"),LeftIcon:h,RightIcon:p,disabled:x,readOnly:C,onFocus:k,onBlur:N,title:E,style:R,onChange:g,loadingPosition:w,iconSize:L,Spinner:o.jsx(H.Loader2,{className:"spinner",size:L,strokeWidth:2.5}),...v}}function In(n){const[r,t]=j.useState(!1),i=j.useRef(null),{inputRef:l,id:u,error:f}=te(),a=l||i,d=n.isError||!!f,{disabled:h,title:p,style:x,className:C,prefix:k,sufix:N,iconSize:E,loadingPosition:R,isLoading:g,LeftIcon:v,readOnly:w,onFocus:F,onBlur:T,RightIcon:D,Spinner:O,...W}=Pn({...n,id:u,isError:d},r),Y=v&&!g,U=D&&!g,L=R==="left"&&g,K=R==="right"&&g;function y(){h||!(a!=null&&a.current)||(t(!0),a.current.focus())}function B(M){t(!0),F&&F(M)}function $(M){t(!1),T&&T(M)}return o.jsxs("section",{title:p,style:x,onClick:y,className:C,children:[k,L&&O,Y&&o.jsx(v,{size:E,strokeWidth:2.5}),o.jsx("input",{disabled:h||g,readOnly:w,ref:a,onFocus:B,onBlur:$,...W}),U&&o.jsx(D,{size:E,strokeWidth:2.5}),K&&O,N]})}function wn(n){return n.type==="currency"?o.jsx(jn,{...n}):n.type==="masked"?o.jsx(Nn,{...n}):n.type==="cpf-cpnj"?o.jsx(yn,{...n}):o.jsx(In,{...n})}function Fn(n,r,t){if(!n)return o.jsx(o.Fragment,{});if(typeof n=="string")return o.jsx("p",{className:t,children:n});const i=n;return o.jsx("p",{className:t,children:o.jsx(i,{color:"var(--secondary-600)",size:r,strokeWidth:2.5})})}function Tn(n,r){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:a,leftIcon:d,disabled:h,readOnly:p,onFocus:x,onBlur:C,title:k,style:N,isSearchable:E=!1,...R}=n,T=`arkyn_select ${a?"hasPrefix":""} ${f} ${l} ${h||p||t?"opacity":""} ${i?"errored":""} ${r?"focused":""} ${u}`,O={md:20,lg:20}[l];return{isLoading:t,className:T,prefix:Fn(a,O,"prefix"),LeftIcon:d,disabled:h,readOnly:p,onFocus:x,onBlur:C,title:k,style:N,isSearchable:E,iconSize:O,Spinner:o.jsx(H.Loader2,{className:"spinner",size:O,strokeWidth:2.5}),...R}}function On(n){var he;const[r,t]=j.useState(!1),{inputRef:i,id:l,error:u}=te(),f=j.useRef(null),a=i||f,d=n.isError||!!u,{disabled:h,title:p,style:x,className:C,prefix:k,iconSize:N,isLoading:E,LeftIcon:R,value:g=null,defaultValue:v="",readOnly:w,onFocus:F,onBlur:T,Spinner:D,name:O,isSearchable:W,placeholder:Y,onSelect:U,options:L,optionMaxHeight:K,...y}=Tn({...n,id:l,isError:d},r),[B,$]=j.useState(v),[M,ee]=j.useState("");function oe(){h||!(a!=null&&a.current)||(t(!0),a.current.focus())}function ie(G){t(!0),F&&F(G)}function ae(){t(!1),T&&a.current&&a.current.blur()}const ne=typeof g=="string"?g:B,A=((he=L.find(G=>G.value===ne))==null?void 0:he.label)||"",Z=()=>{if(W){if(!r&&A)return!0;if(!r&&!A||r)return!1}if(!W){if(!r&&A)return!0;if(!r&&!A)return!1;if(r&&A)return!0;if(r&&!A)return!1}},Q=L.filter(G=>W?G.label.toLowerCase().includes(M.toLowerCase()):!0);return o.jsxs(o.Fragment,{children:[o.jsxs("section",{title:p,style:x,onClick:oe,className:`${C} placeholder_dark_${Z()}`,children:[k,R&&o.jsx(R,{size:N,strokeWidth:2.5}),o.jsx("input",{disabled:h||E,readOnly:!W,value:M||"",placeholder:A||Y,ref:a,onFocus:ie,onBlur:()=>ee(""),...y,onChange:G=>ee(G.target.value)}),o.jsx("input",{type:"hidden",name:O,value:ne||"",readOnly:!0}),r&&o.jsxs("ul",{className:"arkyn_select_content",style:{overflow:"auto",maxHeight:K},children:[Q.map(({label:G,value:re})=>o.jsxs("li",{className:ne===re?"active":"",onClick:()=>{$(B!==re?re:""),U&&U({label:G,value:re})},children:[G," ",o.jsx(H.Check,{})]},re)),Q.length<=0&&o.jsx("p",{children:"Sem opções disponíveis"})]}),!E&&o.jsx(H.ChevronDown,{className:"arkyn_select_arrow",size:N,strokeWidth:2.5}),E&&D]}),r&&o.jsx("aside",{className:"arkyn_select_overlay",onClick:ae})]})}function Ln(n){const{className:r="",...t}=n;return{className:`arkyn_breadcrumb ${r}`.trim(),...t}}function $n(n){const{pathname:r}=ve.useLocation(),{className:t="",disabled:i=!1,to:l,...u}=n,f=r===l?"active":"inactive",a=`arkyn_breadcrumb_link ${f} ${t}`;return{to:l,className:a.trim(),disabled:i||f==="active",...u}}function zn(n){const{className:r,...t}=Ln(n);return o.jsx("nav",{className:r,...t})}function Dn(n){const{children:r,className:t,disabled:i,...l}=$n(n);return i?o.jsxs("p",{className:t,children:[o.jsx(H.ChevronRight,{size:14,strokeWidth:2.5}),r]}):o.jsxs(ve.Link,{className:t,...l,children:[o.jsx(H.ChevronRight,{size:14,strokeWidth:2.5}),r]})}const Ae=j.createContext({});function Wn(n){const{isVisibled:r,makeInvisible:t,children:i,className:l="",...u}=n,a=`arkyn_modal_container ${r?"visible":""} ${l}`;return o.jsx(Ae.Provider,{value:{makeInvisible:t},children:o.jsx(Ce.AnimatePresence,{children:r&&o.jsxs("aside",{className:a.trim(),...u,children:[o.jsx(Ce.motion.div,{className:"overlay",transition:{duration:.15,ease:"easeOut"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t}),o.jsx(Ce.motion.div,{className:"content",transition:{duration:.15,ease:"easeOut"},initial:{opacity:0,scale:.75},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},children:i})]})})})}function Bn(n){const{alignment:r="right",className:t,...i}=n,l=`arkyn_modal_footer ${r} ${t}`;return o.jsx("footer",{className:l.trim(),...i})}function An(n){const{showCloseButton:r,className:t,children:i,...l}=n,{makeInvisible:u}=j.useContext(Ae),a=`arkyn_modal_header ${r?"show-close":""} ${t}`;return o.jsxs("header",{className:a.trim(),...l,children:[i,o.jsx("button",{type:"button",onClick:u,children:o.jsx(H.X,{size:24})})]})}const Vn={Container:Wn,Header:An,Footer:Bn};function Mn(n){const{text:r,size:t="lg",children:i,orientation:l="top",className:u,...f}=n;return o.jsxs("div",{className:`arkyn_tooltip ${t} ${l} ${u}`,...f,children:[i,o.jsx("div",{className:"arkyn_tooltip_text",children:r})]})}function Yn(n=""){const r=ve.useLocation(),t=new URLSearchParams(r.search),i=n?`${n}:`:"",l=u=>{Object.entries(u).forEach(([f,a])=>{a===void 0?t.delete(`${i}${f}`):t.set(`${i}${f}`,String(a))})};return{getParam:u=>t.get(`${i}${u}`),getScopedSearch:u=>{l(u);let f=t.toString();return f&&(f="?"+f),f}}}I.Badge=an,I.Breadcrumb=zn,I.BreadcrumbLink=Dn,I.Button=fn,I.Checkbox=hn,I.Divider=cn,I.FormController=dn,I.FormError=mn,I.FormLabel=vn,I.IconButton=gn,I.Input=wn,I.Modal=Vn,I.Select=On,I.Skeleton=ln,I.Tooltip=Mn,I.useScopedParams=Yn,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK7C,OAAO,cAAc,CAAC;AAEtB,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,2CA0CrC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Check } from "lucide-react";
|
3
|
+
import { useState } from "react";
|
4
|
+
import { useFormController } from "../Form/FormController";
|
5
|
+
import "./styles.css";
|
6
|
+
function Checkbox(props) {
|
7
|
+
const { name, className: baseClassName = "", size = "md", isError: defaultIsError, defaultChecked = false, checked: baseChecked = null, onCheck, value, ...rest } = props;
|
8
|
+
const { id, inputRef, error } = useFormController();
|
9
|
+
const isError = defaultIsError || !!error;
|
10
|
+
const [isChecked, setIsChecked] = useState(defaultChecked || false);
|
11
|
+
const currentChecked = typeof baseChecked === "boolean" ? baseChecked : isChecked;
|
12
|
+
const className = `arkyn_checkbox ${size} ${isError ? "error" : ""} ${currentChecked ? "checked" : ""} ${baseClassName}`;
|
13
|
+
function handleCheck() {
|
14
|
+
const defaultChecked = isChecked;
|
15
|
+
setIsChecked(!defaultChecked);
|
16
|
+
onCheck && onCheck(!defaultChecked ? value || "checked" : "");
|
17
|
+
}
|
18
|
+
return (_jsxs("div", { className: className, onClick: handleCheck, ...rest, children: [_jsx("input", { type: "hidden", name: name, id: id, ref: inputRef, value: currentChecked ? value || "checked" : "" }), _jsx(Check, {})] }));
|
19
|
+
}
|
20
|
+
export { Checkbox };
|
@@ -286,7 +286,6 @@ declare function getConfig(props: CpfCnpjInputProps, isFocused: boolean): {
|
|
286
286
|
placeholder?: string;
|
287
287
|
required?: boolean;
|
288
288
|
src?: string;
|
289
|
-
defaultValue?: string;
|
290
289
|
value?: string;
|
291
290
|
isLoading: boolean;
|
292
291
|
className: string;
|
@@ -294,6 +293,7 @@ declare function getConfig(props: CpfCnpjInputProps, isFocused: boolean): {
|
|
294
293
|
sufix: import("react/jsx-runtime").JSX.Element;
|
295
294
|
LeftIcon: import("lucide-react").LucideIcon;
|
296
295
|
RightIcon: import("lucide-react").LucideIcon;
|
296
|
+
defaultValue: string;
|
297
297
|
disabled: boolean;
|
298
298
|
readOnly: boolean;
|
299
299
|
onFocus: import("react").FocusEventHandler<HTMLInputElement>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/CpfCpnjInput/getConfig.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/CpfCpnjInput/getConfig.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMtD,iBAAS,SAAS,CAAC,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkE9D;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
@@ -1,8 +1,18 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { Loader2 } from "lucide-react";
|
3
3
|
import { morpheme } from "../utils/morpheme";
|
4
|
+
import { MAX_LENGTH, TYPES, applyMask, clear, getMask } from "./utils";
|
4
5
|
function getConfig(props, isFocused) {
|
5
|
-
const { isLoading, isError, size = "md", className: baseClassName = "", variant = "solid", prefix: basePrefix, sufix: baseSufix, leftIcon: LeftIcon, rightIcon: RightIcon, disabled, readOnly, onFocus, onBlur, title, style, onChange, ...rest } = props;
|
6
|
+
const { isLoading, isError, size = "md", className: baseClassName = "", variant = "solid", prefix: basePrefix, sufix: baseSufix, leftIcon: LeftIcon, rightIcon: RightIcon, disabled, defaultValue, readOnly, onFocus, onBlur, title, style, onChange, ...rest } = props;
|
7
|
+
function parseDefault(event) {
|
8
|
+
let value = clear(event);
|
9
|
+
const mask = getMask(value);
|
10
|
+
let nextLength = value.length;
|
11
|
+
if (nextLength > MAX_LENGTH)
|
12
|
+
return;
|
13
|
+
value = applyMask(value, TYPES[mask]);
|
14
|
+
return value;
|
15
|
+
}
|
6
16
|
const loadingPosition = RightIcon ? "right" : "left";
|
7
17
|
const hasPrefix = !!basePrefix ? "hasPrefix" : "";
|
8
18
|
const hasSufix = !!baseSufix ? "hasSufix" : "";
|
@@ -19,6 +29,7 @@ function getConfig(props, isFocused) {
|
|
19
29
|
sufix: morpheme(baseSufix, iconSize, "sufix"),
|
20
30
|
LeftIcon,
|
21
31
|
RightIcon,
|
32
|
+
defaultValue: parseDefault(defaultValue || ""),
|
22
33
|
disabled,
|
23
34
|
readOnly,
|
24
35
|
onFocus,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/CpfCpnjInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAStD,iBAAS,YAAY,CAAC,KAAK,EAAE,iBAAiB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/CpfCpnjInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAStD,iBAAS,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAmG7C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
@@ -5,12 +5,12 @@ import { getConfig } from "./getConfig";
|
|
5
5
|
import { MAX_LENGTH, TYPES, applyMask, clear, getMask } from "./utils";
|
6
6
|
function CpfCnpjInput(props) {
|
7
7
|
const [isFocused, setIsFocused] = useState(false);
|
8
|
-
const [inputValue, setInputValue] = useState(clear(props?.defaultValue || ""));
|
9
8
|
const baseRef = useRef(null);
|
10
9
|
const { inputRef, id, error } = useFormController();
|
11
10
|
const ref = inputRef || baseRef;
|
12
11
|
const isError = props.isError || !!error;
|
13
|
-
const { disabled, title, style, className, prefix, sufix, iconSize, loadingPosition, isLoading, LeftIcon, readOnly, onFocus, onBlur, RightIcon, Spinner, onChange, value, defaultValue
|
12
|
+
const { disabled, title, style, className, prefix, sufix, iconSize, loadingPosition, isLoading, LeftIcon, readOnly, onFocus, onBlur, RightIcon, Spinner, onChange, value, defaultValue, ...rest } = getConfig({ ...props, id, isError }, isFocused);
|
13
|
+
const [inputValue, setInputValue] = useState(defaultValue);
|
14
14
|
const showLeftIcon = LeftIcon && !isLoading;
|
15
15
|
const showRightIcon = RightIcon && !isLoading;
|
16
16
|
const showLeftSpinner = loadingPosition === "left" && isLoading;
|
@@ -36,6 +36,6 @@ function CurrencyInput(props) {
|
|
36
36
|
if (onBlur)
|
37
37
|
onBlur(e);
|
38
38
|
}
|
39
|
-
return (_jsxs("section", { title: title, style: style, onClick: handleSectionClick, className: className, children: [prefix, showLeftSpinner && Spinner, showLeftIcon && _jsx(LeftIcon, { size: iconSize, strokeWidth: 2.5 }), _jsx("input", { value: valueDisplay(value || currencyValue, showCents), onKeyDown: handleKeyDown, disabled: disabled || isLoading, readOnly: readOnly, ref: ref, onFocus: handleFocus, onChange: () => { },
|
39
|
+
return (_jsxs("section", { title: title, style: style, onClick: handleSectionClick, className: className, children: [prefix, showLeftSpinner && Spinner, showLeftIcon && _jsx(LeftIcon, { size: iconSize, strokeWidth: 2.5 }), _jsx("input", { value: valueDisplay(value || currencyValue, showCents), onKeyDown: handleKeyDown, disabled: disabled || isLoading, readOnly: readOnly, ref: ref, onFocus: handleFocus, onBlur: handleBlur, onChange: () => { }, ...rest }), showRightSpinner && Spinner, showRightIcon && _jsx(RightIcon, { size: iconSize, strokeWidth: 2.5 }), sufix] }));
|
40
40
|
}
|
41
41
|
export { CurrencyInput };
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Loader2 } from "lucide-react";
|
3
3
|
import { morpheme } from "../utils/morpheme";
|
4
4
|
function getConfig(props, isFocused) {
|
5
|
-
const { isLoading, isError, size = "md", className: baseClassName = "", variant = "solid", prefix: basePrefix, sufix: baseSufix, leftIcon: LeftIcon, rightIcon: RightIcon, disabled, readOnly, onFocus, onBlur, title, style, onChange, showMask =
|
5
|
+
const { isLoading, isError, size = "md", className: baseClassName = "", variant = "solid", prefix: basePrefix, sufix: baseSufix, leftIcon: LeftIcon, rightIcon: RightIcon, disabled, readOnly, onFocus, onBlur, title, style, onChange, showMask = false, type, ...rest } = props;
|
6
6
|
const loadingPosition = RightIcon ? "right" : "left";
|
7
7
|
const hasPrefix = !!basePrefix ? "hasPrefix" : "";
|
8
8
|
const hasSufix = !!baseSufix ? "hasSufix" : "";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/MaskInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/MaskInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAgBrD,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CA2E3C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
@@ -1,62 +1,38 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { InputMask } from "@react-input/mask";
|
3
|
-
import {
|
3
|
+
import { forwardRef, useRef, useState } from "react";
|
4
|
+
import { useFormController } from "../../Form/FormController";
|
5
|
+
import { getConfig } from "./getConfig";
|
6
|
+
const BaseInput = forwardRef((props, ref) => {
|
7
|
+
return _jsx("input", { ref: ref, ...props });
|
8
|
+
});
|
4
9
|
function MaskedInput(props) {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
// function handleSectionClick() {
|
33
|
-
// if (disabled || !ref?.current) return;
|
34
|
-
// setIsFocused(true);
|
35
|
-
// ref.current.focus();
|
36
|
-
// }
|
37
|
-
// function handleFocus(e: FocusEvent<HTMLInputElement>) {
|
38
|
-
// setIsFocused(true);
|
39
|
-
// if (onFocus) onFocus(e);
|
40
|
-
// }
|
41
|
-
// function handleBlur(e: FocusEvent<HTMLInputElement>) {
|
42
|
-
// setIsFocused(false);
|
43
|
-
// if (onBlur) onBlur(e);
|
44
|
-
// }
|
45
|
-
return (
|
46
|
-
// <section
|
47
|
-
// title={title}
|
48
|
-
// style={style}
|
49
|
-
// onClick={handleSectionClick}
|
50
|
-
// className={className}
|
51
|
-
// >
|
52
|
-
// {prefix}
|
53
|
-
// {showLeftSpinner && Spinner}
|
54
|
-
// {showLeftIcon && <LeftIcon size={iconSize} strokeWidth={2.5} />}
|
55
|
-
_jsx(InputMask, { component: SimpleInput, ...props, type: "text" })
|
56
|
-
// {showRightIcon && <RightIcon size={iconSize} strokeWidth={2.5} />}
|
57
|
-
// {showRightSpinner && Spinner}
|
58
|
-
// {sufix}
|
59
|
-
// </section>
|
60
|
-
);
|
10
|
+
const [isFocused, setIsFocused] = useState(false);
|
11
|
+
const baseRef = useRef(null);
|
12
|
+
const { inputRef, id, error } = useFormController();
|
13
|
+
const ref = inputRef || baseRef;
|
14
|
+
const isError = props.isError || !!error;
|
15
|
+
const { disabled, title, style, className, prefix, sufix, iconSize, loadingPosition, isLoading, LeftIcon, readOnly, onFocus, onBlur, RightIcon, Spinner, ...rest } = getConfig({ ...props, id, isError }, isFocused);
|
16
|
+
const showLeftIcon = LeftIcon && !isLoading;
|
17
|
+
const showRightIcon = RightIcon && !isLoading;
|
18
|
+
const showLeftSpinner = loadingPosition === "left" && isLoading;
|
19
|
+
const showRightSpinner = loadingPosition === "right" && isLoading;
|
20
|
+
function handleSectionClick() {
|
21
|
+
if (disabled || !ref?.current)
|
22
|
+
return;
|
23
|
+
setIsFocused(true);
|
24
|
+
ref.current.focus();
|
25
|
+
}
|
26
|
+
function handleFocus(e) {
|
27
|
+
setIsFocused(true);
|
28
|
+
if (onFocus)
|
29
|
+
onFocus(e);
|
30
|
+
}
|
31
|
+
function handleBlur(e) {
|
32
|
+
setIsFocused(false);
|
33
|
+
if (onBlur)
|
34
|
+
onBlur(e);
|
35
|
+
}
|
36
|
+
return (_jsxs("section", { title: title, style: style, onClick: handleSectionClick, className: className, children: [prefix, showLeftSpinner && Spinner, showLeftIcon && _jsx(LeftIcon, { size: iconSize, strokeWidth: 2.5 }), _jsx(InputMask, { component: BaseInput, ref: ref, onFocus: handleFocus, onBlur: handleBlur, ...rest }), showRightIcon && _jsx(RightIcon, { size: iconSize, strokeWidth: 2.5 }), showRightSpinner && Spinner, sufix] }));
|
61
37
|
}
|
62
38
|
export { MaskedInput };
|