@fanvue/ui 3.40.0 → 3.41.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 (34) hide show
  1. package/dist/cjs/components/Checkbox/Checkbox.cjs +6 -6
  2. package/dist/cjs/components/Checkbox/Checkbox.cjs.map +1 -1
  3. package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs +7 -1
  4. package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs.map +1 -1
  5. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +1 -1
  6. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -1
  7. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +2 -2
  8. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -1
  9. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +6 -4
  10. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -1
  11. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +4 -3
  12. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -1
  13. package/dist/cjs/components/Icons/CommentIcon.cjs +74 -0
  14. package/dist/cjs/components/Icons/CommentIcon.cjs.map +1 -0
  15. package/dist/cjs/index.cjs +2 -0
  16. package/dist/cjs/index.cjs.map +1 -1
  17. package/dist/components/Checkbox/Checkbox.mjs +6 -6
  18. package/dist/components/Checkbox/Checkbox.mjs.map +1 -1
  19. package/dist/components/DropdownMenu/DropdownMenuHeader.mjs +7 -1
  20. package/dist/components/DropdownMenu/DropdownMenuHeader.mjs.map +1 -1
  21. package/dist/components/DropdownMenu/DropdownMenuItem.mjs +1 -1
  22. package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -1
  23. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +2 -2
  24. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -1
  25. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +6 -4
  26. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -1
  27. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +4 -3
  28. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -1
  29. package/dist/components/Icons/CommentIcon.mjs +57 -0
  30. package/dist/components/Icons/CommentIcon.mjs.map +1 -0
  31. package/dist/index.d.ts +13 -0
  32. package/dist/index.mjs +2 -0
  33. package/dist/index.mjs.map +1 -1
  34. package/package.json +1 -1
@@ -100,13 +100,13 @@ const Checkbox = React__namespace.forwardRef(
100
100
  "data-[state=checked]:border-content-primary data-[state=checked]:bg-content-primary data-[state=checked]:text-content-primary-inverted",
101
101
  // Indeterminate state
102
102
  "data-[state=indeterminate]:border-content-primary data-[state=indeterminate]:bg-content-primary data-[state=indeterminate]:text-content-primary-inverted",
103
- // Hover & active state
104
- "hover:ring-2 hover:ring-brand-primary-default group-hover:ring-2 group-hover:ring-brand-primary-default",
105
- "not-disabled:active:ring-2 not-disabled:active:ring-brand-primary-default",
106
- // Focus state
107
- "focus-visible:shadow-focus-ring focus-visible:outline-none",
103
+ // Hover & active state (inset, like the focus ring, so overflow containers can't clip it)
104
+ "hover:inset-ring-2 hover:inset-ring-brand-primary-default group-hover:inset-ring-2 group-hover:inset-ring-brand-primary-default",
105
+ "not-disabled:active:inset-ring-2 not-disabled:active:inset-ring-brand-primary-default",
106
+ // Focus state (drops the hover ring, which would otherwise paint over the focus ring)
107
+ "focus-visible:inset-ring-0 focus-visible:shadow-focus-ring focus-visible:outline-none",
108
108
  // Disabled state
109
- "disabled:cursor-not-allowed disabled:border-neutral-alphas-600 disabled:ring-0 disabled:group-hover:ring-0",
109
+ "disabled:inset-ring-0 disabled:cursor-not-allowed disabled:border-neutral-alphas-600 disabled:group-hover:inset-ring-0",
110
110
  "disabled:data-[state=checked]:border-neutral-alphas-600 disabled:data-[state=checked]:bg-neutral-alphas-600 disabled:data-[state=checked]:text-content-tertiary",
111
111
  !hasLabel && className
112
112
  ),
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.cjs","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { MinusIcon } from \"../Icons/MinusIcon\";\n\n/**\n * Size variant for the checkbox.\n *\n * - `\"20\"` (default) — 20px box, body-lg label.\n * - `\"16\"` — 16px box, body-md label, used in compact contexts like data tables.\n * - `\"default\"` and `\"small\"` are legacy aliases retained for back-compat\n * (`\"default\"` → `\"20\"`, `\"small\"` → `\"20\"` with smaller label typography).\n */\nexport type CheckboxSize =\n | \"20\"\n | \"16\"\n /** @deprecated Use `\"20\"` instead. */\n | \"default\"\n /** @deprecated Use `\"20\"` (the smaller-typography variant remains via `\"small\"`). */\n | \"small\";\n\nconst BOX_SIZE_CLASS: Record<\"20\" | \"16\", string> = {\n \"20\": \"size-5\",\n \"16\": \"size-4\",\n};\n\nconst INDICATOR_SIZE_CLASS: Record<\"20\" | \"16\", string> = {\n \"20\": \"size-3\",\n \"16\": \"size-2.5\",\n};\n\nexport interface CheckboxProps\n extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, \"asChild\"> {\n /** Size variant. @default \"20\" */\n size?: CheckboxSize;\n /** Label text displayed next to the checkbox. */\n label?: string;\n /** Descriptive text displayed below the label. */\n helperText?: string;\n}\n\n/**\n * A checkbox input with optional label and helper text. Supports checked,\n * unchecked, and indeterminate states.\n *\n * The ref type is intentionally `HTMLInputElement` (not `HTMLButtonElement`) for\n * form-library compatibility — libraries like react-hook-form call `register()`\n * which expects an `HTMLInputElement` ref. A hidden `<input>` is synced to the\n * Radix checkbox state via `useImperativeHandle`.\n *\n * @example\n * ```tsx\n * <Checkbox label=\"Accept terms\" helperText=\"Required to continue\" />\n * ```\n */\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ className, size = \"20\", label, helperText, disabled, name, ...props }, ref) => {\n const id = React.useId();\n const helperTextId = helperText ? `${id}-helper` : undefined;\n const hasLabel = Boolean(label || helperText);\n const boxSize: \"20\" | \"16\" = size === \"16\" ? \"16\" : \"20\";\n const useSmallLabelTypography = size === \"small\";\n\n if (\n process.env.NODE_ENV !== \"production\" &&\n !label &&\n !props[\"aria-label\"] &&\n !props[\"aria-labelledby\"]\n ) {\n console.warn(\n \"Checkbox: No accessible name provided. Add a `label`, `aria-label`, or `aria-labelledby` prop so screen readers can announce this checkbox.\",\n );\n }\n\n // Hidden input for form library compatibility (e.g. react-hook-form register)\n const inputRef = React.useRef<HTMLInputElement>(null);\n React.useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);\n\n const handleCheckedChange = (value: boolean | \"indeterminate\") => {\n const checked = value === true;\n if (inputRef.current) {\n inputRef.current.checked = checked;\n inputRef.current.dispatchEvent(new Event(\"change\", { bubbles: true }));\n }\n props.onCheckedChange?.(value);\n };\n\n const checkboxElement = (\n <span\n className={cn(\n \"relative inline-flex shrink-0\",\n BOX_SIZE_CLASS[boxSize],\n // Alignment when used with label\n label && (helperText ? \"mt-1\" : \"mt-0.5\"),\n )}\n >\n <input\n ref={inputRef}\n type=\"checkbox\"\n name={name}\n disabled={disabled}\n aria-hidden\n tabIndex={-1}\n onChange={() => {}}\n className=\"pointer-events-none absolute size-px overflow-hidden opacity-0\"\n style={{ clip: \"rect(0,0,0,0)\" }}\n />\n <CheckboxPrimitive.Root\n id={id}\n disabled={disabled}\n aria-describedby={helperTextId}\n data-testid=\"checkbox\"\n {...props}\n onCheckedChange={handleCheckedChange}\n className={cn(\n // Base styles\n \"flex items-center justify-center rounded-2xs border\",\n BOX_SIZE_CLASS[boxSize],\n \"transition-[border-color,background-color,color,box-shadow] duration-150\",\n // Default state\n \"border-content-primary bg-transparent text-transparent\",\n // Checked state\n \"data-[state=checked]:border-content-primary data-[state=checked]:bg-content-primary data-[state=checked]:text-content-primary-inverted\",\n // Indeterminate state\n \"data-[state=indeterminate]:border-content-primary data-[state=indeterminate]:bg-content-primary data-[state=indeterminate]:text-content-primary-inverted\",\n // Hover & active state\n \"hover:ring-2 hover:ring-brand-primary-default group-hover:ring-2 group-hover:ring-brand-primary-default\",\n \"not-disabled:active:ring-2 not-disabled:active:ring-brand-primary-default\",\n // Focus state\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n // Disabled state\n \"disabled:cursor-not-allowed disabled:border-neutral-alphas-600 disabled:ring-0 disabled:group-hover:ring-0\",\n \"disabled:data-[state=checked]:border-neutral-alphas-600 disabled:data-[state=checked]:bg-neutral-alphas-600 disabled:data-[state=checked]:text-content-tertiary\",\n !hasLabel && className,\n )}\n >\n <CheckboxPrimitive.Indicator\n forceMount\n className={cn(\n \"flex items-center justify-center text-content-primary-inverted\",\n INDICATOR_SIZE_CLASS[boxSize],\n \"data-[state=unchecked]:invisible\",\n )}\n >\n {props.checked === \"indeterminate\" ? <MinusIcon /> : <CheckIcon />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n </span>\n );\n\n if (!hasLabel) {\n return checkboxElement;\n }\n\n return (\n <div\n className={cn(\n \"inline-flex flex-col gap-0.5\",\n disabled && \"is-disabled cursor-not-allowed\",\n className,\n )}\n >\n <div className=\"group inline-flex items-start gap-2\">\n {checkboxElement}\n {label && (\n <label\n htmlFor={id}\n className={cn(\n \"cursor-pointer select-none text-content-primary\",\n \"group-has-disabled:cursor-not-allowed group-has-disabled:text-content-tertiary\",\n useSmallLabelTypography\n ? \"typography-body-small-14px-semibold\"\n : \"typography-body-default-16px-semibold\",\n )}\n >\n {label}\n </label>\n )}\n </div>\n {helperText && (\n <span\n id={helperTextId}\n className={cn(\n \"ml-7 text-content-secondary\",\n \"in-[.is-disabled]:cursor-not-allowed in-[.is-disabled]:text-content-tertiary\",\n useSmallLabelTypography\n ? \"typography-description-12px-regular\"\n : \"typography-body-small-14px-regular\",\n )}\n >\n {helperText}\n </span>\n )}\n </div>\n );\n },\n);\n\nCheckbox.displayName = \"Checkbox\";\n"],"names":["React","jsxs","cn","jsx","CheckboxPrimitive","MinusIcon","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,iBAA8C;AAAA,EAClD,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,uBAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AACR;AA0BO,MAAM,WAAWA,iBAAM;AAAA,EAC5B,CAAC,EAAE,WAAW,OAAO,MAAM,OAAO,YAAY,UAAU,MAAM,GAAG,MAAA,GAAS,QAAQ;AAChF,UAAM,KAAKA,iBAAM,MAAA;AACjB,UAAM,eAAe,aAAa,GAAG,EAAE,YAAY;AACnD,UAAM,WAAW,QAAQ,SAAS,UAAU;AAC5C,UAAM,UAAuB,SAAS,OAAO,OAAO;AACpD,UAAM,0BAA0B,SAAS;AAEzC,QACE,QAAQ,IAAI,aAAa,gBACzB,CAAC,SACD,CAAC,MAAM,YAAY,KACnB,CAAC,MAAM,iBAAiB,GACxB;AACA,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAGA,UAAM,WAAWA,iBAAM,OAAyB,IAAI;AACpDA,qBAAM,oBAAoB,KAAK,MAAM,SAAS,OAA2B;AAEzE,UAAM,sBAAsB,CAAC,UAAqC;AAChE,YAAM,UAAU,UAAU;AAC1B,UAAI,SAAS,SAAS;AACpB,iBAAS,QAAQ,UAAU;AAC3B,iBAAS,QAAQ,cAAc,IAAI,MAAM,UAAU,EAAE,SAAS,KAAA,CAAM,CAAC;AAAA,MACvE;AACA,YAAM,kBAAkB,KAAK;AAAA,IAC/B;AAEA,UAAM,kBACJC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC,GAAAA;AAAAA,UACT;AAAA,UACA,eAAe,OAAO;AAAA;AAAA,UAEtB,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A;AAAA,QAGF,UAAA;AAAA,UAAAD,2BAAAA,KAAC,OAAA,EAAI,WAAU,uCACZ,UAAA;AAAA,YAAA;AAAA,YACA,SACCE,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,SAAS;AAAA,gBACT,WAAWD,GAAAA;AAAAA,kBACT;AAAA,kBACA;AAAA,kBACA,0BACI,wCACA;AAAA,gBAAA;AAAA,gBAGL,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,GAEJ;AAAA,UACC,cACCC,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI;AAAA,cACJ,WAAWD,GAAAA;AAAAA,gBACT;AAAA,gBACA;AAAA,gBACA,0BACI,wCACA;AAAA,cAAA;AAAA,cAGL,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,SAAS,cAAc;;"}
1
+ {"version":3,"file":"Checkbox.cjs","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { MinusIcon } from \"../Icons/MinusIcon\";\n\n/**\n * Size variant for the checkbox.\n *\n * - `\"20\"` (default) — 20px box, body-lg label.\n * - `\"16\"` — 16px box, body-md label, used in compact contexts like data tables.\n * - `\"default\"` and `\"small\"` are legacy aliases retained for back-compat\n * (`\"default\"` → `\"20\"`, `\"small\"` → `\"20\"` with smaller label typography).\n */\nexport type CheckboxSize =\n | \"20\"\n | \"16\"\n /** @deprecated Use `\"20\"` instead. */\n | \"default\"\n /** @deprecated Use `\"20\"` (the smaller-typography variant remains via `\"small\"`). */\n | \"small\";\n\nconst BOX_SIZE_CLASS: Record<\"20\" | \"16\", string> = {\n \"20\": \"size-5\",\n \"16\": \"size-4\",\n};\n\nconst INDICATOR_SIZE_CLASS: Record<\"20\" | \"16\", string> = {\n \"20\": \"size-3\",\n \"16\": \"size-2.5\",\n};\n\nexport interface CheckboxProps\n extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, \"asChild\"> {\n /** Size variant. @default \"20\" */\n size?: CheckboxSize;\n /** Label text displayed next to the checkbox. */\n label?: string;\n /** Descriptive text displayed below the label. */\n helperText?: string;\n}\n\n/**\n * A checkbox input with optional label and helper text. Supports checked,\n * unchecked, and indeterminate states.\n *\n * The ref type is intentionally `HTMLInputElement` (not `HTMLButtonElement`) for\n * form-library compatibility — libraries like react-hook-form call `register()`\n * which expects an `HTMLInputElement` ref. A hidden `<input>` is synced to the\n * Radix checkbox state via `useImperativeHandle`.\n *\n * @example\n * ```tsx\n * <Checkbox label=\"Accept terms\" helperText=\"Required to continue\" />\n * ```\n */\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ className, size = \"20\", label, helperText, disabled, name, ...props }, ref) => {\n const id = React.useId();\n const helperTextId = helperText ? `${id}-helper` : undefined;\n const hasLabel = Boolean(label || helperText);\n const boxSize: \"20\" | \"16\" = size === \"16\" ? \"16\" : \"20\";\n const useSmallLabelTypography = size === \"small\";\n\n if (\n process.env.NODE_ENV !== \"production\" &&\n !label &&\n !props[\"aria-label\"] &&\n !props[\"aria-labelledby\"]\n ) {\n console.warn(\n \"Checkbox: No accessible name provided. Add a `label`, `aria-label`, or `aria-labelledby` prop so screen readers can announce this checkbox.\",\n );\n }\n\n // Hidden input for form library compatibility (e.g. react-hook-form register)\n const inputRef = React.useRef<HTMLInputElement>(null);\n React.useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);\n\n const handleCheckedChange = (value: boolean | \"indeterminate\") => {\n const checked = value === true;\n if (inputRef.current) {\n inputRef.current.checked = checked;\n inputRef.current.dispatchEvent(new Event(\"change\", { bubbles: true }));\n }\n props.onCheckedChange?.(value);\n };\n\n const checkboxElement = (\n <span\n className={cn(\n \"relative inline-flex shrink-0\",\n BOX_SIZE_CLASS[boxSize],\n // Alignment when used with label\n label && (helperText ? \"mt-1\" : \"mt-0.5\"),\n )}\n >\n <input\n ref={inputRef}\n type=\"checkbox\"\n name={name}\n disabled={disabled}\n aria-hidden\n tabIndex={-1}\n onChange={() => {}}\n className=\"pointer-events-none absolute size-px overflow-hidden opacity-0\"\n style={{ clip: \"rect(0,0,0,0)\" }}\n />\n <CheckboxPrimitive.Root\n id={id}\n disabled={disabled}\n aria-describedby={helperTextId}\n data-testid=\"checkbox\"\n {...props}\n onCheckedChange={handleCheckedChange}\n className={cn(\n // Base styles\n \"flex items-center justify-center rounded-2xs border\",\n BOX_SIZE_CLASS[boxSize],\n \"transition-[border-color,background-color,color,box-shadow] duration-150\",\n // Default state\n \"border-content-primary bg-transparent text-transparent\",\n // Checked state\n \"data-[state=checked]:border-content-primary data-[state=checked]:bg-content-primary data-[state=checked]:text-content-primary-inverted\",\n // Indeterminate state\n \"data-[state=indeterminate]:border-content-primary data-[state=indeterminate]:bg-content-primary data-[state=indeterminate]:text-content-primary-inverted\",\n // Hover & active state (inset, like the focus ring, so overflow containers can't clip it)\n \"hover:inset-ring-2 hover:inset-ring-brand-primary-default group-hover:inset-ring-2 group-hover:inset-ring-brand-primary-default\",\n \"not-disabled:active:inset-ring-2 not-disabled:active:inset-ring-brand-primary-default\",\n // Focus state (drops the hover ring, which would otherwise paint over the focus ring)\n \"focus-visible:inset-ring-0 focus-visible:shadow-focus-ring focus-visible:outline-none\",\n // Disabled state\n \"disabled:inset-ring-0 disabled:cursor-not-allowed disabled:border-neutral-alphas-600 disabled:group-hover:inset-ring-0\",\n \"disabled:data-[state=checked]:border-neutral-alphas-600 disabled:data-[state=checked]:bg-neutral-alphas-600 disabled:data-[state=checked]:text-content-tertiary\",\n !hasLabel && className,\n )}\n >\n <CheckboxPrimitive.Indicator\n forceMount\n className={cn(\n \"flex items-center justify-center text-content-primary-inverted\",\n INDICATOR_SIZE_CLASS[boxSize],\n \"data-[state=unchecked]:invisible\",\n )}\n >\n {props.checked === \"indeterminate\" ? <MinusIcon /> : <CheckIcon />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n </span>\n );\n\n if (!hasLabel) {\n return checkboxElement;\n }\n\n return (\n <div\n className={cn(\n \"inline-flex flex-col gap-0.5\",\n disabled && \"is-disabled cursor-not-allowed\",\n className,\n )}\n >\n <div className=\"group inline-flex items-start gap-2\">\n {checkboxElement}\n {label && (\n <label\n htmlFor={id}\n className={cn(\n \"cursor-pointer select-none text-content-primary\",\n \"group-has-disabled:cursor-not-allowed group-has-disabled:text-content-tertiary\",\n useSmallLabelTypography\n ? \"typography-body-small-14px-semibold\"\n : \"typography-body-default-16px-semibold\",\n )}\n >\n {label}\n </label>\n )}\n </div>\n {helperText && (\n <span\n id={helperTextId}\n className={cn(\n \"ml-7 text-content-secondary\",\n \"in-[.is-disabled]:cursor-not-allowed in-[.is-disabled]:text-content-tertiary\",\n useSmallLabelTypography\n ? \"typography-description-12px-regular\"\n : \"typography-body-small-14px-regular\",\n )}\n >\n {helperText}\n </span>\n )}\n </div>\n );\n },\n);\n\nCheckbox.displayName = \"Checkbox\";\n"],"names":["React","jsxs","cn","jsx","CheckboxPrimitive","MinusIcon","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,iBAA8C;AAAA,EAClD,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,uBAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AACR;AA0BO,MAAM,WAAWA,iBAAM;AAAA,EAC5B,CAAC,EAAE,WAAW,OAAO,MAAM,OAAO,YAAY,UAAU,MAAM,GAAG,MAAA,GAAS,QAAQ;AAChF,UAAM,KAAKA,iBAAM,MAAA;AACjB,UAAM,eAAe,aAAa,GAAG,EAAE,YAAY;AACnD,UAAM,WAAW,QAAQ,SAAS,UAAU;AAC5C,UAAM,UAAuB,SAAS,OAAO,OAAO;AACpD,UAAM,0BAA0B,SAAS;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Ref(
66
66
  ref,
67
67
  className: cn.cn(
68
68
  "mb-1 flex flex-col px-1 pt-1",
69
+ // The insets in this header and its rule are measured against the
70
+ // sheet's 4px panel padding. The popper panel pads 8px, so pull the
71
+ // header back out by the extra 4px to land on the same positions.
72
+ variant !== "sheet" && "-mx-1 -mt-1",
69
73
  // Search needs an 8px gap between the input and the divider; the
70
74
  // default (title) variant uses 4px because the title baseline sits
71
75
  // closer to the divider naturally.
@@ -155,7 +159,9 @@ function SearchInput({
155
159
  {
156
160
  "data-dropdown-menu-tab-stops": "",
157
161
  className: cn.cn(
158
- "flex min-w-0 flex-1 items-center gap-2 rounded-xs border border-border-primary",
162
+ // 16px, like the rows: the field sits 8px in from the panel's 24px
163
+ // corner, so 24 − 8 keeps the two curves concentric.
164
+ "flex min-w-0 flex-1 items-center gap-2 rounded-md border border-border-primary",
159
165
  "bg-inputs-inputs-primary px-3 py-1 text-content-primary",
160
166
  "focus-within:shadow-focus-ring focus-within:outline-none"
161
167
  ),
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenuHeader.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuHeader.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ArrowLeftIcon } from \"../Icons/ArrowLeftIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\nimport { SearchIcon } from \"../Icons/SearchIcon\";\nimport { DropdownMenuVariantContext, ToggleOpenContext } from \"./context\";\nimport { DropdownMenuSeparator } from \"./DropdownMenuItem\";\n\n// Keys that the menu must keep handling even when focus is inside a child\n// input — arrows move the highlight into the list, Tab leaves the menu, and\n// Enter / Escape close it.\nconst NAVIGATION_KEYS = new Set([\n \"ArrowDown\",\n \"ArrowUp\",\n \"ArrowLeft\",\n \"ArrowRight\",\n \"Escape\",\n \"Tab\",\n \"Enter\",\n]);\n\n/** Header type. `\"default\"` shows a title; `\"search\"` shows a search input. */\nexport type DropdownMenuHeaderType = \"default\" | \"search\";\n\n/** Header height preset. Matches the menu item sizing scale. */\nexport type DropdownMenuHeaderSize = \"40\" | \"32\";\n\n/** Search-input configuration for {@link DropdownMenuHeader} when `type=\"search\"`. */\nexport interface DropdownMenuHeaderSearchProps {\n /** Controlled value of the search input. */\n value?: string;\n /** Uncontrolled default value. */\n defaultValue?: string;\n /** Fires when the input value changes. */\n onChange?: (value: string) => void;\n /** Placeholder text shown when the input is empty. @default \"Search…\" */\n placeholder?: string;\n /** Accessible label for the search input. @default \"Search\" */\n \"aria-label\"?: string;\n /**\n * Focus the input as soon as the menu opens, so typing filters immediately.\n * Radix parks initial focus on the content element (which is what drives its\n * typeahead), so without this the first keystrokes never reach the input.\n */\n autoFocus?: boolean;\n}\n\nexport interface DropdownMenuHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Visual type. `\"default\"` shows a title; `\"search\"` shows a search input. @default \"default\" */\n type?: DropdownMenuHeaderType;\n /** Height preset for the header row. @default \"40\" */\n size?: DropdownMenuHeaderSize;\n /** Title text shown when `type=\"default\"`. Ignored if `children` is provided. */\n title?: string;\n /** Configuration for the embedded search input when `type=\"search\"`. */\n searchProps?: DropdownMenuHeaderSearchProps;\n /**\n * Action elements rendered at the end of the header row, before the close\n * button — e.g. icon buttons for search/add, or a primary \"Done\" button that\n * commits a {@link DropdownMenuReorderGroup} reorder. An action that should\n * close the menu needs the menu's `open` state controlled (only the built-in\n * close button can dismiss an uncontrolled menu).\n */\n actions?: React.ReactNode;\n /** Whether to render the close icon button on the right. @default true */\n showClose?: boolean;\n /** Fires when the close icon button is activated. */\n onClose?: () => void;\n /** Accessible label for the close button. @default \"Close menu\" */\n closeLabel?: string;\n /**\n * Fires when the back icon button at the start of the row is activated.\n * Rendering it lets a menu step back from a sub-view — a `type=\"search\"`\n * header returning to its title, for instance — without closing the menu.\n */\n onBack?: () => void;\n /** Whether to render the back icon button. @default `onBack !== undefined` */\n showBack?: boolean;\n /** Accessible label for the back button. @default \"Back\" */\n backLabel?: string;\n}\n\n/**\n * Optional header rendered at the top of a {@link DropdownMenuContent}. Use\n * `type=\"default\"` to title the menu, or `type=\"search\"` to embed a search\n * input for filtering long lists.\n *\n * Renders an inset separator beneath the row so it slots cleanly above the\n * first group of items.\n *\n * @example\n * ```tsx\n * <DropdownMenuContent>\n * <DropdownMenuHeader title=\"Sort by\" onClose={() => setOpen(false)} />\n * <DropdownMenuItem>Newest</DropdownMenuItem>\n * <DropdownMenuItem>Oldest</DropdownMenuItem>\n * </DropdownMenuContent>\n * ```\n */\nexport const DropdownMenuHeader = React.forwardRef<HTMLDivElement, DropdownMenuHeaderProps>(\n (\n {\n type = \"default\",\n size = \"40\",\n title,\n searchProps,\n actions,\n showClose = true,\n onClose,\n closeLabel = \"Close menu\",\n onBack,\n showBack = onBack !== undefined,\n backLabel = \"Back\",\n className,\n children,\n ...props\n },\n ref,\n ) => {\n // Regular, not semibold: `V2 Menu Header` titles the menu at\n // `Body Default 16px/Regular`. The weight belongs to the rows' own titles,\n // which is where the two-line layout puts a semibold.\n const titleTypography =\n size === \"32\" ? \"typography-body-small-14px-regular\" : \"typography-body-default-16px-regular\";\n const toggleOpen = React.useContext(ToggleOpenContext);\n const variant = React.useContext(DropdownMenuVariantContext);\n\n const handleClose = () => {\n onClose?.();\n // Also dismiss the Radix menu when used in uncontrolled mode — otherwise\n // the close button would look broken to consumers that don't wire up\n // `open` / `onOpenChange` themselves.\n toggleOpen?.(() => false);\n };\n\n return (\n <div\n ref={ref}\n className={cn(\n \"mb-1 flex flex-col px-1 pt-1\",\n // Search needs an 8px gap between the input and the divider; the\n // default (title) variant uses 4px because the title baseline sits\n // closer to the divider naturally.\n type === \"search\" ? \"gap-2\" : \"gap-1\",\n // With action buttons the design draws a roomier header: 12px above\n // the 32px actions row (the panel's own 4px padding makes up the\n // difference), 8px between it and the divider, and 8px between the\n // divider and the first row.\n actions != null && \"mb-2 gap-2 pt-2\",\n // The sheet is a taller, roomier surface than a trigger-anchored panel:\n // the design sets 16px between the rule and the first row, which this\n // margin plus the panel's own 4px gap adds up to.\n variant === \"sheet\" && \"mb-3\",\n className,\n )}\n {...props}\n >\n {/*\n * The title is inset a further 8px so it clears the panel's rounded\n * corner; the search input is not, because the design runs it to the\n * header's own padding (`V2 Menu Dropdown` node `7393:62008`: the search\n * row is `flex gap-16 w-full` with no inset, so the field sits 8px from\n * the panel edge on both sides). Insetting it left-only left the field\n * 16px in on the left and 8px on the right.\n */}\n <div\n className={cn(\n \"flex items-center gap-4\",\n // With action buttons the title sits a further 4px in (20px from\n // the panel edge) than the close-only header's 16px. A back button\n // supplies its own inset.\n type === \"default\" && !showBack && (actions != null ? \"pl-3\" : \"pl-2\"),\n )}\n >\n {showBack && (\n <div data-dropdown-menu-tab-stops=\"\" className=\"flex shrink-0 items-center\">\n <IconButton\n variant=\"tertiary\"\n size=\"32\"\n icon={<ArrowLeftIcon />}\n onClick={onBack}\n aria-label={backLabel}\n />\n </div>\n )}\n {type === \"default\" ? (\n <div className={cn(\"min-w-0 flex-1 truncate text-content-primary\", titleTypography)}>\n {children ?? title}\n </div>\n ) : (\n <SearchInput {...searchProps} />\n )}\n {(actions != null || showClose) && (\n // The extra right margin only applies with action buttons: filled\n // actions like a \"Done\" pill sit 12px off the panel edge, while the\n // bare tertiary close icon keeps the header's own 8px inset.\n <div\n data-dropdown-menu-tab-stops=\"\"\n className={cn(\"flex shrink-0 items-center gap-1\", actions != null && \"mr-1\")}\n >\n {actions}\n {showClose && (\n <IconButton\n variant=\"tertiary\"\n size=\"32\"\n icon={<CloseIcon />}\n onClick={handleClose}\n aria-label={closeLabel}\n />\n )}\n </div>\n )}\n </div>\n {/*\n * Full-bleed, as the design draws it: the rule runs the panel's whole\n * width rather than stopping at the text. `-mx-2` cancels both insets it\n * sits inside — this header's own `px-1` and the content panel's `p-1`.\n *\n * `Border/Primary` is the token the design binds to this rule. The\n * separator's own default is `neutral-alphas-200`, which in the dark theme\n * is a 20% *white* alpha — as a hairline running the full width it reads as\n * a white line rather than a divider. Group separators between items keep\n * the alpha; this is the header's rule only.\n */}\n <DropdownMenuSeparator className=\"-mx-2 my-0 bg-border-primary\" />\n </div>\n );\n },\n);\nDropdownMenuHeader.displayName = \"DropdownMenuHeader\";\n\nfunction SearchInput({\n value,\n defaultValue,\n onChange,\n placeholder = \"Search\\u2026\",\n \"aria-label\": ariaLabel = \"Search\",\n autoFocus,\n}: DropdownMenuHeaderSearchProps = {}) {\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n // Focus after mount rather than via the `autoFocus` attribute, so the focus\n // move is explicit and only happens when the consumer asked for it.\n React.useEffect(() => {\n if (autoFocus) inputRef.current?.focus();\n }, [autoFocus]);\n\n return (\n <label\n data-dropdown-menu-tab-stops=\"\"\n className={cn(\n \"flex min-w-0 flex-1 items-center gap-2 rounded-xs border border-border-primary\",\n \"bg-inputs-inputs-primary px-3 py-1 text-content-primary\",\n \"focus-within:shadow-focus-ring focus-within:outline-none\",\n )}\n >\n <SearchIcon className=\"size-4 shrink-0 text-content-primary\" aria-hidden=\"true\" />\n <input\n type=\"search\"\n className={cn(\n \"typography-body-default-16px-regular min-w-0 flex-1 bg-transparent outline-none\",\n \"placeholder:text-content-tertiary\",\n )}\n ref={inputRef}\n value={value}\n defaultValue={defaultValue}\n placeholder={placeholder}\n aria-label={ariaLabel}\n onChange={(event) => onChange?.(event.target.value)}\n // Radix DropdownMenu listens for keystrokes on Content for its\n // typeahead (typing letters jumps focus to a matching item). That\n // listener steals focus from the input after the first letter, so we\n // stop character keys from bubbling. Navigation keys (arrows / Tab /\n // Escape / Enter) are still allowed through so the user can leave the\n // input for the list or close the menu. Pointer events are stopped so\n // clicking back into the input doesn't fight the menu's focus\n // management either.\n onKeyDown={(event) => {\n if (!NAVIGATION_KEYS.has(event.key)) event.stopPropagation();\n }}\n onPointerDown={(event) => event.stopPropagation()}\n onMouseDown={(event) => event.stopPropagation()}\n />\n </label>\n );\n}\n"],"names":["React","ToggleOpenContext","DropdownMenuVari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AA,EACnC,GAAG,CAAC,SAAS,CAAC;AAEd,SACEG,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,gCAA6B;AAAA,MAC7B,WAAWC,GAAAA;AAAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAAC,2BAAAA,IAACK,WAAAA,YAAA,EAAW,WAAU,wCAAuC,eAAY,QAAO;AAAA,QAChFL,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAWD,GAAAA;AAAAA,cACT;AAAA,cACA;AAAA,YAAA;AAAA,YAEF,KAAK;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA,cAAY;AAAA,YACZ,UAAU,CAAC,UAAU,WAAW,MAAM,OAAO,KAAK;AAAA,YASlD,WAAW,CAAC,UAAU;AACpB,kBAAI,CAAC,gBAAgB,IAAI,MAAM,GAAG,SAAS,gBAAA;AAAA,YAC7C;AAAA,YACA,eAAe,CAAC,UAAU,MAAM,gBAAA;AAAA,YAChC,aAAa,CAAC,UAAU,MAAM,gBAAA;AAAA,UAAgB;AAAA,QAAA;AAAA,MAChD;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
1
+ {"version":3,"file":"DropdownMenuHeader.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuHeader.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ArrowLeftIcon } from \"../Icons/ArrowLeftIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\nimport { SearchIcon } from \"../Icons/SearchIcon\";\nimport { DropdownMenuVariantContext, ToggleOpenContext } from \"./context\";\nimport { DropdownMenuSeparator } from \"./DropdownMenuItem\";\n\n// Keys that the menu must keep handling even when focus is inside a child\n// input — arrows move the highlight into the list, Tab leaves the menu, and\n// Enter / Escape close it.\nconst NAVIGATION_KEYS = new Set([\n \"ArrowDown\",\n \"ArrowUp\",\n \"ArrowLeft\",\n \"ArrowRight\",\n \"Escape\",\n \"Tab\",\n \"Enter\",\n]);\n\n/** Header type. `\"default\"` shows a title; `\"search\"` shows a search input. */\nexport type DropdownMenuHeaderType = \"default\" | \"search\";\n\n/** Header height preset. Matches the menu item sizing scale. */\nexport type DropdownMenuHeaderSize = \"40\" | \"32\";\n\n/** Search-input configuration for {@link DropdownMenuHeader} when `type=\"search\"`. */\nexport interface DropdownMenuHeaderSearchProps {\n /** Controlled value of the search input. */\n value?: string;\n /** Uncontrolled default value. */\n defaultValue?: string;\n /** Fires when the input value changes. */\n onChange?: (value: string) => void;\n /** Placeholder text shown when the input is empty. @default \"Search…\" */\n placeholder?: string;\n /** Accessible label for the search input. @default \"Search\" */\n \"aria-label\"?: string;\n /**\n * Focus the input as soon as the menu opens, so typing filters immediately.\n * Radix parks initial focus on the content element (which is what drives its\n * typeahead), so without this the first keystrokes never reach the input.\n */\n autoFocus?: boolean;\n}\n\nexport interface DropdownMenuHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Visual type. `\"default\"` shows a title; `\"search\"` shows a search input. @default \"default\" */\n type?: DropdownMenuHeaderType;\n /** Height preset for the header row. @default \"40\" */\n size?: DropdownMenuHeaderSize;\n /** Title text shown when `type=\"default\"`. Ignored if `children` is provided. */\n title?: string;\n /** Configuration for the embedded search input when `type=\"search\"`. */\n searchProps?: DropdownMenuHeaderSearchProps;\n /**\n * Action elements rendered at the end of the header row, before the close\n * button — e.g. icon buttons for search/add, or a primary \"Done\" button that\n * commits a {@link DropdownMenuReorderGroup} reorder. An action that should\n * close the menu needs the menu's `open` state controlled (only the built-in\n * close button can dismiss an uncontrolled menu).\n */\n actions?: React.ReactNode;\n /** Whether to render the close icon button on the right. @default true */\n showClose?: boolean;\n /** Fires when the close icon button is activated. */\n onClose?: () => void;\n /** Accessible label for the close button. @default \"Close menu\" */\n closeLabel?: string;\n /**\n * Fires when the back icon button at the start of the row is activated.\n * Rendering it lets a menu step back from a sub-view — a `type=\"search\"`\n * header returning to its title, for instance — without closing the menu.\n */\n onBack?: () => void;\n /** Whether to render the back icon button. @default `onBack !== undefined` */\n showBack?: boolean;\n /** Accessible label for the back button. @default \"Back\" */\n backLabel?: string;\n}\n\n/**\n * Optional header rendered at the top of a {@link DropdownMenuContent}. Use\n * `type=\"default\"` to title the menu, or `type=\"search\"` to embed a search\n * input for filtering long lists.\n *\n * Renders an inset separator beneath the row so it slots cleanly above the\n * first group of items.\n *\n * @example\n * ```tsx\n * <DropdownMenuContent>\n * <DropdownMenuHeader title=\"Sort by\" onClose={() => setOpen(false)} />\n * <DropdownMenuItem>Newest</DropdownMenuItem>\n * <DropdownMenuItem>Oldest</DropdownMenuItem>\n * </DropdownMenuContent>\n * ```\n */\nexport const DropdownMenuHeader = React.forwardRef<HTMLDivElement, DropdownMenuHeaderProps>(\n (\n {\n type = \"default\",\n size = \"40\",\n title,\n searchProps,\n actions,\n showClose = true,\n onClose,\n closeLabel = \"Close menu\",\n onBack,\n showBack = onBack !== undefined,\n backLabel = \"Back\",\n className,\n children,\n ...props\n },\n ref,\n ) => {\n // Regular, not semibold: `V2 Menu Header` titles the menu at\n // `Body Default 16px/Regular`. The weight belongs to the rows' own titles,\n // which is where the two-line layout puts a semibold.\n const titleTypography =\n size === \"32\" ? \"typography-body-small-14px-regular\" : \"typography-body-default-16px-regular\";\n const toggleOpen = React.useContext(ToggleOpenContext);\n const variant = React.useContext(DropdownMenuVariantContext);\n\n const handleClose = () => {\n onClose?.();\n // Also dismiss the Radix menu when used in uncontrolled mode — otherwise\n // the close button would look broken to consumers that don't wire up\n // `open` / `onOpenChange` themselves.\n toggleOpen?.(() => false);\n };\n\n return (\n <div\n ref={ref}\n className={cn(\n \"mb-1 flex flex-col px-1 pt-1\",\n // The insets in this header and its rule are measured against the\n // sheet's 4px panel padding. The popper panel pads 8px, so pull the\n // header back out by the extra 4px to land on the same positions.\n variant !== \"sheet\" && \"-mx-1 -mt-1\",\n // Search needs an 8px gap between the input and the divider; the\n // default (title) variant uses 4px because the title baseline sits\n // closer to the divider naturally.\n type === \"search\" ? \"gap-2\" : \"gap-1\",\n // With action buttons the design draws a roomier header: 12px above\n // the 32px actions row (the panel's own 4px padding makes up the\n // difference), 8px between it and the divider, and 8px between the\n // divider and the first row.\n actions != null && \"mb-2 gap-2 pt-2\",\n // The sheet is a taller, roomier surface than a trigger-anchored panel:\n // the design sets 16px between the rule and the first row, which this\n // margin plus the panel's own 4px gap adds up to.\n variant === \"sheet\" && \"mb-3\",\n className,\n )}\n {...props}\n >\n {/*\n * The title is inset a further 8px so it clears the panel's rounded\n * corner; the search input is not, because the design runs it to the\n * header's own padding (`V2 Menu Dropdown` node `7393:62008`: the search\n * row is `flex gap-16 w-full` with no inset, so the field sits 8px from\n * the panel edge on both sides). Insetting it left-only left the field\n * 16px in on the left and 8px on the right.\n */}\n <div\n className={cn(\n \"flex items-center gap-4\",\n // With action buttons the title sits a further 4px in (20px from\n // the panel edge) than the close-only header's 16px. A back button\n // supplies its own inset.\n type === \"default\" && !showBack && (actions != null ? \"pl-3\" : \"pl-2\"),\n )}\n >\n {showBack && (\n <div data-dropdown-menu-tab-stops=\"\" className=\"flex shrink-0 items-center\">\n <IconButton\n variant=\"tertiary\"\n size=\"32\"\n icon={<ArrowLeftIcon />}\n onClick={onBack}\n aria-label={backLabel}\n />\n </div>\n )}\n {type === \"default\" ? (\n <div className={cn(\"min-w-0 flex-1 truncate text-content-primary\", titleTypography)}>\n {children ?? title}\n </div>\n ) : (\n <SearchInput {...searchProps} />\n )}\n {(actions != null || showClose) && (\n // The extra right margin only applies with action buttons: filled\n // actions like a \"Done\" pill sit 12px off the panel edge, while the\n // bare tertiary close icon keeps the header's own 8px inset.\n <div\n data-dropdown-menu-tab-stops=\"\"\n className={cn(\"flex shrink-0 items-center gap-1\", actions != null && \"mr-1\")}\n >\n {actions}\n {showClose && (\n <IconButton\n variant=\"tertiary\"\n size=\"32\"\n icon={<CloseIcon />}\n onClick={handleClose}\n aria-label={closeLabel}\n />\n )}\n </div>\n )}\n </div>\n {/*\n * Full-bleed, as the design draws it: the rule runs the panel's whole\n * width rather than stopping at the text. `-mx-2` cancels both insets it\n * sits inside — this header's own `px-1` and the 4px of panel padding\n * left over after the header's `-mx-1` (or the sheet's own `p-1`).\n *\n * `Border/Primary` is the token the design binds to this rule. The\n * separator's own default is `neutral-alphas-200`, which in the dark theme\n * is a 20% *white* alpha — as a hairline running the full width it reads as\n * a white line rather than a divider. Group separators between items keep\n * the alpha; this is the header's rule only.\n */}\n <DropdownMenuSeparator className=\"-mx-2 my-0 bg-border-primary\" />\n </div>\n );\n },\n);\nDropdownMenuHeader.displayName = \"DropdownMenuHeader\";\n\nfunction SearchInput({\n value,\n defaultValue,\n onChange,\n placeholder = \"Search\\u2026\",\n \"aria-label\": ariaLabel = \"Search\",\n autoFocus,\n}: DropdownMenuHeaderSearchProps = {}) {\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n // Focus after mount rather than via the `autoFocus` attribute, so the focus\n // move is explicit and only happens when the consumer asked for it.\n React.useEffect(() => {\n if (autoFocus) inputRef.current?.focus();\n }, [autoFocus]);\n\n return (\n <label\n data-dropdown-menu-tab-stops=\"\"\n className={cn(\n // 16px, like the rows: the field sits 8px in from the panel's 24px\n // corner, so 24 − 8 keeps the two curves concentric.\n \"flex min-w-0 flex-1 items-center gap-2 rounded-md border border-border-primary\",\n \"bg-inputs-inputs-primary px-3 py-1 text-content-primary\",\n \"focus-within:shadow-focus-ring focus-within:outline-none\",\n )}\n >\n <SearchIcon className=\"size-4 shrink-0 text-content-primary\" aria-hidden=\"true\" />\n <input\n type=\"search\"\n className={cn(\n \"typography-body-default-16px-regular min-w-0 flex-1 bg-transparent outline-none\",\n \"placeholder:text-content-tertiary\",\n )}\n ref={inputRef}\n value={value}\n defaultValue={defaultValue}\n placeholder={placeholder}\n aria-label={ariaLabel}\n onChange={(event) => onChange?.(event.target.value)}\n // Radix DropdownMenu listens for keystrokes on Content for its\n // typeahead (typing letters jumps focus to a matching item). That\n // listener steals focus from the input after the first letter, so we\n // stop character keys from bubbling. Navigation keys (arrows / Tab /\n // Escape / Enter) are still allowed through so the user can leave the\n // input for the list or close the menu. Pointer events are stopped so\n // clicking back into the input doesn't fight the menu's focus\n // management either.\n onKeyDown={(event) => {\n if (!NAVIGATION_KEYS.has(event.key)) event.stopPropagation();\n }}\n onPointerDown={(event) => event.stopPropagation()}\n onMouseDown={(event) => event.stopPropagation()}\n />\n </label>\n );\n}\n"],"names":["React","ToggleOpenContext","DropdownMenuVariantContext","jsxs","cn","jsx","IconButton","ArrowLeftIcon","CloseIcon","DropdownMenuSeparator","SearchIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,sCAAsB,IAAI;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAgFM,MAAM,qBAAqBA,iBAAM;AAAA,EACtC,CACE;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AAIH,UAAM,kBACJ,SAAS,OAAO,uCAAuC;AACzD,UAAM,aAAaA,iBAAM,WAAWC,yBAAiB;AACrD,UAAM,UAAUD,iBAAM,WAAWE,kCAA0B;AAE3D,UAAM,cAAc,MAAM;AACxB,gBAAA;AAIA,mBAAa,MAAM,KAAK;AAAA,IAC1B;AAEA,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,GAAAA;AAAAA,UACT;AAAA;AAAA;AAAA;AAAA,UAIA,YAAY,WAAW;AAAA;AAAA;AAAA;AAAA,UAIvB,SAAS,WAA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81
  const itemClassName = cn.cn(
82
82
  // `text-start` because the sheet variant renders the row as a <button>,
83
83
  // whose UA-centred text misaligned it from the popper variant's rows.
84
- "group flex w-full cursor-pointer gap-2 rounded-xs px-3 text-start outline-none",
84
+ "group flex w-full cursor-pointer gap-2 rounded-md px-3 text-start outline-none",
85
85
  hasDescription ? "items-start" : "items-center",
86
86
  // The sheet's header runs the full width of the panel, so its rows have to
87
87
  // come in off the edge themselves — 12px here on the panel's own 4px is the
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenuItem.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuItem.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { DropdownMenuVariantContext, ToggleOpenContext } from \"./context\";\n\n/** Vertical placement of a {@link DropdownMenuLabel} within its group. */\nexport type DropdownMenuLabelPosition = \"default\" | \"top\";\n\n/** Props for the {@link DropdownMenuLabel} component. */\nexport interface DropdownMenuLabelProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> {\n /**\n * Vertical placement within the surrounding group. `\"top\"` is used for the\n * first label directly under a header; `\"default\"` adds extra top padding to\n * separate it from preceding items. @default \"default\"\n */\n position?: DropdownMenuLabelPosition;\n}\n\n/** A non-interactive label that groups related items within a menu. */\nexport const DropdownMenuLabel = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Label>,\n DropdownMenuLabelProps\n>(({ className, position = \"default\", ...props }, ref) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const labelClassName = cn(\n \"typography-description-12px-regular flex items-center px-3 text-content-secondary\",\n position === \"top\" ? \"py-2\" : \"pt-4 pb-2\",\n className,\n );\n\n // DropdownMenuPrimitive.Label requires Radix menu context, unavailable when\n // the sheet variant renders inside a Drawer (Dialog) instead.\n if (variant === \"sheet\") {\n return <div ref={ref} className={labelClassName} {...props} />;\n }\n\n return <DropdownMenuPrimitive.Label ref={ref} className={labelClassName} {...props} />;\n});\nDropdownMenuLabel.displayName = \"DropdownMenuLabel\";\n\n/**\n * Height preset for a dropdown menu item.\n *\n * `\"40\"` (default) and `\"32\"` are the v2 numeric tokens that mirror the Figma\n * design system. `\"sm\"` and `\"md\"` are deprecated aliases retained for\n * backwards compatibility — `\"sm\"` maps to `\"32\"`, `\"md\"` maps to `\"40\"`.\n */\nexport type DropdownMenuItemSize =\n | \"40\"\n | \"32\"\n /** @deprecated Use `\"32\"` instead. */\n | \"sm\"\n /** @deprecated Use `\"40\"` instead. */\n | \"md\";\n\nconst SIZE_NORMALIZED: Record<DropdownMenuItemSize, \"40\" | \"32\"> = {\n \"40\": \"40\",\n md: \"40\",\n \"32\": \"32\",\n sm: \"32\",\n};\n\nconst ITEM_SIZE_CLASSES: Record<\"40\" | \"32\", string> = {\n \"40\": \"min-h-10 py-2 typography-body-default-16px-regular\",\n \"32\": \"min-h-8 py-[7px] typography-body-small-14px-regular\",\n};\n\n/*\n * 14px at both heights. `V2 Menu Item` draws the count as `Body Small 14px/Regular`\n * in `content-tertiary` (node `21542:8629`), and the 40 row previously stepped up to\n * 16px — which also put the count's line box at 24px against the two-line layout's\n * 18px title leading.\n *\n * Only the 40 row is drawn in Figma: the component set's variants are Type and State\n * with no size axis. The 32 row is ours, and 14px matches the body type it already\n * uses, so both entries agree by construction rather than by design reference.\n */\nconst ITEM_COUNT_TYPOGRAPHY: Record<\"40\" | \"32\", string> = {\n \"40\": \"typography-body-small-14px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nconst ITEM_SELECTED_TYPOGRAPHY: Record<\"40\" | \"32\", string> = {\n \"40\": \"typography-body-default-16px-semibold\",\n \"32\": \"typography-body-small-14px-semibold\",\n};\n\nexport interface DropdownMenuItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> {\n /** Height of the menu item row. @default \"40\" */\n size?: DropdownMenuItemSize;\n /** Applies the destructive (error) treatment. Use for irreversible actions. @default false */\n destructive?: boolean;\n /** Icon (or other node) rendered before the label. Ignored when {@link DropdownMenuItemProps.avatar} is set. */\n leadingIcon?: React.ReactNode;\n /**\n * Leading avatar rendered in place of {@link DropdownMenuItemProps.leadingIcon},\n * for rows that represent a person or account. Pass an `Avatar` sized to `24`.\n * Takes precedence over `leadingIcon`.\n */\n avatar?: React.ReactNode;\n /**\n * Icon (or other node) rendered after the label.\n */\n trailingIcon?: React.ReactNode;\n /** Trailing count or number (e.g. an unread total) rendered before {@link DropdownMenuItemProps.trailingIcon}. */\n count?: React.ReactNode;\n /**\n * Optional secondary text rendered on a second line below the label. When\n * provided, the row switches to a two-line layout and the leading/trailing\n * icons align to the title line (top) rather than the row's vertical centre.\n */\n description?: React.ReactNode;\n /** Marks the item as the current selection in a single-select menu. @default false */\n selected?: boolean;\n}\n\n/**\n * An individual item within a {@link DropdownMenuContent}.\n *\n * @example\n * ```tsx\n * <DropdownMenuItem>Edit profile</DropdownMenuItem>\n * <DropdownMenuItem destructive>Delete</DropdownMenuItem>\n * <DropdownMenuItem leadingIcon={<EditIcon />}>Edit</DropdownMenuItem>\n *\n * // Feature-rich row with an avatar and a trailing count\n * <DropdownMenuItem avatar={<Avatar size={24} src={src} />} count=\"12\">\n * Jane Doe\n * </DropdownMenuItem>\n *\n * // As a link\n * <DropdownMenuItem asChild>\n * <a href=\"/settings\">Settings</a>\n * </DropdownMenuItem>\n * ```\n */\nexport const DropdownMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\n DropdownMenuItemProps\n>(\n (\n {\n size = \"40\",\n destructive,\n leadingIcon,\n avatar,\n trailingIcon,\n count,\n description,\n selected,\n className,\n children,\n asChild,\n onSelect,\n disabled,\n ...props\n },\n ref,\n ) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const toggleOpen = React.useContext(ToggleOpenContext);\n const normalizedSize = SIZE_NORMALIZED[size];\n const hasDescription = description != null;\n const hasAvatar = avatar != null;\n const itemClassName = cn(\n // `text-start` because the sheet variant renders the row as a <button>,\n // whose UA-centred text misaligned it from the popper variant's rows.\n \"group flex w-full cursor-pointer gap-2 rounded-xs px-3 text-start outline-none\",\n hasDescription ? \"items-start\" : \"items-center\",\n // The sheet's header runs the full width of the panel, so its rows have to\n // come in off the edge themselves — 12px here on the panel's own 4px is the\n // design's 16px. `w-auto` lets the column stretch them to the space left\n // over; `w-full` plus a margin would overflow.\n variant === \"sheet\" && \"mx-3 w-auto\",\n ITEM_SIZE_CLASSES[normalizedSize],\n // A 24px avatar would push the compact 32px row past its height with the\n // default padding; tighten it so the avatar variant keeps the 32px contract.\n hasAvatar && !hasDescription && normalizedSize === \"32\" && \"py-1\",\n \"data-[highlighted]:bg-neutral-alphas-50\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n \"disabled:cursor-not-allowed disabled:text-content-disabled\",\n // Sheet-variant asChild items are marked disabled via aria-disabled\n // (see below), not the native disabled attribute or Radix's\n // data-disabled — neither selector above matches them.\n \"aria-disabled:cursor-not-allowed aria-disabled:text-content-disabled\",\n destructive && \"text-error-content\",\n // `V2 Menu Item` Selected: a `Buttons/Primary/Default` fill with semibold\n // `Content/Primary Inverted` text. The highlighted override keeps the fill\n // when the row is also hovered or keyboard-focused.\n selected && [\n \"bg-buttons-primary-default text-content-primary-inverted data-[highlighted]:bg-buttons-primary-default\",\n !hasDescription && ITEM_SELECTED_TYPOGRAPHY[normalizedSize],\n ],\n className,\n );\n\n // In the two-line (description) layout everything beside the title sits on\n // the title's line, not the centre of the two-line block. A box the height of\n // that line centres each sibling on it whatever its own size — a 16px icon, a\n // 24px avatar, or the count's larger text box. The height is the title's, from\n // `typography-body-small-14px-semibold`; a `pt-*` nudge cannot do this because\n // the correct offset differs per sibling, and the previous `pt-1` was computed\n // against the single-line title's 24px leading, leaving all four 3px low.\n const iconAlignClassName = hasDescription ? \"flex h-[18px] shrink-0 items-center\" : null;\n\n const countNode = count != null && (\n <span\n className={cn(\n \"shrink-0 tabular-nums\",\n iconAlignClassName,\n ITEM_COUNT_TYPOGRAPHY[normalizedSize],\n destructive\n ? \"text-error-content\"\n : selected\n ? \"text-content-primary-inverted\"\n : \"text-content-tertiary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {count}\n </span>\n );\n\n const trailingNode =\n trailingIcon != null &&\n (hasDescription ? <span className={iconAlignClassName!}>{trailingIcon}</span> : trailingIcon);\n\n const itemChildren = (\n <>\n {avatar != null ? (\n <span className={cn(\"shrink-0\", iconAlignClassName)}>{avatar}</span>\n ) : (\n leadingIcon != null &&\n (hasDescription ? (\n <span className={iconAlignClassName!}>{leadingIcon}</span>\n ) : (\n leadingIcon\n ))\n )}\n {hasDescription ? (\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n {/*\n * The two-line row sets its own title type rather than inheriting the\n * row's: `V2 Menu Item` pairs a 14px semibold title with the 14px\n * regular description below it, where a single-line row's title is the\n * size's own 16px regular. It also settles the row's height — 18 + 2 +\n * 18 of text inside `py-2` is the design's 54px.\n */}\n <span className=\"typography-body-small-14px-semibold truncate\">{children}</span>\n <span\n className={cn(\n \"typography-body-small-14px-regular truncate\",\n selected ? \"text-content-primary-inverted\" : \"text-content-secondary\",\n )}\n >\n {description}\n </span>\n </span>\n ) : (\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n )}\n {countNode}\n {trailingNode}\n </>\n );\n\n // The sheet variant renders inside a Drawer (Dialog), not a Radix menu, so\n // DropdownMenuPrimitive.Item (which requires menu context) can't be used —\n // render a plain option element with equivalent selection semantics instead.\n // asChild goes through the same Slot primitive Radix's own Item uses\n // internally, so a custom element (e.g. a link) gets the option\n // role/handlers merged onto it without needing menu context.\n if (variant === \"sheet\") {\n const Comp = asChild ? Slot : \"button\";\n // Pull the consumer's onClick out of the passthrough spread so the\n // handler below can compose with it instead of the spread order\n // silently overwriting it (an explicit onClick after {...props} always\n // wins over the spread's).\n const { onClick: consumerOnClick, ...restProps } =\n props as React.ComponentPropsWithoutRef<\"button\">;\n const sheetSpecificProps = !asChild\n ? { type: \"button\" as const, disabled }\n : disabled\n ? { \"aria-disabled\": true }\n : {};\n return (\n <Comp\n ref={ref as React.Ref<HTMLButtonElement>}\n {...restProps}\n {...sheetSpecificProps}\n role=\"option\"\n aria-selected={selected}\n className={itemClassName}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n // A native <button disabled> already blocks its click event, but\n // asChild's element (e.g. a link) has no such enforcement — guard\n // explicitly, and prevent the click's default action (e.g. anchor\n // navigation) since aria-disabled alone doesn't stop it.\n if (disabled) {\n event.preventDefault();\n return;\n }\n consumerOnClick?.(event);\n if (event.defaultPrevented) return;\n // Pass the real native event through, not a fake partial shape —\n // handlers that call any Event API beyond preventDefault (e.g.\n // stopPropagation, composedPath) need it to actually exist. It's\n // still live (currentTarget/target are valid) since we're inside\n // the same synchronous click handler that produced it.\n onSelect?.(event.nativeEvent);\n if (!event.nativeEvent.defaultPrevented) toggleOpen?.(() => false);\n }}\n >\n {asChild ? children : itemChildren}\n </Comp>\n );\n }\n\n if (asChild) {\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n asChild\n className={itemClassName}\n disabled={disabled}\n onSelect={onSelect}\n {...props}\n >\n {children}\n </DropdownMenuPrimitive.Item>\n );\n }\n\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={itemClassName}\n disabled={disabled}\n onSelect={onSelect}\n {...props}\n >\n {itemChildren}\n </DropdownMenuPrimitive.Item>\n );\n },\n);\nDropdownMenuItem.displayName = \"DropdownMenuItem\";\n\n/** Props for the {@link DropdownMenuSeparator} component. */\nexport interface DropdownMenuSeparatorProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator> {}\n\n/** Visual separator between groups of items. */\nexport const DropdownMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,\n DropdownMenuSeparatorProps\n>(({ className, ...props }, ref) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const separatorClassName = cn(\"my-1 h-px bg-neutral-alphas-200\", className);\n\n // DropdownMenuPrimitive.Separator requires Radix menu context, unavailable\n // when the sheet variant renders inside a Drawer (Dialog) instead. <hr> is a\n // native separator, so it needs no ARIA role.\n if (variant === \"sheet\") {\n return <hr ref={ref as React.Ref<HTMLHRElement>} className={separatorClassName} {...props} />;\n }\n\n return <DropdownMenuPrimitive.Separator ref={ref} className={separatorClassName} {...props} />;\n});\nDropdownMenuSeparator.displayName = \"DropdownMenuSeparator\";\n"],"names":["React","DropdownMenuVariantContext","cn","jsx","DropdownMenuPrimitive","ToggleOpenContext","jsxs","Fragment","Slot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,oBAAoBA,iBAAM,WAGrC,CAAC,EAAE,WAAW,WAAW,WAAW,GAAG,MAAA,GAAS,QAAQ;AACxD,QAAM,UAAUA,iBAAM,WAAWC,kCAA0B;AAC3D,QAAM,iBAAiBC,GAAAA;AAAAA,IACrB;AAAA,IACA,aAAa,QAAQ,SAAS;AAAA,IAC9B;AAAA,EAAA;AAKF,MAAI,YAAY,SAAS;AACvB,0CAAQ,OAAA,EAAI,KAAU,WAAW,gBAAiB,GAAG,OAAO;AAAA,EAC9D;AAEA,SAAOC,2BAAAA,IAACC,iCAAsB,OAAtB,EAA4B,KAAU,WAAW,gBAAiB,GAAG,OAAO;AACtF,CAAC;AACD,kBAAkB,cAAc;AAiBhC,MAAM,kBAA6D;AAAA,EACjE,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,IAAI;AACN;AAEA,MAAM,oBAAiD;AAAA,EACrD,MAAM;AAAA,EACN,MAAM;AACR;AAYA,MAAM,wBAAqD;AAAA,EACzD,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,2BAAwD;AAAA,EAC5D,MAAM;AAAA,EACN,MAAM;AACR;AAoDO,MAAM,mBAAmBJ,iBAAM;AAA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AAI,SAAS;AACX,aACEA,2BAAAA;AAAAA,QAACC,iCAAsB;AAAA,QAAtB;AAAA,UACC;AAAA,UACA,SAAO;AAAA,UACP,WAAW;AAAA,UACX;AAAA,UACA;AAAA,UACC,GAAG;AAAA,UAEH;AAAA,QAAA;AAAA,MAAA;AAAA,IAGP;AAEA,WACED,2BAAAA;AAAAA,MAACC,iCAAsB;AAAA,MAAtB;AAAA,QACC;AAAA,QACA,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QAEH,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,iBAAiB,cAAc;AAOxB,MAAM,wBAAwBJ,iBAAM,WAGzC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAAQ;AAClC,QAAM,UAAUA,iBAAM,WAAWC,kCAA0B;AAC3D,QAAM,qBAAqBC,GAAAA,GAAG,mCAAmC,SAAS;AAK1E,MAAI,YAAY,SAAS;AACvB,0CAAQ,MAAA,EAAG,KAAsC,WAAW,oBAAqB,GAAG,OAAO;AAAA,EAC7F;AAEA,SAAOC,2BAAAA,IAACC,iCAAsB,WAAtB,EAAgC,KAAU,WAAW,oBAAqB,GAAG,OAAO;AAC9F,CAAC;AACD,sBAAsB,cAAc;;;;"}
1
+ {"version":3,"file":"DropdownMenuItem.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuItem.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { DropdownMenuVariantContext, ToggleOpenContext } from \"./context\";\n\n/** Vertical placement of a {@link DropdownMenuLabel} within its group. */\nexport type DropdownMenuLabelPosition = \"default\" | \"top\";\n\n/** Props for the {@link DropdownMenuLabel} component. */\nexport interface DropdownMenuLabelProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> {\n /**\n * Vertical placement within the surrounding group. `\"top\"` is used for the\n * first label directly under a header; `\"default\"` adds extra top padding to\n * separate it from preceding items. @default \"default\"\n */\n position?: DropdownMenuLabelPosition;\n}\n\n/** A non-interactive label that groups related items within a menu. */\nexport const DropdownMenuLabel = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Label>,\n DropdownMenuLabelProps\n>(({ className, position = \"default\", ...props }, ref) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const labelClassName = cn(\n \"typography-description-12px-regular flex items-center px-3 text-content-secondary\",\n position === \"top\" ? \"py-2\" : \"pt-4 pb-2\",\n className,\n );\n\n // DropdownMenuPrimitive.Label requires Radix menu context, unavailable when\n // the sheet variant renders inside a Drawer (Dialog) instead.\n if (variant === \"sheet\") {\n return <div ref={ref} className={labelClassName} {...props} />;\n }\n\n return <DropdownMenuPrimitive.Label ref={ref} className={labelClassName} {...props} />;\n});\nDropdownMenuLabel.displayName = \"DropdownMenuLabel\";\n\n/**\n * Height preset for a dropdown menu item.\n *\n * `\"40\"` (default) and `\"32\"` are the v2 numeric tokens that mirror the Figma\n * design system. `\"sm\"` and `\"md\"` are deprecated aliases retained for\n * backwards compatibility — `\"sm\"` maps to `\"32\"`, `\"md\"` maps to `\"40\"`.\n */\nexport type DropdownMenuItemSize =\n | \"40\"\n | \"32\"\n /** @deprecated Use `\"32\"` instead. */\n | \"sm\"\n /** @deprecated Use `\"40\"` instead. */\n | \"md\";\n\nconst SIZE_NORMALIZED: Record<DropdownMenuItemSize, \"40\" | \"32\"> = {\n \"40\": \"40\",\n md: \"40\",\n \"32\": \"32\",\n sm: \"32\",\n};\n\nconst ITEM_SIZE_CLASSES: Record<\"40\" | \"32\", string> = {\n \"40\": \"min-h-10 py-2 typography-body-default-16px-regular\",\n \"32\": \"min-h-8 py-[7px] typography-body-small-14px-regular\",\n};\n\n/*\n * 14px at both heights. `V2 Menu Item` draws the count as `Body Small 14px/Regular`\n * in `content-tertiary` (node `21542:8629`), and the 40 row previously stepped up to\n * 16px — which also put the count's line box at 24px against the two-line layout's\n * 18px title leading.\n *\n * Only the 40 row is drawn in Figma: the component set's variants are Type and State\n * with no size axis. The 32 row is ours, and 14px matches the body type it already\n * uses, so both entries agree by construction rather than by design reference.\n */\nconst ITEM_COUNT_TYPOGRAPHY: Record<\"40\" | \"32\", string> = {\n \"40\": \"typography-body-small-14px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nconst ITEM_SELECTED_TYPOGRAPHY: Record<\"40\" | \"32\", string> = {\n \"40\": \"typography-body-default-16px-semibold\",\n \"32\": \"typography-body-small-14px-semibold\",\n};\n\nexport interface DropdownMenuItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> {\n /** Height of the menu item row. @default \"40\" */\n size?: DropdownMenuItemSize;\n /** Applies the destructive (error) treatment. Use for irreversible actions. @default false */\n destructive?: boolean;\n /** Icon (or other node) rendered before the label. Ignored when {@link DropdownMenuItemProps.avatar} is set. */\n leadingIcon?: React.ReactNode;\n /**\n * Leading avatar rendered in place of {@link DropdownMenuItemProps.leadingIcon},\n * for rows that represent a person or account. Pass an `Avatar` sized to `24`.\n * Takes precedence over `leadingIcon`.\n */\n avatar?: React.ReactNode;\n /**\n * Icon (or other node) rendered after the label.\n */\n trailingIcon?: React.ReactNode;\n /** Trailing count or number (e.g. an unread total) rendered before {@link DropdownMenuItemProps.trailingIcon}. */\n count?: React.ReactNode;\n /**\n * Optional secondary text rendered on a second line below the label. When\n * provided, the row switches to a two-line layout and the leading/trailing\n * icons align to the title line (top) rather than the row's vertical centre.\n */\n description?: React.ReactNode;\n /** Marks the item as the current selection in a single-select menu. @default false */\n selected?: boolean;\n}\n\n/**\n * An individual item within a {@link DropdownMenuContent}.\n *\n * @example\n * ```tsx\n * <DropdownMenuItem>Edit profile</DropdownMenuItem>\n * <DropdownMenuItem destructive>Delete</DropdownMenuItem>\n * <DropdownMenuItem leadingIcon={<EditIcon />}>Edit</DropdownMenuItem>\n *\n * // Feature-rich row with an avatar and a trailing count\n * <DropdownMenuItem avatar={<Avatar size={24} src={src} />} count=\"12\">\n * Jane Doe\n * </DropdownMenuItem>\n *\n * // As a link\n * <DropdownMenuItem asChild>\n * <a href=\"/settings\">Settings</a>\n * </DropdownMenuItem>\n * ```\n */\nexport const DropdownMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\n DropdownMenuItemProps\n>(\n (\n {\n size = \"40\",\n destructive,\n leadingIcon,\n avatar,\n trailingIcon,\n count,\n description,\n selected,\n className,\n children,\n asChild,\n onSelect,\n disabled,\n ...props\n },\n ref,\n ) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const toggleOpen = React.useContext(ToggleOpenContext);\n const normalizedSize = SIZE_NORMALIZED[size];\n const hasDescription = description != null;\n const hasAvatar = avatar != null;\n const itemClassName = cn(\n // `text-start` because the sheet variant renders the row as a <button>,\n // whose UA-centred text misaligned it from the popper variant's rows.\n \"group flex w-full cursor-pointer gap-2 rounded-md px-3 text-start outline-none\",\n hasDescription ? \"items-start\" : \"items-center\",\n // The sheet's header runs the full width of the panel, so its rows have to\n // come in off the edge themselves — 12px here on the panel's own 4px is the\n // design's 16px. `w-auto` lets the column stretch them to the space left\n // over; `w-full` plus a margin would overflow.\n variant === \"sheet\" && \"mx-3 w-auto\",\n ITEM_SIZE_CLASSES[normalizedSize],\n // A 24px avatar would push the compact 32px row past its height with the\n // default padding; tighten it so the avatar variant keeps the 32px contract.\n hasAvatar && !hasDescription && normalizedSize === \"32\" && \"py-1\",\n \"data-[highlighted]:bg-neutral-alphas-50\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n \"disabled:cursor-not-allowed disabled:text-content-disabled\",\n // Sheet-variant asChild items are marked disabled via aria-disabled\n // (see below), not the native disabled attribute or Radix's\n // data-disabled — neither selector above matches them.\n \"aria-disabled:cursor-not-allowed aria-disabled:text-content-disabled\",\n destructive && \"text-error-content\",\n // `V2 Menu Item` Selected: a `Buttons/Primary/Default` fill with semibold\n // `Content/Primary Inverted` text. The highlighted override keeps the fill\n // when the row is also hovered or keyboard-focused.\n selected && [\n \"bg-buttons-primary-default text-content-primary-inverted data-[highlighted]:bg-buttons-primary-default\",\n !hasDescription && ITEM_SELECTED_TYPOGRAPHY[normalizedSize],\n ],\n className,\n );\n\n // In the two-line (description) layout everything beside the title sits on\n // the title's line, not the centre of the two-line block. A box the height of\n // that line centres each sibling on it whatever its own size — a 16px icon, a\n // 24px avatar, or the count's larger text box. The height is the title's, from\n // `typography-body-small-14px-semibold`; a `pt-*` nudge cannot do this because\n // the correct offset differs per sibling, and the previous `pt-1` was computed\n // against the single-line title's 24px leading, leaving all four 3px low.\n const iconAlignClassName = hasDescription ? \"flex h-[18px] shrink-0 items-center\" : null;\n\n const countNode = count != null && (\n <span\n className={cn(\n \"shrink-0 tabular-nums\",\n iconAlignClassName,\n ITEM_COUNT_TYPOGRAPHY[normalizedSize],\n destructive\n ? \"text-error-content\"\n : selected\n ? \"text-content-primary-inverted\"\n : \"text-content-tertiary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {count}\n </span>\n );\n\n const trailingNode =\n trailingIcon != null &&\n (hasDescription ? <span className={iconAlignClassName!}>{trailingIcon}</span> : trailingIcon);\n\n const itemChildren = (\n <>\n {avatar != null ? (\n <span className={cn(\"shrink-0\", iconAlignClassName)}>{avatar}</span>\n ) : (\n leadingIcon != null &&\n (hasDescription ? (\n <span className={iconAlignClassName!}>{leadingIcon}</span>\n ) : (\n leadingIcon\n ))\n )}\n {hasDescription ? (\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n {/*\n * The two-line row sets its own title type rather than inheriting the\n * row's: `V2 Menu Item` pairs a 14px semibold title with the 14px\n * regular description below it, where a single-line row's title is the\n * size's own 16px regular. It also settles the row's height — 18 + 2 +\n * 18 of text inside `py-2` is the design's 54px.\n */}\n <span className=\"typography-body-small-14px-semibold truncate\">{children}</span>\n <span\n className={cn(\n \"typography-body-small-14px-regular truncate\",\n selected ? \"text-content-primary-inverted\" : \"text-content-secondary\",\n )}\n >\n {description}\n </span>\n </span>\n ) : (\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n )}\n {countNode}\n {trailingNode}\n </>\n );\n\n // The sheet variant renders inside a Drawer (Dialog), not a Radix menu, so\n // DropdownMenuPrimitive.Item (which requires menu context) can't be used —\n // render a plain option element with equivalent selection semantics instead.\n // asChild goes through the same Slot primitive Radix's own Item uses\n // internally, so a custom element (e.g. a link) gets the option\n // role/handlers merged onto it without needing menu context.\n if (variant === \"sheet\") {\n const Comp = asChild ? Slot : \"button\";\n // Pull the consumer's onClick out of the passthrough spread so the\n // handler below can compose with it instead of the spread order\n // silently overwriting it (an explicit onClick after {...props} always\n // wins over the spread's).\n const { onClick: consumerOnClick, ...restProps } =\n props as React.ComponentPropsWithoutRef<\"button\">;\n const sheetSpecificProps = !asChild\n ? { type: \"button\" as const, disabled }\n : disabled\n ? { \"aria-disabled\": true }\n : {};\n return (\n <Comp\n ref={ref as React.Ref<HTMLButtonElement>}\n {...restProps}\n {...sheetSpecificProps}\n role=\"option\"\n aria-selected={selected}\n className={itemClassName}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n // A native <button disabled> already blocks its click event, but\n // asChild's element (e.g. a link) has no such enforcement — guard\n // explicitly, and prevent the click's default action (e.g. anchor\n // navigation) since aria-disabled alone doesn't stop it.\n if (disabled) {\n event.preventDefault();\n return;\n }\n consumerOnClick?.(event);\n if (event.defaultPrevented) return;\n // Pass the real native event through, not a fake partial shape —\n // handlers that call any Event API beyond preventDefault (e.g.\n // stopPropagation, composedPath) need it to actually exist. It's\n // still live (currentTarget/target are valid) since we're inside\n // the same synchronous click handler that produced it.\n onSelect?.(event.nativeEvent);\n if (!event.nativeEvent.defaultPrevented) toggleOpen?.(() => false);\n }}\n >\n {asChild ? children : itemChildren}\n </Comp>\n );\n }\n\n if (asChild) {\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n asChild\n className={itemClassName}\n disabled={disabled}\n onSelect={onSelect}\n {...props}\n >\n {children}\n </DropdownMenuPrimitive.Item>\n );\n }\n\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={itemClassName}\n disabled={disabled}\n onSelect={onSelect}\n {...props}\n >\n {itemChildren}\n </DropdownMenuPrimitive.Item>\n );\n },\n);\nDropdownMenuItem.displayName = \"DropdownMenuItem\";\n\n/** Props for the {@link DropdownMenuSeparator} component. */\nexport interface DropdownMenuSeparatorProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator> {}\n\n/** Visual separator between groups of items. */\nexport const DropdownMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,\n DropdownMenuSeparatorProps\n>(({ className, ...props }, ref) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const separatorClassName = cn(\"my-1 h-px bg-neutral-alphas-200\", className);\n\n // DropdownMenuPrimitive.Separator requires Radix menu context, unavailable\n // when the sheet variant renders inside a Drawer (Dialog) instead. <hr> is a\n // native separator, so it needs no ARIA role.\n if (variant === \"sheet\") {\n return <hr ref={ref as React.Ref<HTMLHRElement>} className={separatorClassName} {...props} />;\n }\n\n return <DropdownMenuPrimitive.Separator ref={ref} className={separatorClassName} {...props} />;\n});\nDropdownMenuSeparator.displayName = \"DropdownMenuSeparator\";\n"],"names":["React","DropdownMenuVariantContext","cn","jsx","DropdownMenuPrimitive","ToggleOpenContext","jsxs","Fragment","Slot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,oBAAoBA,iBAAM,WAGrC,CAAC,EAAE,WAAW,WAAW,WAAW,GAAG,MAAA,GAAS,QAAQ;AACxD,QAAM,UAAUA,iBAAM,WAAWC,kCAA0B;AAC3D,QAAM,iBAAiBC,GAAAA;AAAAA,IACrB;AAAA,IACA,aAAa,QAAQ,SAAS;AAAA,IAC9B;AAAA,EAAA;AAKF,MAAI,YAAY,SAAS;AACvB,0CAAQ,OA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O;AAC9F,CAAC;AACD,sBAAsB,cAAc;;;;"}
@@ -63,7 +63,7 @@ function ReorderGhost({
63
63
  ref: registerGhost,
64
64
  className: "pointer-events-none fixed top-0 left-0 will-change-transform",
65
65
  style: { width: lifted.width, zIndex: lifted.zIndex },
66
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-sm bg-surface-primary/65 backdrop-blur-[20px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "typography-body-small-14px-regular flex min-h-10 items-center gap-2 bg-neutral-alphas-100 py-2 pr-6 pl-3 text-content-primary", children: [
66
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-md bg-surface-primary/65 backdrop-blur-[20px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "typography-body-small-14px-regular flex min-h-10 items-center gap-2 bg-neutral-alphas-100 py-2 pr-6 pl-3 text-content-primary", children: [
67
67
  /* @__PURE__ */ jsxRuntime.jsx(reorderShared.DragHandleDots, { className: "size-4 shrink-0 text-icons-tertiary" }),
68
68
  children
69
69
  ] }) })
@@ -123,7 +123,7 @@ const DropdownMenuReorderItem = React__namespace.forwardRef(
123
123
  ref: setElement,
124
124
  "data-dragging": isLifted || void 0,
125
125
  className: cn.cn(
126
- "typography-body-small-14px-regular group relative flex min-h-10 w-full select-none items-center gap-2 rounded-sm px-3 py-2 text-content-primary",
126
+ "typography-body-small-14px-regular group relative flex min-h-10 w-full select-none items-center gap-2 rounded-md px-3 py-2 text-content-primary",
127
127
  variant === "sheet" && "mx-3 w-auto",
128
128
  rowStateClasses,
129
129
  className
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenuReorderItem.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuReorderItem.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../../utils/cn\";\nimport { DropdownMenuVariantContext } from \"./context\";\nimport {\n DragHandleDots,\n type ReorderActions,\n ReorderActionsContext,\n type ReorderLifted,\n ReorderLiftedContext,\n} from \"./reorderShared\";\n\nconst INTERACTIVE_CONTROL_SELECTOR = 'button, a[href], input, select, textarea, [role=\"button\"]';\n\n// A drag starts from a primary mouse button anywhere on the row — except on\n// another control inside it (a `trailing` action, say), which keeps its click\n// and focus — or from the drag handle only for touch/pen, so the rest of the\n// row still scrolls a long menu with a finger.\nfunction canStartReorderDrag(event: React.PointerEvent, handle: HTMLElement | null): boolean {\n if (event.defaultPrevented || !(event.target instanceof Element)) return false;\n const onHandle = handle?.contains(event.target) === true;\n if (event.pointerType !== \"mouse\") return onHandle;\n if (event.button !== 0) return false;\n return onHandle || event.target.closest(INTERACTIVE_CONTROL_SELECTOR) === null;\n}\n\n// pointerdown's preventDefault (needed to stop text selection) also suppresses\n// focus, so a plain click on the grip focuses it here — ArrowUp/Down then work.\nfunction focusHandleAfterClick(event: React.PointerEvent, handle: HTMLElement | null): void {\n if (handle !== null && event.target instanceof Node && handle.contains(event.target)) {\n handle.focus({ preventScroll: true });\n }\n}\n// Icon, label and trailing slot of a row — rendered once in the row itself and\n// again inside its floating copy while lifted.\nfunction ReorderRowContent({\n leadingIcon,\n trailing,\n children,\n}: Pick<DropdownMenuReorderItemProps, \"leadingIcon\" | \"trailing\" | \"children\">) {\n return (\n <>\n {leadingIcon != null && <span className=\"shrink-0\">{leadingIcon}</span>}\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n {trailing != null && <span className=\"shrink-0\">{trailing}</span>}\n </>\n );\n}\n\n// The floating copy of a lifted row. Anchored at the viewport origin and moved\n// with a transform (see the group's positionGhost) so each pointer move is\n// compositor work only.\nfunction ReorderGhost({\n lifted,\n registerGhost,\n container,\n children,\n}: {\n lifted: ReorderLifted;\n registerGhost: ReorderActions[\"registerGhost\"];\n container: Element;\n children: React.ReactNode;\n}) {\n return createPortal(\n <div\n aria-hidden=\"true\"\n data-reorder-ghost=\"\"\n ref={registerGhost}\n className=\"pointer-events-none fixed top-0 left-0 will-change-transform\"\n style={{ width: lifted.width, zIndex: lifted.zIndex }}\n >\n {/*\n * The design draws the floating copy as frosted glass — a translucent\n * surface with a heavy backdrop blur and no drop shadow (the same\n * treatment the panel itself gets) — so what the ghost passes over\n * smears through it.\n */}\n <div className=\"overflow-hidden rounded-sm bg-surface-primary/65 backdrop-blur-[20px]\">\n <div className=\"typography-body-small-14px-regular flex min-h-10 items-center gap-2 bg-neutral-alphas-100 py-2 pr-6 pl-3 text-content-primary\">\n <DragHandleDots className=\"size-4 shrink-0 text-icons-tertiary\" />\n {children}\n </div>\n </div>\n </div>,\n container,\n );\n}\n\n/** Props for the {@link DropdownMenuReorderItem} component. */\nexport interface DropdownMenuReorderItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value identifying this item within the parent group's `values`. */\n value: string;\n /**\n * Plain-text name used in the group's screen-reader announcements and\n * reported in `onReorder`'s detail. Defaults to `children` when that is a\n * string or number, then to `value` — so pass it whenever `value` is an id.\n */\n label?: string;\n /** Icon (or other node) rendered between the drag handle and the label. */\n leadingIcon?: React.ReactNode;\n /** Content rendered at the end of the row, e.g. an item count. */\n trailing?: React.ReactNode;\n /** Accessible label for the drag handle button. @default \"Reorder\" */\n dragHandleLabel?: string;\n /** Disables dragging and keyboard reordering for this item. @default false */\n disabled?: boolean;\n}\n\n/**\n * A draggable row within a {@link DropdownMenuReorderGroup}. Shows the drag\n * handle grip, dims in place while its floating copy follows the pointer, and\n * supports ArrowUp/ArrowDown reordering when the handle has focus.\n */\nexport const DropdownMenuReorderItem = React.forwardRef<\n HTMLDivElement,\n DropdownMenuReorderItemProps\n>(\n (\n {\n value,\n label,\n leadingIcon,\n trailing,\n dragHandleLabel = \"Reorder\",\n disabled,\n className,\n children,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n ...props\n },\n ref,\n ) => {\n const actions = React.useContext(ReorderActionsContext);\n const lifted = React.useContext(ReorderLiftedContext);\n const variant = React.useContext(DropdownMenuVariantContext);\n const elementRef = React.useRef<HTMLDivElement | null>(null);\n const handleRef = React.useRef<HTMLButtonElement | null>(null);\n const liftedHere = lifted !== null && lifted.value === value ? lifted : null;\n const isLifted = liftedHere !== null;\n const resolvedLabel =\n label ??\n (typeof children === \"string\" || typeof children === \"number\" ? String(children) : value);\n const grabCursor = isLifted ? \"cursor-grabbing\" : \"cursor-grab\";\n // The design dims the lifted source row as a whole — 60% opacity over its\n // own colours — rather than swapping to the disabled tone.\n const rowStateClasses = disabled\n ? \"cursor-default text-content-disabled\"\n : cn(grabCursor, isLifted ? \"opacity-60\" : \"hover:bg-neutral-alphas-50\");\n const handleStateClasses = disabled\n ? \"cursor-not-allowed [&>svg]:text-content-disabled\"\n : grabCursor;\n\n const setElement = React.useCallback(\n (node: HTMLDivElement | null) => {\n elementRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n // Registered from an effect, not the ref callback, so re-renders don't\n // churn the group's registry with a delete + set per row.\n React.useLayoutEffect(() => {\n const element = elementRef.current;\n if (actions === null || element === null) return;\n actions.registerItem(value, { element, label: resolvedLabel });\n return () => actions.registerItem(value, null);\n }, [actions, value, resolvedLabel]);\n\n const rowContent = (\n <ReorderRowContent leadingIcon={leadingIcon} trailing={trailing}>\n {children}\n </ReorderRowContent>\n );\n\n return (\n <div\n ref={setElement}\n data-dragging={isLifted || undefined}\n className={cn(\n \"typography-body-small-14px-regular group relative flex min-h-10 w-full select-none items-center gap-2 rounded-sm px-3 py-2 text-content-primary\",\n variant === \"sheet\" && \"mx-3 w-auto\",\n rowStateClasses,\n className,\n )}\n {...props}\n onPointerDown={(event) => {\n onPointerDown?.(event);\n const element = elementRef.current;\n if (disabled || actions === null || element === null) return;\n if (!canStartReorderDrag(event, handleRef.current)) return;\n if (!actions.startDrag(value, event, element)) return;\n event.preventDefault();\n element.setPointerCapture?.(event.pointerId);\n }}\n onPointerMove={(event) => {\n onPointerMove?.(event);\n actions?.updateDrag(event);\n }}\n onPointerUp={(event) => {\n onPointerUp?.(event);\n actions?.endDrag(event.pointerId, true);\n if (!isLifted) focusHandleAfterClick(event, handleRef.current);\n }}\n onPointerCancel={(event) => {\n onPointerCancel?.(event);\n actions?.endDrag(event.pointerId, false);\n }}\n >\n <button\n ref={handleRef}\n type=\"button\"\n aria-label={dragHandleLabel}\n aria-describedby={actions?.instructionsId}\n disabled={disabled}\n className={cn(\n \"relative flex size-4 shrink-0 touch-none items-center justify-center rounded-2xs outline-none focus-visible:shadow-focus-ring\",\n // The grip draws at 16px but is the only touch drag affordance, so\n // its hit area extends 12px each way to the row's edges — a 40px\n // target — without changing the glyph.\n \"before:absolute before:-inset-3 before:content-['']\",\n handleStateClasses,\n )}\n onKeyDown={(event) => {\n if (event.key !== \"ArrowUp\" && event.key !== \"ArrowDown\") return;\n event.preventDefault();\n event.stopPropagation();\n actions?.moveItem(value, event.key === \"ArrowUp\" ? -1 : 1);\n }}\n >\n <DragHandleDots className=\"size-4 text-icons-tertiary\" />\n </button>\n {rowContent}\n {liftedHere !== null && actions !== null && (\n <ReorderGhost\n lifted={liftedHere}\n registerGhost={actions.registerGhost}\n container={elementRef.current?.ownerDocument.body ?? document.body}\n >\n {rowContent}\n </ReorderGhost>\n )}\n </div>\n );\n },\n);\nDropdownMenuReorderItem.displayName = \"DropdownMenuReorderItem\";\n"],"names":["jsxs","Fragment","jsx","createPortal","DragHandleDots","React","ReorderActionsContext","ReorderLiftedContext","DropdownMenuVariantContext","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,+BAA+B;AAMrC,SAAS,oBAAoB,OAA2B,QAAqC;AAC3F,MAAI,MAAM,oBAAoB,EAAE,MAAM,kBAAkB,SAAU,QAAO;AACzE,QAAM,WAAW,QAAQ,SAAS,MAAM,MAAM,MAAM;AACpD,MAAI,MAAM,gBAAgB,QAAS,QAAO;AAC1C,MAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,SAAO,YAAY,MAAM,OAAO,Q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U,6BAAA,CAA6B;AAAA,YAAA;AAAA,UAAA;AAAA,UAExD;AAAA,UACA,eAAe,QAAQ,YAAY,QAClCF,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,QAAQ;AAAA,cACR,eAAe,QAAQ;AAAA,cACvB,WAAW,WAAW,SAAS,cAAc,QAAQ,SAAS;AAAA,cAE7D,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACA,wBAAwB,cAAc;;"}
1
+ {"version":3,"file":"DropdownMenuReorderItem.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuReorderItem.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../../utils/cn\";\nimport { DropdownMenuVariantContext } from \"./context\";\nimport {\n DragHandleDots,\n type ReorderActions,\n ReorderActionsContext,\n type ReorderLifted,\n ReorderLiftedContext,\n} from \"./reorderShared\";\n\nconst INTERACTIVE_CONTROL_SELECTOR = 'button, a[href], input, select, textarea, [role=\"button\"]';\n\n// A drag starts from a primary mouse button anywhere on the row — except on\n// another control inside it (a `trailing` action, say), which keeps its click\n// and focus — or from the drag handle only for touch/pen, so the rest of the\n// row still scrolls a long menu with a finger.\nfunction canStartReorderDrag(event: React.PointerEvent, handle: HTMLElement | null): boolean {\n if (event.defaultPrevented || !(event.target instanceof Element)) return false;\n const onHandle = handle?.contains(event.target) === true;\n if (event.pointerType !== \"mouse\") return onHandle;\n if (event.button !== 0) return false;\n return onHandle || event.target.closest(INTERACTIVE_CONTROL_SELECTOR) === null;\n}\n\n// pointerdown's preventDefault (needed to stop text selection) also suppresses\n// focus, so a plain click on the grip focuses it here — ArrowUp/Down then work.\nfunction focusHandleAfterClick(event: React.PointerEvent, handle: HTMLElement | null): void {\n if (handle !== null && event.target instanceof Node && handle.contains(event.target)) {\n handle.focus({ preventScroll: true });\n }\n}\n// Icon, label and trailing slot of a row — rendered once in the row itself and\n// again inside its floating copy while lifted.\nfunction ReorderRowContent({\n leadingIcon,\n trailing,\n children,\n}: Pick<DropdownMenuReorderItemProps, \"leadingIcon\" | \"trailing\" | \"children\">) {\n return (\n <>\n {leadingIcon != null && <span className=\"shrink-0\">{leadingIcon}</span>}\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n {trailing != null && <span className=\"shrink-0\">{trailing}</span>}\n </>\n );\n}\n\n// The floating copy of a lifted row. Anchored at the viewport origin and moved\n// with a transform (see the group's positionGhost) so each pointer move is\n// compositor work only.\nfunction ReorderGhost({\n lifted,\n registerGhost,\n container,\n children,\n}: {\n lifted: ReorderLifted;\n registerGhost: ReorderActions[\"registerGhost\"];\n container: Element;\n children: React.ReactNode;\n}) {\n return createPortal(\n <div\n aria-hidden=\"true\"\n data-reorder-ghost=\"\"\n ref={registerGhost}\n className=\"pointer-events-none fixed top-0 left-0 will-change-transform\"\n style={{ width: lifted.width, zIndex: lifted.zIndex }}\n >\n {/*\n * The design draws the floating copy as frosted glass — a translucent\n * surface with a heavy backdrop blur and no drop shadow (the same\n * treatment the panel itself gets) — so what the ghost passes over\n * smears through it.\n */}\n <div className=\"overflow-hidden rounded-md bg-surface-primary/65 backdrop-blur-[20px]\">\n <div className=\"typography-body-small-14px-regular flex min-h-10 items-center gap-2 bg-neutral-alphas-100 py-2 pr-6 pl-3 text-content-primary\">\n <DragHandleDots className=\"size-4 shrink-0 text-icons-tertiary\" />\n {children}\n </div>\n </div>\n </div>,\n container,\n );\n}\n\n/** Props for the {@link DropdownMenuReorderItem} component. */\nexport interface DropdownMenuReorderItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value identifying this item within the parent group's `values`. */\n value: string;\n /**\n * Plain-text name used in the group's screen-reader announcements and\n * reported in `onReorder`'s detail. Defaults to `children` when that is a\n * string or number, then to `value` — so pass it whenever `value` is an id.\n */\n label?: string;\n /** Icon (or other node) rendered between the drag handle and the label. */\n leadingIcon?: React.ReactNode;\n /** Content rendered at the end of the row, e.g. an item count. */\n trailing?: React.ReactNode;\n /** Accessible label for the drag handle button. @default \"Reorder\" */\n dragHandleLabel?: string;\n /** Disables dragging and keyboard reordering for this item. @default false */\n disabled?: boolean;\n}\n\n/**\n * A draggable row within a {@link DropdownMenuReorderGroup}. Shows the drag\n * handle grip, dims in place while its floating copy follows the pointer, and\n * supports ArrowUp/ArrowDown reordering when the handle has focus.\n */\nexport const DropdownMenuReorderItem = React.forwardRef<\n HTMLDivElement,\n DropdownMenuReorderItemProps\n>(\n (\n {\n value,\n label,\n leadingIcon,\n trailing,\n dragHandleLabel = \"Reorder\",\n disabled,\n className,\n children,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n ...props\n },\n ref,\n ) => {\n const actions = React.useContext(ReorderActionsContext);\n const lifted = React.useContext(ReorderLiftedContext);\n const variant = React.useContext(DropdownMenuVariantContext);\n const elementRef = React.useRef<HTMLDivElement | null>(null);\n const handleRef = React.useRef<HTMLButtonElement | null>(null);\n const liftedHere = lifted !== null && lifted.value === value ? lifted : null;\n const isLifted = liftedHere !== null;\n const resolvedLabel =\n label ??\n (typeof children === \"string\" || typeof children === \"number\" ? String(children) : value);\n const grabCursor = isLifted ? \"cursor-grabbing\" : \"cursor-grab\";\n // The design dims the lifted source row as a whole — 60% opacity over its\n // own colours — rather than swapping to the disabled tone.\n const rowStateClasses = disabled\n ? \"cursor-default text-content-disabled\"\n : cn(grabCursor, isLifted ? \"opacity-60\" : \"hover:bg-neutral-alphas-50\");\n const handleStateClasses = disabled\n ? \"cursor-not-allowed [&>svg]:text-content-disabled\"\n : grabCursor;\n\n const setElement = React.useCallback(\n (node: HTMLDivElement | null) => {\n elementRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n // Registered from an effect, not the ref callback, so re-renders don't\n // churn the group's registry with a delete + set per row.\n React.useLayoutEffect(() => {\n const element = elementRef.current;\n if (actions === null || element === null) return;\n actions.registerItem(value, { element, label: resolvedLabel });\n return () => actions.registerItem(value, null);\n }, [actions, value, resolvedLabel]);\n\n const rowContent = (\n <ReorderRowContent leadingIcon={leadingIcon} trailing={trailing}>\n {children}\n </ReorderRowContent>\n );\n\n return (\n <div\n ref={setElement}\n data-dragging={isLifted || undefined}\n className={cn(\n \"typography-body-small-14px-regular group relative flex min-h-10 w-full select-none items-center gap-2 rounded-md px-3 py-2 text-content-primary\",\n variant === \"sheet\" && \"mx-3 w-auto\",\n rowStateClasses,\n className,\n )}\n {...props}\n onPointerDown={(event) => {\n onPointerDown?.(event);\n const element = elementRef.current;\n if (disabled || actions === null || element === null) return;\n if (!canStartReorderDrag(event, handleRef.current)) return;\n if (!actions.startDrag(value, event, element)) return;\n event.preventDefault();\n element.setPointerCapture?.(event.pointerId);\n }}\n onPointerMove={(event) => {\n onPointerMove?.(event);\n actions?.updateDrag(event);\n }}\n onPointerUp={(event) => {\n onPointerUp?.(event);\n actions?.endDrag(event.pointerId, true);\n if (!isLifted) focusHandleAfterClick(event, handleRef.current);\n }}\n onPointerCancel={(event) => {\n onPointerCancel?.(event);\n actions?.endDrag(event.pointerId, false);\n }}\n >\n <button\n ref={handleRef}\n type=\"button\"\n aria-label={dragHandleLabel}\n aria-describedby={actions?.instructionsId}\n disabled={disabled}\n className={cn(\n \"relative flex size-4 shrink-0 touch-none items-center justify-center rounded-2xs outline-none focus-visible:shadow-focus-ring\",\n // The grip draws at 16px but is the only touch drag affordance, so\n // its hit area extends 12px each way to the row's edges — a 40px\n // target — without changing the glyph.\n \"before:absolute before:-inset-3 before:content-['']\",\n handleStateClasses,\n )}\n onKeyDown={(event) => {\n if (event.key !== \"ArrowUp\" && event.key !== \"ArrowDown\") return;\n event.preventDefault();\n event.stopPropagation();\n actions?.moveItem(value, event.key === \"ArrowUp\" ? -1 : 1);\n }}\n >\n <DragHandleDots className=\"size-4 text-icons-tertiary\" />\n </button>\n {rowContent}\n {liftedHere !== null && actions !== null && (\n <ReorderGhost\n lifted={liftedHere}\n registerGhost={actions.registerGhost}\n container={elementRef.current?.ownerDocument.body ?? document.body}\n >\n {rowContent}\n </ReorderGhost>\n )}\n </div>\n );\n },\n);\nDropdownMenuReorderItem.displayName = \"DropdownMenuReorderItem\";\n"],"names":["jsxs","Fragment","jsx","createPortal","DragHandleDots","React","ReorderActionsContext","ReorderLiftedContext","DropdownMenuVariantContext","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,+BAA+B;AAMrC,SAAS,oBAAoB,OAA2B,QAAqC;AAC3F,MAAI,MAAM,oBAAoB,EAAE,MAAM,kBAAkB,SAAU,QAAO;AACzE,QAAM,WAAW,QAAQ,SAAS,MAAM,MAAM,MAAM;AACpD,MAAI,MAAM,gBAAgB,QAAS,QAAO;AAC1C,MAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,SAAO,YAAY,MAAM,OAAO,QAAQ,4BAA4B,MAAM;AAC5E;AAIA,SAAS,sBAAsB,OAA2B,QAAkC;AAC1F,MAAI,WAAW,QAAQ,MAAM,kBAAkB,QAAQ,OAAO,SAAS,MAAM,MAAM,GAAG;AACpF,WAAO,MAAM,EAAE,eAAe,KAAA,CAAM;AAAA,EACtC;AACF;AAGA,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AACF,GAAgF;AAC9E,SACEA,2BAAAA,KAAAC,qBAAA,EACG,UAAA;AAAA,IAAA,eAAe,QAAQC,2BAAAA,IAAC,QAAA,EAAK,WAAU,YAAY,UAAA,aAAY;AAAA,IAChEA,2BAAAA,IAAC,QAAA,EAAK,WAAU,2BAA2B,SAAA,CAAS;AAAA,IACnD,YAAY,QAAQA,2BAAAA,IAAC,QAAA,EAAK,WAAU,YAAY,UAAA,SAAA,CAAS;AAAA,EAAA,GAC5D;AAEJ;AAKA,SAAS,aAAa;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,SAAOC,SAAAA;AAAAA,IACLD,2BAAAA;AAA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AK;AACvB,mBAAS,QAAQ,MAAM,WAAW,KAAK;AAAA,QACzC;AAAA,QAEA,UAAA;AAAA,UAAAP,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL,MAAK;AAAA,cACL,cAAY;AAAA,cACZ,oBAAkB,SAAS;AAAA,cAC3B;AAAA,cACA,WAAWO,GAAAA;AAAAA,gBACT;AAAA;AAAA;AAAA;AAAA,gBAIA;AAAA,gBACA;AAAA,cAAA;AAAA,cAEF,WAAW,CAAC,UAAU;AACpB,oBAAI,MAAM,QAAQ,aAAa,MAAM,QAAQ,YAAa;AAC1D,sBAAM,eAAA;AACN,sBAAM,gBAAA;AACN,yBAAS,SAAS,OAAO,MAAM,QAAQ,YAAY,KAAK,CAAC;AAAA,cAC3D;AAAA,cAEA,UAAAP,2BAAAA,IAACE,cAAAA,gBAAA,EAAe,WAAU,6BAAA,CAA6B;AAAA,YAAA;AAAA,UAAA;AAAA,UAExD;AAAA,UACA,eAAe,QAAQ,YAAY,QAClCF,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,QAAQ;AAAA,cACR,eAAe,QAAQ;AAAA,cACvB,WAAW,WAAW,SAAS,cAAc,QAAQ,SAAS;AAAA,cAE7D,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACA,wBAAwB,cAAc;;"}
@@ -185,14 +185,16 @@ const DropdownMenuContent = React__namespace.forwardRef(
185
185
  sideOffset,
186
186
  collisionPadding,
187
187
  className: cn.cn(
188
- // Panel tokens come from `V2 Menu Dropdown`: `rounded-sm` (12px) over
189
- // `Surface/Primary`, a `Border/Primary` stroke, 4px of padding, and the
190
- // `blur + shadow/floating` effect.
188
+ // Panel tokens come from `V2 Menu Dropdown` (product file node
189
+ // `7393:62008`): `rounded-lg` (24px) over `Background/Secondary`, a
190
+ // `Border/Strong` stroke, 8px of padding, and the `blur + shadow/menu`
191
+ // effect. Rows inside it are 16px `rounded-md`: the panel's 24px less its
192
+ // 8px padding, so a highlighted row's corners sit concentric with it.
191
193
  //
192
194
  // `backdrop-blur-[4px]` is the CSS equivalent of that effect's
193
195
  // BACKGROUND_BLUR radius 8, which Figma halves on export. It is not a
194
196
  // 4-against-8 mismatch.
195
- "w-max min-w-(--radix-dropdown-menu-trigger-width) max-w-(--radix-dropdown-menu-content-available-width) overflow-y-auto rounded-sm border border-border-primary bg-surface-primary p-1 text-content-primary shadow-blur-floating backdrop-blur-[4px]",
197
+ "w-max min-w-(--radix-dropdown-menu-trigger-width) max-w-(--radix-dropdown-menu-content-available-width) overflow-y-auto rounded-lg border border-border-strong bg-background-secondary p-2 text-content-primary shadow-blur-menu backdrop-blur-[4px]",
196
198
  "data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in",
197
199
  "data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out",
198
200
  "data-[side=top]:slide-in-from-bottom-2 data-[side=bottom]:slide-in-from-top-2",
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenuRoot.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuRoot.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { FLOATING_CONTENT_COLLISION_PADDING } from \"../../utils/floatingContentCollisionPadding\";\nimport { Drawer, DrawerContent, DrawerTrigger } from \"../Drawer/Drawer\";\nimport { type DropdownMenuVariant, DropdownMenuVariantContext, ToggleOpenContext } from \"./context\";\n\n// Movement, in CSS px, above which a touch press-and-release counts as a drag.\nconst TAP_MOVEMENT_THRESHOLD_PX = 10;\n\n// Radix menus swallow Tab (a menu has no tab stops, only items), which strands\n// any non-item control rendered inside one — header actions, a search input,\n// reorder handles. Containers of such controls carry this attribute and\n// `DropdownMenuContent` cycles Tab through the focusable elements inside them.\nconst TAB_STOPS_ATTRIBUTE = \"data-dropdown-menu-tab-stops\";\nconst FOCUSABLE_SELECTOR = \"a[href], button, input, select, textarea, [tabindex]\";\n\nfunction getMenuTabStops(content: HTMLElement): HTMLElement[] {\n const stops: HTMLElement[] = [];\n for (const container of content.querySelectorAll<HTMLElement>(`[${TAB_STOPS_ATTRIBUTE}]`)) {\n for (const element of container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) {\n if (element.tabIndex < 0 || element.matches(\":disabled\") || element.hidden) continue;\n stops.push(element);\n }\n }\n return stops;\n}\n\n// Cycles focus through the menu's tab stops on Tab / Shift+Tab, skipping menu\n// items (which keep their arrow-key navigation). Returns without acting when\n// the key isn't a plain Tab, came from a nested menu, or there is nothing to\n// cycle through — Radix then swallows the key as it always has.\nfunction cycleMenuTabStops(event: React.KeyboardEvent<HTMLElement>): void {\n if (event.key !== \"Tab\" || event.altKey || event.ctrlKey || event.metaKey) return;\n // A nested menu's keydowns bubble here through React's portal tree; they are\n // the nested menu's to handle.\n const target = event.target as HTMLElement;\n if (target.closest(\"[data-radix-menu-content]\") !== event.currentTarget) return;\n const stops = getMenuTabStops(event.currentTarget);\n if (stops.length === 0) return;\n // Prevented here so Radix's own handler (which would swallow the key) is\n // skipped — Radix composes it after ours and checks `defaultPrevented`.\n event.preventDefault();\n const index = stops.indexOf(target);\n const last = stops.length - 1;\n const next = event.shiftKey\n ? stops[index <= 0 ? last : index - 1]\n : stops[index === -1 || index === last ? 0 : index + 1];\n // Radix's FocusScope also sees this Tab (after us, ignoring\n // `defaultPrevented`), but a menu's scope is trapped without `loop`, so it\n // only prevents the default — it never moves focus itself.\n next?.focus({ preventScroll: true });\n}\n\ntype ActiveTap = {\n pointerId: number;\n x: number;\n y: number;\n movedPastThreshold: boolean;\n};\n\n/** Props for the {@link DropdownMenu} root component. */\nexport interface DropdownMenuProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {\n /** How the menu presents its content. @default \"menu\" */\n variant?: DropdownMenuVariant;\n}\n\n/** Root component that manages open/close state for a dropdown menu. */\nexport function DropdownMenu({\n open: openProp,\n defaultOpen,\n onOpenChange,\n variant = \"menu\",\n children,\n ...props\n}: DropdownMenuProps) {\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n });\n\n if (variant === \"sheet\") {\n return (\n <DropdownMenuVariantContext.Provider value=\"sheet\">\n <ToggleOpenContext.Provider value={setOpen}>\n <Drawer open={open} onOpenChange={setOpen}>\n {children}\n </Drawer>\n </ToggleOpenContext.Provider>\n </DropdownMenuVariantContext.Provider>\n );\n }\n\n return (\n <DropdownMenuVariantContext.Provider value=\"menu\">\n <ToggleOpenContext.Provider value={setOpen}>\n <DropdownMenuPrimitive.Root open={open} onOpenChange={setOpen} {...props}>\n {children}\n </DropdownMenuPrimitive.Root>\n </ToggleOpenContext.Provider>\n </DropdownMenuVariantContext.Provider>\n );\n}\n\n/** Props for the {@link DropdownMenuTrigger} component. */\nexport type DropdownMenuTriggerProps = React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Trigger\n>;\n\n/**\n * The element that toggles the dropdown menu when clicked.\n *\n * On touch devices, the menu only opens if the press-and-release stays within\n * a small movement threshold. A drag that incidentally ends over the trigger\n * (common when scrolling a feed on Android Chrome) is ignored. Mouse and\n * keyboard interactions are unchanged.\n */\nexport const DropdownMenuTrigger = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Trigger>,\n DropdownMenuTriggerProps\n>((props, ref) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const toggleOpen = React.useContext(ToggleOpenContext);\n const tapRef = React.useRef<ActiveTap | null>(null);\n\n // The sheet variant opens a Drawer (Dialog), which already suppresses\n // scroll-drag-end synthetic clicks itself — no need for the touch-tap gating below.\n if (variant === \"sheet\") {\n return <DrawerTrigger {...props} ref={ref} />;\n }\n\n // Used outside our DropdownMenu wrapper — fall through to Radix defaults.\n if (toggleOpen === null) {\n return <DropdownMenuPrimitive.Trigger {...props} ref={ref} />;\n }\n\n return (\n <DropdownMenuPrimitive.Trigger\n {...props}\n ref={ref}\n onPointerDown={(event) => {\n props.onPointerDown?.(event);\n if (event.pointerType === \"mouse\" || props.disabled) return;\n // Keep pointerup / pointercancel on this element if the finger drifts off.\n // Optional because jsdom (used in tests) doesn't implement it.\n event.currentTarget.setPointerCapture?.(event.pointerId);\n tapRef.current = {\n pointerId: event.pointerId,\n x: event.clientX,\n y: event.clientY,\n movedPastThreshold: false,\n };\n // preventDefault stops Radix's pointerdown open path via composeEventHandlers.\n event.preventDefault();\n }}\n onPointerMove={(event) => {\n props.onPointerMove?.(event);\n const tap = tapRef.current;\n if (tap === null || event.pointerId !== tap.pointerId || tap.movedPastThreshold) {\n return;\n }\n const dx = event.clientX - tap.x;\n const dy = event.clientY - tap.y;\n if (Math.hypot(dx, dy) > TAP_MOVEMENT_THRESHOLD_PX) {\n tap.movedPastThreshold = true;\n }\n }}\n onPointerUp={(event) => {\n props.onPointerUp?.(event);\n const tap = tapRef.current;\n if (tap === null || event.pointerId !== tap.pointerId) return;\n const wasDrag = tap.movedPastThreshold;\n tapRef.current = null;\n if (!wasDrag && !props.disabled) {\n toggleOpen((prev) => !prev);\n }\n }}\n onPointerCancel={(event) => {\n props.onPointerCancel?.(event);\n const tap = tapRef.current;\n if (tap !== null && event.pointerId === tap.pointerId) {\n tapRef.current = null;\n }\n }}\n />\n );\n});\nDropdownMenuTrigger.displayName = \"DropdownMenuTrigger\";\n\n/** Props for the {@link DropdownMenuContent} component. */\nexport interface DropdownMenuContentProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> {}\n\n/**\n * The positioned content panel rendered inside a portal.\n *\n * Override the portal z-index per-instance via `style={{ zIndex: 1500 }}` or\n * globally with the `--fanvue-ui-portal-z-index` CSS custom property.\n *\n * @example\n * ```tsx\n * <DropdownMenu>\n * <DropdownMenuTrigger asChild>\n * <Button>Open</Button>\n * </DropdownMenuTrigger>\n * <DropdownMenuContent>\n * <DropdownMenuItem>Option 1</DropdownMenuItem>\n * <DropdownMenuItem>Option 2</DropdownMenuItem>\n * </DropdownMenuContent>\n * </DropdownMenu>\n * ```\n */\nexport const DropdownMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\n DropdownMenuContentProps\n>(\n (\n {\n className,\n style,\n sideOffset = 4,\n // Radix defaults `avoidCollisions` to true, so passing `collisionPadding`\n // is enough to keep the menu flipping/shifting to stay on screen — no\n // hand-rolled reposition logic needed.\n collisionPadding = FLOATING_CONTENT_COLLISION_PADDING,\n onPointerDownOutside,\n onCloseAutoFocus,\n onKeyDown,\n children,\n ...props\n },\n ref,\n ) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n // Radix returns focus to the trigger when the menu closes. That is right for\n // the keyboard, but Chrome's :focus-visible heuristic also paints the ring on\n // that programmatic refocus, so dismissing with a click left a focus ring\n // sitting on the trigger. Track pointer dismissals and skip the restore for\n // them only — Escape and Tab still hand focus back with the ring.\n const dismissedByPointer = React.useRef(false);\n\n if (variant === \"sheet\") {\n return (\n <DrawerContent\n ref={ref}\n position=\"bottom\"\n // `\"sheet\"` sits flush to the bottom edge at full width; the design draws\n // this panel inset from all three sides and rounded on every corner, which\n // is `\"menu\"`. Both carry the same modal surface.\n variant=\"menu\"\n // The design's `blur + shadow/menu` effect is a background blur, and the\n // panel's own fill is opaque — so the blur has to go on the overlay to be\n // visible at all. Scoped here rather than on DrawerOverlay so only menus\n // shown this way blur the page behind them.\n overlayProps={{ className: \"backdrop-blur-[8px]\" }}\n // `pb-4` gives the design's 16px below the last row. The rows inset\n // themselves horizontally (see the item's `mx-3`) rather than the panel\n // padding doing it, so the header and its rule can still run full width.\n className={cn(\"flex flex-col gap-1 p-1 pb-4\", className)}\n style={style}\n // Both are destructured above for the popper branch's focus-ring\n // handling, which takes them out of `props` — so the sheet branch has\n // to re-attach them or they are silently dropped. `DrawerContent`\n // forwards them to its `DialogPrimitive.Content`, which supports both.\n // Consumers stack sheets on these (a nested sheet's `onCloseAutoFocus`\n // is the only point at which the parent knows the child has finished\n // animating out), so dropping them breaks the flow with no error.\n onPointerDownOutside={onPointerDownOutside}\n onCloseAutoFocus={onCloseAutoFocus}\n onKeyDown={onKeyDown}\n {...props}\n >\n {children}\n </DrawerContent>\n );\n }\n\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n onPointerDownOutside={(event) => {\n dismissedByPointer.current = true;\n onPointerDownOutside?.(event);\n }}\n onCloseAutoFocus={(event) => {\n if (dismissedByPointer.current) event.preventDefault();\n dismissedByPointer.current = false;\n onCloseAutoFocus?.(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented) cycleMenuTabStops(event);\n }}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n className={cn(\n // Panel tokens come from `V2 Menu Dropdown`: `rounded-sm` (12px) over\n // `Surface/Primary`, a `Border/Primary` stroke, 4px of padding, and the\n // `blur + shadow/floating` effect.\n //\n // `backdrop-blur-[4px]` is the CSS equivalent of that effect's\n // BACKGROUND_BLUR radius 8, which Figma halves on export. It is not a\n // 4-against-8 mismatch.\n \"w-max min-w-(--radix-dropdown-menu-trigger-width) max-w-(--radix-dropdown-menu-content-available-width) overflow-y-auto rounded-sm border border-border-primary bg-surface-primary p-1 text-content-primary shadow-blur-floating backdrop-blur-[4px]\",\n \"data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out\",\n \"data-[side=top]:slide-in-from-bottom-2 data-[side=bottom]:slide-in-from-top-2\",\n \"data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n style={{\n zIndex: \"var(--fanvue-ui-portal-z-index, 50)\",\n maxHeight: \"var(--radix-dropdown-menu-content-available-height)\",\n ...style,\n }}\n {...props}\n >\n {children}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nDropdownMenuContent.displayName = \"DropdownMenuContent\";\n\n/** Props for the {@link DropdownMenuGroup} component. */\nexport type DropdownMenuGroupProps = React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Group\n>;\n\n/**\n * Groups related menu items. Accepts an optional `DropdownMenuLabel`.\n *\n * Requires Radix menu context — not supported inside a `variant=\"sheet\"` menu.\n */\nexport const DropdownMenuGroup = DropdownMenuPrimitive.Group;\nDropdownMenuGroup.displayName = \"DropdownMenuGroup\";\n"],"names":["useControllableState","DropdownMenuVariantContext","ToggleOpenContext","Drawer","jsx","DropdownMenuPrimitive","React","DrawerTrigger","FLOATING_CONTENT_COLLISION_PADDING","DrawerContent","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,4BAA4B;AAMlC,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAE3B,SAAS,gBAAgB,SAAqC;AAC5D,QAAM,QAAuB,CAAA;AAC7B,aAAW,aAAa,QAAQ,iBAA8B,IAAI,mBAAmB,GAAG,GAAG;AACzF,eAAW,WAAW,UAAU,iBAA8B,kBAAkB,GAAG;AACjF,UAAI,QAAQ,WAAW,KAAK,QAAQ,QAAQ,WAAW,KAAK,QAAQ,OAAQ;AAC5E,YAAM,KAAK,OAAO;AAAA,IACpB;AAAA,EACF;AACA,SAAO;AACT;AAMA,SAAS,kBAAkB,OAA+C;AACxE,MAAI,MAAM,QAAQ,SAAS,MAAM,UAAU,MAAM,WAAW,MAAM,QAAS;AAG3E,QAAM,SAAS,MAAM;AACrB,MAAI,OAAO,QAAQ,2BAA2B,MAAM,MAAM,cAAe;AACzE,QAAM,QAAQ,gBAAgB,MAAM,aAAa;AACjD,MAAI,MAAM,WAAW,EAAG;AAGxB,QAAM,eAAA;AACN,QAAM,QAAQ,MAAM,QAAQ,MAA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A,QAAA;AAAA,QAEF,OAAO;AAAA,UACL,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,GAAG;AAAA,QAAA;AAAA,QAEJ,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,EAEJ;AACF;AACA,oBAAoB,cAAc;AAY3B,MAAM,oBAAoBL,iCAAsB;AACvD,kBAAkB,cAAc;;;;;"}
1
+ {"version":3,"file":"DropdownMenuRoot.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuRoot.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { FLOATING_CONTENT_COLLISION_PADDING } from \"../../utils/floatingContentCollisionPadding\";\nimport { Drawer, DrawerContent, DrawerTrigger } from \"../Drawer/Drawer\";\nimport { type DropdownMenuVariant, DropdownMenuVariantContext, ToggleOpenContext } from \"./context\";\n\n// Movement, in CSS px, above which a touch press-and-release counts as a drag.\nconst TAP_MOVEMENT_THRESHOLD_PX = 10;\n\n// Radix menus swallow Tab (a menu has no tab stops, only items), which strands\n// any non-item control rendered inside one — header actions, a search input,\n// reorder handles. Containers of such controls carry this attribute and\n// `DropdownMenuContent` cycles Tab through the focusable elements inside them.\nconst TAB_STOPS_ATTRIBUTE = \"data-dropdown-menu-tab-stops\";\nconst FOCUSABLE_SELECTOR = \"a[href], button, input, select, textarea, [tabindex]\";\n\nfunction getMenuTabStops(content: HTMLElement): HTMLElement[] {\n const stops: HTMLElement[] = [];\n for (const container of content.querySelectorAll<HTMLElement>(`[${TAB_STOPS_ATTRIBUTE}]`)) {\n for (const element of container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) {\n if (element.tabIndex < 0 || element.matches(\":disabled\") || element.hidden) continue;\n stops.push(element);\n }\n }\n return stops;\n}\n\n// Cycles focus through the menu's tab stops on Tab / Shift+Tab, skipping menu\n// items (which keep their arrow-key navigation). Returns without acting when\n// the key isn't a plain Tab, came from a nested menu, or there is nothing to\n// cycle through — Radix then swallows the key as it always has.\nfunction cycleMenuTabStops(event: React.KeyboardEvent<HTMLElement>): void {\n if (event.key !== \"Tab\" || event.altKey || event.ctrlKey || event.metaKey) return;\n // A nested menu's keydowns bubble here through React's portal tree; they are\n // the nested menu's to handle.\n const target = event.target as HTMLElement;\n if (target.closest(\"[data-radix-menu-content]\") !== event.currentTarget) return;\n const stops = getMenuTabStops(event.currentTarget);\n if (stops.length === 0) return;\n // Prevented here so Radix's own handler (which would swallow the key) is\n // skipped — Radix composes it after ours and checks `defaultPrevented`.\n event.preventDefault();\n const index = stops.indexOf(target);\n const last = stops.length - 1;\n const next = event.shiftKey\n ? stops[index <= 0 ? last : index - 1]\n : stops[index === -1 || index === last ? 0 : index + 1];\n // Radix's FocusScope also sees this Tab (after us, ignoring\n // `defaultPrevented`), but a menu's scope is trapped without `loop`, so it\n // only prevents the default — it never moves focus itself.\n next?.focus({ preventScroll: true });\n}\n\ntype ActiveTap = {\n pointerId: number;\n x: number;\n y: number;\n movedPastThreshold: boolean;\n};\n\n/** Props for the {@link DropdownMenu} root component. */\nexport interface DropdownMenuProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {\n /** How the menu presents its content. @default \"menu\" */\n variant?: DropdownMenuVariant;\n}\n\n/** Root component that manages open/close state for a dropdown menu. */\nexport function DropdownMenu({\n open: openProp,\n defaultOpen,\n onOpenChange,\n variant = \"menu\",\n children,\n ...props\n}: DropdownMenuProps) {\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n });\n\n if (variant === \"sheet\") {\n return (\n <DropdownMenuVariantContext.Provider value=\"sheet\">\n <ToggleOpenContext.Provider value={setOpen}>\n <Drawer open={open} onOpenChange={setOpen}>\n {children}\n </Drawer>\n </ToggleOpenContext.Provider>\n </DropdownMenuVariantContext.Provider>\n );\n }\n\n return (\n <DropdownMenuVariantContext.Provider value=\"menu\">\n <ToggleOpenContext.Provider value={setOpen}>\n <DropdownMenuPrimitive.Root open={open} onOpenChange={setOpen} {...props}>\n {children}\n </DropdownMenuPrimitive.Root>\n </ToggleOpenContext.Provider>\n </DropdownMenuVariantContext.Provider>\n );\n}\n\n/** Props for the {@link DropdownMenuTrigger} component. */\nexport type DropdownMenuTriggerProps = React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Trigger\n>;\n\n/**\n * The element that toggles the dropdown menu when clicked.\n *\n * On touch devices, the menu only opens if the press-and-release stays within\n * a small movement threshold. A drag that incidentally ends over the trigger\n * (common when scrolling a feed on Android Chrome) is ignored. Mouse and\n * keyboard interactions are unchanged.\n */\nexport const DropdownMenuTrigger = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Trigger>,\n DropdownMenuTriggerProps\n>((props, ref) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const toggleOpen = React.useContext(ToggleOpenContext);\n const tapRef = React.useRef<ActiveTap | null>(null);\n\n // The sheet variant opens a Drawer (Dialog), which already suppresses\n // scroll-drag-end synthetic clicks itself — no need for the touch-tap gating below.\n if (variant === \"sheet\") {\n return <DrawerTrigger {...props} ref={ref} />;\n }\n\n // Used outside our DropdownMenu wrapper — fall through to Radix defaults.\n if (toggleOpen === null) {\n return <DropdownMenuPrimitive.Trigger {...props} ref={ref} />;\n }\n\n return (\n <DropdownMenuPrimitive.Trigger\n {...props}\n ref={ref}\n onPointerDown={(event) => {\n props.onPointerDown?.(event);\n if (event.pointerType === \"mouse\" || props.disabled) return;\n // Keep pointerup / pointercancel on this element if the finger drifts off.\n // Optional because jsdom (used in tests) doesn't implement it.\n event.currentTarget.setPointerCapture?.(event.pointerId);\n tapRef.current = {\n pointerId: event.pointerId,\n x: event.clientX,\n y: event.clientY,\n movedPastThreshold: false,\n };\n // preventDefault stops Radix's pointerdown open path via composeEventHandlers.\n event.preventDefault();\n }}\n onPointerMove={(event) => {\n props.onPointerMove?.(event);\n const tap = tapRef.current;\n if (tap === null || event.pointerId !== tap.pointerId || tap.movedPastThreshold) {\n return;\n }\n const dx = event.clientX - tap.x;\n const dy = event.clientY - tap.y;\n if (Math.hypot(dx, dy) > TAP_MOVEMENT_THRESHOLD_PX) {\n tap.movedPastThreshold = true;\n }\n }}\n onPointerUp={(event) => {\n props.onPointerUp?.(event);\n const tap = tapRef.current;\n if (tap === null || event.pointerId !== tap.pointerId) return;\n const wasDrag = tap.movedPastThreshold;\n tapRef.current = null;\n if (!wasDrag && !props.disabled) {\n toggleOpen((prev) => !prev);\n }\n }}\n onPointerCancel={(event) => {\n props.onPointerCancel?.(event);\n const tap = tapRef.current;\n if (tap !== null && event.pointerId === tap.pointerId) {\n tapRef.current = null;\n }\n }}\n />\n );\n});\nDropdownMenuTrigger.displayName = \"DropdownMenuTrigger\";\n\n/** Props for the {@link DropdownMenuContent} component. */\nexport interface DropdownMenuContentProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> {}\n\n/**\n * The positioned content panel rendered inside a portal.\n *\n * Override the portal z-index per-instance via `style={{ zIndex: 1500 }}` or\n * globally with the `--fanvue-ui-portal-z-index` CSS custom property.\n *\n * @example\n * ```tsx\n * <DropdownMenu>\n * <DropdownMenuTrigger asChild>\n * <Button>Open</Button>\n * </DropdownMenuTrigger>\n * <DropdownMenuContent>\n * <DropdownMenuItem>Option 1</DropdownMenuItem>\n * <DropdownMenuItem>Option 2</DropdownMenuItem>\n * </DropdownMenuContent>\n * </DropdownMenu>\n * ```\n */\nexport const DropdownMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\n DropdownMenuContentProps\n>(\n (\n {\n className,\n style,\n sideOffset = 4,\n // Radix defaults `avoidCollisions` to true, so passing `collisionPadding`\n // is enough to keep the menu flipping/shifting to stay on screen — no\n // hand-rolled reposition logic needed.\n collisionPadding = FLOATING_CONTENT_COLLISION_PADDING,\n onPointerDownOutside,\n onCloseAutoFocus,\n onKeyDown,\n children,\n ...props\n },\n ref,\n ) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n // Radix returns focus to the trigger when the menu closes. That is right for\n // the keyboard, but Chrome's :focus-visible heuristic also paints the ring on\n // that programmatic refocus, so dismissing with a click left a focus ring\n // sitting on the trigger. Track pointer dismissals and skip the restore for\n // them only — Escape and Tab still hand focus back with the ring.\n const dismissedByPointer = React.useRef(false);\n\n if (variant === \"sheet\") {\n return (\n <DrawerContent\n ref={ref}\n position=\"bottom\"\n // `\"sheet\"` sits flush to the bottom edge at full width; the design draws\n // this panel inset from all three sides and rounded on every corner, which\n // is `\"menu\"`. Both carry the same modal surface.\n variant=\"menu\"\n // The design's `blur + shadow/menu` effect is a background blur, and the\n // panel's own fill is opaque — so the blur has to go on the overlay to be\n // visible at all. Scoped here rather than on DrawerOverlay so only menus\n // shown this way blur the page behind them.\n overlayProps={{ className: \"backdrop-blur-[8px]\" }}\n // `pb-4` gives the design's 16px below the last row. The rows inset\n // themselves horizontally (see the item's `mx-3`) rather than the panel\n // padding doing it, so the header and its rule can still run full width.\n className={cn(\"flex flex-col gap-1 p-1 pb-4\", className)}\n style={style}\n // Both are destructured above for the popper branch's focus-ring\n // handling, which takes them out of `props` — so the sheet branch has\n // to re-attach them or they are silently dropped. `DrawerContent`\n // forwards them to its `DialogPrimitive.Content`, which supports both.\n // Consumers stack sheets on these (a nested sheet's `onCloseAutoFocus`\n // is the only point at which the parent knows the child has finished\n // animating out), so dropping them breaks the flow with no error.\n onPointerDownOutside={onPointerDownOutside}\n onCloseAutoFocus={onCloseAutoFocus}\n onKeyDown={onKeyDown}\n {...props}\n >\n {children}\n </DrawerContent>\n );\n }\n\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n onPointerDownOutside={(event) => {\n dismissedByPointer.current = true;\n onPointerDownOutside?.(event);\n }}\n onCloseAutoFocus={(event) => {\n if (dismissedByPointer.current) event.preventDefault();\n dismissedByPointer.current = false;\n onCloseAutoFocus?.(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented) cycleMenuTabStops(event);\n }}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n className={cn(\n // Panel tokens come from `V2 Menu Dropdown` (product file node\n // `7393:62008`): `rounded-lg` (24px) over `Background/Secondary`, a\n // `Border/Strong` stroke, 8px of padding, and the `blur + shadow/menu`\n // effect. Rows inside it are 16px `rounded-md`: the panel's 24px less its\n // 8px padding, so a highlighted row's corners sit concentric with it.\n //\n // `backdrop-blur-[4px]` is the CSS equivalent of that effect's\n // BACKGROUND_BLUR radius 8, which Figma halves on export. It is not a\n // 4-against-8 mismatch.\n \"w-max min-w-(--radix-dropdown-menu-trigger-width) max-w-(--radix-dropdown-menu-content-available-width) overflow-y-auto rounded-lg border border-border-strong bg-background-secondary p-2 text-content-primary shadow-blur-menu backdrop-blur-[4px]\",\n \"data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out\",\n \"data-[side=top]:slide-in-from-bottom-2 data-[side=bottom]:slide-in-from-top-2\",\n \"data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n style={{\n zIndex: \"var(--fanvue-ui-portal-z-index, 50)\",\n maxHeight: \"var(--radix-dropdown-menu-content-available-height)\",\n ...style,\n }}\n {...props}\n >\n {children}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nDropdownMenuContent.displayName = \"DropdownMenuContent\";\n\n/** Props for the {@link DropdownMenuGroup} component. */\nexport type DropdownMenuGroupProps = React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Group\n>;\n\n/**\n * Groups related menu items. Accepts an optional `DropdownMenuLabel`.\n *\n * Requires Radix menu context — not supported inside a `variant=\"sheet\"` menu.\n */\nexport const DropdownMenuGroup = DropdownMenuPrimitive.Group;\nDropdownMenuGroup.displayName = \"DropdownMenuGroup\";\n"],"names":["useControllableState","DropdownMenuVariantContext","ToggleOpenContext","Drawer","jsx","DropdownMenuPrimitive","React","DrawerTrigger","FLOATING_CONTENT_COLLISION_PADDING","DrawerContent","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,4BAA4B;AAMlC,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAE3B,SAAS,gBAAgB,SAAqC;AAC5D,QAAM,QAAuB,CAAA;AAC7B,aAAW,aAAa,QAAQ,iBAA8B,IAAI,mBAAmB,GAAG,GAAG;AACzF,eAAW,WAAW,UAAU,iBAA8B,kBAAkB,GAAG;AACjF,UAAI,QAAQ,WAAW,KAAK,QAAQ,QAAQ,WAAW,KAAK,QAAQ,OAAQ;AAC5E,YAAM,KAAK,OAAO;AAAA,IACpB;AAAA,EACF;AACA,SAAO;AACT;AAMA,SAAS,kBAAkB,OAA+C;AACxE,MAAI,MAAM,QAAQ,SAAS,MAAM,UAAU,MAAM,WAAW,MAAM,QAAS;AAG3E,QAAM,SAAS,MAAM;AACrB,MAAI,OAAO,QAAQ,2BAA2B,MAAM,MAAM,cAAe;AACzE,QAAM,QAAQ,gBAAgB,MAAM,aAAa;AACjD,MAAI,MAAM,WAAW,EAAG;AAGxB,QAAM,eAAA;AACN,QAAM,QAAQ,MAAM,QAAQ,MAAM;AAClC,QAAM,OAAO,MAAM,SAAS;AAC5B,QAAM,OAAO,MAAM,WACf,MAAM,SAAS,IAAI,OAAO,QAAQ,CAAC,IACnC,MAAM,UAAU,MAAM,UAAU,OAAO,IAAI,QAAQ,CAAC;AAIxD,QAAM,MAAM,EAAE,eAAe,KAAA,CAAM;AACrC;AAiBO,SAAS,aAAa;AAAA,EAC3B,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,CA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(
34
34
  // `px-3` (12px), not 16px: `V2 Menu Radio Item` is `px-[12px] py-[8px]`
35
35
  // (node `7393:62008`), and at 16px a radio row indented 4px further than a
36
- // `DropdownMenuCheckboxItem` in the same menu.
37
- "group flex w-full cursor-pointer items-start gap-3 rounded-xs px-3 py-2 outline-none",
36
+ // `DropdownMenuCheckboxItem` in the same menu. 16px radius like
37
+ // `DropdownMenuItem`, so the highlight sits concentric with the panel.
38
+ "group flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 outline-none",
38
39
  "data-[highlighted]:bg-neutral-alphas-50",
39
40
  "data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled",
40
41
  // See DropdownMenuItem above: bg-interaction-hover aliases to the same
@@ -81,7 +82,7 @@ const DropdownMenuCheckboxItem = React__namespace.forwardRef(({ className, child
81
82
  {
82
83
  ref,
83
84
  className: cn.cn(
84
- "group flex w-full cursor-pointer items-center gap-3 rounded-xs px-3 py-2 outline-none",
85
+ "group flex w-full cursor-pointer items-center gap-3 rounded-md px-3 py-2 outline-none",
85
86
  // Checked state is carried by the tick alone. A background here would
86
87
  // leave every selected row shaded, which reads as "all highlighted" on
87
88
  // a menu that starts fully selected.
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenuSelectionItems.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuSelectionItems.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { TickIcon } from \"../Icons/TickIcon\";\n\n/** Props for the {@link DropdownMenuRadioGroup} component. */\nexport interface DropdownMenuRadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioGroup> {}\n\n/**\n * Groups {@link DropdownMenuRadioItem} children so they behave as a\n * single-select set. Controlled via `value`/`onValueChange`.\n *\n * @example\n * ```tsx\n * <DropdownMenuRadioGroup value={sort} onValueChange={setSort}>\n * <DropdownMenuRadioItem value=\"newest\">Newest first</DropdownMenuRadioItem>\n * <DropdownMenuRadioItem value=\"oldest\">Oldest first</DropdownMenuRadioItem>\n * </DropdownMenuRadioGroup>\n * ```\n *\n * Requires Radix menu context — not supported inside a `variant=\"sheet\"` menu.\n */\nexport const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\n/** Height preset for a {@link DropdownMenuRadioItem}. */\nexport type DropdownMenuRadioItemSize = \"40\";\n\nexport interface DropdownMenuRadioItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> {\n /** Optional secondary text shown below the title. */\n helper?: string;\n /** Height of the item row. @default \"40\" */\n size?: DropdownMenuRadioItemSize;\n}\n\n/**\n * A single radio-style choice within a {@link DropdownMenuRadioGroup}. Shows\n * a circular indicator that fills when selected, plus an optional helper line\n * underneath the title.\n */\nexport const DropdownMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n DropdownMenuRadioItemProps\n>(({ className, children, helper, size: _size = \"40\", ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n // `px-3` (12px), not 16px: `V2 Menu Radio Item` is `px-[12px] py-[8px]`\n // (node `7393:62008`), and at 16px a radio row indented 4px further than a\n // `DropdownMenuCheckboxItem` in the same menu.\n \"group flex w-full cursor-pointer items-start gap-3 rounded-xs px-3 py-2 outline-none\",\n \"data-[highlighted]:bg-neutral-alphas-50\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n // See DropdownMenuItem above: bg-interaction-hover aliases to the same\n // token as the plain hover background, so it can't distinguish the\n // checked state from an unchecked-but-hovered row.\n \"data-[state=checked]:bg-neutral-alphas-100\",\n \"data-[state=checked]:data-[highlighted]:bg-neutral-alphas-200\",\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"mt-1 flex size-4 shrink-0 items-center justify-center rounded-full border border-icons-primary\",\n \"group-data-[disabled]:border-content-disabled\",\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator asChild>\n <span className=\"size-2 rounded-full bg-content-primary\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"typography-body-default-16px-semibold truncate\">{children}</span>\n {helper && (\n <span\n className={cn(\n \"typography-description-12px-regular text-content-secondary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {helper}\n </span>\n )}\n </span>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\";\n\nexport interface DropdownMenuCheckboxItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> {\n /** Optional secondary text shown below the title. */\n helper?: string;\n /** Leading avatar rendered between the checkbox and the title. Render at 32px to match the design. */\n avatar?: React.ReactNode;\n}\n\n/**\n * A single multi-select choice within a dropdown menu. Shows a square indicator\n * that fills when checked, an optional leading avatar, and an optional helper\n * line underneath the title.\n *\n * Pair with {@link DropdownMenuHeader} at `type=\"search\"` for filterable menus.\n * Use {@link DropdownMenuRadioItem} instead when only one option may be active.\n *\n * @example\n * ```tsx\n * <DropdownMenuCheckboxItem\n * checked={selected.has(creator.id)}\n * onCheckedChange={() => toggle(creator.id)}\n * avatar={<Avatar size={32} src={creator.avatarUrl} />}\n * >\n * @sofiabloom\n * </DropdownMenuCheckboxItem>\n * ```\n */\nexport const DropdownMenuCheckboxItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n DropdownMenuCheckboxItemProps\n>(({ className, children, helper, avatar, ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"group flex w-full cursor-pointer items-center gap-3 rounded-xs px-3 py-2 outline-none\",\n // Checked state is carried by the tick alone. A background here would\n // leave every selected row shaded, which reads as \"all highlighted\" on\n // a menu that starts fully selected.\n \"data-[highlighted]:bg-neutral-alphas-50\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-2xs border border-icons-primary\",\n \"group-data-[state=checked]:bg-icons-primary\",\n \"group-data-[disabled]:border-content-disabled\",\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator asChild>\n <TickIcon className=\"size-4 text-content-primary-inverted\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {avatar && <span className=\"shrink-0\">{avatar}</span>}\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"typography-body-default-16px-semibold truncate\">{children}</span>\n {helper && (\n <span\n className={cn(\n \"typography-description-12px-regular text-content-secondary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {helper}\n </span>\n )}\n </span>\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\";\n"],"names":["DropdownMenuPrimitive","React","jsxs","cn","jsx","TickIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,yBAAyBA,iCAAsB;AAkBrD,MAAM,wBAAwBC,iBAAM,WAGzC,CAAC,EAAE,WAAW,UAAU,QAAQ,MAAM,QAAQ,MAAM,GAAG,MAAA,GAAS,QAAQ;AACxE,SACEC,2BAAAA;AAAAA,IAACF,iCAAsB;AAAA,IAAtB;AAAA,MACC;AAAA,MACA,WAAWG,GAAAA;AAAAA;AAAAA;AAAAA;AAAAA,QAIT;AAAA,QACA;AAAA,QACA;AAAA;AAAA;AAAA;AAAA,QAIA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAAC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,GAAAA;AAAAA,cACT;AAAA,cACA;AAAA,YAAA;AAAA,YAEF,e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C9CF,2BAAAA,KAAC,QAAA,EAAK,WAAU,sCACd,UAAA;AAAA,UAAAE,2BAAAA,IAAC,QAAA,EAAK,WAAU,kDAAkD,SAAA,CAAS;AAAA,UAC1E,UACCA,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWD,GAAAA;AAAAA,gBACT;AAAA,gBACA;AAAA,cAAA;AAAA,cAGD,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AACD,yBAAyB,cAAc;;;;"}
1
+ {"version":3,"file":"DropdownMenuSelectionItems.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuSelectionItems.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { TickIcon } from \"../Icons/TickIcon\";\n\n/** Props for the {@link DropdownMenuRadioGroup} component. */\nexport interface DropdownMenuRadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioGroup> {}\n\n/**\n * Groups {@link DropdownMenuRadioItem} children so they behave as a\n * single-select set. Controlled via `value`/`onValueChange`.\n *\n * @example\n * ```tsx\n * <DropdownMenuRadioGroup value={sort} onValueChange={setSort}>\n * <DropdownMenuRadioItem value=\"newest\">Newest first</DropdownMenuRadioItem>\n * <DropdownMenuRadioItem value=\"oldest\">Oldest first</DropdownMenuRadioItem>\n * </DropdownMenuRadioGroup>\n * ```\n *\n * Requires Radix menu context — not supported inside a `variant=\"sheet\"` menu.\n */\nexport const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\n/** Height preset for a {@link DropdownMenuRadioItem}. */\nexport type DropdownMenuRadioItemSize = \"40\";\n\nexport interface DropdownMenuRadioItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> {\n /** Optional secondary text shown below the title. */\n helper?: string;\n /** Height of the item row. @default \"40\" */\n size?: DropdownMenuRadioItemSize;\n}\n\n/**\n * A single radio-style choice within a {@link DropdownMenuRadioGroup}. Shows\n * a circular indicator that fills when selected, plus an optional helper line\n * underneath the title.\n */\nexport const DropdownMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n DropdownMenuRadioItemProps\n>(({ className, children, helper, size: _size = \"40\", ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n // `px-3` (12px), not 16px: `V2 Menu Radio Item` is `px-[12px] py-[8px]`\n // (node `7393:62008`), and at 16px a radio row indented 4px further than a\n // `DropdownMenuCheckboxItem` in the same menu. 16px radius like\n // `DropdownMenuItem`, so the highlight sits concentric with the panel.\n \"group flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 outline-none\",\n \"data-[highlighted]:bg-neutral-alphas-50\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n // See DropdownMenuItem above: bg-interaction-hover aliases to the same\n // token as the plain hover background, so it can't distinguish the\n // checked state from an unchecked-but-hovered row.\n \"data-[state=checked]:bg-neutral-alphas-100\",\n \"data-[state=checked]:data-[highlighted]:bg-neutral-alphas-200\",\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"mt-1 flex size-4 shrink-0 items-center justify-center rounded-full border border-icons-primary\",\n \"group-data-[disabled]:border-content-disabled\",\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator asChild>\n <span className=\"size-2 rounded-full bg-content-primary\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"typography-body-default-16px-semibold truncate\">{children}</span>\n {helper && (\n <span\n className={cn(\n \"typography-description-12px-regular text-content-secondary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {helper}\n </span>\n )}\n </span>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\";\n\nexport interface DropdownMenuCheckboxItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> {\n /** Optional secondary text shown below the title. */\n helper?: string;\n /** Leading avatar rendered between the checkbox and the title. Render at 32px to match the design. */\n avatar?: React.ReactNode;\n}\n\n/**\n * A single multi-select choice within a dropdown menu. Shows a square indicator\n * that fills when checked, an optional leading avatar, and an optional helper\n * line underneath the title.\n *\n * Pair with {@link DropdownMenuHeader} at `type=\"search\"` for filterable menus.\n * Use {@link DropdownMenuRadioItem} instead when only one option may be active.\n *\n * @example\n * ```tsx\n * <DropdownMenuCheckboxItem\n * checked={selected.has(creator.id)}\n * onCheckedChange={() => toggle(creator.id)}\n * avatar={<Avatar size={32} src={creator.avatarUrl} />}\n * >\n * @sofiabloom\n * </DropdownMenuCheckboxItem>\n * ```\n */\nexport const DropdownMenuCheckboxItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n DropdownMenuCheckboxItemProps\n>(({ className, children, helper, avatar, ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"group flex w-full cursor-pointer items-center gap-3 rounded-md px-3 py-2 outline-none\",\n // Checked state is carried by the tick alone. A background here would\n // leave every selected row shaded, which reads as \"all highlighted\" on\n // a menu that starts fully selected.\n \"data-[highlighted]:bg-neutral-alphas-50\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-2xs border border-icons-primary\",\n \"group-data-[state=checked]:bg-icons-primary\",\n \"group-data-[disabled]:border-content-disabled\",\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator asChild>\n <TickIcon className=\"size-4 text-content-primary-inverted\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {avatar && <span className=\"shrink-0\">{avatar}</span>}\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"typography-body-default-16px-semibold truncate\">{children}</span>\n {helper && (\n <span\n className={cn(\n \"typography-description-12px-regular text-content-secondary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {helper}\n </span>\n )}\n </span>\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\";\n"],"names":["DropdownMenuPrimitive","React","jsxs","cn","jsx","TickIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,yBAAyBA,iCAAsB;AAkBrD,MAAM,wBAAwBC,iBAAM,WAGzC,CAAC,EAAE,WAAW,UAAU,QAAQ,MAAM,QAAQ,MAAM,GAAG,MAAA,GAAS,QAAQ;AACxE,SACEC,2BAAAA;AAAAA,IAACF,iCAAsB;AAAA,IAAtB;AAAA,MACC;AAAA,MACA,WAAWG,GAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,QAKT;AAAA,QACA;AAAA,QACA;AAAA;AAAA;AAAA;AAAA,QAIA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAAC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,GAAAA;AAAAA,cACT;AAAA,cACA;AAAA,YAAA;AAAA,YAEF,eAAY;AAAA,YAEZ,UAAAC,2BAAAA,IAACJ,iCAAsB,eAAtB,EAAoC,SAAO,MAC1C,UAAAI,2BAAAA,IAAC,QAAA,EAAK,WAAU,yCAAA,CAAyC,EAAA,CAC3D;AAAA,UAAA;AAAA,QAAA;AAAA,QAEFF,2BAAAA,KAAC,QAAA,EAAK,WAAU,sCACd,UAAA;AAAA,UAAAE,2BAAAA,IAAC,QAAA,EAAK,WAAU,kDAAkD,SAAA,CAAS;AAAA,UAC1E,UACCA,2BAAAA;AAAAA,YAA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