beez-ui 2.7.0 → 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 +78 -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 +2 -2
- 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,267 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
4
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
5
|
+
import { AVATAR_STATUS_HIDDEN_SCALE } from "../../constants/avatar.js";
|
|
6
|
+
import { usePrefersReducedMotion } from "../../hooks/use-prefers-reduced-motion.js";
|
|
7
|
+
import { cn } from "../../lib/utils.js";
|
|
8
|
+
import { ARC_DURATION, ARC_SPRING_SNAPPY } from "../../motion/arc-tokens.js";
|
|
9
|
+
import { MotionSlot } from "../../motion/motion-slot.js";
|
|
10
|
+
import { useBeezUIComponents } from "../../providers/beez-ui-provider.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
/** The presence ring: a surface-coloured gap plus a faint hairline, so the dot reads on photos and fills alike. */
|
|
13
|
+
const presenceRingClassName = "shadow-[0_0_0_2px_var(--surface),0_0_0_3px_color-mix(in_oklab,var(--border)_70%,transparent)]";
|
|
14
|
+
/**
|
|
15
|
+
* The avatar circle with its optional presence dot.
|
|
16
|
+
* @param props - Size, optional presence and the Base UI avatar root props.
|
|
17
|
+
* @returns The avatar root.
|
|
18
|
+
*/
|
|
19
|
+
function AvatarRoot(t0) {
|
|
20
|
+
const $ = _c(19);
|
|
21
|
+
let children;
|
|
22
|
+
let className;
|
|
23
|
+
let props;
|
|
24
|
+
let status;
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[0] !== t0) {
|
|
27
|
+
({className, size: t1, status, children, ...props} = t0);
|
|
28
|
+
$[0] = t0;
|
|
29
|
+
$[1] = children;
|
|
30
|
+
$[2] = className;
|
|
31
|
+
$[3] = props;
|
|
32
|
+
$[4] = status;
|
|
33
|
+
$[5] = t1;
|
|
34
|
+
} else {
|
|
35
|
+
children = $[1];
|
|
36
|
+
className = $[2];
|
|
37
|
+
props = $[3];
|
|
38
|
+
status = $[4];
|
|
39
|
+
t1 = $[5];
|
|
40
|
+
}
|
|
41
|
+
const size = t1 === undefined ? "md" : t1;
|
|
42
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[6] !== className) {
|
|
45
|
+
t2 = cn("group/avatar relative inline-grid size-8 shrink-0 place-items-center rounded-(--radius-pill) border border-border bg-surface-muted text-xs font-medium text-foreground select-none data-[size=lg]:size-10 data-[size=lg]:text-sm data-[size=sm]:size-6 data-[size=sm]:text-[10px] data-[size=xl]:size-22 data-[size=xl]:text-xl", className);
|
|
46
|
+
$[6] = className;
|
|
47
|
+
$[7] = t2;
|
|
48
|
+
} else {
|
|
49
|
+
t2 = $[7];
|
|
50
|
+
}
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[8] !== reduceMotion || $[9] !== status) {
|
|
53
|
+
t3 = status ? /* @__PURE__ */ _jsx(motion.span, {
|
|
54
|
+
"data-slot": "avatar-status",
|
|
55
|
+
"data-status": status,
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
className: cn("absolute right-0 bottom-0 z-10 size-2.5 rounded-(--radius-pill) data-[status=offline]:bg-text-muted data-[status=online]:bg-success group-data-[size=lg]/avatar:size-3 group-data-[size=sm]/avatar:size-2 group-data-[size=xl]/avatar:right-1 group-data-[size=xl]/avatar:bottom-1 group-data-[size=xl]/avatar:size-3.5 group-has-data-[slot=avatar-badge]/avatar:top-0 group-has-data-[slot=avatar-badge]/avatar:bottom-auto group-data-[size=xl]/avatar:group-has-data-[slot=avatar-badge]/avatar:top-1", presenceRingClassName),
|
|
58
|
+
initial: {
|
|
59
|
+
opacity: 0,
|
|
60
|
+
scale: AVATAR_STATUS_HIDDEN_SCALE
|
|
61
|
+
},
|
|
62
|
+
animate: {
|
|
63
|
+
opacity: 1,
|
|
64
|
+
scale: 1
|
|
65
|
+
},
|
|
66
|
+
exit: {
|
|
67
|
+
opacity: 0,
|
|
68
|
+
scale: AVATAR_STATUS_HIDDEN_SCALE,
|
|
69
|
+
transition: { duration: reduceMotion ? 0 : ARC_DURATION.fast }
|
|
70
|
+
},
|
|
71
|
+
transition: reduceMotion ? { duration: 0 } : ARC_SPRING_SNAPPY
|
|
72
|
+
}, status) : null;
|
|
73
|
+
$[8] = reduceMotion;
|
|
74
|
+
$[9] = status;
|
|
75
|
+
$[10] = t3;
|
|
76
|
+
} else {
|
|
77
|
+
t3 = $[10];
|
|
78
|
+
}
|
|
79
|
+
let t4;
|
|
80
|
+
if ($[11] !== t3) {
|
|
81
|
+
t4 = /* @__PURE__ */ _jsx(AnimatePresence, {
|
|
82
|
+
initial: false,
|
|
83
|
+
children: t3
|
|
84
|
+
});
|
|
85
|
+
$[11] = t3;
|
|
86
|
+
$[12] = t4;
|
|
87
|
+
} else {
|
|
88
|
+
t4 = $[12];
|
|
89
|
+
}
|
|
90
|
+
let t5;
|
|
91
|
+
if ($[13] !== children || $[14] !== props || $[15] !== size || $[16] !== t2 || $[17] !== t4) {
|
|
92
|
+
t5 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
93
|
+
kind: "fade",
|
|
94
|
+
children: /* @__PURE__ */ _jsxs(AvatarPrimitive.Root, {
|
|
95
|
+
"data-slot": "avatar",
|
|
96
|
+
"data-size": size,
|
|
97
|
+
className: t2,
|
|
98
|
+
...props,
|
|
99
|
+
children: [children, t4]
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
$[13] = children;
|
|
103
|
+
$[14] = props;
|
|
104
|
+
$[15] = size;
|
|
105
|
+
$[16] = t2;
|
|
106
|
+
$[17] = t4;
|
|
107
|
+
$[18] = t5;
|
|
108
|
+
} else {
|
|
109
|
+
t5 = $[18];
|
|
110
|
+
}
|
|
111
|
+
return t5;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The photo. Delegates loading, failure and fallback synchronization to the avatar primitive and renders through the
|
|
115
|
+
* provider's `Image` adapter; loaded images develop in place.
|
|
116
|
+
* @param props - Native image props with a nullable source.
|
|
117
|
+
* @returns The image, mounted while it loads so the fallback can stay until it is ready.
|
|
118
|
+
*/
|
|
119
|
+
function AvatarImage(t0) {
|
|
120
|
+
const $ = _c(15);
|
|
121
|
+
let className;
|
|
122
|
+
let props;
|
|
123
|
+
let src;
|
|
124
|
+
let t1;
|
|
125
|
+
if ($[0] !== t0) {
|
|
126
|
+
({alt: t1, className, src, ...props} = t0);
|
|
127
|
+
$[0] = t0;
|
|
128
|
+
$[1] = className;
|
|
129
|
+
$[2] = props;
|
|
130
|
+
$[3] = src;
|
|
131
|
+
$[4] = t1;
|
|
132
|
+
} else {
|
|
133
|
+
className = $[1];
|
|
134
|
+
props = $[2];
|
|
135
|
+
src = $[3];
|
|
136
|
+
t1 = $[4];
|
|
137
|
+
}
|
|
138
|
+
const alt = t1 === undefined ? "" : t1;
|
|
139
|
+
const { Image: t2 } = useBeezUIComponents();
|
|
140
|
+
const ImageComponent = t2 === undefined ? "img" : t2;
|
|
141
|
+
let t3;
|
|
142
|
+
if ($[5] !== ImageComponent) {
|
|
143
|
+
t3 = /* @__PURE__ */ _jsx(ImageComponent, {});
|
|
144
|
+
$[5] = ImageComponent;
|
|
145
|
+
$[6] = t3;
|
|
146
|
+
} else {
|
|
147
|
+
t3 = $[6];
|
|
148
|
+
}
|
|
149
|
+
let t4;
|
|
150
|
+
if ($[7] !== className) {
|
|
151
|
+
t4 = cn("pointer-events-none absolute inset-0 aspect-square size-full rounded-full object-cover data-[loading]:opacity-0 data-[error]:hidden", className);
|
|
152
|
+
$[7] = className;
|
|
153
|
+
$[8] = t4;
|
|
154
|
+
} else {
|
|
155
|
+
t4 = $[8];
|
|
156
|
+
}
|
|
157
|
+
const t5 = src ?? undefined;
|
|
158
|
+
let t6;
|
|
159
|
+
if ($[9] !== alt || $[10] !== props || $[11] !== t3 || $[12] !== t4 || $[13] !== t5) {
|
|
160
|
+
t6 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
161
|
+
kind: "reveal",
|
|
162
|
+
children: /* @__PURE__ */ _jsx(AvatarPrimitive.Image, {
|
|
163
|
+
render: t3,
|
|
164
|
+
keepMounted: true,
|
|
165
|
+
alt,
|
|
166
|
+
"data-slot": "avatar-image",
|
|
167
|
+
className: t4,
|
|
168
|
+
src: t5,
|
|
169
|
+
loading: "lazy",
|
|
170
|
+
decoding: "async",
|
|
171
|
+
...props
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
$[9] = alt;
|
|
175
|
+
$[10] = props;
|
|
176
|
+
$[11] = t3;
|
|
177
|
+
$[12] = t4;
|
|
178
|
+
$[13] = t5;
|
|
179
|
+
$[14] = t6;
|
|
180
|
+
} else {
|
|
181
|
+
t6 = $[14];
|
|
182
|
+
}
|
|
183
|
+
return t6;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Initials or another stand-in, shown until the photo loads or when it fails.
|
|
187
|
+
* @param props - Base UI fallback props.
|
|
188
|
+
* @returns The fallback.
|
|
189
|
+
*/
|
|
190
|
+
function AvatarFallback(t0) {
|
|
191
|
+
const $ = _c(8);
|
|
192
|
+
let className;
|
|
193
|
+
let props;
|
|
194
|
+
if ($[0] !== t0) {
|
|
195
|
+
({className, ...props} = t0);
|
|
196
|
+
$[0] = t0;
|
|
197
|
+
$[1] = className;
|
|
198
|
+
$[2] = props;
|
|
199
|
+
} else {
|
|
200
|
+
className = $[1];
|
|
201
|
+
props = $[2];
|
|
202
|
+
}
|
|
203
|
+
let t1;
|
|
204
|
+
if ($[3] !== className) {
|
|
205
|
+
t1 = cn("flex size-full items-center justify-center rounded-full bg-surface-muted text-[length:inherit] font-medium text-foreground", className);
|
|
206
|
+
$[3] = className;
|
|
207
|
+
$[4] = t1;
|
|
208
|
+
} else {
|
|
209
|
+
t1 = $[4];
|
|
210
|
+
}
|
|
211
|
+
let t2;
|
|
212
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
213
|
+
t2 = /* @__PURE__ */ _jsx(AvatarPrimitive.Fallback, {
|
|
214
|
+
"data-slot": "avatar-fallback",
|
|
215
|
+
className: t1,
|
|
216
|
+
...props
|
|
217
|
+
});
|
|
218
|
+
$[5] = props;
|
|
219
|
+
$[6] = t1;
|
|
220
|
+
$[7] = t2;
|
|
221
|
+
} else {
|
|
222
|
+
t2 = $[7];
|
|
223
|
+
}
|
|
224
|
+
return t2;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* A custom corner badge, drawn with the same ring as Arc's presence dot.
|
|
228
|
+
* @param props - Native span props.
|
|
229
|
+
* @returns The badge.
|
|
230
|
+
*/
|
|
231
|
+
function AvatarBadge(t0) {
|
|
232
|
+
const $ = _c(8);
|
|
233
|
+
let className;
|
|
234
|
+
let props;
|
|
235
|
+
if ($[0] !== t0) {
|
|
236
|
+
({className, ...props} = t0);
|
|
237
|
+
$[0] = t0;
|
|
238
|
+
$[1] = className;
|
|
239
|
+
$[2] = props;
|
|
240
|
+
} else {
|
|
241
|
+
className = $[1];
|
|
242
|
+
props = $[2];
|
|
243
|
+
}
|
|
244
|
+
let t1;
|
|
245
|
+
if ($[3] !== className) {
|
|
246
|
+
t1 = cn("absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color select-none", presenceRingClassName, "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden", "group-data-[size=md]/avatar:size-2.5 group-data-[size=md]/avatar:[&>svg]:size-2", "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", "group-data-[size=xl]/avatar:right-1 group-data-[size=xl]/avatar:bottom-1 group-data-[size=xl]/avatar:size-3.5 group-data-[size=xl]/avatar:[&>svg]:size-2.5", className);
|
|
247
|
+
$[3] = className;
|
|
248
|
+
$[4] = t1;
|
|
249
|
+
} else {
|
|
250
|
+
t1 = $[4];
|
|
251
|
+
}
|
|
252
|
+
let t2;
|
|
253
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
254
|
+
t2 = /* @__PURE__ */ _jsx("span", {
|
|
255
|
+
"data-slot": "avatar-badge",
|
|
256
|
+
className: t1,
|
|
257
|
+
...props
|
|
258
|
+
});
|
|
259
|
+
$[5] = props;
|
|
260
|
+
$[6] = t1;
|
|
261
|
+
$[7] = t2;
|
|
262
|
+
} else {
|
|
263
|
+
t2 = $[7];
|
|
264
|
+
}
|
|
265
|
+
return t2;
|
|
266
|
+
}
|
|
267
|
+
export { AvatarRoot, AvatarImage, AvatarFallback, AvatarBadge };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arc's Calendar (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md) on react-day-picker: round day cells
|
|
3
|
+
* on a 4px grid, the month title on the left with quiet pill controls on the right, today marked by a dot under its
|
|
4
|
+
* number, a selected disc that glides between days and an optional Today button. react-day-picker keeps selection
|
|
5
|
+
* modes, ranges, dropdowns, locales and keyboard navigation; only the design and the motion come from Arc.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { DayPicker, type DayButton, type Locale } from "react-day-picker";
|
|
9
|
+
import { ControlButton } from "../control-button.js";
|
|
10
|
+
type CalendarProps = React.ComponentProps<typeof DayPicker> & {
|
|
11
|
+
/** Variant of the month navigation buttons, kept for compatibility; Arc's look is the default `ghost`. */
|
|
12
|
+
buttonVariant?: React.ComponentProps<typeof ControlButton>["variant"];
|
|
13
|
+
/**
|
|
14
|
+
* Adds Arc's Today button before the month controls: it goes back to the month holding today and, in single
|
|
15
|
+
* selection mode, selects today when it is available. It rests dimmed while there is nothing left to do.
|
|
16
|
+
*/
|
|
17
|
+
showToday?: boolean;
|
|
18
|
+
/** Copy of the Today button. Defaults to "Hoy". */
|
|
19
|
+
todayLabel?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A month grid for picking a day, several days or a range, controlled or uncontrolled like react-day-picker.
|
|
23
|
+
* @param props - Every react-day-picker prop plus the Arc additions `showToday` and `todayLabel`.
|
|
24
|
+
* @returns The calendar, in Spanish by default.
|
|
25
|
+
*/
|
|
26
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, locale, formatters, components, showToday, todayLabel, ...props }: CalendarProps): React.JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* One day of the grid: a round cell whose fill answers hover on fine pointers, presses in slightly and marks today
|
|
29
|
+
* with a dot under its number that takes the number's colour.
|
|
30
|
+
* @param props - react-day-picker day button properties plus the locale used for `data-day`.
|
|
31
|
+
* @returns The day button.
|
|
32
|
+
*/
|
|
33
|
+
declare function CalendarDayButton({ className, day, modifiers, locale, ...props }: React.ComponentProps<typeof DayButton> & {
|
|
34
|
+
locale?: Partial<Locale>;
|
|
35
|
+
}): React.JSX.Element;
|
|
36
|
+
export { Calendar, CalendarDayButton };
|
|
37
|
+
export type { CalendarProps };
|