beez-ui 2.5.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/components/alert-dialog.d.ts +15 -4
- package/dist/components/alert-dialog.js +84 -44
- package/dist/components/alert.d.ts +30 -9
- package/dist/components/alert.js +360 -39
- package/dist/components/avatar.d.ts +33 -10
- package/dist/components/avatar.js +110 -30
- package/dist/components/badge.d.ts +39 -7
- package/dist/components/badge.js +348 -24
- package/dist/components/calendar.d.ts +29 -2
- package/dist/components/calendar.js +1035 -223
- package/dist/components/card.d.ts +17 -1
- package/dist/components/card.js +34 -8
- package/dist/components/carousel.d.ts +29 -2
- package/dist/components/carousel.js +471 -90
- package/dist/components/checkbox.d.ts +13 -2
- package/dist/components/checkbox.js +301 -41
- package/dist/components/dialog-surface.d.ts +27 -0
- package/dist/components/dialog-surface.js +137 -0
- package/dist/components/dialog.d.ts +21 -4
- package/dist/components/dialog.js +163 -96
- package/dist/components/dropdown-menu.d.ts +30 -16
- package/dist/components/dropdown-menu.js +139 -83
- package/dist/components/hover-card.d.ts +46 -3
- package/dist/components/hover-card.js +423 -60
- package/dist/components/pagination.d.ts +32 -14
- package/dist/components/pagination.js +136 -59
- package/dist/components/popover.d.ts +14 -5
- package/dist/components/popover.js +78 -36
- package/dist/components/radio-group.d.ts +19 -3
- package/dist/components/radio-group.js +400 -57
- package/dist/components/select.d.ts +17 -6
- package/dist/components/select.js +83 -71
- package/dist/components/sheet.js +37 -26
- package/dist/components/sidebar.js +11 -0
- package/dist/components/skeleton.d.ts +19 -5
- package/dist/components/skeleton.js +434 -14
- package/dist/components/switch.d.ts +14 -4
- package/dist/components/switch.js +424 -40
- package/dist/components/tabs.d.ts +38 -5
- package/dist/components/tabs.js +564 -97
- package/dist/components/themed-toaster.d.ts +6 -2
- package/dist/components/themed-toaster.js +80 -50
- package/dist/components/tooltip.d.ts +33 -2
- package/dist/components/tooltip.js +197 -69
- package/dist/constants/alert.d.ts +12 -0
- package/dist/constants/alert.js +9 -0
- package/dist/constants/avatar.d.ts +10 -0
- package/dist/constants/avatar.js +7 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/calendar.d.ts +24 -0
- package/dist/constants/calendar.js +22 -0
- package/dist/constants/carousel.d.ts +37 -0
- package/dist/constants/carousel.js +53 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +6 -0
- package/dist/constants/dialog.js +6 -0
- package/dist/constants/dropdown-menu.d.ts +5 -0
- package/dist/constants/dropdown-menu.js +5 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/pagination.d.ts +9 -0
- package/dist/constants/pagination.js +9 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +39 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +3 -0
- package/dist/constants/select.js +3 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/switch.d.ts +44 -0
- package/dist/constants/switch.js +49 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +167 -0
- package/dist/motion/glide-indicator.d.ts +6 -7
- package/dist/motion/glide-indicator.js +5 -3
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/components/alert.js
CHANGED
|
@@ -1,60 +1,381 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Arc's Alert (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a persistent message that helps people
|
|
5
|
+
* recover or continue, on Arc's surface with a resting shadow. A `tone` tints and picks its icon, which morphs in
|
|
6
|
+
* place when the tone changes; `onDismiss` adds a dismiss button and `open` collapses the alert's height while it
|
|
7
|
+
* fades, so the content below closes the gap. The compound title, description and action parts are kept.
|
|
8
|
+
*/
|
|
9
|
+
import { useRef, useState } from "react";
|
|
4
10
|
import { cva } from "class-variance-authority";
|
|
5
|
-
import {
|
|
11
|
+
import { AnimatePresence, motion, useIsPresent } from "motion/react";
|
|
12
|
+
import { Check, CircleX, Info, TriangleAlert, X } from "lucide-react";
|
|
13
|
+
import { ALERT_DISMISS_LABEL, ALERT_TONE_ROLE } from "../constants/alert.js";
|
|
14
|
+
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
6
15
|
import { cn } from "../lib/utils.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
import { ARC_DURATION, ARC_EASE, ARC_SPRING_SMOOTH } from "../motion/arc-tokens.js";
|
|
17
|
+
import { ARC_ICON_ENTER, ARC_ICON_EXIT, ARC_ICON_TRANSITION, ARC_REDUCED_EXIT, ARC_REDUCED_TRANSITION, ARC_SWAP_EXIT_TRANSITION, ARC_SWAP_REST } from "../motion/arc-swap.js";
|
|
18
|
+
import { MotionSlot } from "../motion/motion-slot.js";
|
|
19
|
+
import { useAttachedElement } from "../motion/use-attached-element.js";
|
|
20
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
/** The icon each tone shows unless `icon` replaces it. */
|
|
22
|
+
const TONE_ICON = {
|
|
23
|
+
info: Info,
|
|
24
|
+
success: Check,
|
|
25
|
+
warning: TriangleAlert,
|
|
26
|
+
danger: CircleX
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Arc's alert recipe. The icon column (a direct svg or the tone icon) spans the title and description rows, and
|
|
30
|
+
* `--alert-color` tints it by tone.
|
|
31
|
+
*/
|
|
32
|
+
const alertVariants = cva("group/alert relative grid w-full items-start gap-x-(--space-3) gap-y-(--space-1) rounded-(--radius-control) border border-border bg-surface p-(--space-4) text-left text-sm text-foreground shadow-(--shadow-resting) [--alert-color:currentColor] has-[>svg]:grid-cols-[auto_1fr] has-data-[slot=alert-icon]:grid-cols-[auto_1fr] has-data-[slot=alert-action]:pr-18 has-data-[slot=alert-dismiss]:pr-12 has-data-[slot=alert-action]:has-data-[slot=alert-dismiss]:pr-36 *:[svg]:row-span-2 *:[svg]:mt-px *:[svg]:text-(--alert-color) *:[svg:not([class*='size-'])]:size-[18px]", {
|
|
33
|
+
variants: {
|
|
34
|
+
variant: {
|
|
35
|
+
default: "",
|
|
36
|
+
destructive: "[--alert-color:var(--danger)] *:data-[slot=alert-title]:text-danger"
|
|
37
|
+
},
|
|
38
|
+
tone: {
|
|
39
|
+
info: "[--alert-color:var(--accent)]",
|
|
40
|
+
success: "[--alert-color:var(--success)]",
|
|
41
|
+
warning: "[--alert-color:var(--warning)]",
|
|
42
|
+
danger: "[--alert-color:var(--danger)]"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
13
45
|
defaultVariants: { variant: "default" }
|
|
14
46
|
});
|
|
15
|
-
|
|
16
|
-
|
|
47
|
+
const reducedEnter = { opacity: 0 };
|
|
48
|
+
const presenceTransition = {
|
|
49
|
+
height: ARC_SPRING_SMOOTH,
|
|
50
|
+
opacity: {
|
|
51
|
+
duration: ARC_DURATION.standard,
|
|
52
|
+
ease: [...ARC_EASE.enter]
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/** The alert itself collapses, so its padding, border and margins close along with the height. */
|
|
56
|
+
const collapsedBox = {
|
|
57
|
+
height: 0,
|
|
58
|
+
paddingTop: 0,
|
|
59
|
+
paddingBottom: 0,
|
|
60
|
+
borderTopWidth: 0,
|
|
61
|
+
borderBottomWidth: 0,
|
|
62
|
+
marginTop: 0,
|
|
63
|
+
marginBottom: 0
|
|
64
|
+
};
|
|
65
|
+
const presenceExit = {
|
|
66
|
+
...collapsedBox,
|
|
67
|
+
opacity: 0,
|
|
68
|
+
transition: {
|
|
69
|
+
default: ARC_SPRING_SMOOTH,
|
|
70
|
+
opacity: ARC_SWAP_EXIT_TRANSITION
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const reducedPresenceExit = {
|
|
74
|
+
...collapsedBox,
|
|
75
|
+
opacity: 0,
|
|
76
|
+
transition: { duration: 0 }
|
|
77
|
+
};
|
|
78
|
+
/** Entrance target; once it settles, the alert hands height and opacity back to the consumer's classes and style. */
|
|
79
|
+
const presenceEnter = {
|
|
80
|
+
height: "auto",
|
|
81
|
+
opacity: 1
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Converts a consumer style value into the inline string React would write.
|
|
85
|
+
* @param value - The consumer's style value, if any.
|
|
86
|
+
* @param unit - Unit appended to numbers, as React does for lengths.
|
|
87
|
+
* @returns The inline value, or an empty string to fall back to the stylesheet.
|
|
88
|
+
*/
|
|
89
|
+
function toInlineStyleValue(value, unit = "") {
|
|
90
|
+
if (value === undefined) return "";
|
|
91
|
+
return typeof value === "number" ? `${value}${unit}` : value;
|
|
92
|
+
}
|
|
93
|
+
/** Outgoing icons are hidden from assistive technology while they fade. */
|
|
94
|
+
function AlertIconSwap(props) {
|
|
95
|
+
const $ = _c(3);
|
|
96
|
+
const isPresent = useIsPresent();
|
|
97
|
+
const t0 = isPresent ? props["aria-hidden"] : true;
|
|
98
|
+
let t1;
|
|
99
|
+
if ($[0] !== props || $[1] !== t0) {
|
|
100
|
+
t1 = /* @__PURE__ */ _jsx(motion.span, {
|
|
101
|
+
...props,
|
|
102
|
+
"aria-hidden": t0
|
|
103
|
+
});
|
|
104
|
+
$[0] = props;
|
|
105
|
+
$[1] = t0;
|
|
106
|
+
$[2] = t1;
|
|
107
|
+
} else {
|
|
108
|
+
t1 = $[2];
|
|
109
|
+
}
|
|
110
|
+
return t1;
|
|
111
|
+
}
|
|
112
|
+
/** The tone icon column: a new tone morphs its icon in place. */
|
|
113
|
+
function AlertIcon(t0) {
|
|
114
|
+
const $ = _c(6);
|
|
115
|
+
const { icon, iconKey, reduceMotion } = t0;
|
|
116
|
+
const t1 = reduceMotion ? reducedEnter : ARC_ICON_ENTER;
|
|
117
|
+
const t2 = reduceMotion ? ARC_REDUCED_EXIT : ARC_ICON_EXIT;
|
|
118
|
+
const t3 = reduceMotion ? ARC_REDUCED_TRANSITION : ARC_ICON_TRANSITION;
|
|
119
|
+
let t4;
|
|
120
|
+
if ($[0] !== icon || $[1] !== iconKey || $[2] !== t1 || $[3] !== t2 || $[4] !== t3) {
|
|
121
|
+
t4 = /* @__PURE__ */ _jsx("span", {
|
|
122
|
+
"data-slot": "alert-icon",
|
|
123
|
+
"aria-hidden": "true",
|
|
124
|
+
className: "relative row-span-2 mt-px grid size-[18px] flex-none place-items-center text-(--alert-color) [&_svg]:block [&_svg:not([class*='size-'])]:size-[18px]",
|
|
125
|
+
children: /* @__PURE__ */ _jsx(AnimatePresence, {
|
|
126
|
+
mode: "popLayout",
|
|
127
|
+
initial: false,
|
|
128
|
+
children: /* @__PURE__ */ _jsx(AlertIconSwap, {
|
|
129
|
+
className: "relative grid place-items-center",
|
|
130
|
+
initial: t1,
|
|
131
|
+
animate: ARC_SWAP_REST,
|
|
132
|
+
exit: t2,
|
|
133
|
+
transition: t3,
|
|
134
|
+
children: icon
|
|
135
|
+
}, iconKey)
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
$[0] = icon;
|
|
139
|
+
$[1] = iconKey;
|
|
140
|
+
$[2] = t1;
|
|
141
|
+
$[3] = t2;
|
|
142
|
+
$[4] = t3;
|
|
143
|
+
$[5] = t4;
|
|
144
|
+
} else {
|
|
145
|
+
t4 = $[5];
|
|
146
|
+
}
|
|
147
|
+
return t4;
|
|
148
|
+
}
|
|
149
|
+
/** The alert surface itself. */
|
|
150
|
+
function AlertBox(t0) {
|
|
151
|
+
const $ = _c(44);
|
|
152
|
+
let children;
|
|
17
153
|
let className;
|
|
154
|
+
let icon;
|
|
155
|
+
let onDismiss;
|
|
156
|
+
let presence;
|
|
18
157
|
let props;
|
|
158
|
+
let reduceMotion;
|
|
159
|
+
let t1;
|
|
160
|
+
let tone;
|
|
19
161
|
let variant;
|
|
20
162
|
if ($[0] !== t0) {
|
|
21
|
-
({className, variant, ...props} = t0);
|
|
163
|
+
({className, variant, tone, icon, onDismiss, dismissLabel: t1, reduceMotion, presence, children, ...props} = t0);
|
|
22
164
|
$[0] = t0;
|
|
23
|
-
$[1] =
|
|
24
|
-
$[2] =
|
|
25
|
-
$[3] =
|
|
165
|
+
$[1] = children;
|
|
166
|
+
$[2] = className;
|
|
167
|
+
$[3] = icon;
|
|
168
|
+
$[4] = onDismiss;
|
|
169
|
+
$[5] = presence;
|
|
170
|
+
$[6] = props;
|
|
171
|
+
$[7] = reduceMotion;
|
|
172
|
+
$[8] = t1;
|
|
173
|
+
$[9] = tone;
|
|
174
|
+
$[10] = variant;
|
|
26
175
|
} else {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
176
|
+
children = $[1];
|
|
177
|
+
className = $[2];
|
|
178
|
+
icon = $[3];
|
|
179
|
+
onDismiss = $[4];
|
|
180
|
+
presence = $[5];
|
|
181
|
+
props = $[6];
|
|
182
|
+
reduceMotion = $[7];
|
|
183
|
+
t1 = $[8];
|
|
184
|
+
tone = $[9];
|
|
185
|
+
variant = $[10];
|
|
30
186
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
187
|
+
const dismissLabel = t1 === undefined ? ALERT_DISMISS_LABEL : t1;
|
|
188
|
+
const isPresent = useIsPresent();
|
|
189
|
+
const ToneIcon = tone ? TONE_ICON[tone] : null;
|
|
190
|
+
let t2;
|
|
191
|
+
if ($[11] !== ToneIcon || $[12] !== icon) {
|
|
192
|
+
t2 = icon === false ? null : icon ?? (ToneIcon ? /* @__PURE__ */ _jsx(ToneIcon, { "aria-hidden": "true" }) : null);
|
|
193
|
+
$[11] = ToneIcon;
|
|
194
|
+
$[12] = icon;
|
|
195
|
+
$[13] = t2;
|
|
37
196
|
} else {
|
|
38
|
-
|
|
197
|
+
t2 = $[13];
|
|
39
198
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
199
|
+
const resolvedIcon = t2;
|
|
200
|
+
const t3 = tone ? ALERT_TONE_ROLE[tone] : "alert";
|
|
201
|
+
let t4;
|
|
202
|
+
if ($[14] !== className || $[15] !== tone || $[16] !== variant) {
|
|
203
|
+
t4 = cn(alertVariants({
|
|
204
|
+
variant,
|
|
205
|
+
tone
|
|
206
|
+
}), className);
|
|
207
|
+
$[14] = className;
|
|
208
|
+
$[15] = tone;
|
|
209
|
+
$[16] = variant;
|
|
210
|
+
$[17] = t4;
|
|
211
|
+
} else {
|
|
212
|
+
t4 = $[17];
|
|
213
|
+
}
|
|
214
|
+
let t5;
|
|
215
|
+
if ($[18] !== props || $[19] !== t3 || $[20] !== t4 || $[21] !== tone) {
|
|
216
|
+
t5 = {
|
|
217
|
+
"data-slot": "alert",
|
|
218
|
+
"data-tone": tone,
|
|
219
|
+
role: t3,
|
|
220
|
+
className: t4,
|
|
221
|
+
...props
|
|
222
|
+
};
|
|
223
|
+
$[18] = props;
|
|
224
|
+
$[19] = t3;
|
|
225
|
+
$[20] = t4;
|
|
226
|
+
$[21] = tone;
|
|
227
|
+
$[22] = t5;
|
|
228
|
+
} else {
|
|
229
|
+
t5 = $[22];
|
|
230
|
+
}
|
|
231
|
+
const rootProps = t5;
|
|
232
|
+
let t6;
|
|
233
|
+
if ($[23] !== icon || $[24] !== reduceMotion || $[25] !== resolvedIcon || $[26] !== tone) {
|
|
234
|
+
t6 = resolvedIcon ? /* @__PURE__ */ _jsx(AlertIcon, {
|
|
235
|
+
icon: resolvedIcon,
|
|
236
|
+
iconKey: icon ? "custom" : tone ?? "custom",
|
|
237
|
+
reduceMotion
|
|
238
|
+
}) : null;
|
|
239
|
+
$[23] = icon;
|
|
240
|
+
$[24] = reduceMotion;
|
|
241
|
+
$[25] = resolvedIcon;
|
|
242
|
+
$[26] = tone;
|
|
243
|
+
$[27] = t6;
|
|
244
|
+
} else {
|
|
245
|
+
t6 = $[27];
|
|
246
|
+
}
|
|
247
|
+
let t7;
|
|
248
|
+
if ($[28] !== dismissLabel || $[29] !== onDismiss) {
|
|
249
|
+
t7 = onDismiss ? /* @__PURE__ */ _jsx("button", {
|
|
250
|
+
type: "button",
|
|
251
|
+
"data-slot": "alert-dismiss",
|
|
252
|
+
"aria-label": dismissLabel,
|
|
253
|
+
onClick: onDismiss,
|
|
254
|
+
className: "absolute top-(--space-3) right-(--space-3) grid size-7 cursor-pointer place-items-center rounded-(--radius-pill) border-0 bg-transparent text-text-muted [-webkit-tap-highlight-color:transparent] transition-[scale,background-color,color] duration-(--duration-fast) ease-(--ease-standard) hover-fine:bg-surface-muted hover-fine:text-foreground active:scale-[.96] motion-reduce:transition-none motion-reduce:active:scale-100",
|
|
255
|
+
children: /* @__PURE__ */ _jsx(X, {
|
|
256
|
+
className: "size-4",
|
|
257
|
+
strokeWidth: 1.75,
|
|
258
|
+
"aria-hidden": "true"
|
|
259
|
+
})
|
|
260
|
+
}) : null;
|
|
261
|
+
$[28] = dismissLabel;
|
|
262
|
+
$[29] = onDismiss;
|
|
263
|
+
$[30] = t7;
|
|
264
|
+
} else {
|
|
265
|
+
t7 = $[30];
|
|
266
|
+
}
|
|
267
|
+
let t8;
|
|
268
|
+
if ($[31] !== children || $[32] !== t6 || $[33] !== t7) {
|
|
269
|
+
t8 = /* @__PURE__ */ _jsxs(_Fragment, { children: [
|
|
270
|
+
t6,
|
|
271
|
+
children,
|
|
272
|
+
t7
|
|
273
|
+
] });
|
|
274
|
+
$[31] = children;
|
|
275
|
+
$[32] = t6;
|
|
276
|
+
$[33] = t7;
|
|
277
|
+
$[34] = t8;
|
|
278
|
+
} else {
|
|
279
|
+
t8 = $[34];
|
|
280
|
+
}
|
|
281
|
+
const content = t8;
|
|
282
|
+
if (presence) {
|
|
283
|
+
const t9 = rootProps;
|
|
284
|
+
const t10 = isPresent ? rootProps["aria-hidden"] : true;
|
|
285
|
+
const t11 = !isPresent || rootProps.inert;
|
|
286
|
+
let t12;
|
|
287
|
+
if ($[35] !== content || $[36] !== presence || $[37] !== t10 || $[38] !== t11 || $[39] !== t9) {
|
|
288
|
+
t12 = /* @__PURE__ */ _jsx(motion.div, {
|
|
289
|
+
...t9,
|
|
290
|
+
...presence,
|
|
291
|
+
"aria-hidden": t10,
|
|
292
|
+
inert: t11,
|
|
293
|
+
children: content
|
|
294
|
+
});
|
|
295
|
+
$[35] = content;
|
|
296
|
+
$[36] = presence;
|
|
297
|
+
$[37] = t10;
|
|
298
|
+
$[38] = t11;
|
|
299
|
+
$[39] = t9;
|
|
300
|
+
$[40] = t12;
|
|
301
|
+
} else {
|
|
302
|
+
t12 = $[40];
|
|
303
|
+
}
|
|
304
|
+
return t12;
|
|
305
|
+
}
|
|
306
|
+
let t9;
|
|
307
|
+
if ($[41] !== content || $[42] !== rootProps) {
|
|
308
|
+
t9 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
43
309
|
kind: "message",
|
|
44
310
|
children: /* @__PURE__ */ _jsx("div", {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
className: t1,
|
|
48
|
-
...props
|
|
311
|
+
...rootProps,
|
|
312
|
+
children: content
|
|
49
313
|
})
|
|
50
314
|
});
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
315
|
+
$[41] = content;
|
|
316
|
+
$[42] = rootProps;
|
|
317
|
+
$[43] = t9;
|
|
54
318
|
} else {
|
|
55
|
-
|
|
319
|
+
t9 = $[43];
|
|
56
320
|
}
|
|
57
|
-
return
|
|
321
|
+
return t9;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* A persistent message. Compose it with `AlertTitle`, `AlertDescription` and `AlertAction`.
|
|
325
|
+
* @param props - Variant, Arc tone and icon, optional presence and dismissal, plus native div attributes.
|
|
326
|
+
* @returns The alert; with `open` or `onDismiss` it collapses its own height when hidden.
|
|
327
|
+
*/
|
|
328
|
+
function Alert({ open, onDismiss, ref: consumerRef, ...props }) {
|
|
329
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
330
|
+
const [isDismissed, setIsDismissed] = useState(false);
|
|
331
|
+
const [presenceElement, attachPresence] = useAttachedElement(consumerRef);
|
|
332
|
+
const restingOverflow = useRef(undefined);
|
|
333
|
+
const clipPresence = () => {
|
|
334
|
+
if (!presenceElement) return;
|
|
335
|
+
restingOverflow.current ??= presenceElement.style.overflow;
|
|
336
|
+
presenceElement.style.overflow = "hidden";
|
|
337
|
+
};
|
|
338
|
+
const settlePresence = (definition) => {
|
|
339
|
+
if (!presenceElement) return;
|
|
340
|
+
if (restingOverflow.current !== undefined) presenceElement.style.overflow = restingOverflow.current;
|
|
341
|
+
restingOverflow.current = undefined;
|
|
342
|
+
if (definition === presenceEnter) {
|
|
343
|
+
presenceElement.style.height = toInlineStyleValue(props.style?.height, "px");
|
|
344
|
+
presenceElement.style.opacity = toInlineStyleValue(props.style?.opacity);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
if (open === undefined && !onDismiss) {
|
|
348
|
+
return /* @__PURE__ */ _jsx(AlertBox, {
|
|
349
|
+
...props,
|
|
350
|
+
ref: consumerRef,
|
|
351
|
+
reduceMotion
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
const isOpen = open ?? !isDismissed;
|
|
355
|
+
const dismiss = onDismiss && (() => open === undefined ? setIsDismissed(true) : onDismiss());
|
|
356
|
+
return /* @__PURE__ */ _jsx(AnimatePresence, {
|
|
357
|
+
initial: false,
|
|
358
|
+
onExitComplete: () => {
|
|
359
|
+
if (open === undefined) onDismiss?.();
|
|
360
|
+
},
|
|
361
|
+
children: isOpen ? /* @__PURE__ */ _jsx(AlertBox, {
|
|
362
|
+
...props,
|
|
363
|
+
onDismiss: dismiss,
|
|
364
|
+
reduceMotion,
|
|
365
|
+
presence: {
|
|
366
|
+
ref: attachPresence,
|
|
367
|
+
initial: {
|
|
368
|
+
height: 0,
|
|
369
|
+
opacity: 0
|
|
370
|
+
},
|
|
371
|
+
animate: presenceEnter,
|
|
372
|
+
exit: reduceMotion ? reducedPresenceExit : presenceExit,
|
|
373
|
+
transition: reduceMotion ? { duration: 0 } : presenceTransition,
|
|
374
|
+
onAnimationStart: clipPresence,
|
|
375
|
+
onAnimationComplete: settlePresence
|
|
376
|
+
}
|
|
377
|
+
}, "alert") : null
|
|
378
|
+
});
|
|
58
379
|
}
|
|
59
380
|
function AlertTitle(t0) {
|
|
60
381
|
const $ = _c(8);
|
|
@@ -71,7 +392,7 @@ function AlertTitle(t0) {
|
|
|
71
392
|
}
|
|
72
393
|
let t1;
|
|
73
394
|
if ($[3] !== className) {
|
|
74
|
-
t1 = cn("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground", className);
|
|
395
|
+
t1 = cn("text-sm font-medium group-has-[>svg]/alert:col-start-2 group-has-data-[slot=alert-icon]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover-fine:text-foreground", className);
|
|
75
396
|
$[3] = className;
|
|
76
397
|
$[4] = t1;
|
|
77
398
|
} else {
|
|
@@ -107,7 +428,7 @@ function AlertDescription(t0) {
|
|
|
107
428
|
}
|
|
108
429
|
let t1;
|
|
109
430
|
if ($[3] !== className) {
|
|
110
|
-
t1 = cn("text-
|
|
431
|
+
t1 = cn("text-xs leading-(--leading-body) text-pretty text-text-secondary group-has-[>svg]/alert:col-start-2 group-has-data-[slot=alert-icon]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover-fine:text-foreground [&_p:not(:last-child)]:mb-4", className);
|
|
111
432
|
$[3] = className;
|
|
112
433
|
$[4] = t1;
|
|
113
434
|
} else {
|
|
@@ -143,7 +464,7 @@ function AlertAction(t0) {
|
|
|
143
464
|
}
|
|
144
465
|
let t1;
|
|
145
466
|
if ($[3] !== className) {
|
|
146
|
-
t1 = cn("absolute top-
|
|
467
|
+
t1 = cn("absolute top-(--space-3) right-(--space-3) group-has-data-[slot=alert-dismiss]/alert:right-12", className);
|
|
147
468
|
$[3] = className;
|
|
148
469
|
$[4] = t1;
|
|
149
470
|
} else {
|
|
@@ -1,17 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Arc's Avatar (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a compact identity marker on Arc's
|
|
3
|
+
* tokens, with a hairline border, a muted fill behind the initials and an optional presence dot that pops in and out.
|
|
4
|
+
* Loading, failure and fallback stay on the Base UI avatar primitive.
|
|
5
|
+
*/
|
|
6
|
+
import type { ComponentProps } from "react";
|
|
2
7
|
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
8
|
+
import type { AvatarStatus } from "../constants/avatar.js";
|
|
9
|
+
export type { AvatarStatus };
|
|
10
|
+
/** Avatar diameters: 24px (`sm`), 32px (`default`), 40px (`lg`) and Arc's 88px profile size (`xl`). */
|
|
11
|
+
export type AvatarSize = "default" | "sm" | "lg" | "xl";
|
|
3
12
|
/** Accepts native image props and nullable image sources from application results. */
|
|
4
|
-
export type AvatarImageProps = Omit<
|
|
13
|
+
export type AvatarImageProps = Omit<ComponentProps<"img">, "src"> & {
|
|
5
14
|
src?: string | null;
|
|
6
15
|
};
|
|
7
|
-
|
|
8
|
-
size?:
|
|
9
|
-
|
|
16
|
+
export type AvatarProps = AvatarPrimitive.Root.Props & {
|
|
17
|
+
size?: AvatarSize;
|
|
18
|
+
/**
|
|
19
|
+
* Shows Arc's presence dot in the bottom corner, or the top corner when an `AvatarBadge` holds the bottom one, and
|
|
20
|
+
* adds the presence to the accessible text.
|
|
21
|
+
*/
|
|
22
|
+
status?: AvatarStatus;
|
|
23
|
+
/** Accessible presence text; defaults to "En línea" or "Desconectado". */
|
|
24
|
+
statusLabel?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A person or account, as a photo with initials as fallback.
|
|
28
|
+
* @param props - Size, optional presence and the Base UI avatar root props.
|
|
29
|
+
* @returns The avatar root.
|
|
30
|
+
*/
|
|
31
|
+
declare function Avatar({ className, size, status, statusLabel, children, ...props }: AvatarProps): import("react").JSX.Element;
|
|
10
32
|
/** Delegates loading, failure and fallback synchronization to the avatar primitive; loaded images develop in place. */
|
|
11
|
-
declare function AvatarImage({ alt, className, src, ...props }: AvatarImageProps):
|
|
12
|
-
declare function AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props):
|
|
13
|
-
|
|
33
|
+
declare function AvatarImage({ alt, className, src, ...props }: AvatarImageProps): import("react").JSX.Element;
|
|
34
|
+
declare function AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props): import("react").JSX.Element;
|
|
35
|
+
/** A custom corner badge, drawn with the same ring as Arc's presence dot. Prefer `status` for presence. */
|
|
36
|
+
declare function AvatarBadge({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
14
37
|
/** Overlaps avatars; the hovered one lifts slightly above its neighbours. */
|
|
15
|
-
declare function AvatarGroup({ className, ...props }:
|
|
16
|
-
declare function AvatarGroupCount({ className, ...props }:
|
|
38
|
+
declare function AvatarGroup({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
39
|
+
declare function AvatarGroupCount({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
17
40
|
export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge, };
|