@t3q-ui/design-system 1.62.0 → 1.63.1

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 (41) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +21 -0
  3. package/dist/chunk-DWF6AFPQ.js +409 -0
  4. package/dist/chunk-DWF6AFPQ.js.map +1 -0
  5. package/dist/{chunk-B7EVWGOO.cjs → chunk-ESAMXUUJ.cjs} +2264 -1129
  6. package/dist/chunk-ESAMXUUJ.cjs.map +1 -0
  7. package/dist/{chunk-RWXQIS6W.js → chunk-GZZXYYDY.js} +2182 -1049
  8. package/dist/chunk-GZZXYYDY.js.map +1 -0
  9. package/dist/chunk-OQOBPYZT.cjs +443 -0
  10. package/dist/chunk-OQOBPYZT.cjs.map +1 -0
  11. package/dist/{index-49sVdPlX.d.cts → index-DoIChamr.d.cts} +177 -1
  12. package/dist/{index-49sVdPlX.d.ts → index-DoIChamr.d.ts} +177 -1
  13. package/dist/index.cjs +1146 -1799
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.css +12 -0
  16. package/dist/index.css.map +1 -1
  17. package/dist/index.d.cts +54 -7
  18. package/dist/index.d.ts +54 -7
  19. package/dist/index.js +584 -1264
  20. package/dist/index.js.map +1 -1
  21. package/dist/markdown/index.cjs +441 -0
  22. package/dist/markdown/index.cjs.map +1 -0
  23. package/dist/markdown/index.d.cts +24 -0
  24. package/dist/markdown/index.d.ts +24 -0
  25. package/dist/markdown/index.js +434 -0
  26. package/dist/markdown/index.js.map +1 -0
  27. package/dist/patterns/index.cjs +586 -69
  28. package/dist/patterns/index.cjs.map +1 -1
  29. package/dist/patterns/index.d.cts +119 -2
  30. package/dist/patterns/index.d.ts +119 -2
  31. package/dist/patterns/index.js +520 -5
  32. package/dist/patterns/index.js.map +1 -1
  33. package/dist/styles.css +23 -0
  34. package/mcp/manifests/components.json +2620 -68
  35. package/package.json +20 -3
  36. package/skills/tds/SKILL.md +7 -3
  37. package/skills/tds/examples/chat-page.tsx +313 -0
  38. package/skills/tds/reference/components.md +239 -12
  39. package/skills/tds/rules.md +3 -2
  40. package/dist/chunk-B7EVWGOO.cjs.map +0 -1
  41. package/dist/chunk-RWXQIS6W.js.map +0 -1
@@ -1,59 +1,25 @@
1
- import { clsx } from 'clsx';
2
- import { extendTailwindMerge } from 'tailwind-merge';
1
+ import { cn, IconButton, distributeColumnWidths, useCopy } from './chunk-DWF6AFPQ.js';
3
2
  import { cva } from 'class-variance-authority';
4
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import * as React12 from 'react';
4
+ import * as React10 from 'react';
6
5
  import { forwardRef, createContext, useMemo, useContext, useState, useEffect, useRef, useCallback } from 'react';
7
6
  import LottieImport from 'react-lottie';
8
7
  import { Slot, Slottable } from '@radix-ui/react-slot';
9
8
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
10
9
  import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
11
10
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
12
- import * as DialogPrimitive from '@radix-ui/react-dialog';
13
- import * as lucide from 'lucide-react';
14
- import { X, Info, TriangleAlert, Check, CircleX, CircleCheck, ChevronRightIcon, ChevronsLeft, ChevronLeft, ChevronsRight, ChevronRight } from 'lucide-react';
15
- import * as SeparatorPrimitive from '@radix-ui/react-separator';
16
11
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
12
+ import * as lucide from 'lucide-react';
13
+ import { Info, TriangleAlert, Check, Paperclip, Plus, ArrowUp, X, CircleX, CircleCheck, ChevronRightIcon, Search, CircleAlert, SearchX, MessagesSquare, RefreshCw, ThumbsUp, ThumbsDown, ChevronsLeft, ChevronLeft, ChevronsRight, ChevronRight, Ellipsis, Copy } from 'lucide-react';
17
14
  import { useFormContext, FormProvider, Controller } from 'react-hook-form';
15
+ import TextareaAutosize from 'react-textarea-autosize';
16
+ import { isValid, differenceInCalendarDays } from 'date-fns';
17
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
18
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
18
19
  import * as TabsPrimitive from '@radix-ui/react-tabs';
19
20
  import { ModuleRegistry, AllCommunityModule, ClientSideRowModelModule, themeQuartz } from 'ag-grid-community';
20
21
  import { AgGridReact } from 'ag-grid-react';
21
22
 
22
- function cn(...inputs) {
23
- return twMerge(clsx(inputs));
24
- }
25
- var fontSize = [
26
- "h1",
27
- "h2",
28
- "h3",
29
- "h4",
30
- "h5",
31
- "h6",
32
- "base-semibold",
33
- "base-medium",
34
- "base-regular",
35
- "large-medium",
36
- "large-semibold",
37
- "small-bold-h",
38
- "small-medium-h",
39
- "small-regular-h",
40
- "small-bold",
41
- "small-medium",
42
- "small-regular",
43
- "xsmall-bold",
44
- "xsmall-medium",
45
- "xsmall-regular"
46
- ];
47
- var borderRadius = ["none", "xsmall", "small", "medium", "large", "xlarge", "full"];
48
- var twMerge = extendTailwindMerge({
49
- extend: {
50
- classGroups: {
51
- "font-size": fontSize.map((item) => "text-" + item),
52
- "border-radius": borderRadius.map((item) => "rounded-" + item)
53
- }
54
- }
55
- });
56
-
57
23
  // src/utils/sanitizeUserText.ts
58
24
  function sanitizeUserText(node) {
59
25
  if (typeof node === "string") return node.replace(/[\r\n]+/g, " ");
@@ -1006,12 +972,6 @@ var sizeVariants = {
1006
972
  large: 48,
1007
973
  xlarge: 96
1008
974
  };
1009
- var dotSizeVariants = {
1010
- small: "w-[8px] h-[8px]",
1011
- medium: "w-[12px] h-[12px]",
1012
- large: "w-[24px] h-[24px]",
1013
- xlarge: "w-[48px] h-[48px]"
1014
- };
1015
975
  var spinnerVariants = cva("tds-spinner [&_path]:fill-current", {
1016
976
  variants: {
1017
977
  variant: {
@@ -1041,12 +1001,12 @@ function Spinner({
1041
1001
  shape = "spinner",
1042
1002
  ...props
1043
1003
  }) {
1004
+ const px = typeof size === "number" ? size : sizeVariants[size];
1044
1005
  const lottieWrapperRef = useRef(null);
1045
1006
  useEffect(() => {
1046
1007
  lottieWrapperRef.current?.querySelector("[tabindex]")?.setAttribute("tabindex", "-1");
1047
1008
  });
1048
1009
  if (shape === "dot") {
1049
- const px = sizeVariants[size];
1050
1010
  return /* @__PURE__ */ jsx(
1051
1011
  "div",
1052
1012
  {
@@ -1061,7 +1021,8 @@ function Spinner({
1061
1021
  "span",
1062
1022
  {
1063
1023
  "aria-hidden": true,
1064
- className: cn("rounded-full bg-current animate-pulse", dotSizeVariants[size])
1024
+ className: "rounded-full bg-current animate-pulse",
1025
+ style: { width: px / 2, height: px / 2 }
1065
1026
  }
1066
1027
  )
1067
1028
  }
@@ -1076,8 +1037,8 @@ function Spinner({
1076
1037
  children: /* @__PURE__ */ jsx(
1077
1038
  Lottie,
1078
1039
  {
1079
- height: sizeVariants[size],
1080
- width: sizeVariants[size],
1040
+ height: px,
1041
+ width: px,
1081
1042
  ariaRole: "presentation",
1082
1043
  ariaLabel: "",
1083
1044
  isClickToPauseDisabled: true,
@@ -1192,7 +1153,7 @@ var buttonVariants = cva(
1192
1153
  defaultVariants: defaultButtonVariants
1193
1154
  }
1194
1155
  );
1195
- var Button = React12.forwardRef(
1156
+ var Button = React10.forwardRef(
1196
1157
  ({
1197
1158
  className,
1198
1159
  variant,
@@ -1207,11 +1168,11 @@ var Button = React12.forwardRef(
1207
1168
  }, ref) => {
1208
1169
  const Comp = asChild ? Slot : "button";
1209
1170
  const resolvedWeightClass = buttonWeightVariants[weight ?? defaultButtonVariants.weight];
1210
- const slotChild = asChild && React12.isValidElement(children) ? children : null;
1171
+ const slotChild = asChild && React10.isValidElement(children) ? children : null;
1211
1172
  const labelSource = slotChild ? slotChild.props.children : children;
1212
- const processedChildren = React12.useMemo(() => {
1213
- const flatten = (nodes) => React12.Children.toArray(nodes).flatMap(
1214
- (child) => React12.isValidElement(child) && child.type === React12.Fragment ? flatten(child.props.children) : [child]
1173
+ const processedChildren = React10.useMemo(() => {
1174
+ const flatten = (nodes) => React10.Children.toArray(nodes).flatMap(
1175
+ (child) => React10.isValidElement(child) && child.type === React10.Fragment ? flatten(child.props.children) : [child]
1215
1176
  );
1216
1177
  const childrenArray = flatten(labelSource);
1217
1178
  const result = [];
@@ -1258,7 +1219,7 @@ var Button = React12.forwardRef(
1258
1219
  size: "medium"
1259
1220
  }
1260
1221
  ) }),
1261
- /* @__PURE__ */ jsx(Slottable, { children: slotChild ? React12.cloneElement(slotChild, void 0, processedChildren) : asChild ? children : processedChildren })
1222
+ /* @__PURE__ */ jsx(Slottable, { children: slotChild ? React10.cloneElement(slotChild, void 0, processedChildren) : asChild ? children : processedChildren })
1262
1223
  ]
1263
1224
  }
1264
1225
  );
@@ -1385,7 +1346,7 @@ var badgeVariants = cva(
1385
1346
  }
1386
1347
  );
1387
1348
  function Badge({ className, variant, rounded, appearance, size, children, ...props }) {
1388
- const wrappedChildren = React12.Children.map(children, (child) => {
1349
+ const wrappedChildren = React10.Children.map(children, (child) => {
1389
1350
  if (typeof child === "string" || typeof child === "number") {
1390
1351
  return /* @__PURE__ */ jsx("span", { className: "px-[3px]", children: child });
1391
1352
  }
@@ -1402,9 +1363,9 @@ function Badge({ className, variant, rounded, appearance, size, children, ...pro
1402
1363
  }
1403
1364
  var TooltipProvider = TooltipPrimitive.Provider;
1404
1365
  var Tooltip = TooltipPrimitive.Root;
1405
- var TooltipTrigger = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { type: "button", ref, className: cn(className), ...props }));
1366
+ var TooltipTrigger = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { type: "button", ref, className: cn(className), ...props }));
1406
1367
  TooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName;
1407
- var TooltipContent = React12.forwardRef(({ className, sideOffset = 4, children, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1368
+ var TooltipContent = React10.forwardRef(({ className, sideOffset = 4, children, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1408
1369
  TooltipPrimitive.Content,
1409
1370
  {
1410
1371
  ref,
@@ -1418,7 +1379,7 @@ var TooltipContent = React12.forwardRef(({ className, sideOffset = 4, children,
1418
1379
  }
1419
1380
  ) }));
1420
1381
  TooltipContent.displayName = TooltipPrimitive.Content.displayName;
1421
- var ToggleGroupContext = React12.createContext({
1382
+ var ToggleGroupContext = React10.createContext({
1422
1383
  variant: "default",
1423
1384
  spacing: false
1424
1385
  });
@@ -1447,7 +1408,7 @@ function ToggleGroupItem({
1447
1408
  className,
1448
1409
  ...props
1449
1410
  }) {
1450
- const { variant, spacing } = React12.useContext(ToggleGroupContext);
1411
+ const { variant, spacing } = React10.useContext(ToggleGroupContext);
1451
1412
  const shapeClass = variant === "outline" && !spacing ? "rounded-none first:rounded-l-small last:rounded-r-small" : variant === "outline" && spacing ? "rounded-small border border-secondary30" : "rounded-small";
1452
1413
  const focusClass = variant === "outline" && !spacing ? "focus-visible:relative focus-visible:z-10 focus-visible:outline-[2px] focus-visible:outline-sys-focus-ring-main focus-visible:outline-offset-[2px]" : "focus-visible:outline-[2px] focus-visible:outline-sys-focus-ring-main focus-visible:outline-offset-[1px]";
1453
1414
  return /* @__PURE__ */ jsxs(
@@ -1474,56 +1435,6 @@ function ToggleGroupItem({
1474
1435
  }
1475
1436
  );
1476
1437
  }
1477
- var iconButtonVariants = cva(
1478
- "inline-flex items-center justify-center h-fit whitespace-nowrap text-h6 transition-colors hover:cursor-pointer disabled:pointer-events-none disabled:text-sys-button-disabled-text disabled:bg-sys-button-disabled-background",
1479
- {
1480
- variants: {
1481
- variant: {
1482
- primary: "bg-sys-button-primary-subtle-background text-sys-button-primary-subtle-text hover:bg-sys-button-primary-subtle-background-hover active:bg-sys-button-primary-subtle-background-press",
1483
- primaryBold: "bg-sys-button-primary-background text-sys-button-primary-text hover:bg-sys-button-primary-background-hover active:bg-sys-button-primary-background-press",
1484
- primaryLink: "text-sys-button-primary-link-text hover:text-sys-button-primary-link-text-hover active:text-sys-button-primary-link-text-press",
1485
- danger: "bg-sys-button-danger-subtle-background text-sys-button-danger-subtle-text hover:bg-sys-button-danger-subtle-background-hover active:bg-sys-button-danger-subtle-background-press",
1486
- dangerBold: "bg-sys-button-danger-background text-sys-button-danger-text hover:bg-sys-button-danger-background-hover active:bg-sys-button-danger-background-press",
1487
- dangerLink: "text-sys-button-danger-link-text hover:text-sys-button-danger-link-text-hover active:text-sys-button-danger-link-text-press",
1488
- secondary: "bg-sys-button-secondary-subtle-background text-sys-button-secondary-subtle-text hover:bg-sys-button-secondary-subtle-background-hover active:bg-sys-button-secondary-subtle-background-press",
1489
- secondaryBold: "bg-sys-button-secondary-background text-sys-button-secondary-text hover:bg-sys-button-secondary-background-hover active:bg-sys-button-secondary-background-press",
1490
- secondaryLink: "text-sys-button-secondary-link-text hover:text-sys-button-secondary-link-text-hover active:text-sys-button-secondary-link-text-press",
1491
- warning: "bg-sys-button-warning-subtle-background text-sys-button-warning-subtle-text hover:bg-sys-button-warning-subtle-background-hover active:bg-sys-button-warning-subtle-background-press",
1492
- warningBold: "bg-sys-button-warning-background text-sys-button-warning-text hover:bg-sys-button-warning-background-hover active:bg-sys-button-warning-background-press",
1493
- warningLink: "text-sys-button-warning-link-text hover:text-sys-button-warning-link-text-hover active:text-sys-button-warning-link-text-press",
1494
- outline: "border border-secondary30 text-sys-text-subtler text-base-medium"
1495
- },
1496
- spacing: {
1497
- normal: "p-[6px]",
1498
- compact: "p-[2px] max-h-[28px] max-w-[28px]"
1499
- },
1500
- shape: {
1501
- normal: "rounded-small",
1502
- rounded: "rounded-full"
1503
- }
1504
- },
1505
- defaultVariants: {
1506
- variant: "primary",
1507
- shape: "normal",
1508
- spacing: "normal"
1509
- }
1510
- }
1511
- );
1512
- var IconButton = React12.forwardRef(
1513
- ({ className, variant, shape, spacing, asChild = false, type, ...props }, ref) => {
1514
- const Comp = asChild ? Slot : "button";
1515
- return /* @__PURE__ */ jsx(
1516
- Comp,
1517
- {
1518
- className: cn(iconButtonVariants({ variant, shape, spacing }), className),
1519
- ref,
1520
- type: asChild ? type : type ?? "button",
1521
- ...props
1522
- }
1523
- );
1524
- }
1525
- );
1526
- IconButton.displayName = "IconButton";
1527
1438
  function Card({ className, ...props }) {
1528
1439
  return /* @__PURE__ */ jsx(
1529
1440
  "div",
@@ -1618,7 +1529,7 @@ var checkboxVariants = cva(
1618
1529
  defaultVariants
1619
1530
  }
1620
1531
  );
1621
- var Checkbox = React12.forwardRef(
1532
+ var Checkbox = React10.forwardRef(
1622
1533
  ({ className, size = defaultVariants.size, indeterminate = false, ...props }, ref) => {
1623
1534
  return /* @__PURE__ */ jsx(
1624
1535
  CheckboxPrimitive.Root,
@@ -1748,684 +1659,2245 @@ function IndeterminateIcon({ size }) {
1748
1659
  );
1749
1660
  }
1750
1661
  }
1751
- function useRestoreFocusToOpener({
1752
- onOpenAutoFocus,
1753
- onCloseAutoFocus
1662
+ function DropdownMenu({ ...props }) {
1663
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
1664
+ }
1665
+ function DropdownMenuPortal({
1666
+ ...props
1754
1667
  }) {
1755
- const openerRef = useRef(null);
1756
- const handleOpenAutoFocus = useCallback(
1668
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { "data-slot": "dropdown-menu-portal", ...props });
1669
+ }
1670
+ function DropdownMenuTrigger({
1671
+ ...props
1672
+ }) {
1673
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
1674
+ }
1675
+ function DropdownMenuContent({
1676
+ className,
1677
+ sideOffset = 4,
1678
+ ...props
1679
+ }) {
1680
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1681
+ DropdownMenuPrimitive.Content,
1682
+ {
1683
+ "data-slot": "dropdown-menu-content",
1684
+ sideOffset,
1685
+ className: cn(
1686
+ "bg-sys-background text-base-regular",
1687
+ "overflow-x-hidden overflow-y-auto shadow-gray-small rounded-xsmall p-[4px] border border-sys-divider-subtler",
1688
+ "max-h-(--radix-dropdown-menu-content-available-height) ",
1689
+ "min-w-[200px] origin-(--radix-dropdown-menu-content-transform-origin)",
1690
+ "data-[state=open]:animate-[fade-in_150ms_ease-out,zoom-in_150ms_ease-out]",
1691
+ "data-[state=closed]:animate-[fade-out_150ms_ease-in,zoom-out_150ms_ease-in]",
1692
+ "data-[side=top]:animate-[slide-in-bottom_150ms_ease-out]",
1693
+ "data-[side=bottom]:animate-[slide-in-top_150ms_ease-out]",
1694
+ "data-[side=left]:animate-[slide-in-right_150ms_ease-out]",
1695
+ "data-[side=right]:animate-[slide-in-left_150ms_ease-out]",
1696
+ className
1697
+ ),
1698
+ ...props
1699
+ }
1700
+ ) });
1701
+ }
1702
+ function DropdownMenuGroup({ ...props }) {
1703
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
1704
+ }
1705
+ function DropdownMenuItem({
1706
+ className,
1707
+ variant = "default",
1708
+ keepOpen = false,
1709
+ onSelect,
1710
+ ...props
1711
+ }) {
1712
+ const handleSelect = React10.useCallback(
1757
1713
  (event) => {
1758
- openerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
1759
- onOpenAutoFocus?.(event);
1714
+ onSelect?.(event);
1715
+ if (keepOpen) event.preventDefault();
1760
1716
  },
1761
- [onOpenAutoFocus]
1717
+ [onSelect, keepOpen]
1762
1718
  );
1763
- const handleCloseAutoFocus = useCallback(
1764
- (event) => {
1765
- onCloseAutoFocus?.(event);
1766
- if (event.defaultPrevented) return;
1767
- const opener = openerRef.current;
1768
- if (!opener || opener === document.body || !opener.isConnected) return;
1769
- event.preventDefault();
1770
- opener.focus({ preventScroll: true });
1771
- },
1772
- [onCloseAutoFocus]
1719
+ return /* @__PURE__ */ jsx(
1720
+ DropdownMenuPrimitive.Item,
1721
+ {
1722
+ "data-slot": "dropdown-menu-item",
1723
+ "data-variant": variant,
1724
+ onSelect: handleSelect,
1725
+ className: cn(
1726
+ "relative flex cursor-default items-center gap-[12px] rounded-xsmall p-[6px] text-base-regular outline-hidden select-none",
1727
+ "data-[variant=danger]:text-danger30",
1728
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-[20px]",
1729
+ "focus:bg-secondary-o10",
1730
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
1731
+ className
1732
+ ),
1733
+ ...props
1734
+ }
1773
1735
  );
1774
- return { onOpenAutoFocus: handleOpenAutoFocus, onCloseAutoFocus: handleCloseAutoFocus };
1775
1736
  }
1776
- var Dialog = DialogPrimitive.Root;
1777
- var DialogTrigger = DialogPrimitive.Trigger;
1778
- var DialogPortal = DialogPrimitive.Portal;
1779
- var DialogClose = DialogPrimitive.Close;
1780
- var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1781
- DialogPrimitive.Overlay,
1782
- {
1783
- ...props,
1784
- ref,
1785
- className: cn(
1786
- "fixed inset-0 z-[var(--root-z-index)] bg-sys-blanket",
1787
- "data-[state=open]:animate-[fade-in_0ms_ease-out,zoom-in_0ms_ease-out]",
1788
- "data-[state=closed]:animate-[fade-out_0ms_ease-in,zoom-out_0ms_ease-in]",
1789
- className
1790
- )
1791
- }
1792
- ));
1793
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
1794
- var dialogContentVariants = cva(null, {
1795
- variants: {
1796
- width: {
1797
- small: "w-[400px]",
1798
- medium: "w-[600px]",
1799
- large: "w-[800px]",
1800
- xlarge: "w-[1000px]"
1737
+ function DropdownMenuSeparator({
1738
+ className,
1739
+ ...props
1740
+ }) {
1741
+ return /* @__PURE__ */ jsx(
1742
+ DropdownMenuPrimitive.Separator,
1743
+ {
1744
+ "data-slot": "dropdown-menu-separator",
1745
+ className: cn("bg-sys-divider-subtle -mx-[1px] my-[1px] h-[1px]", className),
1746
+ ...props
1801
1747
  }
1802
- },
1803
- defaultVariants: {
1804
- width: "small"
1805
- }
1806
- });
1807
- var DialogContent = React12.forwardRef(
1808
- ({
1809
- children,
1810
- className,
1811
- width,
1812
- overlayClassName,
1813
- hideCloseButton,
1814
- onOpenAutoFocus,
1815
- onCloseAutoFocus,
1816
- ...props
1817
- }, ref) => {
1818
- const focusHandlers = useRestoreFocusToOpener({ onOpenAutoFocus, onCloseAutoFocus });
1819
- return /* @__PURE__ */ jsxs(DialogPortal, { children: [
1820
- /* @__PURE__ */ jsx(DialogOverlay, { className: overlayClassName }),
1821
- /* @__PURE__ */ jsxs(
1822
- DialogPrimitive.Content,
1823
- {
1824
- ref,
1825
- ...focusHandlers,
1826
- className: cn(
1827
- "fixed left-[50%] top-[50%] z-[var(--root-z-index)] translate-x-[-50%] translate-y-[-50%] w-full max-w-[70vw]",
1828
- "flex flex-col gap-[16px] rounded-medium bg-sys-background p-[32px] shadow-gray-medium duration-200",
1829
- "data-[state=open]:animate-[fade-in_0ms_ease-out,zoom-in_0ms_ease-out]",
1830
- "data-[state=closed]:animate-[fade-out_0ms_ease-in,zoom-out_0ms_ease-in]",
1831
- dialogContentVariants({ width }),
1832
- className
1833
- ),
1834
- ...props,
1835
- children: [
1836
- children,
1837
- !hideCloseButton && /* @__PURE__ */ jsx(
1838
- IconButton,
1839
- {
1840
- asChild: true,
1841
- variant: "secondaryLink",
1842
- className: cn("absolute right-[32px] top-[32px]"),
1843
- children: /* @__PURE__ */ jsxs(DialogPrimitive.Close, { children: [
1844
- /* @__PURE__ */ jsx(X, {}),
1845
- /* @__PURE__ */ jsx("span", { className: "sr-only a11y", children: "Close" })
1846
- ] })
1847
- }
1848
- )
1849
- ]
1850
- }
1851
- )
1852
- ] });
1853
- }
1854
- );
1855
- DialogContent.displayName = DialogPrimitive.Content.displayName;
1856
- var DialogHeader = (props) => /* @__PURE__ */ jsx(
1857
- "div",
1858
- {
1859
- ...props,
1860
- className: cn("flex flex-col gap-[16px] text-center sm:text-left", props.className)
1748
+ );
1749
+ }
1750
+ function DropdownMenuSub({ ...props }) {
1751
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
1752
+ }
1753
+ function DropdownMenuSubTrigger({
1754
+ className,
1755
+ children,
1756
+ ...props
1757
+ }) {
1758
+ return /* @__PURE__ */ jsxs(
1759
+ DropdownMenuPrimitive.SubTrigger,
1760
+ {
1761
+ "data-slot": "dropdown-menu-sub-trigger",
1762
+ className: cn(
1763
+ "relative flex cursor-default items-center gap-[12px] rounded-xsmall p-[6px] text-base-regular outline-hidden select-none",
1764
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-[20px]",
1765
+ "focus:bg-secondary-o10",
1766
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
1767
+ className
1768
+ ),
1769
+ ...props,
1770
+ children: [
1771
+ children,
1772
+ /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-[20px]" })
1773
+ ]
1774
+ }
1775
+ );
1776
+ }
1777
+ function DropdownMenuSubContent({
1778
+ className,
1779
+ ...props
1780
+ }) {
1781
+ return /* @__PURE__ */ jsx(
1782
+ DropdownMenuPrimitive.SubContent,
1783
+ {
1784
+ "data-slot": "dropdown-menu-sub-content",
1785
+ className: cn(
1786
+ "bg-sys-background text-base-regular",
1787
+ "overflow-x-hidden overflow-y-auto z-[var(--root-z-index)] shadow-gray-small rounded-xsmall p-[4px] border border-sys-divider-subtler",
1788
+ "max-h-(--radix-dropdown-menu-content-available-height) ",
1789
+ "min-w-[200px] origin-(--radix-dropdown-menu-content-transform-origin)",
1790
+ "data-[state=open]:animate-[fade-in_150ms_ease-out,zoom-in_150ms_ease-out]",
1791
+ "data-[state=closed]:animate-[fade-out_150ms_ease-in,zoom-out_150ms_ease-in]",
1792
+ "data-[side=top]:animate-[slide-in-bottom_150ms_ease-out]",
1793
+ "data-[side=bottom]:animate-[slide-in-top_150ms_ease-out]",
1794
+ "data-[side=left]:animate-[slide-in-right_150ms_ease-out]",
1795
+ "data-[side=right]:animate-[slide-in-left_150ms_ease-out]",
1796
+ className
1797
+ ),
1798
+ ...props
1799
+ }
1800
+ );
1801
+ }
1802
+ var X_MASK = `url("data:image/svg+xml,${encodeURIComponent(
1803
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>'
1804
+ )}")`;
1805
+ var CancelIcon = React10.forwardRef(
1806
+ ({ size = 20, className, iconClassName, ...props }, ref) => {
1807
+ let innerSize = Math.round(size * 0.75);
1808
+ if (size % 2 !== innerSize % 2) innerSize -= 1;
1809
+ return /* @__PURE__ */ jsx(
1810
+ "span",
1811
+ {
1812
+ ref,
1813
+ "aria-hidden": "true",
1814
+ className: cn(
1815
+ "inline-flex items-center justify-center align-middle rounded-full bg-current",
1816
+ className
1817
+ ),
1818
+ style: { width: size, height: size },
1819
+ ...props,
1820
+ children: /* @__PURE__ */ jsx(
1821
+ "span",
1822
+ {
1823
+ className: cn("block bg-current text-sys-background", iconClassName),
1824
+ style: {
1825
+ width: innerSize,
1826
+ height: innerSize,
1827
+ maskImage: X_MASK,
1828
+ WebkitMaskImage: X_MASK,
1829
+ maskSize: "contain",
1830
+ WebkitMaskSize: "contain"
1831
+ }
1832
+ }
1833
+ )
1834
+ }
1835
+ );
1861
1836
  }
1862
1837
  );
1863
- DialogHeader.displayName = "DialogHeader";
1864
- var DialogFooter = (props) => /* @__PURE__ */ jsx(
1865
- "div",
1838
+ CancelIcon.displayName = "CancelIcon";
1839
+ var CLEAR_HOST_CLASS = "group/clear-host";
1840
+ var CLEAR_REVEAL_CLASS = "opacity-0 group-hover/clear-host:opacity-100 group-focus-within/clear-host:opacity-100 [@media(hover:none)]:opacity-100";
1841
+ var tagVariants = cva(
1842
+ // whitespace-nowrap: 좁은 칸에서 태그 글자가 줄바꿈되지 않게 (2026-10-19 15차 D1, Badge 와 같은 규칙)
1843
+ "inline-flex items-center whitespace-nowrap py-[4px] text-small-bold gap-[4px] w-fit transition-colors",
1866
1844
  {
1867
- ...props,
1868
- className: cn("flex flex-col-reverse gap-[8px] sm:flex-row sm:justify-end", props.className)
1845
+ variants: {
1846
+ variant: {
1847
+ primary: "bg-primary10 text-primary50",
1848
+ primaryBold: "bg-primary30 text-secondary10",
1849
+ secondary: "bg-secondary-o20 text-sys-text-main",
1850
+ secondaryBold: "bg-secondary60 text-secondary10",
1851
+ danger: "bg-danger10 text-danger50",
1852
+ dangerBold: "bg-danger30 text-secondary10",
1853
+ warning: "bg-warning10 text-warning50",
1854
+ warningBold: "bg-warning30 text-grayscale80",
1855
+ success: "bg-success10 text-success50",
1856
+ successBold: "bg-success30 text-secondary10",
1857
+ info: "bg-info10 text-info50",
1858
+ infoBold: "bg-info30 text-grayscale80",
1859
+ etc: "bg-etc10 text-etc50",
1860
+ etcBold: "bg-etc30 text-secondary10"
1861
+ },
1862
+ shape: {
1863
+ normal: "rounded-xsmall",
1864
+ rounded: "rounded-full"
1865
+ }
1866
+ },
1867
+ defaultVariants: {
1868
+ variant: "primary",
1869
+ shape: "normal"
1870
+ }
1869
1871
  }
1870
1872
  );
1871
- DialogFooter.displayName = "DialogFooter";
1872
- var variantToIcon = {
1873
- normal: null,
1874
- success: /* @__PURE__ */ jsx(CircleCheck, { className: "text-success30" }),
1875
- info: /* @__PURE__ */ jsx(Info, { className: "text-sys-text-subtler" }),
1876
- warning: /* @__PURE__ */ jsx(TriangleAlert, { className: "text-critical30" }),
1877
- danger: /* @__PURE__ */ jsx(CircleX, { className: "text-danger30" })
1873
+ var cancelIconXColor = {
1874
+ primary: "text-primary10",
1875
+ primaryBold: "text-primary30",
1876
+ secondary: "text-secondary-o20",
1877
+ secondaryBold: "text-secondary60",
1878
+ danger: "text-danger10",
1879
+ dangerBold: "text-danger30",
1880
+ warning: "text-warning10",
1881
+ warningBold: "text-warning30",
1882
+ success: "text-success10",
1883
+ successBold: "text-success30",
1884
+ info: "text-info10",
1885
+ infoBold: "text-info30",
1886
+ etc: "text-etc10",
1887
+ etcBold: "text-etc30"
1878
1888
  };
1879
- var DialogTitle = React12.forwardRef(({ variant, children, ...props }, ref) => {
1880
- if (variant) {
1881
- return /* @__PURE__ */ jsxs(Stack, { spacing: 8, children: [
1882
- variantToIcon[variant],
1883
- /* @__PURE__ */ jsx(
1884
- DialogPrimitive.Title,
1889
+ var tagTextColor = {
1890
+ primary: "text-primary50",
1891
+ primaryBold: "text-secondary10",
1892
+ secondary: "text-sys-text-main",
1893
+ secondaryBold: "text-secondary10",
1894
+ danger: "text-danger50",
1895
+ dangerBold: "text-secondary10",
1896
+ warning: "text-warning50",
1897
+ warningBold: "text-grayscale80",
1898
+ success: "text-success50",
1899
+ successBold: "text-secondary10",
1900
+ info: "text-info50",
1901
+ infoBold: "text-grayscale80",
1902
+ etc: "text-etc50",
1903
+ etcBold: "text-secondary10"
1904
+ };
1905
+ var linkHoverBg = {
1906
+ primary: "hover:bg-[image:linear-gradient(var(--color-primary-o30),var(--color-primary-o30))]",
1907
+ primaryBold: "hover:bg-[image:linear-gradient(var(--color-primary-o30),var(--color-primary-o30))]",
1908
+ secondary: "hover:bg-secondary-o30",
1909
+ secondaryBold: "hover:bg-[image:linear-gradient(var(--color-secondary-o30),var(--color-secondary-o30))]",
1910
+ danger: "hover:bg-[image:linear-gradient(var(--color-danger-o30),var(--color-danger-o30))]",
1911
+ dangerBold: "hover:bg-[image:linear-gradient(var(--color-danger-o30),var(--color-danger-o30))]",
1912
+ warning: "hover:bg-[image:linear-gradient(var(--color-warning-o30),var(--color-warning-o30))]",
1913
+ warningBold: "hover:bg-[image:linear-gradient(var(--color-warning-o30),var(--color-warning-o30))]",
1914
+ success: "hover:bg-[image:linear-gradient(var(--color-success-o30),var(--color-success-o30))]",
1915
+ successBold: "hover:bg-[image:linear-gradient(var(--color-success-o30),var(--color-success-o30))]",
1916
+ info: "hover:bg-[image:linear-gradient(var(--color-info-o30),var(--color-info-o30))]",
1917
+ infoBold: "hover:bg-[image:linear-gradient(var(--color-info-o30),var(--color-info-o30))]",
1918
+ etc: "hover:bg-[image:linear-gradient(var(--color-etc-o30),var(--color-etc-o30))]",
1919
+ etcBold: "hover:bg-[image:linear-gradient(var(--color-etc-o30),var(--color-etc-o30))]"
1920
+ };
1921
+ var linkPressBg = {
1922
+ primary: "active:bg-[image:linear-gradient(var(--color-primary-o50),var(--color-primary-o50))]",
1923
+ primaryBold: "active:bg-[image:linear-gradient(var(--color-primary-o50),var(--color-primary-o50))]",
1924
+ secondary: "active:bg-secondary-o50",
1925
+ secondaryBold: "active:bg-[image:linear-gradient(var(--color-secondary-o50),var(--color-secondary-o50))]",
1926
+ danger: "active:bg-[image:linear-gradient(var(--color-danger-o50),var(--color-danger-o50))]",
1927
+ dangerBold: "active:bg-[image:linear-gradient(var(--color-danger-o50),var(--color-danger-o50))]",
1928
+ warning: "active:bg-[image:linear-gradient(var(--color-warning-o50),var(--color-warning-o50))]",
1929
+ warningBold: "active:bg-[image:linear-gradient(var(--color-warning-o50),var(--color-warning-o50))]",
1930
+ success: "active:bg-[image:linear-gradient(var(--color-success-o50),var(--color-success-o50))]",
1931
+ successBold: "active:bg-[image:linear-gradient(var(--color-success-o50),var(--color-success-o50))]",
1932
+ info: "active:bg-[image:linear-gradient(var(--color-info-o50),var(--color-info-o50))]",
1933
+ infoBold: "active:bg-[image:linear-gradient(var(--color-info-o50),var(--color-info-o50))]",
1934
+ etc: "active:bg-[image:linear-gradient(var(--color-etc-o50),var(--color-etc-o50))]",
1935
+ etcBold: "active:bg-[image:linear-gradient(var(--color-etc-o50),var(--color-etc-o50))]"
1936
+ };
1937
+ var linkHoverXColor = {
1938
+ primary: "group-hover/tag:bg-[image:linear-gradient(var(--color-primary-o30),var(--color-primary-o30))]",
1939
+ primaryBold: "group-hover/tag:bg-[image:linear-gradient(var(--color-primary-o30),var(--color-primary-o30))]",
1940
+ secondary: "group-hover/tag:text-secondary-o30",
1941
+ secondaryBold: "group-hover/tag:bg-[image:linear-gradient(var(--color-secondary-o30),var(--color-secondary-o30))]",
1942
+ danger: "group-hover/tag:bg-[image:linear-gradient(var(--color-danger-o30),var(--color-danger-o30))]",
1943
+ dangerBold: "group-hover/tag:bg-[image:linear-gradient(var(--color-danger-o30),var(--color-danger-o30))]",
1944
+ warning: "group-hover/tag:bg-[image:linear-gradient(var(--color-warning-o30),var(--color-warning-o30))]",
1945
+ warningBold: "group-hover/tag:bg-[image:linear-gradient(var(--color-warning-o30),var(--color-warning-o30))]",
1946
+ success: "group-hover/tag:bg-[image:linear-gradient(var(--color-success-o30),var(--color-success-o30))]",
1947
+ successBold: "group-hover/tag:bg-[image:linear-gradient(var(--color-success-o30),var(--color-success-o30))]",
1948
+ info: "group-hover/tag:bg-[image:linear-gradient(var(--color-info-o30),var(--color-info-o30))]",
1949
+ infoBold: "group-hover/tag:bg-[image:linear-gradient(var(--color-info-o30),var(--color-info-o30))]",
1950
+ etc: "group-hover/tag:bg-[image:linear-gradient(var(--color-etc-o30),var(--color-etc-o30))]",
1951
+ etcBold: "group-hover/tag:bg-[image:linear-gradient(var(--color-etc-o30),var(--color-etc-o30))]"
1952
+ };
1953
+ var linkPressXColor = {
1954
+ primary: "group-active/tag:bg-[image:linear-gradient(var(--color-primary-o50),var(--color-primary-o50))]",
1955
+ primaryBold: "group-active/tag:bg-[image:linear-gradient(var(--color-primary-o50),var(--color-primary-o50))]",
1956
+ secondary: "group-active/tag:text-secondary-o50",
1957
+ secondaryBold: "group-active/tag:bg-[image:linear-gradient(var(--color-secondary-o50),var(--color-secondary-o50))]",
1958
+ danger: "group-active/tag:bg-[image:linear-gradient(var(--color-danger-o50),var(--color-danger-o50))]",
1959
+ dangerBold: "group-active/tag:bg-[image:linear-gradient(var(--color-danger-o50),var(--color-danger-o50))]",
1960
+ warning: "group-active/tag:bg-[image:linear-gradient(var(--color-warning-o50),var(--color-warning-o50))]",
1961
+ warningBold: "group-active/tag:bg-[image:linear-gradient(var(--color-warning-o50),var(--color-warning-o50))]",
1962
+ success: "group-active/tag:bg-[image:linear-gradient(var(--color-success-o50),var(--color-success-o50))]",
1963
+ successBold: "group-active/tag:bg-[image:linear-gradient(var(--color-success-o50),var(--color-success-o50))]",
1964
+ info: "group-active/tag:bg-[image:linear-gradient(var(--color-info-o50),var(--color-info-o50))]",
1965
+ infoBold: "group-active/tag:bg-[image:linear-gradient(var(--color-info-o50),var(--color-info-o50))]",
1966
+ etc: "group-active/tag:bg-[image:linear-gradient(var(--color-etc-o50),var(--color-etc-o50))]",
1967
+ etcBold: "group-active/tag:bg-[image:linear-gradient(var(--color-etc-o50),var(--color-etc-o50))]"
1968
+ };
1969
+ function Tag({
1970
+ className,
1971
+ variant,
1972
+ shape,
1973
+ asChild = false,
1974
+ elemBefore,
1975
+ onRemove,
1976
+ removeLabel = "\uC0AD\uC81C",
1977
+ children,
1978
+ ...props
1979
+ }) {
1980
+ const Comp = asChild ? Slot : "div";
1981
+ const v = variant ?? "primary";
1982
+ const removeOutside = asChild && !!onRemove;
1983
+ const removeButton = onRemove && /* @__PURE__ */ jsx(
1984
+ "button",
1985
+ {
1986
+ type: "button",
1987
+ onClick: (e) => {
1988
+ e.preventDefault();
1989
+ e.stopPropagation();
1990
+ onRemove();
1991
+ },
1992
+ onKeyDown: (e) => {
1993
+ if (e.key === "Backspace" || e.key === "Delete") {
1994
+ e.preventDefault();
1995
+ onRemove();
1996
+ }
1997
+ },
1998
+ className: "absolute right-[4px] top-1/2 -translate-y-1/2 inline-flex items-center justify-center size-[16px] rounded-full focus-visible:outline-[2px] focus-visible:outline-sys-focus-ring-main focus-visible:outline-offset-[-1px] group/remove",
1999
+ "aria-label": removeLabel,
2000
+ children: /* @__PURE__ */ jsx(
2001
+ CancelIcon,
1885
2002
  {
1886
- ...props,
1887
- ref,
1888
- className: cn("text-h4 text-sys-text-main whitespace-pre-wrap", props.className),
1889
- children: sanitizeUserText(children)
2003
+ size: 14,
2004
+ iconClassName: cn(
2005
+ cancelIconXColor[v],
2006
+ asChild && [linkHoverXColor[v], linkPressXColor[v]],
2007
+ "group-hover/remove:bg-sys-background hover:group-hover/remove:bg-[image:linear-gradient(var(--color-danger-o10),var(--color-danger-o10))]",
2008
+ "group-active/remove:bg-sys-background active:group-active/remove:bg-[image:linear-gradient(var(--color-danger-o20),var(--color-danger-o20))]"
2009
+ )
1890
2010
  }
1891
2011
  )
1892
- ] });
1893
- } else {
1894
- return /* @__PURE__ */ jsx(
1895
- DialogPrimitive.Title,
2012
+ }
2013
+ );
2014
+ const tag = /* @__PURE__ */ jsxs(
2015
+ Comp,
2016
+ {
2017
+ className: cn(
2018
+ tagVariants({ variant, shape }),
2019
+ elemBefore ? "pl-[6px]" : "pl-[8px]",
2020
+ onRemove ? "pr-[24px]" : "pr-[8px]",
2021
+ onRemove && !removeOutside && "relative",
2022
+ asChild && [
2023
+ !removeOutside && "group/tag",
2024
+ "cursor-pointer hover:underline active:underline",
2025
+ "focus-visible:outline-[2px] focus-visible:outline-sys-focus-ring-main focus-visible:outline-offset-[1px] focus-visible:underline",
2026
+ linkHoverBg[v],
2027
+ linkPressBg[v]
2028
+ ],
2029
+ onRemove && "transition-colors",
2030
+ onRemove && !removeOutside && [
2031
+ "has-[button:hover]:bg-sys-background has-[button:hover]:bg-[image:linear-gradient(var(--color-danger-o10),var(--color-danger-o10))] has-[button:hover]:text-danger40",
2032
+ "active:has-[button:active]:bg-sys-background active:has-[button:active]:bg-[image:linear-gradient(var(--color-danger-o20),var(--color-danger-o20))] active:has-[button:active]:text-danger40"
2033
+ ],
2034
+ removeOutside && [
2035
+ "group-has-[button:hover]/tag:bg-sys-background group-has-[button:hover]/tag:bg-[image:linear-gradient(var(--color-danger-o10),var(--color-danger-o10))] group-has-[button:hover]/tag:text-danger40",
2036
+ "group-has-[button:active]/tag:bg-sys-background group-has-[button:active]/tag:bg-[image:linear-gradient(var(--color-danger-o20),var(--color-danger-o20))] group-has-[button:active]/tag:text-danger40"
2037
+ ],
2038
+ className
2039
+ ),
2040
+ ...props,
2041
+ children: [
2042
+ elemBefore && /* @__PURE__ */ jsx("span", { className: "shrink-0 inline-flex items-center size-[16px]", children: elemBefore }),
2043
+ /* @__PURE__ */ jsx(Slottable, { children }),
2044
+ !removeOutside && removeButton
2045
+ ]
2046
+ }
2047
+ );
2048
+ if (removeOutside) {
2049
+ return /* @__PURE__ */ jsxs(
2050
+ "span",
1896
2051
  {
1897
- ...props,
1898
- ref,
1899
- className: cn("text-h4 text-sys-text-main whitespace-pre-wrap", props.className),
1900
- children: sanitizeUserText(children)
2052
+ className: cn(
2053
+ "group/tag relative inline-flex w-fit",
2054
+ // 삭제 버튼(currentColor)이 태그 글자색을, 삭제 hover·press 시 danger 색을 따르게 한다
2055
+ tagTextColor[v],
2056
+ "has-[button:hover]:text-danger40 has-[button:active]:text-danger40"
2057
+ ),
2058
+ children: [
2059
+ tag,
2060
+ removeButton
2061
+ ]
1901
2062
  }
1902
2063
  );
1903
2064
  }
1904
- });
1905
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
1906
- var DialogDescription = React12.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx(
1907
- DialogPrimitive.Description,
1908
- {
1909
- ...props,
1910
- ref,
1911
- className: cn("text-base-regular text-sys-text-main whitespace-pre-wrap", props.className),
1912
- children: sanitizeUserText(children)
1913
- }
1914
- ));
1915
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
1916
- var Separator = React12.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
1917
- SeparatorPrimitive.Root,
1918
- {
1919
- ref,
1920
- decorative,
1921
- orientation,
1922
- className: cn(
1923
- "shrink-0 bg-sys-divider-subtle",
1924
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
1925
- className
1926
- ),
1927
- ...props
2065
+ return tag;
2066
+ }
2067
+ function getLabelColorClass(options) {
2068
+ const { isDisabled, isInvalid, isOpen, isFocused, hasValue } = options;
2069
+ if (isDisabled) return "text-sys-text-disabled";
2070
+ if (isInvalid) {
2071
+ if (hasValue || isOpen || isFocused) return "text-danger30";
2072
+ return "text-sys-text-placeholder";
1928
2073
  }
1929
- ));
1930
- Separator.displayName = SeparatorPrimitive.Root.displayName;
1931
- var DrawerModalContext = React12.createContext(true);
1932
- var Drawer = ({ modal = true, ...props }) => /* @__PURE__ */ jsx(DrawerModalContext.Provider, { value: modal, children: /* @__PURE__ */ jsx(DialogPrimitive.Root, { modal, ...props }) });
1933
- Drawer.displayName = "Drawer";
1934
- var DrawerTrigger = DialogPrimitive.Trigger;
1935
- var DrawerClose = DialogPrimitive.Close;
1936
- var DrawerPortal = DialogPrimitive.Portal;
1937
- var DrawerOverlay = React12.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx(
1938
- DialogPrimitive.Overlay,
1939
- {
1940
- ...props,
1941
- className: cn(
1942
- "fixed inset-0 z-[var(--root-z-index)] bg-sys-blanket",
1943
- "data-[state=open]:animate-fade-in",
1944
- "data-[state=closed]:animate-fade-out",
1945
- props.className
1946
- ),
1947
- ref
2074
+ if (isOpen || isFocused) return "text-sys-focus-ring-bold";
2075
+ if (hasValue) return "text-sys-text-subtler";
2076
+ return "text-sys-text-placeholder";
2077
+ }
2078
+ function getBorderColorClass(options) {
2079
+ const { isDisabled, isInvalid, isOpen, isFocused } = options;
2080
+ if (isDisabled) return "border-sys-divider-main";
2081
+ if (isInvalid) return "border-danger30";
2082
+ if (isOpen || isFocused) return "border-sys-focus-ring-bold";
2083
+ return "border-sys-divider-main";
2084
+ }
2085
+ function useFloatingLabel(options) {
2086
+ const {
2087
+ label,
2088
+ hasValue,
2089
+ isOpen = false,
2090
+ isFocused = false,
2091
+ isInvalid = false,
2092
+ isDisabled = false
2093
+ } = options;
2094
+ const hasLabel = !!label;
2095
+ const isFloating = hasValue || isOpen || isFocused;
2096
+ const [isMounted, setIsMounted] = React10.useState(false);
2097
+ React10.useEffect(() => {
2098
+ const id = requestAnimationFrame(() => setIsMounted(true));
2099
+ return () => cancelAnimationFrame(id);
2100
+ }, []);
2101
+ const labelId = React10.useId();
2102
+ const labelColorClass = getLabelColorClass({
2103
+ isDisabled,
2104
+ isInvalid,
2105
+ isOpen,
2106
+ isFocused,
2107
+ hasValue
2108
+ });
2109
+ const borderColorClass = getBorderColorClass({
2110
+ isDisabled,
2111
+ isInvalid,
2112
+ isOpen,
2113
+ isFocused
2114
+ });
2115
+ const isThickBorder = !!isInvalid || isOpen || isFocused;
2116
+ return {
2117
+ hasLabel,
2118
+ isFloating,
2119
+ isMounted,
2120
+ labelColorClass,
2121
+ borderColorClass,
2122
+ isThickBorder,
2123
+ labelId
2124
+ };
2125
+ }
2126
+ var Form = FormProvider;
2127
+ var FormFieldContext = React10.createContext({});
2128
+ var FormField = ({
2129
+ ...props
2130
+ }) => {
2131
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
2132
+ };
2133
+ var useFormField = () => {
2134
+ const fieldContext = React10.useContext(FormFieldContext);
2135
+ const itemContext = React10.useContext(FormItemContext);
2136
+ const { getFieldState, formState } = useFormContext();
2137
+ const fieldState = getFieldState(fieldContext.name, formState);
2138
+ if (!fieldContext) {
2139
+ throw new Error("useFormField should be used within <FormField>");
1948
2140
  }
1949
- ));
1950
- DrawerOverlay.displayName = DialogPrimitive.Overlay.displayName;
1951
- var sheetVariants = cva(
1952
- "fixed z-[var(--root-z-index)] flex flex-col overflow-hidden bg-sys-background shadow-gray-medium",
1953
- {
1954
- variants: {
1955
- side: {
1956
- top: [
1957
- "inset-x-0 top-0 bottom-auto",
1958
- "data-[state=open]:animate-slide-in-from-top",
1959
- "data-[state=closed]:animate-slide-out-to-top"
1960
- ],
1961
- bottom: [
1962
- "inset-x-0 bottom-0 top-auto",
1963
- "data-[state=open]:animate-slide-in-from-bottom",
1964
- "data-[state=closed]:animate-slide-out-to-bottom"
1965
- ],
1966
- left: [
1967
- "inset-y-0 left-0 right-auto h-full",
1968
- "data-[state=open]:animate-slide-in-from-left",
1969
- "data-[state=closed]:animate-slide-out-to-left"
1970
- ],
1971
- right: [
1972
- "inset-y-0 right-0 left-auto h-full",
1973
- "data-[state=open]:animate-slide-in-from-right",
1974
- "data-[state=closed]:animate-slide-out-to-right"
1975
- ]
1976
- },
1977
- size: {
1978
- small: "w-[360px] max-w-[70vw]",
1979
- medium: "w-[480px] max-w-[70vw]",
1980
- large: "w-[720px] max-w-[70vw]",
1981
- xLarge: "w-[1080px] max-w-[70vw]"
1982
- }
1983
- },
1984
- defaultVariants: {
1985
- side: "right",
1986
- size: "large"
1987
- }
2141
+ const { id } = itemContext;
2142
+ return {
2143
+ id,
2144
+ name: fieldContext.name,
2145
+ formItemId: `${id}-form-item`,
2146
+ formDescriptionId: `${id}-form-item-description`,
2147
+ formMessageId: `${id}-form-item-message`,
2148
+ ...fieldState
2149
+ };
2150
+ };
2151
+ var FormItemContext = React10.createContext({});
2152
+ var FormItem = React10.forwardRef(
2153
+ ({ className, ...props }, ref) => {
2154
+ const id = React10.useId();
2155
+ return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { ref, className: cn("space-y-[4px]", className), ...props }) });
1988
2156
  }
1989
2157
  );
1990
- var DrawerContent = React12.forwardRef(
1991
- ({ side, size, children, onOpenAutoFocus, onCloseAutoFocus, onInteractOutside, ...props }, ref) => {
1992
- const focusHandlers = useRestoreFocusToOpener({ onOpenAutoFocus, onCloseAutoFocus });
1993
- const modal = React12.useContext(DrawerModalContext);
1994
- return /* @__PURE__ */ jsxs(DrawerPortal, { children: [
1995
- modal ? /* @__PURE__ */ jsx(DrawerOverlay, {}) : null,
1996
- /* @__PURE__ */ jsxs(
1997
- DialogPrimitive.Content,
2158
+ FormItem.displayName = "FormItem";
2159
+ var FormLabel = React10.forwardRef(({ className, required, ...props }, ref) => {
2160
+ const { error, formItemId } = useFormField();
2161
+ if (required) {
2162
+ return /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "start", children: [
2163
+ /* @__PURE__ */ jsx(
2164
+ "label",
1998
2165
  {
1999
- ...props,
2000
- ...focusHandlers,
2001
- onInteractOutside: (e) => {
2002
- onInteractOutside?.(e);
2003
- if (!modal && !e.defaultPrevented) e.preventDefault();
2004
- },
2005
2166
  ref,
2006
2167
  className: cn(
2007
- sheetVariants({ side, size }),
2008
- !modal && "border-l border-sys-border-subtle shadow-none",
2009
- props.className
2168
+ error && "text-destructive",
2169
+ "inline-block text-sys-text-subtle text-base-medium",
2170
+ className
2010
2171
  ),
2011
- children: [
2012
- /* @__PURE__ */ jsxs(
2013
- DialogPrimitive.Close,
2014
- {
2015
- className: cn("absolute right-[24px] top-[24px] disabled:pointer-events-none"),
2016
- children: [
2017
- /* @__PURE__ */ jsx(X, { size: 24 }),
2018
- /* @__PURE__ */ jsx("span", { className: "sr-only a11y", children: "Close" })
2019
- ]
2020
- }
2021
- ),
2022
- children
2023
- ]
2172
+ htmlFor: formItemId,
2173
+ ...props
2174
+ }
2175
+ ),
2176
+ /* @__PURE__ */ jsx("span", { className: "text-base-medium text-danger30", children: "*" })
2177
+ ] });
2178
+ }
2179
+ return /* @__PURE__ */ jsx(
2180
+ "label",
2181
+ {
2182
+ ref,
2183
+ className: cn(
2184
+ error && "text-destructive",
2185
+ "inline-block text-sys-text-subtle text-base-medium",
2186
+ className
2187
+ ),
2188
+ htmlFor: formItemId,
2189
+ ...props
2190
+ }
2191
+ );
2192
+ });
2193
+ FormLabel.displayName = "FormLabel";
2194
+ var FormControlContext = React10.createContext(null);
2195
+ var useFormControlContext = () => React10.useContext(FormControlContext);
2196
+ var formControlVariants = cva("", {
2197
+ variants: {
2198
+ maxWidth: {
2199
+ default: "max-w-[var(--max-w-form-control)]",
2200
+ narrow: "max-w-[var(--max-w-form-control-narrow)]",
2201
+ full: ""
2202
+ }
2203
+ },
2204
+ defaultVariants: {
2205
+ maxWidth: "default"
2206
+ }
2207
+ });
2208
+ var FormControl = React10.forwardRef(({ className, maxWidth, ...props }, ref) => {
2209
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
2210
+ const isInvalid = !!error;
2211
+ return /* @__PURE__ */ jsx(FormControlContext.Provider, { value: { isInvalid }, children: /* @__PURE__ */ jsx(
2212
+ Slot,
2213
+ {
2214
+ ref,
2215
+ id: formItemId,
2216
+ className: cn(formControlVariants({ maxWidth }), className),
2217
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
2218
+ "aria-invalid": isInvalid,
2219
+ ...props
2220
+ }
2221
+ ) });
2222
+ });
2223
+ FormControl.displayName = "FormControl";
2224
+ var FormDescription = React10.forwardRef(
2225
+ ({ className, icon = true, ...props }, ref) => {
2226
+ const { formDescriptionId, error } = useFormField();
2227
+ if (error) return null;
2228
+ return /* @__PURE__ */ jsxs(Stack, { spacing: 5, className: "pt-[2px]", children: [
2229
+ icon ? /* @__PURE__ */ jsx(Info, { size: 16, "aria-hidden": true, className: "text-sys-text-subtle" }) : null,
2230
+ /* @__PURE__ */ jsx(
2231
+ "p",
2232
+ {
2233
+ ref,
2234
+ id: formDescriptionId,
2235
+ className: cn("text-small-regular text-sys-text-subtle", className),
2236
+ ...props
2024
2237
  }
2025
2238
  )
2026
2239
  ] });
2027
2240
  }
2028
2241
  );
2029
- DrawerContent.displayName = DialogPrimitive.Content.displayName;
2030
- var DrawerHeader = ({ ...props }) => /* @__PURE__ */ jsx("div", { ...props, className: cn("flex flex-col gap-[8px] text-left p-[24px]", props.className) });
2031
- DrawerHeader.displayName = "DrawerHeader";
2032
- var DrawerBody = ({ ...props }) => /* @__PURE__ */ jsx(
2033
- "div",
2034
- {
2035
- tabIndex: 0,
2036
- ...props,
2037
- className: cn(
2038
- "flex-1 min-h-0 overflow-y-auto scrollbar-gutter-stable",
2039
- // DrawerContent 가 overflow-hidden 이라 바깥 outline 은 잘린다 → 안쪽 링
2040
- "outline-none focus-visible:ring-[2px] focus-visible:ring-inset focus-visible:ring-sys-focus-ring-main",
2041
- props.className
2242
+ FormDescription.displayName = "FormDescription";
2243
+ var FormMessage = React10.forwardRef(({ className, children, ...props }, ref) => {
2244
+ const { error, formMessageId } = useFormField();
2245
+ const body = error ? String(error?.message ?? "") : children;
2246
+ if (!body) {
2247
+ return null;
2248
+ }
2249
+ return /* @__PURE__ */ jsxs(Stack, { spacing: 5, className: "pt-[2px]", children: [
2250
+ /* @__PURE__ */ jsx(TriangleAlert, { size: 16, className: "text-danger30" }),
2251
+ /* @__PURE__ */ jsx(
2252
+ "p",
2253
+ {
2254
+ ref,
2255
+ id: formMessageId,
2256
+ className: cn("text-small-regular text-danger30", className),
2257
+ ...props,
2258
+ children: body
2259
+ }
2042
2260
  )
2261
+ ] });
2262
+ });
2263
+ FormMessage.displayName = "FormMessage";
2264
+ var FormValidMessage = React10.forwardRef(({ className, children, ...props }, ref) => {
2265
+ if (!children) {
2266
+ return null;
2267
+ }
2268
+ return /* @__PURE__ */ jsxs(Stack, { spacing: 5, className: "pt-[2px]", children: [
2269
+ /* @__PURE__ */ jsx(Check, { size: 16, className: "text-success30" }),
2270
+ /* @__PURE__ */ jsx("p", { ref, className: cn("text-small-regular text-success30", className), ...props, children })
2271
+ ] });
2272
+ });
2273
+ FormValidMessage.displayName = "FormValidMessage";
2274
+ var FormHeader = React10.forwardRef(
2275
+ ({ className, title, description, children, ...props }, ref) => {
2276
+ return /* @__PURE__ */ jsxs(
2277
+ "div",
2278
+ {
2279
+ ref,
2280
+ className: cn("flex flex-col gap-[2px] items-start w-full", className),
2281
+ ...props,
2282
+ children: [
2283
+ title && /* @__PURE__ */ jsx("h2", { className: "text-h4 text-sys-text-main w-full", children: title }),
2284
+ description && /* @__PURE__ */ jsx("p", { className: "text-base-regular text-sys-text-main", children: description }),
2285
+ children
2286
+ ]
2287
+ }
2288
+ );
2043
2289
  }
2044
2290
  );
2045
- DrawerBody.displayName = "DrawerBody";
2046
- var DrawerFooter = ({ ...props }) => /* @__PURE__ */ jsx(
2047
- "div",
2048
- {
2049
- ...props,
2050
- className: cn("flex gap-[8px] justify-end mt-[16px] px-[24px] pb-[26px]", props.className)
2291
+ FormHeader.displayName = "FormHeader";
2292
+ var FormSectionLevelContext = React10.createContext(3);
2293
+ var FormSection = React10.forwardRef(
2294
+ ({ className, title, level, children, ...props }, ref) => {
2295
+ const contextLevel = React10.useContext(FormSectionLevelContext);
2296
+ const Heading = (level ?? contextLevel) === 2 ? "h2" : "h3";
2297
+ return /* @__PURE__ */ jsxs(
2298
+ "div",
2299
+ {
2300
+ ref,
2301
+ className: cn(
2302
+ // 섹션 사이 간격 48px 를 구분선 위아래 24px 씩으로 나눈다 (2026-10-13: 앞 섹션의 설명 글줄이 선에 붙어 있었다)
2303
+ // 필드 사이 16(한 묶음 안) — 섹션 사이 48(pt-24+pb-24)과 구분되는 단계. 2026-10-17 8차 D2
2304
+ "flex flex-col gap-[16px] w-full pt-[24px]",
2305
+ // 부모 컨테이너 안에서 자기가 첫 자식이면 (= FormHeader 같은 형제가 앞에 없으면)
2306
+ // 16px 의 상단 여백만 둔다 (컨테이너 상단 과공백 방지). FormHeader 가 앞에 있으면 :first-child 가 아니므로 pt-[24px] + 선.
2307
+ "first:pt-[16px]",
2308
+ // 마지막 섹션 아래에는 여백이 없다 (푸터 버튼 줄이 자기 간격을 가진다)
2309
+ "[&:not(:last-child)]:pb-[24px]",
2310
+ // 섹션 사이에 연한 가로 구분선 (2026-10-12 블라인드 평가: 구획이 없으면 "제목뿐" 으로 읽혔다). 첫 섹션 위에는 없다
2311
+ "[&:not(:first-child)]:border-t [&:not(:first-child)]:border-sys-divider-subtle",
2312
+ className
2313
+ ),
2314
+ ...props,
2315
+ children: [
2316
+ title && /* @__PURE__ */ jsx(Heading, { className: "text-h4 text-sys-text-main w-full", children: title }),
2317
+ children
2318
+ ]
2319
+ }
2320
+ );
2051
2321
  }
2052
2322
  );
2053
- DrawerFooter.displayName = "DrawerFooter";
2054
- var DrawerTitle = React12.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx(
2055
- DialogPrimitive.Title,
2056
- {
2057
- ref,
2058
- ...props,
2059
- className: cn("text-h4 text-sys-text-main", props.className)
2323
+ FormSection.displayName = "FormSection";
2324
+ var formFooterVariants = cva("flex flex-col justify-end overflow-clip pt-[48px] w-full", {
2325
+ variants: {
2326
+ align: {
2327
+ start: "items-start",
2328
+ end: "items-end",
2329
+ center: "items-center",
2330
+ stretch: "items-stretch"
2331
+ }
2332
+ },
2333
+ defaultVariants: {
2334
+ align: "end"
2060
2335
  }
2061
- ));
2062
- DrawerTitle.displayName = DialogPrimitive.Title.displayName;
2063
- var DrawerDescription = React12.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx(
2064
- DialogPrimitive.Description,
2065
- {
2066
- ref,
2067
- ...props,
2068
- className: cn("text-base-regular text-sys-text-main", props.className)
2336
+ });
2337
+ var FormFooter = React10.forwardRef(
2338
+ ({ className, align, children, ...props }, ref) => {
2339
+ return /* @__PURE__ */ jsx("div", { ref, className: cn(formFooterVariants({ align }), className), ...props, children });
2069
2340
  }
2070
- ));
2071
- DrawerDescription.displayName = DialogPrimitive.Description.displayName;
2072
- function DropdownMenu({ ...props }) {
2073
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
2074
- }
2075
- function DropdownMenuPortal({
2076
- ...props
2077
- }) {
2078
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { "data-slot": "dropdown-menu-portal", ...props });
2079
- }
2080
- function DropdownMenuTrigger({
2081
- ...props
2082
- }) {
2083
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
2084
- }
2085
- function DropdownMenuContent({
2086
- className,
2087
- sideOffset = 4,
2088
- ...props
2341
+ );
2342
+ FormFooter.displayName = "FormFooter";
2343
+ function FloatingLabelOutline({
2344
+ mode,
2345
+ label,
2346
+ required,
2347
+ isFloating,
2348
+ isMounted,
2349
+ labelColorClass,
2350
+ borderColorClass,
2351
+ isThickBorder,
2352
+ labelId
2089
2353
  }) {
2090
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
2091
- DropdownMenuPrimitive.Content,
2354
+ const transitionClass = cn(
2355
+ isMounted && "transition-[top,translate,scale,color] duration-150 ease-[cubic-bezier(0.4,0,0.2,1)]",
2356
+ "motion-reduce:transition-none"
2357
+ );
2358
+ if (mode === "standard") {
2359
+ return /* @__PURE__ */ jsxs(
2360
+ "div",
2361
+ {
2362
+ className: "pointer-events-none absolute inset-0 flex rounded-small",
2363
+ "data-slot": "notched-outline",
2364
+ children: [
2365
+ /* @__PURE__ */ jsx(
2366
+ "span",
2367
+ {
2368
+ className: cn(
2369
+ "h-full w-[8px] rounded-l-small",
2370
+ borderColorClass,
2371
+ isThickBorder ? "border-t-[2px] border-b-[2px] border-l-[2px] border-r-0" : "border-t border-b border-l border-r-0"
2372
+ )
2373
+ }
2374
+ ),
2375
+ /* @__PURE__ */ jsxs(
2376
+ "span",
2377
+ {
2378
+ className: cn(
2379
+ "h-full relative",
2380
+ borderColorClass,
2381
+ isThickBorder ? "border-t-[2px] border-b-[2px] border-l-0 border-r-0" : "border-t border-b border-l-0 border-r-0",
2382
+ isFloating && "!border-t-transparent",
2383
+ isMounted && "transition-[border-top-color] duration-150 ease-[cubic-bezier(0.4,0,0.2,1)]",
2384
+ "motion-reduce:transition-none"
2385
+ ),
2386
+ children: [
2387
+ /* @__PURE__ */ jsxs(
2388
+ "span",
2389
+ {
2390
+ className: "invisible text-small-medium px-[2px] leading-none whitespace-nowrap",
2391
+ "aria-hidden": "true",
2392
+ children: [
2393
+ label,
2394
+ required && "*"
2395
+ ]
2396
+ }
2397
+ ),
2398
+ /* @__PURE__ */ jsxs(
2399
+ "span",
2400
+ {
2401
+ id: labelId,
2402
+ "data-slot": "floating-label",
2403
+ "data-floating": isFloating,
2404
+ className: cn(
2405
+ "absolute left-0 px-[2px] whitespace-nowrap origin-left",
2406
+ "text-small-medium leading-none -translate-y-1/2",
2407
+ isFloating ? cn("scale-100 -top-[2px]", isThickBorder && "-mt-[1px]") : "top-[min(50%,18px)] scale-[1.167]",
2408
+ labelColorClass,
2409
+ transitionClass
2410
+ ),
2411
+ children: [
2412
+ label,
2413
+ required && /* @__PURE__ */ jsx("span", { className: "text-danger30 ml-[1px]", "aria-hidden": "true", children: "*" })
2414
+ ]
2415
+ }
2416
+ )
2417
+ ]
2418
+ }
2419
+ ),
2420
+ /* @__PURE__ */ jsx(
2421
+ "span",
2422
+ {
2423
+ className: cn(
2424
+ "h-full flex-1 rounded-r-small",
2425
+ borderColorClass,
2426
+ isThickBorder ? "border-t-[2px] border-b-[2px] border-r-[2px] border-l-0" : "border-t border-b border-r border-l-0"
2427
+ )
2428
+ }
2429
+ )
2430
+ ]
2431
+ }
2432
+ );
2433
+ }
2434
+ return /* @__PURE__ */ jsxs(
2435
+ "span",
2092
2436
  {
2093
- "data-slot": "dropdown-menu-content",
2094
- sideOffset,
2437
+ id: labelId,
2438
+ "data-slot": "floating-label",
2439
+ "data-floating": isFloating,
2095
2440
  className: cn(
2096
- "bg-sys-background text-base-regular",
2097
- "overflow-x-hidden overflow-y-auto shadow-gray-small rounded-xsmall p-[4px] border border-sys-divider-subtler",
2098
- "max-h-(--radix-dropdown-menu-content-available-height) ",
2099
- "min-w-[200px] origin-(--radix-dropdown-menu-content-transform-origin)",
2100
- "data-[state=open]:animate-[fade-in_150ms_ease-out,zoom-in_150ms_ease-out]",
2101
- "data-[state=closed]:animate-[fade-out_150ms_ease-in,zoom-out_150ms_ease-in]",
2102
- "data-[side=top]:animate-[slide-in-bottom_150ms_ease-out]",
2103
- "data-[side=bottom]:animate-[slide-in-top_150ms_ease-out]",
2104
- "data-[side=left]:animate-[slide-in-right_150ms_ease-out]",
2105
- "data-[side=right]:animate-[slide-in-left_150ms_ease-out]",
2106
- className
2441
+ "absolute left-[8px] pointer-events-none origin-left z-10",
2442
+ "text-small-medium leading-none whitespace-nowrap -translate-y-1/2",
2443
+ isFloating ? "-top-[2px] scale-100" : "top-[min(50%,18px)] scale-[1.167]",
2444
+ labelColorClass,
2445
+ transitionClass
2107
2446
  ),
2108
- ...props
2447
+ children: [
2448
+ label,
2449
+ required && /* @__PURE__ */ jsx("span", { className: "text-danger30 ml-[1px]", "aria-hidden": "true", children: "*" })
2450
+ ]
2109
2451
  }
2110
- ) });
2452
+ );
2111
2453
  }
2112
- function DropdownMenuGroup({ ...props }) {
2113
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
2454
+ var textareaContainerVariants = cva(
2455
+ [
2456
+ "flex w-full items-start bg-transparent",
2457
+ "rounded-small min-h-[84px] text-base-medium text-sys-text-main",
2458
+ "transition-colors"
2459
+ ].join(" "),
2460
+ {
2461
+ variants: {
2462
+ appearance: {
2463
+ standard: [
2464
+ "bg-sys-background border border-sys-divider-main py-[3px] px-[5px]",
2465
+ "hover:bg-secondary-o10"
2466
+ ].join(" "),
2467
+ none: "bg-transparent border-none py-[4px] px-[6px]"
2468
+ },
2469
+ isInvalid: {
2470
+ true: "",
2471
+ false: ""
2472
+ }
2473
+ },
2474
+ compoundVariants: [
2475
+ {
2476
+ appearance: "standard",
2477
+ isInvalid: true,
2478
+ class: "border-[2px] border-danger30 py-[2px] px-[4px]"
2479
+ }
2480
+ ],
2481
+ defaultVariants: {
2482
+ appearance: "standard",
2483
+ isInvalid: false
2484
+ }
2485
+ }
2486
+ );
2487
+ var Textarea = React10.forwardRef(
2488
+ ({
2489
+ appearance = "standard",
2490
+ label,
2491
+ required: requiredProp,
2492
+ isInvalid: isInvalidProp,
2493
+ containerClassName,
2494
+ className,
2495
+ disabled,
2496
+ readOnly,
2497
+ resize = false,
2498
+ minRows = 3,
2499
+ maxRows,
2500
+ value: valueProp,
2501
+ defaultValue,
2502
+ onChange: onChangeProp,
2503
+ onFocus: onFocusProp,
2504
+ onBlur: onBlurProp,
2505
+ style,
2506
+ ...textareaProps
2507
+ }, forwardedRef) => {
2508
+ const formControl = useFormControlContext();
2509
+ const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false;
2510
+ const textareaRef = React10.useRef(null);
2511
+ const [isFocused, setIsFocused] = React10.useState(false);
2512
+ const isControlled = valueProp !== void 0;
2513
+ const [internalValue, setInternalValue] = React10.useState(
2514
+ defaultValue !== void 0 ? String(defaultValue) : ""
2515
+ );
2516
+ const hasValue = isControlled ? String(valueProp) !== "" : internalValue !== "";
2517
+ const composedRef = React10.useCallback(
2518
+ (node) => {
2519
+ textareaRef.current = node;
2520
+ if (typeof forwardedRef === "function") forwardedRef(node);
2521
+ else if (forwardedRef)
2522
+ forwardedRef.current = node;
2523
+ },
2524
+ [forwardedRef]
2525
+ );
2526
+ const {
2527
+ hasLabel,
2528
+ isFloating,
2529
+ isMounted,
2530
+ labelColorClass,
2531
+ borderColorClass,
2532
+ isThickBorder,
2533
+ labelId
2534
+ } = useFloatingLabel({
2535
+ label,
2536
+ hasValue,
2537
+ isFocused,
2538
+ isInvalid: !!isInvalid,
2539
+ isDisabled: !!disabled});
2540
+ const showNotchedOutline = hasLabel && appearance !== "none";
2541
+ const showNoneLabel = hasLabel && appearance === "none";
2542
+ const handleChange = React10.useCallback(
2543
+ (e) => {
2544
+ if (!isControlled) setInternalValue(e.target.value);
2545
+ onChangeProp?.(e);
2546
+ },
2547
+ [isControlled, onChangeProp]
2548
+ );
2549
+ const handleFocus = React10.useCallback(
2550
+ (e) => {
2551
+ setIsFocused(true);
2552
+ onFocusProp?.(e);
2553
+ },
2554
+ [onFocusProp]
2555
+ );
2556
+ const handleBlur = React10.useCallback(
2557
+ (e) => {
2558
+ setIsFocused(false);
2559
+ onBlurProp?.(e);
2560
+ },
2561
+ [onBlurProp]
2562
+ );
2563
+ return /* @__PURE__ */ jsxs(
2564
+ "div",
2565
+ {
2566
+ "data-slot": "textarea",
2567
+ "aria-disabled": disabled || void 0,
2568
+ className: cn(
2569
+ textareaContainerVariants({ appearance, isInvalid }),
2570
+ // Focus styling (state-managed, standard appearance without notched outline only)
2571
+ isFocused && !isInvalid && appearance === "standard" && !showNotchedOutline && "border-[2px] border-sys-focus-ring-bold py-[2px] px-[4px]",
2572
+ // Floating label positioning
2573
+ (showNotchedOutline || showNoneLabel) && "relative",
2574
+ // Notched outline draws border — remove container's own border
2575
+ showNotchedOutline && "!border-0 !py-[4px] !px-[6px]",
2576
+ // Disabled / cursor
2577
+ disabled ? "cursor-not-allowed opacity-50" : "cursor-text",
2578
+ // disabled 시 hover 배경 무력화 (div container라 :disabled 불가 → JS 조건부; none은 원래 hover bg 없음)
2579
+ disabled && appearance !== "none" && "hover:bg-sys-background",
2580
+ containerClassName,
2581
+ // 외부 className 은 root container 에 적용 — FormControl 의 maxWidth 가
2582
+ // 자식 className 에 inject 되는데, wrapper div 의 폭 제어가 의도이므로
2583
+ // inner textarea 가 아닌 여기에 머지한다.
2584
+ className
2585
+ ),
2586
+ style: {
2587
+ resize: resize ? "vertical" : "none",
2588
+ overflow: resize ? "hidden" : void 0
2589
+ },
2590
+ children: [
2591
+ (showNotchedOutline || showNoneLabel) && /* @__PURE__ */ jsx(
2592
+ FloatingLabelOutline,
2593
+ {
2594
+ mode: showNotchedOutline ? "standard" : "none",
2595
+ label,
2596
+ required: requiredProp,
2597
+ isFloating,
2598
+ isMounted,
2599
+ labelColorClass,
2600
+ borderColorClass,
2601
+ isThickBorder,
2602
+ labelId
2603
+ }
2604
+ ),
2605
+ /* @__PURE__ */ jsx(
2606
+ TextareaAutosize,
2607
+ {
2608
+ ref: composedRef,
2609
+ minRows,
2610
+ maxRows,
2611
+ disabled,
2612
+ readOnly,
2613
+ value: isControlled ? valueProp : void 0,
2614
+ defaultValue: !isControlled ? defaultValue : void 0,
2615
+ onChange: handleChange,
2616
+ onFocus: handleFocus,
2617
+ onBlur: handleBlur,
2618
+ "aria-labelledby": hasLabel ? labelId : void 0,
2619
+ "aria-required": hasLabel && requiredProp ? true : void 0,
2620
+ className: cn(
2621
+ "flex-1 min-w-0 bg-transparent border-none outline-none",
2622
+ "text-base-medium text-sys-text-main",
2623
+ "placeholder:text-sys-text-placeholder",
2624
+ "disabled:cursor-not-allowed",
2625
+ "px-[4px] py-[2px]",
2626
+ // maxRows 미지정(무한 auto-grow) 시 자체 스크롤바 숨김: 스크롤바가 뜨면 content 폭이 줄어
2627
+ // autosize 재측정과 어긋나 스크롤바가 고착되는 피드백 루프를 막는다(스크롤바 없으면 content 가
2628
+ // height 에 정확히 맞아 잘림 없음). maxRows 지정(바운드) 시엔 기본 overflow-y:auto 로 캡 초과분 스크롤.
2629
+ maxRows == null && "overflow-hidden",
2630
+ // When label is down (acting as placeholder), hide textarea's placeholder
2631
+ hasLabel && !hasValue && !isFocused && "placeholder:text-transparent"
2632
+ ),
2633
+ style: {
2634
+ resize: "none",
2635
+ ...style
2636
+ },
2637
+ ...textareaProps
2638
+ }
2639
+ )
2640
+ ]
2641
+ }
2642
+ );
2643
+ }
2644
+ );
2645
+ Textarea.displayName = "Textarea";
2646
+ var ChatComposer = React10.forwardRef(
2647
+ ({
2648
+ value,
2649
+ onValueChange,
2650
+ onSubmit,
2651
+ streaming = false,
2652
+ onStop,
2653
+ disabled = false,
2654
+ placeholder = "\uBA54\uC2DC\uC9C0\uB97C \uC785\uB825\uD558\uC138\uC694",
2655
+ label = "\uBA54\uC2DC\uC9C0",
2656
+ maxRows = 6,
2657
+ menu,
2658
+ elemBefore,
2659
+ elemAfter,
2660
+ attachments,
2661
+ onAttach,
2662
+ onRemoveAttachment,
2663
+ accept,
2664
+ multiple = true,
2665
+ className
2666
+ }, forwardedRef) => {
2667
+ const textareaRef = React10.useRef(null);
2668
+ const setRef = React10.useCallback(
2669
+ (el) => {
2670
+ textareaRef.current = el;
2671
+ if (typeof forwardedRef === "function") forwardedRef(el);
2672
+ else if (forwardedRef) forwardedRef.current = el;
2673
+ },
2674
+ [forwardedRef]
2675
+ );
2676
+ const fileRef = React10.useRef(null);
2677
+ const [inner, setInner] = React10.useState("");
2678
+ const text = value ?? inner;
2679
+ const setText = (next) => {
2680
+ if (value === void 0) setInner(next);
2681
+ onValueChange?.(next);
2682
+ };
2683
+ const files = attachments ?? [];
2684
+ const uploading = files.some((file) => file.status === "uploading");
2685
+ const hasContent = text.trim() !== "" || files.length > 0;
2686
+ const canSend = !disabled && !streaming && hasContent && !uploading;
2687
+ const submit = () => {
2688
+ if (!canSend) return;
2689
+ onSubmit(text.trim());
2690
+ setText("");
2691
+ textareaRef.current?.focus();
2692
+ };
2693
+ const handleKeyDown = (e) => {
2694
+ if (e.nativeEvent.isComposing || e.keyCode === 229) return;
2695
+ if (e.key !== "Enter" || e.shiftKey) return;
2696
+ e.preventDefault();
2697
+ submit();
2698
+ };
2699
+ const handleFiles = (e) => {
2700
+ const picked = Array.from(e.target.files ?? []);
2701
+ e.target.value = "";
2702
+ if (picked.length) onAttach?.(picked);
2703
+ };
2704
+ const failed = files.filter((file) => file.status === "error" && file.error);
2705
+ return /* @__PURE__ */ jsxs(
2706
+ "div",
2707
+ {
2708
+ "data-slot": "chat-composer",
2709
+ className: cn(
2710
+ "flex flex-col gap-[4px] rounded-xlarge border border-sys-divider-subtle bg-sys-background p-[8px] shadow-gray-small",
2711
+ // Textarea 의 appearance='none' 은 포커스 표시가 없다 — 상자가 대신 보여 준다
2712
+ "has-[textarea:focus-visible]:border-primary30 has-[textarea:focus-visible]:outline-[2px] has-[textarea:focus-visible]:outline-sys-focus-ring-main",
2713
+ disabled && "bg-sys-background-subtle shadow-none",
2714
+ className
2715
+ ),
2716
+ children: [
2717
+ files.length ? /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-wrap gap-[8px] px-[4px] pt-[4px]", children: files.map((file) => /* @__PURE__ */ jsx("li", { className: "min-w-0", children: /* @__PURE__ */ jsxs(
2718
+ Tag,
2719
+ {
2720
+ variant: file.status === "error" ? "danger" : "secondary",
2721
+ elemBefore: file.status === "uploading" ? /* @__PURE__ */ jsx(Spinner, { size: "small", variant: "current", "aria-hidden": true }) : /* @__PURE__ */ jsx(Paperclip, { size: 14, "aria-hidden": true }),
2722
+ onRemove: onRemoveAttachment ? () => onRemoveAttachment(file.id) : void 0,
2723
+ removeLabel: `${file.name} \uC0AD\uC81C`,
2724
+ className: "max-w-[240px]",
2725
+ children: [
2726
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: file.name }),
2727
+ file.status === "uploading" ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: " \uC62C\uB9AC\uB294 \uC911" }) : null
2728
+ ]
2729
+ }
2730
+ ) }, file.id)) }) : null,
2731
+ failed.length ? /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col px-[4px] text-small-regular-h text-danger40", children: failed.map((file) => /* @__PURE__ */ jsxs("li", { children: [
2732
+ file.name,
2733
+ ": ",
2734
+ file.error
2735
+ ] }, file.id)) }) : null,
2736
+ /* @__PURE__ */ jsx(
2737
+ Textarea,
2738
+ {
2739
+ ref: setRef,
2740
+ appearance: "none",
2741
+ "aria-label": label,
2742
+ className: "min-h-[36px]",
2743
+ minRows: 1,
2744
+ maxRows,
2745
+ placeholder,
2746
+ value: text,
2747
+ disabled,
2748
+ onChange: (e) => setText(e.target.value),
2749
+ onKeyDown: handleKeyDown
2750
+ }
2751
+ ),
2752
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-[8px]", children: [
2753
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-[8px]", children: [
2754
+ onAttach ? /* @__PURE__ */ jsx(
2755
+ "input",
2756
+ {
2757
+ ref: fileRef,
2758
+ type: "file",
2759
+ hidden: true,
2760
+ tabIndex: -1,
2761
+ accept,
2762
+ multiple,
2763
+ onChange: handleFiles
2764
+ }
2765
+ ) : null,
2766
+ onAttach || menu ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
2767
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { variant: "secondaryLink", "aria-label": "\uCD94\uAC00", disabled, children: /* @__PURE__ */ jsx(Plus, { size: 20 }) }) }),
2768
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { side: "top", align: "start", children: [
2769
+ onAttach ? /* @__PURE__ */ jsxs(DropdownMenuItem, { onSelect: () => fileRef.current?.click(), children: [
2770
+ /* @__PURE__ */ jsx(Paperclip, { size: 16, "aria-hidden": true }),
2771
+ "\uD30C\uC77C \uCCA8\uBD80"
2772
+ ] }) : null,
2773
+ menu
2774
+ ] })
2775
+ ] }) : null,
2776
+ elemBefore
2777
+ ] }),
2778
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-[8px]", children: [
2779
+ elemAfter,
2780
+ streaming && onStop ? /* @__PURE__ */ jsx(
2781
+ IconButton,
2782
+ {
2783
+ variant: "secondaryBold",
2784
+ shape: "rounded",
2785
+ "aria-label": "\uC751\uB2F5 \uC911\uC9C0",
2786
+ onClick: () => {
2787
+ onStop();
2788
+ textareaRef.current?.focus();
2789
+ },
2790
+ children: /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", "aria-hidden": true, children: /* @__PURE__ */ jsx("rect", { x: "5", y: "5", width: "10", height: "10", rx: "2", fill: "currentColor" }) })
2791
+ }
2792
+ ) : /* @__PURE__ */ jsx(
2793
+ IconButton,
2794
+ {
2795
+ variant: "primaryBold",
2796
+ shape: "rounded",
2797
+ "aria-label": "\uBCF4\uB0B4\uAE30",
2798
+ disabled: !canSend,
2799
+ onClick: submit,
2800
+ children: /* @__PURE__ */ jsx(ArrowUp, { size: 20 })
2801
+ }
2802
+ )
2803
+ ] })
2804
+ ] })
2805
+ ]
2806
+ }
2807
+ );
2808
+ }
2809
+ );
2810
+ ChatComposer.displayName = "ChatComposer";
2811
+ function Skeleton({ className, ...props }) {
2812
+ return /* @__PURE__ */ jsx("div", { className: cn("animate-pulse rounded-md bg-secondary20", className), ...props });
2114
2813
  }
2115
- function DropdownMenuItem({
2116
- className,
2117
- variant = "default",
2118
- keepOpen = false,
2119
- onSelect,
2120
- ...props
2814
+ function seededWidth(row, col, min, max) {
2815
+ const hash = (row * 31 + col * 17 + 7) * 2654435761 >>> 0;
2816
+ return min + hash % (max - min + 1);
2817
+ }
2818
+ function buildColumns(columnDefs, selectionColumnWidth) {
2819
+ const cols = [];
2820
+ if (selectionColumnWidth != null) {
2821
+ cols.push({ width: selectionColumnWidth });
2822
+ }
2823
+ for (const def of columnDefs) {
2824
+ cols.push({
2825
+ width: def.width,
2826
+ flex: def.flex,
2827
+ minWidth: def.minWidth
2828
+ });
2829
+ }
2830
+ return cols;
2831
+ }
2832
+ function getColStyle(col) {
2833
+ if (col.width != null) {
2834
+ return { width: col.width, flexShrink: 0 };
2835
+ }
2836
+ if (col.flex != null) {
2837
+ return { flex: col.flex, minWidth: col.minWidth };
2838
+ }
2839
+ return { flex: 1 };
2840
+ }
2841
+ function TableSkeleton({
2842
+ columnDefs = [],
2843
+ rowLength = 3,
2844
+ rowHeight = 50,
2845
+ headerHeight = 40,
2846
+ selectionColumnWidth
2121
2847
  }) {
2122
- const handleSelect = React12.useCallback(
2123
- (event) => {
2124
- onSelect?.(event);
2125
- if (keepOpen) event.preventDefault();
2848
+ const displayRowLength = rowLength && rowLength > 0 ? rowLength : 5;
2849
+ const columns = buildColumns(columnDefs, selectionColumnWidth);
2850
+ return /* @__PURE__ */ jsxs(Stack, { direction: "column", className: "w-full", children: [
2851
+ /* @__PURE__ */ jsx(
2852
+ "div",
2853
+ {
2854
+ className: "flex items-center bg-sys-table-header-background border-b border-sys-divider-subtler rounded-[6px]",
2855
+ style: { height: headerHeight + 1, paddingLeft: 10, paddingRight: 10 },
2856
+ children: columns.map((col, colIndex) => /* @__PURE__ */ jsx("div", { className: "flex items-center px-[6px]", style: getColStyle(col), children: /* @__PURE__ */ jsx(
2857
+ Skeleton,
2858
+ {
2859
+ className: "h-[12px] rounded-[3px] !bg-grayscale-s20",
2860
+ style: { width: `${seededWidth(0, colIndex, 40, 70)}%` }
2861
+ }
2862
+ ) }, colIndex))
2863
+ }
2864
+ ),
2865
+ Array.from({ length: displayRowLength }).map((_, rowIndex) => /* @__PURE__ */ jsx(
2866
+ "div",
2867
+ {
2868
+ className: cn(
2869
+ "flex items-center",
2870
+ rowIndex < displayRowLength - 1 && "border-b border-sys-divider-subtler"
2871
+ ),
2872
+ style: { height: rowHeight, paddingLeft: 10, paddingRight: 10 },
2873
+ children: columns.map((col, colIndex) => /* @__PURE__ */ jsx("div", { className: "flex items-center px-[6px]", style: getColStyle(col), children: /* @__PURE__ */ jsx(
2874
+ Skeleton,
2875
+ {
2876
+ className: "h-[14px] rounded-[3px]",
2877
+ style: { width: `${seededWidth(rowIndex + 1, colIndex, 40, 80)}%` }
2878
+ }
2879
+ ) }, colIndex))
2880
+ },
2881
+ rowIndex
2882
+ ))
2883
+ ] });
2884
+ }
2885
+ var textFieldContainerVariants = cva(
2886
+ [
2887
+ "flex w-full items-center gap-[2px] bg-transparent",
2888
+ "rounded-small min-h-[36px] text-base-medium text-sys-text-main",
2889
+ "transition-colors"
2890
+ ].join(" "),
2891
+ {
2892
+ variants: {
2893
+ appearance: {
2894
+ standard: [
2895
+ "bg-sys-background border border-sys-divider-main py-[3px] px-[5px]",
2896
+ "hover:bg-secondary-o10"
2897
+ ].join(" "),
2898
+ none: "bg-transparent border-none py-[4px] px-[6px]"
2899
+ },
2900
+ isInvalid: {
2901
+ true: "",
2902
+ false: ""
2903
+ }
2126
2904
  },
2127
- [onSelect, keepOpen]
2128
- );
2129
- return /* @__PURE__ */ jsx(
2130
- DropdownMenuPrimitive.Item,
2131
- {
2132
- "data-slot": "dropdown-menu-item",
2133
- "data-variant": variant,
2134
- onSelect: handleSelect,
2135
- className: cn(
2136
- "relative flex cursor-default items-center gap-[12px] rounded-xsmall p-[6px] text-base-regular outline-hidden select-none",
2137
- "data-[variant=danger]:text-danger30",
2138
- "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-[20px]",
2139
- "focus:bg-secondary-o10",
2140
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2141
- className
2142
- ),
2143
- ...props
2905
+ compoundVariants: [
2906
+ {
2907
+ appearance: "standard",
2908
+ isInvalid: true,
2909
+ class: "border-[2px] border-danger30 py-[2px] px-[4px]"
2910
+ }
2911
+ ],
2912
+ defaultVariants: {
2913
+ appearance: "standard",
2914
+ isInvalid: false
2144
2915
  }
2145
- );
2916
+ }
2917
+ );
2918
+ var TextField = React10.forwardRef(
2919
+ ({
2920
+ appearance = "standard",
2921
+ label,
2922
+ required: requiredProp,
2923
+ hasClearButton,
2924
+ elemBeforeInput,
2925
+ elemAfterInput,
2926
+ isInvalid: isInvalidProp,
2927
+ containerClassName,
2928
+ className,
2929
+ disabled,
2930
+ readOnly,
2931
+ value: valueProp,
2932
+ defaultValue,
2933
+ onChange: onChangeProp,
2934
+ onFocus: onFocusProp,
2935
+ onBlur: onBlurProp,
2936
+ ...inputProps
2937
+ }, forwardedRef) => {
2938
+ const formControl = useFormControlContext();
2939
+ const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false;
2940
+ const inputRef = React10.useRef(null);
2941
+ const [isFocused, setIsFocused] = React10.useState(false);
2942
+ const isControlled = valueProp !== void 0;
2943
+ const [internalValue, setInternalValue] = React10.useState(
2944
+ defaultValue !== void 0 ? String(defaultValue) : ""
2945
+ );
2946
+ const hasValue = isControlled ? String(valueProp) !== "" : internalValue !== "";
2947
+ const composedRef = React10.useCallback(
2948
+ (node) => {
2949
+ inputRef.current = node;
2950
+ if (typeof forwardedRef === "function") forwardedRef(node);
2951
+ else if (forwardedRef)
2952
+ forwardedRef.current = node;
2953
+ },
2954
+ [forwardedRef]
2955
+ );
2956
+ const {
2957
+ hasLabel,
2958
+ isFloating,
2959
+ isMounted,
2960
+ labelColorClass,
2961
+ borderColorClass,
2962
+ isThickBorder,
2963
+ labelId
2964
+ } = useFloatingLabel({
2965
+ label,
2966
+ hasValue,
2967
+ isFocused,
2968
+ isInvalid: !!isInvalid,
2969
+ isDisabled: !!disabled});
2970
+ const showNotchedOutline = hasLabel && appearance !== "none";
2971
+ const showNoneLabel = hasLabel && appearance === "none";
2972
+ const handleChange = React10.useCallback(
2973
+ (e) => {
2974
+ if (!isControlled) setInternalValue(e.target.value);
2975
+ onChangeProp?.(e);
2976
+ },
2977
+ [isControlled, onChangeProp]
2978
+ );
2979
+ const handleFocus = React10.useCallback(
2980
+ (e) => {
2981
+ setIsFocused(true);
2982
+ onFocusProp?.(e);
2983
+ },
2984
+ [onFocusProp]
2985
+ );
2986
+ const handleBlur = React10.useCallback(
2987
+ (e) => {
2988
+ setIsFocused(false);
2989
+ onBlurProp?.(e);
2990
+ },
2991
+ [onBlurProp]
2992
+ );
2993
+ const handleClear = React10.useCallback(() => {
2994
+ const input = inputRef.current;
2995
+ if (!input) return;
2996
+ if (!isControlled) setInternalValue("");
2997
+ const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
2998
+ if (nativeSetter) {
2999
+ nativeSetter.call(input, "");
3000
+ input.dispatchEvent(new Event("input", { bubbles: true }));
3001
+ }
3002
+ input.focus();
3003
+ }, [isControlled]);
3004
+ return /* @__PURE__ */ jsxs(
3005
+ "div",
3006
+ {
3007
+ "data-slot": "text-field",
3008
+ "aria-disabled": disabled || void 0,
3009
+ className: cn(
3010
+ textFieldContainerVariants({ appearance, isInvalid }),
3011
+ CLEAR_HOST_CLASS,
3012
+ // Focus styling (state-managed, standard appearance without notched outline only)
3013
+ isFocused && !isInvalid && appearance === "standard" && !showNotchedOutline && "border-[2px] border-sys-focus-ring-bold py-[2px] px-[4px]",
3014
+ // Floating label positioning
3015
+ (showNotchedOutline || showNoneLabel) && "relative",
3016
+ // Notched outline draws border — remove container's own border
3017
+ showNotchedOutline && "!border-0 !py-[4px] !px-[6px]",
3018
+ // Disabled / cursor
3019
+ disabled ? "cursor-not-allowed opacity-50" : "cursor-text",
3020
+ // disabled 시 hover 배경 무력화 (div container라 :disabled 불가 → JS 조건부; none은 원래 hover bg 없음)
3021
+ disabled && appearance !== "none" && "hover:bg-sys-background",
3022
+ containerClassName,
3023
+ // 외부 className 은 root container 에 적용 — FormControl 의 maxWidth 가
3024
+ // 자식 className 에 inject 되는데, wrapper div 의 폭 제어가 의도이므로
3025
+ // inner input 이 아닌 여기에 머지한다.
3026
+ className
3027
+ ),
3028
+ children: [
3029
+ (showNotchedOutline || showNoneLabel) && /* @__PURE__ */ jsx(
3030
+ FloatingLabelOutline,
3031
+ {
3032
+ mode: showNotchedOutline ? "standard" : "none",
3033
+ label,
3034
+ required: requiredProp,
3035
+ isFloating,
3036
+ isMounted,
3037
+ labelColorClass,
3038
+ borderColorClass,
3039
+ isThickBorder,
3040
+ labelId
3041
+ }
3042
+ ),
3043
+ elemBeforeInput && /* @__PURE__ */ jsx(
3044
+ "span",
3045
+ {
3046
+ className: cn(
3047
+ // 아이콘은 24×24, 글자("개"·"코어")는 줄바꿈 없이 폭이 늘어난다 — 고정 size-[24px] 는 두 글자가 두 줄로 깨졌다 (2026-10-12)
3048
+ "shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap",
3049
+ typeof elemBeforeInput === "string" && "px-[2px] text-sys-text-subtle",
3050
+ hasLabel && !isFloating && "invisible"
3051
+ ),
3052
+ children: elemBeforeInput
3053
+ }
3054
+ ),
3055
+ /* @__PURE__ */ jsx(
3056
+ "input",
3057
+ {
3058
+ ref: composedRef,
3059
+ disabled,
3060
+ readOnly,
3061
+ value: isControlled ? valueProp : void 0,
3062
+ defaultValue: !isControlled ? defaultValue : void 0,
3063
+ onChange: handleChange,
3064
+ onFocus: handleFocus,
3065
+ onBlur: handleBlur,
3066
+ "aria-labelledby": hasLabel ? labelId : void 0,
3067
+ "aria-required": hasLabel && requiredProp ? true : void 0,
3068
+ className: cn(
3069
+ "flex-1 min-w-0 bg-transparent border-none outline-none",
3070
+ "text-base-medium text-sys-text-main",
3071
+ "placeholder:text-sys-text-placeholder",
3072
+ "disabled:cursor-not-allowed",
3073
+ "px-[4px] py-[2px]",
3074
+ // When label is down (acting as placeholder), hide input's placeholder
3075
+ hasLabel && !hasValue && !isFocused && "placeholder:text-transparent"
3076
+ ),
3077
+ ...inputProps
3078
+ }
3079
+ ),
3080
+ hasClearButton && /* @__PURE__ */ jsx(
3081
+ "button",
3082
+ {
3083
+ type: "button",
3084
+ onClick: handleClear,
3085
+ className: cn(
3086
+ "shrink-0 flex items-center justify-center p-[2px] rounded-small hover:bg-secondary-o10 text-sys-text-subtler",
3087
+ CLEAR_REVEAL_CLASS,
3088
+ (!hasValue || disabled || readOnly) && "invisible"
3089
+ ),
3090
+ "aria-label": "\uC785\uB825 \uC9C0\uC6B0\uAE30",
3091
+ tabIndex: -1,
3092
+ children: /* @__PURE__ */ jsx(CancelIcon, { size: 20 })
3093
+ }
3094
+ ),
3095
+ elemAfterInput && /* @__PURE__ */ jsx(
3096
+ "span",
3097
+ {
3098
+ className: cn(
3099
+ "shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap",
3100
+ typeof elemAfterInput === "string" && "px-[2px] text-sys-text-subtle"
3101
+ ),
3102
+ children: elemAfterInput
3103
+ }
3104
+ )
3105
+ ]
3106
+ }
3107
+ );
3108
+ }
3109
+ );
3110
+ TextField.displayName = "TextField";
3111
+ var GROUP_LABELS = ["\uC624\uB298", "\uC5B4\uC81C", "\uC9C0\uB09C 7\uC77C", "\uC9C0\uB09C 30\uC77C", "\uC774\uC804"];
3112
+ function groupChatHistoryByDate(items, now) {
3113
+ if (items.length === 0) return [];
3114
+ const dates = items.map((item) => item.updatedAt == null ? null : new Date(item.updatedAt));
3115
+ if (dates.some((date) => date == null || !isValid(date))) return [{ label: null, items }];
3116
+ const buckets = GROUP_LABELS.map(() => []);
3117
+ items.forEach((item, i) => {
3118
+ const days = differenceInCalendarDays(now, dates[i]);
3119
+ const index = days <= 0 ? 0 : days === 1 ? 1 : days <= 7 ? 2 : days <= 30 ? 3 : 4;
3120
+ buckets[index].push(item);
3121
+ });
3122
+ return buckets.map((bucket, i) => ({ label: GROUP_LABELS[i], items: bucket })).filter((group) => group.items.length > 0);
2146
3123
  }
2147
- function DropdownMenuSeparator({
2148
- className,
2149
- ...props
2150
- }) {
2151
- return /* @__PURE__ */ jsx(
2152
- DropdownMenuPrimitive.Separator,
3124
+ function HistoryRow({ item, active, onSelect, onRename, onDelete }) {
3125
+ const title = item.title.trim() || "\uC81C\uBAA9 \uC5C6\uC74C";
3126
+ const [editing, setEditing] = React10.useState(false);
3127
+ const [draft, setDraft] = React10.useState("");
3128
+ const inputRef = React10.useRef(null);
3129
+ const triggerRef = React10.useRef(null);
3130
+ const pendingRef = React10.useRef(void 0);
3131
+ React10.useEffect(() => {
3132
+ if (!editing) return;
3133
+ inputRef.current?.focus();
3134
+ inputRef.current?.select();
3135
+ }, [editing]);
3136
+ const finish = (commit) => {
3137
+ setEditing(false);
3138
+ const next = draft.trim();
3139
+ if (commit && next !== "" && next !== item.title) onRename?.(item.id, next);
3140
+ };
3141
+ const hasMenu = Boolean(onRename || onDelete);
3142
+ return /* @__PURE__ */ jsxs(
3143
+ "li",
2153
3144
  {
2154
- "data-slot": "dropdown-menu-separator",
2155
- className: cn("bg-sys-divider-subtle -mx-[1px] my-[1px] h-[1px]", className),
2156
- ...props
3145
+ className: cn(
3146
+ "group/row relative flex h-[36px] items-center gap-[4px] rounded-small pr-[4px] pl-[12px]",
3147
+ active ? "bg-primary-o10" : "hover:bg-secondary-o10"
3148
+ ),
3149
+ children: [
3150
+ editing ? (
3151
+ // 줄 높이 안에 들어가는 그 자리 입력. TextField 는 높이·테두리가 줄보다 크다
3152
+ /* @__PURE__ */ jsx(
3153
+ "input",
3154
+ {
3155
+ ref: inputRef,
3156
+ value: draft,
3157
+ "aria-label": `${title} \uC774\uB984 \uBCC0\uACBD`,
3158
+ onChange: (e) => setDraft(e.target.value),
3159
+ onBlur: () => finish(true),
3160
+ onKeyDown: (e) => {
3161
+ if (e.nativeEvent.isComposing || e.keyCode === 229) return;
3162
+ if (e.key === "Enter") {
3163
+ e.preventDefault();
3164
+ finish(true);
3165
+ } else if (e.key === "Escape") {
3166
+ e.preventDefault();
3167
+ finish(false);
3168
+ }
3169
+ },
3170
+ className: "-ml-[8px] min-w-0 flex-1 rounded-xsmall bg-sys-background px-[8px] py-[2px] text-base-regular text-sys-text-main outline-none ring-[2px] ring-inset ring-sys-focus-ring-main"
3171
+ }
3172
+ )
3173
+ ) : /* @__PURE__ */ jsx(
3174
+ "button",
3175
+ {
3176
+ type: "button",
3177
+ "aria-current": active ? "true" : void 0,
3178
+ title,
3179
+ onClick: () => onSelect(item.id),
3180
+ className: cn(
3181
+ "h-full min-w-0 flex-1 cursor-pointer truncate rounded-xsmall text-left focus-visible:outline-[2px] focus-visible:outline-sys-focus-ring-main",
3182
+ active ? "text-base-medium text-primary40" : "text-base-regular text-sys-text-main"
3183
+ ),
3184
+ children: title
3185
+ }
3186
+ ),
3187
+ hasMenu && !editing ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
3188
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
3189
+ IconButton,
3190
+ {
3191
+ ref: triggerRef,
3192
+ variant: "secondaryLink",
3193
+ "aria-label": `${title} \uB354\uBCF4\uAE30`,
3194
+ className: cn(
3195
+ // 고른 줄은 항상, 나머지는 올리거나 포커스했을 때 보인다(키보드로는 항상 닿는다)
3196
+ "shrink-0 opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100",
3197
+ active && "opacity-100"
3198
+ ),
3199
+ children: /* @__PURE__ */ jsx(Ellipsis, { size: 16 })
3200
+ }
3201
+ ) }),
3202
+ /* @__PURE__ */ jsxs(
3203
+ DropdownMenuContent,
3204
+ {
3205
+ align: "end",
3206
+ onCloseAutoFocus: (e) => {
3207
+ e.preventDefault();
3208
+ triggerRef.current?.focus();
3209
+ const fn = pendingRef.current;
3210
+ pendingRef.current = void 0;
3211
+ fn?.();
3212
+ },
3213
+ children: [
3214
+ onRename ? /* @__PURE__ */ jsx(
3215
+ DropdownMenuItem,
3216
+ {
3217
+ onSelect: () => {
3218
+ pendingRef.current = () => {
3219
+ setDraft(item.title);
3220
+ setEditing(true);
3221
+ };
3222
+ },
3223
+ children: "\uC774\uB984 \uBCC0\uACBD"
3224
+ }
3225
+ ) : null,
3226
+ onDelete ? /* @__PURE__ */ jsx(
3227
+ DropdownMenuItem,
3228
+ {
3229
+ variant: "danger",
3230
+ onSelect: () => {
3231
+ pendingRef.current = () => onDelete(item.id);
3232
+ },
3233
+ children: "\uC0AD\uC81C"
3234
+ }
3235
+ ) : null
3236
+ ]
3237
+ }
3238
+ )
3239
+ ] }) : null
3240
+ ]
2157
3241
  }
2158
3242
  );
2159
3243
  }
2160
- function DropdownMenuSub({ ...props }) {
2161
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
2162
- }
2163
- function DropdownMenuSubTrigger({
2164
- className,
2165
- children,
2166
- ...props
3244
+ function Notice({
3245
+ role,
3246
+ icon,
3247
+ title,
3248
+ description,
3249
+ action
2167
3250
  }) {
2168
3251
  return /* @__PURE__ */ jsxs(
2169
- DropdownMenuPrimitive.SubTrigger,
3252
+ "div",
2170
3253
  {
2171
- "data-slot": "dropdown-menu-sub-trigger",
2172
- className: cn(
2173
- "relative flex cursor-default items-center gap-[12px] rounded-xsmall p-[6px] text-base-regular outline-hidden select-none",
2174
- "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-[20px]",
2175
- "focus:bg-secondary-o10",
2176
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2177
- className
2178
- ),
2179
- ...props,
3254
+ role,
3255
+ className: "flex flex-col items-center gap-[4px] px-[12px] py-[32px] text-center",
2180
3256
  children: [
2181
- children,
2182
- /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-[20px]" })
3257
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "mb-[4px] flex text-sys-text-subtler", children: icon }),
3258
+ /* @__PURE__ */ jsx("span", { className: "text-base-medium text-sys-text-main", children: title }),
3259
+ description ? /* @__PURE__ */ jsx("span", { className: "break-keep text-small-regular-h text-sys-text-subtle wrap-break-word", children: description }) : null,
3260
+ action ? /* @__PURE__ */ jsx("div", { className: "mt-[8px]", children: action }) : null
2183
3261
  ]
2184
3262
  }
2185
3263
  );
2186
3264
  }
2187
- function DropdownMenuSubContent({
2188
- className,
2189
- ...props
3265
+ function ChatHistory({
3266
+ items,
3267
+ activeId,
3268
+ onSelect,
3269
+ onNew,
3270
+ onRename,
3271
+ onDelete,
3272
+ search,
3273
+ loading = false,
3274
+ error,
3275
+ onRetry,
3276
+ hasMore = false,
3277
+ onLoadMore,
3278
+ now,
3279
+ className
2190
3280
  }) {
2191
- return /* @__PURE__ */ jsx(
2192
- DropdownMenuPrimitive.SubContent,
3281
+ const [mountedAt] = React10.useState(() => Date.now());
3282
+ const groups = React10.useMemo(
3283
+ () => groupChatHistoryByDate(items, now ?? mountedAt),
3284
+ [items, now, mountedAt]
3285
+ );
3286
+ const moreRef = React10.useRef(null);
3287
+ const loadMoreRef = React10.useRef(onLoadMore);
3288
+ React10.useEffect(() => {
3289
+ loadMoreRef.current = onLoadMore;
3290
+ }, [onLoadMore]);
3291
+ React10.useEffect(() => {
3292
+ const el = moreRef.current;
3293
+ if (!hasMore || !el || typeof IntersectionObserver === "undefined") return;
3294
+ const io = new IntersectionObserver((entries) => {
3295
+ if (entries.some((entry) => entry.isIntersecting)) loadMoreRef.current?.();
3296
+ });
3297
+ io.observe(el);
3298
+ return () => io.disconnect();
3299
+ }, [hasMore, items.length]);
3300
+ const searching = Boolean(search?.value.trim());
3301
+ return /* @__PURE__ */ jsxs("nav", { "aria-label": "\uB300\uD654 \uAE30\uB85D", className: cn("flex min-h-0 flex-col gap-[8px]", className), children: [
3302
+ onNew ? /* @__PURE__ */ jsxs(
3303
+ Button,
3304
+ {
3305
+ type: "button",
3306
+ variant: "primaryLink",
3307
+ className: "w-full justify-start px-[12px]",
3308
+ onClick: onNew,
3309
+ children: [
3310
+ /* @__PURE__ */ jsx(Plus, { size: 16, "aria-hidden": true, className: "mr-[6px]" }),
3311
+ "\uC0C8 \uB300\uD654"
3312
+ ]
3313
+ }
3314
+ ) : null,
3315
+ search ? /* @__PURE__ */ jsx(
3316
+ TextField,
3317
+ {
3318
+ appearance: "none",
3319
+ "aria-label": "\uB300\uD654 \uAC80\uC0C9",
3320
+ placeholder: "\uB300\uD654 \uAC80\uC0C9",
3321
+ value: search.value,
3322
+ onChange: (e) => search.onChange(e.target.value),
3323
+ hasClearButton: true,
3324
+ elemBeforeInput: /* @__PURE__ */ jsx(Search, { size: 16, "aria-hidden": true, className: "text-sys-text-subtler" }),
3325
+ className: "rounded-none border-b border-solid border-sys-divider-subtler px-[8px] focus-within:border-sys-focus-ring-bold"
3326
+ }
3327
+ ) : null,
3328
+ /* @__PURE__ */ jsx(
3329
+ "div",
3330
+ {
3331
+ tabIndex: 0,
3332
+ className: cn(
3333
+ "-mx-[4px] min-h-0 flex-1 overflow-y-auto px-[4px] outline-none focus-visible:ring-[2px] focus-visible:ring-inset focus-visible:ring-sys-focus-ring-main",
3334
+ // 목록은 위의 도구(새 대화·검색)와 다른 묶음 — 묶음 사이는 24(nav 의 gap 8 + 16)
3335
+ (onNew || search) && "mt-[16px]"
3336
+ ),
3337
+ children: loading ? /* @__PURE__ */ jsx(
3338
+ "div",
3339
+ {
3340
+ role: "status",
3341
+ "aria-label": "\uB300\uD654 \uAE30\uB85D\uC744 \uBD88\uB7EC\uC624\uB294 \uC911",
3342
+ className: "flex flex-col gap-[4px]",
3343
+ children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-[36px] w-full rounded-small" }, i))
3344
+ }
3345
+ ) : error ? /* @__PURE__ */ jsx(
3346
+ Notice,
3347
+ {
3348
+ role: "alert",
3349
+ icon: /* @__PURE__ */ jsx(CircleAlert, { size: 32, className: "text-danger30" }),
3350
+ title: "\uAE30\uB85D\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
3351
+ description: error,
3352
+ action: onRetry ? /* @__PURE__ */ jsx(Button, { type: "button", variant: "primary", spacing: "compact", onClick: onRetry, children: "\uB2E4\uC2DC \uC2DC\uB3C4" }) : null
3353
+ }
3354
+ ) : items.length === 0 ? searching ? /* @__PURE__ */ jsx(
3355
+ Notice,
3356
+ {
3357
+ role: "status",
3358
+ icon: /* @__PURE__ */ jsx(SearchX, { size: 32 }),
3359
+ title: "\uAC80\uC0C9 \uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
3360
+ description: "\uB2E4\uB978 \uAC80\uC0C9\uC5B4\uB85C \uB2E4\uC2DC \uCC3E\uC544\uBCF4\uC138\uC694"
3361
+ }
3362
+ ) : /* @__PURE__ */ jsx(
3363
+ Notice,
3364
+ {
3365
+ role: "status",
3366
+ icon: /* @__PURE__ */ jsx(MessagesSquare, { size: 32 }),
3367
+ title: "\uB300\uD654 \uAE30\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
3368
+ description: "\uB300\uD654\uB97C \uC2DC\uC791\uD558\uBA74 \uC5EC\uAE30\uC5D0 \uAE30\uB85D\uC774 \uC313\uC785\uB2C8\uB2E4"
3369
+ }
3370
+ ) : (
3371
+ // 날짜 묶음 사이 18 — 간격 단계(16·24) 밖 값이지만 디자이너 지정(2026-11-18, 12 의 1.5배)
3372
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[18px]", children: [
3373
+ groups.map((group) => /* @__PURE__ */ jsxs("section", { "aria-label": group.label ?? void 0, children: [
3374
+ group.label ? /* @__PURE__ */ jsx(
3375
+ "div",
3376
+ {
3377
+ "aria-hidden": true,
3378
+ className: "px-[12px] pb-[4px] text-small-medium-h text-sys-text-subtler",
3379
+ children: group.label
3380
+ }
3381
+ ) : null,
3382
+ /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col gap-[2px] p-0", children: group.items.map((item) => /* @__PURE__ */ jsx(
3383
+ HistoryRow,
3384
+ {
3385
+ item,
3386
+ active: item.id === activeId,
3387
+ onSelect,
3388
+ onRename,
3389
+ onDelete
3390
+ },
3391
+ item.id
3392
+ )) })
3393
+ ] }, group.label ?? "all")),
3394
+ hasMore ? /* @__PURE__ */ jsx("ul", { className: "m-0 list-none p-0", children: /* @__PURE__ */ jsx(
3395
+ "li",
3396
+ {
3397
+ ref: moreRef,
3398
+ role: "status",
3399
+ "aria-label": "\uB300\uD654 \uAE30\uB85D\uC744 \uB354 \uBD88\uB7EC\uC624\uB294 \uC911",
3400
+ className: "flex h-[36px] items-center justify-center",
3401
+ children: /* @__PURE__ */ jsx(Spinner, { size: "small", variant: "primary", "aria-hidden": true })
3402
+ }
3403
+ ) }) : null
3404
+ ] })
3405
+ )
3406
+ }
3407
+ )
3408
+ ] });
3409
+ }
3410
+ function ActionButton({
3411
+ label,
3412
+ pressed,
3413
+ onClick,
3414
+ children
3415
+ }) {
3416
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
3417
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
3418
+ IconButton,
3419
+ {
3420
+ variant: pressed ? "primaryLink" : "secondaryLink",
3421
+ "aria-label": label,
3422
+ "aria-pressed": pressed,
3423
+ onClick,
3424
+ children
3425
+ }
3426
+ ) }),
3427
+ /* @__PURE__ */ jsx(TooltipContent, { children: label })
3428
+ ] });
3429
+ }
3430
+ function CopyAction({ text }) {
3431
+ const { copied, failed, copy } = useCopy();
3432
+ if (failed) return null;
3433
+ return /* @__PURE__ */ jsx(ActionButton, { label: copied ? "\uBCF5\uC0AC\uB428" : "\uBCF5\uC0AC", onClick: () => void copy(text), children: copied ? /* @__PURE__ */ jsx(Check, { size: 16 }) : /* @__PURE__ */ jsx(Copy, { size: 16 }) });
3434
+ }
3435
+ function Attachments({ items }) {
3436
+ return /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-wrap justify-end gap-[8px] p-0", children: items.map((file) => /* @__PURE__ */ jsx("li", { className: "min-w-0", children: /* @__PURE__ */ jsx(
3437
+ Tag,
2193
3438
  {
2194
- "data-slot": "dropdown-menu-sub-content",
2195
- className: cn(
2196
- "bg-sys-background text-base-regular",
2197
- "overflow-x-hidden overflow-y-auto z-[var(--root-z-index)] shadow-gray-small rounded-xsmall p-[4px] border border-sys-divider-subtler",
2198
- "max-h-(--radix-dropdown-menu-content-available-height) ",
2199
- "min-w-[200px] origin-(--radix-dropdown-menu-content-transform-origin)",
2200
- "data-[state=open]:animate-[fade-in_150ms_ease-out,zoom-in_150ms_ease-out]",
2201
- "data-[state=closed]:animate-[fade-out_150ms_ease-in,zoom-out_150ms_ease-in]",
2202
- "data-[side=top]:animate-[slide-in-bottom_150ms_ease-out]",
2203
- "data-[side=bottom]:animate-[slide-in-top_150ms_ease-out]",
2204
- "data-[side=left]:animate-[slide-in-right_150ms_ease-out]",
2205
- "data-[side=right]:animate-[slide-in-left_150ms_ease-out]",
2206
- className
2207
- ),
2208
- ...props
3439
+ variant: "secondary",
3440
+ asChild: Boolean(file.href),
3441
+ elemBefore: /* @__PURE__ */ jsx(Paperclip, { size: 14, "aria-hidden": true }),
3442
+ className: "max-w-[240px]",
3443
+ children: file.href ? /* @__PURE__ */ jsx("a", { href: file.href, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: file.name }) }) : /* @__PURE__ */ jsx("span", { className: "truncate", children: file.name })
2209
3444
  }
2210
- );
3445
+ ) }, file.id)) });
2211
3446
  }
2212
- var Form = FormProvider;
2213
- var FormFieldContext = React12.createContext({});
2214
- var FormField = ({
2215
- ...props
2216
- }) => {
2217
- return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
2218
- };
2219
- var useFormField = () => {
2220
- const fieldContext = React12.useContext(FormFieldContext);
2221
- const itemContext = React12.useContext(FormItemContext);
2222
- const { getFieldState, formState } = useFormContext();
2223
- const fieldState = getFieldState(fieldContext.name, formState);
2224
- if (!fieldContext) {
2225
- throw new Error("useFormField should be used within <FormField>");
2226
- }
2227
- const { id } = itemContext;
2228
- return {
2229
- id,
2230
- name: fieldContext.name,
2231
- formItemId: `${id}-form-item`,
2232
- formDescriptionId: `${id}-form-item-description`,
2233
- formMessageId: `${id}-form-item-message`,
2234
- ...fieldState
2235
- };
2236
- };
2237
- var FormItemContext = React12.createContext({});
2238
- var FormItem = React12.forwardRef(
2239
- ({ className, ...props }, ref) => {
2240
- const id = React12.useId();
2241
- return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { ref, className: cn("space-y-[4px]", className), ...props }) });
2242
- }
2243
- );
2244
- FormItem.displayName = "FormItem";
2245
- var FormLabel = React12.forwardRef(({ className, required, ...props }, ref) => {
2246
- const { error, formItemId } = useFormField();
2247
- if (required) {
2248
- return /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "start", children: [
3447
+ function Sources({ items }) {
3448
+ return /* @__PURE__ */ jsxs("details", { className: "group/sources", children: [
3449
+ /* @__PURE__ */ jsxs("summary", { className: "inline-flex cursor-pointer list-none items-center gap-[4px] rounded-small text-small-medium-h text-sys-text-subtle hover:text-sys-text-main focus-visible:outline-[2px] focus-visible:outline-sys-focus-ring-main [&::-webkit-details-marker]:hidden", children: [
2249
3450
  /* @__PURE__ */ jsx(
2250
- "label",
3451
+ ChevronRight,
2251
3452
  {
2252
- ref,
2253
- className: cn(
2254
- error && "text-destructive",
2255
- "inline-block text-sys-text-subtle text-base-medium",
2256
- className
2257
- ),
2258
- htmlFor: formItemId,
2259
- ...props
3453
+ size: 14,
3454
+ "aria-hidden": true,
3455
+ className: "transition-transform group-open/sources:rotate-90"
2260
3456
  }
2261
3457
  ),
2262
- /* @__PURE__ */ jsx("span", { className: "text-base-medium text-danger30", children: "*" })
2263
- ] });
3458
+ "\uCD9C\uCC98 ",
3459
+ items.length,
3460
+ "\uAC1C"
3461
+ ] }),
3462
+ /* @__PURE__ */ jsx("ol", { className: "m-0 mt-[8px] flex list-none flex-col gap-[8px] p-0", children: items.map((source, i) => (
3463
+ // 출처는 순서(번호)로 구분된다
3464
+ // eslint-disable-next-line react/no-array-index-key
3465
+ /* @__PURE__ */ jsxs("li", { className: "flex gap-[8px] text-small-regular-h text-sys-text-subtle", children: [
3466
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "shrink-0 text-sys-text-subtler", children: [
3467
+ i + 1,
3468
+ "."
3469
+ ] }),
3470
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
3471
+ source.href ? /* @__PURE__ */ jsx(
3472
+ "a",
3473
+ {
3474
+ href: source.href,
3475
+ target: "_blank",
3476
+ rel: "noopener noreferrer",
3477
+ className: "block truncate text-small-medium-h text-primary40 underline",
3478
+ children: source.title
3479
+ }
3480
+ ) : /* @__PURE__ */ jsx("span", { className: "block truncate text-small-medium-h text-sys-text-main", children: source.title }),
3481
+ source.description ? /* @__PURE__ */ jsx("span", { className: "line-clamp-2 break-keep wrap-break-word", children: source.description }) : null
3482
+ ] })
3483
+ ] }, i)
3484
+ )) })
3485
+ ] });
3486
+ }
3487
+ function ChatMessage({
3488
+ from,
3489
+ children,
3490
+ pending = false,
3491
+ streaming = false,
3492
+ error,
3493
+ onRetry,
3494
+ attachments,
3495
+ sources,
3496
+ meta,
3497
+ actions,
3498
+ copyText,
3499
+ onRegenerate,
3500
+ onFeedback,
3501
+ feedback,
3502
+ headingLevel = 2,
3503
+ className
3504
+ }) {
3505
+ const id = React10.useId();
3506
+ const Heading = `h${headingLevel}`;
3507
+ const isUser = from === "user";
3508
+ if (isUser) {
3509
+ return /* @__PURE__ */ jsxs(
3510
+ "article",
3511
+ {
3512
+ "aria-labelledby": id,
3513
+ "data-role": "user",
3514
+ className: cn("flex flex-col items-end gap-[8px]", className),
3515
+ children: [
3516
+ /* @__PURE__ */ jsx(Heading, { id, className: "sr-only", children: "\uB0B4 \uBA54\uC2DC\uC9C0" }),
3517
+ attachments?.length ? /* @__PURE__ */ jsx(Attachments, { items: attachments }) : null,
3518
+ children ? /* @__PURE__ */ jsx("div", { className: "max-w-[80%] rounded-xlarge bg-secondary-o10 px-[16px] py-[12px] text-base-regular whitespace-pre-wrap text-sys-text-main wrap-break-word", children }) : null
3519
+ ]
3520
+ }
3521
+ );
2264
3522
  }
2265
- return /* @__PURE__ */ jsx(
2266
- "label",
3523
+ const done = !pending && !streaming;
3524
+ const hasActions = done && (copyText != null || onRegenerate != null || onFeedback != null || actions != null);
3525
+ return /* @__PURE__ */ jsxs(
3526
+ "article",
2267
3527
  {
2268
- ref,
2269
- className: cn(
2270
- error && "text-destructive",
2271
- "inline-block text-sys-text-subtle text-base-medium",
2272
- className
2273
- ),
2274
- htmlFor: formItemId,
2275
- ...props
3528
+ "aria-labelledby": id,
3529
+ "data-role": "assistant",
3530
+ className: cn("flex min-w-0 flex-col gap-[8px]", className),
3531
+ children: [
3532
+ /* @__PURE__ */ jsx(Heading, { id, className: "sr-only", children: "AI \uB2F5\uBCC0" }),
3533
+ pending ? (
3534
+ // 로딩 표시는 보이는 글자와 함께(스피너만 두지 않는다). 낭독은 패턴의 상태 영역이 맡으므로 여기는 live 가 아니다
3535
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[8px] text-base-regular text-sys-text-subtle", children: [
3536
+ /* @__PURE__ */ jsx(Spinner, { size: 20, variant: "primary", "aria-hidden": true }),
3537
+ "\uC751\uB2F5\uC744 \uC0DD\uC131\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4"
3538
+ ] })
3539
+ ) : /* @__PURE__ */ jsx("div", { className: "min-w-0 text-base-regular text-sys-text-main wrap-break-word", children }),
3540
+ error ? (
3541
+ // role 을 지운다 — 실패 낭독은 패턴의 상태 영역(polite)이 한 번만 한다
3542
+ /* @__PURE__ */ jsxs(Alert, { variant: "danger", role: void 0, children: [
3543
+ /* @__PURE__ */ jsx(AlertDescription, { children: error }),
3544
+ onRetry ? /* @__PURE__ */ jsx(AlertActions, { children: /* @__PURE__ */ jsx(Button, { type: "button", variant: "secondaryLink", onClick: onRetry, children: "\uB2E4\uC2DC \uC2DC\uB3C4" }) }) : null
3545
+ ] })
3546
+ ) : null,
3547
+ done && sources?.length ? /* @__PURE__ */ jsx(Sources, { items: sources }) : null,
3548
+ hasActions || done && meta ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-[8px]", children: [
3549
+ hasActions ? /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs("div", { className: "-ml-[6px] flex items-center", children: [
3550
+ copyText != null ? /* @__PURE__ */ jsx(CopyAction, { text: copyText }) : null,
3551
+ onRegenerate ? /* @__PURE__ */ jsx(ActionButton, { label: "\uB2E4\uC2DC \uC0DD\uC131", onClick: onRegenerate, children: /* @__PURE__ */ jsx(RefreshCw, { size: 16 }) }) : null,
3552
+ onFeedback ? /* @__PURE__ */ jsxs(Fragment, { children: [
3553
+ /* @__PURE__ */ jsx(
3554
+ ActionButton,
3555
+ {
3556
+ label: "\uB3C4\uC6C0\uC774 \uB410\uC5B4\uC694",
3557
+ pressed: feedback === "up",
3558
+ onClick: () => onFeedback("up"),
3559
+ children: /* @__PURE__ */ jsx(ThumbsUp, { size: 16 })
3560
+ }
3561
+ ),
3562
+ /* @__PURE__ */ jsx(
3563
+ ActionButton,
3564
+ {
3565
+ label: "\uB3C4\uC6C0\uC774 \uC548 \uB410\uC5B4\uC694",
3566
+ pressed: feedback === "down",
3567
+ onClick: () => onFeedback("down"),
3568
+ children: /* @__PURE__ */ jsx(ThumbsDown, { size: 16 })
3569
+ }
3570
+ )
3571
+ ] }) : null,
3572
+ actions
3573
+ ] }) }) : null,
3574
+ meta ? /* @__PURE__ */ jsx("div", { className: "flex items-center gap-[8px] text-small-regular-h text-sys-text-subtler", children: meta }) : null
3575
+ ] }) : null
3576
+ ]
2276
3577
  }
2277
3578
  );
2278
- });
2279
- FormLabel.displayName = "FormLabel";
2280
- var FormControlContext = React12.createContext(null);
2281
- var useFormControlContext = () => React12.useContext(FormControlContext);
2282
- var formControlVariants = cva("", {
3579
+ }
3580
+ function useRestoreFocusToOpener({
3581
+ onOpenAutoFocus,
3582
+ onCloseAutoFocus
3583
+ }) {
3584
+ const openerRef = useRef(null);
3585
+ const handleOpenAutoFocus = useCallback(
3586
+ (event) => {
3587
+ openerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
3588
+ onOpenAutoFocus?.(event);
3589
+ },
3590
+ [onOpenAutoFocus]
3591
+ );
3592
+ const handleCloseAutoFocus = useCallback(
3593
+ (event) => {
3594
+ onCloseAutoFocus?.(event);
3595
+ if (event.defaultPrevented) return;
3596
+ const opener = openerRef.current;
3597
+ if (!opener || opener === document.body || !opener.isConnected) return;
3598
+ event.preventDefault();
3599
+ opener.focus({ preventScroll: true });
3600
+ },
3601
+ [onCloseAutoFocus]
3602
+ );
3603
+ return { onOpenAutoFocus: handleOpenAutoFocus, onCloseAutoFocus: handleCloseAutoFocus };
3604
+ }
3605
+ var Dialog = DialogPrimitive.Root;
3606
+ var DialogTrigger = DialogPrimitive.Trigger;
3607
+ var DialogPortal = DialogPrimitive.Portal;
3608
+ var DialogClose = DialogPrimitive.Close;
3609
+ var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3610
+ DialogPrimitive.Overlay,
3611
+ {
3612
+ ...props,
3613
+ ref,
3614
+ className: cn(
3615
+ "fixed inset-0 z-[var(--root-z-index)] bg-sys-blanket",
3616
+ "data-[state=open]:animate-[fade-in_0ms_ease-out,zoom-in_0ms_ease-out]",
3617
+ "data-[state=closed]:animate-[fade-out_0ms_ease-in,zoom-out_0ms_ease-in]",
3618
+ className
3619
+ )
3620
+ }
3621
+ ));
3622
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
3623
+ var dialogContentVariants = cva(null, {
2283
3624
  variants: {
2284
- maxWidth: {
2285
- default: "max-w-[var(--max-w-form-control)]",
2286
- narrow: "max-w-[var(--max-w-form-control-narrow)]",
2287
- full: ""
3625
+ width: {
3626
+ small: "w-[400px]",
3627
+ medium: "w-[600px]",
3628
+ large: "w-[800px]",
3629
+ xlarge: "w-[1000px]"
2288
3630
  }
2289
3631
  },
2290
3632
  defaultVariants: {
2291
- maxWidth: "default"
3633
+ width: "small"
2292
3634
  }
2293
3635
  });
2294
- var FormControl = React12.forwardRef(({ className, maxWidth, ...props }, ref) => {
2295
- const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
2296
- const isInvalid = !!error;
2297
- return /* @__PURE__ */ jsx(FormControlContext.Provider, { value: { isInvalid }, children: /* @__PURE__ */ jsx(
2298
- Slot,
2299
- {
2300
- ref,
2301
- id: formItemId,
2302
- className: cn(formControlVariants({ maxWidth }), className),
2303
- "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
2304
- "aria-invalid": isInvalid,
2305
- ...props
2306
- }
2307
- ) });
2308
- });
2309
- FormControl.displayName = "FormControl";
2310
- var FormDescription = React12.forwardRef(
2311
- ({ className, icon = true, ...props }, ref) => {
2312
- const { formDescriptionId, error } = useFormField();
2313
- if (error) return null;
2314
- return /* @__PURE__ */ jsxs(Stack, { spacing: 5, className: "pt-[2px]", children: [
2315
- icon ? /* @__PURE__ */ jsx(Info, { size: 16, "aria-hidden": true, className: "text-sys-text-subtle" }) : null,
2316
- /* @__PURE__ */ jsx(
2317
- "p",
3636
+ var DialogContent = React10.forwardRef(
3637
+ ({
3638
+ children,
3639
+ className,
3640
+ width,
3641
+ overlayClassName,
3642
+ hideCloseButton,
3643
+ onOpenAutoFocus,
3644
+ onCloseAutoFocus,
3645
+ ...props
3646
+ }, ref) => {
3647
+ const focusHandlers = useRestoreFocusToOpener({ onOpenAutoFocus, onCloseAutoFocus });
3648
+ return /* @__PURE__ */ jsxs(DialogPortal, { children: [
3649
+ /* @__PURE__ */ jsx(DialogOverlay, { className: overlayClassName }),
3650
+ /* @__PURE__ */ jsxs(
3651
+ DialogPrimitive.Content,
2318
3652
  {
2319
3653
  ref,
2320
- id: formDescriptionId,
2321
- className: cn("text-small-regular text-sys-text-subtle", className),
2322
- ...props
3654
+ ...focusHandlers,
3655
+ className: cn(
3656
+ "fixed left-[50%] top-[50%] z-[var(--root-z-index)] translate-x-[-50%] translate-y-[-50%] w-full max-w-[70vw]",
3657
+ "flex flex-col gap-[16px] rounded-medium bg-sys-background p-[32px] shadow-gray-medium duration-200",
3658
+ "data-[state=open]:animate-[fade-in_0ms_ease-out,zoom-in_0ms_ease-out]",
3659
+ "data-[state=closed]:animate-[fade-out_0ms_ease-in,zoom-out_0ms_ease-in]",
3660
+ dialogContentVariants({ width }),
3661
+ className
3662
+ ),
3663
+ ...props,
3664
+ children: [
3665
+ children,
3666
+ !hideCloseButton && /* @__PURE__ */ jsx(
3667
+ IconButton,
3668
+ {
3669
+ asChild: true,
3670
+ variant: "secondaryLink",
3671
+ className: cn("absolute right-[32px] top-[32px]"),
3672
+ children: /* @__PURE__ */ jsxs(DialogPrimitive.Close, { children: [
3673
+ /* @__PURE__ */ jsx(X, {}),
3674
+ /* @__PURE__ */ jsx("span", { className: "sr-only a11y", children: "Close" })
3675
+ ] })
3676
+ }
3677
+ )
3678
+ ]
2323
3679
  }
2324
3680
  )
2325
3681
  ] });
2326
3682
  }
2327
3683
  );
2328
- FormDescription.displayName = "FormDescription";
2329
- var FormMessage = React12.forwardRef(({ className, children, ...props }, ref) => {
2330
- const { error, formMessageId } = useFormField();
2331
- const body = error ? String(error?.message ?? "") : children;
2332
- if (!body) {
2333
- return null;
3684
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
3685
+ var DialogHeader = (props) => /* @__PURE__ */ jsx(
3686
+ "div",
3687
+ {
3688
+ ...props,
3689
+ className: cn("flex flex-col gap-[16px] text-center sm:text-left", props.className)
2334
3690
  }
2335
- return /* @__PURE__ */ jsxs(Stack, { spacing: 5, className: "pt-[2px]", children: [
2336
- /* @__PURE__ */ jsx(TriangleAlert, { size: 16, className: "text-danger30" }),
2337
- /* @__PURE__ */ jsx(
2338
- "p",
3691
+ );
3692
+ DialogHeader.displayName = "DialogHeader";
3693
+ var DialogFooter = (props) => /* @__PURE__ */ jsx(
3694
+ "div",
3695
+ {
3696
+ ...props,
3697
+ className: cn("flex flex-col-reverse gap-[8px] sm:flex-row sm:justify-end", props.className)
3698
+ }
3699
+ );
3700
+ DialogFooter.displayName = "DialogFooter";
3701
+ var variantToIcon = {
3702
+ normal: null,
3703
+ success: /* @__PURE__ */ jsx(CircleCheck, { className: "text-success30" }),
3704
+ info: /* @__PURE__ */ jsx(Info, { className: "text-sys-text-subtler" }),
3705
+ warning: /* @__PURE__ */ jsx(TriangleAlert, { className: "text-critical30" }),
3706
+ danger: /* @__PURE__ */ jsx(CircleX, { className: "text-danger30" })
3707
+ };
3708
+ var DialogTitle = React10.forwardRef(({ variant, children, ...props }, ref) => {
3709
+ if (variant) {
3710
+ return /* @__PURE__ */ jsxs(Stack, { spacing: 8, children: [
3711
+ variantToIcon[variant],
3712
+ /* @__PURE__ */ jsx(
3713
+ DialogPrimitive.Title,
3714
+ {
3715
+ ...props,
3716
+ ref,
3717
+ className: cn("text-h4 text-sys-text-main whitespace-pre-wrap", props.className),
3718
+ children: sanitizeUserText(children)
3719
+ }
3720
+ )
3721
+ ] });
3722
+ } else {
3723
+ return /* @__PURE__ */ jsx(
3724
+ DialogPrimitive.Title,
2339
3725
  {
2340
- ref,
2341
- id: formMessageId,
2342
- className: cn("text-small-regular text-danger30", className),
2343
3726
  ...props,
2344
- children: body
3727
+ ref,
3728
+ className: cn("text-h4 text-sys-text-main whitespace-pre-wrap", props.className),
3729
+ children: sanitizeUserText(children)
2345
3730
  }
2346
- )
2347
- ] });
2348
- });
2349
- FormMessage.displayName = "FormMessage";
2350
- var FormValidMessage = React12.forwardRef(({ className, children, ...props }, ref) => {
2351
- if (!children) {
2352
- return null;
3731
+ );
2353
3732
  }
2354
- return /* @__PURE__ */ jsxs(Stack, { spacing: 5, className: "pt-[2px]", children: [
2355
- /* @__PURE__ */ jsx(Check, { size: 16, className: "text-success30" }),
2356
- /* @__PURE__ */ jsx("p", { ref, className: cn("text-small-regular text-success30", className), ...props, children })
2357
- ] });
2358
3733
  });
2359
- FormValidMessage.displayName = "FormValidMessage";
2360
- var FormHeader = React12.forwardRef(
2361
- ({ className, title, description, children, ...props }, ref) => {
2362
- return /* @__PURE__ */ jsxs(
2363
- "div",
2364
- {
2365
- ref,
2366
- className: cn("flex flex-col gap-[2px] items-start w-full", className),
2367
- ...props,
2368
- children: [
2369
- title && /* @__PURE__ */ jsx("h2", { className: "text-h4 text-sys-text-main w-full", children: title }),
2370
- description && /* @__PURE__ */ jsx("p", { className: "text-base-regular text-sys-text-main", children: description }),
2371
- children
3734
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
3735
+ var DialogDescription = React10.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx(
3736
+ DialogPrimitive.Description,
3737
+ {
3738
+ ...props,
3739
+ ref,
3740
+ className: cn("text-base-regular text-sys-text-main whitespace-pre-wrap", props.className),
3741
+ children: sanitizeUserText(children)
3742
+ }
3743
+ ));
3744
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
3745
+ var Separator2 = React10.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
3746
+ SeparatorPrimitive.Root,
3747
+ {
3748
+ ref,
3749
+ decorative,
3750
+ orientation,
3751
+ className: cn(
3752
+ "shrink-0 bg-sys-divider-subtle",
3753
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
3754
+ className
3755
+ ),
3756
+ ...props
3757
+ }
3758
+ ));
3759
+ Separator2.displayName = SeparatorPrimitive.Root.displayName;
3760
+ var DrawerModalContext = React10.createContext(true);
3761
+ var Drawer = ({ modal = true, ...props }) => /* @__PURE__ */ jsx(DrawerModalContext.Provider, { value: modal, children: /* @__PURE__ */ jsx(DialogPrimitive.Root, { modal, ...props }) });
3762
+ Drawer.displayName = "Drawer";
3763
+ var DrawerTrigger = DialogPrimitive.Trigger;
3764
+ var DrawerClose = DialogPrimitive.Close;
3765
+ var DrawerPortal = DialogPrimitive.Portal;
3766
+ var DrawerOverlay = React10.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx(
3767
+ DialogPrimitive.Overlay,
3768
+ {
3769
+ ...props,
3770
+ className: cn(
3771
+ "fixed inset-0 z-[var(--root-z-index)] bg-sys-blanket",
3772
+ "data-[state=open]:animate-fade-in",
3773
+ "data-[state=closed]:animate-fade-out",
3774
+ props.className
3775
+ ),
3776
+ ref
3777
+ }
3778
+ ));
3779
+ DrawerOverlay.displayName = DialogPrimitive.Overlay.displayName;
3780
+ var sheetVariants = cva(
3781
+ "fixed z-[var(--root-z-index)] flex flex-col overflow-hidden bg-sys-background shadow-gray-medium",
3782
+ {
3783
+ variants: {
3784
+ side: {
3785
+ top: [
3786
+ "inset-x-0 top-0 bottom-auto",
3787
+ "data-[state=open]:animate-slide-in-from-top",
3788
+ "data-[state=closed]:animate-slide-out-to-top"
3789
+ ],
3790
+ bottom: [
3791
+ "inset-x-0 bottom-0 top-auto",
3792
+ "data-[state=open]:animate-slide-in-from-bottom",
3793
+ "data-[state=closed]:animate-slide-out-to-bottom"
3794
+ ],
3795
+ left: [
3796
+ "inset-y-0 left-0 right-auto h-full",
3797
+ "data-[state=open]:animate-slide-in-from-left",
3798
+ "data-[state=closed]:animate-slide-out-to-left"
3799
+ ],
3800
+ right: [
3801
+ "inset-y-0 right-0 left-auto h-full",
3802
+ "data-[state=open]:animate-slide-in-from-right",
3803
+ "data-[state=closed]:animate-slide-out-to-right"
2372
3804
  ]
3805
+ },
3806
+ size: {
3807
+ small: "w-[360px] max-w-[70vw]",
3808
+ medium: "w-[480px] max-w-[70vw]",
3809
+ large: "w-[720px] max-w-[70vw]",
3810
+ xLarge: "w-[1080px] max-w-[70vw]"
2373
3811
  }
2374
- );
3812
+ },
3813
+ defaultVariants: {
3814
+ side: "right",
3815
+ size: "large"
3816
+ }
3817
+ }
3818
+ );
3819
+ var DrawerContent = React10.forwardRef(
3820
+ ({ side, size, children, onOpenAutoFocus, onCloseAutoFocus, onInteractOutside, ...props }, ref) => {
3821
+ const focusHandlers = useRestoreFocusToOpener({ onOpenAutoFocus, onCloseAutoFocus });
3822
+ const modal = React10.useContext(DrawerModalContext);
3823
+ return /* @__PURE__ */ jsxs(DrawerPortal, { children: [
3824
+ modal ? /* @__PURE__ */ jsx(DrawerOverlay, {}) : null,
3825
+ /* @__PURE__ */ jsxs(
3826
+ DialogPrimitive.Content,
3827
+ {
3828
+ ...props,
3829
+ ...focusHandlers,
3830
+ onInteractOutside: (e) => {
3831
+ onInteractOutside?.(e);
3832
+ if (!modal && !e.defaultPrevented) e.preventDefault();
3833
+ },
3834
+ ref,
3835
+ className: cn(
3836
+ sheetVariants({ side, size }),
3837
+ !modal && "border-l border-sys-border-subtle shadow-none",
3838
+ props.className
3839
+ ),
3840
+ children: [
3841
+ /* @__PURE__ */ jsxs(
3842
+ DialogPrimitive.Close,
3843
+ {
3844
+ className: cn("absolute right-[24px] top-[24px] disabled:pointer-events-none"),
3845
+ children: [
3846
+ /* @__PURE__ */ jsx(X, { size: 24 }),
3847
+ /* @__PURE__ */ jsx("span", { className: "sr-only a11y", children: "Close" })
3848
+ ]
3849
+ }
3850
+ ),
3851
+ children
3852
+ ]
3853
+ }
3854
+ )
3855
+ ] });
2375
3856
  }
2376
3857
  );
2377
- FormHeader.displayName = "FormHeader";
2378
- var FormSectionLevelContext = React12.createContext(3);
2379
- var FormSection = React12.forwardRef(
2380
- ({ className, title, level, children, ...props }, ref) => {
2381
- const contextLevel = React12.useContext(FormSectionLevelContext);
2382
- const Heading = (level ?? contextLevel) === 2 ? "h2" : "h3";
2383
- return /* @__PURE__ */ jsxs(
2384
- "div",
2385
- {
2386
- ref,
2387
- className: cn(
2388
- // 섹션 사이 간격 48px 를 구분선 위아래 24px 씩으로 나눈다 (2026-10-13: 앞 섹션의 설명 글줄이 선에 붙어 있었다)
2389
- // 필드 사이 16(한 묶음 안) — 섹션 사이 48(pt-24+pb-24)과 구분되는 단계. 2026-10-17 8차 D2
2390
- "flex flex-col gap-[16px] w-full pt-[24px]",
2391
- // 부모 컨테이너 안에서 자기가 첫 자식이면 (= FormHeader 같은 형제가 앞에 없으면)
2392
- // 16px 의 상단 여백만 둔다 (컨테이너 상단 과공백 방지). FormHeader 가 앞에 있으면 :first-child 가 아니므로 pt-[24px] + 선.
2393
- "first:pt-[16px]",
2394
- // 마지막 섹션 아래에는 여백이 없다 (푸터 버튼 줄이 자기 간격을 가진다)
2395
- "[&:not(:last-child)]:pb-[24px]",
2396
- // 섹션 사이에 연한 가로 구분선 (2026-10-12 블라인드 평가: 구획이 없으면 "제목뿐" 으로 읽혔다). 첫 섹션 위에는 없다
2397
- "[&:not(:first-child)]:border-t [&:not(:first-child)]:border-sys-divider-subtle",
2398
- className
2399
- ),
2400
- ...props,
2401
- children: [
2402
- title && /* @__PURE__ */ jsx(Heading, { className: "text-h4 text-sys-text-main w-full", children: title }),
2403
- children
2404
- ]
2405
- }
2406
- );
3858
+ DrawerContent.displayName = DialogPrimitive.Content.displayName;
3859
+ var DrawerHeader = ({ ...props }) => /* @__PURE__ */ jsx("div", { ...props, className: cn("flex flex-col gap-[8px] text-left p-[24px]", props.className) });
3860
+ DrawerHeader.displayName = "DrawerHeader";
3861
+ var DrawerBody = ({ ...props }) => /* @__PURE__ */ jsx(
3862
+ "div",
3863
+ {
3864
+ tabIndex: 0,
3865
+ ...props,
3866
+ className: cn(
3867
+ "flex-1 min-h-0 overflow-y-auto scrollbar-gutter-stable",
3868
+ // DrawerContent 가 overflow-hidden 이라 바깥 outline 은 잘린다 → 안쪽 링
3869
+ "outline-none focus-visible:ring-[2px] focus-visible:ring-inset focus-visible:ring-sys-focus-ring-main",
3870
+ props.className
3871
+ )
2407
3872
  }
2408
3873
  );
2409
- FormSection.displayName = "FormSection";
2410
- var formFooterVariants = cva("flex flex-col justify-end overflow-clip pt-[48px] w-full", {
2411
- variants: {
2412
- align: {
2413
- start: "items-start",
2414
- end: "items-end",
2415
- center: "items-center",
2416
- stretch: "items-stretch"
2417
- }
2418
- },
2419
- defaultVariants: {
2420
- align: "end"
2421
- }
2422
- });
2423
- var FormFooter = React12.forwardRef(
2424
- ({ className, align, children, ...props }, ref) => {
2425
- return /* @__PURE__ */ jsx("div", { ref, className: cn(formFooterVariants({ align }), className), ...props, children });
3874
+ DrawerBody.displayName = "DrawerBody";
3875
+ var DrawerFooter = ({ ...props }) => /* @__PURE__ */ jsx(
3876
+ "div",
3877
+ {
3878
+ ...props,
3879
+ className: cn("flex gap-[8px] justify-end mt-[16px] px-[24px] pb-[26px]", props.className)
2426
3880
  }
2427
3881
  );
2428
- FormFooter.displayName = "FormFooter";
3882
+ DrawerFooter.displayName = "DrawerFooter";
3883
+ var DrawerTitle = React10.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx(
3884
+ DialogPrimitive.Title,
3885
+ {
3886
+ ref,
3887
+ ...props,
3888
+ className: cn("text-h4 text-sys-text-main", props.className)
3889
+ }
3890
+ ));
3891
+ DrawerTitle.displayName = DialogPrimitive.Title.displayName;
3892
+ var DrawerDescription = React10.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx(
3893
+ DialogPrimitive.Description,
3894
+ {
3895
+ ref,
3896
+ ...props,
3897
+ className: cn("text-base-regular text-sys-text-main", props.className)
3898
+ }
3899
+ ));
3900
+ DrawerDescription.displayName = DialogPrimitive.Description.displayName;
2429
3901
  function isValidIconComponent(componentName) {
2430
3902
  return componentName in lucide.icons;
2431
3903
  }
@@ -2443,7 +3915,7 @@ function LucideIcon({ iconComponentName, size = 16, ...props }) {
2443
3915
  if (!Icon) return null;
2444
3916
  return /* @__PURE__ */ jsx(Icon, { size, ...props });
2445
3917
  }
2446
- var EmptyBoxIllustration = React12.forwardRef(
3918
+ var EmptyBoxIllustration = React10.forwardRef(
2447
3919
  ({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
2448
3920
  "svg",
2449
3921
  {
@@ -2537,7 +4009,7 @@ var EmptyBoxIllustration = React12.forwardRef(
2537
4009
  )
2538
4010
  );
2539
4011
  EmptyBoxIllustration.displayName = "EmptyBoxIllustration";
2540
- var TabsContext = React12.createContext({
4012
+ var TabsContext = React10.createContext({
2541
4013
  variant: "box",
2542
4014
  size: "medium"
2543
4015
  });
@@ -2571,10 +4043,10 @@ function TabsList({
2571
4043
  size: sizeProp,
2572
4044
  ...props
2573
4045
  }) {
2574
- const context = React12.useContext(TabsContext);
4046
+ const context = React10.useContext(TabsContext);
2575
4047
  const variant = variantProp ?? context.variant;
2576
4048
  const size = sizeProp ?? context.size;
2577
- const value = React12.useMemo(() => ({ variant, size }), [variant, size]);
4049
+ const value = React10.useMemo(() => ({ variant, size }), [variant, size]);
2578
4050
  return /* @__PURE__ */ jsx(TabsContext.Provider, { value, children: /* @__PURE__ */ jsx(
2579
4051
  TabsPrimitive.List,
2580
4052
  {
@@ -2613,7 +4085,7 @@ var tabTriggerVariants = cva("text-sys-text-subtle", {
2613
4085
  }
2614
4086
  });
2615
4087
  function TabsTrigger({ className, ...props }) {
2616
- const { variant, size } = React12.useContext(TabsContext);
4088
+ const { variant, size } = React10.useContext(TabsContext);
2617
4089
  return /* @__PURE__ */ jsx(
2618
4090
  TabsPrimitive.Trigger,
2619
4091
  {
@@ -2770,7 +4242,7 @@ function PageHeader({
2770
4242
  hasControlsRow ? /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-wrap items-start gap-[12px] pb-[24px]", children: [
2771
4243
  bottomLeft ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-[8px]", children: bottomLeft }) : null,
2772
4244
  hasBottomDivider ? /* @__PURE__ */ jsx(
2773
- Separator,
4245
+ Separator2,
2774
4246
  {
2775
4247
  "aria-hidden": true,
2776
4248
  orientation: "vertical",
@@ -2797,14 +4269,14 @@ function Pagination({
2797
4269
  ...rest
2798
4270
  }) {
2799
4271
  const countOfAllPages = total > 0 && rowsPerPage > 0 ? Math.ceil(total / rowsPerPage) : 0;
2800
- const [pageStartIdx, setPageStartIdx] = React12.useState(1);
2801
- const [pageEndIdx, setPageEndIdx] = React12.useState(count);
2802
- const handleGoToFirst = React12.useCallback(() => {
4272
+ const [pageStartIdx, setPageStartIdx] = React10.useState(1);
4273
+ const [pageEndIdx, setPageEndIdx] = React10.useState(count);
4274
+ const handleGoToFirst = React10.useCallback(() => {
2803
4275
  setPageStartIdx(1);
2804
4276
  setPageEndIdx(count);
2805
4277
  onChange(1);
2806
4278
  }, [onChange, count]);
2807
- const handleGoToPrev = React12.useCallback(() => {
4279
+ const handleGoToPrev = React10.useCallback(() => {
2808
4280
  if (page === 1) {
2809
4281
  return;
2810
4282
  }
@@ -2814,7 +4286,7 @@ function Pagination({
2814
4286
  }
2815
4287
  onChange(page - 1);
2816
4288
  }, [onChange, page, pageStartIdx]);
2817
- const handleGoToNext = React12.useCallback(() => {
4289
+ const handleGoToNext = React10.useCallback(() => {
2818
4290
  if (page === countOfAllPages) {
2819
4291
  return;
2820
4292
  }
@@ -2824,12 +4296,12 @@ function Pagination({
2824
4296
  }
2825
4297
  onChange(page + 1);
2826
4298
  }, [countOfAllPages, onChange, page, pageEndIdx]);
2827
- const handleGoToEnd = React12.useCallback(() => {
4299
+ const handleGoToEnd = React10.useCallback(() => {
2828
4300
  setPageStartIdx(countOfAllPages - (count - 1));
2829
4301
  setPageEndIdx(countOfAllPages);
2830
4302
  onChange(countOfAllPages);
2831
4303
  }, [countOfAllPages, onChange, count]);
2832
- React12.useEffect(() => {
4304
+ React10.useEffect(() => {
2833
4305
  if (page < pageStartIdx || page > pageEndIdx) {
2834
4306
  const currentBlock = Math.ceil(page / count);
2835
4307
  const newStart = (currentBlock - 1) * count + 1;
@@ -2837,7 +4309,7 @@ function Pagination({
2837
4309
  setPageEndIdx(newStart + count - 1);
2838
4310
  }
2839
4311
  }, [count, page, pageStartIdx, pageEndIdx]);
2840
- const label = React12.useMemo(() => {
4312
+ const label = React10.useMemo(() => {
2841
4313
  const n = total.toLocaleString();
2842
4314
  const start = total === 0 ? 0 : (page - 1) * rowsPerPage + 1;
2843
4315
  const end = total === 0 ? 0 : Math.min(page * rowsPerPage, total);
@@ -2957,13 +4429,13 @@ function PaginationLink({
2957
4429
  href,
2958
4430
  ...props
2959
4431
  }) {
2960
- const wrappedChildren = React12.Children.map(children, (child) => {
4432
+ const wrappedChildren = React10.Children.map(children, (child) => {
2961
4433
  if (typeof child === "string" || typeof child === "number") {
2962
4434
  return /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center", children: child });
2963
4435
  }
2964
4436
  return child;
2965
4437
  });
2966
- const handleClick = React12.useCallback(
4438
+ const handleClick = React10.useCallback(
2967
4439
  (e) => {
2968
4440
  e.preventDefault();
2969
4441
  onClick?.(e);
@@ -3027,7 +4499,7 @@ function Panel({
3027
4499
  children,
3028
4500
  ...props
3029
4501
  }) {
3030
- const id = React12.useId();
4502
+ const id = React10.useId();
3031
4503
  const hasTitle = title != null;
3032
4504
  const Heading = level === 3 ? "h3" : "h2";
3033
4505
  const Root9 = hasTitle ? "section" : "div";
@@ -3065,345 +4537,6 @@ function Panel({
3065
4537
  }
3066
4538
  );
3067
4539
  }
3068
-
3069
- // src/utils/columnWidths.ts
3070
- var TEXT_COLUMN_GROW_LIMIT = 2;
3071
- function distributeColumnWidths(cols, available) {
3072
- const widths = cols.map((c) => c.content);
3073
- let extra = available - widths.reduce((a, b) => a + b, 0);
3074
- if (extra <= 0) return widths;
3075
- const weight = (i) => Math.max(1, cols[i].content);
3076
- const fill = (idx, cap) => {
3077
- let active = idx.filter((i) => widths[i] < cap(i));
3078
- while (extra > 0.01 && active.length > 0) {
3079
- const total = active.reduce((s, i) => s + weight(i), 0);
3080
- let used = 0;
3081
- for (const i of active) {
3082
- const give = Math.min(extra * weight(i) / total, cap(i) - widths[i]);
3083
- widths[i] += give;
3084
- used += give;
3085
- }
3086
- extra -= used;
3087
- active = active.filter((i) => widths[i] < cap(i) - 0.01);
3088
- }
3089
- };
3090
- const all = cols.map((_, i) => i);
3091
- const grow = all.filter((i) => cols[i].grow);
3092
- const maxOf = (i) => cols[i].max ?? Infinity;
3093
- fill(grow, (i) => Math.min(maxOf(i), cols[i].content * TEXT_COLUMN_GROW_LIMIT));
3094
- fill(all, maxOf);
3095
- const last = grow.length > 0 ? grow : all;
3096
- fill(last, () => Infinity);
3097
- const rounded = widths.map((w) => Math.round(w));
3098
- rounded[last[last.length - 1]] += Math.round(available) - rounded.reduce((a, b) => a + b, 0);
3099
- return rounded;
3100
- }
3101
- var useIsoLayoutEffect = typeof window === "undefined" ? React12.useEffect : React12.useLayoutEffect;
3102
- function measureColumnWidths(table) {
3103
- const cells = Array.from(table.rows[0]?.cells ?? []);
3104
- if (cells.length === 0 || cells.some((c) => c.colSpan > 1)) return null;
3105
- const cols = Array.from(table.querySelectorAll(":scope > colgroup > col"));
3106
- const saved = [table.style.width, table.style.tableLayout, ...cols.map((c) => c.style.width)];
3107
- table.style.width = "max-content";
3108
- table.style.tableLayout = "auto";
3109
- cols.forEach((c) => c.style.width = "");
3110
- const widths = cells.map((c) => c.getBoundingClientRect().width);
3111
- table.style.width = saved[0];
3112
- table.style.tableLayout = saved[1];
3113
- cols.forEach((c, i) => c.style.width = saved[i + 2]);
3114
- return widths.every((w) => w > 0) ? widths : null;
3115
- }
3116
- var sameWidths = (a, b) => a === b || !!a && !!b && a.length === b.length && a.every((w, i) => w === b[i]);
3117
- var Table = React12.forwardRef(
3118
- ({ className, children, ...props }, ref) => {
3119
- const tableRef = React12.useRef(null);
3120
- const setRef = React12.useCallback(
3121
- (el) => {
3122
- tableRef.current = el;
3123
- if (typeof ref === "function") ref(el);
3124
- else if (ref) ref.current = el;
3125
- },
3126
- [ref]
3127
- );
3128
- const [widths, setWidths] = React12.useState(null);
3129
- const fit = !/(^|\s)table-fixed(\s|$)/.test(className ?? "");
3130
- useIsoLayoutEffect(() => {
3131
- const table = tableRef.current;
3132
- const wrap = table?.parentElement;
3133
- if (!fit || !table || !wrap) return;
3134
- const update = () => {
3135
- const content = measureColumnWidths(table);
3136
- const available = wrap.clientWidth;
3137
- let next = null;
3138
- if (content && available > content.reduce((a, b) => a + b, 0)) {
3139
- const firstIsNumber = table.rows[0].cells[0].dataset.align === "right";
3140
- next = distributeColumnWidths(
3141
- content.map((w, i) => ({ content: w, grow: i === 0 && !firstIsNumber })),
3142
- available
3143
- );
3144
- }
3145
- setWidths((prev) => sameWidths(prev, next) ? prev : next);
3146
- };
3147
- update();
3148
- const ro = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
3149
- ro?.observe(wrap);
3150
- const mo = new MutationObserver(update);
3151
- mo.observe(table, { childList: true, subtree: true, characterData: true });
3152
- return () => {
3153
- ro?.disconnect();
3154
- mo.disconnect();
3155
- };
3156
- }, [fit]);
3157
- return (
3158
- // 둥근 테두리 상자(AgGridTable 과 같은 8px·같은 선). overflow-auto 라 내용이 라운드로 잘린다 (2026-10-17 이슈 47 4차)
3159
- /* @__PURE__ */ jsx("div", { className: "w-full overflow-auto rounded-medium border border-sys-divider-subtle", children: /* @__PURE__ */ jsxs(
3160
- "table",
3161
- {
3162
- ref: setRef,
3163
- className: cn(
3164
- "w-full border-collapse border-spacing-0 border-0",
3165
- widths ? "table-fixed" : "table-auto",
3166
- className
3167
- ),
3168
- ...props,
3169
- children: [
3170
- widths && /* @__PURE__ */ jsx("colgroup", { children: widths.map((w, i) => (
3171
- // 열은 순서로만 구분된다(첫 행 셀 순서)
3172
- // eslint-disable-next-line react/no-array-index-key
3173
- /* @__PURE__ */ jsx("col", { style: { width: w } }, i)
3174
- )) }),
3175
- children
3176
- ]
3177
- }
3178
- ) })
3179
- );
3180
- }
3181
- );
3182
- var tableHeaderVariant = cva(
3183
- // 헤더: 아주 연한 바탕(sys-table-header-background = o10) + 아래 1px 선(행 선과 같은 토큰). 양끝 라운드는 바깥 상자가 맡는다.
3184
- // 선은 th 에 — border-separate(ParameterTable)에서도 그려지도록 (2026-10-17 이슈 47 4차)
3185
- "[&_tr]:border-none [&_tr:hover]:bg-transparent [&_tr:active]:bg-transparent [&_th]:bg-sys-table-header-background [&_th]:border-b [&_th]:border-sys-divider-subtle [&_th]:text-sys-text-subtle [&_th]:text-h6",
3186
- {
3187
- variants: {
3188
- spacing: {
3189
- compact: "[&_th]:px-[12px] [&_th]:py-[2px]",
3190
- normal: "[&_th]:px-[12px] [&_th]:py-[8px]"
3191
- }
3192
- },
3193
- defaultVariants: {
3194
- spacing: "normal"
3195
- }
3196
- }
3197
- );
3198
- var TableHeader = React12.forwardRef(
3199
- ({ className, spacing, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn(tableHeaderVariant({ spacing }), className), ...props })
3200
- );
3201
- var tableBodyVariant = cva(null, {
3202
- variants: {
3203
- spacing: {
3204
- normal: "[&_td]:h-[50px]",
3205
- compact: "[&_td]:h-[36px]"
3206
- }
3207
- },
3208
- defaultVariants: {
3209
- spacing: "normal"
3210
- }
3211
- });
3212
- var TableBody = React12.forwardRef(
3213
- ({ className, spacing, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className: cn(tableBodyVariant({ spacing }), className), ...props })
3214
- );
3215
- var TablePagination = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3216
- "div",
3217
- {
3218
- ref,
3219
- className: cn("mt-0 flex items-center justify-center", className),
3220
- ...props
3221
- }
3222
- ));
3223
- var TableRow = React12.forwardRef(
3224
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3225
- "tr",
3226
- {
3227
- ref,
3228
- className: cn(
3229
- // 행 선은 헤더·바깥 테두리와 같은 토큰, 마지막 행은 바깥 테두리와 겹치지 않게 선 없음
3230
- "border-b border-sys-divider-subtle border-solid last:border-b-0 hover:bg-sys-table-hover active:bg-sys-table-press data-[state=selected]:bg-sys-table-select",
3231
- className
3232
- ),
3233
- ...props
3234
- }
3235
- )
3236
- );
3237
- var NUMBER_COLUMN_CLASS = "whitespace-nowrap";
3238
- var tableHeadVariant = cva(null, {
3239
- variants: {
3240
- align: {
3241
- left: "text-left",
3242
- center: "text-center",
3243
- right: `text-right ${NUMBER_COLUMN_CLASS}`
3244
- }
3245
- },
3246
- defaultVariants: {
3247
- align: "left"
3248
- }
3249
- });
3250
- var TableHead = React12.forwardRef(
3251
- ({ className, align, ...props }, ref) => /* @__PURE__ */ jsx(
3252
- "th",
3253
- {
3254
- ref,
3255
- "data-align": alignFromClassName(align, className) ?? "left",
3256
- className: cn(tableHeadVariant({ align: alignFromClassName(align, className) }), className),
3257
- ...props
3258
- }
3259
- )
3260
- );
3261
- var tableCellMasterVariant = cva("align-middle px-[12px]", {
3262
- variants: {
3263
- align: {
3264
- left: "",
3265
- center: "[&>_.c-wrap-main]:justify-center",
3266
- // 머리글 없는 표도 숫자 셀은 한 줄
3267
- right: `[&>_.c-wrap-main]:justify-end ${NUMBER_COLUMN_CLASS}`
3268
- }
3269
- },
3270
- defaultVariants: {
3271
- align: "left"
3272
- }
3273
- });
3274
- function alignFromClassName(align, className) {
3275
- if (align) return align;
3276
- if (/(^|\s)text-right(\s|$)/.test(className ?? "")) return "right";
3277
- if (/(^|\s)text-center(\s|$)/.test(className ?? "")) return "center";
3278
- return void 0;
3279
- }
3280
- var TableCell = React12.forwardRef(
3281
- ({ className, children, desc, customElement, align, ...props }, ref) => {
3282
- return /* @__PURE__ */ jsx(
3283
- "td",
3284
- {
3285
- ref,
3286
- "data-align": alignFromClassName(align, className) ?? "left",
3287
- className: cn(
3288
- tableCellMasterVariant({ align: alignFromClassName(align, className) }),
3289
- className
3290
- ),
3291
- ...props,
3292
- children: /* @__PURE__ */ jsxs("div", { className: "c-wrap-main flex gap-[12px] items-center w-full h-full text-base-regular text-sys-text-main", children: [
3293
- customElement && customElement,
3294
- React12.isValidElement(children) ? desc ? (
3295
- // 엘리먼트 자식(Badge 등)도 desc 를 아래에 함께 보여준다
3296
- /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
3297
- children,
3298
- /* @__PURE__ */ jsx("div", { className: "c-text-overflow text-small-regular text-sys-text-subtler", children: desc })
3299
- ] })
3300
- ) : /* @__PURE__ */ jsx(Fragment, { children }) : /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
3301
- /* @__PURE__ */ jsx("div", { className: "c-text-overflow text-base-regular text-sys-text-main", children }),
3302
- desc && /* @__PURE__ */ jsx("div", { className: "c-text-overflow text-small-regular text-sys-text-subtler", children: desc })
3303
- ] })
3304
- ] })
3305
- }
3306
- );
3307
- }
3308
- );
3309
- function SortIcon({ direction = "asc" }) {
3310
- const activeColor = "var(--color-secondary60)";
3311
- const inactiveColor = "var(--color-secondary30)";
3312
- return /* @__PURE__ */ jsx("svg", { width: "22", height: "24", viewBox: "0 0 22 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: direction ? /* @__PURE__ */ jsxs(Fragment, { children: [
3313
- /* @__PURE__ */ jsx("path", { d: "M11 5L6 10H16L11 5Z", fill: direction === "asc" ? activeColor : inactiveColor }),
3314
- /* @__PURE__ */ jsx(
3315
- "path",
3316
- {
3317
- d: "M11 19L16 14L6 14L11 19Z",
3318
- fill: direction === "asc" ? inactiveColor : activeColor
3319
- }
3320
- )
3321
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3322
- /* @__PURE__ */ jsx("path", { d: "M11 5L6 10H16L11 5Z", fill: inactiveColor }),
3323
- /* @__PURE__ */ jsx("path", { d: "M11 19L16 14L6 14L11 19Z", fill: inactiveColor })
3324
- ] }) });
3325
- }
3326
- Table.displayName = "Table";
3327
- TableHeader.displayName = "TableHeader";
3328
- TableBody.displayName = "TableBody";
3329
- TablePagination.displayName = "TablePagination";
3330
- TableRow.displayName = "TableRow";
3331
- TableHead.displayName = "TableHead";
3332
- TableCell.displayName = "TableCell";
3333
- function Skeleton({ className, ...props }) {
3334
- return /* @__PURE__ */ jsx("div", { className: cn("animate-pulse rounded-md bg-secondary20", className), ...props });
3335
- }
3336
- function seededWidth(row, col, min, max) {
3337
- const hash = (row * 31 + col * 17 + 7) * 2654435761 >>> 0;
3338
- return min + hash % (max - min + 1);
3339
- }
3340
- function buildColumns(columnDefs, selectionColumnWidth) {
3341
- const cols = [];
3342
- if (selectionColumnWidth != null) {
3343
- cols.push({ width: selectionColumnWidth });
3344
- }
3345
- for (const def of columnDefs) {
3346
- cols.push({
3347
- width: def.width,
3348
- flex: def.flex,
3349
- minWidth: def.minWidth
3350
- });
3351
- }
3352
- return cols;
3353
- }
3354
- function getColStyle(col) {
3355
- if (col.width != null) {
3356
- return { width: col.width, flexShrink: 0 };
3357
- }
3358
- if (col.flex != null) {
3359
- return { flex: col.flex, minWidth: col.minWidth };
3360
- }
3361
- return { flex: 1 };
3362
- }
3363
- function TableSkeleton({
3364
- columnDefs = [],
3365
- rowLength = 3,
3366
- rowHeight = 50,
3367
- headerHeight = 40,
3368
- selectionColumnWidth
3369
- }) {
3370
- const displayRowLength = rowLength && rowLength > 0 ? rowLength : 5;
3371
- const columns = buildColumns(columnDefs, selectionColumnWidth);
3372
- return /* @__PURE__ */ jsxs(Stack, { direction: "column", className: "w-full", children: [
3373
- /* @__PURE__ */ jsx(
3374
- "div",
3375
- {
3376
- className: "flex items-center bg-sys-table-header-background border-b border-sys-divider-subtler rounded-[6px]",
3377
- style: { height: headerHeight + 1, paddingLeft: 10, paddingRight: 10 },
3378
- children: columns.map((col, colIndex) => /* @__PURE__ */ jsx("div", { className: "flex items-center px-[6px]", style: getColStyle(col), children: /* @__PURE__ */ jsx(
3379
- Skeleton,
3380
- {
3381
- className: "h-[12px] rounded-[3px] !bg-grayscale-s20",
3382
- style: { width: `${seededWidth(0, colIndex, 40, 70)}%` }
3383
- }
3384
- ) }, colIndex))
3385
- }
3386
- ),
3387
- Array.from({ length: displayRowLength }).map((_, rowIndex) => /* @__PURE__ */ jsx(
3388
- "div",
3389
- {
3390
- className: cn(
3391
- "flex items-center",
3392
- rowIndex < displayRowLength - 1 && "border-b border-sys-divider-subtler"
3393
- ),
3394
- style: { height: rowHeight, paddingLeft: 10, paddingRight: 10 },
3395
- children: columns.map((col, colIndex) => /* @__PURE__ */ jsx("div", { className: "flex items-center px-[6px]", style: getColStyle(col), children: /* @__PURE__ */ jsx(
3396
- Skeleton,
3397
- {
3398
- className: "h-[14px] rounded-[3px]",
3399
- style: { width: `${seededWidth(rowIndex + 1, colIndex, 40, 80)}%` }
3400
- }
3401
- ) }, colIndex))
3402
- },
3403
- rowIndex
3404
- ))
3405
- ] });
3406
- }
3407
4540
  var AgGridContext = createContext({
3408
4541
  containerHeight: 0,
3409
4542
  isEmpty: false,
@@ -4503,6 +5636,6 @@ function TwoLineCellRenderer(params) {
4503
5636
  ] });
4504
5637
  }
4505
5638
 
4506
- export { AG_GRID_LOCALE_KR, AgGridContext, AgGridTable, Alert, AlertActions, AlertDescription, AlertTitle, BADGE_OUTLINE_ACCENT, BALANCED_FILL_MIN_WIDTH, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardThumbnail, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyBoxIllustration, Form, FormControl, FormDescription, FormField, FormFooter, FormHeader, FormItem, FormLabel, FormMessage, FormSection, FormSectionLevelContext, FormValidMessage, HeaderCheckboxRenderer, IconButton, LucideIcon, NUMBER_COLUMN_CLASS, NUMBER_COLUMN_WIDTH, PageHeader, PageHeaderProvider, Pagination, PaginationContent, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationNext, PaginationPrevious, PaginationWrapper, Panel, RowCheckboxRenderer, SORT_ICON_OFFSET_CLASS, Separator, Skeleton, SortIcon, Spinner, Stack, Table, TableBody, TableCell, TableHead, TableHeader, TablePagination, TableRow, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TwoLineCellRenderer, alignFromClassName, badgeVariants, buttonVariants, cn, estimateHeaderTextWidth, fitColumnsToContent, getPaginationRange, getSortedColumnState, growColumnIds, sanitizeUserText, useFormControlContext, useFormField, usePageHeader, useRestoreFocusToOpener, withBalancedFill, withExplicitSortIcons, withFlexFill, withHeaderMinWidth, withNumberColumnWidth, withSortIconOffset, withTypeClasses, withWidthFloor };
4507
- //# sourceMappingURL=chunk-RWXQIS6W.js.map
4508
- //# sourceMappingURL=chunk-RWXQIS6W.js.map
5639
+ export { AG_GRID_LOCALE_KR, AgGridContext, AgGridTable, Alert, AlertActions, AlertDescription, AlertTitle, BADGE_OUTLINE_ACCENT, BALANCED_FILL_MIN_WIDTH, Badge, Button, CLEAR_HOST_CLASS, CLEAR_REVEAL_CLASS, CancelIcon, Card, CardContent, CardDescription, CardFooter, CardHeader, CardThumbnail, CardTitle, ChatComposer, ChatHistory, ChatMessage, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyBoxIllustration, FloatingLabelOutline, Form, FormControl, FormDescription, FormField, FormFooter, FormHeader, FormItem, FormLabel, FormMessage, FormSection, FormSectionLevelContext, FormValidMessage, HeaderCheckboxRenderer, LucideIcon, NUMBER_COLUMN_WIDTH, PageHeader, PageHeaderProvider, Pagination, PaginationContent, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationNext, PaginationPrevious, PaginationWrapper, Panel, RowCheckboxRenderer, SORT_ICON_OFFSET_CLASS, Separator2 as Separator, Skeleton, Spinner, Stack, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TextField, Textarea, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TwoLineCellRenderer, badgeVariants, buttonVariants, estimateHeaderTextWidth, fitColumnsToContent, getPaginationRange, getSortedColumnState, groupChatHistoryByDate, growColumnIds, sanitizeUserText, tagVariants, useFloatingLabel, useFormControlContext, useFormField, usePageHeader, useRestoreFocusToOpener, withBalancedFill, withExplicitSortIcons, withFlexFill, withHeaderMinWidth, withNumberColumnWidth, withSortIconOffset, withTypeClasses, withWidthFloor };
5640
+ //# sourceMappingURL=chunk-GZZXYYDY.js.map
5641
+ //# sourceMappingURL=chunk-GZZXYYDY.js.map