beez-ui 2.7.1 → 3.0.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 (110) hide show
  1. package/CHANGELOG.md +72 -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 +267 -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 +24 -1
  82. package/dist/constants/avatar.js +19 -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
@@ -0,0 +1,407 @@
1
+ "use client";
2
+ import { c as _c } from "react/compiler-runtime";
3
+ /**
4
+ * Internal primitive of Arc's Select (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): Arc's trigger, whose
5
+ * hover, press and open states answer in color only so the anchored list never shifts, and its raised list with
6
+ * option rows and an end check, on Arc's tokens, with beez-ui's option entrance, check pop and chevron rotation.
7
+ * Internal: the Radix composition behind the public closed `Select`; the package does not export it.
8
+ */
9
+ import * as React from "react";
10
+ import { Select as SelectPrimitive } from "radix-ui";
11
+ import { SELECT_COLLISION_PADDING_PX } from "../../constants/select.js";
12
+ import { GlideSlot } from "../../motion/glide-slot.js";
13
+ import { MotionSlot } from "../../motion/motion-slot.js";
14
+ import { cn } from "../../lib/utils.js";
15
+ import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react";
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
+ function Select(t0) {
18
+ const $ = _c(4);
19
+ let props;
20
+ if ($[0] !== t0) {
21
+ ({...props} = t0);
22
+ $[0] = t0;
23
+ $[1] = props;
24
+ } else {
25
+ props = $[1];
26
+ }
27
+ let t1;
28
+ if ($[2] !== props) {
29
+ t1 = /* @__PURE__ */ _jsx(SelectPrimitive.Root, {
30
+ "data-slot": "select",
31
+ ...props
32
+ });
33
+ $[2] = props;
34
+ $[3] = t1;
35
+ } else {
36
+ t1 = $[3];
37
+ }
38
+ return t1;
39
+ }
40
+ function SelectValue(t0) {
41
+ const $ = _c(4);
42
+ let props;
43
+ if ($[0] !== t0) {
44
+ ({...props} = t0);
45
+ $[0] = t0;
46
+ $[1] = props;
47
+ } else {
48
+ props = $[1];
49
+ }
50
+ let t1;
51
+ if ($[2] !== props) {
52
+ t1 = /* @__PURE__ */ _jsx(SelectPrimitive.Value, {
53
+ "data-slot": "select-value",
54
+ ...props
55
+ });
56
+ $[2] = props;
57
+ $[3] = t1;
58
+ } else {
59
+ t1 = $[3];
60
+ }
61
+ return t1;
62
+ }
63
+ /**
64
+ * Renders Arc's selection control: `default` matches the height of `Input` and `Button`, `sm` their small size.
65
+ * Hover only answers on fine pointers, keyboard focus draws the shared outline, and `aria-invalid` turns the border
66
+ * to the danger color.
67
+ * @param props - Primitive properties, the `size` and optional consumer overrides.
68
+ * @returns The styled primitive with its original interaction contract.
69
+ */
70
+ function SelectTrigger(t0) {
71
+ const $ = _c(13);
72
+ let children;
73
+ let className;
74
+ let props;
75
+ let t1;
76
+ if ($[0] !== t0) {
77
+ ({className, size: t1, children, ...props} = t0);
78
+ $[0] = t0;
79
+ $[1] = children;
80
+ $[2] = className;
81
+ $[3] = props;
82
+ $[4] = t1;
83
+ } else {
84
+ children = $[1];
85
+ className = $[2];
86
+ props = $[3];
87
+ t1 = $[4];
88
+ }
89
+ const size = t1 === undefined ? "default" : t1;
90
+ let t2;
91
+ if ($[5] !== className) {
92
+ t2 = cn("flex w-fit cursor-pointer items-center justify-between gap-3 rounded-(--radius-control) border border-border bg-surface px-3 text-left text-sm whitespace-nowrap text-foreground outline-none select-none transition-[color,background-color,border-color,box-shadow] duration-(--duration-fast) ease-(--ease-standard) motion-reduce:transition-none hover-fine:not-disabled:not-aria-invalid:border-border-strong hover-fine:not-disabled:bg-surface-muted active:not-disabled:not-aria-invalid:border-border-strong active:not-disabled:bg-surface-muted data-[state=open]:not-aria-invalid:border-border-strong data-[state=open]:bg-surface-muted focus-visible:not-aria-invalid:border-border-strong disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-danger data-placeholder:text-text-muted data-[size=default]:min-h-(--control-height-md) data-[size=sm]:min-h-(--control-height-sm) data-[state=open]:*:data-[slot=select-icon]:rotate-180 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className);
93
+ $[5] = className;
94
+ $[6] = t2;
95
+ } else {
96
+ t2 = $[6];
97
+ }
98
+ let t3;
99
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
100
+ t3 = /* @__PURE__ */ _jsx(SelectPrimitive.Icon, {
101
+ asChild: true,
102
+ children: /* @__PURE__ */ _jsx(MotionSlot, {
103
+ kind: "rotate",
104
+ children: /* @__PURE__ */ _jsx(ChevronDownIcon, {
105
+ "data-slot": "select-icon",
106
+ strokeWidth: 1.75,
107
+ className: "pointer-events-none size-4 text-text-muted"
108
+ })
109
+ })
110
+ });
111
+ $[7] = t3;
112
+ } else {
113
+ t3 = $[7];
114
+ }
115
+ let t4;
116
+ if ($[8] !== children || $[9] !== props || $[10] !== size || $[11] !== t2) {
117
+ t4 = /* @__PURE__ */ _jsx(MotionSlot, {
118
+ kind: "field",
119
+ children: /* @__PURE__ */ _jsxs(SelectPrimitive.Trigger, {
120
+ "data-slot": "select-trigger",
121
+ "data-size": size,
122
+ className: t2,
123
+ ...props,
124
+ children: [children, t3]
125
+ })
126
+ });
127
+ $[8] = children;
128
+ $[9] = props;
129
+ $[10] = size;
130
+ $[11] = t2;
131
+ $[12] = t4;
132
+ } else {
133
+ t4 = $[12];
134
+ }
135
+ return t4;
136
+ }
137
+ /**
138
+ * Renders Arc's raised option list, at least twelve rem wide so options stay readable. With `position="popper"` it
139
+ * grows from the trigger edge, matches the trigger width up to min(24rem, 100vw minus 20px), keeps 12px from the
140
+ * viewport edges and caps its height at 20rem.
141
+ * @param props - Primitive properties and optional consumer overrides.
142
+ * @returns The styled primitive with its original interaction contract.
143
+ */
144
+ function SelectContent(t0) {
145
+ const $ = _c(23);
146
+ let children;
147
+ let className;
148
+ let props;
149
+ let t1;
150
+ let t2;
151
+ let t3;
152
+ if ($[0] !== t0) {
153
+ ({className, children, position: t1, align: t2, collisionPadding: t3, ...props} = t0);
154
+ $[0] = t0;
155
+ $[1] = children;
156
+ $[2] = className;
157
+ $[3] = props;
158
+ $[4] = t1;
159
+ $[5] = t2;
160
+ $[6] = t3;
161
+ } else {
162
+ children = $[1];
163
+ className = $[2];
164
+ props = $[3];
165
+ t1 = $[4];
166
+ t2 = $[5];
167
+ t3 = $[6];
168
+ }
169
+ const position = t1 === undefined ? "item-aligned" : t1;
170
+ const align = t2 === undefined ? "center" : t2;
171
+ const collisionPadding = t3 === undefined ? SELECT_COLLISION_PADDING_PX : t3;
172
+ const t4 = position === "item-aligned";
173
+ const t5 = position === "popper" && "w-(--radix-select-trigger-width) max-w-[min(24rem,calc(100vw-20px))] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";
174
+ let t6;
175
+ if ($[7] !== className || $[8] !== t5) {
176
+ t6 = cn("relative z-50 max-h-[min(20rem,var(--radix-select-content-available-height))] min-w-48 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-[calc(var(--radius-control)+2px)] border border-border bg-surface-raised p-1.5 text-foreground shadow-(--shadow-floating)", t5, className);
177
+ $[7] = className;
178
+ $[8] = t5;
179
+ $[9] = t6;
180
+ } else {
181
+ t6 = $[9];
182
+ }
183
+ let t7;
184
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
185
+ t7 = /* @__PURE__ */ _jsx(SelectScrollUpButton, {});
186
+ $[10] = t7;
187
+ } else {
188
+ t7 = $[10];
189
+ }
190
+ let t8;
191
+ if ($[11] !== children || $[12] !== position) {
192
+ t8 = /* @__PURE__ */ _jsx(SelectPrimitive.Viewport, {
193
+ "data-position": position,
194
+ className: "py-0.5 data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full",
195
+ children
196
+ });
197
+ $[11] = children;
198
+ $[12] = position;
199
+ $[13] = t8;
200
+ } else {
201
+ t8 = $[13];
202
+ }
203
+ let t9;
204
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
205
+ t9 = /* @__PURE__ */ _jsx(SelectScrollDownButton, {});
206
+ $[14] = t9;
207
+ } else {
208
+ t9 = $[14];
209
+ }
210
+ let t10;
211
+ if ($[15] !== align || $[16] !== collisionPadding || $[17] !== position || $[18] !== props || $[19] !== t4 || $[20] !== t6 || $[21] !== t8) {
212
+ t10 = /* @__PURE__ */ _jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ _jsx(MotionSlot, {
213
+ kind: "surface",
214
+ children: /* @__PURE__ */ _jsx(GlideSlot, {
215
+ preset: "menu",
216
+ children: /* @__PURE__ */ _jsxs(SelectPrimitive.Content, {
217
+ "data-slot": "select-content",
218
+ "data-align-trigger": t4,
219
+ className: t6,
220
+ position,
221
+ align,
222
+ collisionPadding,
223
+ ...props,
224
+ children: [
225
+ t7,
226
+ t8,
227
+ t9
228
+ ]
229
+ })
230
+ })
231
+ }) });
232
+ $[15] = align;
233
+ $[16] = collisionPadding;
234
+ $[17] = position;
235
+ $[18] = props;
236
+ $[19] = t4;
237
+ $[20] = t6;
238
+ $[21] = t8;
239
+ $[22] = t10;
240
+ } else {
241
+ t10 = $[22];
242
+ }
243
+ return t10;
244
+ }
245
+ /**
246
+ * Renders Arc's option row: 36px tall, a muted fill when highlighted and the check of the chosen option at the end,
247
+ * while retaining selection and disabled semantics.
248
+ * @param props - Primitive properties and optional consumer overrides.
249
+ * @returns The styled primitive with its original interaction contract.
250
+ */
251
+ function SelectItem(t0) {
252
+ const $ = _c(13);
253
+ let children;
254
+ let className;
255
+ let props;
256
+ if ($[0] !== t0) {
257
+ ({className, children, ...props} = t0);
258
+ $[0] = t0;
259
+ $[1] = children;
260
+ $[2] = className;
261
+ $[3] = props;
262
+ } else {
263
+ children = $[1];
264
+ className = $[2];
265
+ props = $[3];
266
+ }
267
+ let t1;
268
+ if ($[4] !== className) {
269
+ t1 = cn("relative flex min-h-9 w-full cursor-default items-center gap-1.5 rounded-[calc(var(--radius-control)-4px)] py-1 pr-[34px] pl-[11px] text-sm text-foreground outline-hidden select-none transition-colors duration-(--duration-instant) ease-(--ease-standard) motion-reduce:transition-none data-highlighted:bg-surface-muted data-disabled:pointer-events-none data-disabled:opacity-45 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className);
270
+ $[4] = className;
271
+ $[5] = t1;
272
+ } else {
273
+ t1 = $[5];
274
+ }
275
+ let t2;
276
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
277
+ t2 = /* @__PURE__ */ _jsx("span", {
278
+ className: "pointer-events-none absolute right-2.5 flex size-4 items-center justify-center text-foreground",
279
+ children: /* @__PURE__ */ _jsx(MotionSlot, {
280
+ kind: "item-check",
281
+ children: /* @__PURE__ */ _jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsx(CheckIcon, {
282
+ strokeWidth: 1.75,
283
+ className: "pointer-events-none"
284
+ }) })
285
+ })
286
+ });
287
+ $[6] = t2;
288
+ } else {
289
+ t2 = $[6];
290
+ }
291
+ let t3;
292
+ if ($[7] !== children) {
293
+ t3 = /* @__PURE__ */ _jsx(SelectPrimitive.ItemText, { children });
294
+ $[7] = children;
295
+ $[8] = t3;
296
+ } else {
297
+ t3 = $[8];
298
+ }
299
+ let t4;
300
+ if ($[9] !== props || $[10] !== t1 || $[11] !== t3) {
301
+ t4 = /* @__PURE__ */ _jsx(MotionSlot, {
302
+ kind: "list-item",
303
+ children: /* @__PURE__ */ _jsxs(SelectPrimitive.Item, {
304
+ "data-slot": "select-item",
305
+ className: t1,
306
+ ...props,
307
+ children: [t2, t3]
308
+ })
309
+ });
310
+ $[9] = props;
311
+ $[10] = t1;
312
+ $[11] = t3;
313
+ $[12] = t4;
314
+ } else {
315
+ t4 = $[12];
316
+ }
317
+ return t4;
318
+ }
319
+ function SelectScrollUpButton(t0) {
320
+ const $ = _c(9);
321
+ let className;
322
+ let props;
323
+ if ($[0] !== t0) {
324
+ ({className, ...props} = t0);
325
+ $[0] = t0;
326
+ $[1] = className;
327
+ $[2] = props;
328
+ } else {
329
+ className = $[1];
330
+ props = $[2];
331
+ }
332
+ let t1;
333
+ if ($[3] !== className) {
334
+ t1 = cn("z-10 flex h-7 cursor-default items-center justify-center bg-surface-raised text-text-muted [&_svg:not([class*='size-'])]:size-4", className);
335
+ $[3] = className;
336
+ $[4] = t1;
337
+ } else {
338
+ t1 = $[4];
339
+ }
340
+ let t2;
341
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
342
+ t2 = /* @__PURE__ */ _jsx(ChevronUpIcon, { strokeWidth: 1.75 });
343
+ $[5] = t2;
344
+ } else {
345
+ t2 = $[5];
346
+ }
347
+ let t3;
348
+ if ($[6] !== props || $[7] !== t1) {
349
+ t3 = /* @__PURE__ */ _jsx(SelectPrimitive.ScrollUpButton, {
350
+ "data-slot": "select-scroll-up-button",
351
+ className: t1,
352
+ ...props,
353
+ children: t2
354
+ });
355
+ $[6] = props;
356
+ $[7] = t1;
357
+ $[8] = t3;
358
+ } else {
359
+ t3 = $[8];
360
+ }
361
+ return t3;
362
+ }
363
+ function SelectScrollDownButton(t0) {
364
+ const $ = _c(9);
365
+ let className;
366
+ let props;
367
+ if ($[0] !== t0) {
368
+ ({className, ...props} = t0);
369
+ $[0] = t0;
370
+ $[1] = className;
371
+ $[2] = props;
372
+ } else {
373
+ className = $[1];
374
+ props = $[2];
375
+ }
376
+ let t1;
377
+ if ($[3] !== className) {
378
+ t1 = cn("z-10 flex h-7 cursor-default items-center justify-center bg-surface-raised text-text-muted [&_svg:not([class*='size-'])]:size-4", className);
379
+ $[3] = className;
380
+ $[4] = t1;
381
+ } else {
382
+ t1 = $[4];
383
+ }
384
+ let t2;
385
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
386
+ t2 = /* @__PURE__ */ _jsx(ChevronDownIcon, { strokeWidth: 1.75 });
387
+ $[5] = t2;
388
+ } else {
389
+ t2 = $[5];
390
+ }
391
+ let t3;
392
+ if ($[6] !== props || $[7] !== t1) {
393
+ t3 = /* @__PURE__ */ _jsx(SelectPrimitive.ScrollDownButton, {
394
+ "data-slot": "select-scroll-down-button",
395
+ className: t1,
396
+ ...props,
397
+ children: t2
398
+ });
399
+ $[6] = props;
400
+ $[7] = t1;
401
+ $[8] = t3;
402
+ } else {
403
+ t3 = $[8];
404
+ }
405
+ return t3;
406
+ }
407
+ export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Internal primitive of Arc's Tooltip (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a short dark
3
+ * bubble on Arc's tokens that waits a moment, then rises a few pixels from its trigger. While a tooltip is open, and
4
+ * briefly after it closes, the next one opens at once and only fades. Internal: the Radix composition (`Tooltip`,
5
+ * `TooltipTrigger`, `TooltipContent`, `TooltipProvider`) behind the public closed `Tooltip` and beez-ui's composite
6
+ * components; the package does not export it.
7
+ */
8
+ import * as React from "react";
9
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
10
+ /**
11
+ * Shares the open delay among the tooltips it wraps.
12
+ * @param props - Radix provider properties. `delayDuration` defaults to Arc's 250ms.
13
+ * @returns The provider.
14
+ */
15
+ declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
16
+ /**
17
+ * Owns the open state of one tooltip. It works with or without a `TooltipProvider`: without one it brings its own,
18
+ * as Arc's Tooltip does. Within the shared skip window it opens without delay.
19
+ * @param props - Radix root properties.
20
+ * @returns The tooltip root.
21
+ */
22
+ declare function Tooltip({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
23
+ declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
24
+ /**
25
+ * Renders Arc's bubble: inverted colors, a hairline border, the raised shadow and 15rem of maximum width.
26
+ * @param props - Radix content properties. `sideOffset` defaults to 8px and `collisionPadding` to 12px.
27
+ * @returns The portaled bubble.
28
+ */
29
+ declare function TooltipContent({ className, sideOffset, collisionPadding, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): React.JSX.Element;
30
+ export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
@@ -0,0 +1,277 @@
1
+ "use client";
2
+ import { c as _c } from "react/compiler-runtime";
3
+ /**
4
+ * Internal primitive of Arc's Tooltip (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a short dark
5
+ * bubble on Arc's tokens that waits a moment, then rises a few pixels from its trigger. While a tooltip is open, and
6
+ * briefly after it closes, the next one opens at once and only fades. Internal: the Radix composition (`Tooltip`,
7
+ * `TooltipTrigger`, `TooltipContent`, `TooltipProvider`) behind the public closed `Tooltip` and beez-ui's composite
8
+ * components; the package does not export it.
9
+ */
10
+ import * as React from "react";
11
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
12
+ import { ArcFloatingSlot } from "../../motion/arc-floating-slot.js";
13
+ import { createOverlayWarmth, useOpenedWhileWarm } from "../../motion/overlay-warmth.js";
14
+ import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../../motion/presence.js";
15
+ import { cn } from "../../lib/utils.js";
16
+ import { TOOLTIP_COLLISION_PADDING_PX, TOOLTIP_INSTANT_MOTION, TOOLTIP_MOTION, TOOLTIP_OPEN_DELAY_MS, TOOLTIP_SIDE_OFFSET_PX, TOOLTIP_SKIP_WINDOW_MS } from "../../constants/tooltip.js";
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ /** Every tooltip on the page shares one skip window, whichever provider it belongs to. */
19
+ const tooltipWarmth = createOverlayWarmth(TOOLTIP_SKIP_WINDOW_MS);
20
+ /** Whether the page was already warm when the surrounding layer opened, so its entrance only fades. */
21
+ const TooltipOpenedWhileWarmContext = React.createContext(false);
22
+ /** Tells a `Tooltip` whether a `TooltipProvider` already wraps it. */
23
+ const TooltipProviderPresenceContext = React.createContext(false);
24
+ /**
25
+ * Shares the open delay among the tooltips it wraps.
26
+ * @param props - Radix provider properties. `delayDuration` defaults to Arc's 250ms.
27
+ * @returns The provider.
28
+ */
29
+ function TooltipProvider(t0) {
30
+ const $ = _c(6);
31
+ let props;
32
+ let t1;
33
+ if ($[0] !== t0) {
34
+ ({delayDuration: t1, ...props} = t0);
35
+ $[0] = t0;
36
+ $[1] = props;
37
+ $[2] = t1;
38
+ } else {
39
+ props = $[1];
40
+ t1 = $[2];
41
+ }
42
+ const delayDuration = t1 === undefined ? TOOLTIP_OPEN_DELAY_MS : t1;
43
+ let t2;
44
+ if ($[3] !== delayDuration || $[4] !== props) {
45
+ t2 = /* @__PURE__ */ _jsx(TooltipProviderPresenceContext.Provider, {
46
+ value: true,
47
+ children: /* @__PURE__ */ _jsx(TooltipPrimitive.Provider, {
48
+ "data-slot": "tooltip-provider",
49
+ delayDuration,
50
+ ...props
51
+ })
52
+ });
53
+ $[3] = delayDuration;
54
+ $[4] = props;
55
+ $[5] = t2;
56
+ } else {
57
+ t2 = $[5];
58
+ }
59
+ return t2;
60
+ }
61
+ /**
62
+ * Owns the open state of one tooltip. It works with or without a `TooltipProvider`: without one it brings its own,
63
+ * as Arc's Tooltip does. Within the shared skip window it opens without delay.
64
+ * @param props - Radix root properties.
65
+ * @returns The tooltip root.
66
+ */
67
+ function Tooltip(t0) {
68
+ const $ = _c(20);
69
+ let delayDuration;
70
+ let props;
71
+ if ($[0] !== t0) {
72
+ ({delayDuration, ...props} = t0);
73
+ $[0] = t0;
74
+ $[1] = delayDuration;
75
+ $[2] = props;
76
+ } else {
77
+ delayDuration = $[1];
78
+ props = $[2];
79
+ }
80
+ const [motionOpen, setMotionOpen] = useMotionOpenState(props);
81
+ const isWarm = React.useSyncExternalStore(tooltipWarmth.subscribe, tooltipWarmth.isWarm, tooltipWarmth.isWarmOnServer);
82
+ const openedWhileWarm = useOpenedWhileWarm(motionOpen, isWarm);
83
+ const hasProvider = React.useContext(TooltipProviderPresenceContext);
84
+ let t1;
85
+ let t2;
86
+ if ($[3] !== motionOpen) {
87
+ t1 = () => {
88
+ if (!motionOpen) {
89
+ return;
90
+ }
91
+ return tooltipWarmth.open();
92
+ };
93
+ t2 = [motionOpen];
94
+ $[3] = motionOpen;
95
+ $[4] = t1;
96
+ $[5] = t2;
97
+ } else {
98
+ t1 = $[4];
99
+ t2 = $[5];
100
+ }
101
+ React.useEffect(t1, t2);
102
+ const t3 = isWarm ? 0 : delayDuration;
103
+ let t4;
104
+ if ($[6] !== motionOpen || $[7] !== props || $[8] !== setMotionOpen || $[9] !== t3) {
105
+ t4 = /* @__PURE__ */ _jsx(TooltipPrimitive.Root, {
106
+ "data-slot": "tooltip",
107
+ ...props,
108
+ delayDuration: t3,
109
+ open: motionOpen,
110
+ onOpenChange: setMotionOpen
111
+ });
112
+ $[6] = motionOpen;
113
+ $[7] = props;
114
+ $[8] = setMotionOpen;
115
+ $[9] = t3;
116
+ $[10] = t4;
117
+ } else {
118
+ t4 = $[10];
119
+ }
120
+ let t5;
121
+ if ($[11] !== openedWhileWarm || $[12] !== t4) {
122
+ t5 = /* @__PURE__ */ _jsx(TooltipOpenedWhileWarmContext.Provider, {
123
+ value: openedWhileWarm,
124
+ children: t4
125
+ });
126
+ $[11] = openedWhileWarm;
127
+ $[12] = t4;
128
+ $[13] = t5;
129
+ } else {
130
+ t5 = $[13];
131
+ }
132
+ let t6;
133
+ if ($[14] !== motionOpen || $[15] !== t5) {
134
+ t6 = /* @__PURE__ */ _jsx(MotionOpenProvider, {
135
+ scope: "tooltip",
136
+ open: motionOpen,
137
+ children: t5
138
+ });
139
+ $[14] = motionOpen;
140
+ $[15] = t5;
141
+ $[16] = t6;
142
+ } else {
143
+ t6 = $[16];
144
+ }
145
+ const root = t6;
146
+ let t7;
147
+ if ($[17] !== hasProvider || $[18] !== root) {
148
+ t7 = hasProvider ? root : /* @__PURE__ */ _jsx(TooltipProvider, { children: root });
149
+ $[17] = hasProvider;
150
+ $[18] = root;
151
+ $[19] = t7;
152
+ } else {
153
+ t7 = $[19];
154
+ }
155
+ return t7;
156
+ }
157
+ function TooltipTrigger(t0) {
158
+ const $ = _c(4);
159
+ let props;
160
+ if ($[0] !== t0) {
161
+ ({...props} = t0);
162
+ $[0] = t0;
163
+ $[1] = props;
164
+ } else {
165
+ props = $[1];
166
+ }
167
+ let t1;
168
+ if ($[2] !== props) {
169
+ t1 = /* @__PURE__ */ _jsx(TooltipPrimitive.Trigger, {
170
+ "data-slot": "tooltip-trigger",
171
+ ...props
172
+ });
173
+ $[2] = props;
174
+ $[3] = t1;
175
+ } else {
176
+ t1 = $[3];
177
+ }
178
+ return t1;
179
+ }
180
+ /**
181
+ * Renders Arc's bubble: inverted colors, a hairline border, the raised shadow and 15rem of maximum width.
182
+ * @param props - Radix content properties. `sideOffset` defaults to 8px and `collisionPadding` to 12px.
183
+ * @returns The portaled bubble.
184
+ */
185
+ function TooltipContent(t0) {
186
+ const $ = _c(22);
187
+ let children;
188
+ let className;
189
+ let props;
190
+ let t1;
191
+ let t2;
192
+ if ($[0] !== t0) {
193
+ ({className, sideOffset: t1, collisionPadding: t2, children, ...props} = t0);
194
+ $[0] = t0;
195
+ $[1] = children;
196
+ $[2] = className;
197
+ $[3] = props;
198
+ $[4] = t1;
199
+ $[5] = t2;
200
+ } else {
201
+ children = $[1];
202
+ className = $[2];
203
+ props = $[3];
204
+ t1 = $[4];
205
+ t2 = $[5];
206
+ }
207
+ const sideOffset = t1 === undefined ? TOOLTIP_SIDE_OFFSET_PX : t1;
208
+ const collisionPadding = t2 === undefined ? TOOLTIP_COLLISION_PADDING_PX : t2;
209
+ const openedWhileWarm = React.useContext(TooltipOpenedWhileWarmContext);
210
+ const t3 = props.forceMount;
211
+ let t4;
212
+ if ($[6] !== openedWhileWarm) {
213
+ t4 = () => openedWhileWarm ? TOOLTIP_INSTANT_MOTION : TOOLTIP_MOTION;
214
+ $[6] = openedWhileWarm;
215
+ $[7] = t4;
216
+ } else {
217
+ t4 = $[7];
218
+ }
219
+ let t5;
220
+ if ($[8] !== className) {
221
+ t5 = cn("z-50 inline-flex w-fit max-w-60 origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-(--radius-control) border border-[color-mix(in_oklab,var(--background)_14%,var(--foreground))] bg-foreground px-(--space-4) py-(--space-3) font-sans text-sm leading-(--leading-body) font-normal tracking-(--tracking-body) text-background shadow-(--shadow-raised) has-data-[slot=kbd]:pr-(--space-3) **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm", className);
222
+ $[8] = className;
223
+ $[9] = t5;
224
+ } else {
225
+ t5 = $[9];
226
+ }
227
+ let t6;
228
+ if ($[10] !== children || $[11] !== collisionPadding || $[12] !== props || $[13] !== sideOffset || $[14] !== t5) {
229
+ t6 = /* @__PURE__ */ _jsx(TooltipPrimitive.Content, {
230
+ forceMount: true,
231
+ "data-slot": "tooltip-content",
232
+ sideOffset,
233
+ collisionPadding,
234
+ className: t5,
235
+ ...props,
236
+ children
237
+ });
238
+ $[10] = children;
239
+ $[11] = collisionPadding;
240
+ $[12] = props;
241
+ $[13] = sideOffset;
242
+ $[14] = t5;
243
+ $[15] = t6;
244
+ } else {
245
+ t6 = $[15];
246
+ }
247
+ let t7;
248
+ if ($[16] !== t4 || $[17] !== t6) {
249
+ t7 = /* @__PURE__ */ _jsx(ArcFloatingSlot, {
250
+ motion: t4,
251
+ children: t6
252
+ });
253
+ $[16] = t4;
254
+ $[17] = t6;
255
+ $[18] = t7;
256
+ } else {
257
+ t7 = $[18];
258
+ }
259
+ let t8;
260
+ if ($[19] !== props.forceMount || $[20] !== t7) {
261
+ t8 = /* @__PURE__ */ _jsx(TooltipPrimitive.Portal, {
262
+ forceMount: true,
263
+ children: /* @__PURE__ */ _jsx(MotionPresence, {
264
+ scope: "tooltip",
265
+ forceMount: t3,
266
+ children: t7
267
+ })
268
+ });
269
+ $[19] = props.forceMount;
270
+ $[20] = t7;
271
+ $[21] = t8;
272
+ } else {
273
+ t8 = $[21];
274
+ }
275
+ return t8;
276
+ }
277
+ export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };