naria-ui 0.1.46 → 0.1.48
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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
export interface props {
|
|
3
3
|
type?: "password" | "text";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
classNames?: {
|
|
5
|
+
wrapper?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
input?: string;
|
|
8
|
+
};
|
|
8
9
|
placeholder: string;
|
|
9
10
|
label: string;
|
|
10
11
|
hasError?: string | null;
|
package/dist/naria-ui.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");function se(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");function se(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const d=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,d.get?d:{enumerable:!0,get:()=>t[s]})}}return i.default=t,Object.freeze(i)}const P=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
|
|
9
|
+
*/var K;function ie(){if(K)return U;K=1;var t=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(d,o,f){var g=null;if(f!==void 0&&(g=""+f),o.key!==void 0&&(g=""+o.key),"key"in o){f={};for(var m in o)m!=="key"&&(f[m]=o[m])}else f=o;return o=f.ref,{$$typeof:t,type:d,key:g,ref:o!==void 0?o:null,props:f}}return U.Fragment=i,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
|
|
17
|
+
*/var ee;function ce(){return ee||(ee=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===k?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case S:return"Profiler";case q:return"StrictMode";case u: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 W:return"Portal";case G:return(e.displayName||"Context")+".Provider";case L: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 s(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===T)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var n=t(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function o(){var e=v.A;return e===null?null:e.getOwner()}function f(){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 m(e,n){function c(){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))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function x(){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 E(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:x}):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 $(e,n,c,r,b,w,X,Z){var p=n.children;if(p!==void 0)if(r)if(j(p)){for(r=0;r<p.length;r++)R(p[r]);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 R(p);if(Y.call(n,"key")){p=t(e);var A=Object.keys(n).filter(function(oe){return oe!=="key"});r=0<A.length?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}",J[p+r]||(A=0<A.length?"{"+A.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} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,r,p,A,p),J[p+r]=!0)}if(p=null,c!==void 0&&(s(c),p=""+c),g(n)&&(s(n.key),p=""+n.key),"key"in n){c={};for(var Q in n)Q!=="key"&&(c[Q]=n[Q])}else c=n;return p&&m(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),E(e,p,w,b,o(),c,X,Z)}function R(e){typeof e=="object"&&e!==null&&e.$$typeof===I&&e._store&&(e._store.validated=1)}var h=l,I=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),G=Symbol.for("react.context"),z=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"),B=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),v=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,j=Array.isArray,O=console.createTask?console.createTask:function(){return null};h={"react-stack-bottom-frame":function(e){return e()}};var y,D={},N=h["react-stack-bottom-frame"].bind(h,f)(),F=O(d(f)),J={};H.Fragment=T,H.jsx=function(e,n,c,r,b){var w=1e4>v.recentlyCreatedOwnerStacks++;return $(e,n,c,!1,r,b,w?Error("react-stack-top-frame"):N,w?O(d(e)):F)},H.jsxs=function(e,n,c,r,b){var w=1e4>v.recentlyCreatedOwnerStacks++;return $(e,n,c,!0,r,b,w?Error("react-stack-top-frame"):N,w?O(d(e)):F)}}()),H}var re;function le(){return re||(re=1,process.env.NODE_ENV==="production"?V.exports=ie():V.exports=ce()),V.exports}var a=le();const ue=({type:t="button",value:i})=>a.jsx("button",{type:t,children:i}),fe=({type:t="text",placeholder:i,classNames:s={wrapper:"",label:"",input:""},label:d,hasError:o,register:f,name:g,isDisabled:m=!1,autocomplete:x=!1,...E})=>a.jsxs("div",{className:`nariaInputWrapper ${s.wrapper}`,children:[a.jsxs("label",{htmlFor:g,className:`${s.label} ${o&&"nariaInputLabel-error"}`,children:[d,a.jsx("input",{disabled:m,autoComplete:x?"on":"off",id:g,...f,...E,type:t,name:g,className:`${s.input} ${o&&"nariaInput-error"}`,placeholder:i})]}),o&&a.jsx("p",{className:"nariaInputErrorText",children:o})]}),te=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"})),de=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"})),ne=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),s=()=>i(typeof window<"u"?window.innerWidth:0);return l.useEffect(()=>(window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)),[t]),t},ae=({classNames:t={wrapper:"",color:""}})=>a.jsxs("svg",{className:`nariaLoading ${t.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})]}),ge=()=>{const t=`${window.location.pathname}${window.location.search}`;window.history.replaceState(null,"",t)},me=t=>{window.location.hash=t},he=t=>{const[i,s]=l.useState(!1);return l.useEffect(()=>{const d=o=>{window.location.hash!==t?s(!0):s(!1)};return window.addEventListener("hashchange",d),()=>{window.removeEventListener("hashchange",d)}},[]),i},we=(t,i,s)=>{l.useEffect(()=>{function d(o){i.current&&!i.current.contains(o.target)&&t?.current&&!t?.current.contains(o.target)&&s()}return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[t,s])},ve=({options:t,label:i,hasError:s,title:d,value:o,api:f,selected:g,placeholder:m,disabled:x=!1,pagination:E,optionFilterLabel:$,hasSearch:R=!1,classNames:h={wrapper:"",label:"",title:"",button:"",input:"",listWrapper:"",list:"",option:""},onSelectChange:I})=>{let W=!0;const T=pe(),q=he("#select"),[S,L]=l.useState(!1),[G,z]=l.useState(!0),[u,M]=l.useState(null),[_,C]=l.useState(null),[B,k]=l.useState(""),[v,Y]=l.useState({page:1,pageLabel:"page",size:20,sizeLabel:"size",isLoading:!1}),j=l.useRef(void 0),O=l.useRef(void 0),y=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(f?.length){if(j.current=f,j.current.includes(E?.pageLabel||"page")){const r=new URL(f);r.searchParams.set(E?.pageLabel||"page",(E?.page||v.page).toString()),r.searchParams.set(E?.sizeLabel||"size",(E?.size||v.size).toString()),j.current=r.href}z(!0),D().then(r=>{W&&(z(!1),C(r))})}},[f,E]),l.useEffect(()=>{if(v.isLoading){if(j.current.includes(E?.pageLabel||"page")){const r=new URL(j.current);r.searchParams.set(E?.pageLabel||"page",v.page.toString()),j.current=r.href}D().then(r=>{W&&(z(!1),Y({...v,isLoading:!1}),C([..._,...r]))})}},[v]),l.useEffect(()=>{T<768&&(S?(me("select"),document.body.style.overflow="hidden",y.current?.focus()):(window.location.hash&&!document.referrer.includes("#")&&ge(),document.body.style.overflow="auto"))},[S]),l.useEffect(()=>{g&&t?.length&&(t?.find(r=>r[i]===g)?M(t?.find(r=>r[i]===g)):M(g))},[g]),l.useEffect(()=>{u&&R&&(o?.length&&_?.find(r=>r[i]===u[i])?k(_?.find(r=>r[i]===u[i])[o]||""):k(u))},[u]),l.useEffect(()=>{q&&L(!1)},[q]),l.useEffect(()=>{t?.length&&C(t)},[t]);const N=()=>{R&&C(t),L(r=>!r)},F=()=>{R&&(C(t),k(typeof u=="string"?u:u?u[o]:"")),L(!1)},J=r=>{R&&(o?.length?k(r[o]):k(r)),M(r),N(),I&&I(r)},e=r=>{if(!u)return"";if(i?.length&&r[i]===u[i]||r===u)return"bg-grey-100"},n=r=>{f?.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[$?.length?$:o].includes(r?.target?.value):w.includes(r?.target?.value)):t;C(b),k(r?.target?.value),S||L(!0)};return we(O,y,F),a.jsxs("div",{className:`nariaSelect ${x?"nariaSelect-disabled":""} ${h?.wrapper}`,"data-prop":"wrapper",children:[a.jsxs("label",{className:`cursor-pointer
|
|
23
23
|
${s&&"!text-danger-100"}
|
|
24
|
-
${
|
|
25
|
-
${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${
|
|
26
|
-
${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${
|
|
27
|
-
|
|
24
|
+
${h?.label}`,"data-prop":"label",children:[a.jsx("span",{className:h?.title,"data-prop":"title",children:d}),R?a.jsxs("div",{className:"nariaSearchInput",children:[a.jsx("input",{ref:y,placeholder:m?.length?m:"Select",className:`${u?"text-dark-100":"text-grey-300"}
|
|
25
|
+
${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${h?.input}`,value:B,disabled:x,type:"text",onClick:N,onChange:c,"data-prop":"input"}),S?a.jsx(ne,{className:"nariaSearchIcon"}):a.jsx(te,{className:`nariaArrowIcon ${S?"nariaArrowIcon-rotate-180":""}`})]}):a.jsxs("button",{type:"button",ref:y,disabled:x,className:`nariaHandler ${u?"text-dark-100":"text-grey-300"}
|
|
26
|
+
${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${h?.button}`,"data-prop":"button",onClick:N,children:[u?o?.length?u[o]:u:m?.length?m:"Select"," ",a.jsx(te,{className:`nariaArrowIcon ${S?"nariaArrowIcon-rotate-180":""}`})]})]}),S?a.jsx("div",{className:`nariaListWrapper ${T<768?"nariaListWrapper-mobile":""} ${h?.listWrapper}`,"data-prop":"listWrapper",ref:O,children:a.jsx("div",{className:`nariaList ${T<768?"nariaList-mobile":"nariaList-desktop"} ${h?.list}`,"data-prop":"input",onScroll:n,children:f&&G?a.jsx("div",{className:"nariaLoadingWrapper",children:a.jsx(ae,{})}):a.jsxs(a.Fragment,{children:[T<768?a.jsxs("div",{className:"nariaSelectMobileHeader",children:[R?a.jsxs("div",{className:"nariaSearchInput",children:[a.jsx("input",{ref:y,placeholder:m?.length?m:"Select",className:`${u?"text-dark-100":"text-grey-300"}
|
|
27
|
+
${s&&"!border-danger-100 focus:border-danger-100 outline-danger-100"} ${h?.input}`,"data-prop":"input",value:B,disabled:x,type:"text",onChange:c}),a.jsx(ne,{className:"nariaSearchIcon"})]}):void 0,a.jsx("button",{className:"p-3",onClick:F,disabled:x,children:a.jsx(de,{className:"w-6"})})]}):void 0,_?.length?a.jsx(a.Fragment,{children:_?.map((r,b)=>a.jsx("button",{type:"button",onClick:()=>J(r),disabled:x,className:`${h?.option} ${e(r)}`,"data-prop":"option",children:o?.length?r[o]:r},b.toString()))}):a.jsx("div",{children:"No Data"}),v.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(t){return t.charAt(0).toUpperCase()+t.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:
|
|
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:150px}.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 .nariaList .nariaSelectMobileHeader{position:sticky;top:0;justify-content:end;display:flex}.nariaSelect .nariaList .nariaSelectMobileHeader .nariaSearchInput{flex-grow:1}.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)}}
|
package/dist/naria-ui.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as $ from "react";
|
|
2
|
+
import ce, { useState as y, useEffect as x, 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"),
|
|
18
|
-
function
|
|
17
|
+
var t = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment");
|
|
18
|
+
function c(f, o, u) {
|
|
19
19
|
var p = null;
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
for (var
|
|
23
|
-
|
|
24
|
-
} else
|
|
25
|
-
return
|
|
20
|
+
if (u !== void 0 && (p = "" + u), o.key !== void 0 && (p = "" + o.key), "key" in o) {
|
|
21
|
+
u = {};
|
|
22
|
+
for (var g in o)
|
|
23
|
+
g !== "key" && (u[g] = o[g]);
|
|
24
|
+
} else u = o;
|
|
25
|
+
return o = u.ref, {
|
|
26
26
|
$$typeof: t,
|
|
27
|
-
type:
|
|
27
|
+
type: f,
|
|
28
28
|
key: p,
|
|
29
|
-
ref:
|
|
30
|
-
props:
|
|
29
|
+
ref: o !== void 0 ? o : null,
|
|
30
|
+
props: u
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
return H.Fragment =
|
|
33
|
+
return H.Fragment = i, H.jsx = c, H.jsxs = c, H;
|
|
34
34
|
}
|
|
35
35
|
var J = {};
|
|
36
36
|
/**
|
|
@@ -51,13 +51,13 @@ function ue() {
|
|
|
51
51
|
return e.$$typeof === S ? null : e.displayName || e.name || null;
|
|
52
52
|
if (typeof e == "string") return e;
|
|
53
53
|
switch (e) {
|
|
54
|
-
case
|
|
54
|
+
case _:
|
|
55
55
|
return "Fragment";
|
|
56
|
-
case
|
|
56
|
+
case C:
|
|
57
57
|
return "Profiler";
|
|
58
58
|
case q:
|
|
59
59
|
return "StrictMode";
|
|
60
|
-
case
|
|
60
|
+
case l:
|
|
61
61
|
return "Suspense";
|
|
62
62
|
case M:
|
|
63
63
|
return "SuspenseList";
|
|
@@ -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
|
|
71
|
+
case z:
|
|
72
72
|
return "Portal";
|
|
73
73
|
case X:
|
|
74
74
|
return (e.displayName || "Context") + ".Provider";
|
|
@@ -79,7 +79,7 @@ function ue() {
|
|
|
79
79
|
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
80
80
|
case T:
|
|
81
81
|
return n = e.displayName || null, n !== null ? n : t(e.type) || "Memo";
|
|
82
|
-
case
|
|
82
|
+
case k:
|
|
83
83
|
n = e._payload, e = e._init;
|
|
84
84
|
try {
|
|
85
85
|
return t(e(n));
|
|
@@ -88,12 +88,12 @@ function ue() {
|
|
|
88
88
|
}
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function i(e) {
|
|
92
92
|
return "" + e;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function c(e) {
|
|
95
95
|
try {
|
|
96
|
-
|
|
96
|
+
i(e);
|
|
97
97
|
var n = !1;
|
|
98
98
|
} catch {
|
|
99
99
|
n = !0;
|
|
@@ -105,12 +105,12 @@ 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
|
-
),
|
|
108
|
+
), i(e);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
if (e ===
|
|
113
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
111
|
+
function f(e) {
|
|
112
|
+
if (e === _) return "<>";
|
|
113
|
+
if (typeof e == "object" && e !== null && e.$$typeof === k)
|
|
114
114
|
return "<...>";
|
|
115
115
|
try {
|
|
116
116
|
var n = t(e);
|
|
@@ -119,11 +119,11 @@ function ue() {
|
|
|
119
119
|
return "<...>";
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
var e =
|
|
122
|
+
function o() {
|
|
123
|
+
var e = w.A;
|
|
124
124
|
return e === null ? null : e.getOwner();
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function u() {
|
|
127
127
|
return Error("react-stack-top-frame");
|
|
128
128
|
}
|
|
129
129
|
function p(e) {
|
|
@@ -133,7 +133,7 @@ function ue() {
|
|
|
133
133
|
}
|
|
134
134
|
return e.key !== void 0;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function g(e, n) {
|
|
137
137
|
function s() {
|
|
138
138
|
L || (L = !0, console.error(
|
|
139
139
|
"%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)",
|
|
@@ -145,22 +145,22 @@ function ue() {
|
|
|
145
145
|
configurable: !0
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function E() {
|
|
149
149
|
var e = t(this.type);
|
|
150
150
|
return F[e] || (F[e] = !0, console.error(
|
|
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
|
|
154
|
+
function b(e, n, s, r, v, h, Z, Q) {
|
|
155
155
|
return s = h.ref, e = {
|
|
156
|
-
$$typeof:
|
|
156
|
+
$$typeof: W,
|
|
157
157
|
type: e,
|
|
158
158
|
key: n,
|
|
159
159
|
props: h,
|
|
160
|
-
_owner:
|
|
160
|
+
_owner: v
|
|
161
161
|
}, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
|
|
162
162
|
enumerable: !1,
|
|
163
|
-
get:
|
|
163
|
+
get: E
|
|
164
164
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
165
165
|
configurable: !1,
|
|
166
166
|
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
|
|
187
|
-
var
|
|
188
|
-
if (
|
|
186
|
+
function I(e, n, s, r, v, h, Z, Q) {
|
|
187
|
+
var d = n.children;
|
|
188
|
+
if (d !== void 0)
|
|
189
189
|
if (r)
|
|
190
|
-
if (
|
|
191
|
-
for (r = 0; r <
|
|
192
|
-
|
|
193
|
-
Object.freeze && Object.freeze(
|
|
190
|
+
if (R(d)) {
|
|
191
|
+
for (r = 0; r < d.length; r++)
|
|
192
|
+
j(d[r]);
|
|
193
|
+
Object.freeze && Object.freeze(d);
|
|
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
|
|
198
|
+
else j(d);
|
|
199
199
|
if (D.call(n, "key")) {
|
|
200
|
-
|
|
201
|
-
var
|
|
202
|
-
return
|
|
200
|
+
d = t(e);
|
|
201
|
+
var P = Object.keys(n).filter(function(ie) {
|
|
202
|
+
return ie !== "key";
|
|
203
203
|
});
|
|
204
|
-
r = 0 <
|
|
204
|
+
r = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", V[d + r] || (P = 0 < P.length ? "{" + P.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,68 +209,68 @@ 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
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
), V[
|
|
212
|
+
d,
|
|
213
|
+
P,
|
|
214
|
+
d
|
|
215
|
+
), V[d + r] = !0);
|
|
216
216
|
}
|
|
217
|
-
if (
|
|
217
|
+
if (d = null, s !== void 0 && (c(s), d = "" + s), p(n) && (c(n.key), d = "" + 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
|
|
222
|
+
return d && g(
|
|
223
223
|
s,
|
|
224
224
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
225
|
-
),
|
|
225
|
+
), b(
|
|
226
226
|
e,
|
|
227
|
-
|
|
227
|
+
d,
|
|
228
228
|
h,
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
v,
|
|
230
|
+
o(),
|
|
231
231
|
s,
|
|
232
232
|
Z,
|
|
233
233
|
Q
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
typeof e == "object" && e !== null && e.$$typeof ===
|
|
236
|
+
function j(e) {
|
|
237
|
+
typeof e == "object" && e !== null && e.$$typeof === W && e._store && (e._store.validated = 1);
|
|
238
238
|
}
|
|
239
|
-
var
|
|
239
|
+
var m = ce, W = Symbol.for("react.transitional.element"), z = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), A = Symbol.for("react.consumer"), X = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), l = 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"), S = Symbol.for("react.client.reference"), w = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, R = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
240
240
|
return null;
|
|
241
241
|
};
|
|
242
|
-
|
|
242
|
+
m = {
|
|
243
243
|
"react-stack-bottom-frame": function(e) {
|
|
244
244
|
return e();
|
|
245
245
|
}
|
|
246
246
|
};
|
|
247
|
-
var L, F = {},
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
)(), U =
|
|
251
|
-
J.Fragment =
|
|
252
|
-
var h = 1e4 >
|
|
253
|
-
return
|
|
247
|
+
var L, F = {}, O = m["react-stack-bottom-frame"].bind(
|
|
248
|
+
m,
|
|
249
|
+
u
|
|
250
|
+
)(), U = N(f(u)), V = {};
|
|
251
|
+
J.Fragment = _, J.jsx = function(e, n, s, r, v) {
|
|
252
|
+
var h = 1e4 > w.recentlyCreatedOwnerStacks++;
|
|
253
|
+
return I(
|
|
254
254
|
e,
|
|
255
255
|
n,
|
|
256
256
|
s,
|
|
257
257
|
!1,
|
|
258
258
|
r,
|
|
259
|
-
|
|
260
|
-
h ? Error("react-stack-top-frame") :
|
|
261
|
-
h ?
|
|
259
|
+
v,
|
|
260
|
+
h ? Error("react-stack-top-frame") : O,
|
|
261
|
+
h ? N(f(e)) : U
|
|
262
262
|
);
|
|
263
|
-
}, J.jsxs = function(e, n, s, r,
|
|
264
|
-
var h = 1e4 >
|
|
265
|
-
return
|
|
263
|
+
}, J.jsxs = function(e, n, s, r, v) {
|
|
264
|
+
var h = 1e4 > w.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return I(
|
|
266
266
|
e,
|
|
267
267
|
n,
|
|
268
268
|
s,
|
|
269
269
|
!0,
|
|
270
270
|
r,
|
|
271
|
-
|
|
272
|
-
h ? Error("react-stack-top-frame") :
|
|
273
|
-
h ?
|
|
271
|
+
v,
|
|
272
|
+
h ? Error("react-stack-top-frame") : O,
|
|
273
|
+
h ? N(f(e)) : U
|
|
274
274
|
);
|
|
275
275
|
};
|
|
276
276
|
}()), J;
|
|
@@ -279,56 +279,57 @@ var ne;
|
|
|
279
279
|
function de() {
|
|
280
280
|
return ne || (ne = 1, process.env.NODE_ENV === "production" ? G.exports = le() : G.exports = ue()), G.exports;
|
|
281
281
|
}
|
|
282
|
-
var
|
|
283
|
-
const
|
|
282
|
+
var a = de();
|
|
283
|
+
const be = ({ type: t = "button", value: i }) => /* @__PURE__ */ a.jsx("button", { type: t, children: i }), xe = ({
|
|
284
284
|
type: t = "text",
|
|
285
|
-
placeholder:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
285
|
+
placeholder: i,
|
|
286
|
+
classNames: c = {
|
|
287
|
+
wrapper: "",
|
|
288
|
+
label: "",
|
|
289
|
+
input: ""
|
|
290
|
+
},
|
|
291
|
+
label: f,
|
|
292
|
+
hasError: o,
|
|
293
|
+
register: u,
|
|
294
|
+
name: p,
|
|
295
|
+
isDisabled: g = !1,
|
|
296
|
+
autocomplete: E = !1,
|
|
297
|
+
...b
|
|
298
|
+
}) => /* @__PURE__ */ a.jsxs("div", { className: `nariaInputWrapper ${c.wrapper}`, children: [
|
|
299
|
+
/* @__PURE__ */ a.jsxs(
|
|
299
300
|
"label",
|
|
300
301
|
{
|
|
301
|
-
htmlFor:
|
|
302
|
-
className: `${
|
|
302
|
+
htmlFor: p,
|
|
303
|
+
className: `${c.label} ${o && "nariaInputLabel-error"}`,
|
|
303
304
|
children: [
|
|
304
|
-
|
|
305
|
-
/* @__PURE__ */
|
|
305
|
+
f,
|
|
306
|
+
/* @__PURE__ */ a.jsx(
|
|
306
307
|
"input",
|
|
307
308
|
{
|
|
308
|
-
disabled:
|
|
309
|
-
autoComplete:
|
|
310
|
-
id:
|
|
311
|
-
...
|
|
312
|
-
...
|
|
309
|
+
disabled: g,
|
|
310
|
+
autoComplete: E ? "on" : "off",
|
|
311
|
+
id: p,
|
|
312
|
+
...u,
|
|
313
|
+
...b,
|
|
313
314
|
type: t,
|
|
314
|
-
name:
|
|
315
|
-
className: `${
|
|
316
|
-
placeholder:
|
|
315
|
+
name: p,
|
|
316
|
+
className: `${c.input} ${o && "nariaInput-error"}`,
|
|
317
|
+
placeholder: i
|
|
317
318
|
}
|
|
318
319
|
)
|
|
319
320
|
]
|
|
320
321
|
}
|
|
321
322
|
),
|
|
322
|
-
|
|
323
|
-
] }),
|
|
324
|
-
const [t,
|
|
325
|
-
return
|
|
323
|
+
o && /* @__PURE__ */ a.jsx("p", { className: "nariaInputErrorText", children: o })
|
|
324
|
+
] }), ae = (t) => /* @__PURE__ */ $.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", fill: "currentColor", ...t }, /* @__PURE__ */ $.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__ */ $.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", fill: "currentColor", ...t }, /* @__PURE__ */ $.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" })), oe = (t) => /* @__PURE__ */ $.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", fill: "currentColor", ...t }, /* @__PURE__ */ $.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 = () => {
|
|
325
|
+
const [t, i] = y(typeof window < "u" ? window.innerWidth : 0), c = () => i(typeof window < "u" ? window.innerWidth : 0);
|
|
326
|
+
return x(() => (window.addEventListener("resize", c), () => window.removeEventListener("resize", c)), [t]), t;
|
|
326
327
|
}, se = ({
|
|
327
328
|
classNames: t = {
|
|
328
329
|
wrapper: "",
|
|
329
330
|
color: ""
|
|
330
331
|
}
|
|
331
|
-
}) => /* @__PURE__ */
|
|
332
|
+
}) => /* @__PURE__ */ a.jsxs(
|
|
332
333
|
"svg",
|
|
333
334
|
{
|
|
334
335
|
className: `nariaLoading ${t.wrapper}`,
|
|
@@ -336,7 +337,7 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
|
|
|
336
337
|
fill: "none",
|
|
337
338
|
xmlns: "http://www.w3.org/2000/svg",
|
|
338
339
|
children: [
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
+
/* @__PURE__ */ a.jsx(
|
|
340
341
|
"path",
|
|
341
342
|
{
|
|
342
343
|
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",
|
|
@@ -346,7 +347,7 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
|
|
|
346
347
|
strokeLinejoin: "round"
|
|
347
348
|
}
|
|
348
349
|
),
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
+
/* @__PURE__ */ a.jsx(
|
|
350
351
|
"path",
|
|
351
352
|
{
|
|
352
353
|
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",
|
|
@@ -359,63 +360,66 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
|
|
|
359
360
|
)
|
|
360
361
|
]
|
|
361
362
|
}
|
|
362
|
-
),
|
|
363
|
+
), ge = () => {
|
|
363
364
|
const t = `${window.location.pathname}${window.location.search}`;
|
|
364
365
|
window.history.replaceState(null, "", t);
|
|
365
|
-
},
|
|
366
|
+
}, me = (t) => {
|
|
366
367
|
window.location.hash = t;
|
|
367
|
-
},
|
|
368
|
-
const [
|
|
369
|
-
return
|
|
370
|
-
const
|
|
371
|
-
window.location.hash !== t ?
|
|
368
|
+
}, he = (t) => {
|
|
369
|
+
const [i, c] = y(!1);
|
|
370
|
+
return x(() => {
|
|
371
|
+
const f = (o) => {
|
|
372
|
+
window.location.hash !== t ? c(!0) : c(!1);
|
|
372
373
|
};
|
|
373
|
-
return window.addEventListener("hashchange",
|
|
374
|
-
window.removeEventListener("hashchange",
|
|
374
|
+
return window.addEventListener("hashchange", f), () => {
|
|
375
|
+
window.removeEventListener("hashchange", f);
|
|
375
376
|
};
|
|
376
|
-
}, []),
|
|
377
|
-
}, we = (t,
|
|
378
|
-
|
|
379
|
-
function
|
|
380
|
-
|
|
377
|
+
}, []), i;
|
|
378
|
+
}, we = (t, i, c) => {
|
|
379
|
+
x(() => {
|
|
380
|
+
function f(o) {
|
|
381
|
+
i.current && !i.current.contains(o.target) && t?.current && !t?.current.contains(o.target) && c();
|
|
381
382
|
}
|
|
382
|
-
return document.addEventListener("mousedown",
|
|
383
|
-
document.removeEventListener("mousedown",
|
|
383
|
+
return document.addEventListener("mousedown", f), () => {
|
|
384
|
+
document.removeEventListener("mousedown", f);
|
|
384
385
|
};
|
|
385
|
-
}, [t,
|
|
386
|
+
}, [t, c]);
|
|
386
387
|
}, Ee = ({
|
|
387
388
|
options: t,
|
|
388
|
-
label:
|
|
389
|
-
hasError:
|
|
390
|
-
title:
|
|
391
|
-
value:
|
|
392
|
-
api:
|
|
389
|
+
label: i,
|
|
390
|
+
hasError: c,
|
|
391
|
+
title: f,
|
|
392
|
+
value: o,
|
|
393
|
+
api: u,
|
|
393
394
|
selected: p,
|
|
394
|
-
placeholder:
|
|
395
|
-
disabled:
|
|
396
|
-
pagination:
|
|
397
|
-
optionFilterLabel:
|
|
398
|
-
hasSearch:
|
|
399
|
-
classNames:
|
|
395
|
+
placeholder: g,
|
|
396
|
+
disabled: E = !1,
|
|
397
|
+
pagination: b,
|
|
398
|
+
optionFilterLabel: I,
|
|
399
|
+
hasSearch: j = !1,
|
|
400
|
+
classNames: m = {
|
|
400
401
|
wrapper: "",
|
|
401
402
|
label: "",
|
|
402
403
|
title: "",
|
|
403
404
|
button: "",
|
|
404
|
-
input: ""
|
|
405
|
+
input: "",
|
|
406
|
+
listWrapper: "",
|
|
407
|
+
list: "",
|
|
408
|
+
option: ""
|
|
405
409
|
},
|
|
406
|
-
onSelectChange:
|
|
410
|
+
onSelectChange: W
|
|
407
411
|
}) => {
|
|
408
|
-
let
|
|
409
|
-
const
|
|
412
|
+
let z = !0;
|
|
413
|
+
const _ = pe(), q = he("#select"), [C, A] = y(!1), [X, Y] = y(!0), [l, M] = y(null), [T, k] = y(null), [B, S] = y(""), [w, D] = y({
|
|
410
414
|
page: 1,
|
|
411
415
|
pageLabel: "page",
|
|
412
416
|
size: 20,
|
|
413
417
|
sizeLabel: "size",
|
|
414
418
|
isLoading: !1
|
|
415
|
-
}),
|
|
416
|
-
if (
|
|
419
|
+
}), R = ee(void 0), N = ee(void 0), L = ee(void 0), F = async () => {
|
|
420
|
+
if (R?.current)
|
|
417
421
|
try {
|
|
418
|
-
const r = await fetch(
|
|
422
|
+
const r = await fetch(R?.current);
|
|
419
423
|
if (!r.ok)
|
|
420
424
|
throw new Error(`Response status: ${r.status}`);
|
|
421
425
|
return await r.json();
|
|
@@ -423,185 +427,199 @@ const xe = ({ type: t = "button", value: c }) => /* @__PURE__ */ o.jsx("button",
|
|
|
423
427
|
console.error(r.message);
|
|
424
428
|
}
|
|
425
429
|
};
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}, []),
|
|
429
|
-
if (
|
|
430
|
-
if (
|
|
431
|
-
const r = new URL(
|
|
432
|
-
r.searchParams.set(
|
|
430
|
+
x(() => () => {
|
|
431
|
+
z = !1;
|
|
432
|
+
}, []), x(() => {
|
|
433
|
+
if (u?.length) {
|
|
434
|
+
if (R.current = u, R.current.includes(b?.pageLabel || "page")) {
|
|
435
|
+
const r = new URL(u);
|
|
436
|
+
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;
|
|
433
437
|
}
|
|
434
438
|
Y(!0), F().then((r) => {
|
|
435
|
-
|
|
439
|
+
z && (Y(!1), k(r));
|
|
436
440
|
});
|
|
437
441
|
}
|
|
438
|
-
}, [
|
|
439
|
-
if (
|
|
440
|
-
if (
|
|
441
|
-
const r = new URL(
|
|
442
|
-
r.searchParams.set(
|
|
442
|
+
}, [u, b]), x(() => {
|
|
443
|
+
if (w.isLoading) {
|
|
444
|
+
if (R.current.includes(b?.pageLabel || "page")) {
|
|
445
|
+
const r = new URL(R.current);
|
|
446
|
+
r.searchParams.set(b?.pageLabel || "page", w.page.toString()), R.current = r.href;
|
|
443
447
|
}
|
|
444
448
|
F().then((r) => {
|
|
445
|
-
|
|
446
|
-
...
|
|
449
|
+
z && (Y(!1), D({
|
|
450
|
+
...w,
|
|
447
451
|
isLoading: !1
|
|
448
|
-
}),
|
|
452
|
+
}), k([
|
|
449
453
|
...T,
|
|
450
454
|
...r
|
|
451
455
|
]));
|
|
452
456
|
});
|
|
453
457
|
}
|
|
454
|
-
}, [
|
|
455
|
-
|
|
456
|
-
}, [
|
|
457
|
-
p && t?.length && (t?.find((r) => r[
|
|
458
|
-
}, [p]),
|
|
459
|
-
|
|
460
|
-
}, [
|
|
458
|
+
}, [w]), x(() => {
|
|
459
|
+
_ < 768 && (C ? (me("select"), document.body.style.overflow = "hidden", L.current?.focus()) : (window.location.hash && !document.referrer.includes("#") && ge(), document.body.style.overflow = "auto"));
|
|
460
|
+
}, [C]), x(() => {
|
|
461
|
+
p && t?.length && (t?.find((r) => r[i] === p) ? M(t?.find((r) => r[i] === p)) : M(p));
|
|
462
|
+
}, [p]), x(() => {
|
|
463
|
+
l && j && (o?.length && T?.find((r) => r[i] === l[i]) ? S(T?.find((r) => r[i] === l[i])[o] || "") : S(l));
|
|
464
|
+
}, [l]), x(() => {
|
|
461
465
|
q && A(!1);
|
|
462
|
-
}, [q]),
|
|
463
|
-
t?.length &&
|
|
466
|
+
}, [q]), x(() => {
|
|
467
|
+
t?.length && k(t);
|
|
464
468
|
}, [t]);
|
|
465
|
-
const
|
|
466
|
-
|
|
469
|
+
const O = () => {
|
|
470
|
+
j && k(t), A((r) => !r);
|
|
467
471
|
}, U = () => {
|
|
468
|
-
|
|
472
|
+
j && (k(t), S(typeof l == "string" ? l : l ? l[o] : "")), A(!1);
|
|
469
473
|
}, V = (r) => {
|
|
470
|
-
|
|
474
|
+
j && (o?.length ? S(r[o]) : S(r)), M(r), O(), W && W(r);
|
|
471
475
|
}, e = (r) => {
|
|
472
|
-
if (!
|
|
476
|
+
if (!l)
|
|
473
477
|
return "";
|
|
474
|
-
if (
|
|
478
|
+
if (i?.length && r[i] === l[i] || r === l)
|
|
475
479
|
return "bg-grey-100";
|
|
476
480
|
}, n = (r) => {
|
|
477
|
-
|
|
478
|
-
page:
|
|
481
|
+
u?.length && T?.length && !w.isLoading && r.target.offsetHeight + r.target.scrollTop >= r.target.scrollHeight - 100 && D({
|
|
482
|
+
page: w.page + 1,
|
|
479
483
|
isLoading: !0
|
|
480
484
|
});
|
|
481
485
|
}, s = (r) => {
|
|
482
|
-
const
|
|
483
|
-
|
|
486
|
+
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;
|
|
487
|
+
k(v), S(r?.target?.value), C || A(!0);
|
|
484
488
|
};
|
|
485
|
-
return we(
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
{
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
className: `nariaArrowIcon ${k ? "nariaArrowIcon-rotate-180" : ""}`
|
|
518
|
-
}
|
|
519
|
-
)
|
|
520
|
-
] }) : /* @__PURE__ */ o.jsxs(
|
|
521
|
-
"button",
|
|
522
|
-
{
|
|
523
|
-
type: "button",
|
|
524
|
-
ref: L,
|
|
525
|
-
disabled: R,
|
|
526
|
-
className: `nariaHandler ${u ? "text-dark-100" : "text-grey-300"}
|
|
527
|
-
${i && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${w?.button}`,
|
|
528
|
-
onClick: P,
|
|
529
|
-
children: [
|
|
530
|
-
u ? a?.length ? u[a] : u : d?.length ? d : "Select",
|
|
531
|
-
" ",
|
|
532
|
-
/* @__PURE__ */ o.jsx(
|
|
489
|
+
return we(N, L, U), /* @__PURE__ */ a.jsxs(
|
|
490
|
+
"div",
|
|
491
|
+
{
|
|
492
|
+
className: `nariaSelect ${E ? "nariaSelect-disabled" : ""} ${m?.wrapper}`,
|
|
493
|
+
"data-prop": "wrapper",
|
|
494
|
+
children: [
|
|
495
|
+
/* @__PURE__ */ a.jsxs(
|
|
496
|
+
"label",
|
|
497
|
+
{
|
|
498
|
+
className: `cursor-pointer
|
|
499
|
+
${c && "!text-danger-100"}
|
|
500
|
+
${m?.label}`,
|
|
501
|
+
"data-prop": "label",
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ a.jsx("span", { className: m?.title, "data-prop": "title", children: f }),
|
|
504
|
+
j ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
|
|
505
|
+
/* @__PURE__ */ a.jsx(
|
|
506
|
+
"input",
|
|
507
|
+
{
|
|
508
|
+
ref: L,
|
|
509
|
+
placeholder: g?.length ? g : "Select",
|
|
510
|
+
className: `${l ? "text-dark-100" : "text-grey-300"}
|
|
511
|
+
${c && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${m?.input}`,
|
|
512
|
+
value: B,
|
|
513
|
+
disabled: E,
|
|
514
|
+
type: "text",
|
|
515
|
+
onClick: O,
|
|
516
|
+
onChange: s,
|
|
517
|
+
"data-prop": "input"
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
C ? /* @__PURE__ */ a.jsx(
|
|
533
521
|
oe,
|
|
534
522
|
{
|
|
535
|
-
className:
|
|
523
|
+
className: "nariaSearchIcon"
|
|
524
|
+
}
|
|
525
|
+
) : /* @__PURE__ */ a.jsx(
|
|
526
|
+
ae,
|
|
527
|
+
{
|
|
528
|
+
className: `nariaArrowIcon ${C ? "nariaArrowIcon-rotate-180" : ""}`
|
|
536
529
|
}
|
|
537
530
|
)
|
|
538
|
-
]
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
531
|
+
] }) : /* @__PURE__ */ a.jsxs(
|
|
532
|
+
"button",
|
|
533
|
+
{
|
|
534
|
+
type: "button",
|
|
535
|
+
ref: L,
|
|
536
|
+
disabled: E,
|
|
537
|
+
className: `nariaHandler ${l ? "text-dark-100" : "text-grey-300"}
|
|
538
|
+
${c && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${m?.button}`,
|
|
539
|
+
"data-prop": "button",
|
|
540
|
+
onClick: O,
|
|
541
|
+
children: [
|
|
542
|
+
l ? o?.length ? l[o] : l : g?.length ? g : "Select",
|
|
543
|
+
" ",
|
|
544
|
+
/* @__PURE__ */ a.jsx(
|
|
545
|
+
ae,
|
|
546
|
+
{
|
|
547
|
+
className: `nariaArrowIcon ${C ? "nariaArrowIcon-rotate-180" : ""}`
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
]
|
|
554
|
+
}
|
|
555
|
+
),
|
|
556
|
+
C ? /* @__PURE__ */ a.jsx(
|
|
557
|
+
"div",
|
|
558
|
+
{
|
|
559
|
+
className: `nariaListWrapper ${_ < 768 ? "nariaListWrapper-mobile" : ""} ${m?.listWrapper}`,
|
|
560
|
+
"data-prop": "listWrapper",
|
|
561
|
+
ref: N,
|
|
562
|
+
children: /* @__PURE__ */ a.jsx(
|
|
563
|
+
"div",
|
|
566
564
|
{
|
|
567
|
-
className: "
|
|
565
|
+
className: `nariaList ${_ < 768 ? "nariaList-mobile" : "nariaList-desktop"} ${m?.list}`,
|
|
566
|
+
"data-prop": "input",
|
|
567
|
+
onScroll: n,
|
|
568
|
+
children: u && X ? /* @__PURE__ */ a.jsx("div", { className: "nariaLoadingWrapper", children: /* @__PURE__ */ a.jsx(se, {}) }) : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
569
|
+
_ < 768 ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSelectMobileHeader", children: [
|
|
570
|
+
j ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
|
|
571
|
+
/* @__PURE__ */ a.jsx(
|
|
572
|
+
"input",
|
|
573
|
+
{
|
|
574
|
+
ref: L,
|
|
575
|
+
placeholder: g?.length ? g : "Select",
|
|
576
|
+
className: `${l ? "text-dark-100" : "text-grey-300"}
|
|
577
|
+
${c && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${m?.input}`,
|
|
578
|
+
"data-prop": "input",
|
|
579
|
+
value: B,
|
|
580
|
+
disabled: E,
|
|
581
|
+
type: "text",
|
|
582
|
+
onChange: s
|
|
583
|
+
}
|
|
584
|
+
),
|
|
585
|
+
/* @__PURE__ */ a.jsx(
|
|
586
|
+
oe,
|
|
587
|
+
{
|
|
588
|
+
className: "nariaSearchIcon"
|
|
589
|
+
}
|
|
590
|
+
)
|
|
591
|
+
] }) : void 0,
|
|
592
|
+
/* @__PURE__ */ a.jsx("button", { className: "p-3", onClick: U, disabled: E, children: /* @__PURE__ */ a.jsx(fe, { className: "w-6" }) })
|
|
593
|
+
] }) : void 0,
|
|
594
|
+
T?.length ? /* @__PURE__ */ a.jsx(a.Fragment, { children: T?.map((r, v) => /* @__PURE__ */ a.jsx(
|
|
595
|
+
"button",
|
|
596
|
+
{
|
|
597
|
+
type: "button",
|
|
598
|
+
onClick: () => V(r),
|
|
599
|
+
disabled: E,
|
|
600
|
+
className: `${m?.option} ${e(r)}`,
|
|
601
|
+
"data-prop": "option",
|
|
602
|
+
children: o?.length ? r[o] : r
|
|
603
|
+
},
|
|
604
|
+
v.toString()
|
|
605
|
+
)) }) : /* @__PURE__ */ a.jsx("div", { children: "No Data" }),
|
|
606
|
+
w.isLoading ? /* @__PURE__ */ a.jsx("div", { className: "nariaLoadingMoreWrapper", children: /* @__PURE__ */ a.jsx(se, {}) }) : void 0
|
|
607
|
+
] })
|
|
568
608
|
}
|
|
569
609
|
)
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
children: l && X ? /* @__PURE__ */ o.jsx("div", { className: "nariaLoadingWrapper", children: /* @__PURE__ */ o.jsx(se, {}) }) : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
577
|
-
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,
|
|
578
|
-
T?.length ? /* @__PURE__ */ o.jsx(o.Fragment, { children: T?.map((r, x) => /* @__PURE__ */ o.jsx(
|
|
579
|
-
"button",
|
|
580
|
-
{
|
|
581
|
-
type: "button",
|
|
582
|
-
onClick: () => V(r),
|
|
583
|
-
disabled: R,
|
|
584
|
-
className: `text-right py-2.5 px-4 text-base hover:bg-grey-100 rounded-lg ${e(r)}`,
|
|
585
|
-
children: a?.length ? r[a] : r
|
|
586
|
-
},
|
|
587
|
-
x.toString()
|
|
588
|
-
)) }) : /* @__PURE__ */ o.jsx("div", { children: "No Data" }),
|
|
589
|
-
v.isLoading ? /* @__PURE__ */ o.jsx("div", { className: "nariaLoadingMoreWrapper", children: /* @__PURE__ */ o.jsx(se, {}) }) : void 0
|
|
590
|
-
] })
|
|
591
|
-
}
|
|
592
|
-
)
|
|
593
|
-
]
|
|
594
|
-
}
|
|
595
|
-
) : void 0,
|
|
596
|
-
i && /* @__PURE__ */ o.jsx("p", { className: "text-xs mt-1 text-danger-100", children: i })
|
|
597
|
-
] });
|
|
610
|
+
}
|
|
611
|
+
) : void 0,
|
|
612
|
+
c && /* @__PURE__ */ a.jsx("p", { className: "text-xs mt-1 text-danger-100", children: c })
|
|
613
|
+
]
|
|
614
|
+
}
|
|
615
|
+
);
|
|
598
616
|
};
|
|
599
617
|
function Re(t) {
|
|
600
618
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
601
619
|
}
|
|
602
620
|
export {
|
|
603
|
-
|
|
604
|
-
|
|
621
|
+
be as Button,
|
|
622
|
+
xe as Input,
|
|
605
623
|
Ee as Select,
|
|
606
624
|
Re as capitalize
|
|
607
625
|
};
|