@aivex/ui 1.2.0-dev.35 → 1.2.0-dev.36

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 (51) hide show
  1. package/README.md +68 -0
  2. package/dist/{Button-DLfTdKpW.js → Button-CuvXiYtX.js} +1381 -1436
  3. package/dist/Button-CuvXiYtX.js.map +1 -0
  4. package/dist/Button-DXf0LWOC.cjs +2 -0
  5. package/dist/Button-DXf0LWOC.cjs.map +1 -0
  6. package/dist/IconButton-CrrS0BMg.cjs +2 -0
  7. package/dist/{IconButton-CfbfwHu2.cjs.map → IconButton-CrrS0BMg.cjs.map} +1 -1
  8. package/dist/{IconButton-CQG1Pw51.js → IconButton-DusjiWye.js} +14 -13
  9. package/dist/{IconButton-CQG1Pw51.js.map → IconButton-DusjiWye.js.map} +1 -1
  10. package/dist/comment.cjs +1 -1
  11. package/dist/comment.cjs.map +1 -1
  12. package/dist/comment.js +51 -41
  13. package/dist/comment.js.map +1 -1
  14. package/dist/components/Calendar/Calendar.d.ts +13 -2
  15. package/dist/components/Calendar/Calendar.test.d.ts +1 -0
  16. package/dist/components/Calendar/date.d.ts +2 -2
  17. package/dist/components/Calendar/date.test.d.ts +1 -0
  18. package/dist/components/Calendar/index.d.ts +1 -1
  19. package/dist/components/Drawer/Drawer.d.ts +2 -1
  20. package/dist/components/ShapeEditor/_components/SettingsPanel.d.ts +1 -2
  21. package/dist/components/ShapeEditor/_model/strings.d.ts +1 -0
  22. package/dist/components/ShapeEditor/_state/useEditorHotkeys.d.ts +2 -2
  23. package/dist/components/ShapeEditor/_state/useSelectionActions.d.ts +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +1351 -1389
  28. package/dist/index.js.map +1 -1
  29. package/dist/keyboard-9B-R6uN0.cjs +2 -0
  30. package/dist/keyboard-9B-R6uN0.cjs.map +1 -0
  31. package/dist/{Switch-D7Dzld4x.js → keyboard-DUqwZll5.js} +178 -105
  32. package/dist/keyboard-DUqwZll5.js.map +1 -0
  33. package/dist/shape-editor.cjs +1 -1
  34. package/dist/shape-editor.cjs.map +1 -1
  35. package/dist/shape-editor.js +1180 -1190
  36. package/dist/shape-editor.js.map +1 -1
  37. package/dist/styles.css +1 -1
  38. package/dist/utils/keyboard.d.ts +3 -0
  39. package/dist/utils/useModalAutoFocus.d.ts +5 -0
  40. package/dist/utils.cjs +2 -0
  41. package/dist/utils.cjs.map +1 -0
  42. package/dist/utils.js +59 -0
  43. package/dist/utils.js.map +1 -0
  44. package/package.json +20 -22
  45. package/dist/Button-BcJuLWuX.cjs +0 -2
  46. package/dist/Button-BcJuLWuX.cjs.map +0 -1
  47. package/dist/Button-DLfTdKpW.js.map +0 -1
  48. package/dist/IconButton-CfbfwHu2.cjs +0 -2
  49. package/dist/Switch-BTWZAzgl.cjs +0 -2
  50. package/dist/Switch-BTWZAzgl.cjs.map +0 -1
  51. package/dist/Switch-D7Dzld4x.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ const e=require(`./Button-DXf0LWOC.cjs`),t=require(`./utils.cjs`);let n=require(`@radix-ui/react-avatar`);n=e.pa(n,1);let r=require(`class-variance-authority`),i=require(`@radix-ui/react-tooltip`);i=e.pa(i,1);let a=require(`react/jsx-runtime`),o=require(`@radix-ui/react-slot`);var s=(0,r.cva)(`aivex:z-50 aivex:max-w-[720px] aivex:rounded-sm aivex:bg-static-gray aivex:px-md aivex:py-xs aivex:text-body-md-regular aivex:text-text-on-color aivex:whitespace-pre-wrap aivex:break-words aivex:pointer-events-none aivex:shadow-md aivex:select-none`,{variants:{placement:{top:``,bottom:``,left:``,right:``}},defaultVariants:{placement:`top`}}),c=(0,r.cva)(`aivex:fill-static-gray`,{variants:{placement:{top:``,bottom:``,left:``,right:``}},defaultVariants:{placement:`top`}});function l({content:e,children:n,placement:r=`top`,disabled:o=!1,ref:l}){let u=r??`top`;return o?(0,a.jsx)(a.Fragment,{children:n}):(0,a.jsx)(i.Provider,{delayDuration:0,children:(0,a.jsxs)(i.Root,{children:[(0,a.jsx)(i.Trigger,{asChild:!0,children:(0,a.jsx)(`span`,{ref:l,className:`aivex:inline-flex`,children:n})}),(0,a.jsx)(i.Portal,{children:(0,a.jsxs)(i.Content,{side:u,sideOffset:8,className:t.cn(s({placement:u})),children:[e,(0,a.jsx)(i.Arrow,{width:8,height:4,className:t.cn(c({placement:u}))})]})})]})})}var u=(0,r.cva)(`aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:overflow-hidden aivex:select-none aivex:leading-none aivex:text-text-primary`,{variants:{size:{xxs:`aivex:w-4 aivex:h-4 aivex:text-label-sm`,xs:`aivex:w-5 aivex:h-5 aivex:text-label-md`,sm:`aivex:w-6 aivex:h-6 aivex:text-label-md`,md:`aivex:w-8 aivex:h-8 aivex:text-label-lg`,lg:`aivex:w-9 aivex:h-9 aivex:text-label-xl`,xl:`aivex:w-12 aivex:h-12 aivex:text-label-xl`,"2xl":`aivex:w-14 aivex:h-14 aivex:text-label-xl`},type:{round:`aivex:rounded-full aivex:bg-category-indigo-bg`,square:`aivex:bg-category-indigo-bg`,image:`aivex:rounded-full aivex:border aivex:border-border-subtle aivex:bg-bg-secondary`}},compoundVariants:[{type:`square`,size:[`xxs`,`xs`,`sm`],className:`aivex:rounded-xs`},{type:`square`,size:[`md`,`lg`],className:`aivex:rounded-sm`},{type:`square`,size:[`xl`,`2xl`],className:`aivex:rounded-md`}],defaultVariants:{size:`md`,type:`round`}}),d=[`aivex:bg-category-blue-bg aivex:text-category-blue-text`,`aivex:bg-category-green-bg aivex:text-category-green-text`,`aivex:bg-category-orange-bg aivex:text-category-orange-text`,`aivex:bg-category-violet-bg aivex:text-category-violet-text`,`aivex:bg-category-teal-bg aivex:text-category-teal-text`,`aivex:bg-category-pink-bg aivex:text-category-pink-text`,`aivex:bg-category-cyan-bg aivex:text-category-cyan-text`,`aivex:bg-category-red-bg aivex:text-category-red-text`,`aivex:bg-category-lime-bg aivex:text-category-lime-text`,`aivex:bg-category-yellow-bg aivex:text-category-yellow-text`,`aivex:bg-category-indigo-bg aivex:text-category-indigo-text`];function f(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return d[t%d.length]}function p({initials:e,name:t,icon:n}){return(e??t?.trim().slice(0,1).toUpperCase())||(n??null)}function m({className:e,size:r,type:i,src:o,alt:s,initials:c,icon:d,name:m,bgColor:h,showTooltip:g,delayMs:_=600,style:v,ref:y,...b}){let x=p({initials:c,name:m,icon:d}),S=m??c,C=!o&&!h&&S?f(S):void 0,w=(0,a.jsxs)(n.Root,{ref:y,className:t.cn(u({size:r,type:i}),C,e),style:h?{backgroundColor:h,...v}:v,...b,children:[o&&(0,a.jsx)(n.Image,{src:o,alt:s??`avatar`,className:`aivex:w-full aivex:h-full aivex:object-cover`}),(0,a.jsx)(n.Fallback,{delayMs:o?_:0,className:`aivex:inline-flex aivex:h-full aivex:w-full aivex:items-center aivex:justify-center aivex:leading-none`,children:x})]});return g&&m?(0,a.jsx)(l,{content:m,children:w}):w}var h=(0,r.cva)(`aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand`,{variants:{size:{xs:`aivex:size-xl aivex:rounded-xs`,sm:`aivex:size-2xl aivex:rounded-xs`,md:`aivex:size-3xl aivex:rounded-sm`},shape:{rectangle:``,rounded:`aivex:rounded-full`}},defaultVariants:{size:`sm`,shape:`rectangle`}}),g={xs:`aivex:size-xl`,sm:`aivex:size-2xl`,md:`aivex:size-3xl`},_={xs:`aivex:-inset-2xs`,sm:`aivex:-inset-xs`,md:`aivex:-inset-xs`},v={xs:{rectangle:`aivex:rounded-xs`,rounded:`aivex:rounded-full`},sm:{rectangle:`aivex:rounded-sm`,rounded:`aivex:rounded-full`},md:{rectangle:`aivex:rounded-md`,rounded:`aivex:rounded-full`}};function y({className:n,size:r=`sm`,shape:i=`rectangle`,color:s=`primary`,error:c=!1,asChild:l=!1,children:u,ref:d,...f}){let p=l?o.Slot:`button`,m=c?`aivex:text-icon-danger`:s===`white`?`aivex:text-static-white`:`aivex:text-icon-primary`,y=c?`danger`:s===`white`?`white`:`default`,b=r??`sm`,x=i??`rectangle`;return(0,a.jsxs)(p,{ref:d,type:l?void 0:`button`,className:t.cn(h({size:r,shape:i}),m,n),...f,children:[(0,a.jsx)(e.fa,{variant:y,fill:!1,interactive:!0,className:t.cn(_[b],v[b][x])}),(0,a.jsx)(`span`,{className:t.cn(`aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0`,g[b]),children:u})]})}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});
2
+ //# sourceMappingURL=IconButton-CrrS0BMg.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton-CfbfwHu2.cjs","names":[],"sources":["../src/components/Tooltip/Tooltip.tsx","../src/components/Avatar/Avatar.tsx","../src/components/IconButton/IconButton.tsx"],"sourcesContent":["\"use client\";\n\nimport * as RadixTooltip from \"@radix-ui/react-tooltip\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ReactNode, Ref } from \"react\";\nimport { cn } from \"@/utils/cn\";\n\nconst tooltipContentVariants = cva(\n \"aivex:z-50 aivex:max-w-[720px] aivex:rounded-sm aivex:bg-static-gray aivex:px-md aivex:py-xs aivex:text-body-md-regular aivex:text-text-on-color aivex:whitespace-pre-wrap aivex:break-words aivex:pointer-events-none aivex:shadow-md aivex:select-none\",\n {\n variants: {\n placement: {\n top: \"\",\n bottom: \"\",\n left: \"\",\n right: \"\",\n },\n },\n defaultVariants: {\n placement: \"top\",\n },\n },\n);\n\nconst arrowVariants = cva(\"aivex:fill-static-gray\", {\n variants: {\n placement: {\n top: \"\",\n bottom: \"\",\n left: \"\",\n right: \"\",\n },\n },\n defaultVariants: {\n placement: \"top\",\n },\n});\n\ntype TooltipPlacement = NonNullable<VariantProps<typeof tooltipContentVariants>[\"placement\"]>;\n\nexport interface TooltipProps extends VariantProps<typeof tooltipContentVariants> {\n content: ReactNode;\n children: ReactNode;\n disabled?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction Tooltip({ content, children, placement = \"top\", disabled = false, ref }: TooltipProps) {\n const resolvedPlacement: TooltipPlacement = placement ?? \"top\";\n\n if (disabled) {\n return <>{children}</>;\n }\n\n return (\n <RadixTooltip.Provider delayDuration={0}>\n <RadixTooltip.Root>\n <RadixTooltip.Trigger asChild>\n <span ref={ref} className=\"aivex:inline-flex\">\n {children}\n </span>\n </RadixTooltip.Trigger>\n <RadixTooltip.Portal>\n <RadixTooltip.Content\n side={resolvedPlacement}\n sideOffset={8}\n className={cn(tooltipContentVariants({ placement: resolvedPlacement }))}\n >\n {content}\n <RadixTooltip.Arrow\n width={8}\n height={4}\n className={cn(arrowVariants({ placement: resolvedPlacement }))}\n />\n </RadixTooltip.Content>\n </RadixTooltip.Portal>\n </RadixTooltip.Root>\n </RadixTooltip.Provider>\n );\n}\n\nexport { Tooltip, tooltipContentVariants };\n","import * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { HTMLAttributes, ReactNode, Ref } from \"react\";\nimport { Tooltip } from \"@/components/Tooltip\";\nimport { cn } from \"@/utils/cn\";\n\nconst avatarVariants = cva(\n \"aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:overflow-hidden aivex:select-none aivex:leading-none aivex:text-text-primary\",\n {\n variants: {\n size: {\n xxs: \"aivex:w-4 aivex:h-4 aivex:text-label-sm\",\n xs: \"aivex:w-5 aivex:h-5 aivex:text-label-md\",\n sm: \"aivex:w-6 aivex:h-6 aivex:text-label-md\",\n md: \"aivex:w-8 aivex:h-8 aivex:text-label-lg\",\n lg: \"aivex:w-9 aivex:h-9 aivex:text-label-xl\",\n xl: \"aivex:w-12 aivex:h-12 aivex:text-label-xl\",\n \"2xl\": \"aivex:w-14 aivex:h-14 aivex:text-label-xl\",\n },\n type: {\n round: \"aivex:rounded-full aivex:bg-category-indigo-bg\",\n square: \"aivex:bg-category-indigo-bg\",\n image: \"aivex:rounded-full aivex:border aivex:border-border-subtle aivex:bg-bg-secondary\",\n },\n },\n // Square shape: size-scaled radius per Figma\n compoundVariants: [\n { type: \"square\", size: [\"xxs\", \"xs\", \"sm\"], className: \"aivex:rounded-xs\" },\n { type: \"square\", size: [\"md\", \"lg\"], className: \"aivex:rounded-sm\" },\n { type: \"square\", size: [\"xl\", \"2xl\"], className: \"aivex:rounded-md\" },\n ],\n defaultVariants: { size: \"md\", type: \"round\" },\n },\n);\n\nexport interface AvatarProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"children\">,\n VariantProps<typeof avatarVariants> {\n src?: string;\n alt?: string;\n initials?: string;\n icon?: ReactNode;\n name?: string;\n bgColor?: string;\n showTooltip?: boolean;\n /** Fallback render delay in ms (only applies when `src` is provided). Default: 600ms. */\n delayMs?: number;\n ref?: Ref<HTMLSpanElement>;\n}\n\n/** name(또는 initials) 기반으로 결정적 색을 고르기 위한 카테고리 팔레트 */\nconst avatarColorClasses = [\n \"aivex:bg-category-blue-bg aivex:text-category-blue-text\",\n \"aivex:bg-category-green-bg aivex:text-category-green-text\",\n \"aivex:bg-category-orange-bg aivex:text-category-orange-text\",\n \"aivex:bg-category-violet-bg aivex:text-category-violet-text\",\n \"aivex:bg-category-teal-bg aivex:text-category-teal-text\",\n \"aivex:bg-category-pink-bg aivex:text-category-pink-text\",\n \"aivex:bg-category-cyan-bg aivex:text-category-cyan-text\",\n \"aivex:bg-category-red-bg aivex:text-category-red-text\",\n \"aivex:bg-category-lime-bg aivex:text-category-lime-text\",\n \"aivex:bg-category-yellow-bg aivex:text-category-yellow-text\",\n \"aivex:bg-category-indigo-bg aivex:text-category-indigo-text\",\n] as const;\n\nfunction pickColorClass(key: string): string {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash * 31 + key.charCodeAt(i)) >>> 0;\n }\n return avatarColorClasses[hash % avatarColorClasses.length];\n}\n\nfunction resolveFallback({\n initials,\n name,\n icon,\n}: Pick<AvatarProps, \"initials\" | \"name\" | \"icon\">): ReactNode {\n const text = initials ?? name?.trim().slice(0, 1).toUpperCase();\n if (text) return text;\n return icon ?? null;\n}\n\nfunction Avatar({\n className,\n size,\n type,\n src,\n alt,\n initials,\n icon,\n name,\n bgColor,\n showTooltip,\n delayMs = 600,\n style,\n ref,\n ...props\n}: AvatarProps) {\n const fallback = resolveFallback({ initials, name, icon });\n // src/bgColor가 없으면 name(없으면 initials) 기준으로 카테고리 색을 자동 배정한다.\n const colorSeed = name ?? initials;\n const autoColorClass = !src && !bgColor && colorSeed ? pickColorClass(colorSeed) : undefined;\n\n const avatar = (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(avatarVariants({ size, type }), autoColorClass, className)}\n style={bgColor ? { backgroundColor: bgColor, ...style } : style}\n {...props}\n >\n {src && (\n <AvatarPrimitive.Image\n src={src}\n alt={alt ?? \"avatar\"}\n className=\"aivex:w-full aivex:h-full aivex:object-cover\"\n />\n )}\n <AvatarPrimitive.Fallback\n delayMs={src ? delayMs : 0}\n className=\"aivex:inline-flex aivex:h-full aivex:w-full aivex:items-center aivex:justify-center aivex:leading-none\"\n >\n {fallback}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n );\n\n return showTooltip && name ? <Tooltip content={name}>{avatar}</Tooltip> : avatar;\n}\n\nexport { Avatar, avatarVariants };\n","import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { InteractionLayer } from \"@/components/InteractionLayer\";\nimport { cn } from \"@/utils/cn\";\n\nconst iconButtonVariants = cva(\n \"aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand\",\n {\n variants: {\n size: {\n xs: \"aivex:size-xl aivex:rounded-xs\",\n sm: \"aivex:size-2xl aivex:rounded-xs\",\n md: \"aivex:size-3xl aivex:rounded-sm\",\n },\n shape: {\n rectangle: \"\",\n rounded: \"aivex:rounded-full\",\n },\n },\n defaultVariants: {\n size: \"sm\",\n shape: \"rectangle\",\n },\n },\n);\n\ntype IconButtonSize = \"xs\" | \"sm\" | \"md\";\ntype IconButtonShape = \"rectangle\" | \"rounded\";\n\nconst iconSizeClass: Record<IconButtonSize, string> = {\n xs: \"aivex:size-xl\",\n sm: \"aivex:size-2xl\",\n md: \"aivex:size-3xl\",\n};\n\nconst interactionInsetClass: Record<IconButtonSize, string> = {\n xs: \"aivex:-inset-2xs\",\n sm: \"aivex:-inset-xs\",\n md: \"aivex:-inset-xs\",\n};\n\nconst interactionRadiusClass: Record<IconButtonSize, Record<IconButtonShape, string>> = {\n xs: {\n rectangle: \"aivex:rounded-xs\",\n rounded: \"aivex:rounded-full\",\n },\n sm: {\n rectangle: \"aivex:rounded-sm\",\n rounded: \"aivex:rounded-full\",\n },\n md: {\n rectangle: \"aivex:rounded-md\",\n rounded: \"aivex:rounded-full\",\n },\n};\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\">,\n VariantProps<typeof iconButtonVariants> {\n /** 아이콘 색상 — primary: 기본(어두운) 배경, white: 어두운 배경 위 */\n color?: \"primary\" | \"white\";\n /** true 이면 danger 색상 적용 (color 보다 우선) */\n error?: boolean;\n asChild?: boolean;\n children?: ReactNode;\n ref?: Ref<HTMLButtonElement>;\n}\n\nfunction IconButton({\n className,\n size = \"sm\",\n shape = \"rectangle\",\n color = \"primary\",\n error = false,\n asChild = false,\n children,\n ref,\n ...props\n}: IconButtonProps) {\n const Comp = asChild ? Slot : \"button\";\n\n const iconColor = error\n ? \"aivex:text-icon-danger\"\n : color === \"white\"\n ? \"aivex:text-static-white\"\n : \"aivex:text-icon-primary\";\n\n const interactionVariant = error ? \"danger\" : color === \"white\" ? \"white\" : \"default\";\n const iconButtonSize = size ?? \"sm\";\n const iconButtonShape = shape ?? \"rectangle\";\n\n return (\n <Comp\n ref={ref}\n type={asChild ? undefined : \"button\"}\n className={cn(iconButtonVariants({ size, shape }), iconColor, className)}\n {...props}\n >\n <InteractionLayer\n variant={interactionVariant}\n fill={false}\n interactive\n className={cn(\n interactionInsetClass[iconButtonSize],\n interactionRadiusClass[iconButtonSize][iconButtonShape],\n )}\n />\n <span\n className={cn(\n \"aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0\",\n iconSizeClass[iconButtonSize],\n )}\n >\n {children}\n </span>\n </Comp>\n );\n}\n\nexport { IconButton, iconButtonVariants };\n"],"mappings":"6PAOA,IAAM,GAAA,EAAA,EAAA,KACJ,2PACA,CACE,SAAU,CACR,UAAW,CACT,IAAK,GACL,OAAQ,GACR,KAAM,GACN,MAAO,GACR,CACF,CACD,gBAAiB,CACf,UAAW,MACZ,CACF,CACF,CAEK,GAAA,EAAA,EAAA,KAAoB,yBAA0B,CAClD,SAAU,CACR,UAAW,CACT,IAAK,GACL,OAAQ,GACR,KAAM,GACN,MAAO,GACR,CACF,CACD,gBAAiB,CACf,UAAW,MACZ,CACF,CAAC,CAWF,SAAS,EAAQ,CAAE,UAAS,WAAU,YAAY,MAAO,WAAW,GAAO,OAAqB,CAC9F,IAAM,EAAsC,GAAa,MAMzD,OAJI,GACK,EAAA,EAAA,KAAA,EAAA,SAAA,CA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AEK,EAAwD,CAC5D,GAAI,mBACJ,GAAI,kBACJ,GAAI,kBACL,CAEK,EAAkF,CACtF,GAAI,CACF,UAAW,mBACX,QAAS,qBACV,CACD,GAAI,CACF,UAAW,mBACX,QAAS,qBACV,CACD,GAAI,CACF,UAAW,mBACX,QAAS,qBACV,CACF,CAcD,SAAS,EAAW,CAClB,YACA,OAAO,KACP,QAAQ,YACR,QAAQ,UACR,QAAQ,GACR,UAAU,GACV,WACA,MACA,GAAG,GACe,CAClB,IAAM,EAAO,EAAU,EAAA,KAAO,SAExB,EAAY,EACd,yBACA,IAAU,QACR,0BACA,0BAEA,EAAqB,EAAQ,SAAW,IAAU,QAAU,QAAU,UACtE,EAAiB,GAAQ,KACzB,EAAkB,GAAS,YAEjC,OACE,EAAA,EAAA,MAAC,EAAD,CACO,MACL,KAAM,EAAU,IAAA,GAAY,SAC5B,UAAW,EAAA,GAAG,EAAmB,CAAE,OAAM,QAAO,CAAC,CAAE,EAAW,EAAU,CACxE,GAAI,WAJN,EAME,EAAA,EAAA,KAAC,EAAA,GAAD,CACE,QAAS,EACT,KAAM,GACN,YAAA,GACA,UAAW,EAAA,GACT,EAAsB,GACtB,EAAuB,GAAgB,GACxC,CACD,CAAA,EACF,EAAA,EAAA,KAAC,OAAD,CACE,UAAW,EAAA,GACT,oEACA,EAAc,GACf,CAEA,WACI,CAAA,CACF"}
1
+ {"version":3,"file":"IconButton-CrrS0BMg.cjs","names":[],"sources":["../src/components/Tooltip/Tooltip.tsx","../src/components/Avatar/Avatar.tsx","../src/components/IconButton/IconButton.tsx"],"sourcesContent":["\"use client\";\n\nimport * as RadixTooltip from \"@radix-ui/react-tooltip\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ReactNode, Ref } from \"react\";\nimport { cn } from \"@/utils/cn\";\n\nconst tooltipContentVariants = cva(\n \"aivex:z-50 aivex:max-w-[720px] aivex:rounded-sm aivex:bg-static-gray aivex:px-md aivex:py-xs aivex:text-body-md-regular aivex:text-text-on-color aivex:whitespace-pre-wrap aivex:break-words aivex:pointer-events-none aivex:shadow-md aivex:select-none\",\n {\n variants: {\n placement: {\n top: \"\",\n bottom: \"\",\n left: \"\",\n right: \"\",\n },\n },\n defaultVariants: {\n placement: \"top\",\n },\n },\n);\n\nconst arrowVariants = cva(\"aivex:fill-static-gray\", {\n variants: {\n placement: {\n top: \"\",\n bottom: \"\",\n left: \"\",\n right: \"\",\n },\n },\n defaultVariants: {\n placement: \"top\",\n },\n});\n\ntype TooltipPlacement = NonNullable<VariantProps<typeof tooltipContentVariants>[\"placement\"]>;\n\nexport interface TooltipProps extends VariantProps<typeof tooltipContentVariants> {\n content: ReactNode;\n children: ReactNode;\n disabled?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction Tooltip({ content, children, placement = \"top\", disabled = false, ref }: TooltipProps) {\n const resolvedPlacement: TooltipPlacement = placement ?? \"top\";\n\n if (disabled) {\n return <>{children}</>;\n }\n\n return (\n <RadixTooltip.Provider delayDuration={0}>\n <RadixTooltip.Root>\n <RadixTooltip.Trigger asChild>\n <span ref={ref} className=\"aivex:inline-flex\">\n {children}\n </span>\n </RadixTooltip.Trigger>\n <RadixTooltip.Portal>\n <RadixTooltip.Content\n side={resolvedPlacement}\n sideOffset={8}\n className={cn(tooltipContentVariants({ placement: resolvedPlacement }))}\n >\n {content}\n <RadixTooltip.Arrow\n width={8}\n height={4}\n className={cn(arrowVariants({ placement: resolvedPlacement }))}\n />\n </RadixTooltip.Content>\n </RadixTooltip.Portal>\n </RadixTooltip.Root>\n </RadixTooltip.Provider>\n );\n}\n\nexport { Tooltip, tooltipContentVariants };\n","import * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { HTMLAttributes, ReactNode, Ref } from \"react\";\nimport { Tooltip } from \"@/components/Tooltip\";\nimport { cn } from \"@/utils/cn\";\n\nconst avatarVariants = cva(\n \"aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:overflow-hidden aivex:select-none aivex:leading-none aivex:text-text-primary\",\n {\n variants: {\n size: {\n xxs: \"aivex:w-4 aivex:h-4 aivex:text-label-sm\",\n xs: \"aivex:w-5 aivex:h-5 aivex:text-label-md\",\n sm: \"aivex:w-6 aivex:h-6 aivex:text-label-md\",\n md: \"aivex:w-8 aivex:h-8 aivex:text-label-lg\",\n lg: \"aivex:w-9 aivex:h-9 aivex:text-label-xl\",\n xl: \"aivex:w-12 aivex:h-12 aivex:text-label-xl\",\n \"2xl\": \"aivex:w-14 aivex:h-14 aivex:text-label-xl\",\n },\n type: {\n round: \"aivex:rounded-full aivex:bg-category-indigo-bg\",\n square: \"aivex:bg-category-indigo-bg\",\n image: \"aivex:rounded-full aivex:border aivex:border-border-subtle aivex:bg-bg-secondary\",\n },\n },\n // Square shape: size-scaled radius per Figma\n compoundVariants: [\n { type: \"square\", size: [\"xxs\", \"xs\", \"sm\"], className: \"aivex:rounded-xs\" },\n { type: \"square\", size: [\"md\", \"lg\"], className: \"aivex:rounded-sm\" },\n { type: \"square\", size: [\"xl\", \"2xl\"], className: \"aivex:rounded-md\" },\n ],\n defaultVariants: { size: \"md\", type: \"round\" },\n },\n);\n\nexport interface AvatarProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"children\">,\n VariantProps<typeof avatarVariants> {\n src?: string;\n alt?: string;\n initials?: string;\n icon?: ReactNode;\n name?: string;\n bgColor?: string;\n showTooltip?: boolean;\n /** Fallback render delay in ms (only applies when `src` is provided). Default: 600ms. */\n delayMs?: number;\n ref?: Ref<HTMLSpanElement>;\n}\n\n/** name(또는 initials) 기반으로 결정적 색을 고르기 위한 카테고리 팔레트 */\nconst avatarColorClasses = [\n \"aivex:bg-category-blue-bg aivex:text-category-blue-text\",\n \"aivex:bg-category-green-bg aivex:text-category-green-text\",\n \"aivex:bg-category-orange-bg aivex:text-category-orange-text\",\n \"aivex:bg-category-violet-bg aivex:text-category-violet-text\",\n \"aivex:bg-category-teal-bg aivex:text-category-teal-text\",\n \"aivex:bg-category-pink-bg aivex:text-category-pink-text\",\n \"aivex:bg-category-cyan-bg aivex:text-category-cyan-text\",\n \"aivex:bg-category-red-bg aivex:text-category-red-text\",\n \"aivex:bg-category-lime-bg aivex:text-category-lime-text\",\n \"aivex:bg-category-yellow-bg aivex:text-category-yellow-text\",\n \"aivex:bg-category-indigo-bg aivex:text-category-indigo-text\",\n] as const;\n\nfunction pickColorClass(key: string): string {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash * 31 + key.charCodeAt(i)) >>> 0;\n }\n return avatarColorClasses[hash % avatarColorClasses.length];\n}\n\nfunction resolveFallback({\n initials,\n name,\n icon,\n}: Pick<AvatarProps, \"initials\" | \"name\" | \"icon\">): ReactNode {\n const text = initials ?? name?.trim().slice(0, 1).toUpperCase();\n if (text) return text;\n return icon ?? null;\n}\n\nfunction Avatar({\n className,\n size,\n type,\n src,\n alt,\n initials,\n icon,\n name,\n bgColor,\n showTooltip,\n delayMs = 600,\n style,\n ref,\n ...props\n}: AvatarProps) {\n const fallback = resolveFallback({ initials, name, icon });\n // src/bgColor가 없으면 name(없으면 initials) 기준으로 카테고리 색을 자동 배정한다.\n const colorSeed = name ?? initials;\n const autoColorClass = !src && !bgColor && colorSeed ? pickColorClass(colorSeed) : undefined;\n\n const avatar = (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(avatarVariants({ size, type }), autoColorClass, className)}\n style={bgColor ? { backgroundColor: bgColor, ...style } : style}\n {...props}\n >\n {src && (\n <AvatarPrimitive.Image\n src={src}\n alt={alt ?? \"avatar\"}\n className=\"aivex:w-full aivex:h-full aivex:object-cover\"\n />\n )}\n <AvatarPrimitive.Fallback\n delayMs={src ? delayMs : 0}\n className=\"aivex:inline-flex aivex:h-full aivex:w-full aivex:items-center aivex:justify-center aivex:leading-none\"\n >\n {fallback}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n );\n\n return showTooltip && name ? <Tooltip content={name}>{avatar}</Tooltip> : avatar;\n}\n\nexport { Avatar, avatarVariants };\n","import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { InteractionLayer } from \"@/components/InteractionLayer\";\nimport { cn } from \"@/utils/cn\";\n\nconst iconButtonVariants = cva(\n \"aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand\",\n {\n variants: {\n size: {\n xs: \"aivex:size-xl aivex:rounded-xs\",\n sm: \"aivex:size-2xl aivex:rounded-xs\",\n md: \"aivex:size-3xl aivex:rounded-sm\",\n },\n shape: {\n rectangle: \"\",\n rounded: \"aivex:rounded-full\",\n },\n },\n defaultVariants: {\n size: \"sm\",\n shape: \"rectangle\",\n },\n },\n);\n\ntype IconButtonSize = \"xs\" | \"sm\" | \"md\";\ntype IconButtonShape = \"rectangle\" | \"rounded\";\n\nconst iconSizeClass: Record<IconButtonSize, string> = {\n xs: \"aivex:size-xl\",\n sm: \"aivex:size-2xl\",\n md: \"aivex:size-3xl\",\n};\n\nconst interactionInsetClass: Record<IconButtonSize, string> = {\n xs: \"aivex:-inset-2xs\",\n sm: \"aivex:-inset-xs\",\n md: \"aivex:-inset-xs\",\n};\n\nconst interactionRadiusClass: Record<IconButtonSize, Record<IconButtonShape, string>> = {\n xs: {\n rectangle: \"aivex:rounded-xs\",\n rounded: \"aivex:rounded-full\",\n },\n sm: {\n rectangle: \"aivex:rounded-sm\",\n rounded: \"aivex:rounded-full\",\n },\n md: {\n rectangle: \"aivex:rounded-md\",\n rounded: \"aivex:rounded-full\",\n },\n};\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\">,\n VariantProps<typeof iconButtonVariants> {\n /** 아이콘 색상 — primary: 기본(어두운) 배경, white: 어두운 배경 위 */\n color?: \"primary\" | \"white\";\n /** true 이면 danger 색상 적용 (color 보다 우선) */\n error?: boolean;\n asChild?: boolean;\n children?: ReactNode;\n ref?: Ref<HTMLButtonElement>;\n}\n\nfunction IconButton({\n className,\n size = \"sm\",\n shape = \"rectangle\",\n color = \"primary\",\n error = false,\n asChild = false,\n children,\n ref,\n ...props\n}: IconButtonProps) {\n const Comp = asChild ? Slot : \"button\";\n\n const iconColor = error\n ? \"aivex:text-icon-danger\"\n : color === \"white\"\n ? \"aivex:text-static-white\"\n : \"aivex:text-icon-primary\";\n\n const interactionVariant = error ? \"danger\" : color === \"white\" ? \"white\" : \"default\";\n const iconButtonSize = size ?? \"sm\";\n const iconButtonShape = shape ?? \"rectangle\";\n\n return (\n <Comp\n ref={ref}\n type={asChild ? undefined : \"button\"}\n className={cn(iconButtonVariants({ size, shape }), iconColor, className)}\n {...props}\n >\n <InteractionLayer\n variant={interactionVariant}\n fill={false}\n interactive\n className={cn(\n interactionInsetClass[iconButtonSize],\n interactionRadiusClass[iconButtonSize][iconButtonShape],\n )}\n />\n <span\n className={cn(\n \"aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0\",\n iconSizeClass[iconButtonSize],\n )}\n >\n {children}\n </span>\n </Comp>\n );\n}\n\nexport { IconButton, iconButtonVariants };\n"],"mappings":"sRAOA,IAAM,GAAA,EAAA,EAAA,KACJ,2PACA,CACE,SAAU,CACR,UAAW,CACT,IAAK,GACL,OAAQ,GACR,KAAM,GACN,MAAO,GACR,CACF,CACD,gBAAiB,CACf,UAAW,MACZ,CACF,CACF,CAEK,GAAA,EAAA,EAAA,KAAoB,yBAA0B,CAClD,SAAU,CACR,UAAW,CACT,IAAK,GACL,OAAQ,GACR,KAAM,GACN,MAAO,GACR,CACF,CACD,gBAAiB,CACf,UAAW,MACZ,CACF,CAAC,CAWF,SAAS,EAAQ,CAAE,UAAS,WAAU,YAAY,MAAO,WAAW,GAAO,OAAqB,CAC9F,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,CACF,CACF,CAKK,EAAgD,CACpD,GAAI,gBACJ,GAAI,iBACJ,GAAI,iBACL,CAEK,EAAwD,CAC5D,GAAI,mBACJ,GAAI,kBACJ,GAAI,kBACL,CAEK,EAAkF,CACtF,GAAI,CACF,UAAW,mBACX,QAAS,qBACV,CACD,GAAI,CACF,UAAW,mBACX,QAAS,qBACV,CACD,GAAI,CACF,UAAW,mBACX,QAAS,qBACV,CACF,CAcD,SAAS,EAAW,CAClB,YACA,OAAO,KACP,QAAQ,YACR,QAAQ,UACR,QAAQ,GACR,UAAU,GACV,WACA,MACA,GAAG,GACe,CAClB,IAAM,EAAO,EAAU,EAAA,KAAO,SAExB,EAAY,EACd,yBACA,IAAU,QACR,0BACA,0BAEA,EAAqB,EAAQ,SAAW,IAAU,QAAU,QAAU,UACtE,EAAiB,GAAQ,KACzB,EAAkB,GAAS,YAEjC,OACE,EAAA,EAAA,MAAC,EAAD,CACO,MACL,KAAM,EAAU,IAAA,GAAY,SAC5B,UAAW,EAAA,GAAG,EAAmB,CAAE,OAAM,QAAO,CAAC,CAAE,EAAW,EAAU,CACxE,GAAI,WAJN,EAME,EAAA,EAAA,KAAC,EAAA,GAAD,CACE,QAAS,EACT,KAAM,GACN,YAAA,GACA,UAAW,EAAA,GACT,EAAsB,GACtB,EAAuB,GAAgB,GACxC,CACD,CAAA,EACF,EAAA,EAAA,KAAC,OAAD,CACE,UAAW,EAAA,GACT,oEACA,EAAc,GACf,CAEA,WACI,CAAA,CACF"}
@@ -1,4 +1,5 @@
1
- import { fa as e, pa as t } from "./Button-DLfTdKpW.js";
1
+ import { cn as e } from "./utils.js";
2
+ import { fa as t } from "./Button-CuvXiYtX.js";
2
3
  import * as n from "@radix-ui/react-avatar";
3
4
  import { cva as r } from "class-variance-authority";
4
5
  import * as i from "@radix-ui/react-tooltip";
@@ -22,7 +23,7 @@ var l = r("aivex:z-50 aivex:max-w-[720px] aivex:rounded-sm aivex:bg-static-gray
22
23
  } },
23
24
  defaultVariants: { placement: "top" }
24
25
  });
25
- function d({ content: e, children: n, placement: r = "top", disabled: c = !1, ref: d }) {
26
+ function d({ content: t, children: n, placement: r = "top", disabled: c = !1, ref: d }) {
26
27
  let f = r ?? "top";
27
28
  return c ? /* @__PURE__ */ o(a, { children: n }) : /* @__PURE__ */ o(i.Provider, {
28
29
  delayDuration: 0,
@@ -36,11 +37,11 @@ function d({ content: e, children: n, placement: r = "top", disabled: c = !1, re
36
37
  }), /* @__PURE__ */ o(i.Portal, { children: /* @__PURE__ */ s(i.Content, {
37
38
  side: f,
38
39
  sideOffset: 8,
39
- className: t(l({ placement: f })),
40
- children: [e, /* @__PURE__ */ o(i.Arrow, {
40
+ className: e(l({ placement: f })),
41
+ children: [t, /* @__PURE__ */ o(i.Arrow, {
41
42
  width: 8,
42
43
  height: 4,
43
- className: t(u({ placement: f }))
44
+ className: e(u({ placement: f }))
44
45
  })]
45
46
  }) })] })
46
47
  });
@@ -110,17 +111,17 @@ function m(e) {
110
111
  function h({ initials: e, name: t, icon: n }) {
111
112
  return (e ?? t?.trim().slice(0, 1).toUpperCase()) || (n ?? null);
112
113
  }
113
- function g({ className: e, size: r, type: i, src: a, alt: c, initials: l, icon: u, name: p, bgColor: g, showTooltip: _, delayMs: v = 600, style: y, ref: b, ...x }) {
114
+ function g({ className: t, size: r, type: i, src: a, alt: c, initials: l, icon: u, name: p, bgColor: g, showTooltip: _, delayMs: v = 600, style: y, ref: b, ...x }) {
114
115
  let S = h({
115
116
  initials: l,
116
117
  name: p,
117
118
  icon: u
118
119
  }), C = p ?? l, w = !a && !g && C ? m(C) : void 0, T = /* @__PURE__ */ s(n.Root, {
119
120
  ref: b,
120
- className: t(f({
121
+ className: e(f({
121
122
  size: r,
122
123
  type: i
123
- }), w, e),
124
+ }), w, t),
124
125
  style: g ? {
125
126
  backgroundColor: g,
126
127
  ...y
@@ -186,18 +187,18 @@ function x({ className: n, size: r = "sm", shape: i = "rectangle", color: a = "p
186
187
  return /* @__PURE__ */ s(m, {
187
188
  ref: f,
188
189
  type: u ? void 0 : "button",
189
- className: t(_({
190
+ className: e(_({
190
191
  size: r,
191
192
  shape: i
192
193
  }), h, n),
193
194
  ...p,
194
- children: [/* @__PURE__ */ o(e, {
195
+ children: [/* @__PURE__ */ o(t, {
195
196
  variant: g,
196
197
  fill: !1,
197
198
  interactive: !0,
198
- className: t(y[x], b[x][S])
199
+ className: e(y[x], b[x][S])
199
200
  }), /* @__PURE__ */ o("span", {
200
- className: t("aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0", v[x]),
201
+ className: e("aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0", v[x]),
201
202
  children: d
202
203
  })]
203
204
  });
@@ -205,4 +206,4 @@ function x({ className: n, size: r = "sm", shape: i = "rectangle", color: a = "p
205
206
  //#endregion
206
207
  export { d as a, f as i, _ as n, l as o, g as r, x as t };
207
208
 
208
- //# sourceMappingURL=IconButton-CQG1Pw51.js.map
209
+ //# sourceMappingURL=IconButton-DusjiWye.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton-CQG1Pw51.js","names":[],"sources":["../src/components/Tooltip/Tooltip.tsx","../src/components/Avatar/Avatar.tsx","../src/components/IconButton/IconButton.tsx"],"sourcesContent":["\"use client\";\n\nimport * as RadixTooltip from \"@radix-ui/react-tooltip\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ReactNode, Ref } from \"react\";\nimport { cn } from \"@/utils/cn\";\n\nconst tooltipContentVariants = cva(\n \"aivex:z-50 aivex:max-w-[720px] aivex:rounded-sm aivex:bg-static-gray aivex:px-md aivex:py-xs aivex:text-body-md-regular aivex:text-text-on-color aivex:whitespace-pre-wrap aivex:break-words aivex:pointer-events-none aivex:shadow-md aivex:select-none\",\n {\n variants: {\n placement: {\n top: \"\",\n bottom: \"\",\n left: \"\",\n right: \"\",\n },\n },\n defaultVariants: {\n placement: \"top\",\n },\n },\n);\n\nconst arrowVariants = cva(\"aivex:fill-static-gray\", {\n variants: {\n placement: {\n top: \"\",\n bottom: \"\",\n left: \"\",\n right: \"\",\n },\n },\n defaultVariants: {\n placement: \"top\",\n },\n});\n\ntype TooltipPlacement = NonNullable<VariantProps<typeof tooltipContentVariants>[\"placement\"]>;\n\nexport interface TooltipProps extends VariantProps<typeof tooltipContentVariants> {\n content: ReactNode;\n children: ReactNode;\n disabled?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction Tooltip({ content, children, placement = \"top\", disabled = false, ref }: TooltipProps) {\n const resolvedPlacement: TooltipPlacement = placement ?? \"top\";\n\n if (disabled) {\n return <>{children}</>;\n }\n\n return (\n <RadixTooltip.Provider delayDuration={0}>\n <RadixTooltip.Root>\n <RadixTooltip.Trigger asChild>\n <span ref={ref} className=\"aivex:inline-flex\">\n {children}\n </span>\n </RadixTooltip.Trigger>\n <RadixTooltip.Portal>\n <RadixTooltip.Content\n side={resolvedPlacement}\n sideOffset={8}\n className={cn(tooltipContentVariants({ placement: resolvedPlacement }))}\n >\n {content}\n <RadixTooltip.Arrow\n width={8}\n height={4}\n className={cn(arrowVariants({ placement: resolvedPlacement }))}\n />\n </RadixTooltip.Content>\n </RadixTooltip.Portal>\n </RadixTooltip.Root>\n </RadixTooltip.Provider>\n );\n}\n\nexport { Tooltip, tooltipContentVariants };\n","import * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { HTMLAttributes, ReactNode, Ref } from \"react\";\nimport { Tooltip } from \"@/components/Tooltip\";\nimport { cn } from \"@/utils/cn\";\n\nconst avatarVariants = cva(\n \"aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:overflow-hidden aivex:select-none aivex:leading-none aivex:text-text-primary\",\n {\n variants: {\n size: {\n xxs: \"aivex:w-4 aivex:h-4 aivex:text-label-sm\",\n xs: \"aivex:w-5 aivex:h-5 aivex:text-label-md\",\n sm: \"aivex:w-6 aivex:h-6 aivex:text-label-md\",\n md: \"aivex:w-8 aivex:h-8 aivex:text-label-lg\",\n lg: \"aivex:w-9 aivex:h-9 aivex:text-label-xl\",\n xl: \"aivex:w-12 aivex:h-12 aivex:text-label-xl\",\n \"2xl\": \"aivex:w-14 aivex:h-14 aivex:text-label-xl\",\n },\n type: {\n round: \"aivex:rounded-full aivex:bg-category-indigo-bg\",\n square: \"aivex:bg-category-indigo-bg\",\n image: \"aivex:rounded-full aivex:border aivex:border-border-subtle aivex:bg-bg-secondary\",\n },\n },\n // Square shape: size-scaled radius per Figma\n compoundVariants: [\n { type: \"square\", size: [\"xxs\", \"xs\", \"sm\"], className: \"aivex:rounded-xs\" },\n { type: \"square\", size: [\"md\", \"lg\"], className: \"aivex:rounded-sm\" },\n { type: \"square\", size: [\"xl\", \"2xl\"], className: \"aivex:rounded-md\" },\n ],\n defaultVariants: { size: \"md\", type: \"round\" },\n },\n);\n\nexport interface AvatarProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"children\">,\n VariantProps<typeof avatarVariants> {\n src?: string;\n alt?: string;\n initials?: string;\n icon?: ReactNode;\n name?: string;\n bgColor?: string;\n showTooltip?: boolean;\n /** Fallback render delay in ms (only applies when `src` is provided). Default: 600ms. */\n delayMs?: number;\n ref?: Ref<HTMLSpanElement>;\n}\n\n/** name(또는 initials) 기반으로 결정적 색을 고르기 위한 카테고리 팔레트 */\nconst avatarColorClasses = [\n \"aivex:bg-category-blue-bg aivex:text-category-blue-text\",\n \"aivex:bg-category-green-bg aivex:text-category-green-text\",\n \"aivex:bg-category-orange-bg aivex:text-category-orange-text\",\n \"aivex:bg-category-violet-bg aivex:text-category-violet-text\",\n \"aivex:bg-category-teal-bg aivex:text-category-teal-text\",\n \"aivex:bg-category-pink-bg aivex:text-category-pink-text\",\n \"aivex:bg-category-cyan-bg aivex:text-category-cyan-text\",\n \"aivex:bg-category-red-bg aivex:text-category-red-text\",\n \"aivex:bg-category-lime-bg aivex:text-category-lime-text\",\n \"aivex:bg-category-yellow-bg aivex:text-category-yellow-text\",\n \"aivex:bg-category-indigo-bg aivex:text-category-indigo-text\",\n] as const;\n\nfunction pickColorClass(key: string): string {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash * 31 + key.charCodeAt(i)) >>> 0;\n }\n return avatarColorClasses[hash % avatarColorClasses.length];\n}\n\nfunction resolveFallback({\n initials,\n name,\n icon,\n}: Pick<AvatarProps, \"initials\" | \"name\" | \"icon\">): ReactNode {\n const text = initials ?? name?.trim().slice(0, 1).toUpperCase();\n if (text) return text;\n return icon ?? null;\n}\n\nfunction Avatar({\n className,\n size,\n type,\n src,\n alt,\n initials,\n icon,\n name,\n bgColor,\n showTooltip,\n delayMs = 600,\n style,\n ref,\n ...props\n}: AvatarProps) {\n const fallback = resolveFallback({ initials, name, icon });\n // src/bgColor가 없으면 name(없으면 initials) 기준으로 카테고리 색을 자동 배정한다.\n const colorSeed = name ?? initials;\n const autoColorClass = !src && !bgColor && colorSeed ? pickColorClass(colorSeed) : undefined;\n\n const avatar = (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(avatarVariants({ size, type }), autoColorClass, className)}\n style={bgColor ? { backgroundColor: bgColor, ...style } : style}\n {...props}\n >\n {src && (\n <AvatarPrimitive.Image\n src={src}\n alt={alt ?? \"avatar\"}\n className=\"aivex:w-full aivex:h-full aivex:object-cover\"\n />\n )}\n <AvatarPrimitive.Fallback\n delayMs={src ? delayMs : 0}\n className=\"aivex:inline-flex aivex:h-full aivex:w-full aivex:items-center aivex:justify-center aivex:leading-none\"\n >\n {fallback}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n );\n\n return showTooltip && name ? <Tooltip content={name}>{avatar}</Tooltip> : avatar;\n}\n\nexport { Avatar, avatarVariants };\n","import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { InteractionLayer } from \"@/components/InteractionLayer\";\nimport { cn } from \"@/utils/cn\";\n\nconst iconButtonVariants = cva(\n \"aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand\",\n {\n variants: {\n size: {\n xs: \"aivex:size-xl aivex:rounded-xs\",\n sm: \"aivex:size-2xl aivex:rounded-xs\",\n md: \"aivex:size-3xl aivex:rounded-sm\",\n },\n shape: {\n rectangle: \"\",\n rounded: \"aivex:rounded-full\",\n },\n },\n defaultVariants: {\n size: \"sm\",\n shape: \"rectangle\",\n },\n },\n);\n\ntype IconButtonSize = \"xs\" | \"sm\" | \"md\";\ntype IconButtonShape = \"rectangle\" | \"rounded\";\n\nconst iconSizeClass: Record<IconButtonSize, string> = {\n xs: \"aivex:size-xl\",\n sm: \"aivex:size-2xl\",\n md: \"aivex:size-3xl\",\n};\n\nconst interactionInsetClass: Record<IconButtonSize, string> = {\n xs: \"aivex:-inset-2xs\",\n sm: \"aivex:-inset-xs\",\n md: \"aivex:-inset-xs\",\n};\n\nconst interactionRadiusClass: Record<IconButtonSize, Record<IconButtonShape, string>> = {\n xs: {\n rectangle: \"aivex:rounded-xs\",\n rounded: \"aivex:rounded-full\",\n },\n sm: {\n rectangle: \"aivex:rounded-sm\",\n rounded: \"aivex:rounded-full\",\n },\n md: {\n rectangle: \"aivex:rounded-md\",\n rounded: \"aivex:rounded-full\",\n },\n};\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\">,\n VariantProps<typeof iconButtonVariants> {\n /** 아이콘 색상 — primary: 기본(어두운) 배경, white: 어두운 배경 위 */\n color?: \"primary\" | \"white\";\n /** true 이면 danger 색상 적용 (color 보다 우선) */\n error?: boolean;\n asChild?: boolean;\n children?: ReactNode;\n ref?: Ref<HTMLButtonElement>;\n}\n\nfunction IconButton({\n className,\n size = \"sm\",\n shape = \"rectangle\",\n color = \"primary\",\n error = false,\n asChild = false,\n children,\n ref,\n ...props\n}: IconButtonProps) {\n const Comp = asChild ? Slot : \"button\";\n\n const iconColor = error\n ? \"aivex:text-icon-danger\"\n : color === \"white\"\n ? \"aivex:text-static-white\"\n : \"aivex:text-icon-primary\";\n\n const interactionVariant = error ? \"danger\" : color === \"white\" ? \"white\" : \"default\";\n const iconButtonSize = size ?? \"sm\";\n const iconButtonShape = shape ?? \"rectangle\";\n\n return (\n <Comp\n ref={ref}\n type={asChild ? undefined : \"button\"}\n className={cn(iconButtonVariants({ size, shape }), iconColor, className)}\n {...props}\n >\n <InteractionLayer\n variant={interactionVariant}\n fill={false}\n interactive\n className={cn(\n interactionInsetClass[iconButtonSize],\n interactionRadiusClass[iconButtonSize][iconButtonShape],\n )}\n />\n <span\n className={cn(\n \"aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0\",\n iconSizeClass[iconButtonSize],\n )}\n >\n {children}\n </span>\n </Comp>\n );\n}\n\nexport { IconButton, iconButtonVariants };\n"],"mappings":";;;;;;;AAOA,IAAM,IAAyB,EAC7B,4PACA;CACE,UAAU,EACR,WAAW;EACT,KAAK;EACL,QAAQ;EACR,MAAM;EACN,OAAO;EACR,EACF;CACD,iBAAiB,EACf,WAAW,OACZ;CACF,CACF,EAEK,IAAgB,EAAI,0BAA0B;CAClD,UAAU,EACR,WAAW;EACT,KAAK;EACL,QAAQ;EACR,MAAM;EACN,OAAO;EACR,EACF;CACD,iBAAiB,EACf,WAAW,OACZ;CACF,CAAC;AAWF,SAAS,EAAQ,EAAE,YAAS,aAAU,eAAY,OAAO,cAAW,IAAO,UAAqB;CAC9F,IAAM,IAAsC,KAAa;AAMzD,QAJI,IACK,kBAAA,GAAA,EAAG,aAAY,CAAA,GAItB,kBAAC,EAAa,UAAd;EAAuB,eAAe;YACpC,kBAAC,EAAa,MAAd,EAAA,UAAA,CACE,kBAAC,EAAa,SAAd;GAAsB,SAAA;aACpB,kBAAC,QAAD;IAAW;IAAK,WAAU;IACvB;IACI,CAAA;GACc,C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IAAQ,WAAW,MAAU,UAAU,UAAU,WACtE,IAAiB,KAAQ,MACzB,IAAkB,KAAS;AAEjC,QACE,kBAAC,GAAD;EACO;EACL,MAAM,IAAU,KAAA,IAAY;EAC5B,WAAW,EAAG,EAAmB;GAAE;GAAM;GAAO,CAAC,EAAE,GAAW,EAAU;EACxE,GAAI;YAJN,CAME,kBAAC,GAAD;GACE,SAAS;GACT,MAAM;GACN,aAAA;GACA,WAAW,EACT,EAAsB,IACtB,EAAuB,GAAgB,GACxC;GACD,CAAA,EACF,kBAAC,QAAD;GACE,WAAW,EACT,qEACA,EAAc,GACf;GAEA;GACI,CAAA,CACF"}
1
+ {"version":3,"file":"IconButton-DusjiWye.js","names":[],"sources":["../src/components/Tooltip/Tooltip.tsx","../src/components/Avatar/Avatar.tsx","../src/components/IconButton/IconButton.tsx"],"sourcesContent":["\"use client\";\n\nimport * as RadixTooltip from \"@radix-ui/react-tooltip\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ReactNode, Ref } from \"react\";\nimport { cn } from \"@/utils/cn\";\n\nconst tooltipContentVariants = cva(\n \"aivex:z-50 aivex:max-w-[720px] aivex:rounded-sm aivex:bg-static-gray aivex:px-md aivex:py-xs aivex:text-body-md-regular aivex:text-text-on-color aivex:whitespace-pre-wrap aivex:break-words aivex:pointer-events-none aivex:shadow-md aivex:select-none\",\n {\n variants: {\n placement: {\n top: \"\",\n bottom: \"\",\n left: \"\",\n right: \"\",\n },\n },\n defaultVariants: {\n placement: \"top\",\n },\n },\n);\n\nconst arrowVariants = cva(\"aivex:fill-static-gray\", {\n variants: {\n placement: {\n top: \"\",\n bottom: \"\",\n left: \"\",\n right: \"\",\n },\n },\n defaultVariants: {\n placement: \"top\",\n },\n});\n\ntype TooltipPlacement = NonNullable<VariantProps<typeof tooltipContentVariants>[\"placement\"]>;\n\nexport interface TooltipProps extends VariantProps<typeof tooltipContentVariants> {\n content: ReactNode;\n children: ReactNode;\n disabled?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction Tooltip({ content, children, placement = \"top\", disabled = false, ref }: TooltipProps) {\n const resolvedPlacement: TooltipPlacement = placement ?? \"top\";\n\n if (disabled) {\n return <>{children}</>;\n }\n\n return (\n <RadixTooltip.Provider delayDuration={0}>\n <RadixTooltip.Root>\n <RadixTooltip.Trigger asChild>\n <span ref={ref} className=\"aivex:inline-flex\">\n {children}\n </span>\n </RadixTooltip.Trigger>\n <RadixTooltip.Portal>\n <RadixTooltip.Content\n side={resolvedPlacement}\n sideOffset={8}\n className={cn(tooltipContentVariants({ placement: resolvedPlacement }))}\n >\n {content}\n <RadixTooltip.Arrow\n width={8}\n height={4}\n className={cn(arrowVariants({ placement: resolvedPlacement }))}\n />\n </RadixTooltip.Content>\n </RadixTooltip.Portal>\n </RadixTooltip.Root>\n </RadixTooltip.Provider>\n );\n}\n\nexport { Tooltip, tooltipContentVariants };\n","import * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { HTMLAttributes, ReactNode, Ref } from \"react\";\nimport { Tooltip } from \"@/components/Tooltip\";\nimport { cn } from \"@/utils/cn\";\n\nconst avatarVariants = cva(\n \"aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:overflow-hidden aivex:select-none aivex:leading-none aivex:text-text-primary\",\n {\n variants: {\n size: {\n xxs: \"aivex:w-4 aivex:h-4 aivex:text-label-sm\",\n xs: \"aivex:w-5 aivex:h-5 aivex:text-label-md\",\n sm: \"aivex:w-6 aivex:h-6 aivex:text-label-md\",\n md: \"aivex:w-8 aivex:h-8 aivex:text-label-lg\",\n lg: \"aivex:w-9 aivex:h-9 aivex:text-label-xl\",\n xl: \"aivex:w-12 aivex:h-12 aivex:text-label-xl\",\n \"2xl\": \"aivex:w-14 aivex:h-14 aivex:text-label-xl\",\n },\n type: {\n round: \"aivex:rounded-full aivex:bg-category-indigo-bg\",\n square: \"aivex:bg-category-indigo-bg\",\n image: \"aivex:rounded-full aivex:border aivex:border-border-subtle aivex:bg-bg-secondary\",\n },\n },\n // Square shape: size-scaled radius per Figma\n compoundVariants: [\n { type: \"square\", size: [\"xxs\", \"xs\", \"sm\"], className: \"aivex:rounded-xs\" },\n { type: \"square\", size: [\"md\", \"lg\"], className: \"aivex:rounded-sm\" },\n { type: \"square\", size: [\"xl\", \"2xl\"], className: \"aivex:rounded-md\" },\n ],\n defaultVariants: { size: \"md\", type: \"round\" },\n },\n);\n\nexport interface AvatarProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"children\">,\n VariantProps<typeof avatarVariants> {\n src?: string;\n alt?: string;\n initials?: string;\n icon?: ReactNode;\n name?: string;\n bgColor?: string;\n showTooltip?: boolean;\n /** Fallback render delay in ms (only applies when `src` is provided). Default: 600ms. */\n delayMs?: number;\n ref?: Ref<HTMLSpanElement>;\n}\n\n/** name(또는 initials) 기반으로 결정적 색을 고르기 위한 카테고리 팔레트 */\nconst avatarColorClasses = [\n \"aivex:bg-category-blue-bg aivex:text-category-blue-text\",\n \"aivex:bg-category-green-bg aivex:text-category-green-text\",\n \"aivex:bg-category-orange-bg aivex:text-category-orange-text\",\n \"aivex:bg-category-violet-bg aivex:text-category-violet-text\",\n \"aivex:bg-category-teal-bg aivex:text-category-teal-text\",\n \"aivex:bg-category-pink-bg aivex:text-category-pink-text\",\n \"aivex:bg-category-cyan-bg aivex:text-category-cyan-text\",\n \"aivex:bg-category-red-bg aivex:text-category-red-text\",\n \"aivex:bg-category-lime-bg aivex:text-category-lime-text\",\n \"aivex:bg-category-yellow-bg aivex:text-category-yellow-text\",\n \"aivex:bg-category-indigo-bg aivex:text-category-indigo-text\",\n] as const;\n\nfunction pickColorClass(key: string): string {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash * 31 + key.charCodeAt(i)) >>> 0;\n }\n return avatarColorClasses[hash % avatarColorClasses.length];\n}\n\nfunction resolveFallback({\n initials,\n name,\n icon,\n}: Pick<AvatarProps, \"initials\" | \"name\" | \"icon\">): ReactNode {\n const text = initials ?? name?.trim().slice(0, 1).toUpperCase();\n if (text) return text;\n return icon ?? null;\n}\n\nfunction Avatar({\n className,\n size,\n type,\n src,\n alt,\n initials,\n icon,\n name,\n bgColor,\n showTooltip,\n delayMs = 600,\n style,\n ref,\n ...props\n}: AvatarProps) {\n const fallback = resolveFallback({ initials, name, icon });\n // src/bgColor가 없으면 name(없으면 initials) 기준으로 카테고리 색을 자동 배정한다.\n const colorSeed = name ?? initials;\n const autoColorClass = !src && !bgColor && colorSeed ? pickColorClass(colorSeed) : undefined;\n\n const avatar = (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(avatarVariants({ size, type }), autoColorClass, className)}\n style={bgColor ? { backgroundColor: bgColor, ...style } : style}\n {...props}\n >\n {src && (\n <AvatarPrimitive.Image\n src={src}\n alt={alt ?? \"avatar\"}\n className=\"aivex:w-full aivex:h-full aivex:object-cover\"\n />\n )}\n <AvatarPrimitive.Fallback\n delayMs={src ? delayMs : 0}\n className=\"aivex:inline-flex aivex:h-full aivex:w-full aivex:items-center aivex:justify-center aivex:leading-none\"\n >\n {fallback}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n );\n\n return showTooltip && name ? <Tooltip content={name}>{avatar}</Tooltip> : avatar;\n}\n\nexport { Avatar, avatarVariants };\n","import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { InteractionLayer } from \"@/components/InteractionLayer\";\nimport { cn } from \"@/utils/cn\";\n\nconst iconButtonVariants = cva(\n \"aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand\",\n {\n variants: {\n size: {\n xs: \"aivex:size-xl aivex:rounded-xs\",\n sm: \"aivex:size-2xl aivex:rounded-xs\",\n md: \"aivex:size-3xl aivex:rounded-sm\",\n },\n shape: {\n rectangle: \"\",\n rounded: \"aivex:rounded-full\",\n },\n },\n defaultVariants: {\n size: \"sm\",\n shape: \"rectangle\",\n },\n },\n);\n\ntype IconButtonSize = \"xs\" | \"sm\" | \"md\";\ntype IconButtonShape = \"rectangle\" | \"rounded\";\n\nconst iconSizeClass: Record<IconButtonSize, string> = {\n xs: \"aivex:size-xl\",\n sm: \"aivex:size-2xl\",\n md: \"aivex:size-3xl\",\n};\n\nconst interactionInsetClass: Record<IconButtonSize, string> = {\n xs: \"aivex:-inset-2xs\",\n sm: \"aivex:-inset-xs\",\n md: \"aivex:-inset-xs\",\n};\n\nconst interactionRadiusClass: Record<IconButtonSize, Record<IconButtonShape, string>> = {\n xs: {\n rectangle: \"aivex:rounded-xs\",\n rounded: \"aivex:rounded-full\",\n },\n sm: {\n rectangle: \"aivex:rounded-sm\",\n rounded: \"aivex:rounded-full\",\n },\n md: {\n rectangle: \"aivex:rounded-md\",\n rounded: \"aivex:rounded-full\",\n },\n};\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\">,\n VariantProps<typeof iconButtonVariants> {\n /** 아이콘 색상 — primary: 기본(어두운) 배경, white: 어두운 배경 위 */\n color?: \"primary\" | \"white\";\n /** true 이면 danger 색상 적용 (color 보다 우선) */\n error?: boolean;\n asChild?: boolean;\n children?: ReactNode;\n ref?: Ref<HTMLButtonElement>;\n}\n\nfunction IconButton({\n className,\n size = \"sm\",\n shape = \"rectangle\",\n color = \"primary\",\n error = false,\n asChild = false,\n children,\n ref,\n ...props\n}: IconButtonProps) {\n const Comp = asChild ? Slot : \"button\";\n\n const iconColor = error\n ? \"aivex:text-icon-danger\"\n : color === \"white\"\n ? \"aivex:text-static-white\"\n : \"aivex:text-icon-primary\";\n\n const interactionVariant = error ? \"danger\" : color === \"white\" ? \"white\" : \"default\";\n const iconButtonSize = size ?? \"sm\";\n const iconButtonShape = shape ?? \"rectangle\";\n\n return (\n <Comp\n ref={ref}\n type={asChild ? undefined : \"button\"}\n className={cn(iconButtonVariants({ size, shape }), iconColor, className)}\n {...props}\n >\n <InteractionLayer\n variant={interactionVariant}\n fill={false}\n interactive\n className={cn(\n interactionInsetClass[iconButtonSize],\n interactionRadiusClass[iconButtonSize][iconButtonShape],\n )}\n />\n <span\n className={cn(\n \"aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0\",\n iconSizeClass[iconButtonSize],\n )}\n >\n {children}\n </span>\n </Comp>\n );\n}\n\nexport { IconButton, iconButtonVariants };\n"],"mappings":";;;;;;;;AAOA,IAAM,IAAyB,EAC7B,4PACA;CACE,UAAU,EACR,WAAW;EACT,KAAK;EACL,QAAQ;EACR,MAAM;EACN,OAAO;EACR,EACF;CACD,iBAAiB,EACf,WAAW,OACZ;CACF,CACF,EAEK,IAAgB,EAAI,0BAA0B;CAClD,UAAU,EACR,WAAW;EACT,KAAK;EACL,QAAQ;EACR,MAAM;EACN,OAAO;EACR,EACF;CACD,iBAAiB,EACf,WAAW,OACZ;CACF,CAAC;AAWF,SAAS,EAAQ,EAAE,YAAS,aAAU,eAAY,OAAO,cAAW,IAAO,UAAqB;CAC9F,IAAM,IAAsC,KAAa;AAMzD,QAJI,IACK,kBAAA,GAAA,EAAG,aAAY,CAAA,GAItB,kBAAC,EAAa,UAAd;EAAuB,eAAe;YACpC,kBAAC,EAAa,MAAd,EAAA,UAAA,CACE,kBAAC,EAAa,SAAd;GAAsB,SAAA;aACpB,kBAAC,QAAD;IAAW;IAAK,WAAU;IACvB;IACI,CAAA;GACc,CAAA,EACvB,kBAAC,EAAa,QAAd,EAAA,UACE,kBAAC,EAAa,SAAd;GACE,MAAM;GACN,YAAY;GACZ,WAAW,EAAG,EAAuB,EAAE,WAAW,GAAmB,CAAC,CAAC;aAHzE,CAKG,GACD,kBAAC,EAAa,OAAd;IACE,OAAO;IACP,QAAQ;IACR,WAAW,EAAG,EAAc,EAAE,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,GAAD;GACE,SAAS;GACT,MAAM;GACN,aAAA;GACA,WAAW,EACT,EAAsB,IACtB,EAAuB,GAAgB,GACxC;GACD,CAAA,EACF,kBAAC,QAAD;GACE,WAAW,EACT,qEACA,EAAc,GACf;GAEA;GACI,CAAA,CACF"}
package/dist/comment.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use client";require(`./styles.css`),Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./Button-BcJuLWuX.cjs`),t=require(`./IconButton-CfbfwHu2.cjs`);let n=require(`react/jsx-runtime`),r=require(`react`),i=require(`@tiptap/extension-mention`);i=e.ma(i,1);let a=require(`@tiptap/extension-placeholder`);a=e.ma(a,1);let o=require(`@tiptap/react`),s=require(`@tiptap/starter-kit`);s=e.ma(s,1);let c=require(`tippy.js`);c=e.ma(c,1);var l=(0,r.memo)(function({items:e,command:i,emptyText:a=`No results found.`,ref:o}){let[s,c]=(0,r.useState)(0),l=(0,r.useRef)([]),u=(0,r.useCallback)(t=>{let n=e[t];n&&i(n)},[e,i]),d=(0,r.useCallback)(t=>{c(n=>{let r=e.length;return t===`up`?(n+r-1)%r:(n+1)%r})},[e.length]),f=(0,r.useCallback)(e=>{switch(e.key){case`ArrowUp`:return d(`up`),!0;case`ArrowDown`:return d(`down`),!0;case`Enter`:return u(s),!0;default:return!1}},[d,u,s]);return(0,r.useEffect)(()=>{c(0),l.current=e.map(()=>null)},[e]),(0,r.useEffect)(()=>{l.current[s]?.scrollIntoView({behavior:`smooth`,block:`nearest`})},[s]),(0,r.useImperativeHandle)(o,()=>({onKeyDown:f}),[f]),e.length?(0,n.jsx)(`div`,{className:`aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl`,children:e.map((e,r)=>(0,n.jsxs)(`div`,{ref:e=>{l.current[r]=e},className:`aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${s===r?`aivex:bg-bg-brand-subtle`:``}`,onClick:()=>u(r),children:[(0,n.jsx)(t.r,{size:`sm`,src:e.avatarUrl,bgColor:e.color,name:e.name}),(0,n.jsxs)(`div`,{className:`aivex:flex aivex:max-w-[260px] aivex:flex-col`,children:[(0,n.jsx)(`div`,{className:`aivex:truncate aivex:text-label-md aivex:text-text-primary`,children:e.name}),e.email?(0,n.jsx)(`div`,{className:`aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary`,children:e.email}):null]})]},e.id))}):(0,n.jsx)(`div`,{className:`aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl`,children:(0,n.jsx)(`div`,{className:`aivex:p-2 aivex:text-body-md-regular aivex:text-text-secondary`,children:a})})}),u=(e,t,n)=>(0,r.useMemo)(()=>{let r=t=>{if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(n)||(e.email??``).toLowerCase().includes(n))},i=e=>t=>{e({id:t.id,label:t.name})};return{items:({query:e})=>r(e),render:()=>{let e=null,r=null;return{onStart:a=>{e=new o.ReactRenderer(l,{props:{...a,emptyText:n,command:i(a.command)},editor:a.editor}),a.clientRect&&(r=(0,c.default)(`body`,{getReferenceClientRect:a.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:`manual`,placement:`bottom-start`}),t?.(!0))},onUpdate(t){e?.updateProps({...t,emptyText:n,command:i(t.command)}),t.clientRect&&r?.[0]?.setProps({getReferenceClientRect:t.clientRect})},onKeyDown(n){return n.event.key===`Escape`?(r?.[0]&&!r[0].state.isDestroyed&&r[0].hide(),t?.(!1),!0):e?.ref?.onKeyDown(n.event)||!1},onExit(){r?.[0]&&!r[0].state.isDestroyed&&r[0].destroy(),e?.destroy(),r=null,e=null,t?.(!1)}}}}},[e,t,n]);function d({value:e,onChange:t,placeholder:c,onSubmit:l,onEscape:d,userList:p=[],initialContent:m,mentionEmptyText:h,autoFocus:g=!0,handleRef:_}){let v=(0,r.useRef)(null),[y,b]=(0,r.useState)(!1),x=u(p,b,h),S=(0,o.useEditor)({extensions:[s.default,a.default.configure({placeholder:c,emptyEditorClass:`aivex:before:content-[attr(data-placeholder)] aivex:before:text-text-tertiary aivex:before:absolute aivex:before:left-3`}),i.default.configure({HTMLAttributes:{class:`aivex:text-text-brand aivex:px-1`},renderHTML({options:e,node:t}){return[`span`,(0,o.mergeAttributes)(e.HTMLAttributes),`${t.attrs.label}`]},renderText({node:e}){return`@[${e.attrs.label}](${e.attrs.id})`},deleteTriggerWithBackspace:!0,suggestion:x})],content:m||e,immediatelyRender:!1,editorProps:{attributes:{class:`aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]`},handleKeyDown:(t,n)=>n.key===`Enter`?y||n.shiftKey||n.metaKey||n.ctrlKey||n.altKey?!1:(n.preventDefault(),e.trim()&&l&&l(),!0):n.key===`Escape`?y?!1:(n.preventDefault(),d?.(),!0):!1},onUpdate:({editor:e})=>{t(f(e.getJSON()))}});return(0,r.useEffect)(()=>{S&&!m&&e!==S.getText()&&S.commands.setContent(e)},[e,S,m]),(0,r.useEffect)(()=>{S&&g&&requestAnimationFrame(()=>{S.commands.focus()})},[S,g]),(0,r.useImperativeHandle)(_,()=>({focus:()=>{S?.commands.focus()}}),[S]),(0,n.jsx)(o.EditorContent,{ref:v,editor:S,className:`aivex:relative aivex:h-full aivex:w-full`,onKeyDown:e=>e.stopPropagation()})}function f(e){if(!e?.content)return``;let t=e=>e.type===`mention`&&e.attrs?`@[${e.attrs.label}](${e.attrs.id})`:e.type===`text`?e.text||``:e.type===`hardBreak`?`
1
+ "use client";require(`./styles.css`),Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./Button-DXf0LWOC.cjs`),t=require(`./IconButton-CrrS0BMg.cjs`);let n=require(`react/jsx-runtime`),r=require(`react`),i=require(`@tiptap/extension-mention`);i=e.pa(i,1);let a=require(`@tiptap/extension-placeholder`);a=e.pa(a,1);let o=require(`@tiptap/react`),s=require(`@tiptap/starter-kit`);s=e.pa(s,1);let c=require(`tippy.js`);c=e.pa(c,1);var l=(0,r.memo)(function({items:e,command:i,emptyText:a=`No results found.`,ref:o}){let[s,c]=(0,r.useState)(0),l=(0,r.useRef)([]),u=(0,r.useCallback)(t=>{let n=e[t];n&&i(n)},[e,i]),d=(0,r.useCallback)(t=>{c(n=>{let r=e.length;return t===`up`?(n+r-1)%r:(n+1)%r})},[e.length]),f=(0,r.useCallback)(e=>{switch(e.key){case`ArrowUp`:return d(`up`),!0;case`ArrowDown`:return d(`down`),!0;case`Enter`:return u(s),!0;default:return!1}},[d,u,s]);return(0,r.useEffect)(()=>{c(0),l.current=e.map(()=>null)},[e]),(0,r.useEffect)(()=>{l.current[s]?.scrollIntoView({behavior:`smooth`,block:`nearest`})},[s]),(0,r.useImperativeHandle)(o,()=>({onKeyDown:f}),[f]),e.length?(0,n.jsx)(`div`,{className:`aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl`,children:e.map((e,r)=>(0,n.jsxs)(`div`,{ref:e=>{l.current[r]=e},className:`aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${s===r?`aivex:bg-bg-brand-subtle`:``}`,onClick:()=>u(r),children:[(0,n.jsx)(t.r,{size:`sm`,src:e.avatarUrl,bgColor:e.color,name:e.name}),(0,n.jsxs)(`div`,{className:`aivex:flex aivex:max-w-[260px] aivex:flex-col`,children:[(0,n.jsx)(`div`,{className:`aivex:truncate aivex:text-label-md aivex:text-text-primary`,children:e.name}),e.email?(0,n.jsx)(`div`,{className:`aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary`,children:e.email}):null]})]},e.id))}):(0,n.jsx)(`div`,{className:`aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl`,children:(0,n.jsx)(`div`,{className:`aivex:p-2 aivex:text-body-md-regular aivex:text-text-secondary`,children:a})})}),u=(e,t,n)=>(0,r.useMemo)(()=>{let r=t=>{if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(n)||(e.email??``).toLowerCase().includes(n))},i=e=>t=>{e({id:t.id,label:t.name})};return{items:({query:e})=>r(e),render:()=>{let e=null,r=null;return{onStart:a=>{e=new o.ReactRenderer(l,{props:{...a,emptyText:n,command:i(a.command)},editor:a.editor}),a.clientRect&&(r=(0,c.default)(`body`,{getReferenceClientRect:a.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:`manual`,placement:`bottom-start`}),t?.(!0))},onUpdate(t){e?.updateProps({...t,emptyText:n,command:i(t.command)}),t.clientRect&&r?.[0]?.setProps({getReferenceClientRect:t.clientRect})},onKeyDown(n){return n.event.key===`Escape`?(r?.[0]&&!r[0].state.isDestroyed&&r[0].hide(),t?.(!1),!0):e?.ref?.onKeyDown(n.event)||!1},onExit(){r?.[0]&&!r[0].state.isDestroyed&&r[0].destroy(),e?.destroy(),r=null,e=null,t?.(!1)}}}}},[e,t,n]);function d({value:e,onChange:t,placeholder:c,onSubmit:l,onEscape:d,userList:p=[],initialContent:m,mentionEmptyText:h,autoFocus:g=!0,handleRef:_}){let v=(0,r.useRef)(null),[y,b]=(0,r.useState)(!1),x=u(p,b,h),S=(0,o.useEditor)({extensions:[s.default,a.default.configure({placeholder:c,emptyEditorClass:`aivex:before:content-[attr(data-placeholder)] aivex:before:text-text-tertiary aivex:before:absolute aivex:before:left-3`}),i.default.configure({HTMLAttributes:{class:`aivex:text-text-brand aivex:px-1`},renderHTML({options:e,node:t}){return[`span`,(0,o.mergeAttributes)(e.HTMLAttributes),`${t.attrs.label}`]},renderText({node:e}){return`@[${e.attrs.label}](${e.attrs.id})`},deleteTriggerWithBackspace:!0,suggestion:x})],content:m||e,immediatelyRender:!1,editorProps:{attributes:{class:`aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]`},handleKeyDown:(t,n)=>n.key===`Enter`?y||n.shiftKey||n.metaKey||n.ctrlKey||n.altKey?!1:(n.preventDefault(),e.trim()&&l&&l(),!0):n.key===`Escape`?y||!d?!1:(n.preventDefault(),d(),!0):!1},onUpdate:({editor:e})=>{t(f(e.getJSON()))}});return(0,r.useEffect)(()=>{if(!S||!y&&!d)return;let e=S.view,t=e.dom.ownerDocument.defaultView,n=t=>{t.key!==`Escape`||t.defaultPrevented||!(t.target instanceof Node)||!e.dom.contains(t.target)||e.someProp(`handleKeyDown`,n=>n(e,t))&&(t.preventDefault(),t.stopPropagation())};return t?.addEventListener(`keydown`,n,!0),()=>t?.removeEventListener(`keydown`,n,!0)},[S,y,d]),(0,r.useEffect)(()=>{S&&!m&&e!==S.getText()&&S.commands.setContent(e)},[e,S,m]),(0,r.useEffect)(()=>{S&&g&&requestAnimationFrame(()=>{S.commands.focus()})},[S,g]),(0,r.useImperativeHandle)(_,()=>({focus:()=>{S?.commands.focus()}}),[S]),(0,n.jsx)(o.EditorContent,{ref:v,editor:S,className:`aivex:relative aivex:h-full aivex:w-full`,onKeyDown:e=>e.stopPropagation()})}function f(e){if(!e?.content)return``;let t=e=>e.type===`mention`&&e.attrs?`@[${e.attrs.label}](${e.attrs.id})`:e.type===`text`?e.text||``:e.type===`hardBreak`?`
2
2
  `:e.content?e.content.map(t).join(``):``;return e.content.map(t).join(`
3
3
  `)}function p({user:r,value:i,onChange:a,onSubmit:o,onClose:s,title:c=`Comment`,placeholder:l,submitLabel:u=`Send`,showSubmit:f=!0,pending:p=!1,userList:m,mentionEmptyText:h,initialContent:g,className:_}){let v=()=>{!i.trim()||p||o()};return(0,n.jsx)(`div`,{className:`aivex:rounded-2xl aivex:bg-bg-primary aivex:shadow-xl ${_??``}`,children:(0,n.jsxs)(`div`,{className:`aivex:flex aivex:w-[360px] aivex:flex-col`,children:[(0,n.jsxs)(`div`,{className:`aivex:flex aivex:h-12 aivex:items-center aivex:justify-between aivex:border-border-subtle aivex:border-b aivex:px-5 aivex:py-2`,children:[(0,n.jsx)(`span`,{className:`aivex:text-body-lg-medium aivex:text-text-primary`,children:c}),(0,n.jsx)(t.t,{size:`sm`,className:`aivex:text-text-secondary`,onClick:s,children:(0,n.jsx)(e.xt,{size:20})})]}),(0,n.jsxs)(`div`,{className:`aivex:flex aivex:flex-col aivex:px-4 aivex:py-3`,children:[(0,n.jsxs)(`div`,{className:`aivex:flex aivex:gap-1.5`,children:[(0,n.jsx)(`div`,{className:`aivex:h-6 aivex:w-6 aivex:py-1`,children:r?(0,n.jsx)(t.r,{size:`sm`,src:r.avatarUrl,bgColor:r.color,name:r.name}):null}),(0,n.jsx)(`div`,{className:`aivex:min-w-0 aivex:flex-1`,children:(0,n.jsx)(d,{value:i,onChange:a,placeholder:l,onSubmit:v,onEscape:s,userList:m,mentionEmptyText:h,initialContent:g})})]}),f?(0,n.jsx)(`div`,{className:`aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out ${i.trim()?`aivex:grid-rows-[1fr] aivex:opacity-100`:`aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0`}`,children:(0,n.jsx)(`div`,{className:`aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5`,children:(0,n.jsx)(e.t,{size:`md`,disabled:!i.trim()||p,onClick:v,tabIndex:i.trim()?void 0:-1,children:u})})}):null]})]})})}function m({users:e,selected:r=!1,resolved:i=!1,onClick:a,maxAvatars:o=3,className:s}){let c=e.slice(0,o);return(0,n.jsxs)(`button`,{type:`button`,onClick:a,className:`aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${r?`aivex:border-border-brand aivex:bg-bg-brand`:`aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand`} ${i?`aivex:opacity-40`:``} ${s??``}`,children:[c.map((e,r)=>(0,n.jsx)(`span`,{className:`aivex:flex`,style:r>0?{marginLeft:`-4px`}:void 0,children:(0,n.jsx)(t.r,{size:`xs`,src:e.avatarUrl,bgColor:e.color,name:e.name})},e.id)),e.length>o?(0,n.jsxs)(`span`,{className:`aivex:px-1 aivex:text-label-sm aivex:text-text-secondary`,children:[`+`,e.length-o]}):null]})}exports.CommentInput=p,exports.CommentPin=m,exports.MentionInput=d;
4
4
  //# sourceMappingURL=comment.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"comment.cjs","names":[],"sources":["../src/components/Comment/MentionList.tsx","../src/components/Comment/useMentionSuggestion.ts","../src/components/Comment/MentionInput.tsx","../src/components/Comment/CommentInput.tsx","../src/components/Comment/CommentPin.tsx"],"sourcesContent":["\"use client\";\n\nimport { memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface MentionListHandle {\n onKeyDown: (event: KeyboardEvent) => boolean;\n}\n\ninterface MentionListProps {\n items: CommentUser[];\n command: (item: CommentUser) => void;\n /** 후보 없음 문구(호스트 i18n). 기본 \"No results found.\" */\n emptyText?: string;\n ref?: React.Ref<MentionListHandle>;\n}\n\n/** 멘션(@) 자동완성 목록 — 옵스 에디터 MentionList 이식(도메인 결합 제거). */\nconst MentionList = memo(function MentionList({\n items,\n command,\n emptyText = \"No results found.\",\n ref,\n}: MentionListProps) {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const itemRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n const selectItem = useCallback(\n (index: number) => {\n const item = items[index];\n if (item) command(item);\n },\n [items, command],\n );\n\n const moveSelection = useCallback(\n (direction: \"up\" | \"down\") => {\n setSelectedIndex((prev) => {\n const itemCount = items.length;\n if (direction === \"up\") return (prev + itemCount - 1) % itemCount;\n return (prev + 1) % itemCount;\n });\n },\n [items.length],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent): boolean => {\n switch (event.key) {\n case \"ArrowUp\":\n moveSelection(\"up\");\n return true;\n case \"ArrowDown\":\n moveSelection(\"down\");\n return true;\n case \"Enter\":\n selectItem(selectedIndex);\n return true;\n default:\n return false;\n }\n },\n [moveSelection, selectItem, selectedIndex],\n );\n\n useEffect(() => {\n setSelectedIndex(0);\n itemRefs.current = items.map(() => null);\n }, [items]);\n\n useEffect(() => {\n itemRefs.current[selectedIndex]?.scrollIntoView({ behavior: \"smooth\", block: \"nearest\" });\n }, [selectedIndex]);\n\n useImperativeHandle(ref, () => ({ onKeyDown: handleKeyDown }), [handleKeyDown]);\n\n if (!items.length) {\n return (\n <div className=\"aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n <div className=\"aivex:p-2 aivex:text-body-md-regular aivex:text-text-secondary\">\n {emptyText}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n {items.map((item, index) => (\n // 키보드 상호작용은 tiptap 에디터가 MentionListHandle로 위임 처리한다.\n <div\n key={item.id}\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n className={`aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${\n selectedIndex === index ? \"aivex:bg-bg-brand-subtle\" : \"\"\n }`}\n onClick={() => selectItem(index)}\n >\n <Avatar size=\"sm\" src={item.avatarUrl} bgColor={item.color} name={item.name} />\n <div className=\"aivex:flex aivex:max-w-[260px] aivex:flex-col\">\n <div className=\"aivex:truncate aivex:text-label-md aivex:text-text-primary\">\n {item.name}\n </div>\n {item.email ? (\n <div className=\"aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary\">\n {item.email}\n </div>\n ) : null}\n </div>\n </div>\n ))}\n </div>\n );\n});\n\nexport default MentionList;\n","\"use client\";\n\nimport { ReactRenderer } from \"@tiptap/react\";\nimport { useMemo } from \"react\";\nimport tippy, { type Instance as TippyInstance } from \"tippy.js\";\nimport MentionList, { type MentionListHandle } from \"./MentionList\";\nimport type { CommentUser } from \"./types\";\n\n/** tiptap Mention 확장에 꽂는 자동완성 설정 — 옵스 에디터 이식(CommentUser 기반). */\nexport const useMentionSuggestion = (\n userList: CommentUser[],\n onOpenChange?: (isOpen: boolean) => void,\n emptyText?: string,\n) => {\n return useMemo(() => {\n const filterUsers = (query: string) => {\n if (!query) return userList;\n const q = query.toLowerCase();\n return userList.filter(\n (user) =>\n user.name.toLowerCase().includes(q) || (user.email ?? \"\").toLowerCase().includes(q),\n );\n };\n\n const createCommandHandler =\n (originalCommand: (item: { id: string; label: string }) => void) => (item: CommentUser) => {\n originalCommand({ id: item.id, label: item.name });\n };\n\n const createRenderer = () => {\n let component: ReactRenderer<MentionListHandle> | null = null;\n let popup: TippyInstance[] | null = null;\n\n return {\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onStart: (props: Record<string, any>) => {\n component = new ReactRenderer(MentionList, {\n props: {\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n },\n editor: props.editor,\n });\n\n if (!props.clientRect) return;\n\n popup = tippy(\"body\", {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom-start\",\n });\n\n onOpenChange?.(true);\n },\n\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onUpdate(props: Record<string, any>) {\n component?.updateProps({\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n });\n\n if (!props.clientRect) return;\n\n popup?.[0]?.setProps({ getReferenceClientRect: props.clientRect });\n },\n\n onKeyDown(props: { event: KeyboardEvent }) {\n if (props.event.key === \"Escape\") {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].hide();\n onOpenChange?.(false);\n return true;\n }\n return component?.ref?.onKeyDown(props.event) || false;\n },\n\n onExit() {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].destroy();\n component?.destroy();\n popup = null;\n component = null;\n onOpenChange?.(false);\n },\n };\n };\n\n return {\n items: ({ query }: { query: string }) => filterUsers(query),\n render: createRenderer,\n };\n }, [userList, onOpenChange, emptyText]);\n};\n","\"use client\";\n\nimport Mention from \"@tiptap/extension-mention\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport { EditorContent, type JSONContent, mergeAttributes, useEditor } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport { type Ref, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport type { CommentUser } from \"./types\";\nimport { useMentionSuggestion } from \"./useMentionSuggestion\";\n\nexport interface MentionInputHandle {\n /** 입력기에 포커스를 준다(예: 전송 버튼 클릭 후 포커스 유지). */\n focus: () => void;\n}\n\nexport interface MentionInputProps {\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /** Enter(멘션 목록 닫힌 상태) 제출. */\n onSubmit?: () => void;\n /** Esc(멘션 목록 닫힌 상태) 취소. */\n onEscape?: () => void;\n /** 멘션(@) 후보. 빈 배열이면 멘션 없이 플레인 입력처럼 동작한다. */\n userList?: CommentUser[];\n initialContent?: JSONContent;\n /** 멘션 후보 없음 문구(호스트 i18n). */\n mentionEmptyText?: string;\n /** 마운트 시 자동 포커스(기본 true). */\n autoFocus?: boolean;\n /** 명령형 핸들(포커스 제어). */\n handleRef?: Ref<MentionInputHandle>;\n}\n\n/**\n * 멘션(@) 지원 코멘트 입력기 — 옵스 에디터 MentionInput 이식.\n * value는 평문 직렬화(`@[이름](id)`)로 주고받는다.\n */\nexport default function MentionInput({\n value,\n onChange,\n placeholder,\n onSubmit,\n onEscape,\n userList = [],\n initialContent,\n mentionEmptyText,\n autoFocus = true,\n handleRef,\n}: MentionInputProps) {\n const editorRef = useRef<HTMLDivElement>(null);\n const [isMentionListOpen, setIsMentionListOpen] = useState(false);\n const suggestion = useMentionSuggestion(userList, setIsMentionListOpen, mentionEmptyText);\n\n const editor = useEditor({\n extensions: [\n StarterKit,\n Placeholder.configure({\n placeholder,\n emptyEditorClass:\n \"aivex:before:content-[attr(data-placeholder)] aivex:before:text-text-tertiary aivex:before:absolute aivex:before:left-3\",\n }),\n Mention.configure({\n HTMLAttributes: { class: \"aivex:text-text-brand aivex:px-1\" },\n // 멘션이 확정되면 골뱅이는 사라지고 이름만 남는다(시안) — 확정 전\n // 타이핑 중인 \"@검색어\"는 그대로다. 직렬화 형식은 바뀌지 않는다.\n renderHTML({ options, node }) {\n return [\"span\", mergeAttributes(options.HTMLAttributes), `${node.attrs.label}`];\n },\n renderText({ node }) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n },\n deleteTriggerWithBackspace: true,\n suggestion,\n }),\n ],\n content: initialContent || value,\n // SSR 환경(next 등)에서 hydration 불일치 방지.\n immediatelyRender: false,\n editorProps: {\n attributes: {\n // 줄높이 22(내부 p에 강제) + py 8 + 보더 2 = 32px — 옆의 Send 버튼(h-8)과 높이 일치.\n class:\n \"aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]\",\n },\n handleKeyDown: (_view, event) => {\n if (event.key === \"Enter\") {\n if (isMentionListOpen) return false;\n // 보조키를 짚은 Enter는 전송이 아니라 개행 — tiptap 기본 동작에 맡긴다.\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false;\n }\n event.preventDefault();\n if (value.trim() && onSubmit) onSubmit();\n return true;\n }\n if (event.key === \"Escape\") {\n if (isMentionListOpen) return false;\n event.preventDefault();\n onEscape?.();\n return true;\n }\n return false;\n },\n },\n onUpdate: ({ editor }) => {\n onChange(extractContentFromJSON(editor.getJSON()));\n },\n });\n\n useEffect(() => {\n if (editor && !initialContent && value !== editor.getText()) {\n editor.commands.setContent(value);\n }\n }, [value, editor, initialContent]);\n\n useEffect(() => {\n if (editor && autoFocus) {\n requestAnimationFrame(() => {\n editor.commands.focus();\n });\n }\n }, [editor, autoFocus]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n focus: () => {\n editor?.commands.focus();\n },\n }),\n [editor],\n );\n\n return (\n <EditorContent\n ref={editorRef}\n editor={editor}\n className=\"aivex:relative aivex:h-full aivex:w-full\"\n onKeyDown={(e) => e.stopPropagation()}\n />\n );\n}\n\n/** tiptap 문서 → 평문(멘션은 `@[이름](id)`, 줄바꿈은 \\n) 직렬화. */\nfunction extractContentFromJSON(json: JSONContent): string {\n if (!json?.content) return \"\";\n\n const processNode = (node: JSONContent): string => {\n if (node.type === \"mention\" && node.attrs) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n }\n if (node.type === \"text\") return node.text || \"\";\n // Shift+Enter가 넣는 줄바꿈 — 문단 분리(아래 join)와 같은 값으로 편다.\n if (node.type === \"hardBreak\") return \"\\n\";\n if (node.content) return node.content.map(processNode).join(\"\");\n return \"\";\n };\n // 문단마다 한 줄 — 보조키+Enter로 문단이 갈리면 그대로 줄이 나뉜다.\n return json.content.map(processNode).join(\"\\n\");\n}\n","\"use client\";\n\nimport type { JSONContent } from \"@tiptap/react\";\nimport { Avatar } from \"../Avatar\";\nimport { Button } from \"../Button\";\nimport { CloseIcon } from \"../Icon\";\nimport { IconButton } from \"../IconButton\";\nimport MentionInput from \"./MentionInput\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentInputProps {\n /** 작성자(입력행 아바타). */\n user?: CommentUser;\n value: string;\n onChange: (value: string) => void;\n /** 전송(Enter 또는 Send 버튼). 값이 비어 있으면 호출되지 않는다. */\n onSubmit: () => void;\n /** 헤더 닫기 버튼·Esc. */\n onClose?: () => void;\n /** 헤더 타이틀(호스트 i18n). 기본 \"Comment\". */\n title?: string;\n placeholder?: string;\n /** 전송 버튼 라벨(호스트 i18n). 기본 \"Send\". */\n submitLabel?: string;\n /**\n * 전송 버튼 사용 — 켜면 내용이 있을 때만 입력 아래 오른쪽에 나타난다(시안).\n * 끄면 어느 상태에서도 없이 Enter로만 보낸다.\n */\n showSubmit?: boolean;\n /** 전송 중 여부 — 버튼 비활성(스피너 등은 호스트가 submitLabel 자리로). */\n pending?: boolean;\n /** 멘션(@) 후보. 생략하면 멘션 없이 동작. */\n userList?: CommentUser[];\n mentionEmptyText?: string;\n initialContent?: JSONContent;\n className?: string;\n}\n\n/**\n * 새 코멘트 입력 패널 — 옵스 new-editor의 NewCommentPanel 이식(도메인/위치 결합 제거).\n * 코멘트 스레드와 동일한 크롬: 헤더(타이틀+닫기) + 입력행(아바타 · 멘션 입력 · 오른쪽\n * Send 버튼). 화면 배치(핀 오른쪽 등)는 호스트가 감싸는 컨테이너에서 담당한다.\n */\nexport function CommentInput({\n user,\n value,\n onChange,\n onSubmit,\n onClose,\n title = \"Comment\",\n placeholder,\n submitLabel = \"Send\",\n showSubmit = true,\n pending = false,\n userList,\n mentionEmptyText,\n initialContent,\n className,\n}: CommentInputProps) {\n const handleSubmit = () => {\n if (!value.trim() || pending) return;\n onSubmit();\n };\n\n return (\n <div className={`aivex:rounded-2xl aivex:bg-bg-primary aivex:shadow-xl ${className ?? \"\"}`}>\n <div className=\"aivex:flex aivex:w-[360px] aivex:flex-col\">\n <div className=\"aivex:flex aivex:h-12 aivex:items-center aivex:justify-between aivex:border-border-subtle aivex:border-b aivex:px-5 aivex:py-2\">\n <span className=\"aivex:text-body-lg-medium aivex:text-text-primary\">{title}</span>\n <IconButton size=\"sm\" className=\"aivex:text-text-secondary\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n </div>\n <div className=\"aivex:flex aivex:flex-col aivex:px-4 aivex:py-3\">\n <div className=\"aivex:flex aivex:gap-1.5\">\n <div className=\"aivex:h-6 aivex:w-6 aivex:py-1\">\n {user ? (\n <Avatar size=\"sm\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n ) : null}\n </div>\n <div className=\"aivex:min-w-0 aivex:flex-1\">\n <MentionInput\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n onSubmit={handleSubmit}\n onEscape={onClose}\n userList={userList}\n mentionEmptyText={mentionEmptyText}\n initialContent={initialContent}\n />\n </div>\n </div>\n {/* 전송 버튼은 빈 입력에서는 없다 — 내용이 생기면 아래로 밀려 나온다(시안).\n grid-rows 0fr↔1fr은 높이를 모르는 내용도 부드럽게 여닫는다. */}\n {showSubmit ? (\n <div\n className={`aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out ${\n value.trim()\n ? \"aivex:grid-rows-[1fr] aivex:opacity-100\"\n : \"aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0\"\n }`}\n >\n {/* 입력과 버튼 사이 6px(시안) — 접히는 안쪽에 둬야 함께 사라진다. */}\n <div className=\"aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5\">\n <Button\n size=\"md\"\n disabled={!value.trim() || pending}\n onClick={handleSubmit}\n tabIndex={value.trim() ? undefined : -1}\n >\n {submitLabel}\n </Button>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n","\"use client\";\n\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentPinProps {\n /** 스레드 참여자(작성자 우선). 최대 maxAvatars명까지 아바타를 겹쳐 그린다. */\n users: CommentUser[];\n selected?: boolean;\n /** 해결(resolve)된 코멘트 — 반투명 표시. */\n resolved?: boolean;\n onClick?: () => void;\n maxAvatars?: number;\n className?: string;\n}\n\n/**\n * 코멘트 핀(다트) — 옵스 에디터 CommentDart의 말풍선 부분 이식.\n * 좌하단이 뾰족한 말풍선(팁이 코멘트 지점을 가리킴). 위치·스케일 고정은 호스트가\n * ShapeEditor overlayMarkers(anchor \"topLeft\") 등으로 담당한다.\n */\nexport function CommentPin({\n users,\n selected = false,\n resolved = false,\n onClick,\n maxAvatars = 3,\n className,\n}: CommentPinProps) {\n const shown = users.slice(0, maxAvatars);\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={`aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${\n selected\n ? \"aivex:border-border-brand aivex:bg-bg-brand\"\n : \"aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand\"\n } ${resolved ? \"aivex:opacity-40\" : \"\"} ${className ?? \"\"}`}\n >\n {shown.map((user, i) => (\n <span\n key={user.id}\n className=\"aivex:flex\"\n style={i > 0 ? { marginLeft: \"-4px\" } : undefined}\n >\n <Avatar size=\"xs\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n </span>\n ))}\n {users.length > maxAvatars ? (\n <span className=\"aivex:px-1 aivex:text-label-sm aivex:text-text-secondary\">\n +{users.length - maxAvatars}\n </span>\n ) : null}\n </button>\n );\n}\n"],"mappings":"kdA0BE,GAAM,EAAA,EAAA,MAAA,SAAgD,CAAA,QAAA,UAAA,YAAA,oBAAA,OAAA,CAEtD,GAAM,CAAA,EAAA,IACH,EAAA,EAAA,UAAkB,EAAA,CACjB,GAAa,EAAM,EAAA,QAAA,EAAA,CAAA,CACf,GAAc,EAAA,EAAK,aAAA,GAAA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,WACM,4EACkB,EAAI,EAAA,KAAA,EAAA,EAAA,CAC3B,KAAA,KACA,SAAU,CAAA,EAAM,MAAM,EAAG,YAGlB,SAAA,EAAA,MAAA,CAAA,IAAA,GAAA,GACL,SAAA,EACF,CAAA,CAGN,CAAA,SACF,CAAA,CAAA,KCxFR,SACE,EAAA,CAAA,QAAA,WAAA,GAAA,WAAC,GAAD,UAAA,aAAA,EAAA,aAAA,KACE,EAAK,EAAA,MAAA,EAAA,EAAA,QACI,EAAA,EAAA,MAAA,SAAA,CACT,KAAA,6BASI,4JAAU,EAAA,8CAAA,iFAAA,GAAA,EAAA,mBAAA,GAAA,GAAA,GAAA,cACH,CAAA,EAAQ,KAAE,EAAA,KAAuB,EAAA,EAAA,KAAA,OAAA,WAExC,mBAAa,EAAA,EAAA,CAAA,WAAA,OAAA,CAAA,IAAA,aAAe,EAAA,EAAA,KAAA,EAAA,EAAA,CAAW,KAAA,KAAqB,IAAA,EAAM,UAAa,QAAA,EAAA,MAC1E,KALK,EAMZ,KAEM,CAAA,OAAN,CAA2E,CAAA,EACvE,OAAM,GACH,EAAA,EAAA,MAAA,OAAA,WAEF"}
1
+ {"version":3,"file":"comment.cjs","names":[],"sources":["../src/components/Comment/MentionList.tsx","../src/components/Comment/useMentionSuggestion.ts","../src/components/Comment/MentionInput.tsx","../src/components/Comment/CommentInput.tsx","../src/components/Comment/CommentPin.tsx"],"sourcesContent":["\"use client\";\n\nimport { memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface MentionListHandle {\n onKeyDown: (event: KeyboardEvent) => boolean;\n}\n\ninterface MentionListProps {\n items: CommentUser[];\n command: (item: CommentUser) => void;\n /** 후보 없음 문구(호스트 i18n). 기본 \"No results found.\" */\n emptyText?: string;\n ref?: React.Ref<MentionListHandle>;\n}\n\n/** 멘션(@) 자동완성 목록 — 옵스 에디터 MentionList 이식(도메인 결합 제거). */\nconst MentionList = memo(function MentionList({\n items,\n command,\n emptyText = \"No results found.\",\n ref,\n}: MentionListProps) {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const itemRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n const selectItem = useCallback(\n (index: number) => {\n const item = items[index];\n if (item) command(item);\n },\n [items, command],\n );\n\n const moveSelection = useCallback(\n (direction: \"up\" | \"down\") => {\n setSelectedIndex((prev) => {\n const itemCount = items.length;\n if (direction === \"up\") return (prev + itemCount - 1) % itemCount;\n return (prev + 1) % itemCount;\n });\n },\n [items.length],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent): boolean => {\n switch (event.key) {\n case \"ArrowUp\":\n moveSelection(\"up\");\n return true;\n case \"ArrowDown\":\n moveSelection(\"down\");\n return true;\n case \"Enter\":\n selectItem(selectedIndex);\n return true;\n default:\n return false;\n }\n },\n [moveSelection, selectItem, selectedIndex],\n );\n\n useEffect(() => {\n setSelectedIndex(0);\n itemRefs.current = items.map(() => null);\n }, [items]);\n\n useEffect(() => {\n itemRefs.current[selectedIndex]?.scrollIntoView({ behavior: \"smooth\", block: \"nearest\" });\n }, [selectedIndex]);\n\n useImperativeHandle(ref, () => ({ onKeyDown: handleKeyDown }), [handleKeyDown]);\n\n if (!items.length) {\n return (\n <div className=\"aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n <div className=\"aivex:p-2 aivex:text-body-md-regular aivex:text-text-secondary\">\n {emptyText}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n {items.map((item, index) => (\n // 키보드 상호작용은 tiptap 에디터가 MentionListHandle로 위임 처리한다.\n <div\n key={item.id}\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n className={`aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${\n selectedIndex === index ? \"aivex:bg-bg-brand-subtle\" : \"\"\n }`}\n onClick={() => selectItem(index)}\n >\n <Avatar size=\"sm\" src={item.avatarUrl} bgColor={item.color} name={item.name} />\n <div className=\"aivex:flex aivex:max-w-[260px] aivex:flex-col\">\n <div className=\"aivex:truncate aivex:text-label-md aivex:text-text-primary\">\n {item.name}\n </div>\n {item.email ? (\n <div className=\"aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary\">\n {item.email}\n </div>\n ) : null}\n </div>\n </div>\n ))}\n </div>\n );\n});\n\nexport default MentionList;\n","\"use client\";\n\nimport { ReactRenderer } from \"@tiptap/react\";\nimport { useMemo } from \"react\";\nimport tippy, { type Instance as TippyInstance } from \"tippy.js\";\nimport MentionList, { type MentionListHandle } from \"./MentionList\";\nimport type { CommentUser } from \"./types\";\n\n/** tiptap Mention 확장에 꽂는 자동완성 설정 — 옵스 에디터 이식(CommentUser 기반). */\nexport const useMentionSuggestion = (\n userList: CommentUser[],\n onOpenChange?: (isOpen: boolean) => void,\n emptyText?: string,\n) => {\n return useMemo(() => {\n const filterUsers = (query: string) => {\n if (!query) return userList;\n const q = query.toLowerCase();\n return userList.filter(\n (user) =>\n user.name.toLowerCase().includes(q) || (user.email ?? \"\").toLowerCase().includes(q),\n );\n };\n\n const createCommandHandler =\n (originalCommand: (item: { id: string; label: string }) => void) => (item: CommentUser) => {\n originalCommand({ id: item.id, label: item.name });\n };\n\n const createRenderer = () => {\n let component: ReactRenderer<MentionListHandle> | null = null;\n let popup: TippyInstance[] | null = null;\n\n return {\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onStart: (props: Record<string, any>) => {\n component = new ReactRenderer(MentionList, {\n props: {\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n },\n editor: props.editor,\n });\n\n if (!props.clientRect) return;\n\n popup = tippy(\"body\", {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom-start\",\n });\n\n onOpenChange?.(true);\n },\n\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onUpdate(props: Record<string, any>) {\n component?.updateProps({\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n });\n\n if (!props.clientRect) return;\n\n popup?.[0]?.setProps({ getReferenceClientRect: props.clientRect });\n },\n\n onKeyDown(props: { event: KeyboardEvent }) {\n if (props.event.key === \"Escape\") {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].hide();\n onOpenChange?.(false);\n return true;\n }\n return component?.ref?.onKeyDown(props.event) || false;\n },\n\n onExit() {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].destroy();\n component?.destroy();\n popup = null;\n component = null;\n onOpenChange?.(false);\n },\n };\n };\n\n return {\n items: ({ query }: { query: string }) => filterUsers(query),\n render: createRenderer,\n };\n }, [userList, onOpenChange, emptyText]);\n};\n","\"use client\";\n\nimport Mention from \"@tiptap/extension-mention\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport { EditorContent, type JSONContent, mergeAttributes, useEditor } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport { type Ref, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport type { CommentUser } from \"./types\";\nimport { useMentionSuggestion } from \"./useMentionSuggestion\";\n\nexport interface MentionInputHandle {\n /** 입력기에 포커스를 준다(예: 전송 버튼 클릭 후 포커스 유지). */\n focus: () => void;\n}\n\nexport interface MentionInputProps {\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /** Enter(멘션 목록 닫힌 상태) 제출. */\n onSubmit?: () => void;\n /** Esc(멘션 목록 닫힌 상태) 취소. */\n onEscape?: () => void;\n /** 멘션(@) 후보. 빈 배열이면 멘션 없이 플레인 입력처럼 동작한다. */\n userList?: CommentUser[];\n initialContent?: JSONContent;\n /** 멘션 후보 없음 문구(호스트 i18n). */\n mentionEmptyText?: string;\n /** 마운트 시 자동 포커스(기본 true). */\n autoFocus?: boolean;\n /** 명령형 핸들(포커스 제어). */\n handleRef?: Ref<MentionInputHandle>;\n}\n\n/**\n * 멘션(@) 지원 코멘트 입력기 — 옵스 에디터 MentionInput 이식.\n * value는 평문 직렬화(`@[이름](id)`)로 주고받는다.\n */\nexport default function MentionInput({\n value,\n onChange,\n placeholder,\n onSubmit,\n onEscape,\n userList = [],\n initialContent,\n mentionEmptyText,\n autoFocus = true,\n handleRef,\n}: MentionInputProps) {\n const editorRef = useRef<HTMLDivElement>(null);\n const [isMentionListOpen, setIsMentionListOpen] = useState(false);\n const suggestion = useMentionSuggestion(userList, setIsMentionListOpen, mentionEmptyText);\n\n const editor = useEditor({\n extensions: [\n StarterKit,\n Placeholder.configure({\n placeholder,\n emptyEditorClass:\n \"aivex:before:content-[attr(data-placeholder)] aivex:before:text-text-tertiary aivex:before:absolute aivex:before:left-3\",\n }),\n Mention.configure({\n HTMLAttributes: { class: \"aivex:text-text-brand aivex:px-1\" },\n // 멘션이 확정되면 골뱅이는 사라지고 이름만 남는다(시안) — 확정 전\n // 타이핑 중인 \"@검색어\"는 그대로다. 직렬화 형식은 바뀌지 않는다.\n renderHTML({ options, node }) {\n return [\"span\", mergeAttributes(options.HTMLAttributes), `${node.attrs.label}`];\n },\n renderText({ node }) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n },\n deleteTriggerWithBackspace: true,\n suggestion,\n }),\n ],\n content: initialContent || value,\n // SSR 환경(next 등)에서 hydration 불일치 방지.\n immediatelyRender: false,\n editorProps: {\n attributes: {\n // 줄높이 22(내부 p에 강제) + py 8 + 보더 2 = 32px — 옆의 Send 버튼(h-8)과 높이 일치.\n class:\n \"aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]\",\n },\n handleKeyDown: (_view, event) => {\n if (event.key === \"Enter\") {\n if (isMentionListOpen) return false;\n // 보조키를 짚은 Enter는 전송이 아니라 개행 — tiptap 기본 동작에 맡긴다.\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false;\n }\n event.preventDefault();\n if (value.trim() && onSubmit) onSubmit();\n return true;\n }\n if (event.key === \"Escape\") {\n if (isMentionListOpen || !onEscape) return false;\n event.preventDefault();\n onEscape();\n return true;\n }\n return false;\n },\n },\n onUpdate: ({ editor }) => {\n onChange(extractContentFromJSON(editor.getJSON()));\n },\n });\n\n // Radix는 document capture에서 Esc를 받는다. 입력기 내부의 Esc는 그보다\n // 먼저 공개 ProseMirror 키 핸들러로 처리해 멘션/편집 취소가 부모를 닫지 않게 한다.\n useEffect(() => {\n if (!editor || (!isMentionListOpen && !onEscape)) return;\n const view = editor.view;\n const ownerWindow = view.dom.ownerDocument.defaultView;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented) return;\n if (!(event.target instanceof Node) || !view.dom.contains(event.target)) return;\n if (view.someProp(\"handleKeyDown\", (handler) => handler(view, event))) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n ownerWindow?.addEventListener(\"keydown\", onKeyDown, true);\n return () => ownerWindow?.removeEventListener(\"keydown\", onKeyDown, true);\n }, [editor, isMentionListOpen, onEscape]);\n\n useEffect(() => {\n if (editor && !initialContent && value !== editor.getText()) {\n editor.commands.setContent(value);\n }\n }, [value, editor, initialContent]);\n\n useEffect(() => {\n if (editor && autoFocus) {\n requestAnimationFrame(() => {\n editor.commands.focus();\n });\n }\n }, [editor, autoFocus]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n focus: () => {\n editor?.commands.focus();\n },\n }),\n [editor],\n );\n\n return (\n <EditorContent\n ref={editorRef}\n editor={editor}\n className=\"aivex:relative aivex:h-full aivex:w-full\"\n onKeyDown={(e) => e.stopPropagation()}\n />\n );\n}\n\n/** tiptap 문서 → 평문(멘션은 `@[이름](id)`, 줄바꿈은 \\n) 직렬화. */\nfunction extractContentFromJSON(json: JSONContent): string {\n if (!json?.content) return \"\";\n\n const processNode = (node: JSONContent): string => {\n if (node.type === \"mention\" && node.attrs) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n }\n if (node.type === \"text\") return node.text || \"\";\n // Shift+Enter가 넣는 줄바꿈 — 문단 분리(아래 join)와 같은 값으로 편다.\n if (node.type === \"hardBreak\") return \"\\n\";\n if (node.content) return node.content.map(processNode).join(\"\");\n return \"\";\n };\n // 문단마다 한 줄 — 보조키+Enter로 문단이 갈리면 그대로 줄이 나뉜다.\n return json.content.map(processNode).join(\"\\n\");\n}\n","\"use client\";\n\nimport type { JSONContent } from \"@tiptap/react\";\nimport { Avatar } from \"../Avatar\";\nimport { Button } from \"../Button\";\nimport { CloseIcon } from \"../Icon\";\nimport { IconButton } from \"../IconButton\";\nimport MentionInput from \"./MentionInput\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentInputProps {\n /** 작성자(입력행 아바타). */\n user?: CommentUser;\n value: string;\n onChange: (value: string) => void;\n /** 전송(Enter 또는 Send 버튼). 값이 비어 있으면 호출되지 않는다. */\n onSubmit: () => void;\n /** 헤더 닫기 버튼·Esc. */\n onClose?: () => void;\n /** 헤더 타이틀(호스트 i18n). 기본 \"Comment\". */\n title?: string;\n placeholder?: string;\n /** 전송 버튼 라벨(호스트 i18n). 기본 \"Send\". */\n submitLabel?: string;\n /**\n * 전송 버튼 사용 — 켜면 내용이 있을 때만 입력 아래 오른쪽에 나타난다(시안).\n * 끄면 어느 상태에서도 없이 Enter로만 보낸다.\n */\n showSubmit?: boolean;\n /** 전송 중 여부 — 버튼 비활성(스피너 등은 호스트가 submitLabel 자리로). */\n pending?: boolean;\n /** 멘션(@) 후보. 생략하면 멘션 없이 동작. */\n userList?: CommentUser[];\n mentionEmptyText?: string;\n initialContent?: JSONContent;\n className?: string;\n}\n\n/**\n * 새 코멘트 입력 패널 — 옵스 new-editor의 NewCommentPanel 이식(도메인/위치 결합 제거).\n * 코멘트 스레드와 동일한 크롬: 헤더(타이틀+닫기) + 입력행(아바타 · 멘션 입력 · 오른쪽\n * Send 버튼). 화면 배치(핀 오른쪽 등)는 호스트가 감싸는 컨테이너에서 담당한다.\n */\nexport function CommentInput({\n user,\n value,\n onChange,\n onSubmit,\n onClose,\n title = \"Comment\",\n placeholder,\n submitLabel = \"Send\",\n showSubmit = true,\n pending = false,\n userList,\n mentionEmptyText,\n initialContent,\n className,\n}: CommentInputProps) {\n const handleSubmit = () => {\n if (!value.trim() || pending) return;\n onSubmit();\n };\n\n return (\n <div className={`aivex:rounded-2xl aivex:bg-bg-primary aivex:shadow-xl ${className ?? \"\"}`}>\n <div className=\"aivex:flex aivex:w-[360px] aivex:flex-col\">\n <div className=\"aivex:flex aivex:h-12 aivex:items-center aivex:justify-between aivex:border-border-subtle aivex:border-b aivex:px-5 aivex:py-2\">\n <span className=\"aivex:text-body-lg-medium aivex:text-text-primary\">{title}</span>\n <IconButton size=\"sm\" className=\"aivex:text-text-secondary\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n </div>\n <div className=\"aivex:flex aivex:flex-col aivex:px-4 aivex:py-3\">\n <div className=\"aivex:flex aivex:gap-1.5\">\n <div className=\"aivex:h-6 aivex:w-6 aivex:py-1\">\n {user ? (\n <Avatar size=\"sm\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n ) : null}\n </div>\n <div className=\"aivex:min-w-0 aivex:flex-1\">\n <MentionInput\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n onSubmit={handleSubmit}\n onEscape={onClose}\n userList={userList}\n mentionEmptyText={mentionEmptyText}\n initialContent={initialContent}\n />\n </div>\n </div>\n {/* 전송 버튼은 빈 입력에서는 없다 — 내용이 생기면 아래로 밀려 나온다(시안).\n grid-rows 0fr↔1fr은 높이를 모르는 내용도 부드럽게 여닫는다. */}\n {showSubmit ? (\n <div\n className={`aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out ${\n value.trim()\n ? \"aivex:grid-rows-[1fr] aivex:opacity-100\"\n : \"aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0\"\n }`}\n >\n {/* 입력과 버튼 사이 6px(시안) — 접히는 안쪽에 둬야 함께 사라진다. */}\n <div className=\"aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5\">\n <Button\n size=\"md\"\n disabled={!value.trim() || pending}\n onClick={handleSubmit}\n tabIndex={value.trim() ? undefined : -1}\n >\n {submitLabel}\n </Button>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n","\"use client\";\n\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentPinProps {\n /** 스레드 참여자(작성자 우선). 최대 maxAvatars명까지 아바타를 겹쳐 그린다. */\n users: CommentUser[];\n selected?: boolean;\n /** 해결(resolve)된 코멘트 — 반투명 표시. */\n resolved?: boolean;\n onClick?: () => void;\n maxAvatars?: number;\n className?: string;\n}\n\n/**\n * 코멘트 핀(다트) — 옵스 에디터 CommentDart의 말풍선 부분 이식.\n * 좌하단이 뾰족한 말풍선(팁이 코멘트 지점을 가리킴). 위치·스케일 고정은 호스트가\n * ShapeEditor overlayMarkers(anchor \"topLeft\") 등으로 담당한다.\n */\nexport function CommentPin({\n users,\n selected = false,\n resolved = false,\n onClick,\n maxAvatars = 3,\n className,\n}: CommentPinProps) {\n const shown = users.slice(0, maxAvatars);\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={`aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${\n selected\n ? \"aivex:border-border-brand aivex:bg-bg-brand\"\n : \"aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand\"\n } ${resolved ? \"aivex:opacity-40\" : \"\"} ${className ?? \"\"}`}\n >\n {shown.map((user, i) => (\n <span\n key={user.id}\n className=\"aivex:flex\"\n style={i > 0 ? { marginLeft: \"-4px\" } : undefined}\n >\n <Avatar size=\"xs\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n </span>\n ))}\n {users.length > maxAvatars ? (\n <span className=\"aivex:px-1 aivex:text-label-sm aivex:text-text-secondary\">\n +{users.length - maxAvatars}\n </span>\n ) : null}\n </button>\n );\n}\n"],"mappings":"kdA0BE,GAAM,EAAA,EAAA,MAAA,SAAgD,CAAA,QAAA,UAAA,YAAA,oBAAA,OAAA,CAEtD,GAAM,CAAA,EAAA,IACH,EAAA,EAAA,UAAkB,EAAA,CACjB,GAAa,EAAM,EAAA,QAAA,EAAA,CAAA,CACf,GAAc,EAAA,EAAK,aAAA,GAAA,KAExB,EAAO,EACT,GAED,GAAM,EAAA,EAAA,EAEF,CAAA,EAAA,EAAkB,CAAA,CAChB,GAAkB,EAAM,EAAA,aAAA,GAAA,CACxB,EAAI,GAAoB,CACxB,IAAA,EAAe,EAAK,cACpB,IAAA,MAAA,EAAA,EAAA,GAAA,GAEG,EAAO,GACf,GAED,EAEI,CAAA,EAAQ,OAAM,CAAA,CACZ,GAAK,EAAA,EAAA,aAAA,GAAA,CACH,OAAA,EAAA,IAAA,CACA,IAAA,UAEA,OADF,EAAK,KAAA,CACH,GACA,IAAA,YAEA,OADF,EAAK,OAAA,CACH,GACA,IAAA,eACF,EACE,EAAO,YAGb,MAAA,KAAgB,CAAY,EAAc,EAG5C,EACE,CAAA,QACA,EAAA,EAAS,eAAgB,GAChB,EAAA,CAEX,EAAA,QAAA,EAAA,QAAgB,KAAA,EACd,CAAA,EAAS,CAAA,IAAyC,EAAA,eAAU,GAAiB,QAAA,IAAA,eAAA,CAAW,SAAC,eACvF,UAEJ,CAAA,EAEA,CAAI,EACF,CAAA,EACO,EAAA,EAAA,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D,UAAA,aAAA,EAAA,aAAA,KACE,EAAK,EAAA,MAAA,EAAA,EAAA,QACI,EAAA,EAAA,MAAA,SAAA,CACT,KAAA,6BASI,4JAAU,EAAA,8CAAA,iFAAA,GAAA,EAAA,mBAAA,GAAA,GAAA,GAAA,cACH,CAAA,EAAQ,KAAE,EAAA,KAAuB,EAAA,EAAA,KAAA,OAAA,WAExC,mBAAa,EAAA,EAAA,CAAA,WAAA,OAAA,CAAA,IAAA,aAAe,EAAA,EAAA,KAAA,EAAA,EAAA,CAAW,KAAA,KAAqB,IAAA,EAAM,UAAa,QAAA,EAAA,MAC1E,KALK,EAMZ,KAEM,CAAA,OAAN,CAA2E,CAAA,EACvE,OAAM,GACH,EAAA,EAAA,MAAA,OAAA,WAEF"}
package/dist/comment.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "./styles.css";
3
- import { t as e, xt as t } from "./Button-DLfTdKpW.js";
4
- import { r as n, t as r } from "./IconButton-CQG1Pw51.js";
3
+ import { r as e, t } from "./IconButton-DusjiWye.js";
4
+ import { t as n, xt as r } from "./Button-CuvXiYtX.js";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  import { memo as o, useCallback as s, useEffect as c, useImperativeHandle as l, useMemo as u, useRef as d, useState as f } from "react";
7
7
  import p from "@tiptap/extension-mention";
@@ -10,16 +10,16 @@ import { EditorContent as h, ReactRenderer as g, mergeAttributes as _, useEditor
10
10
  import y from "@tiptap/starter-kit";
11
11
  import b from "tippy.js";
12
12
  //#region src/components/Comment/MentionList.tsx
13
- var x = o(function({ items: e, command: t, emptyText: r = "No results found.", ref: o }) {
14
- let [u, p] = f(0), m = d([]), h = s((n) => {
15
- let r = e[n];
16
- r && t(r);
17
- }, [e, t]), g = s((t) => {
13
+ var x = o(function({ items: t, command: n, emptyText: r = "No results found.", ref: o }) {
14
+ let [u, p] = f(0), m = d([]), h = s((e) => {
15
+ let r = t[e];
16
+ r && n(r);
17
+ }, [t, n]), g = s((e) => {
18
18
  p((n) => {
19
- let r = e.length;
20
- return t === "up" ? (n + r - 1) % r : (n + 1) % r;
19
+ let r = t.length;
20
+ return e === "up" ? (n + r - 1) % r : (n + 1) % r;
21
21
  });
22
- }, [e.length]), _ = s((e) => {
22
+ }, [t.length]), _ = s((e) => {
23
23
  switch (e.key) {
24
24
  case "ArrowUp": return g("up"), !0;
25
25
  case "ArrowDown": return g("down"), !0;
@@ -32,36 +32,36 @@ var x = o(function({ items: e, command: t, emptyText: r = "No results found.", r
32
32
  u
33
33
  ]);
34
34
  return c(() => {
35
- p(0), m.current = e.map(() => null);
36
- }, [e]), c(() => {
35
+ p(0), m.current = t.map(() => null);
36
+ }, [t]), c(() => {
37
37
  m.current[u]?.scrollIntoView({
38
38
  behavior: "smooth",
39
39
  block: "nearest"
40
40
  });
41
- }, [u]), l(o, () => ({ onKeyDown: _ }), [_]), e.length ? /* @__PURE__ */ i("div", {
41
+ }, [u]), l(o, () => ({ onKeyDown: _ }), [_]), t.length ? /* @__PURE__ */ i("div", {
42
42
  className: "aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl",
43
- children: e.map((e, t) => /* @__PURE__ */ a("div", {
43
+ children: t.map((t, n) => /* @__PURE__ */ a("div", {
44
44
  ref: (e) => {
45
- m.current[t] = e;
45
+ m.current[n] = e;
46
46
  },
47
- className: `aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${u === t ? "aivex:bg-bg-brand-subtle" : ""}`,
48
- onClick: () => h(t),
49
- children: [/* @__PURE__ */ i(n, {
47
+ className: `aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${u === n ? "aivex:bg-bg-brand-subtle" : ""}`,
48
+ onClick: () => h(n),
49
+ children: [/* @__PURE__ */ i(e, {
50
50
  size: "sm",
51
- src: e.avatarUrl,
52
- bgColor: e.color,
53
- name: e.name
51
+ src: t.avatarUrl,
52
+ bgColor: t.color,
53
+ name: t.name
54
54
  }), /* @__PURE__ */ a("div", {
55
55
  className: "aivex:flex aivex:max-w-[260px] aivex:flex-col",
56
56
  children: [/* @__PURE__ */ i("div", {
57
57
  className: "aivex:truncate aivex:text-label-md aivex:text-text-primary",
58
- children: e.name
59
- }), e.email ? /* @__PURE__ */ i("div", {
58
+ children: t.name
59
+ }), t.email ? /* @__PURE__ */ i("div", {
60
60
  className: "aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary",
61
- children: e.email
61
+ children: t.email
62
62
  }) : null]
63
63
  })]
64
- }, e.id))
64
+ }, t.id))
65
65
  }) : /* @__PURE__ */ i("div", {
66
66
  className: "aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl",
67
67
  children: /* @__PURE__ */ i("div", {
@@ -154,13 +154,23 @@ function C({ value: e, onChange: t, placeholder: n, onSubmit: r, onEscape: a, us
154
154
  immediatelyRender: !1,
155
155
  editorProps: {
156
156
  attributes: { class: "aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]" },
157
- handleKeyDown: (t, n) => n.key === "Enter" ? C || n.shiftKey || n.metaKey || n.ctrlKey || n.altKey ? !1 : (n.preventDefault(), e.trim() && r && r(), !0) : n.key === "Escape" ? C ? !1 : (n.preventDefault(), a?.(), !0) : !1
157
+ handleKeyDown: (t, n) => n.key === "Enter" ? C || n.shiftKey || n.metaKey || n.ctrlKey || n.altKey ? !1 : (n.preventDefault(), e.trim() && r && r(), !0) : n.key === "Escape" ? C || !a ? !1 : (n.preventDefault(), a(), !0) : !1
158
158
  },
159
159
  onUpdate: ({ editor: e }) => {
160
160
  t(w(e.getJSON()));
161
161
  }
162
162
  });
163
163
  return c(() => {
164
+ if (!D || !C && !a) return;
165
+ let e = D.view, t = e.dom.ownerDocument.defaultView, n = (t) => {
166
+ t.key !== "Escape" || t.defaultPrevented || !(t.target instanceof Node) || !e.dom.contains(t.target) || e.someProp("handleKeyDown", (n) => n(e, t)) && (t.preventDefault(), t.stopPropagation());
167
+ };
168
+ return t?.addEventListener("keydown", n, !0), () => t?.removeEventListener("keydown", n, !0);
169
+ }, [
170
+ D,
171
+ C,
172
+ a
173
+ ]), c(() => {
164
174
  D && !s && e !== D.getText() && D.commands.setContent(e);
165
175
  }, [
166
176
  e,
@@ -199,11 +209,11 @@ function T({ user: o, value: s, onChange: c, onSubmit: l, onClose: u, title: d =
199
209
  children: [/* @__PURE__ */ i("span", {
200
210
  className: "aivex:text-body-lg-medium aivex:text-text-primary",
201
211
  children: d
202
- }), /* @__PURE__ */ i(r, {
212
+ }), /* @__PURE__ */ i(t, {
203
213
  size: "sm",
204
214
  className: "aivex:text-text-secondary",
205
215
  onClick: u,
206
- children: /* @__PURE__ */ i(t, { size: 20 })
216
+ children: /* @__PURE__ */ i(r, { size: 20 })
207
217
  })]
208
218
  }), /* @__PURE__ */ a("div", {
209
219
  className: "aivex:flex aivex:flex-col aivex:px-4 aivex:py-3",
@@ -211,7 +221,7 @@ function T({ user: o, value: s, onChange: c, onSubmit: l, onClose: u, title: d =
211
221
  className: "aivex:flex aivex:gap-1.5",
212
222
  children: [/* @__PURE__ */ i("div", {
213
223
  className: "aivex:h-6 aivex:w-6 aivex:py-1",
214
- children: o ? /* @__PURE__ */ i(n, {
224
+ children: o ? /* @__PURE__ */ i(e, {
215
225
  size: "sm",
216
226
  src: o.avatarUrl,
217
227
  bgColor: o.color,
@@ -234,7 +244,7 @@ function T({ user: o, value: s, onChange: c, onSubmit: l, onClose: u, title: d =
234
244
  className: `aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out ${s.trim() ? "aivex:grid-rows-[1fr] aivex:opacity-100" : "aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0"}`,
235
245
  children: /* @__PURE__ */ i("div", {
236
246
  className: "aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5",
237
- children: /* @__PURE__ */ i(e, {
247
+ children: /* @__PURE__ */ i(n, {
238
248
  size: "md",
239
249
  disabled: !s.trim() || h,
240
250
  onClick: b,
@@ -249,24 +259,24 @@ function T({ user: o, value: s, onChange: c, onSubmit: l, onClose: u, title: d =
249
259
  }
250
260
  //#endregion
251
261
  //#region src/components/Comment/CommentPin.tsx
252
- function E({ users: e, selected: t = !1, resolved: r = !1, onClick: o, maxAvatars: s = 3, className: c }) {
253
- let l = e.slice(0, s);
262
+ function E({ users: t, selected: n = !1, resolved: r = !1, onClick: o, maxAvatars: s = 3, className: c }) {
263
+ let l = t.slice(0, s);
254
264
  return /* @__PURE__ */ a("button", {
255
265
  type: "button",
256
266
  onClick: o,
257
- className: `aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${t ? "aivex:border-border-brand aivex:bg-bg-brand" : "aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand"} ${r ? "aivex:opacity-40" : ""} ${c ?? ""}`,
258
- children: [l.map((e, t) => /* @__PURE__ */ i("span", {
267
+ className: `aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${n ? "aivex:border-border-brand aivex:bg-bg-brand" : "aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand"} ${r ? "aivex:opacity-40" : ""} ${c ?? ""}`,
268
+ children: [l.map((t, n) => /* @__PURE__ */ i("span", {
259
269
  className: "aivex:flex",
260
- style: t > 0 ? { marginLeft: "-4px" } : void 0,
261
- children: /* @__PURE__ */ i(n, {
270
+ style: n > 0 ? { marginLeft: "-4px" } : void 0,
271
+ children: /* @__PURE__ */ i(e, {
262
272
  size: "xs",
263
- src: e.avatarUrl,
264
- bgColor: e.color,
265
- name: e.name
273
+ src: t.avatarUrl,
274
+ bgColor: t.color,
275
+ name: t.name
266
276
  })
267
- }, e.id)), e.length > s ? /* @__PURE__ */ a("span", {
277
+ }, t.id)), t.length > s ? /* @__PURE__ */ a("span", {
268
278
  className: "aivex:px-1 aivex:text-label-sm aivex:text-text-secondary",
269
- children: ["+", e.length - s]
279
+ children: ["+", t.length - s]
270
280
  }) : null]
271
281
  });
272
282
  }