@fanvue/ui 3.31.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 (46) hide show
  1. package/dist/cjs/components/ChatInput/ChatInput.cjs +6 -5
  2. package/dist/cjs/components/ChatInput/ChatInput.cjs.map +1 -1
  3. package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs +190 -0
  4. package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs.map +1 -0
  5. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +213 -0
  6. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -0
  7. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs +438 -0
  8. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs.map +1 -0
  9. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +197 -0
  10. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -0
  11. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +221 -0
  12. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -0
  13. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +128 -0
  14. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -0
  15. package/dist/cjs/components/DropdownMenu/context.cjs +26 -0
  16. package/dist/cjs/components/DropdownMenu/context.cjs.map +1 -0
  17. package/dist/cjs/components/DropdownMenu/reorderShared.cjs +38 -0
  18. package/dist/cjs/components/DropdownMenu/reorderShared.cjs.map +1 -0
  19. package/dist/cjs/index.cjs +19 -12
  20. package/dist/cjs/index.cjs.map +1 -1
  21. package/dist/components/ChatInput/ChatInput.mjs +2 -1
  22. package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
  23. package/dist/components/DropdownMenu/DropdownMenuHeader.mjs +173 -0
  24. package/dist/components/DropdownMenu/DropdownMenuHeader.mjs.map +1 -0
  25. package/dist/components/DropdownMenu/DropdownMenuItem.mjs +195 -0
  26. package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -0
  27. package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs +421 -0
  28. package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs.map +1 -0
  29. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +180 -0
  30. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -0
  31. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +203 -0
  32. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -0
  33. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +110 -0
  34. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -0
  35. package/dist/components/DropdownMenu/context.mjs +9 -0
  36. package/dist/components/DropdownMenu/context.mjs.map +1 -0
  37. package/dist/components/DropdownMenu/reorderShared.mjs +21 -0
  38. package/dist/components/DropdownMenu/reorderShared.mjs.map +1 -0
  39. package/dist/index.d.ts +121 -1
  40. package/dist/index.mjs +8 -1
  41. package/dist/index.mjs.map +1 -1
  42. package/package.json +3 -2
  43. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +0 -598
  44. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +0 -1
  45. package/dist/components/DropdownMenu/DropdownMenu.mjs +0 -580
  46. package/dist/components/DropdownMenu/DropdownMenu.mjs.map +0 -1
@@ -1,580 +0,0 @@
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 { useControllableState } from "@radix-ui/react-use-controllable-state";
6
- import * as React from "react";
7
- import { cn } from "../../utils/cn.mjs";
8
- import { FLOATING_CONTENT_COLLISION_PADDING } from "../../utils/floatingContentCollisionPadding.mjs";
9
- import { Drawer, DrawerContent, DrawerTrigger } from "../Drawer/Drawer.mjs";
10
- import { IconButton } from "../IconButton/IconButton.mjs";
11
- import { CheckIcon } from "../Icons/CheckIcon.mjs";
12
- import { CloseIcon } from "../Icons/CloseIcon.mjs";
13
- import { SearchIcon } from "../Icons/SearchIcon.mjs";
14
- import { TickIcon } from "../Icons/TickIcon.mjs";
15
- const TAP_MOVEMENT_THRESHOLD_PX = 10;
16
- const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
17
- "ArrowDown",
18
- "ArrowUp",
19
- "ArrowLeft",
20
- "ArrowRight",
21
- "Escape",
22
- "Tab",
23
- "Enter"
24
- ]);
25
- const ToggleOpenContext = React.createContext(null);
26
- const DropdownMenuVariantContext = React.createContext("menu");
27
- function DropdownMenu({
28
- open: openProp,
29
- defaultOpen,
30
- onOpenChange,
31
- variant = "menu",
32
- children,
33
- ...props
34
- }) {
35
- const [open = false, setOpen] = useControllableState({
36
- prop: openProp,
37
- defaultProp: defaultOpen ?? false,
38
- onChange: onOpenChange
39
- });
40
- if (variant === "sheet") {
41
- return /* @__PURE__ */ jsx(DropdownMenuVariantContext.Provider, { value: "sheet", children: /* @__PURE__ */ jsx(ToggleOpenContext.Provider, { value: setOpen, children: /* @__PURE__ */ jsx(Drawer, { open, onOpenChange: setOpen, children }) }) });
42
- }
43
- return /* @__PURE__ */ jsx(DropdownMenuVariantContext.Provider, { value: "menu", children: /* @__PURE__ */ jsx(ToggleOpenContext.Provider, { value: setOpen, children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { open, onOpenChange: setOpen, ...props, children }) }) });
44
- }
45
- const DropdownMenuTrigger = React.forwardRef((props, ref) => {
46
- const variant = React.useContext(DropdownMenuVariantContext);
47
- const toggleOpen = React.useContext(ToggleOpenContext);
48
- const tapRef = React.useRef(null);
49
- if (variant === "sheet") {
50
- return /* @__PURE__ */ jsx(DrawerTrigger, { ...props, ref });
51
- }
52
- if (toggleOpen === null) {
53
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, { ...props, ref });
54
- }
55
- return /* @__PURE__ */ jsx(
56
- DropdownMenuPrimitive.Trigger,
57
- {
58
- ...props,
59
- ref,
60
- onPointerDown: (event) => {
61
- props.onPointerDown?.(event);
62
- if (event.pointerType === "mouse" || props.disabled) return;
63
- event.currentTarget.setPointerCapture?.(event.pointerId);
64
- tapRef.current = {
65
- pointerId: event.pointerId,
66
- x: event.clientX,
67
- y: event.clientY,
68
- movedPastThreshold: false
69
- };
70
- event.preventDefault();
71
- },
72
- onPointerMove: (event) => {
73
- props.onPointerMove?.(event);
74
- const tap = tapRef.current;
75
- if (tap === null || event.pointerId !== tap.pointerId || tap.movedPastThreshold) {
76
- return;
77
- }
78
- const dx = event.clientX - tap.x;
79
- const dy = event.clientY - tap.y;
80
- if (Math.hypot(dx, dy) > TAP_MOVEMENT_THRESHOLD_PX) {
81
- tap.movedPastThreshold = true;
82
- }
83
- },
84
- onPointerUp: (event) => {
85
- props.onPointerUp?.(event);
86
- const tap = tapRef.current;
87
- if (tap === null || event.pointerId !== tap.pointerId) return;
88
- const wasDrag = tap.movedPastThreshold;
89
- tapRef.current = null;
90
- if (!wasDrag && !props.disabled) {
91
- toggleOpen((prev) => !prev);
92
- }
93
- },
94
- onPointerCancel: (event) => {
95
- props.onPointerCancel?.(event);
96
- const tap = tapRef.current;
97
- if (tap !== null && event.pointerId === tap.pointerId) {
98
- tapRef.current = null;
99
- }
100
- }
101
- }
102
- );
103
- });
104
- DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
105
- const DropdownMenuContent = React.forwardRef(
106
- ({
107
- className,
108
- style,
109
- sideOffset = 4,
110
- // Radix defaults `avoidCollisions` to true, so passing `collisionPadding`
111
- // is enough to keep the menu flipping/shifting to stay on screen — no
112
- // hand-rolled reposition logic needed.
113
- collisionPadding = FLOATING_CONTENT_COLLISION_PADDING,
114
- onPointerDownOutside,
115
- onCloseAutoFocus,
116
- children,
117
- ...props
118
- }, ref) => {
119
- const variant = React.useContext(DropdownMenuVariantContext);
120
- const dismissedByPointer = React.useRef(false);
121
- if (variant === "sheet") {
122
- return /* @__PURE__ */ jsx(
123
- DrawerContent,
124
- {
125
- ref,
126
- position: "bottom",
127
- variant: "menu",
128
- overlayProps: { className: "backdrop-blur-[8px]" },
129
- className: cn("flex flex-col gap-1 p-1 pb-4", className),
130
- style,
131
- onPointerDownOutside,
132
- onCloseAutoFocus,
133
- ...props,
134
- children
135
- }
136
- );
137
- }
138
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
139
- DropdownMenuPrimitive.Content,
140
- {
141
- ref,
142
- onPointerDownOutside: (event) => {
143
- dismissedByPointer.current = true;
144
- onPointerDownOutside?.(event);
145
- },
146
- onCloseAutoFocus: (event) => {
147
- if (dismissedByPointer.current) event.preventDefault();
148
- dismissedByPointer.current = false;
149
- onCloseAutoFocus?.(event);
150
- },
151
- sideOffset,
152
- collisionPadding,
153
- className: cn(
154
- // `rounded-sm` (12px) is the panel radius `V2 Menu Dropdown` carries
155
- // (product file node `7393:62008`). The 8px `rounded-xs` belongs to the
156
- // rows inside it, not the panel.
157
- //
158
- // The `sheet` variant is deliberately not 12px: it renders through
159
- // `DrawerContent variant="menu"`, whose `MENU_CLASSES` is `rounded-lg`
160
- // (24px). A bottom sheet is a full-width surface with its own radius,
161
- // not a scaled-up popper, so the two are meant to differ.
162
- "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-menu backdrop-blur-[4px]",
163
- "data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in",
164
- "data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out",
165
- "data-[side=top]:slide-in-from-bottom-2 data-[side=bottom]:slide-in-from-top-2",
166
- "data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
167
- className
168
- ),
169
- style: {
170
- zIndex: "var(--fanvue-ui-portal-z-index, 50)",
171
- maxHeight: "var(--radix-dropdown-menu-content-available-height)",
172
- ...style
173
- },
174
- ...props,
175
- children
176
- }
177
- ) });
178
- }
179
- );
180
- DropdownMenuContent.displayName = "DropdownMenuContent";
181
- const DropdownMenuGroup = DropdownMenuPrimitive.Group;
182
- DropdownMenuGroup.displayName = "DropdownMenuGroup";
183
- const DropdownMenuLabel = React.forwardRef(({ className, position = "default", ...props }, ref) => {
184
- const variant = React.useContext(DropdownMenuVariantContext);
185
- const labelClassName = cn(
186
- "typography-description-12px-regular flex items-center px-3 text-content-secondary",
187
- position === "top" ? "py-2" : "pt-4 pb-2",
188
- className
189
- );
190
- if (variant === "sheet") {
191
- return /* @__PURE__ */ jsx("div", { ref, className: labelClassName, ...props });
192
- }
193
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, { ref, className: labelClassName, ...props });
194
- });
195
- DropdownMenuLabel.displayName = "DropdownMenuLabel";
196
- const SIZE_NORMALIZED = {
197
- "40": "40",
198
- md: "40",
199
- "32": "32",
200
- sm: "32"
201
- };
202
- const ITEM_SIZE_CLASSES = {
203
- "40": "min-h-10 py-2 typography-body-default-16px-regular",
204
- "32": "min-h-8 py-[7px] typography-body-small-14px-regular"
205
- };
206
- const ITEM_COUNT_TYPOGRAPHY = {
207
- "40": "typography-body-small-14px-regular",
208
- "32": "typography-body-small-14px-regular"
209
- };
210
- function SelectedCheckIndicator({ hasDescription }) {
211
- return /* @__PURE__ */ jsx(
212
- CheckIcon,
213
- {
214
- className: cn(
215
- "size-4 shrink-0 text-content-primary",
216
- // The two-line layout switches the row to `items-start`, which would hang
217
- // the tick off the title's line. A leading icon or avatar belongs there —
218
- // it labels the title — but the tick is a property of the whole row, so it
219
- // centres against both lines. {@link SelectItem} already does this.
220
- hasDescription && "self-center"
221
- )
222
- }
223
- );
224
- }
225
- const DropdownMenuItem = React.forwardRef(
226
- ({
227
- size = "40",
228
- destructive,
229
- leadingIcon,
230
- avatar,
231
- trailingIcon,
232
- count,
233
- description,
234
- selected,
235
- className,
236
- children,
237
- asChild,
238
- onSelect,
239
- disabled,
240
- ...props
241
- }, ref) => {
242
- const variant = React.useContext(DropdownMenuVariantContext);
243
- const toggleOpen = React.useContext(ToggleOpenContext);
244
- const normalizedSize = SIZE_NORMALIZED[size];
245
- const hasDescription = description != null;
246
- const hasAvatar = avatar != null;
247
- const itemClassName = cn(
248
- // `text-start` because the sheet variant renders the row as a <button>,
249
- // whose UA-centred text misaligned it from the popper variant's rows.
250
- "group flex w-full cursor-pointer gap-2 rounded-sm px-3 text-start outline-none",
251
- hasDescription ? "items-start" : "items-center",
252
- // The sheet's header runs the full width of the panel, so its rows have to
253
- // come in off the edge themselves — 12px here on the panel's own 4px is the
254
- // design's 16px. `w-auto` lets the column stretch them to the space left
255
- // over; `w-full` plus a margin would overflow.
256
- variant === "sheet" && "mx-3 w-auto",
257
- ITEM_SIZE_CLASSES[normalizedSize],
258
- // A 24px avatar would push the compact 32px row past its height with the
259
- // default padding; tighten it so the avatar variant keeps the 32px contract.
260
- hasAvatar && !hasDescription && normalizedSize === "32" && "py-1",
261
- "data-[highlighted]:bg-neutral-alphas-50",
262
- "data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled",
263
- "disabled:cursor-not-allowed disabled:text-content-disabled",
264
- // Sheet-variant asChild items are marked disabled via aria-disabled
265
- // (see below), not the native disabled attribute or Radix's
266
- // data-disabled — neither selector above matches them.
267
- "aria-disabled:cursor-not-allowed aria-disabled:text-content-disabled",
268
- destructive && "text-error-content",
269
- // bg-interaction-hover aliases to the same token as the plain hover
270
- // background above, so a selected row would be indistinguishable from a
271
- // hovered-but-unselected one. Use the next step up the neutral-alphas
272
- // ramp instead (still a subtle overlay, not the heavy filled style).
273
- selected && ["bg-neutral-alphas-100", "data-[highlighted]:bg-neutral-alphas-200"],
274
- className
275
- );
276
- const iconAlignClassName = hasDescription ? "flex h-[18px] shrink-0 items-center" : null;
277
- const countNode = count != null && /* @__PURE__ */ jsx(
278
- "span",
279
- {
280
- className: cn(
281
- "shrink-0 tabular-nums",
282
- iconAlignClassName,
283
- ITEM_COUNT_TYPOGRAPHY[normalizedSize],
284
- destructive ? "text-error-content" : "text-content-tertiary",
285
- "group-data-[disabled]:text-content-disabled"
286
- ),
287
- children: count
288
- }
289
- );
290
- const trailingNode = trailingIcon != null ? hasDescription ? /* @__PURE__ */ jsx("span", { className: iconAlignClassName, children: trailingIcon }) : trailingIcon : selected && /* @__PURE__ */ jsx(SelectedCheckIndicator, { hasDescription });
291
- const itemChildren = /* @__PURE__ */ jsxs(Fragment, { children: [
292
- avatar != null ? /* @__PURE__ */ jsx("span", { className: cn("shrink-0", iconAlignClassName), children: avatar }) : leadingIcon != null && (hasDescription ? /* @__PURE__ */ jsx("span", { className: iconAlignClassName, children: leadingIcon }) : leadingIcon),
293
- hasDescription ? /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
294
- /* @__PURE__ */ jsx("span", { className: "typography-body-small-14px-semibold truncate", children }),
295
- /* @__PURE__ */ jsx("span", { className: "typography-body-small-14px-regular truncate text-content-secondary", children: description })
296
- ] }) : /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children }),
297
- countNode,
298
- trailingNode
299
- ] });
300
- if (variant === "sheet") {
301
- const Comp = asChild ? Slot : "button";
302
- const { onClick: consumerOnClick, ...restProps } = props;
303
- const sheetSpecificProps = !asChild ? { type: "button", disabled } : disabled ? { "aria-disabled": true } : {};
304
- return /* @__PURE__ */ jsx(
305
- Comp,
306
- {
307
- ref,
308
- ...restProps,
309
- ...sheetSpecificProps,
310
- role: "option",
311
- "aria-selected": selected,
312
- className: itemClassName,
313
- onClick: (event) => {
314
- if (disabled) {
315
- event.preventDefault();
316
- return;
317
- }
318
- consumerOnClick?.(event);
319
- if (event.defaultPrevented) return;
320
- onSelect?.(event.nativeEvent);
321
- if (!event.nativeEvent.defaultPrevented) toggleOpen?.(() => false);
322
- },
323
- children: asChild ? children : itemChildren
324
- }
325
- );
326
- }
327
- if (asChild) {
328
- return /* @__PURE__ */ jsx(
329
- DropdownMenuPrimitive.Item,
330
- {
331
- ref,
332
- asChild: true,
333
- className: itemClassName,
334
- disabled,
335
- onSelect,
336
- ...props,
337
- children
338
- }
339
- );
340
- }
341
- return /* @__PURE__ */ jsx(
342
- DropdownMenuPrimitive.Item,
343
- {
344
- ref,
345
- className: itemClassName,
346
- disabled,
347
- onSelect,
348
- ...props,
349
- children: itemChildren
350
- }
351
- );
352
- }
353
- );
354
- DropdownMenuItem.displayName = "DropdownMenuItem";
355
- const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => {
356
- const variant = React.useContext(DropdownMenuVariantContext);
357
- const separatorClassName = cn("my-1 h-px bg-neutral-alphas-200", className);
358
- if (variant === "sheet") {
359
- return /* @__PURE__ */ jsx("hr", { ref, className: separatorClassName, ...props });
360
- }
361
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, { ref, className: separatorClassName, ...props });
362
- });
363
- DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
364
- const DropdownMenuHeader = React.forwardRef(
365
- ({
366
- type = "default",
367
- size = "40",
368
- title,
369
- searchProps,
370
- showClose = true,
371
- onClose,
372
- closeLabel = "Close menu",
373
- className,
374
- children,
375
- ...props
376
- }, ref) => {
377
- const titleTypography = size === "32" ? "typography-body-small-14px-regular" : "typography-body-default-16px-regular";
378
- const toggleOpen = React.useContext(ToggleOpenContext);
379
- const variant = React.useContext(DropdownMenuVariantContext);
380
- const handleClose = () => {
381
- onClose?.();
382
- toggleOpen?.(() => false);
383
- };
384
- return /* @__PURE__ */ jsxs(
385
- "div",
386
- {
387
- ref,
388
- className: cn(
389
- "mb-1 flex flex-col px-1 pt-1",
390
- // Search needs an 8px gap between the input and the divider; the
391
- // default (title) variant uses 4px because the title baseline sits
392
- // closer to the divider naturally.
393
- type === "search" ? "gap-2" : "gap-1",
394
- // The sheet is a taller, roomier surface than a trigger-anchored panel:
395
- // the design sets 16px between the rule and the first row, which this
396
- // margin plus the panel's own 4px gap adds up to.
397
- variant === "sheet" && "mb-3",
398
- className
399
- ),
400
- ...props,
401
- children: [
402
- /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-4", type === "default" && "pl-2"), children: [
403
- type === "default" ? /* @__PURE__ */ jsx("div", { className: cn("min-w-0 flex-1 truncate text-content-primary", titleTypography), children: children ?? title }) : /* @__PURE__ */ jsx(SearchInput, { ...searchProps }),
404
- showClose && /* @__PURE__ */ jsx(
405
- IconButton,
406
- {
407
- variant: "tertiary",
408
- size: "32",
409
- icon: /* @__PURE__ */ jsx(CloseIcon, {}),
410
- onClick: handleClose,
411
- "aria-label": closeLabel
412
- }
413
- )
414
- ] }),
415
- /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "-mx-2 my-0 bg-border-strong" })
416
- ]
417
- }
418
- );
419
- }
420
- );
421
- DropdownMenuHeader.displayName = "DropdownMenuHeader";
422
- function SearchInput({
423
- value,
424
- defaultValue,
425
- onChange,
426
- placeholder = "Search…",
427
- "aria-label": ariaLabel = "Search",
428
- autoFocus
429
- } = {}) {
430
- const inputRef = React.useRef(null);
431
- React.useEffect(() => {
432
- if (autoFocus) inputRef.current?.focus();
433
- }, [autoFocus]);
434
- return /* @__PURE__ */ jsxs(
435
- "label",
436
- {
437
- className: cn(
438
- "flex min-w-0 flex-1 items-center gap-2 rounded-xs border border-border-primary",
439
- "bg-inputs-inputs-primary px-3 py-1 text-content-primary",
440
- "focus-within:shadow-focus-ring focus-within:outline-none"
441
- ),
442
- children: [
443
- /* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 text-content-primary", "aria-hidden": "true" }),
444
- /* @__PURE__ */ jsx(
445
- "input",
446
- {
447
- type: "search",
448
- className: cn(
449
- "typography-body-default-16px-regular min-w-0 flex-1 bg-transparent outline-none",
450
- "placeholder:text-content-tertiary"
451
- ),
452
- ref: inputRef,
453
- value,
454
- defaultValue,
455
- placeholder,
456
- "aria-label": ariaLabel,
457
- onChange: (event) => onChange?.(event.target.value),
458
- onKeyDown: (event) => {
459
- if (!NAVIGATION_KEYS.has(event.key)) event.stopPropagation();
460
- },
461
- onPointerDown: (event) => event.stopPropagation(),
462
- onMouseDown: (event) => event.stopPropagation()
463
- }
464
- )
465
- ]
466
- }
467
- );
468
- }
469
- const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
470
- const DropdownMenuRadioItem = React.forwardRef(({ className, children, helper, size: _size = "40", ...props }, ref) => {
471
- return /* @__PURE__ */ jsxs(
472
- DropdownMenuPrimitive.RadioItem,
473
- {
474
- ref,
475
- className: cn(
476
- // `px-3` (12px), not 16px: `V2 Menu Radio Item` is `px-[12px] py-[8px]`
477
- // (node `7393:62008`), and at 16px a radio row indented 4px further than a
478
- // `DropdownMenuCheckboxItem` in the same menu.
479
- "group flex w-full cursor-pointer items-start gap-3 rounded-xs px-3 py-2 outline-none",
480
- "data-[highlighted]:bg-neutral-alphas-50",
481
- "data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled",
482
- // See DropdownMenuItem above: bg-interaction-hover aliases to the same
483
- // token as the plain hover background, so it can't distinguish the
484
- // checked state from an unchecked-but-hovered row.
485
- "data-[state=checked]:bg-neutral-alphas-100",
486
- "data-[state=checked]:data-[highlighted]:bg-neutral-alphas-200",
487
- className
488
- ),
489
- ...props,
490
- children: [
491
- /* @__PURE__ */ jsx(
492
- "span",
493
- {
494
- className: cn(
495
- "mt-1 flex size-4 shrink-0 items-center justify-center rounded-full border border-icons-primary",
496
- "group-data-[disabled]:border-content-disabled"
497
- ),
498
- "aria-hidden": "true",
499
- children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-content-primary" }) })
500
- }
501
- ),
502
- /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
503
- /* @__PURE__ */ jsx("span", { className: "typography-body-default-16px-semibold truncate", children }),
504
- helper && /* @__PURE__ */ jsx(
505
- "span",
506
- {
507
- className: cn(
508
- "typography-description-12px-regular text-content-secondary",
509
- "group-data-[disabled]:text-content-disabled"
510
- ),
511
- children: helper
512
- }
513
- )
514
- ] })
515
- ]
516
- }
517
- );
518
- });
519
- DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";
520
- const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, helper, avatar, ...props }, ref) => {
521
- return /* @__PURE__ */ jsxs(
522
- DropdownMenuPrimitive.CheckboxItem,
523
- {
524
- ref,
525
- className: cn(
526
- "group flex w-full cursor-pointer items-center gap-3 rounded-xs px-3 py-2 outline-none",
527
- // Checked state is carried by the tick alone. A background here would
528
- // leave every selected row shaded, which reads as "all highlighted" on
529
- // a menu that starts fully selected.
530
- "data-[highlighted]:bg-neutral-alphas-50",
531
- "data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled",
532
- className
533
- ),
534
- ...props,
535
- children: [
536
- /* @__PURE__ */ jsx(
537
- "span",
538
- {
539
- className: cn(
540
- "flex size-4 shrink-0 items-center justify-center rounded-2xs border border-icons-primary",
541
- "group-data-[state=checked]:bg-icons-primary",
542
- "group-data-[disabled]:border-content-disabled"
543
- ),
544
- "aria-hidden": "true",
545
- children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { asChild: true, children: /* @__PURE__ */ jsx(TickIcon, { className: "size-4 text-content-primary-inverted" }) })
546
- }
547
- ),
548
- avatar && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: avatar }),
549
- /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
550
- /* @__PURE__ */ jsx("span", { className: "typography-body-default-16px-semibold truncate", children }),
551
- helper && /* @__PURE__ */ jsx(
552
- "span",
553
- {
554
- className: cn(
555
- "typography-description-12px-regular text-content-secondary",
556
- "group-data-[disabled]:text-content-disabled"
557
- ),
558
- children: helper
559
- }
560
- )
561
- ] })
562
- ]
563
- }
564
- );
565
- });
566
- DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem";
567
- export {
568
- DropdownMenu,
569
- DropdownMenuCheckboxItem,
570
- DropdownMenuContent,
571
- DropdownMenuGroup,
572
- DropdownMenuHeader,
573
- DropdownMenuItem,
574
- DropdownMenuLabel,
575
- DropdownMenuRadioGroup,
576
- DropdownMenuRadioItem,
577
- DropdownMenuSeparator,
578
- DropdownMenuTrigger
579
- };
580
- //# sourceMappingURL=DropdownMenu.mjs.map