@tailor-platform/app-shell 0.9.3 → 0.10.0

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/index.d.ts CHANGED
@@ -218,7 +218,9 @@ type ThemeProviderState = {
218
218
  declare const useTheme: () => ThemeProviderState;
219
219
 
220
220
  type BuiltinIdPAuthContextType = {
221
+ isLoading: boolean;
221
222
  login: () => Promise<void>;
223
+ logout: () => Promise<void>;
222
224
  };
223
225
  declare const useBuiltinIdpAuth: () => BuiltinIdPAuthContextType;
224
226
  type Props = {
@@ -226,6 +228,6 @@ type Props = {
226
228
  clientId: string;
227
229
  redirectUri?: string;
228
230
  } & PropsWithChildren;
229
- declare const BuiltinIdPAuthProvider: ({ idpEndpoint, clientId, redirectUri, children }: Props) => react_jsx_runtime.JSX.Element;
231
+ declare const BuiltinIdPAuthProvider: ({ idpEndpoint, clientId, redirectUri, children, }: Props) => react_jsx_runtime.JSX.Element;
230
232
 
231
233
  export { AppShell, type AppShellProps, BuiltinIdPAuthProvider, DefaultSidebar, type ResourceComponentProps, SidebarLayoutContainer, defineModule, defineResource, useAppShell, useBuiltinIdpAuth, useTheme };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{Table as da}from"lucide-react";import{useEffect as la,useMemo as ca,useState as wa}from"react";import{createContext as Gt,useContext as qt}from"react";var H=Gt({navItems:[],configurations:{modules:[]}}),S=()=>qt(H);import{createBrowserRouter as Jt,RouterProvider as Zt}from"react-router";import{Outlet as Xt}from"react-router";import{Toaster as Yt}from"sonner";import{Fragment as Qt,jsx as _,jsxs as et}from"react/jsx-runtime";var L=({contentBorder:t,children:a})=>_("div",{className:t?"astw:p-4 astw:rounded-sm astw:border astw:shadow-xs":"",children:a}),at=()=>et(L,{contentBorder:!0,children:[_("p",{className:"astw:font-semibold astw:leading-none astw:tracking-tight",children:"Welcome to AppShell"}),_("p",{className:"pt-4",children:"Add your GraphQL resources from configuration at first!"})]}),V=()=>et(Qt,{children:[_(Xt,{}),_(Yt,{})]});import{jsx as ta}from"react/jsx-runtime";var rt=t=>{let a={index:!0,Component:t.component};return{path:t.path,...t.subResources&&t.subResources.length>0?{children:[a,...t.subResources.map(rt)]}:{children:[a]}}},ot=t=>{let{configurations:a}=S(),e=a.modules.reduce((o,s)=>{let l={index:!0,Component:s.component};return[...o,{path:s.path,...s.resources&&s.resources.length>0?{children:[l,...s.resources.map(rt)]}:{children:[l]}}]},[]),r=Jt([{path:a.basePath,element:t.children,children:[{index:!0,Component:at},{path:R,children:e}]}]);return ta(Zt,{router:r})};import{createContext as aa,useContext as ea,useEffect as ra,useMemo as oa,useState as sa}from"react";import{jsx as na}from"react/jsx-runtime";var ia={resolvedTheme:"light",theme:"system",setTheme:()=>null},st=aa(ia);function it({children:t,storageKey:a,defaultTheme:e="system",...r}){let[o,s]=sa(()=>localStorage.getItem(a)||e),l=oa(()=>o!=="system"?o:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",[o]);ra(()=>{let d=window.document.documentElement;d.classList.remove("light","dark"),d.classList.add(l)},[l]);let i={resolvedTheme:l,theme:o,setTheme:d=>{localStorage.setItem(a,d),s(d)}};return na(st.Provider,{...r,value:i,children:t})}var U=()=>{let t=ea(st);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t};import{jsx as O}from"react/jsx-runtime";var R="resources",pa=t=>{let[a,e]=wa(!1);la(function(){e(!0)},[]);let r=t.configurations.basePath,o=l=>r?`/${r}/${R}/${l}`:`/${R}/${l}`,s=ca(()=>t.configurations.modules.map(i=>{let d=i.resources.map(p=>({title:p.meta.title,url:o(`${i.path}/${p.path}`)}));return{title:i.meta.title,url:i.meta.menuItemClickable?o(i.path):void 0,clickable:i.component,icon:i.meta.icon||O(da,{}),isActive:!0,items:d}}),[t.configurations.modules]);return a?O(H.Provider,{value:{title:t.title,icon:t.icon,configurations:{...t.configurations,basePath:r},navItems:s},children:O(it,{defaultTheme:"system",storageKey:"appshell-ui-theme",children:O(ot,{children:t.children})})}):null};import*as T from"@radix-ui/react-collapsible";import{jsx as j}from"react/jsx-runtime";function nt({...t}){return j(T.Root,{"data-slot":"collapsible",...t})}function F({...t}){return j(T.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...t})}function dt({...t}){return j(T.CollapsibleContent,{"data-slot":"collapsible-content",...t})}import{useLocation as $t}from"react-router";import*as m from"react";import{Slot as X}from"@radix-ui/react-slot";import{cva as Ca}from"class-variance-authority";import{PanelLeftIcon as Sa}from"lucide-react";import*as D from"react";var K=768;function lt(){let[t,a]=D.useState(void 0);return D.useEffect(()=>{let e=window.matchMedia(`(max-width: ${K-1}px)`),r=()=>{a(window.innerWidth<K)};return e.addEventListener("change",r),a(window.innerWidth<K),()=>e.removeEventListener("change",r)},[]),!!t}import{clsx as ua}from"clsx";import{twMerge as ga}from"tailwind-merge";function c(...t){return ga(ua(t))}import{Slot as ma}from"@radix-ui/react-slot";import{cva as ba}from"class-variance-authority";import{jsx as fa}from"react/jsx-runtime";var ha=ba("astw:inline-flex astw:items-center astw:justify-center astw:gap-2 astw:whitespace-nowrap astw:rounded-md astw:text-sm astw:font-medium astw:transition-all astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:[&_svg]:pointer-events-none astw:[&_svg:not([class*='size-'])]:size-4 astw:shrink-0 astw:[&_svg]:shrink-0 astw:outline-none astw:focus-visible:border-ring astw:focus-visible:ring-ring/50 astw:focus-visible:ring-[3px] astw:aria-invalid:ring-destructive/20 astw:dark:aria-invalid:ring-destructive/40 astw:aria-invalid:border-destructive",{variants:{variant:{default:"astw:bg-primary astw:text-primary-foreground astw:shadow-xs astw:hover:bg-primary/90",destructive:"astw:bg-destructive astw:text-white astw:shadow-xs astw:hover:bg-destructive/90 astw:focus-visible:ring-destructive/20 astw:dark:focus-visible:ring-destructive/40 astw:dark:bg-destructive/60",outline:"astw:border astw:bg-background astw:shadow-xs astw:hover:bg-accent astw:hover:text-accent-foreground astw:dark:bg-input/30 astw:dark:border-input astw:dark:hover:bg-input/50",secondary:"astw:bg-secondary astw:text-secondary-foreground astw:shadow-xs astw:hover:bg-secondary/80",ghost:"astw:hover:bg-accent astw:hover:text-accent-foreground astw:dark:hover:bg-accent/50",link:"astw:text-primary astw:underline-offset-4 astw:hover:underline"},size:{default:"astw:h-9 astw:px-4 astw:py-2 astw:has-[>svg]:px-3",sm:"astw:h-8 astw:rounded-md astw:gap-1.5 astw:px-3 astw:has-[>svg]:px-2.5",lg:"astw:h-10 astw:rounded-md astw:px-6 astw:has-[>svg]:px-4",icon:"astw:size-9"}},defaultVariants:{variant:"default",size:"default"}});function $({className:t,variant:a,size:e,asChild:r=!1,...o}){return fa(r?ma:"button",{"data-slot":"button",className:c(ha({variant:a,size:e,className:t})),...o})}import{jsx as We}from"react/jsx-runtime";import*as va from"@radix-ui/react-separator";import{jsx as Fe}from"react/jsx-runtime";import*as u from"@radix-ui/react-dialog";import{XIcon as xa}from"lucide-react";import{jsx as v,jsxs as G}from"react/jsx-runtime";function ct({...t}){return v(u.Root,{"data-slot":"sheet",...t})}function ya({...t}){return v(u.Portal,{"data-slot":"sheet-portal",...t})}function ka({className:t,...a}){return v(u.Overlay,{"data-slot":"sheet-overlay",className:c("astw:data-[state=open]:animate-in astw:data-[state=closed]:animate-out astw:data-[state=closed]:fade-out-0 astw:data-[state=open]:fade-in-0 astw:fixed astw:inset-0 astw:z-50 astw:bg-black/50",t),...a})}function wt({className:t,children:a,side:e="right",...r}){return G(ya,{children:[v(ka,{}),G(u.Content,{"data-slot":"sheet-content",className:c("astw:bg-background astw:data-[state=open]:animate-in astw:data-[state=closed]:animate-out astw:fixed astw:z-50 astw:flex astw:flex-col astw:gap-4 astw:shadow-lg astw:transition astw:ease-in-out astw:data-[state=closed]:duration-300 astw:data-[state=open]:duration-500",e==="right"&&"astw:data-[state=closed]:slide-out-to-right astw:data-[state=open]:slide-in-from-right astw:inset-y-0 astw:right-0 astw:h-full astw:w-3/4 astw:border-l astw:sm:max-w-sm",e==="left"&&"astw:data-[state=closed]:slide-out-to-left astw:data-[state=open]:slide-in-from-left astw:inset-y-0 astw:left-0 astw:h-full astw:w-3/4 astw:border-r astw:sm:max-w-sm",e==="top"&&"astw:data-[state=closed]:slide-out-to-top astw:data-[state=open]:slide-in-from-top astw:inset-x-0 astw:top-0 astw:h-auto astw:border-b",e==="bottom"&&"astw:data-[state=closed]:slide-out-to-bottom astw:data-[state=open]:slide-in-from-bottom astw:inset-x-0 astw:bottom-0 astw:h-auto astw:border-t",t),...r,children:[a,G(u.Close,{className:"astw:ring-offset-bg astw:focus:ring-ring astw:data-[state=open]:bg-secondary astw:absolute astw:top-4 astw:right-4 astw:rounded-xs astw:opacity-70 astw:transition-opacity astw:hover:opacity-100 astw:focus:ring-2 astw:focus:ring-offset-2 astw:focus:outline-hidden astw:disabled:pointer-events-none",children:[v(xa,{className:"astw:size-4"}),v("span",{className:"astw:sr-only",children:"Close"})]})]})]})}function pt({className:t,...a}){return v("div",{"data-slot":"sheet-header",className:c("astw:flex astw:flex-col astw:gap-1.5 astw:p-4",t),...a})}function ut({className:t,...a}){return v(u.Title,{"data-slot":"sheet-title",className:c("astw:text-foreground astw:font-semibold",t),...a})}function gt({className:t,...a}){return v(u.Description,{"data-slot":"sheet-description",className:c("astw:text-muted-foreground astw:text-sm",t),...a})}import{jsx as Je}from"react/jsx-runtime";import*as h from"@radix-ui/react-tooltip";import{jsx as z,jsxs as Pa}from"react/jsx-runtime";function q({delayDuration:t=0,...a}){return z(h.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function mt({...t}){return z(q,{children:z(h.Root,{"data-slot":"tooltip",...t})})}function bt({...t}){return z(h.Trigger,{"data-slot":"tooltip-trigger",...t})}function ht({className:t,sideOffset:a=0,children:e,...r}){return z(h.Portal,{children:Pa(h.Content,{"data-slot":"tooltip-content",sideOffset:a,className:c("astw:bg-primary astw:text-primary-foreground astw:animate-in astw:fade-in-0 astw:zoom-in-95 astw:data-[state=closed]:animate-out astw:data-[state=closed]:fade-out-0 astw:data-[state=closed]:zoom-out-95 astw:data-[side=bottom]:slide-in-from-top-2 astw:data-[side=left]:slide-in-from-right-2 astw:data-[side=right]:slide-in-from-left-2 astw:data-[side=top]:slide-in-from-bottom-2 astw:z-50 astw:w-fit astw:origin-(--radix-tooltip-content-transform-origin) astw:rounded-md astw:px-3 astw:py-1.5 astw:text-xs astw:text-balance",t),...r,children:[e,z(h.Arrow,{className:"astw:bg-primary astw:fill-primary astw:z-50 astw:size-2.5 astw:translate-y-[calc(-50%_-_2px)] astw:rotate-45 astw:rounded-[2px]"})]})})}import{jsx as w,jsxs as I}from"react/jsx-runtime";var Ra="sidebar_state",Ta=60*60*24*7,za="16rem",Na="18rem",Ma="3rem",_a="b",ft=m.createContext(null);function A(){let t=m.useContext(ft);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function vt({defaultOpen:t=!0,open:a,onOpenChange:e,className:r,style:o,children:s,...l}){let i=lt(),[d,p]=m.useState(!1),[b,k]=m.useState(t),x=a??b,P=m.useCallback(f=>{let y=typeof f=="function"?f(x):f;e?e(y):k(y),document.cookie=`${Ra}=${y}; path=/; max-age=${Ta}`},[e,x]),C=m.useCallback(()=>i?p(f=>!f):P(f=>!f),[i,P,p]);m.useEffect(()=>{let f=y=>{y.key===_a&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),C())};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[C]);let W=x?"expanded":"collapsed",E=m.useMemo(()=>({state:W,open:x,setOpen:P,isMobile:i,openMobile:d,setOpenMobile:p,toggleSidebar:C}),[W,x,P,i,d,p,C]);return w(ft.Provider,{value:E,children:w(q,{delayDuration:0,children:w("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":za,"--sidebar-width-icon":Ma,...o},className:c("astw:group/sidebar-wrapper astw:has-data-[variant=inset]:bg-sidebar astw:flex astw:min-h-svh astw:w-full",r),...l,children:s})})})}function xt({side:t="left",variant:a="sidebar",collapsible:e="offcanvas",className:r,children:o,...s}){let{isMobile:l,state:i,openMobile:d,setOpenMobile:p}=A();return e==="none"?w("div",{"data-slot":"sidebar",className:c("astw:bg-sidebar astw:text-sidebar-foreground astw:flex astw:h-full astw:w-(--sidebar-width) astw:flex-col",r),...s,children:o}):l?w(ct,{open:d,onOpenChange:p,...s,children:I(wt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"astw:bg-sidebar astw:text-sidebar-foreground astw:w-(--sidebar-width) astw:p-0 astw:[&>button]:hidden",style:{"--sidebar-width":Na},side:t,children:[I(pt,{className:"sr-only",children:[w(ut,{children:"Sidebar"}),w(gt,{children:"Displays the mobile sidebar."})]}),w("div",{className:"flex h-full w-full flex-col",children:o})]})}):I("div",{className:"astw:group astw:peer astw:text-sidebar-foreground astw:hidden astw:md:block","data-state":i,"data-collapsible":i==="collapsed"?e:"","data-variant":a,"data-side":t,"data-slot":"sidebar",children:[w("div",{"data-slot":"sidebar-gap",className:c("astw:relative astw:w-(--sidebar-width) astw:bg-transparent astw:transition-[width] astw:duration-200 astw:ease-linear","astw:group-data-[collapsible=offcanvas]:w-0","astw:group-data-[side=right]:rotate-180",a==="floating"||a==="inset"?"astw:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"astw:group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),w("div",{"data-slot":"sidebar-container",className:c("astw:fixed astw:inset-y-0 astw:z-10 astw:hidden astw:h-svh astw:w-(--sidebar-width) astw:transition-[left,right,width] astw:duration-200 astw:ease-linear astw:md:flex",t==="left"?"astw:left-0 astw:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"astw:right-0 astw:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",a==="floating"||a==="inset"?"astw:p-2 astw:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"astw:group-data-[collapsible=icon]:w-(--sidebar-width-icon) astw:group-data-[side=left]:border-r astw:group-data-[side=right]:border-l",a==="inset"&&"astw:border-x astw:border-x-border",r),...s,children:w("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"astw:bg-sidebar astw:group-data-[variant=floating]:border-sidebar-border astw:flex astw:h-full astw:w-full astw:flex-col astw:group-data-[variant=floating]:rounded-lg astw:group-data-[variant=floating]:border astw:group-data-[variant=floating]:shadow-sm",children:o})})]})}function Y({className:t,onClick:a,...e}){let{toggleSidebar:r}=A();return I($,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:c("astw:text-muted-foreground",t),onClick:o=>{a?.(o),r()},...e,children:[w(Sa,{className:"astw:size-4.5"}),w("span",{className:"astw:sr-only",children:"Toggle Sidebar"})]})}function yt({className:t,...a}){return w("main",{"data-slot":"sidebar-inset",className:c("astw:bg-background astw:relative astw:flex astw:w-full astw:flex-1 astw:flex-col","astw:px-4 astw:md:peer-data-[variant=inset]:px-8 astw:md:peer-data-[variant=inset]:py-2",t),...a})}function kt({className:t,...a}){return w("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:c("astw:flex astw:flex-row astw:items-center astw:gap-0.5 astw:p-2",t),...a})}function Pt({className:t,...a}){return w("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:c("astw:flex astw:min-h-0 astw:flex-1 astw:flex-col astw:gap-2 astw:overflow-auto astw:group-data-[collapsible=icon]:overflow-hidden",t),...a})}function Ct({className:t,...a}){return w("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:c("astw:relative astw:flex astw:w-full astw:min-w-0 astw:flex-col astw:p-2",t),...a})}function St({className:t,...a}){return w("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:c("astw:flex astw:w-full astw:min-w-0 astw:flex-col astw:gap-1",t),...a})}function Rt({className:t,...a}){return w("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:c("astw:group/menu-item astw:relative",t),...a})}var Ia=Ca("astw:peer/menu-button astw:flex astw:w-full astw:items-center astw:gap-2 astw:overflow-hidden astw:rounded-md astw:p-2 astw:text-left astw:text-sm astw:outline-hidden astw:ring-sidebar-ring astw:transition-[width,height,padding] astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:focus-visible:ring-2 astw:active:bg-sidebar-accent astw:active:text-sidebar-accent-foreground astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:group-has-data-[sidebar=menu-action]/menu-item:pr-8 astw:aria-disabled:pointer-events-none astw:aria-disabled:opacity-50 astw:data-[active=true]:bg-sidebar-accent astw:data-[active=true]:font-medium astw:data-[active=true]:text-sidebar-accent-foreground astw:data-[state=open]:hover:bg-sidebar-accent astw:data-[state=open]:hover:text-sidebar-accent-foreground astw:group-data-[collapsible=icon]:size-8! astw:group-data-[collapsible=icon]:p-2! astw:[&>span:last-child]:truncate astw:[&>svg]:size-4 astw:[&>svg]:shrink-0",{variants:{variant:{default:"astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground",outline:"astw:bg-background astw:shadow-[0_0_0_1px_hsl(var(--sidebar-border))] astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"astw:h-8 astw:text-sm",sm:"astw:h-7 astw:rounded-md astw:gap-1.5 astw:px-3 astw:has-[>svg]:px-2.5",lg:"astw:h-12 astw:text-sm astw:group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Q({asChild:t=!1,isActive:a=!1,variant:e="default",size:r="default",tooltip:o,className:s,...l}){let i=t?X:"button",{isMobile:d,state:p}=A(),b=w(i,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":a,className:c(Ia({variant:e,size:r}),s),...l});return o?(typeof o=="string"&&(o={children:o}),I(mt,{children:[w(bt,{asChild:!0,children:b}),w(ht,{side:"right",align:"center",hidden:p!=="collapsed"||d,...o})]})):b}function J({className:t,asChild:a=!1,showOnHover:e=!1,...r}){return w(a?X:"button",{"data-slot":"sidebar-menu-action","data-sidebar":"menu-action",className:c("astw:text-sidebar-foreground astw:ring-sidebar-ring astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:peer-hover/menu-button:text-sidebar-accent-foreground astw:absolute astw:top-1.5 astw:right-1 astw:flex astw:aspect-square astw:w-5 astw:items-center astw:justify-center astw:rounded-md astw:p-0 astw:outline-hidden astw:transition-transform astw:focus-visible:ring-2 astw:[&>svg]:size-4 astw:[&>svg]:shrink-0","astw:after:absolute astw:after:-inset-2 astw:md:after:hidden","astw:peer-data-[size=sm]/menu-button:top-1","astw:peer-data-[size=default]/menu-button:top-1.5","astw:peer-data-[size=lg]/menu-button:top-2.5","astw:group-data-[collapsible=icon]:hidden",e&&"astw:peer-data-[active=true]/menu-button:text-sidebar-accent-foreground astw:group-focus-within/menu-item:opacity-100 astw:group-hover/menu-item:opacity-100 astw:data-[state=open]:opacity-100 astw:md:opacity-0",t),...r})}function Tt({className:t,...a}){return w("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:c("astw:border-sidebar-border astw:mx-3.5 astw:flex astw:min-w-0 astw:translate-x-px astw:flex-col astw:gap-1 astw:border-l astw:px-2.5 astw:py-0.5","astw:group-data-[collapsible=icon]:hidden",t),...a})}function zt({className:t,...a}){return w("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:c("astw:group/menu-sub-item astw:relative",t),...a})}function Nt({asChild:t=!1,size:a="md",isActive:e=!1,className:r,...o}){return w(t?X:"a",{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":e,className:c("astw:text-sidebar-foreground astw:ring-sidebar-ring astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:active:bg-sidebar-accent astw:active:text-sidebar-accent-foreground astw:[&>svg]:text-sidebar-accent-foreground astw:flex astw:h-7 astw:min-w-0 astw:-translate-x-px astw:items-center astw:gap-2 astw:overflow-hidden astw:rounded-md astw:px-2 astw:outline-hidden astw:focus-visible:ring-2 astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:aria-disabled:pointer-events-none astw:aria-disabled:opacity-50 astw:[&>span:last-child]:truncate astw:[&>svg]:size-4 astw:[&>svg]:shrink-0","astw:data-[active=true]:bg-sidebar-accent astw:data-[active=true]:text-sidebar-accent-foreground",a==="sm"&&"astw:text-xs",a==="md"&&"astw:text-sm","astw:group-data-[collapsible=icon]:hidden",r),...o})}import{ChevronRight as Ot,SunIcon as Da}from"lucide-react";import{Slot as Ea}from"@radix-ui/react-slot";import{ChevronRight as La,MoreHorizontal as Sr}from"lucide-react";import{Link as Aa,useHref as Ba}from"react-router";import{jsx as Mt}from"react/jsx-runtime";function B({to:t,children:a,...e}){try{return Ba(t),Mt(Aa,{to:t,...e,children:a})}catch{return Mt("a",{href:t,...e,children:a})}}import{jsx as N,jsxs as Nr}from"react/jsx-runtime";function _t({...t}){return N("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...t})}function It({className:t,...a}){return N("ol",{"data-slot":"breadcrumb-list",className:c("astw:text-muted-foreground astw:flex astw:flex-wrap astw:items-center astw:gap-1.5 astw:text-sm astw:break-words astw:sm:gap-2.5",t),...a})}function At({className:t,...a}){return N("li",{"data-slot":"breadcrumb-item",className:c("astw:inline-flex astw:items-center astw:gap-1.5",t),...a})}function Bt({asChild:t,className:a,children:e,...r}){return N(t?Ea:B,{"data-slot":"breadcrumb-link",className:c("astw:hover:text-foreground astw:transition-colors",a),...r,children:e})}function Et({children:t,className:a,...e}){return N("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:c("astw:[&>svg]:size-3.5",a),...e,children:t??N(La,{})})}var Oa=t=>t.reduce((a,e)=>{a[e.path]={title:e.meta.title,breadcrumbTitle:e.meta.breadcrumbTitle};let r=(o,s)=>{!o||o.length===0||o.forEach(l=>{let i=`${s}/${l.path}`;a[i]={title:l.meta.title,breadcrumbTitle:l.meta.breadcrumbTitle},l.subResources&&l.subResources.length>0&&r(l.subResources,i)})};return e.resources&&e.resources.length>0&&r(e.resources,e.path),a},{});function Lt(t,a,e){let r=t.split("/").filter(i=>i!=="").slice(1),o=a?(()=>{let[i,...d]=r;return d})():r,s=Oa(e),l=o.map((i,d)=>{let p=o.slice(0,d+1).join("/"),b=s[p];if(!b){let x=Object.entries(s).find(([P])=>{let C=P.split("/").map(E=>E.startsWith(":")?"[^/]+":E).join("/");return new RegExp(`^${C}$`).test(p)})?.[1];x&&(b=x)}let k;return b?typeof b.breadcrumbTitle=="function"?k=b.breadcrumbTitle(i):typeof b.breadcrumbTitle=="string"?k=b.breadcrumbTitle:k=b.title:k=decodeURIComponent(i),{segment:i,path:p,title:k}});return{basePath:a||null,segments:l}}import{Fragment as Dt,jsx as n,jsxs as g}from"react/jsx-runtime";var $a=()=>{let{open:t}=A();return n("div",{className:t?"astw:md:hidden":void 0,children:n(Y,{className:"astw:-ml-2.5"})})},Wa=t=>{let a=t.children?t.children({Outlet:V}):null,e=U(),r=()=>{e.setTheme(e.theme==="dark"?"light":"dark")};return n(vt,{className:"astw:flex astw:flex-col",children:g("div",{className:"astw:flex astw:flex-1",children:[t.sidebar??n(Wt,{}),g(yt,{className:"astw:w-[calc(100%-var(--sidebar-width))]",children:[n("header",{className:"astw:flex astw:h-14 astw:shrink-0 astw:items-center astw:gap-2 astw:transition-[width,height] astw:ease-linear astw:group-has-data-[collapsible=icon]/sidebar-wrapper:h-12",children:g("div",{className:"astw:flex astw:w-full astw:items-center astw:justify-between",children:[g("div",{className:"astw:flex astw:items-center astw:gap-2",children:[n($a,{}),n(Va,{})]}),n("div",{className:"astw:flex astw:items-center astw:gap-2",children:n($,{variant:"outline",size:"icon",onClick:r,children:n(Da,{})})})]})}),n("div",{className:"astw:flex astw:flex-col astw:gap-4",children:a??n(V,{})})]})]})})},Wt=t=>{let{title:a,icon:e,navItems:r}=S(),{pathname:o}=$t(),s=g(kt,{children:[e,n("h1",{className:"astw:text-sm astw:mb-2 astw:mt-2 astw:px-2",children:a})]});return g(xt,{variant:"inset",children:[g("div",{className:"astw:flex astw:justify-between astw:items-center",children:[t.header??s,n("div",{className:"astw:hidden astw:md:block",children:n(Y,{className:"astw:-ml-1"})})]}),n(Pt,{children:n(Ct,{children:n(St,{children:r.map(i=>n(nt,{asChild:!0,defaultOpen:i.isActive,children:g(Rt,{children:[i.url?g(Dt,{children:[n(Q,{asChild:!0,tooltip:i.title,children:g(B,{to:i.url,className:i.url===o?"astw:bg-sidebar-accent astw:font-medium":void 0,children:[i.icon,n("span",{children:i.title})]})}),!!i.items?.length&&n(F,{asChild:!0,children:g(J,{className:"astw:data-[state=open]:rotate-90",children:[n(Ot,{}),n("span",{className:"sr-only",children:"Toggle"})]})})]}):n(Dt,{children:g(F,{className:"astw:flex astw:w-[100%] astw:[&[data-state=open]_.astw-rotate-target]:rotate-90",children:[n(Q,{asChild:!0,tooltip:i.title,children:g("span",{className:"astw:flex astw:w-[100%]",children:[i.icon,n("span",{children:i.title})]})}),!!i.items?.length&&n(J,{className:"astw-rotate-target",asChild:!0,children:g("span",{children:[n(Ot,{}),n("span",{className:"sr-only",children:"Toggle"})]})})]})}),!!i.items?.length&&n(dt,{children:n(Tt,{children:i.items?.map(d=>n(zt,{children:n(Nt,{asChild:!0,children:n(B,{to:d.url,className:d.url===o?"astw:bg-sidebar-accent astw:font-medium":void 0,children:n("span",{children:d.title})})})},d.title))})})]})},i.title))})})}),t.footer??null]})},Ha=()=>{let{configurations:t}=S(),a=$t();return Lt(a.pathname,t.basePath,t.modules)},Va=()=>{let{basePath:t,segments:a}=Ha();return n(_t,{children:n(It,{children:a.map((e,r)=>g("div",{className:"astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground",children:[n(At,{children:n(Bt,{to:`${t?`/${t}`:""}/${R}/${e.path}`,children:e.title})}),r<a.length-1&&n(Et,{})]},r))})})};import{useEffect as Ua}from"react";import{capitalCase as Ht}from"change-case";import{useNavigate as Fa}from"react-router";import{jsx as Vt}from"react/jsx-runtime";function ja(t){let{path:a,meta:e,component:r,defaultResourceRedirectPath:o}=t,s=e?.title??Ht(a),l=r||function(){let d=Fa();return Ua(()=>{d(o)},[d]),null};return{path:a,type:"component",_type:"module",component:()=>Vt(L,{contentBorder:e?.contentBorder??!1,children:l({title:s})}),meta:{title:s,...e?.breadcrumbTitle!==void 0?{breadcrumbTitle:e.breadcrumbTitle}:{},...e,menuItemClickable:!o,icon:t.meta?.icon},resources:t.resources}}function Ka(t){let{path:a,component:e,subResources:r,meta:o}=t,s=o?.title??Ht(a);return{_type:"resource",type:"component",path:a,meta:{title:s,...o?.breadcrumbTitle!==void 0?{breadcrumbTitle:o.breadcrumbTitle}:{}},component:()=>Vt(L,{contentBorder:o?.contentBorder??!1,children:e({title:s})}),subResources:r}}import{useLocation as go,useNavigate as mo,useParams as bo,useSearchParams as ho,Link as fo}from"react-router";import{createContext as qa,useCallback as Xa,useContext as Ya,useEffect as Qa}from"react";import*as M from"oauth4webapi";var Z="oauth_pkce_verifier",tt="oauth_state",Ut=({idpEndpoint:t,clientId:a,state:e,codeChallenge:r,redirectUri:o})=>{let s=new URL(`${t}/oauth2/authorize`);return s.searchParams.set("response_type","code"),s.searchParams.set("client_id",a),s.searchParams.set("redirect_uri",o||window.location.origin),s.searchParams.set("scope","openid profile email"),s.searchParams.set("state",e),s.searchParams.set("code_challenge",r),s.searchParams.set("code_challenge_method","S256"),s.toString()},Ga=async({code:t,returnedState:a,idpEndpoint:e,clientId:r,redirectUri:o})=>{let s=sessionStorage.getItem(Z),l=sessionStorage.getItem(tt);if(!t||!a||!s||!l){let d=[];throw t||d.push("code"),a||d.push("returnedState"),s||d.push("code_verifier"),l||d.push("expectedState"),new Error(`Missing params: ${d.join(", ")}`)}if(a!==l)throw new Error("State mismatch: possible CSRF attack");let i=new URLSearchParams({grant_type:"authorization_code",client_id:r,code:t,redirect_uri:o||window.location.origin,code_verifier:s});try{let d=await fetch(`${e}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json","X-Tailor-Nonce":crypto.randomUUID()},credentials:"include",body:i.toString()}),{access_token:p}=await d.json();return p}catch(d){throw new Error(`Token exchange failed: ${d instanceof Error?d.message:String(d)}`)}},Ft=async()=>{let t=M.generateRandomCodeVerifier(),a=await M.calculatePKCECodeChallenge(t),e=M.generateRandomState();return sessionStorage.setItem(Z,t),sessionStorage.setItem(tt,e),{codeChallenge:a,state:e}},jt=async({currentUrl:t,idpEndpoint:a,clientId:e,redirectUri:r})=>{try{let o=t.searchParams.get("code"),s=t.searchParams.get("state");await Ga({idpEndpoint:a,clientId:e,code:o,returnedState:s,redirectUri:r})}catch(o){console.error(o)}finally{sessionStorage.removeItem(Z),sessionStorage.removeItem(tt),t.searchParams.delete("code"),t.searchParams.delete("state"),t.searchParams.delete("error"),t.searchParams.delete("error_description"),window.history.replaceState({},document.title,t.toString())}};import{jsx as te}from"react/jsx-runtime";var Kt=qa(void 0),Ja=()=>{let t=Ya(Kt);if(t===void 0)throw new Error("useBuiltinIdpAuth must be used within an BuiltinIdPAuthContextProvider");return t},Za=({idpEndpoint:t,clientId:a,redirectUri:e,children:r})=>{let o=Xa(async()=>{let{codeChallenge:s,state:l}=await Ft(),i=Ut({idpEndpoint:t,clientId:a,codeChallenge:s,state:l,redirectUri:e});window.location.href=i},[t,a,e]);return Qa(()=>{let s=new URL(window.location.href);if(s.searchParams.has("error")&&s.searchParams.has("error_description"))throw new Error(s.searchParams.get("error_description")||"Authentication Error");s.searchParams.has("code")&&s.searchParams.has("state")&&jt({currentUrl:s,idpEndpoint:t,clientId:a,redirectUri:e})},[t,a,e]),te(Kt.Provider,{value:{login:o},children:r})};export{pa as AppShell,Za as BuiltinIdPAuthProvider,Wt as DefaultSidebar,fo as Link,Wa as SidebarLayoutContainer,ja as defineModule,Ka as defineResource,S as useAppShell,Ja as useBuiltinIdpAuth,go as useLocation,mo as useNavigate,bo as useParams,ho as useSearchParams,U as useTheme};
1
+ import{Table as la}from"lucide-react";import{useEffect as ca,useMemo as wa,useState as pa}from"react";import{createContext as qt,useContext as Yt}from"react";var V=qt({navItems:[],configurations:{modules:[]}}),S=()=>Yt(V);import{createBrowserRouter as Zt,RouterProvider as ta}from"react-router";import{Outlet as Xt}from"react-router";import{Toaster as Qt}from"sonner";import{Fragment as Jt,jsx as _,jsxs as rt}from"react/jsx-runtime";var D=({contentBorder:t,children:a})=>_("div",{className:t?"astw:p-4 astw:rounded-sm astw:border astw:shadow-xs":"",children:a}),et=()=>rt(D,{contentBorder:!0,children:[_("p",{className:"astw:font-semibold astw:leading-none astw:tracking-tight",children:"Welcome to AppShell"}),_("p",{className:"pt-4",children:"Add your GraphQL resources from configuration at first!"})]}),K=()=>rt(Jt,{children:[_(Xt,{}),_(Qt,{})]});import{jsx as aa}from"react/jsx-runtime";var ot=t=>{let a={index:!0,Component:t.component};return{path:t.path,...t.subResources&&t.subResources.length>0?{children:[a,...t.subResources.map(ot)]}:{children:[a]}}},st=t=>{let{configurations:a}=S(),e=a.modules.reduce((o,s)=>{let l={index:!0,Component:s.component};return[...o,{path:s.path,...s.resources&&s.resources.length>0?{children:[l,...s.resources.map(ot)]}:{children:[l]}}]},[]),r=Zt([{path:a.basePath,element:t.children,children:[{index:!0,Component:et},{path:R,children:e}]}]);return aa(ta,{router:r})};import{createContext as ea,useContext as ra,useEffect as oa,useMemo as sa,useState as ia}from"react";import{jsx as da}from"react/jsx-runtime";var na={resolvedTheme:"light",theme:"system",setTheme:()=>null},it=ea(na);function nt({children:t,storageKey:a,defaultTheme:e="system",...r}){let[o,s]=ia(()=>localStorage.getItem(a)||e),l=sa(()=>o!=="system"?o:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",[o]);oa(()=>{let d=window.document.documentElement;d.classList.remove("light","dark"),d.classList.add(l)},[l]);let i={resolvedTheme:l,theme:o,setTheme:d=>{localStorage.setItem(a,d),s(d)}};return da(it.Provider,{...r,value:i,children:t})}var F=()=>{let t=ra(it);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t};import{jsx as $}from"react/jsx-runtime";var R="resources",ua=t=>{let[a,e]=pa(!1);ca(function(){e(!0)},[]);let r=t.configurations.basePath,o=l=>r?`/${r}/${R}/${l}`:`/${R}/${l}`,s=wa(()=>t.configurations.modules.map(i=>{let d=i.resources.map(w=>({title:w.meta.title,url:o(`${i.path}/${w.path}`)}));return{title:i.meta.title,url:i.meta.menuItemClickable?o(i.path):void 0,clickable:i.component,icon:i.meta.icon||$(la,{}),isActive:!0,items:d}}),[t.configurations.modules]);return a?$(V.Provider,{value:{title:t.title,icon:t.icon,configurations:{...t.configurations,basePath:r},navItems:s},children:$(nt,{defaultTheme:"system",storageKey:"appshell-ui-theme",children:$(st,{children:t.children})})}):null};import*as T from"@radix-ui/react-collapsible";import{jsx as G}from"react/jsx-runtime";function dt({...t}){return G(T.Root,{"data-slot":"collapsible",...t})}function j({...t}){return G(T.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...t})}function lt({...t}){return G(T.CollapsibleContent,{"data-slot":"collapsible-content",...t})}import{useLocation as Ut}from"react-router";import*as b from"react";import{Slot as Q}from"@radix-ui/react-slot";import{cva as Sa}from"class-variance-authority";import{PanelLeftIcon as Ra}from"lucide-react";import*as U from"react";var q=768;function ct(){let[t,a]=U.useState(void 0);return U.useEffect(()=>{let e=window.matchMedia(`(max-width: ${q-1}px)`),r=()=>{a(window.innerWidth<q)};return e.addEventListener("change",r),a(window.innerWidth<q),()=>e.removeEventListener("change",r)},[]),!!t}import{clsx as ga}from"clsx";import{twMerge as ma}from"tailwind-merge";function c(...t){return ma(ga(t))}import{Slot as ba}from"@radix-ui/react-slot";import{cva as ha}from"class-variance-authority";import{jsx as va}from"react/jsx-runtime";var fa=ha("astw:inline-flex astw:items-center astw:justify-center astw:gap-2 astw:whitespace-nowrap astw:rounded-md astw:text-sm astw:font-medium astw:transition-all astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:[&_svg]:pointer-events-none astw:[&_svg:not([class*='size-'])]:size-4 astw:shrink-0 astw:[&_svg]:shrink-0 astw:outline-none astw:focus-visible:border-ring astw:focus-visible:ring-ring/50 astw:focus-visible:ring-[3px] astw:aria-invalid:ring-destructive/20 astw:dark:aria-invalid:ring-destructive/40 astw:aria-invalid:border-destructive",{variants:{variant:{default:"astw:bg-primary astw:text-primary-foreground astw:shadow-xs astw:hover:bg-primary/90",destructive:"astw:bg-destructive astw:text-white astw:shadow-xs astw:hover:bg-destructive/90 astw:focus-visible:ring-destructive/20 astw:dark:focus-visible:ring-destructive/40 astw:dark:bg-destructive/60",outline:"astw:border astw:bg-background astw:shadow-xs astw:hover:bg-accent astw:hover:text-accent-foreground astw:dark:bg-input/30 astw:dark:border-input astw:dark:hover:bg-input/50",secondary:"astw:bg-secondary astw:text-secondary-foreground astw:shadow-xs astw:hover:bg-secondary/80",ghost:"astw:hover:bg-accent astw:hover:text-accent-foreground astw:dark:hover:bg-accent/50",link:"astw:text-primary astw:underline-offset-4 astw:hover:underline"},size:{default:"astw:h-9 astw:px-4 astw:py-2 astw:has-[>svg]:px-3",sm:"astw:h-8 astw:rounded-md astw:gap-1.5 astw:px-3 astw:has-[>svg]:px-2.5",lg:"astw:h-10 astw:rounded-md astw:px-6 astw:has-[>svg]:px-4",icon:"astw:size-9"}},defaultVariants:{variant:"default",size:"default"}});function W({className:t,variant:a,size:e,asChild:r=!1,...o}){return va(r?ba:"button",{"data-slot":"button",className:c(fa({variant:a,size:e,className:t})),...o})}import{jsx as We}from"react/jsx-runtime";import*as xa from"@radix-ui/react-separator";import{jsx as Fe}from"react/jsx-runtime";import*as g from"@radix-ui/react-dialog";import{XIcon as ya}from"lucide-react";import{jsx as x,jsxs as Y}from"react/jsx-runtime";function wt({...t}){return x(g.Root,{"data-slot":"sheet",...t})}function ka({...t}){return x(g.Portal,{"data-slot":"sheet-portal",...t})}function Pa({className:t,...a}){return x(g.Overlay,{"data-slot":"sheet-overlay",className:c("astw:data-[state=open]:animate-in astw:data-[state=closed]:animate-out astw:data-[state=closed]:fade-out-0 astw:data-[state=open]:fade-in-0 astw:fixed astw:inset-0 astw:z-50 astw:bg-black/50",t),...a})}function pt({className:t,children:a,side:e="right",...r}){return Y(ka,{children:[x(Pa,{}),Y(g.Content,{"data-slot":"sheet-content",className:c("astw:bg-background astw:data-[state=open]:animate-in astw:data-[state=closed]:animate-out astw:fixed astw:z-50 astw:flex astw:flex-col astw:gap-4 astw:shadow-lg astw:transition astw:ease-in-out astw:data-[state=closed]:duration-300 astw:data-[state=open]:duration-500",e==="right"&&"astw:data-[state=closed]:slide-out-to-right astw:data-[state=open]:slide-in-from-right astw:inset-y-0 astw:right-0 astw:h-full astw:w-3/4 astw:border-l astw:sm:max-w-sm",e==="left"&&"astw:data-[state=closed]:slide-out-to-left astw:data-[state=open]:slide-in-from-left astw:inset-y-0 astw:left-0 astw:h-full astw:w-3/4 astw:border-r astw:sm:max-w-sm",e==="top"&&"astw:data-[state=closed]:slide-out-to-top astw:data-[state=open]:slide-in-from-top astw:inset-x-0 astw:top-0 astw:h-auto astw:border-b",e==="bottom"&&"astw:data-[state=closed]:slide-out-to-bottom astw:data-[state=open]:slide-in-from-bottom astw:inset-x-0 astw:bottom-0 astw:h-auto astw:border-t",t),...r,children:[a,Y(g.Close,{className:"astw:ring-offset-bg astw:focus:ring-ring astw:data-[state=open]:bg-secondary astw:absolute astw:top-4 astw:right-4 astw:rounded-xs astw:opacity-70 astw:transition-opacity astw:hover:opacity-100 astw:focus:ring-2 astw:focus:ring-offset-2 astw:focus:outline-hidden astw:disabled:pointer-events-none",children:[x(ya,{className:"astw:size-4"}),x("span",{className:"astw:sr-only",children:"Close"})]})]})]})}function ut({className:t,...a}){return x("div",{"data-slot":"sheet-header",className:c("astw:flex astw:flex-col astw:gap-1.5 astw:p-4",t),...a})}function gt({className:t,...a}){return x(g.Title,{"data-slot":"sheet-title",className:c("astw:text-foreground astw:font-semibold",t),...a})}function mt({className:t,...a}){return x(g.Description,{"data-slot":"sheet-description",className:c("astw:text-muted-foreground astw:text-sm",t),...a})}import{jsx as Ze}from"react/jsx-runtime";import*as h from"@radix-ui/react-tooltip";import{jsx as z,jsxs as Ca}from"react/jsx-runtime";function X({delayDuration:t=0,...a}){return z(h.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function bt({...t}){return z(X,{children:z(h.Root,{"data-slot":"tooltip",...t})})}function ht({...t}){return z(h.Trigger,{"data-slot":"tooltip-trigger",...t})}function ft({className:t,sideOffset:a=0,children:e,...r}){return z(h.Portal,{children:Ca(h.Content,{"data-slot":"tooltip-content",sideOffset:a,className:c("astw:bg-primary astw:text-primary-foreground astw:animate-in astw:fade-in-0 astw:zoom-in-95 astw:data-[state=closed]:animate-out astw:data-[state=closed]:fade-out-0 astw:data-[state=closed]:zoom-out-95 astw:data-[side=bottom]:slide-in-from-top-2 astw:data-[side=left]:slide-in-from-right-2 astw:data-[side=right]:slide-in-from-left-2 astw:data-[side=top]:slide-in-from-bottom-2 astw:z-50 astw:w-fit astw:origin-(--radix-tooltip-content-transform-origin) astw:rounded-md astw:px-3 astw:py-1.5 astw:text-xs astw:text-balance",t),...r,children:[e,z(h.Arrow,{className:"astw:bg-primary astw:fill-primary astw:z-50 astw:size-2.5 astw:translate-y-[calc(-50%_-_2px)] astw:rotate-45 astw:rounded-[2px]"})]})})}import{jsx as p,jsxs as I}from"react/jsx-runtime";var Ta="sidebar_state",za=60*60*24*7,Na="16rem",Ma="18rem",_a="3rem",Ia="b",vt=b.createContext(null);function A(){let t=b.useContext(vt);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function xt({defaultOpen:t=!0,open:a,onOpenChange:e,className:r,style:o,children:s,...l}){let i=ct(),[d,w]=b.useState(!1),[u,v]=b.useState(t),y=a??u,P=b.useCallback(f=>{let k=typeof f=="function"?f(y):f;e?e(k):v(k),document.cookie=`${Ta}=${k}; path=/; max-age=${za}`},[e,y]),C=b.useCallback(()=>i?w(f=>!f):P(f=>!f),[i,P,w]);b.useEffect(()=>{let f=k=>{k.key===Ia&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),C())};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[C]);let H=y?"expanded":"collapsed",O=b.useMemo(()=>({state:H,open:y,setOpen:P,isMobile:i,openMobile:d,setOpenMobile:w,toggleSidebar:C}),[H,y,P,i,d,w,C]);return p(vt.Provider,{value:O,children:p(X,{delayDuration:0,children:p("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Na,"--sidebar-width-icon":_a,...o},className:c("astw:group/sidebar-wrapper astw:has-data-[variant=inset]:bg-sidebar astw:flex astw:min-h-svh astw:w-full",r),...l,children:s})})})}function yt({side:t="left",variant:a="sidebar",collapsible:e="offcanvas",className:r,children:o,...s}){let{isMobile:l,state:i,openMobile:d,setOpenMobile:w}=A();return e==="none"?p("div",{"data-slot":"sidebar",className:c("astw:bg-sidebar astw:text-sidebar-foreground astw:flex astw:h-full astw:w-(--sidebar-width) astw:flex-col",r),...s,children:o}):l?p(wt,{open:d,onOpenChange:w,...s,children:I(pt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"astw:bg-sidebar astw:text-sidebar-foreground astw:w-(--sidebar-width) astw:p-0 astw:[&>button]:hidden",style:{"--sidebar-width":Ma},side:t,children:[I(ut,{className:"sr-only",children:[p(gt,{children:"Sidebar"}),p(mt,{children:"Displays the mobile sidebar."})]}),p("div",{className:"flex h-full w-full flex-col",children:o})]})}):I("div",{className:"astw:group astw:peer astw:text-sidebar-foreground astw:hidden astw:md:block","data-state":i,"data-collapsible":i==="collapsed"?e:"","data-variant":a,"data-side":t,"data-slot":"sidebar",children:[p("div",{"data-slot":"sidebar-gap",className:c("astw:relative astw:w-(--sidebar-width) astw:bg-transparent astw:transition-[width] astw:duration-200 astw:ease-linear","astw:group-data-[collapsible=offcanvas]:w-0","astw:group-data-[side=right]:rotate-180",a==="floating"||a==="inset"?"astw:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"astw:group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),p("div",{"data-slot":"sidebar-container",className:c("astw:fixed astw:inset-y-0 astw:z-10 astw:hidden astw:h-svh astw:w-(--sidebar-width) astw:transition-[left,right,width] astw:duration-200 astw:ease-linear astw:md:flex",t==="left"?"astw:left-0 astw:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"astw:right-0 astw:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",a==="floating"||a==="inset"?"astw:p-2 astw:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"astw:group-data-[collapsible=icon]:w-(--sidebar-width-icon) astw:group-data-[side=left]:border-r astw:group-data-[side=right]:border-l",a==="inset"&&"astw:border-x astw:border-x-border",r),...s,children:p("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"astw:bg-sidebar astw:group-data-[variant=floating]:border-sidebar-border astw:flex astw:h-full astw:w-full astw:flex-col astw:group-data-[variant=floating]:rounded-lg astw:group-data-[variant=floating]:border astw:group-data-[variant=floating]:shadow-sm",children:o})})]})}function J({className:t,onClick:a,...e}){let{toggleSidebar:r}=A();return I(W,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:c("astw:text-muted-foreground",t),onClick:o=>{a?.(o),r()},...e,children:[p(Ra,{className:"astw:size-4.5"}),p("span",{className:"astw:sr-only",children:"Toggle Sidebar"})]})}function kt({className:t,...a}){return p("main",{"data-slot":"sidebar-inset",className:c("astw:bg-background astw:relative astw:flex astw:w-full astw:flex-1 astw:flex-col","astw:px-4 astw:md:peer-data-[variant=inset]:px-8 astw:md:peer-data-[variant=inset]:py-2",t),...a})}function Pt({className:t,...a}){return p("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:c("astw:flex astw:flex-row astw:items-center astw:gap-0.5 astw:p-2",t),...a})}function Ct({className:t,...a}){return p("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:c("astw:flex astw:min-h-0 astw:flex-1 astw:flex-col astw:gap-2 astw:overflow-auto astw:group-data-[collapsible=icon]:overflow-hidden",t),...a})}function St({className:t,...a}){return p("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:c("astw:relative astw:flex astw:w-full astw:min-w-0 astw:flex-col astw:p-2",t),...a})}function Rt({className:t,...a}){return p("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:c("astw:flex astw:w-full astw:min-w-0 astw:flex-col astw:gap-1",t),...a})}function Tt({className:t,...a}){return p("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:c("astw:group/menu-item astw:relative",t),...a})}var Aa=Sa("astw:peer/menu-button astw:flex astw:w-full astw:items-center astw:gap-2 astw:overflow-hidden astw:rounded-md astw:p-2 astw:text-left astw:text-sm astw:outline-hidden astw:ring-sidebar-ring astw:transition-[width,height,padding] astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:focus-visible:ring-2 astw:active:bg-sidebar-accent astw:active:text-sidebar-accent-foreground astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:group-has-data-[sidebar=menu-action]/menu-item:pr-8 astw:aria-disabled:pointer-events-none astw:aria-disabled:opacity-50 astw:data-[active=true]:bg-sidebar-accent astw:data-[active=true]:font-medium astw:data-[active=true]:text-sidebar-accent-foreground astw:data-[state=open]:hover:bg-sidebar-accent astw:data-[state=open]:hover:text-sidebar-accent-foreground astw:group-data-[collapsible=icon]:size-8! astw:group-data-[collapsible=icon]:p-2! astw:[&>span:last-child]:truncate astw:[&>svg]:size-4 astw:[&>svg]:shrink-0",{variants:{variant:{default:"astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground",outline:"astw:bg-background astw:shadow-[0_0_0_1px_hsl(var(--sidebar-border))] astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"astw:h-8 astw:text-sm",sm:"astw:h-7 astw:rounded-md astw:gap-1.5 astw:px-3 astw:has-[>svg]:px-2.5",lg:"astw:h-12 astw:text-sm astw:group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Z({asChild:t=!1,isActive:a=!1,variant:e="default",size:r="default",tooltip:o,className:s,...l}){let i=t?Q:"button",{isMobile:d,state:w}=A(),u=p(i,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":a,className:c(Aa({variant:e,size:r}),s),...l});return o?(typeof o=="string"&&(o={children:o}),I(bt,{children:[p(ht,{asChild:!0,children:u}),p(ft,{side:"right",align:"center",hidden:w!=="collapsed"||d,...o})]})):u}function tt({className:t,asChild:a=!1,showOnHover:e=!1,...r}){return p(a?Q:"button",{"data-slot":"sidebar-menu-action","data-sidebar":"menu-action",className:c("astw:text-sidebar-foreground astw:ring-sidebar-ring astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:peer-hover/menu-button:text-sidebar-accent-foreground astw:absolute astw:top-1.5 astw:right-1 astw:flex astw:aspect-square astw:w-5 astw:items-center astw:justify-center astw:rounded-md astw:p-0 astw:outline-hidden astw:transition-transform astw:focus-visible:ring-2 astw:[&>svg]:size-4 astw:[&>svg]:shrink-0","astw:after:absolute astw:after:-inset-2 astw:md:after:hidden","astw:peer-data-[size=sm]/menu-button:top-1","astw:peer-data-[size=default]/menu-button:top-1.5","astw:peer-data-[size=lg]/menu-button:top-2.5","astw:group-data-[collapsible=icon]:hidden",e&&"astw:peer-data-[active=true]/menu-button:text-sidebar-accent-foreground astw:group-focus-within/menu-item:opacity-100 astw:group-hover/menu-item:opacity-100 astw:data-[state=open]:opacity-100 astw:md:opacity-0",t),...r})}function zt({className:t,...a}){return p("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:c("astw:border-sidebar-border astw:mx-3.5 astw:flex astw:min-w-0 astw:translate-x-px astw:flex-col astw:gap-1 astw:border-l astw:px-2.5 astw:py-0.5","astw:group-data-[collapsible=icon]:hidden",t),...a})}function Nt({className:t,...a}){return p("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:c("astw:group/menu-sub-item astw:relative",t),...a})}function Mt({asChild:t=!1,size:a="md",isActive:e=!1,className:r,...o}){return p(t?Q:"a",{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":e,className:c("astw:text-sidebar-foreground astw:ring-sidebar-ring astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:active:bg-sidebar-accent astw:active:text-sidebar-accent-foreground astw:[&>svg]:text-sidebar-accent-foreground astw:flex astw:h-7 astw:min-w-0 astw:-translate-x-px astw:items-center astw:gap-2 astw:overflow-hidden astw:rounded-md astw:px-2 astw:outline-hidden astw:focus-visible:ring-2 astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:aria-disabled:pointer-events-none astw:aria-disabled:opacity-50 astw:[&>span:last-child]:truncate astw:[&>svg]:size-4 astw:[&>svg]:shrink-0","astw:data-[active=true]:bg-sidebar-accent astw:data-[active=true]:text-sidebar-accent-foreground",a==="sm"&&"astw:text-xs",a==="md"&&"astw:text-sm","astw:group-data-[collapsible=icon]:hidden",r),...o})}import{ChevronRight as Dt,SunIcon as $a}from"lucide-react";import{Slot as La}from"@radix-ui/react-slot";import{ChevronRight as Oa,MoreHorizontal as Rr}from"lucide-react";import{Link as Ba,useHref as Ea}from"react-router";import{jsx as _t}from"react/jsx-runtime";function B({to:t,children:a,...e}){try{return Ea(t),_t(Ba,{to:t,...e,children:a})}catch{return _t("a",{href:t,...e,children:a})}}import{jsx as N,jsxs as Mr}from"react/jsx-runtime";function It({...t}){return N("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...t})}function At({className:t,...a}){return N("ol",{"data-slot":"breadcrumb-list",className:c("astw:text-muted-foreground astw:flex astw:flex-wrap astw:items-center astw:gap-1.5 astw:text-sm astw:break-words astw:sm:gap-2.5",t),...a})}function Bt({className:t,...a}){return N("li",{"data-slot":"breadcrumb-item",className:c("astw:inline-flex astw:items-center astw:gap-1.5",t),...a})}function Et({asChild:t,className:a,children:e,...r}){return N(t?La:B,{"data-slot":"breadcrumb-link",className:c("astw:hover:text-foreground astw:transition-colors",a),...r,children:e})}function Lt({children:t,className:a,...e}){return N("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:c("astw:[&>svg]:size-3.5",a),...e,children:t??N(Oa,{})})}var Da=t=>t.reduce((a,e)=>{a[e.path]={title:e.meta.title,breadcrumbTitle:e.meta.breadcrumbTitle};let r=(o,s)=>{!o||o.length===0||o.forEach(l=>{let i=`${s}/${l.path}`;a[i]={title:l.meta.title,breadcrumbTitle:l.meta.breadcrumbTitle},l.subResources&&l.subResources.length>0&&r(l.subResources,i)})};return e.resources&&e.resources.length>0&&r(e.resources,e.path),a},{});function Ot(t,a,e){let r=t.split("/").filter(i=>i!=="").slice(1),o=a?(()=>{let[i,...d]=r;return d})():r,s=Da(e),l=o.map((i,d)=>{let w=o.slice(0,d+1).join("/"),u=s[w];if(!u){let y=Object.entries(s).find(([P])=>{let C=P.split("/").map(O=>O.startsWith(":")?"[^/]+":O).join("/");return new RegExp(`^${C}$`).test(w)})?.[1];y&&(u=y)}let v;return u?typeof u.breadcrumbTitle=="function"?v=u.breadcrumbTitle(i):typeof u.breadcrumbTitle=="string"?v=u.breadcrumbTitle:v=u.title:v=decodeURIComponent(i),{segment:i,path:w,title:v}});return{basePath:a||null,segments:l}}import{Fragment as $t,jsx as n,jsxs as m}from"react/jsx-runtime";var Ua=()=>{let{open:t}=A();return n("div",{className:t?"astw:md:hidden":void 0,children:n(J,{className:"astw:-ml-2.5"})})},Wa=t=>{let a=t.children?t.children({Outlet:K}):null,e=F(),r=()=>{e.setTheme(e.theme==="dark"?"light":"dark")};return n(xt,{className:"astw:flex astw:flex-col",children:m("div",{className:"astw:flex astw:flex-1",children:[t.sidebar??n(Wt,{}),m(kt,{className:"astw:w-[calc(100%-var(--sidebar-width))]",children:[n("header",{className:"astw:flex astw:h-14 astw:shrink-0 astw:items-center astw:gap-2 astw:transition-[width,height] astw:ease-linear astw:group-has-data-[collapsible=icon]/sidebar-wrapper:h-12",children:m("div",{className:"astw:flex astw:w-full astw:items-center astw:justify-between",children:[m("div",{className:"astw:flex astw:items-center astw:gap-2",children:[n(Ua,{}),n(Va,{})]}),n("div",{className:"astw:flex astw:items-center astw:gap-2",children:n(W,{variant:"outline",size:"icon",onClick:r,children:n($a,{})})})]})}),n("div",{className:"astw:flex astw:flex-col astw:gap-4",children:a??n(K,{})})]})]})})},Wt=t=>{let{title:a,icon:e,navItems:r}=S(),{pathname:o}=Ut(),s=m(Pt,{children:[e,n("h1",{className:"astw:text-sm astw:mb-2 astw:mt-2 astw:px-2",children:a})]});return m(yt,{variant:"inset",children:[m("div",{className:"astw:flex astw:justify-between astw:items-center",children:[t.header??s,n("div",{className:"astw:hidden astw:md:block",children:n(J,{className:"astw:-ml-1"})})]}),n(Ct,{children:n(St,{children:n(Rt,{children:r.map(i=>n(dt,{asChild:!0,defaultOpen:i.isActive,children:m(Tt,{children:[i.url?m($t,{children:[n(Z,{asChild:!0,tooltip:i.title,children:m(B,{to:i.url,className:i.url===o?"astw:bg-sidebar-accent astw:font-medium":void 0,children:[i.icon,n("span",{children:i.title})]})}),!!i.items?.length&&n(j,{asChild:!0,children:m(tt,{className:"astw:data-[state=open]:rotate-90",children:[n(Dt,{}),n("span",{className:"sr-only",children:"Toggle"})]})})]}):n($t,{children:m(j,{className:"astw:flex astw:w-[100%] astw:[&[data-state=open]_.astw-rotate-target]:rotate-90",children:[n(Z,{asChild:!0,tooltip:i.title,children:m("span",{className:"astw:flex astw:w-[100%]",children:[i.icon,n("span",{children:i.title})]})}),!!i.items?.length&&n(tt,{className:"astw-rotate-target",asChild:!0,children:m("span",{children:[n(Dt,{}),n("span",{className:"sr-only",children:"Toggle"})]})})]})}),!!i.items?.length&&n(lt,{children:n(zt,{children:i.items?.map(d=>n(Nt,{children:n(Mt,{asChild:!0,children:n(B,{to:d.url,className:d.url===o?"astw:bg-sidebar-accent astw:font-medium":void 0,children:n("span",{children:d.title})})})},d.title))})})]})},i.title))})})}),t.footer??null]})},Ha=()=>{let{configurations:t}=S(),a=Ut();return Ot(a.pathname,t.basePath,t.modules)},Va=()=>{let{basePath:t,segments:a}=Ha();return n(It,{children:n(At,{children:a.map((e,r)=>m("div",{className:"astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground",children:[n(Bt,{children:n(Et,{to:`${t?`/${t}`:""}/${R}/${e.path}`,children:e.title})}),r<a.length-1&&n(Lt,{})]},r))})})};import{useEffect as Ka}from"react";import{capitalCase as Ht}from"change-case";import{useNavigate as Fa}from"react-router";import{jsx as Vt}from"react/jsx-runtime";function ja(t){let{path:a,meta:e,component:r,defaultResourceRedirectPath:o}=t,s=e?.title??Ht(a),l=r||function(){let d=Fa();return Ka(()=>{d(o)},[d]),null};return{path:a,type:"component",_type:"module",component:()=>Vt(D,{contentBorder:e?.contentBorder??!1,children:l({title:s})}),meta:{title:s,...e?.breadcrumbTitle!==void 0?{breadcrumbTitle:e.breadcrumbTitle}:{},...e,menuItemClickable:!o,icon:t.meta?.icon},resources:t.resources}}function Ga(t){let{path:a,component:e,subResources:r,meta:o}=t,s=o?.title??Ht(a);return{_type:"resource",type:"component",path:a,meta:{title:s,...o?.breadcrumbTitle!==void 0?{breadcrumbTitle:o.breadcrumbTitle}:{}},component:()=>Vt(D,{contentBorder:o?.contentBorder??!1,children:e({title:s})}),subResources:r}}import{useLocation as mo,useNavigate as bo,useParams as ho,useSearchParams as fo,Link as vo}from"react-router";import{createContext as Ya,useCallback as at,useContext as Xa,useEffect as Qa,useState as Ja}from"react";import*as M from"oauth4webapi";var E="oauth_pkce_verifier",L="oauth_state",Kt=({idpEndpoint:t,clientId:a,state:e,codeChallenge:r,redirectUri:o})=>{let s=new URL(`${t}/oauth2/authorize`);return s.searchParams.set("response_type","code"),s.searchParams.set("client_id",a),s.searchParams.set("redirect_uri",o||window.location.origin),s.searchParams.set("scope","openid profile email"),s.searchParams.set("state",e),s.searchParams.set("code_challenge",r),s.searchParams.set("code_challenge_method","S256"),s.toString()},qa=async({code:t,returnedState:a,idpEndpoint:e,clientId:r,redirectUri:o})=>{let s=sessionStorage.getItem(E),l=sessionStorage.getItem(L);if(!t||!a||!s||!l){let d=[];throw t||d.push("code"),a||d.push("returnedState"),s||d.push("code_verifier"),l||d.push("expectedState"),new Error(`Missing params: ${d.join(", ")}`)}if(a!==l)throw new Error("State mismatch: possible CSRF attack");let i=new URLSearchParams({grant_type:"authorization_code",client_id:r,code:t,redirect_uri:o||window.location.origin,code_verifier:s});try{let d=await fetch(`${e}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json","X-Tailor-Nonce":crypto.randomUUID()},credentials:"include",body:i.toString()}),{access_token:w}=await d.json();return w}catch(d){throw new Error(`Token exchange failed: ${d instanceof Error?d.message:String(d)}`)}},Ft=async()=>{let t=M.generateRandomCodeVerifier(),a=await M.calculatePKCECodeChallenge(t),e=M.generateRandomState();return sessionStorage.setItem(E,t),sessionStorage.setItem(L,e),{codeChallenge:a,state:e}},jt=async({currentUrl:t,idpEndpoint:a,clientId:e,redirectUri:r})=>{try{let o=t.searchParams.get("code"),s=t.searchParams.get("state");await qa({idpEndpoint:a,clientId:e,code:o,returnedState:s,redirectUri:r})}catch(o){console.error(o)}finally{sessionStorage.removeItem(E),sessionStorage.removeItem(L),t.searchParams.delete("code"),t.searchParams.delete("state"),t.searchParams.delete("error"),t.searchParams.delete("error_description"),window.history.replaceState({},document.title,t.toString())}};import{jsx as ae}from"react/jsx-runtime";var Gt=Ya(void 0),Za=()=>{let t=Xa(Gt);if(t===void 0)throw new Error("useBuiltinIdpAuth must be used within an BuiltinIdPAuthContextProvider");return t},te=({idpEndpoint:t,clientId:a,redirectUri:e,children:r})=>{let[o,s]=Ja(!0),l=at(async()=>{let{codeChallenge:w,state:u}=await Ft(),v=Kt({idpEndpoint:t,clientId:a,codeChallenge:w,state:u,redirectUri:e});window.location.href=v},[t,a,e]),i=at(async()=>{sessionStorage.removeItem(E),sessionStorage.removeItem(L);try{await fetch(`${t}/oauth2/revoke`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Tailor-Nonce":crypto.randomUUID()},credentials:"include",body:""}),window.location.href="/"}catch(w){console.error(w)}},[t]),d=at(async w=>{s(!0),await jt({currentUrl:w,idpEndpoint:t,clientId:a,redirectUri:e}),s(!1)},[t,a,e]);return Qa(()=>{let w=new URL(window.location.href);w.searchParams.has("error")&&w.searchParams.has("error_description")?(console.error(w.searchParams.get("error_description")||"Authentication Error"),s(!1)):w.searchParams.has("code")&&w.searchParams.has("state")?d(w):s(!1)},[]),ae(Gt.Provider,{value:{isLoading:o,login:l,logout:i},children:r})};export{ua as AppShell,te as BuiltinIdPAuthProvider,Wt as DefaultSidebar,vo as Link,Wa as SidebarLayoutContainer,ja as defineModule,Ga as defineResource,S as useAppShell,Za as useBuiltinIdpAuth,mo as useLocation,bo as useNavigate,ho as useParams,fo as useSearchParams,F as useTheme};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/app-shell",
3
- "version": "0.9.3",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./styles": "./dist/index.css",
@@ -33,7 +33,8 @@
33
33
  "@radix-ui/react-slot": "^1.1.2",
34
34
  "@radix-ui/react-tooltip": "^1.1.8",
35
35
  "@tanstack/react-table": "^8.21.2",
36
- "@urql/exchange-auth": "^2.2.0",
36
+ "@urql/core": "^6.0.0",
37
+ "@urql/exchange-auth": "^3.0.0",
37
38
  "change-case": "^5.4.4",
38
39
  "class-variance-authority": "^0.7.1",
39
40
  "clsx": "^2.1.1",
@@ -49,13 +50,17 @@
49
50
  "react-router": "^7.4.0",
50
51
  "sonner": "^2.0.7",
51
52
  "tailwind-merge": "^3.0.1",
53
+ "urql": "^5.0.1",
52
54
  "zod": "^3.24.2"
53
55
  },
54
56
  "devDependencies": {
55
57
  "@tailwindcss/postcss": "^4.1.2",
58
+ "@testing-library/react": "^16.3.0",
56
59
  "@types/node": "^22",
57
60
  "@types/react": "^19",
58
61
  "@types/react-dom": "^19",
62
+ "jsdom": "^27.0.0",
63
+ "msw": "^2.11.2",
59
64
  "postcss": "^8",
60
65
  "prettier": "^3.5.1",
61
66
  "tailwindcss": "^4.1.3",