@arkyn/components 1.2.3 → 1.2.5
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 +1031 -760
- 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/CurrencyInput/index.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 +312 -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/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Skeleton/index.d.ts.map +1 -1
- package/dist/components/Skeleton/index.js +1 -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/CurrencyInput/index.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 +157 -0
- package/src/components/Select/styles.css +305 -0
- package/src/components/Select/utils/morpheme.tsx +19 -0
- package/src/components/Skeleton/index.tsx +1 -0
- package/src/index.ts +2 -0
package/dist/bundle.umd.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
(function(
|
1
|
+
(function(w,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):(w=typeof globalThis<"u"?globalThis:w||self,j(w["@arkyn/components"]={},w.require$$0,w.lucideReact,w.react,w.mask,w.framerMotion))})(this,function(w,j,Z,ve,qe,Se){"use strict";var Ce={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 Fe;function er(){if(Fe)return fe;Fe=1;var r=j,n=Symbol.for("react.element"),t=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function f(c,d,h){var v,g={},b=null,_=null;h!==void 0&&(b=""+h),d.key!==void 0&&(b=""+d.key),d.ref!==void 0&&(_=d.ref);for(v in d)i.call(d,v)&&!u.hasOwnProperty(v)&&(g[v]=d[v]);if(c&&c.defaultProps)for(v in d=c.defaultProps,d)g[v]===void 0&&(g[v]=d[v]);return{$$typeof:n,type:c,key:b,ref:_,props:g,_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 Te;function
|
18
|
-
`+
|
19
|
-
`),
|
20
|
-
`)
|
21
|
-
`+
|
17
|
+
*/var Te;function rr(){return Te||(Te=1,process.env.NODE_ENV!=="production"&&function(){var r=j,n=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"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),R=Symbol.iterator,N="@@iterator";function P(e){if(e===null||typeof e!="object")return null;var s=R&&e[R]||e[N];return typeof s=="function"?s:null}var x=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(e){{for(var s=arguments.length,a=new Array(s>1?s-1:0),m=1;m<s;m++)a[m-1]=arguments[m];E("error",e,a)}}function E(e,s,a){{var m=x.ReactDebugCurrentFrame,k=m.getStackAddendum();k!==""&&(s+="%s",a=a.concat([k]));var I=a.map(function(S){return String(S)});I.unshift("Warning: "+s),Function.prototype.apply.call(console[e],console,I)}}var T=!1,L=!1,z=!1,O=!1,D=!1,W;W=Symbol.for("react.module.reference");function V(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===u||D||e===l||e===h||e===v||O||e===_||T||L||z||typeof e=="object"&&e!==null&&(e.$$typeof===b||e.$$typeof===g||e.$$typeof===f||e.$$typeof===c||e.$$typeof===d||e.$$typeof===W||e.getModuleId!==void 0))}function F(e,s,a){var m=e.displayName;if(m)return m;var k=s.displayName||s.name||"";return k!==""?a+"("+k+")":a}function K(e){return e.displayName||"Context"}function C(e){if(e==null)return null;if(typeof e.tag=="number"&&p("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 v:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case c:var s=e;return K(s)+".Consumer";case f:var a=e;return K(a._context)+".Provider";case d:return F(e,e.render,"ForwardRef");case g:var m=e.displayName||null;return m!==null?m:C(e.type)||"Memo";case b:{var k=e,I=k._payload,S=k._init;try{return C(S(I))}catch{return null}}}return null}var A=Object.assign,M=0,Y,oe,ie,ae,re,J,G;function X(){}X.__reactDisabledLog=!0;function Q(){{if(M===0){Y=console.log,oe=console.info,ie=console.warn,ae=console.error,re=console.group,J=console.groupCollapsed,G=console.groupEnd;var e={configurable:!0,enumerable:!0,value:X,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}}function q(){{if(M--,M===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},e,{value:Y}),info:A({},e,{value:oe}),warn:A({},e,{value:ie}),error:A({},e,{value:ae}),group:A({},e,{value:re}),groupCollapsed:A({},e,{value:J}),groupEnd:A({},e,{value:G})})}M<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ne=x.ReactCurrentDispatcher,_e;function ge(e,s,a){{if(_e===void 0)try{throw Error()}catch(k){var m=k.stack.trim().match(/\n( *(at )?)/);_e=m&&m[1]||""}return`
|
18
|
+
`+_e+e}}var je=!1,xe;{var Mr=typeof WeakMap=="function"?WeakMap:Map;xe=new Mr}function We(e,s){if(!e||je)return"";{var a=xe.get(e);if(a!==void 0)return a}var m;je=!0;var k=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var I;I=ne.current,ne.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(H){m=H}Reflect.construct(e,[],S)}else{try{S.call()}catch(H){m=H}e.call(S.prototype)}}else{try{throw Error()}catch(H){m=H}e()}}catch(H){if(H&&m&&typeof H.stack=="string"){for(var y=H.stack.split(`
|
19
|
+
`),U=m.stack.split(`
|
20
|
+
`),$=y.length-1,B=U.length-1;$>=1&&B>=0&&y[$]!==U[B];)B--;for(;$>=1&&B>=0;$--,B--)if(y[$]!==U[B]){if($!==1||B!==1)do if($--,B--,B<0||y[$]!==U[B]){var ee=`
|
21
|
+
`+y[$].replace(" at new "," at ");return e.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",e.displayName)),typeof e=="function"&&xe.set(e,ee),ee}while($>=1&&B>=0);break}}}finally{je=!1,ne.current=I,q(),Error.prepareStackTrace=k}var ue=e?e.displayName||e.name:"",ce=ue?ge(ue):"";return typeof e=="function"&&xe.set(e,ce),ce}function Ur(e,s,a){return We(e,!1)}function Kr(e){var s=e.prototype;return!!(s&&s.isReactComponent)}function ye(e,s,a){if(e==null)return"";if(typeof e=="function")return We(e,Kr(e));if(typeof e=="string")return ge(e);switch(e){case h:return ge("Suspense");case v:return ge("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Ur(e.render);case g:return ye(e.type,s,a);case b:{var m=e,k=m._payload,I=m._init;try{return ye(I(k),s,a)}catch{}}}return""}var he=Object.prototype.hasOwnProperty,Be={},Ae=x.ReactDebugCurrentFrame;function be(e){if(e){var s=e._owner,a=ye(e.type,e._source,s?s.type:null);Ae.setExtraStackFrame(a)}else Ae.setExtraStackFrame(null)}function Jr(e,s,a,m,k){{var I=Function.call.bind(he);for(var S in e)if(I(e,S)){var y=void 0;try{if(typeof e[S]!="function"){var U=Error((m||"React class")+": "+a+" 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 U.name="Invariant Violation",U}y=e[S](s,S,m,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch($){y=$}y&&!(y instanceof Error)&&(be(k),p("%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",a,S,typeof y),be(null)),y instanceof Error&&!(y.message in Be)&&(Be[y.message]=!0,be(k),p("Failed %s type: %s",a,y.message),be(null))}}}var Gr=Array.isArray;function Ee(e){return Gr(e)}function Xr(e){{var s=typeof Symbol=="function"&&Symbol.toStringTag,a=s&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function Hr(e){try{return Ve(e),!1}catch{return!0}}function Ve(e){return""+e}function Ye(e){if(Hr(e))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xr(e)),Ve(e)}var me=x.ReactCurrentOwner,Zr={key:!0,ref:!0,__self:!0,__source:!0},Me,Ue,Re;Re={};function Qr(e){if(he.call(e,"ref")){var s=Object.getOwnPropertyDescriptor(e,"ref").get;if(s&&s.isReactWarning)return!1}return e.ref!==void 0}function qr(e){if(he.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function en(e,s){if(typeof e.ref=="string"&&me.current&&s&&me.current.stateNode!==s){var a=C(me.current.type);Re[a]||(p('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',C(me.current.type),e.ref),Re[a]=!0)}}function rn(e,s){{var a=function(){Me||(Me=!0,p("%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))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function nn(e,s){{var a=function(){Ue||(Ue=!0,p("%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))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var tn=function(e,s,a,m,k,I,S){var y={$$typeof:n,type:e,key:s,ref:a,props:S,_owner:I};return y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(y,"_self",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.defineProperty(y,"_source",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y};function sn(e,s,a,m,k){{var I,S={},y=null,U=null;a!==void 0&&(Ye(a),y=""+a),qr(s)&&(Ye(s.key),y=""+s.key),Qr(s)&&(U=s.ref,en(s,k));for(I in s)he.call(s,I)&&!Zr.hasOwnProperty(I)&&(S[I]=s[I]);if(e&&e.defaultProps){var $=e.defaultProps;for(I in $)S[I]===void 0&&(S[I]=$[I])}if(y||U){var B=typeof e=="function"?e.displayName||e.name||"Unknown":e;y&&rn(S,B),U&&nn(S,B)}return tn(e,y,U,k,m,me.current,S)}}var Ne=x.ReactCurrentOwner,Ke=x.ReactDebugCurrentFrame;function le(e){if(e){var s=e._owner,a=ye(e.type,e._source,s?s.type:null);Ke.setExtraStackFrame(a)}else Ke.setExtraStackFrame(null)}var Pe;Pe=!1;function Ie(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function Je(){{if(Ne.current){var e=C(Ne.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 on(e){{if(e!==void 0){var s=e.fileName.replace(/^.*[\\\/]/,""),a=e.lineNumber;return`
|
24
24
|
|
25
|
-
Check your code at `+
|
25
|
+
Check your code at `+s+":"+a+"."}return""}}var Ge={};function an(e){{var s=Je();if(!s){var a=typeof e=="string"?e:e.displayName||e.name;a&&(s=`
|
26
26
|
|
27
|
-
Check the top-level render call using <`+a+">.")}return
|
27
|
+
Check the top-level render call using <`+a+">.")}return s}}function Xe(e,s){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=an(s);if(Ge[a])return;Ge[a]=!0;var m="";e&&e._owner&&e._owner!==Ne.current&&(m=" It was passed a child from "+C(e._owner.type)+"."),le(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,m),le(null)}}function He(e,s){{if(typeof e!="object")return;if(Ee(e))for(var a=0;a<e.length;a++){var m=e[a];Ie(m)&&Xe(m,s)}else if(Ie(e))e._store&&(e._store.validated=!0);else if(e){var k=P(e);if(typeof k=="function"&&k!==e.entries)for(var I=k.call(e),S;!(S=I.next()).done;)Ie(S.value)&&Xe(S.value,s)}}}function cn(e){{var s=e.type;if(s==null||typeof s=="string")return;var a;if(typeof s=="function")a=s.propTypes;else if(typeof s=="object"&&(s.$$typeof===d||s.$$typeof===g))a=s.propTypes;else return;if(a){var m=C(s);Jr(a,e.props,"prop",m,e)}else if(s.PropTypes!==void 0&&!Pe){Pe=!0;var k=C(s);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k||"Unknown")}typeof s.getDefaultProps=="function"&&!s.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ln(e){{for(var s=Object.keys(e.props),a=0;a<s.length;a++){var m=s[a];if(m!=="children"&&m!=="key"){le(e),p("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),p("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}}var Ze={};function Qe(e,s,a,m,k,I){{var S=V(e);if(!S){var y="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(y+=" 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 U=on(k);U?y+=U:y+=Je();var $;e===null?$="null":Ee(e)?$="array":e!==void 0&&e.$$typeof===n?($="<"+(C(e.type)||"Unknown")+" />",y=" Did you accidentally export a JSX literal instead of a component?"):$=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",$,y)}var B=sn(e,s,a,k,I);if(B==null)return B;if(S){var ee=s.children;if(ee!==void 0)if(m)if(Ee(ee)){for(var ue=0;ue<ee.length;ue++)He(ee[ue],e);Object.freeze&&Object.freeze(ee)}else p("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 He(ee,e)}if(he.call(s,"key")){var ce=C(e),H=Object.keys(s).filter(function(vn){return vn!=="key"}),we=H.length>0?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}";if(!Ze[ce+we]){var mn=H.length>0?"{"+H.join(": ..., ")+": ...}":"{}";p(`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} />`,we,ce,mn,ce),Ze[ce+we]=!0}}return e===i?ln(B):cn(B),B}}function un(e,s,a){return Qe(e,s,a,!0)}function fn(e,s,a){return Qe(e,s,a,!1)}var dn=fn,hn=un;de.Fragment=i,de.jsx=dn,de.jsxs=hn}()),de}process.env.NODE_ENV==="production"?Ce.exports=er():Ce.exports=rr();var o=Ce.exports;function pe(r,n){return n?o.jsx(n,{size:r,strokeWidth:2.5}):o.jsx(o.Fragment,{})}function nr(r){const{variant:n="ghost",scheme:t="primary",size:i="md",leftIcon:l,rightIcon:u,className:f="",children:c,...d}=r,v={md:12,lg:14}[i];return{className:`arkyn_badge ${n} ${t} ${i} ${f}`.trim(),children:c,leftIcon:pe(v,l),rightIcon:pe(v,u),...d}}function tr(r){const{leftIcon:n,children:t,rightIcon:i,...l}=nr(r);return o.jsxs("div",{...l,children:[n,t,i]})}function sr(r){const{className:n,orientation:t="horizontal",...i}=r,l=`arkyn_divider ${t} ${n}`;return o.jsx("div",{className:l,...i})}function or({className:r,...n}){const t="arkyn_skeleton "+r;return o.jsx("div",{className:t.trim(),...n})}function ir(r){const{isLoading:n=!1,scheme:t="primary",variant:i="solid",loadingText:l,size:u="md",leftIcon:f,rightIcon:c,disabled:d,className:h="",children:v,...g}=r,_={xs:12,sm:16,md:20,lg:24}[u];return{className:`arkyn_button loading_text_${!!l} ${i} ${t} ${u} loading_${n} ${h}`.trim(),loadingText:l,children:v,iconSize:_,disabled:d||n,leftIcon:pe(_,f),rightIcon:pe(_,c),...g}}function ar(r){const{leftIcon:n,rightIcon:t,iconSize:i,children:l,loadingText:u,...f}=ir(r);return o.jsxs("button",{...f,children:[o.jsxs("div",{className:"spinner",children:[o.jsx(Z.Loader2,{size:i,strokeWidth:2.5}),u&&u]}),o.jsxs("div",{className:"content",children:[n,l,t]})]})}const Oe=j.createContext({});function cr({children:r,...n}){var c,d;const t=ve.useActionData(),i=j.useRef(null),l=((c=i.current)==null?void 0:c.name)||"",u=((d=t==null?void 0:t.fieldErrors)==null?void 0:d[l])||null,f=j.useId();return o.jsx(Oe.Provider,{value:{error:u,id:f,inputRef:i},children:o.jsx("section",{className:"arkyn_form_controller",...n,children:r})})}function te(){return j.useContext(Oe)}function lr(r){const{name:n,className:t="",size:i="md",isError:l,defaultChecked:u=!1,checked:f=null,onCheck:c,value:d,...h}=r,{id:v,inputRef:g,error:b}=te(),_=l||!!b,[R,N]=j.useState(u||!1),P=typeof f=="boolean"?f:R,x=`arkyn_checkbox ${i} ${_?"error":""} ${P?"checked":""} ${t}`;function p(){const E=R;N(!E),c&&c(E?"":d||"checked")}return o.jsxs("div",{className:x,onClick:p,...h,children:[o.jsx("input",{type:"hidden",name:n,id:v,ref:g,value:P?d||"checked":""}),o.jsx(Z.Check,{})]})}function ur({children:r}){const{error:n}=te();return r?o.jsx("strong",{className:"arkyn_form_error",children:r}):n?o.jsx("strong",{className:"arkyn_form_error",children:n}):o.jsx(o.Fragment,{})}function fr(r){const{showAsterisk:n=!1,className:t="",...i}=r;return{className:`arkyn_form_label ${n?"show-asterisk":""} ${t}`.trim(),...i}}function dr(r){const{id:n}=te();return o.jsx("label",{...fr(r),htmlFor:n})}const Le={xs:12,sm:16,md:20,lg:24};function hr(r){const{isLoading:n=!1,scheme:t="primary",variant:i="solid",size:l="md",icon:u,disabled:f,className:c="",...d}=r,h=`arkyn_icon_button ${i} ${t} ${l} loading_${n} ${c}`;return o.jsxs("button",{disabled:f||n,className:h.trim(),...d,children:[o.jsx("div",{className:"spinner",children:o.jsx(Z.Loader2,{size:Le[l],strokeWidth:2.5})}),o.jsx("div",{className:"content "+l,children:o.jsx(u,{size:Le[l],strokeWidth:2.5})})]})}function se(r,n,t){if(!r)return o.jsx(o.Fragment,{});if(typeof r=="string")return o.jsx("p",{className:t,children:r});const i=r;return o.jsx("p",{className:t,children:o.jsx(i,{color:"var(--secondary-600)",size:n,strokeWidth:2.5})})}function mr(r,n){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:c,sufix:d,leftIcon:h,rightIcon:v,disabled:g,readOnly:b,onFocus:_,onBlur:R,title:N,style:P,onChange:x,...p}=r,E=v?"right":"left",W=`arkyn_input ${c?"hasPrefix":""} ${d?"hasSufix":""} ${f} ${l} ${g||b||t?"opacity":""} ${i?"errored":""} ${n?"focused":""} ${u}`,F={md:20,lg:20}[l];return{isLoading:t,className:W,prefix:se(c,F,"prefix"),sufix:se(d,F,"sufix"),LeftIcon:h,RightIcon:v,disabled:g,readOnly:b,onFocus:_,onBlur:R,title:N,style:P,onChange:x,loadingPosition:E,iconSize:F,Spinner:o.jsx(Z.Loader2,{className:"spinner",size:F,strokeWidth:2.5}),...p}}function ke(r){return r&&r.replace(/[^0-9]/g,"")}function vr(r,n){let t="",i=0;return Array.from(r).forEach((l,u)=>{n[u+i].match(/[0-9]/)||(t+=n[u+i],i++),t+=l}),t}function pr(r){return r.length>11?"CNPJ":"CPF"}const $e={CPF:"999.999.999-999",CNPJ:"99.999.999/9999-99"},gr=ke($e.CNPJ).length;function xr(r){const[n,t]=j.useState(!1),[i,l]=j.useState(ke((r==null?void 0:r.defaultValue)||"")),u=j.useRef(null),{inputRef:f,id:c,error:d}=te(),h=f||u,v=r.isError||!!d,{disabled:g,title:b,style:_,className:R,prefix:N,sufix:P,iconSize:x,loadingPosition:p,isLoading:E,LeftIcon:T,readOnly:L,onFocus:z,onBlur:O,RightIcon:D,Spinner:W,onChange:V,value:F,defaultValue:K="",...C}=mr({...r,id:c,isError:v},n),A=T&&!E,M=D&&!E,Y=p==="left"&&E,oe=p==="right"&&E;function ie(){g||!(h!=null&&h.current)||(t(!0),h.current.focus())}function ae(G){let X=ke(G.target.value);const Q=pr(X);X.length>gr||(X=vr(X,$e[Q]),G.target.value=X,l(X),V&&V(G))}function re(G){t(!0),z&&z(G)}function J(G){t(!1),O&&O(G)}return o.jsxs("section",{title:b,style:_,onClick:ie,className:R,children:[N,Y&&W,A&&o.jsx(T,{size:x,strokeWidth:2.5}),o.jsx("input",{disabled:g||E,readOnly:L,ref:h,value:F||i,onFocus:re,onChange:ae,onBlur:J,...C}),M&&o.jsx(D,{size:x,strokeWidth:2.5}),oe&&W,P]})}function yr(r,n){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:c,sufix:d,leftIcon:h,rightIcon:v,disabled:g,readOnly:b,onFocus:_,onBlur:R,title:N,style:P,showCents:x=!1,max:p=1e9,onChange:E,...T}=r,L=v?"right":"left",F=`arkyn_input ${c?"hasPrefix":""} ${d?"hasSufix":""} ${f} ${l} ${g||b||t?"opacity":""} ${i?"errored":""} ${n?"focused":""} ${u}`,C={md:20,lg:20}[l];return{isLoading:t,className:F,prefix:se(c,C,"prefix"),sufix:se(d,C,"sufix"),LeftIcon:h,RightIcon:v,disabled:g,readOnly:b,onFocus:_,onBlur:R,title:N,style:P,max:p,onChange:E,showCents:x,loadingPosition:L,iconSize:C,Spinner:o.jsx(Z.Loader2,{className:"spinner",size:C,strokeWidth:2.5}),...T}}const br=/^[1-9]{1}$/,Sr=/^[0-9]{1}$/,ze=8;function Cr(r,n){if(r===0)return"";const t=(r/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"});return n?t:t.replace("R$","").trim()}function kr(r){const{currencyValue:n,event:t,max:i,setCurrencyValue:l}=r,{key:u,keyCode:f}=t;if(n===0&&!br.test(u)||n!==0&&!Sr.test(u)&&f!==ze)return;const c=n.toString();let d;if(f!==ze){const h=n===0?u:`${c}${u}`;d=Number.parseInt(h,10)}else{const h=c.slice(0,-1);d=h===""?0:Number.parseInt(h,10)}d>Number(i)||l(d)}function _r(r){const[n,t]=j.useState(!1),[i,l]=j.useState(r.defaultValue||0),u=j.useRef(null),{inputRef:f,id:c,error:d}=te(),h=f||u,v=r.isError||!!d,{disabled:g,title:b,style:_,className:R,prefix:N,sufix:P,iconSize:x,loadingPosition:p,isLoading:E,LeftIcon:T,readOnly:L,onFocus:z,onBlur:O,RightIcon:D,Spinner:W,value:V,max:F,onKeyDown:K,onChange:C,showCents:A,...M}=yr({...r,id:c,isError:v},n),Y=T&&!E,oe=D&&!E,ie=p==="left"&&E,ae=p==="right"&&E;function re(){g||!(h!=null&&h.current)||(t(!0),h.current.focus())}function J(Q){kr({currencyValue:i,event:Q,max:F,setCurrencyValue:l}),C&&C(i),K&&K(Q)}function G(Q){t(!0),z&&z(Q)}function X(Q){t(!1),O&&O(Q)}return o.jsxs("section",{title:b,style:_,onClick:re,className:R,children:[N,ie&&W,Y&&o.jsx(T,{size:x,strokeWidth:2.5}),o.jsx("input",{value:Cr(V||i,A),onKeyDown:J,disabled:g||E,readOnly:L,ref:h,onFocus:G,onBlur:X,onChange:()=>{},...M}),ae&&W,oe&&o.jsx(D,{size:x,strokeWidth:2.5}),P]})}function jr(r,n){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:c,sufix:d,leftIcon:h,rightIcon:v,disabled:g,readOnly:b,onFocus:_,onBlur:R,title:N,style:P,onChange:x,showMask:p=!0,type:E,...T}=r,L=v?"right":"left",F=`arkyn_input ${c?"hasPrefix":""} ${d?"hasSufix":""} ${f} ${l} ${g||b||t?"opacity":""} ${i?"errored":""} ${n?"focused":""} ${u}`,C={md:20,lg:20}[l];return{isLoading:t,className:F,prefix:se(c,C,"prefix"),sufix:se(d,C,"sufix"),LeftIcon:h,RightIcon:v,disabled:g,readOnly:b,onFocus:_,onBlur:R,title:N,style:P,onChange:x,loadingPosition:L,iconSize:C,showMask:p,Spinner:o.jsx(Z.Loader2,{className:"spinner",size:C,strokeWidth:2.5}),...T}}const Er=j.forwardRef((r,n)=>o.jsx("input",{ref:n,...r}));function Rr(r){const[n,t]=j.useState(!1),i=j.useRef(null),{inputRef:l,id:u,error:f}=te(),c=l||i,d=r.isError||!!f,{disabled:h,title:v,style:g,className:b,prefix:_,sufix:R,iconSize:N,loadingPosition:P,isLoading:x,LeftIcon:p,readOnly:E,onFocus:T,onBlur:L,RightIcon:z,Spinner:O,...D}=jr({...r,id:u,isError:d},n),W=p&&!x,V=z&&!x,F=P==="left"&&x,K=P==="right"&&x;function C(){h||!(c!=null&&c.current)||(t(!0),c.current.focus())}function A(Y){t(!0),T&&T(Y)}function M(Y){t(!1),L&&L(Y)}return o.jsxs("section",{title:v,style:g,onClick:C,className:b,children:[_,F&&O,W&&o.jsx(p,{size:N,strokeWidth:2.5}),o.jsx(qe.InputMask,{component:Er,ref:c,onFocus:A,onBlur:M,...D}),V&&o.jsx(z,{size:N,strokeWidth:2.5}),K&&O,R]})}function Nr(r,n){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:c,sufix:d,leftIcon:h,rightIcon:v,disabled:g,readOnly:b,onFocus:_,onBlur:R,title:N,style:P,onChange:x,...p}=r,E=v?"right":"left",W=`arkyn_input ${c?"hasPrefix":""} ${d?"hasSufix":""} ${f} ${l} ${g||b||t?"opacity":""} ${i?"errored":""} ${n?"focused":""} ${u}`,F={md:20,lg:20}[l];return{isLoading:t,className:W,prefix:se(c,F,"prefix"),sufix:se(d,F,"sufix"),LeftIcon:h,RightIcon:v,disabled:g,readOnly:b,onFocus:_,onBlur:R,title:N,style:P,onChange:x,loadingPosition:E,iconSize:F,Spinner:o.jsx(Z.Loader2,{className:"spinner",size:F,strokeWidth:2.5}),...p}}function Pr(r){const[n,t]=j.useState(!1),i=j.useRef(null),{inputRef:l,id:u,error:f}=te(),c=l||i,d=r.isError||!!f,{disabled:h,title:v,style:g,className:b,prefix:_,sufix:R,iconSize:N,loadingPosition:P,isLoading:x,LeftIcon:p,readOnly:E,onFocus:T,onBlur:L,RightIcon:z,Spinner:O,...D}=Nr({...r,id:u,isError:d},n),W=p&&!x,V=z&&!x,F=P==="left"&&x,K=P==="right"&&x;function C(){h||!(c!=null&&c.current)||(t(!0),c.current.focus())}function A(Y){t(!0),T&&T(Y)}function M(Y){t(!1),L&&L(Y)}return o.jsxs("section",{title:v,style:g,onClick:C,className:b,children:[_,F&&O,W&&o.jsx(p,{size:N,strokeWidth:2.5}),o.jsx("input",{disabled:h||x,readOnly:E,ref:c,onFocus:A,onBlur:M,...D}),V&&o.jsx(z,{size:N,strokeWidth:2.5}),K&&O,R]})}function Ir(r){return r.type==="currency"?o.jsx(_r,{...r}):r.type==="masked"?o.jsx(Rr,{...r}):r.type==="cpf-cpnj"?o.jsx(xr,{...r}):o.jsx(Pr,{...r})}function wr(r,n,t){if(!r)return o.jsx(o.Fragment,{});if(typeof r=="string")return o.jsx("p",{className:t,children:r});const i=r;return o.jsx("p",{className:t,children:o.jsx(i,{color:"var(--secondary-600)",size:n,strokeWidth:2.5})})}function Fr(r,n){const{isLoading:t,isError:i,size:l="md",className:u="",variant:f="solid",prefix:c,leftIcon:d,disabled:h,readOnly:v,onFocus:g,onBlur:b,title:_,style:R,isSearchable:N=!1,...P}=r,L=`arkyn_select ${c?"hasPrefix":""} ${f} ${l} ${h||v||t?"opacity":""} ${i?"errored":""} ${n?"focused":""} ${u}`,O={md:20,lg:20}[l];return{isLoading:t,className:L,prefix:wr(c,O,"prefix"),LeftIcon:d,disabled:h,readOnly:v,onFocus:g,onBlur:b,title:_,style:R,isSearchable:N,iconSize:O,Spinner:o.jsx(Z.Loader2,{className:"spinner",size:O,strokeWidth:2.5}),...P}}function Tr(r){var Q;const[n,t]=j.useState(!1),{inputRef:i,id:l,error:u}=te(),f=j.useRef(null),c=i||f,d=r.isError||!!u,{disabled:h,title:v,style:g,className:b,prefix:_,iconSize:R,isLoading:N,LeftIcon:P,value:x=null,defaultValue:p="",readOnly:E,onFocus:T,onBlur:L,Spinner:z,name:O,isSearchable:D,placeholder:W,onSelect:V,options:F,...K}=Fr({...r,id:l,isError:d},n),[C,A]=j.useState(p),[M,Y]=j.useState("");function oe(){h||!(c!=null&&c.current)||(t(!0),c.current.focus())}function ie(q){t(!0),T&&T(q)}function ae(){t(!1),L&&c.current&&c.current.blur()}const re=typeof x=="string"?x:C,J=((Q=F.find(q=>q.value===re))==null?void 0:Q.label)||"",G=()=>{if(D){if(!n&&J)return!0;if(!n&&!J||n)return!1}if(!D){if(!n&&J)return!0;if(!n&&!J)return!1;if(n&&J)return!0;if(n&&!J)return!1}},X=F.filter(q=>D?q.label.toLowerCase().includes(M.toLowerCase()):!0);return o.jsxs(o.Fragment,{children:[o.jsxs("section",{title:v,style:g,onClick:oe,className:`${b} placeholder_dark_${G()}`,children:[_,P&&o.jsx(P,{size:R,strokeWidth:2.5}),o.jsx("input",{disabled:h||N,readOnly:!D,value:M||"",placeholder:J||W,ref:c,onFocus:ie,onBlur:()=>Y(""),...K,onChange:q=>Y(q.target.value)}),o.jsx("input",{type:"hidden",name:O,value:re||"",readOnly:!0}),n&&o.jsxs("ul",{className:"arkyn_select_content",children:[X.map(({label:q,value:ne})=>o.jsxs("li",{className:re===ne?"active":"",onClick:()=>{A(C!==ne?ne:""),V&&V({label:q,value:ne})},children:[q," ",o.jsx(Z.Check,{})]},ne)),X.length<=0&&o.jsx("p",{children:"Sem opções disponíveis"})]}),!N&&o.jsx(Z.ChevronDown,{className:"arkyn_select_arrow",size:R,strokeWidth:2.5}),N&&z]}),n&&o.jsx("aside",{className:"arkyn_select_overlay",onClick:ae})]})}function Or(r){const{className:n="",...t}=r;return{className:`arkyn_breadcrumb ${n}`.trim(),...t}}function Lr(r){const{pathname:n}=ve.useLocation(),{className:t="",disabled:i=!1,to:l,...u}=r,f=n===l?"active":"inactive",c=`arkyn_breadcrumb_link ${f} ${t}`;return{to:l,className:c.trim(),disabled:i||f==="active",...u}}function $r(r){const{className:n,...t}=Or(r);return o.jsx("nav",{className:n,...t})}function zr(r){const{children:n,className:t,disabled:i,...l}=Lr(r);return i?o.jsxs("p",{className:t,children:[o.jsx(Z.ChevronRight,{size:14,strokeWidth:2.5}),n]}):o.jsxs(ve.Link,{className:t,...l,children:[o.jsx(Z.ChevronRight,{size:14,strokeWidth:2.5}),n]})}const De=j.createContext({});function Dr(r){const{isVisibled:n,makeInvisible:t,children:i,className:l="",...u}=r,c=`arkyn_modal_container ${n?"visible":""} ${l}`;return o.jsx(De.Provider,{value:{makeInvisible:t},children:o.jsx(Se.AnimatePresence,{children:n&&o.jsxs("aside",{className:c.trim(),...u,children:[o.jsx(Se.motion.div,{className:"overlay",transition:{duration:.15,ease:"easeOut"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t}),o.jsx(Se.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 Wr(r){const{alignment:n="right",className:t,...i}=r,l=`arkyn_modal_footer ${n} ${t}`;return o.jsx("footer",{className:l.trim(),...i})}function Br(r){const{showCloseButton:n,className:t,children:i,...l}=r,{makeInvisible:u}=j.useContext(De),c=`arkyn_modal_header ${n?"show-close":""} ${t}`;return o.jsxs("header",{className:c.trim(),...l,children:[i,o.jsx("button",{type:"button",onClick:u,children:o.jsx(Z.X,{size:24})})]})}const Ar={Container:Dr,Header:Br,Footer:Wr};function Vr(r){const{text:n,size:t="lg",children:i,orientation:l="top",className:u,...f}=r;return o.jsxs("div",{className:`arkyn_tooltip ${t} ${l} ${u}`,...f,children:[i,o.jsx("div",{className:"arkyn_tooltip_text",children:n})]})}function Yr(r=""){const n=ve.useLocation(),t=new URLSearchParams(n.search),i=r?`${r}:`:"",l=u=>{Object.entries(u).forEach(([f,c])=>{c===void 0?t.delete(`${i}${f}`):t.set(`${i}${f}`,String(c))})};return{getParam:u=>t.get(`${i}${u}`),getScopedSearch:u=>{l(u);let f=t.toString();return f&&(f="?"+f),f}}}w.Badge=tr,w.Breadcrumb=$r,w.BreadcrumbLink=zr,w.Button=ar,w.Checkbox=lr,w.Divider=sr,w.FormController=cr,w.FormError=ur,w.FormLabel=dr,w.IconButton=hr,w.Input=Ir,w.Modal=Ar,w.Select=Tr,w.Skeleton=or,w.Tooltip=Vr,w.useScopedParams=Yr,Object.defineProperty(w,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 };
|
@@ -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 };
|
@@ -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 };
|