beez-ui 2.7.1 → 3.0.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +43 -13
  3. package/THIRD_PARTY_NOTICES.md +1 -1
  4. package/dist/components/account-menu.d.ts +4 -3
  5. package/dist/components/account-menu.js +63 -54
  6. package/dist/components/alert.d.ts +15 -15
  7. package/dist/components/alert.js +289 -270
  8. package/dist/components/animated-theme-toggler.js +1 -1
  9. package/dist/components/avatar.d.ts +56 -31
  10. package/dist/components/avatar.js +394 -277
  11. package/dist/components/badge.d.ts +8 -28
  12. package/dist/components/badge.js +55 -108
  13. package/dist/components/calendar.d.ts +36 -26
  14. package/dist/components/calendar.js +132 -1227
  15. package/dist/components/card.d.ts +36 -25
  16. package/dist/components/card.js +895 -72
  17. package/dist/components/carousel.d.ts +63 -47
  18. package/dist/components/carousel.js +496 -777
  19. package/dist/components/data-table.d.ts +5 -4
  20. package/dist/components/data-table.js +7 -6
  21. package/dist/components/dialog-surface.d.ts +23 -1
  22. package/dist/components/dialog-surface.js +99 -3
  23. package/dist/components/dialog.d.ts +80 -45
  24. package/dist/components/dialog.js +258 -503
  25. package/dist/components/dropdown-menu.d.ts +56 -73
  26. package/dist/components/dropdown-menu.js +79 -714
  27. package/dist/components/field.d.ts +3 -1
  28. package/dist/components/field.js +49 -39
  29. package/dist/components/filter-presets-bar.js +2 -2
  30. package/dist/components/filter-query-bar.js +1 -1
  31. package/dist/components/hover-card.d.ts +42 -41
  32. package/dist/components/hover-card.js +57 -483
  33. package/dist/components/pagination.d.ts +53 -31
  34. package/dist/components/pagination.js +176 -412
  35. package/dist/components/popover.d.ts +11 -23
  36. package/dist/components/popover.js +19 -304
  37. package/dist/components/{alert-dialog.d.ts → primitives/alert-dialog.d.ts} +17 -5
  38. package/dist/components/{alert-dialog.js → primitives/alert-dialog.js} +102 -54
  39. package/dist/components/primitives/avatar.d.ts +46 -0
  40. package/dist/components/primitives/avatar.js +268 -0
  41. package/dist/components/primitives/calendar.d.ts +37 -0
  42. package/dist/components/primitives/calendar.js +1250 -0
  43. package/dist/components/primitives/carousel.d.ts +106 -0
  44. package/dist/components/primitives/carousel.js +928 -0
  45. package/dist/components/primitives/dialog.d.ts +62 -0
  46. package/dist/components/primitives/dialog.js +490 -0
  47. package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
  48. package/dist/components/primitives/dropdown-menu-items.js +265 -0
  49. package/dist/components/primitives/dropdown-menu.d.ts +64 -0
  50. package/dist/components/primitives/dropdown-menu.js +557 -0
  51. package/dist/components/primitives/hover-card.d.ts +50 -0
  52. package/dist/components/primitives/hover-card.js +507 -0
  53. package/dist/components/primitives/pagination.d.ts +65 -0
  54. package/dist/components/primitives/pagination.js +373 -0
  55. package/dist/components/primitives/popover.d.ts +22 -0
  56. package/dist/components/primitives/popover.js +213 -0
  57. package/dist/components/primitives/select.d.ts +36 -0
  58. package/dist/components/primitives/select.js +407 -0
  59. package/dist/components/primitives/tooltip.d.ts +30 -0
  60. package/dist/components/primitives/tooltip.js +277 -0
  61. package/dist/components/radio-group.d.ts +30 -17
  62. package/dist/components/radio-group.js +266 -315
  63. package/dist/components/rich-link-editor.js +1 -1
  64. package/dist/components/select.d.ts +51 -42
  65. package/dist/components/select.js +163 -495
  66. package/dist/components/skeleton.d.ts +16 -15
  67. package/dist/components/skeleton.js +99 -205
  68. package/dist/components/split-button.js +1 -1
  69. package/dist/components/switch.d.ts +3 -6
  70. package/dist/components/switch.js +163 -170
  71. package/dist/components/tabs.d.ts +3 -11
  72. package/dist/components/tabs.js +61 -75
  73. package/dist/components/themed-toaster.d.ts +1 -1
  74. package/dist/components/themed-toaster.js +1 -1
  75. package/dist/components/toaster.d.ts +1 -1
  76. package/dist/components/toaster.js +1 -1
  77. package/dist/components/tooltip.d.ts +36 -31
  78. package/dist/components/tooltip.js +44 -284
  79. package/dist/constants/alert.d.ts +5 -1
  80. package/dist/constants/alert.js +5 -1
  81. package/dist/constants/avatar.d.ts +29 -1
  82. package/dist/constants/avatar.js +25 -0
  83. package/dist/constants/calendar.d.ts +12 -0
  84. package/dist/constants/calendar.js +12 -0
  85. package/dist/constants/card.d.ts +23 -0
  86. package/dist/constants/card.js +20 -0
  87. package/dist/constants/carousel.d.ts +31 -13
  88. package/dist/constants/carousel.js +32 -11
  89. package/dist/constants/dialog.d.ts +6 -1
  90. package/dist/constants/dialog.js +5 -1
  91. package/dist/constants/dropdown-menu.d.ts +2 -2
  92. package/dist/constants/dropdown-menu.js +2 -2
  93. package/dist/constants/pagination.d.ts +13 -2
  94. package/dist/constants/pagination.js +13 -2
  95. package/dist/constants/select.d.ts +4 -2
  96. package/dist/constants/select.js +4 -2
  97. package/dist/constants/switch.d.ts +5 -16
  98. package/dist/constants/switch.js +6 -14
  99. package/dist/hooks/use-today.d.ts +7 -0
  100. package/dist/hooks/use-today.js +50 -0
  101. package/dist/hooks.d.ts +1 -0
  102. package/dist/hooks.js +1 -0
  103. package/dist/index.d.ts +0 -1
  104. package/dist/index.js +0 -1
  105. package/dist/motion/glide-indicator.d.ts +1 -1
  106. package/dist/motion/glide-indicator.js +1 -1
  107. package/dist/motion/presence.d.ts +0 -1
  108. package/dist/motion/presence.js +0 -1
  109. package/dist/styles.css +1 -1
  110. package/package.json +1 -6
@@ -1,742 +1,107 @@
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
- */
9
- import * as React from "react";
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";
12
- import { GlideSlot } from "../motion/glide-slot.js";
13
- import { MotionSlot } from "../motion/motion-slot.js";
14
- import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../motion/presence.js";
3
+ import { ChevronDownIcon } from "lucide-react";
15
4
  import { cn } from "../lib/utils.js";
16
- import { CheckIcon, ChevronRightIcon } from "lucide-react";
5
+ import { Button } from "./button.js";
6
+ import { DropdownMenu as DropdownMenuRoot, DropdownMenuContent, DropdownMenuTrigger } from "./primitives/dropdown-menu.js";
7
+ import { DropdownMenuItems } from "./primitives/dropdown-menu-items.js";
17
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
9
  /**
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.
10
+ * A focused list of actions anchored to a trigger.
11
+ * @param props - The label, the items and optional trigger, selection, placement and open state.
12
+ * @returns The trigger with its menu.
28
13
  */
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";
34
14
  function DropdownMenu(t0) {
35
- const $ = _c(9);
36
- let props;
37
- if ($[0] !== t0) {
38
- ({...props} = t0);
39
- $[0] = t0;
40
- $[1] = props;
41
- } else {
42
- props = $[1];
43
- }
44
- const [motionOpen, setMotionOpen] = useMotionOpenState(props);
15
+ const $ = _c(23);
16
+ const { label, items, icon, trigger, selection, side, align, contentClassName, contentLabel, className, open, defaultOpen, onOpenChange, modal } = t0;
45
17
  let t1;
46
- if ($[2] !== motionOpen || $[3] !== props || $[4] !== setMotionOpen) {
47
- t1 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Root, {
48
- "data-slot": "dropdown-menu",
49
- ...props,
50
- open: motionOpen,
51
- onOpenChange: setMotionOpen
52
- });
53
- $[2] = motionOpen;
54
- $[3] = props;
55
- $[4] = setMotionOpen;
56
- $[5] = t1;
57
- } else {
58
- t1 = $[5];
59
- }
60
- let t2;
61
- if ($[6] !== motionOpen || $[7] !== t1) {
62
- t2 = /* @__PURE__ */ _jsx(MotionOpenProvider, {
63
- scope: "dropdown-menu",
64
- open: motionOpen,
65
- children: t1
66
- });
67
- $[6] = motionOpen;
68
- $[7] = t1;
69
- $[8] = t2;
70
- } else {
71
- t2 = $[8];
72
- }
73
- return t2;
74
- }
75
- function DropdownMenuPortal(t0) {
76
- const $ = _c(4);
77
- let props;
78
- if ($[0] !== t0) {
79
- ({...props} = t0);
80
- $[0] = t0;
81
- $[1] = props;
82
- } else {
83
- props = $[1];
84
- }
85
- let t1;
86
- if ($[2] !== props) {
87
- t1 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Portal, {
88
- "data-slot": "dropdown-menu-portal",
89
- ...props
90
- });
91
- $[2] = props;
92
- $[3] = t1;
93
- } else {
94
- t1 = $[3];
95
- }
96
- return t1;
97
- }
98
- function DropdownMenuTrigger(t0) {
99
- const $ = _c(4);
100
- let props;
101
- if ($[0] !== t0) {
102
- ({...props} = t0);
103
- $[0] = t0;
104
- $[1] = props;
105
- } else {
106
- props = $[1];
107
- }
108
- let t1;
109
- if ($[2] !== props) {
110
- t1 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Trigger, {
111
- "data-slot": "dropdown-menu-trigger",
112
- ...props
113
- });
114
- $[2] = props;
115
- $[3] = t1;
116
- } else {
117
- t1 = $[3];
118
- }
119
- return t1;
120
- }
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
- */
128
- function DropdownMenuContent(t0) {
129
- const $ = _c(19);
130
- let className;
131
- let props;
132
- let t1;
133
- let t2;
134
- let t3;
135
- let t4;
136
- if ($[0] !== t0) {
137
- ({className, align: t1, sideOffset: t2, collisionPadding: t3, loop: t4, ...props} = t0);
138
- $[0] = t0;
139
- $[1] = className;
140
- $[2] = props;
141
- $[3] = t1;
142
- $[4] = t2;
143
- $[5] = t3;
144
- $[6] = t4;
145
- } else {
146
- className = $[1];
147
- props = $[2];
148
- t1 = $[3];
149
- t2 = $[4];
150
- t3 = $[5];
151
- t4 = $[6];
152
- }
153
- const align = t1 === undefined ? "start" : t1;
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;
163
- } else {
164
- t6 = $[8];
165
- }
166
- let t7;
167
- if ($[9] !== align || $[10] !== collisionPadding || $[11] !== loop || $[12] !== props || $[13] !== sideOffset || $[14] !== t6) {
168
- t7 = /* @__PURE__ */ _jsx(MotionSlot, {
169
- kind: "surface",
170
- children: /* @__PURE__ */ _jsx(GlideSlot, {
171
- preset: "menu",
172
- children: /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Content, {
173
- forceMount: true,
174
- "data-slot": "dropdown-menu-content",
175
- sideOffset,
176
- align,
177
- collisionPadding,
178
- loop,
179
- className: t6,
180
- ...props
18
+ if ($[0] !== className || $[1] !== icon || $[2] !== label || $[3] !== trigger) {
19
+ t1 = trigger ?? /* @__PURE__ */ _jsxs(Button, {
20
+ variant: "secondary",
21
+ className: cn("max-w-full", className),
22
+ children: [
23
+ icon,
24
+ /* @__PURE__ */ _jsx("span", {
25
+ className: "min-w-0 truncate",
26
+ children: label
27
+ }),
28
+ /* @__PURE__ */ _jsx(ChevronDownIcon, {
29
+ "aria-hidden": "true",
30
+ strokeWidth: 1.75,
31
+ className: "text-text-muted"
181
32
  })
182
- })
33
+ ]
183
34
  });
184
- $[9] = align;
185
- $[10] = collisionPadding;
186
- $[11] = loop;
187
- $[12] = props;
188
- $[13] = sideOffset;
189
- $[14] = t6;
190
- $[15] = t7;
191
- } else {
192
- t7 = $[15];
193
- }
194
- let t8;
195
- if ($[16] !== props.forceMount || $[17] !== t7) {
196
- t8 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Portal, {
197
- forceMount: true,
198
- children: /* @__PURE__ */ _jsx(MotionPresence, {
199
- scope: "dropdown-menu",
200
- forceMount: t5,
201
- children: t7
202
- })
203
- });
204
- $[16] = props.forceMount;
205
- $[17] = t7;
206
- $[18] = t8;
207
- } else {
208
- t8 = $[18];
209
- }
210
- return t8;
211
- }
212
- function DropdownMenuGroup(t0) {
213
- const $ = _c(4);
214
- let props;
215
- if ($[0] !== t0) {
216
- ({...props} = t0);
217
- $[0] = t0;
218
- $[1] = props;
219
- } else {
220
- props = $[1];
221
- }
222
- let t1;
223
- if ($[2] !== props) {
224
- t1 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Group, {
225
- "data-slot": "dropdown-menu-group",
226
- ...props
227
- });
228
- $[2] = props;
229
- $[3] = t1;
230
- } else {
231
- t1 = $[3];
232
- }
233
- return t1;
234
- }
235
- /**
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`.
239
- * @returns The styled primitive with its original interaction contract.
240
- */
241
- function DropdownMenuItem(t0) {
242
- const $ = _c(12);
243
- let className;
244
- let inset;
245
- let props;
246
- let t1;
247
- if ($[0] !== t0) {
248
- ({className, inset, variant: t1, ...props} = t0);
249
- $[0] = t0;
250
- $[1] = className;
251
- $[2] = inset;
252
- $[3] = props;
35
+ $[0] = className;
36
+ $[1] = icon;
37
+ $[2] = label;
38
+ $[3] = trigger;
253
39
  $[4] = t1;
254
40
  } else {
255
- className = $[1];
256
- inset = $[2];
257
- props = $[3];
258
41
  t1 = $[4];
259
42
  }
260
- const variant = t1 === undefined ? "default" : t1;
261
- let t2;
262
- if ($[5] !== className) {
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);
264
- $[5] = className;
265
- $[6] = t2;
266
- } else {
267
- t2 = $[6];
268
- }
269
- let t3;
270
- if ($[7] !== inset || $[8] !== props || $[9] !== t2 || $[10] !== variant) {
271
- t3 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Item, {
272
- "data-slot": "dropdown-menu-item",
273
- "data-inset": inset,
274
- "data-variant": variant,
275
- className: t2,
276
- ...props
277
- });
278
- $[7] = inset;
279
- $[8] = props;
280
- $[9] = t2;
281
- $[10] = variant;
282
- $[11] = t3;
283
- } else {
284
- t3 = $[11];
285
- }
286
- return t3;
287
- }
288
- /**
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.
291
- * @returns The styled primitive with its original interaction contract.
292
- */
293
- function DropdownMenuCheckboxItem(t0) {
294
- const $ = _c(15);
295
- let checked;
296
- let children;
297
- let className;
298
- let inset;
299
- let props;
300
- if ($[0] !== t0) {
301
- ({className, children, checked, inset, ...props} = t0);
302
- $[0] = t0;
303
- $[1] = checked;
304
- $[2] = children;
305
- $[3] = className;
306
- $[4] = inset;
307
- $[5] = props;
308
- } else {
309
- checked = $[1];
310
- children = $[2];
311
- className = $[3];
312
- inset = $[4];
313
- props = $[5];
314
- }
315
- let t1;
316
- if ($[6] !== className) {
317
- t1 = cn(menuItemClassName, menuSelectableItemClassName, className);
318
- $[6] = className;
319
- $[7] = t1;
320
- } else {
321
- t1 = $[7];
322
- }
323
43
  let t2;
324
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
325
- t2 = /* @__PURE__ */ _jsx("span", {
326
- className: menuItemIndicatorClassName,
327
- "data-slot": "dropdown-menu-checkbox-item-indicator",
328
- children: /* @__PURE__ */ _jsx(MotionSlot, {
329
- kind: "item-check",
330
- children: /* @__PURE__ */ _jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsx(CheckIcon, { strokeWidth: 1.75 }) })
331
- })
332
- });
333
- $[8] = t2;
334
- } else {
335
- t2 = $[8];
336
- }
337
- let t3;
338
- if ($[9] !== checked || $[10] !== children || $[11] !== inset || $[12] !== props || $[13] !== t1) {
339
- t3 = /* @__PURE__ */ _jsxs(DropdownMenuPrimitive.CheckboxItem, {
340
- "data-slot": "dropdown-menu-checkbox-item",
341
- "data-inset": inset,
342
- className: t1,
343
- checked,
344
- ...props,
345
- children: [t2, children]
346
- });
347
- $[9] = checked;
348
- $[10] = children;
349
- $[11] = inset;
350
- $[12] = props;
351
- $[13] = t1;
352
- $[14] = t3;
353
- } else {
354
- t3 = $[14];
355
- }
356
- return t3;
357
- }
358
- function DropdownMenuRadioGroup(t0) {
359
- const $ = _c(4);
360
- let props;
361
- if ($[0] !== t0) {
362
- ({...props} = t0);
363
- $[0] = t0;
364
- $[1] = props;
365
- } else {
366
- props = $[1];
367
- }
368
- let t1;
369
- if ($[2] !== props) {
370
- t1 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.RadioGroup, {
371
- "data-slot": "dropdown-menu-radio-group",
372
- ...props
373
- });
374
- $[2] = props;
375
- $[3] = t1;
376
- } else {
377
- t1 = $[3];
378
- }
379
- return t1;
380
- }
381
- /**
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.
384
- * @returns The styled primitive with its original interaction contract.
385
- */
386
- function DropdownMenuRadioItem(t0) {
387
- const $ = _c(13);
388
- let children;
389
- let className;
390
- let inset;
391
- let props;
392
- if ($[0] !== t0) {
393
- ({className, children, inset, ...props} = t0);
394
- $[0] = t0;
395
- $[1] = children;
396
- $[2] = className;
397
- $[3] = inset;
398
- $[4] = props;
399
- } else {
400
- children = $[1];
401
- className = $[2];
402
- inset = $[3];
403
- props = $[4];
404
- }
405
- let t1;
406
- if ($[5] !== className) {
407
- t1 = cn(menuItemClassName, menuSelectableItemClassName, className);
408
- $[5] = className;
409
- $[6] = t1;
410
- } else {
411
- t1 = $[6];
412
- }
413
- let t2;
414
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
415
- t2 = /* @__PURE__ */ _jsx("span", {
416
- className: menuItemIndicatorClassName,
417
- "data-slot": "dropdown-menu-radio-item-indicator",
418
- children: /* @__PURE__ */ _jsx(MotionSlot, {
419
- kind: "item-check",
420
- children: /* @__PURE__ */ _jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsx(CheckIcon, { strokeWidth: 1.75 }) })
421
- })
422
- });
423
- $[7] = t2;
424
- } else {
425
- t2 = $[7];
426
- }
427
- let t3;
428
- if ($[8] !== children || $[9] !== inset || $[10] !== props || $[11] !== t1) {
429
- t3 = /* @__PURE__ */ _jsxs(DropdownMenuPrimitive.RadioItem, {
430
- "data-slot": "dropdown-menu-radio-item",
431
- "data-inset": inset,
432
- className: t1,
433
- ...props,
434
- children: [t2, children]
435
- });
436
- $[8] = children;
437
- $[9] = inset;
438
- $[10] = props;
439
- $[11] = t1;
440
- $[12] = t3;
441
- } else {
442
- t3 = $[12];
443
- }
444
- return t3;
445
- }
446
- /**
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.
449
- * @returns The styled primitive with its original interaction contract.
450
- */
451
- function DropdownMenuLabel(t0) {
452
- const $ = _c(10);
453
- let className;
454
- let inset;
455
- let props;
456
- if ($[0] !== t0) {
457
- ({className, inset, ...props} = t0);
458
- $[0] = t0;
459
- $[1] = className;
460
- $[2] = inset;
461
- $[3] = props;
462
- } else {
463
- className = $[1];
464
- inset = $[2];
465
- props = $[3];
466
- }
467
- let t1;
468
- if ($[4] !== className) {
469
- t1 = cn("px-[11px] py-1.5 text-xs font-medium text-text-muted data-inset:pl-[38px]", className);
470
- $[4] = className;
471
- $[5] = t1;
472
- } else {
473
- t1 = $[5];
474
- }
475
- let t2;
476
- if ($[6] !== inset || $[7] !== props || $[8] !== t1) {
477
- t2 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Label, {
478
- "data-slot": "dropdown-menu-label",
479
- "data-inset": inset,
480
- className: t1,
481
- ...props
482
- });
483
- $[6] = inset;
484
- $[7] = props;
485
- $[8] = t1;
486
- $[9] = t2;
487
- } else {
488
- t2 = $[9];
489
- }
490
- return t2;
491
- }
492
- function DropdownMenuSeparator(t0) {
493
- const $ = _c(8);
494
- let className;
495
- let props;
496
- if ($[0] !== t0) {
497
- ({className, ...props} = t0);
498
- $[0] = t0;
499
- $[1] = className;
500
- $[2] = props;
501
- } else {
502
- className = $[1];
503
- props = $[2];
504
- }
505
- let t1;
506
- if ($[3] !== className) {
507
- t1 = cn("-mx-1 my-1 h-px bg-border-subtle", className);
508
- $[3] = className;
509
- $[4] = t1;
510
- } else {
511
- t1 = $[4];
512
- }
513
- let t2;
514
- if ($[5] !== props || $[6] !== t1) {
515
- t2 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Separator, {
516
- "data-slot": "dropdown-menu-separator",
517
- className: t1,
518
- ...props
519
- });
520
- $[5] = props;
521
- $[6] = t1;
522
- $[7] = t2;
523
- } else {
524
- t2 = $[7];
525
- }
526
- return t2;
527
- }
528
- function DropdownMenuShortcut(t0) {
529
- const $ = _c(8);
530
- let className;
531
- let props;
532
- if ($[0] !== t0) {
533
- ({className, ...props} = t0);
534
- $[0] = t0;
535
- $[1] = className;
536
- $[2] = props;
537
- } else {
538
- className = $[1];
539
- props = $[2];
540
- }
541
- let t1;
542
- if ($[3] !== className) {
543
- t1 = cn("ml-auto text-xs text-text-muted group-data-highlighted/dropdown-menu-item:text-text-secondary", className);
544
- $[3] = className;
545
- $[4] = t1;
546
- } else {
547
- t1 = $[4];
548
- }
549
- let t2;
550
- if ($[5] !== props || $[6] !== t1) {
551
- t2 = /* @__PURE__ */ _jsx("span", {
552
- "data-slot": "dropdown-menu-shortcut",
553
- className: t1,
554
- ...props
555
- });
556
- $[5] = props;
557
- $[6] = t1;
558
- $[7] = t2;
559
- } else {
560
- t2 = $[7];
561
- }
562
- return t2;
563
- }
564
- function DropdownMenuSub(t0) {
565
- const $ = _c(9);
566
- let props;
567
- if ($[0] !== t0) {
568
- ({...props} = t0);
569
- $[0] = t0;
570
- $[1] = props;
571
- } else {
572
- props = $[1];
573
- }
574
- const [motionOpen, setMotionOpen] = useMotionOpenState(props);
575
- let t1;
576
- if ($[2] !== motionOpen || $[3] !== props || $[4] !== setMotionOpen) {
577
- t1 = /* @__PURE__ */ _jsx(DropdownMenuPrimitive.Sub, {
578
- "data-slot": "dropdown-menu-sub",
579
- ...props,
580
- open: motionOpen,
581
- onOpenChange: setMotionOpen
582
- });
583
- $[2] = motionOpen;
584
- $[3] = props;
585
- $[4] = setMotionOpen;
586
- $[5] = t1;
587
- } else {
588
- t1 = $[5];
589
- }
590
- let t2;
591
- if ($[6] !== motionOpen || $[7] !== t1) {
592
- t2 = /* @__PURE__ */ _jsx(MotionOpenProvider, {
593
- scope: "dropdown-sub",
594
- open: motionOpen,
44
+ if ($[5] !== t1) {
45
+ t2 = /* @__PURE__ */ _jsx(DropdownMenuTrigger, {
46
+ asChild: true,
595
47
  children: t1
596
48
  });
597
- $[6] = motionOpen;
598
- $[7] = t1;
599
- $[8] = t2;
600
- } else {
601
- t2 = $[8];
602
- }
603
- return t2;
604
- }
605
- /**
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.
609
- * @returns The styled primitive with its original interaction contract.
610
- */
611
- function DropdownMenuSubTrigger(t0) {
612
- const $ = _c(13);
613
- let children;
614
- let className;
615
- let inset;
616
- let props;
617
- if ($[0] !== t0) {
618
- ({className, inset, children, ...props} = t0);
619
- $[0] = t0;
620
- $[1] = children;
621
- $[2] = className;
622
- $[3] = inset;
623
- $[4] = props;
624
- } else {
625
- children = $[1];
626
- className = $[2];
627
- inset = $[3];
628
- props = $[4];
629
- }
630
- let t1;
631
- if ($[5] !== className) {
632
- t1 = cn(menuItemClassName, "data-[state=open]:bg-surface-muted data-open:*:data-[slot=dropdown-menu-sub-trigger-icon]:translate-x-0.5", className);
633
- $[5] = className;
634
- $[6] = t1;
635
- } else {
636
- t1 = $[6];
637
- }
638
- let t2;
639
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
640
- t2 = /* @__PURE__ */ _jsx(ChevronRightIcon, {
641
- "data-slot": "dropdown-menu-sub-trigger-icon",
642
- strokeWidth: 1.75,
643
- className: "ml-auto text-text-muted transition-transform duration-200 ease-out motion-reduce:transition-none"
644
- });
645
- $[7] = t2;
646
- } else {
647
- t2 = $[7];
648
- }
649
- let t3;
650
- if ($[8] !== children || $[9] !== inset || $[10] !== props || $[11] !== t1) {
651
- t3 = /* @__PURE__ */ _jsxs(DropdownMenuPrimitive.SubTrigger, {
652
- "data-slot": "dropdown-menu-sub-trigger",
653
- "data-inset": inset,
654
- className: t1,
655
- ...props,
656
- children: [children, t2]
657
- });
658
- $[8] = children;
659
- $[9] = inset;
660
- $[10] = props;
661
- $[11] = t1;
662
- $[12] = t3;
663
- } else {
664
- t3 = $[12];
665
- }
666
- return t3;
667
- }
668
- /**
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.
672
- */
673
- function DropdownMenuSubContent(t0) {
674
- const $ = _c(15);
675
- let className;
676
- let props;
677
- let t1;
678
- let t2;
679
- if ($[0] !== t0) {
680
- ({className, collisionPadding: t1, loop: t2, ...props} = t0);
681
- $[0] = t0;
682
- $[1] = className;
683
- $[2] = props;
684
- $[3] = t1;
685
- $[4] = t2;
49
+ $[5] = t1;
50
+ $[6] = t2;
686
51
  } else {
687
- className = $[1];
688
- props = $[2];
689
- t1 = $[3];
690
- t2 = $[4];
52
+ t2 = $[6];
691
53
  }
692
- const collisionPadding = t1 === undefined ? DROPDOWN_MENU_COLLISION_PADDING_PX : t1;
693
- const loop = t2 === undefined ? true : t2;
694
- const t3 = props.forceMount;
54
+ const t3 = contentLabel ?? label;
695
55
  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;
56
+ if ($[7] !== items || $[8] !== selection) {
57
+ t4 = /* @__PURE__ */ _jsx(DropdownMenuItems, {
58
+ items,
59
+ selection
60
+ });
61
+ $[7] = items;
62
+ $[8] = selection;
63
+ $[9] = t4;
700
64
  } else {
701
- t4 = $[6];
65
+ t4 = $[9];
702
66
  }
703
67
  let t5;
704
- if ($[7] !== collisionPadding || $[8] !== loop || $[9] !== props || $[10] !== t4) {
705
- t5 = /* @__PURE__ */ _jsx(MotionSlot, {
706
- kind: "surface",
707
- children: /* @__PURE__ */ _jsx(GlideSlot, {
708
- preset: "menu",
709
- children: /* @__PURE__ */ _jsx(DropdownMenuPrimitive.SubContent, {
710
- forceMount: true,
711
- "data-slot": "dropdown-menu-sub-content",
712
- collisionPadding,
713
- loop,
714
- className: t4,
715
- ...props
716
- })
717
- })
718
- });
719
- $[7] = collisionPadding;
720
- $[8] = loop;
721
- $[9] = props;
722
- $[10] = t4;
723
- $[11] = t5;
724
- } else {
725
- t5 = $[11];
68
+ if ($[10] !== align || $[11] !== contentClassName || $[12] !== side || $[13] !== t3 || $[14] !== t4) {
69
+ t5 = /* @__PURE__ */ _jsx(DropdownMenuContent, {
70
+ side,
71
+ align,
72
+ className: contentClassName,
73
+ "aria-label": t3,
74
+ "aria-labelledby": undefined,
75
+ children: t4
76
+ });
77
+ $[10] = align;
78
+ $[11] = contentClassName;
79
+ $[12] = side;
80
+ $[13] = t3;
81
+ $[14] = t4;
82
+ $[15] = t5;
83
+ } else {
84
+ t5 = $[15];
726
85
  }
727
86
  let t6;
728
- if ($[12] !== props.forceMount || $[13] !== t5) {
729
- t6 = /* @__PURE__ */ _jsx(MotionPresence, {
730
- scope: "dropdown-sub",
731
- forceMount: t3,
732
- children: t5
733
- });
734
- $[12] = props.forceMount;
735
- $[13] = t5;
736
- $[14] = t6;
737
- } else {
738
- t6 = $[14];
87
+ if ($[16] !== defaultOpen || $[17] !== modal || $[18] !== onOpenChange || $[19] !== open || $[20] !== t2 || $[21] !== t5) {
88
+ t6 = /* @__PURE__ */ _jsxs(DropdownMenuRoot, {
89
+ open,
90
+ defaultOpen,
91
+ onOpenChange,
92
+ modal,
93
+ children: [t2, t5]
94
+ });
95
+ $[16] = defaultOpen;
96
+ $[17] = modal;
97
+ $[18] = onOpenChange;
98
+ $[19] = open;
99
+ $[20] = t2;
100
+ $[21] = t5;
101
+ $[22] = t6;
102
+ } else {
103
+ t6 = $[22];
739
104
  }
740
105
  return t6;
741
106
  }
742
- export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent };
107
+ export { DropdownMenu };