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