naria-ui 0.1.52 → 0.1.53

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.
@@ -4,11 +4,12 @@ export interface props {
4
4
  classNames?: {
5
5
  wrapper?: string;
6
6
  label?: string;
7
+ title?: string;
7
8
  input?: string;
8
9
  errorText?: string;
9
10
  };
10
11
  placeholder: string;
11
- label: string;
12
+ title: string;
12
13
  hasError?: string | null;
13
14
  register?: any;
14
15
  name?: string;
@@ -29,6 +29,7 @@ export interface props {
29
29
  option?: string;
30
30
  optionActive?: string;
31
31
  mobileHeader?: string;
32
+ errorText?: string;
32
33
  };
33
34
  onSelectChange?: any;
34
35
  }
@@ -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 ee;function ie(){if(ee)return H;ee=1;var t=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function o(d,s,u){var p=null;if(u!==void 0&&(p=""+u),s.key!==void 0&&(p=""+s.key),"key"in s){u={};for(var h in s)h!=="key"&&(u[h]=s[h])}else u=s;return s=u.ref,{$$typeof:t,type:d,key:p,ref:s!==void 0?s:null,props:u}}return H.Fragment=i,H.jsx=o,H.jsxs=o,H}var U={};/**
9
+ */var ee;function ie(){if(ee)return H;ee=1;var t=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function o(d,s,u){var g=null;if(u!==void 0&&(g=""+u),s.key!==void 0&&(g=""+s.key),"key"in s){u={};for(var h in s)h!=="key"&&(u[h]=s[h])}else u=s;return s=u.ref,{$$typeof:t,type:d,key:g,ref:s!==void 0?s:null,props:u}}return H.Fragment=i,H.jsx=o,H.jsxs=o,H}var U={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,13 +14,13 @@
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 re;function ce(){return re||(re=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===T?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case R:return"Profiler";case B:return"StrictMode";case f:return"Suspense";case M:return"SuspenseList";case q:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case W:return"Portal";case G:return(e.displayName||"Context")+".Provider";case O:return(e._context.displayName||"Context")+".Consumer";case z:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case _:return n=e.displayName||null,n!==null?n:t(e.type)||"Memo";case C:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function i(e){return""+e}function o(e){try{i(e);var n=!1}catch{n=!0}if(n){n=console;var c=n.error,r=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",r),i(e)}}function d(e){if(e===k)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var n=t(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function s(){var e=v.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function p(e){if(Y.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function h(e,n){function c(){L||(L=!0,console.error("%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://react.dev/link/special-props)",n))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function E(){var e=t(this.type);return D[e]||(D[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function x(e,n,c,r,b,w,X,Z){return c=w.ref,e={$$typeof:I,type:e,key:n,props:w,_owner:b},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:E}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Z}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function N(e,n,c,r,b,w,X,Z){var m=n.children;if(m!==void 0)if(r)if(j(m)){for(r=0;r<m.length;r++)S(m[r]);Object.freeze&&Object.freeze(m)}else console.error("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 S(m);if(Y.call(n,"key")){m=t(e);var $=Object.keys(n).filter(function(oe){return oe!=="key"});r=0<$.length?"{key: someKey, "+$.join(": ..., ")+": ...}":"{key: someKey}",J[m+r]||($=0<$.length?"{"+$.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var re;function ce(){return re||(re=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===C?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case R:return"Profiler";case B:return"StrictMode";case f:return"Suspense";case M:return"SuspenseList";case q:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case W:return"Portal";case G:return(e.displayName||"Context")+".Provider";case O:return(e._context.displayName||"Context")+".Consumer";case z:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case _:return n=e.displayName||null,n!==null?n:t(e.type)||"Memo";case T:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function i(e){return""+e}function o(e){try{i(e);var n=!1}catch{n=!0}if(n){n=console;var c=n.error,r=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",r),i(e)}}function d(e){if(e===k)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===T)return"<...>";try{var n=t(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function s(){var e=v.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function g(e){if(Y.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function h(e,n){function c(){L||(L=!0,console.error("%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://react.dev/link/special-props)",n))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function E(){var e=t(this.type);return D[e]||(D[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function x(e,n,c,r,b,w,X,Z){return c=w.ref,e={$$typeof:I,type:e,key:n,props:w,_owner:b},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:E}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Z}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function N(e,n,c,r,b,w,X,Z){var m=n.children;if(m!==void 0)if(r)if(j(m)){for(r=0;r<m.length;r++)S(m[r]);Object.freeze&&Object.freeze(m)}else console.error("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 S(m);if(Y.call(n,"key")){m=t(e);var $=Object.keys(n).filter(function(oe){return oe!=="key"});r=0<$.length?"{key: someKey, "+$.join(": ..., ")+": ...}":"{key: someKey}",J[m+r]||($=0<$.length?"{"+$.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,r,m,$,m),J[m+r]=!0)}if(m=null,c!==void 0&&(o(c),m=""+c),p(n)&&(o(n.key),m=""+n.key),"key"in n){c={};for(var Q in n)Q!=="key"&&(c[Q]=n[Q])}else c=n;return m&&h(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),x(e,m,w,b,s(),c,X,Z)}function S(e){typeof e=="object"&&e!==null&&e.$$typeof===I&&e._store&&(e._store.validated=1)}var g=l,I=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),G=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),T=Symbol.for("react.client.reference"),v=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,j=Array.isArray,y=console.createTask?console.createTask:function(){return null};g={"react-stack-bottom-frame":function(e){return e()}};var L,D={},A=g["react-stack-bottom-frame"].bind(g,u)(),F=y(d(u)),J={};U.Fragment=k,U.jsx=function(e,n,c,r,b){var w=1e4>v.recentlyCreatedOwnerStacks++;return N(e,n,c,!1,r,b,w?Error("react-stack-top-frame"):A,w?y(d(e)):F)},U.jsxs=function(e,n,c,r,b){var w=1e4>v.recentlyCreatedOwnerStacks++;return N(e,n,c,!0,r,b,w?Error("react-stack-top-frame"):A,w?y(d(e)):F)}}()),U}var te;function le(){return te||(te=1,process.env.NODE_ENV==="production"?V.exports=ie():V.exports=ce()),V.exports}var a=le();const K=({classNames:t={wrapper:"",color:""}})=>a.jsxs("svg",{className:`nariaLoading ${t.wrapper}`,"data-prop":"wrapper",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M32 3C35.8083 3 39.5794 3.75011 43.0978 5.20749C46.6163 6.66488 49.8132 8.80101 52.5061 11.4939C55.199 14.1868 57.3351 17.3837 58.7925 20.9022C60.2499 24.4206 61 28.1917 61 32C61 35.8083 60.2499 39.5794 58.7925 43.0978C57.3351 46.6163 55.199 49.8132 52.5061 52.5061C49.8132 55.199 46.6163 57.3351 43.0978 58.7925C39.5794 60.2499 35.8083 61 32 61C28.1917 61 24.4206 60.2499 20.9022 58.7925C17.3837 57.3351 14.1868 55.199 11.4939 52.5061C8.801 49.8132 6.66487 46.6163 5.20749 43.0978C3.7501 39.5794 3 35.8083 3 32C3 28.1917 3.75011 24.4206 5.2075 20.9022C6.66489 17.3837 8.80101 14.1868 11.4939 11.4939C14.1868 8.80099 17.3838 6.66487 20.9022 5.20749C24.4206 3.7501 28.1917 3 32 3L32 3Z",stroke:"currentColor",strokeWidth:"6",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M32 3C36.5778 3 41.0906 4.08374 45.1692 6.16256C49.2477 8.24138 52.7762 11.2562 55.466 14.9605C58.1558 18.6647 59.9304 22.9531 60.6448 27.4748C61.3591 31.9965 60.9928 36.6232 59.5759 40.9762",stroke:"currentColor",strokeWidth:"6",strokeLinecap:"round",strokeLinejoin:"round",className:t.color,"data-prop":"color"})]}),ue=({type:t="button",classNames:i={button:"",loading:{wrapper:"",color:""}},value:o,icon:d=null,isLoading:s=!1,isDisabled:u=!1,...p})=>a.jsxs("button",{type:t,disabled:u,...p,className:`nariaButton ${u?"nariaButton-disabled":""} ${i?.button}`,"data-prop":"button",children:[s?a.jsx(K,{classNames:{wrapper:i.loading.wrapper,color:i.loading.color},"data-prop-wrapper":"wrapper","data-prop-color":"color"}):d,o]}),de=({type:t="text",placeholder:i,classNames:o={wrapper:"",label:"",input:"",errorText:""},label:d,hasError:s,register:u,name:p,isDisabled:h=!1,autocomplete:E=!1,...x})=>a.jsxs("div",{className:`nariaInputWrapper ${o.wrapper}`,"data-prop":"wrapper",children:[a.jsxs("label",{htmlFor:p,className:`${o.label} ${s&&"nariaInputLabel-error"}`,"data-prop":"label",children:[d,a.jsx("input",{disabled:h,autoComplete:E?"on":"off",id:p,...u,...x,type:t,name:p,className:`${o.input} ${s&&"nariaInput-error"}`,placeholder:i,"data-prop":"input"})]}),s&&a.jsx("p",{className:`nariaInputErrorText ${o?.errorText}`,"data-prop":"errorText",children:s})]}),ne=t=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...t},P.createElement("path",{fill:"currentColor",d:"M209.5 369c-9.4 9.4-24.6 9.4-33.9 0L15.5 209c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l143 143 143-143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-160 160z"})),fe=t=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...t},P.createElement("path",{fill:"currentColor",d:"M7.5 105c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l151 151 151-151c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-151 151 151 151c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-151-151-151 151c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l151-151-151-151z"})),ae=t=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",...t},P.createElement("path",{fill:"currentColor",d:"M368 208a160 160 0 1 0 -320 0 160 160 0 1 0 320 0zM337.1 371.1C301.7 399.2 256.8 416 208 416 93.1 416 0 322.9 0 208S93.1 0 208 0 416 93.1 416 208c0 48.8-16.8 93.7-44.9 129.1L505 471c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L337.1 371.1z"})),pe=()=>{const[t,i]=l.useState(typeof window<"u"?window.innerWidth:0),o=()=>i(typeof window<"u"?window.innerWidth:0);return l.useEffect(()=>(window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)),[t]),t},ge=()=>{const t=`${window.location.pathname}${window.location.search}`;window.history.replaceState(null,"",t)},me=t=>{window.location.hash=t},he=t=>{const[i,o]=l.useState(!1);return l.useEffect(()=>{const d=s=>{window.location.hash!==t?o(!0):o(!1)};return window.addEventListener("hashchange",d),()=>{window.removeEventListener("hashchange",d)}},[]),i},we=(t,i,o)=>{l.useEffect(()=>{function d(s){i.current&&!i.current.contains(s.target)&&t?.current&&!t?.current.contains(s.target)&&o()}return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[t,o])},ve=({options:t,label:i,hasError:o,title:d,value:s,api:u,selected:p,placeholder:h,disabled:E=!1,pagination:x,optionFilterLabel:N,hasSearch:S=!1,classNames:g={wrapper:"",label:"",title:"",button:"",input:"",listWrapper:"",list:"",option:"",optionActive:"",mobileHeader:""},onSelectChange:I})=>{let W=!0;const k=pe(),B=he("#select"),[R,O]=l.useState(!1),[G,z]=l.useState(!0),[f,M]=l.useState(null),[_,C]=l.useState(null),[q,T]=l.useState(""),[v,Y]=l.useState({page:1,pageLabel:"page",size:20,sizeLabel:"size",isLoading:!1}),j=l.useRef(void 0),y=l.useRef(void 0),L=l.useRef(void 0),D=async()=>{if(j?.current)try{const r=await fetch(j?.current);if(!r.ok)throw new Error(`Response status: ${r.status}`);return await r.json()}catch(r){console.error(r.message)}};l.useEffect(()=>()=>{W=!1},[]),l.useEffect(()=>{if(u?.length){if(j.current=u,j.current.includes(x?.pageLabel||"page")){const r=new URL(u);r.searchParams.set(x?.pageLabel||"page",(x?.page||v.page).toString()),r.searchParams.set(x?.sizeLabel||"size",(x?.size||v.size).toString()),j.current=r.href}z(!0),D().then(r=>{W&&(z(!1),C(r))})}},[u,x]),l.useEffect(()=>{if(v.isLoading){if(j.current.includes(x?.pageLabel||"page")){const r=new URL(j.current);r.searchParams.set(x?.pageLabel||"page",v.page.toString()),j.current=r.href}D().then(r=>{W&&(z(!1),Y({...v,isLoading:!1}),C([..._,...r]))})}},[v]),l.useEffect(()=>{k<768&&(R?(me("select"),document.body.style.overflow="hidden",L.current?.focus()):(window.location.hash&&!document.referrer.includes("#")&&ge(),document.body.style.overflow="auto"))},[R]),l.useEffect(()=>{p&&t?.length&&(t?.find(r=>r[i]===p)?M(t?.find(r=>r[i]===p)):M(p))},[p]),l.useEffect(()=>{f&&S&&(s?.length&&_?.find(r=>r[i]===f[i])?T(_?.find(r=>r[i]===f[i])[s]||""):T(f))},[f]),l.useEffect(()=>{B&&O(!1)},[B]),l.useEffect(()=>{t?.length&&C(t)},[t]);const A=()=>{S&&C(t),O(r=>!r)},F=()=>{S&&(C(t),T(typeof f=="string"?f:f?f[s]:"")),O(!1)},J=r=>{S&&(s?.length?T(r[s]):T(r)),M(r),A(),I&&I(r)},e=r=>{if(!f)return"";if(i?.length&&r[i]===f[i])return`nariaSelectOption-active ${g?.optionActive}`;if(r===f)return`nariaSelectOption-active ${g?.optionActive}`},n=r=>{u?.length&&_?.length&&!v.isLoading&&r.target.offsetHeight+r.target.scrollTop>=r.target.scrollHeight-100&&Y({page:v.page+1,isLoading:!0})},c=r=>{const b=r?.target?.value?.length?t.filter(w=>typeof w=="object"?w[N?.length?N:s].includes(r?.target?.value):w.includes(r?.target?.value)):t;C(b),T(r?.target?.value),R||O(!0)};return we(y,L,F),a.jsxs("div",{className:`nariaSelect ${E?"nariaSelect-disabled":""} ${g?.wrapper}`,"data-prop":"wrapper",children:[a.jsxs("label",{className:`${o&&"!text-danger-100"}
23
- ${g?.label}`,"data-prop":"label",children:[a.jsx("span",{className:g?.title,"data-prop":"title",children:d}),S?a.jsxs("div",{className:"nariaSearchInput",children:[a.jsx("input",{ref:L,placeholder:h?.length?h:"Select",className:`${f?"text-dark-100":"text-grey-300"}
24
- ${o&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${g?.input}`,value:q,disabled:E,type:"text",onClick:A,onChange:c,"data-prop":"input"}),R?a.jsx(ae,{className:"nariaSearchIcon"}):a.jsx(ne,{className:`nariaArrowIcon ${R?"nariaArrowIcon-rotate-180":""}`})]}):a.jsxs("button",{type:"button",ref:L,disabled:E,className:`nariaHandler ${f?"text-dark-100":"text-grey-300"}
25
- ${o&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${g?.button}`,"data-prop":"button",onClick:A,children:[f?s?.length?f[s]:f:h?.length?h:"Select"," ",a.jsx(ne,{className:`nariaArrowIcon ${R?"nariaArrowIcon-rotate-180":""}`})]})]}),R?a.jsx("div",{className:`nariaListWrapper ${k<768?"nariaListWrapper-mobile":""} ${g?.listWrapper}`,"data-prop":"listWrapper",ref:y,children:a.jsx("div",{className:`nariaList ${k<768?"nariaList-mobile":"nariaList-desktop"} ${g?.list}`,"data-prop":"input",onScroll:n,children:u&&G?a.jsx("div",{className:"nariaLoadingWrapper",children:a.jsx(K,{})}):a.jsxs(a.Fragment,{children:[k<768?a.jsxs("div",{className:`nariaSelectMobileHeader ${g?.mobileHeader}`,"data-prop":"mobileHeader",children:[S?a.jsxs("div",{className:"nariaSearchInput",children:[a.jsx("input",{ref:L,placeholder:h?.length?h:"Select",className:`${f?"text-dark-100":"text-grey-300"}
26
- ${o&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${g?.input}`,"data-prop":"input",value:q,disabled:E,type:"text",onChange:c}),a.jsx(ae,{className:"nariaSearchIcon"})]}):void 0,a.jsx("button",{className:"p-3",onClick:F,disabled:E,children:a.jsx(fe,{className:"w-6"})})]}):void 0,_?.length?a.jsx(a.Fragment,{children:_?.map((r,b)=>a.jsx("button",{type:"button",onClick:()=>J(r),disabled:E,className:`nariaSelectOption ${g?.option} ${e(r)}`,"data-prop":"option","data-prop-active":"optionActive",children:s?.length?r[s]:r},b.toString()))}):a.jsx("div",{children:"No Data"}),v.isLoading?a.jsx("div",{className:"nariaLoadingMoreWrapper",children:a.jsx(K,{})}):void 0]})})}):void 0,o&&a.jsx("p",{className:"text-xs mt-1 text-danger-100",children:o})]})};function be(t){return t.charAt(0).toUpperCase()+t.slice(1)}exports.Button=ue;exports.Input=de;exports.Select=ve;exports.capitalize=be;
22
+ <%s key={someKey} {...props} />`,r,m,$,m),J[m+r]=!0)}if(m=null,c!==void 0&&(o(c),m=""+c),g(n)&&(o(n.key),m=""+n.key),"key"in n){c={};for(var Q in n)Q!=="key"&&(c[Q]=n[Q])}else c=n;return m&&h(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),x(e,m,w,b,s(),c,X,Z)}function S(e){typeof e=="object"&&e!==null&&e.$$typeof===I&&e._store&&(e._store.validated=1)}var p=l,I=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),G=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),C=Symbol.for("react.client.reference"),v=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,j=Array.isArray,y=console.createTask?console.createTask:function(){return null};p={"react-stack-bottom-frame":function(e){return e()}};var L,D={},A=p["react-stack-bottom-frame"].bind(p,u)(),F=y(d(u)),J={};U.Fragment=k,U.jsx=function(e,n,c,r,b){var w=1e4>v.recentlyCreatedOwnerStacks++;return N(e,n,c,!1,r,b,w?Error("react-stack-top-frame"):A,w?y(d(e)):F)},U.jsxs=function(e,n,c,r,b){var w=1e4>v.recentlyCreatedOwnerStacks++;return N(e,n,c,!0,r,b,w?Error("react-stack-top-frame"):A,w?y(d(e)):F)}}()),U}var te;function le(){return te||(te=1,process.env.NODE_ENV==="production"?V.exports=ie():V.exports=ce()),V.exports}var a=le();const K=({classNames:t={wrapper:"",color:""}})=>a.jsxs("svg",{className:`nariaLoading ${t.wrapper}`,"data-prop":"wrapper",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M32 3C35.8083 3 39.5794 3.75011 43.0978 5.20749C46.6163 6.66488 49.8132 8.80101 52.5061 11.4939C55.199 14.1868 57.3351 17.3837 58.7925 20.9022C60.2499 24.4206 61 28.1917 61 32C61 35.8083 60.2499 39.5794 58.7925 43.0978C57.3351 46.6163 55.199 49.8132 52.5061 52.5061C49.8132 55.199 46.6163 57.3351 43.0978 58.7925C39.5794 60.2499 35.8083 61 32 61C28.1917 61 24.4206 60.2499 20.9022 58.7925C17.3837 57.3351 14.1868 55.199 11.4939 52.5061C8.801 49.8132 6.66487 46.6163 5.20749 43.0978C3.7501 39.5794 3 35.8083 3 32C3 28.1917 3.75011 24.4206 5.2075 20.9022C6.66489 17.3837 8.80101 14.1868 11.4939 11.4939C14.1868 8.80099 17.3838 6.66487 20.9022 5.20749C24.4206 3.7501 28.1917 3 32 3L32 3Z",stroke:"currentColor",strokeWidth:"6",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M32 3C36.5778 3 41.0906 4.08374 45.1692 6.16256C49.2477 8.24138 52.7762 11.2562 55.466 14.9605C58.1558 18.6647 59.9304 22.9531 60.6448 27.4748C61.3591 31.9965 60.9928 36.6232 59.5759 40.9762",stroke:"currentColor",strokeWidth:"6",strokeLinecap:"round",strokeLinejoin:"round",className:t.color,"data-prop":"color"})]}),ue=({type:t="button",classNames:i={button:"",loading:{wrapper:"",color:""}},value:o,icon:d=null,isLoading:s=!1,isDisabled:u=!1,...g})=>a.jsxs("button",{type:t,disabled:u,...g,className:`nariaButton ${u?"nariaButton-disabled":""} ${i?.button}`,"data-prop":"button",children:[s?a.jsx(K,{classNames:{wrapper:i.loading.wrapper,color:i.loading.color},"data-prop-wrapper":"wrapper","data-prop-color":"color"}):d,o]}),de=({type:t="text",placeholder:i,classNames:o={wrapper:"",label:"",title:"",input:"",errorText:""},title:d,hasError:s,register:u,name:g,isDisabled:h=!1,autocomplete:E=!1,...x})=>a.jsxs("div",{className:`nariaInputWrapper ${o.wrapper}`,"data-prop":"wrapper",children:[a.jsxs("label",{htmlFor:g,className:`${o.label} ${s&&"nariaInputLabel-error"}`,"data-prop":"label",children:[a.jsx("span",{className:o?.title,"data-prop":"title",children:d}),a.jsx("input",{disabled:h,autoComplete:E?"on":"off",id:g,...u,...x,type:t,name:g,className:`${o.input} ${s&&"nariaInput-error"}`,placeholder:i,"data-prop":"input"})]}),s&&a.jsx("p",{className:`nariaInputErrorText ${o?.errorText}`,"data-prop":"errorText",children:s})]}),ne=t=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...t},P.createElement("path",{fill:"currentColor",d:"M209.5 369c-9.4 9.4-24.6 9.4-33.9 0L15.5 209c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l143 143 143-143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-160 160z"})),fe=t=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...t},P.createElement("path",{fill:"currentColor",d:"M7.5 105c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l151 151 151-151c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-151 151 151 151c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-151-151-151 151c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l151-151-151-151z"})),ae=t=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",...t},P.createElement("path",{fill:"currentColor",d:"M368 208a160 160 0 1 0 -320 0 160 160 0 1 0 320 0zM337.1 371.1C301.7 399.2 256.8 416 208 416 93.1 416 0 322.9 0 208S93.1 0 208 0 416 93.1 416 208c0 48.8-16.8 93.7-44.9 129.1L505 471c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L337.1 371.1z"})),pe=()=>{const[t,i]=l.useState(typeof window<"u"?window.innerWidth:0),o=()=>i(typeof window<"u"?window.innerWidth:0);return l.useEffect(()=>(window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)),[t]),t},ge=()=>{const t=`${window.location.pathname}${window.location.search}`;window.history.replaceState(null,"",t)},me=t=>{window.location.hash=t},he=t=>{const[i,o]=l.useState(!1);return l.useEffect(()=>{const d=s=>{window.location.hash!==t?o(!0):o(!1)};return window.addEventListener("hashchange",d),()=>{window.removeEventListener("hashchange",d)}},[]),i},we=(t,i,o)=>{l.useEffect(()=>{function d(s){i.current&&!i.current.contains(s.target)&&t?.current&&!t?.current.contains(s.target)&&o()}return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[t,o])},ve=({options:t,label:i,hasError:o,title:d,value:s,api:u,selected:g,placeholder:h,disabled:E=!1,pagination:x,optionFilterLabel:N,hasSearch:S=!1,classNames:p={wrapper:"",label:"",title:"",button:"",input:"",listWrapper:"",list:"",option:"",optionActive:"",mobileHeader:"",errorText:""},onSelectChange:I})=>{let W=!0;const k=pe(),B=he("#select"),[R,O]=l.useState(!1),[G,z]=l.useState(!0),[f,M]=l.useState(null),[_,T]=l.useState(null),[q,C]=l.useState(""),[v,Y]=l.useState({page:1,pageLabel:"page",size:20,sizeLabel:"size",isLoading:!1}),j=l.useRef(void 0),y=l.useRef(void 0),L=l.useRef(void 0),D=async()=>{if(j?.current)try{const r=await fetch(j?.current);if(!r.ok)throw new Error(`Response status: ${r.status}`);return await r.json()}catch(r){console.error(r.message)}};l.useEffect(()=>()=>{W=!1},[]),l.useEffect(()=>{if(u?.length){if(j.current=u,j.current.includes(x?.pageLabel||"page")){const r=new URL(u);r.searchParams.set(x?.pageLabel||"page",(x?.page||v.page).toString()),r.searchParams.set(x?.sizeLabel||"size",(x?.size||v.size).toString()),j.current=r.href}z(!0),D().then(r=>{W&&(z(!1),T(r))})}},[u,x]),l.useEffect(()=>{if(v.isLoading){if(j.current.includes(x?.pageLabel||"page")){const r=new URL(j.current);r.searchParams.set(x?.pageLabel||"page",v.page.toString()),j.current=r.href}D().then(r=>{W&&(z(!1),Y({...v,isLoading:!1}),T([..._,...r]))})}},[v]),l.useEffect(()=>{k<768&&(R?(me("select"),document.body.style.overflow="hidden",L.current?.focus()):(window.location.hash&&!document.referrer.includes("#")&&ge(),document.body.style.overflow="auto"))},[R]),l.useEffect(()=>{g&&t?.length&&(t?.find(r=>r[i]===g)?M(t?.find(r=>r[i]===g)):M(g))},[g]),l.useEffect(()=>{f&&S&&(s?.length&&_?.find(r=>r[i]===f[i])?C(_?.find(r=>r[i]===f[i])[s]||""):C(f))},[f]),l.useEffect(()=>{B&&O(!1)},[B]),l.useEffect(()=>{t?.length&&T(t)},[t]);const A=()=>{S&&T(t),O(r=>!r)},F=()=>{S&&(T(t),C(typeof f=="string"?f:f?f[s]:"")),O(!1)},J=r=>{S&&(s?.length?C(r[s]):C(r)),M(r),A(),I&&I(r)},e=r=>{if(!f)return"";if(i?.length&&r[i]===f[i])return`nariaSelectOption-active ${p?.optionActive}`;if(r===f)return`nariaSelectOption-active ${p?.optionActive}`},n=r=>{u?.length&&_?.length&&!v.isLoading&&r.target.offsetHeight+r.target.scrollTop>=r.target.scrollHeight-100&&Y({page:v.page+1,isLoading:!0})},c=r=>{const b=r?.target?.value?.length?t.filter(w=>typeof w=="object"?w[N?.length?N:s].includes(r?.target?.value):w.includes(r?.target?.value)):t;T(b),C(r?.target?.value),R||O(!0)};return we(y,L,F),a.jsxs("div",{className:`nariaSelect ${E?"nariaSelect-disabled":""} ${p?.wrapper}`,"data-prop":"wrapper",children:[a.jsxs("label",{className:`${o&&"!text-danger-100"}
23
+ ${p?.label}`,"data-prop":"label",children:[a.jsx("span",{className:p?.title,"data-prop":"title",children:d}),S?a.jsxs("div",{className:"nariaSearchInput",children:[a.jsx("input",{ref:L,placeholder:h?.length?h:"Select",className:`${f?"text-dark-100":"text-grey-300"}
24
+ ${o&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${p?.input}`,value:q,disabled:E,type:"text",onClick:A,onChange:c,"data-prop":"input"}),R?a.jsx(ae,{className:"nariaSearchIcon"}):a.jsx(ne,{className:`nariaArrowIcon ${R?"nariaArrowIcon-rotate-180":""}`})]}):a.jsxs("button",{type:"button",ref:L,disabled:E,className:`nariaHandler ${f?"text-dark-100":"text-grey-300"}
25
+ ${o&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${p?.button}`,"data-prop":"button",onClick:A,children:[f?s?.length?f[s]:f:h?.length?h:"Select"," ",a.jsx(ne,{className:`nariaArrowIcon ${R?"nariaArrowIcon-rotate-180":""}`})]})]}),R?a.jsx("div",{className:`nariaListWrapper ${k<768?"nariaListWrapper-mobile":""} ${p?.listWrapper}`,"data-prop":"listWrapper",ref:y,children:a.jsx("div",{className:`nariaList ${k<768?"nariaList-mobile":"nariaList-desktop"} ${p?.list}`,"data-prop":"input",onScroll:n,children:u&&G?a.jsx("div",{className:"nariaLoadingWrapper",children:a.jsx(K,{})}):a.jsxs(a.Fragment,{children:[k<768?a.jsxs("div",{className:`nariaSelectMobileHeader ${p?.mobileHeader}`,"data-prop":"mobileHeader",children:[S?a.jsxs("div",{className:"nariaSearchInput",children:[a.jsx("input",{ref:L,placeholder:h?.length?h:"Select",className:`${f?"text-dark-100":"text-grey-300"}
26
+ ${o&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${p?.input}`,"data-prop":"input",value:q,disabled:E,type:"text",onChange:c}),a.jsx(ae,{className:"nariaSearchIcon"})]}):void 0,a.jsx("button",{className:"p-3",onClick:F,disabled:E,children:a.jsx(fe,{className:"w-6"})})]}):void 0,_?.length?a.jsx(a.Fragment,{children:_?.map((r,b)=>a.jsx("button",{type:"button",onClick:()=>J(r),disabled:E,className:`nariaSelectOption ${p?.option} ${e(r)}`,"data-prop":"option","data-prop-active":"optionActive",children:s?.length?r[s]:r},b.toString()))}):a.jsx("div",{children:"No Data"}),v.isLoading?a.jsx("div",{className:"nariaLoadingMoreWrapper",children:a.jsx(K,{})}):void 0]})})}):void 0,o&&a.jsx("p",{className:`nariaSelectErrorText ${p?.errorText}`,"data-prop":"errorText",children:o})]})};function be(t){return t.charAt(0).toUpperCase()+t.slice(1)}exports.Button=ue;exports.Input=de;exports.Select=ve;exports.capitalize=be;
@@ -15,17 +15,17 @@ function ce() {
15
15
  if (te) return U;
16
16
  te = 1;
17
17
  var t = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment");
18
- function s(d, o, c) {
19
- var f = null;
20
- if (c !== void 0 && (f = "" + c), o.key !== void 0 && (f = "" + o.key), "key" in o) {
18
+ function s(f, o, c) {
19
+ var p = null;
20
+ if (c !== void 0 && (p = "" + c), o.key !== void 0 && (p = "" + o.key), "key" in o) {
21
21
  c = {};
22
22
  for (var m in o)
23
23
  m !== "key" && (c[m] = o[m]);
24
24
  } else c = o;
25
25
  return o = c.ref, {
26
26
  $$typeof: t,
27
- type: d,
28
- key: f,
27
+ type: f,
28
+ key: p,
29
29
  ref: o !== void 0 ? o : null,
30
30
  props: c
31
31
  };
@@ -48,12 +48,12 @@ function ue() {
48
48
  function t(e) {
49
49
  if (e == null) return null;
50
50
  if (typeof e == "function")
51
- return e.$$typeof === T ? null : e.displayName || e.name || null;
51
+ return e.$$typeof === S ? null : e.displayName || e.name || null;
52
52
  if (typeof e == "string") return e;
53
53
  switch (e) {
54
54
  case k:
55
55
  return "Fragment";
56
- case C:
56
+ case T:
57
57
  return "Profiler";
58
58
  case J:
59
59
  return "StrictMode";
@@ -72,14 +72,14 @@ function ue() {
72
72
  return "Portal";
73
73
  case X:
74
74
  return (e.displayName || "Context") + ".Provider";
75
- case O:
75
+ case $:
76
76
  return (e._context.displayName || "Context") + ".Consumer";
77
77
  case Y:
78
78
  var n = e.render;
79
79
  return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
80
80
  case _:
81
81
  return n = e.displayName || null, n !== null ? n : t(e.type) || "Memo";
82
- case S:
82
+ case C:
83
83
  n = e._payload, e = e._init;
84
84
  try {
85
85
  return t(e(n));
@@ -108,9 +108,9 @@ function ue() {
108
108
  ), i(e);
109
109
  }
110
110
  }
111
- function d(e) {
111
+ function f(e) {
112
112
  if (e === k) return "<>";
113
- if (typeof e == "object" && e !== null && e.$$typeof === S)
113
+ if (typeof e == "object" && e !== null && e.$$typeof === C)
114
114
  return "<...>";
115
115
  try {
116
116
  var n = t(e);
@@ -126,7 +126,7 @@ function ue() {
126
126
  function c() {
127
127
  return Error("react-stack-top-frame");
128
128
  }
129
- function f(e) {
129
+ function p(e) {
130
130
  if (D.call(e, "key")) {
131
131
  var n = Object.getOwnPropertyDescriptor(e, "key").get;
132
132
  if (n && n.isReactWarning) return !1;
@@ -187,15 +187,15 @@ function ue() {
187
187
  var g = n.children;
188
188
  if (g !== void 0)
189
189
  if (r)
190
- if (R(g)) {
190
+ if (j(g)) {
191
191
  for (r = 0; r < g.length; r++)
192
- j(g[r]);
192
+ R(g[r]);
193
193
  Object.freeze && Object.freeze(g);
194
194
  } else
195
195
  console.error(
196
196
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
197
  );
198
- else j(g);
198
+ else R(g);
199
199
  if (D.call(n, "key")) {
200
200
  g = t(e);
201
201
  var N = Object.keys(n).filter(function(ie) {
@@ -214,7 +214,7 @@ React keys must be passed directly to JSX without using spread:
214
214
  g
215
215
  ), V[g + r] = !0);
216
216
  }
217
- if (g = null, l !== void 0 && (s(l), g = "" + l), f(n) && (s(n.key), g = "" + n.key), "key" in n) {
217
+ if (g = null, l !== void 0 && (s(l), g = "" + l), p(n) && (s(n.key), g = "" + n.key), "key" in n) {
218
218
  l = {};
219
219
  for (var K in n)
220
220
  K !== "key" && (l[K] = n[K]);
@@ -233,21 +233,21 @@ React keys must be passed directly to JSX without using spread:
233
233
  Q
234
234
  );
235
235
  }
236
- function j(e) {
236
+ function R(e) {
237
237
  typeof e == "object" && e !== null && e.$$typeof === W && e._store && (e._store.validated = 1);
238
238
  }
239
- var p = le, W = Symbol.for("react.transitional.element"), z = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), J = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), O = Symbol.for("react.consumer"), X = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), q = Symbol.for("react.activity"), T = Symbol.for("react.client.reference"), w = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, R = Array.isArray, $ = console.createTask ? console.createTask : function() {
239
+ var d = le, W = Symbol.for("react.transitional.element"), z = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), J = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), X = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), q = Symbol.for("react.activity"), S = Symbol.for("react.client.reference"), w = d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, j = Array.isArray, O = console.createTask ? console.createTask : function() {
240
240
  return null;
241
241
  };
242
- p = {
242
+ d = {
243
243
  "react-stack-bottom-frame": function(e) {
244
244
  return e();
245
245
  }
246
246
  };
247
- var L, F = {}, y = p["react-stack-bottom-frame"].bind(
248
- p,
247
+ var L, F = {}, y = d["react-stack-bottom-frame"].bind(
248
+ d,
249
249
  c
250
- )(), H = $(d(c)), V = {};
250
+ )(), H = O(f(c)), V = {};
251
251
  B.Fragment = k, B.jsx = function(e, n, l, r, v) {
252
252
  var h = 1e4 > w.recentlyCreatedOwnerStacks++;
253
253
  return I(
@@ -258,7 +258,7 @@ React keys must be passed directly to JSX without using spread:
258
258
  r,
259
259
  v,
260
260
  h ? Error("react-stack-top-frame") : y,
261
- h ? $(d(e)) : H
261
+ h ? O(f(e)) : H
262
262
  );
263
263
  }, B.jsxs = function(e, n, l, r, v) {
264
264
  var h = 1e4 > w.recentlyCreatedOwnerStacks++;
@@ -270,7 +270,7 @@ React keys must be passed directly to JSX without using spread:
270
270
  r,
271
271
  v,
272
272
  h ? Error("react-stack-top-frame") : y,
273
- h ? $(d(e)) : H
273
+ h ? O(f(e)) : H
274
274
  );
275
275
  };
276
276
  }()), B;
@@ -328,23 +328,23 @@ const re = ({
328
328
  }
329
329
  },
330
330
  value: s,
331
- icon: d = null,
331
+ icon: f = null,
332
332
  isLoading: o = !1,
333
333
  isDisabled: c = !1,
334
- ...f
334
+ ...p
335
335
  }) => /* @__PURE__ */ a.jsxs(
336
336
  "button",
337
337
  {
338
338
  type: t,
339
339
  disabled: c,
340
- ...f,
340
+ ...p,
341
341
  className: `nariaButton ${c ? "nariaButton-disabled" : ""} ${i?.button}`,
342
342
  "data-prop": "button",
343
343
  children: [
344
344
  o ? /* @__PURE__ */ a.jsx(re, { classNames: {
345
345
  wrapper: i.loading.wrapper,
346
346
  color: i.loading.color
347
- }, "data-prop-wrapper": "wrapper", "data-prop-color": "color" }) : d,
347
+ }, "data-prop-wrapper": "wrapper", "data-prop-color": "color" }) : f,
348
348
  s
349
349
  ]
350
350
  }
@@ -354,13 +354,14 @@ const re = ({
354
354
  classNames: s = {
355
355
  wrapper: "",
356
356
  label: "",
357
+ title: "",
357
358
  input: "",
358
359
  errorText: ""
359
360
  },
360
- label: d,
361
+ title: f,
361
362
  hasError: o,
362
363
  register: c,
363
- name: f,
364
+ name: p,
364
365
  isDisabled: m = !1,
365
366
  autocomplete: E = !1,
366
367
  ...b
@@ -368,21 +369,21 @@ const re = ({
368
369
  /* @__PURE__ */ a.jsxs(
369
370
  "label",
370
371
  {
371
- htmlFor: f,
372
+ htmlFor: p,
372
373
  className: `${s.label} ${o && "nariaInputLabel-error"}`,
373
374
  "data-prop": "label",
374
375
  children: [
375
- d,
376
+ /* @__PURE__ */ a.jsx("span", { className: s?.title, "data-prop": "title", children: f }),
376
377
  /* @__PURE__ */ a.jsx(
377
378
  "input",
378
379
  {
379
380
  disabled: m,
380
381
  autoComplete: E ? "on" : "off",
381
- id: f,
382
+ id: p,
382
383
  ...c,
383
384
  ...b,
384
385
  type: t,
385
- name: f,
386
+ name: p,
386
387
  className: `${s.input} ${o && "nariaInput-error"}`,
387
388
  placeholder: i,
388
389
  "data-prop": "input"
@@ -403,36 +404,36 @@ const re = ({
403
404
  }, he = (t) => {
404
405
  const [i, s] = A(!1);
405
406
  return x(() => {
406
- const d = (o) => {
407
+ const f = (o) => {
407
408
  window.location.hash !== t ? s(!0) : s(!1);
408
409
  };
409
- return window.addEventListener("hashchange", d), () => {
410
- window.removeEventListener("hashchange", d);
410
+ return window.addEventListener("hashchange", f), () => {
411
+ window.removeEventListener("hashchange", f);
411
412
  };
412
413
  }, []), i;
413
414
  }, we = (t, i, s) => {
414
415
  x(() => {
415
- function d(o) {
416
+ function f(o) {
416
417
  i.current && !i.current.contains(o.target) && t?.current && !t?.current.contains(o.target) && s();
417
418
  }
418
- return document.addEventListener("mousedown", d), () => {
419
- document.removeEventListener("mousedown", d);
419
+ return document.addEventListener("mousedown", f), () => {
420
+ document.removeEventListener("mousedown", f);
420
421
  };
421
422
  }, [t, s]);
422
423
  }, Ee = ({
423
424
  options: t,
424
425
  label: i,
425
426
  hasError: s,
426
- title: d,
427
+ title: f,
427
428
  value: o,
428
429
  api: c,
429
- selected: f,
430
+ selected: p,
430
431
  placeholder: m,
431
432
  disabled: E = !1,
432
433
  pagination: b,
433
434
  optionFilterLabel: I,
434
- hasSearch: j = !1,
435
- classNames: p = {
435
+ hasSearch: R = !1,
436
+ classNames: d = {
436
437
  wrapper: "",
437
438
  label: "",
438
439
  title: "",
@@ -442,21 +443,22 @@ const re = ({
442
443
  list: "",
443
444
  option: "",
444
445
  optionActive: "",
445
- mobileHeader: ""
446
+ mobileHeader: "",
447
+ errorText: ""
446
448
  },
447
449
  onSelectChange: W
448
450
  }) => {
449
451
  let z = !0;
450
- const k = pe(), J = he("#select"), [C, O] = A(!1), [X, Y] = A(!0), [u, M] = A(null), [_, S] = A(null), [q, T] = A(""), [w, D] = A({
452
+ const k = pe(), J = he("#select"), [T, $] = A(!1), [X, Y] = A(!0), [u, M] = A(null), [_, C] = A(null), [q, S] = A(""), [w, D] = A({
451
453
  page: 1,
452
454
  pageLabel: "page",
453
455
  size: 20,
454
456
  sizeLabel: "size",
455
457
  isLoading: !1
456
- }), R = ee(void 0), $ = ee(void 0), L = ee(void 0), F = async () => {
457
- if (R?.current)
458
+ }), j = ee(void 0), O = ee(void 0), L = ee(void 0), F = async () => {
459
+ if (j?.current)
458
460
  try {
459
- const r = await fetch(R?.current);
461
+ const r = await fetch(j?.current);
460
462
  if (!r.ok)
461
463
  throw new Error(`Response status: ${r.status}`);
462
464
  return await r.json();
@@ -468,54 +470,54 @@ const re = ({
468
470
  z = !1;
469
471
  }, []), x(() => {
470
472
  if (c?.length) {
471
- if (R.current = c, R.current.includes(b?.pageLabel || "page")) {
473
+ if (j.current = c, j.current.includes(b?.pageLabel || "page")) {
472
474
  const r = new URL(c);
473
- r.searchParams.set(b?.pageLabel || "page", (b?.page || w.page).toString()), r.searchParams.set(b?.sizeLabel || "size", (b?.size || w.size).toString()), R.current = r.href;
475
+ r.searchParams.set(b?.pageLabel || "page", (b?.page || w.page).toString()), r.searchParams.set(b?.sizeLabel || "size", (b?.size || w.size).toString()), j.current = r.href;
474
476
  }
475
477
  Y(!0), F().then((r) => {
476
- z && (Y(!1), S(r));
478
+ z && (Y(!1), C(r));
477
479
  });
478
480
  }
479
481
  }, [c, b]), x(() => {
480
482
  if (w.isLoading) {
481
- if (R.current.includes(b?.pageLabel || "page")) {
482
- const r = new URL(R.current);
483
- r.searchParams.set(b?.pageLabel || "page", w.page.toString()), R.current = r.href;
483
+ if (j.current.includes(b?.pageLabel || "page")) {
484
+ const r = new URL(j.current);
485
+ r.searchParams.set(b?.pageLabel || "page", w.page.toString()), j.current = r.href;
484
486
  }
485
487
  F().then((r) => {
486
488
  z && (Y(!1), D({
487
489
  ...w,
488
490
  isLoading: !1
489
- }), S([
491
+ }), C([
490
492
  ..._,
491
493
  ...r
492
494
  ]));
493
495
  });
494
496
  }
495
497
  }, [w]), x(() => {
496
- k < 768 && (C ? (me("select"), document.body.style.overflow = "hidden", L.current?.focus()) : (window.location.hash && !document.referrer.includes("#") && ge(), document.body.style.overflow = "auto"));
497
- }, [C]), x(() => {
498
- f && t?.length && (t?.find((r) => r[i] === f) ? M(t?.find((r) => r[i] === f)) : M(f));
499
- }, [f]), x(() => {
500
- u && j && (o?.length && _?.find((r) => r[i] === u[i]) ? T(_?.find((r) => r[i] === u[i])[o] || "") : T(u));
498
+ k < 768 && (T ? (me("select"), document.body.style.overflow = "hidden", L.current?.focus()) : (window.location.hash && !document.referrer.includes("#") && ge(), document.body.style.overflow = "auto"));
499
+ }, [T]), x(() => {
500
+ p && t?.length && (t?.find((r) => r[i] === p) ? M(t?.find((r) => r[i] === p)) : M(p));
501
+ }, [p]), x(() => {
502
+ u && R && (o?.length && _?.find((r) => r[i] === u[i]) ? S(_?.find((r) => r[i] === u[i])[o] || "") : S(u));
501
503
  }, [u]), x(() => {
502
- J && O(!1);
504
+ J && $(!1);
503
505
  }, [J]), x(() => {
504
- t?.length && S(t);
506
+ t?.length && C(t);
505
507
  }, [t]);
506
508
  const y = () => {
507
- j && S(t), O((r) => !r);
509
+ R && C(t), $((r) => !r);
508
510
  }, H = () => {
509
- j && (S(t), T(typeof u == "string" ? u : u ? u[o] : "")), O(!1);
511
+ R && (C(t), S(typeof u == "string" ? u : u ? u[o] : "")), $(!1);
510
512
  }, V = (r) => {
511
- j && (o?.length ? T(r[o]) : T(r)), M(r), y(), W && W(r);
513
+ R && (o?.length ? S(r[o]) : S(r)), M(r), y(), W && W(r);
512
514
  }, e = (r) => {
513
515
  if (!u)
514
516
  return "";
515
517
  if (i?.length && r[i] === u[i])
516
- return `nariaSelectOption-active ${p?.optionActive}`;
518
+ return `nariaSelectOption-active ${d?.optionActive}`;
517
519
  if (r === u)
518
- return `nariaSelectOption-active ${p?.optionActive}`;
520
+ return `nariaSelectOption-active ${d?.optionActive}`;
519
521
  }, n = (r) => {
520
522
  c?.length && _?.length && !w.isLoading && r.target.offsetHeight + r.target.scrollTop >= r.target.scrollHeight - 100 && D({
521
523
  page: w.page + 1,
@@ -523,30 +525,30 @@ const re = ({
523
525
  });
524
526
  }, l = (r) => {
525
527
  const v = r?.target?.value?.length ? t.filter((h) => typeof h == "object" ? h[I?.length ? I : o].includes(r?.target?.value) : h.includes(r?.target?.value)) : t;
526
- S(v), T(r?.target?.value), C || O(!0);
528
+ C(v), S(r?.target?.value), T || $(!0);
527
529
  };
528
- return we($, L, H), /* @__PURE__ */ a.jsxs(
530
+ return we(O, L, H), /* @__PURE__ */ a.jsxs(
529
531
  "div",
530
532
  {
531
- className: `nariaSelect ${E ? "nariaSelect-disabled" : ""} ${p?.wrapper}`,
533
+ className: `nariaSelect ${E ? "nariaSelect-disabled" : ""} ${d?.wrapper}`,
532
534
  "data-prop": "wrapper",
533
535
  children: [
534
536
  /* @__PURE__ */ a.jsxs(
535
537
  "label",
536
538
  {
537
539
  className: `${s && "!text-danger-100"}
538
- ${p?.label}`,
540
+ ${d?.label}`,
539
541
  "data-prop": "label",
540
542
  children: [
541
- /* @__PURE__ */ a.jsx("span", { className: p?.title, "data-prop": "title", children: d }),
542
- j ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
543
+ /* @__PURE__ */ a.jsx("span", { className: d?.title, "data-prop": "title", children: f }),
544
+ R ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
543
545
  /* @__PURE__ */ a.jsx(
544
546
  "input",
545
547
  {
546
548
  ref: L,
547
549
  placeholder: m?.length ? m : "Select",
548
550
  className: `${u ? "text-dark-100" : "text-grey-300"}
549
- ${s && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${p?.input}`,
551
+ ${s && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${d?.input}`,
550
552
  value: q,
551
553
  disabled: E,
552
554
  type: "text",
@@ -555,7 +557,7 @@ const re = ({
555
557
  "data-prop": "input"
556
558
  }
557
559
  ),
558
- C ? /* @__PURE__ */ a.jsx(
560
+ T ? /* @__PURE__ */ a.jsx(
559
561
  se,
560
562
  {
561
563
  className: "nariaSearchIcon"
@@ -563,7 +565,7 @@ const re = ({
563
565
  ) : /* @__PURE__ */ a.jsx(
564
566
  oe,
565
567
  {
566
- className: `nariaArrowIcon ${C ? "nariaArrowIcon-rotate-180" : ""}`
568
+ className: `nariaArrowIcon ${T ? "nariaArrowIcon-rotate-180" : ""}`
567
569
  }
568
570
  )
569
571
  ] }) : /* @__PURE__ */ a.jsxs(
@@ -573,7 +575,7 @@ const re = ({
573
575
  ref: L,
574
576
  disabled: E,
575
577
  className: `nariaHandler ${u ? "text-dark-100" : "text-grey-300"}
576
- ${s && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${p?.button}`,
578
+ ${s && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${d?.button}`,
577
579
  "data-prop": "button",
578
580
  onClick: y,
579
581
  children: [
@@ -582,7 +584,7 @@ const re = ({
582
584
  /* @__PURE__ */ a.jsx(
583
585
  oe,
584
586
  {
585
- className: `nariaArrowIcon ${C ? "nariaArrowIcon-rotate-180" : ""}`
587
+ className: `nariaArrowIcon ${T ? "nariaArrowIcon-rotate-180" : ""}`
586
588
  }
587
589
  )
588
590
  ]
@@ -591,33 +593,33 @@ const re = ({
591
593
  ]
592
594
  }
593
595
  ),
594
- C ? /* @__PURE__ */ a.jsx(
596
+ T ? /* @__PURE__ */ a.jsx(
595
597
  "div",
596
598
  {
597
- className: `nariaListWrapper ${k < 768 ? "nariaListWrapper-mobile" : ""} ${p?.listWrapper}`,
599
+ className: `nariaListWrapper ${k < 768 ? "nariaListWrapper-mobile" : ""} ${d?.listWrapper}`,
598
600
  "data-prop": "listWrapper",
599
- ref: $,
601
+ ref: O,
600
602
  children: /* @__PURE__ */ a.jsx(
601
603
  "div",
602
604
  {
603
- className: `nariaList ${k < 768 ? "nariaList-mobile" : "nariaList-desktop"} ${p?.list}`,
605
+ className: `nariaList ${k < 768 ? "nariaList-mobile" : "nariaList-desktop"} ${d?.list}`,
604
606
  "data-prop": "input",
605
607
  onScroll: n,
606
608
  children: c && X ? /* @__PURE__ */ a.jsx("div", { className: "nariaLoadingWrapper", children: /* @__PURE__ */ a.jsx(re, {}) }) : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
607
609
  k < 768 ? /* @__PURE__ */ a.jsxs(
608
610
  "div",
609
611
  {
610
- className: `nariaSelectMobileHeader ${p?.mobileHeader}`,
612
+ className: `nariaSelectMobileHeader ${d?.mobileHeader}`,
611
613
  "data-prop": "mobileHeader",
612
614
  children: [
613
- j ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
615
+ R ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
614
616
  /* @__PURE__ */ a.jsx(
615
617
  "input",
616
618
  {
617
619
  ref: L,
618
620
  placeholder: m?.length ? m : "Select",
619
621
  className: `${u ? "text-dark-100" : "text-grey-300"}
620
- ${s && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${p?.input}`,
622
+ ${s && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${d?.input}`,
621
623
  "data-prop": "input",
622
624
  value: q,
623
625
  disabled: E,
@@ -642,7 +644,7 @@ const re = ({
642
644
  type: "button",
643
645
  onClick: () => V(r),
644
646
  disabled: E,
645
- className: `nariaSelectOption ${p?.option} ${e(r)}`,
647
+ className: `nariaSelectOption ${d?.option} ${e(r)}`,
646
648
  "data-prop": "option",
647
649
  "data-prop-active": "optionActive",
648
650
  children: o?.length ? r[o] : r
@@ -655,17 +657,17 @@ const re = ({
655
657
  )
656
658
  }
657
659
  ) : void 0,
658
- s && /* @__PURE__ */ a.jsx("p", { className: "text-xs mt-1 text-danger-100", children: s })
660
+ s && /* @__PURE__ */ a.jsx("p", { className: `nariaSelectErrorText ${d?.errorText}`, "data-prop": "errorText", children: s })
659
661
  ]
660
662
  }
661
663
  );
662
664
  };
663
- function Re(t) {
665
+ function je(t) {
664
666
  return t.charAt(0).toUpperCase() + t.slice(1);
665
667
  }
666
668
  export {
667
669
  be as Button,
668
670
  xe as Input,
669
671
  Ee as Select,
670
- Re as capitalize
672
+ je as capitalize
671
673
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Mohammad Mehdi Mohammadi",
6
6
  "url": ""
7
7
  },
8
- "version": "0.1.52",
8
+ "version": "0.1.53",
9
9
  "type": "module",
10
10
  "main": "./dist/naria-ui.cjs.js",
11
11
  "module": "./dist/naria-ui.es.js",