@aivex/ui 1.2.0-dev.57 → 1.2.0-dev.59

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 (68) 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.map +1 -1
  17. package/dist/components/Modal/Modal.d.cts +4 -5
  18. package/dist/components/Modal/Modal.d.ts +4 -5
  19. package/dist/components/Modal/Modal.js.map +1 -1
  20. package/dist/components/ShapeEditor/ShapeEditor.cjs +1 -1
  21. package/dist/components/ShapeEditor/ShapeEditor.cjs.map +1 -1
  22. package/dist/components/ShapeEditor/ShapeEditor.js +406 -428
  23. package/dist/components/ShapeEditor/ShapeEditor.js.map +1 -1
  24. package/dist/components/ShapeEditor/_components/OverlayMarkers.cjs +2 -0
  25. package/dist/components/ShapeEditor/_components/OverlayMarkers.cjs.map +1 -0
  26. package/dist/components/ShapeEditor/_components/OverlayMarkers.d.cts +16 -0
  27. package/dist/components/ShapeEditor/_components/OverlayMarkers.d.ts +16 -0
  28. package/dist/components/ShapeEditor/_components/OverlayMarkers.js +41 -0
  29. package/dist/components/ShapeEditor/_components/OverlayMarkers.js.map +1 -0
  30. package/dist/components/ShapeEditor/_model/types/props.d.cts +3 -1
  31. package/dist/components/ShapeEditor/_model/types/props.d.ts +3 -1
  32. package/dist/components/ShapeEditor/_state/createInteractionController.cjs +1 -1
  33. package/dist/components/ShapeEditor/_state/createInteractionController.cjs.map +1 -1
  34. package/dist/components/ShapeEditor/_state/createInteractionController.js +4 -2
  35. package/dist/components/ShapeEditor/_state/createInteractionController.js.map +1 -1
  36. package/dist/components/ShapeEditor/_state/useAssistant.cjs +1 -1
  37. package/dist/components/ShapeEditor/_state/useAssistant.cjs.map +1 -1
  38. package/dist/components/ShapeEditor/_state/useAssistant.d.cts +1 -0
  39. package/dist/components/ShapeEditor/_state/useAssistant.d.ts +1 -0
  40. package/dist/components/ShapeEditor/_state/useAssistant.js +81 -74
  41. package/dist/components/ShapeEditor/_state/useAssistant.js.map +1 -1
  42. package/dist/components/ShapeEditor/_state/useDrawSession.cjs +1 -1
  43. package/dist/components/ShapeEditor/_state/useDrawSession.cjs.map +1 -1
  44. package/dist/components/ShapeEditor/_state/useDrawSession.d.cts +4 -1
  45. package/dist/components/ShapeEditor/_state/useDrawSession.d.ts +4 -1
  46. package/dist/components/ShapeEditor/_state/useDrawSession.js +184 -164
  47. package/dist/components/ShapeEditor/_state/useDrawSession.js.map +1 -1
  48. package/dist/components/ShapeEditor/_state/useEditorDocument.cjs +1 -1
  49. package/dist/components/ShapeEditor/_state/useEditorDocument.cjs.map +1 -1
  50. package/dist/components/ShapeEditor/_state/useEditorDocument.d.cts +7 -0
  51. package/dist/components/ShapeEditor/_state/useEditorDocument.d.ts +7 -0
  52. package/dist/components/ShapeEditor/_state/useEditorDocument.js +61 -31
  53. package/dist/components/ShapeEditor/_state/useEditorDocument.js.map +1 -1
  54. package/dist/components/ShapeEditor/_state/useSelectionModel.cjs +1 -1
  55. package/dist/components/ShapeEditor/_state/useSelectionModel.cjs.map +1 -1
  56. package/dist/components/ShapeEditor/_state/useSelectionModel.js +10 -3
  57. package/dist/components/ShapeEditor/_state/useSelectionModel.js.map +1 -1
  58. package/dist/components/Toast/Toast.cjs.map +1 -1
  59. package/dist/components/Toast/Toast.d.cts +2 -1
  60. package/dist/components/Toast/Toast.d.ts +2 -1
  61. package/dist/components/Toast/Toast.js.map +1 -1
  62. package/dist/index.cjs +1 -1
  63. package/dist/index.js +53 -53
  64. package/dist/llms-full.txt +11 -11
  65. package/dist/llms.txt +2 -2
  66. package/dist/utils/dataAttributes.d.cts +7 -0
  67. package/dist/utils/dataAttributes.d.ts +7 -0
  68. package/package.json +1 -1
package/dist/DESIGN.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @aivex/ui 디자인 토큰과 규칙
2
2
 
3
- > 버전 1.2.0-dev.57. 이 파일은 빌드할 때 `tokens.css`에서 생성된다. 컴포넌트 목록과 props는 `llms.txt`·`llms-full.txt`에 있다.
3
+ > 버전 1.2.0-dev.59. 이 파일은 빌드할 때 `tokens.css`에서 생성된다. 컴포넌트 목록과 props는 `llms.txt`·`llms-full.txt`에 있다.
4
4
 
5
5
  앱에서 아래 클래스를 쓰려면 Tailwind v4 전역 CSS에 프리셋을 넣는다.
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"Coachmark.cjs","names":[],"sources":["../../../src/components/Coachmark/Coachmark.tsx"],"sourcesContent":["\"use client\";\n\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { popoverContentBaseClassName } from \"@/components/Popover/Popover\";\nimport { cn } from \"@/utils/cn\";\n\n// 진한 배경(static-gray) 위 코치마크 콘텐츠. Radix가 side/충돌 회피/화살표 위치를 처리한다.\n// 폭 280px은 Figma Popover-Bubble(3848:11976) 사양이다(Popover-Dropdown은 277px).\nconst contentClassName = cn(\n popoverContentBaseClassName,\n \"aivex:w-[280px] aivex:bg-static-gray aivex:text-text-on-color\",\n);\n\n/** 버튼은 라벨을 children으로 받고, 스타일(variant/color/size)은 Coachmark가 고정한다. */\nexport interface CoachmarkButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n > {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\nfunction CoachmarkActionButton({\n button,\n variant,\n className,\n}: {\n button: CoachmarkButtonProps;\n variant: ButtonProps[\"variant\"];\n className?: string;\n}) {\n const { children, ...props } = button;\n\n return (\n <Button\n variant={variant}\n color=\"primary\"\n size=\"md\"\n // 진한 배경 위라 세 버튼 모두 text/on-color(흰색)다. ghost의 기본 브랜드색을 덮는다.\n className={cn(\"aivex:text-text-on-color\", className)}\n {...props}\n >\n {children}\n </Button>\n );\n}\n\n// ─── Root ───────────────────────────────────────────────────────────────────\n/** Coachmark 루트 props (Radix `Popover.Root`와 동일: `open`·`defaultOpen`·`onOpenChange`·`modal`). */\ntype CoachmarkRootProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Root>;\n\n/** 코치마크의 열림 상태를 관리하는 루트(Radix Popover.Root). */\nfunction CoachmarkRoot(props: CoachmarkRootProps) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\n// ─── Trigger / Anchor ────────────────────────────────────────────────────────\n/** Coachmark.Trigger props (Radix `Popover.Trigger`와 동일). */\ntype CoachmarkTriggerProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger> & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** 클릭하면 코치마크를 여닫는 기준 요소. asChild로 임의 요소를 감싼다. */\nfunction CoachmarkTrigger({ ref, ...props }: CoachmarkTriggerProps) {\n return <PopoverPrimitive.Trigger ref={ref} {...props} />;\n}\n\n/** Coachmark.Anchor props (Radix `Popover.Anchor`와 동일). */\ntype CoachmarkAnchorProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>;\n\n/** 클릭 트리거 없이 특정 요소를 기준점으로만 쓸 때 사용한다. */\nfunction CoachmarkAnchor(props: CoachmarkAnchorProps) {\n return <PopoverPrimitive.Anchor {...props} />;\n}\n\n// ─── Content ─────────────────────────────────────────────────────────────────\n/** Coachmark.Content props. `side`·`align`·`sideOffset` 등 Radix `Popover.Content` 위치 props도 받는다. */\ninterface CoachmarkContentProps\n extends Omit<ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>, \"children\" | \"title\"> {\n /** 상단 타이틀. 생략하면 타이틀 영역을 렌더하지 않는다. */\n title?: ReactNode;\n /** 본문(텍스트·이미지 등, min 40 / max 200px, 초과 시 스크롤). */\n children?: ReactNode;\n /** 좌측 하단 보조 버튼(예: 넘기기). */\n tertiaryButton?: CoachmarkButtonProps;\n /** 우측 보조 버튼(예: 이전). */\n secondaryButton?: CoachmarkButtonProps;\n /** 우측 주요 버튼(예: 다음). */\n primaryButton?: CoachmarkButtonProps;\n /** 지정하면 타이틀 우측에 닫기(X) 버튼을 렌더한다. */\n onClose?: () => void;\n /** 포털 대상. 생략하면 document.body — Shadow DOM 안에서는 그 루트 안의 요소를 넘긴다. */\n container?: ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>[\"container\"];\n /**\n * 닫기 버튼 aria-label\n * @default \"닫기\"\n */\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * 진한 배경의 말풍선 본체. 포털로 렌더링되고 열릴 때 포커스를 가져가지 않는다.\n * `sideOffset` 기본값은 8이다.\n */\nfunction CoachmarkContent({\n className,\n sideOffset = 8,\n title,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n onClose,\n closeAriaLabel = \"닫기\",\n container,\n ref,\n ...props\n}: CoachmarkContentProps) {\n const hasBtnArea = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n // 코치마크는 페이지 흐름을 방해하지 않도록 열릴 때 포커스를 뺏지 않는다.\n onOpenAutoFocus={(event) => event.preventDefault()}\n className={cn(contentClassName, className)}\n {...props}\n >\n {(title != null || onClose != null) && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:gap-2.5 aivex:px-xs\">\n <div className=\"aivex:min-w-0 aivex:flex-1 aivex:truncate aivex:text-label-lg\">\n {title}\n </div>\n {onClose != null && (\n <IconButton aria-label={closeAriaLabel} color=\"white\" size=\"xs\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n )}\n </div>\n )}\n\n <div className=\"aivex:flex aivex:max-h-[200px] aivex:min-h-[40px] aivex:w-full aivex:flex-col aivex:gap-md aivex:overflow-y-auto aivex:text-body-md-regular\">\n {children}\n </div>\n\n {hasBtnArea && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-md\">\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-start\">\n {tertiaryButton && (\n <CoachmarkActionButton\n button={tertiaryButton}\n variant=\"ghost\"\n className=\"aivex:min-w-9\"\n />\n )}\n </div>\n <div className=\"aivex:flex aivex:items-start aivex:gap-md\">\n {secondaryButton && (\n <CoachmarkActionButton\n button={secondaryButton}\n variant=\"ghost\"\n className=\"aivex:min-w-[60px]\"\n />\n )}\n {primaryButton && (\n <CoachmarkActionButton\n button={primaryButton}\n variant=\"solid\"\n className=\"aivex:min-w-[60px]\"\n />\n )}\n </div>\n </div>\n )}\n\n <PopoverPrimitive.Arrow width={20} height={10} className=\"aivex:fill-static-gray\" />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n}\n\n/**\n * 특정 요소를 가리키며 온보딩·기능 안내를 띄우는 진한 말풍선 코치마크.\n *\n * Figma Popover-Bubble(3848:11976). `@radix-ui/react-popover` 기반이라 side/정렬/충돌 회피/화살표 위치를 Radix가 처리한다.\n * 진한 배경 위에 타이틀·닫기·본문·버튼(넘기기/이전/다음)을 담는다. 일반 드롭다운·폼 팝업은 `Popover`, 짧은 hover 설명은 `Tooltip`을 쓴다.\n * 구성: `Coachmark`(루트, `open`/`onOpenChange`) > `Coachmark.Trigger` 또는 `Coachmark.Anchor`(asChild) + `Coachmark.Content`.\n * 바깥 클릭 등으로도 닫히므로 보통 `open`을 제어형으로 관리한다.\n *\n * @example\n * ```tsx\n * import { Button, Coachmark } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(true);\n *\n * <Coachmark open={open} onOpenChange={setOpen}>\n * <Coachmark.Anchor asChild>\n * <Button variant=\"outline\" color=\"secondary\">새 기능</Button>\n * </Coachmark.Anchor>\n * <Coachmark.Content\n * side=\"bottom\"\n * title=\"새 기능 안내\"\n * onClose={() => setOpen(false)}\n * tertiaryButton={{ children: \"넘기기\", onClick: () => setOpen(false) }}\n * primaryButton={{ children: \"다음\", onClick: goNext }}\n * >\n * 여기서 데이터를 내보낼 수 있습니다.\n * </Coachmark.Content>\n * </Coachmark>\n * ```\n */\nconst Coachmark = Object.assign(CoachmarkRoot, {\n Trigger: CoachmarkTrigger,\n Anchor: CoachmarkAnchor,\n Content: CoachmarkContent,\n});\n\nexport type {\n CoachmarkAnchorProps,\n CoachmarkContentProps,\n CoachmarkRootProps,\n CoachmarkTriggerProps,\n};\nexport { Coachmark };\n"],"mappings":"uVAYA,IAAM,EAAmB,EAAA,GACvB,EAAA,4BACA,gEACD,CAYD,SAAS,EAAsB,CAC7B,SACA,UACA,aAKC,CACD,GAAM,CAAE,WAAU,GAAG,GAAU,EAE/B,OACE,EAAA,EAAA,KAAC,EAAA,OAAD,CACW,UACT,MAAM,UACN,KAAK,KAEL,UAAW,EAAA,GAAG,2BAA4B,EAAU,CACpD,GAAI,EAEH,WACM,CAAA,CASb,SAAS,EAAc,EAA2B,CAChD,OAAO,EAAA,EAAA,KAAC,EAAiB,KAAlB,CAAuB,GAAI,EAAS,CAAA,CAU7C,SAAS,EAAiB,CAAE,MAAK,GAAG,GAAgC,CAClE,OAAO,EAAA,EAAA,KAAC,EAAiB,QAAlB,CAA+B,MAAK,G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A,GACF,IAGR,EAAA,EAAA,KAAC,EAAiB,MAAlB,CAAwB,MAAO,GAAI,OAAQ,GAAI,UAAU,yBAA2B,CAAA,CAC3D,GACH,CAAA,CAkC9B,IAAM,EAAY,OAAO,OAAO,EAAe,CAC7C,QAAS,EACT,OAAQ,EACR,QAAS,EACV,CAAC"}
1
+ {"version":3,"file":"Coachmark.cjs","names":[],"sources":["../../../src/components/Coachmark/Coachmark.tsx"],"sourcesContent":["\"use client\";\n\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { popoverContentBaseClassName } from \"@/components/Popover/Popover\";\nimport { cn } from \"@/utils/cn\";\nimport type { DataAttributes } from \"@/utils/dataAttributes\";\n\n// 진한 배경(static-gray) 위 코치마크 콘텐츠. Radix가 side/충돌 회피/화살표 위치를 처리한다.\n// 폭 280px은 Figma Popover-Bubble(3848:11976) 사양이다(Popover-Dropdown은 277px).\nconst contentClassName = cn(\n popoverContentBaseClassName,\n \"aivex:w-[280px] aivex:bg-static-gray aivex:text-text-on-color\",\n);\n\n/** 버튼은 라벨을 children으로 받고, 스타일(variant/color/size)은 Coachmark가 고정한다. */\nexport interface CoachmarkButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n >,\n DataAttributes {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\nfunction CoachmarkActionButton({\n button,\n variant,\n className,\n}: {\n button: CoachmarkButtonProps;\n variant: ButtonProps[\"variant\"];\n className?: string;\n}) {\n const { children, ...props } = button;\n\n return (\n <Button\n variant={variant}\n color=\"primary\"\n size=\"md\"\n // 진한 배경 위라 세 버튼 모두 text/on-color(흰색)다. ghost의 기본 브랜드색을 덮는다.\n className={cn(\"aivex:text-text-on-color\", className)}\n {...props}\n >\n {children}\n </Button>\n );\n}\n\n// ─── Root ───────────────────────────────────────────────────────────────────\n/** Coachmark 루트 props (Radix `Popover.Root`와 동일: `open`·`defaultOpen`·`onOpenChange`·`modal`). */\ntype CoachmarkRootProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Root>;\n\n/** 코치마크의 열림 상태를 관리하는 루트(Radix Popover.Root). */\nfunction CoachmarkRoot(props: CoachmarkRootProps) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\n// ─── Trigger / Anchor ────────────────────────────────────────────────────────\n/** Coachmark.Trigger props (Radix `Popover.Trigger`와 동일). */\ntype CoachmarkTriggerProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger> & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** 클릭하면 코치마크를 여닫는 기준 요소. asChild로 임의 요소를 감싼다. */\nfunction CoachmarkTrigger({ ref, ...props }: CoachmarkTriggerProps) {\n return <PopoverPrimitive.Trigger ref={ref} {...props} />;\n}\n\n/** Coachmark.Anchor props (Radix `Popover.Anchor`와 동일). */\ntype CoachmarkAnchorProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>;\n\n/** 클릭 트리거 없이 특정 요소를 기준점으로만 쓸 때 사용한다. */\nfunction CoachmarkAnchor(props: CoachmarkAnchorProps) {\n return <PopoverPrimitive.Anchor {...props} />;\n}\n\n// ─── Content ─────────────────────────────────────────────────────────────────\n/** Coachmark.Content props. `side`·`align`·`sideOffset` 등 Radix `Popover.Content` 위치 props도 받는다. */\ninterface CoachmarkContentProps\n extends Omit<ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>, \"children\" | \"title\"> {\n /** 상단 타이틀. 생략하면 타이틀 영역을 렌더하지 않는다. */\n title?: ReactNode;\n /** 본문(텍스트·이미지 등, min 40 / max 200px, 초과 시 스크롤). */\n children?: ReactNode;\n /** 좌측 하단 보조 버튼(예: 넘기기). */\n tertiaryButton?: CoachmarkButtonProps;\n /** 우측 보조 버튼(예: 이전). */\n secondaryButton?: CoachmarkButtonProps;\n /** 우측 주요 버튼(예: 다음). */\n primaryButton?: CoachmarkButtonProps;\n /** 지정하면 타이틀 우측에 닫기(X) 버튼을 렌더한다. */\n onClose?: () => void;\n /** 포털 대상. 생략하면 document.body — Shadow DOM 안에서는 그 루트 안의 요소를 넘긴다. */\n container?: ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>[\"container\"];\n /**\n * 닫기 버튼 aria-label\n * @default \"닫기\"\n */\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * 진한 배경의 말풍선 본체. 포털로 렌더링되고 열릴 때 포커스를 가져가지 않는다.\n * `sideOffset` 기본값은 8이다.\n */\nfunction CoachmarkContent({\n className,\n sideOffset = 8,\n title,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n onClose,\n closeAriaLabel = \"닫기\",\n container,\n ref,\n ...props\n}: CoachmarkContentProps) {\n const hasBtnArea = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n // 코치마크는 페이지 흐름을 방해하지 않도록 열릴 때 포커스를 뺏지 않는다.\n onOpenAutoFocus={(event) => event.preventDefault()}\n className={cn(contentClassName, className)}\n {...props}\n >\n {(title != null || onClose != null) && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:gap-2.5 aivex:px-xs\">\n <div className=\"aivex:min-w-0 aivex:flex-1 aivex:truncate aivex:text-label-lg\">\n {title}\n </div>\n {onClose != null && (\n <IconButton aria-label={closeAriaLabel} color=\"white\" size=\"xs\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n )}\n </div>\n )}\n\n <div className=\"aivex:flex aivex:max-h-[200px] aivex:min-h-[40px] aivex:w-full aivex:flex-col aivex:gap-md aivex:overflow-y-auto aivex:text-body-md-regular\">\n {children}\n </div>\n\n {hasBtnArea && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-md\">\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-start\">\n {tertiaryButton && (\n <CoachmarkActionButton\n button={tertiaryButton}\n variant=\"ghost\"\n className=\"aivex:min-w-9\"\n />\n )}\n </div>\n <div className=\"aivex:flex aivex:items-start aivex:gap-md\">\n {secondaryButton && (\n <CoachmarkActionButton\n button={secondaryButton}\n variant=\"ghost\"\n className=\"aivex:min-w-[60px]\"\n />\n )}\n {primaryButton && (\n <CoachmarkActionButton\n button={primaryButton}\n variant=\"solid\"\n className=\"aivex:min-w-[60px]\"\n />\n )}\n </div>\n </div>\n )}\n\n <PopoverPrimitive.Arrow width={20} height={10} className=\"aivex:fill-static-gray\" />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n}\n\n/**\n * 특정 요소를 가리키며 온보딩·기능 안내를 띄우는 진한 말풍선 코치마크.\n *\n * Figma Popover-Bubble(3848:11976). `@radix-ui/react-popover` 기반이라 side/정렬/충돌 회피/화살표 위치를 Radix가 처리한다.\n * 진한 배경 위에 타이틀·닫기·본문·버튼(넘기기/이전/다음)을 담는다. 일반 드롭다운·폼 팝업은 `Popover`, 짧은 hover 설명은 `Tooltip`을 쓴다.\n * 구성: `Coachmark`(루트, `open`/`onOpenChange`) > `Coachmark.Trigger` 또는 `Coachmark.Anchor`(asChild) + `Coachmark.Content`.\n * 바깥 클릭 등으로도 닫히므로 보통 `open`을 제어형으로 관리한다.\n *\n * @example\n * ```tsx\n * import { Button, Coachmark } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(true);\n *\n * <Coachmark open={open} onOpenChange={setOpen}>\n * <Coachmark.Anchor asChild>\n * <Button variant=\"outline\" color=\"secondary\">새 기능</Button>\n * </Coachmark.Anchor>\n * <Coachmark.Content\n * side=\"bottom\"\n * title=\"새 기능 안내\"\n * onClose={() => setOpen(false)}\n * tertiaryButton={{ children: \"넘기기\", onClick: () => setOpen(false) }}\n * primaryButton={{ children: \"다음\", onClick: goNext }}\n * >\n * 여기서 데이터를 내보낼 수 있습니다.\n * </Coachmark.Content>\n * </Coachmark>\n * ```\n */\nconst Coachmark = Object.assign(CoachmarkRoot, {\n Trigger: CoachmarkTrigger,\n Anchor: CoachmarkAnchor,\n Content: CoachmarkContent,\n});\n\nexport type {\n CoachmarkAnchorProps,\n CoachmarkContentProps,\n CoachmarkRootProps,\n CoachmarkTriggerProps,\n};\nexport { Coachmark };\n"],"mappings":"uVAaA,IAAM,EAAmB,EAAA,GACvB,EAAA,4BACA,gEACD,CAaD,SAAS,EAAsB,CAC7B,SACA,UACA,aAKC,CACD,GAAM,CAAE,WAAU,GAAG,GAAU,EAE/B,OACE,EAAA,EAAA,KAAC,EAAA,OAAD,CACW,UACT,MAAM,UACN,KAAK,KAEL,UAAW,EAAA,GAAG,2BAA4B,EAAU,CACpD,GAAI,EAEH,WACM,CAAA,CASb,SAAS,EAAc,EAA2B,CAChD,OAAO,EAAA,EAAA,KAAC,EAAiB,KAAlB,CAAuB,GAAI,EAAS,CAAA,CAU7C,SAAS,EAAiB,CAAE,MAAK,GAAG,GAAgC,CAClE,OAAO,EAAA,EAAA,KAAC,EAAiB,QAAlB,CAA+B,MAAK,GAAI,EAAS,CAAA,CAO1D,SAAS,EAAgB,EAA6B,CACpD,OAAO,EAAA,EAAA,KAAC,EAAiB,OAAlB,CAAyB,GAAI,EAAS,CAAA,CAiC/C,SAAS,EAAiB,CACxB,YACA,aAAa,EACb,QACA,WACA,iBACA,kBACA,gBACA,UACA,iBAAiB,KACjB,YACA,MACA,GAAG,GACqB,CACxB,IAAM,EAAa,GAAQ,GAAkB,GAAmB,GAEhE,OACE,EAAA,EAAA,KAAC,EAAiB,OAAlB,CAAoC,sBAClC,EAAA,EAAA,MAAC,EAAiB,QAAlB,CACO,MACO,aAEZ,gBAAkB,GAAU,EAAM,gBAAgB,CAClD,UAAW,EAAA,GAAG,EAAkB,EAAU,CAC1C,GAAI,WANN,EAQI,GAAS,MAAQ,GAAW,QAC5B,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,gFAAf,EACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,yEACZ,EACG,CAAA,CACL,GAAW,OACV,EAAA,EAAA,KAAC,EAAA,WAAD,CAAY,aAAY,EAAgB,MAAM,QAAQ,KAAK,KAAK,QAAS,YACvE,EAAA,EAAA,KAAC,EAAA,UAAD,CAAW,KAAM,GAAM,CAAA,CACZ,CAAA,CAEX,IAGR,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,8IACZ,WACG,CAAA,CAEL,IACC,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qFAAf,EACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,mEACZ,IACC,EAAA,EAAA,KAAC,EAAD,CACE,OAAQ,EACR,QAAQ,QACR,UAAU,gBACV,CAAA,CAEA,CAAA,EACN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qDAAf,CACG,IACC,EAAA,EAAA,KAAC,EAAD,CACE,OAAQ,EACR,QAAQ,QACR,UAAU,qBACV,CAAA,CAEH,IACC,EAAA,EAAA,KAAC,EAAD,CACE,OAAQ,EACR,QAAQ,QACR,UAAU,qBACV,CAAA,CAEA,GACF,IAGR,EAAA,EAAA,KAAC,EAAiB,MAAlB,CAAwB,MAAO,GAAI,OAAQ,GAAI,UAAU,yBAA2B,CAAA,CAC3D,GACH,CAAA,CAkC9B,IAAM,EAAY,OAAO,OAAO,EAAe,CAC7C,QAAS,EACT,OAAQ,EACR,QAAS,EACV,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import * as PopoverPrimitive from "@radix-ui/react-popover";
2
2
  import type { ComponentPropsWithoutRef, ReactNode, Ref } from "react";
3
3
  import { type ButtonProps } from "../Button/index.cjs";
4
+ import type { DataAttributes } from "../../utils/dataAttributes.cjs";
4
5
  /** 버튼은 라벨을 children으로 받고, 스타일(variant/color/size)은 Coachmark가 고정한다. */
5
- export interface CoachmarkButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant"> {
6
+ export interface CoachmarkButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant">, DataAttributes {
6
7
  /** 버튼 라벨 */
7
8
  children: ReactNode;
8
9
  }
@@ -1,8 +1,9 @@
1
1
  import * as PopoverPrimitive from "@radix-ui/react-popover";
2
2
  import type { ComponentPropsWithoutRef, ReactNode, Ref } from "react";
3
3
  import { type ButtonProps } from "../Button/index.js";
4
+ import type { DataAttributes } from "../../utils/dataAttributes.js";
4
5
  /** 버튼은 라벨을 children으로 받고, 스타일(variant/color/size)은 Coachmark가 고정한다. */
5
- export interface CoachmarkButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant"> {
6
+ export interface CoachmarkButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant">, DataAttributes {
6
7
  /** 버튼 라벨 */
7
8
  children: ReactNode;
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Coachmark.js","names":[],"sources":["../../../src/components/Coachmark/Coachmark.tsx"],"sourcesContent":["\"use client\";\n\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { popoverContentBaseClassName } from \"@/components/Popover/Popover\";\nimport { cn } from \"@/utils/cn\";\n\n// 진한 배경(static-gray) 위 코치마크 콘텐츠. Radix가 side/충돌 회피/화살표 위치를 처리한다.\n// 폭 280px은 Figma Popover-Bubble(3848:11976) 사양이다(Popover-Dropdown은 277px).\nconst contentClassName = cn(\n popoverContentBaseClassName,\n \"aivex:w-[280px] aivex:bg-static-gray aivex:text-text-on-color\",\n);\n\n/** 버튼은 라벨을 children으로 받고, 스타일(variant/color/size)은 Coachmark가 고정한다. */\nexport interface CoachmarkButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n > {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\nfunction CoachmarkActionButton({\n button,\n variant,\n className,\n}: {\n button: CoachmarkButtonProps;\n variant: ButtonProps[\"variant\"];\n className?: string;\n}) {\n const { children, ...props } = button;\n\n return (\n <Button\n variant={variant}\n color=\"primary\"\n size=\"md\"\n // 진한 배경 위라 세 버튼 모두 text/on-color(흰색)다. ghost의 기본 브랜드색을 덮는다.\n className={cn(\"aivex:text-text-on-color\", className)}\n {...props}\n >\n {children}\n </Button>\n );\n}\n\n// ─── Root ───────────────────────────────────────────────────────────────────\n/** Coachmark 루트 props (Radix `Popover.Root`와 동일: `open`·`defaultOpen`·`onOpenChange`·`modal`). */\ntype CoachmarkRootProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Root>;\n\n/** 코치마크의 열림 상태를 관리하는 루트(Radix Popover.Root). */\nfunction CoachmarkRoot(props: CoachmarkRootProps) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\n// ─── Trigger / Anchor ────────────────────────────────────────────────────────\n/** Coachmark.Trigger props (Radix `Popover.Trigger`와 동일). */\ntype CoachmarkTriggerProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger> & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** 클릭하면 코치마크를 여닫는 기준 요소. asChild로 임의 요소를 감싼다. */\nfunction CoachmarkTrigger({ ref, ...props }: CoachmarkTriggerProps) {\n return <PopoverPrimitive.Trigger ref={ref} {...props} />;\n}\n\n/** Coachmark.Anchor props (Radix `Popover.Anchor`와 동일). */\ntype CoachmarkAnchorProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>;\n\n/** 클릭 트리거 없이 특정 요소를 기준점으로만 쓸 때 사용한다. */\nfunction CoachmarkAnchor(props: CoachmarkAnchorProps) {\n return <PopoverPrimitive.Anchor {...props} />;\n}\n\n// ─── Content ─────────────────────────────────────────────────────────────────\n/** Coachmark.Content props. `side`·`align`·`sideOffset` 등 Radix `Popover.Content` 위치 props도 받는다. */\ninterface CoachmarkContentProps\n extends Omit<ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>, \"children\" | \"title\"> {\n /** 상단 타이틀. 생략하면 타이틀 영역을 렌더하지 않는다. */\n title?: ReactNode;\n /** 본문(텍스트·이미지 등, min 40 / max 200px, 초과 시 스크롤). */\n children?: ReactNode;\n /** 좌측 하단 보조 버튼(예: 넘기기). */\n tertiaryButton?: CoachmarkButtonProps;\n /** 우측 보조 버튼(예: 이전). */\n secondaryButton?: CoachmarkButtonProps;\n /** 우측 주요 버튼(예: 다음). */\n primaryButton?: CoachmarkButtonProps;\n /** 지정하면 타이틀 우측에 닫기(X) 버튼을 렌더한다. */\n onClose?: () => void;\n /** 포털 대상. 생략하면 document.body — Shadow DOM 안에서는 그 루트 안의 요소를 넘긴다. */\n container?: ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>[\"container\"];\n /**\n * 닫기 버튼 aria-label\n * @default \"닫기\"\n */\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * 진한 배경의 말풍선 본체. 포털로 렌더링되고 열릴 때 포커스를 가져가지 않는다.\n * `sideOffset` 기본값은 8이다.\n */\nfunction CoachmarkContent({\n className,\n sideOffset = 8,\n title,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n onClose,\n closeAriaLabel = \"닫기\",\n container,\n ref,\n ...props\n}: CoachmarkContentProps) {\n const hasBtnArea = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n // 코치마크는 페이지 흐름을 방해하지 않도록 열릴 때 포커스를 뺏지 않는다.\n onOpenAutoFocus={(event) => event.preventDefault()}\n className={cn(contentClassName, className)}\n {...props}\n >\n {(title != null || onClose != null) && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:gap-2.5 aivex:px-xs\">\n <div className=\"aivex:min-w-0 aivex:flex-1 aivex:truncate aivex:text-label-lg\">\n {title}\n </div>\n {onClose != null && (\n <IconButton aria-label={closeAriaLabel} color=\"white\" size=\"xs\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n )}\n </div>\n )}\n\n <div className=\"aivex:flex aivex:max-h-[200px] aivex:min-h-[40px] aivex:w-full aivex:flex-col aivex:gap-md aivex:overflow-y-auto aivex:text-body-md-regular\">\n {children}\n </div>\n\n {hasBtnArea && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-md\">\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-start\">\n {tertiaryButton && (\n <CoachmarkActionButton\n button={tertiaryButton}\n variant=\"ghost\"\n className=\"aivex:min-w-9\"\n />\n )}\n </div>\n <div className=\"aivex:flex aivex:items-start aivex:gap-md\">\n {secondaryButton && (\n <CoachmarkActionButton\n button={secondaryButton}\n variant=\"ghost\"\n className=\"aivex:min-w-[60px]\"\n />\n )}\n {primaryButton && (\n <CoachmarkActionButton\n button={primaryButton}\n variant=\"solid\"\n className=\"aivex:min-w-[60px]\"\n />\n )}\n </div>\n </div>\n )}\n\n <PopoverPrimitive.Arrow width={20} height={10} className=\"aivex:fill-static-gray\" />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n}\n\n/**\n * 특정 요소를 가리키며 온보딩·기능 안내를 띄우는 진한 말풍선 코치마크.\n *\n * Figma Popover-Bubble(3848:11976). `@radix-ui/react-popover` 기반이라 side/정렬/충돌 회피/화살표 위치를 Radix가 처리한다.\n * 진한 배경 위에 타이틀·닫기·본문·버튼(넘기기/이전/다음)을 담는다. 일반 드롭다운·폼 팝업은 `Popover`, 짧은 hover 설명은 `Tooltip`을 쓴다.\n * 구성: `Coachmark`(루트, `open`/`onOpenChange`) > `Coachmark.Trigger` 또는 `Coachmark.Anchor`(asChild) + `Coachmark.Content`.\n * 바깥 클릭 등으로도 닫히므로 보통 `open`을 제어형으로 관리한다.\n *\n * @example\n * ```tsx\n * import { Button, Coachmark } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(true);\n *\n * <Coachmark open={open} onOpenChange={setOpen}>\n * <Coachmark.Anchor asChild>\n * <Button variant=\"outline\" color=\"secondary\">새 기능</Button>\n * </Coachmark.Anchor>\n * <Coachmark.Content\n * side=\"bottom\"\n * title=\"새 기능 안내\"\n * onClose={() => setOpen(false)}\n * tertiaryButton={{ children: \"넘기기\", onClick: () => setOpen(false) }}\n * primaryButton={{ children: \"다음\", onClick: goNext }}\n * >\n * 여기서 데이터를 내보낼 수 있습니다.\n * </Coachmark.Content>\n * </Coachmark>\n * ```\n */\nconst Coachmark = Object.assign(CoachmarkRoot, {\n Trigger: CoachmarkTrigger,\n Anchor: CoachmarkAnchor,\n Content: CoachmarkContent,\n});\n\nexport type {\n CoachmarkAnchorProps,\n CoachmarkContentProps,\n CoachmarkRootProps,\n CoachmarkTriggerProps,\n};\nexport { Coachmark };\n"],"mappings":";;;;;;;;;;AAYA,IAAM,IAAmB,EACvB,GACA,gEACD;AAYD,SAAS,EAAsB,EAC7B,WACA,YACA,gBAKC;CACD,IAAM,EAAE,aAAU,GAAG,MAAU;AAE/B,QACE,kBAAC,GAAD;EACW;EACT,OAAM;EACN,MAAK;EAEL,WAAW,EAAG,4BAA4B,EAAU;EACpD,GAAI;EAEH;EACM,CAAA;;AASb,SAAS,EAAc,GAA2B;AAChD,QAAO,kBAAC,EAAiB,MAAlB,EAAuB,GAAI,GAAS,CAAA;;AAU7C,SAAS,EAAiB,EAAE,QAAK,GAAG,KAAgC;AAClE,QAAO,kBAAC,EAAiB,SAAlB;EAA+B;EAAK,GAAI;EAAS,CAAA;;AAO1D,SAAS,EAAgB,GAA6B;AACpD,QAAO,kBAAC,EAAiB,QAAlB,EA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ark.tsx"],"sourcesContent":["\"use client\";\n\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { popoverContentBaseClassName } from \"@/components/Popover/Popover\";\nimport { cn } from \"@/utils/cn\";\nimport type { DataAttributes } from \"@/utils/dataAttributes\";\n\n// 진한 배경(static-gray) 위 코치마크 콘텐츠. Radix가 side/충돌 회피/화살표 위치를 처리한다.\n// 폭 280px은 Figma Popover-Bubble(3848:11976) 사양이다(Popover-Dropdown은 277px).\nconst contentClassName = cn(\n popoverContentBaseClassName,\n \"aivex:w-[280px] aivex:bg-static-gray aivex:text-text-on-color\",\n);\n\n/** 버튼은 라벨을 children으로 받고, 스타일(variant/color/size)은 Coachmark가 고정한다. */\nexport interface CoachmarkButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n >,\n DataAttributes {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\nfunction CoachmarkActionButton({\n button,\n variant,\n className,\n}: {\n button: CoachmarkButtonProps;\n variant: ButtonProps[\"variant\"];\n className?: string;\n}) {\n const { children, ...props } = button;\n\n return (\n <Button\n variant={variant}\n color=\"primary\"\n size=\"md\"\n // 진한 배경 위라 세 버튼 모두 text/on-color(흰색)다. ghost의 기본 브랜드색을 덮는다.\n className={cn(\"aivex:text-text-on-color\", className)}\n {...props}\n >\n {children}\n </Button>\n );\n}\n\n// ─── Root ───────────────────────────────────────────────────────────────────\n/** Coachmark 루트 props (Radix `Popover.Root`와 동일: `open`·`defaultOpen`·`onOpenChange`·`modal`). */\ntype CoachmarkRootProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Root>;\n\n/** 코치마크의 열림 상태를 관리하는 루트(Radix Popover.Root). */\nfunction CoachmarkRoot(props: CoachmarkRootProps) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\n// ─── Trigger / Anchor ────────────────────────────────────────────────────────\n/** Coachmark.Trigger props (Radix `Popover.Trigger`와 동일). */\ntype CoachmarkTriggerProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger> & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** 클릭하면 코치마크를 여닫는 기준 요소. asChild로 임의 요소를 감싼다. */\nfunction CoachmarkTrigger({ ref, ...props }: CoachmarkTriggerProps) {\n return <PopoverPrimitive.Trigger ref={ref} {...props} />;\n}\n\n/** Coachmark.Anchor props (Radix `Popover.Anchor`와 동일). */\ntype CoachmarkAnchorProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>;\n\n/** 클릭 트리거 없이 특정 요소를 기준점으로만 쓸 때 사용한다. */\nfunction CoachmarkAnchor(props: CoachmarkAnchorProps) {\n return <PopoverPrimitive.Anchor {...props} />;\n}\n\n// ─── Content ─────────────────────────────────────────────────────────────────\n/** Coachmark.Content props. `side`·`align`·`sideOffset` 등 Radix `Popover.Content` 위치 props도 받는다. */\ninterface CoachmarkContentProps\n extends Omit<ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>, \"children\" | \"title\"> {\n /** 상단 타이틀. 생략하면 타이틀 영역을 렌더하지 않는다. */\n title?: ReactNode;\n /** 본문(텍스트·이미지 등, min 40 / max 200px, 초과 시 스크롤). */\n children?: ReactNode;\n /** 좌측 하단 보조 버튼(예: 넘기기). */\n tertiaryButton?: CoachmarkButtonProps;\n /** 우측 보조 버튼(예: 이전). */\n secondaryButton?: CoachmarkButtonProps;\n /** 우측 주요 버튼(예: 다음). */\n primaryButton?: CoachmarkButtonProps;\n /** 지정하면 타이틀 우측에 닫기(X) 버튼을 렌더한다. */\n onClose?: () => void;\n /** 포털 대상. 생략하면 document.body — Shadow DOM 안에서는 그 루트 안의 요소를 넘긴다. */\n container?: ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>[\"container\"];\n /**\n * 닫기 버튼 aria-label\n * @default \"닫기\"\n */\n closeAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * 진한 배경의 말풍선 본체. 포털로 렌더링되고 열릴 때 포커스를 가져가지 않는다.\n * `sideOffset` 기본값은 8이다.\n */\nfunction CoachmarkContent({\n className,\n sideOffset = 8,\n title,\n children,\n tertiaryButton,\n secondaryButton,\n primaryButton,\n onClose,\n closeAriaLabel = \"닫기\",\n container,\n ref,\n ...props\n}: CoachmarkContentProps) {\n const hasBtnArea = Boolean(tertiaryButton || secondaryButton || primaryButton);\n\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n // 코치마크는 페이지 흐름을 방해하지 않도록 열릴 때 포커스를 뺏지 않는다.\n onOpenAutoFocus={(event) => event.preventDefault()}\n className={cn(contentClassName, className)}\n {...props}\n >\n {(title != null || onClose != null) && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:gap-2.5 aivex:px-xs\">\n <div className=\"aivex:min-w-0 aivex:flex-1 aivex:truncate aivex:text-label-lg\">\n {title}\n </div>\n {onClose != null && (\n <IconButton aria-label={closeAriaLabel} color=\"white\" size=\"xs\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n )}\n </div>\n )}\n\n <div className=\"aivex:flex aivex:max-h-[200px] aivex:min-h-[40px] aivex:w-full aivex:flex-col aivex:gap-md aivex:overflow-y-auto aivex:text-body-md-regular\">\n {children}\n </div>\n\n {hasBtnArea && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-md\">\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-start\">\n {tertiaryButton && (\n <CoachmarkActionButton\n button={tertiaryButton}\n variant=\"ghost\"\n className=\"aivex:min-w-9\"\n />\n )}\n </div>\n <div className=\"aivex:flex aivex:items-start aivex:gap-md\">\n {secondaryButton && (\n <CoachmarkActionButton\n button={secondaryButton}\n variant=\"ghost\"\n className=\"aivex:min-w-[60px]\"\n />\n )}\n {primaryButton && (\n <CoachmarkActionButton\n button={primaryButton}\n variant=\"solid\"\n className=\"aivex:min-w-[60px]\"\n />\n )}\n </div>\n </div>\n )}\n\n <PopoverPrimitive.Arrow width={20} height={10} className=\"aivex:fill-static-gray\" />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n}\n\n/**\n * 특정 요소를 가리키며 온보딩·기능 안내를 띄우는 진한 말풍선 코치마크.\n *\n * Figma Popover-Bubble(3848:11976). `@radix-ui/react-popover` 기반이라 side/정렬/충돌 회피/화살표 위치를 Radix가 처리한다.\n * 진한 배경 위에 타이틀·닫기·본문·버튼(넘기기/이전/다음)을 담는다. 일반 드롭다운·폼 팝업은 `Popover`, 짧은 hover 설명은 `Tooltip`을 쓴다.\n * 구성: `Coachmark`(루트, `open`/`onOpenChange`) > `Coachmark.Trigger` 또는 `Coachmark.Anchor`(asChild) + `Coachmark.Content`.\n * 바깥 클릭 등으로도 닫히므로 보통 `open`을 제어형으로 관리한다.\n *\n * @example\n * ```tsx\n * import { Button, Coachmark } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(true);\n *\n * <Coachmark open={open} onOpenChange={setOpen}>\n * <Coachmark.Anchor asChild>\n * <Button variant=\"outline\" color=\"secondary\">새 기능</Button>\n * </Coachmark.Anchor>\n * <Coachmark.Content\n * side=\"bottom\"\n * title=\"새 기능 안내\"\n * onClose={() => setOpen(false)}\n * tertiaryButton={{ children: \"넘기기\", onClick: () => setOpen(false) }}\n * primaryButton={{ children: \"다음\", onClick: goNext }}\n * >\n * 여기서 데이터를 내보낼 수 있습니다.\n * </Coachmark.Content>\n * </Coachmark>\n * ```\n */\nconst Coachmark = Object.assign(CoachmarkRoot, {\n Trigger: CoachmarkTrigger,\n Anchor: CoachmarkAnchor,\n Content: CoachmarkContent,\n});\n\nexport type {\n CoachmarkAnchorProps,\n CoachmarkContentProps,\n CoachmarkRootProps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,CACE,kBAAC,OAAD;MAAK,WAAU;gBACZ,KACC,kBAAC,GAAD;OACE,QAAQ;OACR,SAAQ;OACR,WAAU;OACV,CAAA;MAEA,CAAA,EACN,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACG,KACC,kBAAC,GAAD;OACE,QAAQ;OACR,SAAQ;OACR,WAAU;OACV,CAAA,EAEH,KACC,kBAAC,GAAD;OACE,QAAQ;OACR,SAAQ;OACR,WAAU;OACV,CAAA,CAEA;QACF;;IAGR,kBAAC,EAAiB,OAAlB;KAAwB,OAAO;KAAI,QAAQ;KAAI,WAAU;KAA2B,CAAA;IAC3D;;EACH,CAAA;;AAkC9B,IAAM,IAAY,OAAO,OAAO,GAAe;CAC7C,SAAS;CACT,QAAQ;CACR,SAAS;CACV,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.cjs","names":[],"sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as RadixDialog from \"@radix-ui/react-alert-dialog\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CheckCircleFilledIcon, WarningTriangleFilledIcon } from \"@/components/Icon\";\nimport { Overlay } from \"@/components/Overlay\";\nimport { cn } from \"@/utils/cn\";\nimport { useModalAutoFocus } from \"@/utils/useModalAutoFocus\";\n\n/**\n * Dialog 톤. default는 확인 버튼이 primary, warning은 확인 버튼이 danger 색이 된다\n * (showIcon이면 아이콘도 성공/경고 아이콘으로 바뀐다).\n */\nexport type DialogVariant = \"default\" | \"warning\";\n/** Dialog 하단 버튼 — Button props에서 색·크기·스타일은 Dialog가 고정하고 라벨은 children으로 받는다. */\nexport interface DialogButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n > {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\n/** 확인 버튼 props. 누른다고 자동으로 닫히지 않으니 onClick에서 open을 false로 바꾼다. */\nexport type DialogConfirmButtonProps = DialogButtonProps;\n\ninterface DialogConfirmButtonInternalProps extends DialogConfirmButtonProps {\n defaultColor: ButtonProps[\"color\"];\n}\n\nexport interface DialogProps\n extends Omit<ComponentPropsWithoutRef<typeof RadixDialog.Root>, \"children\"> {\n /**\n * 톤. warning이면 확인 버튼이 danger 색이 된다(삭제 등 되돌릴 수 없는 동작).\n * @default \"default\"\n */\n variant?: DialogVariant;\n /** 제목(필수) — 다이얼로그의 접근성 이름이 된다. 줄바꿈(\\n)을 그대로 표시한다. */\n title: ReactNode;\n /** 제목 아래 설명 — 접근성 설명(aria-describedby)으로 연결된다. */\n description?: ReactNode;\n /** 설명 아래에 덧붙이는 추가 내용(체크박스 등). */\n children?: ReactNode;\n /** 취소 버튼. 누르면 다이얼로그가 닫힌다(onOpenChange(false) 호출). */\n cancelButton?: DialogButtonProps;\n /** 확인 버튼. 자동으로 닫히지 않으니 onClick에서 직접 닫는다. */\n confirmButton?: DialogConfirmButtonProps;\n /**\n * 제목 위에 톤 아이콘(default=성공, warning=경고)을 표시하고 내용을 가운데 정렬한다.\n * @default false\n */\n showIcon?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst iconMap = {\n default: { component: CheckCircleFilledIcon, className: \"aivex:text-icon-success\" },\n warning: { component: WarningTriangleFilledIcon, className: \"aivex:text-icon-warning\" },\n} as const;\n\n/**\n * 사용자에게 확인·취소를 묻는 작은 경고형(alert) 다이얼로그.\n *\n * 제목·설명·버튼 1~2개로 끝나는 확인 질문(저장할까요? 삭제할까요?)에 쓴다. 입력 폼이나\n * 긴 내용이 들어가면 Modal, 화면 안에 머무는 안내 문구는 Messagebox, 잠깐 뜨는 알림은\n * Toast를 쓴다. alertdialog라 바깥 클릭으로 닫히지 않고 Esc·취소 버튼으로만 닫힌다.\n * open/onOpenChange로 제어하거나 defaultOpen으로 비제어로 쓴다. title은 필수다.\n *\n * @example\n * ```tsx\n * import { Button, Dialog } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(false);\n *\n * <Button color=\"danger\" onClick={() => setOpen(true)}>삭제</Button>\n * <Dialog\n * open={open}\n * onOpenChange={setOpen}\n * variant=\"warning\"\n * title=\"프로젝트를 삭제할까요?\"\n * description=\"삭제한 프로젝트는 복구할 수 없습니다.\"\n * cancelButton={{ children: \"취소\" }}\n * confirmButton={{ children: \"삭제\", onClick: () => setOpen(false) }}\n * />\n * ```\n */\nfunction Dialog({\n open,\n defaultOpen,\n onOpenChange,\n variant = \"default\",\n title,\n description,\n children,\n cancelButton,\n confirmButton,\n showIcon = false,\n ref,\n ...props\n}: DialogProps) {\n const autoFocus = useModalAutoFocus();\n const icon = iconMap[variant];\n const IconComponent = showIcon ? icon.component : null;\n const isCenterAligned = Boolean(IconComponent);\n const confirmButtonColor = variant === \"warning\" ? \"danger\" : \"primary\";\n\n return (\n <RadixDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange} {...props}>\n <RadixDialog.Portal>\n <RadixDialog.Overlay asChild>\n <Overlay variant=\"dim\" />\n </RadixDialog.Overlay>\n <RadixDialog.Content\n ref={ref}\n {...autoFocus}\n className=\"aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal) aivex:w-[calc(100vw-32px)] aivex:max-w-[384px] aivex:-translate-x-1/2 aivex:-translate-y-1/2 aivex:outline-none\"\n // 설명이 없는 다이얼로그임을 Radix에 알린다 — 명시하지 않으면 개발 모드에서 매번 경고한다.\n {...(description ? {} : { \"aria-describedby\": undefined })}\n >\n <div className=\"aivex:flex aivex:w-full aivex:flex-col aivex:items-start aivex:gap-2xl aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-2xl aivex:shadow-xl\">\n <div\n className={cn(\n \"aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs aivex:px-md aivex:py-xs\",\n isCenterAligned\n ? \"aivex:items-center aivex:justify-center aivex:text-center\"\n : \"aivex:items-start aivex:text-left\",\n )}\n >\n {IconComponent && (\n <span\n className={cn(\n \"aivex:flex aivex:h-12 aivex:w-12 aivex:shrink-0 aivex:items-center aivex:justify-center aivex:leading-none\",\n icon.className,\n )}\n >\n <IconComponent size={28} />\n </span>\n )}\n <RadixDialog.Title className=\"aivex:m-0 aivex:w-full aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary\">\n {title}\n </RadixDialog.Title>\n {description && (\n <RadixDialog.Description className=\"aivex:m-0 aivex:w-full aivex:whitespace-pre-line aivex:text-body-lg-regular aivex:text-text-secondary\">\n {description}\n </RadixDialog.Description>\n )}\n {children}\n </div>\n\n {(cancelButton || confirmButton) && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-lg\">\n {cancelButton && <DialogCancelButton {...cancelButton} />}\n {confirmButton && (\n <DialogConfirmButton {...confirmButton} defaultColor={confirmButtonColor} />\n )}\n </div>\n )}\n </div>\n </RadixDialog.Content>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n );\n}\n\nfunction DialogCancelButton({ children, onClick, ...props }: DialogButtonProps) {\n return (\n <RadixDialog.Cancel asChild>\n <Button\n variant=\"solid\"\n color=\"secondary\"\n size=\"lg\"\n className=\"aivex:min-w-0 aivex:basis-0 aivex:flex-1\"\n onClick={(event) => {\n void onClick?.(event);\n }}\n {...props}\n >\n {children}\n </Button>\n </RadixDialog.Cancel>\n );\n}\n\nfunction DialogConfirmButton({\n children,\n defaultColor,\n onClick,\n ...props\n}: DialogConfirmButtonInternalProps) {\n return (\n <Button\n variant=\"solid\"\n color={defaultColor}\n size=\"lg\"\n className=\"aivex:min-w-0 aivex:basis-0 aivex:flex-1\"\n onClick={(event) => {\n void onClick?.(event);\n }}\n {...props}\n >\n {children}\n </Button>\n );\n}\n\nexport { Dialog };\n"],"mappings":"oVAuDA,IAAM,EAAU,CACd,QAAS,CAAE,UAAW,EAAA,sBAAuB,UAAW,0BAA2B,CACnF,QAAS,CAAE,UAAW,EAAA,0BAA2B,UAA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sB,CAAA,CAE1E,GAEJ,GACc,CAAA,CACH,CAAA,CAAA,CACJ,CAAA,CAIvB,SAAS,EAAmB,CAAE,WAAU,UAAS,GAAG,GAA4B,CAC9E,OACE,EAAA,EAAA,KAAC,EAAY,OAAb,CAAoB,QAAA,aAClB,EAAA,EAAA,KAAC,EAAA,OAAD,CACE,QAAQ,QACR,MAAM,YACN,KAAK,KACL,UAAU,2CACV,QAAU,GAAU,CACb,IAAU,EAAM,EAEvB,GAAI,EAEH,WACM,CAAA,CACU,CAAA,CAIzB,SAAS,EAAoB,CAC3B,WACA,eACA,UACA,GAAG,GACgC,CACnC,OACE,EAAA,EAAA,KAAC,EAAA,OAAD,CACE,QAAQ,QACR,MAAO,EACP,KAAK,KACL,UAAU,2CACV,QAAU,GAAU,CACb,IAAU,EAAM,EAEvB,GAAI,EAEH,WACM,CAAA"}
1
+ {"version":3,"file":"Dialog.cjs","names":[],"sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as RadixDialog from \"@radix-ui/react-alert-dialog\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CheckCircleFilledIcon, WarningTriangleFilledIcon } from \"@/components/Icon\";\nimport { Overlay } from \"@/components/Overlay\";\nimport { cn } from \"@/utils/cn\";\nimport type { DataAttributes } from \"@/utils/dataAttributes\";\nimport { useModalAutoFocus } from \"@/utils/useModalAutoFocus\";\n\n/**\n * Dialog 톤. default는 확인 버튼이 primary, warning은 확인 버튼이 danger 색이 된다\n * (showIcon이면 아이콘도 성공/경고 아이콘으로 바뀐다).\n */\nexport type DialogVariant = \"default\" | \"warning\";\n/** Dialog 하단 버튼 — Button props에서 색·크기·스타일은 Dialog가 고정하고 라벨은 children으로 받는다. */\nexport interface DialogButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n >,\n DataAttributes {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\n/** 확인 버튼 props. 누른다고 자동으로 닫히지 않으니 onClick에서 open을 false로 바꾼다. */\nexport type DialogConfirmButtonProps = DialogButtonProps;\n\ninterface DialogConfirmButtonInternalProps extends DialogConfirmButtonProps {\n defaultColor: ButtonProps[\"color\"];\n}\n\nexport interface DialogProps\n extends Omit<ComponentPropsWithoutRef<typeof RadixDialog.Root>, \"children\"> {\n /**\n * 톤. warning이면 확인 버튼이 danger 색이 된다(삭제 등 되돌릴 수 없는 동작).\n * @default \"default\"\n */\n variant?: DialogVariant;\n /** 제목(필수) — 다이얼로그의 접근성 이름이 된다. 줄바꿈(\\n)을 그대로 표시한다. */\n title: ReactNode;\n /** 제목 아래 설명 — 접근성 설명(aria-describedby)으로 연결된다. */\n description?: ReactNode;\n /** 설명 아래에 덧붙이는 추가 내용(체크박스 등). */\n children?: ReactNode;\n /** 취소 버튼. 누르면 다이얼로그가 닫힌다(onOpenChange(false) 호출). */\n cancelButton?: DialogButtonProps;\n /** 확인 버튼. 자동으로 닫히지 않으니 onClick에서 직접 닫는다. */\n confirmButton?: DialogConfirmButtonProps;\n /**\n * 제목 위에 톤 아이콘(default=성공, warning=경고)을 표시하고 내용을 가운데 정렬한다.\n * @default false\n */\n showIcon?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst iconMap = {\n default: { component: CheckCircleFilledIcon, className: \"aivex:text-icon-success\" },\n warning: { component: WarningTriangleFilledIcon, className: \"aivex:text-icon-warning\" },\n} as const;\n\n/**\n * 사용자에게 확인·취소를 묻는 작은 경고형(alert) 다이얼로그.\n *\n * 제목·설명·버튼 1~2개로 끝나는 확인 질문(저장할까요? 삭제할까요?)에 쓴다. 입력 폼이나\n * 긴 내용이 들어가면 Modal, 화면 안에 머무는 안내 문구는 Messagebox, 잠깐 뜨는 알림은\n * Toast를 쓴다. alertdialog라 바깥 클릭으로 닫히지 않고 Esc·취소 버튼으로만 닫힌다.\n * open/onOpenChange로 제어하거나 defaultOpen으로 비제어로 쓴다. title은 필수다.\n *\n * @example\n * ```tsx\n * import { Button, Dialog } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(false);\n *\n * <Button color=\"danger\" onClick={() => setOpen(true)}>삭제</Button>\n * <Dialog\n * open={open}\n * onOpenChange={setOpen}\n * variant=\"warning\"\n * title=\"프로젝트를 삭제할까요?\"\n * description=\"삭제한 프로젝트는 복구할 수 없습니다.\"\n * cancelButton={{ children: \"취소\" }}\n * confirmButton={{ children: \"삭제\", onClick: () => setOpen(false) }}\n * />\n * ```\n */\nfunction Dialog({\n open,\n defaultOpen,\n onOpenChange,\n variant = \"default\",\n title,\n description,\n children,\n cancelButton,\n confirmButton,\n showIcon = false,\n ref,\n ...props\n}: DialogProps) {\n const autoFocus = useModalAutoFocus();\n const icon = iconMap[variant];\n const IconComponent = showIcon ? icon.component : null;\n const isCenterAligned = Boolean(IconComponent);\n const confirmButtonColor = variant === \"warning\" ? \"danger\" : \"primary\";\n\n return (\n <RadixDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange} {...props}>\n <RadixDialog.Portal>\n <RadixDialog.Overlay asChild>\n <Overlay variant=\"dim\" />\n </RadixDialog.Overlay>\n <RadixDialog.Content\n ref={ref}\n {...autoFocus}\n className=\"aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal) aivex:w-[calc(100vw-32px)] aivex:max-w-[384px] aivex:-translate-x-1/2 aivex:-translate-y-1/2 aivex:outline-none\"\n // 설명이 없는 다이얼로그임을 Radix에 알린다 — 명시하지 않으면 개발 모드에서 매번 경고한다.\n {...(description ? {} : { \"aria-describedby\": undefined })}\n >\n <div className=\"aivex:flex aivex:w-full aivex:flex-col aivex:items-start aivex:gap-2xl aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-2xl aivex:shadow-xl\">\n <div\n className={cn(\n \"aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs aivex:px-md aivex:py-xs\",\n isCenterAligned\n ? \"aivex:items-center aivex:justify-center aivex:text-center\"\n : \"aivex:items-start aivex:text-left\",\n )}\n >\n {IconComponent && (\n <span\n className={cn(\n \"aivex:flex aivex:h-12 aivex:w-12 aivex:shrink-0 aivex:items-center aivex:justify-center aivex:leading-none\",\n icon.className,\n )}\n >\n <IconComponent size={28} />\n </span>\n )}\n <RadixDialog.Title className=\"aivex:m-0 aivex:w-full aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary\">\n {title}\n </RadixDialog.Title>\n {description && (\n <RadixDialog.Description className=\"aivex:m-0 aivex:w-full aivex:whitespace-pre-line aivex:text-body-lg-regular aivex:text-text-secondary\">\n {description}\n </RadixDialog.Description>\n )}\n {children}\n </div>\n\n {(cancelButton || confirmButton) && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-lg\">\n {cancelButton && <DialogCancelButton {...cancelButton} />}\n {confirmButton && (\n <DialogConfirmButton {...confirmButton} defaultColor={confirmButtonColor} />\n )}\n </div>\n )}\n </div>\n </RadixDialog.Content>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n );\n}\n\nfunction DialogCancelButton({ children, onClick, ...props }: DialogButtonProps) {\n return (\n <RadixDialog.Cancel asChild>\n <Button\n variant=\"solid\"\n color=\"secondary\"\n size=\"lg\"\n className=\"aivex:min-w-0 aivex:basis-0 aivex:flex-1\"\n onClick={(event) => {\n void onClick?.(event);\n }}\n {...props}\n >\n {children}\n </Button>\n </RadixDialog.Cancel>\n );\n}\n\nfunction DialogConfirmButton({\n children,\n defaultColor,\n onClick,\n ...props\n}: DialogConfirmButtonInternalProps) {\n return (\n <Button\n variant=\"solid\"\n color={defaultColor}\n size=\"lg\"\n className=\"aivex:min-w-0 aivex:basis-0 aivex:flex-1\"\n onClick={(event) => {\n void onClick?.(event);\n }}\n {...props}\n >\n {children}\n </Button>\n );\n}\n\nexport { Dialog };\n"],"mappings":"oVAyDA,IAAM,EAAU,CACd,QAAS,CAAE,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EAAgB,CAAA,CACxD,IACC,EAAA,EAAA,KAAC,EAAD,CAAqB,GAAI,EAAe,aAAc,EAAsB,CAAA,CAE1E,GAEJ,GACc,CAAA,CACH,CAAA,CAAA,CACJ,CAAA,CAIvB,SAAS,EAAmB,CAAE,WAAU,UAAS,GAAG,GAA4B,CAC9E,OACE,EAAA,EAAA,KAAC,EAAY,OAAb,CAAoB,QAAA,aAClB,EAAA,EAAA,KAAC,EAAA,OAAD,CACE,QAAQ,QACR,MAAM,YACN,KAAK,KACL,UAAU,2CACV,QAAU,GAAU,CACb,IAAU,EAAM,EAEvB,GAAI,EAEH,WACM,CAAA,CACU,CAAA,CAIzB,SAAS,EAAoB,CAC3B,WACA,eACA,UACA,GAAG,GACgC,CACnC,OACE,EAAA,EAAA,KAAC,EAAA,OAAD,CACE,QAAQ,QACR,MAAO,EACP,KAAK,KACL,UAAU,2CACV,QAAU,GAAU,CACb,IAAU,EAAM,EAEvB,GAAI,EAEH,WACM,CAAA"}
@@ -1,13 +1,14 @@
1
1
  import * as RadixDialog from "@radix-ui/react-alert-dialog";
2
2
  import type { ComponentPropsWithoutRef, ReactNode, Ref } from "react";
3
3
  import { type ButtonProps } from "../Button/index.cjs";
4
+ import type { DataAttributes } from "../../utils/dataAttributes.cjs";
4
5
  /**
5
6
  * Dialog 톤. default는 확인 버튼이 primary, warning은 확인 버튼이 danger 색이 된다
6
7
  * (showIcon이면 아이콘도 성공/경고 아이콘으로 바뀐다).
7
8
  */
8
9
  export type DialogVariant = "default" | "warning";
9
10
  /** Dialog 하단 버튼 — Button props에서 색·크기·스타일은 Dialog가 고정하고 라벨은 children으로 받는다. */
10
- export interface DialogButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant"> {
11
+ export interface DialogButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant">, DataAttributes {
11
12
  /** 버튼 라벨 */
12
13
  children: ReactNode;
13
14
  }
@@ -1,13 +1,14 @@
1
1
  import * as RadixDialog from "@radix-ui/react-alert-dialog";
2
2
  import type { ComponentPropsWithoutRef, ReactNode, Ref } from "react";
3
3
  import { type ButtonProps } from "../Button/index.js";
4
+ import type { DataAttributes } from "../../utils/dataAttributes.js";
4
5
  /**
5
6
  * Dialog 톤. default는 확인 버튼이 primary, warning은 확인 버튼이 danger 색이 된다
6
7
  * (showIcon이면 아이콘도 성공/경고 아이콘으로 바뀐다).
7
8
  */
8
9
  export type DialogVariant = "default" | "warning";
9
10
  /** Dialog 하단 버튼 — Button props에서 색·크기·스타일은 Dialog가 고정하고 라벨은 children으로 받는다. */
10
- export interface DialogButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant"> {
11
+ export interface DialogButtonProps extends Omit<ButtonProps, "asChild" | "children" | "className" | "color" | "ref" | "size" | "style" | "variant">, DataAttributes {
11
12
  /** 버튼 라벨 */
12
13
  children: ReactNode;
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","names":[],"sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as RadixDialog from \"@radix-ui/react-alert-dialog\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CheckCircleFilledIcon, WarningTriangleFilledIcon } from \"@/components/Icon\";\nimport { Overlay } from \"@/components/Overlay\";\nimport { cn } from \"@/utils/cn\";\nimport { useModalAutoFocus } from \"@/utils/useModalAutoFocus\";\n\n/**\n * Dialog 톤. default는 확인 버튼이 primary, warning은 확인 버튼이 danger 색이 된다\n * (showIcon이면 아이콘도 성공/경고 아이콘으로 바뀐다).\n */\nexport type DialogVariant = \"default\" | \"warning\";\n/** Dialog 하단 버튼 — Button props에서 색·크기·스타일은 Dialog가 고정하고 라벨은 children으로 받는다. */\nexport interface DialogButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n > {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\n/** 확인 버튼 props. 누른다고 자동으로 닫히지 않으니 onClick에서 open을 false로 바꾼다. */\nexport type DialogConfirmButtonProps = DialogButtonProps;\n\ninterface DialogConfirmButtonInternalProps extends DialogConfirmButtonProps {\n defaultColor: ButtonProps[\"color\"];\n}\n\nexport interface DialogProps\n extends Omit<ComponentPropsWithoutRef<typeof RadixDialog.Root>, \"children\"> {\n /**\n * 톤. warning이면 확인 버튼이 danger 색이 된다(삭제 등 되돌릴 수 없는 동작).\n * @default \"default\"\n */\n variant?: DialogVariant;\n /** 제목(필수) — 다이얼로그의 접근성 이름이 된다. 줄바꿈(\\n)을 그대로 표시한다. */\n title: ReactNode;\n /** 제목 아래 설명 — 접근성 설명(aria-describedby)으로 연결된다. */\n description?: ReactNode;\n /** 설명 아래에 덧붙이는 추가 내용(체크박스 등). */\n children?: ReactNode;\n /** 취소 버튼. 누르면 다이얼로그가 닫힌다(onOpenChange(false) 호출). */\n cancelButton?: DialogButtonProps;\n /** 확인 버튼. 자동으로 닫히지 않으니 onClick에서 직접 닫는다. */\n confirmButton?: DialogConfirmButtonProps;\n /**\n * 제목 위에 톤 아이콘(default=성공, warning=경고)을 표시하고 내용을 가운데 정렬한다.\n * @default false\n */\n showIcon?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst iconMap = {\n default: { component: CheckCircleFilledIcon, className: \"aivex:text-icon-success\" },\n warning: { component: WarningTriangleFilledIcon, className: \"aivex:text-icon-warning\" },\n} as const;\n\n/**\n * 사용자에게 확인·취소를 묻는 작은 경고형(alert) 다이얼로그.\n *\n * 제목·설명·버튼 1~2개로 끝나는 확인 질문(저장할까요? 삭제할까요?)에 쓴다. 입력 폼이나\n * 긴 내용이 들어가면 Modal, 화면 안에 머무는 안내 문구는 Messagebox, 잠깐 뜨는 알림은\n * Toast를 쓴다. alertdialog라 바깥 클릭으로 닫히지 않고 Esc·취소 버튼으로만 닫힌다.\n * open/onOpenChange로 제어하거나 defaultOpen으로 비제어로 쓴다. title은 필수다.\n *\n * @example\n * ```tsx\n * import { Button, Dialog } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(false);\n *\n * <Button color=\"danger\" onClick={() => setOpen(true)}>삭제</Button>\n * <Dialog\n * open={open}\n * onOpenChange={setOpen}\n * variant=\"warning\"\n * title=\"프로젝트를 삭제할까요?\"\n * description=\"삭제한 프로젝트는 복구할 수 없습니다.\"\n * cancelButton={{ children: \"취소\" }}\n * confirmButton={{ children: \"삭제\", onClick: () => setOpen(false) }}\n * />\n * ```\n */\nfunction Dialog({\n open,\n defaultOpen,\n onOpenChange,\n variant = \"default\",\n title,\n description,\n children,\n cancelButton,\n confirmButton,\n showIcon = false,\n ref,\n ...props\n}: DialogProps) {\n const autoFocus = useModalAutoFocus();\n const icon = iconMap[variant];\n const IconComponent = showIcon ? icon.component : null;\n const isCenterAligned = Boolean(IconComponent);\n const confirmButtonColor = variant === \"warning\" ? \"danger\" : \"primary\";\n\n return (\n <RadixDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange} {...props}>\n <RadixDialog.Portal>\n <RadixDialog.Overlay asChild>\n <Overlay variant=\"dim\" />\n </RadixDialog.Overlay>\n <RadixDialog.Content\n ref={ref}\n {...autoFocus}\n className=\"aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal) aivex:w-[calc(100vw-32px)] aivex:max-w-[384px] aivex:-translate-x-1/2 aivex:-translate-y-1/2 aivex:outline-none\"\n // 설명이 없는 다이얼로그임을 Radix에 알린다 — 명시하지 않으면 개발 모드에서 매번 경고한다.\n {...(description ? {} : { \"aria-describedby\": undefined })}\n >\n <div className=\"aivex:flex aivex:w-full aivex:flex-col aivex:items-start aivex:gap-2xl aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-2xl aivex:shadow-xl\">\n <div\n className={cn(\n \"aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs aivex:px-md aivex:py-xs\",\n isCenterAligned\n ? \"aivex:items-center aivex:justify-center aivex:text-center\"\n : \"aivex:items-start aivex:text-left\",\n )}\n >\n {IconComponent && (\n <span\n className={cn(\n \"aivex:flex aivex:h-12 aivex:w-12 aivex:shrink-0 aivex:items-center aivex:justify-center aivex:leading-none\",\n icon.className,\n )}\n >\n <IconComponent size={28} />\n </span>\n )}\n <RadixDialog.Title className=\"aivex:m-0 aivex:w-full aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary\">\n {title}\n </RadixDialog.Title>\n {description && (\n <RadixDialog.Description className=\"aivex:m-0 aivex:w-full aivex:whitespace-pre-line aivex:text-body-lg-regular aivex:text-text-secondary\">\n {description}\n </RadixDialog.Description>\n )}\n {children}\n </div>\n\n {(cancelButton || confirmButton) && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-lg\">\n {cancelButton && <DialogCancelButton {...cancelButton} />}\n {confirmButton && (\n <DialogConfirmButton {...confirmButton} defaultColor={confirmButtonColor} />\n )}\n </div>\n )}\n </div>\n </RadixDialog.Content>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n );\n}\n\nfunction DialogCancelButton({ children, onClick, ...props }: DialogButtonProps) {\n return (\n <RadixDialog.Cancel asChild>\n <Button\n variant=\"solid\"\n color=\"secondary\"\n size=\"lg\"\n className=\"aivex:min-w-0 aivex:basis-0 aivex:flex-1\"\n onClick={(event) => {\n void onClick?.(event);\n }}\n {...props}\n >\n {children}\n </Button>\n </RadixDialog.Cancel>\n );\n}\n\nfunction DialogConfirmButton({\n children,\n defaultColor,\n onClick,\n ...props\n}: DialogConfirmButtonInternalProps) {\n return (\n <Button\n variant=\"solid\"\n color={defaultColor}\n size=\"lg\"\n className=\"aivex:min-w-0 aivex:basis-0 aivex:flex-1\"\n onClick={(event) => {\n void onClick?.(event);\n }}\n {...props}\n >\n {children}\n </Button>\n );\n}\n\nexport { Dialog };\n"],"mappings":";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IvB,SAAS,EAAmB,EAAE,aAAU,YAAS,GAAG,KAA4B;AAC9E,QACE,kBAAC,EAAY,QAAb;EAAoB,SAAA;YAClB,kBAAC,GAAD;GACE,SAAQ;GACR,OAAM;GACN,MAAK;GACL,WAAU;GACV,UAAU,MAAU;AACb,QAAU,EAAM;;GAEvB,GAAI;GAEH;GACM,CAAA;EACU,CAAA;;AAIzB,SAAS,EAAoB,EAC3B,aACA,iBACA,YACA,GAAG,KACgC;AACnC,QACE,kBAAC,GAAD;EACE,SAAQ;EACR,OAAO;EACP,MAAK;EACL,WAAU;EACV,UAAU,MAAU;AACb,OAAU,EAAM;;EAEvB,GAAI;EAEH;EACM,CAAA"}
1
+ {"version":3,"file":"Dialog.js","names":[],"sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as RadixDialog from \"@radix-ui/react-alert-dialog\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { Button, type ButtonProps } from \"@/components/Button\";\nimport { CheckCircleFilledIcon, WarningTriangleFilledIcon } from \"@/components/Icon\";\nimport { Overlay } from \"@/components/Overlay\";\nimport { cn } from \"@/utils/cn\";\nimport type { DataAttributes } from \"@/utils/dataAttributes\";\nimport { useModalAutoFocus } from \"@/utils/useModalAutoFocus\";\n\n/**\n * Dialog 톤. default는 확인 버튼이 primary, warning은 확인 버튼이 danger 색이 된다\n * (showIcon이면 아이콘도 성공/경고 아이콘으로 바뀐다).\n */\nexport type DialogVariant = \"default\" | \"warning\";\n/** Dialog 하단 버튼 — Button props에서 색·크기·스타일은 Dialog가 고정하고 라벨은 children으로 받는다. */\nexport interface DialogButtonProps\n extends Omit<\n ButtonProps,\n \"asChild\" | \"children\" | \"className\" | \"color\" | \"ref\" | \"size\" | \"style\" | \"variant\"\n >,\n DataAttributes {\n /** 버튼 라벨 */\n children: ReactNode;\n}\n\n/** 확인 버튼 props. 누른다고 자동으로 닫히지 않으니 onClick에서 open을 false로 바꾼다. */\nexport type DialogConfirmButtonProps = DialogButtonProps;\n\ninterface DialogConfirmButtonInternalProps extends DialogConfirmButtonProps {\n defaultColor: ButtonProps[\"color\"];\n}\n\nexport interface DialogProps\n extends Omit<ComponentPropsWithoutRef<typeof RadixDialog.Root>, \"children\"> {\n /**\n * 톤. warning이면 확인 버튼이 danger 색이 된다(삭제 등 되돌릴 수 없는 동작).\n * @default \"default\"\n */\n variant?: DialogVariant;\n /** 제목(필수) — 다이얼로그의 접근성 이름이 된다. 줄바꿈(\\n)을 그대로 표시한다. */\n title: ReactNode;\n /** 제목 아래 설명 — 접근성 설명(aria-describedby)으로 연결된다. */\n description?: ReactNode;\n /** 설명 아래에 덧붙이는 추가 내용(체크박스 등). */\n children?: ReactNode;\n /** 취소 버튼. 누르면 다이얼로그가 닫힌다(onOpenChange(false) 호출). */\n cancelButton?: DialogButtonProps;\n /** 확인 버튼. 자동으로 닫히지 않으니 onClick에서 직접 닫는다. */\n confirmButton?: DialogConfirmButtonProps;\n /**\n * 제목 위에 톤 아이콘(default=성공, warning=경고)을 표시하고 내용을 가운데 정렬한다.\n * @default false\n */\n showIcon?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst iconMap = {\n default: { component: CheckCircleFilledIcon, className: \"aivex:text-icon-success\" },\n warning: { component: WarningTriangleFilledIcon, className: \"aivex:text-icon-warning\" },\n} as const;\n\n/**\n * 사용자에게 확인·취소를 묻는 작은 경고형(alert) 다이얼로그.\n *\n * 제목·설명·버튼 1~2개로 끝나는 확인 질문(저장할까요? 삭제할까요?)에 쓴다. 입력 폼이나\n * 긴 내용이 들어가면 Modal, 화면 안에 머무는 안내 문구는 Messagebox, 잠깐 뜨는 알림은\n * Toast를 쓴다. alertdialog라 바깥 클릭으로 닫히지 않고 Esc·취소 버튼으로만 닫힌다.\n * open/onOpenChange로 제어하거나 defaultOpen으로 비제어로 쓴다. title은 필수다.\n *\n * @example\n * ```tsx\n * import { Button, Dialog } from \"@aivex/ui\";\n *\n * const [open, setOpen] = useState(false);\n *\n * <Button color=\"danger\" onClick={() => setOpen(true)}>삭제</Button>\n * <Dialog\n * open={open}\n * onOpenChange={setOpen}\n * variant=\"warning\"\n * title=\"프로젝트를 삭제할까요?\"\n * description=\"삭제한 프로젝트는 복구할 수 없습니다.\"\n * cancelButton={{ children: \"취소\" }}\n * confirmButton={{ children: \"삭제\", onClick: () => setOpen(false) }}\n * />\n * ```\n */\nfunction Dialog({\n open,\n defaultOpen,\n onOpenChange,\n variant = \"default\",\n title,\n description,\n children,\n cancelButton,\n confirmButton,\n showIcon = false,\n ref,\n ...props\n}: DialogProps) {\n const autoFocus = useModalAutoFocus();\n const icon = iconMap[variant];\n const IconComponent = showIcon ? icon.component : null;\n const isCenterAligned = Boolean(IconComponent);\n const confirmButtonColor = variant === \"warning\" ? \"danger\" : \"primary\";\n\n return (\n <RadixDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange} {...props}>\n <RadixDialog.Portal>\n <RadixDialog.Overlay asChild>\n <Overlay variant=\"dim\" />\n </RadixDialog.Overlay>\n <RadixDialog.Content\n ref={ref}\n {...autoFocus}\n className=\"aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal) aivex:w-[calc(100vw-32px)] aivex:max-w-[384px] aivex:-translate-x-1/2 aivex:-translate-y-1/2 aivex:outline-none\"\n // 설명이 없는 다이얼로그임을 Radix에 알린다 — 명시하지 않으면 개발 모드에서 매번 경고한다.\n {...(description ? {} : { \"aria-describedby\": undefined })}\n >\n <div className=\"aivex:flex aivex:w-full aivex:flex-col aivex:items-start aivex:gap-2xl aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-2xl aivex:shadow-xl\">\n <div\n className={cn(\n \"aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs aivex:px-md aivex:py-xs\",\n isCenterAligned\n ? \"aivex:items-center aivex:justify-center aivex:text-center\"\n : \"aivex:items-start aivex:text-left\",\n )}\n >\n {IconComponent && (\n <span\n className={cn(\n \"aivex:flex aivex:h-12 aivex:w-12 aivex:shrink-0 aivex:items-center aivex:justify-center aivex:leading-none\",\n icon.className,\n )}\n >\n <IconComponent size={28} />\n </span>\n )}\n <RadixDialog.Title className=\"aivex:m-0 aivex:w-full aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary\">\n {title}\n </RadixDialog.Title>\n {description && (\n <RadixDialog.Description className=\"aivex:m-0 aivex:w-full aivex:whitespace-pre-line aivex:text-body-lg-regular aivex:text-text-secondary\">\n {description}\n </RadixDialog.Description>\n )}\n {children}\n </div>\n\n {(cancelButton || confirmButton) && (\n <div className=\"aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-lg\">\n {cancelButton && <DialogCancelButton {...cancelButton} />}\n {confirmButton && (\n <DialogConfirmButton {...confirmButton} defaultColor={confirmButtonColor} />\n )}\n </div>\n )}\n </div>\n </RadixDialog.Content>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n );\n}\n\nfunction DialogCancelButton({ children, onClick, ...props }: DialogButtonProps) {\n return (\n <RadixDialog.Cancel asChild>\n <Button\n variant=\"solid\"\n color=\"secondary\"\n size=\"lg\"\n className=\"aivex:min-w-0 aivex:basis-0 aivex:flex-1\"\n onClick={(event) => {\n void onClick?.(event);\n }}\n {...props}\n >\n {children}\n </Button>\n </RadixDialog.Cancel>\n );\n}\n\nfunction DialogConfirmButton({\n children,\n defaultColor,\n onClick,\n ...props\n}: DialogConfirmButtonInternalProps) {\n return (\n <Button\n variant=\"solid\"\n color={defaultColor}\n size=\"lg\"\n className=\"aivex:min-w-0 aivex:basis-0 aivex:flex-1\"\n onClick={(event) => {\n void onClick?.(event);\n }}\n {...props}\n >\n {children}\n </Button>\n );\n}\n\nexport { Dialog };\n"],"mappings":";;;;;;;;;AAyDA,IAAM,IAAU;CACd,SAAS;EAAE,WAAW;EAAuB,WAAW;EAA2B;CACnF,SAAS;EAAE,WAAW;EAA2B,WAAW;EAA2B;CACxF;AA4BD,SAAS,EAAO,EACd,S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