@noxickon/onyx 1.0.1 → 1.0.3

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,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../chunks/ui-ChsTPgui.js"),m=require("../chunks/query-BhvXa-m6.js"),E=require("../chunks/useAuth-DxoDe3YA.js"),h=require("../chunks/hooks-DiKvsNs-.js"),u=require("react");function A({adminRole:s="admin",children:r,getCurrentUserQuery:n=m.DEFAULT_GET_CURRENT_USER,options:o={},pollInterval:l=300*1e3}){const{data:a,error:O,loading:f,refetch:e}=h.useQuery(n,{fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first",errorPolicy:"all",pollInterval:l,...o}),t=!!a?.me,i=a?.me?.role===s;return c.jsxRuntimeExports.jsx(E.OxAuthContext.Provider,{value:{user:a?.me||null,loading:f,error:O??null,isLoggedIn:t,isAdmin:i,refreshUser:e},children:r})}const g=h.gql`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../chunks/ui-WTrU_DUw.js"),m=require("../chunks/query-BhvXa-m6.js"),E=require("../chunks/useAuth-DxoDe3YA.js"),h=require("../chunks/hooks-DiKvsNs-.js"),u=require("react");function A({adminRole:s="admin",children:r,getCurrentUserQuery:n=m.DEFAULT_GET_CURRENT_USER,options:o={},pollInterval:l=300*1e3}){const{data:a,error:O,loading:f,refetch:e}=h.useQuery(n,{fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first",errorPolicy:"all",pollInterval:l,...o}),t=!!a?.me,i=a?.me?.role===s;return c.jsxRuntimeExports.jsx(E.OxAuthContext.Provider,{value:{user:a?.me||null,loading:f,error:O??null,isLoggedIn:t,isAdmin:i,refreshUser:e},children:r})}const g=h.gql`
2
2
  query getFeatures {
3
3
  features
4
4
  }
@@ -1,4 +1,4 @@
1
- import { _ as d, $ as h, o as D } from "../chunks/ui-DxsSYHCv.js";
1
+ import { _ as d, $ as h, o as D } from "../chunks/ui-BgyYCO2P.js";
2
2
  import { D as E } from "../chunks/query-iDn3qBGF.js";
3
3
  import { O as F } from "../chunks/useAuth-BFgXzu6Q.js";
4
4
  import { u as H } from "../chunks/useAuth-BFgXzu6Q.js";
package/dist/index.d.ts CHANGED
@@ -1385,7 +1385,7 @@ export declare const OxSelect: typeof OxSelect_2 & {
1385
1385
  Trigger: typeof OxSelectTrigger;
1386
1386
  };
1387
1387
 
1388
- declare const OxSelect_2: ({ children, className, defaultValue, disabled, error, id: propId, multiple, onChange, required, size, value, wrapperClassName, }: OxSelectProps) => JSX.Element;
1388
+ declare const OxSelect_2: ({ children, className, defaultValue, disabled, error, id: propId, isLoading, multiple, onChange, required, size, value, wrapperClassName, }: OxSelectProps) => JSX.Element;
1389
1389
 
1390
1390
  declare const OxSelectContent: ({ children, className, ...domProps }: OxSelectContentProps) => JSX.Element;
1391
1391
 
@@ -1424,6 +1424,7 @@ export declare interface OxSelectProps extends Omit<HTMLAttributes<HTMLDivElemen
1424
1424
  defaultValue?: string | string[] | number | number[] | null;
1425
1425
  disabled?: boolean;
1426
1426
  error?: boolean;
1427
+ isLoading?: boolean;
1427
1428
  multiple?: boolean;
1428
1429
  onChange?: (value: string | number | null | (string | number | null)[], name?: string) => void;
1429
1430
  required?: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/ui-ChsTPgui.js"),x=require("react"),C=({brand:t,children:n,className:s,hasSidebar:r=!1,navClassName:o,toggleSidebar:a,...i})=>e.jsxRuntimeExports.jsx("header",{className:e.cn("max-h-15 min-h-15 sticky top-0 z-10 bg-gray-100",s),"data-ox-slot":"header",...i,children:e.jsxRuntimeExports.jsxs("nav",{className:e.cn("max-w-10xl mx-auto flex items-center justify-between px-4 py-2.5",o),children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-[17px]",children:[r?e.jsxRuntimeExports.jsx(e.OxButton,{"aria-label":"Open menu","data-ox-slot":"header-toggle",size:"md",variant:"ghost",onClick:a,children:e.jsxRuntimeExports.jsx(e.OxButton.Icon,{path:"mdiMenu"})}):null,t?e.jsxRuntimeExports.jsx("div",{children:t}):null]}),n]})}),O="group ox-gray-inset-focus items-center rounded-lg text-sm transition-colors text-left col-span-2 grid grid-cols-subgrid",h="size-10 justify-center",S="h-10 w-full px-2",v="bg-gray-300 text-gray-1200",I="h-15",y=x.createContext(void 0),k=({children:t,className:n,desktopCollapsed:s=!1,hasHeader:r=!1,mobileCollapsed:o=!0,onClose:a,...i})=>{const[l,d]=x.useState(window.innerWidth<e.MOBILE_BREAKPOINT),m=l?o:s,E=x.useMemo(()=>({collapsed:m,isMobile:l}),[m,l]);return x.useEffect(()=>{const u=()=>{d(window.innerWidth<e.MOBILE_BREAKPOINT)};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]),e.jsxRuntimeExports.jsx(y.Provider,{value:E,children:l?e.jsxRuntimeExports.jsx(e.OxDrawer,{open:!m,onOpenChange:u=>!u&&a?.(),children:e.jsxRuntimeExports.jsx(e.OxDrawer.Content,{closeOnOutsideClick:!!a,side:"left",...i,children:e.jsxRuntimeExports.jsxs("nav",{"aria-label":"Mobile navigation",className:e.cn("flex h-screen w-full flex-col bg-gray-100",n),"data-ox-slot":"sidebar",role:"navigation",...i,children:[a?e.jsxRuntimeExports.jsx("div",{className:e.cn("h-15 flex items-center gap-[17px] px-4",I),children:e.jsxRuntimeExports.jsx(e.OxButton,{"aria-label":"Close sidebar",size:"md",variant:"ghost",onClick:a,children:e.jsxRuntimeExports.jsx(e.OxButton.Icon,{path:"mdiClose"})})}):null,t]})})}):e.jsxRuntimeExports.jsx("nav",{"aria-label":"Desktop navigation",className:e.cn("sticky box-content flex flex-col overflow-y-auto bg-gray-100",{"top-0 h-screen":!r,"viewport-minus-header top-15":r,'max-w-18 min-w-18 [&_[data-ox-slot="sidebar-label"]]:hidden':m,"min-w-64 max-w-64":!m},n),"data-ox-slot":"sidebar",role:"navigation",...i,children:t})})},g=()=>{const t=x.useContext(y);if(!t)throw new Error("useSidebar must be used within a SidebarProvider");return t},L=({children:t,className:n,...s})=>{const{collapsed:r,isMobile:o}=g();return e.jsxRuntimeExports.jsx("div",{className:e.cn("grid flex-1 content-start gap-y-1 overflow-y-auto p-4",{"grid-cols-1 place-items-center":r&&!o,"grid-cols-[auto_1fr]":!r||o},'[&_[data-ox-slot="sidebar-link"]]:col-span-2 [&_[data-ox-slot="sidebar-link"]]:grid [&_[data-ox-slot="sidebar-link"]]:grid-cols-subgrid','[&_[data-ox-slot="sidebar-button"]]:col-span-2 [&_[data-ox-slot="sidebar-button"]]:grid [&_[data-ox-slot="sidebar-button"]]:grid-cols-subgrid','[&_[data-ox-slot="sidebar-icon"]]:justify-self-center [&_[data-ox-slot="sidebar-icon"]]:[grid-column-start:var(--ox-menu-icon-col)]','[&_[data-ox-slot="sidebar-label"]]:[grid-column-start:var(--ox-menu-label-col)]',n),"data-ox-slot":"sidebar-body",...s,children:t})},_=({active:t=!1,children:n,className:s,disabled:r=!1,...o})=>{const{collapsed:a}=g();return e.jsxRuntimeExports.jsx("button",{className:e.cn("enabled:text-gray-1000 enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300",O,{[h]:a,[S]:!a,[v]:t&&!r,"disabled:ox-default-disabled":r},s),"data-ox-slot":"sidebar-button",disabled:r,type:"button",...o,"data-ox-state":t?"active":"inactive",children:n})},B=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("p-4",n),"data-ox-slot":"sidebar-footer",...s,children:t}),T=({children:t,className:n,headline:s,...r})=>{const{collapsed:o,isMobile:a}=g();return e.jsxRuntimeExports.jsxs("div",{className:e.cn("contents",n),"data-ox-slot":"sidebar-group",...r,children:[e.jsxRuntimeExports.jsx("h3",{className:e.cn("text-gray-1000 col-span-full mb-2 mt-4 block cursor-default text-xs",{invisible:o&&!a}),children:s}),t]})},z=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("h-15 flex items-center px-4",n),"data-ox-slot":"sidebar-header",...s,children:t}),A=({className:t,size:n=.8,...s})=>{const{collapsed:r}=g();return e.jsxRuntimeExports.jsx(e.OxIcon,{className:e.cn("shrink-0 text-current",{"mr-2":!r},t),"data-ox-slot":"sidebar-icon",size:n,...s})},D=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("span",{className:e.cn("overflow-hidden text-ellipsis",n),"data-ox-slot":"sidebar-label",...s,children:t}),H=({active:t=!1,children:n,className:s,disabled:r=!1,href:o,...a})=>{const{collapsed:i}=g();return e.jsxRuntimeExports.jsx("a",{"aria-current":t?"page":void 0,className:e.cn(O,{[h]:i,[S]:!i,[v]:t&&!r,"text-gray-1000 hover:text-gray-1200 cursor-pointer hover:bg-gray-300":!t&&!r,"ox-default-disabled":r},s),"data-ox-slot":"sidebar-link",href:r?void 0:o,role:"link",onClick:r?l=>l.preventDefault():void 0,...a,"data-ox-state":t?"active":"inactive",children:n})},b=k;b.Body=L;b.Button=_;b.Footer=B;b.Group=T;b.Header=z;b.Icon=A;b.Label=D;b.Link=H;const P=({children:t,className:n,color:s="purple",icon:r,subtitle:o,title:a,...i})=>{const l=a||o||r,d=e.COLOR_STYLES[s];return e.jsxRuntimeExports.jsxs("main",{"aria-labelledby":l?"main-headline":void 0,className:e.cn("w-full p-6",n),"data-ox-slot":"main-content",...i,children:[l?e.jsxRuntimeExports.jsx("div",{className:"mb-8 border-b border-gray-400 pb-6",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4",children:[r?e.jsxRuntimeExports.jsx("div",{className:e.cn("rounded-lg border p-3",d.border,d.background),children:e.jsxRuntimeExports.jsx(e.OxIcon,{className:d.text,path:r,size:1.41})}):null,e.jsxRuntimeExports.jsxs("div",{children:[a?e.jsxRuntimeExports.jsx("h2",{id:"main-headline",className:"text-gray-1200 text-xl font-semibold","data-ox-slot":"main-headline",children:a}):null,o&&e.jsxRuntimeExports.jsx("p",{className:"mt-1 text-sm",children:o})]})]})}):null,t]})},G=({children:t,className:n,...s})=>{const{isMobile:r}=j();return e.jsxRuntimeExports.jsx("div",{className:e.cn("max-w-10xl mx-auto grid min-h-screen bg-transparent",r?"grid-cols-1":"grid-cols-[auto_1fr]",n),"data-ox-slot":"app-layout",...s,children:t})},$=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("main",{className:e.cn("flex flex-col overflow-y-auto",n),"data-ox-slot":"main-content",...s,children:t}),W=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex-1 overflow-y-auto px-6 py-6",n),"data-ox-slot":"main-content-body",...s,children:t}),Y=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex-shrink-0 border-b border-gray-400 bg-gray-100 px-6 py-4",n),"data-ox-slot":"main-content-header",...s,children:t}),F=Object.assign($,{Header:Y,Body:W}),R=x.createContext(void 0);function j(){const t=x.useContext(R);if(!t)throw new Error("useOxSidebar must be used within a SidebarProvider");return t}const K=256,q=({children:t,className:n,...s})=>{const{isMobile:r,mobileOpen:o,toggleSidebar:a}=j();return r?e.jsxRuntimeExports.jsx(e.OxDrawer,{open:o,onOpenChange:a,children:e.jsxRuntimeExports.jsx(e.OxDrawer.Content,{closeOnOutsideClick:!0,side:"left",children:e.jsxRuntimeExports.jsx("aside",{className:e.cn("bg-gray-150 flex h-full flex-col",n),"data-ox-slot":"sidebar",...s,children:t})})}):e.jsxRuntimeExports.jsx("aside",{className:e.cn("bg-gray-150 sticky top-0 flex h-screen flex-col overflow-y-auto",n),"data-ox-slot":"sidebar",style:{width:K},...s,children:t})},V=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex-1 overflow-y-auto p-2",n),"data-ox-slot":"sidebar-content",...s,children:t}),J=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex shrink-0 flex-col p-2",n),"data-ox-slot":"sidebar-footer",...s,children:t}),Q=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex flex-wrap items-center gap-2",'[&_[data-ox-slot="sidebar-group-content"]]:w-full',n),"data-ox-slot":"sidebar-group",...s,children:t}),U=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("button",{className:e.cn("mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-md","enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:text-gray-900 enabled:hover:bg-gray-300","ox-gray-outset-focus disabled:ox-default-disabled",n),"data-ox-slot":"sidebar-group-action",type:"button",...s,children:t}),X=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn(n),"data-ox-slot":"sidebar-group-content",...s,children:t}),Z=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex flex-1 items-center pl-2 text-xs font-medium text-gray-900",n),"data-ox-slot":"sidebar-group-label",...s,children:t}),ee=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex shrink-0 flex-col p-2",n),"data-ox-slot":"sidebar-header",...s,children:t}),te=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("ul",{className:e.cn("flex flex-col items-stretch gap-1",n),"data-ox-slot":"sidebar-menu",...s,children:t}),se=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("button",{className:e.cn("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-transparent","enabled:text-gray-1200 enabled:cursor-pointer enabled:bg-transparent enabled:hover:bg-gray-300","ox-gray-outset-focus disabled:ox-default-disabled",n),"data-ox-slot":"sidebar-menu-action",type:"button",...s,children:t}),ne=({children:t,className:n})=>e.jsxRuntimeExports.jsx(e.OxBadge,{className:e.cn("ml-auto",n),"data-ox-slot":"sidebar-menu-badge",size:"sm",children:t}),w=x.createContext(void 0),N=()=>{const t=x.useContext(w);if(!t)throw new Error("useMenuItemContext must be used within MenuItemProvider");return t},M=({className:t,path:n,placeholder:s})=>e.jsxRuntimeExports.jsx(e.OxIcon,{className:e.cn("shrink-0",t),"data-ox-slot":"sidebar-menu-icon",path:n,placeholder:s,size:.8}),re=({children:t,className:n,disabled:s=!1,href:r,onClick:o,...a})=>{const{hasSub:i,isOpen:l,toggleOpen:d}=N(),m=e.cn("flex h-9 flex-1 items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-left text-sm","ox-gray-outset-focus",n);if(r)return e.jsxRuntimeExports.jsx("a",{"aria-disabled":s?"true":void 0,className:e.cn(m,{"text-gray-1200 cursor-pointer hover:bg-gray-300":!s,"ox-default-disabled":s}),"data-ox-slot":"sidebar-menu-button",href:s?void 0:r,onClick:s?u=>u.preventDefault():void 0,...a,children:t});const E=u=>{i&&d(),o&&o(u)};return e.jsxRuntimeExports.jsxs("button",{className:e.cn(m,"enabled:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300","disabled:ox-default-disabled"),"data-ox-slot":"sidebar-menu-button",disabled:s,type:"button",onClick:E,...a,children:[t,i?e.jsxRuntimeExports.jsx(M,{className:e.cn("ml-auto transition-transform duration-200",{"rotate-180":l}),path:"mdiChevronDown"}):null]})};function oe({children:t,defaultOpen:n=!1,hasSub:s=!1}){const[r,o]=x.useState(n),a=()=>o(i=>!i);return e.jsxRuntimeExports.jsx(w.Provider,{value:{hasSub:s,isOpen:r,setIsOpen:o,toggleOpen:a},children:t})}const ae=({children:t,className:n,defaultOpen:s=!1,hasSub:r=!1,...o})=>e.jsxRuntimeExports.jsx(oe,{defaultOpen:s,hasSub:r,children:e.jsxRuntimeExports.jsx("li",{className:e.cn("group flex flex-wrap items-center gap-x-2",n),"data-ox-slot":"sidebar-menu-item",...o,children:t})}),ie=({className:t})=>e.jsxRuntimeExports.jsx(e.OxSkeleton,{className:t,"data-ox-slot":"sidebar-menu-skeleton",fullWidth:!0,height:36}),xe=({children:t,className:n,...s})=>{const{isOpen:r}=N();return e.jsxRuntimeExports.jsx("div",{className:"ox-sidebar-submenu w-content grid w-full","data-ox-slot":"sidebar-menu-sub-wrapper","data-ox-state":r?"open":"closed",children:e.jsxRuntimeExports.jsx("ul",{className:e.cn("ml-4.5 flex flex-col gap-1 border-l border-gray-400 py-0.5 pl-2.5",n),"data-ox-slot":"sidebar-menu-sub",...s,children:t})})},le=({children:t,className:n,href:s,...r})=>{const o=e.cn("text-gray-1200 flex h-8 flex-1 cursor-pointer items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-left text-sm hover:bg-gray-300","ox-gray-outset-focus",n);return s?e.jsxRuntimeExports.jsx("a",{className:o,"data-ox-slot":"sidebar-menu-sub-button",href:s,...r,children:t}):e.jsxRuntimeExports.jsx("button",{className:o,"data-ox-slot":"sidebar-menu-sub-button",type:"button",...r,children:t})},de=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("li",{className:e.cn("flex items-center gap-2",n),"data-ox-slot":"sidebar-menu-sub-item",...s,children:t}),ce=({className:t,...n})=>e.jsxRuntimeExports.jsx(e.OxSeparator,{className:t,"data-ox-slot":"sidebar-separator",...n}),ue=({className:t,onClick:n})=>{const{isMobile:s,toggleSidebar:r}=j(),o=()=>{s?r():n&&n()},a=s||n;return e.jsxRuntimeExports.jsx("button",{"aria-label":"Toggle sidebar",className:e.cn("inline-flex size-8 items-center justify-center rounded-lg","text-gray-1200 border border-transparent bg-transparent",{"ox-gray-outset-focus cursor-pointer hover:bg-gray-300":a},t),"data-ox-slot":"sidebar-trigger",disabled:!a,type:"button",onClick:o,children:e.jsxRuntimeExports.jsx(e.OxIcon,{path:"mdiDockLeft",size:.8})})};function be({children:t}){const[n,s]=x.useState(!1),[r,o]=x.useState(!1);x.useEffect(()=>{const d=()=>{o(window.innerWidth<e.MOBILE_BREAKPOINT)};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]);const a=x.useCallback(()=>{s(!0)},[]),i=x.useCallback(()=>{s(!1)},[]),l=x.useCallback(()=>{s(d=>!d)},[]);return e.jsxRuntimeExports.jsx(R.Provider,{value:{closeSidebar:i,isMobile:r,mobileOpen:n,openSidebar:a,toggleSidebar:l},children:t})}const p=q,c=te,f=Q;p.Header=ee;p.Content=V;p.Footer=J;p.Separator=ce;p.Trigger=ue;c.Item=ae;c.Button=re;c.Icon=M;c.Badge=ne;c.Action=se;c.Skeleton=ie;c.Sub=xe;c.SubItem=de;c.SubButton=le;f.Label=Z;f.Action=U;f.Content=X;exports.OxAppLayout=G;exports.OxLegacyHeader=C;exports.OxLegacyMainContent=P;exports.OxLegacySidebar=b;exports.OxMainContent=F;exports.OxSidebar=p;exports.OxSidebarGroup=f;exports.OxSidebarMenu=c;exports.OxSidebarProvider=be;exports.useOxSidebar=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/ui-WTrU_DUw.js"),x=require("react"),C=({brand:t,children:n,className:s,hasSidebar:r=!1,navClassName:o,toggleSidebar:a,...i})=>e.jsxRuntimeExports.jsx("header",{className:e.cn("max-h-15 min-h-15 sticky top-0 z-10 bg-gray-100",s),"data-ox-slot":"header",...i,children:e.jsxRuntimeExports.jsxs("nav",{className:e.cn("max-w-10xl mx-auto flex items-center justify-between px-4 py-2.5",o),children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-[17px]",children:[r?e.jsxRuntimeExports.jsx(e.OxButton,{"aria-label":"Open menu","data-ox-slot":"header-toggle",size:"md",variant:"ghost",onClick:a,children:e.jsxRuntimeExports.jsx(e.OxButton.Icon,{path:"mdiMenu"})}):null,t?e.jsxRuntimeExports.jsx("div",{children:t}):null]}),n]})}),O="group ox-gray-inset-focus items-center rounded-lg text-sm transition-colors text-left col-span-2 grid grid-cols-subgrid",h="size-10 justify-center",S="h-10 w-full px-2",v="bg-gray-300 text-gray-1200",I="h-15",y=x.createContext(void 0),k=({children:t,className:n,desktopCollapsed:s=!1,hasHeader:r=!1,mobileCollapsed:o=!0,onClose:a,...i})=>{const[l,d]=x.useState(window.innerWidth<e.MOBILE_BREAKPOINT),m=l?o:s,E=x.useMemo(()=>({collapsed:m,isMobile:l}),[m,l]);return x.useEffect(()=>{const u=()=>{d(window.innerWidth<e.MOBILE_BREAKPOINT)};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]),e.jsxRuntimeExports.jsx(y.Provider,{value:E,children:l?e.jsxRuntimeExports.jsx(e.OxDrawer,{open:!m,onOpenChange:u=>!u&&a?.(),children:e.jsxRuntimeExports.jsx(e.OxDrawer.Content,{closeOnOutsideClick:!!a,side:"left",...i,children:e.jsxRuntimeExports.jsxs("nav",{"aria-label":"Mobile navigation",className:e.cn("flex h-screen w-full flex-col bg-gray-100",n),"data-ox-slot":"sidebar",role:"navigation",...i,children:[a?e.jsxRuntimeExports.jsx("div",{className:e.cn("h-15 flex items-center gap-[17px] px-4",I),children:e.jsxRuntimeExports.jsx(e.OxButton,{"aria-label":"Close sidebar",size:"md",variant:"ghost",onClick:a,children:e.jsxRuntimeExports.jsx(e.OxButton.Icon,{path:"mdiClose"})})}):null,t]})})}):e.jsxRuntimeExports.jsx("nav",{"aria-label":"Desktop navigation",className:e.cn("sticky box-content flex flex-col overflow-y-auto bg-gray-100",{"top-0 h-screen":!r,"viewport-minus-header top-15":r,'max-w-18 min-w-18 [&_[data-ox-slot="sidebar-label"]]:hidden':m,"min-w-64 max-w-64":!m},n),"data-ox-slot":"sidebar",role:"navigation",...i,children:t})})},g=()=>{const t=x.useContext(y);if(!t)throw new Error("useSidebar must be used within a SidebarProvider");return t},L=({children:t,className:n,...s})=>{const{collapsed:r,isMobile:o}=g();return e.jsxRuntimeExports.jsx("div",{className:e.cn("grid flex-1 content-start gap-y-1 overflow-y-auto p-4",{"grid-cols-1 place-items-center":r&&!o,"grid-cols-[auto_1fr]":!r||o},'[&_[data-ox-slot="sidebar-link"]]:col-span-2 [&_[data-ox-slot="sidebar-link"]]:grid [&_[data-ox-slot="sidebar-link"]]:grid-cols-subgrid','[&_[data-ox-slot="sidebar-button"]]:col-span-2 [&_[data-ox-slot="sidebar-button"]]:grid [&_[data-ox-slot="sidebar-button"]]:grid-cols-subgrid','[&_[data-ox-slot="sidebar-icon"]]:justify-self-center [&_[data-ox-slot="sidebar-icon"]]:[grid-column-start:var(--ox-menu-icon-col)]','[&_[data-ox-slot="sidebar-label"]]:[grid-column-start:var(--ox-menu-label-col)]',n),"data-ox-slot":"sidebar-body",...s,children:t})},_=({active:t=!1,children:n,className:s,disabled:r=!1,...o})=>{const{collapsed:a}=g();return e.jsxRuntimeExports.jsx("button",{className:e.cn("enabled:text-gray-1000 enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300",O,{[h]:a,[S]:!a,[v]:t&&!r,"disabled:ox-default-disabled":r},s),"data-ox-slot":"sidebar-button",disabled:r,type:"button",...o,"data-ox-state":t?"active":"inactive",children:n})},B=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("p-4",n),"data-ox-slot":"sidebar-footer",...s,children:t}),T=({children:t,className:n,headline:s,...r})=>{const{collapsed:o,isMobile:a}=g();return e.jsxRuntimeExports.jsxs("div",{className:e.cn("contents",n),"data-ox-slot":"sidebar-group",...r,children:[e.jsxRuntimeExports.jsx("h3",{className:e.cn("text-gray-1000 col-span-full mb-2 mt-4 block cursor-default text-xs",{invisible:o&&!a}),children:s}),t]})},z=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("h-15 flex items-center px-4",n),"data-ox-slot":"sidebar-header",...s,children:t}),A=({className:t,size:n=.8,...s})=>{const{collapsed:r}=g();return e.jsxRuntimeExports.jsx(e.OxIcon,{className:e.cn("shrink-0 text-current",{"mr-2":!r},t),"data-ox-slot":"sidebar-icon",size:n,...s})},D=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("span",{className:e.cn("overflow-hidden text-ellipsis",n),"data-ox-slot":"sidebar-label",...s,children:t}),H=({active:t=!1,children:n,className:s,disabled:r=!1,href:o,...a})=>{const{collapsed:i}=g();return e.jsxRuntimeExports.jsx("a",{"aria-current":t?"page":void 0,className:e.cn(O,{[h]:i,[S]:!i,[v]:t&&!r,"text-gray-1000 hover:text-gray-1200 cursor-pointer hover:bg-gray-300":!t&&!r,"ox-default-disabled":r},s),"data-ox-slot":"sidebar-link",href:r?void 0:o,role:"link",onClick:r?l=>l.preventDefault():void 0,...a,"data-ox-state":t?"active":"inactive",children:n})},b=k;b.Body=L;b.Button=_;b.Footer=B;b.Group=T;b.Header=z;b.Icon=A;b.Label=D;b.Link=H;const P=({children:t,className:n,color:s="purple",icon:r,subtitle:o,title:a,...i})=>{const l=a||o||r,d=e.COLOR_STYLES[s];return e.jsxRuntimeExports.jsxs("main",{"aria-labelledby":l?"main-headline":void 0,className:e.cn("w-full p-6",n),"data-ox-slot":"main-content",...i,children:[l?e.jsxRuntimeExports.jsx("div",{className:"mb-8 border-b border-gray-400 pb-6",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4",children:[r?e.jsxRuntimeExports.jsx("div",{className:e.cn("rounded-lg border p-3",d.border,d.background),children:e.jsxRuntimeExports.jsx(e.OxIcon,{className:d.text,path:r,size:1.41})}):null,e.jsxRuntimeExports.jsxs("div",{children:[a?e.jsxRuntimeExports.jsx("h2",{id:"main-headline",className:"text-gray-1200 text-xl font-semibold","data-ox-slot":"main-headline",children:a}):null,o&&e.jsxRuntimeExports.jsx("p",{className:"mt-1 text-sm",children:o})]})]})}):null,t]})},G=({children:t,className:n,...s})=>{const{isMobile:r}=j();return e.jsxRuntimeExports.jsx("div",{className:e.cn("max-w-10xl mx-auto grid min-h-screen bg-transparent",r?"grid-cols-1":"grid-cols-[auto_1fr]",n),"data-ox-slot":"app-layout",...s,children:t})},$=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("main",{className:e.cn("flex flex-col overflow-y-auto",n),"data-ox-slot":"main-content",...s,children:t}),W=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex-1 overflow-y-auto px-6 py-6",n),"data-ox-slot":"main-content-body",...s,children:t}),Y=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex-shrink-0 border-b border-gray-400 bg-gray-100 px-6 py-4",n),"data-ox-slot":"main-content-header",...s,children:t}),F=Object.assign($,{Header:Y,Body:W}),R=x.createContext(void 0);function j(){const t=x.useContext(R);if(!t)throw new Error("useOxSidebar must be used within a SidebarProvider");return t}const K=256,q=({children:t,className:n,...s})=>{const{isMobile:r,mobileOpen:o,toggleSidebar:a}=j();return r?e.jsxRuntimeExports.jsx(e.OxDrawer,{open:o,onOpenChange:a,children:e.jsxRuntimeExports.jsx(e.OxDrawer.Content,{closeOnOutsideClick:!0,side:"left",children:e.jsxRuntimeExports.jsx("aside",{className:e.cn("bg-gray-150 flex h-full flex-col",n),"data-ox-slot":"sidebar",...s,children:t})})}):e.jsxRuntimeExports.jsx("aside",{className:e.cn("bg-gray-150 sticky top-0 flex h-screen flex-col overflow-y-auto",n),"data-ox-slot":"sidebar",style:{width:K},...s,children:t})},V=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex-1 overflow-y-auto p-2",n),"data-ox-slot":"sidebar-content",...s,children:t}),J=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex shrink-0 flex-col p-2",n),"data-ox-slot":"sidebar-footer",...s,children:t}),Q=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex flex-wrap items-center gap-2",'[&_[data-ox-slot="sidebar-group-content"]]:w-full',n),"data-ox-slot":"sidebar-group",...s,children:t}),U=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("button",{className:e.cn("mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-md","enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:text-gray-900 enabled:hover:bg-gray-300","ox-gray-outset-focus disabled:ox-default-disabled",n),"data-ox-slot":"sidebar-group-action",type:"button",...s,children:t}),X=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn(n),"data-ox-slot":"sidebar-group-content",...s,children:t}),Z=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex flex-1 items-center pl-2 text-xs font-medium text-gray-900",n),"data-ox-slot":"sidebar-group-label",...s,children:t}),ee=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex shrink-0 flex-col p-2",n),"data-ox-slot":"sidebar-header",...s,children:t}),te=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("ul",{className:e.cn("flex flex-col items-stretch gap-1",n),"data-ox-slot":"sidebar-menu",...s,children:t}),se=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("button",{className:e.cn("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-transparent","enabled:text-gray-1200 enabled:cursor-pointer enabled:bg-transparent enabled:hover:bg-gray-300","ox-gray-outset-focus disabled:ox-default-disabled",n),"data-ox-slot":"sidebar-menu-action",type:"button",...s,children:t}),ne=({children:t,className:n})=>e.jsxRuntimeExports.jsx(e.OxBadge,{className:e.cn("ml-auto",n),"data-ox-slot":"sidebar-menu-badge",size:"sm",children:t}),w=x.createContext(void 0),N=()=>{const t=x.useContext(w);if(!t)throw new Error("useMenuItemContext must be used within MenuItemProvider");return t},M=({className:t,path:n,placeholder:s})=>e.jsxRuntimeExports.jsx(e.OxIcon,{className:e.cn("shrink-0",t),"data-ox-slot":"sidebar-menu-icon",path:n,placeholder:s,size:.8}),re=({children:t,className:n,disabled:s=!1,href:r,onClick:o,...a})=>{const{hasSub:i,isOpen:l,toggleOpen:d}=N(),m=e.cn("flex h-9 flex-1 items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-left text-sm","ox-gray-outset-focus",n);if(r)return e.jsxRuntimeExports.jsx("a",{"aria-disabled":s?"true":void 0,className:e.cn(m,{"text-gray-1200 cursor-pointer hover:bg-gray-300":!s,"ox-default-disabled":s}),"data-ox-slot":"sidebar-menu-button",href:s?void 0:r,onClick:s?u=>u.preventDefault():void 0,...a,children:t});const E=u=>{i&&d(),o&&o(u)};return e.jsxRuntimeExports.jsxs("button",{className:e.cn(m,"enabled:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300","disabled:ox-default-disabled"),"data-ox-slot":"sidebar-menu-button",disabled:s,type:"button",onClick:E,...a,children:[t,i?e.jsxRuntimeExports.jsx(M,{className:e.cn("ml-auto transition-transform duration-200",{"rotate-180":l}),path:"mdiChevronDown"}):null]})};function oe({children:t,defaultOpen:n=!1,hasSub:s=!1}){const[r,o]=x.useState(n),a=()=>o(i=>!i);return e.jsxRuntimeExports.jsx(w.Provider,{value:{hasSub:s,isOpen:r,setIsOpen:o,toggleOpen:a},children:t})}const ae=({children:t,className:n,defaultOpen:s=!1,hasSub:r=!1,...o})=>e.jsxRuntimeExports.jsx(oe,{defaultOpen:s,hasSub:r,children:e.jsxRuntimeExports.jsx("li",{className:e.cn("group flex flex-wrap items-center gap-x-2",n),"data-ox-slot":"sidebar-menu-item",...o,children:t})}),ie=({className:t})=>e.jsxRuntimeExports.jsx(e.OxSkeleton,{className:t,"data-ox-slot":"sidebar-menu-skeleton",fullWidth:!0,height:36}),xe=({children:t,className:n,...s})=>{const{isOpen:r}=N();return e.jsxRuntimeExports.jsx("div",{className:"ox-sidebar-submenu w-content grid w-full","data-ox-slot":"sidebar-menu-sub-wrapper","data-ox-state":r?"open":"closed",children:e.jsxRuntimeExports.jsx("ul",{className:e.cn("ml-4.5 flex flex-col gap-1 border-l border-gray-400 py-0.5 pl-2.5",n),"data-ox-slot":"sidebar-menu-sub",...s,children:t})})},le=({children:t,className:n,href:s,...r})=>{const o=e.cn("text-gray-1200 flex h-8 flex-1 cursor-pointer items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-left text-sm hover:bg-gray-300","ox-gray-outset-focus",n);return s?e.jsxRuntimeExports.jsx("a",{className:o,"data-ox-slot":"sidebar-menu-sub-button",href:s,...r,children:t}):e.jsxRuntimeExports.jsx("button",{className:o,"data-ox-slot":"sidebar-menu-sub-button",type:"button",...r,children:t})},de=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("li",{className:e.cn("flex items-center gap-2",n),"data-ox-slot":"sidebar-menu-sub-item",...s,children:t}),ce=({className:t,...n})=>e.jsxRuntimeExports.jsx(e.OxSeparator,{className:t,"data-ox-slot":"sidebar-separator",...n}),ue=({className:t,onClick:n})=>{const{isMobile:s,toggleSidebar:r}=j(),o=()=>{s?r():n&&n()},a=s||n;return e.jsxRuntimeExports.jsx("button",{"aria-label":"Toggle sidebar",className:e.cn("inline-flex size-8 items-center justify-center rounded-lg","text-gray-1200 border border-transparent bg-transparent",{"ox-gray-outset-focus cursor-pointer hover:bg-gray-300":a},t),"data-ox-slot":"sidebar-trigger",disabled:!a,type:"button",onClick:o,children:e.jsxRuntimeExports.jsx(e.OxIcon,{path:"mdiDockLeft",size:.8})})};function be({children:t}){const[n,s]=x.useState(!1),[r,o]=x.useState(!1);x.useEffect(()=>{const d=()=>{o(window.innerWidth<e.MOBILE_BREAKPOINT)};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]);const a=x.useCallback(()=>{s(!0)},[]),i=x.useCallback(()=>{s(!1)},[]),l=x.useCallback(()=>{s(d=>!d)},[]);return e.jsxRuntimeExports.jsx(R.Provider,{value:{closeSidebar:i,isMobile:r,mobileOpen:n,openSidebar:a,toggleSidebar:l},children:t})}const p=q,c=te,f=Q;p.Header=ee;p.Content=V;p.Footer=J;p.Separator=ce;p.Trigger=ue;c.Item=ae;c.Button=re;c.Icon=M;c.Badge=ne;c.Action=se;c.Skeleton=ie;c.Sub=xe;c.SubItem=de;c.SubButton=le;f.Label=Z;f.Action=U;f.Content=X;exports.OxAppLayout=G;exports.OxLegacyHeader=C;exports.OxLegacyMainContent=P;exports.OxLegacySidebar=b;exports.OxMainContent=F;exports.OxSidebar=p;exports.OxSidebarGroup=f;exports.OxSidebarMenu=c;exports.OxSidebarProvider=be;exports.useOxSidebar=j;
@@ -1,4 +1,4 @@
1
- import { _ as s, $ as r, e as f, a1 as j, i as h, l as y, a2 as D, c as $, u as G, t as P } from "../chunks/ui-DxsSYHCv.js";
1
+ import { _ as s, $ as r, e as f, a1 as j, i as h, l as y, a2 as D, c as $, u as G, t as P } from "../chunks/ui-BgyYCO2P.js";
2
2
  import { createContext as w, useState as v, useMemo as R, useEffect as k, useContext as N, useCallback as S } from "react";
3
3
  const Ne = ({
4
4
  brand: e,
package/dist/onyx.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./chunks/ui-ChsTPgui.js");exports.OxAccordion=x.OxAccordion;exports.OxAlert=x.OxAlert;exports.OxAvatar=x.OxAvatar;exports.OxBadge=x.OxBadge;exports.OxBreadcrumb=x.OxBreadcrumb;exports.OxButton=x.OxButton;exports.OxCalendar=x.OxCalendar;exports.OxCard=x.OxCard;exports.OxCheckbox=x.OxCheckbox;exports.OxDateInput=x.OxDateInput;exports.OxDescription=x.OxDescription;exports.OxDescriptionList=x.OxDescriptionList;exports.OxDialog=x.OxDialog;exports.OxDrawer=x.OxDrawer;exports.OxDropdown=x.OxDropdown;exports.OxError=x.OxError;exports.OxFileUpload=x.OxFileUpload;exports.OxFloating=x.OxFloating;exports.OxForm=x.OxForm;exports.OxHeading=x.OxHeading;exports.OxIcon=x.OxIcon;exports.OxJsonField=x.OxJsonField;exports.OxLabel=x.OxLabel;exports.OxLegend=x.OxLegend;exports.OxLink=x.OxLink;exports.OxNotifications=x.OxNotifications;exports.OxNumberInput=x.OxNumberInput;exports.OxOtpInput=x.OxOtpInput;exports.OxPagination=x.OxPagination;exports.OxPopover=x.OxPopover;exports.OxProgress=x.OxProgress;exports.OxRadio=x.OxRadio;exports.OxSelect=x.OxSelect;exports.OxSeparator=x.OxSeparator;exports.OxSkeleton=x.OxSkeleton;exports.OxSkeletonText=x.OxSkeletonText;exports.OxSlider=x.OxSlider;exports.OxSpinner=x.OxSpinner;exports.OxStatusDisplay=x.OxStatusDisplay;exports.OxStepper=x.OxStepper;exports.OxSwitch=x.OxSwitch;exports.OxTable=x.OxTable;exports.OxTabs=x.OxTabs;exports.OxTextInput=x.OxTextInput;exports.OxTextarea=x.OxTextarea;exports.OxTimeInput=x.OxTimeInput;exports.OxTimeline=x.OxTimeline;exports.OxToast=x.OxToast;exports.OxToastProvider=x.OxToastProvider;exports.OxToggle=x.OxToggle;exports.OxTooltip=x.OxTooltip;exports.useOxToast=x.useOxToast;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./chunks/ui-WTrU_DUw.js");exports.OxAccordion=x.OxAccordion;exports.OxAlert=x.OxAlert;exports.OxAvatar=x.OxAvatar;exports.OxBadge=x.OxBadge;exports.OxBreadcrumb=x.OxBreadcrumb;exports.OxButton=x.OxButton;exports.OxCalendar=x.OxCalendar;exports.OxCard=x.OxCard;exports.OxCheckbox=x.OxCheckbox;exports.OxDateInput=x.OxDateInput;exports.OxDescription=x.OxDescription;exports.OxDescriptionList=x.OxDescriptionList;exports.OxDialog=x.OxDialog;exports.OxDrawer=x.OxDrawer;exports.OxDropdown=x.OxDropdown;exports.OxError=x.OxError;exports.OxFileUpload=x.OxFileUpload;exports.OxFloating=x.OxFloating;exports.OxForm=x.OxForm;exports.OxHeading=x.OxHeading;exports.OxIcon=x.OxIcon;exports.OxJsonField=x.OxJsonField;exports.OxLabel=x.OxLabel;exports.OxLegend=x.OxLegend;exports.OxLink=x.OxLink;exports.OxNotifications=x.OxNotifications;exports.OxNumberInput=x.OxNumberInput;exports.OxOtpInput=x.OxOtpInput;exports.OxPagination=x.OxPagination;exports.OxPopover=x.OxPopover;exports.OxProgress=x.OxProgress;exports.OxRadio=x.OxRadio;exports.OxSelect=x.OxSelect;exports.OxSeparator=x.OxSeparator;exports.OxSkeleton=x.OxSkeleton;exports.OxSkeletonText=x.OxSkeletonText;exports.OxSlider=x.OxSlider;exports.OxSpinner=x.OxSpinner;exports.OxStatusDisplay=x.OxStatusDisplay;exports.OxStepper=x.OxStepper;exports.OxSwitch=x.OxSwitch;exports.OxTable=x.OxTable;exports.OxTabs=x.OxTabs;exports.OxTextInput=x.OxTextInput;exports.OxTextarea=x.OxTextarea;exports.OxTimeInput=x.OxTimeInput;exports.OxTimeline=x.OxTimeline;exports.OxToast=x.OxToast;exports.OxToastProvider=x.OxToastProvider;exports.OxToggle=x.OxToggle;exports.OxTooltip=x.OxTooltip;exports.useOxToast=x.useOxToast;
package/dist/onyx.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { O as x, a as O, b as e, c as o, d as t, e as r, f as i, g as n, I as p, L as l, V as d, h as T, o as c, i as u, j as g, W as S, J as D, k as b, K as m, X as I, l as k, m as F, Y as L, Z as P, n as v, p as w, M as A, N as B, q as C, r as f, s as h, R as N, S as y, t as E, u as H, v as J, w as R, x as U, y as j, z as q, T as z, A as G, B as K, P as M, U as Q, Q as V, C as W, F as X, D as Y, G as Z, H as _, E as $ } from "./chunks/ui-DxsSYHCv.js";
1
+ import { O as x, a as O, b as e, c as o, d as t, e as r, f as i, g as n, I as p, L as l, V as d, h as T, o as c, i as u, j as g, W as S, J as D, k as b, K as m, X as I, l as k, m as F, Y as L, Z as P, n as v, p as w, M as A, N as B, q as C, r as f, s as h, R as N, S as y, t as E, u as H, v as J, w as R, x as U, y as j, z as q, T as z, A as G, B as K, P as M, U as Q, Q as V, C as W, F as X, D as Y, G as Z, H as _, E as $ } from "./chunks/ui-BgyYCO2P.js";
2
2
  export {
3
3
  x as OxAccordion,
4
4
  O as OxAlert,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/ui-ChsTPgui.js");require("react");const n=require("../chunks/hooks-DiKvsNs-.js"),p=require("../chunks/query-BhvXa-m6.js"),c=n.gql`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/ui-WTrU_DUw.js");require("react");const i=require("../chunks/hooks-DiKvsNs-.js"),p=require("../chunks/query-BhvXa-m6.js"),c=i.gql`
2
2
  mutation Login($input: LoginInput!) {
3
3
  login(input: $input) {
4
4
  success
@@ -10,4 +10,4 @@
10
10
  }
11
11
  }
12
12
  }
13
- `,j=({cacheQuery:i=p.DEFAULT_GET_CURRENT_USER,className:o,mutation:a=c,onSubmit:x,subtitle:u="",title:d="noxickon",...l})=>{const s=n.useForm({initialData:{username:"",password:""},validationRules:{username:["required"],password:["required"]},operation:a,options:{update:(t,{data:r})=>{r?.login.success&&t.writeQuery({query:i,data:{me:r.login.me}})}}}),m=async t=>{t.preventDefault(),s.submit({onError:r=>{e.handleGraphQLFormErrors(r,s)},onSuccess:r=>{r.data&&r.data.login.success?x?.(r):console.error("Login failed: Invalid credentials")}})};return e.jsxRuntimeExports.jsx("div",{className:e.cn("w-80",o),...l,children:e.jsxRuntimeExports.jsxs("div",{className:"ox-gray-border rounded-lg bg-gray-50 p-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-4 text-center",children:[e.jsxRuntimeExports.jsx("h1",{className:"text-gray-1200 px-2 font-mono text-2xl",children:d}),e.jsxRuntimeExports.jsx("p",{className:"px-2 py-1 font-mono text-xs",children:u})]}),e.jsxRuntimeExports.jsxs(e.OxForm,{className:"space-y-6",onSubmit:m,children:[e.jsxRuntimeExports.jsxs(e.OxForm.Field,{children:[e.jsxRuntimeExports.jsx(e.OxLabel,{children:"username"}),e.jsxRuntimeExports.jsxs(e.OxTextInput.Container,{disabled:s.isLoading,error:s.hasError("username"),required:!0,value:s.data.username,onChange:t=>s.setData("username",t),children:[e.jsxRuntimeExports.jsx(e.OxTextInput.Icon,{path:"mdiAccount"}),e.jsxRuntimeExports.jsx(e.OxTextInput,{autoComplete:"off",name:"username",placeholder:"Enter your username"})]})]}),e.jsxRuntimeExports.jsxs(e.OxForm.Field,{children:[e.jsxRuntimeExports.jsx(e.OxLabel,{children:"password"}),e.jsxRuntimeExports.jsxs(e.OxTextInput.Container,{disabled:s.isLoading,error:s.hasError("password"),required:!0,type:"password",value:s.data.password,onChange:t=>s.setData("password",t),children:[e.jsxRuntimeExports.jsx(e.OxTextInput.Icon,{path:"mdiLockOutline"}),e.jsxRuntimeExports.jsx(e.OxTextInput,{autoComplete:"off",name:"password",placeholder:"Enter your password"}),e.jsxRuntimeExports.jsx(e.OxTextInput.VisibilityButton,{})]})]}),s.hasErrors?e.jsxRuntimeExports.jsx(e.OxError,{icon:"mdiAlertCircleOutline",children:"username or password is wrong"}):null,e.jsxRuntimeExports.jsx(e.OxButton,{disabled:s.isLoading,fullWidth:!0,isLoading:s.isLoading,size:"sm",type:"submit",variant:"primary",children:s.isLoading?"Signing in...":"Sign In"})]})]})})};exports.OxLogin=j;
13
+ `,j=({cacheQuery:o=p.DEFAULT_GET_CURRENT_USER,className:a,mutation:x=c,onSubmit:u,subtitle:t="",title:d="noxickon",...l})=>{const s=i.useForm({initialData:{username:"",password:""},validationRules:{username:["required"],password:["required"]},operation:x,options:{update:(n,{data:r})=>{r?.login.success&&n.writeQuery({query:o,data:{me:r.login.me}})}}}),m=async n=>{n.preventDefault(),s.submit({onError:r=>{e.handleGraphQLFormErrors(r,s)},onSuccess:r=>{r.data&&r.data.login.success?u?.(r):console.error("Login failed: Invalid credentials")}})};return e.jsxRuntimeExports.jsx("div",{className:e.cn("w-80",a),...l,children:e.jsxRuntimeExports.jsxs("div",{className:"ox-gray-border rounded-lg bg-gray-50 p-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-4 text-center",children:[e.jsxRuntimeExports.jsx("h1",{className:"text-gray-1200 px-2 font-mono text-2xl",children:d}),t?e.jsxRuntimeExports.jsx("p",{className:"px-2 py-1 font-mono text-xs",children:t}):null]}),e.jsxRuntimeExports.jsxs(e.OxForm,{className:"space-y-6",onSubmit:m,children:[e.jsxRuntimeExports.jsxs(e.OxForm.Field,{children:[e.jsxRuntimeExports.jsx(e.OxLabel,{children:"username"}),e.jsxRuntimeExports.jsxs(e.OxTextInput.Container,{disabled:s.isLoading,error:s.hasError("username"),required:!0,value:s.data.username,onChange:n=>s.setData("username",n),children:[e.jsxRuntimeExports.jsx(e.OxTextInput.Icon,{path:"mdiAccount"}),e.jsxRuntimeExports.jsx(e.OxTextInput,{autoComplete:"off",name:"username",placeholder:"Enter your username"})]})]}),e.jsxRuntimeExports.jsxs(e.OxForm.Field,{children:[e.jsxRuntimeExports.jsx(e.OxLabel,{children:"password"}),e.jsxRuntimeExports.jsxs(e.OxTextInput.Container,{disabled:s.isLoading,error:s.hasError("password"),required:!0,type:"password",value:s.data.password,onChange:n=>s.setData("password",n),children:[e.jsxRuntimeExports.jsx(e.OxTextInput.Icon,{path:"mdiLockOutline"}),e.jsxRuntimeExports.jsx(e.OxTextInput,{autoComplete:"off",name:"password",placeholder:"Enter your password"}),e.jsxRuntimeExports.jsx(e.OxTextInput.VisibilityButton,{})]})]}),s.hasErrors?e.jsxRuntimeExports.jsx(e.OxError,{icon:"mdiAlertCircleOutline",children:"username or password is wrong"}):null,e.jsxRuntimeExports.jsx(e.OxButton,{disabled:s.isLoading,fullWidth:!0,isLoading:s.isLoading,size:"sm",type:"submit",variant:"primary",children:s.isLoading?"Signing in...":"Sign In"})]})]})})};exports.OxLogin=j;
@@ -1,4 +1,4 @@
1
- import { _ as e, $ as h, K as i, Y as o, P as n, W as g, e as j, a0 as f } from "../chunks/ui-DxsSYHCv.js";
1
+ import { _ as e, $ as h, K as i, Y as t, P as n, W as g, e as j, a0 as f } from "../chunks/ui-BgyYCO2P.js";
2
2
  import "react";
3
3
  import { l as L, n as y } from "../chunks/hooks-bJFfbTks.js";
4
4
  import { D as w } from "../chunks/query-iDn3qBGF.js";
@@ -15,11 +15,11 @@ const E = y`
15
15
  }
16
16
  }
17
17
  `, C = ({
18
- cacheQuery: t = w,
19
- className: d,
20
- mutation: l = E,
21
- onSubmit: u,
22
- subtitle: m = "",
18
+ cacheQuery: d = w,
19
+ className: l,
20
+ mutation: u = E,
21
+ onSubmit: m,
22
+ subtitle: o = "",
23
23
  title: c = "noxickon",
24
24
  ...p
25
25
  }) => {
@@ -32,11 +32,11 @@ const E = y`
32
32
  username: ["required"],
33
33
  password: ["required"]
34
34
  },
35
- operation: l,
35
+ operation: u,
36
36
  options: {
37
37
  update: (a, { data: r }) => {
38
38
  r?.login.success && a.writeQuery({
39
- query: t,
39
+ query: d,
40
40
  data: { me: r.login.me }
41
41
  });
42
42
  }
@@ -47,18 +47,18 @@ const E = y`
47
47
  f(r, s);
48
48
  },
49
49
  onSuccess: (r) => {
50
- r.data && r.data.login.success ? u?.(r) : console.error("Login failed: Invalid credentials");
50
+ r.data && r.data.login.success ? m?.(r) : console.error("Login failed: Invalid credentials");
51
51
  }
52
52
  });
53
53
  };
54
- return /* @__PURE__ */ e.jsx("div", { className: h("w-80", d), ...p, children: /* @__PURE__ */ e.jsxs("div", { className: "ox-gray-border rounded-lg bg-gray-50 p-6", children: [
54
+ return /* @__PURE__ */ e.jsx("div", { className: h("w-80", l), ...p, children: /* @__PURE__ */ e.jsxs("div", { className: "ox-gray-border rounded-lg bg-gray-50 p-6", children: [
55
55
  /* @__PURE__ */ e.jsxs("div", { className: "mb-4 text-center", children: [
56
56
  /* @__PURE__ */ e.jsx("h1", { className: "text-gray-1200 px-2 font-mono text-2xl", children: c }),
57
- /* @__PURE__ */ e.jsx("p", { className: "px-2 py-1 font-mono text-xs", children: m })
57
+ o ? /* @__PURE__ */ e.jsx("p", { className: "px-2 py-1 font-mono text-xs", children: o }) : null
58
58
  ] }),
59
59
  /* @__PURE__ */ e.jsxs(i, { className: "space-y-6", onSubmit: x, children: [
60
60
  /* @__PURE__ */ e.jsxs(i.Field, { children: [
61
- /* @__PURE__ */ e.jsx(o, { children: "username" }),
61
+ /* @__PURE__ */ e.jsx(t, { children: "username" }),
62
62
  /* @__PURE__ */ e.jsxs(
63
63
  n.Container,
64
64
  {
@@ -75,7 +75,7 @@ const E = y`
75
75
  )
76
76
  ] }),
77
77
  /* @__PURE__ */ e.jsxs(i.Field, { children: [
78
- /* @__PURE__ */ e.jsx(o, { children: "password" }),
78
+ /* @__PURE__ */ e.jsx(t, { children: "password" }),
79
79
  /* @__PURE__ */ e.jsxs(
80
80
  n.Container,
81
81
  {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/ui-ChsTPgui.js");const o=require("../chunks/useAuth-DxoDe3YA.js"),s=require("../chunks/hooks-DiKvsNs-.js"),i=({children:t,onAuthenticated:u=null,onLoading:n=null})=>{const{isLoggedIn:e,loading:r}=o.useOxAuth();return r?n:e?u:t},c=({children:t,onLoading:u=null,onUnauthenticated:n=null})=>{const{isLoggedIn:e,loading:r}=o.useOxAuth();return r?u:e?t:n},d=({children:t,onLoading:u=null,onUnauthorized:n=null,roles:e=["admin"]})=>{const{loading:r,user:l}=o.useOxAuth();return r?u:!l||s.isEmpty(e)||!e.includes(l.role)?n:t};exports.OxGuestRoute=i;exports.OxProtectedRoute=c;exports.OxRoleRoute=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/ui-WTrU_DUw.js");const o=require("../chunks/useAuth-DxoDe3YA.js"),s=require("../chunks/hooks-DiKvsNs-.js"),i=({children:t,onAuthenticated:u=null,onLoading:n=null})=>{const{isLoggedIn:e,loading:r}=o.useOxAuth();return r?n:e?u:t},c=({children:t,onLoading:u=null,onUnauthenticated:n=null})=>{const{isLoggedIn:e,loading:r}=o.useOxAuth();return r?u:e?t:n},d=({children:t,onLoading:u=null,onUnauthorized:n=null,roles:e=["admin"]})=>{const{loading:r,user:l}=o.useOxAuth();return r?u:!l||s.isEmpty(e)||!e.includes(l.role)?n:t};exports.OxGuestRoute=i;exports.OxProtectedRoute=c;exports.OxRoleRoute=d;
@@ -1,4 +1,4 @@
1
- import "../chunks/ui-DxsSYHCv.js";
1
+ import "../chunks/ui-BgyYCO2P.js";
2
2
  import { u as o } from "../chunks/useAuth-BFgXzu6Q.js";
3
3
  import { q as l } from "../chunks/hooks-bJFfbTks.js";
4
4
  const f = ({
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/ui-ChsTPgui.js");exports.buildMailTo=r.buildMailTo;exports.buildUrl=r.buildUrl;exports.cn=r.cn;exports.copyToClipboard=r.copyToClipboard;exports.createId=r.createId;exports.formatBytes=r.formatBytes;exports.formatCurrency=r.formatCurrency;exports.formatDate=r.formatDate;exports.formatNumber=r.formatNumber;exports.formatTimestamp=r.formatTimestamp;exports.generateRandomString=r.generateRandomString;exports.handleFormErrors=r.handleFormErrors;exports.handleGraphQLFormErrors=r.handleGraphQLFormErrors;exports.hasDataSlot=r.hasDataSlot;exports.parseGraphQLErrors=r.parseGraphQLErrors;exports.scrollToElement=r.scrollToElement;exports.validateEmail=r.validateEmail;exports.validatePhone=r.validatePhone;exports.validateUrl=r.validateUrl;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/ui-WTrU_DUw.js");exports.buildMailTo=r.buildMailTo;exports.buildUrl=r.buildUrl;exports.cn=r.cn;exports.copyToClipboard=r.copyToClipboard;exports.createId=r.createId;exports.formatBytes=r.formatBytes;exports.formatCurrency=r.formatCurrency;exports.formatDate=r.formatDate;exports.formatNumber=r.formatNumber;exports.formatTimestamp=r.formatTimestamp;exports.generateRandomString=r.generateRandomString;exports.handleFormErrors=r.handleFormErrors;exports.handleGraphQLFormErrors=r.handleGraphQLFormErrors;exports.hasDataSlot=r.hasDataSlot;exports.parseGraphQLErrors=r.parseGraphQLErrors;exports.scrollToElement=r.scrollToElement;exports.validateEmail=r.validateEmail;exports.validatePhone=r.validatePhone;exports.validateUrl=r.validateUrl;
@@ -1,4 +1,4 @@
1
- import { a4 as s, a3 as e, $ as o, a5 as t, a6 as l, aa as m, ab as d, ac as i, ad as n, ae as f, a7 as h, a8 as p, a0 as c, af as b, a9 as E, ag as u, ah as T, aj as g, ai as v } from "../chunks/ui-DxsSYHCv.js";
1
+ import { a4 as s, a3 as e, $ as o, a5 as t, a6 as l, aa as m, ab as d, ac as i, ad as n, ae as f, a7 as h, a8 as p, a0 as c, af as b, a9 as E, ag as u, ah as T, aj as g, ai as v } from "../chunks/ui-BgyYCO2P.js";
2
2
  export {
3
3
  s as buildMailTo,
4
4
  e as buildUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxickon/onyx",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/onyx.umd.js",
6
6
  "module": "./dist/onyx.es.js",