naria-ui 0.1.46 → 0.1.47

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.
@@ -24,6 +24,9 @@ export interface props {
24
24
  title?: string;
25
25
  button?: string;
26
26
  input?: string;
27
+ listWrapper?: string;
28
+ list?: string;
29
+ option?: string;
27
30
  };
28
31
  onSelectChange?: any;
29
32
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");function se(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const d=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,d.get?d:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const $=se(l);var V={exports:{}},U={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");function se(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const d=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(a,s,d.get?d:{enumerable:!0,get:()=>r[s]})}}return a.default=r,Object.freeze(a)}const $=se(l);var V={exports:{}},U={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.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 K;function ce(){if(K)return U;K=1;var r=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function s(d,c,u){var w=null;if(u!==void 0&&(w=""+u),c.key!==void 0&&(w=""+c.key),"key"in c){u={};for(var g in c)g!=="key"&&(u[g]=c[g])}else u=c;return c=u.ref,{$$typeof:r,type:d,key:w,ref:c!==void 0?c:null,props:u}}return U.Fragment=o,U.jsx=s,U.jsxs=s,U}var H={};/**
9
+ */var K;function ce(){if(K)return U;K=1;var r=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function s(d,c,u){var v=null;if(u!==void 0&&(v=""+u),c.key!==void 0&&(v=""+c.key),"key"in c){u={};for(var g in c)g!=="key"&&(u[g]=c[g])}else u=c;return c=u.ref,{$$typeof:r,type:d,key:v,ref:c!==void 0?c:null,props:u}}return U.Fragment=a,U.jsx=s,U.jsxs=s,U}var H={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,14 +14,14 @@
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 ee;function ie(){return ee||(ee=1,process.env.NODE_ENV!=="production"&&function(){function r(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case C:return"Profiler";case q:return"StrictMode";case f:return"Suspense";case M:return"SuspenseList";case B: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 z:return"Portal";case G:return(e.displayName||"Context")+".Provider";case N:return(e._context.displayName||"Context")+".Consumer";case W:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case T:return n=e.displayName||null,n!==null?n:r(e.type)||"Memo";case k:n=e._payload,e=e._init;try{return r(e(n))}catch{}}return null}function o(e){return""+e}function s(e){try{o(e);var n=!1}catch{n=!0}if(n){n=console;var i=n.error,t=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),o(e)}}function d(e){if(e===S)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===k)return"<...>";try{var n=r(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function c(){var e=b.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function w(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 g(e,n){function i(){y||(y=!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))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function j(){var e=r(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 h(e,n,i,t,x,p,X,Z){return i=p.ref,e={$$typeof:I,type:e,key:n,props:p,_owner:x},(i!==void 0?i:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:j}):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 L(e,n,i,t,x,p,X,Z){var m=n.children;if(m!==void 0)if(t)if(R(m)){for(t=0;t<m.length;t++)E(m[t]);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 E(m);if(Y.call(n,"key")){m=r(e);var P=Object.keys(n).filter(function(oe){return oe!=="key"});t=0<P.length?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}",J[m+t]||(P=0<P.length?"{"+P.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var ee;function ie(){return ee||(ee=1,process.env.NODE_ENV!=="production"&&function(){function r(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case C:return"Profiler";case q:return"StrictMode";case f:return"Suspense";case M:return"SuspenseList";case B: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 z:return"Portal";case G:return(e.displayName||"Context")+".Provider";case O:return(e._context.displayName||"Context")+".Consumer";case W:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case T:return n=e.displayName||null,n!==null?n:r(e.type)||"Memo";case k:n=e._payload,e=e._init;try{return r(e(n))}catch{}}return null}function a(e){return""+e}function s(e){try{a(e);var n=!1}catch{n=!0}if(n){n=console;var i=n.error,t=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),a(e)}}function d(e){if(e===S)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===k)return"<...>";try{var n=r(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function c(){var e=b.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function v(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 g(e,n){function i(){y||(y=!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))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function j(){var e=r(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 h(e,n,i,t,x,w,X,Z){return i=w.ref,e={$$typeof:I,type:e,key:n,props:w,_owner:x},(i!==void 0?i:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:j}):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 L(e,n,i,t,x,w,X,Z){var p=n.children;if(p!==void 0)if(t)if(R(p)){for(t=0;t<p.length;t++)E(p[t]);Object.freeze&&Object.freeze(p)}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 E(p);if(Y.call(n,"key")){p=r(e);var P=Object.keys(n).filter(function(ae){return ae!=="key"});t=0<P.length?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}",J[p+t]||(P=0<P.length?"{"+P.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} />`,t,m,P,m),J[m+t]=!0)}if(m=null,i!==void 0&&(s(i),m=""+i),w(n)&&(s(n.key),m=""+n.key),"key"in n){i={};for(var Q in n)Q!=="key"&&(i[Q]=n[Q])}else i=n;return m&&g(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),h(e,m,p,x,c(),i,X,Z)}function E(e){typeof e=="object"&&e!==null&&e.$$typeof===I&&e._store&&(e._store.validated=1)}var v=l,I=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),G=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),_=Symbol.for("react.client.reference"),b=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,R=Array.isArray,O=console.createTask?console.createTask:function(){return null};v={"react-stack-bottom-frame":function(e){return e()}};var y,D={},A=v["react-stack-bottom-frame"].bind(v,u)(),F=O(d(u)),J={};H.Fragment=S,H.jsx=function(e,n,i,t,x){var p=1e4>b.recentlyCreatedOwnerStacks++;return L(e,n,i,!1,t,x,p?Error("react-stack-top-frame"):A,p?O(d(e)):F)},H.jsxs=function(e,n,i,t,x){var p=1e4>b.recentlyCreatedOwnerStacks++;return L(e,n,i,!0,t,x,p?Error("react-stack-top-frame"):A,p?O(d(e)):F)}}()),H}var te;function le(){return te||(te=1,process.env.NODE_ENV==="production"?V.exports=ce():V.exports=ie()),V.exports}var a=le();const ue=({type:r="button",value:o})=>a.jsx("button",{type:r,children:o}),fe=({type:r="text",placeholder:o,wrapperClass:s="",labelClass:d="",inputClass:c="",errorClass:u="",label:w,hasError:g,register:j,name:h,isDisabled:L=!1,autocomplete:E=!1,...v})=>a.jsxs("div",{className:s,children:[a.jsxs("label",{htmlFor:h,className:`${d} ${g&&"error"}`,children:[w,a.jsx("input",{disabled:L,autoComplete:E?"on":"off",id:h,...j,...v,type:r,name:h,className:`${c} ${g&&"error"} ${u}`,placeholder:o})]}),g&&a.jsx("p",{className:u,children:g})]}),re=r=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...r},$.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"})),de=r=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...r},$.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"})),ne=r=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",...r},$.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"})),ge=()=>{const[r,o]=l.useState(typeof window<"u"?window.innerWidth:0),s=()=>o(typeof window<"u"?window.innerWidth:0);return l.useEffect(()=>(window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)),[r]),r},ae=({classNames:r={wrapper:"",color:""}})=>a.jsxs("svg",{className:`nariaLoading ${r.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:r.color})]}),me=()=>{const r=`${window.location.pathname}${window.location.search}`;window.history.replaceState(null,"",r)},he=r=>{window.location.hash=r},pe=r=>{const[o,s]=l.useState(!1);return l.useEffect(()=>{const d=c=>{window.location.hash!==r?s(!0):s(!1)};return window.addEventListener("hashchange",d),()=>{window.removeEventListener("hashchange",d)}},[]),o},we=(r,o,s)=>{l.useEffect(()=>{function d(c){o.current&&!o.current.contains(c.target)&&r?.current&&!r?.current.contains(c.target)&&s()}return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[r,s])},ve=({options:r,label:o,hasError:s,title:d,value:c,api:u,selected:w,placeholder:g,disabled:j=!1,pagination:h,optionFilterLabel:L,hasSearch:E=!1,classNames:v={wrapper:"",label:"",title:"",button:"",input:""},onSelectChange:I})=>{let z=!0;const S=ge(),q=pe("#select"),[C,N]=l.useState(!1),[G,W]=l.useState(!0),[f,M]=l.useState(null),[T,k]=l.useState(null),[B,_]=l.useState(""),[b,Y]=l.useState({page:1,pageLabel:"page",size:20,sizeLabel:"size",isLoading:!1}),R=l.useRef(void 0),O=l.useRef(void 0),y=l.useRef(void 0),D=async()=>{if(R?.current)try{const t=await fetch(R?.current);if(!t.ok)throw new Error(`Response status: ${t.status}`);return await t.json()}catch(t){console.error(t.message)}};l.useEffect(()=>()=>{z=!1},[]),l.useEffect(()=>{if(u?.length){if(R.current=u,R.current.includes(h?.pageLabel||"page")){const t=new URL(u);t.searchParams.set(h?.pageLabel||"page",(h?.page||b.page).toString()),t.searchParams.set(h?.sizeLabel||"size",(h?.size||b.size).toString()),R.current=t.href}W(!0),D().then(t=>{z&&(W(!1),k(t))})}},[u,h]),l.useEffect(()=>{if(b.isLoading){if(R.current.includes(h?.pageLabel||"page")){const t=new URL(R.current);t.searchParams.set(h?.pageLabel||"page",b.page.toString()),R.current=t.href}D().then(t=>{z&&(W(!1),Y({...b,isLoading:!1}),k([...T,...t]))})}},[b]),l.useEffect(()=>{S<768&&(C?(he("select"),document.body.style.overflow="hidden",y.current?.focus()):(window.location.hash&&!document.referrer.includes("#")&&me(),document.body.style.overflow="auto"))},[C]),l.useEffect(()=>{w&&r?.length&&(r?.find(t=>t[o]===w)?M(r?.find(t=>t[o]===w)):M(w))},[w]),l.useEffect(()=>{f&&E&&(c?.length&&T?.find(t=>t[o]===f[o])?_(T?.find(t=>t[o]===f[o])[c]||""):_(f))},[f]),l.useEffect(()=>{q&&N(!1)},[q]),l.useEffect(()=>{r?.length&&k(r)},[r]);const A=()=>{E&&k(r),N(t=>!t)},F=()=>{E&&(k(r),_(typeof f=="string"?f:f?f[c]:"")),N(!1)},J=t=>{E&&(c?.length?_(t[c]):_(t)),M(t),A(),I&&I(t)},e=t=>{if(!f)return"";if(o?.length&&t[o]===f[o]||t===f)return"bg-grey-100"},n=t=>{u?.length&&T?.length&&!b.isLoading&&t.target.offsetHeight+t.target.scrollTop>=t.target.scrollHeight-100&&Y({page:b.page+1,isLoading:!0})},i=t=>{const x=t?.target?.value?.length?r.filter(p=>typeof p=="object"?p[L?.length?L:c].includes(t?.target?.value):p.includes(t?.target?.value)):r;k(x),_(t?.target?.value),C||N(!0)};return we(O,y,F),a.jsxs("div",{className:`nariaSelect ${j?"nariaSelect-disabled":""} ${v?.wrapper}`,children:[a.jsxs("label",{className:`cursor-pointer
22
+ <%s key={someKey} {...props} />`,t,p,P,p),J[p+t]=!0)}if(p=null,i!==void 0&&(s(i),p=""+i),v(n)&&(s(n.key),p=""+n.key),"key"in n){i={};for(var Q in n)Q!=="key"&&(i[Q]=n[Q])}else i=n;return p&&g(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),h(e,p,w,x,c(),i,X,Z)}function E(e){typeof e=="object"&&e!==null&&e.$$typeof===I&&e._store&&(e._store.validated=1)}var m=l,I=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),G=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),_=Symbol.for("react.client.reference"),b=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,R=Array.isArray,N=console.createTask?console.createTask:function(){return null};m={"react-stack-bottom-frame":function(e){return e()}};var y,D={},A=m["react-stack-bottom-frame"].bind(m,u)(),F=N(d(u)),J={};H.Fragment=S,H.jsx=function(e,n,i,t,x){var w=1e4>b.recentlyCreatedOwnerStacks++;return L(e,n,i,!1,t,x,w?Error("react-stack-top-frame"):A,w?N(d(e)):F)},H.jsxs=function(e,n,i,t,x){var w=1e4>b.recentlyCreatedOwnerStacks++;return L(e,n,i,!0,t,x,w?Error("react-stack-top-frame"):A,w?N(d(e)):F)}}()),H}var te;function le(){return te||(te=1,process.env.NODE_ENV==="production"?V.exports=ce():V.exports=ie()),V.exports}var o=le();const ue=({type:r="button",value:a})=>o.jsx("button",{type:r,children:a}),fe=({type:r="text",placeholder:a,wrapperClass:s="",labelClass:d="",inputClass:c="",errorClass:u="",label:v,hasError:g,register:j,name:h,isDisabled:L=!1,autocomplete:E=!1,...m})=>o.jsxs("div",{className:s,children:[o.jsxs("label",{htmlFor:h,className:`${d} ${g&&"error"}`,children:[v,o.jsx("input",{disabled:L,autoComplete:E?"on":"off",id:h,...j,...m,type:r,name:h,className:`${c} ${g&&"error"} ${u}`,placeholder:a})]}),g&&o.jsx("p",{className:u,children:g})]}),re=r=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...r},$.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"})),de=r=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...r},$.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"})),ne=r=>$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",...r},$.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"})),ge=()=>{const[r,a]=l.useState(typeof window<"u"?window.innerWidth:0),s=()=>a(typeof window<"u"?window.innerWidth:0);return l.useEffect(()=>(window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)),[r]),r},oe=({classNames:r={wrapper:"",color:""}})=>o.jsxs("svg",{className:`nariaLoading ${r.wrapper}`,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.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"}),o.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:r.color})]}),me=()=>{const r=`${window.location.pathname}${window.location.search}`;window.history.replaceState(null,"",r)},pe=r=>{window.location.hash=r},he=r=>{const[a,s]=l.useState(!1);return l.useEffect(()=>{const d=c=>{window.location.hash!==r?s(!0):s(!1)};return window.addEventListener("hashchange",d),()=>{window.removeEventListener("hashchange",d)}},[]),a},we=(r,a,s)=>{l.useEffect(()=>{function d(c){a.current&&!a.current.contains(c.target)&&r?.current&&!r?.current.contains(c.target)&&s()}return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[r,s])},ve=({options:r,label:a,hasError:s,title:d,value:c,api:u,selected:v,placeholder:g,disabled:j=!1,pagination:h,optionFilterLabel:L,hasSearch:E=!1,classNames:m={wrapper:"",label:"",title:"",button:"",input:"",listWrapper:"",list:"",option:""},onSelectChange:I})=>{let z=!0;const S=ge(),q=he("#select"),[C,O]=l.useState(!1),[G,W]=l.useState(!0),[f,M]=l.useState(null),[T,k]=l.useState(null),[B,_]=l.useState(""),[b,Y]=l.useState({page:1,pageLabel:"page",size:20,sizeLabel:"size",isLoading:!1}),R=l.useRef(void 0),N=l.useRef(void 0),y=l.useRef(void 0),D=async()=>{if(R?.current)try{const t=await fetch(R?.current);if(!t.ok)throw new Error(`Response status: ${t.status}`);return await t.json()}catch(t){console.error(t.message)}};l.useEffect(()=>()=>{z=!1},[]),l.useEffect(()=>{if(u?.length){if(R.current=u,R.current.includes(h?.pageLabel||"page")){const t=new URL(u);t.searchParams.set(h?.pageLabel||"page",(h?.page||b.page).toString()),t.searchParams.set(h?.sizeLabel||"size",(h?.size||b.size).toString()),R.current=t.href}W(!0),D().then(t=>{z&&(W(!1),k(t))})}},[u,h]),l.useEffect(()=>{if(b.isLoading){if(R.current.includes(h?.pageLabel||"page")){const t=new URL(R.current);t.searchParams.set(h?.pageLabel||"page",b.page.toString()),R.current=t.href}D().then(t=>{z&&(W(!1),Y({...b,isLoading:!1}),k([...T,...t]))})}},[b]),l.useEffect(()=>{S<768&&(C?(pe("select"),document.body.style.overflow="hidden",y.current?.focus()):(window.location.hash&&!document.referrer.includes("#")&&me(),document.body.style.overflow="auto"))},[C]),l.useEffect(()=>{v&&r?.length&&(r?.find(t=>t[a]===v)?M(r?.find(t=>t[a]===v)):M(v))},[v]),l.useEffect(()=>{f&&E&&(c?.length&&T?.find(t=>t[a]===f[a])?_(T?.find(t=>t[a]===f[a])[c]||""):_(f))},[f]),l.useEffect(()=>{q&&O(!1)},[q]),l.useEffect(()=>{r?.length&&k(r)},[r]);const A=()=>{E&&k(r),O(t=>!t)},F=()=>{E&&(k(r),_(typeof f=="string"?f:f?f[c]:"")),O(!1)},J=t=>{E&&(c?.length?_(t[c]):_(t)),M(t),A(),I&&I(t)},e=t=>{if(!f)return"";if(a?.length&&t[a]===f[a]||t===f)return"bg-grey-100"},n=t=>{u?.length&&T?.length&&!b.isLoading&&t.target.offsetHeight+t.target.scrollTop>=t.target.scrollHeight-100&&Y({page:b.page+1,isLoading:!0})},i=t=>{const x=t?.target?.value?.length?r.filter(w=>typeof w=="object"?w[L?.length?L:c].includes(t?.target?.value):w.includes(t?.target?.value)):r;k(x),_(t?.target?.value),C||O(!0)};return we(N,y,F),o.jsxs("div",{className:`nariaSelect ${j?"nariaSelect-disabled":""} ${m?.wrapper}`,children:[o.jsxs("label",{className:`cursor-pointer
23
23
  ${s&&"!text-danger-100"}
24
- ${v?.label}`,children:[a.jsx("span",{className:v?.title,children:d}),E?a.jsxs("div",{className:"nariaSearchInput",children:[a.jsx("input",{ref:y,placeholder:g?.length?g:"Select",className:`${f?"text-dark-100":"text-grey-300"}
25
- ${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${v?.input}`,value:B,disabled:j,type:"text",onClick:A,onChange:i}),C?a.jsx(ne,{className:"nariaSearchIcon"}):a.jsx(re,{className:`nariaArrowIcon ${C?"nariaArrowIcon-rotate-180":""}`})]}):a.jsxs("button",{type:"button",ref:y,disabled:j,className:`nariaHandler ${f?"text-dark-100":"text-grey-300"}
26
- ${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${v?.button}`,onClick:A,children:[f?c?.length?f[c]:f:g?.length?g:"Select"," ",a.jsx(re,{className:`nariaArrowIcon ${C?"nariaArrowIcon-rotate-180":""}`})]})]}),C?a.jsxs("div",{className:`nariaListWrapper ${S<768?"nariaListWrapper-mobile":""}`,ref:O,children:[E&&S<768?a.jsxs("div",{className:"nariaSearchInput",children:[a.jsx("input",{ref:y,placeholder:g?.length?g:"Select",className:`${f?"text-dark-100":"text-grey-300"}
27
- ${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${v?.input}`,value:B,disabled:j,type:"text",onChange:i}),a.jsx(ne,{className:"nariaSearchIcon"})]}):void 0,a.jsx("div",{className:`nariaList ${S<768?"nariaList-mobile":"nariaList-desktop"}`,onScroll:n,children:u&&G?a.jsx("div",{className:"nariaLoadingWrapper",children:a.jsx(ae,{})}):a.jsxs(a.Fragment,{children:[S<768?a.jsx("div",{className:"sticky top-0 text-left",children:a.jsx("button",{className:"p-3",onClick:F,disabled:j,children:a.jsx(de,{className:"w-6"})})}):void 0,T?.length?a.jsx(a.Fragment,{children:T?.map((t,x)=>a.jsx("button",{type:"button",onClick:()=>J(t),disabled:j,className:`text-right py-2.5 px-4 text-base hover:bg-grey-100 rounded-lg ${e(t)}`,children:c?.length?t[c]:t},x.toString()))}):a.jsx("div",{children:"No Data"}),b.isLoading?a.jsx("div",{className:"nariaLoadingMoreWrapper",children:a.jsx(ae,{})}):void 0]})})]}):void 0,s&&a.jsx("p",{className:"text-xs mt-1 text-danger-100",children:s})]})};function be(r){return r.charAt(0).toUpperCase()+r.slice(1)}exports.Button=ue;exports.Input=fe;exports.Select=ve;exports.capitalize=be;
24
+ ${m?.label}`,children:[o.jsx("span",{className:m?.title,children:d}),E?o.jsxs("div",{className:"nariaSearchInput",children:[o.jsx("input",{ref:y,placeholder:g?.length?g:"Select",className:`${f?"text-dark-100":"text-grey-300"}
25
+ ${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${m?.input}`,value:B,disabled:j,type:"text",onClick:A,onChange:i}),C?o.jsx(ne,{className:"nariaSearchIcon"}):o.jsx(re,{className:`nariaArrowIcon ${C?"nariaArrowIcon-rotate-180":""}`})]}):o.jsxs("button",{type:"button",ref:y,disabled:j,className:`nariaHandler ${f?"text-dark-100":"text-grey-300"}
26
+ ${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${m?.button}`,onClick:A,children:[f?c?.length?f[c]:f:g?.length?g:"Select"," ",o.jsx(re,{className:`nariaArrowIcon ${C?"nariaArrowIcon-rotate-180":""}`})]})]}),C?o.jsxs("div",{className:`nariaListWrapper ${S<768?"nariaListWrapper-mobile":""} ${m?.listWrapper}`,ref:N,children:[E&&S<768?o.jsxs("div",{className:"nariaSearchInput",children:[o.jsx("input",{ref:y,placeholder:g?.length?g:"Select",className:`${f?"text-dark-100":"text-grey-300"}
27
+ ${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${m?.input}`,value:B,disabled:j,type:"text",onChange:i}),o.jsx(ne,{className:"nariaSearchIcon"})]}):void 0,o.jsx("div",{className:`nariaList ${S<768?"nariaList-mobile":"nariaList-desktop"} ${m?.list}`,onScroll:n,children:u&&G?o.jsx("div",{className:"nariaLoadingWrapper",children:o.jsx(oe,{})}):o.jsxs(o.Fragment,{children:[S<768?o.jsx("div",{className:"sticky top-0 text-left",children:o.jsx("button",{className:"p-3",onClick:F,disabled:j,children:o.jsx(de,{className:"w-6"})})}):void 0,T?.length?o.jsx(o.Fragment,{children:T?.map((t,x)=>o.jsx("button",{type:"button",onClick:()=>J(t),disabled:j,className:`${m?.option} ${e(t)}`,children:c?.length?t[c]:t},x.toString()))}):o.jsx("div",{children:"No Data"}),b.isLoading?o.jsx("div",{className:"nariaLoadingMoreWrapper",children:o.jsx(oe,{})}):void 0]})})]}):void 0,s&&o.jsx("p",{className:"text-xs mt-1 text-danger-100",children:s})]})};function be(r){return r.charAt(0).toUpperCase()+r.slice(1)}exports.Button=ue;exports.Input=fe;exports.Select=ve;exports.capitalize=be;
package/dist/naria-ui.css CHANGED
@@ -1 +1 @@
1
- .nariaLoading{animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.nariaSelect{position:relative}.nariaSelect .nariaListWrapper{overflow:hidden}.nariaSelect .nariaListWrapper.nariaListWrapper-mobile{position:fixed;top:0;right:0;height:100%;width:100%;z-index:97}.nariaSelect .nariaList{display:flex;flex-direction:column;width:100%;z-index:99;position:relative;overflow:auto}.nariaSelect .nariaList.nariaList-mobile{position:relative;height:100%}.nariaSelect .nariaList.nariaList-desktop{position:absolute;animation:fadeInTranslateY .3s ease-out forwards;max-height:100px}.nariaSelect .nariaList .nariaLoadingWrapper{padding:24px 0;display:flex;justify-content:center}.nariaSelect .nariaList .nariaLoadingMoreWrapper{position:sticky;bottom:0;text-align:center;width:100%}.nariaSelect .nariaList .nariaLoadingMoreWrapper .nariaLoading{width:20px}.nariaSelect .nariaSearchInput{position:relative;display:flex}.nariaSelect .nariaSearchInput input{width:100%;padding-right:20px}.nariaSelect .nariaSearchInput .nariaArrowIcon,.nariaSelect .nariaSearchInput .nariaSearchIcon{position:absolute;bottom:0;margin-top:auto;margin-bottom:auto;top:0;right:6px;width:12px;height:12px}.nariaSelect .nariaHandler{position:relative;display:flex;gap:4px;width:100%;align-items:center;justify-content:space-between}.nariaSelect .nariaHandler .nariaArrowIcon{width:12px;height:12px;transition:transform .4s;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0)}.nariaSelect .nariaHandler .nariaArrowIcon.nariaArrowIcon-rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}html[dir=rtl] .nariaSelect .nariaSearchInput input{padding-left:20px;padding-right:0}html[dir=rtl] .nariaSelect .nariaSearchInput .nariaArrowIcon,html[dir=rtl] .nariaSelect .nariaSearchInput .nariaSearchIcon{left:6px;right:auto}@keyframes fadeInTranslateY{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
1
+ .nariaLoading{animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.nariaSelect{position:relative}.nariaSelect .nariaListWrapper{overflow:hidden}.nariaSelect .nariaListWrapper.nariaListWrapper-mobile{position:fixed;top:0;right:0;height:100%;width:100%;z-index:97}.nariaSelect .nariaList{display:flex;flex-direction:column;width:100%;z-index:99;position:relative;overflow:auto}.nariaSelect .nariaList.nariaList-mobile{position:relative;height:100%}.nariaSelect .nariaList.nariaList-desktop{position:absolute;animation:fadeInTranslateY .3s ease-out forwards;max-height:100px}.nariaSelect .nariaList .nariaLoadingWrapper{padding:24px 0;display:flex;justify-content:center}.nariaSelect .nariaList .nariaLoadingMoreWrapper{position:sticky;bottom:0;text-align:center;width:100%}.nariaSelect .nariaList .nariaLoadingMoreWrapper .nariaLoading{width:20px}.nariaSelect .nariaSearchInput{position:relative;display:flex}.nariaSelect .nariaSearchInput input{width:100%}.nariaSelect .nariaSearchInput .nariaArrowIcon,.nariaSelect .nariaSearchInput .nariaSearchIcon{position:absolute;bottom:0;margin-top:auto;margin-bottom:auto;top:0;right:0;width:12px;height:12px;z-index:1}.nariaSelect .nariaHandler{position:relative;display:flex;gap:4px;width:100%;align-items:center;justify-content:space-between}.nariaSelect .nariaHandler .nariaArrowIcon{width:12px;height:12px;transition:transform .4s;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0)}.nariaSelect .nariaHandler .nariaArrowIcon.nariaArrowIcon-rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}html[dir=rtl] .nariaSelect .nariaSearchInput .nariaArrowIcon,html[dir=rtl] .nariaSelect .nariaSearchInput .nariaSearchIcon{left:0;right:auto}@keyframes fadeInTranslateY{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@@ -1,5 +1,5 @@
1
1
  import * as I from "react";
2
- import ie, { useState as y, useEffect as E, useRef as ee } from "react";
2
+ import ce, { useState as y, useEffect as E, useRef as ee } from "react";
3
3
  var G = { exports: {} }, H = {};
4
4
  /**
5
5
  * @license React
@@ -14,23 +14,23 @@ var re;
14
14
  function le() {
15
15
  if (re) return H;
16
16
  re = 1;
17
- var t = Symbol.for("react.transitional.element"), c = Symbol.for("react.fragment");
18
- function i(g, a, l) {
19
- var p = null;
20
- if (l !== void 0 && (p = "" + l), a.key !== void 0 && (p = "" + a.key), "key" in a) {
17
+ var t = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment");
18
+ function c(m, a, l) {
19
+ var w = null;
20
+ if (l !== void 0 && (w = "" + l), a.key !== void 0 && (w = "" + a.key), "key" in a) {
21
21
  l = {};
22
22
  for (var d in a)
23
23
  d !== "key" && (l[d] = a[d]);
24
24
  } else l = a;
25
25
  return a = l.ref, {
26
26
  $$typeof: t,
27
- type: g,
28
- key: p,
27
+ type: m,
28
+ key: w,
29
29
  ref: a !== void 0 ? a : null,
30
30
  props: l
31
31
  };
32
32
  }
33
- return H.Fragment = c, H.jsx = i, H.jsxs = i, H;
33
+ return H.Fragment = i, H.jsx = c, H.jsxs = c, H;
34
34
  }
35
35
  var J = {};
36
36
  /**
@@ -68,7 +68,7 @@ function ue() {
68
68
  switch (typeof e.tag == "number" && console.error(
69
69
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
70
70
  ), e.$$typeof) {
71
- case W:
71
+ case z:
72
72
  return "Portal";
73
73
  case X:
74
74
  return (e.displayName || "Context") + ".Provider";
@@ -88,12 +88,12 @@ function ue() {
88
88
  }
89
89
  return null;
90
90
  }
91
- function c(e) {
91
+ function i(e) {
92
92
  return "" + e;
93
93
  }
94
- function i(e) {
94
+ function c(e) {
95
95
  try {
96
- c(e);
96
+ i(e);
97
97
  var n = !1;
98
98
  } catch {
99
99
  n = !0;
@@ -105,10 +105,10 @@ function ue() {
105
105
  n,
106
106
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
107
107
  r
108
- ), c(e);
108
+ ), i(e);
109
109
  }
110
110
  }
111
- function g(e) {
111
+ function m(e) {
112
112
  if (e === C) return "<>";
113
113
  if (typeof e == "object" && e !== null && e.$$typeof === _)
114
114
  return "<...>";
@@ -126,7 +126,7 @@ function ue() {
126
126
  function l() {
127
127
  return Error("react-stack-top-frame");
128
128
  }
129
- function p(e) {
129
+ function w(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;
@@ -151,12 +151,12 @@ function ue() {
151
151
  "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."
152
152
  )), e = this.props.ref, e !== void 0 ? e : null;
153
153
  }
154
- function m(e, n, s, r, x, h, Z, Q) {
155
- return s = h.ref, e = {
156
- $$typeof: z,
154
+ function h(e, n, s, r, x, p, Z, Q) {
155
+ return s = p.ref, e = {
156
+ $$typeof: W,
157
157
  type: e,
158
158
  key: n,
159
- props: h,
159
+ props: p,
160
160
  _owner: x
161
161
  }, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
162
162
  enumerable: !1,
@@ -183,25 +183,25 @@ function ue() {
183
183
  value: Q
184
184
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
185
  }
186
- function N(e, n, s, r, x, h, Z, Q) {
187
- var f = n.children;
188
- if (f !== void 0)
186
+ function N(e, n, s, r, x, p, Z, Q) {
187
+ var g = n.children;
188
+ if (g !== void 0)
189
189
  if (r)
190
- if (j(f)) {
191
- for (r = 0; r < f.length; r++)
192
- b(f[r]);
193
- Object.freeze && Object.freeze(f);
190
+ if (j(g)) {
191
+ for (r = 0; r < g.length; r++)
192
+ b(g[r]);
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 b(f);
198
+ else b(g);
199
199
  if (D.call(n, "key")) {
200
- f = t(e);
201
- var $ = Object.keys(n).filter(function(ce) {
202
- return ce !== "key";
200
+ g = t(e);
201
+ var $ = Object.keys(n).filter(function(ie) {
202
+ return ie !== "key";
203
203
  });
204
- r = 0 < $.length ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}", V[f + r] || ($ = 0 < $.length ? "{" + $.join(": ..., ") + ": ...}" : "{}", console.error(
204
+ r = 0 < $.length ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}", V[g + r] || ($ = 0 < $.length ? "{" + $.join(": ..., ") + ": ...}" : "{}", console.error(
205
205
  `A props object containing a "key" prop is being spread into JSX:
206
206
  let props = %s;
207
207
  <%s {...props} />
@@ -209,23 +209,23 @@ React keys must be passed directly to JSX without using spread:
209
209
  let props = %s;
210
210
  <%s key={someKey} {...props} />`,
211
211
  r,
212
- f,
212
+ g,
213
213
  $,
214
- f
215
- ), V[f + r] = !0);
214
+ g
215
+ ), V[g + r] = !0);
216
216
  }
217
- if (f = null, s !== void 0 && (i(s), f = "" + s), p(n) && (i(n.key), f = "" + n.key), "key" in n) {
217
+ if (g = null, s !== void 0 && (c(s), g = "" + s), w(n) && (c(n.key), g = "" + n.key), "key" in n) {
218
218
  s = {};
219
219
  for (var K in n)
220
220
  K !== "key" && (s[K] = n[K]);
221
221
  } else s = n;
222
- return f && d(
222
+ return g && d(
223
223
  s,
224
224
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
225
- ), m(
225
+ ), h(
226
226
  e,
227
- f,
228
- h,
227
+ g,
228
+ p,
229
229
  x,
230
230
  a(),
231
231
  s,
@@ -234,22 +234,22 @@ React keys must be passed directly to JSX without using spread:
234
234
  );
235
235
  }
236
236
  function b(e) {
237
- typeof e == "object" && e !== null && e.$$typeof === z && e._store && (e._store.validated = 1);
237
+ typeof e == "object" && e !== null && e.$$typeof === W && e._store && (e._store.validated = 1);
238
238
  }
239
- var w = ie, z = Symbol.for("react.transitional.element"), W = Symbol.for("react.portal"), C = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), k = Symbol.for("react.profiler"), A = 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"), T = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), B = Symbol.for("react.activity"), S = Symbol.for("react.client.reference"), v = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, j = Array.isArray, O = console.createTask ? console.createTask : function() {
239
+ var f = ce, W = Symbol.for("react.transitional.element"), z = Symbol.for("react.portal"), C = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), k = Symbol.for("react.profiler"), A = 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"), T = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), B = Symbol.for("react.activity"), S = Symbol.for("react.client.reference"), v = f.__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
- w = {
242
+ f = {
243
243
  "react-stack-bottom-frame": function(e) {
244
244
  return e();
245
245
  }
246
246
  };
247
- var L, F = {}, P = w["react-stack-bottom-frame"].bind(
248
- w,
247
+ var L, F = {}, P = f["react-stack-bottom-frame"].bind(
248
+ f,
249
249
  l
250
- )(), U = O(g(l)), V = {};
250
+ )(), U = O(m(l)), V = {};
251
251
  J.Fragment = C, J.jsx = function(e, n, s, r, x) {
252
- var h = 1e4 > v.recentlyCreatedOwnerStacks++;
252
+ var p = 1e4 > v.recentlyCreatedOwnerStacks++;
253
253
  return N(
254
254
  e,
255
255
  n,
@@ -257,11 +257,11 @@ React keys must be passed directly to JSX without using spread:
257
257
  !1,
258
258
  r,
259
259
  x,
260
- h ? Error("react-stack-top-frame") : P,
261
- h ? O(g(e)) : U
260
+ p ? Error("react-stack-top-frame") : P,
261
+ p ? O(m(e)) : U
262
262
  );
263
263
  }, J.jsxs = function(e, n, s, r, x) {
264
- var h = 1e4 > v.recentlyCreatedOwnerStacks++;
264
+ var p = 1e4 > v.recentlyCreatedOwnerStacks++;
265
265
  return N(
266
266
  e,
267
267
  n,
@@ -269,8 +269,8 @@ React keys must be passed directly to JSX without using spread:
269
269
  !0,
270
270
  r,
271
271
  x,
272
- h ? Error("react-stack-top-frame") : P,
273
- h ? O(g(e)) : U
272
+ p ? Error("react-stack-top-frame") : P,
273
+ p ? O(m(e)) : U
274
274
  );
275
275
  };
276
276
  }()), J;
@@ -280,40 +280,40 @@ function de() {
280
280
  return ne || (ne = 1, process.env.NODE_ENV === "production" ? G.exports = le() : G.exports = ue()), G.exports;
281
281
  }
282
282
  var o = de();
283
- const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button", { type: t, children: c }), be = ({
283
+ const xe = ({ type: t = "button", value: i }) => /* @__PURE__ */ o.jsx("button", { type: t, children: i }), be = ({
284
284
  type: t = "text",
285
- placeholder: c,
286
- wrapperClass: i = "",
287
- labelClass: g = "",
285
+ placeholder: i,
286
+ wrapperClass: c = "",
287
+ labelClass: m = "",
288
288
  inputClass: a = "",
289
289
  errorClass: l = "",
290
- label: p,
290
+ label: w,
291
291
  hasError: d,
292
292
  register: R,
293
- name: m,
293
+ name: h,
294
294
  isDisabled: N = !1,
295
295
  autocomplete: b = !1,
296
- ...w
297
- }) => /* @__PURE__ */ o.jsxs("div", { className: i, children: [
296
+ ...f
297
+ }) => /* @__PURE__ */ o.jsxs("div", { className: c, children: [
298
298
  /* @__PURE__ */ o.jsxs(
299
299
  "label",
300
300
  {
301
- htmlFor: m,
302
- className: `${g} ${d && "error"}`,
301
+ htmlFor: h,
302
+ className: `${m} ${d && "error"}`,
303
303
  children: [
304
- p,
304
+ w,
305
305
  /* @__PURE__ */ o.jsx(
306
306
  "input",
307
307
  {
308
308
  disabled: N,
309
309
  autoComplete: b ? "on" : "off",
310
- id: m,
310
+ id: h,
311
311
  ...R,
312
- ...w,
312
+ ...f,
313
313
  type: t,
314
- name: m,
314
+ name: h,
315
315
  className: `${a} ${d && "error"} ${l}`,
316
- placeholder: c
316
+ placeholder: i
317
317
  }
318
318
  )
319
319
  ]
@@ -321,8 +321,8 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
321
321
  ),
322
322
  d && /* @__PURE__ */ o.jsx("p", { className: l, children: d })
323
323
  ] }), oe = (t) => /* @__PURE__ */ I.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", fill: "currentColor", ...t }, /* @__PURE__ */ I.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) => /* @__PURE__ */ I.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", fill: "currentColor", ...t }, /* @__PURE__ */ I.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) => /* @__PURE__ */ I.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", fill: "currentColor", ...t }, /* @__PURE__ */ I.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" })), ge = () => {
324
- const [t, c] = y(typeof window < "u" ? window.innerWidth : 0), i = () => c(typeof window < "u" ? window.innerWidth : 0);
325
- return E(() => (window.addEventListener("resize", i), () => window.removeEventListener("resize", i)), [t]), t;
324
+ const [t, i] = y(typeof window < "u" ? window.innerWidth : 0), c = () => i(typeof window < "u" ? window.innerWidth : 0);
325
+ return E(() => (window.addEventListener("resize", c), () => window.removeEventListener("resize", c)), [t]), t;
326
326
  }, se = ({
327
327
  classNames: t = {
328
328
  wrapper: "",
@@ -365,47 +365,50 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
365
365
  }, he = (t) => {
366
366
  window.location.hash = t;
367
367
  }, pe = (t) => {
368
- const [c, i] = y(!1);
368
+ const [i, c] = y(!1);
369
369
  return E(() => {
370
- const g = (a) => {
371
- window.location.hash !== t ? i(!0) : i(!1);
370
+ const m = (a) => {
371
+ window.location.hash !== t ? c(!0) : c(!1);
372
372
  };
373
- return window.addEventListener("hashchange", g), () => {
374
- window.removeEventListener("hashchange", g);
373
+ return window.addEventListener("hashchange", m), () => {
374
+ window.removeEventListener("hashchange", m);
375
375
  };
376
- }, []), c;
377
- }, we = (t, c, i) => {
376
+ }, []), i;
377
+ }, we = (t, i, c) => {
378
378
  E(() => {
379
- function g(a) {
380
- c.current && !c.current.contains(a.target) && t?.current && !t?.current.contains(a.target) && i();
379
+ function m(a) {
380
+ i.current && !i.current.contains(a.target) && t?.current && !t?.current.contains(a.target) && c();
381
381
  }
382
- return document.addEventListener("mousedown", g), () => {
383
- document.removeEventListener("mousedown", g);
382
+ return document.addEventListener("mousedown", m), () => {
383
+ document.removeEventListener("mousedown", m);
384
384
  };
385
- }, [t, i]);
385
+ }, [t, c]);
386
386
  }, Ee = ({
387
387
  options: t,
388
- label: c,
389
- hasError: i,
390
- title: g,
388
+ label: i,
389
+ hasError: c,
390
+ title: m,
391
391
  value: a,
392
392
  api: l,
393
- selected: p,
393
+ selected: w,
394
394
  placeholder: d,
395
395
  disabled: R = !1,
396
- pagination: m,
396
+ pagination: h,
397
397
  optionFilterLabel: N,
398
398
  hasSearch: b = !1,
399
- classNames: w = {
399
+ classNames: f = {
400
400
  wrapper: "",
401
401
  label: "",
402
402
  title: "",
403
403
  button: "",
404
- input: ""
404
+ input: "",
405
+ listWrapper: "",
406
+ list: "",
407
+ option: ""
405
408
  },
406
- onSelectChange: z
409
+ onSelectChange: W
407
410
  }) => {
408
- let W = !0;
411
+ let z = !0;
409
412
  const C = ge(), q = pe("#select"), [k, A] = y(!1), [X, Y] = y(!0), [u, M] = y(null), [T, _] = y(null), [B, S] = y(""), [v, D] = y({
410
413
  page: 1,
411
414
  pageLabel: "page",
@@ -424,25 +427,25 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
424
427
  }
425
428
  };
426
429
  E(() => () => {
427
- W = !1;
430
+ z = !1;
428
431
  }, []), E(() => {
429
432
  if (l?.length) {
430
- if (j.current = l, j.current.includes(m?.pageLabel || "page")) {
433
+ if (j.current = l, j.current.includes(h?.pageLabel || "page")) {
431
434
  const r = new URL(l);
432
- r.searchParams.set(m?.pageLabel || "page", (m?.page || v.page).toString()), r.searchParams.set(m?.sizeLabel || "size", (m?.size || v.size).toString()), j.current = r.href;
435
+ r.searchParams.set(h?.pageLabel || "page", (h?.page || v.page).toString()), r.searchParams.set(h?.sizeLabel || "size", (h?.size || v.size).toString()), j.current = r.href;
433
436
  }
434
437
  Y(!0), F().then((r) => {
435
- W && (Y(!1), _(r));
438
+ z && (Y(!1), _(r));
436
439
  });
437
440
  }
438
- }, [l, m]), E(() => {
441
+ }, [l, h]), E(() => {
439
442
  if (v.isLoading) {
440
- if (j.current.includes(m?.pageLabel || "page")) {
443
+ if (j.current.includes(h?.pageLabel || "page")) {
441
444
  const r = new URL(j.current);
442
- r.searchParams.set(m?.pageLabel || "page", v.page.toString()), j.current = r.href;
445
+ r.searchParams.set(h?.pageLabel || "page", v.page.toString()), j.current = r.href;
443
446
  }
444
447
  F().then((r) => {
445
- W && (Y(!1), D({
448
+ z && (Y(!1), D({
446
449
  ...v,
447
450
  isLoading: !1
448
451
  }), _([
@@ -454,9 +457,9 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
454
457
  }, [v]), E(() => {
455
458
  C < 768 && (k ? (he("select"), document.body.style.overflow = "hidden", L.current?.focus()) : (window.location.hash && !document.referrer.includes("#") && me(), document.body.style.overflow = "auto"));
456
459
  }, [k]), E(() => {
457
- p && t?.length && (t?.find((r) => r[c] === p) ? M(t?.find((r) => r[c] === p)) : M(p));
458
- }, [p]), E(() => {
459
- u && b && (a?.length && T?.find((r) => r[c] === u[c]) ? S(T?.find((r) => r[c] === u[c])[a] || "") : S(u));
460
+ w && t?.length && (t?.find((r) => r[i] === w) ? M(t?.find((r) => r[i] === w)) : M(w));
461
+ }, [w]), E(() => {
462
+ u && b && (a?.length && T?.find((r) => r[i] === u[i]) ? S(T?.find((r) => r[i] === u[i])[a] || "") : S(u));
460
463
  }, [u]), E(() => {
461
464
  q && A(!1);
462
465
  }, [q]), E(() => {
@@ -467,11 +470,11 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
467
470
  }, U = () => {
468
471
  b && (_(t), S(typeof u == "string" ? u : u ? u[a] : "")), A(!1);
469
472
  }, V = (r) => {
470
- b && (a?.length ? S(r[a]) : S(r)), M(r), P(), z && z(r);
473
+ b && (a?.length ? S(r[a]) : S(r)), M(r), P(), W && W(r);
471
474
  }, e = (r) => {
472
475
  if (!u)
473
476
  return "";
474
- if (c?.length && r[c] === u[c] || r === u)
477
+ if (i?.length && r[i] === u[i] || r === u)
475
478
  return "bg-grey-100";
476
479
  }, n = (r) => {
477
480
  l?.length && T?.length && !v.isLoading && r.target.offsetHeight + r.target.scrollTop >= r.target.scrollHeight - 100 && D({
@@ -479,18 +482,18 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
479
482
  isLoading: !0
480
483
  });
481
484
  }, s = (r) => {
482
- const x = r?.target?.value?.length ? t.filter((h) => typeof h == "object" ? h[N?.length ? N : a].includes(r?.target?.value) : h.includes(r?.target?.value)) : t;
485
+ const x = r?.target?.value?.length ? t.filter((p) => typeof p == "object" ? p[N?.length ? N : a].includes(r?.target?.value) : p.includes(r?.target?.value)) : t;
483
486
  _(x), S(r?.target?.value), k || A(!0);
484
487
  };
485
- return we(O, L, U), /* @__PURE__ */ o.jsxs("div", { className: `nariaSelect ${R ? "nariaSelect-disabled" : ""} ${w?.wrapper}`, children: [
488
+ return we(O, L, U), /* @__PURE__ */ o.jsxs("div", { className: `nariaSelect ${R ? "nariaSelect-disabled" : ""} ${f?.wrapper}`, children: [
486
489
  /* @__PURE__ */ o.jsxs(
487
490
  "label",
488
491
  {
489
492
  className: `cursor-pointer
490
- ${i && "!text-danger-100"}
491
- ${w?.label}`,
493
+ ${c && "!text-danger-100"}
494
+ ${f?.label}`,
492
495
  children: [
493
- /* @__PURE__ */ o.jsx("span", { className: w?.title, children: g }),
496
+ /* @__PURE__ */ o.jsx("span", { className: f?.title, children: m }),
494
497
  b ? /* @__PURE__ */ o.jsxs("div", { className: "nariaSearchInput", children: [
495
498
  /* @__PURE__ */ o.jsx(
496
499
  "input",
@@ -498,7 +501,7 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
498
501
  ref: L,
499
502
  placeholder: d?.length ? d : "Select",
500
503
  className: `${u ? "text-dark-100" : "text-grey-300"}
501
- ${i && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${w?.input}`,
504
+ ${c && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${f?.input}`,
502
505
  value: B,
503
506
  disabled: R,
504
507
  type: "text",
@@ -524,7 +527,7 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
524
527
  ref: L,
525
528
  disabled: R,
526
529
  className: `nariaHandler ${u ? "text-dark-100" : "text-grey-300"}
527
- ${i && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${w?.button}`,
530
+ ${c && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${f?.button}`,
528
531
  onClick: P,
529
532
  children: [
530
533
  u ? a?.length ? u[a] : u : d?.length ? d : "Select",
@@ -544,7 +547,7 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
544
547
  k ? /* @__PURE__ */ o.jsxs(
545
548
  "div",
546
549
  {
547
- className: `nariaListWrapper ${C < 768 ? "nariaListWrapper-mobile" : ""}`,
550
+ className: `nariaListWrapper ${C < 768 ? "nariaListWrapper-mobile" : ""} ${f?.listWrapper}`,
548
551
  ref: O,
549
552
  children: [
550
553
  b && C < 768 ? /* @__PURE__ */ o.jsxs("div", { className: "nariaSearchInput", children: [
@@ -554,7 +557,7 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
554
557
  ref: L,
555
558
  placeholder: d?.length ? d : "Select",
556
559
  className: `${u ? "text-dark-100" : "text-grey-300"}
557
- ${i && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${w?.input}`,
560
+ ${c && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${f?.input}`,
558
561
  value: B,
559
562
  disabled: R,
560
563
  type: "text",
@@ -571,7 +574,7 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
571
574
  /* @__PURE__ */ o.jsx(
572
575
  "div",
573
576
  {
574
- className: `nariaList ${C < 768 ? "nariaList-mobile" : "nariaList-desktop"}`,
577
+ className: `nariaList ${C < 768 ? "nariaList-mobile" : "nariaList-desktop"} ${f?.list}`,
575
578
  onScroll: n,
576
579
  children: l && X ? /* @__PURE__ */ o.jsx("div", { className: "nariaLoadingWrapper", children: /* @__PURE__ */ o.jsx(se, {}) }) : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
577
580
  C < 768 ? /* @__PURE__ */ o.jsx("div", { className: "sticky top-0 text-left", children: /* @__PURE__ */ o.jsx("button", { className: "p-3", onClick: U, disabled: R, children: /* @__PURE__ */ o.jsx(fe, { className: "w-6" }) }) }) : void 0,
@@ -581,7 +584,7 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
581
584
  type: "button",
582
585
  onClick: () => V(r),
583
586
  disabled: R,
584
- className: `text-right py-2.5 px-4 text-base hover:bg-grey-100 rounded-lg ${e(r)}`,
587
+ className: `${f?.option} ${e(r)}`,
585
588
  children: a?.length ? r[a] : r
586
589
  },
587
590
  x.toString()
@@ -593,7 +596,7 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
593
596
  ]
594
597
  }
595
598
  ) : void 0,
596
- i && /* @__PURE__ */ o.jsx("p", { className: "text-xs mt-1 text-danger-100", children: i })
599
+ c && /* @__PURE__ */ o.jsx("p", { className: "text-xs mt-1 text-danger-100", children: c })
597
600
  ] });
598
601
  };
599
602
  function Re(t) {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Mohammad Mehdi Mohammadi",
6
6
  "url": ""
7
7
  },
8
- "version": "0.1.46",
8
+ "version": "0.1.47",
9
9
  "type": "module",
10
10
  "main": "dist/naria-ui.cjs.js",
11
11
  "module": "dist/naria-ui.es.js",