@zvoove/unity-ui 2.22.0 → 2.22.1
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/llms.txt +1 -0
- package/dist/theme.css +2 -0
- package/dist/unity-ui.cjs.js +1 -1
- package/dist/unity-ui.css +1 -1
- package/dist/unity-ui.es.js +1 -1
- package/package.json +1 -1
package/dist/unity-ui.es.js
CHANGED
|
@@ -1963,7 +1963,7 @@ return e("div",{ref:e=>{e?M.current.set(t.id,e):M.current.delete(t.id)},"data-sn
|
|
|
1963
1963
|
/* @__PURE__ */e(nc,{...m||zh[t.variant],color:Bh[t.variant]}),
|
|
1964
1964
|
/* @__PURE__ */e("div",{className:"flex items-center",children:/* @__PURE__ */e($m,{color:Bh[t.variant],children:t.children})})]}),(d||t.showCloseButton)&&/* @__PURE__ */a(Jh,{direction:"row",gap:"sm",justify:"flex-end",align:C>p?"flex-start":"center",width:C>p?"100%":"fit-content",height:"100%",children:[d&&/* @__PURE__ */e("button",{className:Ph({variant:t.variant}),onClick:()=>{t.onAction?.(t.id),t.duration>0&&s(t.id)},children:t.actionLabel}),h&&/* @__PURE__ */e("button",{className:Gh(),onClick:()=>{t.onClose?.(t.id),s(t.id)},"aria-label":"Close snackbar",children:/* @__PURE__ */e(nc,{name:"close",size:"sm",color:Bh[t.variant]})})]})]})})})},t.id)})})},t)})});return b(A,document.body)};qh.displayName="Snackbar";const Yh=({children:a,maxSnackbars:t=3,defaultDuration:l=5e3})=>{const[n,r]=i([]),c=m(/* @__PURE__ */new Map),d=m(!1),h=o(e=>{const a=c.current.get(e);a?.timeoutId&&clearTimeout(a.timeoutId),c.current.delete(e),r(a=>a.map(a=>a.id===e?{...a,isRemoving:!0}:a)),setTimeout(()=>{r(a=>a.filter(a=>a.id!==e))},300)},[]),p=o((e,a={})=>{const n=a.id||Math.random().toString(36).substring(2,11),i={id:n,children:e,variant:a.variant||"default",placement:a.placement||"top-right",showCloseButton:a.showCloseButton??!0,icon:a.icon,actionLabel:a.actionLabel,onAction:a.onAction,onClose:a.onClose,duration:a.duration??l,createdAt:Date.now()};r(e=>{const a=e.filter(e=>e.placement===i.placement),l=e.filter(e=>e.placement!==i.placement),n=[...a,i];return[...l,...n.length>t?n.slice(-t):n]});const o=i.duration;if(o&&o>0){const e=Date.now();let a=null;d.current||(a=setTimeout(()=>{h(n)},o)),c.current.set(n,{timeoutId:a,startTime:e,remainingDuration:o})}return n},[l,t,h]),u=o(()=>{for(const e of c.current.values())e.timeoutId&&clearTimeout(e.timeoutId);c.current.clear(),r([])},[]),C=o(()=>{if(d.current)return;d.current=!0;const e=Date.now();for(const[a,t]of c.current.entries())if(t.timeoutId){const l=e-t.startTime,n=Math.max(0,t.remainingDuration-l);clearTimeout(t.timeoutId),c.current.set(a,{...t,timeoutId:null,remainingDuration:n})}},[]),H=o(()=>{if(!d.current)return;d.current=!1;const e=Date.now();for(const[a,t]of c.current.entries())if(t.remainingDuration>0&&!t.timeoutId){const l=setTimeout(()=>{h(a)},t.remainingDuration);c.current.set(a,{timeoutId:l,startTime:e,remainingDuration:t.remainingDuration})}},[h]),g=s(()=>({snackbars:n,addSnackbar:p,removeSnackbar:h,clearAll:u,pauseTimeouts:C,resumeTimeouts:H}),[n,p,h,u,C,H]);/* @__PURE__ */
|
|
1965
1965
|
return e(Uh.Provider,{value:g,children:a})},Xh=()=>{const{addSnackbar:e,removeSnackbar:a,clearAll:t}=(()=>{const e=V(Uh);if(!e)throw new Error("useSnackbarContext must be used within a SnackbarProvider");return e})();return{snackbar:o((a,t)=>e(a,t),[e]),dismiss:o(e=>{a(e)},[a]),dismissAll:o(()=>{t()},[t])}},Kh=Ya({base:["flex"],variants:{hasClassName:{false:"w-full"},...ie,...ee,...te,...ne,...K,...R,...q}}),Jh=d(({children:a,gap:t="md",direction:l="column",justify:n,align:r="baseline",wrap:i,className:o,padding:s,margin:c,height:m,width:d,minHeight:h,maxHeight:p,minWidth:u,maxWidth:C,...H},g)=>{o&&(Po(!qo(o),"@Stack: className only accepts tailwindcss classes that defines height or width. \n\nExample: h-[200px], w-[200px], h-full, w-full, size-full, size-[500px]"),Go(!!qo(o),"@Stack: className is deprecated. Use the `height`, `width`, `minHeight`, `maxHeight`, `minWidth`, `maxWidth` props instead. In v3.0.0, the className prop will be removed."));const f=ps(m),V=ps(d),Z=ps(h),x=ps(p),M=ps(u),v=ps(C);/* @__PURE__ */
|
|
1966
|
-
return e("span",{ref:g,className:Kh({...ds(s,c,t),...Hs(l,n,r,i),hasClassName:Boolean(o),className:o}),...H,style:{height:f,width:V,minHeight:Z,maxHeight:x,minWidth:M,maxWidth:v},children:a})});Jh.displayName="Stack";const Qh=Ya({base:["relative","inline-flex","items-center","cursor-pointer","border-2","rounded-full","transition-colors","w-[52px]","h-[32px]","shrink-0","group","has-[:focus-visible]:ring-2","has-[:focus-visible]:ring-primary","has-[:focus-visible]:ring-offset-2","has-[:focus-visible]:outline-none"],variants:{checked:{true:["bg-primary","border-primary","peer-hover/thumb:bg-primary-container"],false:["bg-transparent","border-outline"]},disabled:{true:["opacity-10","!cursor-not-allowed"]}},compoundVariants:[{checked:!0,disabled:!0,class:["border-outline!","bg-outline!"]}],defaultVariants:{checked:!1,disabled:!1}}),ep=Ya({base:["rounded-full","transform","transition-all","flex","items-center","justify-center",'before:content-[""]',"before:absolute","before:size-[24px]","before:rounded-full","before:transition-all","before:transform","before:opacity-0",'after:content-[""]',"after:absolute","after:size-full","after:rounded-full","after:transition-colors","after:top-[0]","after:left-[0]"],variants:{checked:{true:["size-[24px]","translate-x-[22px]","bg-primary-container","text-on-primary-container","after:bg-on-primary","group-hover:after:bg-primary-container","before:bg-primary"],false:["translate-x-[3px]","text-
|
|
1966
|
+
return e("span",{ref:g,className:Kh({...ds(s,c,t),...Hs(l,n,r,i),hasClassName:Boolean(o),className:o}),...H,style:{height:f,width:V,minHeight:Z,maxHeight:x,minWidth:M,maxWidth:v},children:a})});Jh.displayName="Stack";const Qh=Ya({base:["relative","inline-flex","items-center","cursor-pointer","border-2","rounded-full","transition-colors","w-[52px]","h-[32px]","shrink-0","group","has-[:focus-visible]:ring-2","has-[:focus-visible]:ring-primary","has-[:focus-visible]:ring-offset-2","has-[:focus-visible]:outline-variant-low-none"],variants:{checked:{true:["bg-primary","border-primary","peer-hover/thumb:bg-primary-container"],false:["bg-transparent","border-outline-variant-low"]},disabled:{true:["opacity-10","!cursor-not-allowed"]}},compoundVariants:[{checked:!0,disabled:!0,class:["border-outline-variant-low!","bg-outline-variant-low!"]}],defaultVariants:{checked:!1,disabled:!1}}),ep=Ya({base:["rounded-full","transform","transition-all","flex","items-center","justify-center",'before:content-[""]',"before:absolute","before:size-[24px]","before:rounded-full","before:transition-all","before:transform","before:opacity-0",'after:content-[""]',"after:absolute","after:size-full","after:rounded-full","after:transition-colors","after:top-[0]","after:left-[0]"],variants:{checked:{true:["size-[24px]","translate-x-[22px]","bg-primary-container","text-on-primary-container","after:bg-on-primary","group-hover:after:bg-primary-container","before:bg-primary"],false:["translate-x-[3px]","text-on-primary","after:bg-outline-variant-low","group-hover:after:bg-on-surface-variant","before:bg-outline-variant-low"]},animate:{true:["before:animate-ripple"]},disabled:{true:[]},withIcons:{true:[]}},compoundVariants:[{checked:!0,disabled:!0,class:["after:bg-container"]},{checked:!1,disabled:!0,class:["after:bg-outline-variant-low"]},{checked:!1,withIcons:!0,class:["size-[24px]","before:top-[0]","before:left-[0]"]},{checked:!1,withIcons:!1,class:["size-[16px]","translate-x-[6px]","before:top-[-4px]","before:left-[-4px]"]}],defaultVariants:{checked:!1}}),ap=d(({checked:l=!1,disabled:n=!1,onChange:r=()=>{},name:o,value:s,id:c,withIcons:m=!1,label:d,labelPlacement:p="left",justify:u="flex-start",...C},H)=>{const[g,f]=i(!1),V=h(),Z=c??V,x=e=>{n||(f(!0),r(e),setTimeout(()=>{f(!1)},500))};let M=null;!0===m?M={on:"check",off:"close"}:!1!==m&&(M=m);const v=void 0!==d,A=["space-between","space-around","space-evenly","flex-end","center"].includes(u);/* @__PURE__ */
|
|
1967
1967
|
return e("label",{htmlFor:Z,className:`cursor-pointer ${A?"w-full":"w-fit"} inline-block prevent-select`,"aria-label":"string"==typeof d?d:v?void 0:"Toggle switch",children:/* @__PURE__ */a(Jh,{direction:"row",gap:"sm",align:"center",justify:u,width:A?"100%":"fit-content",children:[v&&"left"===p&&/* @__PURE__ */a($m,{variant:"body",size:"large",children:["string"==typeof d&&d,"object"==typeof d&&/* @__PURE__ */e(t,{children:l?d.on:d.off})]}),
|
|
1968
1968
|
/* @__PURE__ */a("span",{className:Qh({checked:l,disabled:n}),children:[
|
|
1969
1969
|
/* @__PURE__ */e("input",{id:Z,name:o,value:s,type:"checkbox",checked:l,"aria-checked":l,"aria-disabled":n,disabled:n,onChange:x,onKeyDown:e=>{"Space"===e.key&&(e.preventDefault(),e.stopPropagation(),x({target:{checked:l}}))},className:"sr-only",ref:H,tabIndex:n?-1:0,...C}),
|