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
@@ -1,506 +1,80 @@
1
1
  "use client";
2
2
  import { c as _c } from "react/compiler-runtime";
3
- /**
4
- * Arc's Hover Card (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a read-only preview of a person or
5
- * link that opens after half a second of hover or on keyboard focus, grows from the trigger edge on a smooth spring
6
- * and closes fast on leave. While a card is open, and briefly after it closes, moving to another trigger opens its
7
- * card almost at once and only fades. It keeps the Radix composition and adds Arc's `HoverCardProfile` preset.
8
- */
9
- import * as React from "react";
10
- import { HoverCard as HoverCardPrimitive } from "radix-ui";
11
- import { motion } from "motion/react";
12
- import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
13
- import { ArcFloatingSlot } from "../motion/arc-floating-slot.js";
14
- import { ARC_DURATION, ARC_EASE } from "../motion/arc-tokens.js";
15
- import { createOverlayWarmth, useOpenedWhileWarm } from "../motion/overlay-warmth.js";
16
- import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../motion/presence.js";
17
3
  import { cn } from "../lib/utils.js";
18
- import { HOVER_CARD_CLOSE_DELAY_MS, HOVER_CARD_COLLISION_PADDING_PX, HOVER_CARD_INSTANT_MOTION, HOVER_CARD_MOTION, HOVER_CARD_OPEN_DELAY_MS, HOVER_CARD_PROFILE_INITIALS_LENGTH, HOVER_CARD_PROFILE_PORTRAIT_SIZE_PX, HOVER_CARD_PROFILE_ROW_ORDER, HOVER_CARD_PROFILE_SETTLE_DELAY_S, HOVER_CARD_PROFILE_SETTLE_DISTANCE_PX, HOVER_CARD_PROFILE_STAGGER_S, HOVER_CARD_SIDE_OFFSET_PX, HOVER_CARD_SKIP_WINDOW_MS, HOVER_CARD_WARM_OPEN_DELAY_MS } from "../constants/hover-card.js";
4
+ import { HoverCard as HoverCardRoot, HoverCardContent, HoverCardProfile, HoverCardTrigger } from "./primitives/hover-card.js";
19
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
- /** Every hover card on the page shares one skip window. */
21
- const hoverCardWarmth = createOverlayWarmth(HOVER_CARD_SKIP_WINDOW_MS);
22
- /** Whether the page was already warm when the surrounding layer opened, so its entrance only fades. */
23
- const HoverCardOpenedWhileWarmContext = React.createContext(false);
24
6
  /**
25
- * Owns the open state and timing of one hover card.
26
- * @param props - Radix root properties. `openDelay` defaults to Arc's 500ms and `closeDelay` to 140ms; within the
27
- * skip window the card waits at most 80ms.
28
- * @returns The hover card root.
7
+ * A read-only preview that opens after a short hover or keyboard focus and stays open while the pointer travels into
8
+ * it.
9
+ * @param props - The trigger, the preview and optional timing, placement and open state.
10
+ * @returns The trigger with its hover card.
29
11
  */
30
12
  function HoverCard(t0) {
31
- const $ = _c(19);
32
- let props;
33
- let t1;
34
- let t2;
35
- if ($[0] !== t0) {
36
- ({openDelay: t1, closeDelay: t2, ...props} = t0);
37
- $[0] = t0;
38
- $[1] = props;
39
- $[2] = t1;
40
- $[3] = t2;
41
- } else {
42
- props = $[1];
43
- t1 = $[2];
44
- t2 = $[3];
45
- }
46
- const openDelay = t1 === undefined ? HOVER_CARD_OPEN_DELAY_MS : t1;
47
- const closeDelay = t2 === undefined ? HOVER_CARD_CLOSE_DELAY_MS : t2;
48
- const [motionOpen, setMotionOpen] = useMotionOpenState(props);
49
- const isWarm = React.useSyncExternalStore(hoverCardWarmth.subscribe, hoverCardWarmth.isWarm, hoverCardWarmth.isWarmOnServer);
50
- const openedWhileWarm = useOpenedWhileWarm(motionOpen, isWarm);
13
+ const $ = _c(20);
14
+ const { children, content, side: t1, align: t2, openDelay, closeDelay, className, contentClassName, sideOffset, collisionPadding, open, defaultOpen, onOpenChange } = t0;
15
+ const side = t1 === undefined ? "bottom" : t1;
16
+ const align = t2 === undefined ? "start" : t2;
51
17
  let t3;
52
- let t4;
53
- if ($[4] !== motionOpen) {
54
- t3 = () => {
55
- if (!motionOpen) {
56
- return;
57
- }
58
- return hoverCardWarmth.open();
59
- };
60
- t4 = [motionOpen];
61
- $[4] = motionOpen;
62
- $[5] = t3;
63
- $[6] = t4;
64
- } else {
65
- t3 = $[5];
66
- t4 = $[6];
67
- }
68
- React.useEffect(t3, t4);
69
- const t5 = isWarm ? Math.min(openDelay, HOVER_CARD_WARM_OPEN_DELAY_MS) : openDelay;
70
- let t6;
71
- if ($[7] !== closeDelay || $[8] !== motionOpen || $[9] !== props || $[10] !== setMotionOpen || $[11] !== t5) {
72
- t6 = /* @__PURE__ */ _jsx(HoverCardPrimitive.Root, {
73
- "data-slot": "hover-card",
74
- ...props,
75
- openDelay: t5,
76
- closeDelay,
77
- open: motionOpen,
78
- onOpenChange: setMotionOpen
79
- });
80
- $[7] = closeDelay;
81
- $[8] = motionOpen;
82
- $[9] = props;
83
- $[10] = setMotionOpen;
84
- $[11] = t5;
85
- $[12] = t6;
86
- } else {
87
- t6 = $[12];
88
- }
89
- let t7;
90
- if ($[13] !== openedWhileWarm || $[14] !== t6) {
91
- t7 = /* @__PURE__ */ _jsx(HoverCardOpenedWhileWarmContext.Provider, {
92
- value: openedWhileWarm,
93
- children: t6
18
+ if ($[0] !== children) {
19
+ t3 = /* @__PURE__ */ _jsx(HoverCardTrigger, {
20
+ asChild: true,
21
+ children
94
22
  });
95
- $[13] = openedWhileWarm;
96
- $[14] = t6;
97
- $[15] = t7;
23
+ $[0] = children;
24
+ $[1] = t3;
98
25
  } else {
99
- t7 = $[15];
26
+ t3 = $[1];
100
27
  }
101
- let t8;
102
- if ($[16] !== motionOpen || $[17] !== t7) {
103
- t8 = /* @__PURE__ */ _jsx(MotionOpenProvider, {
104
- scope: "hover-card",
105
- open: motionOpen,
106
- children: t7
107
- });
108
- $[16] = motionOpen;
109
- $[17] = t7;
110
- $[18] = t8;
111
- } else {
112
- t8 = $[18];
113
- }
114
- return t8;
115
- }
116
- function HoverCardTrigger(t0) {
117
- const $ = _c(4);
118
- let props;
119
- if ($[0] !== t0) {
120
- ({...props} = t0);
121
- $[0] = t0;
122
- $[1] = props;
123
- } else {
124
- props = $[1];
125
- }
126
- let t1;
127
- if ($[2] !== props) {
128
- t1 = /* @__PURE__ */ _jsx(HoverCardPrimitive.Trigger, {
129
- "data-slot": "hover-card-trigger",
130
- ...props
131
- });
132
- $[2] = props;
133
- $[3] = t1;
134
- } else {
135
- t1 = $[3];
136
- }
137
- return t1;
138
- }
139
- /**
140
- * Renders Arc's card: raised surface, hairline border, panel radius and floating shadow, 18.5rem wide at most.
141
- * @param props - Radix content properties. `align` defaults to `center`, `sideOffset` to 8px and `collisionPadding`
142
- * to 12px.
143
- * @returns The portaled card.
144
- */
145
- function HoverCardContent(t0) {
146
- const $ = _c(22);
147
- let className;
148
- let props;
149
- let t1;
150
- let t2;
151
- let t3;
152
- if ($[0] !== t0) {
153
- ({className, align: t1, sideOffset: t2, collisionPadding: t3, ...props} = t0);
154
- $[0] = t0;
155
- $[1] = className;
156
- $[2] = props;
157
- $[3] = t1;
158
- $[4] = t2;
159
- $[5] = t3;
28
+ let t4;
29
+ if ($[2] !== className || $[3] !== contentClassName) {
30
+ t4 = cn(className, contentClassName);
31
+ $[2] = className;
32
+ $[3] = contentClassName;
33
+ $[4] = t4;
160
34
  } else {
161
- className = $[1];
162
- props = $[2];
163
- t1 = $[3];
164
- t2 = $[4];
165
- t3 = $[5];
35
+ t4 = $[4];
166
36
  }
167
- const align = t1 === undefined ? "center" : t1;
168
- const sideOffset = t2 === undefined ? HOVER_CARD_SIDE_OFFSET_PX : t2;
169
- const collisionPadding = t3 === undefined ? HOVER_CARD_COLLISION_PADDING_PX : t3;
170
- const openedWhileWarm = React.useContext(HoverCardOpenedWhileWarmContext);
171
- const t4 = props.forceMount;
172
37
  let t5;
173
- if ($[6] !== openedWhileWarm) {
174
- t5 = () => openedWhileWarm ? HOVER_CARD_INSTANT_MOTION : HOVER_CARD_MOTION;
175
- $[6] = openedWhileWarm;
176
- $[7] = t5;
177
- } else {
178
- t5 = $[7];
179
- }
180
- let t6;
181
- if ($[8] !== className) {
182
- t6 = cn("z-50 box-border w-74 max-w-[min(18.5rem,var(--radix-hover-card-content-available-width,calc(100vw-24px)))] origin-(--radix-hover-card-content-transform-origin) rounded-(--radius-panel) border border-border bg-surface-raised p-(--space-4) font-sans text-sm leading-(--leading-body) tracking-(--tracking-body) text-foreground shadow-(--shadow-floating) outline-hidden", className);
183
- $[8] = className;
184
- $[9] = t6;
185
- } else {
186
- t6 = $[9];
187
- }
188
- let t7;
189
- if ($[10] !== align || $[11] !== collisionPadding || $[12] !== props || $[13] !== sideOffset || $[14] !== t6) {
190
- t7 = /* @__PURE__ */ _jsx(HoverCardPrimitive.Content, {
191
- forceMount: true,
192
- "data-slot": "hover-card-content",
38
+ if ($[5] !== align || $[6] !== collisionPadding || $[7] !== content || $[8] !== side || $[9] !== sideOffset || $[10] !== t4) {
39
+ t5 = /* @__PURE__ */ _jsx(HoverCardContent, {
40
+ side,
193
41
  align,
194
42
  sideOffset,
195
43
  collisionPadding,
196
- className: t6,
197
- ...props
198
- });
199
- $[10] = align;
200
- $[11] = collisionPadding;
201
- $[12] = props;
202
- $[13] = sideOffset;
203
- $[14] = t6;
204
- $[15] = t7;
205
- } else {
206
- t7 = $[15];
207
- }
208
- let t8;
209
- if ($[16] !== t5 || $[17] !== t7) {
210
- t8 = /* @__PURE__ */ _jsx(ArcFloatingSlot, {
211
- motion: t5,
212
- children: t7
213
- });
214
- $[16] = t5;
215
- $[17] = t7;
216
- $[18] = t8;
217
- } else {
218
- t8 = $[18];
219
- }
220
- let t9;
221
- if ($[19] !== props.forceMount || $[20] !== t8) {
222
- t9 = /* @__PURE__ */ _jsx(HoverCardPrimitive.Portal, {
223
- "data-slot": "hover-card-portal",
224
- forceMount: true,
225
- children: /* @__PURE__ */ _jsx(MotionPresence, {
226
- scope: "hover-card",
227
- forceMount: t4,
228
- children: t8
229
- })
230
- });
231
- $[19] = props.forceMount;
232
- $[20] = t8;
233
- $[21] = t9;
234
- } else {
235
- t9 = $[21];
236
- }
237
- return t9;
238
- }
239
- /**
240
- * Shows a portrait that fades in from a soft blur while it downloads, and at once when it is cached.
241
- * @param props.source - Portrait URL.
242
- * @returns The decorative portrait image.
243
- */
244
- function HoverCardPortrait(t0) {
245
- const $ = _c(7);
246
- const { source } = t0;
247
- const [isLoading, setIsLoading] = React.useState(false);
248
- const imageRef = React.useRef(null);
249
- let t1;
250
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
251
- t1 = () => {
252
- const image = imageRef.current;
253
- setIsLoading(Boolean(image && !image.complete));
254
- };
255
- $[0] = t1;
256
- } else {
257
- t1 = $[0];
258
- }
259
- let t2;
260
- if ($[1] !== source) {
261
- t2 = [source];
262
- $[1] = source;
263
- $[2] = t2;
264
- } else {
265
- t2 = $[2];
266
- }
267
- React.useLayoutEffect(t1, t2);
268
- const t3 = isLoading || undefined;
269
- let t4;
270
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
271
- t4 = () => setIsLoading(false);
272
- $[3] = t4;
273
- } else {
274
- t4 = $[3];
275
- }
276
- let t5;
277
- if ($[4] !== source || $[5] !== t3) {
278
- t5 = /* @__PURE__ */ _jsx("img", {
279
- ref: imageRef,
280
- src: source,
281
- alt: "",
282
- width: HOVER_CARD_PROFILE_PORTRAIT_SIZE_PX,
283
- height: HOVER_CARD_PROFILE_PORTRAIT_SIZE_PX,
284
- decoding: "async",
285
- "data-loading": t3,
286
- onLoad: t4,
287
- className: "block size-full object-cover transition-[opacity,filter] duration-(--duration-standard) ease-(--ease-enter) data-loading:opacity-0 data-loading:blur-xs data-loading:transition-none motion-reduce:transition-none motion-reduce:data-loading:blur-none"
44
+ className: t4,
45
+ children: content
288
46
  });
289
- $[4] = source;
290
- $[5] = t3;
291
- $[6] = t5;
292
- } else {
293
- t5 = $[6];
294
- }
295
- return t5;
296
- }
297
- /**
298
- * Builds the initials shown when the profile has no portrait.
299
- * @param name - The person's name.
300
- * @returns Up to two uppercase initials.
301
- */
302
- function initialsOf(name) {
303
- return name.trim().split(/\s+/).slice(0, HOVER_CARD_PROFILE_INITIALS_LENGTH).map((word) => word[0]?.toUpperCase() ?? "").join("");
304
- }
305
- /**
306
- * Arc's person preview: portrait, name, role, a short bio, a couple of numbers and a quiet footer line. Its rows
307
- * settle in with a tiny stagger, and stay still when the user prefers reduced motion.
308
- * @param props - The person's details.
309
- * @returns The profile, meant as the child of `HoverCardContent`.
310
- */
311
- function HoverCardProfile(t0) {
312
- const $ = _c(39);
313
- const { name, role, avatar, bio, stats: t1, meta, className } = t0;
314
- let t2;
315
- if ($[0] !== t1) {
316
- t2 = t1 === undefined ? [] : t1;
317
- $[0] = t1;
318
- $[1] = t2;
319
- } else {
320
- t2 = $[1];
321
- }
322
- const stats = t2;
323
- const reduceMotion = usePrefersReducedMotion();
324
- let t3;
325
- if ($[2] !== reduceMotion) {
326
- t3 = (order) => reduceMotion ? {} : {
327
- initial: {
328
- opacity: 0,
329
- y: HOVER_CARD_PROFILE_SETTLE_DISTANCE_PX
330
- },
331
- animate: {
332
- opacity: 1,
333
- y: 0
334
- },
335
- transition: {
336
- duration: ARC_DURATION.standard,
337
- ease: [...ARC_EASE.enter],
338
- delay: HOVER_CARD_PROFILE_SETTLE_DELAY_S + order * HOVER_CARD_PROFILE_STAGGER_S
339
- }
340
- };
341
- $[2] = reduceMotion;
342
- $[3] = t3;
343
- } else {
344
- t3 = $[3];
345
- }
346
- const settle = t3;
347
- let t4;
348
- if ($[4] !== className) {
349
- t4 = cn("grid gap-(--space-3)", className);
350
- $[4] = className;
351
- $[5] = t4;
352
- } else {
353
- t4 = $[5];
354
- }
355
- let t5;
356
- if ($[6] !== settle) {
357
- t5 = settle(HOVER_CARD_PROFILE_ROW_ORDER.head);
358
- $[6] = settle;
359
- $[7] = t5;
47
+ $[5] = align;
48
+ $[6] = collisionPadding;
49
+ $[7] = content;
50
+ $[8] = side;
51
+ $[9] = sideOffset;
52
+ $[10] = t4;
53
+ $[11] = t5;
360
54
  } else {
361
- t5 = $[7];
55
+ t5 = $[11];
362
56
  }
363
57
  let t6;
364
- if ($[8] !== avatar || $[9] !== name) {
365
- t6 = typeof avatar === "string" ? /* @__PURE__ */ _jsx(HoverCardPortrait, { source: avatar }) : avatar ?? initialsOf(name);
366
- $[8] = avatar;
367
- $[9] = name;
368
- $[10] = t6;
369
- } else {
370
- t6 = $[10];
371
- }
372
- let t7;
373
- if ($[11] !== t6) {
374
- t7 = /* @__PURE__ */ _jsx("span", {
375
- "aria-hidden": "true",
376
- className: "relative grid size-12 flex-none place-items-center overflow-hidden rounded-full border border-border bg-surface-muted text-sm font-medium text-foreground",
377
- children: t6
378
- });
379
- $[11] = t6;
380
- $[12] = t7;
381
- } else {
382
- t7 = $[12];
383
- }
384
- let t8;
385
- if ($[13] !== name) {
386
- t8 = /* @__PURE__ */ _jsx("span", {
387
- className: "truncate text-base leading-(--leading-body) font-medium text-foreground",
388
- children: name
389
- });
390
- $[13] = name;
391
- $[14] = t8;
392
- } else {
393
- t8 = $[14];
394
- }
395
- let t9;
396
- if ($[15] !== role) {
397
- t9 = role ? /* @__PURE__ */ _jsx("span", {
398
- className: "truncate text-sm leading-(--leading-body) text-text-secondary",
399
- children: role
400
- }) : null;
401
- $[15] = role;
402
- $[16] = t9;
403
- } else {
404
- t9 = $[16];
405
- }
406
- let t10;
407
- if ($[17] !== t8 || $[18] !== t9) {
408
- t10 = /* @__PURE__ */ _jsxs("span", {
409
- className: "grid min-w-0",
410
- children: [t8, t9]
411
- });
412
- $[17] = t8;
413
- $[18] = t9;
414
- $[19] = t10;
415
- } else {
416
- t10 = $[19];
417
- }
418
- let t11;
419
- if ($[20] !== t10 || $[21] !== t5 || $[22] !== t7) {
420
- t11 = /* @__PURE__ */ _jsxs(motion.div, {
421
- className: "flex min-w-0 items-center gap-(--space-3)",
422
- ...t5,
423
- children: [t7, t10]
424
- });
425
- $[20] = t10;
426
- $[21] = t5;
427
- $[22] = t7;
428
- $[23] = t11;
429
- } else {
430
- t11 = $[23];
431
- }
432
- let t12;
433
- if ($[24] !== bio || $[25] !== settle) {
434
- t12 = bio ? /* @__PURE__ */ _jsx(motion.p, {
435
- className: "m-0 text-sm leading-(--leading-body) text-text-secondary",
436
- ...settle(HOVER_CARD_PROFILE_ROW_ORDER.bio),
437
- children: bio
438
- }) : null;
439
- $[24] = bio;
440
- $[25] = settle;
441
- $[26] = t12;
442
- } else {
443
- t12 = $[26];
444
- }
445
- let t13;
446
- if ($[27] !== settle || $[28] !== stats) {
447
- t13 = stats.length > 0 ? /* @__PURE__ */ _jsx(motion.dl, {
448
- className: "m-0 flex flex-wrap gap-x-(--space-6) gap-y-(--space-2) border-t border-border-subtle pt-(--space-3)",
449
- ...settle(HOVER_CARD_PROFILE_ROW_ORDER.stats),
450
- children: stats.map(_temp)
451
- }) : null;
452
- $[27] = settle;
453
- $[28] = stats;
454
- $[29] = t13;
455
- } else {
456
- t13 = $[29];
457
- }
458
- let t14;
459
- if ($[30] !== meta || $[31] !== settle) {
460
- t14 = meta ? /* @__PURE__ */ _jsx(motion.div, {
461
- className: "flex items-center gap-1.5 text-xs leading-(--leading-body) text-text-muted [&_svg]:flex-none",
462
- ...settle(HOVER_CARD_PROFILE_ROW_ORDER.meta),
463
- children: meta
464
- }) : null;
465
- $[30] = meta;
466
- $[31] = settle;
467
- $[32] = t14;
468
- } else {
469
- t14 = $[32];
470
- }
471
- let t15;
472
- if ($[33] !== t11 || $[34] !== t12 || $[35] !== t13 || $[36] !== t14 || $[37] !== t4) {
473
- t15 = /* @__PURE__ */ _jsxs("div", {
474
- "data-slot": "hover-card-profile",
475
- className: t4,
476
- children: [
477
- t11,
478
- t12,
479
- t13,
480
- t14
481
- ]
58
+ if ($[12] !== closeDelay || $[13] !== defaultOpen || $[14] !== onOpenChange || $[15] !== open || $[16] !== openDelay || $[17] !== t3 || $[18] !== t5) {
59
+ t6 = /* @__PURE__ */ _jsxs(HoverCardRoot, {
60
+ openDelay,
61
+ closeDelay,
62
+ open,
63
+ defaultOpen,
64
+ onOpenChange,
65
+ children: [t3, t5]
482
66
  });
483
- $[33] = t11;
484
- $[34] = t12;
485
- $[35] = t13;
486
- $[36] = t14;
487
- $[37] = t4;
488
- $[38] = t15;
489
- } else {
490
- t15 = $[38];
491
- }
492
- return t15;
493
- }
494
- function _temp(stat) {
495
- return /* @__PURE__ */ _jsxs("div", {
496
- className: "flex flex-col-reverse",
497
- children: [/* @__PURE__ */ _jsx("dt", {
498
- className: "text-xs leading-(--leading-body) text-text-muted",
499
- children: stat.label
500
- }), /* @__PURE__ */ _jsx("dd", {
501
- className: "m-0 text-base leading-(--leading-body) font-medium text-foreground tabular-nums",
502
- children: stat.value
503
- })]
504
- }, stat.label);
67
+ $[12] = closeDelay;
68
+ $[13] = defaultOpen;
69
+ $[14] = onOpenChange;
70
+ $[15] = open;
71
+ $[16] = openDelay;
72
+ $[17] = t3;
73
+ $[18] = t5;
74
+ $[19] = t6;
75
+ } else {
76
+ t6 = $[19];
77
+ }
78
+ return t6;
505
79
  }
506
- export { HoverCard, HoverCardTrigger, HoverCardContent, HoverCardProfile };
80
+ export { HoverCard, HoverCardProfile };
@@ -1,37 +1,59 @@
1
1
  /**
2
- * Arc's Pagination (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): compact page controls on Arc's
3
- * tokens with tabular numbers, a current-page mark that glides to the newly selected page with Arc's morph spring,
4
- * hover only on fine pointers and arrows that press in. Unlike Arc's stateful component it stays composable: every
5
- * page is a link rendered through the provider's `Link` adapter (Next.js, TanStack Router or a native anchor).
2
+ * Arc's Pagination (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): previous and next arrows around a
3
+ * sliding five page window, with a current-page mark that glides to the selected page. Arc's API (`page`,
4
+ * `pageCount`, `onPageChange`, `label`), with beez-ui's extensions: links through the provider's `Link` adapter
5
+ * (`getHref`), cursor paging without a page count (`hasNextPage`), arrow labels and Spanish copy.
6
6
  */
7
- import type { ComponentProps } from "react";
8
- import type { ControlButton } from "./control-button.js";
9
- import { type LinkProps } from "./link.js";
7
+ import type { MouseEvent } from "react";
10
8
  /**
11
- * Landmark that holds the page controls.
12
- * @param props - Native `nav` attributes; `aria-label` defaults to Spanish copy.
13
- * @returns The navigation landmark.
9
+ * Click that requested a page, from a page link or button or an arrow. Call `event.preventDefault()` on a link to keep
10
+ * the provider's `Link` from navigating, for example to page in place on plain clicks while modified clicks still
11
+ * open the address in a new tab.
14
12
  */
15
- declare function Pagination({ className, ...props }: ComponentProps<"nav">): import("react").JSX.Element;
16
- /** Lists page links; the current page's mark glides to the newly selected page. */
17
- declare function PaginationContent({ className, ...props }: ComponentProps<"ul">): import("react").JSX.Element;
18
- declare function PaginationItem({ ...props }: ComponentProps<"li">): import("react").JSX.Element;
19
- export type PaginationLinkProps = {
20
- isActive?: boolean;
21
- } & Pick<ComponentProps<typeof ControlButton>, "size"> & LinkProps;
13
+ export type PaginationClickEvent = MouseEvent<HTMLAnchorElement | HTMLButtonElement>;
14
+ /** Called with the requested page and the click that requested it. */
15
+ export type PaginationPageChangeHandler = (page: number, event: PaginationClickEvent) => void;
16
+ /** Props shared by every way of paging. */
17
+ type PaginationBaseProps = {
18
+ /** Current page, 1-based. Clamped to the range. */
19
+ page: number;
20
+ /**
21
+ * Total pages. Zero renders an empty landmark. Leave it out for cursor paging: only the arrows render, and
22
+ * `hasNextPage` decides whether the next one is enabled.
23
+ */
24
+ pageCount?: number;
25
+ /** Whether a page follows the current one, for cursor paging without `pageCount`. Ignored with `pageCount`. */
26
+ hasNextPage?: boolean;
27
+ /** Accessible name of the navigation landmark. Defaults to "Paginación". */
28
+ label?: string;
29
+ /** Visible label of the previous arrow, hidden on small screens. Defaults to "Anterior". */
30
+ previousLabel?: string;
31
+ /** Visible label of the next arrow, hidden on small screens. Defaults to "Siguiente". */
32
+ nextLabel?: string;
33
+ /** Classes of the navigation landmark. */
34
+ className?: string;
35
+ };
36
+ /** Props of `Pagination`: buttons that report the page, or links built with `getHref`. */
37
+ export type PaginationProps = PaginationBaseProps & ({
38
+ /** Called with the requested page and the click event. */
39
+ onPageChange: PaginationPageChangeHandler;
40
+ getHref?: undefined;
41
+ } | {
42
+ /**
43
+ * Called with the requested page and the click event when a link is clicked, before it navigates. Calling
44
+ * `event.preventDefault()` cancels the navigation of that link.
45
+ */
46
+ onPageChange?: PaginationPageChangeHandler;
47
+ /**
48
+ * Builds the address of a page. Every control becomes a link rendered through the provider's `Link` adapter,
49
+ * so pages live in the URL and render on the server.
50
+ */
51
+ getHref: (page: number) => string;
52
+ });
22
53
  /**
23
- * One page, rendered through the provider's `Link` adapter or the `component` passed to it.
24
- * @param props - `isActive` marks the current page (`aria-current="page"`); `size` keeps the previous size names
25
- * and only changes the horizontal padding; every other prop reaches the link. With `aria-disabled` the link
26
- * stays visible but never navigates, whether clicked or activated with Enter, and `onClick` is not called.
27
- * @returns The page link.
54
+ * Previous and next arrows around a five page window. Disabled arrows keep `aria-disabled` and never request a page.
55
+ * @param props - Current page, page count or next-page flag, handlers and copy.
56
+ * @returns The navigation landmark.
28
57
  */
29
- declare function PaginationLink({ className, isActive, size, onClick, ...props }: PaginationLinkProps): import("react").JSX.Element;
30
- /** Previous and next links accept an optional visible label, hidden on small screens. */
31
- type PaginationStepProps = PaginationLinkProps & {
32
- text?: string;
33
- };
34
- declare function PaginationPrevious({ className, text, ...props }: PaginationStepProps): import("react").JSX.Element;
35
- declare function PaginationNext({ className, text, ...props }: PaginationStepProps): import("react").JSX.Element;
36
- declare function PaginationEllipsis({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
37
- export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
58
+ declare function Pagination({ page, pageCount, hasNextPage, onPageChange, getHref, label, previousLabel, nextLabel, className, }: PaginationProps): import("react").JSX.Element;
59
+ export { Pagination };