beez-ui 2.5.0 → 2.6.1
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/CHANGELOG.md +63 -0
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/components/alert-dialog.d.ts +15 -4
- package/dist/components/alert-dialog.js +84 -44
- package/dist/components/alert.d.ts +30 -9
- package/dist/components/alert.js +360 -39
- package/dist/components/avatar.d.ts +33 -10
- package/dist/components/avatar.js +110 -30
- package/dist/components/badge.d.ts +39 -7
- package/dist/components/badge.js +348 -24
- package/dist/components/calendar.d.ts +29 -2
- package/dist/components/calendar.js +1035 -223
- package/dist/components/card.d.ts +17 -1
- package/dist/components/card.js +34 -8
- package/dist/components/carousel.d.ts +29 -2
- package/dist/components/carousel.js +471 -90
- package/dist/components/checkbox.d.ts +13 -2
- package/dist/components/checkbox.js +301 -41
- package/dist/components/dialog-surface.d.ts +27 -0
- package/dist/components/dialog-surface.js +137 -0
- package/dist/components/dialog.d.ts +21 -4
- package/dist/components/dialog.js +163 -96
- package/dist/components/dropdown-menu.d.ts +30 -16
- package/dist/components/dropdown-menu.js +139 -83
- package/dist/components/hover-card.d.ts +46 -3
- package/dist/components/hover-card.js +423 -60
- package/dist/components/pagination.d.ts +32 -14
- package/dist/components/pagination.js +136 -59
- package/dist/components/popover.d.ts +14 -5
- package/dist/components/popover.js +78 -36
- package/dist/components/radio-group.d.ts +19 -3
- package/dist/components/radio-group.js +400 -57
- package/dist/components/select.d.ts +17 -6
- package/dist/components/select.js +83 -71
- package/dist/components/sheet.js +37 -26
- package/dist/components/sidebar.js +11 -0
- package/dist/components/skeleton.d.ts +19 -5
- package/dist/components/skeleton.js +434 -14
- package/dist/components/switch.d.ts +14 -4
- package/dist/components/switch.js +424 -40
- package/dist/components/tabs.d.ts +38 -5
- package/dist/components/tabs.js +564 -97
- package/dist/components/themed-toaster.d.ts +6 -2
- package/dist/components/themed-toaster.js +80 -50
- package/dist/components/tooltip.d.ts +33 -2
- package/dist/components/tooltip.js +197 -69
- package/dist/constants/alert.d.ts +12 -0
- package/dist/constants/alert.js +9 -0
- package/dist/constants/avatar.d.ts +10 -0
- package/dist/constants/avatar.js +7 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/calendar.d.ts +24 -0
- package/dist/constants/calendar.js +22 -0
- package/dist/constants/carousel.d.ts +37 -0
- package/dist/constants/carousel.js +53 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +6 -0
- package/dist/constants/dialog.js +6 -0
- package/dist/constants/dropdown-menu.d.ts +5 -0
- package/dist/constants/dropdown-menu.js +5 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/pagination.d.ts +9 -0
- package/dist/constants/pagination.js +9 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +39 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +3 -0
- package/dist/constants/select.js +3 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/switch.d.ts +44 -0
- package/dist/constants/switch.js +49 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +167 -0
- package/dist/motion/glide-indicator.d.ts +6 -7
- package/dist/motion/glide-indicator.js +5 -3
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Arc's Dropdown menu (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md) as beez-ui's composable Radix
|
|
5
|
+
* menu: Arc's raised panel, item rows, danger tone, separators, placement defaults and staggered item entrance on its
|
|
6
|
+
* tokens, keeping every subcomponent, prop and `data-slot` of the previous API. The surface keeps beez-ui's reveal
|
|
7
|
+
* from the trigger edge and the highlight that glides between items with the keyboard.
|
|
8
|
+
*/
|
|
3
9
|
import * as React from "react";
|
|
4
10
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
11
|
+
import { DROPDOWN_MENU_COLLISION_PADDING_PX, DROPDOWN_MENU_SIDE_OFFSET_PX } from "../constants/dropdown-menu.js";
|
|
5
12
|
import { GlideSlot } from "../motion/glide-slot.js";
|
|
6
13
|
import { MotionSlot } from "../motion/motion-slot.js";
|
|
7
14
|
import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../motion/presence.js";
|
|
8
15
|
import { cn } from "../lib/utils.js";
|
|
9
16
|
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
10
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
/**
|
|
19
|
+
* Arc's menu panel on its tokens. It also sets the direction its items rise in from (`--menu-item-offset-*`, toward
|
|
20
|
+
* the trigger), so a nested submenu staggers its own items from its own side.
|
|
21
|
+
*/
|
|
22
|
+
const menuSurfaceClassName = "relative z-50 overflow-x-hidden overflow-y-auto rounded-(--radius-panel) border border-border bg-surface-raised p-[5px] text-foreground shadow-(--shadow-floating) data-[state=closed]:pointer-events-none data-[state=closed]:overflow-hidden [--menu-item-offset-x:0px] [--menu-item-offset-y:-2px] data-[side=top]:[--menu-item-offset-y:2px] data-[side=left]:[--menu-item-offset-x:2px] data-[side=left]:[--menu-item-offset-y:0px] data-[side=right]:[--menu-item-offset-x:-2px] data-[side=right]:[--menu-item-offset-y:0px]";
|
|
23
|
+
/**
|
|
24
|
+
* Arc's item row: 36px tall, a muted fill when highlighted and a muted icon (icons with their own `text-*` color keep
|
|
25
|
+
* it). Items fade and rise in once when the menu opens, staggered by 35ms up to the fifth row; reduced motion shows
|
|
26
|
+
* them at once. Only color, opacity and translate transition, so the highlight fill paints instantly and the
|
|
27
|
+
* keyboard glide owns its movement.
|
|
28
|
+
*/
|
|
29
|
+
const menuItemClassName = "relative flex min-h-9 cursor-pointer items-center gap-2.5 rounded-[calc(var(--radius-panel)-6px)] px-[11px] text-sm text-foreground outline-hidden select-none [transition:color_var(--duration-fast)_var(--ease-standard),opacity_var(--duration-standard)_var(--ease-enter)_var(--menu-item-delay,0ms),translate_var(--duration-standard)_var(--ease-enter)_var(--menu-item-delay,0ms)] starting:opacity-0 starting:[translate:var(--menu-item-offset-x,0px)_var(--menu-item-offset-y,0px)] nth-2:[--menu-item-delay:35ms] nth-3:[--menu-item-delay:70ms] nth-4:[--menu-item-delay:105ms] nth-[n+5]:[--menu-item-delay:140ms] motion-reduce:transition-none data-highlighted:bg-surface-muted data-inset:pl-[38px] data-disabled:pointer-events-none data-disabled:cursor-default data-disabled:opacity-45 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[svg:not([class*='text-'])]:text-text-secondary";
|
|
30
|
+
/** Room at the end of checkbox and radio rows for their check, as in Arc's select options. */
|
|
31
|
+
const menuSelectableItemClassName = "pr-[34px]";
|
|
32
|
+
/** Position and color of the check of checkbox and radio rows. */
|
|
33
|
+
const menuItemIndicatorClassName = "pointer-events-none absolute right-2.5 flex items-center justify-center text-foreground";
|
|
11
34
|
function DropdownMenu(t0) {
|
|
12
35
|
const $ = _c(9);
|
|
13
36
|
let props;
|
|
@@ -95,40 +118,54 @@ function DropdownMenuTrigger(t0) {
|
|
|
95
118
|
}
|
|
96
119
|
return t1;
|
|
97
120
|
}
|
|
98
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* Arc's menu panel. It sizes action menus by their content, at least 12rem unless the viewport is narrower, instead
|
|
123
|
+
* of narrowing them to an icon trigger.
|
|
124
|
+
* @param props - Primitive properties. Arc's defaults: `align="start"`, a 6px `sideOffset`, a 12px
|
|
125
|
+
* `collisionPadding` and `loop`, so arrow keys wrap from the last item to the first.
|
|
126
|
+
* @returns The portaled menu, animated in and out with its open state.
|
|
127
|
+
*/
|
|
99
128
|
function DropdownMenuContent(t0) {
|
|
100
|
-
const $ = _c(
|
|
129
|
+
const $ = _c(19);
|
|
101
130
|
let className;
|
|
102
131
|
let props;
|
|
103
132
|
let t1;
|
|
104
133
|
let t2;
|
|
134
|
+
let t3;
|
|
135
|
+
let t4;
|
|
105
136
|
if ($[0] !== t0) {
|
|
106
|
-
({className, align: t1, sideOffset: t2, ...props} = t0);
|
|
137
|
+
({className, align: t1, sideOffset: t2, collisionPadding: t3, loop: t4, ...props} = t0);
|
|
107
138
|
$[0] = t0;
|
|
108
139
|
$[1] = className;
|
|
109
140
|
$[2] = props;
|
|
110
141
|
$[3] = t1;
|
|
111
142
|
$[4] = t2;
|
|
143
|
+
$[5] = t3;
|
|
144
|
+
$[6] = t4;
|
|
112
145
|
} else {
|
|
113
146
|
className = $[1];
|
|
114
147
|
props = $[2];
|
|
115
148
|
t1 = $[3];
|
|
116
149
|
t2 = $[4];
|
|
150
|
+
t3 = $[5];
|
|
151
|
+
t4 = $[6];
|
|
117
152
|
}
|
|
118
153
|
const align = t1 === undefined ? "start" : t1;
|
|
119
|
-
const sideOffset = t2 === undefined ?
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
154
|
+
const sideOffset = t2 === undefined ? DROPDOWN_MENU_SIDE_OFFSET_PX : t2;
|
|
155
|
+
const collisionPadding = t3 === undefined ? DROPDOWN_MENU_COLLISION_PADDING_PX : t3;
|
|
156
|
+
const loop = t4 === undefined ? true : t4;
|
|
157
|
+
const t5 = props.forceMount;
|
|
158
|
+
let t6;
|
|
159
|
+
if ($[7] !== className) {
|
|
160
|
+
t6 = cn(menuSurfaceClassName, "max-h-(--radix-dropdown-menu-content-available-height) min-w-[min(12rem,var(--radix-dropdown-menu-content-available-width))] max-w-(--radix-dropdown-menu-content-available-width) origin-(--radix-dropdown-menu-content-transform-origin)", className);
|
|
161
|
+
$[7] = className;
|
|
162
|
+
$[8] = t6;
|
|
126
163
|
} else {
|
|
127
|
-
|
|
164
|
+
t6 = $[8];
|
|
128
165
|
}
|
|
129
|
-
let
|
|
130
|
-
if ($[
|
|
131
|
-
|
|
166
|
+
let t7;
|
|
167
|
+
if ($[9] !== align || $[10] !== collisionPadding || $[11] !== loop || $[12] !== props || $[13] !== sideOffset || $[14] !== t6) {
|
|
168
|
+
t7 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
132
169
|
kind: "surface",
|
|
133
170
|
children: /* @__PURE__ */ _jsx(GlideSlot, {
|
|
134
171
|
preset: "menu",
|
|
@@ -137,36 +174,40 @@ function DropdownMenuContent(t0) {
|
|
|
137
174
|
"data-slot": "dropdown-menu-content",
|
|
138
175
|
sideOffset,
|
|
139
176
|
align,
|
|
140
|
-
|
|
177
|
+
collisionPadding,
|
|
178
|
+
loop,
|
|
179
|
+
className: t6,
|
|
141
180
|
...props
|
|
142
181
|
})
|
|
143
182
|
})
|
|
144
183
|
});
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
184
|
+
$[9] = align;
|
|
185
|
+
$[10] = collisionPadding;
|
|
186
|
+
$[11] = loop;
|
|
187
|
+
$[12] = props;
|
|
188
|
+
$[13] = sideOffset;
|
|
189
|
+
$[14] = t6;
|
|
190
|
+
$[15] = t7;
|
|
150
191
|
} else {
|
|
151
|
-
|
|
192
|
+
t7 = $[15];
|
|
152
193
|
}
|
|
153
|
-
let
|
|
154
|
-
if ($[
|
|
155
|
-
|
|
194
|
+
let t8;
|
|
195
|
+
if ($[16] !== props.forceMount || $[17] !== t7) {
|
|
196
|
+
t8 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Portal, {
|
|
156
197
|
forceMount: true,
|
|
157
198
|
children: /* @__PURE__ */ _jsx(MotionPresence, {
|
|
158
199
|
scope: "dropdown-menu",
|
|
159
|
-
forceMount:
|
|
160
|
-
children:
|
|
200
|
+
forceMount: t5,
|
|
201
|
+
children: t7
|
|
161
202
|
})
|
|
162
203
|
});
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
204
|
+
$[16] = props.forceMount;
|
|
205
|
+
$[17] = t7;
|
|
206
|
+
$[18] = t8;
|
|
166
207
|
} else {
|
|
167
|
-
|
|
208
|
+
t8 = $[18];
|
|
168
209
|
}
|
|
169
|
-
return
|
|
210
|
+
return t8;
|
|
170
211
|
}
|
|
171
212
|
function DropdownMenuGroup(t0) {
|
|
172
213
|
const $ = _c(4);
|
|
@@ -192,8 +233,9 @@ function DropdownMenuGroup(t0) {
|
|
|
192
233
|
return t1;
|
|
193
234
|
}
|
|
194
235
|
/**
|
|
195
|
-
* Renders an action
|
|
196
|
-
*
|
|
236
|
+
* Renders an action row. `destructive` draws Arc's danger tone: danger text and icon over a faint danger fill when
|
|
237
|
+
* highlighted.
|
|
238
|
+
* @param props - Primitive properties, `inset` to align with rows that carry an icon, and the `variant`.
|
|
197
239
|
* @returns The styled primitive with its original interaction contract.
|
|
198
240
|
*/
|
|
199
241
|
function DropdownMenuItem(t0) {
|
|
@@ -218,7 +260,7 @@ function DropdownMenuItem(t0) {
|
|
|
218
260
|
const variant = t1 === undefined ? "default" : t1;
|
|
219
261
|
let t2;
|
|
220
262
|
if ($[5] !== className) {
|
|
221
|
-
t2 = cn("group/dropdown-menu-item
|
|
263
|
+
t2 = cn("group/dropdown-menu-item", menuItemClassName, "data-[variant=destructive]:text-danger data-[variant=destructive]:*:[svg:not([class*='text-'])]:text-danger data-[variant=destructive]:data-highlighted:bg-[color-mix(in_oklab,var(--danger)_8%,var(--surface))]", className);
|
|
222
264
|
$[5] = className;
|
|
223
265
|
$[6] = t2;
|
|
224
266
|
} else {
|
|
@@ -244,8 +286,8 @@ function DropdownMenuItem(t0) {
|
|
|
244
286
|
return t3;
|
|
245
287
|
}
|
|
246
288
|
/**
|
|
247
|
-
* Renders a
|
|
248
|
-
* @param props - Primitive properties and
|
|
289
|
+
* Renders a selectable checkbox action with its check at the end of the row.
|
|
290
|
+
* @param props - Primitive properties and `inset` to align with rows that carry an icon.
|
|
249
291
|
* @returns The styled primitive with its original interaction contract.
|
|
250
292
|
*/
|
|
251
293
|
function DropdownMenuCheckboxItem(t0) {
|
|
@@ -272,7 +314,7 @@ function DropdownMenuCheckboxItem(t0) {
|
|
|
272
314
|
}
|
|
273
315
|
let t1;
|
|
274
316
|
if ($[6] !== className) {
|
|
275
|
-
t1 = cn(
|
|
317
|
+
t1 = cn(menuItemClassName, menuSelectableItemClassName, className);
|
|
276
318
|
$[6] = className;
|
|
277
319
|
$[7] = t1;
|
|
278
320
|
} else {
|
|
@@ -281,11 +323,11 @@ function DropdownMenuCheckboxItem(t0) {
|
|
|
281
323
|
let t2;
|
|
282
324
|
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
283
325
|
t2 = /* @__PURE__ */ _jsx("span", {
|
|
284
|
-
className:
|
|
326
|
+
className: menuItemIndicatorClassName,
|
|
285
327
|
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
286
328
|
children: /* @__PURE__ */ _jsx(MotionSlot, {
|
|
287
329
|
kind: "item-check",
|
|
288
|
-
children: /* @__PURE__ */ _jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsx(CheckIcon, {}) })
|
|
330
|
+
children: /* @__PURE__ */ _jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsx(CheckIcon, { strokeWidth: 1.75 }) })
|
|
289
331
|
})
|
|
290
332
|
});
|
|
291
333
|
$[8] = t2;
|
|
@@ -337,8 +379,8 @@ function DropdownMenuRadioGroup(t0) {
|
|
|
337
379
|
return t1;
|
|
338
380
|
}
|
|
339
381
|
/**
|
|
340
|
-
* Renders a
|
|
341
|
-
* @param props - Primitive properties and
|
|
382
|
+
* Renders a mutually exclusive action with its check at the end of the row.
|
|
383
|
+
* @param props - Primitive properties and `inset` to align with rows that carry an icon.
|
|
342
384
|
* @returns The styled primitive with its original interaction contract.
|
|
343
385
|
*/
|
|
344
386
|
function DropdownMenuRadioItem(t0) {
|
|
@@ -362,7 +404,7 @@ function DropdownMenuRadioItem(t0) {
|
|
|
362
404
|
}
|
|
363
405
|
let t1;
|
|
364
406
|
if ($[5] !== className) {
|
|
365
|
-
t1 = cn(
|
|
407
|
+
t1 = cn(menuItemClassName, menuSelectableItemClassName, className);
|
|
366
408
|
$[5] = className;
|
|
367
409
|
$[6] = t1;
|
|
368
410
|
} else {
|
|
@@ -371,11 +413,11 @@ function DropdownMenuRadioItem(t0) {
|
|
|
371
413
|
let t2;
|
|
372
414
|
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
373
415
|
t2 = /* @__PURE__ */ _jsx("span", {
|
|
374
|
-
className:
|
|
416
|
+
className: menuItemIndicatorClassName,
|
|
375
417
|
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
376
418
|
children: /* @__PURE__ */ _jsx(MotionSlot, {
|
|
377
419
|
kind: "item-check",
|
|
378
|
-
children: /* @__PURE__ */ _jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsx(CheckIcon, {}) })
|
|
420
|
+
children: /* @__PURE__ */ _jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsx(CheckIcon, { strokeWidth: 1.75 }) })
|
|
379
421
|
})
|
|
380
422
|
});
|
|
381
423
|
$[7] = t2;
|
|
@@ -402,8 +444,8 @@ function DropdownMenuRadioItem(t0) {
|
|
|
402
444
|
return t3;
|
|
403
445
|
}
|
|
404
446
|
/**
|
|
405
|
-
* Renders a
|
|
406
|
-
* @param props - Primitive properties and
|
|
447
|
+
* Renders a muted group label aligned with the item text.
|
|
448
|
+
* @param props - Primitive properties and `inset` to align with rows that carry an icon.
|
|
407
449
|
* @returns The styled primitive with its original interaction contract.
|
|
408
450
|
*/
|
|
409
451
|
function DropdownMenuLabel(t0) {
|
|
@@ -424,7 +466,7 @@ function DropdownMenuLabel(t0) {
|
|
|
424
466
|
}
|
|
425
467
|
let t1;
|
|
426
468
|
if ($[4] !== className) {
|
|
427
|
-
t1 = cn("px-
|
|
469
|
+
t1 = cn("px-[11px] py-1.5 text-xs font-medium text-text-muted data-inset:pl-[38px]", className);
|
|
428
470
|
$[4] = className;
|
|
429
471
|
$[5] = t1;
|
|
430
472
|
} else {
|
|
@@ -462,7 +504,7 @@ function DropdownMenuSeparator(t0) {
|
|
|
462
504
|
}
|
|
463
505
|
let t1;
|
|
464
506
|
if ($[3] !== className) {
|
|
465
|
-
t1 = cn("-mx-1 my-1 h-px bg-border", className);
|
|
507
|
+
t1 = cn("-mx-1 my-1 h-px bg-border-subtle", className);
|
|
466
508
|
$[3] = className;
|
|
467
509
|
$[4] = t1;
|
|
468
510
|
} else {
|
|
@@ -498,7 +540,7 @@ function DropdownMenuShortcut(t0) {
|
|
|
498
540
|
}
|
|
499
541
|
let t1;
|
|
500
542
|
if ($[3] !== className) {
|
|
501
|
-
t1 = cn("ml-auto text-xs text-muted
|
|
543
|
+
t1 = cn("ml-auto text-xs text-text-muted group-data-highlighted/dropdown-menu-item:text-text-secondary", className);
|
|
502
544
|
$[3] = className;
|
|
503
545
|
$[4] = t1;
|
|
504
546
|
} else {
|
|
@@ -561,8 +603,9 @@ function DropdownMenuSub(t0) {
|
|
|
561
603
|
return t2;
|
|
562
604
|
}
|
|
563
605
|
/**
|
|
564
|
-
* Renders
|
|
565
|
-
*
|
|
606
|
+
* Renders the row that opens a nested menu. It keeps the highlight fill while its submenu is open and nudges its
|
|
607
|
+
* chevron toward it.
|
|
608
|
+
* @param props - Primitive properties and `inset` to align with rows that carry an icon.
|
|
566
609
|
* @returns The styled primitive with its original interaction contract.
|
|
567
610
|
*/
|
|
568
611
|
function DropdownMenuSubTrigger(t0) {
|
|
@@ -586,7 +629,7 @@ function DropdownMenuSubTrigger(t0) {
|
|
|
586
629
|
}
|
|
587
630
|
let t1;
|
|
588
631
|
if ($[5] !== className) {
|
|
589
|
-
t1 = cn("
|
|
632
|
+
t1 = cn(menuItemClassName, "data-[state=open]:bg-surface-muted data-open:*:data-[slot=dropdown-menu-sub-trigger-icon]:translate-x-0.5", className);
|
|
590
633
|
$[5] = className;
|
|
591
634
|
$[6] = t1;
|
|
592
635
|
} else {
|
|
@@ -596,7 +639,8 @@ function DropdownMenuSubTrigger(t0) {
|
|
|
596
639
|
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
597
640
|
t2 = /* @__PURE__ */ _jsx(ChevronRightIcon, {
|
|
598
641
|
"data-slot": "dropdown-menu-sub-trigger-icon",
|
|
599
|
-
|
|
642
|
+
strokeWidth: 1.75,
|
|
643
|
+
className: "ml-auto text-text-muted transition-transform duration-200 ease-out motion-reduce:transition-none"
|
|
600
644
|
});
|
|
601
645
|
$[7] = t2;
|
|
602
646
|
} else {
|
|
@@ -622,65 +666,77 @@ function DropdownMenuSubTrigger(t0) {
|
|
|
622
666
|
return t3;
|
|
623
667
|
}
|
|
624
668
|
/**
|
|
625
|
-
*
|
|
626
|
-
* @param props - Primitive properties
|
|
627
|
-
* @returns The
|
|
669
|
+
* Renders a nested menu on the same raised panel, at least 12rem wide.
|
|
670
|
+
* @param props - Primitive properties. Arc's defaults: a 12px `collisionPadding` and `loop`.
|
|
671
|
+
* @returns The submenu, animated in and out with its open state.
|
|
628
672
|
*/
|
|
629
673
|
function DropdownMenuSubContent(t0) {
|
|
630
|
-
const $ = _c(
|
|
674
|
+
const $ = _c(15);
|
|
631
675
|
let className;
|
|
632
676
|
let props;
|
|
677
|
+
let t1;
|
|
678
|
+
let t2;
|
|
633
679
|
if ($[0] !== t0) {
|
|
634
|
-
({className, ...props} = t0);
|
|
680
|
+
({className, collisionPadding: t1, loop: t2, ...props} = t0);
|
|
635
681
|
$[0] = t0;
|
|
636
682
|
$[1] = className;
|
|
637
683
|
$[2] = props;
|
|
684
|
+
$[3] = t1;
|
|
685
|
+
$[4] = t2;
|
|
638
686
|
} else {
|
|
639
687
|
className = $[1];
|
|
640
688
|
props = $[2];
|
|
689
|
+
t1 = $[3];
|
|
690
|
+
t2 = $[4];
|
|
641
691
|
}
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
692
|
+
const collisionPadding = t1 === undefined ? DROPDOWN_MENU_COLLISION_PADDING_PX : t1;
|
|
693
|
+
const loop = t2 === undefined ? true : t2;
|
|
694
|
+
const t3 = props.forceMount;
|
|
695
|
+
let t4;
|
|
696
|
+
if ($[5] !== className) {
|
|
697
|
+
t4 = cn(menuSurfaceClassName, "min-w-48 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden", className);
|
|
698
|
+
$[5] = className;
|
|
699
|
+
$[6] = t4;
|
|
648
700
|
} else {
|
|
649
|
-
|
|
701
|
+
t4 = $[6];
|
|
650
702
|
}
|
|
651
|
-
let
|
|
652
|
-
if ($[
|
|
653
|
-
|
|
703
|
+
let t5;
|
|
704
|
+
if ($[7] !== collisionPadding || $[8] !== loop || $[9] !== props || $[10] !== t4) {
|
|
705
|
+
t5 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
654
706
|
kind: "surface",
|
|
655
707
|
children: /* @__PURE__ */ _jsx(GlideSlot, {
|
|
656
708
|
preset: "menu",
|
|
657
709
|
children: /* @__PURE__ */ _jsx(DropdownMenuPrimitive.SubContent, {
|
|
658
710
|
forceMount: true,
|
|
659
711
|
"data-slot": "dropdown-menu-sub-content",
|
|
660
|
-
|
|
712
|
+
collisionPadding,
|
|
713
|
+
loop,
|
|
714
|
+
className: t4,
|
|
661
715
|
...props
|
|
662
716
|
})
|
|
663
717
|
})
|
|
664
718
|
});
|
|
665
|
-
$[
|
|
666
|
-
$[
|
|
667
|
-
$[
|
|
719
|
+
$[7] = collisionPadding;
|
|
720
|
+
$[8] = loop;
|
|
721
|
+
$[9] = props;
|
|
722
|
+
$[10] = t4;
|
|
723
|
+
$[11] = t5;
|
|
668
724
|
} else {
|
|
669
|
-
|
|
725
|
+
t5 = $[11];
|
|
670
726
|
}
|
|
671
|
-
let
|
|
672
|
-
if ($[
|
|
673
|
-
|
|
727
|
+
let t6;
|
|
728
|
+
if ($[12] !== props.forceMount || $[13] !== t5) {
|
|
729
|
+
t6 = /* @__PURE__ */ _jsx(MotionPresence, {
|
|
674
730
|
scope: "dropdown-sub",
|
|
675
|
-
forceMount:
|
|
676
|
-
children:
|
|
731
|
+
forceMount: t3,
|
|
732
|
+
children: t5
|
|
677
733
|
});
|
|
678
|
-
$[
|
|
679
|
-
$[
|
|
680
|
-
$[
|
|
734
|
+
$[12] = props.forceMount;
|
|
735
|
+
$[13] = t5;
|
|
736
|
+
$[14] = t6;
|
|
681
737
|
} else {
|
|
682
|
-
|
|
738
|
+
t6 = $[14];
|
|
683
739
|
}
|
|
684
|
-
return
|
|
740
|
+
return t6;
|
|
685
741
|
}
|
|
686
742
|
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent };
|
|
@@ -1,6 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arc's Hover Card (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a read-only preview of a person or
|
|
3
|
+
* link that opens after half a second of hover or on keyboard focus, grows from the trigger edge on a smooth spring
|
|
4
|
+
* and closes fast on leave. While a card is open, and briefly after it closes, moving to another trigger opens its
|
|
5
|
+
* card almost at once and only fades. It keeps the Radix composition and adds Arc's `HoverCardProfile` preset.
|
|
6
|
+
*/
|
|
1
7
|
import * as React from "react";
|
|
2
8
|
import { HoverCard as HoverCardPrimitive } from "radix-ui";
|
|
3
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Owns the open state and timing of one hover card.
|
|
11
|
+
* @param props - Radix root properties. `openDelay` defaults to Arc's 500ms and `closeDelay` to 140ms; within the
|
|
12
|
+
* skip window the card waits at most 80ms.
|
|
13
|
+
* @returns The hover card root.
|
|
14
|
+
*/
|
|
15
|
+
declare function HoverCard({ openDelay, closeDelay, ...props }: React.ComponentProps<typeof HoverCardPrimitive.Root>): React.JSX.Element;
|
|
4
16
|
declare function HoverCardTrigger({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
-
|
|
6
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Renders Arc's card: raised surface, hairline border, panel radius and floating shadow, 18.5rem wide at most.
|
|
19
|
+
* @param props - Radix content properties. `align` defaults to `center`, `sideOffset` to 8px and `collisionPadding`
|
|
20
|
+
* to 12px.
|
|
21
|
+
* @returns The portaled card.
|
|
22
|
+
*/
|
|
23
|
+
declare function HoverCardContent({ className, align, sideOffset, collisionPadding, ...props }: React.ComponentProps<typeof HoverCardPrimitive.Content>): React.JSX.Element;
|
|
24
|
+
/** One number of `HoverCardProfile`, such as followers or projects. */
|
|
25
|
+
export interface HoverCardStat {
|
|
26
|
+
label: string;
|
|
27
|
+
value: string | number;
|
|
28
|
+
}
|
|
29
|
+
/** A person preview for `HoverCardContent`. */
|
|
30
|
+
export interface HoverCardProfileProps {
|
|
31
|
+
name: string;
|
|
32
|
+
/** Role and team, such as "Diseñadora de producto, Pagos". */
|
|
33
|
+
role?: string;
|
|
34
|
+
/** A portrait URL, or your own image element such as an `Image` adapter. Initials show when it is missing. */
|
|
35
|
+
avatar?: string | React.ReactNode;
|
|
36
|
+
bio?: string;
|
|
37
|
+
stats?: HoverCardStat[];
|
|
38
|
+
/** A footer line, such as a location and local time. */
|
|
39
|
+
meta?: React.ReactNode;
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Arc's person preview: portrait, name, role, a short bio, a couple of numbers and a quiet footer line. Its rows
|
|
44
|
+
* settle in with a tiny stagger, and stay still when the user prefers reduced motion.
|
|
45
|
+
* @param props - The person's details.
|
|
46
|
+
* @returns The profile, meant as the child of `HoverCardContent`.
|
|
47
|
+
*/
|
|
48
|
+
declare function HoverCardProfile({ name, role, avatar, bio, stats, meta, className }: HoverCardProfileProps): React.JSX.Element;
|
|
49
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent, HoverCardProfile };
|