@aivex/ui 1.2.0-dev.56 → 1.2.0-dev.58

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.
Files changed (34) hide show
  1. package/dist/DESIGN.md +1 -1
  2. package/dist/components/Coachmark/Coachmark.cjs.map +1 -1
  3. package/dist/components/Coachmark/Coachmark.d.cts +2 -1
  4. package/dist/components/Coachmark/Coachmark.d.ts +2 -1
  5. package/dist/components/Coachmark/Coachmark.js.map +1 -1
  6. package/dist/components/Dialog/Dialog.cjs.map +1 -1
  7. package/dist/components/Dialog/Dialog.d.cts +2 -1
  8. package/dist/components/Dialog/Dialog.d.ts +2 -1
  9. package/dist/components/Dialog/Dialog.js.map +1 -1
  10. package/dist/components/Icon/index.cjs +1 -1
  11. package/dist/components/Icon/index.cjs.map +1 -1
  12. package/dist/components/Icon/index.d.cts +28 -0
  13. package/dist/components/Icon/index.d.ts +28 -0
  14. package/dist/components/Icon/index.js +280 -250
  15. package/dist/components/Icon/index.js.map +1 -1
  16. package/dist/components/Modal/Modal.cjs +1 -1
  17. package/dist/components/Modal/Modal.cjs.map +1 -1
  18. package/dist/components/Modal/Modal.d.cts +15 -4
  19. package/dist/components/Modal/Modal.d.ts +15 -4
  20. package/dist/components/Modal/Modal.js +30 -27
  21. package/dist/components/Modal/Modal.js.map +1 -1
  22. package/dist/components/Modal/index.d.cts +1 -1
  23. package/dist/components/Modal/index.d.ts +1 -1
  24. package/dist/components/Toast/Toast.cjs.map +1 -1
  25. package/dist/components/Toast/Toast.d.cts +2 -1
  26. package/dist/components/Toast/Toast.d.ts +2 -1
  27. package/dist/components/Toast/Toast.js.map +1 -1
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.js +53 -53
  30. package/dist/llms-full.txt +21 -7
  31. package/dist/llms.txt +2 -2
  32. package/dist/utils/dataAttributes.d.cts +7 -0
  33. package/dist/utils/dataAttributes.d.ts +7 -0
  34. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils.cjs`),n=require(`../Icon/index.cjs`),r=require(`../Button/Button.cjs`),i=require(`../IconButton/IconButton.cjs`),a=require(`../Overlay/Overlay.cjs`),o=require(`../../utils/useModalAutoFocus.cjs`);let s=require(`react`),c=require(`react/jsx-runtime`),l=require(`@radix-ui/react-dialog`);l=e.__toESM(l,1);var u=(0,s.createContext)(!1),d={sm:`aivex:max-w-modal-sm`,md:`aivex:max-w-modal-md`,lg:`aivex:max-w-modal-lg`,xl:`aivex:max-w-[960px]`,full:`aivex:h-[calc(100dvh-32px)] aivex:max-w-[calc(100vw-32px)]`},f=t.cn(`aivex:flex aivex:max-h-[80dvh] aivex:w-[85vw] aivex:flex-col aivex:gap-2xl aivex:overflow-hidden aivex:p-2xl`,`aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:shadow-xl aivex:outline-none`),p=`aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs`;function m({title:e,titleId:t,description:r,headingButton:a,onClose:o,closeAriaLabel:d=`Close modal`,ref:f,...m}){let g=(0,s.useContext)(u),_=(0,c.jsx)(`h2`,{...t?{id:t}:{},className:`aivex:m-0 aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary aivex:break-words`,children:e}),v=r?(0,c.jsx)(`p`,{className:`aivex:m-0 aivex:whitespace-pre-line aivex:text-body-md-regular aivex:text-text-secondary aivex:break-words`,children:r}):null,y=(0,c.jsx)(i.IconButton,{size:`md`,onClick:o,className:`aivex:shrink-0`,"aria-label":d,children:(0,c.jsx)(n.CloseIcon,{size:24})}),b=a?(0,c.jsx)(h,{button:a}):null;return(0,c.jsxs)(`div`,{ref:f,className:p,...m,children:[(0,c.jsxs)(`div`,{className:`aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-md`,children:[b,(0,c.jsx)(`div`,{className:`aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:justify-center`,children:g?(0,c.jsx)(l.Title,{asChild:!0,children:_}):_}),o?y:g&&(0,c.jsx)(l.Close,{asChild:!0,children:y})]}),g&&v?(0,c.jsx)(l.Description,{asChild:!0,children:v}):v]})}function h({button:e}){let{children:t,...n}=e;return(0,c.jsx)(i.IconButton,{size:`md`,className:`aivex:shrink-0`,...n,children:t})}function g({children:e,ref:t,...n}){return(0,c.jsx)(`div`,{ref:t,"data-aivex-modal-body":``,className:`aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col aivex:overflow-y-auto`,...n,children:e})}function _({tertiaryButton:e,secondaryButton:t,primaryButton:n,ref:r,...i}){return(0,c.jsxs)(`div`,{ref:r,className:`aivex:flex aivex:h-10 aivex:w-full aivex:items-center aivex:justify-end aivex:gap-lg`,...i,children:[(0,c.jsx)(`div`,{className:`aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-center aivex:justify-start`,children:e&&(0,c.jsx)(v,{button:e,variant:`ghost`,color:`secondary`,className:`aivex:min-w-9`})}),(0,c.jsxs)(`div`,{className:`aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-end aivex:gap-lg`,children:[t&&(0,c.jsx)(v,{button:t,variant:`solid`,color:`secondary`,className:`aivex:min-w-[84px]`}),n&&(0,c.jsx)(v,{button:n,variant:`solid`,color:`primary`,className:`aivex:min-w-[84px]`})]})]})}function v({button:e,variant:t,color:n,className:i}){let{children:a,...o}=e;return(0,c.jsx)(r.Button,{variant:t,color:n,size:`lg`,className:i,...o,children:a})}function y({open:e,defaultOpen:n,onOpenChange:r,children:i,size:s=`md`,closeOnInteractOutside:p=!0,onOpenAutoFocus:m,onCloseAutoFocus:h,onInteractOutside:g,onKeyDown:_,onKeyUp:v,ref:y,...b}){let x=o.useModalAutoFocus(m,h);return(0,c.jsx)(l.Root,{open:e,defaultOpen:n,onOpenChange:r,children:(0,c.jsxs)(l.Portal,{children:[(0,c.jsx)(l.Overlay,{className:a.overlayVariants({variant:`dim`})}),(0,c.jsx)(l.Content,{ref:y,className:t.cn(`aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal)`,`aivex:-translate-x-1/2 aivex:-translate-y-1/2`,f,d[s]),onInteractOutside:e=>{g?.(e),!p&&!e.defaultPrevented&&e.preventDefault()},...x,onKeyDown:_,onKeyUp:v,...b,children:(0,c.jsx)(u.Provider,{value:!0,children:i})})]})})}function b({title:e,description:n,headingButton:r,children:i,tertiaryButton:a,secondaryButton:o,primaryButton:l,size:u=`md`,onClose:p,closeAriaLabel:h,ref:v}){let y=(0,s.useId)(),b=!!(a||o||l);return(0,c.jsxs)(`div`,{ref:v,role:`dialog`,"aria-labelledby":y,className:t.cn(f,d[u]),children:[(0,c.jsx)(m,{title:e,titleId:y,description:n,headingButton:r,onClose:p,closeAriaLabel:h}),i&&(0,c.jsx)(g,{children:i}),b&&(0,c.jsx)(_,{tertiaryButton:a,secondaryButton:o,primaryButton:l})]})}function x({open:e,defaultOpen:t,onOpenChange:n,title:r,description:i,headingButton:a,children:o,tertiaryButton:s,secondaryButton:l,primaryButton:u,size:d,closeOnInteractOutside:f,onOpenAutoFocus:p,closeAriaLabel:h}){let v=!!(s||l||u);return(0,c.jsxs)(y,{open:e,defaultOpen:t,onOpenChange:n,size:d,closeOnInteractOutside:f,onOpenAutoFocus:p,...i?{}:{"aria-describedby":void 0},children:[(0,c.jsx)(m,{title:r,description:i,headingButton:a,closeAriaLabel:h}),o&&(0,c.jsx)(g,{children:o}),v&&(0,c.jsx)(_,{tertiaryButton:s,secondaryButton:l,primaryButton:u})]})}exports.Modal=x,exports.ModalSurface=b;
1
+ "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils.cjs`),n=require(`../Icon/index.cjs`),r=require(`../Button/Button.cjs`),i=require(`../IconButton/IconButton.cjs`),a=require(`../Overlay/Overlay.cjs`),o=require(`../../utils/useModalAutoFocus.cjs`);let s=require(`react`),c=require(`react/jsx-runtime`),l=require(`@radix-ui/react-dialog`);l=e.__toESM(l,1);var u=(0,s.createContext)(!1),d={sm:`aivex:max-w-modal-sm`,md:`aivex:max-w-modal-md`,lg:`aivex:max-w-modal-lg`,xl:`aivex:max-w-[960px]`,full:`aivex:h-[calc(100dvh-32px)] aivex:max-w-[calc(100vw-32px)]`},f=t.cn(`aivex:flex aivex:max-h-[80dvh] aivex:w-[85vw] aivex:flex-col aivex:gap-2xl aivex:overflow-hidden aivex:p-2xl`,`aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:shadow-xl aivex:outline-none`),p=`aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs`;function m({title:e,titleId:t,description:r,headingButton:a,onClose:o,closeAriaLabel:d=`Close modal`,closeButtonProps:f,ref:m,...g}){let _=(0,s.useContext)(u),v=(0,c.jsx)(`h2`,{...t?{id:t}:{},className:`aivex:m-0 aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary aivex:break-words`,children:e}),y=r?(0,c.jsx)(`p`,{className:`aivex:m-0 aivex:whitespace-pre-line aivex:text-body-md-regular aivex:text-text-secondary aivex:break-words`,children:r}):null,b=(0,c.jsx)(i.IconButton,{...f,size:`md`,onClick:o,className:`aivex:shrink-0`,"aria-label":d,children:(0,c.jsx)(n.CloseIcon,{size:24})}),x=a?(0,c.jsx)(h,{button:a}):null;return(0,c.jsxs)(`div`,{ref:m,className:p,...g,children:[(0,c.jsxs)(`div`,{className:`aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-md`,children:[x,(0,c.jsx)(`div`,{className:`aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:justify-center`,children:_?(0,c.jsx)(l.Title,{asChild:!0,children:v}):v}),o?b:_&&(0,c.jsx)(l.Close,{asChild:!0,children:b})]}),_&&y?(0,c.jsx)(l.Description,{asChild:!0,children:y}):y]})}function h({button:e}){let{children:t,...n}=e;return(0,c.jsx)(i.IconButton,{size:`md`,className:`aivex:shrink-0`,...n,children:t})}function g({children:e,ref:t,...n}){return(0,c.jsx)(`div`,{ref:t,"data-aivex-modal-body":``,className:`aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col aivex:overflow-y-auto`,...n,children:e})}function _({tertiaryButton:e,secondaryButton:t,primaryButton:n,ref:r,...i}){return(0,c.jsxs)(`div`,{ref:r,className:`aivex:flex aivex:h-10 aivex:w-full aivex:items-center aivex:justify-end aivex:gap-lg`,...i,children:[(0,c.jsx)(`div`,{className:`aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-center aivex:justify-start`,children:e&&(0,c.jsx)(v,{button:e,variant:`ghost`,color:`secondary`,className:`aivex:min-w-9`})}),(0,c.jsxs)(`div`,{className:`aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-end aivex:gap-lg`,children:[t&&(0,c.jsx)(v,{button:t,variant:`solid`,color:`secondary`,className:`aivex:min-w-[84px]`}),n&&(0,c.jsx)(v,{button:n,variant:`solid`,color:`primary`,className:`aivex:min-w-[84px]`})]})]})}function v({button:e,variant:t,color:n,className:i}){let{children:a,...o}=e;return(0,c.jsx)(r.Button,{variant:t,color:n,size:`lg`,className:i,...o,children:a})}function y({open:e,defaultOpen:n,onOpenChange:r,children:i,size:s=`md`,closeOnInteractOutside:p=!0,onOpenAutoFocus:m,onCloseAutoFocus:h,onInteractOutside:g,onKeyDown:_,onKeyUp:v,ref:y,...b}){let x=o.useModalAutoFocus(m,h);return(0,c.jsx)(l.Root,{open:e,defaultOpen:n,onOpenChange:r,children:(0,c.jsxs)(l.Portal,{children:[(0,c.jsx)(l.Overlay,{className:a.overlayVariants({variant:`dim`})}),(0,c.jsx)(l.Content,{ref:y,className:t.cn(`aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal)`,`aivex:-translate-x-1/2 aivex:-translate-y-1/2`,f,d[s]),onInteractOutside:e=>{g?.(e),!p&&!e.defaultPrevented&&e.preventDefault()},...x,onKeyDown:_,onKeyUp:v,...b,children:(0,c.jsx)(u.Provider,{value:!0,children:i})})]})})}function b({title:e,description:n,headingButton:r,children:i,tertiaryButton:a,secondaryButton:o,primaryButton:l,size:u=`md`,onClose:p,closeAriaLabel:h,closeButtonProps:v,ref:y}){let b=(0,s.useId)(),x=!!(a||o||l);return(0,c.jsxs)(`div`,{ref:y,role:`dialog`,"aria-labelledby":b,className:t.cn(f,d[u]),children:[(0,c.jsx)(m,{title:e,titleId:b,description:n,headingButton:r,onClose:p,closeAriaLabel:h,closeButtonProps:v}),i&&(0,c.jsx)(g,{children:i}),x&&(0,c.jsx)(_,{tertiaryButton:a,secondaryButton:o,primaryButton:l})]})}function x({open:e,defaultOpen:t,onOpenChange:n,title:r,description:i,headingButton:a,children:o,tertiaryButton:s,secondaryButton:l,primaryButton:u,size:d,closeOnInteractOutside:f,onOpenAutoFocus:p,closeAriaLabel:h,closeButtonProps:v}){let b=!!(s||l||u);return(0,c.jsxs)(y,{open:e,defaultOpen:t,onOpenChange:n,size:d,closeOnInteractOutside:f,onOpenAutoFocus:p,...i?{}:{"aria-describedby":void 0},children:[(0,c.jsx)(m,{title:r,description:i,headingButton:a,closeAriaLabel:h,closeButtonProps:v}),o&&(0,c.jsx)(g,{children:o}),b&&(0,c.jsx)(_,{tertiaryButton:s,secondaryButton:l,primaryButton:u})]})}exports.Modal=x,exports.ModalSurface=b;
2
2
  //# sourceMappingURL=Modal.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.cjs","names":[],"sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import * as RadixDialog from \"@radix-ui/react-dialog\";\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport type { IconButtonProps } from \"@/components/IconButton\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { overlayVariants } from \"@/components/Overlay/Overlay\";\nimport { cn } from \"@/utils/cn\";\nimport { useModalAutoFocus } from \"@/utils/useModalAutoFocus\";\n\ntype ModalContentProps = ComponentPropsWithoutRef<typeof RadixDialog.Content>;\nconst ModalContext = createContext(false);\ntype ModalOpenAutoFocusHandler = (event: Event) => void;\n\n/**\n * Modal 최대 폭 — sm 384px, md 548px, lg 720px, xl 960px, full은 화면 크기 - 32px(높이 포함).\n * 높이는 내용만큼이며 화면 높이의 80%를 넘으면 본문이 스크롤된다.\n */\nexport type ModalSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\nconst modalSizeClasses = {\n sm: \"aivex:max-w-modal-sm\",\n md: \"aivex:max-w-modal-md\",\n lg: \"aivex:max-w-modal-lg\",\n xl: \"aivex:max-w-[960px]\",\n full: \"aivex:h-[calc(100dvh-32px)] aivex:max-w-[calc(100vw-32px)]\",\n} as const;\n\nconst modalSurfaceClassName = cn(\n \"aivex:flex aivex:max-h-[80dvh] aivex:w-[85vw] aivex:flex-col aivex:gap-2xl aivex:overflow-hidden aivex:p-2xl\",\n \"aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:shadow-xl aivex:outline-none\",\n);\nconst modalHeaderClassName = \"aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs\";\n\ninterface ModalHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\" | \"title\"> {\n title: ReactNode;\n titleId?: string;\n description?: ReactNode;\n headingButton?: ModalHeadingButtonProps;\n onClose?: () => void;\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalHeader({\n title,\n titleId,\n description,\n headingButton,\n onClose,\n closeAriaLabel = \"Close modal\",\n ref,\n ...props\n}: ModalHeaderProps) {\n const isInsideModalRoot = useContext(ModalContext);\n const titleElement = (\n <h2\n {...(titleId ? { id: titleId } : {})}\n className=\"aivex:m-0 aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary aivex:break-words\"\n >\n {title}\n </h2>\n );\n const descriptionElement = description ? (\n <p className=\"aivex:m-0 aivex:whitespace-pre-line aivex:text-body-md-regular aivex:text-text-secondary aivex:break-words\">\n {description}\n </p>\n ) : null;\n const closeButton = (\n <IconButton size=\"md\" onClick={onClose} className=\"aivex:shrink-0\" aria-label={closeAriaLabel}>\n <CloseIcon size={24} />\n </IconButton>\n );\n const headingButtonElement = headingButton ? <ModalHeadingButton button={headingButton} /> : null;\n\n return (\n <div ref={ref} className={modalHeaderClassName} {...props}>\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-md\">\n {headingButtonElement}\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:justify-center\">\n {isInsideModalRoot ? (\n <RadixDialog.Title asChild>{titleElement}</RadixDialog.Title>\n ) : (\n titleElement\n )}\n </div>\n {onClose\n ? closeButton\n : isInsideModalRoot && <RadixDialog.Close asChild>{closeButton}</RadixDialog.Close>}\n </div>\n {isInsideModalRoot && descriptionElement ? (\n <RadixDialog.Description asChild>{descriptionElement}</RadixDialog.Description>\n ) : (\n descriptionElement\n )}\n </div>\n );\n}\n\n/** 제목 왼쪽 아이콘 버튼(뒤로 가기 등) — IconButton props에서 크기·모양은 Modal이 고정한다. */\nexport interface ModalHeadingButtonProps\n extends Omit<IconButtonProps, \"asChild\" | \"children\" | \"className\" | \"ref\" | \"shape\" | \"size\"> {\n /** 아이콘 전용 버튼이라 접근성 이름이 필수다. */\n \"aria-label\": string;\n /** 버튼 안에 그릴 아이콘(예: `<ArrowLeftIcon size={24} />`). */\n children: ReactNode;\n}\n\nfunction ModalHeadingButton({ button }: { button: ModalHeadingButtonProps }) {\n const { children, ...props } = button;\n\n return (\n <IconButton size=\"md\" className=\"aivex:shrink-0\" {...props}>\n {children}\n </IconButton>\n );\n}\n\ninterface ModalBodyProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\"> {\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalBody({ children, ref, ...props }: ModalBodyProps) {\n return (\n // 세로 flex여야 표면의 max-h가 자식까지 전달돼, 자식의 flex-1 min-h-0 목록이 본문 대신 스크롤된다.\n // 일반 자식이 줄어들지 않게 하는 규칙은 styles.css(data-aivex-modal-body)에 있다.\n <div\n ref={ref}\n data-aivex-modal-body=\"\"\n className=\"aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col aivex:overflow-y-auto\"\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/** 푸터 버튼 — Button props에서 색·크기·스타일은 Modal이 고정하고 라벨은 children으로 받는다. */\nexport interface ModalButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n > {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\ninterface ModalFooterProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\" | \"children\"> {\n tertiaryButton?: ModalButtonProps;\n secondaryButton?: ModalButtonProps;\n primaryButton?: ModalButtonProps;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalFooter({\n tertiaryButton,\n secondaryButton,\n primaryButton,\n ref,\n ...props\n}: ModalFooterProps) {\n return (\n <div\n ref={ref}\n className=\"aivex:flex aivex:h-10 aivex:w-full aivex:items-center aivex:justify-end aivex:gap-lg\"\n {...props}\n >\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-center aivex:justify-start\">\n {tertiaryButton && (\n <ModalActionButton\n button={tertiaryButton}\n variant=\"ghost\"\n color=\"secondary\"\n className=\"aivex:min-w-9\"\n />\n )}\n </div>\n <div className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-end aivex:gap-lg\">\n {secondaryButton && (\n <ModalActionButton\n button={secondaryButton}\n variant=\"solid\"\n color=\"secondary\"\n className=\"aivex:min-w-[84px]\"\n />\n )}\n {primaryButton && (\n <ModalActionButton\n button={primaryButton}\n variant=\"solid\"\n color=\"primary\"\n className=\"aivex:min-w-[84px]\"\n />\n )}\n </div>\n </div>\n );\n}\n\ninterface ModalActionButtonProps {\n button: ModalButtonProps;\n variant: ButtonProps[\"variant\"];\n color: ButtonProps[\"color\"];\n className?: string;\n}\n\nfunction ModalActionButton({ button, variant, color, className }: ModalActionButtonProps) {\n const { children, ...props } = button;\n\n return (\n <Button variant={variant} color={color} size=\"lg\" className={className} {...props}>\n {children}\n </Button>\n );\n}\n\ninterface ModalRootProps\n extends Omit<\n ModalContentProps,\n | \"children\"\n | \"className\"\n | \"defaultOpen\"\n | \"onInteractOutside\"\n | \"onKeyDown\"\n | \"open\"\n | \"ref\"\n | \"title\"\n > {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: ReactNode;\n size?: ModalSize;\n closeOnInteractOutside?: boolean;\n onOpenAutoFocus?: ModalOpenAutoFocusHandler;\n onInteractOutside?: ModalContentProps[\"onInteractOutside\"];\n onKeyDown?: ModalContentProps[\"onKeyDown\"];\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalRoot({\n open,\n defaultOpen,\n onOpenChange,\n children,\n size = \"md\",\n closeOnInteractOutside = true,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onInteractOutside,\n onKeyDown,\n onKeyUp,\n ref,\n ...props\n}: ModalRootProps) {\n const autoFocus = useModalAutoFocus(onOpenAutoFocus, onCloseAutoFocus);\n return (\n <RadixDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n <RadixDialog.Portal>\n <RadixDialog.Overlay className={overlayVariants({ variant: \"dim\" })} />\n <RadixDialog.Content\n ref={ref}\n className={cn(\n \"aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal)\",\n \"aivex:-translate-x-1/2 aivex:-translate-y-1/2\",\n modalSurfaceClassName,\n modalSizeClasses[size],\n )}\n onInteractOutside={(event) => {\n onInteractOutside?.(event);\n if (!closeOnInteractOutside && !event.defaultPrevented) event.preventDefault();\n }}\n {...autoFocus}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n {...props}\n >\n <ModalContext.Provider value={true}>{children}</ModalContext.Provider>\n </RadixDialog.Content>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n );\n}\n\nexport interface ModalSurfaceProps {\n /** 제목(필수) — 표면의 aria-labelledby로 연결된다. */\n title: ReactNode;\n /** 제목 아래 설명. */\n description?: ReactNode;\n /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등). */\n headingButton?: ModalHeadingButtonProps;\n /** 본문 — 넘치면 본문 영역만 세로 스크롤한다. */\n children?: ReactNode;\n /** 푸터 왼쪽 끝의 ghost 버튼(보조 동작). */\n tertiaryButton?: ModalButtonProps;\n /** 푸터 오른쪽의 secondary 버튼(취소·이전). */\n secondaryButton?: ModalButtonProps;\n /** 푸터 오른쪽 끝의 primary 버튼(확인·다음). */\n primaryButton?: ModalButtonProps;\n /**\n * 최대 폭.\n * @default \"md\"\n */\n size?: ModalSize;\n /** 지정하면 헤더에 닫기(X) 버튼을 렌더한다. 열림 상태가 없으므로 숨김은 소비자가 처리한다. */\n onClose?: () => void;\n /**\n * 닫기 버튼 aria-label.\n * @default \"Close modal\"\n */\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * Modal과 같은 카드 표면을 포털·딤·포커스 트랩 없이 제자리에 그리는 정적 변형.\n *\n * 상단 버튼 아래에 붙는 패널처럼 위치를 소비자가 잡는 경우나 문서·미리보기에 쓴다.\n * 열림 상태·Esc·바깥 클릭 처리가 없으니 화면을 막는 모달이 필요하면 Modal을 쓴다.\n *\n * @example\n * ```tsx\n * import { ModalSurface } from \"@aivex/ui\";\n *\n * <div className=\"absolute right-6 top-6\">\n * <ModalSurface title=\"작업 상태\" size=\"md\" onClose={() => setVisible(false)}>\n * 진행 중인 작업 2개\n * </ModalSurface>\n * </div>\n * ```\n */\nfunction ModalSurface({\n title,\n description,\n headingButton,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n size = \"md\",\n onClose,\n closeAriaLabel,\n ref,\n}: ModalSurfaceProps) {\n const titleId = useId();\n const hasFooter = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <div\n ref={ref}\n role=\"dialog\"\n // 포커스를 가두지도 뒤를 막지도 않는 비모달 표면이라 aria-modal을 달지 않는다.\n // 달면 보조기기가 나머지 페이지를 비활성으로 보고 탐색을 막는다.\n aria-labelledby={titleId}\n className={cn(modalSurfaceClassName, modalSizeClasses[size])}\n >\n <ModalHeader\n title={title}\n titleId={titleId}\n description={description}\n headingButton={headingButton}\n onClose={onClose}\n closeAriaLabel={closeAriaLabel}\n />\n {children && <ModalBody>{children}</ModalBody>}\n {hasFooter && (\n <ModalFooter\n tertiaryButton={tertiaryButton}\n secondaryButton={secondaryButton}\n primaryButton={primaryButton}\n />\n )}\n </div>\n );\n}\n\nexport interface ModalProps {\n /** 열림 상태(제어). onOpenChange와 함께 쓴다. */\n open?: boolean;\n /** 초기 열림 상태(비제어). */\n defaultOpen?: boolean;\n /** 열림 상태가 바뀔 때 호출 — 닫기(X)·Esc·바깥 클릭 모두 false로 알린다. */\n onOpenChange?: (open: boolean) => void;\n /** 제목(필수) — 모달의 접근성 이름이 된다. */\n title: ReactNode;\n /** 제목 아래 설명 — 접근성 설명으로 연결된다. */\n description?: ReactNode;\n /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등). */\n headingButton?: ModalHeadingButtonProps;\n /** 본문(폼·목록 등) — 넘치면 본문 영역만 세로 스크롤한다. */\n children?: ReactNode;\n /** 푸터 왼쪽 끝의 ghost 버튼(보조 동작). 눌러도 자동으로 닫히지 않는다. */\n tertiaryButton?: ModalButtonProps;\n /** 푸터 오른쪽의 secondary 버튼(취소·이전). 눌러도 자동으로 닫히지 않는다. */\n secondaryButton?: ModalButtonProps;\n /** 푸터 오른쪽 끝의 primary 버튼(확인·다음). 눌러도 자동으로 닫히지 않는다. */\n primaryButton?: ModalButtonProps;\n /**\n * 최대 폭.\n * @default \"md\"\n */\n size?: ModalSize;\n /**\n * 바깥(딤) 클릭으로 닫을지 여부. 입력 중 실수로 닫히면 안 되는 폼은 false.\n * @default true\n */\n closeOnInteractOutside?: boolean;\n /** 열릴 때 자동 포커스 직전 호출 — event.preventDefault()로 기본 포커스 이동을 막을 수 있다. */\n onOpenAutoFocus?: ModalOpenAutoFocusHandler;\n /**\n * 헤더 닫기(X) 버튼 aria-label.\n * @default \"Close modal\"\n */\n closeAriaLabel?: string;\n}\n\n/**\n * 제목·본문·푸터 버튼으로 구성된 표준 모달 창(딤 + 화면 중앙 카드).\n *\n * 입력 폼, 선택 목록, 여러 단계 흐름처럼 본문이 있는 작업에 쓴다. 제목·설명과 버튼만 있는\n * 짧은 확인 질문은 Dialog, 카드 틀을 벗어난 자유 레이아웃(검색 팔레트 등)은 ModalBase,\n * 화면 옆에서 미끄러져 나오는 시트는 Drawer를 쓴다. 헤더에 닫기(X) 버튼이 자동으로 붙고,\n * 푸터 버튼은 눌러도 닫히지 않으니 onClick에서 open을 직접 false로 바꾼다. title은 필수다.\n *\n * @example\n * ```tsx\n * import { Button, Modal, Textbox } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(false);\n *\n * <Button onClick={() => setOpen(true)}>워크스페이스 생성</Button>\n * <Modal\n * open={open}\n * onOpenChange={setOpen}\n * size=\"md\"\n * title=\"워크스페이스 생성\"\n * description=\"생성할 워크스페이스명을 입력하세요.\"\n * secondaryButton={{ children: \"취소\", onClick: () => setOpen(false) }}\n * primaryButton={{ children: \"생성\", onClick: () => setOpen(false) }}\n * >\n * <Textbox aria-label=\"워크스페이스명\" placeholder=\"워크스페이스명을 입력하세요\" />\n * </Modal>\n * ```\n */\nfunction Modal({\n open,\n defaultOpen,\n onOpenChange,\n title,\n description,\n headingButton,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n size,\n closeOnInteractOutside,\n onOpenAutoFocus,\n closeAriaLabel,\n}: ModalProps) {\n const hasFooter = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <ModalRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n size={size}\n closeOnInteractOutside={closeOnInteractOutside}\n onOpenAutoFocus={onOpenAutoFocus}\n // 설명이 없는 모달임을 Radix에 알린다 — 명시하지 않으면 개발 모드에서 매번 경고한다.\n {...(description ? {} : { \"aria-describedby\": undefined })}\n >\n <ModalHeader\n title={title}\n description={description}\n headingButton={headingButton}\n closeAriaLabel={closeAriaLabel}\n />\n {children && <ModalBody>{children}</ModalBody>}\n {hasFooter && (\n <ModalFooter\n tertiaryButton={tertiaryButton}\n secondaryButton={secondaryButton}\n primaryButton={primaryButton}\n />\n )}\n </ModalRoot>\n );\n}\n\nexport { Modal, ModalSurface };\n"],"mappings":"2YAmBA,IAAM,GAAA,EAAA,EAAA,eAA6B,GAAM,CASnC,EAAmB,CACvB,GAAI,uBACJ,GAAI,uBACJ,GAAI,uBACJ,GAAI,sBACJ,KAAM,6DACP,CAEK,EAAwB,EAAA,GAC5B,+GACA,mHACD,CACK,EAAuB,sDAY7B,SAAS,EAAY,CACnB,QACA,UACA,cACA,gBACA,UACA,iBAAiB,cACjB,MACA,GAAG,GACgB,CACnB,IAAM,GAAA,EAAA,EAAA,YAA+B,EAAa,CAC5C,GACJ,EAAA,EAAA,KAAC,KAAD,CACE,GAAK,EAAU,CAAE,GAAI,EAAS,CAAG,EAAE,CACnC,UAAU,+GAET,EACE,CAAA,CAED,EAAqB,GACzB,EAAA,EAAA,KAAC,IAAD,CAAG,UAAU,sHACV,EACC,CAAA,CACF,KACE,GACJ,EAAA,EAAA,KAAC,EAAA,WAAD,CAAY,KAAK,KAAK,QAAS,EAAS,UAAU,iBAAiB,aAAY,YAC7E,EAAA,EAAA,KAAC,EAAA,UAAD,CAAW,KAAM,GAAM,CAAA,CACZ,CAAA,CAET,EAAuB,GAAgB,EAAA,EAAA,KAAC,EAAD,CAAoB,OAAQ,EAAiB,CAAA,CAAG,KAE7F,OACE,EAAA,EAAA,MAAC,MAAD,CAAU,MAAK,UAAW,EAAsB,GAAI,WAApD,EACE,EAAA,E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A,KAAC,EAAD,CAAY,WAAqB,CAAA,CAC7C,IACC,EAAA,EAAA,KAAC,EAAD,CACkB,iBACC,kBACF,gBACf,CAAA,CAEA,GAwEV,SAAS,EAAM,CACb,OACA,cACA,eACA,QACA,cACA,gBACA,WACA,iBACA,kBACA,gBACA,OACA,yBACA,kBACA,kBACa,CACb,IAAM,EAAY,GAAQ,GAAkB,GAAmB,GAE/D,OACE,EAAA,EAAA,MAAC,EAAD,CACQ,OACO,cACC,eACR,OACkB,yBACP,kBAEjB,GAAK,EAAc,EAAE,CAAG,CAAE,mBAAoB,IAAA,GAAW,UAR3D,EAUE,EAAA,EAAA,KAAC,EAAD,CACS,QACM,cACE,gBACC,iBAChB,CAAA,CACD,IAAY,EAAA,EAAA,KAAC,EAAD,CAAY,WAAqB,CAAA,CAC7C,IACC,EAAA,EAAA,KAAC,EAAD,CACkB,iBACC,kBACF,gBACf,CAAA,CAEM"}
1
+ {"version":3,"file":"Modal.cjs","names":[],"sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import * as RadixDialog from \"@radix-ui/react-dialog\";\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport type { IconButtonProps } from \"@/components/IconButton\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { overlayVariants } from \"@/components/Overlay/Overlay\";\nimport { cn } from \"@/utils/cn\";\nimport type { DataAttributes } from \"@/utils/dataAttributes\";\nimport { useModalAutoFocus } from \"@/utils/useModalAutoFocus\";\n\ntype ModalContentProps = ComponentPropsWithoutRef<typeof RadixDialog.Content>;\nconst ModalContext = createContext(false);\ntype ModalOpenAutoFocusHandler = (event: Event) => void;\n\n/**\n * Modal 최대 폭 — sm 384px, md 548px, lg 720px, xl 960px, full은 화면 크기 - 32px(높이 포함).\n * 높이는 내용만큼이며 화면 높이의 80%를 넘으면 본문이 스크롤된다.\n */\nexport type ModalSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\nconst modalSizeClasses = {\n sm: \"aivex:max-w-modal-sm\",\n md: \"aivex:max-w-modal-md\",\n lg: \"aivex:max-w-modal-lg\",\n xl: \"aivex:max-w-[960px]\",\n full: \"aivex:h-[calc(100dvh-32px)] aivex:max-w-[calc(100vw-32px)]\",\n} as const;\n\nconst modalSurfaceClassName = cn(\n \"aivex:flex aivex:max-h-[80dvh] aivex:w-[85vw] aivex:flex-col aivex:gap-2xl aivex:overflow-hidden aivex:p-2xl\",\n \"aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:shadow-xl aivex:outline-none\",\n);\nconst modalHeaderClassName = \"aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs\";\n\ninterface ModalHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\" | \"title\"> {\n title: ReactNode;\n titleId?: string;\n description?: ReactNode;\n headingButton?: ModalHeadingButtonProps;\n onClose?: () => void;\n closeAriaLabel?: string;\n closeButtonProps?: ModalCloseButtonProps;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalHeader({\n title,\n titleId,\n description,\n headingButton,\n onClose,\n closeAriaLabel = \"Close modal\",\n closeButtonProps,\n ref,\n ...props\n}: ModalHeaderProps) {\n const isInsideModalRoot = useContext(ModalContext);\n const titleElement = (\n <h2\n {...(titleId ? { id: titleId } : {})}\n className=\"aivex:m-0 aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary aivex:break-words\"\n >\n {title}\n </h2>\n );\n const descriptionElement = description ? (\n <p className=\"aivex:m-0 aivex:whitespace-pre-line aivex:text-body-md-regular aivex:text-text-secondary aivex:break-words\">\n {description}\n </p>\n ) : null;\n const closeButton = (\n <IconButton\n {...closeButtonProps}\n size=\"md\"\n onClick={onClose}\n className=\"aivex:shrink-0\"\n aria-label={closeAriaLabel}\n >\n <CloseIcon size={24} />\n </IconButton>\n );\n const headingButtonElement = headingButton ? <ModalHeadingButton button={headingButton} /> : null;\n\n return (\n <div ref={ref} className={modalHeaderClassName} {...props}>\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-md\">\n {headingButtonElement}\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:justify-center\">\n {isInsideModalRoot ? (\n <RadixDialog.Title asChild>{titleElement}</RadixDialog.Title>\n ) : (\n titleElement\n )}\n </div>\n {onClose\n ? closeButton\n : isInsideModalRoot && <RadixDialog.Close asChild>{closeButton}</RadixDialog.Close>}\n </div>\n {isInsideModalRoot && descriptionElement ? (\n <RadixDialog.Description asChild>{descriptionElement}</RadixDialog.Description>\n ) : (\n descriptionElement\n )}\n </div>\n );\n}\n\n/** 제목 왼쪽 아이콘 버튼(뒤로 가기 등) — IconButton props에서 크기·모양은 Modal이 고정한다. */\nexport interface ModalHeadingButtonProps\n extends Omit<IconButtonProps, \"asChild\" | \"children\" | \"className\" | \"ref\" | \"shape\" | \"size\">,\n DataAttributes {\n /** 아이콘 전용 버튼이라 접근성 이름이 필수다. */\n \"aria-label\": string;\n /** 버튼 안에 그릴 아이콘(예: `<ArrowLeftIcon size={24} />`). */\n children: ReactNode;\n}\n\n/**\n * 헤더 닫기(X) 버튼에 덧붙일 속성(`data-*`·`id`·`disabled` 등) — 크기·모양·동작·접근성 이름은\n * Modal이 고정한다(이름은 closeAriaLabel로 바꾼다).\n */\nexport interface ModalCloseButtonProps\n extends Omit<\n IconButtonProps,\n | \"aria-label\"\n | \"asChild\"\n | \"children\"\n | \"className\"\n | \"dangerouslySetInnerHTML\"\n | \"onClick\"\n | \"ref\"\n | \"shape\"\n | \"size\"\n >,\n DataAttributes {}\n\nfunction ModalHeadingButton({ button }: { button: ModalHeadingButtonProps }) {\n const { children, ...props } = button;\n\n return (\n <IconButton size=\"md\" className=\"aivex:shrink-0\" {...props}>\n {children}\n </IconButton>\n );\n}\n\ninterface ModalBodyProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\"> {\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalBody({ children, ref, ...props }: ModalBodyProps) {\n return (\n // 세로 flex여야 표면의 max-h가 자식까지 전달돼, 자식의 flex-1 min-h-0 목록이 본문 대신 스크롤된다.\n // 일반 자식이 줄어들지 않게 하는 규칙은 styles.css(data-aivex-modal-body)에 있다.\n <div\n ref={ref}\n data-aivex-modal-body=\"\"\n className=\"aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col aivex:overflow-y-auto\"\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/** 푸터 버튼 — Button props에서 색·크기·스타일은 Modal이 고정하고 라벨은 children으로 받는다. */\nexport interface ModalButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n >,\n DataAttributes {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\ninterface ModalFooterProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\" | \"children\"> {\n tertiaryButton?: ModalButtonProps;\n secondaryButton?: ModalButtonProps;\n primaryButton?: ModalButtonProps;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalFooter({\n tertiaryButton,\n secondaryButton,\n primaryButton,\n ref,\n ...props\n}: ModalFooterProps) {\n return (\n <div\n ref={ref}\n className=\"aivex:flex aivex:h-10 aivex:w-full aivex:items-center aivex:justify-end aivex:gap-lg\"\n {...props}\n >\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-center aivex:justify-start\">\n {tertiaryButton && (\n <ModalActionButton\n button={tertiaryButton}\n variant=\"ghost\"\n color=\"secondary\"\n className=\"aivex:min-w-9\"\n />\n )}\n </div>\n <div className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-end aivex:gap-lg\">\n {secondaryButton && (\n <ModalActionButton\n button={secondaryButton}\n variant=\"solid\"\n color=\"secondary\"\n className=\"aivex:min-w-[84px]\"\n />\n )}\n {primaryButton && (\n <ModalActionButton\n button={primaryButton}\n variant=\"solid\"\n color=\"primary\"\n className=\"aivex:min-w-[84px]\"\n />\n )}\n </div>\n </div>\n );\n}\n\ninterface ModalActionButtonProps {\n button: ModalButtonProps;\n variant: ButtonProps[\"variant\"];\n color: ButtonProps[\"color\"];\n className?: string;\n}\n\nfunction ModalActionButton({ button, variant, color, className }: ModalActionButtonProps) {\n const { children, ...props } = button;\n\n return (\n <Button variant={variant} color={color} size=\"lg\" className={className} {...props}>\n {children}\n </Button>\n );\n}\n\ninterface ModalRootProps\n extends Omit<\n ModalContentProps,\n | \"children\"\n | \"className\"\n | \"defaultOpen\"\n | \"onInteractOutside\"\n | \"onKeyDown\"\n | \"open\"\n | \"ref\"\n | \"title\"\n > {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: ReactNode;\n size?: ModalSize;\n closeOnInteractOutside?: boolean;\n onOpenAutoFocus?: ModalOpenAutoFocusHandler;\n onInteractOutside?: ModalContentProps[\"onInteractOutside\"];\n onKeyDown?: ModalContentProps[\"onKeyDown\"];\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalRoot({\n open,\n defaultOpen,\n onOpenChange,\n children,\n size = \"md\",\n closeOnInteractOutside = true,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onInteractOutside,\n onKeyDown,\n onKeyUp,\n ref,\n ...props\n}: ModalRootProps) {\n const autoFocus = useModalAutoFocus(onOpenAutoFocus, onCloseAutoFocus);\n return (\n <RadixDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n <RadixDialog.Portal>\n <RadixDialog.Overlay className={overlayVariants({ variant: \"dim\" })} />\n <RadixDialog.Content\n ref={ref}\n className={cn(\n \"aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal)\",\n \"aivex:-translate-x-1/2 aivex:-translate-y-1/2\",\n modalSurfaceClassName,\n modalSizeClasses[size],\n )}\n onInteractOutside={(event) => {\n onInteractOutside?.(event);\n if (!closeOnInteractOutside && !event.defaultPrevented) event.preventDefault();\n }}\n {...autoFocus}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n {...props}\n >\n <ModalContext.Provider value={true}>{children}</ModalContext.Provider>\n </RadixDialog.Content>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n );\n}\n\nexport interface ModalSurfaceProps {\n /** 제목(필수) — 표면의 aria-labelledby로 연결된다. */\n title: ReactNode;\n /** 제목 아래 설명. */\n description?: ReactNode;\n /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등). */\n headingButton?: ModalHeadingButtonProps;\n /** 본문 — 넘치면 본문 영역만 세로 스크롤한다. */\n children?: ReactNode;\n /** 푸터 왼쪽 끝의 ghost 버튼(보조 동작). */\n tertiaryButton?: ModalButtonProps;\n /** 푸터 오른쪽의 secondary 버튼(취소·이전). */\n secondaryButton?: ModalButtonProps;\n /** 푸터 오른쪽 끝의 primary 버튼(확인·다음). */\n primaryButton?: ModalButtonProps;\n /**\n * 최대 폭.\n * @default \"md\"\n */\n size?: ModalSize;\n /** 지정하면 헤더에 닫기(X) 버튼을 렌더한다. 열림 상태가 없으므로 숨김은 소비자가 처리한다. */\n onClose?: () => void;\n /**\n * 닫기 버튼 aria-label.\n * @default \"Close modal\"\n */\n closeAriaLabel?: string;\n /** 닫기(X) 버튼에 덧붙일 속성 — 예: `{ \"data-track-id\": \"invite-close-btn\" }`. */\n closeButtonProps?: ModalCloseButtonProps;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * Modal과 같은 카드 표면을 포털·딤·포커스 트랩 없이 제자리에 그리는 정적 변형.\n *\n * 상단 버튼 아래에 붙는 패널처럼 위치를 소비자가 잡는 경우나 문서·미리보기에 쓴다.\n * 열림 상태·Esc·바깥 클릭 처리가 없으니 화면을 막는 모달이 필요하면 Modal을 쓴다.\n *\n * @example\n * ```tsx\n * import { ModalSurface } from \"@aivex/ui\";\n *\n * <div className=\"absolute right-6 top-6\">\n * <ModalSurface title=\"작업 상태\" size=\"md\" onClose={() => setVisible(false)}>\n * 진행 중인 작업 2개\n * </ModalSurface>\n * </div>\n * ```\n */\nfunction ModalSurface({\n title,\n description,\n headingButton,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n size = \"md\",\n onClose,\n closeAriaLabel,\n closeButtonProps,\n ref,\n}: ModalSurfaceProps) {\n const titleId = useId();\n const hasFooter = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <div\n ref={ref}\n role=\"dialog\"\n // 포커스를 가두지도 뒤를 막지도 않는 비모달 표면이라 aria-modal을 달지 않는다.\n // 달면 보조기기가 나머지 페이지를 비활성으로 보고 탐색을 막는다.\n aria-labelledby={titleId}\n className={cn(modalSurfaceClassName, modalSizeClasses[size])}\n >\n <ModalHeader\n title={title}\n titleId={titleId}\n description={description}\n headingButton={headingButton}\n onClose={onClose}\n closeAriaLabel={closeAriaLabel}\n closeButtonProps={closeButtonProps}\n />\n {children && <ModalBody>{children}</ModalBody>}\n {hasFooter && (\n <ModalFooter\n tertiaryButton={tertiaryButton}\n secondaryButton={secondaryButton}\n primaryButton={primaryButton}\n />\n )}\n </div>\n );\n}\n\nexport interface ModalProps {\n /** 열림 상태(제어). onOpenChange와 함께 쓴다. */\n open?: boolean;\n /** 초기 열림 상태(비제어). */\n defaultOpen?: boolean;\n /** 열림 상태가 바뀔 때 호출 — 닫기(X)·Esc·바깥 클릭 모두 false로 알린다. */\n onOpenChange?: (open: boolean) => void;\n /** 제목(필수) — 모달의 접근성 이름이 된다. */\n title: ReactNode;\n /** 제목 아래 설명 — 접근성 설명으로 연결된다. */\n description?: ReactNode;\n /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등). */\n headingButton?: ModalHeadingButtonProps;\n /** 본문(폼·목록 등) — 넘치면 본문 영역만 세로 스크롤한다. */\n children?: ReactNode;\n /** 푸터 왼쪽 끝의 ghost 버튼(보조 동작). 눌러도 자동으로 닫히지 않는다. */\n tertiaryButton?: ModalButtonProps;\n /** 푸터 오른쪽의 secondary 버튼(취소·이전). 눌러도 자동으로 닫히지 않는다. */\n secondaryButton?: ModalButtonProps;\n /** 푸터 오른쪽 끝의 primary 버튼(확인·다음). 눌러도 자동으로 닫히지 않는다. */\n primaryButton?: ModalButtonProps;\n /**\n * 최대 폭.\n * @default \"md\"\n */\n size?: ModalSize;\n /**\n * 바깥(딤) 클릭으로 닫을지 여부. 입력 중 실수로 닫히면 안 되는 폼은 false.\n * @default true\n */\n closeOnInteractOutside?: boolean;\n /** 열릴 때 자동 포커스 직전 호출 — event.preventDefault()로 기본 포커스 이동을 막을 수 있다. */\n onOpenAutoFocus?: ModalOpenAutoFocusHandler;\n /**\n * 헤더 닫기(X) 버튼 aria-label.\n * @default \"Close modal\"\n */\n closeAriaLabel?: string;\n /** 헤더 닫기(X) 버튼에 덧붙일 속성 — 예: `{ \"data-track-id\": \"invite-close-btn\" }`. */\n closeButtonProps?: ModalCloseButtonProps;\n}\n\n/**\n * 제목·본문·푸터 버튼으로 구성된 표준 모달 창(딤 + 화면 중앙 카드).\n *\n * 입력 폼, 선택 목록, 여러 단계 흐름처럼 본문이 있는 작업에 쓴다. 제목·설명과 버튼만 있는\n * 짧은 확인 질문은 Dialog, 카드 틀을 벗어난 자유 레이아웃(검색 팔레트 등)은 ModalBase,\n * 화면 옆에서 미끄러져 나오는 시트는 Drawer를 쓴다. 헤더에 닫기(X) 버튼이 자동으로 붙고,\n * 푸터 버튼은 눌러도 닫히지 않으니 onClick에서 open을 직접 false로 바꾼다. title은 필수다.\n *\n * @example\n * ```tsx\n * import { Button, Modal, Textbox } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(false);\n *\n * <Button onClick={() => setOpen(true)}>워크스페이스 생성</Button>\n * <Modal\n * open={open}\n * onOpenChange={setOpen}\n * size=\"md\"\n * title=\"워크스페이스 생성\"\n * description=\"생성할 워크스페이스명을 입력하세요.\"\n * secondaryButton={{ children: \"취소\", onClick: () => setOpen(false) }}\n * primaryButton={{ children: \"생성\", onClick: () => setOpen(false) }}\n * >\n * <Textbox aria-label=\"워크스페이스명\" placeholder=\"워크스페이스명을 입력하세요\" />\n * </Modal>\n * ```\n */\nfunction Modal({\n open,\n defaultOpen,\n onOpenChange,\n title,\n description,\n headingButton,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n size,\n closeOnInteractOutside,\n onOpenAutoFocus,\n closeAriaLabel,\n closeButtonProps,\n}: ModalProps) {\n const hasFooter = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <ModalRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n size={size}\n closeOnInteractOutside={closeOnInteractOutside}\n onOpenAutoFocus={onOpenAutoFocus}\n // 설명이 없는 모달임을 Radix에 알린다 — 명시하지 않으면 개발 모드에서 매번 경고한다.\n {...(description ? {} : { \"aria-describedby\": undefined })}\n >\n <ModalHeader\n title={title}\n description={description}\n headingButton={headingButton}\n closeAriaLabel={closeAriaLabel}\n closeButtonProps={closeButtonProps}\n />\n {children && <ModalBody>{children}</ModalBody>}\n {hasFooter && (\n <ModalFooter\n tertiaryButton={tertiaryButton}\n secondaryButton={secondaryButton}\n primaryButton={primaryButton}\n />\n )}\n </ModalRoot>\n );\n}\n\nexport { Modal, ModalSurface };\n"],"mappings":"2YAoBA,IAAM,GAAA,EAAA,EAAA,eAA6B,GAAM,CASnC,EAAmB,CACvB,GAAI,uBACJ,GAAI,uBACJ,GAAI,uBACJ,GAAI,sBACJ,KAAM,6DACP,CAEK,EAAwB,EAAA,GAC5B,+GACA,mHACD,CACK,EAAuB,sDAa7B,SAAS,EAAY,CACnB,QACA,UACA,cACA,gBACA,UACA,iBAAiB,cACjB,mBACA,MACA,GAAG,GACgB,CACnB,IAAM,GAAA,EAAA,EAAA,YAA+B,EAAa,CAC5C,GACJ,EAAA,EAAA,KAAC,KAAD,CACE,GAAK,EAAU,CAAE,GAAI,EAAS,CAAG,EAAE,CACn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GAAO,WAAiC,CAAA,CAClD,CAAA,CACH,CAAA,CAAA,CACJ,CAAA,CAqDvB,SAAS,EAAa,CACpB,QACA,cACA,gBACA,WACA,iBACA,kBACA,gBACA,OAAO,KACP,UACA,iBACA,mBACA,OACoB,CACpB,IAAM,GAAA,EAAA,EAAA,QAAiB,CACjB,EAAY,GAAQ,GAAkB,GAAmB,GAE/D,OACE,EAAA,EAAA,MAAC,MAAD,CACO,MACL,KAAK,SAGL,kBAAiB,EACjB,UAAW,EAAA,GAAG,EAAuB,EAAiB,GAAM,UAN9D,EAQE,EAAA,EAAA,KAAC,EAAD,CACS,QACE,UACI,cACE,gBACN,UACO,iBACE,mBAClB,CAAA,CACD,IAAY,EAAA,EAAA,KAAC,EAAD,CAAY,WAAqB,CAAA,CAC7C,IACC,EAAA,EAAA,KAAC,EAAD,CACkB,iBACC,kBACF,gBACf,CAAA,CAEA,GA0EV,SAAS,EAAM,CACb,OACA,cACA,eACA,QACA,cACA,gBACA,WACA,iBACA,kBACA,gBACA,OACA,yBACA,kBACA,iBACA,oBACa,CACb,IAAM,EAAY,GAAQ,GAAkB,GAAmB,GAE/D,OACE,EAAA,EAAA,MAAC,EAAD,CACQ,OACO,cACC,eACR,OACkB,yBACP,kBAEjB,GAAK,EAAc,EAAE,CAAG,CAAE,mBAAoB,IAAA,GAAW,UAR3D,EAUE,EAAA,EAAA,KAAC,EAAD,CACS,QACM,cACE,gBACC,iBACE,mBAClB,CAAA,CACD,IAAY,EAAA,EAAA,KAAC,EAAD,CAAY,WAAqB,CAAA,CAC7C,IACC,EAAA,EAAA,KAAC,EAAD,CACkB,iBACC,kBACF,gBACf,CAAA,CAEM"}
@@ -1,6 +1,7 @@
1
1
  import { type ReactNode, type Ref } from "react";
2
2
  import { type ButtonProps } from "../Button/index.cjs";
3
3
  import type { IconButtonProps } from "../IconButton/index.cjs";
4
+ import type { DataAttributes } from "../../utils/dataAttributes.cjs";
4
5
  type ModalOpenAutoFocusHandler = (event: Event) => void;
5
6
  /**
6
7
  * Modal 최대 폭 — sm 384px, md 548px, lg 720px, xl 960px, full은 화면 크기 - 32px(높이 포함).
@@ -8,14 +9,20 @@ type ModalOpenAutoFocusHandler = (event: Event) => void;
8
9
  */
9
10
  export type ModalSize = "sm" | "md" | "lg" | "xl" | "full";
10
11
  /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등) — IconButton props에서 크기·모양은 Modal이 고정한다. */
11
- export interface ModalHeadingButtonProps extends Omit<IconButtonProps, "asChild" | "children" | "className" | "ref" | "shape" | "size"> {
12
+ export interface ModalHeadingButtonProps extends Omit<IconButtonProps, "asChild" | "children" | "className" | "ref" | "shape" | "size">, DataAttributes {
12
13
  /** 아이콘 전용 버튼이라 접근성 이름이 필수다. */
13
14
  "aria-label": string;
14
15
  /** 버튼 안에 그릴 아이콘(예: `<ArrowLeftIcon size={24} />`). */
15
16
  children: ReactNode;
16
17
  }
18
+ /**
19
+ * 헤더 닫기(X) 버튼에 덧붙일 속성(`data-*`·`id`·`disabled` 등) — 크기·모양·동작·접근성 이름은
20
+ * Modal이 고정한다(이름은 closeAriaLabel로 바꾼다).
21
+ */
22
+ export interface ModalCloseButtonProps extends Omit<IconButtonProps, "aria-label" | "asChild" | "children" | "className" | "dangerouslySetInnerHTML" | "onClick" | "ref" | "shape" | "size">, DataAttributes {
23
+ }
17
24
  /** 푸터 버튼 — Button props에서 색·크기·스타일은 Modal이 고정하고 라벨은 children으로 받는다. */
18
- export interface ModalButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant"> {
25
+ export interface ModalButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant">, DataAttributes {
19
26
  /** 버튼 라벨 */
20
27
  children: ReactNode;
21
28
  }
@@ -46,6 +53,8 @@ export interface ModalSurfaceProps {
46
53
  * @default "Close modal"
47
54
  */
48
55
  closeAriaLabel?: string;
56
+ /** 닫기(X) 버튼에 덧붙일 속성 — 예: `{ "data-track-id": "invite-close-btn" }`. */
57
+ closeButtonProps?: ModalCloseButtonProps;
49
58
  ref?: Ref<HTMLDivElement>;
50
59
  }
51
60
  /**
@@ -65,7 +74,7 @@ export interface ModalSurfaceProps {
65
74
  * </div>
66
75
  * ```
67
76
  */
68
- declare function ModalSurface({ title, description, headingButton, children, tertiaryButton, secondaryButton, primaryButton, size, onClose, closeAriaLabel, ref, }: ModalSurfaceProps): import("react/jsx-runtime").JSX.Element;
77
+ declare function ModalSurface({ title, description, headingButton, children, tertiaryButton, secondaryButton, primaryButton, size, onClose, closeAriaLabel, closeButtonProps, ref, }: ModalSurfaceProps): import("react/jsx-runtime").JSX.Element;
69
78
  export interface ModalProps {
70
79
  /** 열림 상태(제어). onOpenChange와 함께 쓴다. */
71
80
  open?: boolean;
@@ -104,6 +113,8 @@ export interface ModalProps {
104
113
  * @default "Close modal"
105
114
  */
106
115
  closeAriaLabel?: string;
116
+ /** 헤더 닫기(X) 버튼에 덧붙일 속성 — 예: `{ "data-track-id": "invite-close-btn" }`. */
117
+ closeButtonProps?: ModalCloseButtonProps;
107
118
  }
108
119
  /**
109
120
  * 제목·본문·푸터 버튼으로 구성된 표준 모달 창(딤 + 화면 중앙 카드).
@@ -133,5 +144,5 @@ export interface ModalProps {
133
144
  * </Modal>
134
145
  * ```
135
146
  */
136
- declare function Modal({ open, defaultOpen, onOpenChange, title, description, headingButton, children, tertiaryButton, secondaryButton, primaryButton, size, closeOnInteractOutside, onOpenAutoFocus, closeAriaLabel, }: ModalProps): import("react/jsx-runtime").JSX.Element;
147
+ declare function Modal({ open, defaultOpen, onOpenChange, title, description, headingButton, children, tertiaryButton, secondaryButton, primaryButton, size, closeOnInteractOutside, onOpenAutoFocus, closeAriaLabel, closeButtonProps, }: ModalProps): import("react/jsx-runtime").JSX.Element;
137
148
  export { Modal, ModalSurface };
@@ -1,6 +1,7 @@
1
1
  import { type ReactNode, type Ref } from "react";
2
2
  import { type ButtonProps } from "../Button/index.js";
3
3
  import type { IconButtonProps } from "../IconButton/index.js";
4
+ import type { DataAttributes } from "../../utils/dataAttributes.js";
4
5
  type ModalOpenAutoFocusHandler = (event: Event) => void;
5
6
  /**
6
7
  * Modal 최대 폭 — sm 384px, md 548px, lg 720px, xl 960px, full은 화면 크기 - 32px(높이 포함).
@@ -8,14 +9,20 @@ type ModalOpenAutoFocusHandler = (event: Event) => void;
8
9
  */
9
10
  export type ModalSize = "sm" | "md" | "lg" | "xl" | "full";
10
11
  /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등) — IconButton props에서 크기·모양은 Modal이 고정한다. */
11
- export interface ModalHeadingButtonProps extends Omit<IconButtonProps, "asChild" | "children" | "className" | "ref" | "shape" | "size"> {
12
+ export interface ModalHeadingButtonProps extends Omit<IconButtonProps, "asChild" | "children" | "className" | "ref" | "shape" | "size">, DataAttributes {
12
13
  /** 아이콘 전용 버튼이라 접근성 이름이 필수다. */
13
14
  "aria-label": string;
14
15
  /** 버튼 안에 그릴 아이콘(예: `<ArrowLeftIcon size={24} />`). */
15
16
  children: ReactNode;
16
17
  }
18
+ /**
19
+ * 헤더 닫기(X) 버튼에 덧붙일 속성(`data-*`·`id`·`disabled` 등) — 크기·모양·동작·접근성 이름은
20
+ * Modal이 고정한다(이름은 closeAriaLabel로 바꾼다).
21
+ */
22
+ export interface ModalCloseButtonProps extends Omit<IconButtonProps, "aria-label" | "asChild" | "children" | "className" | "dangerouslySetInnerHTML" | "onClick" | "ref" | "shape" | "size">, DataAttributes {
23
+ }
17
24
  /** 푸터 버튼 — Button props에서 색·크기·스타일은 Modal이 고정하고 라벨은 children으로 받는다. */
18
- export interface ModalButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant"> {
25
+ export interface ModalButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant">, DataAttributes {
19
26
  /** 버튼 라벨 */
20
27
  children: ReactNode;
21
28
  }
@@ -46,6 +53,8 @@ export interface ModalSurfaceProps {
46
53
  * @default "Close modal"
47
54
  */
48
55
  closeAriaLabel?: string;
56
+ /** 닫기(X) 버튼에 덧붙일 속성 — 예: `{ "data-track-id": "invite-close-btn" }`. */
57
+ closeButtonProps?: ModalCloseButtonProps;
49
58
  ref?: Ref<HTMLDivElement>;
50
59
  }
51
60
  /**
@@ -65,7 +74,7 @@ export interface ModalSurfaceProps {
65
74
  * </div>
66
75
  * ```
67
76
  */
68
- declare function ModalSurface({ title, description, headingButton, children, tertiaryButton, secondaryButton, primaryButton, size, onClose, closeAriaLabel, ref, }: ModalSurfaceProps): import("react/jsx-runtime").JSX.Element;
77
+ declare function ModalSurface({ title, description, headingButton, children, tertiaryButton, secondaryButton, primaryButton, size, onClose, closeAriaLabel, closeButtonProps, ref, }: ModalSurfaceProps): import("react/jsx-runtime").JSX.Element;
69
78
  export interface ModalProps {
70
79
  /** 열림 상태(제어). onOpenChange와 함께 쓴다. */
71
80
  open?: boolean;
@@ -104,6 +113,8 @@ export interface ModalProps {
104
113
  * @default "Close modal"
105
114
  */
106
115
  closeAriaLabel?: string;
116
+ /** 헤더 닫기(X) 버튼에 덧붙일 속성 — 예: `{ "data-track-id": "invite-close-btn" }`. */
117
+ closeButtonProps?: ModalCloseButtonProps;
107
118
  }
108
119
  /**
109
120
  * 제목·본문·푸터 버튼으로 구성된 표준 모달 창(딤 + 화면 중앙 카드).
@@ -133,5 +144,5 @@ export interface ModalProps {
133
144
  * </Modal>
134
145
  * ```
135
146
  */
136
- declare function Modal({ open, defaultOpen, onOpenChange, title, description, headingButton, children, tertiaryButton, secondaryButton, primaryButton, size, closeOnInteractOutside, onOpenAutoFocus, closeAriaLabel, }: ModalProps): import("react/jsx-runtime").JSX.Element;
147
+ declare function Modal({ open, defaultOpen, onOpenChange, title, description, headingButton, children, tertiaryButton, secondaryButton, primaryButton, size, closeOnInteractOutside, onOpenAutoFocus, closeAriaLabel, closeButtonProps, }: ModalProps): import("react/jsx-runtime").JSX.Element;
137
148
  export { Modal, ModalSurface };
@@ -16,45 +16,46 @@ var f = o(!1), p = {
16
16
  xl: "aivex:max-w-[960px]",
17
17
  full: "aivex:h-[calc(100dvh-32px)] aivex:max-w-[calc(100vw-32px)]"
18
18
  }, m = e("aivex:flex aivex:max-h-[80dvh] aivex:w-[85vw] aivex:flex-col aivex:gap-2xl aivex:overflow-hidden aivex:p-2xl", "aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:shadow-xl aivex:outline-none"), h = "aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs";
19
- function g({ title: e, titleId: n, description: i, headingButton: a, onClose: o, closeAriaLabel: c = "Close modal", ref: p, ...m }) {
20
- let g = s(f), v = /* @__PURE__ */ l("h2", {
19
+ function g({ title: e, titleId: n, description: i, headingButton: a, onClose: o, closeAriaLabel: c = "Close modal", closeButtonProps: p, ref: m, ...g }) {
20
+ let v = s(f), y = /* @__PURE__ */ l("h2", {
21
21
  ...n ? { id: n } : {},
22
22
  className: "aivex:m-0 aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary aivex:break-words",
23
23
  children: e
24
- }), y = i ? /* @__PURE__ */ l("p", {
24
+ }), b = i ? /* @__PURE__ */ l("p", {
25
25
  className: "aivex:m-0 aivex:whitespace-pre-line aivex:text-body-md-regular aivex:text-text-secondary aivex:break-words",
26
26
  children: i
27
- }) : null, b = /* @__PURE__ */ l(r, {
27
+ }) : null, x = /* @__PURE__ */ l(r, {
28
+ ...p,
28
29
  size: "md",
29
30
  onClick: o,
30
31
  className: "aivex:shrink-0",
31
32
  "aria-label": c,
32
33
  children: /* @__PURE__ */ l(t, { size: 24 })
33
- }), x = a ? /* @__PURE__ */ l(_, { button: a }) : null;
34
+ }), S = a ? /* @__PURE__ */ l(_, { button: a }) : null;
34
35
  return /* @__PURE__ */ u("div", {
35
- ref: p,
36
+ ref: m,
36
37
  className: h,
37
- ...m,
38
+ ...g,
38
39
  children: [/* @__PURE__ */ u("div", {
39
40
  className: "aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-md",
40
41
  children: [
41
- x,
42
+ S,
42
43
  /* @__PURE__ */ l("div", {
43
44
  className: "aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:justify-center",
44
- children: g ? /* @__PURE__ */ l(d.Title, {
45
+ children: v ? /* @__PURE__ */ l(d.Title, {
45
46
  asChild: !0,
46
- children: v
47
- }) : v
47
+ children: y
48
+ }) : y
48
49
  }),
49
- o ? b : g && /* @__PURE__ */ l(d.Close, {
50
+ o ? x : v && /* @__PURE__ */ l(d.Close, {
50
51
  asChild: !0,
51
- children: b
52
+ children: x
52
53
  })
53
54
  ]
54
- }), g && y ? /* @__PURE__ */ l(d.Description, {
55
+ }), v && b ? /* @__PURE__ */ l(d.Description, {
55
56
  asChild: !0,
56
- children: y
57
- }) : y]
57
+ children: b
58
+ }) : b]
58
59
  });
59
60
  }
60
61
  function _({ button: e }) {
@@ -138,24 +139,25 @@ function x({ open: t, defaultOpen: n, onOpenChange: r, children: o, size: s = "m
138
139
  })] })
139
140
  });
140
141
  }
141
- function S({ title: t, description: n, headingButton: r, children: i, tertiaryButton: a, secondaryButton: o, primaryButton: s, size: d = "md", onClose: f, closeAriaLabel: h, ref: _ }) {
142
- let b = c(), x = !!(a || o || s);
142
+ function S({ title: t, description: n, headingButton: r, children: i, tertiaryButton: a, secondaryButton: o, primaryButton: s, size: d = "md", onClose: f, closeAriaLabel: h, closeButtonProps: _, ref: b }) {
143
+ let x = c(), S = !!(a || o || s);
143
144
  return /* @__PURE__ */ u("div", {
144
- ref: _,
145
+ ref: b,
145
146
  role: "dialog",
146
- "aria-labelledby": b,
147
+ "aria-labelledby": x,
147
148
  className: e(m, p[d]),
148
149
  children: [
149
150
  /* @__PURE__ */ l(g, {
150
151
  title: t,
151
- titleId: b,
152
+ titleId: x,
152
153
  description: n,
153
154
  headingButton: r,
154
155
  onClose: f,
155
- closeAriaLabel: h
156
+ closeAriaLabel: h,
157
+ closeButtonProps: _
156
158
  }),
157
159
  i && /* @__PURE__ */ l(v, { children: i }),
158
- x && /* @__PURE__ */ l(y, {
160
+ S && /* @__PURE__ */ l(y, {
159
161
  tertiaryButton: a,
160
162
  secondaryButton: o,
161
163
  primaryButton: s
@@ -163,8 +165,8 @@ function S({ title: t, description: n, headingButton: r, children: i, tertiaryBu
163
165
  ]
164
166
  });
165
167
  }
166
- function C({ open: e, defaultOpen: t, onOpenChange: n, title: r, description: i, headingButton: a, children: o, tertiaryButton: s, secondaryButton: c, primaryButton: d, size: f, closeOnInteractOutside: p, onOpenAutoFocus: m, closeAriaLabel: h }) {
167
- let _ = !!(s || c || d);
168
+ function C({ open: e, defaultOpen: t, onOpenChange: n, title: r, description: i, headingButton: a, children: o, tertiaryButton: s, secondaryButton: c, primaryButton: d, size: f, closeOnInteractOutside: p, onOpenAutoFocus: m, closeAriaLabel: h, closeButtonProps: _ }) {
169
+ let b = !!(s || c || d);
168
170
  return /* @__PURE__ */ u(x, {
169
171
  open: e,
170
172
  defaultOpen: t,
@@ -178,10 +180,11 @@ function C({ open: e, defaultOpen: t, onOpenChange: n, title: r, description: i,
178
180
  title: r,
179
181
  description: i,
180
182
  headingButton: a,
181
- closeAriaLabel: h
183
+ closeAriaLabel: h,
184
+ closeButtonProps: _
182
185
  }),
183
186
  o && /* @__PURE__ */ l(v, { children: o }),
184
- _ && /* @__PURE__ */ l(y, {
187
+ b && /* @__PURE__ */ l(y, {
185
188
  tertiaryButton: s,
186
189
  secondaryButton: c,
187
190
  primaryButton: d
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","names":[],"sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import * as RadixDialog from \"@radix-ui/react-dialog\";\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport type { IconButtonProps } from \"@/components/IconButton\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { overlayVariants } from \"@/components/Overlay/Overlay\";\nimport { cn } from \"@/utils/cn\";\nimport { useModalAutoFocus } from \"@/utils/useModalAutoFocus\";\n\ntype ModalContentProps = ComponentPropsWithoutRef<typeof RadixDialog.Content>;\nconst ModalContext = createContext(false);\ntype ModalOpenAutoFocusHandler = (event: Event) => void;\n\n/**\n * Modal 최대 폭 — sm 384px, md 548px, lg 720px, xl 960px, full은 화면 크기 - 32px(높이 포함).\n * 높이는 내용만큼이며 화면 높이의 80%를 넘으면 본문이 스크롤된다.\n */\nexport type ModalSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\nconst modalSizeClasses = {\n sm: \"aivex:max-w-modal-sm\",\n md: \"aivex:max-w-modal-md\",\n lg: \"aivex:max-w-modal-lg\",\n xl: \"aivex:max-w-[960px]\",\n full: \"aivex:h-[calc(100dvh-32px)] aivex:max-w-[calc(100vw-32px)]\",\n} as const;\n\nconst modalSurfaceClassName = cn(\n \"aivex:flex aivex:max-h-[80dvh] aivex:w-[85vw] aivex:flex-col aivex:gap-2xl aivex:overflow-hidden aivex:p-2xl\",\n \"aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:shadow-xl aivex:outline-none\",\n);\nconst modalHeaderClassName = \"aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs\";\n\ninterface ModalHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\" | \"title\"> {\n title: ReactNode;\n titleId?: string;\n description?: ReactNode;\n headingButton?: ModalHeadingButtonProps;\n onClose?: () => void;\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalHeader({\n title,\n titleId,\n description,\n headingButton,\n onClose,\n closeAriaLabel = \"Close modal\",\n ref,\n ...props\n}: ModalHeaderProps) {\n const isInsideModalRoot = useContext(ModalContext);\n const titleElement = (\n <h2\n {...(titleId ? { id: titleId } : {})}\n className=\"aivex:m-0 aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary aivex:break-words\"\n >\n {title}\n </h2>\n );\n const descriptionElement = description ? (\n <p className=\"aivex:m-0 aivex:whitespace-pre-line aivex:text-body-md-regular aivex:text-text-secondary aivex:break-words\">\n {description}\n </p>\n ) : null;\n const closeButton = (\n <IconButton size=\"md\" onClick={onClose} className=\"aivex:shrink-0\" aria-label={closeAriaLabel}>\n <CloseIcon size={24} />\n </IconButton>\n );\n const headingButtonElement = headingButton ? <ModalHeadingButton button={headingButton} /> : null;\n\n return (\n <div ref={ref} className={modalHeaderClassName} {...props}>\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-md\">\n {headingButtonElement}\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:justify-center\">\n {isInsideModalRoot ? (\n <RadixDialog.Title asChild>{titleElement}</RadixDialog.Title>\n ) : (\n titleElement\n )}\n </div>\n {onClose\n ? closeButton\n : isInsideModalRoot && <RadixDialog.Close asChild>{closeButton}</RadixDialog.Close>}\n </div>\n {isInsideModalRoot && descriptionElement ? (\n <RadixDialog.Description asChild>{descriptionElement}</RadixDialog.Description>\n ) : (\n descriptionElement\n )}\n </div>\n );\n}\n\n/** 제목 왼쪽 아이콘 버튼(뒤로 가기 등) — IconButton props에서 크기·모양은 Modal이 고정한다. */\nexport interface ModalHeadingButtonProps\n extends Omit<IconButtonProps, \"asChild\" | \"children\" | \"className\" | \"ref\" | \"shape\" | \"size\"> {\n /** 아이콘 전용 버튼이라 접근성 이름이 필수다. */\n \"aria-label\": string;\n /** 버튼 안에 그릴 아이콘(예: `<ArrowLeftIcon size={24} />`). */\n children: ReactNode;\n}\n\nfunction ModalHeadingButton({ button }: { button: ModalHeadingButtonProps }) {\n const { children, ...props } = button;\n\n return (\n <IconButton size=\"md\" className=\"aivex:shrink-0\" {...props}>\n {children}\n </IconButton>\n );\n}\n\ninterface ModalBodyProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\"> {\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalBody({ children, ref, ...props }: ModalBodyProps) {\n return (\n // 세로 flex여야 표면의 max-h가 자식까지 전달돼, 자식의 flex-1 min-h-0 목록이 본문 대신 스크롤된다.\n // 일반 자식이 줄어들지 않게 하는 규칙은 styles.css(data-aivex-modal-body)에 있다.\n <div\n ref={ref}\n data-aivex-modal-body=\"\"\n className=\"aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col aivex:overflow-y-auto\"\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/** 푸터 버튼 — Button props에서 색·크기·스타일은 Modal이 고정하고 라벨은 children으로 받는다. */\nexport interface ModalButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n > {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\ninterface ModalFooterProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\" | \"children\"> {\n tertiaryButton?: ModalButtonProps;\n secondaryButton?: ModalButtonProps;\n primaryButton?: ModalButtonProps;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalFooter({\n tertiaryButton,\n secondaryButton,\n primaryButton,\n ref,\n ...props\n}: ModalFooterProps) {\n return (\n <div\n ref={ref}\n className=\"aivex:flex aivex:h-10 aivex:w-full aivex:items-center aivex:justify-end aivex:gap-lg\"\n {...props}\n >\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-center aivex:justify-start\">\n {tertiaryButton && (\n <ModalActionButton\n button={tertiaryButton}\n variant=\"ghost\"\n color=\"secondary\"\n className=\"aivex:min-w-9\"\n />\n )}\n </div>\n <div className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-end aivex:gap-lg\">\n {secondaryButton && (\n <ModalActionButton\n button={secondaryButton}\n variant=\"solid\"\n color=\"secondary\"\n className=\"aivex:min-w-[84px]\"\n />\n )}\n {primaryButton && (\n <ModalActionButton\n button={primaryButton}\n variant=\"solid\"\n color=\"primary\"\n className=\"aivex:min-w-[84px]\"\n />\n )}\n </div>\n </div>\n );\n}\n\ninterface ModalActionButtonProps {\n button: ModalButtonProps;\n variant: ButtonProps[\"variant\"];\n color: ButtonProps[\"color\"];\n className?: string;\n}\n\nfunction ModalActionButton({ button, variant, color, className }: ModalActionButtonProps) {\n const { children, ...props } = button;\n\n return (\n <Button variant={variant} color={color} size=\"lg\" className={className} {...props}>\n {children}\n </Button>\n );\n}\n\ninterface ModalRootProps\n extends Omit<\n ModalContentProps,\n | \"children\"\n | \"className\"\n | \"defaultOpen\"\n | \"onInteractOutside\"\n | \"onKeyDown\"\n | \"open\"\n | \"ref\"\n | \"title\"\n > {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: ReactNode;\n size?: ModalSize;\n closeOnInteractOutside?: boolean;\n onOpenAutoFocus?: ModalOpenAutoFocusHandler;\n onInteractOutside?: ModalContentProps[\"onInteractOutside\"];\n onKeyDown?: ModalContentProps[\"onKeyDown\"];\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalRoot({\n open,\n defaultOpen,\n onOpenChange,\n children,\n size = \"md\",\n closeOnInteractOutside = true,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onInteractOutside,\n onKeyDown,\n onKeyUp,\n ref,\n ...props\n}: ModalRootProps) {\n const autoFocus = useModalAutoFocus(onOpenAutoFocus, onCloseAutoFocus);\n return (\n <RadixDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n <RadixDialog.Portal>\n <RadixDialog.Overlay className={overlayVariants({ variant: \"dim\" })} />\n <RadixDialog.Content\n ref={ref}\n className={cn(\n \"aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal)\",\n \"aivex:-translate-x-1/2 aivex:-translate-y-1/2\",\n modalSurfaceClassName,\n modalSizeClasses[size],\n )}\n onInteractOutside={(event) => {\n onInteractOutside?.(event);\n if (!closeOnInteractOutside && !event.defaultPrevented) event.preventDefault();\n }}\n {...autoFocus}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n {...props}\n >\n <ModalContext.Provider value={true}>{children}</ModalContext.Provider>\n </RadixDialog.Content>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n );\n}\n\nexport interface ModalSurfaceProps {\n /** 제목(필수) — 표면의 aria-labelledby로 연결된다. */\n title: ReactNode;\n /** 제목 아래 설명. */\n description?: ReactNode;\n /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등). */\n headingButton?: ModalHeadingButtonProps;\n /** 본문 — 넘치면 본문 영역만 세로 스크롤한다. */\n children?: ReactNode;\n /** 푸터 왼쪽 끝의 ghost 버튼(보조 동작). */\n tertiaryButton?: ModalButtonProps;\n /** 푸터 오른쪽의 secondary 버튼(취소·이전). */\n secondaryButton?: ModalButtonProps;\n /** 푸터 오른쪽 끝의 primary 버튼(확인·다음). */\n primaryButton?: ModalButtonProps;\n /**\n * 최대 폭.\n * @default \"md\"\n */\n size?: ModalSize;\n /** 지정하면 헤더에 닫기(X) 버튼을 렌더한다. 열림 상태가 없으므로 숨김은 소비자가 처리한다. */\n onClose?: () => void;\n /**\n * 닫기 버튼 aria-label.\n * @default \"Close modal\"\n */\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * Modal과 같은 카드 표면을 포털·딤·포커스 트랩 없이 제자리에 그리는 정적 변형.\n *\n * 상단 버튼 아래에 붙는 패널처럼 위치를 소비자가 잡는 경우나 문서·미리보기에 쓴다.\n * 열림 상태·Esc·바깥 클릭 처리가 없으니 화면을 막는 모달이 필요하면 Modal을 쓴다.\n *\n * @example\n * ```tsx\n * import { ModalSurface } from \"@aivex/ui\";\n *\n * <div className=\"absolute right-6 top-6\">\n * <ModalSurface title=\"작업 상태\" size=\"md\" onClose={() => setVisible(false)}>\n * 진행 중인 작업 2개\n * </ModalSurface>\n * </div>\n * ```\n */\nfunction ModalSurface({\n title,\n description,\n headingButton,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n size = \"md\",\n onClose,\n closeAriaLabel,\n ref,\n}: ModalSurfaceProps) {\n const titleId = useId();\n const hasFooter = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <div\n ref={ref}\n role=\"dialog\"\n // 포커스를 가두지도 뒤를 막지도 않는 비모달 표면이라 aria-modal을 달지 않는다.\n // 달면 보조기기가 나머지 페이지를 비활성으로 보고 탐색을 막는다.\n aria-labelledby={titleId}\n className={cn(modalSurfaceClassName, modalSizeClasses[size])}\n >\n <ModalHeader\n title={title}\n titleId={titleId}\n description={description}\n headingButton={headingButton}\n onClose={onClose}\n closeAriaLabel={closeAriaLabel}\n />\n {children && <ModalBody>{children}</ModalBody>}\n {hasFooter && (\n <ModalFooter\n tertiaryButton={tertiaryButton}\n secondaryButton={secondaryButton}\n primaryButton={primaryButton}\n />\n )}\n </div>\n );\n}\n\nexport interface ModalProps {\n /** 열림 상태(제어). onOpenChange와 함께 쓴다. */\n open?: boolean;\n /** 초기 열림 상태(비제어). */\n defaultOpen?: boolean;\n /** 열림 상태가 바뀔 때 호출 — 닫기(X)·Esc·바깥 클릭 모두 false로 알린다. */\n onOpenChange?: (open: boolean) => void;\n /** 제목(필수) — 모달의 접근성 이름이 된다. */\n title: ReactNode;\n /** 제목 아래 설명 — 접근성 설명으로 연결된다. */\n description?: ReactNode;\n /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등). */\n headingButton?: ModalHeadingButtonProps;\n /** 본문(폼·목록 등) — 넘치면 본문 영역만 세로 스크롤한다. */\n children?: ReactNode;\n /** 푸터 왼쪽 끝의 ghost 버튼(보조 동작). 눌러도 자동으로 닫히지 않는다. */\n tertiaryButton?: ModalButtonProps;\n /** 푸터 오른쪽의 secondary 버튼(취소·이전). 눌러도 자동으로 닫히지 않는다. */\n secondaryButton?: ModalButtonProps;\n /** 푸터 오른쪽 끝의 primary 버튼(확인·다음). 눌러도 자동으로 닫히지 않는다. */\n primaryButton?: ModalButtonProps;\n /**\n * 최대 폭.\n * @default \"md\"\n */\n size?: ModalSize;\n /**\n * 바깥(딤) 클릭으로 닫을지 여부. 입력 중 실수로 닫히면 안 되는 폼은 false.\n * @default true\n */\n closeOnInteractOutside?: boolean;\n /** 열릴 때 자동 포커스 직전 호출 — event.preventDefault()로 기본 포커스 이동을 막을 수 있다. */\n onOpenAutoFocus?: ModalOpenAutoFocusHandler;\n /**\n * 헤더 닫기(X) 버튼 aria-label.\n * @default \"Close modal\"\n */\n closeAriaLabel?: string;\n}\n\n/**\n * 제목·본문·푸터 버튼으로 구성된 표준 모달 창(딤 + 화면 중앙 카드).\n *\n * 입력 폼, 선택 목록, 여러 단계 흐름처럼 본문이 있는 작업에 쓴다. 제목·설명과 버튼만 있는\n * 짧은 확인 질문은 Dialog, 카드 틀을 벗어난 자유 레이아웃(검색 팔레트 등)은 ModalBase,\n * 화면 옆에서 미끄러져 나오는 시트는 Drawer를 쓴다. 헤더에 닫기(X) 버튼이 자동으로 붙고,\n * 푸터 버튼은 눌러도 닫히지 않으니 onClick에서 open을 직접 false로 바꾼다. title은 필수다.\n *\n * @example\n * ```tsx\n * import { Button, Modal, Textbox } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(false);\n *\n * <Button onClick={() => setOpen(true)}>워크스페이스 생성</Button>\n * <Modal\n * open={open}\n * onOpenChange={setOpen}\n * size=\"md\"\n * title=\"워크스페이스 생성\"\n * description=\"생성할 워크스페이스명을 입력하세요.\"\n * secondaryButton={{ children: \"취소\", onClick: () => setOpen(false) }}\n * primaryButton={{ children: \"생성\", onClick: () => setOpen(false) }}\n * >\n * <Textbox aria-label=\"워크스페이스명\" placeholder=\"워크스페이스명을 입력하세요\" />\n * </Modal>\n * ```\n */\nfunction Modal({\n open,\n defaultOpen,\n onOpenChange,\n title,\n description,\n headingButton,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n size,\n closeOnInteractOutside,\n onOpenAutoFocus,\n closeAriaLabel,\n}: ModalProps) {\n const hasFooter = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <ModalRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n size={size}\n closeOnInteractOutside={closeOnInteractOutside}\n onOpenAutoFocus={onOpenAutoFocus}\n // 설명이 없는 모달임을 Radix에 알린다 — 명시하지 않으면 개발 모드에서 매번 경고한다.\n {...(description ? {} : { \"aria-describedby\": undefined })}\n >\n <ModalHeader\n title={title}\n description={description}\n headingButton={headingButton}\n closeAriaLabel={closeAriaLabel}\n />\n {children && <ModalBody>{children}</ModalBody>}\n {hasFooter && (\n <ModalFooter\n tertiaryButton={tertiaryButton}\n secondaryButton={secondaryButton}\n primaryButton={primaryButton}\n />\n )}\n </ModalRoot>\n );\n}\n\nexport { Modal, ModalSurface };\n"],"mappings":";;;;;;;;;;;AAmBA,IAAM,IAAe,EAAc,GAAM,EASnC,IAAmB;CACvB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACP,EAEK,IAAwB,EAC5B,gHACA,mHACD,EACK,IAAuB;AAY7B,SAAS,EAAY,EACnB,UACA,YACA,gBACA,kBACA,YACA,oBAAiB,eACjB,QACA,GAAG,KACgB;CACnB,IAAM,IAAoB,EAAW,EAAa,EAC5C,IACJ,kBAAC,MAAD;EACE,GAAK,IAAU,EAAE,IAAI,GAAS,GAAG,EAAE;EACnC,WAAU;YAET;EACE,CAAA,EAED,IAAqB,IACzB,kBAAC,KAAD;EAAG,WAAU;YACV;EACC,CAAA,GACF,MACE,IACJ,kBAAC,GAAD;EAAY,MAAK;EAAK,SAAS;EAAS,WAAU;EAAiB,cAAY;YAC7E,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;EACZ,CAAA,EAET,IAAuB,IAAgB,kBAAC,GAAD,EAAoB,QAAQ,GAAiB,CAAA,GAAG;AAE7F,QACE,kBAAC,OAAD;EAAU;EAAK,WAAW;EAAsB,GAAI;YAAp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O;EACC;EACR;EACkB;EACP;EAEjB,GAAK,IAAc,EAAE,GAAG,EAAE,oBAAoB,KAAA,GAAW;YAR3D;GAUE,kBAAC,GAAD;IACS;IACM;IACE;IACC;IAChB,CAAA;GACD,KAAY,kBAAC,GAAD,EAAY,aAAqB,CAAA;GAC7C,KACC,kBAAC,GAAD;IACkB;IACC;IACF;IACf,CAAA;GAEM"}
1
+ {"version":3,"file":"Modal.js","names":[],"sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import * as RadixDialog from \"@radix-ui/react-dialog\";\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport type { IconButtonProps } from \"@/components/IconButton\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { overlayVariants } from \"@/components/Overlay/Overlay\";\nimport { cn } from \"@/utils/cn\";\nimport type { DataAttributes } from \"@/utils/dataAttributes\";\nimport { useModalAutoFocus } from \"@/utils/useModalAutoFocus\";\n\ntype ModalContentProps = ComponentPropsWithoutRef<typeof RadixDialog.Content>;\nconst ModalContext = createContext(false);\ntype ModalOpenAutoFocusHandler = (event: Event) => void;\n\n/**\n * Modal 최대 폭 — sm 384px, md 548px, lg 720px, xl 960px, full은 화면 크기 - 32px(높이 포함).\n * 높이는 내용만큼이며 화면 높이의 80%를 넘으면 본문이 스크롤된다.\n */\nexport type ModalSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\nconst modalSizeClasses = {\n sm: \"aivex:max-w-modal-sm\",\n md: \"aivex:max-w-modal-md\",\n lg: \"aivex:max-w-modal-lg\",\n xl: \"aivex:max-w-[960px]\",\n full: \"aivex:h-[calc(100dvh-32px)] aivex:max-w-[calc(100vw-32px)]\",\n} as const;\n\nconst modalSurfaceClassName = cn(\n \"aivex:flex aivex:max-h-[80dvh] aivex:w-[85vw] aivex:flex-col aivex:gap-2xl aivex:overflow-hidden aivex:p-2xl\",\n \"aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:shadow-xl aivex:outline-none\",\n);\nconst modalHeaderClassName = \"aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs\";\n\ninterface ModalHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\" | \"title\"> {\n title: ReactNode;\n titleId?: string;\n description?: ReactNode;\n headingButton?: ModalHeadingButtonProps;\n onClose?: () => void;\n closeAriaLabel?: string;\n closeButtonProps?: ModalCloseButtonProps;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalHeader({\n title,\n titleId,\n description,\n headingButton,\n onClose,\n closeAriaLabel = \"Close modal\",\n closeButtonProps,\n ref,\n ...props\n}: ModalHeaderProps) {\n const isInsideModalRoot = useContext(ModalContext);\n const titleElement = (\n <h2\n {...(titleId ? { id: titleId } : {})}\n className=\"aivex:m-0 aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary aivex:break-words\"\n >\n {title}\n </h2>\n );\n const descriptionElement = description ? (\n <p className=\"aivex:m-0 aivex:whitespace-pre-line aivex:text-body-md-regular aivex:text-text-secondary aivex:break-words\">\n {description}\n </p>\n ) : null;\n const closeButton = (\n <IconButton\n {...closeButtonProps}\n size=\"md\"\n onClick={onClose}\n className=\"aivex:shrink-0\"\n aria-label={closeAriaLabel}\n >\n <CloseIcon size={24} />\n </IconButton>\n );\n const headingButtonElement = headingButton ? <ModalHeadingButton button={headingButton} /> : null;\n\n return (\n <div ref={ref} className={modalHeaderClassName} {...props}>\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-md\">\n {headingButtonElement}\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:justify-center\">\n {isInsideModalRoot ? (\n <RadixDialog.Title asChild>{titleElement}</RadixDialog.Title>\n ) : (\n titleElement\n )}\n </div>\n {onClose\n ? closeButton\n : isInsideModalRoot && <RadixDialog.Close asChild>{closeButton}</RadixDialog.Close>}\n </div>\n {isInsideModalRoot && descriptionElement ? (\n <RadixDialog.Description asChild>{descriptionElement}</RadixDialog.Description>\n ) : (\n descriptionElement\n )}\n </div>\n );\n}\n\n/** 제목 왼쪽 아이콘 버튼(뒤로 가기 등) — IconButton props에서 크기·모양은 Modal이 고정한다. */\nexport interface ModalHeadingButtonProps\n extends Omit<IconButtonProps, \"asChild\" | \"children\" | \"className\" | \"ref\" | \"shape\" | \"size\">,\n DataAttributes {\n /** 아이콘 전용 버튼이라 접근성 이름이 필수다. */\n \"aria-label\": string;\n /** 버튼 안에 그릴 아이콘(예: `<ArrowLeftIcon size={24} />`). */\n children: ReactNode;\n}\n\n/**\n * 헤더 닫기(X) 버튼에 덧붙일 속성(`data-*`·`id`·`disabled` 등) — 크기·모양·동작·접근성 이름은\n * Modal이 고정한다(이름은 closeAriaLabel로 바꾼다).\n */\nexport interface ModalCloseButtonProps\n extends Omit<\n IconButtonProps,\n | \"aria-label\"\n | \"asChild\"\n | \"children\"\n | \"className\"\n | \"dangerouslySetInnerHTML\"\n | \"onClick\"\n | \"ref\"\n | \"shape\"\n | \"size\"\n >,\n DataAttributes {}\n\nfunction ModalHeadingButton({ button }: { button: ModalHeadingButtonProps }) {\n const { children, ...props } = button;\n\n return (\n <IconButton size=\"md\" className=\"aivex:shrink-0\" {...props}>\n {children}\n </IconButton>\n );\n}\n\ninterface ModalBodyProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\"> {\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalBody({ children, ref, ...props }: ModalBodyProps) {\n return (\n // 세로 flex여야 표면의 max-h가 자식까지 전달돼, 자식의 flex-1 min-h-0 목록이 본문 대신 스크롤된다.\n // 일반 자식이 줄어들지 않게 하는 규칙은 styles.css(data-aivex-modal-body)에 있다.\n <div\n ref={ref}\n data-aivex-modal-body=\"\"\n className=\"aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col aivex:overflow-y-auto\"\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/** 푸터 버튼 — Button props에서 색·크기·스타일은 Modal이 고정하고 라벨은 children으로 받는다. */\nexport interface ModalButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n >,\n DataAttributes {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\ninterface ModalFooterProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\" | \"children\"> {\n tertiaryButton?: ModalButtonProps;\n secondaryButton?: ModalButtonProps;\n primaryButton?: ModalButtonProps;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalFooter({\n tertiaryButton,\n secondaryButton,\n primaryButton,\n ref,\n ...props\n}: ModalFooterProps) {\n return (\n <div\n ref={ref}\n className=\"aivex:flex aivex:h-10 aivex:w-full aivex:items-center aivex:justify-end aivex:gap-lg\"\n {...props}\n >\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-center aivex:justify-start\">\n {tertiaryButton && (\n <ModalActionButton\n button={tertiaryButton}\n variant=\"ghost\"\n color=\"secondary\"\n className=\"aivex:min-w-9\"\n />\n )}\n </div>\n <div className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-end aivex:gap-lg\">\n {secondaryButton && (\n <ModalActionButton\n button={secondaryButton}\n variant=\"solid\"\n color=\"secondary\"\n className=\"aivex:min-w-[84px]\"\n />\n )}\n {primaryButton && (\n <ModalActionButton\n button={primaryButton}\n variant=\"solid\"\n color=\"primary\"\n className=\"aivex:min-w-[84px]\"\n />\n )}\n </div>\n </div>\n );\n}\n\ninterface ModalActionButtonProps {\n button: ModalButtonProps;\n variant: ButtonProps[\"variant\"];\n color: ButtonProps[\"color\"];\n className?: string;\n}\n\nfunction ModalActionButton({ button, variant, color, className }: ModalActionButtonProps) {\n const { children, ...props } = button;\n\n return (\n <Button variant={variant} color={color} size=\"lg\" className={className} {...props}>\n {children}\n </Button>\n );\n}\n\ninterface ModalRootProps\n extends Omit<\n ModalContentProps,\n | \"children\"\n | \"className\"\n | \"defaultOpen\"\n | \"onInteractOutside\"\n | \"onKeyDown\"\n | \"open\"\n | \"ref\"\n | \"title\"\n > {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: ReactNode;\n size?: ModalSize;\n closeOnInteractOutside?: boolean;\n onOpenAutoFocus?: ModalOpenAutoFocusHandler;\n onInteractOutside?: ModalContentProps[\"onInteractOutside\"];\n onKeyDown?: ModalContentProps[\"onKeyDown\"];\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction ModalRoot({\n open,\n defaultOpen,\n onOpenChange,\n children,\n size = \"md\",\n closeOnInteractOutside = true,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onInteractOutside,\n onKeyDown,\n onKeyUp,\n ref,\n ...props\n}: ModalRootProps) {\n const autoFocus = useModalAutoFocus(onOpenAutoFocus, onCloseAutoFocus);\n return (\n <RadixDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n <RadixDialog.Portal>\n <RadixDialog.Overlay className={overlayVariants({ variant: \"dim\" })} />\n <RadixDialog.Content\n ref={ref}\n className={cn(\n \"aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal)\",\n \"aivex:-translate-x-1/2 aivex:-translate-y-1/2\",\n modalSurfaceClassName,\n modalSizeClasses[size],\n )}\n onInteractOutside={(event) => {\n onInteractOutside?.(event);\n if (!closeOnInteractOutside && !event.defaultPrevented) event.preventDefault();\n }}\n {...autoFocus}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n {...props}\n >\n <ModalContext.Provider value={true}>{children}</ModalContext.Provider>\n </RadixDialog.Content>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n );\n}\n\nexport interface ModalSurfaceProps {\n /** 제목(필수) — 표면의 aria-labelledby로 연결된다. */\n title: ReactNode;\n /** 제목 아래 설명. */\n description?: ReactNode;\n /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등). */\n headingButton?: ModalHeadingButtonProps;\n /** 본문 — 넘치면 본문 영역만 세로 스크롤한다. */\n children?: ReactNode;\n /** 푸터 왼쪽 끝의 ghost 버튼(보조 동작). */\n tertiaryButton?: ModalButtonProps;\n /** 푸터 오른쪽의 secondary 버튼(취소·이전). */\n secondaryButton?: ModalButtonProps;\n /** 푸터 오른쪽 끝의 primary 버튼(확인·다음). */\n primaryButton?: ModalButtonProps;\n /**\n * 최대 폭.\n * @default \"md\"\n */\n size?: ModalSize;\n /** 지정하면 헤더에 닫기(X) 버튼을 렌더한다. 열림 상태가 없으므로 숨김은 소비자가 처리한다. */\n onClose?: () => void;\n /**\n * 닫기 버튼 aria-label.\n * @default \"Close modal\"\n */\n closeAriaLabel?: string;\n /** 닫기(X) 버튼에 덧붙일 속성 — 예: `{ \"data-track-id\": \"invite-close-btn\" }`. */\n closeButtonProps?: ModalCloseButtonProps;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * Modal과 같은 카드 표면을 포털·딤·포커스 트랩 없이 제자리에 그리는 정적 변형.\n *\n * 상단 버튼 아래에 붙는 패널처럼 위치를 소비자가 잡는 경우나 문서·미리보기에 쓴다.\n * 열림 상태·Esc·바깥 클릭 처리가 없으니 화면을 막는 모달이 필요하면 Modal을 쓴다.\n *\n * @example\n * ```tsx\n * import { ModalSurface } from \"@aivex/ui\";\n *\n * <div className=\"absolute right-6 top-6\">\n * <ModalSurface title=\"작업 상태\" size=\"md\" onClose={() => setVisible(false)}>\n * 진행 중인 작업 2개\n * </ModalSurface>\n * </div>\n * ```\n */\nfunction ModalSurface({\n title,\n description,\n headingButton,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n size = \"md\",\n onClose,\n closeAriaLabel,\n closeButtonProps,\n ref,\n}: ModalSurfaceProps) {\n const titleId = useId();\n const hasFooter = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <div\n ref={ref}\n role=\"dialog\"\n // 포커스를 가두지도 뒤를 막지도 않는 비모달 표면이라 aria-modal을 달지 않는다.\n // 달면 보조기기가 나머지 페이지를 비활성으로 보고 탐색을 막는다.\n aria-labelledby={titleId}\n className={cn(modalSurfaceClassName, modalSizeClasses[size])}\n >\n <ModalHeader\n title={title}\n titleId={titleId}\n description={description}\n headingButton={headingButton}\n onClose={onClose}\n closeAriaLabel={closeAriaLabel}\n closeButtonProps={closeButtonProps}\n />\n {children && <ModalBody>{children}</ModalBody>}\n {hasFooter && (\n <ModalFooter\n tertiaryButton={tertiaryButton}\n secondaryButton={secondaryButton}\n primaryButton={primaryButton}\n />\n )}\n </div>\n );\n}\n\nexport interface ModalProps {\n /** 열림 상태(제어). onOpenChange와 함께 쓴다. */\n open?: boolean;\n /** 초기 열림 상태(비제어). */\n defaultOpen?: boolean;\n /** 열림 상태가 바뀔 때 호출 — 닫기(X)·Esc·바깥 클릭 모두 false로 알린다. */\n onOpenChange?: (open: boolean) => void;\n /** 제목(필수) — 모달의 접근성 이름이 된다. */\n title: ReactNode;\n /** 제목 아래 설명 — 접근성 설명으로 연결된다. */\n description?: ReactNode;\n /** 제목 왼쪽 아이콘 버튼(뒤로 가기 등). */\n headingButton?: ModalHeadingButtonProps;\n /** 본문(폼·목록 등) — 넘치면 본문 영역만 세로 스크롤한다. */\n children?: ReactNode;\n /** 푸터 왼쪽 끝의 ghost 버튼(보조 동작). 눌러도 자동으로 닫히지 않는다. */\n tertiaryButton?: ModalButtonProps;\n /** 푸터 오른쪽의 secondary 버튼(취소·이전). 눌러도 자동으로 닫히지 않는다. */\n secondaryButton?: ModalButtonProps;\n /** 푸터 오른쪽 끝의 primary 버튼(확인·다음). 눌러도 자동으로 닫히지 않는다. */\n primaryButton?: ModalButtonProps;\n /**\n * 최대 폭.\n * @default \"md\"\n */\n size?: ModalSize;\n /**\n * 바깥(딤) 클릭으로 닫을지 여부. 입력 중 실수로 닫히면 안 되는 폼은 false.\n * @default true\n */\n closeOnInteractOutside?: boolean;\n /** 열릴 때 자동 포커스 직전 호출 — event.preventDefault()로 기본 포커스 이동을 막을 수 있다. */\n onOpenAutoFocus?: ModalOpenAutoFocusHandler;\n /**\n * 헤더 닫기(X) 버튼 aria-label.\n * @default \"Close modal\"\n */\n closeAriaLabel?: string;\n /** 헤더 닫기(X) 버튼에 덧붙일 속성 — 예: `{ \"data-track-id\": \"invite-close-btn\" }`. */\n closeButtonProps?: ModalCloseButtonProps;\n}\n\n/**\n * 제목·본문·푸터 버튼으로 구성된 표준 모달 창(딤 + 화면 중앙 카드).\n *\n * 입력 폼, 선택 목록, 여러 단계 흐름처럼 본문이 있는 작업에 쓴다. 제목·설명과 버튼만 있는\n * 짧은 확인 질문은 Dialog, 카드 틀을 벗어난 자유 레이아웃(검색 팔레트 등)은 ModalBase,\n * 화면 옆에서 미끄러져 나오는 시트는 Drawer를 쓴다. 헤더에 닫기(X) 버튼이 자동으로 붙고,\n * 푸터 버튼은 눌러도 닫히지 않으니 onClick에서 open을 직접 false로 바꾼다. title은 필수다.\n *\n * @example\n * ```tsx\n * import { Button, Modal, Textbox } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(false);\n *\n * <Button onClick={() => setOpen(true)}>워크스페이스 생성</Button>\n * <Modal\n * open={open}\n * onOpenChange={setOpen}\n * size=\"md\"\n * title=\"워크스페이스 생성\"\n * description=\"생성할 워크스페이스명을 입력하세요.\"\n * secondaryButton={{ children: \"취소\", onClick: () => setOpen(false) }}\n * primaryButton={{ children: \"생성\", onClick: () => setOpen(false) }}\n * >\n * <Textbox aria-label=\"워크스페이스명\" placeholder=\"워크스페이스명을 입력하세요\" />\n * </Modal>\n * ```\n */\nfunction Modal({\n open,\n defaultOpen,\n onOpenChange,\n title,\n description,\n headingButton,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n size,\n closeOnInteractOutside,\n onOpenAutoFocus,\n closeAriaLabel,\n closeButtonProps,\n}: ModalProps) {\n const hasFooter = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <ModalRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n size={size}\n closeOnInteractOutside={closeOnInteractOutside}\n onOpenAutoFocus={onOpenAutoFocus}\n // 설명이 없는 모달임을 Radix에 알린다 — 명시하지 않으면 개발 모드에서 매번 경고한다.\n {...(description ? {} : { \"aria-describedby\": undefined })}\n >\n <ModalHeader\n title={title}\n description={description}\n headingButton={headingButton}\n closeAriaLabel={closeAriaLabel}\n closeButtonProps={closeButtonProps}\n />\n {children && <ModalBody>{children}</ModalBody>}\n {hasFooter && (\n <ModalFooter\n tertiaryButton={tertiaryButton}\n secondaryButton={secondaryButton}\n primaryButton={primaryButton}\n />\n )}\n </ModalRoot>\n );\n}\n\nexport { Modal, ModalSurface };\n"],"mappings":";;;;;;;;;;;AAoBA,IAAM,IAAe,EAAc,GAAM,EASnC,IAAmB;CACvB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACP,EAEK,IAAwB,EAC5B,gHACA,mHACD,EACK,IAAuB;AAa7B,SAAS,EAAY,EACnB,UACA,YACA,gBACA,kBACA,YACA,oBAAiB,eACjB,qBACA,QACA,GAAG,KACgB;CACnB,IAAM,IAAoB,EAAW,EAAa,EAC5C,IACJ,kBAAC,MAAD;EACE,GAAK,IAAU,EAAE,IAAI,GAAS,GAAG,EAAE;EACnC,WAAU;YAET;EACE,CAAA,EAED,IAAqB,IACzB,kBAAC,KAAD;EAAG,WAAU;YACV;EACC,CAAA,GACF,MACE,IACJ,kBAAC,GAAD;EACE,GAAI;EACJ,MAAK;EACL,SAAS;EACT,WAAU;EACV,cAAY;YAEZ,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;EACZ,CAAA,EAET,IAAuB,IAAgB,kBAAC,GAAD,EAAoB,QAAQ,GAAiB,CAAA,GAAG;AAE7F,QACE,kBAAC,OAAD;EAAU;EAAK,WAAW;EAAsB,GAAI;YAApD,CACE,kBAAC,OAAD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;EACC;EACR;EACkB;EACP;EAEjB,GAAK,IAAc,EAAE,GAAG,EAAE,oBAAoB,KAAA,GAAW;YAR3D;GAUE,kBAAC,GAAD;IACS;IACM;IACE;IACC;IACE;IAClB,CAAA;GACD,KAAY,kBAAC,GAAD,EAAY,aAAqB,CAAA;GAC7C,KACC,kBAAC,GAAD;IACkB;IACC;IACF;IACf,CAAA;GAEM"}
@@ -1,4 +1,4 @@
1
- export type { ModalButtonProps, ModalHeadingButtonProps, ModalProps, ModalSize, ModalSurfaceProps, } from "./Modal.cjs";
1
+ export type { ModalButtonProps, ModalCloseButtonProps, ModalHeadingButtonProps, ModalProps, ModalSize, ModalSurfaceProps, } from "./Modal.cjs";
2
2
  export { Modal, ModalSurface } from "./Modal.cjs";
3
3
  export type { ModalBaseProps } from "./ModalBase.cjs";
4
4
  export { ModalBase } from "./ModalBase.cjs";
@@ -1,4 +1,4 @@
1
- export type { ModalButtonProps, ModalHeadingButtonProps, ModalProps, ModalSize, ModalSurfaceProps, } from "./Modal.js";
1
+ export type { ModalButtonProps, ModalCloseButtonProps, ModalHeadingButtonProps, ModalProps, ModalSize, ModalSurfaceProps, } from "./Modal.js";
2
2
  export { Modal, ModalSurface } from "./Modal.js";
3
3
  export type { ModalBaseProps } from "./ModalBase.js";
4
4
  export { ModalBase } from "./ModalBase.js";
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.cjs","names":[],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport type { CSSProperties, HTMLAttributes, ReactNode, Ref } from \"react\";\nimport { type ExternalToast, Toaster as SonnerToaster, type ToasterProps, toast } from \"sonner\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { cn } from \"@/utils/cn\";\n\n// py는 xs(4px) — 액션 버튼(32px)이 들어가도 전체 높이가 40px로 유지된다.\n/** 토스트 표면 클래스(cva) — 같은 모양의 커스텀 토스트를 만들 때 쓴다. */\nconst toastVariants = cva(\n \"aivex:inline-flex aivex:min-h-10 aivex:w-fit aivex:items-center aivex:justify-center aivex:gap-md aivex:rounded-xs aivex:bg-static-gray aivex:px-xl aivex:py-xs\",\n {\n variants: {\n variant: {\n default: \"\",\n success: \"\",\n danger: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\n/**\n * Toast의 의미 톤 — default·success·danger. 시각적으로는 같은 어두운 표면이고,\n * danger는 스크린리더가 즉시 읽도록 role=\"alert\"로 알린다. 루트에 `data-variant`가 붙는다.\n */\nexport type ToastVariant = NonNullable<VariantProps<typeof toastVariants>[\"variant\"]>;\n\n/** 액션 버튼은 라벨을 children으로 받고, 스타일은 Toast가 고정한다. */\nexport interface ToastActionProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n > {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\nexport interface ToastProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * 의미 톤. 기본 \"default\".\n * @default \"default\"\n */\n variant?: ToastVariant;\n /**\n * false면 아무것도 렌더하지 않는다.\n * @default true\n */\n open?: boolean;\n /** 표시할 메시지(필수). 최대 720px 폭에서 가운데 정렬로 줄바꿈된다. */\n message: string;\n /** 메시지 우측 액션 버튼(예: 실행 취소). */\n action?: ToastActionProps;\n /** 지정하면 우측 끝에 닫기(X) 버튼을 렌더한다. */\n onClose?: () => void;\n /**\n * 닫기 버튼 aria-label. 기본 \"닫기\".\n * @default \"닫기\"\n */\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/** ToastToaster props — sonner `Toaster` props 그대로(position·duration·visibleToasts·gap 등). */\nexport type ToastToasterProps = ToasterProps;\n/** `toast(message, options)`의 옵션 — sonner `ExternalToast` 그대로(description·action·closeButton·duration 등). */\nexport type ToastOptions = ExternalToast;\n\n/**\n * 토스트 모양만 그리는 정적 프리미티브 — 위치·자동 사라짐·쌓임 관리가 없다.\n *\n * 일반적인 알림은 이 컴포넌트 대신 `toast(\"메시지\")` 함수를 호출한다(ToastToaster가 앱에\n * 마운트돼 있어야 함). Toast는 직접 위치·표시를 제어해야 하는 특수한 경우나 미리보기용이다.\n * 계속 보여야 하는 화면 내 안내는 Messagebox를 쓴다. role=\"status\"·aria-live=\"polite\"로 읽힌다.\n *\n * @example\n * ```tsx\n * import { Toast } from \"@aivex/ui\";\n *\n * <Toast\n * message=\"파일을 삭제했습니다\"\n * action={{ children: \"실행 취소\", onClick: undo }}\n * onClose={() => setOpen(false)}\n * open={open}\n * />\n * ```\n */\nfunction Toast({\n className,\n variant,\n open = true,\n message,\n action,\n onClose,\n closeAriaLabel = \"닫기\",\n ref,\n ...props\n}: ToastProps) {\n if (!open) return null;\n\n const { children: actionLabel, ...actionProps } = action ?? {};\n\n return (\n <div\n ref={ref}\n // 실패 알림은 읽던 내용을 끊고 바로 알린다. 나머지는 끝난 뒤에 읽는다.\n role={variant === \"danger\" ? \"alert\" : \"status\"}\n aria-live={variant === \"danger\" ? \"assertive\" : \"polite\"}\n data-variant={variant ?? \"default\"}\n className={cn(toastVariants({ variant: variant ?? \"default\" }), className)}\n {...props}\n >\n <p className=\"aivex:max-w-[720px] aivex:text-center aivex:text-body-lg-regular aivex:text-static-white\">\n {message}\n </p>\n {action && (\n <Button\n variant=\"ghost\"\n color=\"primary\"\n size=\"md\"\n className=\"aivex:shrink-0\"\n {...actionProps}\n >\n {actionLabel}\n </Button>\n )}\n {onClose && (\n <IconButton\n aria-label={closeAriaLabel}\n color=\"white\"\n size=\"sm\"\n className=\"aivex:shrink-0\"\n onClick={onClose}\n >\n <CloseIcon size={20} />\n </IconButton>\n )}\n </div>\n );\n}\n\n/**\n * `toast()` 호출을 받아 화면에 토스트를 쌓아 보여 주는 컨테이너(sonner Toaster 래퍼).\n *\n * 앱 루트(레이아웃)에 한 번만 마운트한다 — 없으면 `toast()`를 호출해도 아무것도 보이지 않는다.\n * 그 뒤 어디서든 `@aivex/ui`의 `toast()`를 호출한다(sonner를 직접 import하지 않는다).\n * 기본값: position \"bottom-center\", duration 4000ms, visibleToasts 3, gap 8.\n *\n * @example\n * ```tsx\n * import { Button, ToastToaster, toast } from \"@aivex/ui\";\n *\n * // 앱 루트\n * <>\n * <App />\n * <ToastToaster />\n * </>\n *\n * // 어디서든\n * <Button onClick={() => toast(\"저장했습니다\")}>저장</Button>\n * <Button\n * onClick={() =>\n * toast(\"파일을 삭제했습니다\", {\n * action: { label: \"실행 취소\", onClick: undo },\n * closeButton: true,\n * })\n * }\n * >\n * 삭제\n * </Button>\n * ```\n */\nfunction ToastToaster({\n position = \"bottom-center\",\n duration = 4000,\n visibleToasts = 3,\n gap = 8,\n style,\n toastOptions,\n ...props\n}: ToastToasterProps) {\n const horizontallyCentered = position.endsWith(\"center\");\n\n return (\n <SonnerToaster\n position={position}\n duration={duration}\n visibleToasts={visibleToasts}\n gap={gap}\n // 토스트는 내용만큼 넓어진다(w-fit). 그런데 sonner는 감싸는 목록에\n // --width(기본 356px)를 박고 width: var(--width)를 걸어서, 자식의\n // fit-content가 356px에 갇혀 긴 문구가 접혔다. 목록 폭을 본문 최대\n // 폭(title의 max-w-720)까지 열어 두어, 토스트가 720px까지는 한 줄로\n // 늘어나고 그 뒤에야 접히게 한다.\n // (목록은 fixed + 자식이 absolute라 fit-content로 두면 0px로 무너진다.)\n style={{ \"--width\": \"720px\", ...style } as CSSProperties}\n toastOptions={{\n ...toastOptions,\n unstyled: true,\n // 토스트는 내용만큼 넓고(w-fit) 목록은 그보다 넓다 — sonner가 토스트를\n // 목록 왼쪽 끝(left:0)에 절대배치하므로 그대로 두면 왼쪽으로 치우친다.\n // 세로 위치는 sonner가 transform으로 잡으므로 건드리지 않고, 좌우만\n // inset-x-0 + mx-auto로 가운데 맞춘다.\n className: cn(\n toastVariants({ variant: \"default\" }),\n horizontallyCentered && \"aivex:inset-x-0 aivex:mx-auto\",\n toastOptions?.className,\n ),\n classNames: {\n title:\n \"aivex:max-w-[720px] aivex:text-center aivex:text-body-lg-regular aivex:text-static-white\",\n description:\n \"aivex:mt-xs aivex:max-w-[720px] aivex:text-center aivex:text-body-md-regular aivex:text-static-white aivex:opacity-80\",\n // 스탠드얼론 Toast의 Button(ghost/primary/md)·IconButton(white/sm)과 같은 서식.\n actionButton:\n \"aivex:inline-flex aivex:h-8 aivex:shrink-0 aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:gap-2xs aivex:rounded-md aivex:px-md aivex:text-label-lg aivex:text-text-brand aivex:transition-colors aivex:hover:bg-static-white/8\",\n cancelButton:\n \"aivex:inline-flex aivex:h-8 aivex:shrink-0 aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:gap-2xs aivex:rounded-md aivex:px-md aivex:text-label-lg aivex:text-static-white aivex:transition-colors aivex:hover:bg-static-white/8\",\n // sonner는 닫기 버튼을 DOM 맨 앞에 렌더한다. 시안은 우측 끝이라 order로 옮긴다.\n closeButton:\n \"aivex:order-last aivex:inline-flex aivex:size-2xl aivex:shrink-0 aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:rounded-xs aivex:text-static-white aivex:transition-colors aivex:hover:bg-static-white/8\",\n ...toastOptions?.classNames,\n },\n }}\n {...props}\n />\n );\n}\n\nexport { Toast, ToastToaster, toast, toastVariants };\n"],"mappings":"wSAUA,IAAM,GAAA,EAAA,EAAA,KACJ,kKACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,GACT,QAAS,GACT,OAAQ,GACT,CACF,CACD,gBAAiB,CACf,QAAS,UACV,CACF,CACF,CAmED,SAAS,EAAM,CACb,YACA,UACA,OAAO,GACP,UACA,SACA,UACA,iBAAiB,KACjB,MACA,GAAG,GACU,CACb,GAAI,CAAC,EAAM,OAAO,KAElB,GAAM,CAAE,SAAU,EAAa,GAAG,GAAgB,GAAU,EAAE,CAE9D,OACE,EAAA,EAAA,MAAC,MAAD,CACO,MAEL,KAAM,IAAY,SAAW,QAAU,SACvC,YAAW,IAAY,SAAW,YAAc,SAChD,eAAc,GAAW,UACzB,UAAW,EAAA,GAAG,EAAc,CAAE,QAAS,GAAW,UAAW,CAAC,CAAE,EAAU,CAC1E,GAAI,WAPN,EASE,EAAA,EAAA,KAAC,IAAD,CAAG,UAAU,oGACV,EACC,CAAA,CACH,IACC,EAAA,EAAA,KAAC,EAAA,OAAD,CACE,QAAQ,QACR,MAAM,UACN,KAAK,KACL,UAAU,iBACV,GAAI,WAEH,EACM,CAAA,CAEV,IACC,EAAA,EAAA,KAAC,EAAA,WAAD,CACE,aAAY,EACZ,MAAM,QACN,KAAK,KACL,UAAU,iBACV,QAAS,YAET,EAAA,EAAA,KAAC,EAAA,UAAD,CAAW,KAAM,GAAM,CAAA,CACZ,CAAA,CAEX,GAmCV,SAAS,EAAa,CACpB,WAAW,gBACX,WAAW,IACX,gBAAgB,EAChB,MAAM,EACN,QACA,eACA,GAAG,GACiB,CACpB,IAAM,EAAuB,EAAS,SAAS,SAAS,CAExD,OACE,EAAA,EAAA,KAAC,EAAA,QAAD,CACY,WACA,WACK,gBACV,MAOL,MAAO,CAAE,UAAW,QAAS,GAAG,EAAO,CACvC,aAAc,CACZ,GAAG,EACH,SAAU,GAKV,UAAW,EAAA,GACT,EAAc,CAAE,QAAS,UAAW,CAAC,CACrC,GAAwB,gCACxB,GAAc,UACf,CACD,WAAY,CACV,MACE,2FACF,YACE,wHAEF,aACE,qPACF,aACE,uPAEF,YACE,+NACF,GAAG,GAAc,WAClB,CACF,CACD,GAAI,EACJ,CAAA"}
1
+ {"version":3,"file":"Toast.cjs","names":[],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport type { CSSProperties, HTMLAttributes, ReactNode, Ref } from \"react\";\nimport { type ExternalToast, Toaster as SonnerToaster, type ToasterProps, toast } from \"sonner\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { cn } from \"@/utils/cn\";\nimport type { DataAttributes } from \"@/utils/dataAttributes\";\n\n// py는 xs(4px) — 액션 버튼(32px)이 들어가도 전체 높이가 40px로 유지된다.\n/** 토스트 표면 클래스(cva) — 같은 모양의 커스텀 토스트를 만들 때 쓴다. */\nconst toastVariants = cva(\n \"aivex:inline-flex aivex:min-h-10 aivex:w-fit aivex:items-center aivex:justify-center aivex:gap-md aivex:rounded-xs aivex:bg-static-gray aivex:px-xl aivex:py-xs\",\n {\n variants: {\n variant: {\n default: \"\",\n success: \"\",\n danger: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\n/**\n * Toast의 의미 톤 — default·success·danger. 시각적으로는 같은 어두운 표면이고,\n * danger는 스크린리더가 즉시 읽도록 role=\"alert\"로 알린다. 루트에 `data-variant`가 붙는다.\n */\nexport type ToastVariant = NonNullable<VariantProps<typeof toastVariants>[\"variant\"]>;\n\n/** 액션 버튼은 라벨을 children으로 받고, 스타일은 Toast가 고정한다. */\nexport interface ToastActionProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n >,\n DataAttributes {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\nexport interface ToastProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * 의미 톤. 기본 \"default\".\n * @default \"default\"\n */\n variant?: ToastVariant;\n /**\n * false면 아무것도 렌더하지 않는다.\n * @default true\n */\n open?: boolean;\n /** 표시할 메시지(필수). 최대 720px 폭에서 가운데 정렬로 줄바꿈된다. */\n message: string;\n /** 메시지 우측 액션 버튼(예: 실행 취소). */\n action?: ToastActionProps;\n /** 지정하면 우측 끝에 닫기(X) 버튼을 렌더한다. */\n onClose?: () => void;\n /**\n * 닫기 버튼 aria-label. 기본 \"닫기\".\n * @default \"닫기\"\n */\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/** ToastToaster props — sonner `Toaster` props 그대로(position·duration·visibleToasts·gap 등). */\nexport type ToastToasterProps = ToasterProps;\n/** `toast(message, options)`의 옵션 — sonner `ExternalToast` 그대로(description·action·closeButton·duration 등). */\nexport type ToastOptions = ExternalToast;\n\n/**\n * 토스트 모양만 그리는 정적 프리미티브 — 위치·자동 사라짐·쌓임 관리가 없다.\n *\n * 일반적인 알림은 이 컴포넌트 대신 `toast(\"메시지\")` 함수를 호출한다(ToastToaster가 앱에\n * 마운트돼 있어야 함). Toast는 직접 위치·표시를 제어해야 하는 특수한 경우나 미리보기용이다.\n * 계속 보여야 하는 화면 내 안내는 Messagebox를 쓴다. role=\"status\"·aria-live=\"polite\"로 읽힌다.\n *\n * @example\n * ```tsx\n * import { Toast } from \"@aivex/ui\";\n *\n * <Toast\n * message=\"파일을 삭제했습니다\"\n * action={{ children: \"실행 취소\", onClick: undo }}\n * onClose={() => setOpen(false)}\n * open={open}\n * />\n * ```\n */\nfunction Toast({\n className,\n variant,\n open = true,\n message,\n action,\n onClose,\n closeAriaLabel = \"닫기\",\n ref,\n ...props\n}: ToastProps) {\n if (!open) return null;\n\n const { children: actionLabel, ...actionProps } = action ?? {};\n\n return (\n <div\n ref={ref}\n // 실패 알림은 읽던 내용을 끊고 바로 알린다. 나머지는 끝난 뒤에 읽는다.\n role={variant === \"danger\" ? \"alert\" : \"status\"}\n aria-live={variant === \"danger\" ? \"assertive\" : \"polite\"}\n data-variant={variant ?? \"default\"}\n className={cn(toastVariants({ variant: variant ?? \"default\" }), className)}\n {...props}\n >\n <p className=\"aivex:max-w-[720px] aivex:text-center aivex:text-body-lg-regular aivex:text-static-white\">\n {message}\n </p>\n {action && (\n <Button\n variant=\"ghost\"\n color=\"primary\"\n size=\"md\"\n className=\"aivex:shrink-0\"\n {...actionProps}\n >\n {actionLabel}\n </Button>\n )}\n {onClose && (\n <IconButton\n aria-label={closeAriaLabel}\n color=\"white\"\n size=\"sm\"\n className=\"aivex:shrink-0\"\n onClick={onClose}\n >\n <CloseIcon size={20} />\n </IconButton>\n )}\n </div>\n );\n}\n\n/**\n * `toast()` 호출을 받아 화면에 토스트를 쌓아 보여 주는 컨테이너(sonner Toaster 래퍼).\n *\n * 앱 루트(레이아웃)에 한 번만 마운트한다 — 없으면 `toast()`를 호출해도 아무것도 보이지 않는다.\n * 그 뒤 어디서든 `@aivex/ui`의 `toast()`를 호출한다(sonner를 직접 import하지 않는다).\n * 기본값: position \"bottom-center\", duration 4000ms, visibleToasts 3, gap 8.\n *\n * @example\n * ```tsx\n * import { Button, ToastToaster, toast } from \"@aivex/ui\";\n *\n * // 앱 루트\n * <>\n * <App />\n * <ToastToaster />\n * </>\n *\n * // 어디서든\n * <Button onClick={() => toast(\"저장했습니다\")}>저장</Button>\n * <Button\n * onClick={() =>\n * toast(\"파일을 삭제했습니다\", {\n * action: { label: \"실행 취소\", onClick: undo },\n * closeButton: true,\n * })\n * }\n * >\n * 삭제\n * </Button>\n * ```\n */\nfunction ToastToaster({\n position = \"bottom-center\",\n duration = 4000,\n visibleToasts = 3,\n gap = 8,\n style,\n toastOptions,\n ...props\n}: ToastToasterProps) {\n const horizontallyCentered = position.endsWith(\"center\");\n\n return (\n <SonnerToaster\n position={position}\n duration={duration}\n visibleToasts={visibleToasts}\n gap={gap}\n // 토스트는 내용만큼 넓어진다(w-fit). 그런데 sonner는 감싸는 목록에\n // --width(기본 356px)를 박고 width: var(--width)를 걸어서, 자식의\n // fit-content가 356px에 갇혀 긴 문구가 접혔다. 목록 폭을 본문 최대\n // 폭(title의 max-w-720)까지 열어 두어, 토스트가 720px까지는 한 줄로\n // 늘어나고 그 뒤에야 접히게 한다.\n // (목록은 fixed + 자식이 absolute라 fit-content로 두면 0px로 무너진다.)\n style={{ \"--width\": \"720px\", ...style } as CSSProperties}\n toastOptions={{\n ...toastOptions,\n unstyled: true,\n // 토스트는 내용만큼 넓고(w-fit) 목록은 그보다 넓다 — sonner가 토스트를\n // 목록 왼쪽 끝(left:0)에 절대배치하므로 그대로 두면 왼쪽으로 치우친다.\n // 세로 위치는 sonner가 transform으로 잡으므로 건드리지 않고, 좌우만\n // inset-x-0 + mx-auto로 가운데 맞춘다.\n className: cn(\n toastVariants({ variant: \"default\" }),\n horizontallyCentered && \"aivex:inset-x-0 aivex:mx-auto\",\n toastOptions?.className,\n ),\n classNames: {\n title:\n \"aivex:max-w-[720px] aivex:text-center aivex:text-body-lg-regular aivex:text-static-white\",\n description:\n \"aivex:mt-xs aivex:max-w-[720px] aivex:text-center aivex:text-body-md-regular aivex:text-static-white aivex:opacity-80\",\n // 스탠드얼론 Toast의 Button(ghost/primary/md)·IconButton(white/sm)과 같은 서식.\n actionButton:\n \"aivex:inline-flex aivex:h-8 aivex:shrink-0 aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:gap-2xs aivex:rounded-md aivex:px-md aivex:text-label-lg aivex:text-text-brand aivex:transition-colors aivex:hover:bg-static-white/8\",\n cancelButton:\n \"aivex:inline-flex aivex:h-8 aivex:shrink-0 aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:gap-2xs aivex:rounded-md aivex:px-md aivex:text-label-lg aivex:text-static-white aivex:transition-colors aivex:hover:bg-static-white/8\",\n // sonner는 닫기 버튼을 DOM 맨 앞에 렌더한다. 시안은 우측 끝이라 order로 옮긴다.\n closeButton:\n \"aivex:order-last aivex:inline-flex aivex:size-2xl aivex:shrink-0 aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:rounded-xs aivex:text-static-white aivex:transition-colors aivex:hover:bg-static-white/8\",\n ...toastOptions?.classNames,\n },\n }}\n {...props}\n />\n );\n}\n\nexport { Toast, ToastToaster, toast, toastVariants };\n"],"mappings":"wSAWA,IAAM,GAAA,EAAA,EAAA,KACJ,kKACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,GACT,QAAS,GACT,OAAQ,GACT,CACF,CACD,gBAAiB,CACf,QAAS,UACV,CACF,CACF,CAoED,SAAS,EAAM,CACb,YACA,UACA,OAAO,GACP,UACA,SACA,UACA,iBAAiB,KACjB,MACA,GAAG,GACU,CACb,GAAI,CAAC,EAAM,OAAO,KAElB,GAAM,CAAE,SAAU,EAAa,GAAG,GAAgB,GAAU,EAAE,CAE9D,OACE,EAAA,EAAA,MAAC,MAAD,CACO,MAEL,KAAM,IAAY,SAAW,QAAU,SACvC,YAAW,IAAY,SAAW,YAAc,SAChD,eAAc,GAAW,UACzB,UAAW,EAAA,GAAG,EAAc,CAAE,QAAS,GAAW,UAAW,CAAC,CAAE,EAAU,CAC1E,GAAI,WAPN,EASE,EAAA,EAAA,KAAC,IAAD,CAAG,UAAU,oGACV,EACC,CAAA,CACH,IACC,EAAA,EAAA,KAAC,EAAA,OAAD,CACE,QAAQ,QACR,MAAM,UACN,KAAK,KACL,UAAU,iBACV,GAAI,WAEH,EACM,CAAA,CAEV,IACC,EAAA,EAAA,KAAC,EAAA,WAAD,CACE,aAAY,EACZ,MAAM,QACN,KAAK,KACL,UAAU,iBACV,QAAS,YAET,EAAA,EAAA,KAAC,EAAA,UAAD,CAAW,KAAM,GAAM,CAAA,CACZ,CAAA,CAEX,GAmCV,SAAS,EAAa,CACpB,WAAW,gBACX,WAAW,IACX,gBAAgB,EAChB,MAAM,EACN,QACA,eACA,GAAG,GACiB,CACpB,IAAM,EAAuB,EAAS,SAAS,SAAS,CAExD,OACE,EAAA,EAAA,KAAC,EAAA,QAAD,CACY,WACA,WACK,gBACV,MAOL,MAAO,CAAE,UAAW,QAAS,GAAG,EAAO,CACvC,aAAc,CACZ,GAAG,EACH,SAAU,GAKV,UAAW,EAAA,GACT,EAAc,CAAE,QAAS,UAAW,CAAC,CACrC,GAAwB,gCACxB,GAAc,UACf,CACD,WAAY,CACV,MACE,2FACF,YACE,wHAEF,aACE,qPACF,aACE,uPAEF,YACE,+NACF,GAAG,GAAc,WAClB,CACF,CACD,GAAI,EACJ,CAAA"}
@@ -2,6 +2,7 @@ import { type VariantProps } from "class-variance-authority";
2
2
  import type { HTMLAttributes, ReactNode, Ref } from "react";
3
3
  import { type ExternalToast, type ToasterProps, toast } from "sonner";
4
4
  import { type ButtonProps } from "../Button/index.cjs";
5
+ import type { DataAttributes } from "../../utils/dataAttributes.cjs";
5
6
  /** 토스트 표면 클래스(cva) — 같은 모양의 커스텀 토스트를 만들 때 쓴다. */
6
7
  declare const toastVariants: (props?: ({
7
8
  variant?: "danger" | "default" | "success" | null | undefined;
@@ -12,7 +13,7 @@ declare const toastVariants: (props?: ({
12
13
  */
13
14
  export type ToastVariant = NonNullable<VariantProps<typeof toastVariants>["variant"]>;
14
15
  /** 액션 버튼은 라벨을 children으로 받고, 스타일은 Toast가 고정한다. */
15
- export interface ToastActionProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant"> {
16
+ export interface ToastActionProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant">, DataAttributes {
16
17
  /** 버튼 라벨 */
17
18
  children: ReactNode;
18
19
  }
@@ -2,6 +2,7 @@ import { type VariantProps } from "class-variance-authority";
2
2
  import type { HTMLAttributes, ReactNode, Ref } from "react";
3
3
  import { type ExternalToast, type ToasterProps, toast } from "sonner";
4
4
  import { type ButtonProps } from "../Button/index.js";
5
+ import type { DataAttributes } from "../../utils/dataAttributes.js";
5
6
  /** 토스트 표면 클래스(cva) — 같은 모양의 커스텀 토스트를 만들 때 쓴다. */
6
7
  declare const toastVariants: (props?: ({
7
8
  variant?: "danger" | "default" | "success" | null | undefined;
@@ -12,7 +13,7 @@ declare const toastVariants: (props?: ({
12
13
  */
13
14
  export type ToastVariant = NonNullable<VariantProps<typeof toastVariants>["variant"]>;
14
15
  /** 액션 버튼은 라벨을 children으로 받고, 스타일은 Toast가 고정한다. */
15
- export interface ToastActionProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant"> {
16
+ export interface ToastActionProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant">, DataAttributes {
16
17
  /** 버튼 라벨 */
17
18
  children: ReactNode;
18
19
  }