@cryptlex/web-components 6.6.119 → 6.6.120

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.
@@ -48,25 +48,6 @@ export interface DialogContentProps extends Omit<React.ComponentProps<typeof Ari
48
48
  */
49
49
  closeButton?: boolean;
50
50
  }
51
- /**
52
- * Dialog panel container. Renders either a centered modal or a sheet
53
- * from an edge when `side` is provided.
54
- *
55
- * @example Basic
56
- * ```tsx
57
- * <DialogTrigger>
58
- * <Button>Open</Button>
59
- * <DialogOverlay>
60
- * <DialogContent>
61
- * <DialogHeader>
62
- * <DialogTitle>Sign up</DialogTitle>
63
- * </DialogHeader>
64
- * ...
65
- * </DialogContent>
66
- * </DialogOverlay>
67
- * </DialogTrigger>
68
- * ```
69
- */
70
51
  export declare function DialogContent({ className, children, side, role, closeButton, ...props }: DialogContentProps): import("react/jsx-runtime").JSX.Element;
71
52
  /**
72
53
  * Header region for the dialog panel.
@@ -1,2 +1,2 @@
1
- "use client";import{jsxs as l,jsx as o,Fragment as h}from"react/jsx-runtime";import{cva as p}from"class-variance-authority";import{createContext as b,useState as c,useContext as v}from"react";import{DialogTrigger as D,Modal as w,Dialog as N,composeRenderProps as u,ModalOverlay as C,Heading as y}from"react-aria-components";import{Button as z}from"./button.js";import{classNames as n}from"../utilities/theme.js";import{useIsMobile as f}from"../utilities/use-mobile.js";import{IcClose as M}from"./icons.js";import"./loader.js";import"clsx";import"@icons-pack/react-simple-icons";const O=p(["fixed z-50 gap-icon bg-elevation-mid transition ease-in-out","data-[entering]:duration-200 data-[entering]:animate-in data-[entering]:fade-in-0 data-[exiting]:duration-200 data-[exiting]:animate-out data-[exiting]:fade-out-0"],{variants:{side:{top:"inset-x-0 top-0 overflow-hidden border-b rounded-b-lg data-[entering]:slide-in-from-top data-[exiting]:slide-out-to-top max-h-table",bottom:"inset-x-0 bottom-0 overflow-hidden rounded-t-lg data-[entering]:slide-in-from-bottom data-[exiting]:slide-out-to-bottom max-h-[80dvh]",left:"inset-y-0 left-0 h-full w-3/4 overflow-hidden border-r rounded-r-lg data-[entering]:slide-in-from-left data-[exiting]:slide-out-to-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 overflow-hidden border-l rounded-l-lg data-[entering]:slide-in-from-right data-[exiting]:slide-out-to-right sm:max-w-sm"}}}),P=D,T=({className:e,isDismissable:t=!0,...i})=>o(C,{isDismissable:t,className:u(e,a=>n("fixed inset-0 z-50 bg-background/50","data-[exiting]:duration-100 data-[exiting]:animate-out","data-[entering]:animate-in",a)),...i});function j({className:e,children:t,side:i,role:a,closeButton:d=!0,...s}){const g=f();return i=i??(g?"bottom":void 0),o(w,{className:u(e,r=>n(i?O({side:i}):["fixed left-[50vw] top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden border rounded-lg bg-elevation-mid duration-100 data-[exiting]:duration-100 data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in-0 data-[exiting]:fade-out-0 data-[entering]:zoom-in-95 data-[exiting]:zoom-out-95 md:w-full"],r)),...s,children:o(N,{role:a,className:n(!i&&"grid h-full gap-icon relative","h-full outline-none"),children:u(t,(r,m)=>l(h,{children:[r,d&&o("div",{className:"absolute right-2 top-6 md:top-3",children:l(z,{variant:"ghost",onPress:m.close,className:"!rounded-full",children:[o(M,{className:"size-6"}),o("span",{className:"sr-only",children:"Close"})]})})]}))})})}function A({className:e,...t}){return l("div",{className:n("flex flex-col p-icon border-b rounded-t-3xl gap-y-2 text-left bg-elevation-mid",e),...t,children:[o("div",{className:"md:hidden mx-auto h-1 w-9 shrink-0 rounded-full bg-neutral-200"}),t.children]})}function G({className:e,...t}){return o("div",{className:n("flex flex-row justify-end gap-2 p-icon border-t *:flex-1 sm:*:flex-none",e),...t})}function J({className:e,...t}){return o("div",{className:n("flex flex-col gap-2 p-icon max-h-[60dvh] overflow-auto",e),...t})}function K({className:e,...t}){return o(y,{slot:"title",className:n("heading-4 font-semibold leading-none tracking-tight",e),...t})}function L({className:e,...t}){return o("p",{className:n("flex flex-col gap-y-1 text-center sm:text-left",e),...t})}const x=b(null);function Q({children:e}){const[t,i]=c(!1),[a,d]=c(null),s=m=>{d(m),i(!0)},g=()=>{i(!1)},r=f();return l(x.Provider,{value:{openDialog:s,closeDialog:g,isOpen:t},children:[e,o(P,{isOpen:t,onOpenChange:i,children:o(T,{isDismissable:!0,children:o(j,{side:r?"bottom":void 0,children:a})})})]})}function U(){const e=v(x);if(!e)throw new Error("useControlledDialog must be used within ControlledDialogProvider");return e}export{Q as ControlledDialogProvider,J as DialogBody,j as DialogContent,L as DialogDescription,G as DialogFooter,A as DialogHeader,T as DialogOverlay,K as DialogTitle,P as DialogTrigger,U as useControlledDialog};
1
+ "use client";import{jsxs as l,jsx as i,Fragment as v}from"react/jsx-runtime";import{cva as D}from"class-variance-authority";import{createContext as h,useState as x,useContext as d}from"react";import{DialogTrigger as w,Modal as y,Dialog as C,composeRenderProps as f,ModalOverlay as N,Heading as z}from"react-aria-components";import{Button as P}from"./button.js";import{classNames as n}from"../utilities/theme.js";import{useIsMobile as p}from"../utilities/use-mobile.js";import{IcClose as M}from"./icons.js";import"./loader.js";import"clsx";import"@icons-pack/react-simple-icons";const O=D(["fixed z-50 gap-icon bg-surface-secondary border-stroke-primary transition ease-in-out","data-[entering]:duration-200 data-[entering]:animate-in data-[entering]:fade-in-0 data-[exiting]:duration-200 data-[exiting]:animate-out data-[exiting]:fade-out-0"],{variants:{side:{top:"inset-x-0 top-0 overflow-hidden border-b rounded-b-lg data-[entering]:slide-in-from-top data-[exiting]:slide-out-to-top max-h-table",bottom:"inset-x-0 bottom-0 overflow-hidden rounded-t-lg data-[entering]:slide-in-from-bottom data-[exiting]:slide-out-to-bottom max-h-[80dvh]",left:"inset-y-0 left-0 h-full w-3/4 overflow-hidden border-r rounded-r-lg data-[entering]:slide-in-from-left data-[exiting]:slide-out-to-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 overflow-hidden border-l rounded-l-lg data-[entering]:slide-in-from-right data-[exiting]:slide-out-to-right sm:max-w-sm"}}}),k=w,T=({className:e,isDismissable:o=!0,...t})=>i(N,{isDismissable:o,className:f(e,a=>n("fixed inset-0 z-50 bg-background-overlay","data-[exiting]:duration-100 data-[exiting]:animate-out","data-[entering]:animate-in",a)),...t}),s=h(void 0);function j({className:e,children:o,side:t,role:a,closeButton:g=!0,...c}){const u=p();return t=t??(u?"bottom":void 0),i(s.Provider,{value:t,children:i(y,{className:f(e,r=>n(t?O({side:t}):["fixed left-[50vw] top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden border rounded-lg bg-elevation-mid duration-100 data-[exiting]:duration-100 data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in-0 data-[exiting]:fade-out-0 data-[entering]:zoom-in-95 data-[exiting]:zoom-out-95 md:w-full"],r)),...c,children:i(C,{role:a,className:n(!t&&"grid h-full gap-icon relative","h-full outline-none"),children:f(o,(r,m)=>l(v,{children:[r,g&&i("div",{className:"absolute right-2 top-6 md:top-3",children:l(P,{variant:"ghost",onPress:m.close,className:"!rounded-full",children:[i(M,{className:"size-6"}),i("span",{className:"sr-only",children:"Close"})]})})]}))})})})}function G({className:e,...o}){const t=d(s);return l("div",{className:n("flex flex-col p-icon border-b rounded-t-3xl gap-y-2 text-left",t?"bg-surface-secondary":"bg-elevation-mid",e),...o,children:[i("div",{className:"md:hidden mx-auto h-1 w-9 shrink-0 rounded-full bg-neutral-200"}),o.children]})}function J({className:e,...o}){const t=d(s);return i("div",{className:n("flex flex-row justify-end gap-2 p-icon border-t *:flex-1 sm:*:flex-none",t&&"bg-surface-secondary",e),...o})}function K({className:e,...o}){const t=d(s);return i("div",{className:n("flex flex-col gap-2 p-icon max-h-[60dvh] overflow-auto",t&&"bg-surface-secondary",e),...o})}function L({className:e,...o}){return i(z,{slot:"title",className:n("heading-4 font-semibold leading-none tracking-tight text-text-primary",e),...o})}function Q({className:e,...o}){return i("p",{className:n("flex flex-col gap-y-1 text-center sm:text-left",e),...o})}const b=h(null);function U({children:e}){const[o,t]=x(!1),[a,g]=x(null),c=m=>{g(m),t(!0)},u=()=>{t(!1)},r=p();return l(b.Provider,{value:{openDialog:c,closeDialog:u,isOpen:o},children:[e,i(k,{isOpen:o,onOpenChange:t,children:i(T,{isDismissable:!0,children:i(j,{side:r?"bottom":void 0,children:a})})})]})}function W(){const e=d(b);if(!e)throw new Error("useControlledDialog must be used within ControlledDialogProvider");return e}export{U as ControlledDialogProvider,K as DialogBody,j as DialogContent,Q as DialogDescription,J as DialogFooter,G as DialogHeader,T as DialogOverlay,L as DialogTitle,k as DialogTrigger,W as useControlledDialog};
2
2
  //# sourceMappingURL=dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sources":["../../lib/components/dialog.tsx"],"sourcesContent":["'use client';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useState } from 'react';\nimport {\n Dialog as AriaDialog,\n DialogProps as AriaDialogProps,\n DialogTrigger as AriaDialogTrigger,\n Heading as AriaHeading,\n HeadingProps as AriaHeadingProps,\n Modal as AriaModal,\n ModalOverlay as AriaModalOverlay,\n ModalOverlayProps as AriaModalOverlayProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nimport { Button } from '../components/button';\nimport { classNames } from '../utilities/theme';\nimport { useIsMobile } from '../utilities/use-mobile';\nimport { IcClose } from './icons';\n\n/**\n * Visual variants for the sheet-style dialog (slide in from an edge).\n *\n * @remarks\n * Internally used to style `<DialogContent side=\"...\">`.\n */\nconst sheetVariants = cva(\n [\n 'fixed z-50 gap-icon bg-elevation-mid transition ease-in-out',\n 'data-[entering]:duration-200 data-[entering]:animate-in data-[entering]:fade-in-0 data-[exiting]:duration-200 data-[exiting]:animate-out data-[exiting]:fade-out-0',\n ],\n {\n variants: {\n side: {\n top: 'inset-x-0 top-0 overflow-hidden border-b rounded-b-lg data-[entering]:slide-in-from-top data-[exiting]:slide-out-to-top max-h-table',\n bottom: 'inset-x-0 bottom-0 overflow-hidden rounded-t-lg data-[entering]:slide-in-from-bottom data-[exiting]:slide-out-to-bottom max-h-[80dvh]',\n left: 'inset-y-0 left-0 h-full w-3/4 overflow-hidden border-r rounded-r-lg data-[entering]:slide-in-from-left data-[exiting]:slide-out-to-left sm:max-w-sm',\n right: 'inset-y-0 right-0 h-full w-3/4 overflow-hidden border-l rounded-l-lg data-[entering]:slide-in-from-right data-[exiting]:slide-out-to-right sm:max-w-sm',\n },\n },\n }\n);\n\n/**\n * Opens the dialog when interacted with (click/press).\n *\n * @remarks\n * Compose this around any control that should open the dialog.\n *\n * @example\n * ```tsx\n * <DialogTrigger>\n * <Button>Open</Button>\n * <DialogOverlay>\n * <DialogContent>...</DialogContent>\n * </DialogOverlay>\n * </DialogTrigger>\n * ```\n */\nexport const DialogTrigger = AriaDialogTrigger;\n\nexport const DialogOverlay = ({ className, isDismissable = true, ...props }: AriaModalOverlayProps) => {\n return (\n <AriaModalOverlay\n isDismissable={isDismissable}\n className={composeRenderProps(className, className =>\n classNames(\n 'fixed inset-0 z-50 bg-background/50',\n /* Exiting */\n 'data-[exiting]:duration-100 data-[exiting]:animate-out',\n /* Entering */\n 'data-[entering]:animate-in',\n className\n )\n )}\n {...props}\n />\n );\n};\n\n/** Props for {@link DialogContent}. */\nexport interface DialogContentProps\n extends Omit<React.ComponentProps<typeof AriaModal>, 'children'>,\n VariantProps<typeof sheetVariants> {\n /**\n * Render function or nodes for the dialog panel contents.\n */\n children?: AriaDialogProps['children'];\n\n /**\n * ARIA role of the dialog.\n *\n * Use `\"alertdialog\"` for destructive/confirmation flows that require\n * explicit acknowledgement.\n * @defaultValue \"dialog\"\n */\n role?: AriaDialogProps['role'];\n\n /**\n * Show a built-in close button in the top-right corner.\n * @defaultValue true\n */\n closeButton?: boolean;\n}\n\n/**\n * Dialog panel container. Renders either a centered modal or a sheet\n * from an edge when `side` is provided.\n *\n * @example Basic\n * ```tsx\n * <DialogTrigger>\n * <Button>Open</Button>\n * <DialogOverlay>\n * <DialogContent>\n * <DialogHeader>\n * <DialogTitle>Sign up</DialogTitle>\n * </DialogHeader>\n * ...\n * </DialogContent>\n * </DialogOverlay>\n * </DialogTrigger>\n * ```\n */\nexport function DialogContent({ className, children, side, role, closeButton = true, ...props }: DialogContentProps) {\n const isMobile = useIsMobile();\n side = side ?? (isMobile ? 'bottom' : undefined);\n return (\n <AriaModal\n className={composeRenderProps(className, className =>\n classNames(\n side\n ? sheetVariants({ side })\n : [\n 'fixed left-[50vw] top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden border rounded-lg bg-elevation-mid duration-100 data-[exiting]:duration-100 data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in-0 data-[exiting]:fade-out-0 data-[entering]:zoom-in-95 data-[exiting]:zoom-out-95 md:w-full',\n ],\n className\n )\n )}\n {...props}\n >\n <AriaDialog\n role={role}\n className={classNames(!side && 'grid h-full gap-icon relative', 'h-full outline-none')}\n >\n {composeRenderProps(children, (children, renderProps) => (\n <>\n {children}\n {closeButton && (\n <div className=\"absolute right-2 top-6 md:top-3\">\n <Button variant={'ghost'} onPress={renderProps.close} className=\"!rounded-full\">\n <IcClose className=\"size-6\" />\n <span className=\"sr-only\">Close</span>\n </Button>\n </div>\n )}\n </>\n ))}\n </AriaDialog>\n </AriaModal>\n );\n}\n\n/**\n * Header region for the dialog panel.\n *\n * @example\n * ```tsx\n * <DialogHeader>\n * <DialogTitle>Settings</DialogTitle>\n * </DialogHeader>\n * ```\n */\nexport function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={classNames(\n 'flex flex-col p-icon border-b rounded-t-3xl gap-y-2 text-left bg-elevation-mid',\n className\n )}\n {...props}\n >\n <div className=\"md:hidden mx-auto h-1 w-9 shrink-0 rounded-full bg-neutral-200\" />\n {props.children}\n </div>\n );\n}\n\n/**\n * Footer region that aligns action buttons.\n *\n * @example\n * ```tsx\n * <DialogFooter>\n * <Button variant=\"outline\">Cancel</Button>\n * <Button>Save</Button>\n * </DialogFooter>\n * ```\n */\nexport function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={classNames('flex flex-row justify-end gap-2 p-icon border-t *:flex-1 sm:*:flex-none', className)}\n {...props}\n />\n );\n}\n\n/**\n * Body section of the dialog\n */\nexport function DialogBody({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div className={classNames('flex flex-col gap-2 p-icon max-h-[60dvh] overflow-auto', className)} {...props} />\n );\n}\n\n/**\n * Heading element mapped to the dialog title (announced by screen readers).\n *\n * @remarks\n * Sets `slot=\"title\"` so RAC wires it to the dialog.\n */\nexport function DialogTitle({ className, ...props }: AriaHeadingProps) {\n return (\n <AriaHeading\n slot=\"title\"\n className={classNames('heading-4 font-semibold leading-none tracking-tight', className)}\n {...props}\n />\n );\n}\n\n/**\n * Short explanatory text under the title.\n *\n * @example\n * ```tsx\n * <DialogDescription>\n * This action cannot be undone.\n * </DialogDescription>\n * ```\n */\nexport function DialogDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {\n return <p className={classNames('flex flex-col gap-y-1 text-center sm:text-left', className)} {...props} />;\n}\n\n/**\n * Context type for controlled dialog state and actions.\n */\ntype ControlledDialogContextType = {\n /** Opens the dialog with the provided content */\n openDialog: (content: ReactNode) => void;\n /** Closes the dialog */\n closeDialog: () => void;\n /** Whether the dialog is currently open */\n isOpen: boolean;\n};\n\nconst ControlledDialogContext = createContext<ControlledDialogContextType | null>(null);\n\n/**\n * Provider that manages a scoped dialog controlled via hooks.\n *\n * @example\n * ```tsx\n * <ControlledDialogProvider>\n * <MyComponent />\n * </ControlledDialogProvider>\n *\n * // Inside MyComponent:\n * function MyComponent() {\n * const { openDialog } = useControlledDialog();\n * return (\n * <Button onPress={() => openDialog(<div>Dialog content</div>)}>\n * Open Dialog\n * </Button>\n * );\n * }\n * ```\n */\nexport function ControlledDialogProvider({ children }: { children: ReactNode }) {\n const [isOpen, setIsOpen] = useState(false);\n const [content, setContent] = useState<ReactNode>(null);\n\n const openDialog = (dialogContent: ReactNode) => {\n setContent(dialogContent);\n setIsOpen(true);\n };\n\n const closeDialog = () => {\n setIsOpen(false);\n };\n const isMobile = useIsMobile();\n return (\n <ControlledDialogContext.Provider value={{ openDialog, closeDialog, isOpen }}>\n {children}\n <DialogTrigger isOpen={isOpen} onOpenChange={setIsOpen}>\n <DialogOverlay isDismissable>\n <DialogContent side={isMobile ? 'bottom' : undefined}>{content}</DialogContent>\n </DialogOverlay>\n </DialogTrigger>\n </ControlledDialogContext.Provider>\n );\n}\n\n/**\n * Hook to access the controlled dialog from within a ControlledDialogProvider.\n *\n * @throws Error if used outside of ControlledDialogProvider\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { openDialog, closeDialog, isOpen } = useControlledDialog();\n *\n * return (\n * <Button onPress={() => openDialog(\n * <DialogHeader>\n * <DialogTitle>Confirm</DialogTitle>\n * </DialogHeader>\n * )}>\n * Open\n * </Button>\n * );\n * }\n * ```\n */\nexport function useControlledDialog() {\n const context = useContext(ControlledDialogContext);\n if (!context) {\n throw new Error('useControlledDialog must be used within ControlledDialogProvider');\n }\n return context;\n}\n"],"names":["sheetVariants","cva","DialogTrigger","AriaDialogTrigger","DialogOverlay","className","isDismissable","props","jsx","AriaModalOverlay","composeRenderProps","classNames","DialogContent","children","side","role","closeButton","isMobile","useIsMobile","AriaModal","AriaDialog","renderProps","jsxs","Fragment","Button","IcClose","DialogHeader","DialogFooter","DialogBody","DialogTitle","AriaHeading","DialogDescription","ControlledDialogContext","createContext","ControlledDialogProvider","isOpen","setIsOpen","useState","content","setContent","openDialog","dialogContent","closeDialog","useControlledDialog","context","useContext"],"mappings":"kkBA2BA,MAAMA,EAAgBC,EAClB,CACI,8DACA,qKAAA,EAEJ,CACI,SAAU,CACN,KAAM,CACF,IAAK,sIACL,OAAQ,wIACR,K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,MAAMC,EAAUC,EAAWb,CAAuB,EAClD,GAAI,CAACY,EACD,MAAM,IAAI,MAAM,kEAAkE,EAEtF,OAAOA,CACX"}
1
+ {"version":3,"file":"dialog.js","sources":["../../lib/components/dialog.tsx"],"sourcesContent":["'use client';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useState } from 'react';\nimport {\n Dialog as AriaDialog,\n DialogProps as AriaDialogProps,\n DialogTrigger as AriaDialogTrigger,\n Heading as AriaHeading,\n HeadingProps as AriaHeadingProps,\n Modal as AriaModal,\n ModalOverlay as AriaModalOverlay,\n ModalOverlayProps as AriaModalOverlayProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nimport { Button } from '../components/button';\nimport { classNames } from '../utilities/theme';\nimport { useIsMobile } from '../utilities/use-mobile';\nimport { IcClose } from './icons';\n\n/**\n * Visual variants for the sheet-style dialog (slide in from an edge).\n *\n * @remarks\n * Internally used to style `<DialogContent side=\"...\">`.\n */\nconst sheetVariants = cva(\n [\n 'fixed z-50 gap-icon bg-surface-secondary border-stroke-primary transition ease-in-out',\n 'data-[entering]:duration-200 data-[entering]:animate-in data-[entering]:fade-in-0 data-[exiting]:duration-200 data-[exiting]:animate-out data-[exiting]:fade-out-0',\n ],\n {\n variants: {\n side: {\n top: 'inset-x-0 top-0 overflow-hidden border-b rounded-b-lg data-[entering]:slide-in-from-top data-[exiting]:slide-out-to-top max-h-table',\n bottom: 'inset-x-0 bottom-0 overflow-hidden rounded-t-lg data-[entering]:slide-in-from-bottom data-[exiting]:slide-out-to-bottom max-h-[80dvh]',\n left: 'inset-y-0 left-0 h-full w-3/4 overflow-hidden border-r rounded-r-lg data-[entering]:slide-in-from-left data-[exiting]:slide-out-to-left sm:max-w-sm',\n right: 'inset-y-0 right-0 h-full w-3/4 overflow-hidden border-l rounded-l-lg data-[entering]:slide-in-from-right data-[exiting]:slide-out-to-right sm:max-w-sm',\n },\n },\n }\n);\n\n/**\n * Opens the dialog when interacted with (click/press).\n *\n * @remarks\n * Compose this around any control that should open the dialog.\n *\n * @example\n * ```tsx\n * <DialogTrigger>\n * <Button>Open</Button>\n * <DialogOverlay>\n * <DialogContent>...</DialogContent>\n * </DialogOverlay>\n * </DialogTrigger>\n * ```\n */\nexport const DialogTrigger = AriaDialogTrigger;\n\nexport const DialogOverlay = ({ className, isDismissable = true, ...props }: AriaModalOverlayProps) => {\n return (\n <AriaModalOverlay\n isDismissable={isDismissable}\n className={composeRenderProps(className, className =>\n classNames(\n 'fixed inset-0 z-50 bg-background-overlay',\n /* Exiting */\n 'data-[exiting]:duration-100 data-[exiting]:animate-out',\n /* Entering */\n 'data-[entering]:animate-in',\n className\n )\n )}\n {...props}\n />\n );\n};\n\n/** Props for {@link DialogContent}. */\nexport interface DialogContentProps\n extends Omit<React.ComponentProps<typeof AriaModal>, 'children'>,\n VariantProps<typeof sheetVariants> {\n /**\n * Render function or nodes for the dialog panel contents.\n */\n children?: AriaDialogProps['children'];\n\n /**\n * ARIA role of the dialog.\n *\n * Use `\"alertdialog\"` for destructive/confirmation flows that require\n * explicit acknowledgement.\n * @defaultValue \"dialog\"\n */\n role?: AriaDialogProps['role'];\n\n /**\n * Show a built-in close button in the top-right corner.\n * @defaultValue true\n */\n closeButton?: boolean;\n}\n\n/**\n * Dialog panel container. Renders either a centered modal or a sheet\n * from an edge when `side` is provided.\n *\n * @example Basic\n * ```tsx\n * <DialogTrigger>\n * <Button>Open</Button>\n * <DialogOverlay>\n * <DialogContent>\n * <DialogHeader>\n * <DialogTitle>Sign up</DialogTitle>\n * </DialogHeader>\n * ...\n * </DialogContent>\n * </DialogOverlay>\n * </DialogTrigger>\n * ```\n */\nconst DialogSideContext = createContext<DialogContentProps['side']>(undefined);\n\nexport function DialogContent({ className, children, side, role, closeButton = true, ...props }: DialogContentProps) {\n const isMobile = useIsMobile();\n side = side ?? (isMobile ? 'bottom' : undefined);\n return (\n <DialogSideContext.Provider value={side}>\n <AriaModal\n className={composeRenderProps(className, className =>\n classNames(\n side\n ? sheetVariants({ side })\n : [\n 'fixed left-[50vw] top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden border rounded-lg bg-elevation-mid duration-100 data-[exiting]:duration-100 data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in-0 data-[exiting]:fade-out-0 data-[entering]:zoom-in-95 data-[exiting]:zoom-out-95 md:w-full',\n ],\n className\n )\n )}\n {...props}\n >\n <AriaDialog\n role={role}\n className={classNames(!side && 'grid h-full gap-icon relative', 'h-full outline-none')}\n >\n {composeRenderProps(children, (children, renderProps) => (\n <>\n {children}\n {closeButton && (\n <div className=\"absolute right-2 top-6 md:top-3\">\n <Button variant={'ghost'} onPress={renderProps.close} className=\"!rounded-full\">\n <IcClose className=\"size-6\" />\n <span className=\"sr-only\">Close</span>\n </Button>\n </div>\n )}\n </>\n ))}\n </AriaDialog>\n </AriaModal>\n </DialogSideContext.Provider>\n );\n}\n\n/**\n * Header region for the dialog panel.\n *\n * @example\n * ```tsx\n * <DialogHeader>\n * <DialogTitle>Settings</DialogTitle>\n * </DialogHeader>\n * ```\n */\nexport function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n const side = useContext(DialogSideContext);\n return (\n <div\n className={classNames(\n 'flex flex-col p-icon border-b rounded-t-3xl gap-y-2 text-left',\n side ? 'bg-surface-secondary' : 'bg-elevation-mid',\n className\n )}\n {...props}\n >\n <div className=\"md:hidden mx-auto h-1 w-9 shrink-0 rounded-full bg-neutral-200\" />\n {props.children}\n </div>\n );\n}\n\n/**\n * Footer region that aligns action buttons.\n *\n * @example\n * ```tsx\n * <DialogFooter>\n * <Button variant=\"outline\">Cancel</Button>\n * <Button>Save</Button>\n * </DialogFooter>\n * ```\n */\nexport function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n const side = useContext(DialogSideContext);\n return (\n <div\n className={classNames(\n 'flex flex-row justify-end gap-2 p-icon border-t *:flex-1 sm:*:flex-none',\n side && 'bg-surface-secondary',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Body section of the dialog\n */\nexport function DialogBody({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n const side = useContext(DialogSideContext);\n return (\n <div\n className={classNames(\n 'flex flex-col gap-2 p-icon max-h-[60dvh] overflow-auto',\n side && 'bg-surface-secondary',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Heading element mapped to the dialog title (announced by screen readers).\n *\n * @remarks\n * Sets `slot=\"title\"` so RAC wires it to the dialog.\n */\nexport function DialogTitle({ className, ...props }: AriaHeadingProps) {\n return (\n <AriaHeading\n slot=\"title\"\n className={classNames('heading-4 font-semibold leading-none tracking-tight text-text-primary', className)}\n {...props}\n />\n );\n}\n\n/**\n * Short explanatory text under the title.\n *\n * @example\n * ```tsx\n * <DialogDescription>\n * This action cannot be undone.\n * </DialogDescription>\n * ```\n */\nexport function DialogDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {\n return <p className={classNames('flex flex-col gap-y-1 text-center sm:text-left', className)} {...props} />;\n}\n\n/**\n * Context type for controlled dialog state and actions.\n */\ntype ControlledDialogContextType = {\n /** Opens the dialog with the provided content */\n openDialog: (content: ReactNode) => void;\n /** Closes the dialog */\n closeDialog: () => void;\n /** Whether the dialog is currently open */\n isOpen: boolean;\n};\n\nconst ControlledDialogContext = createContext<ControlledDialogContextType | null>(null);\n\n/**\n * Provider that manages a scoped dialog controlled via hooks.\n *\n * @example\n * ```tsx\n * <ControlledDialogProvider>\n * <MyComponent />\n * </ControlledDialogProvider>\n *\n * // Inside MyComponent:\n * function MyComponent() {\n * const { openDialog } = useControlledDialog();\n * return (\n * <Button onPress={() => openDialog(<div>Dialog content</div>)}>\n * Open Dialog\n * </Button>\n * );\n * }\n * ```\n */\nexport function ControlledDialogProvider({ children }: { children: ReactNode }) {\n const [isOpen, setIsOpen] = useState(false);\n const [content, setContent] = useState<ReactNode>(null);\n\n const openDialog = (dialogContent: ReactNode) => {\n setContent(dialogContent);\n setIsOpen(true);\n };\n\n const closeDialog = () => {\n setIsOpen(false);\n };\n const isMobile = useIsMobile();\n return (\n <ControlledDialogContext.Provider value={{ openDialog, closeDialog, isOpen }}>\n {children}\n <DialogTrigger isOpen={isOpen} onOpenChange={setIsOpen}>\n <DialogOverlay isDismissable>\n <DialogContent side={isMobile ? 'bottom' : undefined}>{content}</DialogContent>\n </DialogOverlay>\n </DialogTrigger>\n </ControlledDialogContext.Provider>\n );\n}\n\n/**\n * Hook to access the controlled dialog from within a ControlledDialogProvider.\n *\n * @throws Error if used outside of ControlledDialogProvider\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { openDialog, closeDialog, isOpen } = useControlledDialog();\n *\n * return (\n * <Button onPress={() => openDialog(\n * <DialogHeader>\n * <DialogTitle>Confirm</DialogTitle>\n * </DialogHeader>\n * )}>\n * Open\n * </Button>\n * );\n * }\n * ```\n */\nexport function useControlledDialog() {\n const context = useContext(ControlledDialogContext);\n if (!context) {\n throw new Error('useControlledDialog must be used within ControlledDialogProvider');\n }\n return context;\n}\n"],"names":["sheetVariants","cva","DialogTrigger","AriaDialogTrigger","DialogOverlay","className","isDismissable","props","jsx","AriaModalOverlay","composeRenderProps","classNames","DialogSideContext","createContext","DialogContent","children","side","role","closeButton","isMobile","useIsMobile","AriaModal","AriaDialog","renderProps","jsxs","Fragment","Button","IcClose","DialogHeader","useContext","DialogFooter","DialogBody","DialogTitle","AriaHeading","DialogDescription","ControlledDialogContext","ControlledDialogProvider","isOpen","setIsOpen","useState","content","setContent","openDialog","dialogContent","closeDialog","useControlledDialog","context"],"mappings":"kkBA2BA,MAAMA,EAAgBC,EAClB,CACI,wFACA,qKAAA,EAEJ,CACI,SAAU,CACN,KAAM,CACF,IAAK,sIACL,OAAQ,wIACR,KAAM,sJACN,MAAO,wJAAA,CACX,CACJ,CAER,EAkBaC,EAAgBC,EAEhBC,EAAgB,CAAC,CAAE,UAAAC,EAAW,cAAAC,EAAg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AA,CAAc,cAAa,GACxB,SAAAI,EAACM,GAAc,KAAMK,EAAW,SAAW,OAAY,SAAAqB,EAAQ,EACnE,CAAA,CACJ,CAAA,EACJ,CAER,CAwBO,SAASK,GAAsB,CAClC,MAAMC,EAAUjB,EAAWM,CAAuB,EAClD,GAAI,CAACW,EACD,MAAM,IAAI,MAAM,kEAAkE,EAEtF,OAAOA,CACX"}
@@ -1,2 +1,2 @@
1
- "use client";import{jsxs as a,Fragment as c,jsx as r}from"react/jsx-runtime";import{cva as s}from"class-variance-authority";import{Label as u,Text as f,Group as p,composeRenderProps as m,Button as g}from"react-aria-components";import{classNames as n}from"../utilities/theme.js";import{Card as b,CardHeader as x,CardTitle as h}from"./card.js";import{IcInfo as v,IcError as F}from"./icons.js";import"clsx";import"@icons-pack/react-simple-icons";import"react";const N=s(["select-none body-sm font-medium leading-none","disabled-muted","group-data-[invalid]:text-destructive"]);function y({className:t,...e}){return r(u,{className:n(N(),t),...e})}function k({className:t,children:e,...i}){return a(f,{className:n("body-sm text-muted leading-tight",t),...i,slot:"description",children:[e,r(v,{className:"inline size-2 align-text-top ms-0.5"})]})}function w({className:t,children:e,...i}){return a("label",{role:"alert",className:n("body-sm leading-tight text-destructive duration-150 animate-in transition-transform slide-in-from-top-5 fade-in",t),...i,children:[e,r(F,{className:"inline size-2 align-text-top ms-0.5"})]})}const j=s("",{variants:{variant:{default:["relative flex w-full items-center overflow-hidden border border-input bg-elevation-1 input-dim ring-offset-background placeholder:text-muted-foreground","focus-ring","disabled-muted"],ghost:""}},defaultVariants:{variant:"default"}});function B({className:t,variant:e,...i}){return r(p,{className:m(t,o=>n(j({variant:e}),o)),...i})}function D({label:t,description:e,errorMessage:i,children:o,requiredIndicator:d,htmlFor:l}){return a(c,{children:[t&&a(y,{htmlFor:l,children:[t,d&&r("sup",{className:"text-destructive",children:"*"})]}),o,e&&r(k,{children:e}),i&&r(w,{htmlFor:l,children:i})]})}function A({className:t,...e}){return r(g,{className:m(t,i=>n("btn btn-ghost h-input px-2 -me-2",i)),...e})}function H({className:t,onSubmit:e,...i}){return r("form",{className:n(t),onSubmit:o=>{o.preventDefault(),document?.activeElement?.blur(),e?.(o)},...i})}function P({className:t,...e}){return r(b,{className:n("gap-input bg-elevation-mid",t),...e})}function R({className:t,...e}){return r(x,{children:r(h,{className:n(t,"!body-base text-muted"),...e})})}function q({className:t,...e}){return r("nav",{className:n("flex items-center justify-end bg-elevation-mid sticky bottom-0 z-50 py-icon px-icon border-t",t),...e})}function J({className:t,preview:e,...i}){return a("div",{className:"flex flex-col gap-icon lg:flex-row lg:items-start",children:[r("div",{className:n("grid grid-cols-1 gap-input mt-icon my-header w-full max-w-3xl",t),...i}),e&&r("div",{className:"lg:sticky lg:top-header lg:shrink-0",children:e})]})}export{B as FieldGroup,H as Form,q as FormActionFooter,D as FormField,A as FormFieldButton,k as FormFieldDescription,w as FormFieldError,y as FormFieldLabel,J as FormLayout,P as FormSection,R as FormSectionTitle,j as fieldGroupVariants,N as labelVariants};
1
+ "use client";import{jsxs as a,Fragment as c,jsx as r}from"react/jsx-runtime";import{cva as s}from"class-variance-authority";import{Label as u,Text as f,Group as p,composeRenderProps as m,Button as g}from"react-aria-components";import{classNames as n}from"../utilities/theme.js";import{Card as b,CardHeader as x,CardTitle as v}from"./card.js";import{IcInfo as h,IcError as F}from"./icons.js";import"clsx";import"@icons-pack/react-simple-icons";import"react";const N=s(["select-none body-sm font-medium leading-none","disabled-muted","group-data-[invalid]:text-destructive"]);function y({className:t,...e}){return r(u,{className:n(N(),t),...e})}function k({className:t,children:e,...i}){return a(f,{className:n("body-sm text-muted leading-tight",t),...i,slot:"description",children:[e,r(h,{className:"inline size-2 align-text-top ms-0.5"})]})}function w({className:t,children:e,...i}){return a("label",{role:"alert",className:n("body-sm leading-tight text-destructive duration-150 animate-in transition-transform slide-in-from-top-5 fade-in",t),...i,children:[e,r(F,{className:"inline size-2 align-text-top ms-0.5"})]})}const j=s("",{variants:{variant:{default:["relative flex w-full items-center overflow-hidden border border-input bg-elevation-1 input-dim ring-offset-background placeholder:text-muted-foreground","focus-ring focus-visible:border-stroke-active","disabled-muted"],ghost:""}},defaultVariants:{variant:"default"}});function B({className:t,variant:e,...i}){return r(p,{className:m(t,o=>n(j({variant:e}),o)),...i})}function D({label:t,description:e,errorMessage:i,children:o,requiredIndicator:d,htmlFor:l}){return a(c,{children:[t&&a(y,{htmlFor:l,children:[t,d&&r("sup",{className:"text-destructive",children:"*"})]}),o,e&&r(k,{children:e}),i&&r(w,{htmlFor:l,children:i})]})}function A({className:t,...e}){return r(g,{className:m(t,i=>n("btn btn-ghost h-input px-2 -me-2",i)),...e})}function H({className:t,onSubmit:e,...i}){return r("form",{className:n(t),onSubmit:o=>{o.preventDefault(),document?.activeElement?.blur(),e?.(o)},...i})}function P({className:t,...e}){return r(b,{className:n("gap-input bg-elevation-mid",t),...e})}function R({className:t,...e}){return r(x,{children:r(v,{className:n(t,"!body-base text-muted"),...e})})}function q({className:t,...e}){return r("nav",{className:n("flex items-center justify-end bg-elevation-mid sticky bottom-0 z-50 py-icon px-icon border-t",t),...e})}function J({className:t,preview:e,...i}){return a("div",{className:"flex flex-col gap-icon lg:flex-row lg:items-start",children:[r("div",{className:n("grid grid-cols-1 gap-input mt-icon my-header w-full max-w-3xl",t),...i}),e&&r("div",{className:"lg:sticky lg:top-header lg:shrink-0",children:e})]})}export{B as FieldGroup,H as Form,q as FormActionFooter,D as FormField,A as FormFieldButton,k as FormFieldDescription,w as FormFieldError,y as FormFieldLabel,J as FormLayout,P as FormSection,R as FormSectionTitle,j as fieldGroupVariants,N as labelVariants};
2
2
  //# sourceMappingURL=form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sources":["../../lib/components/form.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Button as AriaButton,\n ButtonProps as AriaButtonProps,\n Group as AriaGroup,\n GroupProps as AriaGroupProps,\n Label as AriaLabel,\n LabelProps as AriaLabelProps,\n Text as AriaText,\n TextProps as AriaTextProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nimport { classNames } from '../utilities/theme';\nimport { Card, CardHeader, CardTitle } from './card';\nimport { IcError, IcInfo } from './icons';\n\n/**\n * Class variance authority variants for form field labels.\n * Provides styling for different states including disabled and invalid.\n */\nexport const labelVariants = cva([\n 'select-none body-sm font-medium leading-none',\n /* Disabled */\n 'disabled-muted',\n /* Invalid */\n 'group-data-[invalid]:text-destructive',\n]);\n\n/**\n * A form field label component that extends React Aria's Label component.\n * Applies consistent styling for form labels including disabled and invalid states.\n *\n * @param className - Optional additional CSS classes to apply\n * @param props - All other props from AriaLabelProps\n * @returns A styled label element\n */\nexport function FormFieldLabel({ className, ...props }: AriaLabelProps) {\n return <AriaLabel className={classNames(labelVariants(), className)} {...props} />;\n}\n\n/**\n * A form field description component that provides additional context or help text.\n * Automatically includes an info icon and uses the \"description\" slot for accessibility.\n */\nexport function FormFieldDescription({ className, children, ...props }: AriaTextProps) {\n return (\n <AriaText className={classNames('body-sm text-muted leading-tight', className)} {...props} slot=\"description\">\n {children}\n <IcInfo className=\"inline size-2 align-text-top ms-0.5\" />\n </AriaText>\n );\n}\n/**\n * A form field error component that displays validation error messages.\n *\n * @remarks\n * Currently uses a div instead of AriaFieldError to avoid overlap with Tanstack Form.\n * This approach needs further discussion and exploration.\n *\n */\nexport function FormFieldError({ className, children, ...props }: React.ComponentPropsWithRef<'label'>) {\n return (\n <label\n role=\"alert\"\n className={classNames(\n 'body-sm leading-tight text-destructive duration-150 animate-in transition-transform slide-in-from-top-5 fade-in',\n className\n )}\n {...props}\n >\n {children}\n <IcError className=\"inline size-2 align-text-top ms-0.5\" />\n </label>\n );\n}\n\n/**\n * Class variance authority variants for field groups.\n * Provides styling variants for different types of form field containers.\n */\nexport const fieldGroupVariants = cva('', {\n variants: {\n variant: {\n default: [\n 'relative flex w-full items-center overflow-hidden border border-input bg-elevation-1 input-dim ring-offset-background placeholder:text-muted-foreground',\n /* Focus Within */\n 'focus-ring',\n /* Disabled */\n 'disabled-muted',\n ],\n ghost: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\n/**\n * Props interface for FieldGroup component.\n * Extends AriaGroupProps with variant styling options.\n */\nexport interface GroupProps extends AriaGroupProps, VariantProps<typeof fieldGroupVariants> {}\n\n/**\n * A field group component that wraps form inputs with consistent styling.\n * Supports different variants for various use cases.\n */\nexport function FieldGroup({ className, variant, ...props }: GroupProps) {\n return (\n <AriaGroup\n className={composeRenderProps(className, className =>\n classNames(fieldGroupVariants({ variant }), className)\n )}\n {...props}\n />\n );\n}\n\n/**\n * Props for the FormField component.\n * Defines the structure for form field configuration.\n */\nexport type FormFieldProps = {\n /** Optional label text for the form field */\n label?: React.ReactNode;\n /** Optional description or help text */\n description?: React.ReactNode;\n /** Optional error message to display */\n errorMessage?: string;\n /** Show required indicator on field label */\n requiredIndicator?: boolean;\n /** Not defining the htmlFor on labels will lead to accessibilty warnings */\n htmlFor?: string;\n};\n\n/**\n * A wrapper component for form fields that provides consistent layout and styling.\n * Automatically renders label, children, description, and error message in the correct order.\n * @returns A complete form field with all associated elements\n */\nexport function FormField({\n label,\n description,\n errorMessage,\n children,\n requiredIndicator,\n htmlFor,\n}: FormFieldProps & {\n children: React.ReactNode;\n}) {\n return (\n <>\n {label && (\n <FormFieldLabel htmlFor={htmlFor}>\n {label}\n {requiredIndicator && <sup className=\"text-destructive\">*</sup>}\n </FormFieldLabel>\n )}\n {children}\n {description && <FormFieldDescription>{description}</FormFieldDescription>}\n {errorMessage && <FormFieldError htmlFor={htmlFor}>{errorMessage}</FormFieldError>}\n </>\n );\n}\n\n/**\n * A button component designed to be used within form fields.\n * Styled to fit nicely alongside form inputs with ghost styling.\n */\nexport function FormFieldButton({ className, ...props }: AriaButtonProps) {\n return (\n <AriaButton\n className={composeRenderProps(className, className =>\n classNames('btn btn-ghost h-input px-2 -me-2', className)\n )}\n {...props}\n />\n );\n}\n\n/**\n * A form component that prevents default form submission and handles submit events.\n * All forms in this application are controlled components, not pure HTML forms.\n */\nexport function Form({ className, onSubmit, ...props }: React.ComponentProps<'form'>) {\n return (\n <form\n className={classNames(className)}\n onSubmit={e => {\n // None of the forms in our applications are pure HTML forms.\n e.preventDefault();\n\n // Blur the active input field.\n (document?.activeElement as HTMLElement)?.blur();\n\n // If onSubmit is provided, call it.\n onSubmit?.(e);\n }}\n {...props}\n />\n );\n}\n\n/**\n * A section component for organizing form content into logical groups.\n * Provides consistent spacing and visual separation between form sections.\n */\nexport function FormSection({ className, ...props }: React.ComponentProps<'div'>) {\n return <Card className={classNames('gap-input bg-elevation-mid', className)} {...props} />;\n}\n\n/**\n * A title component for form sections.\n */\nexport function FormSectionTitle({ className, ...props }: React.ComponentProps<'h2'>) {\n return (\n <CardHeader>\n <CardTitle className={classNames(className, '!body-base text-muted')} {...props} />\n </CardHeader>\n );\n}\n\nexport function FormActionFooter({ className, ...props }: React.ComponentProps<'nav'>) {\n return (\n <nav\n className={classNames(\n 'flex items-center justify-end bg-elevation-mid sticky bottom-0 z-50 py-icon px-icon border-t',\n className\n )}\n {...props}\n />\n );\n}\n\nexport function FormLayout({\n className,\n preview,\n ...props\n}: React.ComponentProps<'div'> & { preview?: React.ReactNode }) {\n return (\n <div className=\"flex flex-col gap-icon lg:flex-row lg:items-start\">\n <div\n className={classNames('grid grid-cols-1 gap-input mt-icon my-header w-full max-w-3xl', className)}\n {...props}\n />\n {preview && <div className=\"lg:sticky lg:top-header lg:shrink-0\">{preview}</div>}\n </div>\n );\n}\n"],"names":["labelVariants","cva","FormFieldLabel","className","props","jsx","AriaLabel","classNames","FormFieldDescription","children","jsxs","AriaText","IcInfo","FormFieldError","IcError","fieldGroupVariants","FieldGroup","variant","AriaGroup","composeRenderProps","FormField","label","description","errorMessage","requiredIndicator","htmlFor","Fragment","FormFieldButton","AriaButton","Form","onSubmit","e","FormSection","Card","FormSectionTitle","CardHeader","CardTitle","FormActionFooter","FormLayout","preview"],"mappings":"ycAuBO,MAAM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,oDACX,SAAA,CAAAL,EAAC,MAAA,CACG,UAAWE,EAAW,gEAAiEJ,CAAS,EAC/F,GAAGC,CAAA,CAAA,EAEPmC,GAAWlC,EAAC,MAAA,CAAI,UAAU,sCAAuC,SAAAkC,CAAA,CAAQ,CAAA,EAC9E,CAER"}
1
+ {"version":3,"file":"form.js","sources":["../../lib/components/form.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Button as AriaButton,\n ButtonProps as AriaButtonProps,\n Group as AriaGroup,\n GroupProps as AriaGroupProps,\n Label as AriaLabel,\n LabelProps as AriaLabelProps,\n Text as AriaText,\n TextProps as AriaTextProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nimport { classNames } from '../utilities/theme';\nimport { Card, CardHeader, CardTitle } from './card';\nimport { IcError, IcInfo } from './icons';\n\n/**\n * Class variance authority variants for form field labels.\n * Provides styling for different states including disabled and invalid.\n */\nexport const labelVariants = cva([\n 'select-none body-sm font-medium leading-none',\n /* Disabled */\n 'disabled-muted',\n /* Invalid */\n 'group-data-[invalid]:text-destructive',\n]);\n\n/**\n * A form field label component that extends React Aria's Label component.\n * Applies consistent styling for form labels including disabled and invalid states.\n *\n * @param className - Optional additional CSS classes to apply\n * @param props - All other props from AriaLabelProps\n * @returns A styled label element\n */\nexport function FormFieldLabel({ className, ...props }: AriaLabelProps) {\n return <AriaLabel className={classNames(labelVariants(), className)} {...props} />;\n}\n\n/**\n * A form field description component that provides additional context or help text.\n * Automatically includes an info icon and uses the \"description\" slot for accessibility.\n */\nexport function FormFieldDescription({ className, children, ...props }: AriaTextProps) {\n return (\n <AriaText className={classNames('body-sm text-muted leading-tight', className)} {...props} slot=\"description\">\n {children}\n <IcInfo className=\"inline size-2 align-text-top ms-0.5\" />\n </AriaText>\n );\n}\n/**\n * A form field error component that displays validation error messages.\n *\n * @remarks\n * Currently uses a div instead of AriaFieldError to avoid overlap with Tanstack Form.\n * This approach needs further discussion and exploration.\n *\n */\nexport function FormFieldError({ className, children, ...props }: React.ComponentPropsWithRef<'label'>) {\n return (\n <label\n role=\"alert\"\n className={classNames(\n 'body-sm leading-tight text-destructive duration-150 animate-in transition-transform slide-in-from-top-5 fade-in',\n className\n )}\n {...props}\n >\n {children}\n <IcError className=\"inline size-2 align-text-top ms-0.5\" />\n </label>\n );\n}\n\n/**\n * Class variance authority variants for field groups.\n * Provides styling variants for different types of form field containers.\n */\nexport const fieldGroupVariants = cva('', {\n variants: {\n variant: {\n default: [\n 'relative flex w-full items-center overflow-hidden border border-input bg-elevation-1 input-dim ring-offset-background placeholder:text-muted-foreground',\n /* Focus Within */\n 'focus-ring focus-visible:border-stroke-active',\n /* Disabled */\n 'disabled-muted',\n ],\n ghost: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\n/**\n * Props interface for FieldGroup component.\n * Extends AriaGroupProps with variant styling options.\n */\nexport interface GroupProps extends AriaGroupProps, VariantProps<typeof fieldGroupVariants> {}\n\n/**\n * A field group component that wraps form inputs with consistent styling.\n * Supports different variants for various use cases.\n */\nexport function FieldGroup({ className, variant, ...props }: GroupProps) {\n return (\n <AriaGroup\n className={composeRenderProps(className, className =>\n classNames(fieldGroupVariants({ variant }), className)\n )}\n {...props}\n />\n );\n}\n\n/**\n * Props for the FormField component.\n * Defines the structure for form field configuration.\n */\nexport type FormFieldProps = {\n /** Optional label text for the form field */\n label?: React.ReactNode;\n /** Optional description or help text */\n description?: React.ReactNode;\n /** Optional error message to display */\n errorMessage?: string;\n /** Show required indicator on field label */\n requiredIndicator?: boolean;\n /** Not defining the htmlFor on labels will lead to accessibilty warnings */\n htmlFor?: string;\n};\n\n/**\n * A wrapper component for form fields that provides consistent layout and styling.\n * Automatically renders label, children, description, and error message in the correct order.\n * @returns A complete form field with all associated elements\n */\nexport function FormField({\n label,\n description,\n errorMessage,\n children,\n requiredIndicator,\n htmlFor,\n}: FormFieldProps & {\n children: React.ReactNode;\n}) {\n return (\n <>\n {label && (\n <FormFieldLabel htmlFor={htmlFor}>\n {label}\n {requiredIndicator && <sup className=\"text-destructive\">*</sup>}\n </FormFieldLabel>\n )}\n {children}\n {description && <FormFieldDescription>{description}</FormFieldDescription>}\n {errorMessage && <FormFieldError htmlFor={htmlFor}>{errorMessage}</FormFieldError>}\n </>\n );\n}\n\n/**\n * A button component designed to be used within form fields.\n * Styled to fit nicely alongside form inputs with ghost styling.\n */\nexport function FormFieldButton({ className, ...props }: AriaButtonProps) {\n return (\n <AriaButton\n className={composeRenderProps(className, className =>\n classNames('btn btn-ghost h-input px-2 -me-2', className)\n )}\n {...props}\n />\n );\n}\n\n/**\n * A form component that prevents default form submission and handles submit events.\n * All forms in this application are controlled components, not pure HTML forms.\n */\nexport function Form({ className, onSubmit, ...props }: React.ComponentProps<'form'>) {\n return (\n <form\n className={classNames(className)}\n onSubmit={e => {\n // None of the forms in our applications are pure HTML forms.\n e.preventDefault();\n\n // Blur the active input field.\n (document?.activeElement as HTMLElement)?.blur();\n\n // If onSubmit is provided, call it.\n onSubmit?.(e);\n }}\n {...props}\n />\n );\n}\n\n/**\n * A section component for organizing form content into logical groups.\n * Provides consistent spacing and visual separation between form sections.\n */\nexport function FormSection({ className, ...props }: React.ComponentProps<'div'>) {\n return <Card className={classNames('gap-input bg-elevation-mid', className)} {...props} />;\n}\n\n/**\n * A title component for form sections.\n */\nexport function FormSectionTitle({ className, ...props }: React.ComponentProps<'h2'>) {\n return (\n <CardHeader>\n <CardTitle className={classNames(className, '!body-base text-muted')} {...props} />\n </CardHeader>\n );\n}\n\nexport function FormActionFooter({ className, ...props }: React.ComponentProps<'nav'>) {\n return (\n <nav\n className={classNames(\n 'flex items-center justify-end bg-elevation-mid sticky bottom-0 z-50 py-icon px-icon border-t',\n className\n )}\n {...props}\n />\n );\n}\n\nexport function FormLayout({\n className,\n preview,\n ...props\n}: React.ComponentProps<'div'> & { preview?: React.ReactNode }) {\n return (\n <div className=\"flex flex-col gap-icon lg:flex-row lg:items-start\">\n <div\n className={classNames('grid grid-cols-1 gap-input mt-icon my-header w-full max-w-3xl', className)}\n {...props}\n />\n {preview && <div className=\"lg:sticky lg:top-header lg:shrink-0\">{preview}</div>}\n </div>\n );\n}\n"],"names":["labelVariants","cva","FormFieldLabel","className","props","jsx","AriaLabel","classNames","FormFieldDescription","children","jsxs","AriaText","IcInfo","FormFieldError","IcError","fieldGroupVariants","FieldGroup","variant","AriaGroup","composeRenderProps","FormField","label","description","errorMessage","requiredIndicator","htmlFor","Fragment","FormFieldButton","AriaButton","Form","onSubmit","e","FormSection","Card","FormSectionTitle","CardHeader","CardTitle","FormActionFooter","FormLayout","preview"],"mappings":"ycAuBO,MAAMA,EAAgBC,EAAI,CAC7B,+CAEA,iBAEA,uCACJ,CAAC,EAUM,SAASC,EAAe,CAAE,UAAAC,EAAW,GAAGC,GAAyB,CACpE,OAAOC,EAACC,GAAU,UAAWC,EAAWP,IAAiBG,CAAS,EAAI,GAAGC,EAAO,CACpF,CAMO,SAASI,EAAqB,CAAE,UAAAL,EAAW,SAAAM,EAAU,GAAGL,GAAwB,CACnF,OACIM,EAACC,EAAA,CAAS,UAAWJ,EAAW,mCAAoCJ,CAAS,EAAI,GAAGC,EAAO,KAAK,cAC3F,SAAA,CAAAK,EACDJ,EAACO,EAAA,CAAO,UAAU,qCAAA,CAAsC,CAAA,EAC5D,CAER,CASO,SAASC,EAAe,CAAE,UAAAV,EAAW,SAAAM,EAAU,GAAGL,GAA+C,CACpG,OACIM,EAAC,QAAA,CACG,KAAK,QACL,UAAWH,EACP,mHACAJ,CAAA,EAEH,GAAGC,EAEH,SAAA,CAAAK,EACDJ,EAACS,EAAA,CAAQ,UAAU,qCAAA,CAAsC,CAAA,CAAA,CAAA,CAGrE,CAMO,MAAMC,EAAqBd,EAAI,GAAI,CACtC,SAAU,CACN,QAAS,CACL,QAAS,CACL,0JAEA,gDAEA,gBAAA,EAEJ,MAAO,EAAA,CACX,EAEJ,gBAAiB,CACb,QAAS,SAAA,CAEjB,CAAC,EAYM,SAASe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AAW,GAAGC,GAAqC,CAClF,OACIC,EAAC8B,EAAA,CACG,SAAA9B,EAAC+B,EAAA,CAAU,UAAW7B,EAAWJ,EAAW,uBAAuB,EAAI,GAAGC,CAAA,CAAO,CAAA,CACrF,CAER,CAEO,SAASiC,EAAiB,CAAE,UAAAlC,EAAW,GAAGC,GAAsC,CACnF,OACIC,EAAC,MAAA,CACG,UAAWE,EACP,+FACAJ,CAAA,EAEH,GAAGC,CAAA,CAAA,CAGhB,CAEO,SAASkC,EAAW,CACvB,UAAAnC,EACA,QAAAoC,EACA,GAAGnC,CACP,EAAgE,CAC5D,OACIM,EAAC,MAAA,CAAI,UAAU,oDACX,SAAA,CAAAL,EAAC,MAAA,CACG,UAAWE,EAAW,gEAAiEJ,CAAS,EAC/F,GAAGC,CAAA,CAAA,EAEPmC,GAAWlC,EAAC,MAAA,CAAI,UAAU,sCAAuC,SAAAkC,CAAA,CAAQ,CAAA,EAC9E,CAER"}
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as a,jsxs as h}from"react/jsx-runtime";import{createContext as _,useState as w,useCallback as S,useEffect as j,useMemo as D,use as B}from"react";import{Button as N}from"./button.js";import{DialogTrigger as I,DialogOverlay as T,DialogContent as z}from"./dialog.js";import{TooltipTrigger as E,Tooltip as G}from"./tooltip.js";import{classNames as i}from"../utilities/theme.js";import{useIsMobile as K}from"../utilities/use-mobile.js";import{IcMenu as L,IcLeft as R,IcRight as A}from"./icons.js";import"class-variance-authority";import"react-aria-components";import"./loader.js";import"clsx";import"@icons-pack/react-simple-icons";const H="/",y=_(null);function v(){const e=B(y);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function ae({defaultOpen:e=!0,open:t,onOpenChange:n,className:o,style:r,children:s,...c}){const d=K(),[u,p]=w(!1),[C,k]=w(e),f=t??C,m=S(l=>{const b=typeof l=="function"?l(f):l;n?n(b):k(b)},[n,f]),g=S(()=>d?p(l=>!l):m(l=>!l),[d,m,p]);j(()=>{const l=b=>{b.key===H&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),g())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[g]);const x=f?"expanded":"collapsed",O=D(()=>({state:x,open:f,setOpen:m,isMobile:d,openMobile:u,setOpenMobile:p,toggleSidebar:g}),[x,f,m,d,u,p,g]);return a(y.Provider,{value:O,children:a("div",{className:i("group/sidebar-wrapper flex w-full has-[[data-variant=inset]]:bg-elevation-1",o),...c,children:s})})}function ie({side:e="left",variant:t="sidebar",collapsible:n="icon",className:o,children:r,...s}){const{isMobile:c,state:d,openMobile:u,setOpenMobile:p}=v();return n==="none"?a("div",{className:i("flex h-full w-(--sidebar-width) flex-col bg-elevation-1 text-foreground",o),...s,children:r}):c?a(I,{isOpen:u,onOpenChange:p,...s,children:a(T,{children:a(z,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) max-h-svh overflow-auto p-0 [&>button]:hidden",side:"left",children:()=>a("div",{className:"flex h-full w-full flex-col",children:r})})})}):h("div",{className:"group peer hidden text-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?n:"","data-variant":t,"data-side":e,children:[a("div",{className:i("relative w-(--sidebar-width) bg-elevation-1 transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),a("div",{className:i("absolute z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",o),...s,children:a("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-elevation-1 group-data-[variant=floating]:border group-data-[variant=floating]:border-border",children:r})})]})}function F({className:e,onClick:t,...n}){const{toggleSidebar:o,open:r,isMobile:s}=v();return a(N,{"data-sidebar":"trigger",variant:"neutral",size:"icon-sm",className:i(e,"!rounded-full p-icon"),onClick:c=>{t?.(c),o()},"aria-label":"trigger",...n,children:s?a(L,{}):r?a(R,{}):a(A,{})})}function ne({className:e,...t}){return a("div",{"data-sidebar":"content",className:i("flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden",e),...t})}function oe({className:e,...t}){return a("div",{"data-sidebar":"group",className:i("group/section relative flex w-full min-w-0 flex-col px-3 group-data-[collapsible=icon]:items-center",e),...t})}function re({className:e,...t}){return a("div",{"data-sidebar":"group-label",className:i("flex h-input shrink-0 items-center overflow-hidden px-2 text-xs select-none font-medium uppercase text-muted-foreground outline-none ring-ring transition-[height,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-icon [&>svg]:shrink-0","group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:!h-0 group-data-[collapsible=icon]:min-h-0 group-data-[collapsible=icon]:opacity-0",e),...t})}function le({className:e,...t}){return a("div",{"data-sidebar":"group-content",className:i("w-full body-sm",e),...t})}function se({className:e,...t}){return a("ul",{"data-sidebar":"menu",className:i("flex w-full min-w-0 flex-col gap-px",e),...t})}function de({className:e,...t}){return a("li",{"data-sidebar":"menu-item",className:i("group/menu-item relative list-none group-data-[collapsible=icon]:[&>*:not([data-sidebar=menu-button])]:hidden",e),...t})}function ue({className:e,...t}){return a("button",{"data-sidebar":"menu-action",className:i("absolute top-0 right-0 btn btn-ghost h-input","group-data-[collapsible=icon]:hidden",e),...t})}function ce({className:e,number:t,...n}){return a("div",{"data-sidebar":"menu-badge",className:i("absolute pointer-events-none top-0 right-0 font-light h-input select-none flex items-center justify-center body-sm tabular-nums","group-data-[collapsible=icon]:hidden",e),...n,children:new Intl.NumberFormat(navigator.language,{useGrouping:!0}).format(t)})}function be({className:e,...t}){return a("ul",{"data-sidebar":"menu-sub",className:i("ms-2 flex min-w-0 flex-col","group-data-[collapsible=icon]:hidden",e),...t})}function pe({className:e,...t}){return a("li",{className:i("list-none ms-0",e),...t})}const M="btn-tab relative rounded-md border-0 justify-start w-full group-data-[collapsible=icon]:justify-center";function fe({isActive:e=!1,className:t,children:n,icon:o,leading:r,...s}){const{isMobile:c,state:d}=v(),u=!c&&d==="collapsed";return h(E,{isDisabled:!u,children:[h(N,{size:u?"icon":void 0,"data-sidebar":"menu-button",...e&&{"data-selected":!0},className:i("peer/menu-button group/active group-has-[[data-sidebar=menu-action]]/menu-item:pr-input",M,t),...s,children:[a("span",{"aria-hidden":!0,className:"absolute inset-y-2 -left-1 w-[7px] rounded-full bg-primary opacity-0 group-data-[selected=true]/active:opacity-100"}),r!==void 0?r:o?a(o,{}):null,!u&&n]}),a(G,{placement:"right",children:a("span",{className:"flex items-center gap-2",children:n})})]})}function me({isActive:e,className:t,...n}){return a("button",{"data-sidebar":"menu-sub-button","data-active":e,className:i(M,t),...n})}function ge({className:e,logo:t,children:n,showTrigger:o=!0,...r}){return h("div",{"data-sidebar":"header",className:i("flex items-center h-header select-none shrink-0 border-b px-2 gap-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0",e),...r,children:[t&&a("div",{className:"flex items-center justify-center size-input shrink-0",children:t}),n&&a("div",{className:"flex-1 min-w-0 group-data-[collapsible=icon]:hidden",children:n}),o&&a(F,{className:"hidden bg-elevation-1 lg:flex lg:absolute lg:-right-4 lg:z-50"})]})}function he({className:e,...t}){return a("div",{"data-sidebar":"footer",className:i("mt-auto flex shrink-0 select-none items-center gap-2 border-t py-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0",e),...t})}function ve({className:e,...t}){return a("div",{className:i(e,"flex flex-col flex-1 overflow-auto"),...t})}function xe({className:e,...t}){return a("div",{className:i(e,"flex-1 overflow-auto"),...t})}function we({className:e,...t}){return a("nav",{className:i("flex items-center h-header bg-elevation-1 p-2 border-b",e),...t})}export{ie as Sidebar,ne as SidebarContent,y as SidebarContext,he as SidebarFooter,oe as SidebarGroup,le as SidebarGroupContent,re as SidebarGroupLabel,ge as SidebarHeader,se as SidebarMenu,ue as SidebarMenuAction,ce as SidebarMenuBadge,fe as SidebarMenuButton,de as SidebarMenuItem,be as SidebarMenuSub,me as SidebarMenuSubButton,pe as SidebarMenuSubItem,ve as SidebarOutlet,xe as SidebarOutletContent,we as SidebarOutletHeader,ae as SidebarProvider,F as SidebarTrigger,M as sidebarMenuButtonClasses,v as useSidebar};
1
+ "use client";import{jsx as t,jsxs as h}from"react/jsx-runtime";import{createContext as _,useState as w,useCallback as S,useEffect as j,useMemo as D,use as B}from"react";import{Button as N}from"./button.js";import{DialogTrigger as I,DialogOverlay as T,DialogContent as z}from"./dialog.js";import{TooltipTrigger as E,Tooltip as G}from"./tooltip.js";import{classNames as i}from"../utilities/theme.js";import{useIsMobile as K}from"../utilities/use-mobile.js";import{IcMenu as L,IcLeft as R,IcRight as A}from"./icons.js";import"class-variance-authority";import"react-aria-components";import"./loader.js";import"clsx";import"@icons-pack/react-simple-icons";const H="/",y=_(null);function v(){const e=B(y);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function te({defaultOpen:e=!0,open:a,onOpenChange:r,className:n,style:o,children:s,...c}){const d=K(),[u,p]=w(!1),[C,k]=w(e),f=a??C,m=S(l=>{const b=typeof l=="function"?l(f):l;r?r(b):k(b)},[r,f]),g=S(()=>d?p(l=>!l):m(l=>!l),[d,m,p]);j(()=>{const l=b=>{b.key===H&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),g())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[g]);const x=f?"expanded":"collapsed",O=D(()=>({state:x,open:f,setOpen:m,isMobile:d,openMobile:u,setOpenMobile:p,toggleSidebar:g}),[x,f,m,d,u,p,g]);return t(y.Provider,{value:O,children:t("div",{className:i("group/sidebar-wrapper flex w-full has-[[data-variant=inset]]:bg-elevation-1",n),...c,children:s})})}function ie({side:e="left",variant:a="sidebar",collapsible:r="icon",className:n,children:o,...s}){const{isMobile:c,state:d,openMobile:u,setOpenMobile:p}=v();return r==="none"?t("div",{className:i("flex h-full w-(--sidebar-width) flex-col bg-elevation-1 text-foreground",n),...s,children:o}):c?t(I,{isOpen:u,onOpenChange:p,...s,children:t(T,{children:t(z,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) max-h-svh overflow-auto p-0 [&>button]:hidden border-r! border-stroke-primary! bg-surface-primary!",side:"left",children:()=>t("div",{className:"flex h-full w-full flex-col",children:o})})})}):h("div",{className:"group peer hidden text-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?r:"","data-variant":a,"data-side":e,children:[t("div",{className:i("relative w-(--sidebar-width) bg-elevation-1 transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",a==="floating"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),t("div",{className:i("absolute z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",a==="floating"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...s,children:t("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-elevation-1 group-data-[variant=floating]:border group-data-[variant=floating]:border-border",children:o})})]})}function F({className:e,onClick:a,...r}){const{toggleSidebar:n,open:o,isMobile:s}=v();return t(N,{"data-sidebar":"trigger",variant:"neutral",size:"icon-sm",className:i(e,"!rounded-full p-icon"),onClick:c=>{a?.(c),n()},"aria-label":"trigger",...r,children:s?t(L,{}):o?t(R,{}):t(A,{})})}function re({className:e,...a}){return t("div",{"data-sidebar":"content",className:i("flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden",e),...a})}function ne({className:e,...a}){return t("div",{"data-sidebar":"group",className:i("group/section relative flex w-full min-w-0 flex-col px-3 group-data-[collapsible=icon]:items-center",e),...a})}function oe({className:e,...a}){return t("div",{"data-sidebar":"group-label",className:i("flex h-input shrink-0 items-center overflow-hidden px-2 text-xs select-none font-medium uppercase text-muted-foreground outline-none ring-ring transition-[height,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-icon [&>svg]:shrink-0","group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:!h-0 group-data-[collapsible=icon]:min-h-0 group-data-[collapsible=icon]:opacity-0",e),...a})}function le({className:e,...a}){return t("div",{"data-sidebar":"group-content",className:i("w-full body-sm",e),...a})}function se({className:e,...a}){return t("ul",{"data-sidebar":"menu",className:i("flex w-full min-w-0 flex-col gap-px",e),...a})}function de({className:e,...a}){return t("li",{"data-sidebar":"menu-item",className:i("group/menu-item relative list-none group-data-[collapsible=icon]:[&>*:not([data-sidebar=menu-button])]:hidden",e),...a})}function ue({className:e,...a}){return t("button",{"data-sidebar":"menu-action",className:i("absolute top-0 right-0 btn btn-ghost h-input","group-data-[collapsible=icon]:hidden",e),...a})}function ce({className:e,number:a,...r}){return t("div",{"data-sidebar":"menu-badge",className:i("absolute pointer-events-none top-0 right-0 font-light h-input select-none flex items-center justify-center body-sm tabular-nums","group-data-[collapsible=icon]:hidden",e),...r,children:new Intl.NumberFormat(navigator.language,{useGrouping:!0}).format(a)})}function be({className:e,...a}){return t("ul",{"data-sidebar":"menu-sub",className:i("ms-2 flex min-w-0 flex-col","group-data-[collapsible=icon]:hidden",e),...a})}function pe({className:e,...a}){return t("li",{className:i("list-none ms-0",e),...a})}const M="btn-tab relative rounded-md border-0 justify-start w-full group-data-[collapsible=icon]:justify-center";function fe({isActive:e=!1,className:a,children:r,icon:n,leading:o,...s}){const{isMobile:c,state:d}=v(),u=!c&&d==="collapsed";return h(E,{isDisabled:!u,children:[h(N,{size:u?"icon":void 0,"data-sidebar":"menu-button",...e&&{"data-selected":!0},className:i("peer/menu-button group/active group-has-[[data-sidebar=menu-action]]/menu-item:pr-input",M,a),...s,children:[t("span",{"aria-hidden":!0,className:"absolute inset-y-2 -left-1 w-[7px] rounded-full bg-primary opacity-0 group-data-[selected=true]/active:opacity-100"}),o!==void 0?o:n?t(n,{}):null,!u&&r]}),t(G,{placement:"right",children:t("span",{className:"flex items-center gap-2",children:r})})]})}function me({isActive:e,className:a,...r}){return t("button",{"data-sidebar":"menu-sub-button","data-active":e,className:i(M,a),...r})}function ge({className:e,logo:a,children:r,showTrigger:n=!0,...o}){return h("div",{"data-sidebar":"header",className:i("flex items-center h-header select-none shrink-0 border-b px-2 gap-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0",e),...o,children:[a&&t("div",{className:"flex items-center justify-center size-input shrink-0",children:a}),r&&t("div",{className:"flex-1 min-w-0 group-data-[collapsible=icon]:hidden",children:r}),n&&t(F,{className:"hidden bg-elevation-1 lg:flex lg:absolute lg:-right-4 lg:z-50"})]})}function he({className:e,...a}){return t("div",{"data-sidebar":"footer",className:i("mt-auto flex shrink-0 select-none items-center gap-2 border-t py-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0",e),...a})}function ve({className:e,...a}){return t("div",{className:i(e,"flex flex-col flex-1 overflow-auto"),...a})}function xe({className:e,...a}){return t("div",{className:i(e,"flex-1 overflow-auto"),...a})}function we({className:e,...a}){return t("nav",{className:i("flex items-center h-header bg-elevation-1 p-2 border-b",e),...a})}export{ie as Sidebar,re as SidebarContent,y as SidebarContext,he as SidebarFooter,ne as SidebarGroup,le as SidebarGroupContent,oe as SidebarGroupLabel,ge as SidebarHeader,se as SidebarMenu,ue as SidebarMenuAction,ce as SidebarMenuBadge,fe as SidebarMenuButton,de as SidebarMenuItem,be as SidebarMenuSub,me as SidebarMenuSubButton,pe as SidebarMenuSubItem,ve as SidebarOutlet,xe as SidebarOutletContent,we as SidebarOutletHeader,te as SidebarProvider,F as SidebarTrigger,M as sidebarMenuButtonClasses,v as useSidebar};
2
2
  //# sourceMappingURL=sidebar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.js","sources":["../../lib/components/sidebar.tsx"],"sourcesContent":["'use client';\nimport { createContext, use, useCallback, useEffect, useMemo, useState } from 'react';\nimport { Button } from '../components/button';\nimport { DialogContent, DialogOverlay, DialogTrigger } from '../components/dialog';\nimport { Tooltip, TooltipTrigger } from '../components/tooltip';\nimport { classNames } from '../utilities/theme';\nimport { useIsMobile } from '../utilities/use-mobile';\nimport { IcLeft, IcMenu, IcRight, type CtxIcon } from './icons';\n\nconst SIDEBAR_KEYBOARD_SHORTCUT = '/';\n\ntype SidebarContextProps = {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n};\n\nexport const SidebarContext = createContext<SidebarContextProps | null>(null);\n\n/**\n * Get the current sidebar state and controls. Must be inside SidebarProvider.\n * @throws When used outside of SidebarProvider\n */\nexport function useSidebar() {\n const context = use(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a SidebarProvider.');\n }\n\n return context;\n}\n\n/**\n * Wraps your app layout and manages sidebar state. Handles keyboard shortcuts (Cmd/Ctrl + /)\n * and mobile vs desktop behavior.\n *\n * @example\n * <SidebarProvider>\n * <Sidebar>...</Sidebar>\n * <SidebarOutlet>\n * <main>Your app content</main>\n * </SidebarOutlet>\n * </SidebarProvider>\n */\nexport function SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Initial open state. Defaults to true */\n defaultOpen?: boolean;\n /** Control the open state yourself */\n open?: boolean;\n /** Callback when sidebar opens/closes */\n onOpenChange?: (open: boolean) => void;\n}) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = useState(false);\n\n // This is the internal state of the sidebar.\n // We use openProp and setOpenProp for control from outside the component.\n const [_open, _setOpen] = useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === 'function' ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n _setOpen(openState);\n }\n },\n [setOpenProp, open]\n );\n\n // Helper to toggle the sidebar.\n const toggleSidebar = useCallback(() => {\n return isMobile ? setOpenMobile(open => !open) : setOpen(open => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Adds a keyboard shortcut to toggle the sidebar.\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n // This makes it easier to style the sidebar with Tailwind classes.\n const state = open ? 'expanded' : 'collapsed';\n\n const contextValue = useMemo<SidebarContextProps>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <div\n className={classNames(\n 'group/sidebar-wrapper flex w-full has-[[data-variant=inset]]:bg-elevation-1',\n className\n )}\n {...props}\n >\n {children}\n </div>\n </SidebarContext.Provider>\n );\n}\n\n/**\n * The actual sidebar panel. On mobile it becomes a modal dialog.\n */\nexport function Sidebar({\n side = 'left',\n variant = 'sidebar',\n collapsible = 'icon',\n className,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Where to dock the sidebar. Default: left */\n side?: 'left' | 'right';\n /** Style variant. Default: sidebar */\n variant?: 'sidebar' | 'floating';\n /** How it collapses. Default: offcanvas */\n collapsible?: 'offcanvas' | 'icon' | 'none';\n}) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div\n className={classNames(\n 'flex h-full w-(--sidebar-width) flex-col bg-elevation-1 text-foreground',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <DialogTrigger isOpen={openMobile} onOpenChange={setOpenMobile} {...props}>\n <DialogOverlay>\n <DialogContent\n data-sidebar=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-(--sidebar-width) max-h-svh overflow-auto p-0 [&>button]:hidden\"\n side=\"left\"\n >\n {() => <div className=\"flex h-full w-full flex-col\">{children}</div>}\n </DialogContent>\n </DialogOverlay>\n </DialogTrigger>\n );\n }\n\n return (\n <div\n className=\"group peer hidden text-foreground md:block\"\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n className={classNames(\n 'relative w-(--sidebar-width) bg-elevation-1 transition-[width] duration-200 ease-linear',\n 'group-data-[collapsible=offcanvas]:w-0',\n 'group-data-[side=right]:rotate-180',\n variant === 'floating'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)'\n )}\n />\n <div\n className={classNames(\n 'absolute z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',\n side === 'left'\n ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'\n : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',\n // Adjust the padding for floating variant.\n variant === 'floating'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',\n className\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n className=\"flex h-full w-full flex-col bg-elevation-1 group-data-[variant=floating]:border group-data-[variant=floating]:border-border\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * Button that toggles the sidebar. Shows arrow icons.\n */\nexport function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {\n const { toggleSidebar, open, isMobile } = useSidebar();\n\n return (\n <Button\n data-sidebar=\"trigger\"\n variant=\"neutral\"\n size=\"icon-sm\"\n className={classNames(className, '!rounded-full p-icon')}\n onClick={event => {\n onClick?.(event);\n toggleSidebar();\n }}\n aria-label=\"trigger\"\n {...props}\n >\n {/* Use transition to rotate a single icon */}\n {isMobile ? <IcMenu /> : open ? <IcLeft /> : <IcRight />}\n </Button>\n );\n}\n\n/**\n * Scrollable container for sidebar content\n */\nexport function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"content\"\n className={classNames('flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden', className)}\n {...props}\n />\n );\n}\n\n/**\n * Groups related menu items together\n */\nexport function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"group\"\n className={classNames(\n 'group/section relative flex w-full min-w-0 flex-col px-3 group-data-[collapsible=icon]:items-center',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Label for a group.\n */\nexport function SidebarGroupLabel({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"group-label\"\n className={classNames(\n 'flex h-input shrink-0 items-center overflow-hidden px-2 text-xs select-none font-medium uppercase text-muted-foreground outline-none ring-ring transition-[height,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-icon [&>svg]:shrink-0',\n 'group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:!h-0 group-data-[collapsible=icon]:min-h-0 group-data-[collapsible=icon]:opacity-0',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Content wrapper for a group\n */\nexport function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-sidebar=\"group-content\" className={classNames('w-full body-sm', className)} {...props} />;\n}\n\n/**\n * Container for menu items\n */\nexport function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {\n return (\n <ul data-sidebar=\"menu\" className={classNames('flex w-full min-w-0 flex-col gap-px', className)} {...props} />\n );\n}\n\n/**\n * Single menu item wrapper\n */\nexport function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {\n return (\n <li\n data-sidebar=\"menu-item\"\n className={classNames(\n 'group/menu-item relative list-none group-data-[collapsible=icon]:[&>*:not([data-sidebar=menu-button])]:hidden',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Extra action button that appears on the right side of menu items\n */\nexport function SidebarMenuAction({\n className,\n ...props\n}: React.ComponentProps<'button'> & {\n /** Only show on hover */\n showOnHover?: boolean;\n}) {\n return (\n <button\n data-sidebar=\"menu-action\"\n className={classNames(\n 'absolute top-0 right-0 btn btn-ghost h-input',\n 'group-data-[collapsible=icon]:hidden',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Shows a number badge on menu items. Auto-formats large numbers.\n */\nexport function SidebarMenuBadge({\n className,\n number,\n ...props\n}: Omit<React.ComponentProps<'div'>, 'children'> & {\n /** The count to display */\n number: number | bigint;\n}) {\n return (\n <div\n data-sidebar=\"menu-badge\"\n className={classNames(\n 'absolute pointer-events-none top-0 right-0 font-light h-input select-none flex items-center justify-center body-sm tabular-nums',\n 'group-data-[collapsible=icon]:hidden',\n className\n )}\n {...props}\n >\n {/* Format the number */}\n {new Intl.NumberFormat(navigator.language, { useGrouping: true }).format(number)}\n </div>\n );\n}\n\n/**\n * Nested submenu container\n */\nexport function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {\n return (\n <ul\n data-sidebar=\"menu-sub\"\n className={classNames('ms-2 flex min-w-0 flex-col', 'group-data-[collapsible=icon]:hidden', className)}\n {...props}\n />\n );\n}\n\n/**\n * Submenu item wrapper\n */\nexport function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>) {\n return <li className={classNames('list-none ms-0', className)} {...props} />;\n}\n\nexport const sidebarMenuButtonClasses =\n 'btn-tab relative rounded-md border-0 justify-start w-full group-data-[collapsible=icon]:justify-center';\n\n// Common interaction logic for SidebarMenuButton and SidebarMenuSubButton\n/**\n * Main menu button. Pass isActive for current page.\n */\nexport function SidebarMenuButton({\n isActive = false,\n className,\n children,\n icon: Icon,\n leading,\n ...props\n}: Omit<React.ComponentProps<typeof Button>, 'children'> & {\n /** Mark as currently active page */\n icon?: CtxIcon;\n leading?: React.ReactNode;\n isActive?: boolean;\n children?: React.ReactNode;\n}) {\n const { isMobile, state } = useSidebar();\n const isCollapsed = !isMobile && state === 'collapsed';\n\n return (\n <TooltipTrigger isDisabled={!isCollapsed}>\n <Button\n size={isCollapsed ? 'icon' : undefined}\n data-sidebar=\"menu-button\"\n {...(isActive && { 'data-selected': true })}\n className={classNames(\n 'peer/menu-button group/active group-has-[[data-sidebar=menu-action]]/menu-item:pr-input',\n sidebarMenuButtonClasses,\n className\n )}\n {...props}\n >\n <span\n aria-hidden\n className=\"absolute inset-y-2 -left-1 w-[7px] rounded-full bg-primary opacity-0 group-data-[selected=true]/active:opacity-100\"\n />\n {leading !== undefined ? leading : Icon ? <Icon /> : null}\n {!isCollapsed && children}\n </Button>\n <Tooltip placement=\"right\">\n <span className=\"flex items-center gap-2\">{children}</span>\n </Tooltip>\n </TooltipTrigger>\n );\n}\n\n/**\n * Button for submenu items\n */\nexport function SidebarMenuSubButton({\n isActive,\n className,\n ...props\n}: React.ComponentProps<'button'> & {\n isActive?: boolean;\n}) {\n return (\n <button\n data-sidebar=\"menu-sub-button\"\n data-active={isActive}\n className={classNames(sidebarMenuButtonClasses, className)}\n {...props}\n />\n );\n}\n\n/**\n * Sticky header at the top of the sidebar. Displays a square logo slot aligned with the outlet header.\n */\nexport function SidebarHeader({\n className,\n logo,\n children,\n showTrigger = true,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Square logo/icon to display */\n logo?: React.ReactNode;\n showTrigger?: boolean;\n}) {\n return (\n <div\n data-sidebar=\"header\"\n className={classNames(\n 'flex items-center h-header select-none shrink-0 border-b px-2 gap-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0',\n className\n )}\n {...props}\n >\n {logo && <div className=\"flex items-center justify-center size-input shrink-0\">{logo}</div>}\n {children && <div className=\"flex-1 min-w-0 group-data-[collapsible=icon]:hidden\">{children}</div>}\n {showTrigger && (\n <SidebarTrigger className={'hidden bg-elevation-1 lg:flex lg:absolute lg:-right-4 lg:z-50'} />\n )}\n </div>\n );\n}\n\nexport function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"footer\"\n className={classNames(\n 'mt-auto flex shrink-0 select-none items-center gap-2 border-t py-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n *\n * @example Basic usage\n * ```tsx\n * <SidebarOutlet>\n * <SidebarOutletHeader><SidebarTrigger/></SidebarOutletHeader>\n * <SidebarOutletContent><Outlet/></SidebarOutletContent>\n * </SidebarOutlet>\n * ```\n */\nexport function SidebarOutlet({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames(className, 'flex flex-col flex-1 overflow-auto')} {...props} />;\n}\n\nexport function SidebarOutletContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames(className, 'flex-1 overflow-auto')} {...props} />;\n}\n\nexport function SidebarOutletHeader({ className, ...props }: React.ComponentProps<'nav'>) {\n return (\n <nav className={classNames('flex items-center h-header bg-elevation-1 p-2 border-b', className)} {...props} />\n );\n}\n"],"names":["SIDEBAR_KEYBOARD_SHORTCUT","SidebarContext","createContext","useSidebar","context","use","SidebarProvider","defaultOpen","openProp","setOpenProp","className","style","children","props","isMobile","useIsMobile","openMobile","setOpenMobile","useState","_open","_setOpen","open","setOpen","useCallback","value","openState","toggleSidebar","useEffect","handleKeyDown","event","state","contextValue","useMemo","jsx","classNames","Sidebar","side","variant","collapsible","DialogTrigger","DialogOverlay","DialogContent","jsxs","SidebarTrigger","onClick","Button","IcMenu","IcLeft","IcRight","SidebarContent","SidebarGroup","SidebarGroupLabel","SidebarGroupContent","SidebarMenu","SidebarMenuItem","SidebarMenuAction","SidebarMenuBadge","number","SidebarMenuSub","SidebarMenuSubItem","sidebarMenuButtonClasses","SidebarMenuButton","isActive","Icon","leading","isCollapsed","TooltipTrigger","Tooltip","SidebarMenuSubButton","SidebarHeader","logo","showTrigger","SidebarFooter","SidebarOutlet","SidebarOutletContent","SidebarOutletHeader"],"mappings":"2oBASA,MAAMA,EAA4B,IAYrBC,EAAiBC,EAA0C,IAAI,EAMrE,SAASC,GAAa,CACzB,MAAMC,EAAUC,EAAIJ,CAAc,EAClC,GAAI,CAACG,EACD,MAAM,IAAI,MAAM,mDAAmD,EAGvE,OAAOA,CACX,CAcO,SAASE,GAAgB,CAC5B,YAAAC,EAAc,GACd,KAAMC,EACN,aAAcC,EACd,UAAAC,EACA,MAAAC,EACA,SAAAC,EACA,GAAGC,CACP,EAOG,CACC,MAAMC,EAAWC,EAAA,EACX,CAACC,EAAYC,CAAa,EAAIC,EAAS,EAAK,EAI5C,CAACC,EAAOC,CAAQ,EAAIF,EAASX,CAAW,EACxCc,EAAOb,GAAYW,EACnBG,EAAUC,EACXC,GAAmD,CAChD,MAAMC,EAAY,OAAOD,GAAU,WAAaA,EAAMH,CAAI,EAAIG,EAC1Df,EACAA,EAAYgB,CAAS,EAErBL,EAASK,CAAS,CAE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GAAG1D,CACP,EAIG,CACC,OACI6B,EAAC,MAAA,CACG,eAAa,SACb,UAAWR,EACP,sJACAxB,CAAA,EAEH,GAAGG,EAEH,SAAA,CAAAyD,GAAQrC,EAAC,MAAA,CAAI,UAAU,uDAAwD,SAAAqC,EAAK,EACpF1D,GAAYqB,EAAC,MAAA,CAAI,UAAU,sDAAuD,SAAArB,EAAS,EAC3F2D,GACGtC,EAACU,EAAA,CAAe,UAAW,+DAAA,CAAiE,CAAA,CAAA,CAAA,CAI5G,CAEO,SAAS6B,GAAc,CAAE,UAAA9D,EAAW,GAAGG,GAAsC,CAChF,OACIoB,EAAC,MAAA,CACG,eAAa,SACb,UAAWC,EACP,qJACAxB,CAAA,EAEH,GAAGG,CAAA,CAAA,CAGhB,CAYO,SAAS4D,GAAc,CAAE,UAAA/D,EAAW,GAAGG,GAAsC,CAChF,OAAOoB,EAAC,OAAI,UAAWC,EAAWxB,EAAW,oCAAoC,EAAI,GAAGG,EAAO,CACnG,CAEO,SAAS6D,GAAqB,CAAE,UAAAhE,EAAW,GAAGG,GAAsC,CACvF,OAAOoB,EAAC,OAAI,UAAWC,EAAWxB,EAAW,sBAAsB,EAAI,GAAGG,EAAO,CACrF,CAEO,SAAS8D,GAAoB,CAAE,UAAAjE,EAAW,GAAGG,GAAsC,CACtF,OACIoB,EAAC,OAAI,UAAWC,EAAW,yDAA0DxB,CAAS,EAAI,GAAGG,EAAO,CAEpH"}
1
+ {"version":3,"file":"sidebar.js","sources":["../../lib/components/sidebar.tsx"],"sourcesContent":["'use client';\nimport { createContext, use, useCallback, useEffect, useMemo, useState } from 'react';\nimport { Button } from '../components/button';\nimport { DialogContent, DialogOverlay, DialogTrigger } from '../components/dialog';\nimport { Tooltip, TooltipTrigger } from '../components/tooltip';\nimport { classNames } from '../utilities/theme';\nimport { useIsMobile } from '../utilities/use-mobile';\nimport { IcLeft, IcMenu, IcRight, type CtxIcon } from './icons';\n\nconst SIDEBAR_KEYBOARD_SHORTCUT = '/';\n\ntype SidebarContextProps = {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n};\n\nexport const SidebarContext = createContext<SidebarContextProps | null>(null);\n\n/**\n * Get the current sidebar state and controls. Must be inside SidebarProvider.\n * @throws When used outside of SidebarProvider\n */\nexport function useSidebar() {\n const context = use(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a SidebarProvider.');\n }\n\n return context;\n}\n\n/**\n * Wraps your app layout and manages sidebar state. Handles keyboard shortcuts (Cmd/Ctrl + /)\n * and mobile vs desktop behavior.\n *\n * @example\n * <SidebarProvider>\n * <Sidebar>...</Sidebar>\n * <SidebarOutlet>\n * <main>Your app content</main>\n * </SidebarOutlet>\n * </SidebarProvider>\n */\nexport function SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Initial open state. Defaults to true */\n defaultOpen?: boolean;\n /** Control the open state yourself */\n open?: boolean;\n /** Callback when sidebar opens/closes */\n onOpenChange?: (open: boolean) => void;\n}) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = useState(false);\n\n // This is the internal state of the sidebar.\n // We use openProp and setOpenProp for control from outside the component.\n const [_open, _setOpen] = useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === 'function' ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n _setOpen(openState);\n }\n },\n [setOpenProp, open]\n );\n\n // Helper to toggle the sidebar.\n const toggleSidebar = useCallback(() => {\n return isMobile ? setOpenMobile(open => !open) : setOpen(open => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Adds a keyboard shortcut to toggle the sidebar.\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n // This makes it easier to style the sidebar with Tailwind classes.\n const state = open ? 'expanded' : 'collapsed';\n\n const contextValue = useMemo<SidebarContextProps>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <div\n className={classNames(\n 'group/sidebar-wrapper flex w-full has-[[data-variant=inset]]:bg-elevation-1',\n className\n )}\n {...props}\n >\n {children}\n </div>\n </SidebarContext.Provider>\n );\n}\n\n/**\n * The actual sidebar panel. On mobile it becomes a modal dialog.\n */\nexport function Sidebar({\n side = 'left',\n variant = 'sidebar',\n collapsible = 'icon',\n className,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Where to dock the sidebar. Default: left */\n side?: 'left' | 'right';\n /** Style variant. Default: sidebar */\n variant?: 'sidebar' | 'floating';\n /** How it collapses. Default: offcanvas */\n collapsible?: 'offcanvas' | 'icon' | 'none';\n}) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div\n className={classNames(\n 'flex h-full w-(--sidebar-width) flex-col bg-elevation-1 text-foreground',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <DialogTrigger isOpen={openMobile} onOpenChange={setOpenMobile} {...props}>\n <DialogOverlay>\n <DialogContent\n data-sidebar=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-(--sidebar-width) max-h-svh overflow-auto p-0 [&>button]:hidden border-r! border-stroke-primary! bg-surface-primary!\"\n side=\"left\"\n >\n {() => <div className=\"flex h-full w-full flex-col\">{children}</div>}\n </DialogContent>\n </DialogOverlay>\n </DialogTrigger>\n );\n }\n\n return (\n <div\n className=\"group peer hidden text-foreground md:block\"\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n className={classNames(\n 'relative w-(--sidebar-width) bg-elevation-1 transition-[width] duration-200 ease-linear',\n 'group-data-[collapsible=offcanvas]:w-0',\n 'group-data-[side=right]:rotate-180',\n variant === 'floating'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)'\n )}\n />\n <div\n className={classNames(\n 'absolute z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',\n side === 'left'\n ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'\n : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',\n // Adjust the padding for floating variant.\n variant === 'floating'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',\n className\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n className=\"flex h-full w-full flex-col bg-elevation-1 group-data-[variant=floating]:border group-data-[variant=floating]:border-border\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * Button that toggles the sidebar. Shows arrow icons.\n */\nexport function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {\n const { toggleSidebar, open, isMobile } = useSidebar();\n\n return (\n <Button\n data-sidebar=\"trigger\"\n variant=\"neutral\"\n size=\"icon-sm\"\n className={classNames(className, '!rounded-full p-icon')}\n onClick={event => {\n onClick?.(event);\n toggleSidebar();\n }}\n aria-label=\"trigger\"\n {...props}\n >\n {/* Use transition to rotate a single icon */}\n {isMobile ? <IcMenu /> : open ? <IcLeft /> : <IcRight />}\n </Button>\n );\n}\n\n/**\n * Scrollable container for sidebar content\n */\nexport function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"content\"\n className={classNames('flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden', className)}\n {...props}\n />\n );\n}\n\n/**\n * Groups related menu items together\n */\nexport function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"group\"\n className={classNames(\n 'group/section relative flex w-full min-w-0 flex-col px-3 group-data-[collapsible=icon]:items-center',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Label for a group.\n */\nexport function SidebarGroupLabel({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"group-label\"\n className={classNames(\n 'flex h-input shrink-0 items-center overflow-hidden px-2 text-xs select-none font-medium uppercase text-muted-foreground outline-none ring-ring transition-[height,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-icon [&>svg]:shrink-0',\n 'group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:!h-0 group-data-[collapsible=icon]:min-h-0 group-data-[collapsible=icon]:opacity-0',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Content wrapper for a group\n */\nexport function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-sidebar=\"group-content\" className={classNames('w-full body-sm', className)} {...props} />;\n}\n\n/**\n * Container for menu items\n */\nexport function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {\n return (\n <ul data-sidebar=\"menu\" className={classNames('flex w-full min-w-0 flex-col gap-px', className)} {...props} />\n );\n}\n\n/**\n * Single menu item wrapper\n */\nexport function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {\n return (\n <li\n data-sidebar=\"menu-item\"\n className={classNames(\n 'group/menu-item relative list-none group-data-[collapsible=icon]:[&>*:not([data-sidebar=menu-button])]:hidden',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Extra action button that appears on the right side of menu items\n */\nexport function SidebarMenuAction({\n className,\n ...props\n}: React.ComponentProps<'button'> & {\n /** Only show on hover */\n showOnHover?: boolean;\n}) {\n return (\n <button\n data-sidebar=\"menu-action\"\n className={classNames(\n 'absolute top-0 right-0 btn btn-ghost h-input',\n 'group-data-[collapsible=icon]:hidden',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Shows a number badge on menu items. Auto-formats large numbers.\n */\nexport function SidebarMenuBadge({\n className,\n number,\n ...props\n}: Omit<React.ComponentProps<'div'>, 'children'> & {\n /** The count to display */\n number: number | bigint;\n}) {\n return (\n <div\n data-sidebar=\"menu-badge\"\n className={classNames(\n 'absolute pointer-events-none top-0 right-0 font-light h-input select-none flex items-center justify-center body-sm tabular-nums',\n 'group-data-[collapsible=icon]:hidden',\n className\n )}\n {...props}\n >\n {/* Format the number */}\n {new Intl.NumberFormat(navigator.language, { useGrouping: true }).format(number)}\n </div>\n );\n}\n\n/**\n * Nested submenu container\n */\nexport function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {\n return (\n <ul\n data-sidebar=\"menu-sub\"\n className={classNames('ms-2 flex min-w-0 flex-col', 'group-data-[collapsible=icon]:hidden', className)}\n {...props}\n />\n );\n}\n\n/**\n * Submenu item wrapper\n */\nexport function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>) {\n return <li className={classNames('list-none ms-0', className)} {...props} />;\n}\n\nexport const sidebarMenuButtonClasses =\n 'btn-tab relative rounded-md border-0 justify-start w-full group-data-[collapsible=icon]:justify-center';\n\n// Common interaction logic for SidebarMenuButton and SidebarMenuSubButton\n/**\n * Main menu button. Pass isActive for current page.\n */\nexport function SidebarMenuButton({\n isActive = false,\n className,\n children,\n icon: Icon,\n leading,\n ...props\n}: Omit<React.ComponentProps<typeof Button>, 'children'> & {\n /** Mark as currently active page */\n icon?: CtxIcon;\n leading?: React.ReactNode;\n isActive?: boolean;\n children?: React.ReactNode;\n}) {\n const { isMobile, state } = useSidebar();\n const isCollapsed = !isMobile && state === 'collapsed';\n\n return (\n <TooltipTrigger isDisabled={!isCollapsed}>\n <Button\n size={isCollapsed ? 'icon' : undefined}\n data-sidebar=\"menu-button\"\n {...(isActive && { 'data-selected': true })}\n className={classNames(\n 'peer/menu-button group/active group-has-[[data-sidebar=menu-action]]/menu-item:pr-input',\n sidebarMenuButtonClasses,\n className\n )}\n {...props}\n >\n <span\n aria-hidden\n className=\"absolute inset-y-2 -left-1 w-[7px] rounded-full bg-primary opacity-0 group-data-[selected=true]/active:opacity-100\"\n />\n {leading !== undefined ? leading : Icon ? <Icon /> : null}\n {!isCollapsed && children}\n </Button>\n <Tooltip placement=\"right\">\n <span className=\"flex items-center gap-2\">{children}</span>\n </Tooltip>\n </TooltipTrigger>\n );\n}\n\n/**\n * Button for submenu items\n */\nexport function SidebarMenuSubButton({\n isActive,\n className,\n ...props\n}: React.ComponentProps<'button'> & {\n isActive?: boolean;\n}) {\n return (\n <button\n data-sidebar=\"menu-sub-button\"\n data-active={isActive}\n className={classNames(sidebarMenuButtonClasses, className)}\n {...props}\n />\n );\n}\n\n/**\n * Sticky header at the top of the sidebar. Displays a square logo slot aligned with the outlet header.\n */\nexport function SidebarHeader({\n className,\n logo,\n children,\n showTrigger = true,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Square logo/icon to display */\n logo?: React.ReactNode;\n showTrigger?: boolean;\n}) {\n return (\n <div\n data-sidebar=\"header\"\n className={classNames(\n 'flex items-center h-header select-none shrink-0 border-b px-2 gap-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0',\n className\n )}\n {...props}\n >\n {logo && <div className=\"flex items-center justify-center size-input shrink-0\">{logo}</div>}\n {children && <div className=\"flex-1 min-w-0 group-data-[collapsible=icon]:hidden\">{children}</div>}\n {showTrigger && (\n <SidebarTrigger className={'hidden bg-elevation-1 lg:flex lg:absolute lg:-right-4 lg:z-50'} />\n )}\n </div>\n );\n}\n\nexport function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"footer\"\n className={classNames(\n 'mt-auto flex shrink-0 select-none items-center gap-2 border-t py-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n *\n * @example Basic usage\n * ```tsx\n * <SidebarOutlet>\n * <SidebarOutletHeader><SidebarTrigger/></SidebarOutletHeader>\n * <SidebarOutletContent><Outlet/></SidebarOutletContent>\n * </SidebarOutlet>\n * ```\n */\nexport function SidebarOutlet({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames(className, 'flex flex-col flex-1 overflow-auto')} {...props} />;\n}\n\nexport function SidebarOutletContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames(className, 'flex-1 overflow-auto')} {...props} />;\n}\n\nexport function SidebarOutletHeader({ className, ...props }: React.ComponentProps<'nav'>) {\n return (\n <nav className={classNames('flex items-center h-header bg-elevation-1 p-2 border-b', className)} {...props} />\n );\n}\n"],"names":["SIDEBAR_KEYBOARD_SHORTCUT","SidebarContext","createContext","useSidebar","context","use","SidebarProvider","defaultOpen","openProp","setOpenProp","className","style","children","props","isMobile","useIsMobile","openMobile","setOpenMobile","useState","_open","_setOpen","open","setOpen","useCallback","value","openState","toggleSidebar","useEffect","handleKeyDown","event","state","contextValue","useMemo","jsx","classNames","Sidebar","side","variant","collapsible","DialogTrigger","DialogOverlay","DialogContent","jsxs","SidebarTrigger","onClick","Button","IcMenu","IcLeft","IcRight","SidebarContent","SidebarGroup","SidebarGroupLabel","SidebarGroupContent","SidebarMenu","SidebarMenuItem","SidebarMenuAction","SidebarMenuBadge","number","SidebarMenuSub","SidebarMenuSubItem","sidebarMenuButtonClasses","SidebarMenuButton","isActive","Icon","leading","isCollapsed","TooltipTrigger","Tooltip","SidebarMenuSubButton","SidebarHeader","logo","showTrigger","SidebarFooter","SidebarOutlet","SidebarOutletContent","SidebarOutletHeader"],"mappings":"2oBASA,MAAMA,EAA4B,IAYrBC,EAAiBC,EAA0C,IAAI,EAMrE,SAASC,GAAa,CACzB,MAAMC,EAAUC,EAAIJ,CAAc,EAClC,GAAI,CAACG,EACD,MAAM,IAAI,MAAM,mDAAmD,EAGvE,OAAOA,CACX,CAcO,SAASE,GAAgB,CAC5B,YAAAC,EAAc,GACd,KAAMC,EACN,aAAcC,EACd,UAAAC,EACA,MAAAC,EACA,SAAAC,EACA,GAAGC,CACP,EAOG,CACC,MAAMC,EAAWC,EAAA,EACX,CAACC,EAAYC,CAAa,EAAIC,EAAS,EAAK,EAI5C,CAACC,EAAOC,CAAQ,EAAIF,EAASX,CAAW,EACxCc,EAAOb,GAAYW,EACnBG,EAAUC,EACXC,GAAmD,CAChD,MAAMC,EAAY,OAAOD,GAAU,WAAaA,EAAMH,CAAI,EAAIG,EAC1Df,EACAA,EAAYgB,CAAS,EAErBL,EAASK,CAAS,CAE1B,EACA,CAAChB,EAAaY,CAAI,CAAA,EAIhBK,EAAgBH,EAAY,IACvBT,EAAWG,EAAcI,GAAQ,CAACA,CAAI,EAAIC,EAAQD,GAAQ,CAACA,CAAI,EACvE,CAACP,EAAUQ,EAASL,CAAa,CAAC,EAGrCU,EAAU,IAAM,CACZ,MAAMC,EAAiBC,GAAyB,CACxCA,EAAM,MAAQ7B,IAA8B6B,EAAM,SAAWA,EAAM,WACnEA,EAAM,eAAA,EACNH,EAAA,EAER,EAEA,cAAO,iBAAiB,UAAWE,CAAa,EACzC,IAAM,OAAO,oBAAoB,UAAWA,CAAa,CACpE,EAAG,CAACF,CAAa,CAAC,EAIlB,MAAMI,EAAQT,EAAO,WAAa,YAE5BU,EAAeC,EACjB,KAAO,CACH,MAAAF,EACA,KAAAT,EACA,QAAAC,EACA,SAAAR,EACA,WAAAE,EACA,cAAAC,EACA,cAAAS,CAAA,GAEJ,CAACI,EAAOT,EAAMC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,GAAGG,EAAO,CACnG,CAEO,SAAS6D,GAAqB,CAAE,UAAAhE,EAAW,GAAGG,GAAsC,CACvF,OAAOoB,EAAC,OAAI,UAAWC,EAAWxB,EAAW,sBAAsB,EAAI,GAAGG,EAAO,CACrF,CAEO,SAAS8D,GAAoB,CAAE,UAAAjE,EAAW,GAAGG,GAAsC,CACtF,OACIoB,EAAC,OAAI,UAAWC,EAAW,yDAA0DxB,CAAS,EAAI,GAAGG,EAAO,CAEpH"}
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as r,jsxs as l,Fragment as p}from"react/jsx-runtime";import{Tag as d,composeRenderProps as i,TagGroup as u,TagList as c}from"react-aria-components";import{classNames as m}from"../utilities/theme.js";import{IcRemove as g}from"./icons.js";import{Button as f}from"./button.js";import"clsx";import"@icons-pack/react-simple-icons";import"react";import"class-variance-authority";import"./loader.js";const x="body-sm rounded-md inline-flex items-center gap-1 px-2 h-input-sm cursor-default select-none border";function B({items:e,children:s,renderEmptyState:a,className:n,...o}){return r(u,{selectionMode:"none",...o,children:r(c,{items:e,renderEmptyState:a,className:i(n,t=>m("flex flex-wrap gap-1",t)),children:s})})}function R({children:e,className:s,...a}){return r(d,{textValue:typeof e=="string"?e:void 0,className:i(s,(o,t)=>m(x,"bg-muted/10 text-muted",t.isDisabled&&"disabled-muted cursor-not-allowed",o)),...a,children:i(e,(o,{allowsRemoving:t})=>l(p,{children:[o,t&&r(f,{slot:"remove",size:"none",variant:"ghost",className:"rounded-full p-0.5",children:r(g,{"aria-hidden":!0,className:"size-icon"})})]}))})}export{R as Tag,B as TagGroup};
1
+ "use client";import{jsx as t,jsxs as l,Fragment as p}from"react/jsx-runtime";import{Tag as c,composeRenderProps as i,TagGroup as d,TagList as u}from"react-aria-components";import{classNames as m}from"../utilities/theme.js";import{IcRemove as f}from"./icons.js";import{Button as g}from"./button.js";import"clsx";import"@icons-pack/react-simple-icons";import"react";import"class-variance-authority";import"./loader.js";const x="body-sm rounded-sm inline-flex items-center gap-1 px-2 h-input-sm cursor-default select-none border border-stroke-primary";function B({items:e,children:s,renderEmptyState:a,className:n,...o}){return t(d,{selectionMode:"none",...o,children:t(u,{items:e,renderEmptyState:a,className:i(n,r=>m("flex flex-wrap gap-1",r)),children:s})})}function R({children:e,className:s,...a}){return t(c,{textValue:typeof e=="string"?e:void 0,className:i(s,(o,r)=>m(x,"bg-surface-secondary text-muted",r.isDisabled&&"disabled-muted cursor-not-allowed",o)),...a,children:i(e,(o,{allowsRemoving:r})=>l(p,{children:[o,r&&t(g,{slot:"remove",size:"none",variant:"ghost",className:"rounded-full p-0.5",children:t(f,{"aria-hidden":!0,className:"size-icon"})})]}))})}export{R as Tag,B as TagGroup};
2
2
  //# sourceMappingURL=tag-group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tag-group.js","sources":["../../lib/components/tag-group.tsx"],"sourcesContent":["'use client';\n\nimport {\n Tag as AriaTag,\n TagGroup as AriaTagGroup,\n TagList,\n composeRenderProps,\n type TagGroupProps as AriaTagGroupProps,\n type TagListProps,\n type TagProps as AriaTagProps,\n} from 'react-aria-components';\n\nimport { classNames } from '../utilities/theme';\nimport { IcRemove } from './icons';\nimport { Button } from './button';\n\nconst tagBase = 'body-sm rounded-md inline-flex items-center gap-1 px-2 h-input-sm cursor-default select-none border';\n\nexport interface TagGroupProps<T extends object>\n extends Omit<AriaTagGroupProps, 'children' | 'className'>,\n Pick<TagListProps<T>, 'items' | 'children' | 'renderEmptyState' | 'className'> {}\n\nexport type TagProps = AriaTagProps;\n\nexport function TagGroup<T extends object>({\n items,\n children,\n renderEmptyState,\n className,\n ...props\n}: TagGroupProps<T>) {\n return (\n <AriaTagGroup selectionMode=\"none\" {...props}>\n <TagList\n items={items}\n renderEmptyState={renderEmptyState}\n className={composeRenderProps(className, className => classNames('flex flex-wrap gap-1', className))}\n >\n {children}\n </TagList>\n </AriaTagGroup>\n );\n}\n\nexport function Tag({ children, className, ...props }: TagProps) {\n const textValue = typeof children === 'string' ? children : undefined;\n\n return (\n <AriaTag\n textValue={textValue}\n className={composeRenderProps(className, (className, renderProps) =>\n classNames(\n tagBase,\n 'bg-muted/10 text-muted',\n renderProps.isDisabled && 'disabled-muted cursor-not-allowed',\n className\n )\n )}\n {...props}\n >\n {composeRenderProps(children, (children, { allowsRemoving }) => (\n <>\n {children}\n {allowsRemoving && (\n <Button slot=\"remove\" size=\"none\" variant=\"ghost\" className=\"rounded-full p-0.5\">\n <IcRemove aria-hidden className=\"size-icon\" />\n </Button>\n )}\n </>\n ))}\n </AriaTag>\n );\n}\n"],"names":["tagBase","TagGroup","items","children","renderEmptyState","className","props","jsx","AriaTagGroup","TagList","composeRenderProps","classNames","Tag","AriaTag","renderProps","allowsRemoving","jsxs","Fragment","Button","IcRemove"],"mappings":"iaAgBA,MAAMA,EAAU,sGAQT,SAASC,EAA2B,CACvC,MAAAC,EACA,SAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,GAAGC,CACP,EAAqB,CACjB,OACIC,EAACC,EAAA,CAAa,cAAc,OAAQ,GAAGF,EACnC,SAAAC,EAACE,EAAA,CACG,MAAAP,EACA,iBAAAE,EACA,UAAWM,EAAmBL,EAAWA,GAAaM,EAAW,uBAAwBN,CAAS,CAAC,EAElG,SAAAF,CAAA,CAAA,EAET,CAER,CAEO,SAASS,EAAI,CAAE,SAAAT,EAAU,UAAAE,EAAW,GAAGC,GAAmB,CAG7D,OACIC,EAACM,EAAA,CACG,UAJU,OAAOV,GAAa,SAAWA,EAAW,OAKpD,UAAWO,EAAmBL,EAAW,CAACA,EAAWS,IACjDH,EACIX,EACA,yBACAc,EAAY,YAAc,oCAC1BT,CAAA,CACJ,EAEH,GAAGC,EAEH,WAAmBH,EAAU,CAACA,EAAU,CAAE,eAAAY,CAAA,IACvCC,EAAAC,EAAA,CACK,SAAA,CAAAd,EACAY,GACGR,EAACW,EAAA,CAAO,KAAK,SAAS,KAAK,OAAO,QAAQ,QAAQ,UAAU,qBACxD,SAAAX,EAACY,EAAA,CAAS,cAAW,GAAC,UAAU,YAAY,CAAA,CAChD,CAAA,EAER,CACH,CAAA,CAAA,CAGb"}
1
+ {"version":3,"file":"tag-group.js","sources":["../../lib/components/tag-group.tsx"],"sourcesContent":["'use client';\n\nimport {\n Tag as AriaTag,\n TagGroup as AriaTagGroup,\n TagList,\n composeRenderProps,\n type TagGroupProps as AriaTagGroupProps,\n type TagListProps,\n type TagProps as AriaTagProps,\n} from 'react-aria-components';\n\nimport { classNames } from '../utilities/theme';\nimport { IcRemove } from './icons';\nimport { Button } from './button';\n\nconst tagBase =\n 'body-sm rounded-sm inline-flex items-center gap-1 px-2 h-input-sm cursor-default select-none border border-stroke-primary';\n\nexport interface TagGroupProps<T extends object>\n extends Omit<AriaTagGroupProps, 'children' | 'className'>,\n Pick<TagListProps<T>, 'items' | 'children' | 'renderEmptyState' | 'className'> {}\n\nexport type TagProps = AriaTagProps;\n\nexport function TagGroup<T extends object>({\n items,\n children,\n renderEmptyState,\n className,\n ...props\n}: TagGroupProps<T>) {\n return (\n <AriaTagGroup selectionMode=\"none\" {...props}>\n <TagList\n items={items}\n renderEmptyState={renderEmptyState}\n className={composeRenderProps(className, className => classNames('flex flex-wrap gap-1', className))}\n >\n {children}\n </TagList>\n </AriaTagGroup>\n );\n}\n\nexport function Tag({ children, className, ...props }: TagProps) {\n const textValue = typeof children === 'string' ? children : undefined;\n\n return (\n <AriaTag\n textValue={textValue}\n className={composeRenderProps(className, (className, renderProps) =>\n classNames(\n tagBase,\n 'bg-surface-secondary text-muted',\n renderProps.isDisabled && 'disabled-muted cursor-not-allowed',\n className\n )\n )}\n {...props}\n >\n {composeRenderProps(children, (children, { allowsRemoving }) => (\n <>\n {children}\n {allowsRemoving && (\n <Button slot=\"remove\" size=\"none\" variant=\"ghost\" className=\"rounded-full p-0.5\">\n <IcRemove aria-hidden className=\"size-icon\" />\n </Button>\n )}\n </>\n ))}\n </AriaTag>\n );\n}\n"],"names":["tagBase","TagGroup","items","children","renderEmptyState","className","props","jsx","AriaTagGroup","TagList","composeRenderProps","classNames","Tag","AriaTag","renderProps","allowsRemoving","jsxs","Fragment","Button","IcRemove"],"mappings":"iaAgBA,MAAMA,EACF,4HAQG,SAASC,EAA2B,CACvC,MAAAC,EACA,SAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,GAAGC,CACP,EAAqB,CACjB,OACIC,EAACC,EAAA,CAAa,cAAc,OAAQ,GAAGF,EACnC,SAAAC,EAACE,EAAA,CACG,MAAAP,EACA,iBAAAE,EACA,UAAWM,EAAmBL,EAAWA,GAAaM,EAAW,uBAAwBN,CAAS,CAAC,EAElG,SAAAF,CAAA,CAAA,EAET,CAER,CAEO,SAASS,EAAI,CAAE,SAAAT,EAAU,UAAAE,EAAW,GAAGC,GAAmB,CAG7D,OACIC,EAACM,EAAA,CACG,UAJU,OAAOV,GAAa,SAAWA,EAAW,OAKpD,UAAWO,EAAmBL,EAAW,CAACA,EAAWS,IACjDH,EACIX,EACA,kCACAc,EAAY,YAAc,oCAC1BT,CAAA,CACJ,EAEH,GAAGC,EAEH,WAAmBH,EAAU,CAACA,EAAU,CAAE,eAAAY,CAAA,IACvCC,EAAAC,EAAA,CACK,SAAA,CAAAd,EACAY,GACGR,EAACW,EAAA,CAAO,KAAK,SAAS,KAAK,OAAO,QAAQ,QAAQ,UAAU,qBACxD,SAAAX,EAACY,EAAA,CAAS,cAAW,GAAC,UAAU,YAAY,CAAA,CAChD,CAAA,EAER,CACH,CAAA,CAAA,CAGb"}
package/lib/index.css CHANGED
@@ -87,19 +87,38 @@
87
87
  --color-discovery-900: var(--discovery-900);
88
88
  --color-discovery-950: var(--discovery-950);
89
89
 
90
- --color-foreground: var(--color-neutral-900);
91
- --color-background: var(--color-neutral-100);
92
- --color-elevation-1: var(--color-neutral-50);
93
- --color-elevation-mid: color-mix(in oklch, var(--color-background) 70%, var(--color-neutral-200) 30%);
94
-
95
- --color-primary: var(--color-primary-700);
96
- --color-primary-foreground: var(--color-elevation-1);
97
- --color-muted: var(--color-neutral-700);
98
- --color-muted-foreground: var(--color-neutral-400);
99
- --color-accent: var(--color-neutral-700);
100
- --color-accent-foreground: var(--color-elevation-1);
90
+ /* Semantic tokens from the design system (defined in tokens.css) */
91
+ --color-stroke-primary: var(--stroke-primary);
92
+ --color-stroke-secondary: var(--stroke-secondary);
93
+ --color-stroke-active: var(--stroke-active);
94
+
95
+ --color-surface-primary: var(--surface-primary);
96
+ --color-surface-secondary: var(--surface-secondary);
97
+ --color-surface-tertiary: var(--surface-tertiary);
98
+
99
+ --color-text-primary: var(--text-primary);
100
+ --color-text-secondary: var(--text-secondary);
101
+ --color-text-tertiary: var(--text-tertiary);
102
+ --color-text-white: var(--text-white);
103
+
104
+ --color-icon-primary: var(--icon-primary);
105
+ --color-icon-action: var(--icon-action);
106
+
107
+ --color-background-overlay: var(--background-overlay);
108
+
109
+ --color-foreground: var(--text-primary);
110
+ --color-background: var(--surface-secondary);
111
+ --color-elevation-1: var(--surface-primary);
112
+ --color-elevation-mid: var(--surface-tertiary);
113
+
114
+ --color-primary: var(--primary);
115
+ --color-primary-foreground: oklch(1 0 0);
116
+ --color-muted: var(--text-secondary);
117
+ --color-muted-foreground: var(--text-tertiary);
118
+ --color-accent: var(--text-secondary);
119
+ --color-accent-foreground: var(--text-white);
101
120
  --color-destructive: var(--color-destructive-700);
102
- --color-destructive-foreground: var(--color-elevation-1);
121
+ --color-destructive-foreground: oklch(1 0 0);
103
122
  --color-success: var(--color-success-700);
104
123
  --color-success-foreground: var(--color-elevation-1);
105
124
  --color-warning: var(--color-warning-700);
@@ -107,9 +126,9 @@
107
126
  --color-discovery: var(--color-discovery-700);
108
127
  --color-discovery-foreground: var(--color-elevation-1);
109
128
 
110
- --color-border: var(--color-neutral-300);
129
+ --color-border: var(--stroke-primary);
111
130
  --color-input: var(--color-border);
112
- --color-ring: var(--color-neutral-500);
131
+ --color-ring: var(--stroke-active);
113
132
 
114
133
  --color-chart-1: var(--color-primary-500);
115
134
  --color-chart-2: var(--color-primary-600);
@@ -315,7 +334,7 @@
315
334
  @apply disabled:cursor-not-allowed disabled:opacity-70 aria-disabled:cursor-not-allowed aria-disabled:opacity-70 disabled:pointer-events-none;
316
335
  }
317
336
  @utility input {
318
- @apply border border-input bg-elevation-1 px-icon py-2 body-sm placeholder:text-muted-foreground disabled-muted focus-ring;
337
+ @apply border border-input bg-elevation-1 px-icon py-2 body-sm placeholder:text-muted-foreground disabled-muted focus-ring focus-visible:border-stroke-active;
319
338
  }
320
339
 
321
340
  /* A base set of classes for elements that can be clicked */
@@ -324,7 +343,7 @@
324
343
  }
325
344
 
326
345
  @utility btn-link {
327
- @apply btn-ghost underline underline-offset-2;
346
+ @apply btn-ghost border-none underline underline-offset-2;
328
347
  }
329
348
  @utility btn-primary {
330
349
  @apply border border-primary text-primary-foreground bg-primary;
@@ -350,7 +369,7 @@
350
369
  }
351
370
 
352
371
  @utility btn-tab {
353
- @apply btn-selected truncate btn btn-ghost input-dim font-normal text-accent justify-start;
372
+ @apply btn-selected truncate btn btn-ghost border-none input-dim font-normal text-accent justify-start;
354
373
  }
355
374
  /* Dimensions for a standard input */
356
375
  @utility input-dim {
@@ -429,13 +448,6 @@
429
448
  @apply bg-background text-foreground;
430
449
  }
431
450
 
432
- @media (prefers-color-scheme: dark) {
433
- :root {
434
- --color-background: var(--color-neutral-50);
435
- --color-elevation-1: var(--color-neutral-100);
436
- }
437
- }
438
-
439
451
  .tw-prose a {
440
452
  @apply link;
441
453
  }
package/lib/tokens.css CHANGED
@@ -4,6 +4,20 @@
4
4
  */
5
5
  :root {
6
6
  --primary-hue: 240;
7
+ --primary: oklch(0.547 0.138 var(--primary-hue));
8
+ --text-primary: oklch(0.211 0.041 var(--primary-hue));
9
+ --text-secondary: oklch(0.512 0.031 var(--primary-hue));
10
+ --text-tertiary: oklch(0.598 0.029 var(--primary-hue));
11
+ --text-white: oklch(1 0 0);
12
+ --stroke-primary: oklch(0.911 0.013 var(--primary-hue));
13
+ --stroke-secondary: oklch(0.935 0.009 var(--primary-hue));
14
+ --stroke-active: oklch(0.547 0.138 var(--primary-hue));
15
+ --surface-primary: oklch(1 0 0);
16
+ --surface-secondary: oklch(0.968 0.005 var(--primary-hue));
17
+ --surface-tertiary: oklch(0.978 0.006 var(--primary-hue));
18
+ --icon-primary: oklch(0.512 0.031 var(--primary-hue));
19
+ --icon-action: oklch(0.547 0.138 var(--primary-hue));
20
+ --background-overlay: oklch(0.211 0.041 var(--primary-hue) / 0.5);
7
21
  --xprimary-50: oklch(97% 0.014 var(--primary-hue));
8
22
  --xprimary-100: oklch(93.2% 0.032 var(--primary-hue));
9
23
  --xprimary-200: oklch(88.2% 0.059 var(--primary-hue));
@@ -141,6 +155,20 @@
141
155
  }
142
156
  @media (prefers-color-scheme: dark) {
143
157
  :root {
158
+ --primary: oklch(0.547 0.138 var(--primary-hue));
159
+ --text-primary: oklch(1 0 0);
160
+ --text-secondary: oklch(0.62 0.038 var(--primary-hue));
161
+ --text-tertiary: oklch(0.62 0.038 var(--primary-hue));
162
+ --text-white: oklch(0 0 0);
163
+ --stroke-primary: oklch(0.26 0.021 var(--primary-hue));
164
+ --stroke-secondary: oklch(0.22 0.023 var(--primary-hue));
165
+ --stroke-active: oklch(0.547 0.138 var(--primary-hue));
166
+ --surface-primary: oklch(0.175 0.014 var(--primary-hue));
167
+ --surface-secondary: oklch(0.145 0.005 var(--primary-hue));
168
+ --surface-tertiary: oklch(0.21 0.016 var(--primary-hue));
169
+ --icon-primary: oklch(0.62 0.038 var(--primary-hue));
170
+ --icon-action: oklch(0.547 0.138 var(--primary-hue));
171
+ --background-overlay: oklch(0 0 0 / 0.5);
144
172
  --primary-50: var(--xprimary-950);
145
173
  --primary-100: var(--xprimary-900);
146
174
  --primary-200: var(--xprimary-800);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptlex/web-components",
3
- "version": "6.6.119",
3
+ "version": "6.6.120",
4
4
  "description": "React component library for Cryptlex web applications",
5
5
  "author": "Cryptlex",
6
6
  "type": "module",
@@ -48,7 +48,7 @@
48
48
  "*.{ts,tsx,css,scss,json}": "prettier --write"
49
49
  },
50
50
  "peerDependencies": {
51
- "@cryptlex/web-api-types": "2.164.0",
51
+ "@cryptlex/web-api-types": "2.165.0",
52
52
  "@dnd-kit/core": "6.3.1",
53
53
  "@dnd-kit/sortable": "10.0.0",
54
54
  "@dnd-kit/utilities": "3.2.2",