naria-ui 0.3.16 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/naria-ui.cjs.js +1 -1
- package/dist/naria-ui.es.js +1 -1
- package/package.json +1 -1
package/dist/naria-ui.cjs.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
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,Q,X,Q),De[Q+T]=!0)}if(Q=null,f!==void 0&&(Y(f),Q=""+f),z(E)&&(Y(E.key),Q=""+E.key),"key"in E){f={};for(var ge in E)ge!=="key"&&(f[ge]=E[ge])}else f=E;return Q&&x(f,typeof M=="function"?M.displayName||M.name||"Unknown":M),m(M,Q,f,R(),c,fe)}function u(M){D(M)?M._store&&(M._store.validated=1):typeof M=="object"&&M!==null&&M.$$typeof===b&&(M._payload.status==="fulfilled"?D(M._payload.value)&&M._payload.value._store&&(M._payload.value._store.validated=1):M._store&&(M._store.validated=1))}function D(M){return typeof M=="object"&&M!==null&&M.$$typeof===U}var ee=N,U=Symbol.for("react.transitional.element"),de=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),oe=Symbol.for("react.strict_mode"),he=Symbol.for("react.profiler"),_e=Symbol.for("react.consumer"),ue=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),we=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),B=Symbol.for("react.client.reference"),be=ee.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=Object.prototype.hasOwnProperty,me=Array.isArray,te=console.createTask?console.createTask:function(){return null};ee={react_stack_bottom_frame:function(M){return M()}};var xe,Se={},$e=ee.react_stack_bottom_frame.bind(ee,A)(),Pe=te(g(A)),De={};jt.Fragment=C,jt.jsx=function(M,E,f){var T=1e4>be.recentlyCreatedOwnerStacks++;return W(M,E,f,!1,T?Error("react-stack-top-frame"):$e,T?te(g(M)):Pe)},jt.jsxs=function(M,E,f){var T=1e4>be.recentlyCreatedOwnerStacks++;return W(M,E,f,!0,T?Error("react-stack-top-frame"):$e,T?te(g(M)):Pe)}})()),jt}var cn;function co(){return cn||(cn=1,process.env.NODE_ENV==="production"?Gt.exports=uo():Gt.exports=lo()),Gt.exports}var S=co();const Jt=({classNames:d={root:"",color:""}})=>S.jsxs("svg",{className:`naria-loading ${d.root}`,"data-prop":"root",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[S.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"}),S.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:d.color,"data-prop":"color"})]}),ho=({type:d="button",classNames:O={root:"",loading:{root:"",color:""}},value:Y,icon:g=void 0,isLoading:R=!1,isDisabled:A=!1,...z})=>S.jsxs("button",{type:d,disabled:A,...z,className:`naria-button ${A?"naria-button--disabled":""} ${O==null?void 0:O.root}`,"data-class-prop":"root",children:[R?S.jsx(Jt,{classNames:{root:O.loading.root,color:O.loading.color},"data-class-prop":"root","data-class-prop-color":"color"}):g,Y]}),dn=d=>Le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...d},Le.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"})),Dn=d=>Le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...d},Le.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"})),hn=d=>Le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",...d},Le.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"})),Yn=(d,O,Y)=>{N.useEffect(()=>{function g(R){O.current&&!O.current.contains(R.target)&&(d!=null&&d.current)&&!(d!=null&&d.current.contains(R.target))&&Y()}return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[d,Y])},gr=()=>{const[d,O]=N.useState(typeof window<"u"?window.innerWidth:0),Y=()=>O(typeof window<"u"?window.innerWidth:0);return N.useEffect(()=>(window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)),[d]),d},wr=()=>{const d=`${window.location.pathname}${window.location.search}`;window.history.replaceState(null,"",d)},Mr=d=>{window.location.hash=d},pr=d=>{const[O,Y]=N.useState(!1);return N.useEffect(()=>{const g=R=>{window.location.hash!==d?Y(!0):Y(!1)};return window.addEventListener("hashchange",g),()=>{window.removeEventListener("hashchange",g)}},[]),O},fo=({options:d,label:O,hasError:Y,title:g,value:R,api:A,selected:z,placeholder:x,disabled:ie=!1,pagination:m,optionFilterLabel:W,hasSearch:u=!1,classNames:D={root:"",label:"",title:"",button:"",searchInput:"",listRoot:"",list:"",option:"",optionActive:"",mobileHeader:"",errorText:"",searchInputRoot:"",iconRoot:"",closeIcon:"",arrowIcon:"",searchIcon:""},onSelectChange:ee})=>{let U=!0;const de=gr(),C=pr("#select"),[oe,he]=N.useState(!1),[_e,ue]=N.useState(!0),[q,we]=N.useState(void 0),[L,G]=N.useState(void 0),[b,F]=N.useState(""),[B,be]=N.useState({page:1,pageLabel:"page",size:20,sizeLabel:"size",isLoading:!1}),J=N.useRef(void 0),me=N.useRef(void 0),te=N.useRef(void 0),xe=async()=>{if(J!=null&&J.current)try{const f=await fetch(J==null?void 0:J.current);if(!f.ok)throw new Error(`Response status: ${f.status}`);return await f.json()}catch(f){console.error(f)}};N.useEffect(()=>()=>{U=!1},[]),N.useEffect(()=>{if(A!=null&&A.length){if(J.current=A,J.current.includes((m==null?void 0:m.pageLabel)||"page")){const f=new URL(A);f.searchParams.set((m==null?void 0:m.pageLabel)||"page",((m==null?void 0:m.page)||B.page).toString()),f.searchParams.set((m==null?void 0:m.sizeLabel)||"size",((m==null?void 0:m.size)||B.size).toString()),J.current=f.href}ue(!0),xe().then(f=>{U&&(ue(!1),G(f))})}},[A,m]),N.useEffect(()=>{if(B.isLoading){if(J.current.includes((m==null?void 0:m.pageLabel)||"page")){const f=new URL(J.current);f.searchParams.set((m==null?void 0:m.pageLabel)||"page",B.page.toString()),J.current=f.href}xe().then(f=>{U&&(ue(!1),be({...B,isLoading:!1}),G([...L,...f]))})}},[B]),N.useEffect(()=>{var f;de<768&&(oe?(Mr("select"),document.body.style.overflow="hidden",(f=te.current)==null||f.focus()):(window.location.hash&&!document.referrer.includes("#")&&wr(),document.body.style.overflow="auto"))},[oe]),N.useEffect(()=>{z&&(d!=null&&d.length)?d!=null&&d.find(f=>f[O]===z)?we(d==null?void 0:d.find(f=>f[O]===z)):we(z):q!==void 0&&we(void 0)},[z]),N.useEffect(()=>{q&&u&&(R!=null&&R.length&&(L!=null&&L.find(f=>f[O]===q[O]))?F((L==null?void 0:L.find(f=>f[O]===q[O])[R])||""):F(q))},[q]),N.useEffect(()=>{C&&he(!1)},[C]),N.useEffect(()=>{d!=null&&d.length&&G(d)},[d]);const Se=()=>{u&&G(d),he(f=>!f)},$e=()=>{u&&(G(d),F(typeof q=="string"?q:q?q[R]:"")),he(!1)},Pe=f=>{u&&(R!=null&&R.length?F(f[R]):F(f)),we(f),Se(),ee&&ee(f)},De=f=>{if(!q)return"";if(O!=null&&O.length&&f[O]===q[O])return`naria-select__option--active ${D==null?void 0:D.optionActive}`;if(f===q)return`naria-select__option--active ${D==null?void 0:D.optionActive}`},M=f=>{A!=null&&A.length&&(L!=null&&L.length)&&!B.isLoading&&f.target.offsetHeight+f.target.scrollTop>=f.target.scrollHeight-100&&be({page:B.page+1,isLoading:!0})},E=f=>{var c,fe,Q;const T=(fe=(c=f==null?void 0:f.target)==null?void 0:c.value)!=null&&fe.length?d.filter(X=>{var ge,re;return typeof X=="object"?X[W!=null&&W.length?W:R].includes((ge=f==null?void 0:f.target)==null?void 0:ge.value):X.includes((re=f==null?void 0:f.target)==null?void 0:re.value)}):d;G(T),F((Q=f==null?void 0:f.target)==null?void 0:Q.value),oe||he(!0)};return Yn(me,te,$e),S.jsxs("div",{className:`naria-select ${ie?"naria-select--disabled":""} ${D==null?void 0:D.root}`,"data-class-prop":"root",children:[S.jsxs("label",{className:`naria-select__label ${Y&&"naria-select__label--error"} ${D==null?void 0:D.label}`,"data-class-prop":"label",children:[S.jsx("span",{className:`naria-select__title ${D==null?void 0:D.title}`,"data-class-prop":"title",children:g}),u?S.jsxs("div",{className:`naria-select__search-input-root ${D.searchInputRoot}`,"data-class-prop":"searchInputRoot",children:[S.jsx("input",{ref:te,placeholder:x!=null&&x.length?x:"Select",className:`naria-select__search-input ${q?"naria-select__search-input--selected":""}
|
|
22
|
+
<%s key={someKey} {...props} />`,T,Q,X,Q),De[Q+T]=!0)}if(Q=null,f!==void 0&&(Y(f),Q=""+f),z(E)&&(Y(E.key),Q=""+E.key),"key"in E){f={};for(var ge in E)ge!=="key"&&(f[ge]=E[ge])}else f=E;return Q&&x(f,typeof M=="function"?M.displayName||M.name||"Unknown":M),m(M,Q,f,R(),c,fe)}function u(M){D(M)?M._store&&(M._store.validated=1):typeof M=="object"&&M!==null&&M.$$typeof===b&&(M._payload.status==="fulfilled"?D(M._payload.value)&&M._payload.value._store&&(M._payload.value._store.validated=1):M._store&&(M._store.validated=1))}function D(M){return typeof M=="object"&&M!==null&&M.$$typeof===U}var ee=N,U=Symbol.for("react.transitional.element"),de=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),oe=Symbol.for("react.strict_mode"),he=Symbol.for("react.profiler"),_e=Symbol.for("react.consumer"),ue=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),we=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),B=Symbol.for("react.client.reference"),be=ee.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=Object.prototype.hasOwnProperty,me=Array.isArray,te=console.createTask?console.createTask:function(){return null};ee={react_stack_bottom_frame:function(M){return M()}};var xe,Se={},$e=ee.react_stack_bottom_frame.bind(ee,A)(),Pe=te(g(A)),De={};jt.Fragment=C,jt.jsx=function(M,E,f){var T=1e4>be.recentlyCreatedOwnerStacks++;return W(M,E,f,!1,T?Error("react-stack-top-frame"):$e,T?te(g(M)):Pe)},jt.jsxs=function(M,E,f){var T=1e4>be.recentlyCreatedOwnerStacks++;return W(M,E,f,!0,T?Error("react-stack-top-frame"):$e,T?te(g(M)):Pe)}})()),jt}var cn;function co(){return cn||(cn=1,process.env.NODE_ENV==="production"?Gt.exports=uo():Gt.exports=lo()),Gt.exports}var S=co();const Jt=({classNames:d={root:"",color:""}})=>S.jsxs("svg",{className:`naria-loading ${d.root}`,"data-prop":"root",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[S.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"}),S.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:d.color,"data-prop":"color"})]}),ho=({type:d="button",classNames:O={root:"",loading:{root:"",color:""}},value:Y,icon:g=void 0,isLoading:R=!1,isDisabled:A=!1,...z})=>S.jsxs("button",{type:d,disabled:A,...z,className:`naria-button ${A?"naria-button--disabled":""} ${O==null?void 0:O.root}`,"data-class-prop":"root",children:[R?S.jsx(Jt,{classNames:{root:O.loading.root,color:O.loading.color},"data-class-prop":"root","data-class-prop-color":"color"}):g,Y]}),dn=d=>Le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...d},Le.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"})),Dn=d=>Le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",...d},Le.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"})),hn=d=>Le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",...d},Le.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"})),Yn=(d,O,Y)=>{N.useEffect(()=>{function g(R){O.current&&!O.current.contains(R.target)&&(d!=null&&d.current)&&!(d!=null&&d.current.contains(R.target))&&Y()}return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[d,Y])},gr=()=>{const[d,O]=N.useState(typeof window<"u"?window.innerWidth:0),Y=()=>O(typeof window<"u"?window.innerWidth:0);return N.useEffect(()=>(window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)),[d]),d},wr=()=>{const d=`${window.location.pathname}${window.location.search}`;window.history.replaceState(null,"",d)},Mr=d=>{window.location.hash=d},pr=d=>{const[O,Y]=N.useState(!1);return N.useEffect(()=>{const g=R=>{window.location.hash!==d?Y(!0):Y(!1)};return window.addEventListener("hashchange",g),()=>{window.removeEventListener("hashchange",g)}},[]),O},fo=({options:d,label:O,hasError:Y,title:g,value:R,api:A,selected:z,placeholder:x,disabled:ie=!1,pagination:m,optionFilterLabel:W,hasSearch:u=!1,classNames:D={root:"",label:"",title:"",button:"",searchInput:"",listRoot:"",list:"",option:"",optionActive:"",mobileHeader:"",errorText:"",searchInputRoot:"",iconRoot:"",closeIcon:"",arrowIcon:"",searchIcon:""},onSelectChange:ee})=>{let U=!0;const de=gr(),C=pr("#select"),[oe,he]=N.useState(!1),[_e,ue]=N.useState(!0),[q,we]=N.useState(void 0),[L,G]=N.useState(void 0),[b,F]=N.useState(""),[B,be]=N.useState({page:1,pageLabel:"page",size:20,sizeLabel:"size",isLoading:!1}),J=N.useRef(void 0),me=N.useRef(void 0),te=N.useRef(void 0),xe=async()=>{if(J!=null&&J.current)try{const f=await fetch(J==null?void 0:J.current);if(!f.ok)throw new Error(`Response status: ${f.status}`);return await f.json()}catch(f){console.error(f)}};N.useEffect(()=>()=>{U=!1},[]),N.useEffect(()=>{if(A!=null&&A.length){if(J.current=A,J.current.includes((m==null?void 0:m.pageLabel)||"page")){const f=new URL(A);f.searchParams.set((m==null?void 0:m.pageLabel)||"page",((m==null?void 0:m.page)||B.page).toString()),f.searchParams.set((m==null?void 0:m.sizeLabel)||"size",((m==null?void 0:m.size)||B.size).toString()),J.current=f.href}ue(!0),xe().then(f=>{U&&(ue(!1),G(f))})}},[A,m]),N.useEffect(()=>{if(B.isLoading){if(J.current.includes((m==null?void 0:m.pageLabel)||"page")){const f=new URL(J.current);f.searchParams.set((m==null?void 0:m.pageLabel)||"page",B.page.toString()),J.current=f.href}xe().then(f=>{U&&(ue(!1),be({...B,isLoading:!1}),G([...L,...f]))})}},[B]),N.useEffect(()=>{var f;de<768&&(oe?(Mr("select"),document.body.style.overflow="hidden",(f=te.current)==null||f.focus()):(window.location.hash&&!document.referrer.includes("#")&&wr(),document.body.style.overflow="auto"))},[oe]),N.useEffect(()=>{z&&(d!=null&&d.length)?d!=null&&d.find(f=>f[O]===z)?we(d==null?void 0:d.find(f=>f[O]===z)):we(z):q!==void 0&&(we(void 0),F(""))},[z]),N.useEffect(()=>{q&&u&&(R!=null&&R.length&&(L!=null&&L.find(f=>f[O]===q[O]))?F((L==null?void 0:L.find(f=>f[O]===q[O])[R])||""):F(q))},[q]),N.useEffect(()=>{C&&he(!1)},[C]),N.useEffect(()=>{d!=null&&d.length&&G(d)},[d]);const Se=()=>{u&&G(d),he(f=>!f)},$e=()=>{u&&(G(d),F(typeof q=="string"?q:q?q[R]:"")),he(!1)},Pe=f=>{u&&(R!=null&&R.length?F(f[R]):F(f)),we(f),Se(),ee&&ee(f)},De=f=>{if(!q)return"";if(O!=null&&O.length&&f[O]===q[O])return`naria-select__option--active ${D==null?void 0:D.optionActive}`;if(f===q)return`naria-select__option--active ${D==null?void 0:D.optionActive}`},M=f=>{A!=null&&A.length&&(L!=null&&L.length)&&!B.isLoading&&f.target.offsetHeight+f.target.scrollTop>=f.target.scrollHeight-100&&be({page:B.page+1,isLoading:!0})},E=f=>{var c,fe,Q;const T=(fe=(c=f==null?void 0:f.target)==null?void 0:c.value)!=null&&fe.length?d.filter(X=>{var ge,re;return typeof X=="object"?X[W!=null&&W.length?W:R].includes((ge=f==null?void 0:f.target)==null?void 0:ge.value):X.includes((re=f==null?void 0:f.target)==null?void 0:re.value)}):d;G(T),F((Q=f==null?void 0:f.target)==null?void 0:Q.value),oe||he(!0)};return Yn(me,te,$e),S.jsxs("div",{className:`naria-select ${ie?"naria-select--disabled":""} ${D==null?void 0:D.root}`,"data-class-prop":"root",children:[S.jsxs("label",{className:`naria-select__label ${Y&&"naria-select__label--error"} ${D==null?void 0:D.label}`,"data-class-prop":"label",children:[S.jsx("span",{className:`naria-select__title ${D==null?void 0:D.title}`,"data-class-prop":"title",children:g}),u?S.jsxs("div",{className:`naria-select__search-input-root ${D.searchInputRoot}`,"data-class-prop":"searchInputRoot",children:[S.jsx("input",{ref:te,placeholder:x!=null&&x.length?x:"Select",className:`naria-select__search-input ${q?"naria-select__search-input--selected":""}
|
|
23
23
|
${Y&&"naria-select__search-input--error"} ${D==null?void 0:D.searchInput}`,value:b,disabled:ie,type:"text",onClick:Se,onChange:E,"data-class-prop":"searchInput"}),S.jsx("div",{className:`naria-select__icon-root ${D==null?void 0:D.iconRoot}`,"data-class-prop":"iconRoot",children:oe?S.jsx("div",{className:`naria-select__search-icon ${D==null?void 0:D.searchIcon}`,"data-class-prop":"searchIcon",children:S.jsx(hn,{})}):S.jsx("div",{className:`naria-select__arrow-icon ${D==null?void 0:D.arrowIcon} ${oe?"naria-select__arrow-icon--rotate-180":""}`,"data-class-prop":"arrowIcon",children:S.jsx(dn,{})})})]}):S.jsxs("button",{type:"button",ref:te,disabled:ie,className:`naria-select__handler ${q?"select__handler--selected":""}
|
|
24
24
|
${Y&&"select__handler--error"} ${D==null?void 0:D.button}`,"data-class-prop":"button",onClick:Se,children:[q?R!=null&&R.length?q[R]:q:x!=null&&x.length?x:"Select",S.jsx("div",{className:`naria-select__icon-root ${D==null?void 0:D.iconRoot}`,"data-class-prop":"iconRoot",children:S.jsx("div",{className:`naria-select__arrow-icon ${D==null?void 0:D.arrowIcon} ${oe?"naria-select__arrow-icon--rotate-180":""}`,"data-class-prop":"arrowIcon",children:S.jsx(dn,{})})})]})]}),oe?S.jsx("div",{className:`naria-select__list-root ${de<768?"naria-select__list-root--mobile":""} ${D==null?void 0:D.listRoot}`,"data-class-prop":"listRoot",ref:me,children:S.jsx("div",{className:`naria-select__list ${de<768?"naria-select__list--mobile":"naria-select__list--desktop"} ${D==null?void 0:D.list}`,"data-class-prop":"input",onScroll:M,children:A&&_e?S.jsx("div",{className:"naria-select__loading-root",children:S.jsx("div",{className:"naria-select__loading",children:S.jsx(Jt,{})})}):S.jsxs(S.Fragment,{children:[de<768?S.jsxs("div",{className:`naria-select__header--mobile ${D==null?void 0:D.mobileHeader}`,"data-class-prop":"mobileHeader",children:[u?S.jsxs("div",{className:`naria-select__search-input-root ${D.searchInputRoot}`,"data-class-prop":"searchInputRoot",children:[S.jsx("input",{ref:te,placeholder:x!=null&&x.length?x:"Select",className:`naria-select__search-input ${q?"naria-select__search-input--selected":""}
|
|
25
25
|
${D==null?void 0:D.searchInput} ${Y&&"naria-select__search-input--error"}`,"data-class-prop":"input",value:b,disabled:ie,type:"text",onChange:E}),S.jsx("div",{className:`naria-select__icon-root ${D==null?void 0:D.iconRoot}`,"data-class-prop":"iconRoot",children:S.jsx("div",{className:"naria-select__search-icon","data-class-prop":"searchIcon",children:S.jsx(hn,{})})})]}):void 0,S.jsx("button",{className:`naria-select__close-icon ${D==null?void 0:D.closeIcon}`,onClick:$e,disabled:ie,"data-class-prop":"closeIcon",children:S.jsx(Dn,{})})]}):void 0,L!=null&&L.length?S.jsx(S.Fragment,{children:L==null?void 0:L.map((f,T)=>S.jsx("button",{type:"button",onClick:()=>Pe(f),disabled:ie,className:`naria-select__option ${D==null?void 0:D.option} ${De(f)}`,"data-class-prop":"option","data-class-prop-active":"optionActive",children:R!=null&&R.length?f[R]:f},T.toString()))}):S.jsx("div",{children:"No Data"}),B.isLoading?S.jsx("div",{className:"naria-select__loading-more-root",children:S.jsx("div",{className:"naria-select__loading-more",children:S.jsx(Jt,{})})}):void 0]})})}):void 0,Y&&S.jsx("p",{className:`naria-select--error-text ${D==null?void 0:D.errorText}`,"data-class-prop":"errorText",children:Y})]})},mo=({type:d="text",placeholder:O,classNames:Y={root:"",label:"",title:"",input:"",errorText:""},title:g,hasError:R,register:A,name:z,isDisabled:x=!1,autocomplete:ie=!1,...m})=>S.jsxs("div",{className:`naria-input ${Y.root}`,"data-class-prop":"root",children:[S.jsxs("label",{htmlFor:z,className:`${Y.label} ${R&&"naria-input__label--error"}`,"data-class-prop":"label",children:[S.jsx("span",{className:Y==null?void 0:Y.title,"data-class-prop":"title",children:g}),S.jsx("input",{disabled:x,autoComplete:ie?"on":"off",id:z,...A,...m,type:d,name:z,className:`${Y.input} ${R&&"naria-input__input--error"}`,placeholder:O,"data-class-prop":"input"})]}),R&&S.jsx("p",{className:`naria-input--error-text ${Y==null?void 0:Y.errorText}`,"data-class-prop":"errorText",children:R})]}),vn=({children:d})=>io.createPortal(d,document.body),yo=({classNames:d={root:"",backdrop:"",content:""},backdrop:O="opaque",placement:Y="bottom-start",isOpen:g=!1,onOpenChange:R,children:A,...z})=>{const[x,ie]=N.Children.toArray(A),[m,W]=N.useState({type:"fade-in-scale",position:""}),[u,D]=N.useState({top:void 0,bottom:void 0,left:void 0,right:void 0}),ee=gr(),U=N.useRef(void 0),de=N.useRef(void 0),C=N.useRef(window.crypto.randomUUID()),oe=pr("#"+C.current),he=()=>{R&&R(!1)},_e=()=>{R&&R(!g)};Yn(U,de,he),N.useEffect(()=>{var we;ee<768?g?(document.body.style.overflow="hidden",(we=de.current)==null||we.focus(),setTimeout(()=>{Mr(C.current)},50)):(window.location.hash&&!document.referrer.includes("#")&&wr(),document.body.style.overflow="auto"):g?setTimeout(()=>{ue()},0):D({top:void 0,bottom:void 0,left:void 0,right:void 0})},[g]),N.useEffect(()=>{oe&&he()},[oe]),N.useEffect(()=>(document.addEventListener("scroll",he,{capture:!0}),()=>{document.removeEventListener("scroll",he,{capture:!0})}),[]);const ue=()=>{var we;if(de!=null&&de.current&&U.current){const L=((we=document.documentElement)==null?void 0:we.getAttribute("dir"))==="rtl",G=U.current.getBoundingClientRect(),b=de.current.getBoundingClientRect();switch(!0){case Y==="bottom-start":{window.innerHeight-b.bottom>G.height?(W({type:m.type,position:"transform-origin-top-start"}),D({top:b.bottom+window.scrollY,bottom:void 0,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0})):(W({type:m.type,position:"transform-origin-bottom-start"}),D({top:void 0,bottom:window.innerHeight-b.top-window.scrollY,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0}));break}case Y==="bottom-end":{(window.innerHeight||document.documentElement.clientHeight)-b.bottom>G.height?(W({type:m.type,position:"transform-origin-top-end"}),D({top:b.bottom+window.scrollY,bottom:void 0,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0})):(W({type:m.type,position:"transform-origin-bottom-end"}),D({top:void 0,bottom:window.innerHeight-b.top-window.scrollY,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0}));break}case Y==="bottom":{let F={y:"bottom",x:"center"},B={top:void 0,bottom:window.innerHeight-b.top-window.scrollY,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0};(window.innerHeight||document.documentElement.clientHeight)-b.bottom>G.height&&(F={...F,y:"top"},B={...B,top:b.bottom+window.scrollY,bottom:void 0}),L?(window.innerWidth||document.documentElement.clientWidth)-b.right>G.width/2-b.width/2?(B={...B,left:void 0,right:(window.innerWidth||document.documentElement.clientWidth)-b.right-(G.width/2-b.width/2)},F={...F,x:"center"}):F={...F,x:"start"}:G.width/2-b.width/2<b.left?(B={...B,left:b.left-(G.width/2-b.width/2),right:void 0},F={...F,x:"center"}):F={...F,x:"start"},W({type:m.type,position:`transform-origin-${F.y}-${F.x}`}),D(B);break}case Y==="top":{let F={y:"top",x:"center"},B={top:b.bottom+window.scrollY,bottom:void 0,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0};b.top-G.height>0&&(F={...F,y:"bottom"},B={...B,top:void 0,bottom:window.innerHeight-b.top-window.scrollY}),L?(window.innerWidth||document.documentElement.clientWidth)-b.right>G.width/2-b.width/2?(B={...B,left:void 0,right:(window.innerWidth||document.documentElement.clientWidth)-b.right-(G.width/2-b.width/2)},F={...F,x:"center"}):F={...F,x:"start"}:G.width/2-b.width/2<b.left?(B={...B,left:b.left-(G.width/2-b.width/2),right:void 0},F={...F,x:"center"}):F={...F,x:"start"},W({type:m.type,position:`transform-origin-${F.y}-${F.x}`}),D(B);break}case Y==="top-start":{b.top>G.height?(W({type:m.type,position:"transform-origin-bottom-start"}),D({top:void 0,bottom:window.innerHeight-b.top-window.scrollY,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0})):(W({type:m.type,position:"transform-origin-top-start"}),D({top:b.bottom+window.scrollY,bottom:void 0,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0}));break}case Y==="top-end":{b.top-G.height>0?(W({type:m.type,position:"transform-origin-bottom-end"}),D({top:void 0,bottom:window.innerHeight-b.top-window.scrollY,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0})):(W({type:m.type,position:"transform-origin-top-end"}),D({top:b.bottom+window.scrollY,bottom:void 0,left:L?void 0:b.left,right:L?(window.innerWidth||document.documentElement.clientWidth)-b.right:void 0}));break}}}},q=we=>{we.currentTarget===we.target&&he()};return N.useEffect(()=>(window.addEventListener("resize",ue),()=>{window.removeEventListener("resize",ue)}),[ue]),S.jsxs(S.Fragment,{children:[S.jsx("div",{className:`naria-popover ${d.root}`,"data-class-prop":"root",children:N.cloneElement(x,{onClick:()=>_e(),ref:de})}),g?S.jsx(vn,{children:ee<768?S.jsx("div",{onClick:q,className:`naria-popover__backdrop ${O!=="transparent"?`backdrop--${O}`:""} ${d.backdrop}`,"data-class-prop":"backdrop",children:S.jsx("div",{className:`naria-popover__content naria-popover__content--mobile ${d.content}`,"data-class-prop":"content",children:ie})}):S.jsx("div",{className:`naria-popover__content naria-popover__content--desktop ${m.type} ${m.position} ${d.content}`,ref:U,style:{bottom:u.bottom!==void 0?u.bottom:"unset",top:u.top!==void 0?u.top:"unset",left:u.left!==void 0?u.left:"unset",right:u.right!==void 0?u.right:"unset"},"data-class-prop":"content",children:ie})}):void 0]})},fn=d=>Le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 512",fill:"currentColor",...d},Le.createElement("path",{fill:"currentColor",d:"M241.5 239c9.4 9.4 9.4 24.6 0 33.9L81.5 433c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l143-143-143-143c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l160 160z"})),mn=d=>Le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",fill:"currentColor",...d},Le.createElement("path",{fill:"currentColor",d:"M81.5 433l160-160c9.4-9.4 9.4-24.6 0-33.9L81.5 79c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l143 143-143 143c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0zm192 0l160-160c9.4-9.4 9.4-24.6 0-33.9L273.5 79c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l143 143-143 143c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0z"}));var Vt={exports:{}};function kn(d){throw new Error('Could not dynamically require "'+d+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zt={exports:{}},_o=zt.exports,yn;function Dr(){return yn||(yn=1,(function(d,O){(function(Y,g){d.exports=g()})(_o,(function(){var Y;function g(){return Y.apply(null,arguments)}function R(e){Y=e}function A(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function z(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ie(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(x(e,t))return!1;return!0}function m(e){return e===void 0}function W(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function u(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function D(e,t){var r=[],n,s=e.length;for(n=0;n<s;++n)r.push(t(e[n],n));return r}function ee(e,t){for(var r in t)x(t,r)&&(e[r]=t[r]);return x(t,"toString")&&(e.toString=t.toString),x(t,"valueOf")&&(e.valueOf=t.valueOf),e}function U(e,t,r,n){return Lr(e,t,r,n,!0).utc()}function de(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function C(e){return e._pf==null&&(e._pf=de()),e._pf}var oe;Array.prototype.some?oe=Array.prototype.some:oe=function(e){var t=Object(this),r=t.length>>>0,n;for(n=0;n<r;n++)if(n in t&&e.call(this,t[n],n,t))return!0;return!1};function he(e){var t=null,r=!1,n=e._d&&!isNaN(e._d.getTime());if(n&&(t=C(e),r=oe.call(t.parsedDateParts,function(s){return s!=null}),n=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&r),e._strict&&(n=n&&t.charsLeftOver===0&&t.unusedTokens.length===0&&t.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(e))e._isValid=n;else return n;return e._isValid}function _e(e){var t=U(NaN);return e!=null?ee(C(t),e):C(t).userInvalidated=!0,t}var ue=g.momentProperties=[],q=!1;function we(e,t){var r,n,s,o=ue.length;if(m(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),m(t._i)||(e._i=t._i),m(t._f)||(e._f=t._f),m(t._l)||(e._l=t._l),m(t._strict)||(e._strict=t._strict),m(t._tzm)||(e._tzm=t._tzm),m(t._isUTC)||(e._isUTC=t._isUTC),m(t._offset)||(e._offset=t._offset),m(t._pf)||(e._pf=C(t)),m(t._locale)||(e._locale=t._locale),o>0)for(r=0;r<o;r++)n=ue[r],s=t[n],m(s)||(e[n]=s);return e}function L(e){we(this,e),this._d=new Date(e._d!=null?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),q===!1&&(q=!0,g.updateOffset(this),q=!1)}function G(e){return e instanceof L||e!=null&&e._isAMomentObject!=null}function b(e){g.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+e)}function F(e,t){var r=!0;return ee(function(){if(g.deprecationHandler!=null&&g.deprecationHandler(null,e),r){var n=[],s,o,_,$=arguments.length;for(o=0;o<$;o++){if(s="",typeof arguments[o]=="object"){s+=`
|
package/dist/naria-ui.es.js
CHANGED
|
@@ -460,7 +460,7 @@ const gr = ({
|
|
|
460
460
|
var f;
|
|
461
461
|
ce < 768 && (ie ? (Dr("select"), document.body.style.overflow = "hidden", (f = ee.current) == null || f.focus()) : (window.location.hash && !document.referrer.includes("#") && pr(), document.body.style.overflow = "auto"));
|
|
462
462
|
}, [ie]), ve(() => {
|
|
463
|
-
V && (d != null && d.length) ? d != null && d.find((f) => f[P] === V) ? ge(d == null ? void 0 : d.find((f) => f[P] === V)) : ge(V) : Z !== void 0 && ge(void 0);
|
|
463
|
+
V && (d != null && d.length) ? d != null && d.find((f) => f[P] === V) ? ge(d == null ? void 0 : d.find((f) => f[P] === V)) : ge(V) : Z !== void 0 && (ge(void 0), L(""));
|
|
464
464
|
}, [V]), ve(() => {
|
|
465
465
|
Z && l && ($ != null && $.length && (E != null && E.find((f) => f[P] === Z[P])) ? L((E == null ? void 0 : E.find((f) => f[P] === Z[P])[$]) || "") : L(Z));
|
|
466
466
|
}, [Z]), ve(() => {
|