@agimon-ai/doompi-web-components 0.0.1-alpha.55 → 0.0.1-alpha.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.mts","names":[],"sources":["../../../../../../src/components/Dialog.tsx"],"mappings":";;;;;;;;iBAagB,SAAO,OAAO,sBAAsB,OAAgB,wBAAK,IAAA;wBASzD,cAAc,OAAO,sBAAsB,OAAgB,2BAAQ,IAAA;wBAQnE,YAAY,OAAO,sBAAsB,OAAgB,yBAAM,IAAA;iBA+B9D,2BAA2B,sBAAsB,OAAgB;;EAEhF;;wBAKc,gBAAgB,WAAW,UAAU,UAAiB,SAAS,qCAAkB,IAAA;iBAmBhF,0BAA0B;;;;;;;EAOzC;;EAEA;;wBAGc,eACd,WACA,aACA,YACA,aACG,SACF,oCAAiB,IAAA;wBAsBJ,cAAc,cAAc,SAAS,sBAAsB,OAAgB,yBAAM,IAAA;wBAUjF,oBAAoB,cAAc,SAAS,sBAAsB,OAAgB,+BAAY,IAAA;wBAU7F,aAAa,cAAc,SAAS,wCAAqB,IAAA;qBAU5D,uBAAoB;;6CAc/B;iBAEe,0BAA0B,uBAAuB,oBAAoB;wBAEtE,eAAe,WAAW,YAAY,SAAS,oCAAiB,IAAA"}
1
+ {"version":3,"file":"Dialog.d.mts","names":[],"sources":["../../../../../../src/components/Dialog.tsx"],"mappings":";;;;;;;;iBAagB,SAAO,OAAO,sBAAsB,OAAgB,wBAAK,IAAA;wBASzD,cAAc,OAAO,sBAAsB,OAAgB,2BAAQ,IAAA;wBAQnE,YAAY,OAAO,sBAAsB,OAAgB,yBAAM,IAAA;iBAyC9D,2BAA2B,sBAAsB,OAAgB;;EAEhF;;wBAKc,gBAAgB,WAAW,UAAU,UAAiB,SAAS,qCAAkB,IAAA;iBAmBhF,0BAA0B;;;;;;;EAOzC;;EAEA;;wBAGc,eACd,WACA,aACA,YACA,aACG,SACF,oCAAiB,IAAA;wBAsBJ,cAAc,cAAc,SAAS,sBAAsB,OAAgB,yBAAM,IAAA;wBAUjF,oBAAoB,cAAc,SAAS,sBAAsB,OAAgB,+BAAY,IAAA;wBAU7F,aAAa,cAAc,SAAS,wCAAqB,IAAA;qBAU5D,uBAAoB;;6CAc/B;iBAEe,0BAA0B,uBAAuB,oBAAoB;wBAEtE,eAAe,WAAW,YAAY,SAAS,oCAAiB,IAAA"}
@@ -1,2 +1,2 @@
1
- import{CloseIcon as e}from"../icons/icons.mjs";import{cn as t}from"../lib/cn.mjs";import{Button as n}from"./Button.mjs";import{Dialog as r}from"radix-ui";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{createContext as o,useContext as s}from"react";import{cva as c}from"class-variance-authority";const l=o(void 0);function u(e){let t=e.onOpenChange===void 0?void 0:t=>e.onOpenChange?.(t);return/* @__PURE__ */ i(l.Provider,{value:t,children:/* @__PURE__ */ i(r.Root,{"data-slot":`dialog`,...e,onOpenChange:t})})}function d(e){return/* @__PURE__ */ i(r.Trigger,{"data-slot":`dialog-trigger`,...e})}function f(e){return/* @__PURE__ */ i(r.Portal,{"data-slot":`dialog-portal`,...e})}function p(e){return/* @__PURE__ */ i(r.Close,{"data-slot":`dialog-close`,...e})}function m({className:e,onPointerDownCapture:n,...a}){let o=s(l);return/* @__PURE__ */ i(r.Overlay,{"data-slot":`dialog-overlay`,className:t(`fixed inset-0 z-40 bg-doom-deep/70 data-[state=open]:animate-doom-fade`,e),onPointerDownCapture:e=>{n?.(e),!(e.defaultPrevented||o===void 0)&&e.currentTarget.nextElementSibling?.querySelector(`[data-slot="select-trigger"][data-state="open"]`)!=null&&(e.stopPropagation(),o(!1))},...a})}const h={sm:`w-[360px]`,md:`w-[480px]`,lg:`w-[620px]`};function g({className:e,children:n,width:o=`md`,...s}){return/* @__PURE__ */ a(f,{children:[/* @__PURE__ */ i(m,{}),/* @__PURE__ */ i(r.Content,{"data-slot":`dialog-content`,className:t(`fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-24px)] max-w-[calc(100vw-24px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-doom-border bg-doom-panel font-mono shadow-2xl outline-none data-[state=open]:animate-doom-pop`,h[o],e),...s,children:n})]})}function _({className:o,dismissible:s=!1,closeLabel:c=`close`,children:l,...u}){return/* @__PURE__ */ a(`div`,{"data-slot":`dialog-header`,className:t(`flex min-w-0 items-center justify-between gap-3 border-b border-doom-border px-3 py-3 sm:px-4`,o),...u,children:[l,s?/* @__PURE__ */ i(r.Close,{asChild:!0,children:/* @__PURE__ */ i(n,{variant:`ghost`,size:`icon`,"aria-label":c,className:`text-doom-faint hover:text-doom-hi`,children:/* @__PURE__ */ i(e,{className:`h-3 w-3`})})}):null]})}function v({className:e,...n}){return/* @__PURE__ */ i(r.Title,{"data-slot":`dialog-title`,className:t(`text-sm font-bold tracking-wide text-doom-hi`,e),...n})}function y({className:e,...n}){return/* @__PURE__ */ i(r.Description,{"data-slot":`dialog-description`,className:t(`text-sm leading-relaxed text-doom-dim`,e),...n})}function b({className:e,...n}){return/* @__PURE__ */ i(`div`,{"data-slot":`dialog-body`,className:t(`flex min-h-0 flex-col gap-3 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4`,e),...n})}const x=c(`flex shrink-0 items-center gap-2`,{variants:{variant:{plain:`justify-end`,bar:`min-h-[34px] flex-wrap justify-between border-t border-doom-border-soft bg-doom-deep px-3 py-1.5 sm:flex-nowrap sm:px-4 sm:py-0`}},defaultVariants:{variant:`plain`}});function S({className:e,variant:n,...r}){return/* @__PURE__ */ i(`div`,{"data-slot":`dialog-footer`,className:t(x({variant:n}),e),...r})}export{u as Dialog,b as DialogBody,p as DialogClose,g as DialogContent,y as DialogDescription,S as DialogFooter,_ as DialogHeader,m as DialogOverlay,f as DialogPortal,v as DialogTitle,d as DialogTrigger,x as dialogFooterVariants};
1
+ import{CloseIcon as e}from"../icons/icons.mjs";import{cn as t}from"../lib/cn.mjs";import{Button as n}from"./Button.mjs";import{Dialog as r}from"radix-ui";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{createContext as o,useContext as s}from"react";import{cva as c}from"class-variance-authority";const l=o(void 0);function u(e){let t=e.onOpenChange===void 0?void 0:t=>e.onOpenChange?.(t);return/* @__PURE__ */ i(l.Provider,{value:t,children:/* @__PURE__ */ i(r.Root,{"data-slot":`dialog`,...e,onOpenChange:t})})}function d(e){return/* @__PURE__ */ i(r.Trigger,{"data-slot":`dialog-trigger`,...e})}function f(e){return/* @__PURE__ */ i(r.Portal,{"data-slot":`dialog-portal`,...e})}function p(e){return/* @__PURE__ */ i(r.Close,{"data-slot":`dialog-close`,...e})}function m({className:e,onPointerDownCapture:n,...a}){let o=s(l);return/* @__PURE__ */ i(r.Overlay,{"data-slot":`dialog-overlay`,className:t(`fixed inset-0 z-40 bg-doom-deep/70 data-[state=open]:animate-doom-fade`,e),onPointerDownCapture:e=>{if(n?.(e),e.defaultPrevented||o===void 0)return;let t=e.currentTarget.nextElementSibling;if(t?.querySelector(`[data-slot="select-trigger"][data-state="open"]`)==null)return;let r=t?.getBoundingClientRect();r&&e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom||(e.stopPropagation(),o(!1))},...a})}const h={sm:`w-[360px]`,md:`w-[480px]`,lg:`w-[620px]`};function g({className:e,children:n,width:o=`md`,...s}){return/* @__PURE__ */ a(f,{children:[/* @__PURE__ */ i(m,{}),/* @__PURE__ */ i(r.Content,{"data-slot":`dialog-content`,className:t(`fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-24px)] max-w-[calc(100vw-24px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-doom-border bg-doom-panel font-mono shadow-2xl outline-none data-[state=open]:animate-doom-pop`,h[o],e),...s,children:n})]})}function _({className:o,dismissible:s=!1,closeLabel:c=`close`,children:l,...u}){return/* @__PURE__ */ a(`div`,{"data-slot":`dialog-header`,className:t(`flex min-w-0 items-center justify-between gap-3 border-b border-doom-border px-3 py-3 sm:px-4`,o),...u,children:[l,s?/* @__PURE__ */ i(r.Close,{asChild:!0,children:/* @__PURE__ */ i(n,{variant:`ghost`,size:`icon`,"aria-label":c,className:`text-doom-faint hover:text-doom-hi`,children:/* @__PURE__ */ i(e,{className:`h-3 w-3`})})}):null]})}function v({className:e,...n}){return/* @__PURE__ */ i(r.Title,{"data-slot":`dialog-title`,className:t(`text-sm font-bold tracking-wide text-doom-hi`,e),...n})}function y({className:e,...n}){return/* @__PURE__ */ i(r.Description,{"data-slot":`dialog-description`,className:t(`text-sm leading-relaxed text-doom-dim`,e),...n})}function b({className:e,...n}){return/* @__PURE__ */ i(`div`,{"data-slot":`dialog-body`,className:t(`flex min-h-0 flex-col gap-3 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4`,e),...n})}const x=c(`flex shrink-0 items-center gap-2`,{variants:{variant:{plain:`justify-end`,bar:`min-h-[34px] flex-wrap justify-between border-t border-doom-border-soft bg-doom-deep px-3 py-1.5 sm:flex-nowrap sm:px-4 sm:py-0`}},defaultVariants:{variant:`plain`}});function S({className:e,variant:n,...r}){return/* @__PURE__ */ i(`div`,{"data-slot":`dialog-footer`,className:t(x({variant:n}),e),...r})}export{u as Dialog,b as DialogBody,p as DialogClose,g as DialogContent,y as DialogDescription,S as DialogFooter,_ as DialogHeader,m as DialogOverlay,f as DialogPortal,v as DialogTitle,d as DialogTrigger,x as dialogFooterVariants};
2
2
  //# sourceMappingURL=Dialog.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.mjs","names":["Dialog","DialogPrimitive"],"sources":["../../../../../../src/components/Dialog.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { createContext, type ComponentProps, useContext } from 'react';\n\nimport { CloseIcon } from '../icons/icons';\nimport { cn } from '../lib/cn';\nimport { Button } from './Button';\n\nconst DialogOpenChangeContext = createContext<((open: boolean) => void) | undefined>(undefined);\n/**\n * shadcn's Dialog on Radix: focus trap, Escape, outside click, scroll lock,\n * and focus restored to the trigger on close. The frame is the Doom panel.\n */\nexport function Dialog(props: ComponentProps<typeof DialogPrimitive.Root>) {\n const onOpenChange = props.onOpenChange === undefined ? undefined : (open: boolean) => props.onOpenChange?.(open);\n return (\n <DialogOpenChangeContext.Provider value={onOpenChange}>\n <DialogPrimitive.Root data-slot=\"dialog\" {...props} onOpenChange={onOpenChange} />\n </DialogOpenChangeContext.Provider>\n );\n}\n\nexport function DialogTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nexport function DialogPortal(props: ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nexport function DialogClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nexport function DialogOverlay({\n className,\n onPointerDownCapture,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Overlay>) {\n const onOpenChange = useContext(DialogOpenChangeContext);\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn('fixed inset-0 z-40 bg-doom-deep/70 data-[state=open]:animate-doom-fade', className)}\n onPointerDownCapture={(event) => {\n onPointerDownCapture?.(event);\n if (event.defaultPrevented || onOpenChange === undefined) return;\n const dialogContent = event.currentTarget.nextElementSibling;\n const openSelectTrigger = dialogContent?.querySelector('[data-slot=\"select-trigger\"][data-state=\"open\"]');\n if (openSelectTrigger === null || openSelectTrigger === undefined) return;\n\n // Radix's parent outside listener can lag one render behind a nested\n // modal Select. Own this backdrop press so the complete stack closes.\n event.stopPropagation();\n onOpenChange(false);\n }}\n {...props}\n />\n );\n}\n\nexport interface DialogContentProps extends ComponentProps<typeof DialogPrimitive.Content> {\n /** Width preset; `className` may still override. */\n width?: 'sm' | 'md' | 'lg';\n}\n\nconst CONTENT_WIDTH = { sm: 'w-[360px]', md: 'w-[480px]', lg: 'w-[620px]' } as const;\n\nexport function DialogContent({ className, children, width = 'md', ...props }: DialogContentProps) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-24px)] max-w-[calc(100vw-24px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-doom-border bg-doom-panel font-mono shadow-2xl outline-none data-[state=open]:animate-doom-pop',\n CONTENT_WIDTH[width],\n className,\n )}\n {...props}\n >\n {children}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nexport interface DialogHeaderProps extends ComponentProps<'div'> {\n /**\n * Show the close control at the right of the strip. Off by default: most\n * headers already put something there (a spinner, a method label) and every\n * dialog closes on Escape, so an X that fights the existing content is worse\n * than none. Turn it on for a dialog whose only way out is the mouse.\n */\n dismissible?: boolean;\n /** What the close control announces. */\n closeLabel?: string;\n}\n\nexport function DialogHeader({\n className,\n dismissible = false,\n closeLabel = 'close',\n children,\n ...props\n}: DialogHeaderProps) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\n 'flex min-w-0 items-center justify-between gap-3 border-b border-doom-border px-3 py-3 sm:px-4',\n className,\n )}\n {...props}\n >\n {children}\n {dismissible ? (\n <DialogPrimitive.Close asChild>\n <Button variant=\"ghost\" size=\"icon\" aria-label={closeLabel} className=\"text-doom-faint hover:text-doom-hi\">\n <CloseIcon className=\"h-3 w-3\" />\n </Button>\n </DialogPrimitive.Close>\n ) : null}\n </div>\n );\n}\n\nexport function DialogTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-sm font-bold tracking-wide text-doom-hi', className)}\n {...props}\n />\n );\n}\n\nexport function DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-sm leading-relaxed text-doom-dim', className)}\n {...props}\n />\n );\n}\n\nexport function DialogBody({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-body\"\n className={cn('flex min-h-0 flex-col gap-3 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4', className)}\n {...props}\n />\n );\n}\n\nexport const dialogFooterVariants = cva('flex shrink-0 items-center gap-2', {\n variants: {\n variant: {\n /** Buttons alone, sitting inside the body's padding. */\n plain: 'justify-end',\n /**\n * The full-width strip: a hint on the left, the buttons on the right,\n * recessed and ruled off from the body. The same shape PopoverFooter\n * draws, because a dialog and a popover promise their keys the same way.\n */\n bar: 'min-h-[34px] flex-wrap justify-between border-t border-doom-border-soft bg-doom-deep px-3 py-1.5 sm:flex-nowrap sm:px-4 sm:py-0',\n },\n },\n defaultVariants: { variant: 'plain' },\n});\n\nexport interface DialogFooterProps extends ComponentProps<'div'>, VariantProps<typeof dialogFooterVariants> {}\n\nexport function DialogFooter({ className, variant, ...props }: DialogFooterProps) {\n return <div data-slot=\"dialog-footer\" className={cn(dialogFooterVariants({ variant }), className)} {...props} />;\n}\n"],"mappings":"iTAQA,MAAM,EAA0B,EAAqD,IAAA,EAAS,EAK9F,SAAgBA,EAAO,EAAoD,CACzE,IAAM,EAAe,EAAM,eAAiB,IAAA,GAAY,IAAA,GAAa,GAAkB,EAAM,eAAe,CAAI,EAChH,MACE,kBAAC,EAAwB,SAAzB,CAAkC,MAAO,EACvC,SAAA,kBAACC,EAAgB,KAAjB,CAAsB,YAAU,SAAS,GAAI,EAAqB,cAAe,CAAA,CACjD,CAAA,CAEtC,CAEA,SAAgB,EAAc,EAAuD,CACnF,MAAO,kBAACA,EAAgB,QAAjB,CAAyB,YAAU,iBAAiB,GAAI,CAAQ,CAAA,CACzE,CAEA,SAAgB,EAAa,EAAsD,CACjF,MAAO,kBAACA,EAAgB,OAAjB,CAA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GAAuD,CACjG,MACE,kBAACA,EAAgB,MAAjB,CACE,YAAU,eACV,UAAW,EAAG,+CAAgD,CAAS,EACvE,GAAI,CACL,CAAA,CAEL,CAEA,SAAgB,EAAkB,CAAE,YAAW,GAAG,GAA6D,CAC7G,MACE,kBAACA,EAAgB,YAAjB,CACE,YAAU,qBACV,UAAW,EAAG,wCAAyC,CAAS,EAChE,GAAI,CACL,CAAA,CAEL,CAEA,SAAgB,EAAW,CAAE,YAAW,GAAG,GAAgC,CACzE,MACE,kBAAC,MAAD,CACE,YAAU,cACV,UAAW,EAAG,wEAAyE,CAAS,EAChG,GAAI,CACL,CAAA,CAEL,CAEA,MAAa,EAAuB,EAAI,mCAAoC,CAC1E,SAAU,CACR,QAAS,CAEP,MAAO,cAMP,IAAK,iIACP,CACF,EACA,gBAAiB,CAAE,QAAS,OAAQ,CACtC,CAAC,EAID,SAAgB,EAAa,CAAE,YAAW,UAAS,GAAG,GAA4B,CAChF,MAAO,kBAAC,MAAD,CAAK,YAAU,gBAAgB,UAAW,EAAG,EAAqB,CAAE,SAAQ,CAAC,EAAG,CAAS,EAAG,GAAI,CAAQ,CAAA,CACjH"}
1
+ {"version":3,"file":"Dialog.mjs","names":["Dialog","DialogPrimitive"],"sources":["../../../../../../src/components/Dialog.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { createContext, type ComponentProps, useContext } from 'react';\n\nimport { CloseIcon } from '../icons/icons';\nimport { cn } from '../lib/cn';\nimport { Button } from './Button';\n\nconst DialogOpenChangeContext = createContext<((open: boolean) => void) | undefined>(undefined);\n/**\n * shadcn's Dialog on Radix: focus trap, Escape, outside click, scroll lock,\n * and focus restored to the trigger on close. The frame is the Doom panel.\n */\nexport function Dialog(props: ComponentProps<typeof DialogPrimitive.Root>) {\n const onOpenChange = props.onOpenChange === undefined ? undefined : (open: boolean) => props.onOpenChange?.(open);\n return (\n <DialogOpenChangeContext.Provider value={onOpenChange}>\n <DialogPrimitive.Root data-slot=\"dialog\" {...props} onOpenChange={onOpenChange} />\n </DialogOpenChangeContext.Provider>\n );\n}\n\nexport function DialogTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nexport function DialogPortal(props: ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nexport function DialogClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nexport function DialogOverlay({\n className,\n onPointerDownCapture,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Overlay>) {\n const onOpenChange = useContext(DialogOpenChangeContext);\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn('fixed inset-0 z-40 bg-doom-deep/70 data-[state=open]:animate-doom-fade', className)}\n onPointerDownCapture={(event) => {\n onPointerDownCapture?.(event);\n if (event.defaultPrevented || onOpenChange === undefined) return;\n const dialogContent = event.currentTarget.nextElementSibling;\n const openSelectTrigger = dialogContent?.querySelector('[data-slot=\"select-trigger\"][data-state=\"open\"]');\n if (openSelectTrigger === null || openSelectTrigger === undefined) return;\n // An open Select disables pointer events on the dialog; an inside press falls through to this overlay.\n const bounds = dialogContent?.getBoundingClientRect();\n if (\n bounds &&\n event.clientX >= bounds.left &&\n event.clientX <= bounds.right &&\n event.clientY >= bounds.top &&\n event.clientY <= bounds.bottom\n )\n return;\n\n // Radix's parent outside listener can lag one render behind a nested\n // modal Select. Own this backdrop press so the complete stack closes.\n event.stopPropagation();\n onOpenChange(false);\n }}\n {...props}\n />\n );\n}\n\nexport interface DialogContentProps extends ComponentProps<typeof DialogPrimitive.Content> {\n /** Width preset; `className` may still override. */\n width?: 'sm' | 'md' | 'lg';\n}\n\nconst CONTENT_WIDTH = { sm: 'w-[360px]', md: 'w-[480px]', lg: 'w-[620px]' } as const;\n\nexport function DialogContent({ className, children, width = 'md', ...props }: DialogContentProps) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-24px)] max-w-[calc(100vw-24px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-doom-border bg-doom-panel font-mono shadow-2xl outline-none data-[state=open]:animate-doom-pop',\n CONTENT_WIDTH[width],\n className,\n )}\n {...props}\n >\n {children}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nexport interface DialogHeaderProps extends ComponentProps<'div'> {\n /**\n * Show the close control at the right of the strip. Off by default: most\n * headers already put something there (a spinner, a method label) and every\n * dialog closes on Escape, so an X that fights the existing content is worse\n * than none. Turn it on for a dialog whose only way out is the mouse.\n */\n dismissible?: boolean;\n /** What the close control announces. */\n closeLabel?: string;\n}\n\nexport function DialogHeader({\n className,\n dismissible = false,\n closeLabel = 'close',\n children,\n ...props\n}: DialogHeaderProps) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\n 'flex min-w-0 items-center justify-between gap-3 border-b border-doom-border px-3 py-3 sm:px-4',\n className,\n )}\n {...props}\n >\n {children}\n {dismissible ? (\n <DialogPrimitive.Close asChild>\n <Button variant=\"ghost\" size=\"icon\" aria-label={closeLabel} className=\"text-doom-faint hover:text-doom-hi\">\n <CloseIcon className=\"h-3 w-3\" />\n </Button>\n </DialogPrimitive.Close>\n ) : null}\n </div>\n );\n}\n\nexport function DialogTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-sm font-bold tracking-wide text-doom-hi', className)}\n {...props}\n />\n );\n}\n\nexport function DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-sm leading-relaxed text-doom-dim', className)}\n {...props}\n />\n );\n}\n\nexport function DialogBody({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-body\"\n className={cn('flex min-h-0 flex-col gap-3 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4', className)}\n {...props}\n />\n );\n}\n\nexport const dialogFooterVariants = cva('flex shrink-0 items-center gap-2', {\n variants: {\n variant: {\n /** Buttons alone, sitting inside the body's padding. */\n plain: 'justify-end',\n /**\n * The full-width strip: a hint on the left, the buttons on the right,\n * recessed and ruled off from the body. The same shape PopoverFooter\n * draws, because a dialog and a popover promise their keys the same way.\n */\n bar: 'min-h-[34px] flex-wrap justify-between border-t border-doom-border-soft bg-doom-deep px-3 py-1.5 sm:flex-nowrap sm:px-4 sm:py-0',\n },\n },\n defaultVariants: { variant: 'plain' },\n});\n\nexport interface DialogFooterProps extends ComponentProps<'div'>, VariantProps<typeof dialogFooterVariants> {}\n\nexport function DialogFooter({ className, variant, ...props }: DialogFooterProps) {\n return <div data-slot=\"dialog-footer\" className={cn(dialogFooterVariants({ variant }), className)} {...props} />;\n}\n"],"mappings":"iTAQA,MAAM,EAA0B,EAAqD,IAAA,EAAS,EAK9F,SAAgBA,EAAO,EAAoD,CACzE,IAAM,EAAe,EAAM,eAAiB,IAAA,GAAY,IAAA,GAAa,GAAkB,EAAM,eAAe,CAAI,EAChH,MACE,kBAAC,EAAwB,SAAzB,CAAkC,MAAO,EACvC,SAAA,kBAACC,EAAgB,KAAjB,CAAsB,YAAU,SAAS,GAAI,EAAqB,cAAe,CAAA,CACjD,CAAA,CAEtC,CAEA,SAAgB,EAAc,EAAuD,CACnF,MAAO,kBAACA,EAAgB,QAAjB,CAAyB,YAAU,iBAAiB,GAAI,CAAQ,CAAA,CACzE,CAEA,SAAgB,EAAa,EAAsD,CACjF,MAAO,kBAACA,EAAgB,OAAjB,CAAwB,YAAU,gBAAgB,GAAI,CAAQ,CAAA,CACvE,CAEA,SAAgB,EAAY,EAAqD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kBAAC,EAAD,CAAW,UAAU,SAAW,CAAA,CAC1B,CAAA,CACa,CAAA,EACrB,IACD,GAET,CAEA,SAAgB,EAAY,CAAE,YAAW,GAAG,GAAuD,CACjG,MACE,kBAACA,EAAgB,MAAjB,CACE,YAAU,eACV,UAAW,EAAG,+CAAgD,CAAS,EACvE,GAAI,CACL,CAAA,CAEL,CAEA,SAAgB,EAAkB,CAAE,YAAW,GAAG,GAA6D,CAC7G,MACE,kBAACA,EAAgB,YAAjB,CACE,YAAU,qBACV,UAAW,EAAG,wCAAyC,CAAS,EAChE,GAAI,CACL,CAAA,CAEL,CAEA,SAAgB,EAAW,CAAE,YAAW,GAAG,GAAgC,CACzE,MACE,kBAAC,MAAD,CACE,YAAU,cACV,UAAW,EAAG,wEAAyE,CAAS,EAChG,GAAI,CACL,CAAA,CAEL,CAEA,MAAa,EAAuB,EAAI,mCAAoC,CAC1E,SAAU,CACR,QAAS,CAEP,MAAO,cAMP,IAAK,iIACP,CACF,EACA,gBAAiB,CAAE,QAAS,OAAQ,CACtC,CAAC,EAID,SAAgB,EAAa,CAAE,YAAW,UAAS,GAAG,GAA4B,CAChF,MAAO,kBAAC,MAAD,CAAK,YAAU,gBAAgB,UAAW,EAAG,EAAqB,CAAE,SAAQ,CAAC,EAAG,CAAS,EAAG,GAAI,CAAQ,CAAA,CACjH"}
@@ -1,2 +1,2 @@
1
- require("../icons/icons.cjs");const e=require("../lib/cn.cjs"),t=require("./Button.cjs");let n=require("radix-ui"),r=require("react/jsx-runtime"),i=require("react"),a=require("class-variance-authority"),o=require("lucide-react");const s=(0,i.createContext)(void 0);function c(e){let t=e.onOpenChange===void 0?void 0:t=>e.onOpenChange?.(t);return/* @__PURE__ */ (0,r.jsx)(s.Provider,{value:t,children:/* @__PURE__ */ (0,r.jsx)(n.Dialog.Root,{"data-slot":`dialog`,...e,onOpenChange:t})})}function l(e){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Trigger,{"data-slot":`dialog-trigger`,...e})}function u(e){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Portal,{"data-slot":`dialog-portal`,...e})}function d(e){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Close,{"data-slot":`dialog-close`,...e})}function f({className:t,onPointerDownCapture:a,...o}){let c=(0,i.useContext)(s);return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:e.cn(`fixed inset-0 z-40 bg-doom-deep/70 data-[state=open]:animate-doom-fade`,t),onPointerDownCapture:e=>{a?.(e),!(e.defaultPrevented||c===void 0)&&e.currentTarget.nextElementSibling?.querySelector(`[data-slot="select-trigger"][data-state="open"]`)!=null&&(e.stopPropagation(),c(!1))},...o})}const p={sm:`w-[360px]`,md:`w-[480px]`,lg:`w-[620px]`};function m({className:t,children:i,width:a=`md`,...o}){return/* @__PURE__ */ (0,r.jsxs)(u,{children:[/* @__PURE__ */ (0,r.jsx)(f,{}),/* @__PURE__ */ (0,r.jsx)(n.Dialog.Content,{"data-slot":`dialog-content`,className:e.cn(`fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-24px)] max-w-[calc(100vw-24px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-doom-border bg-doom-panel font-mono shadow-2xl outline-none data-[state=open]:animate-doom-pop`,p[a],t),...o,children:i})]})}function h({className:i,dismissible:a=!1,closeLabel:s=`close`,children:c,...l}){return/* @__PURE__ */ (0,r.jsxs)(`div`,{"data-slot":`dialog-header`,className:e.cn(`flex min-w-0 items-center justify-between gap-3 border-b border-doom-border px-3 py-3 sm:px-4`,i),...l,children:[c,a?/* @__PURE__ */ (0,r.jsx)(n.Dialog.Close,{asChild:!0,children:/* @__PURE__ */ (0,r.jsx)(t.Button,{variant:`ghost`,size:`icon`,"aria-label":s,className:`text-doom-faint hover:text-doom-hi`,children:/* @__PURE__ */ (0,r.jsx)(o.X,{className:`h-3 w-3`})})}):null]})}function g({className:t,...i}){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Title,{"data-slot":`dialog-title`,className:e.cn(`text-sm font-bold tracking-wide text-doom-hi`,t),...i})}function _({className:t,...i}){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Description,{"data-slot":`dialog-description`,className:e.cn(`text-sm leading-relaxed text-doom-dim`,t),...i})}function v({className:t,...n}){return/* @__PURE__ */ (0,r.jsx)(`div`,{"data-slot":`dialog-body`,className:e.cn(`flex min-h-0 flex-col gap-3 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4`,t),...n})}const y=(0,a.cva)(`flex shrink-0 items-center gap-2`,{variants:{variant:{plain:`justify-end`,bar:`min-h-[34px] flex-wrap justify-between border-t border-doom-border-soft bg-doom-deep px-3 py-1.5 sm:flex-nowrap sm:px-4 sm:py-0`}},defaultVariants:{variant:`plain`}});function b({className:t,variant:n,...i}){return/* @__PURE__ */ (0,r.jsx)(`div`,{"data-slot":`dialog-footer`,className:e.cn(y({variant:n}),t),...i})}exports.Dialog=c,exports.DialogBody=v,exports.DialogClose=d,exports.DialogContent=m,exports.DialogDescription=_,exports.DialogFooter=b,exports.DialogHeader=h,exports.DialogOverlay=f,exports.DialogPortal=u,exports.DialogTitle=g,exports.DialogTrigger=l,exports.dialogFooterVariants=y;
1
+ require("../icons/icons.cjs");const e=require("../lib/cn.cjs"),t=require("./Button.cjs");let n=require("radix-ui"),r=require("react/jsx-runtime"),i=require("react"),a=require("class-variance-authority"),o=require("lucide-react");const s=(0,i.createContext)(void 0);function c(e){let t=e.onOpenChange===void 0?void 0:t=>e.onOpenChange?.(t);return/* @__PURE__ */ (0,r.jsx)(s.Provider,{value:t,children:/* @__PURE__ */ (0,r.jsx)(n.Dialog.Root,{"data-slot":`dialog`,...e,onOpenChange:t})})}function l(e){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Trigger,{"data-slot":`dialog-trigger`,...e})}function u(e){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Portal,{"data-slot":`dialog-portal`,...e})}function d(e){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Close,{"data-slot":`dialog-close`,...e})}function f({className:t,onPointerDownCapture:a,...o}){let c=(0,i.useContext)(s);return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:e.cn(`fixed inset-0 z-40 bg-doom-deep/70 data-[state=open]:animate-doom-fade`,t),onPointerDownCapture:e=>{if(a?.(e),e.defaultPrevented||c===void 0)return;let t=e.currentTarget.nextElementSibling;if(t?.querySelector(`[data-slot="select-trigger"][data-state="open"]`)==null)return;let n=t?.getBoundingClientRect();n&&e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom||(e.stopPropagation(),c(!1))},...o})}const p={sm:`w-[360px]`,md:`w-[480px]`,lg:`w-[620px]`};function m({className:t,children:i,width:a=`md`,...o}){return/* @__PURE__ */ (0,r.jsxs)(u,{children:[/* @__PURE__ */ (0,r.jsx)(f,{}),/* @__PURE__ */ (0,r.jsx)(n.Dialog.Content,{"data-slot":`dialog-content`,className:e.cn(`fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-24px)] max-w-[calc(100vw-24px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-doom-border bg-doom-panel font-mono shadow-2xl outline-none data-[state=open]:animate-doom-pop`,p[a],t),...o,children:i})]})}function h({className:i,dismissible:a=!1,closeLabel:s=`close`,children:c,...l}){return/* @__PURE__ */ (0,r.jsxs)(`div`,{"data-slot":`dialog-header`,className:e.cn(`flex min-w-0 items-center justify-between gap-3 border-b border-doom-border px-3 py-3 sm:px-4`,i),...l,children:[c,a?/* @__PURE__ */ (0,r.jsx)(n.Dialog.Close,{asChild:!0,children:/* @__PURE__ */ (0,r.jsx)(t.Button,{variant:`ghost`,size:`icon`,"aria-label":s,className:`text-doom-faint hover:text-doom-hi`,children:/* @__PURE__ */ (0,r.jsx)(o.X,{className:`h-3 w-3`})})}):null]})}function g({className:t,...i}){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Title,{"data-slot":`dialog-title`,className:e.cn(`text-sm font-bold tracking-wide text-doom-hi`,t),...i})}function _({className:t,...i}){return/* @__PURE__ */ (0,r.jsx)(n.Dialog.Description,{"data-slot":`dialog-description`,className:e.cn(`text-sm leading-relaxed text-doom-dim`,t),...i})}function v({className:t,...n}){return/* @__PURE__ */ (0,r.jsx)(`div`,{"data-slot":`dialog-body`,className:e.cn(`flex min-h-0 flex-col gap-3 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4`,t),...n})}const y=(0,a.cva)(`flex shrink-0 items-center gap-2`,{variants:{variant:{plain:`justify-end`,bar:`min-h-[34px] flex-wrap justify-between border-t border-doom-border-soft bg-doom-deep px-3 py-1.5 sm:flex-nowrap sm:px-4 sm:py-0`}},defaultVariants:{variant:`plain`}});function b({className:t,variant:n,...i}){return/* @__PURE__ */ (0,r.jsx)(`div`,{"data-slot":`dialog-footer`,className:e.cn(y({variant:n}),t),...i})}exports.Dialog=c,exports.DialogBody=v,exports.DialogClose=d,exports.DialogContent=m,exports.DialogDescription=_,exports.DialogFooter=b,exports.DialogHeader=h,exports.DialogOverlay=f,exports.DialogPortal=u,exports.DialogTitle=g,exports.DialogTrigger=l,exports.dialogFooterVariants=y;
2
2
  //# sourceMappingURL=Dialog.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.cjs","names":["createContext","DialogPrimitive","useContext","cn","Button","CloseIcon","cva"],"sources":["../../../src/components/Dialog.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { createContext, type ComponentProps, useContext } from 'react';\n\nimport { CloseIcon } from '../icons/icons';\nimport { cn } from '../lib/cn';\nimport { Button } from './Button';\n\nconst DialogOpenChangeContext = createContext<((open: boolean) => void) | undefined>(undefined);\n/**\n * shadcn's Dialog on Radix: focus trap, Escape, outside click, scroll lock,\n * and focus restored to the trigger on close. The frame is the Doom panel.\n */\nexport function Dialog(props: ComponentProps<typeof DialogPrimitive.Root>) {\n const onOpenChange = props.onOpenChange === undefined ? undefined : (open: boolean) => props.onOpenChange?.(open);\n return (\n <DialogOpenChangeContext.Provider value={onOpenChange}>\n <DialogPrimitive.Root data-slot=\"dialog\" {...props} onOpenChange={onOpenChange} />\n </DialogOpenChangeContext.Provider>\n );\n}\n\nexport function DialogTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nexport function DialogPortal(props: ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nexport function DialogClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nexport function DialogOverlay({\n className,\n onPointerDownCapture,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Overlay>) {\n const onOpenChange = useContext(DialogOpenChangeContext);\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn('fixed inset-0 z-40 bg-doom-deep/70 data-[state=open]:animate-doom-fade', className)}\n onPointerDownCapture={(event) => {\n onPointerDownCapture?.(event);\n if (event.defaultPrevented || onOpenChange === undefined) return;\n const dialogContent = event.currentTarget.nextElementSibling;\n const openSelectTrigger = dialogContent?.querySelector('[data-slot=\"select-trigger\"][data-state=\"open\"]');\n if (openSelectTrigger === null || openSelectTrigger === undefined) return;\n\n // Radix's parent outside listener can lag one render behind a nested\n // modal Select. Own this backdrop press so the complete stack closes.\n event.stopPropagation();\n onOpenChange(false);\n }}\n {...props}\n />\n );\n}\n\nexport interface DialogContentProps extends ComponentProps<typeof DialogPrimitive.Content> {\n /** Width preset; `className` may still override. */\n width?: 'sm' | 'md' | 'lg';\n}\n\nconst CONTENT_WIDTH = { sm: 'w-[360px]', md: 'w-[480px]', lg: 'w-[620px]' } as const;\n\nexport function DialogContent({ className, children, width = 'md', ...props }: DialogContentProps) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-24px)] max-w-[calc(100vw-24px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-doom-border bg-doom-panel font-mono shadow-2xl outline-none data-[state=open]:animate-doom-pop',\n CONTENT_WIDTH[width],\n className,\n )}\n {...props}\n >\n {children}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nexport interface DialogHeaderProps extends ComponentProps<'div'> {\n /**\n * Show the close control at the right of the strip. Off by default: most\n * headers already put something there (a spinner, a method label) and every\n * dialog closes on Escape, so an X that fights the existing content is worse\n * than none. Turn it on for a dialog whose only way out is the mouse.\n */\n dismissible?: boolean;\n /** What the close control announces. */\n closeLabel?: string;\n}\n\nexport function DialogHeader({\n className,\n dismissible = false,\n closeLabel = 'close',\n children,\n ...props\n}: DialogHeaderProps) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\n 'flex min-w-0 items-center justify-between gap-3 border-b border-doom-border px-3 py-3 sm:px-4',\n className,\n )}\n {...props}\n >\n {children}\n {dismissible ? (\n <DialogPrimitive.Close asChild>\n <Button variant=\"ghost\" size=\"icon\" aria-label={closeLabel} className=\"text-doom-faint hover:text-doom-hi\">\n <CloseIcon className=\"h-3 w-3\" />\n </Button>\n </DialogPrimitive.Close>\n ) : null}\n </div>\n );\n}\n\nexport function DialogTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-sm font-bold tracking-wide text-doom-hi', className)}\n {...props}\n />\n );\n}\n\nexport function DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-sm leading-relaxed text-doom-dim', className)}\n {...props}\n />\n );\n}\n\nexport function DialogBody({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-body\"\n className={cn('flex min-h-0 flex-col gap-3 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4', className)}\n {...props}\n />\n );\n}\n\nexport const dialogFooterVariants = cva('flex shrink-0 items-center gap-2', {\n variants: {\n variant: {\n /** Buttons alone, sitting inside the body's padding. */\n plain: 'justify-end',\n /**\n * The full-width strip: a hint on the left, the buttons on the right,\n * recessed and ruled off from the body. The same shape PopoverFooter\n * draws, because a dialog and a popover promise their keys the same way.\n */\n bar: 'min-h-[34px] flex-wrap justify-between border-t border-doom-border-soft bg-doom-deep px-3 py-1.5 sm:flex-nowrap sm:px-4 sm:py-0',\n },\n },\n defaultVariants: { variant: 'plain' },\n});\n\nexport interface DialogFooterProps extends ComponentProps<'div'>, VariantProps<typeof dialogFooterVariants> {}\n\nexport function DialogFooter({ className, variant, ...props }: DialogFooterProps) {\n return <div data-slot=\"dialog-footer\" className={cn(dialogFooterVariants({ variant }), className)} {...props} />;\n}\n"],"mappings":"qOAQA,MAAM,GAAA,EAA0BA,EAAAA,cAAAA,CAAqD,IAAA,EAAS,EAK9F,SAAgB,EAAO,EAAoD,CACzE,IAAM,EAAe,EAAM,eAAiB,IAAA,GAAY,IAAA,GAAa,GAAkB,EAAM,eAAe,CAAI,EAChH,MACE,iBAAA,EAAA,EAAA,IAAA,CAAC,EAAwB,SAAzB,CAAkC,MAAO,EACvC,SAAA,iBAAA,EAAA,EAAA,IAAA,CAACC,EAAAA,OAAgB,KAAjB,CAAsB,YAAU,SAAS,GAAI,EAAqB,cAAe,CAAA,CACjD,CAAA,CAEtC,CAEA,SAAgB,EAAc,EAAuD,CACnF,MAAO,iBAAA,EAAA,EAAA,IAAA,CAACA,EAAAA,OAAgB,QAAjB,CAAyB,YAAU,iBAAiB,GAAI,CAAQ,CAAA,CACzE,CAEA,SAAgB,EAAa,EAAsD,CACjF,MAAO,iBAAA,EAAA,EAAA,IAAA,CAACA,EA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Dialog.cjs","names":["createContext","DialogPrimitive","useContext","cn","Button","CloseIcon","cva"],"sources":["../../../src/components/Dialog.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { createContext, type ComponentProps, useContext } from 'react';\n\nimport { CloseIcon } from '../icons/icons';\nimport { cn } from '../lib/cn';\nimport { Button } from './Button';\n\nconst DialogOpenChangeContext = createContext<((open: boolean) => void) | undefined>(undefined);\n/**\n * shadcn's Dialog on Radix: focus trap, Escape, outside click, scroll lock,\n * and focus restored to the trigger on close. The frame is the Doom panel.\n */\nexport function Dialog(props: ComponentProps<typeof DialogPrimitive.Root>) {\n const onOpenChange = props.onOpenChange === undefined ? undefined : (open: boolean) => props.onOpenChange?.(open);\n return (\n <DialogOpenChangeContext.Provider value={onOpenChange}>\n <DialogPrimitive.Root data-slot=\"dialog\" {...props} onOpenChange={onOpenChange} />\n </DialogOpenChangeContext.Provider>\n );\n}\n\nexport function DialogTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nexport function DialogPortal(props: ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nexport function DialogClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nexport function DialogOverlay({\n className,\n onPointerDownCapture,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Overlay>) {\n const onOpenChange = useContext(DialogOpenChangeContext);\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn('fixed inset-0 z-40 bg-doom-deep/70 data-[state=open]:animate-doom-fade', className)}\n onPointerDownCapture={(event) => {\n onPointerDownCapture?.(event);\n if (event.defaultPrevented || onOpenChange === undefined) return;\n const dialogContent = event.currentTarget.nextElementSibling;\n const openSelectTrigger = dialogContent?.querySelector('[data-slot=\"select-trigger\"][data-state=\"open\"]');\n if (openSelectTrigger === null || openSelectTrigger === undefined) return;\n // An open Select disables pointer events on the dialog; an inside press falls through to this overlay.\n const bounds = dialogContent?.getBoundingClientRect();\n if (\n bounds &&\n event.clientX >= bounds.left &&\n event.clientX <= bounds.right &&\n event.clientY >= bounds.top &&\n event.clientY <= bounds.bottom\n )\n return;\n\n // Radix's parent outside listener can lag one render behind a nested\n // modal Select. Own this backdrop press so the complete stack closes.\n event.stopPropagation();\n onOpenChange(false);\n }}\n {...props}\n />\n );\n}\n\nexport interface DialogContentProps extends ComponentProps<typeof DialogPrimitive.Content> {\n /** Width preset; `className` may still override. */\n width?: 'sm' | 'md' | 'lg';\n}\n\nconst CONTENT_WIDTH = { sm: 'w-[360px]', md: 'w-[480px]', lg: 'w-[620px]' } as const;\n\nexport function DialogContent({ className, children, width = 'md', ...props }: DialogContentProps) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-24px)] max-w-[calc(100vw-24px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-doom-border bg-doom-panel font-mono shadow-2xl outline-none data-[state=open]:animate-doom-pop',\n CONTENT_WIDTH[width],\n className,\n )}\n {...props}\n >\n {children}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nexport interface DialogHeaderProps extends ComponentProps<'div'> {\n /**\n * Show the close control at the right of the strip. Off by default: most\n * headers already put something there (a spinner, a method label) and every\n * dialog closes on Escape, so an X that fights the existing content is worse\n * than none. Turn it on for a dialog whose only way out is the mouse.\n */\n dismissible?: boolean;\n /** What the close control announces. */\n closeLabel?: string;\n}\n\nexport function DialogHeader({\n className,\n dismissible = false,\n closeLabel = 'close',\n children,\n ...props\n}: DialogHeaderProps) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\n 'flex min-w-0 items-center justify-between gap-3 border-b border-doom-border px-3 py-3 sm:px-4',\n className,\n )}\n {...props}\n >\n {children}\n {dismissible ? (\n <DialogPrimitive.Close asChild>\n <Button variant=\"ghost\" size=\"icon\" aria-label={closeLabel} className=\"text-doom-faint hover:text-doom-hi\">\n <CloseIcon className=\"h-3 w-3\" />\n </Button>\n </DialogPrimitive.Close>\n ) : null}\n </div>\n );\n}\n\nexport function DialogTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-sm font-bold tracking-wide text-doom-hi', className)}\n {...props}\n />\n );\n}\n\nexport function DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-sm leading-relaxed text-doom-dim', className)}\n {...props}\n />\n );\n}\n\nexport function DialogBody({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-body\"\n className={cn('flex min-h-0 flex-col gap-3 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4', className)}\n {...props}\n />\n );\n}\n\nexport const dialogFooterVariants = cva('flex shrink-0 items-center gap-2', {\n variants: {\n variant: {\n /** Buttons alone, sitting inside the body's padding. */\n plain: 'justify-end',\n /**\n * The full-width strip: a hint on the left, the buttons on the right,\n * recessed and ruled off from the body. The same shape PopoverFooter\n * draws, because a dialog and a popover promise their keys the same way.\n */\n bar: 'min-h-[34px] flex-wrap justify-between border-t border-doom-border-soft bg-doom-deep px-3 py-1.5 sm:flex-nowrap sm:px-4 sm:py-0',\n },\n },\n defaultVariants: { variant: 'plain' },\n});\n\nexport interface DialogFooterProps extends ComponentProps<'div'>, VariantProps<typeof dialogFooterVariants> {}\n\nexport function DialogFooter({ className, variant, ...props }: DialogFooterProps) {\n return <div data-slot=\"dialog-footer\" className={cn(dialogFooterVariants({ variant }), className)} {...props} />;\n}\n"],"mappings":"qOAQA,MAAM,GA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,SAAgB,EAAkB,CAAE,YAAW,GAAG,GAA6D,CAC7G,MACE,iBAAA,EAAA,EAAA,IAAA,CAACF,EAAAA,OAAgB,YAAjB,CACE,YAAU,qBACV,UAAWE,EAAAA,GAAG,wCAAyC,CAAS,EAChE,GAAI,CACL,CAAA,CAEL,CAEA,SAAgB,EAAW,CAAE,YAAW,GAAG,GAAgC,CACzE,MACE,iBAAA,EAAA,EAAA,IAAA,CAAC,MAAD,CACE,YAAU,cACV,UAAWA,EAAAA,GAAG,wEAAyE,CAAS,EAChG,GAAI,CACL,CAAA,CAEL,CAEA,MAAa,GAAA,EAAuBG,EAAAA,IAAAA,CAAI,mCAAoC,CAC1E,SAAU,CACR,QAAS,CAEP,MAAO,cAMP,IAAK,iIACP,CACF,EACA,gBAAiB,CAAE,QAAS,OAAQ,CACtC,CAAC,EAID,SAAgB,EAAa,CAAE,YAAW,UAAS,GAAG,GAA4B,CAChF,MAAO,iBAAA,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,YAAU,gBAAgB,UAAWH,EAAAA,GAAG,EAAqB,CAAE,SAAQ,CAAC,EAAG,CAAS,EAAG,GAAI,CAAQ,CAAA,CACjH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-web-components",
3
- "version": "0.0.1-alpha.55",
3
+ "version": "0.0.1-alpha.56",
4
4
  "description": "Shared web components and theme tokens for the DoomPi cockpit and its web plugins: shadcn-style primitives on Radix, tuned to the Doom palette, with runtime theme configs.",
5
5
  "keywords": [
6
6
  "ai",
@@ -91,7 +91,7 @@
91
91
  "tailwind-merge": "3.7.0"
92
92
  },
93
93
  "devDependencies": {
94
- "@agimon-ai/doompi-core": "0.0.1-alpha.97",
94
+ "@agimon-ai/doompi-core": "0.0.1-alpha.98",
95
95
  "@agimon-ai/vibe-lint-plugin-doom-web": "0.0.1-alpha.85",
96
96
  "@types/node": "26.6.2",
97
97
  "@types/react": "19.3.0",