beez-ui 0.6.2 → 0.8.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 (127) hide show
  1. package/CHANGELOG.md +150 -96
  2. package/README.md +33 -6
  3. package/dist/components/account-menu.d.ts +53 -0
  4. package/dist/components/account-menu.js +405 -0
  5. package/dist/components/alert.js +1 -1
  6. package/dist/components/animated-collapse.d.ts +19 -0
  7. package/dist/components/animated-collapse.js +81 -0
  8. package/dist/components/animated-count.d.ts +13 -0
  9. package/dist/components/animated-count.js +105 -0
  10. package/dist/components/animated-list-item.d.ts +25 -0
  11. package/dist/components/animated-list-item.js +132 -0
  12. package/dist/components/avatar.d.ts +2 -1
  13. package/dist/components/avatar.js +4 -3
  14. package/dist/components/bouncing-dots-loader.d.ts +19 -0
  15. package/dist/components/bouncing-dots-loader.js +47 -0
  16. package/dist/components/calendar.js +102 -0
  17. package/dist/components/carousel.js +61 -48
  18. package/dist/components/checkbox.js +1 -1
  19. package/dist/components/confirm-delete-button.d.ts +29 -0
  20. package/dist/components/confirm-delete-button.js +254 -0
  21. package/dist/components/data-table.js +34 -4
  22. package/dist/components/dropdown-menu.js +5 -2
  23. package/dist/components/empty-state.d.ts +24 -0
  24. package/dist/components/empty-state.js +37 -0
  25. package/dist/components/error-state.d.ts +20 -0
  26. package/dist/components/error-state.js +145 -0
  27. package/dist/components/external-browser-handoff.d.ts +27 -0
  28. package/dist/components/external-browser-handoff.js +306 -0
  29. package/dist/components/file-upload.d.ts +78 -0
  30. package/dist/components/file-upload.js +678 -0
  31. package/dist/components/filter-query-bar.js +11 -6
  32. package/dist/components/form.d.ts +5 -0
  33. package/dist/components/form.js +11 -9
  34. package/dist/components/info-popover.d.ts +23 -0
  35. package/dist/components/info-popover.js +158 -0
  36. package/dist/components/input-group.js +1 -1
  37. package/dist/components/input.js +1 -1
  38. package/dist/components/month-calendar-header.d.ts +65 -0
  39. package/dist/components/month-calendar-header.js +337 -0
  40. package/dist/components/month-grid.d.ts +59 -0
  41. package/dist/components/month-grid.js +301 -0
  42. package/dist/components/notification-bell.d.ts +50 -0
  43. package/dist/components/notification-bell.js +338 -0
  44. package/dist/components/notification-panel.d.ts +56 -0
  45. package/dist/components/notification-panel.js +281 -0
  46. package/dist/components/open-in-browser-cta.d.ts +22 -0
  47. package/dist/components/open-in-browser-cta.js +61 -0
  48. package/dist/components/pagination.d.ts +1 -0
  49. package/dist/components/pagination.js +9 -4
  50. package/dist/components/presence-swap.d.ts +22 -0
  51. package/dist/components/presence-swap.js +162 -0
  52. package/dist/components/progress-ring.d.ts +20 -0
  53. package/dist/components/progress-ring.js +53 -0
  54. package/dist/components/pwa-update-control.d.ts +18 -0
  55. package/dist/components/pwa-update-control.js +119 -0
  56. package/dist/components/radio-group.js +1 -1
  57. package/dist/components/reaction-button.d.ts +26 -0
  58. package/dist/components/reaction-button.js +114 -0
  59. package/dist/components/rich-link-editor.d.ts +25 -0
  60. package/dist/components/rich-link-editor.js +320 -0
  61. package/dist/components/rich-markdown-content.d.ts +10 -0
  62. package/dist/components/rich-markdown-content.js +56 -0
  63. package/dist/components/rich-text-content.d.ts +19 -0
  64. package/dist/components/rich-text-content.js +26 -0
  65. package/dist/components/select.js +1 -1
  66. package/dist/components/sheet.js +12 -9
  67. package/dist/components/sidebar.js +9 -5
  68. package/dist/components/skeleton.d.ts +6 -0
  69. package/dist/components/skeleton.js +7 -1
  70. package/dist/components/switch.js +1 -1
  71. package/dist/components/textarea.js +1 -1
  72. package/dist/components/typing-animation.js +42 -15
  73. package/dist/emoji-picker.d.ts +27 -0
  74. package/dist/emoji-picker.js +283 -0
  75. package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
  76. package/dist/hooks/use-horizontal-swipe.js +80 -0
  77. package/dist/hooks/use-is-hydrated.d.ts +6 -0
  78. package/dist/hooks/use-is-hydrated.js +20 -0
  79. package/dist/hooks/use-minute-clock.d.ts +23 -0
  80. package/dist/hooks/use-minute-clock.js +147 -0
  81. package/dist/hooks/use-month-transition-direction.d.ts +21 -0
  82. package/dist/hooks/use-month-transition-direction.js +110 -0
  83. package/dist/hooks/use-rich-link-editor.d.ts +55 -0
  84. package/dist/hooks/use-rich-link-editor.js +515 -0
  85. package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
  86. package/dist/hooks/use-viewer-time-zone.js +20 -0
  87. package/dist/index.d.ts +44 -0
  88. package/dist/index.js +43 -0
  89. package/dist/lib/browser-clipboard.d.ts +13 -0
  90. package/dist/lib/browser-clipboard.js +48 -0
  91. package/dist/lib/browser-navigation.d.ts +21 -0
  92. package/dist/lib/browser-navigation.js +42 -0
  93. package/dist/lib/column-filter-value.d.ts +12 -0
  94. package/dist/lib/column-filter-value.js +52 -0
  95. package/dist/lib/file-acceptance.d.ts +43 -0
  96. package/dist/lib/file-acceptance.js +107 -0
  97. package/dist/lib/format-file-size.d.ts +16 -0
  98. package/dist/lib/format-file-size.js +34 -0
  99. package/dist/lib/fuzzy-search.d.ts +17 -0
  100. package/dist/lib/fuzzy-search.js +183 -0
  101. package/dist/lib/horizontal-swipe.d.ts +23 -0
  102. package/dist/lib/horizontal-swipe.js +29 -0
  103. package/dist/lib/in-app-browser.d.ts +35 -0
  104. package/dist/lib/in-app-browser.js +80 -0
  105. package/dist/lib/month-grid.d.ts +42 -0
  106. package/dist/lib/month-grid.js +74 -0
  107. package/dist/lib/name-initials.d.ts +7 -0
  108. package/dist/lib/name-initials.js +11 -0
  109. package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
  110. package/dist/lib/rich-text/link-markdown-constants.js +458 -0
  111. package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
  112. package/dist/lib/rich-text/link-markdown-types.js +1 -0
  113. package/dist/lib/rich-text/link-markdown.d.ts +193 -0
  114. package/dist/lib/rich-text/link-markdown.js +592 -0
  115. package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
  116. package/dist/lib/rich-text/rich-markdown.js +105 -0
  117. package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
  118. package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
  119. package/dist/motion/glide-indicator.d.ts +37 -3
  120. package/dist/motion/glide-indicator.js +37 -3
  121. package/dist/motion/motion-slot.js +47 -18
  122. package/dist/motion/surface-keyframes.js +18 -6
  123. package/dist/motion/tokens.d.ts +41 -2
  124. package/dist/motion/tokens.js +40 -1
  125. package/dist/providers/beez-ui-provider.js +49 -17
  126. package/dist/styles.css +1 -1
  127. package/package.json +212 -2
@@ -0,0 +1,405 @@
1
+ "use client";
2
+ import { c as _c } from "react/compiler-runtime";
3
+ import { ChevronDownIcon, LogInIcon, LogOutIcon, PlusIcon } from "lucide-react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { getNameInitials } from "../lib/name-initials.js";
6
+ import { Avatar, AvatarBadge, AvatarFallback, AvatarImage } from "./avatar.js";
7
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu.js";
8
+ import { Link } from "./link.js";
9
+ import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
10
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
+ const ACCOUNT_MENU_DEFAULT_LABELS = {
12
+ signIn: "Iniciar sesión",
13
+ signOut: "Cerrar sesión",
14
+ trigger: "Menú de cuenta"
15
+ };
16
+ /** Shown when the name yields no initials, so the avatar never renders empty. */
17
+ const DEFAULT_AVATAR_FALLBACK = "?";
18
+ /**
19
+ * Renders the account avatar with an optional status badge.
20
+ * @param props - Identity, status and class names.
21
+ * @returns The avatar.
22
+ */
23
+ function AccountAvatar(t0) {
24
+ const $ = _c(21);
25
+ const { name, image, fallback, status, showStatusBadge, isDecorative: t1, className, classNames } = t0;
26
+ const isDecorative = t1 === undefined ? false : t1;
27
+ const isAuthenticated = status === "authenticated";
28
+ const t2 = showStatusBadge && !isAuthenticated && "grayscale";
29
+ let t3;
30
+ if ($[0] !== className || $[1] !== t2) {
31
+ t3 = cn(t2, className);
32
+ $[0] = className;
33
+ $[1] = t2;
34
+ $[2] = t3;
35
+ } else {
36
+ t3 = $[2];
37
+ }
38
+ let t4;
39
+ if ($[3] !== image || $[4] !== isDecorative || $[5] !== name) {
40
+ t4 = image ? /* @__PURE__ */ _jsx(AvatarImage, {
41
+ alt: isDecorative ? "" : name,
42
+ loading: "eager",
43
+ src: image
44
+ }) : null;
45
+ $[3] = image;
46
+ $[4] = isDecorative;
47
+ $[5] = name;
48
+ $[6] = t4;
49
+ } else {
50
+ t4 = $[6];
51
+ }
52
+ const t5 = isDecorative || undefined;
53
+ let t6;
54
+ if ($[7] !== fallback || $[8] !== t5) {
55
+ t6 = /* @__PURE__ */ _jsx(AvatarFallback, {
56
+ "aria-hidden": t5,
57
+ children: fallback
58
+ });
59
+ $[7] = fallback;
60
+ $[8] = t5;
61
+ $[9] = t6;
62
+ } else {
63
+ t6 = $[9];
64
+ }
65
+ let t7;
66
+ if ($[10] !== classNames?.connectedBadge || $[11] !== classNames?.disconnectedBadge || $[12] !== isAuthenticated || $[13] !== showStatusBadge || $[14] !== status) {
67
+ t7 = showStatusBadge ? /* @__PURE__ */ _jsx(AvatarBadge, {
68
+ "data-status": status,
69
+ className: cn(isAuthenticated ? "bg-green-600 dark:bg-green-800" : undefined, isAuthenticated ? classNames?.connectedBadge : classNames?.disconnectedBadge),
70
+ children: isAuthenticated ? null : /* @__PURE__ */ _jsx(PlusIcon, { "aria-hidden": "true" })
71
+ }) : null;
72
+ $[10] = classNames?.connectedBadge;
73
+ $[11] = classNames?.disconnectedBadge;
74
+ $[12] = isAuthenticated;
75
+ $[13] = showStatusBadge;
76
+ $[14] = status;
77
+ $[15] = t7;
78
+ } else {
79
+ t7 = $[15];
80
+ }
81
+ let t8;
82
+ if ($[16] !== t3 || $[17] !== t4 || $[18] !== t6 || $[19] !== t7) {
83
+ t8 = /* @__PURE__ */ _jsxs(Avatar, {
84
+ className: t3,
85
+ children: [
86
+ t4,
87
+ t6,
88
+ t7
89
+ ]
90
+ });
91
+ $[16] = t3;
92
+ $[17] = t4;
93
+ $[18] = t6;
94
+ $[19] = t7;
95
+ $[20] = t8;
96
+ } else {
97
+ t8 = $[20];
98
+ }
99
+ return t8;
100
+ }
101
+ /**
102
+ * Presentational account menu: the session and its side effects stay with the caller. Signed in,
103
+ * the menu offers sign-out; signed out, it offers sign-in as a link (`signInHref`) or a callback.
104
+ * @param props - Identity, session status, callbacks, copy and layout.
105
+ * @returns The trigger and its menu.
106
+ */
107
+ export function AccountMenu(t0) {
108
+ const $ = _c(70);
109
+ const { name, email, status, image: t1, avatarFallback, onSignOut, signOutDisabled: t2, onSignIn, signInHref, triggerVariant: t3, showStatusBadge: t4, tooltipLabel, labels, classNames, align: t5, side: t6, sideOffset: t7, children } = t0;
110
+ const image = t1 === undefined ? null : t1;
111
+ const signOutDisabled = t2 === undefined ? false : t2;
112
+ const triggerVariant = t3 === undefined ? "avatar" : t3;
113
+ const showStatusBadge = t4 === undefined ? false : t4;
114
+ const align = t5 === undefined ? "end" : t5;
115
+ const side = t6 === undefined ? "bottom" : t6;
116
+ const sideOffset = t7 === undefined ? 4 : t7;
117
+ let t8;
118
+ if ($[0] !== labels) {
119
+ t8 = {
120
+ ...ACCOUNT_MENU_DEFAULT_LABELS,
121
+ ...labels
122
+ };
123
+ $[0] = labels;
124
+ $[1] = t8;
125
+ } else {
126
+ t8 = $[1];
127
+ }
128
+ const resolvedLabels = t8;
129
+ const isAuthenticated = status === "authenticated";
130
+ let t9;
131
+ if ($[2] !== avatarFallback || $[3] !== name) {
132
+ t9 = avatarFallback ?? (getNameInitials(name) || DEFAULT_AVATAR_FALLBACK);
133
+ $[2] = avatarFallback;
134
+ $[3] = name;
135
+ $[4] = t9;
136
+ } else {
137
+ t9 = $[4];
138
+ }
139
+ const fallback = t9;
140
+ let t10;
141
+ if ($[5] !== classNames || $[6] !== fallback || $[7] !== image || $[8] !== name || $[9] !== showStatusBadge || $[10] !== status) {
142
+ t10 = {
143
+ name,
144
+ image,
145
+ fallback,
146
+ status,
147
+ showStatusBadge,
148
+ classNames
149
+ };
150
+ $[5] = classNames;
151
+ $[6] = fallback;
152
+ $[7] = image;
153
+ $[8] = name;
154
+ $[9] = showStatusBadge;
155
+ $[10] = status;
156
+ $[11] = t10;
157
+ } else {
158
+ t10 = $[11];
159
+ }
160
+ const avatarProps = t10;
161
+ const t11 = resolvedLabels.trigger;
162
+ const t12 = triggerVariant === "sidebar" && "w-full min-w-0 gap-2.5 rounded-lg p-1.5 text-left";
163
+ const t13 = classNames?.trigger;
164
+ let t14;
165
+ if ($[12] !== t12 || $[13] !== t13) {
166
+ t14 = cn("inline-flex items-center rounded-full outline-none [-webkit-tap-highlight-color:transparent] transition-[box-shadow,opacity,transform] hover:opacity-90 active:scale-[0.96] focus-visible:shadow-[0_0_0_2px_var(--background),0_0_0_4px_var(--ring)] data-[state=open]:shadow-[0_0_0_2px_var(--background),0_0_0_4px_var(--ring)]", t12, t13);
167
+ $[12] = t12;
168
+ $[13] = t13;
169
+ $[14] = t14;
170
+ } else {
171
+ t14 = $[14];
172
+ }
173
+ const t15 = classNames?.triggerAvatar;
174
+ let t16;
175
+ if ($[15] !== avatarProps || $[16] !== t15) {
176
+ t16 = /* @__PURE__ */ _jsx(AccountAvatar, {
177
+ ...avatarProps,
178
+ className: t15
179
+ });
180
+ $[15] = avatarProps;
181
+ $[16] = t15;
182
+ $[17] = t16;
183
+ } else {
184
+ t16 = $[17];
185
+ }
186
+ let t17;
187
+ if ($[18] !== email || $[19] !== name || $[20] !== triggerVariant) {
188
+ t17 = triggerVariant === "sidebar" ? /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsxs("span", {
189
+ className: "grid min-w-0 flex-1",
190
+ children: [/* @__PURE__ */ _jsx("span", {
191
+ className: "truncate text-sm font-semibold",
192
+ children: name
193
+ }), /* @__PURE__ */ _jsx("span", {
194
+ className: "truncate text-xs text-muted-foreground",
195
+ children: email
196
+ })]
197
+ }), /* @__PURE__ */ _jsx(ChevronDownIcon, {
198
+ "aria-hidden": "true",
199
+ className: "size-4 shrink-0 text-muted-foreground"
200
+ })] }) : null;
201
+ $[18] = email;
202
+ $[19] = name;
203
+ $[20] = triggerVariant;
204
+ $[21] = t17;
205
+ } else {
206
+ t17 = $[21];
207
+ }
208
+ let t18;
209
+ if ($[22] !== resolvedLabels.trigger || $[23] !== t14 || $[24] !== t16 || $[25] !== t17 || $[26] !== triggerVariant) {
210
+ const triggerButton = /* @__PURE__ */ _jsxs("button", {
211
+ "data-slot": "account-menu-trigger",
212
+ "data-variant": triggerVariant,
213
+ "aria-label": t11,
214
+ type: "button",
215
+ className: t14,
216
+ children: [t16, t17]
217
+ });
218
+ t18 = /* @__PURE__ */ _jsx(DropdownMenuTrigger, {
219
+ asChild: true,
220
+ children: triggerButton
221
+ });
222
+ $[22] = resolvedLabels.trigger;
223
+ $[23] = t14;
224
+ $[24] = t16;
225
+ $[25] = t17;
226
+ $[26] = triggerVariant;
227
+ $[27] = t18;
228
+ } else {
229
+ t18 = $[27];
230
+ }
231
+ const trigger = t18;
232
+ let t19;
233
+ if ($[28] !== tooltipLabel || $[29] !== trigger) {
234
+ t19 = tooltipLabel ? /* @__PURE__ */ _jsx(TooltipTrigger, {
235
+ asChild: true,
236
+ children: trigger
237
+ }) : trigger;
238
+ $[28] = tooltipLabel;
239
+ $[29] = trigger;
240
+ $[30] = t19;
241
+ } else {
242
+ t19 = $[30];
243
+ }
244
+ const t20 = classNames?.content;
245
+ let t21;
246
+ if ($[31] !== t20) {
247
+ t21 = cn("min-w-56", t20);
248
+ $[31] = t20;
249
+ $[32] = t21;
250
+ } else {
251
+ t21 = $[32];
252
+ }
253
+ let t22;
254
+ if ($[33] !== avatarProps) {
255
+ t22 = /* @__PURE__ */ _jsx(AccountAvatar, {
256
+ ...avatarProps,
257
+ isDecorative: true
258
+ });
259
+ $[33] = avatarProps;
260
+ $[34] = t22;
261
+ } else {
262
+ t22 = $[34];
263
+ }
264
+ let t23;
265
+ if ($[35] !== name) {
266
+ t23 = /* @__PURE__ */ _jsx("span", {
267
+ className: "truncate text-sm leading-tight font-semibold",
268
+ children: name
269
+ });
270
+ $[35] = name;
271
+ $[36] = t23;
272
+ } else {
273
+ t23 = $[36];
274
+ }
275
+ let t24;
276
+ if ($[37] !== email) {
277
+ t24 = /* @__PURE__ */ _jsx("span", {
278
+ className: "truncate text-xs leading-tight text-muted-foreground",
279
+ children: email
280
+ });
281
+ $[37] = email;
282
+ $[38] = t24;
283
+ } else {
284
+ t24 = $[38];
285
+ }
286
+ let t25;
287
+ if ($[39] !== t23 || $[40] !== t24) {
288
+ t25 = /* @__PURE__ */ _jsxs("span", {
289
+ className: "grid min-w-0 gap-px",
290
+ children: [t23, t24]
291
+ });
292
+ $[39] = t23;
293
+ $[40] = t24;
294
+ $[41] = t25;
295
+ } else {
296
+ t25 = $[41];
297
+ }
298
+ let t26;
299
+ if ($[42] !== t22 || $[43] !== t25) {
300
+ t26 = /* @__PURE__ */ _jsxs("div", {
301
+ className: "grid grid-cols-[auto_minmax(0,1fr)] items-center gap-2.5 px-2 py-1.5",
302
+ children: [t22, t25]
303
+ });
304
+ $[42] = t22;
305
+ $[43] = t25;
306
+ $[44] = t26;
307
+ } else {
308
+ t26 = $[44];
309
+ }
310
+ let t27;
311
+ if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
312
+ t27 = /* @__PURE__ */ _jsx(DropdownMenuSeparator, {});
313
+ $[45] = t27;
314
+ } else {
315
+ t27 = $[45];
316
+ }
317
+ let t28;
318
+ if ($[46] !== isAuthenticated || $[47] !== onSignIn || $[48] !== onSignOut || $[49] !== resolvedLabels.signIn || $[50] !== resolvedLabels.signOut || $[51] !== signInHref || $[52] !== signOutDisabled) {
319
+ t28 = isAuthenticated ? /* @__PURE__ */ _jsxs(DropdownMenuItem, {
320
+ disabled: signOutDisabled,
321
+ onSelect: () => void onSignOut(),
322
+ children: [/* @__PURE__ */ _jsx(LogOutIcon, { "aria-hidden": "true" }), resolvedLabels.signOut]
323
+ }) : signInHref ? /* @__PURE__ */ _jsx(DropdownMenuItem, {
324
+ asChild: true,
325
+ children: /* @__PURE__ */ _jsxs(Link, {
326
+ href: signInHref,
327
+ children: [/* @__PURE__ */ _jsx(LogInIcon, { "aria-hidden": "true" }), resolvedLabels.signIn]
328
+ })
329
+ }) : /* @__PURE__ */ _jsxs(DropdownMenuItem, {
330
+ onSelect: () => onSignIn?.(),
331
+ children: [/* @__PURE__ */ _jsx(LogInIcon, { "aria-hidden": "true" }), resolvedLabels.signIn]
332
+ });
333
+ $[46] = isAuthenticated;
334
+ $[47] = onSignIn;
335
+ $[48] = onSignOut;
336
+ $[49] = resolvedLabels.signIn;
337
+ $[50] = resolvedLabels.signOut;
338
+ $[51] = signInHref;
339
+ $[52] = signOutDisabled;
340
+ $[53] = t28;
341
+ } else {
342
+ t28 = $[53];
343
+ }
344
+ let t29;
345
+ if ($[54] !== align || $[55] !== children || $[56] !== side || $[57] !== sideOffset || $[58] !== t21 || $[59] !== t26 || $[60] !== t28) {
346
+ t29 = /* @__PURE__ */ _jsxs(DropdownMenuContent, {
347
+ "data-slot": "account-menu-content",
348
+ align,
349
+ side,
350
+ sideOffset,
351
+ className: t21,
352
+ children: [
353
+ t26,
354
+ t27,
355
+ children,
356
+ t28
357
+ ]
358
+ });
359
+ $[54] = align;
360
+ $[55] = children;
361
+ $[56] = side;
362
+ $[57] = sideOffset;
363
+ $[58] = t21;
364
+ $[59] = t26;
365
+ $[60] = t28;
366
+ $[61] = t29;
367
+ } else {
368
+ t29 = $[61];
369
+ }
370
+ let t30;
371
+ if ($[62] !== t19 || $[63] !== t29) {
372
+ t30 = /* @__PURE__ */ _jsxs(DropdownMenu, { children: [t19, t29] });
373
+ $[62] = t19;
374
+ $[63] = t29;
375
+ $[64] = t30;
376
+ } else {
377
+ t30 = $[64];
378
+ }
379
+ const menu = t30;
380
+ if (!tooltipLabel) {
381
+ return menu;
382
+ }
383
+ let t31;
384
+ if ($[65] !== tooltipLabel) {
385
+ t31 = /* @__PURE__ */ _jsx(TooltipContent, {
386
+ side: "bottom",
387
+ sideOffset: 8,
388
+ children: tooltipLabel
389
+ });
390
+ $[65] = tooltipLabel;
391
+ $[66] = t31;
392
+ } else {
393
+ t31 = $[66];
394
+ }
395
+ let t32;
396
+ if ($[67] !== menu || $[68] !== t31) {
397
+ t32 = /* @__PURE__ */ _jsxs(Tooltip, { children: [menu, t31] });
398
+ $[67] = menu;
399
+ $[68] = t31;
400
+ $[69] = t32;
401
+ } else {
402
+ t32 = $[69];
403
+ }
404
+ return t32;
405
+ }
@@ -40,7 +40,7 @@ function Alert(t0) {
40
40
  let t2;
41
41
  if ($[7] !== props || $[8] !== t1) {
42
42
  t2 = /* @__PURE__ */ _jsx(MotionSlot, {
43
- kind: "fade",
43
+ kind: "message",
44
44
  children: /* @__PURE__ */ _jsx("div", {
45
45
  "data-slot": "alert",
46
46
  role: "alert",
@@ -0,0 +1,19 @@
1
+ /** Expands and collapses a region by animating its height, then releases overflow. */
2
+ import { type ReactNode } from "react";
3
+ export interface AnimatedCollapseProps {
4
+ /** Whether the region is rendered and expanded. */
5
+ isOpen: boolean;
6
+ children: ReactNode;
7
+ className?: string;
8
+ id?: string;
9
+ /** Animate the very first render too; off by default so SSR output stays visible. */
10
+ animateOnMount?: boolean;
11
+ }
12
+ /**
13
+ * Renders `children` only while `isOpen`, animating height and opacity.
14
+ * Keep padding inside `children`: the animated wrapper collapses to zero height.
15
+ * Overflow is clipped only while animating, so focus rings and popovers are not cut once settled.
16
+ * @param props - Open state, content and optional wrapper attributes.
17
+ * @returns The animated region, or nothing when closed.
18
+ */
19
+ export declare function AnimatedCollapse({ isOpen, children, className, id, animateOnMount }: AnimatedCollapseProps): import("react").JSX.Element;
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import { c as _c } from "react/compiler-runtime";
3
+ /** Expands and collapses a region by animating its height, then releases overflow. */
4
+ import { useState } from "react";
5
+ import { AnimatePresence, motion } from "motion/react";
6
+ import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
7
+ import { cn } from "../lib/utils.js";
8
+ import { MOTION_EASE, MOTION_EASE_IN_OUT, MOTION_TIMING } from "../motion/tokens.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const COLLAPSE_TRANSITION = {
11
+ height: {
12
+ duration: MOTION_TIMING.collapse,
13
+ ease: MOTION_EASE_IN_OUT
14
+ },
15
+ opacity: {
16
+ duration: MOTION_TIMING.panel,
17
+ ease: MOTION_EASE
18
+ }
19
+ };
20
+ /** Reduced motion keeps the open/closed contract but applies it instantly. */
21
+ const INSTANT_TRANSITION = { duration: 0 };
22
+ /**
23
+ * Renders `children` only while `isOpen`, animating height and opacity.
24
+ * Keep padding inside `children`: the animated wrapper collapses to zero height.
25
+ * Overflow is clipped only while animating, so focus rings and popovers are not cut once settled.
26
+ * @param props - Open state, content and optional wrapper attributes.
27
+ * @returns The animated region, or nothing when closed.
28
+ */
29
+ export function AnimatedCollapse(t0) {
30
+ const $ = _c(10);
31
+ const { isOpen, children, className, id, animateOnMount: t1 } = t0;
32
+ const animateOnMount = t1 === undefined ? false : t1;
33
+ const [isSettled, setIsSettled] = useState(!animateOnMount);
34
+ const shouldReduceMotion = usePrefersReducedMotion();
35
+ let t2;
36
+ if ($[0] !== children || $[1] !== className || $[2] !== id || $[3] !== isOpen || $[4] !== isSettled || $[5] !== shouldReduceMotion) {
37
+ t2 = isOpen ? /* @__PURE__ */ _jsx(motion.div, {
38
+ "data-slot": "animated-collapse",
39
+ id,
40
+ className: cn(isSettled ? "overflow-visible" : "overflow-hidden", className),
41
+ initial: {
42
+ height: 0,
43
+ opacity: 0
44
+ },
45
+ animate: {
46
+ height: "auto",
47
+ opacity: 1
48
+ },
49
+ exit: {
50
+ height: 0,
51
+ opacity: 0
52
+ },
53
+ transition: shouldReduceMotion ? INSTANT_TRANSITION : COLLAPSE_TRANSITION,
54
+ onAnimationStart: () => setIsSettled(false),
55
+ onAnimationComplete: () => setIsSettled(true),
56
+ children
57
+ }, "animated-collapse") : null;
58
+ $[0] = children;
59
+ $[1] = className;
60
+ $[2] = id;
61
+ $[3] = isOpen;
62
+ $[4] = isSettled;
63
+ $[5] = shouldReduceMotion;
64
+ $[6] = t2;
65
+ } else {
66
+ t2 = $[6];
67
+ }
68
+ let t3;
69
+ if ($[7] !== animateOnMount || $[8] !== t2) {
70
+ t3 = /* @__PURE__ */ _jsx(AnimatePresence, {
71
+ initial: animateOnMount,
72
+ children: t2
73
+ });
74
+ $[7] = animateOnMount;
75
+ $[8] = t2;
76
+ $[9] = t3;
77
+ } else {
78
+ t3 = $[9];
79
+ }
80
+ return t3;
81
+ }
@@ -0,0 +1,13 @@
1
+ export interface AnimatedCountProps {
2
+ value: number;
3
+ /** Optional formatter, for example a locale-aware number format. */
4
+ format?: (value: number) => string;
5
+ className?: string;
6
+ }
7
+ /**
8
+ * Renders `value` and animates each change: increments roll up, decrements roll down.
9
+ * With reduced motion the new value replaces the previous one without travel.
10
+ * @param props - Current value, optional formatter and class name.
11
+ * @returns The animated number.
12
+ */
13
+ export declare function AnimatedCount({ value, format, className }: AnimatedCountProps): import("react").JSX.Element;
@@ -0,0 +1,105 @@
1
+ "use client";
2
+ import { c as _c } from "react/compiler-runtime";
3
+ /** Rolls a numeric value vertically when it changes, in the direction of the change. */
4
+ import { useState } from "react";
5
+ import { AnimatePresence, motion } from "motion/react";
6
+ import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
7
+ import { cn } from "../lib/utils.js";
8
+ import { SPRING_POP } from "../motion/tokens.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ /** Fraction of the line height the digits travel while rolling. */
11
+ const COUNT_ROLL_DISTANCE = "60%";
12
+ const COUNT_ROLL_DISTANCE_INVERTED = "-60%";
13
+ const INCREMENT_DIRECTION = 1;
14
+ const DECREMENT_DIRECTION = -1;
15
+ const COUNT_ROLL_VARIANTS = {
16
+ enter: (direction) => ({
17
+ y: direction > 0 ? COUNT_ROLL_DISTANCE : COUNT_ROLL_DISTANCE_INVERTED,
18
+ opacity: 0
19
+ }),
20
+ center: {
21
+ y: 0,
22
+ opacity: 1
23
+ },
24
+ exit: (direction) => ({
25
+ y: direction > 0 ? COUNT_ROLL_DISTANCE_INVERTED : COUNT_ROLL_DISTANCE,
26
+ opacity: 0
27
+ })
28
+ };
29
+ /**
30
+ * Renders `value` and animates each change: increments roll up, decrements roll down.
31
+ * With reduced motion the new value replaces the previous one without travel.
32
+ * @param props - Current value, optional formatter and class name.
33
+ * @returns The animated number.
34
+ */
35
+ export function AnimatedCount(t0) {
36
+ const $ = _c(13);
37
+ const { value, format, className } = t0;
38
+ const [previousValue, setPreviousValue] = useState(value);
39
+ const [direction, setDirection] = useState(INCREMENT_DIRECTION);
40
+ const shouldReduceMotion = usePrefersReducedMotion();
41
+ if (previousValue !== value) {
42
+ setDirection(value > previousValue ? INCREMENT_DIRECTION : DECREMENT_DIRECTION);
43
+ setPreviousValue(value);
44
+ }
45
+ let t1;
46
+ if ($[0] !== format || $[1] !== value) {
47
+ t1 = format ? format(value) : value;
48
+ $[0] = format;
49
+ $[1] = value;
50
+ $[2] = t1;
51
+ } else {
52
+ t1 = $[2];
53
+ }
54
+ const formattedValue = t1;
55
+ let t2;
56
+ if ($[3] !== className) {
57
+ t2 = cn("relative inline-flex overflow-hidden align-bottom tabular-nums", className);
58
+ $[3] = className;
59
+ $[4] = t2;
60
+ } else {
61
+ t2 = $[4];
62
+ }
63
+ let t3;
64
+ if ($[5] !== direction || $[6] !== formattedValue || $[7] !== shouldReduceMotion || $[8] !== value) {
65
+ t3 = shouldReduceMotion ? /* @__PURE__ */ _jsx("span", {
66
+ className: "inline-block",
67
+ children: formattedValue
68
+ }) : /* @__PURE__ */ _jsx(AnimatePresence, {
69
+ initial: false,
70
+ mode: "popLayout",
71
+ custom: direction,
72
+ children: /* @__PURE__ */ _jsx(motion.span, {
73
+ className: "inline-block",
74
+ custom: direction,
75
+ variants: COUNT_ROLL_VARIANTS,
76
+ initial: "enter",
77
+ animate: "center",
78
+ exit: "exit",
79
+ transition: SPRING_POP,
80
+ children: formattedValue
81
+ }, value)
82
+ });
83
+ $[5] = direction;
84
+ $[6] = formattedValue;
85
+ $[7] = shouldReduceMotion;
86
+ $[8] = value;
87
+ $[9] = t3;
88
+ } else {
89
+ t3 = $[9];
90
+ }
91
+ let t4;
92
+ if ($[10] !== t2 || $[11] !== t3) {
93
+ t4 = /* @__PURE__ */ _jsx("span", {
94
+ "data-slot": "animated-count",
95
+ className: t2,
96
+ children: t3
97
+ });
98
+ $[10] = t2;
99
+ $[11] = t3;
100
+ $[12] = t4;
101
+ } else {
102
+ t4 = $[12];
103
+ }
104
+ return t4;
105
+ }
@@ -0,0 +1,25 @@
1
+ /** List item that enters, leaves and reflows smoothly inside an `AnimatePresence`. */
2
+ import type { HTMLAttributes, ReactNode } from "react";
3
+ declare const ANIMATED_LIST_ITEM_ELEMENTS: {
4
+ readonly li: import("motion/react").ForwardRefComponent<HTMLLIElement, import("motion/react").HTMLMotionProps<"li">>;
5
+ readonly div: import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>;
6
+ readonly article: import("motion/react").ForwardRefComponent<HTMLElement, import("motion/react").HTMLMotionProps<"article">>;
7
+ };
8
+ /** Native handlers whose names collide with Motion's animation and drag callbacks. */
9
+ type MotionConflictingHandlers = "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "onDrag" | "onDragStart" | "onDragEnd";
10
+ export type AnimatedListItemProps = Omit<HTMLAttributes<HTMLElement>, MotionConflictingHandlers> & {
11
+ children: ReactNode;
12
+ as?: keyof typeof ANIMATED_LIST_ITEM_ELEMENTS;
13
+ /** Reflow siblings with a spring when items are added, removed or reordered. */
14
+ layout?: boolean;
15
+ };
16
+ /**
17
+ * Wrap the list in `<AnimatePresence initial={false}>` so only items added after the
18
+ * first render animate in, and removed items animate out before leaving the DOM.
19
+ * A leaving item turns inert and hidden from assistive technology, so it can no
20
+ * longer be focused, clicked or announced during its exit.
21
+ * @param props - Native attributes, element type and content.
22
+ * @returns The animated item.
23
+ */
24
+ export declare function AnimatedListItem({ children, as, layout, className, ...elementProps }: AnimatedListItemProps): import("react").JSX.Element;
25
+ export {};