@langchain/macaw-components 1.0.0 → 1.1.0

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 (64) hide show
  1. package/dist/base.css +5 -5
  2. package/dist/catalog.json +493 -480
  3. package/dist/components/Button/constants.js +2 -2
  4. package/dist/components/Button/constants.js.map +1 -1
  5. package/dist/components/ChartTooltip/ChartTooltip.js +2 -2
  6. package/dist/components/ChartTooltip/ChartTooltip.js.map +1 -1
  7. package/dist/components/Command/Command.js +1 -1
  8. package/dist/components/Command/Command.js.map +1 -1
  9. package/dist/components/ContextMenu/ContextMenu.js +1 -1
  10. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  11. package/dist/components/CopyButton/CopyButton.d.ts +3 -2
  12. package/dist/components/CopyButton/CopyButton.js +5 -0
  13. package/dist/components/CopyButton/CopyButton.js.map +1 -1
  14. package/dist/components/Dialog/index.d.ts +3 -2
  15. package/dist/components/Dialog/index.js +44 -17
  16. package/dist/components/Dialog/index.js.map +1 -1
  17. package/dist/components/DropdownMenu/DropdownMenu.js +3 -3
  18. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
  19. package/dist/components/GroupedTabs/GroupedTabs.d.ts +3 -2
  20. package/dist/components/GroupedTabs/GroupedTabs.js +3 -1
  21. package/dist/components/GroupedTabs/GroupedTabs.js.map +1 -1
  22. package/dist/components/Input/Input.js +7 -6
  23. package/dist/components/Input/Input.js.map +1 -1
  24. package/dist/components/Input/inputStyles.js +4 -4
  25. package/dist/components/Input/inputStyles.js.map +1 -1
  26. package/dist/components/Link/Link.js +3 -3
  27. package/dist/components/Link/Link.js.map +1 -1
  28. package/dist/components/Pane/Pane.d.ts +3 -2
  29. package/dist/components/Pane/Pane.js +107 -101
  30. package/dist/components/Pane/Pane.js.map +1 -1
  31. package/dist/components/Popover/Popover.js +15 -4
  32. package/dist/components/Popover/Popover.js.map +1 -1
  33. package/dist/components/Popover/constants.d.ts +1 -1
  34. package/dist/components/Popover/constants.js +1 -1
  35. package/dist/components/Popover/constants.js.map +1 -1
  36. package/dist/components/Select/Select.d.ts +2 -1
  37. package/dist/components/Select/Select.js +5 -3
  38. package/dist/components/Select/Select.js.map +1 -1
  39. package/dist/components/Select/SelectPrimitive.js +5 -3
  40. package/dist/components/Select/SelectPrimitive.js.map +1 -1
  41. package/dist/components/Tabs/index.d.ts +3 -2
  42. package/dist/components/Tabs/index.js +3 -1
  43. package/dist/components/Tabs/index.js.map +1 -1
  44. package/dist/components/Textarea/Textarea.js +8 -8
  45. package/dist/components/Textarea/Textarea.js.map +1 -1
  46. package/dist/components/Toast/index.js +1 -1
  47. package/dist/components/Toast/index.js.map +1 -1
  48. package/dist/components/Tooltip/Tooltip.js +1 -1
  49. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  50. package/dist/components/Typeahead/TypeaheadView.js +9 -9
  51. package/dist/components/Typeahead/TypeaheadView.js.map +1 -1
  52. package/dist/utilities.css +1 -1
  53. package/dist/utils/ModalLayerContext.d.ts +23 -0
  54. package/dist/utils/ModalLayerContext.js +92 -0
  55. package/dist/utils/ModalLayerContext.js.map +1 -0
  56. package/dist/utils/cn.js +4 -0
  57. package/dist/utils/cn.js.map +1 -1
  58. package/dist/utils/dataAttributes.d.ts +9 -0
  59. package/dist/utils/dataAttributes.js +13 -0
  60. package/dist/utils/dataAttributes.js.map +1 -0
  61. package/docs/DESIGN.md +21 -1
  62. package/docs/STYLES.md +84 -44
  63. package/package.json +2 -2
  64. package/tailwind.preset.cjs +11 -5
@@ -8,8 +8,8 @@ var buttonStyleMap = {
8
8
  "primary-outlined-disabled": "bg-brand-muted border border-transparent text-brand-disabled",
9
9
  "primary-plain-disabled": "bg-brand-muted border border-transparent text-brand-disabled",
10
10
  "primary-underlined-disabled": "bg-transparent text-brand-disabled border border-transparent",
11
- "secondary-normal-enabled": "bg-elevated text-secondary border border-subtle hover:bg-elevated-hover/80",
12
- "secondary-outlined-enabled": "bg-elevated text-secondary border border-subtle hover:bg-elevated-hover/80",
11
+ "secondary-normal-enabled": "bg-elevated text-secondary border button-secondary-border hover:button-secondary-border-hover hover:bg-elevated-hover/80",
12
+ "secondary-outlined-enabled": "bg-elevated text-secondary border button-secondary-border hover:button-secondary-border-hover hover:bg-elevated-hover/80",
13
13
  "secondary-plain-enabled": "bg-transparent text-secondary border border-transparent hover:bg-elevated-hover/80 dark:hover:bg-elevated-hover/40",
14
14
  "secondary-underlined-enabled": "text-secondary hover:text-secondary-hover border-b button-secondary-underlined-border hover:button-secondary-underlined-border-hover",
15
15
  "secondary-normal-disabled": "bg-surface-level-1-hover dark:bg-disabled border border-transparent text-disabled",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../../../src/components/Button/constants.ts"],"sourcesContent":["// Define styles for each specific combination\nexport const buttonStyleMap = {\n // Primary variants - enabled\n 'primary-normal-enabled':\n 'button-primary-bg button-primary-foreground border button-primary-border hover:border-transparent hover:button-primary-bg-hover dark:hover:button-primary-bg-hover dark:hover:border-transparent',\n 'primary-outlined-enabled':\n 'bg-transparent text-brand-secondary border border-brand-strong hover:text-brand-primary hover:bg-brand-muted dark:border-brand dark:hover:bg-brand-subtle dark:hover:button-primary-border dark:hover:text-brand-primary',\n 'primary-plain-enabled':\n 'bg-transparent text-brand-400 dark:text-brand-700 border border-transparent hover:text-brand-secondary dark:hover:text-brand-primary hover:bg-brand-muted/80',\n 'primary-underlined-enabled':\n 'bg-transparent button-primary-underlined-foreground border-b button-primary-underlined-border hover:button-primary-underlined-border-hover hover:button-primary-underlined-foreground-hover',\n\n // Primary variants - disabled\n 'primary-normal-disabled':\n 'bg-brand-muted border border-brand-disabled text-brand-disabled',\n 'primary-outlined-disabled':\n 'bg-brand-muted border border-transparent text-brand-disabled',\n 'primary-plain-disabled':\n 'bg-brand-muted border border-transparent text-brand-disabled',\n 'primary-underlined-disabled':\n 'bg-transparent text-brand-disabled border border-transparent',\n\n // Secondary variants - enabled\n 'secondary-normal-enabled':\n 'bg-elevated text-secondary border border-subtle hover:bg-elevated-hover/80',\n 'secondary-outlined-enabled':\n 'bg-elevated text-secondary border border-subtle hover:bg-elevated-hover/80',\n 'secondary-plain-enabled':\n 'bg-transparent text-secondary border border-transparent hover:bg-elevated-hover/80 dark:hover:bg-elevated-hover/40',\n 'secondary-underlined-enabled':\n 'text-secondary hover:text-secondary-hover border-b button-secondary-underlined-border hover:button-secondary-underlined-border-hover',\n\n // Secondary variants - disabled\n 'secondary-normal-disabled':\n 'bg-surface-level-1-hover dark:bg-disabled border border-transparent text-disabled',\n 'secondary-outlined-disabled':\n 'bg-surface-level-1-hover dark:bg-disabled border border-transparent text-disabled',\n 'secondary-plain-disabled':\n 'bg-surface-level-1-hover dark:bg-disabled border border-transparent text-disabled',\n 'secondary-underlined-disabled': 'text-disabled border border-transparent',\n\n // Error variants - enabled\n 'error-normal-enabled':\n 'bg-error-strong dark:bg-error-secondary text-white border button-error-border hover:button-error-bg-hover dark:hover:bg-error',\n 'error-outlined-enabled':\n 'bg-transparent text-error-secondary border button-error-outlined-border hover:bg-error',\n 'error-plain-enabled':\n 'bg-transparent text-error-secondary border border-transparent hover:bg-error/80',\n 'error-underlined-enabled':\n 'bg-transparent text-error-secondary border-b button-error-underlined-border hover:button-error-underlined-border-hover hover:button-error-underlined-foreground-hover',\n\n // Error variants - disabled\n 'error-normal-disabled':\n 'bg-error border border-transparent button-error-disabled-foreground',\n 'error-outlined-disabled':\n 'bg-transparent button-error-disabled-foreground border button-error-disabled-border',\n 'error-plain-disabled':\n 'bg-transparent button-error-disabled-foreground border border-transparent',\n 'error-underlined-disabled':\n 'bg-transparent button-error-disabled-foreground border border-transparent',\n};\n"],"mappings":";AACA,IAAa,iBAAiB;CAE5B,0BACE;CACF,4BACE;CACF,yBACE;CACF,8BACE;CAGF,2BACE;CACF,6BACE;CACF,0BACE;CACF,+BACE;CAGF,4BACE;CACF,8BACE;CACF,2BACE;CACF,gCACE;CAGF,6BACE;CACF,+BACE;CACF,4BACE;CACF,iCAAiC;CAGjC,wBACE;CACF,0BACE;CACF,uBACE;CACF,4BACE;CAGF,yBACE;CACF,2BACE;CACF,wBACE;CACF,6BACE;AACJ"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../../src/components/Button/constants.ts"],"sourcesContent":["// Define styles for each specific combination\nexport const buttonStyleMap = {\n // Primary variants - enabled\n 'primary-normal-enabled':\n 'button-primary-bg button-primary-foreground border button-primary-border hover:border-transparent hover:button-primary-bg-hover dark:hover:button-primary-bg-hover dark:hover:border-transparent',\n 'primary-outlined-enabled':\n 'bg-transparent text-brand-secondary border border-brand-strong hover:text-brand-primary hover:bg-brand-muted dark:border-brand dark:hover:bg-brand-subtle dark:hover:button-primary-border dark:hover:text-brand-primary',\n 'primary-plain-enabled':\n 'bg-transparent text-brand-400 dark:text-brand-700 border border-transparent hover:text-brand-secondary dark:hover:text-brand-primary hover:bg-brand-muted/80',\n 'primary-underlined-enabled':\n 'bg-transparent button-primary-underlined-foreground border-b button-primary-underlined-border hover:button-primary-underlined-border-hover hover:button-primary-underlined-foreground-hover',\n\n // Primary variants - disabled\n 'primary-normal-disabled':\n 'bg-brand-muted border border-brand-disabled text-brand-disabled',\n 'primary-outlined-disabled':\n 'bg-brand-muted border border-transparent text-brand-disabled',\n 'primary-plain-disabled':\n 'bg-brand-muted border border-transparent text-brand-disabled',\n 'primary-underlined-disabled':\n 'bg-transparent text-brand-disabled border border-transparent',\n\n // Secondary variants - enabled\n 'secondary-normal-enabled':\n 'bg-elevated text-secondary border button-secondary-border hover:button-secondary-border-hover hover:bg-elevated-hover/80',\n 'secondary-outlined-enabled':\n 'bg-elevated text-secondary border button-secondary-border hover:button-secondary-border-hover hover:bg-elevated-hover/80',\n 'secondary-plain-enabled':\n 'bg-transparent text-secondary border border-transparent hover:bg-elevated-hover/80 dark:hover:bg-elevated-hover/40',\n 'secondary-underlined-enabled':\n 'text-secondary hover:text-secondary-hover border-b button-secondary-underlined-border hover:button-secondary-underlined-border-hover',\n\n // Secondary variants - disabled\n 'secondary-normal-disabled':\n 'bg-surface-level-1-hover dark:bg-disabled border border-transparent text-disabled',\n 'secondary-outlined-disabled':\n 'bg-surface-level-1-hover dark:bg-disabled border border-transparent text-disabled',\n 'secondary-plain-disabled':\n 'bg-surface-level-1-hover dark:bg-disabled border border-transparent text-disabled',\n 'secondary-underlined-disabled': 'text-disabled border border-transparent',\n\n // Error variants - enabled\n 'error-normal-enabled':\n 'bg-error-strong dark:bg-error-secondary text-white border button-error-border hover:button-error-bg-hover dark:hover:bg-error',\n 'error-outlined-enabled':\n 'bg-transparent text-error-secondary border button-error-outlined-border hover:bg-error',\n 'error-plain-enabled':\n 'bg-transparent text-error-secondary border border-transparent hover:bg-error/80',\n 'error-underlined-enabled':\n 'bg-transparent text-error-secondary border-b button-error-underlined-border hover:button-error-underlined-border-hover hover:button-error-underlined-foreground-hover',\n\n // Error variants - disabled\n 'error-normal-disabled':\n 'bg-error border border-transparent button-error-disabled-foreground',\n 'error-outlined-disabled':\n 'bg-transparent button-error-disabled-foreground border button-error-disabled-border',\n 'error-plain-disabled':\n 'bg-transparent button-error-disabled-foreground border border-transparent',\n 'error-underlined-disabled':\n 'bg-transparent button-error-disabled-foreground border border-transparent',\n};\n"],"mappings":";AACA,IAAa,iBAAiB;CAE5B,0BACE;CACF,4BACE;CACF,yBACE;CACF,8BACE;CAGF,2BACE;CACF,6BACE;CACF,0BACE;CACF,+BACE;CAGF,4BACE;CACF,8BACE;CACF,2BACE;CACF,gCACE;CAGF,6BACE;CACF,+BACE;CACF,4BACE;CACF,iCAAiC;CAGjC,wBACE;CACF,0BACE;CACF,uBACE;CACF,4BACE;CAGF,yBACE;CACF,2BACE;CACF,wBACE;CACF,6BACE;AACJ"}
@@ -6,7 +6,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
6
  var ChartTooltip = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", {
7
7
  ref,
8
8
  role: "tooltip",
9
- className: cn("flex w-max max-w-[24rem] flex-col rounded-md border border-subtle bg-elevated p-space-1 text-primary shadow-md", className),
9
+ className: cn("flex w-max max-w-[24rem] flex-col rounded-md border border-subtle bg-popover p-space-1 text-primary shadow-md", className),
10
10
  ...props,
11
11
  children
12
12
  }));
@@ -47,7 +47,7 @@ function ChartTooltipRow({ label, value, secondaryValue, markerColor, marker, hi
47
47
  "aria-hidden": true,
48
48
  className: "mx-space-2 my-space-1 border-t border-subtle"
49
49
  }), /* @__PURE__ */ jsxs("div", {
50
- className: cn("flex min-w-0 items-center gap-space-2 rounded-xs px-space-2 py-space-1", highlighted && "bg-surface-level-2", className),
50
+ className: cn("flex min-w-0 items-center gap-space-2 rounded-xs px-space-2 py-space-1", highlighted && "bg-elevated-hover", className),
51
51
  ...props,
52
52
  children: [
53
53
  marker ?? (markerColor != null && /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"ChartTooltip.js","names":[],"sources":["../../../src/components/ChartTooltip/ChartTooltip.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Text } from '../Text';\n\nexport type ChartTooltipProps = HTMLAttributes<HTMLDivElement>;\n\nexport const ChartTooltip = forwardRef<HTMLDivElement, ChartTooltipProps>(\n ({ className, children, ...props }, ref) => (\n <div\n ref={ref}\n role=\"tooltip\"\n className={cn(\n 'flex w-max max-w-[24rem] flex-col rounded-md border border-subtle bg-elevated p-space-1 text-primary shadow-md',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n);\n\nChartTooltip.displayName = 'ChartTooltip';\n\nexport interface ChartTooltipHeaderProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'title'\n> {\n title: ReactNode;\n value?: ReactNode;\n leading?: ReactNode;\n}\n\nexport function ChartTooltipHeader({\n title,\n value,\n leading,\n className,\n ...props\n}: ChartTooltipHeaderProps) {\n return (\n <div className={className} {...props}>\n <div className=\"flex min-w-0 items-center gap-space-6 px-space-2 py-space-1\">\n <div className=\"flex min-w-0 flex-1 items-center gap-space-2\">\n {leading}\n <Text\n variant=\"xs\"\n weight=\"medium\"\n className=\"min-w-0 flex-1 truncate\"\n >\n {title}\n </Text>\n </div>\n {value != null && (\n <Text\n variant=\"xs\"\n weight=\"semibold\"\n className=\"shrink-0 tabular-nums\"\n >\n {value}\n </Text>\n )}\n </div>\n </div>\n );\n}\n\nexport type ChartTooltipBodyProps = HTMLAttributes<HTMLDivElement>;\n\nexport function ChartTooltipBody({\n className,\n children,\n ...props\n}: ChartTooltipBodyProps) {\n return (\n <div\n className={cn(\n 'scroll-mask-t scroll-mask-b flex max-h-[min(300px,70vh)] flex-col overflow-y-auto overflow-x-hidden',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nexport interface ChartTooltipRowProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children'\n> {\n label: ReactNode;\n value?: ReactNode;\n secondaryValue?: ReactNode;\n markerColor?: string;\n marker?: ReactNode;\n /** Highlights the row matching the currently hovered or focused chart mark. Defaults to false. */\n highlighted?: boolean;\n variant?: 'default' | 'total';\n action?: ReactNode;\n}\n\nexport function ChartTooltipRow({\n label,\n value,\n secondaryValue,\n markerColor,\n marker,\n highlighted = false,\n variant = 'default',\n action,\n className,\n ...props\n}: ChartTooltipRowProps) {\n const isTotal = variant === 'total';\n\n return (\n <>\n {isTotal && (\n <div\n aria-hidden\n className=\"mx-space-2 my-space-1 border-t border-subtle\"\n />\n )}\n <div\n className={cn(\n 'flex min-w-0 items-center gap-space-2 rounded-xs px-space-2 py-space-1',\n highlighted && 'bg-surface-level-2',\n className\n )}\n {...props}\n >\n {marker ??\n (markerColor != null && (\n <div\n aria-hidden\n className=\"size-2 shrink-0 rounded-full\"\n style={{ backgroundColor: markerColor }}\n />\n ))}\n <Text\n variant=\"xs\"\n weight={isTotal ? 'semibold' : 'normal'}\n className=\"min-w-0 flex-1 whitespace-normal break-words\"\n >\n {label}\n </Text>\n {value != null && (\n <Text\n variant=\"xs\"\n weight={isTotal ? 'semibold' : 'normal'}\n className=\"shrink-0 text-right tabular-nums\"\n >\n {value}\n </Text>\n )}\n {secondaryValue != null && (\n <Text\n variant=\"xs\"\n color=\"tertiary\"\n className=\"shrink-0 text-right tabular-nums\"\n >\n {secondaryValue}\n </Text>\n )}\n {action}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;AAOA,IAAa,eAAe,YACzB,EAAE,WAAW,UAAU,GAAG,SAAS,QAClC,oBAAC,OAAD;CACO;CACL,MAAK;CACL,WAAW,GACT,kHACA,SACF;CACA,GAAI;CAEH;AACE,CAAA,CAET;AAEA,aAAa,cAAc;AAW3B,SAAgB,mBAAmB,EACjC,OACA,OACA,SACA,WACA,GAAG,SACuB;CAC1B,OACE,oBAAC,OAAD;EAAgB;EAAW,GAAI;EAC7B,UAAA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,SACD,oBAAC,MAAD;KACE,SAAQ;KACR,QAAO;KACP,WAAU;KAET,UAAA;IACG,CAAA,CACH;GACJ,CAAA,GAAA,SAAS,QACR,oBAAC,MAAD;IACE,SAAQ;IACR,QAAO;IACP,WAAU;IAET,UAAA;GACG,CAAA,CAEL;;CACF,CAAA;AAET;AAIA,SAAgB,iBAAiB,EAC/B,WACA,UACA,GAAG,SACqB;CACxB,OACE,oBAAC,OAAD;EACE,WAAW,GACT,uGACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET;AAiBA,SAAgB,gBAAgB,EAC9B,OACA,OACA,gBACA,aACA,QACA,cAAc,OACd,UAAU,WACV,QACA,WACA,GAAG,SACoB;CACvB,MAAM,UAAU,YAAY;CAE5B,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,WACC,oBAAC,OAAD;EACE,eAAA;EACA,WAAU;CACX,CAAA,GAEH,qBAAC,OAAD;EACE,WAAW,GACT,0EACA,eAAe,sBACf,SACF;EACA,GAAI;EANN,UAAA;GAQG,WACE,eAAe,QACd,oBAAC,OAAD;IACE,eAAA;IACA,WAAU;IACV,OAAO,EAAE,iBAAiB,YAAY;GACvC,CAAA;GAEL,oBAAC,MAAD;IACE,SAAQ;IACR,QAAQ,UAAU,aAAa;IAC/B,WAAU;IAET,UAAA;GACG,CAAA;GACL,SAAS,QACR,oBAAC,MAAD;IACE,SAAQ;IACR,QAAQ,UAAU,aAAa;IAC/B,WAAU;IAET,UAAA;GACG,CAAA;GAEP,kBAAkB,QACjB,oBAAC,MAAD;IACE,SAAQ;IACR,OAAM;IACN,WAAU;IAET,UAAA;GACG,CAAA;GAEP;EACE;CACL,CAAA,CAAA,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"ChartTooltip.js","names":[],"sources":["../../../src/components/ChartTooltip/ChartTooltip.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Text } from '../Text';\n\nexport type ChartTooltipProps = HTMLAttributes<HTMLDivElement>;\n\nexport const ChartTooltip = forwardRef<HTMLDivElement, ChartTooltipProps>(\n ({ className, children, ...props }, ref) => (\n <div\n ref={ref}\n role=\"tooltip\"\n className={cn(\n 'flex w-max max-w-[24rem] flex-col rounded-md border border-subtle bg-popover p-space-1 text-primary shadow-md',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n);\n\nChartTooltip.displayName = 'ChartTooltip';\n\nexport interface ChartTooltipHeaderProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'title'\n> {\n title: ReactNode;\n value?: ReactNode;\n leading?: ReactNode;\n}\n\nexport function ChartTooltipHeader({\n title,\n value,\n leading,\n className,\n ...props\n}: ChartTooltipHeaderProps) {\n return (\n <div className={className} {...props}>\n <div className=\"flex min-w-0 items-center gap-space-6 px-space-2 py-space-1\">\n <div className=\"flex min-w-0 flex-1 items-center gap-space-2\">\n {leading}\n <Text\n variant=\"xs\"\n weight=\"medium\"\n className=\"min-w-0 flex-1 truncate\"\n >\n {title}\n </Text>\n </div>\n {value != null && (\n <Text\n variant=\"xs\"\n weight=\"semibold\"\n className=\"shrink-0 tabular-nums\"\n >\n {value}\n </Text>\n )}\n </div>\n </div>\n );\n}\n\nexport type ChartTooltipBodyProps = HTMLAttributes<HTMLDivElement>;\n\nexport function ChartTooltipBody({\n className,\n children,\n ...props\n}: ChartTooltipBodyProps) {\n return (\n <div\n className={cn(\n 'scroll-mask-t scroll-mask-b flex max-h-[min(300px,70vh)] flex-col overflow-y-auto overflow-x-hidden',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nexport interface ChartTooltipRowProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children'\n> {\n label: ReactNode;\n value?: ReactNode;\n secondaryValue?: ReactNode;\n markerColor?: string;\n marker?: ReactNode;\n /** Highlights the row matching the currently hovered or focused chart mark. Defaults to false. */\n highlighted?: boolean;\n variant?: 'default' | 'total';\n action?: ReactNode;\n}\n\nexport function ChartTooltipRow({\n label,\n value,\n secondaryValue,\n markerColor,\n marker,\n highlighted = false,\n variant = 'default',\n action,\n className,\n ...props\n}: ChartTooltipRowProps) {\n const isTotal = variant === 'total';\n\n return (\n <>\n {isTotal && (\n <div\n aria-hidden\n className=\"mx-space-2 my-space-1 border-t border-subtle\"\n />\n )}\n <div\n className={cn(\n 'flex min-w-0 items-center gap-space-2 rounded-xs px-space-2 py-space-1',\n highlighted && 'bg-elevated-hover',\n className\n )}\n {...props}\n >\n {marker ??\n (markerColor != null && (\n <div\n aria-hidden\n className=\"size-2 shrink-0 rounded-full\"\n style={{ backgroundColor: markerColor }}\n />\n ))}\n <Text\n variant=\"xs\"\n weight={isTotal ? 'semibold' : 'normal'}\n className=\"min-w-0 flex-1 whitespace-normal break-words\"\n >\n {label}\n </Text>\n {value != null && (\n <Text\n variant=\"xs\"\n weight={isTotal ? 'semibold' : 'normal'}\n className=\"shrink-0 text-right tabular-nums\"\n >\n {value}\n </Text>\n )}\n {secondaryValue != null && (\n <Text\n variant=\"xs\"\n color=\"tertiary\"\n className=\"shrink-0 text-right tabular-nums\"\n >\n {secondaryValue}\n </Text>\n )}\n {action}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;AAOA,IAAa,eAAe,YACzB,EAAE,WAAW,UAAU,GAAG,SAAS,QAClC,oBAAC,OAAD;CACO;CACL,MAAK;CACL,WAAW,GACT,iHACA,SACF;CACA,GAAI;CAEH;AACE,CAAA,CAET;AAEA,aAAa,cAAc;AAW3B,SAAgB,mBAAmB,EACjC,OACA,OACA,SACA,WACA,GAAG,SACuB;CAC1B,OACE,oBAAC,OAAD;EAAgB;EAAW,GAAI;EAC7B,UAAA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,SACD,oBAAC,MAAD;KACE,SAAQ;KACR,QAAO;KACP,WAAU;KAET,UAAA;IACG,CAAA,CACH;GACJ,CAAA,GAAA,SAAS,QACR,oBAAC,MAAD;IACE,SAAQ;IACR,QAAO;IACP,WAAU;IAET,UAAA;GACG,CAAA,CAEL;;CACF,CAAA;AAET;AAIA,SAAgB,iBAAiB,EAC/B,WACA,UACA,GAAG,SACqB;CACxB,OACE,oBAAC,OAAD;EACE,WAAW,GACT,uGACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET;AAiBA,SAAgB,gBAAgB,EAC9B,OACA,OACA,gBACA,aACA,QACA,cAAc,OACd,UAAU,WACV,QACA,WACA,GAAG,SACoB;CACvB,MAAM,UAAU,YAAY;CAE5B,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,WACC,oBAAC,OAAD;EACE,eAAA;EACA,WAAU;CACX,CAAA,GAEH,qBAAC,OAAD;EACE,WAAW,GACT,0EACA,eAAe,qBACf,SACF;EACA,GAAI;EANN,UAAA;GAQG,WACE,eAAe,QACd,oBAAC,OAAD;IACE,eAAA;IACA,WAAU;IACV,OAAO,EAAE,iBAAiB,YAAY;GACvC,CAAA;GAEL,oBAAC,MAAD;IACE,SAAQ;IACR,QAAQ,UAAU,aAAa;IAC/B,WAAU;IAET,UAAA;GACG,CAAA;GACL,SAAS,QACR,oBAAC,MAAD;IACE,SAAQ;IACR,QAAQ,UAAU,aAAa;IAC/B,WAAU;IAET,UAAA;GACG,CAAA;GAEP,kBAAkB,QACjB,oBAAC,MAAD;IACE,SAAQ;IACR,OAAM;IACN,WAAU;IAET,UAAA;GACG,CAAA;GAEP;EACE;CACL,CAAA,CAAA,EAAA,CAAA;AAEN"}
@@ -73,7 +73,7 @@ var COMMAND_ITEM_SIZE_CLASSES = {
73
73
  };
74
74
  var CommandItem = forwardRef(({ className, size = "md", ...props }, ref) => /* @__PURE__ */ jsx(Command$1.Item, {
75
75
  ref,
76
- className: cn("relative flex cursor-pointer select-none items-center rounded-sm px-space-2 outline-hidden hover:bg-secondary aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-secondary", OPTION_ROW_SIZES[size].minHeightClassName, COMMAND_ITEM_SIZE_CLASSES[size], className),
76
+ className: cn("relative flex cursor-pointer select-none items-center rounded-sm px-space-2 outline-hidden hover:bg-elevated-hover aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-elevated-hover", OPTION_ROW_SIZES[size].minHeightClassName, COMMAND_ITEM_SIZE_CLASSES[size], className),
77
77
  ...props
78
78
  }));
79
79
  CommandItem.displayName = Command$1.Item.displayName;
@@ -1 +1 @@
1
- {"version":3,"file":"Command.js","names":[],"sources":["../../../src/components/Command/Command.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementRef, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport {\n DECORATOR_CLASSES,\n getInputContainerClasses,\n getInputElementClasses,\n} from '../Input/inputStyles';\nimport type { InputSize, InputVariant } from '../Input/inputStyles';\n\nexport const Command = forwardRef<\n ElementRef<typeof CommandPrimitive>,\n ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n 'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover',\n className\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\nexport interface CommandInputProps extends Omit<\n ComponentPropsWithoutRef<typeof CommandPrimitive.Input>,\n 'size'\n> {\n /** Left side decorator (icon or element) */\n leftDecorator?: ReactNode;\n /** Right side decorator (icon or element) */\n rightDecorator?: ReactNode;\n /** Size variant — uses shared Input styling */\n size?: InputSize;\n /** Visual variant — uses shared Input styling */\n variant?: InputVariant;\n}\n\nexport const CommandInput = forwardRef<\n ElementRef<typeof CommandPrimitive.Input>,\n CommandInputProps\n>(\n (\n {\n className,\n leftDecorator,\n rightDecorator,\n size = 'lg',\n variant = 'outlined',\n ...props\n },\n ref\n ) => {\n const containerClasses = getInputContainerClasses({\n size,\n variant,\n disabled: props.disabled,\n className,\n });\n\n const inputClasses = getInputElementClasses({\n size,\n disabled: props.disabled,\n });\n\n return (\n <div className={containerClasses} {...{ 'cmdk-input-wrapper': '' }}>\n {leftDecorator && (\n <div className={DECORATOR_CLASSES}>{leftDecorator}</div>\n )}\n <CommandPrimitive.Input ref={ref} className={inputClasses} {...props} />\n {rightDecorator && (\n <div className={DECORATOR_CLASSES}>{rightDecorator}</div>\n )}\n </div>\n );\n }\n);\n\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nexport const CommandList = forwardRef<\n ElementRef<typeof CommandPrimitive.List>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className)}\n {...props}\n />\n));\n\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nexport const CommandEmpty = forwardRef<\n ElementRef<typeof CommandPrimitive.Empty>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-space-5 text-center\"\n {...props}\n />\n));\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nexport const CommandGroup = forwardRef<\n ElementRef<typeof CommandPrimitive.Group>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n 'overflow-hidden',\n '[&_[cmdk-group-heading]]:px-space-2 [&_[cmdk-group-heading]]:py-space-2 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:text-tertiary',\n className\n )}\n {...props}\n />\n));\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nexport const CommandSeparator = forwardRef<\n ElementRef<typeof CommandPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn('bg-border -mx-space-1 h-px', className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\ninterface CommandItemProps extends ComponentPropsWithoutRef<\n typeof CommandPrimitive.Item\n> {\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n}\n\nconst COMMAND_ITEM_SIZE_CLASSES = {\n sm: 'py-space-1 text-xs leading-4',\n md: 'py-space-1 text-sm',\n} satisfies Record<OptionRowSize, string>;\n\nexport const CommandItem = forwardRef<\n ElementRef<typeof CommandPrimitive.Item>,\n CommandItemProps\n>(({ className, size = 'md', ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer select-none items-center rounded-sm px-space-2 outline-hidden hover:bg-secondary aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-secondary',\n OPTION_ROW_SIZES[size].minHeightClassName,\n COMMAND_ITEM_SIZE_CLASSES[size],\n className\n )}\n {...props}\n />\n));\n\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n"],"mappings":";;;;;;;AAiBA,IAAa,UAAU,YAGpB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,WAAD;CACO;CACL,WAAW,GACT,qEACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,QAAQ,cAAc,UAAiB;AAgBvC,IAAa,eAAe,YAKxB,EACE,WACA,eACA,gBACA,OAAO,MACP,UAAU,YACV,GAAG,SAEL,QACG;CACH,MAAM,mBAAmB,yBAAyB;EAChD;EACA;EACA,UAAU,MAAM;EAChB;CACF,CAAC;CAED,MAAM,eAAe,uBAAuB;EAC1C;EACA,UAAU,MAAM;CAClB,CAAC;CAED,OACE,qBAAC,OAAD;EAAK,WAAW;EAAwB,sBAAsB;EAA9D,UAAA;GACG,iBACC,oBAAC,OAAD;IAAK,WAAA;IAA+B,UAAA;GAAmB,CAAA;GAEzD,oBAAC,UAAiB,OAAlB;IAA6B;IAAK,WAAW;IAAc,GAAI;GAAQ,CAAA;GACtE,kBACC,oBAAC,OAAD;IAAK,WAAA;IAA+B,UAAA;GAAoB,CAAA;EAEvD;;AAET,CACF;AAEA,aAAa,cAAc,UAAiB,MAAM;AAElD,IAAa,cAAc,YAGxB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,UAAiB,MAAlB;CACO;CACL,WAAW,GAAG,mDAAmD,SAAS;CAC1E,GAAI;AACL,CAAA,CACF;AAED,YAAY,cAAc,UAAiB,KAAK;AAEhD,IAAa,eAAe,YAGzB,OAAO,QACR,oBAAC,UAAiB,OAAlB;CACO;CACL,WAAU;CACV,GAAI;AACL,CAAA,CACF;AAED,aAAa,cAAc,UAAiB,MAAM;AAElD,IAAa,eAAe,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,UAAiB,OAAlB;CACO;CACL,WAAW,GACT,mBACA,6NACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AAED,aAAa,cAAc,UAAiB,MAAM;AAElD,IAAa,mBAAmB,YAG7B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,UAAiB,WAAlB;CACO;CACL,WAAW,GAAG,8BAA8B,SAAS;CACrD,GAAI;AACL,CAAA,CACF;AACD,iBAAiB,cAAc,UAAiB,UAAU;AAY1D,IAAM,4BAA4B;CAChC,IAAI;CACJ,IAAI;AACN;AAEA,IAAa,cAAc,YAGxB,EAAE,WAAW,OAAO,MAAM,GAAG,SAAS,QACvC,oBAAC,UAAiB,MAAlB;CACO;CACL,WAAW,GACT,uMACA,iBAAiB,KAAK,CAAC,oBACvB,0BAA0B,OAC1B,SACF;CACA,GAAI;AACL,CAAA,CACF;AAED,YAAY,cAAc,UAAiB,KAAK"}
1
+ {"version":3,"file":"Command.js","names":[],"sources":["../../../src/components/Command/Command.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementRef, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport {\n DECORATOR_CLASSES,\n getInputContainerClasses,\n getInputElementClasses,\n} from '../Input/inputStyles';\nimport type { InputSize, InputVariant } from '../Input/inputStyles';\n\nexport const Command = forwardRef<\n ElementRef<typeof CommandPrimitive>,\n ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n 'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover',\n className\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\nexport interface CommandInputProps extends Omit<\n ComponentPropsWithoutRef<typeof CommandPrimitive.Input>,\n 'size'\n> {\n /** Left side decorator (icon or element) */\n leftDecorator?: ReactNode;\n /** Right side decorator (icon or element) */\n rightDecorator?: ReactNode;\n /** Size variant — uses shared Input styling */\n size?: InputSize;\n /** Visual variant — uses shared Input styling */\n variant?: InputVariant;\n}\n\nexport const CommandInput = forwardRef<\n ElementRef<typeof CommandPrimitive.Input>,\n CommandInputProps\n>(\n (\n {\n className,\n leftDecorator,\n rightDecorator,\n size = 'lg',\n variant = 'outlined',\n ...props\n },\n ref\n ) => {\n const containerClasses = getInputContainerClasses({\n size,\n variant,\n disabled: props.disabled,\n className,\n });\n\n const inputClasses = getInputElementClasses({\n size,\n disabled: props.disabled,\n });\n\n return (\n <div className={containerClasses} {...{ 'cmdk-input-wrapper': '' }}>\n {leftDecorator && (\n <div className={DECORATOR_CLASSES}>{leftDecorator}</div>\n )}\n <CommandPrimitive.Input ref={ref} className={inputClasses} {...props} />\n {rightDecorator && (\n <div className={DECORATOR_CLASSES}>{rightDecorator}</div>\n )}\n </div>\n );\n }\n);\n\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nexport const CommandList = forwardRef<\n ElementRef<typeof CommandPrimitive.List>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className)}\n {...props}\n />\n));\n\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nexport const CommandEmpty = forwardRef<\n ElementRef<typeof CommandPrimitive.Empty>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-space-5 text-center\"\n {...props}\n />\n));\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nexport const CommandGroup = forwardRef<\n ElementRef<typeof CommandPrimitive.Group>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n 'overflow-hidden',\n '[&_[cmdk-group-heading]]:px-space-2 [&_[cmdk-group-heading]]:py-space-2 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:text-tertiary',\n className\n )}\n {...props}\n />\n));\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nexport const CommandSeparator = forwardRef<\n ElementRef<typeof CommandPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn('bg-border -mx-space-1 h-px', className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\ninterface CommandItemProps extends ComponentPropsWithoutRef<\n typeof CommandPrimitive.Item\n> {\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n}\n\nconst COMMAND_ITEM_SIZE_CLASSES = {\n sm: 'py-space-1 text-xs leading-4',\n md: 'py-space-1 text-sm',\n} satisfies Record<OptionRowSize, string>;\n\nexport const CommandItem = forwardRef<\n ElementRef<typeof CommandPrimitive.Item>,\n CommandItemProps\n>(({ className, size = 'md', ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer select-none items-center rounded-sm px-space-2 outline-hidden hover:bg-elevated-hover aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-elevated-hover',\n OPTION_ROW_SIZES[size].minHeightClassName,\n COMMAND_ITEM_SIZE_CLASSES[size],\n className\n )}\n {...props}\n />\n));\n\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n"],"mappings":";;;;;;;AAiBA,IAAa,UAAU,YAGpB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,WAAD;CACO;CACL,WAAW,GACT,qEACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,QAAQ,cAAc,UAAiB;AAgBvC,IAAa,eAAe,YAKxB,EACE,WACA,eACA,gBACA,OAAO,MACP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G,SAAS,QACvC,oBAAC,UAAiB,MAAlB;CACO;CACL,WAAW,GACT,iNACA,iBAAiB,KAAK,CAAC,oBACvB,0BAA0B,OAC1B,SACF;CACA,GAAI;AACL,CAAA,CACF;AAED,YAAY,cAAc,UAAiB,KAAK"}
@@ -13,7 +13,7 @@ var ContextMenuContent = React$1.forwardRef(({ className, children, ...props },
13
13
  const zIndex = useZIndex(zIndices.popover);
14
14
  return /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.Content, {
15
15
  ref,
16
- className: cn("min-w-[8rem] overflow-hidden rounded-md border border-default bg-elevated p-space-1 text-primary shadow-md", className),
16
+ className: cn("min-w-[8rem] overflow-hidden rounded-md border border-default bg-popover p-space-1 text-primary shadow-md", className),
17
17
  ...props,
18
18
  style: {
19
19
  zIndex,
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.js","names":[],"sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\n\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\n\nexport const ContextMenu = ContextMenuPrimitive.Root;\n\nexport const ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nexport const ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, children, ...props }, ref) => {\n const zIndex = useZIndex(zIndices.popover);\n\n return (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'min-w-[8rem] overflow-hidden rounded-md border border-default bg-elevated p-space-1 text-primary shadow-md',\n className\n )}\n {...props}\n style={{ zIndex, ...props.style }}\n >\n <ZIndexProvider value={zIndex}>{children}</ZIndexProvider>\n </ContextMenuPrimitive.Content>\n </ContextMenuPrimitive.Portal>\n );\n});\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nexport const ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n }\n>(({ className, inset, size = 'md', ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'flex w-full cursor-default select-none items-center rounded-sm px-space-2 py-space-1 text-primary outline-hidden transition-colors focus:bg-elevated-hover data-[disabled]:pointer-events-none data-[highlighted]:bg-elevated-hover data-[disabled]:opacity-50',\n OPTION_ROW_SIZES[size].minHeightClassName,\n size === 'sm' ? 'text-xs leading-4' : 'text-sm',\n inset ? 'pl-space-8' : undefined,\n className\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nexport const ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-space-1 my-space-1 border-b border-subtle', className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n"],"mappings":";;;;;;;;;AAaA,IAAa,cAAc,qBAAqB;AAEhD,IAAa,qBAAqB,qBAAqB;AAEvD,IAAa,qBAAqB,QAAM,YAGrC,EAAE,WAAW,UAAU,GAAG,SAAS,QAAQ;CAC5C,MAAM,SAAS,UAAU,SAAS,OAAO;CAEzC,OACE,oBAAC,qBAAqB,QAAtB,EAAA,UACE,oBAAC,qBAAqB,SAAtB;EACO;EACL,WAAW,GACT,8GACA,SACF;EACA,GAAI;EACJ,OAAO;GAAE;GAAQ,GAAG,MAAM;EAAM;EAEhC,UAAA,oBAAC,gBAAD;GAAgB,OAAO;GAAS;EAAyB,CAAA;CAC7B,CAAA,EACH,CAAA;AAEjC,CAAC;AACD,mBAAmB,cAAc,qBAAqB,QAAQ;AAE9D,IAAa,kBAAkB,QAAM,YAUlC,EAAE,WAAW,OAAO,OAAO,MAAM,GAAG,SAAS,QAC9C,oBAAC,qBAAqB,MAAtB;CACO;CACL,WAAW,GACT,kQACA,iBAAiB,KAAK,CAAC,oBACvB,SAAS,OAAO,sBAAsB,WACtC,QAAQ,eAAe,KAAA,GACvB,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,gBAAgB,cAAc,qBAAqB,KAAK;AAExD,IAAa,uBAAuB,QAAM,YAGvC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,qBAAqB,WAAtB;CACO;CACL,WAAW,GAAG,iDAAiD,SAAS;CACxE,GAAI;AACL,CAAA,CACF;AACD,qBAAqB,cAAc,qBAAqB,UAAU"}
1
+ {"version":3,"file":"ContextMenu.js","names":[],"sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\n\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\n\nexport const ContextMenu = ContextMenuPrimitive.Root;\n\nexport const ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nexport const ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, children, ...props }, ref) => {\n const zIndex = useZIndex(zIndices.popover);\n\n return (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'min-w-[8rem] overflow-hidden rounded-md border border-default bg-popover p-space-1 text-primary shadow-md',\n className\n )}\n {...props}\n style={{ zIndex, ...props.style }}\n >\n <ZIndexProvider value={zIndex}>{children}</ZIndexProvider>\n </ContextMenuPrimitive.Content>\n </ContextMenuPrimitive.Portal>\n );\n});\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nexport const ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n }\n>(({ className, inset, size = 'md', ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'flex w-full cursor-default select-none items-center rounded-sm px-space-2 py-space-1 text-primary outline-hidden transition-colors focus:bg-elevated-hover data-[disabled]:pointer-events-none data-[highlighted]:bg-elevated-hover data-[disabled]:opacity-50',\n OPTION_ROW_SIZES[size].minHeightClassName,\n size === 'sm' ? 'text-xs leading-4' : 'text-sm',\n inset ? 'pl-space-8' : undefined,\n className\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nexport const ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-space-1 my-space-1 border-b border-subtle', className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n"],"mappings":";;;;;;;;;AAaA,IAAa,cAAc,qBAAqB;AAEhD,IAAa,qBAAqB,qBAAqB;AAEvD,IAAa,qBAAqB,QAAM,YAGrC,EAAE,WAAW,UAAU,GAAG,SAAS,QAAQ;CAC5C,MAAM,SAAS,UAAU,SAAS,OAAO;CAEzC,OACE,oBAAC,qBAAqB,QAAtB,EAAA,UACE,oBAAC,qBAAqB,SAAtB;EACO;EACL,WAAW,GACT,6GACA,SACF;EACA,GAAI;EACJ,OAAO;GAAE;GAAQ,GAAG,MAAM;EAAM;EAEhC,UAAA,oBAAC,gBAAD;GAAgB,OAAO;GAAS;EAAyB,CAAA;CAC7B,CAAA,EACH,CAAA;AAEjC,CAAC;AACD,mBAAmB,cAAc,qBAAqB,QAAQ;AAE9D,IAAa,kBAAkB,QAAM,YAUlC,EAAE,WAAW,OAAO,OAAO,MAAM,GAAG,SAAS,QAC9C,oBAAC,qBAAqB,MAAtB;CACO;CACL,WAAW,GACT,kQACA,iBAAiB,KAAK,CAAC,oBACvB,SAAS,OAAO,sBAAsB,WACtC,QAAQ,eAAe,KAAA,GACvB,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,gBAAgB,cAAc,qBAAqB,KAAK;AAExD,IAAa,uBAAuB,QAAM,YAGvC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,qBAAqB,WAAtB;CACO;CACL,WAAW,GAAG,iDAAiD,SAAS;CACxE,GAAI;AACL,CAAA,CACF;AACD,qBAAqB,cAAc,qBAAqB,UAAU"}
@@ -1,6 +1,7 @@
1
1
  import { type ReactNode } from 'react';
2
+ import { type DataAttributes } from '../../utils/dataAttributes.js';
2
3
  import { type IconButtonProps } from '../IconButton/index.js';
3
- export interface CopyButtonProps {
4
+ export interface CopyButtonProps extends DataAttributes {
4
5
  copy: string;
5
6
  variant?: 'full' | 'icon';
6
7
  className?: string;
@@ -9,7 +10,7 @@ export interface CopyButtonProps {
9
10
  onCopy?: () => void;
10
11
  }
11
12
  export declare function CopyButton(props: CopyButtonProps): import("react").JSX.Element;
12
- export interface CopyIconButtonProps {
13
+ export interface CopyIconButtonProps extends DataAttributes {
13
14
  copy: string;
14
15
  className?: string;
15
16
  iconClassName?: string;
@@ -2,6 +2,7 @@ import { Text } from "../Text/Text.js";
2
2
  import { Button } from "../Button/Button.js";
3
3
  import { IconButton } from "../IconButton/IconButton.js";
4
4
  import { CheckIcon } from "../../icons/PaddedPhosphorIcons.js";
5
+ import { pickDataAttributes } from "../../utils/dataAttributes.js";
5
6
  import { useCopy } from "./useCopy.js";
6
7
  import { useState } from "react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -9,7 +10,9 @@ import { CopySimpleIcon } from "@phosphor-icons/react/dist/ssr/CopySimple";
9
10
  //#region packages/components/src/components/CopyButton/CopyButton.tsx
10
11
  function CopyButton(props) {
11
12
  const { copied, onCopy } = useCopy({ copy: props.copy });
13
+ const dataAttributes = pickDataAttributes(props);
12
14
  if (props.variant === "icon") return /* @__PURE__ */ jsx(CopyIconButton, {
15
+ ...dataAttributes,
13
16
  copy: props.copy,
14
17
  copyText: props.copyText,
15
18
  className: props.className,
@@ -18,6 +21,7 @@ function CopyButton(props) {
18
21
  });
19
22
  const CopyStatusIcon = copied ? CheckIcon : CopySimpleIcon;
20
23
  return /* @__PURE__ */ jsx(Button, {
24
+ ...dataAttributes,
21
25
  size: "sm",
22
26
  color: "secondary",
23
27
  variant: "outlined",
@@ -90,6 +94,7 @@ function CopyIconButton(props) {
90
94
  const copyLabel = getCopyLabel(props.copyText, props.label);
91
95
  const tooltipTitle = props.copyText ?? copyLabel;
92
96
  return /* @__PURE__ */ jsx(IconButton, {
97
+ ...pickDataAttributes(props),
93
98
  onClick: (e) => {
94
99
  e.stopPropagation();
95
100
  onCopy();
@@ -1 +1 @@
1
- {"version":3,"file":"CopyButton.js","names":[],"sources":["../../../src/components/CopyButton/CopyButton.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\n\nimport { CopySimpleIcon } from '@phosphor-icons/react/dist/ssr/CopySimple';\n\nimport { CheckIcon } from '../../icons/PaddedPhosphorIcons';\nimport { Button } from '../Button';\nimport { IconButton, type IconButtonProps } from '../IconButton';\nimport { Text } from '../Text';\nimport { useCopy } from './useCopy';\n\nexport interface CopyButtonProps {\n copy: string;\n variant?: 'full' | 'icon';\n className?: string;\n copyText?: string;\n disabled?: boolean;\n onCopy?: () => void;\n}\n\nexport function CopyButton(props: CopyButtonProps) {\n const { copied, onCopy } = useCopy({ copy: props.copy });\n\n if (props.variant === 'icon') {\n return (\n <CopyIconButton\n copy={props.copy}\n copyText={props.copyText}\n className={props.className}\n disabled={props.disabled}\n onCopy={props.onCopy}\n />\n );\n }\n\n const CopyStatusIcon = copied ? CheckIcon : CopySimpleIcon;\n\n return (\n <Button\n size=\"sm\"\n color=\"secondary\"\n variant=\"outlined\"\n aria-label={copied ? 'Copied' : (props.copyText ?? 'Copy')}\n onClick={(event) => {\n event.stopPropagation();\n onCopy();\n props.onCopy?.();\n }}\n className={props.className}\n disabled={props.disabled}\n >\n <span className=\"grid\">\n {/* Both states rendered invisibly so the grid cell is always wide enough for either */}\n <Text\n as=\"span\"\n variant=\"sm\"\n weight=\"normal\"\n className=\"invisible col-start-1 row-start-1 flex items-center gap-1 whitespace-nowrap\"\n aria-hidden\n >\n <span aria-hidden className=\"inline-flex size-4 shrink-0\">\n <CopySimpleIcon size=\"100%\" weight=\"regular\" />\n </span>\n {props.copyText ?? 'Copy'}\n </Text>\n <Text\n as=\"span\"\n variant=\"sm\"\n weight=\"normal\"\n className=\"invisible col-start-1 row-start-1 flex items-center gap-1 whitespace-nowrap\"\n aria-hidden\n >\n <span aria-hidden className=\"inline-flex size-4 shrink-0\">\n <CheckIcon size=\"100%\" weight=\"regular\" />\n </span>\n Copied\n </Text>\n <Text\n as=\"span\"\n variant=\"sm\"\n weight=\"normal\"\n className=\"col-start-1 row-start-1 flex items-center justify-center gap-1 whitespace-nowrap\"\n >\n <span aria-hidden className=\"inline-flex size-4 shrink-0\">\n <CopyStatusIcon size=\"100%\" weight=\"regular\" />\n </span>\n {copied ? 'Copied' : (props.copyText ?? 'Copy')}\n </Text>\n </span>\n </Button>\n );\n}\n\nexport interface CopyIconButtonProps {\n copy: string;\n className?: string;\n iconClassName?: string;\n copyText?: ReactNode;\n label?: string;\n disabled?: boolean;\n color?: IconButtonProps['color'];\n size?: IconButtonProps['size'];\n variant?: IconButtonProps['variant'];\n onCopy?: () => void;\n}\n\nfunction getCopyLabel(copyText: ReactNode, label?: string) {\n if (label) return label;\n return typeof copyText === 'string' ? copyText : 'Copy';\n}\n\nexport function CopyIconButton(props: CopyIconButtonProps) {\n const { copied, onCopy } = useCopy({ copy: props.copy });\n const [tooltipOpen, setTooltipOpen] = useState(false);\n const copyLabel = getCopyLabel(props.copyText, props.label);\n const tooltipTitle = props.copyText ?? copyLabel;\n\n return (\n <IconButton\n onClick={(e) => {\n e.stopPropagation();\n onCopy();\n props.onCopy?.();\n }}\n disabled={props.disabled}\n icon={copied ? CheckIcon : CopySimpleIcon}\n label={copied ? 'Copied' : copyLabel}\n tooltipProps={{\n title: copied ? 'Copied' : tooltipTitle,\n side: 'top',\n open: tooltipOpen,\n onOpenChange: (open) => {\n if (open) setTooltipOpen(true);\n },\n }}\n variant={props.variant ?? 'plain'}\n color={props.color ?? 'secondary'}\n size={props.size ?? 'sm'}\n className={props.className}\n iconClassName={props.iconClassName}\n onMouseLeave={() => setTooltipOpen(false)}\n onBlur={() => setTooltipOpen(false)}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAmBA,SAAgB,WAAW,OAAwB;CACjD,MAAM,EAAE,QAAQ,WAAW,QAAQ,EAAE,MAAM,MAAM,KAAK,CAAC;CAEvD,IAAI,MAAM,YAAY,QACpB,OACE,oBAAC,gBAAD;EACE,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB,WAAW,MAAM;EACjB,UAAU,MAAM;EAChB,QAAQ,MAAM;CACf,CAAA;CAIL,MAAM,iBAAiB,SAAS,YAAY;CAE5C,OACE,oBAAC,QAAD;EACE,MAAK;EACL,OAAM;EACN,SAAQ;EACR,cAAY,SAAS,WAAY,MAAM,YAAY;EACnD,UAAU,UAAU;GAClB,MAAM,gBAAgB;G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jB;EACA,UAAU,MAAM;EAChB,MAAM,SAAS,YAAY;EAC3B,OAAO,SAAS,WAAW;EAC3B,cAAc;GACZ,OAAO,SAAS,WAAW;GAC3B,MAAM;GACN,MAAM;GACN,eAAe,SAAS;IACtB,IAAI,MAAM,eAAe,IAAI;GAC/B;EACF;EACA,SAAS,MAAM,WAAW;EAC1B,OAAO,MAAM,SAAS;EACtB,MAAM,MAAM,QAAQ;EACpB,WAAW,MAAM;EACjB,eAAe,MAAM;EACrB,oBAAoB,eAAe,KAAK;EACxC,cAAc,eAAe,KAAK;CACnC,CAAA;AAEL"}
1
+ {"version":3,"file":"CopyButton.js","names":[],"sources":["../../../src/components/CopyButton/CopyButton.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\n\nimport { CopySimpleIcon } from '@phosphor-icons/react/dist/ssr/CopySimple';\n\nimport { CheckIcon } from '../../icons/PaddedPhosphorIcons';\nimport {\n type DataAttributes,\n pickDataAttributes,\n} from '../../utils/dataAttributes';\nimport { Button } from '../Button';\nimport { IconButton, type IconButtonProps } from '../IconButton';\nimport { Text } from '../Text';\nimport { useCopy } from './useCopy';\n\nexport interface CopyButtonProps extends DataAttributes {\n copy: string;\n variant?: 'full' | 'icon';\n className?: string;\n copyText?: string;\n disabled?: boolean;\n onCopy?: () => void;\n}\n\nexport function CopyButton(props: CopyButtonProps) {\n const { copied, onCopy } = useCopy({ copy: props.copy });\n const dataAttributes = pickDataAttributes(props);\n\n if (props.variant === 'icon') {\n return (\n <CopyIconButton\n {...dataAttributes}\n copy={props.copy}\n copyText={props.copyText}\n className={props.className}\n disabled={props.disabled}\n onCopy={props.onCopy}\n />\n );\n }\n\n const CopyStatusIcon = copied ? CheckIcon : CopySimpleIcon;\n\n return (\n <Button\n {...dataAttributes}\n size=\"sm\"\n color=\"secondary\"\n variant=\"outlined\"\n aria-label={copied ? 'Copied' : (props.copyText ?? 'Copy')}\n onClick={(event) => {\n event.stopPropagation();\n onCopy();\n props.onCopy?.();\n }}\n className={props.className}\n disabled={props.disabled}\n >\n <span className=\"grid\">\n {/* Both states rendered invisibly so the grid cell is always wide enough for either */}\n <Text\n as=\"span\"\n variant=\"sm\"\n weight=\"normal\"\n className=\"invisible col-start-1 row-start-1 flex items-center gap-1 whitespace-nowrap\"\n aria-hidden\n >\n <span aria-hidden className=\"inline-flex size-4 shrink-0\">\n <CopySimpleIcon size=\"100%\" weight=\"regular\" />\n </span>\n {props.copyText ?? 'Copy'}\n </Text>\n <Text\n as=\"span\"\n variant=\"sm\"\n weight=\"normal\"\n className=\"invisible col-start-1 row-start-1 flex items-center gap-1 whitespace-nowrap\"\n aria-hidden\n >\n <span aria-hidden className=\"inline-flex size-4 shrink-0\">\n <CheckIcon size=\"100%\" weight=\"regular\" />\n </span>\n Copied\n </Text>\n <Text\n as=\"span\"\n variant=\"sm\"\n weight=\"normal\"\n className=\"col-start-1 row-start-1 flex items-center justify-center gap-1 whitespace-nowrap\"\n >\n <span aria-hidden className=\"inline-flex size-4 shrink-0\">\n <CopyStatusIcon size=\"100%\" weight=\"regular\" />\n </span>\n {copied ? 'Copied' : (props.copyText ?? 'Copy')}\n </Text>\n </span>\n </Button>\n );\n}\n\nexport interface CopyIconButtonProps extends DataAttributes {\n copy: string;\n className?: string;\n iconClassName?: string;\n copyText?: ReactNode;\n label?: string;\n disabled?: boolean;\n color?: IconButtonProps['color'];\n size?: IconButtonProps['size'];\n variant?: IconButtonProps['variant'];\n onCopy?: () => void;\n}\n\nfunction getCopyLabel(copyText: ReactNode, label?: string) {\n if (label) return label;\n return typeof copyText === 'string' ? copyText : 'Copy';\n}\n\nexport function CopyIconButton(props: CopyIconButtonProps) {\n const { copied, onCopy } = useCopy({ copy: props.copy });\n const [tooltipOpen, setTooltipOpen] = useState(false);\n const copyLabel = getCopyLabel(props.copyText, props.label);\n const tooltipTitle = props.copyText ?? copyLabel;\n\n return (\n <IconButton\n {...pickDataAttributes(props)}\n onClick={(e) => {\n e.stopPropagation();\n onCopy();\n props.onCopy?.();\n }}\n disabled={props.disabled}\n icon={copied ? CheckIcon : CopySimpleIcon}\n label={copied ? 'Copied' : copyLabel}\n tooltipProps={{\n title: copied ? 'Copied' : tooltipTitle,\n side: 'top',\n open: tooltipOpen,\n onOpenChange: (open) => {\n if (open) setTooltipOpen(true);\n },\n }}\n variant={props.variant ?? 'plain'}\n color={props.color ?? 'secondary'}\n size={props.size ?? 'sm'}\n className={props.className}\n iconClassName={props.iconClassName}\n onMouseLeave={() => setTooltipOpen(false)}\n onBlur={() => setTooltipOpen(false)}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AAuBA,SAAgB,WAAW,OAAwB;CACjD,MAAM,EAAE,QAAQ,WAAW,QAAQ,EAAE,MAAM,MAAM,KAAK,CAAC;CACvD,MAAM,iBAAiB,mBAAmB,KAAK;CAE/C,IAAI,MAAM,YAAY,QACpB,OACE,oBAAC,gBAAD;EACE,GAAI;EACJ,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB,WAAW,MAAM;EACjB,UAAU,MAAM;EAChB,QAAQ,MAAM;CACf,CAAA;CAIL,MAAM,iBAAiB,SAAS,YAAY;CAE5C,OACE,oBAAC,QAAD;EACE,GAAI;EACJ,MAAK;EACL,OAAM;EACN,SAAQ;EACR,cAAY,SAAS,WAAY,MAAM,YAAY;EACnD,UAAU,UAAU;GAClB,MAAM,gBAAgB;GACtB,OAAO;GACP,MAAM,SAAS;EACjB;EACA,WAAW,MAAM;EACjB,UAAU,MAAM;EAEhB,UAAA,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA;IAEE,qBAAC,MAAD;KACE,IAAG;KACH,SAAQ;KACR,QAAO;KACP,WAAU;KACV,eAAA;KALF,UAAA,CAOE,oBAAC,QAAD;MAAM,eAAA;MAAY,WAAU;MAC1B,UAAA,oBAAC,gBAAD;OAAgB,MAAK;OAAO,QAAO;MAAW,CAAA;KAC1C,CAAA,GACL,MAAM,YAAY,MACf;;IACN,qBAAC,MAAD;KACE,IAAG;KACH,SAAQ;KACR,Q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
@@ -1,5 +1,7 @@
1
1
  import { type ComponentPropsWithoutRef, type KeyboardEvent as ReactKeyboardEvent, type ReactNode } from 'react';
2
2
  import { DialogClose as RadixDialogClose, DialogDescription as RadixDialogDescription, DialogTitle as RadixDialogTitle, type DialogContentProps as RadixDialogContentProps } from '@radix-ui/react-dialog';
3
+ import { type DataAttributes } from '../../utils/dataAttributes.js';
4
+ export { ModalProvider } from '../../utils/ModalLayerContext.js';
3
5
  import type { IconComponent } from '../Icon/index.js';
4
6
  /**
5
7
  * Exposes the modal DialogContent DOM node to descendants so portaled overlays
@@ -20,7 +22,7 @@ export type DialogCloseProps = ComponentPropsWithoutRef<typeof RadixDialogClose>
20
22
  /** Closes the nearest dialog and supports custom controls through `asChild`. */
21
23
  export declare const DialogClose: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
22
24
  type TitleIconIntent = 'error' | 'warning' | 'info';
23
- interface DialogContentProps {
25
+ interface DialogContentProps extends DataAttributes {
24
26
  title?: ReactNode;
25
27
  description?: ReactNode;
26
28
  /** Icon component to display in the title area, inside a colored circular container */
@@ -46,4 +48,3 @@ export declare function Dialog({ open, onOpenChange, children, className, onEsca
46
48
  onEscapeKeyDown?: (e: ReactKeyboardEvent) => void;
47
49
  }): import("react").JSX.Element;
48
50
  export declare const DialogContent: import("react").ForwardRefExoticComponent<DialogContentProps & import("react").RefAttributes<HTMLDivElement>>;
49
- export {};
@@ -6,7 +6,9 @@ import { ZIndexProvider } from "../../utils/ZIndexContext.js";
6
6
  import { Icon } from "../Icon/Icon.js";
7
7
  import { IconButton } from "../IconButton/IconButton.js";
8
8
  import { XIcon } from "../../icons/PaddedPhosphorIcons.js";
9
+ import { pickDataAttributes } from "../../utils/dataAttributes.js";
9
10
  import { mergeRefs } from "../../utils/merge-refs.js";
11
+ import { ModalLayerProvider, ModalProvider, useCurrentModalLayer, useModalLayer } from "../../utils/ModalLayerContext.js";
10
12
  import { createContext, forwardRef, useContext, useState } from "react";
11
13
  import { jsx, jsxs } from "react/jsx-runtime";
12
14
  import { Dialog as Dialog$1, DialogClose as DialogClose$1, DialogContent as DialogContent$1, DialogDescription as DialogDescription$1, DialogOverlay, DialogPortal, DialogTitle as DialogTitle$1 } from "@radix-ui/react-dialog";
@@ -40,36 +42,61 @@ var DialogClose = forwardRef((props, ref) => /* @__PURE__ */ jsx(DialogClose$1,
40
42
  ...props
41
43
  }));
42
44
  DialogClose.displayName = "DialogClose";
45
+ var DialogEscapeContext = createContext(void 0);
43
46
  function Dialog({ open, onOpenChange, children, className, onEscapeKeyDown }) {
44
- const zIndex = useZIndex(zIndices.dialogOverlay);
45
- return /* @__PURE__ */ jsx(Dialog$1, {
46
- modal: true,
47
- open,
48
- onOpenChange,
49
- children: /* @__PURE__ */ jsx(DialogPortal, { children: /* @__PURE__ */ jsx(DialogOverlay, {
50
- className: cn("fixed inset-0 bg-overlay", "data-[state=open]:animate-overlay-in data-[state=closed]:animate-overlay-out motion-reduce:animate-none", className),
51
- style: { zIndex },
52
- onKeyDown: (e) => {
53
- if (e.key === "Escape" && onEscapeKeyDown) onEscapeKeyDown(e);
54
- },
55
- children
56
- }) })
47
+ const layer = useModalLayer(open);
48
+ const zIndex = useZIndex(layer.zIndex ?? zIndices.dialogOverlay);
49
+ return /* @__PURE__ */ jsx(ModalLayerProvider, {
50
+ layer,
51
+ children: /* @__PURE__ */ jsx(DialogEscapeContext.Provider, {
52
+ value: onEscapeKeyDown,
53
+ children: /* @__PURE__ */ jsx(ZIndexProvider, {
54
+ value: zIndex,
55
+ children: /* @__PURE__ */ jsx(Dialog$1, {
56
+ modal: true,
57
+ open: open && !layer.suspended,
58
+ onOpenChange,
59
+ children: /* @__PURE__ */ jsxs(DialogPortal, {
60
+ forceMount: open || void 0,
61
+ children: [/* @__PURE__ */ jsx(DialogOverlay, {
62
+ forceMount: open || void 0,
63
+ className: cn("fixed inset-0 bg-overlay", "data-[state=open]:animate-overlay-in data-[state=closed]:animate-overlay-out motion-reduce:animate-none", className),
64
+ style: {
65
+ zIndex,
66
+ ...layer.backdropStyle,
67
+ display: layer.suspended ? "none" : void 0
68
+ }
69
+ }), children]
70
+ })
71
+ })
72
+ })
73
+ })
57
74
  });
58
75
  }
59
- var DialogContent = forwardRef(({ title, description, titleIcon: TitleIcon, titleIconIntent = "info", showClose = true, children, className, childrenClassName, onPointerDownOutside, onInteractOutside, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onKeyDown }, ref) => {
76
+ var DialogContent = forwardRef(({ title, description, titleIcon: TitleIcon, titleIconIntent = "info", showClose = true, children, className, childrenClassName, onPointerDownOutside, onInteractOutside, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onKeyDown, ...rest }, ref) => {
60
77
  const dialogZIndex = useZIndex(zIndices.dialogContent);
78
+ const layer = useCurrentModalLayer();
79
+ const onDialogEscape = useContext(DialogEscapeContext);
61
80
  const hasHeader = Boolean(title || description || showClose);
62
81
  const [contentNode, setContentNode] = useState(null);
63
82
  return /* @__PURE__ */ jsx(DialogContent$1, {
83
+ forceMount: layer?.open || void 0,
84
+ ...pickDataAttributes(rest),
64
85
  ref: mergeRefs([ref, setContentNode]),
65
86
  className: cn("fixed left-[50%] top-[50%] flex max-h-[calc(100vh-2rem)] w-[37.5rem] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg bg-background", "fade-in", "data-[state=closed]:fade-out", className),
66
- style: { zIndex: dialogZIndex },
87
+ style: {
88
+ zIndex: dialogZIndex,
89
+ display: layer?.suspended ? "none" : void 0
90
+ },
67
91
  onPointerDownOutside,
68
92
  onInteractOutside,
69
93
  onOpenAutoFocus,
70
94
  onCloseAutoFocus,
71
95
  onEscapeKeyDown,
72
- onKeyDown,
96
+ onKeyDown: (event) => {
97
+ onKeyDown?.(event);
98
+ if (event.key === "Escape") onDialogEscape?.(event);
99
+ },
73
100
  children: /* @__PURE__ */ jsx(ZIndexProvider, {
74
101
  value: dialogZIndex,
75
102
  children: /* @__PURE__ */ jsxs(DialogContainerContext.Provider, {
@@ -125,6 +152,6 @@ var DialogContent = forwardRef(({ title, description, titleIcon: TitleIcon, titl
125
152
  });
126
153
  DialogContent.displayName = "DialogContent";
127
154
  //#endregion
128
- export { Dialog, DialogClose, DialogContainerContext, DialogContent, DialogDescription, DialogTitle, useDialogContainer };
155
+ export { Dialog, DialogClose, DialogContainerContext, DialogContent, DialogDescription, DialogTitle, ModalProvider, useDialogContainer };
129
156
 
130
157
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Dialog/index.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n createContext,\n forwardRef,\n useContext,\n useState,\n} from 'react';\n\nimport {\n DialogClose as RadixDialogClose,\n DialogDescription as RadixDialogDescription,\n DialogOverlay,\n DialogPortal,\n DialogTitle as RadixDialogTitle,\n Dialog as RadixDialog,\n DialogContent as RadixDialogContent,\n type DialogContentProps as RadixDialogContentProps,\n} from '@radix-ui/react-dialog';\n\nimport { XIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport { mergeRefs } from '../../utils/merge-refs';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\nimport { Icon } from '../Icon';\nimport type { IconComponent } from '../Icon';\nimport { IconButton } from '../IconButton';\nimport { Text } from '../Text';\n\n/**\n * Exposes the modal DialogContent DOM node to descendants so portaled overlays\n * (e.g. Typeahead's Popover) can render inside the dialog. A modal Dialog sets\n * `pointer-events: none` outside DialogContent, so overlays portaled to\n * `document.body` become mouse-inert; portaling into this node keeps them\n * interactive. Null when not inside a Dialog.\n */\n// eslint-disable-next-line react-refresh/only-export-components\nexport const DialogContainerContext = createContext<HTMLElement | null>(null);\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useDialogContainer(): HTMLElement | null {\n return useContext(DialogContainerContext);\n}\n\nexport type DialogTitleProps = ComponentPropsWithoutRef<\n typeof RadixDialogTitle\n>;\n\n/** Associates a custom-composed heading with the dialog content. */\nexport const DialogTitle = forwardRef<\n ComponentRef<typeof RadixDialogTitle>,\n DialogTitleProps\n>((props, ref) => <RadixDialogTitle ref={ref} {...props} />);\nDialogTitle.displayName = 'DialogTitle';\n\nexport type DialogDescriptionProps = ComponentPropsWithoutRef<\n typeof RadixDialogDescription\n>;\n\n/** Associates supporting copy with the dialog content. */\nexport const DialogDescription = forwardRef<\n ComponentRef<typeof RadixDialogDescription>,\n DialogDescriptionProps\n>((props, ref) => <RadixDialogDescription ref={ref} {...props} />);\nDialogDescription.displayName = 'DialogDescription';\n\nexport type DialogCloseProps = ComponentPropsWithoutRef<\n typeof RadixDialogClose\n>;\n\n/** Closes the nearest dialog and supports custom controls through `asChild`. */\nexport const DialogClose = forwardRef<\n ComponentRef<typeof RadixDialogClose>,\n DialogCloseProps\n>((props, ref) => <RadixDialogClose ref={ref} {...props} />);\nDialogClose.displayName = 'DialogClose';\n\ntype TitleIconIntent = 'error' | 'warning' | 'info';\n\ninterface DialogContentProps {\n title?: ReactNode;\n description?: ReactNode;\n /** Icon component to display in the title area, inside a colored circular container */\n titleIcon?: IconComponent;\n /** Controls the background and color of the title icon container */\n titleIconIntent?: TitleIconIntent;\n showClose?: boolean;\n children: ReactNode;\n className?: string;\n childrenClassName?: string;\n onPointerDownOutside?: RadixDialogContentProps['onPointerDownOutside'];\n onInteractOutside?: RadixDialogContentProps['onInteractOutside'];\n onOpenAutoFocus?: RadixDialogContentProps['onOpenAutoFocus'];\n onCloseAutoFocus?: RadixDialogContentProps['onCloseAutoFocus'];\n onEscapeKeyDown?: RadixDialogContentProps['onEscapeKeyDown'];\n onKeyDown?: RadixDialogContentProps['onKeyDown'];\n}\n\nexport function Dialog({\n open,\n onOpenChange,\n children,\n className,\n onEscapeKeyDown,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n children: ReactNode;\n className?: string;\n onEscapeKeyDown?: (e: ReactKeyboardEvent) => void;\n}) {\n const zIndex = useZIndex(zIndices.dialogOverlay);\n return (\n <RadixDialog modal={true} open={open} onOpenChange={onOpenChange}>\n <DialogPortal>\n <DialogOverlay\n className={cn(\n 'fixed inset-0 bg-overlay',\n 'data-[state=open]:animate-overlay-in data-[state=closed]:animate-overlay-out motion-reduce:animate-none',\n className\n )}\n style={{ zIndex }}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && onEscapeKeyDown) {\n onEscapeKeyDown(e);\n }\n }}\n >\n {children}\n </DialogOverlay>\n </DialogPortal>\n </RadixDialog>\n );\n}\n\nexport const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(\n (\n {\n title,\n description,\n titleIcon: TitleIcon,\n titleIconIntent = 'info',\n showClose = true,\n children,\n className,\n childrenClassName,\n onPointerDownOutside,\n onInteractOutside,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onKeyDown,\n },\n ref\n ) => {\n const dialogZIndex = useZIndex(zIndices.dialogContent);\n const hasHeader = Boolean(title || description || showClose);\n // A modal Dialog sets `pointer-events: none` outside this node, so overlays\n // portaled to `document.body` (e.g. Typeahead's Popover) become mouse-inert.\n // Expose the content node so descendants can portal into it and stay live.\n const [contentNode, setContentNode] = useState<HTMLDivElement | null>(null);\n\n return (\n <RadixDialogContent\n ref={mergeRefs([ref, setContentNode])}\n className={cn(\n 'fixed left-[50%] top-[50%] flex max-h-[calc(100vh-2rem)] w-[37.5rem] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg bg-background',\n 'fade-in',\n 'data-[state=closed]:fade-out',\n className\n )}\n style={{ zIndex: dialogZIndex }}\n onPointerDownOutside={onPointerDownOutside}\n onInteractOutside={onInteractOutside}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={onCloseAutoFocus}\n onEscapeKeyDown={onEscapeKeyDown}\n onKeyDown={onKeyDown}\n >\n <ZIndexProvider value={dialogZIndex}>\n <DialogContainerContext.Provider value={contentNode}>\n {hasHeader && (\n <div className=\"m-0 min-h-14 shrink-0 p-space-4\">\n <div className=\"flex items-center justify-between gap-space-4\">\n <div className=\"flex min-w-0 items-center gap-space-2\">\n {TitleIcon && (\n <Icon\n icon={TitleIcon}\n color={titleIconIntent}\n size=\"md\"\n />\n )}\n <div className=\"flex min-w-0 flex-col gap-space-1\">\n {title && (\n <DialogTitle asChild>\n <Text variant=\"h3\" weight=\"semibold\">\n {title}\n </Text>\n </DialogTitle>\n )}\n {description && (\n <DialogDescription asChild>\n <Text variant=\"sm\" className=\"text-quaternary\">\n {description}\n </Text>\n </DialogDescription>\n )}\n </div>\n </div>\n {showClose && (\n <DialogClose asChild>\n <IconButton\n icon={XIcon}\n label=\"Close\"\n color=\"secondary\"\n variant=\"plain\"\n className=\"shrink-0 self-start\"\n data-testid=\"dialog-close-button\"\n tooltipProps={{ disabled: true }}\n />\n </DialogClose>\n )}\n </div>\n </div>\n )}\n <div\n className={cn(\n 'flex min-h-0 flex-col gap-space-4 overflow-y-auto p-space-4',\n hasHeader && 'pt-0',\n childrenClassName\n )}\n >\n {children}\n </div>\n </DialogContainerContext.Provider>\n </ZIndexProvider>\n </RadixDialogContent>\n );\n }\n);\n\nDialogContent.displayName = 'DialogContent';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,yBAAyB,cAAkC,IAAI;AAG5E,SAAgB,qBAAyC;CACvD,OAAO,WAAW,sBAAsB;AAC1C;;AAOA,IAAa,cAAc,YAGxB,OAAO,QAAQ,oBAAC,eAAD;CAAuB;CAAK,GAAI;AAAQ,CAAA,CAAC;AAC3D,YAAY,cAAc;;AAO1B,IAAa,oBAAoB,YAG9B,OAAO,QAAQ,oBAAC,qBAAD;CAA6B;CAAK,GAAI;AAAQ,CAAA,CAAC;AACjE,kBAAkB,cAAc;;A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UAAA,CACG,SACC,oBAAC,aAAD;SAAa,SAAA;SACX,UAAA,oBAAC,MAAD;UAAM,SAAQ;UAAK,QAAO;UACvB,UAAA;SACG,CAAA;QACK,CAAA,GAEd,eACC,oBAAC,mBAAD;SAAmB,SAAA;SACjB,UAAA,oBAAC,MAAD;UAAM,SAAQ;UAAK,WAAU;UAC1B,UAAA;SACG,CAAA;QACW,CAAA,CAElB;OACF,CAAA,CAAA;MACJ,CAAA,GAAA,aACC,oBAAC,aAAD;OAAa,SAAA;OACX,UAAA,oBAAC,YAAD;QACE,MAAM;QACN,OAAM;QACN,OAAM;QACN,SAAQ;QACR,WAAU;QACV,eAAY;QACZ,cAAc,EAAE,UAAU,KAAK;OAChC,CAAA;MACU,CAAA,CAEZ;;IACF,CAAA,GAEP,oBAAC,OAAD;KACE,WAAW,GACT,+DACA,aAAa,QACb,iBACF;KAEC;IACE,CAAA,CAC0B;;EACnB,CAAA;CACE,CAAA;AAExB,CACF;AAEA,cAAc,cAAc"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Dialog/index.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n createContext,\n forwardRef,\n useContext,\n useState,\n} from 'react';\n\nimport {\n DialogClose as RadixDialogClose,\n DialogDescription as RadixDialogDescription,\n DialogOverlay,\n DialogPortal,\n DialogTitle as RadixDialogTitle,\n Dialog as RadixDialog,\n DialogContent as RadixDialogContent,\n type DialogContentProps as RadixDialogContentProps,\n} from '@radix-ui/react-dialog';\n\nimport { XIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport {\n type DataAttributes,\n pickDataAttributes,\n} from '../../utils/dataAttributes';\nimport { mergeRefs } from '../../utils/merge-refs';\nimport {\n ModalLayerProvider,\n useCurrentModalLayer,\n useModalLayer,\n} from '../../utils/ModalLayerContext';\nexport { ModalProvider } from '../../utils/ModalLayerContext';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\nimport { Icon } from '../Icon';\nimport type { IconComponent } from '../Icon';\nimport { IconButton } from '../IconButton';\nimport { Text } from '../Text';\n\n/**\n * Exposes the modal DialogContent DOM node to descendants so portaled overlays\n * (e.g. Typeahead's Popover) can render inside the dialog. A modal Dialog sets\n * `pointer-events: none` outside DialogContent, so overlays portaled to\n * `document.body` become mouse-inert; portaling into this node keeps them\n * interactive. Null when not inside a Dialog.\n */\n// eslint-disable-next-line react-refresh/only-export-components\nexport const DialogContainerContext = createContext<HTMLElement | null>(null);\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useDialogContainer(): HTMLElement | null {\n return useContext(DialogContainerContext);\n}\n\nexport type DialogTitleProps = ComponentPropsWithoutRef<\n typeof RadixDialogTitle\n>;\n\n/** Associates a custom-composed heading with the dialog content. */\nexport const DialogTitle = forwardRef<\n ComponentRef<typeof RadixDialogTitle>,\n DialogTitleProps\n>((props, ref) => <RadixDialogTitle ref={ref} {...props} />);\nDialogTitle.displayName = 'DialogTitle';\n\nexport type DialogDescriptionProps = ComponentPropsWithoutRef<\n typeof RadixDialogDescription\n>;\n\n/** Associates supporting copy with the dialog content. */\nexport const DialogDescription = forwardRef<\n ComponentRef<typeof RadixDialogDescription>,\n DialogDescriptionProps\n>((props, ref) => <RadixDialogDescription ref={ref} {...props} />);\nDialogDescription.displayName = 'DialogDescription';\n\nexport type DialogCloseProps = ComponentPropsWithoutRef<\n typeof RadixDialogClose\n>;\n\n/** Closes the nearest dialog and supports custom controls through `asChild`. */\nexport const DialogClose = forwardRef<\n ComponentRef<typeof RadixDialogClose>,\n DialogCloseProps\n>((props, ref) => <RadixDialogClose ref={ref} {...props} />);\nDialogClose.displayName = 'DialogClose';\n\nconst DialogEscapeContext = createContext<\n ((event: ReactKeyboardEvent) => void) | undefined\n>(undefined);\n\ntype TitleIconIntent = 'error' | 'warning' | 'info';\n\ninterface DialogContentProps extends DataAttributes {\n title?: ReactNode;\n description?: ReactNode;\n /** Icon component to display in the title area, inside a colored circular container */\n titleIcon?: IconComponent;\n /** Controls the background and color of the title icon container */\n titleIconIntent?: TitleIconIntent;\n showClose?: boolean;\n children: ReactNode;\n className?: string;\n childrenClassName?: string;\n onPointerDownOutside?: RadixDialogContentProps['onPointerDownOutside'];\n onInteractOutside?: RadixDialogContentProps['onInteractOutside'];\n onOpenAutoFocus?: RadixDialogContentProps['onOpenAutoFocus'];\n onCloseAutoFocus?: RadixDialogContentProps['onCloseAutoFocus'];\n onEscapeKeyDown?: RadixDialogContentProps['onEscapeKeyDown'];\n onKeyDown?: RadixDialogContentProps['onKeyDown'];\n}\n\nexport function Dialog({\n open,\n onOpenChange,\n children,\n className,\n onEscapeKeyDown,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n children: ReactNode;\n className?: string;\n onEscapeKeyDown?: (e: ReactKeyboardEvent) => void;\n}) {\n const layer = useModalLayer(open);\n const zIndex = useZIndex(layer.zIndex ?? zIndices.dialogOverlay);\n return (\n <ModalLayerProvider layer={layer}>\n <DialogEscapeContext.Provider value={onEscapeKeyDown}>\n <ZIndexProvider value={zIndex}>\n <RadixDialog\n modal={true}\n open={open && !layer.suspended}\n onOpenChange={onOpenChange}\n >\n <DialogPortal forceMount={open || undefined}>\n <DialogOverlay\n forceMount={open || undefined}\n className={cn(\n 'fixed inset-0 bg-overlay',\n 'data-[state=open]:animate-overlay-in data-[state=closed]:animate-overlay-out motion-reduce:animate-none',\n className\n )}\n style={{\n zIndex,\n ...layer.backdropStyle,\n display: layer.suspended ? 'none' : undefined,\n }}\n />\n {children}\n </DialogPortal>\n </RadixDialog>\n </ZIndexProvider>\n </DialogEscapeContext.Provider>\n </ModalLayerProvider>\n );\n}\n\nexport const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(\n (\n {\n title,\n description,\n titleIcon: TitleIcon,\n titleIconIntent = 'info',\n showClose = true,\n children,\n className,\n childrenClassName,\n onPointerDownOutside,\n onInteractOutside,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onKeyDown,\n ...rest\n },\n ref\n ) => {\n const dialogZIndex = useZIndex(zIndices.dialogContent);\n const layer = useCurrentModalLayer();\n const onDialogEscape = useContext(DialogEscapeContext);\n const hasHeader = Boolean(title || description || showClose);\n // A modal Dialog sets `pointer-events: none` outside this node, so overlays\n // portaled to `document.body` (e.g. Typeahead's Popover) become mouse-inert.\n // Expose the content node so descendants can portal into it and stay live.\n const [contentNode, setContentNode] = useState<HTMLDivElement | null>(null);\n\n return (\n <RadixDialogContent\n forceMount={layer?.open || undefined}\n {...pickDataAttributes(rest)}\n ref={mergeRefs([ref, setContentNode])}\n className={cn(\n 'fixed left-[50%] top-[50%] flex max-h-[calc(100vh-2rem)] w-[37.5rem] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg bg-background',\n 'fade-in',\n 'data-[state=closed]:fade-out',\n className\n )}\n style={{\n zIndex: dialogZIndex,\n display: layer?.suspended ? 'none' : undefined,\n }}\n onPointerDownOutside={onPointerDownOutside}\n onInteractOutside={onInteractOutside}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={onCloseAutoFocus}\n onEscapeKeyDown={onEscapeKeyDown}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.key === 'Escape') onDialogEscape?.(event);\n }}\n >\n <ZIndexProvider value={dialogZIndex}>\n <DialogContainerContext.Provider value={contentNode}>\n {hasHeader && (\n <div className=\"m-0 min-h-14 shrink-0 p-space-4\">\n <div className=\"flex items-center justify-between gap-space-4\">\n <div className=\"flex min-w-0 items-center gap-space-2\">\n {TitleIcon && (\n <Icon\n icon={TitleIcon}\n color={titleIconIntent}\n size=\"md\"\n />\n )}\n <div className=\"flex min-w-0 flex-col gap-space-1\">\n {title && (\n <DialogTitle asChild>\n <Text variant=\"h3\" weight=\"semibold\">\n {title}\n </Text>\n </DialogTitle>\n )}\n {description && (\n <DialogDescription asChild>\n <Text variant=\"sm\" className=\"text-quaternary\">\n {description}\n </Text>\n </DialogDescription>\n )}\n </div>\n </div>\n {showClose && (\n <DialogClose asChild>\n <IconButton\n icon={XIcon}\n label=\"Close\"\n color=\"secondary\"\n variant=\"plain\"\n className=\"shrink-0 self-start\"\n data-testid=\"dialog-close-button\"\n tooltipProps={{ disabled: true }}\n />\n </DialogClose>\n )}\n </div>\n </div>\n )}\n <div\n className={cn(\n 'flex min-h-0 flex-col gap-space-4 overflow-y-auto p-space-4',\n hasHeader && 'pt-0',\n childrenClassName\n )}\n >\n {children}\n </div>\n </DialogContainerContext.Provider>\n </ZIndexProvider>\n </RadixDialogContent>\n );\n }\n);\n\nDialogContent.displayName = 'DialogContent';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAa,yBAAyB,cAAkC,IAAI;AAG5E,SAAgB,qBAAyC;CACvD,OAAO,WAAW,sBAAsB;AAC1C;;AAOA,IAAa,cAAc,YAGxB,OAAO,QAAQ,oBAAC,eAAD;CAAuB;CAAK,GAAI;AAAQ,CAAA,CAAC;AAC3D,YAAY,cAAc;;AAO1B,IAAa,oBAAoB,YAG9B,OAAO,QAAQ,oBAAC,qBAAD;CAA6B;CAAK,GAAI;AAAQ,CAAA,CAAC;AACjE,kBAAkB,cAAc;;AAOhC,IAAa,cAAc,YAGxB,OAAO,QAAQ,oBAAC,eAAD;CAAuB;CAAK,GAAI;AAAQ,CAAA,CAAC;AAC3D,YAAY,cAAc;AAE1B,IAAM,sBAAsB,cAE1B,KAAA,CAAS;AAuBX,SAAgB,OAAO,EACrB,MACA,cACA,UACA,WACA,mBAOC;CACD,MAAM,QAAQ,cAAc,IAAI;CAChC,MAAM,SAAS,UAAU,MAAM,UAAU,SAAS,aAAa;CAC/D,OACE,oBAAC,oBAAD;EAA2B;EACzB,UAAA,oBAAC,oBAAoB,UAArB;GAA8B,OAAO;GACnC,UAAA,oBAAC,gBAAD;IAAgB,OAAO;IACrB,UAA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WAAU;OAAf,UAAA,CACG,aACC,oBAAC,MAAD;QACE,MAAM;QACN,OAAO;QACP,MAAK;OACN,CAAA,GAEH,qBAAC,OAAD;QAAK,WAAU;QAAf,UAAA,CACG,SACC,oBAAC,aAAD;SAAa,SAAA;SACX,UAAA,oBAAC,MAAD;UAAM,SAAQ;UAAK,QAAO;UACvB,UAAA;SACG,CAAA;QACK,CAAA,GAEd,eACC,oBAAC,mBAAD;SAAmB,SAAA;SACjB,UAAA,oBAAC,MAAD;UAAM,SAAQ;UAAK,WAAU;UAC1B,UAAA;SACG,CAAA;QACW,CAAA,CAElB;OACF,CAAA,CAAA;MACJ,CAAA,GAAA,aACC,oBAAC,aAAD;OAAa,SAAA;OACX,UAAA,oBAAC,YAAD;QACE,MAAM;QACN,OAAM;QACN,OAAM;QACN,SAAQ;QACR,WAAU;QACV,eAAY;QACZ,cAAc,EAAE,UAAU,KAAK;OAChC,CAAA;MACU,CAAA,CAEZ;;IACF,CAAA,GAEP,oBAAC,OAAD;KACE,WAAW,GACT,+DACA,aAAa,QACb,iBACF;KAEC;IACE,CAAA,CAC0B;;EACnB,CAAA;CACE,CAAA;AAExB,CACF;AAEA,cAAc,cAAc"}
@@ -112,20 +112,20 @@ var DropdownMenuContent = React$1.forwardRef(({ className, sideOffset = 4, child
112
112
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
113
113
  var DropdownMenuItem = React$1.forwardRef(({ className, inset, size = "md", ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
114
114
  ref,
115
- className: cn("flex cursor-pointer select-none items-center rounded-sm px-space-2 py-space-1 outline-hidden transition-colors focus:bg-surface-level-2 data-[disabled]:pointer-events-none data-[disabled]:opacity-50", OPTION_ROW_SIZES[size].minHeightClassName, size === "sm" ? "text-xs leading-4" : "text-sm", inset && "pl-space-6", className),
115
+ className: cn("flex cursor-pointer select-none items-center rounded-sm px-space-2 py-space-1 outline-hidden transition-colors focus:bg-elevated-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50", OPTION_ROW_SIZES[size].minHeightClassName, size === "sm" ? "text-xs leading-4" : "text-sm", inset && "pl-space-6", className),
116
116
  ...props
117
117
  }));
118
118
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
119
119
  var DropdownMenuSeparator = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
120
120
  ref,
121
- className: cn("my-space-1 h-px bg-surface-level-2", className),
121
+ className: cn("my-space-1 h-px border-b border-subtle", className),
122
122
  ...props
123
123
  }));
124
124
  DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
125
125
  var DropdownMenuSub = DropdownMenuPrimitive.Sub;
126
126
  var DropdownMenuSubTrigger = React$1.forwardRef(({ className, inset, children, size = "md", ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubTrigger, {
127
127
  ref,
128
- className: cn("flex cursor-pointer select-none items-center rounded-sm px-space-2 py-space-1 outline-hidden transition-colors focus:bg-surface-level-2 data-[state=open]:bg-surface-level-2", OPTION_ROW_SIZES[size].minHeightClassName, size === "sm" ? "text-xs leading-4" : "text-sm", inset && "pl-space-6", className),
128
+ className: cn("flex cursor-pointer select-none items-center rounded-sm px-space-2 py-space-1 outline-hidden transition-colors focus:bg-elevated-hover data-[state=open]:bg-elevated-hover", OPTION_ROW_SIZES[size].minHeightClassName, size === "sm" ? "text-xs leading-4" : "text-sm", inset && "pl-space-6", className),
129
129
  ...props,
130
130
  children
131
131
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenu.js","names":[],"sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\n\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\n\nexport const DropdownMenu: typeof DropdownMenuPrimitive.Root = (props) => {\n const [open = false, onOpenChange] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen ?? false,\n onChange: props.onOpenChange,\n });\n\n return (\n <DropdownMenuPrimitive.Root\n {...props}\n open={open}\n onOpenChange={onOpenChange}\n defaultOpen={undefined}\n />\n );\n};\n\nexport const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nexport const DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nexport const DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nexport const DropdownMenuLabel = DropdownMenuPrimitive.Label;\n\n/**\n * Stops clicks outside an open dropdown from reaching elements underneath it\n * (e.g. a table row's `onClick`) without covering the viewport, so scrolling\n * the content behind the menu keeps working natively.\n *\n * React delegates `onClick` at the root in the bubble phase, so a capture-phase\n * `click` listener on `document` runs first and can stop the event before it\n * gets there. pointerdown is left alone so Radix's outside-dismiss keeps\n * working; the wheel listener is passive so native scroll is never interrupted,\n * it just also dismisses the menu (an open menu jitters as Radix repositions it\n * to follow its trigger while scrolling).\n *\n * \"Inside\" is any element with `role=\"menu\"` in its ancestry — Radix gives that\n * role to both the content and its submenus (which portal out separately), so\n * clicks and scrolls inside a submenu are correctly treated as inside.\n */\nconst OutsideClickGuard = () => {\n const cleanupTimerRef =\n React.useRef<ReturnType<typeof setTimeout>>(undefined);\n const pointerDownOutsideRef = React.useRef(false);\n\n React.useLayoutEffect(() => {\n clearTimeout(cleanupTimerRef.current);\n pointerDownOutsideRef.current = false;\n\n const isOutside = (target: EventTarget | null) =>\n !(target instanceof Element) || !target.closest('[role=\"menu\"]');\n\n // Observe (don't block) outside pointerdowns: Radix dismisses on them, so\n // this tells us the trailing click needs absorbing on cleanup.\n const onPointerDown = (event: PointerEvent) => {\n if (isOutside(event.target)) pointerDownOutsideRef.current = true;\n };\n document.addEventListener('pointerdown', onPointerDown, true);\n\n // Block clicks that land outside the menu from reaching the content beneath.\n const onClick = (event: MouseEvent) => {\n if (isOutside(event.target)) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n document.addEventListener('click', onClick, true);\n\n // Dismiss on scroll of the content behind the menu: an anchored menu that\n // stays open jitters as Radix repositions it to chase its trigger. Passive,\n // so the wheel still scrolls the content natively on the same gesture.\n // Scrolling inside the menu (e.g. a details panel) leaves it open.\n const onWheel = (event: WheelEvent) => {\n if (isOutside(event.target)) {\n document.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true })\n );\n }\n };\n document.addEventListener('wheel', onWheel, { passive: true });\n\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true);\n document.removeEventListener('click', onClick, true);\n document.removeEventListener('wheel', onWheel);\n\n // Radix dismisses on the outside pointerdown and unmounts this guard\n // before the trailing click fires, so absorb that one click here. Only\n // for pointer dismissals — Escape / item selection have no trailing\n // outside click, and absorbing an unrelated later click would be wrong.\n if (!pointerDownOutsideRef.current) return;\n\n const absorb = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n };\n const opts = { capture: true, once: true } as const;\n document.addEventListener('pointerup', absorb, opts);\n document.addEventListener('mouseup', absorb, opts);\n document.addEventListener('click', absorb, opts);\n\n cleanupTimerRef.current = setTimeout(() => {\n if (typeof document === 'undefined') return;\n document.removeEventListener('pointerup', absorb, { capture: true });\n document.removeEventListener('mouseup', absorb, { capture: true });\n document.removeEventListener('click', absorb, { capture: true });\n }, 300);\n };\n }, []);\n\n return null;\n};\n\nexport const DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> & {\n /**\n * When true, stops clicks outside the open menu from reaching elements\n * underneath (e.g. table rows), while leaving scrolling of that content\n * intact. Radix's outside-click dismiss still works normally.\n */\n preventClickThrough?: boolean;\n }\n>(\n (\n { className, sideOffset = 4, children, preventClickThrough, ...props },\n ref\n ) => {\n const zIndex = useZIndex(zIndices.popover);\n\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'min-w-[8rem] overflow-hidden rounded-md border border-subtle bg-popover p-space-1 shadow-lg',\n className\n )}\n {...props}\n style={{ zIndex, ...props.style }}\n >\n {preventClickThrough && <OutsideClickGuard />}\n <ZIndexProvider value={zIndex}>{children}</ZIndexProvider>\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n );\n }\n);\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nexport const DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n }\n>(({ className, inset, size = 'md', ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'flex cursor-pointer select-none items-center rounded-sm px-space-2 py-space-1 outline-hidden transition-colors focus:bg-surface-level-2 data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n OPTION_ROW_SIZES[size].minHeightClassName,\n size === 'sm' ? 'text-xs leading-4' : 'text-sm',\n inset && 'pl-space-6',\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nexport const DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('my-space-1 h-px bg-surface-level-2', className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nexport const DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nexport const DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n }\n>(({ className, inset, children, size = 'md', ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-pointer select-none items-center rounded-sm px-space-2 py-space-1 outline-hidden transition-colors focus:bg-surface-level-2 data-[state=open]:bg-surface-level-2',\n OPTION_ROW_SIZES[size].minHeightClassName,\n size === 'sm' ? 'text-xs leading-4' : 'text-sm',\n inset && 'pl-space-6',\n className\n )}\n {...props}\n >\n {children}\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\n\nexport const DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, children, ...props }, ref) => {\n const zIndex = useZIndex(zIndices.popover);\n\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'min-w-[8rem] overflow-hidden rounded-md border border-subtle bg-popover p-space-1 shadow-lg',\n className\n )}\n style={{ zIndex }}\n {...props}\n >\n <ZIndexProvider value={zIndex}>{children}</ZIndexProvider>\n </DropdownMenuPrimitive.SubContent>\n </DropdownMenuPrimitive.Portal>\n );\n});\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n"],"mappings":";;;;;;;;;;AAcA,IAAa,gBAAmD,UAAU;CACxE,MAAM,CAAC,OAAO,OAAO,gBAAgB,qBAAqB;EACxD,MAAM,MAAM;EACZ,aAAa,MAAM,eAAe;EAClC,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AC,sBAAsB,WAAvB;CACO;CACL,WAAW,GAAG,sCAAsC,SAAS;CAC7D,GAAI;AACL,CAAA,CACF;AACD,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,IAAa,kBAAkB,sBAAsB;AAErD,IAAa,yBAAyB,QAAM,YAUzC,EAAE,WAAW,OAAO,UAAU,OAAO,MAAM,GAAG,SAAS,QACxD,oBAAC,sBAAsB,YAAvB;CACO;CACL,WAAW,GACT,gLACA,iBAAiB,KAAK,CAAC,oBACvB,SAAS,OAAO,sBAAsB,WACtC,SAAS,cACT,SACF;CACA,GAAI;CAEH;AAC+B,CAAA,CACnC;AACD,uBAAuB,cACrB,sBAAsB,WAAW;AAEnC,IAAa,yBAAyB,QAAM,YAGzC,EAAE,WAAW,UAAU,GAAG,SAAS,QAAQ;CAC5C,MAAM,SAAS,UAAU,SAAS,OAAO;CAEzC,OACE,oBAAC,sBAAsB,QAAvB,EAAA,UACE,oBAAC,sBAAsB,YAAvB;EACO;EACL,WAAW,GACT,+FACA,SACF;EACA,OAAO,EAAE,OAAO;EAChB,GAAI;EAEJ,UAAA,oBAAC,gBAAD;GAAgB,OAAO;GAAS;EAAyB,CAAA;CACzB,CAAA,EACN,CAAA;AAElC,CAAC;AACD,uBAAuB,cACrB,sBAAsB,WAAW"}
1
+ {"version":3,"file":"DropdownMenu.js","names":[],"sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\n\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\n\nexport const DropdownMenu: typeof DropdownMenuPrimitive.Root = (props) => {\n const [open = false, onOpenChange] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen ?? false,\n onChange: props.onOpenChange,\n });\n\n return (\n <DropdownMenuPrimitive.Root\n {...props}\n open={open}\n onOpenChange={onOpenChange}\n defaultOpen={undefined}\n />\n );\n};\n\nexport const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nexport const DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nexport const DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nexport const DropdownMenuLabel = DropdownMenuPrimitive.Label;\n\n/**\n * Stops clicks outside an open dropdown from reaching elements underneath it\n * (e.g. a table row's `onClick`) without covering the viewport, so scrolling\n * the content behind the menu keeps working natively.\n *\n * React delegates `onClick` at the root in the bubble phase, so a capture-phase\n * `click` listener on `document` runs first and can stop the event before it\n * gets there. pointerdown is left alone so Radix's outside-dismiss keeps\n * working; the wheel listener is passive so native scroll is never interrupted,\n * it just also dismisses the menu (an open menu jitters as Radix repositions it\n * to follow its trigger while scrolling).\n *\n * \"Inside\" is any element with `role=\"menu\"` in its ancestry — Radix gives that\n * role to both the content and its submenus (which portal out separately), so\n * clicks and scrolls inside a submenu are correctly treated as inside.\n */\nconst OutsideClickGuard = () => {\n const cleanupTimerRef =\n React.useRef<ReturnType<typeof setTimeout>>(undefined);\n const pointerDownOutsideRef = React.useRef(false);\n\n React.useLayoutEffect(() => {\n clearTimeout(cleanupTimerRef.current);\n pointerDownOutsideRef.current = false;\n\n const isOutside = (target: EventTarget | null) =>\n !(target instanceof Element) || !target.closest('[role=\"menu\"]');\n\n // Observe (don't block) outside pointerdowns: Radix dismisses on them, so\n // this tells us the trailing click needs absorbing on cleanup.\n const onPointerDown = (event: PointerEvent) => {\n if (isOutside(event.target)) pointerDownOutsideRef.current = true;\n };\n document.addEventListener('pointerdown', onPointerDown, true);\n\n // Block clicks that land outside the menu from reaching the content beneath.\n const onClick = (event: MouseEvent) => {\n if (isOutside(event.target)) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n document.addEventListener('click', onClick, true);\n\n // Dismiss on scroll of the content behind the menu: an anchored menu that\n // stays open jitters as Radix repositions it to chase its trigger. Passive,\n // so the wheel still scrolls the content natively on the same gesture.\n // Scrolling inside the menu (e.g. a details panel) leaves it open.\n const onWheel = (event: WheelEvent) => {\n if (isOutside(event.target)) {\n document.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true })\n );\n }\n };\n document.addEventListener('wheel', onWheel, { passive: true });\n\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true);\n document.removeEventListener('click', onClick, true);\n document.removeEventListener('wheel', onWheel);\n\n // Radix dismisses on the outside pointerdown and unmounts this guard\n // before the trailing click fires, so absorb that one click here. Only\n // for pointer dismissals — Escape / item selection have no trailing\n // outside click, and absorbing an unrelated later click would be wrong.\n if (!pointerDownOutsideRef.current) return;\n\n const absorb = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n };\n const opts = { capture: true, once: true } as const;\n document.addEventListener('pointerup', absorb, opts);\n document.addEventListener('mouseup', absorb, opts);\n document.addEventListener('click', absorb, opts);\n\n cleanupTimerRef.current = setTimeout(() => {\n if (typeof document === 'undefined') return;\n document.removeEventListener('pointerup', absorb, { capture: true });\n document.removeEventListener('mouseup', absorb, { capture: true });\n document.removeEventListener('click', absorb, { capture: true });\n }, 300);\n };\n }, []);\n\n return null;\n};\n\nexport const DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> & {\n /**\n * When true, stops clicks outside the open menu from reaching elements\n * underneath (e.g. table rows), while leaving scrolling of that content\n * intact. Radix's outside-click dismiss still works normally.\n */\n preventClickThrough?: boolean;\n }\n>(\n (\n { className, sideOffset = 4, children, preventClickThrough, ...props },\n ref\n ) => {\n const zIndex = useZIndex(zIndices.popover);\n\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'min-w-[8rem] overflow-hidden rounded-md border border-subtle bg-popover p-space-1 shadow-lg',\n className\n )}\n {...props}\n style={{ zIndex, ...props.style }}\n >\n {preventClickThrough && <OutsideClickGuard />}\n <ZIndexProvider value={zIndex}>{children}</ZIndexProvider>\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n );\n }\n);\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nexport const DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n }\n>(({ className, inset, size = 'md', ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'flex cursor-pointer select-none items-center rounded-sm px-space-2 py-space-1 outline-hidden transition-colors focus:bg-elevated-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n OPTION_ROW_SIZES[size].minHeightClassName,\n size === 'sm' ? 'text-xs leading-4' : 'text-sm',\n inset && 'pl-space-6',\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nexport const DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('my-space-1 h-px border-b border-subtle', className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nexport const DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nexport const DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n }\n>(({ className, inset, children, size = 'md', ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-pointer select-none items-center rounded-sm px-space-2 py-space-1 outline-hidden transition-colors focus:bg-elevated-hover data-[state=open]:bg-elevated-hover',\n OPTION_ROW_SIZES[size].minHeightClassName,\n size === 'sm' ? 'text-xs leading-4' : 'text-sm',\n inset && 'pl-space-6',\n className\n )}\n {...props}\n >\n {children}\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\n\nexport const DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, children, ...props }, ref) => {\n const zIndex = useZIndex(zIndices.popover);\n\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'min-w-[8rem] overflow-hidden rounded-md border border-subtle bg-popover p-space-1 shadow-lg',\n className\n )}\n style={{ zIndex }}\n {...props}\n >\n <ZIndexProvider value={zIndex}>{children}</ZIndexProvider>\n </DropdownMenuPrimitive.SubContent>\n </DropdownMenuPrimitive.Portal>\n );\n});\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n"],"mappings":";;;;;;;;;;AAcA,IAAa,gBAAmD,UAAU;CACxE,MAAM,CAAC,OAAO,OAAO,gBAAgB,qBAAqB;EACxD,MAAM,MAAM;EACZ,aAAa,MAAM,eAAe;EAClC,UAAU,MAAM;CAClB,CAAC;CAED,OACE,oBAAC,sBAAsB,MAAvB;EACE,GAAI;EACE;EACQ;EACd,aAAa,KAAA;CACd,CAAA;AAEL;AAEA,IAAa,sBAAsB,sBAAsB;AAEzD,IAAa,qBAAqB,sBAAsB;AAExD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UzC,EAAE,WAAW,OAAO,UAAU,OAAO,MAAM,GAAG,SAAS,QACxD,oBAAC,sBAAsB,YAAvB;CACO;CACL,WAAW,GACT,8KACA,iBAAiB,KAAK,CAAC,oBACvB,SAAS,OAAO,sBAAsB,WACtC,SAAS,cACT,SACF;CACA,GAAI;CAEH;AAC+B,CAAA,CACnC;AACD,uBAAuB,cACrB,sBAAsB,WAAW;AAEnC,IAAa,yBAAyB,QAAM,YAGzC,EAAE,WAAW,UAAU,GAAG,SAAS,QAAQ;CAC5C,MAAM,SAAS,UAAU,SAAS,OAAO;CAEzC,OACE,oBAAC,sBAAsB,QAAvB,EAAA,UACE,oBAAC,sBAAsB,YAAvB;EACO;EACL,WAAW,GACT,+FACA,SACF;EACA,OAAO,EAAE,OAAO;EAChB,GAAI;EAEJ,UAAA,oBAAC,gBAAD;GAAgB,OAAO;GAAS;EAAyB,CAAA;CACzB,CAAA,EACN,CAAA;AAElC,CAAC;AACD,uBAAuB,cACrB,sBAAsB,WAAW"}
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import { type ControlSize } from '../../utils/componentSizes.js';
3
+ import { type DataAttributes } from '../../utils/dataAttributes.js';
3
4
  import type { IconComponent, IconWeight } from '../../utils/icon-types.js';
4
5
  import type { TooltipProps } from '../Tooltip/index.js';
5
6
  type GroupedTabsSize = Exclude<ControlSize, 'lg'>;
@@ -29,6 +30,6 @@ export type GroupedTabsProps<T extends string | number> = {
29
30
  selectionClassName?: string;
30
31
  /** Optional class for the indicator (e.g. to override top/height for custom margins) */
31
32
  indicatorClassName?: string;
32
- };
33
- export declare const GroupedTabs: <T extends string | number>({ value, onChange, options, className, size, disabled, tooltip, selectionClassName, indicatorClassName, }: GroupedTabsProps<T>) => import("react").JSX.Element;
33
+ } & DataAttributes;
34
+ export declare const GroupedTabs: <T extends string | number>({ value, onChange, options, className, size, disabled, tooltip, selectionClassName, indicatorClassName, ...rest }: GroupedTabsProps<T>) => import("react").JSX.Element;
34
35
  export {};
@@ -2,10 +2,11 @@ import { cn } from "../../utils/cn.js";
2
2
  import { CONTROL_SIZES } from "../../utils/componentSizes.js";
3
3
  import { Text } from "../Text/Text.js";
4
4
  import { Tooltip } from "../Tooltip/Tooltip.js";
5
+ import { pickDataAttributes } from "../../utils/dataAttributes.js";
5
6
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
8
  //#region packages/components/src/components/GroupedTabs/GroupedTabs.tsx
8
- var GroupedTabs = ({ value, onChange, options, className, size = "sm", disabled, tooltip, selectionClassName, indicatorClassName }) => {
9
+ var GroupedTabs = ({ value, onChange, options, className, size = "sm", disabled, tooltip, selectionClassName, indicatorClassName, ...rest }) => {
9
10
  const containerRef = useRef(null);
10
11
  const buttonRefs = useRef([]);
11
12
  const [clipState, setClipState] = useState({
@@ -46,6 +47,7 @@ var GroupedTabs = ({ value, onChange, options, className, size = "sm", disabled,
46
47
  return /* @__PURE__ */ jsx(Tooltip, {
47
48
  title: tooltip,
48
49
  children: /* @__PURE__ */ jsxs("div", {
50
+ ...pickDataAttributes(rest),
49
51
  ref: containerRef,
50
52
  className: cn("relative box-border flex w-fit border border-subtle bg-surface-level-1 dark:border-muted", CONTROL_SIZES[size].heightClassName, size === "md" ? "p-0.5" : "p-px", size === "xs" ? "gap-px" : "gap-0.5", size === "xs" ? "rounded-[2px]" : size === "sm" ? "rounded-[3px]" : "rounded-sm", className),
51
53
  children: [clipState.path && /* @__PURE__ */ jsx("div", {