@fanvue/ui 3.30.0 → 3.32.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 (54) hide show
  1. package/dist/cjs/components/AiButton/AiButton.cjs +8 -6
  2. package/dist/cjs/components/AiButton/AiButton.cjs.map +1 -1
  3. package/dist/cjs/components/ChatInput/ChatInput.cjs +6 -5
  4. package/dist/cjs/components/ChatInput/ChatInput.cjs.map +1 -1
  5. package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs +190 -0
  6. package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs.map +1 -0
  7. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +213 -0
  8. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -0
  9. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs +438 -0
  10. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs.map +1 -0
  11. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +197 -0
  12. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -0
  13. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +221 -0
  14. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -0
  15. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +128 -0
  16. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -0
  17. package/dist/cjs/components/DropdownMenu/context.cjs +26 -0
  18. package/dist/cjs/components/DropdownMenu/context.cjs.map +1 -0
  19. package/dist/cjs/components/DropdownMenu/reorderShared.cjs +38 -0
  20. package/dist/cjs/components/DropdownMenu/reorderShared.cjs.map +1 -0
  21. package/dist/cjs/components/SwitchButton/SwitchButton.cjs +97 -0
  22. package/dist/cjs/components/SwitchButton/SwitchButton.cjs.map +1 -0
  23. package/dist/cjs/index.cjs +21 -12
  24. package/dist/cjs/index.cjs.map +1 -1
  25. package/dist/components/AiButton/AiButton.mjs +8 -6
  26. package/dist/components/AiButton/AiButton.mjs.map +1 -1
  27. package/dist/components/ChatInput/ChatInput.mjs +2 -1
  28. package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
  29. package/dist/components/DropdownMenu/DropdownMenuHeader.mjs +173 -0
  30. package/dist/components/DropdownMenu/DropdownMenuHeader.mjs.map +1 -0
  31. package/dist/components/DropdownMenu/DropdownMenuItem.mjs +195 -0
  32. package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -0
  33. package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs +421 -0
  34. package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs.map +1 -0
  35. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +180 -0
  36. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -0
  37. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +203 -0
  38. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -0
  39. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +110 -0
  40. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -0
  41. package/dist/components/DropdownMenu/context.mjs +9 -0
  42. package/dist/components/DropdownMenu/context.mjs.map +1 -0
  43. package/dist/components/DropdownMenu/reorderShared.mjs +21 -0
  44. package/dist/components/DropdownMenu/reorderShared.mjs.map +1 -0
  45. package/dist/components/SwitchButton/SwitchButton.mjs +80 -0
  46. package/dist/components/SwitchButton/SwitchButton.mjs.map +1 -0
  47. package/dist/index.d.ts +223 -1
  48. package/dist/index.mjs +10 -1
  49. package/dist/index.mjs.map +1 -1
  50. package/package.json +3 -2
  51. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +0 -598
  52. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +0 -1
  53. package/dist/components/DropdownMenu/DropdownMenu.mjs +0 -580
  54. package/dist/components/DropdownMenu/DropdownMenu.mjs.map +0 -1
@@ -0,0 +1,173 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../../utils/cn.mjs";
5
+ import { IconButton } from "../IconButton/IconButton.mjs";
6
+ import { ArrowLeftIcon } from "../Icons/ArrowLeftIcon.mjs";
7
+ import { CloseIcon } from "../Icons/CloseIcon.mjs";
8
+ import { SearchIcon } from "../Icons/SearchIcon.mjs";
9
+ import { ToggleOpenContext, DropdownMenuVariantContext } from "./context.mjs";
10
+ import { DropdownMenuSeparator } from "./DropdownMenuItem.mjs";
11
+ const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
12
+ "ArrowDown",
13
+ "ArrowUp",
14
+ "ArrowLeft",
15
+ "ArrowRight",
16
+ "Escape",
17
+ "Tab",
18
+ "Enter"
19
+ ]);
20
+ const DropdownMenuHeader = React.forwardRef(
21
+ ({
22
+ type = "default",
23
+ size = "40",
24
+ title,
25
+ searchProps,
26
+ actions,
27
+ showClose = true,
28
+ onClose,
29
+ closeLabel = "Close menu",
30
+ onBack,
31
+ showBack = onBack !== void 0,
32
+ backLabel = "Back",
33
+ className,
34
+ children,
35
+ ...props
36
+ }, ref) => {
37
+ const titleTypography = size === "32" ? "typography-body-small-14px-regular" : "typography-body-default-16px-regular";
38
+ const toggleOpen = React.useContext(ToggleOpenContext);
39
+ const variant = React.useContext(DropdownMenuVariantContext);
40
+ const handleClose = () => {
41
+ onClose?.();
42
+ toggleOpen?.(() => false);
43
+ };
44
+ return /* @__PURE__ */ jsxs(
45
+ "div",
46
+ {
47
+ ref,
48
+ className: cn(
49
+ "mb-1 flex flex-col px-1 pt-1",
50
+ // Search needs an 8px gap between the input and the divider; the
51
+ // default (title) variant uses 4px because the title baseline sits
52
+ // closer to the divider naturally.
53
+ type === "search" ? "gap-2" : "gap-1",
54
+ // With action buttons the design draws a roomier header: 12px above
55
+ // the 32px actions row (the panel's own 4px padding makes up the
56
+ // difference), 8px between it and the divider, and 8px between the
57
+ // divider and the first row.
58
+ actions != null && "mb-2 gap-2 pt-2",
59
+ // The sheet is a taller, roomier surface than a trigger-anchored panel:
60
+ // the design sets 16px between the rule and the first row, which this
61
+ // margin plus the panel's own 4px gap adds up to.
62
+ variant === "sheet" && "mb-3",
63
+ className
64
+ ),
65
+ ...props,
66
+ children: [
67
+ /* @__PURE__ */ jsxs(
68
+ "div",
69
+ {
70
+ className: cn(
71
+ "flex items-center gap-4",
72
+ // With action buttons the title sits a further 4px in (20px from
73
+ // the panel edge) than the close-only header's 16px. A back button
74
+ // supplies its own inset.
75
+ type === "default" && !showBack && (actions != null ? "pl-3" : "pl-2")
76
+ ),
77
+ children: [
78
+ showBack && /* @__PURE__ */ jsx("div", { "data-dropdown-menu-tab-stops": "", className: "flex shrink-0 items-center", children: /* @__PURE__ */ jsx(
79
+ IconButton,
80
+ {
81
+ variant: "tertiary",
82
+ size: "32",
83
+ icon: /* @__PURE__ */ jsx(ArrowLeftIcon, {}),
84
+ onClick: onBack,
85
+ "aria-label": backLabel
86
+ }
87
+ ) }),
88
+ type === "default" ? /* @__PURE__ */ jsx("div", { className: cn("min-w-0 flex-1 truncate text-content-primary", titleTypography), children: children ?? title }) : /* @__PURE__ */ jsx(SearchInput, { ...searchProps }),
89
+ (actions != null || showClose) && // The extra right margin only applies with action buttons: filled
90
+ // actions like a "Done" pill sit 12px off the panel edge, while the
91
+ // bare tertiary close icon keeps the header's own 8px inset.
92
+ /* @__PURE__ */ jsxs(
93
+ "div",
94
+ {
95
+ "data-dropdown-menu-tab-stops": "",
96
+ className: cn("flex shrink-0 items-center gap-1", actions != null && "mr-1"),
97
+ children: [
98
+ actions,
99
+ showClose && /* @__PURE__ */ jsx(
100
+ IconButton,
101
+ {
102
+ variant: "tertiary",
103
+ size: "32",
104
+ icon: /* @__PURE__ */ jsx(CloseIcon, {}),
105
+ onClick: handleClose,
106
+ "aria-label": closeLabel
107
+ }
108
+ )
109
+ ]
110
+ }
111
+ )
112
+ ]
113
+ }
114
+ ),
115
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "-mx-2 my-0 bg-border-strong" })
116
+ ]
117
+ }
118
+ );
119
+ }
120
+ );
121
+ DropdownMenuHeader.displayName = "DropdownMenuHeader";
122
+ function SearchInput({
123
+ value,
124
+ defaultValue,
125
+ onChange,
126
+ placeholder = "Search…",
127
+ "aria-label": ariaLabel = "Search",
128
+ autoFocus
129
+ } = {}) {
130
+ const inputRef = React.useRef(null);
131
+ React.useEffect(() => {
132
+ if (autoFocus) inputRef.current?.focus();
133
+ }, [autoFocus]);
134
+ return /* @__PURE__ */ jsxs(
135
+ "label",
136
+ {
137
+ "data-dropdown-menu-tab-stops": "",
138
+ className: cn(
139
+ "flex min-w-0 flex-1 items-center gap-2 rounded-xs border border-border-primary",
140
+ "bg-inputs-inputs-primary px-3 py-1 text-content-primary",
141
+ "focus-within:shadow-focus-ring focus-within:outline-none"
142
+ ),
143
+ children: [
144
+ /* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 text-content-primary", "aria-hidden": "true" }),
145
+ /* @__PURE__ */ jsx(
146
+ "input",
147
+ {
148
+ type: "search",
149
+ className: cn(
150
+ "typography-body-default-16px-regular min-w-0 flex-1 bg-transparent outline-none",
151
+ "placeholder:text-content-tertiary"
152
+ ),
153
+ ref: inputRef,
154
+ value,
155
+ defaultValue,
156
+ placeholder,
157
+ "aria-label": ariaLabel,
158
+ onChange: (event) => onChange?.(event.target.value),
159
+ onKeyDown: (event) => {
160
+ if (!NAVIGATION_KEYS.has(event.key)) event.stopPropagation();
161
+ },
162
+ onPointerDown: (event) => event.stopPropagation(),
163
+ onMouseDown: (event) => event.stopPropagation()
164
+ }
165
+ )
166
+ ]
167
+ }
168
+ );
169
+ }
170
+ export {
171
+ DropdownMenuHeader
172
+ };
173
+ //# sourceMappingURL=DropdownMenuHeader.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownMenuHeader.mjs","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-strong` is the colour the design gives this rule. The separator's\n * own default is `neutral-alphas-200`, which in the dark theme is a 20%\n * *white* alpha — as a hairline running the full width it reads as a white\n * line rather than a divider. Group separators between items keep the\n * alpha; this is the header's rule only.\n */}\n <DropdownMenuSeparator className=\"-mx-2 my-0 bg-border-strong\" />\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":[],"mappings":";;;;;;;;;;AAYA,MAAM,sCAAsB,IAAI;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAgFM,MAAM,qBAAqB,MAAM;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,aAAa,MAAM,WAAW,iBAAiB;AACrD,UAAM,UAAU,MAAM,WAAW,0BAA0B;AAE3D,UAAM,cAAc,MAAM;AACxB,gBAAA;AAIA,mBAAa,MAAM,KAAK;AAAA,IAC1B;AAEA,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA;AAAA;AAAA;AAAA,UAIA,SAA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AAA,EAGrE;AACF;AACA,mBAAmB,cAAc;AAEjC,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,cAAc,YAAY;AAAA,EAC1B;AACF,IAAmC,IAAI;AACrC,QAAM,WAAW,MAAM,OAAyB,IAAI;AAIpD,QAAM,UAAU,MAAM;AACpB,QAAI,UAAW,UAAS,SAAS,MAAA;AAAA,EACnC,GAAG,CAAC,SAAS,CAAC;AAEd,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,gCAA6B;AAAA,MAC7B,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAA,oBAAC,YAAA,EAAW,WAAU,wCAAuC,eAAY,QAAO;AAAA,QAChF;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAW;AAAA,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;"}
@@ -0,0 +1,195 @@
1
+ "use client";
2
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
4
+ import { Slot } from "@radix-ui/react-slot";
5
+ import * as React from "react";
6
+ import { cn } from "../../utils/cn.mjs";
7
+ import { CheckIcon } from "../Icons/CheckIcon.mjs";
8
+ import { DropdownMenuVariantContext, ToggleOpenContext } from "./context.mjs";
9
+ const DropdownMenuLabel = React.forwardRef(({ className, position = "default", ...props }, ref) => {
10
+ const variant = React.useContext(DropdownMenuVariantContext);
11
+ const labelClassName = cn(
12
+ "typography-description-12px-regular flex items-center px-3 text-content-secondary",
13
+ position === "top" ? "py-2" : "pt-4 pb-2",
14
+ className
15
+ );
16
+ if (variant === "sheet") {
17
+ return /* @__PURE__ */ jsx("div", { ref, className: labelClassName, ...props });
18
+ }
19
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, { ref, className: labelClassName, ...props });
20
+ });
21
+ DropdownMenuLabel.displayName = "DropdownMenuLabel";
22
+ const SIZE_NORMALIZED = {
23
+ "40": "40",
24
+ md: "40",
25
+ "32": "32",
26
+ sm: "32"
27
+ };
28
+ const ITEM_SIZE_CLASSES = {
29
+ "40": "min-h-10 py-2 typography-body-default-16px-regular",
30
+ "32": "min-h-8 py-[7px] typography-body-small-14px-regular"
31
+ };
32
+ const ITEM_COUNT_TYPOGRAPHY = {
33
+ "40": "typography-body-small-14px-regular",
34
+ "32": "typography-body-small-14px-regular"
35
+ };
36
+ function SelectedCheckIndicator({ hasDescription }) {
37
+ return /* @__PURE__ */ jsx(
38
+ CheckIcon,
39
+ {
40
+ className: cn(
41
+ "size-4 shrink-0 text-content-primary",
42
+ // The two-line layout switches the row to `items-start`, which would hang
43
+ // the tick off the title's line. A leading icon or avatar belongs there —
44
+ // it labels the title — but the tick is a property of the whole row, so it
45
+ // centres against both lines. {@link SelectItem} already does this.
46
+ hasDescription && "self-center"
47
+ )
48
+ }
49
+ );
50
+ }
51
+ const DropdownMenuItem = React.forwardRef(
52
+ ({
53
+ size = "40",
54
+ destructive,
55
+ leadingIcon,
56
+ avatar,
57
+ trailingIcon,
58
+ count,
59
+ description,
60
+ selected,
61
+ className,
62
+ children,
63
+ asChild,
64
+ onSelect,
65
+ disabled,
66
+ ...props
67
+ }, ref) => {
68
+ const variant = React.useContext(DropdownMenuVariantContext);
69
+ const toggleOpen = React.useContext(ToggleOpenContext);
70
+ const normalizedSize = SIZE_NORMALIZED[size];
71
+ const hasDescription = description != null;
72
+ const hasAvatar = avatar != null;
73
+ const itemClassName = cn(
74
+ // `text-start` because the sheet variant renders the row as a <button>,
75
+ // whose UA-centred text misaligned it from the popper variant's rows.
76
+ "group flex w-full cursor-pointer gap-2 rounded-sm px-3 text-start outline-none",
77
+ hasDescription ? "items-start" : "items-center",
78
+ // The sheet's header runs the full width of the panel, so its rows have to
79
+ // come in off the edge themselves — 12px here on the panel's own 4px is the
80
+ // design's 16px. `w-auto` lets the column stretch them to the space left
81
+ // over; `w-full` plus a margin would overflow.
82
+ variant === "sheet" && "mx-3 w-auto",
83
+ ITEM_SIZE_CLASSES[normalizedSize],
84
+ // A 24px avatar would push the compact 32px row past its height with the
85
+ // default padding; tighten it so the avatar variant keeps the 32px contract.
86
+ hasAvatar && !hasDescription && normalizedSize === "32" && "py-1",
87
+ "data-[highlighted]:bg-neutral-alphas-50",
88
+ "data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled",
89
+ "disabled:cursor-not-allowed disabled:text-content-disabled",
90
+ // Sheet-variant asChild items are marked disabled via aria-disabled
91
+ // (see below), not the native disabled attribute or Radix's
92
+ // data-disabled — neither selector above matches them.
93
+ "aria-disabled:cursor-not-allowed aria-disabled:text-content-disabled",
94
+ destructive && "text-error-content",
95
+ // bg-interaction-hover aliases to the same token as the plain hover
96
+ // background above, so a selected row would be indistinguishable from a
97
+ // hovered-but-unselected one. Use the next step up the neutral-alphas
98
+ // ramp instead (still a subtle overlay, not the heavy filled style).
99
+ selected && ["bg-neutral-alphas-100", "data-[highlighted]:bg-neutral-alphas-200"],
100
+ className
101
+ );
102
+ const iconAlignClassName = hasDescription ? "flex h-[18px] shrink-0 items-center" : null;
103
+ const countNode = count != null && /* @__PURE__ */ jsx(
104
+ "span",
105
+ {
106
+ className: cn(
107
+ "shrink-0 tabular-nums",
108
+ iconAlignClassName,
109
+ ITEM_COUNT_TYPOGRAPHY[normalizedSize],
110
+ destructive ? "text-error-content" : "text-content-tertiary",
111
+ "group-data-[disabled]:text-content-disabled"
112
+ ),
113
+ children: count
114
+ }
115
+ );
116
+ const trailingNode = trailingIcon != null ? hasDescription ? /* @__PURE__ */ jsx("span", { className: iconAlignClassName, children: trailingIcon }) : trailingIcon : selected && /* @__PURE__ */ jsx(SelectedCheckIndicator, { hasDescription });
117
+ const itemChildren = /* @__PURE__ */ jsxs(Fragment, { children: [
118
+ avatar != null ? /* @__PURE__ */ jsx("span", { className: cn("shrink-0", iconAlignClassName), children: avatar }) : leadingIcon != null && (hasDescription ? /* @__PURE__ */ jsx("span", { className: iconAlignClassName, children: leadingIcon }) : leadingIcon),
119
+ hasDescription ? /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
120
+ /* @__PURE__ */ jsx("span", { className: "typography-body-small-14px-semibold truncate", children }),
121
+ /* @__PURE__ */ jsx("span", { className: "typography-body-small-14px-regular truncate text-content-secondary", children: description })
122
+ ] }) : /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children }),
123
+ countNode,
124
+ trailingNode
125
+ ] });
126
+ if (variant === "sheet") {
127
+ const Comp = asChild ? Slot : "button";
128
+ const { onClick: consumerOnClick, ...restProps } = props;
129
+ const sheetSpecificProps = !asChild ? { type: "button", disabled } : disabled ? { "aria-disabled": true } : {};
130
+ return /* @__PURE__ */ jsx(
131
+ Comp,
132
+ {
133
+ ref,
134
+ ...restProps,
135
+ ...sheetSpecificProps,
136
+ role: "option",
137
+ "aria-selected": selected,
138
+ className: itemClassName,
139
+ onClick: (event) => {
140
+ if (disabled) {
141
+ event.preventDefault();
142
+ return;
143
+ }
144
+ consumerOnClick?.(event);
145
+ if (event.defaultPrevented) return;
146
+ onSelect?.(event.nativeEvent);
147
+ if (!event.nativeEvent.defaultPrevented) toggleOpen?.(() => false);
148
+ },
149
+ children: asChild ? children : itemChildren
150
+ }
151
+ );
152
+ }
153
+ if (asChild) {
154
+ return /* @__PURE__ */ jsx(
155
+ DropdownMenuPrimitive.Item,
156
+ {
157
+ ref,
158
+ asChild: true,
159
+ className: itemClassName,
160
+ disabled,
161
+ onSelect,
162
+ ...props,
163
+ children
164
+ }
165
+ );
166
+ }
167
+ return /* @__PURE__ */ jsx(
168
+ DropdownMenuPrimitive.Item,
169
+ {
170
+ ref,
171
+ className: itemClassName,
172
+ disabled,
173
+ onSelect,
174
+ ...props,
175
+ children: itemChildren
176
+ }
177
+ );
178
+ }
179
+ );
180
+ DropdownMenuItem.displayName = "DropdownMenuItem";
181
+ const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => {
182
+ const variant = React.useContext(DropdownMenuVariantContext);
183
+ const separatorClassName = cn("my-1 h-px bg-neutral-alphas-200", className);
184
+ if (variant === "sheet") {
185
+ return /* @__PURE__ */ jsx("hr", { ref, className: separatorClassName, ...props });
186
+ }
187
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, { ref, className: separatorClassName, ...props });
188
+ });
189
+ DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
190
+ export {
191
+ DropdownMenuItem,
192
+ DropdownMenuLabel,
193
+ DropdownMenuSeparator
194
+ };
195
+ //# sourceMappingURL=DropdownMenuItem.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownMenuItem.mjs","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 { CheckIcon } from \"../Icons/CheckIcon\";\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\n// Background alone can't reliably tell \"selected\" apart from a\n// hovered-but-unselected row across every theme/contrast combination (see the\n// neutral-alphas fix on itemClassName below) — pair it with an explicit\n// indicator, matching SelectItem's check indicator for the same V2 Menu Item\n// spec.\nfunction SelectedCheckIndicator({ hasDescription }: { hasDescription: boolean }) {\n return (\n <CheckIcon\n className={cn(\n \"size-4 shrink-0 text-content-primary\",\n // The two-line layout switches the row to `items-start`, which would hang\n // the tick off the title's line. A leading icon or avatar belongs there —\n // it labels the title — but the tick is a property of the whole row, so it\n // centres against both lines. {@link SelectItem} already does this.\n hasDescription && \"self-center\",\n )}\n />\n );\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. When\n * {@link DropdownMenuItemProps.selected} is true and no `trailingIcon` is\n * given, the built-in selected check indicator renders in this slot\n * instead — pass a `trailingIcon` to use a custom selected indicator (e.g.\n * a themed tick) rather than the default one.\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-sm 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 // bg-interaction-hover aliases to the same token as the plain hover\n // background above, so a selected row would be indistinguishable from a\n // hovered-but-unselected one. Use the next step up the neutral-alphas\n // ramp instead (still a subtle overlay, not the heavy filled style).\n selected && [\"bg-neutral-alphas-100\", \"data-[highlighted]:bg-neutral-alphas-200\"],\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 ? \"text-error-content\" : \"text-content-tertiary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {count}\n </span>\n );\n\n // A caller-supplied trailingIcon always wins the trailing slot — some\n // consumers pass their own selected indicator (e.g. a themed tick) and\n // rely on it being shown as-is rather than replaced. Only fall back to\n // the built-in check indicator when selected and no trailingIcon is given.\n const trailingNode =\n trailingIcon != null ? (\n hasDescription ? (\n <span className={iconAlignClassName!}>{trailingIcon}</span>\n ) : (\n trailingIcon\n )\n ) : (\n selected && <SelectedCheckIndicator hasDescription={hasDescription} />\n );\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 className=\"typography-body-small-14px-regular truncate text-content-secondary\">\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":[],"mappings":";;;;;;;;AAsBO,MAAM,oBAAoB,MAAM,WAGrC,CAAC,EAAE,WAAW,WAAW,WAAW,GAAG,MAAA,GAAS,QAAQ;AACxD,QAAM,UAAU,MAAM,WAAW,0BAA0B;AAC3D,QAAM,iBAAiB;AAAA,IACrB;AAAA,IACA,aAAa,QAAQ,SAAS;AAAA,IAC9B;AAAA,EAAA;AAKF,MAAI,YAAY,SAAS;AACvB,+BAAQ,OAAA,EAAI,KAAU,WAAW,gBAAiB,GAAG,OAAO;AAAA,EAC9D;AAEA,SAAO,oBAAC,sBAAsB,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;AAOA,SAAS,uBAAuB,EAAE,kBAA+C;AAC/E,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,kBAAkB;AAAA,MAAA;AAAA,IACpB;AAAA,EAAA;AAGN;AAwDO,MAAM,mBAAmB,MAAM;AAAA,EAIpC,CACE;AAAA,IACE,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,UAAU,MAAM,WAAW,0B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