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