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
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { Link } from "./link.js";
|
|
5
|
-
import { GlideSlot } from "../motion/glide-slot.js";
|
|
6
|
-
import { cn } from "../lib/utils.js";
|
|
7
|
-
import { ControlButton } from "./control-button.js";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
8
4
|
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
|
|
5
|
+
import { PAGINATION_DEFAULT_COPY } from "../constants/pagination.js";
|
|
6
|
+
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
7
|
+
import { cn } from "../lib/utils.js";
|
|
8
|
+
import { useArcPress } from "../motion/arc-press.js";
|
|
9
|
+
import { GlideSlot } from "../motion/glide-slot.js";
|
|
10
|
+
import { useAttachedElement } from "../motion/use-attached-element.js";
|
|
11
|
+
import { Link } from "./link.js";
|
|
9
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
* Landmark that holds the page controls.
|
|
15
|
+
* @param props - Native `nav` attributes; `aria-label` defaults to Spanish copy.
|
|
16
|
+
* @returns The navigation landmark.
|
|
17
|
+
*/
|
|
10
18
|
function Pagination(t0) {
|
|
11
19
|
const $ = _c(8);
|
|
12
20
|
let className;
|
|
@@ -32,7 +40,7 @@ function Pagination(t0) {
|
|
|
32
40
|
if ($[5] !== props || $[6] !== t1) {
|
|
33
41
|
t2 = /* @__PURE__ */ _jsx("nav", {
|
|
34
42
|
role: "navigation",
|
|
35
|
-
"aria-label":
|
|
43
|
+
"aria-label": PAGINATION_DEFAULT_COPY.navigationLabel,
|
|
36
44
|
"data-slot": "pagination",
|
|
37
45
|
className: t1,
|
|
38
46
|
...props
|
|
@@ -45,7 +53,7 @@ function Pagination(t0) {
|
|
|
45
53
|
}
|
|
46
54
|
return t2;
|
|
47
55
|
}
|
|
48
|
-
/** Lists page links; the current page's
|
|
56
|
+
/** Lists page links; the current page's mark glides to the newly selected page. */
|
|
49
57
|
function PaginationContent(t0) {
|
|
50
58
|
const $ = _c(8);
|
|
51
59
|
let className;
|
|
@@ -61,7 +69,7 @@ function PaginationContent(t0) {
|
|
|
61
69
|
}
|
|
62
70
|
let t1;
|
|
63
71
|
if ($[3] !== className) {
|
|
64
|
-
t1 = cn("flex items-center gap-1", className);
|
|
72
|
+
t1 = cn("flex flex-wrap items-center gap-(--space-1)", className);
|
|
65
73
|
$[3] = className;
|
|
66
74
|
$[4] = t1;
|
|
67
75
|
} else {
|
|
@@ -108,69 +116,134 @@ function PaginationItem(t0) {
|
|
|
108
116
|
}
|
|
109
117
|
return t1;
|
|
110
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Arc's page control: a control-height square for numbers, padded for labelled arrows. The current page draws the
|
|
121
|
+
* raised mark (border, surface and resting shadow) that the glide copies while it travels.
|
|
122
|
+
*/
|
|
123
|
+
const paginationLinkVariants = cva("relative inline-flex h-(--control-height-sm) min-w-(--control-height-sm) shrink-0 cursor-pointer items-center justify-center gap-1 rounded-(--radius-control) border border-transparent bg-transparent font-sans text-xs font-medium whitespace-nowrap text-text-secondary tabular-nums no-underline [-webkit-tap-highlight-color:transparent] transition-[color,background-color,border-color,box-shadow,opacity] duration-(--duration-fast) ease-(--ease-standard) select-none motion-reduce:transition-none hover-fine:bg-surface-muted hover-fine:text-foreground aria-[current=page]:border-border aria-[current=page]:bg-surface aria-[current=page]:text-foreground aria-[current=page]:shadow-(--shadow-resting) aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
124
|
+
variants: { size: {
|
|
125
|
+
default: "px-(--space-3)",
|
|
126
|
+
xs: "px-(--space-2)",
|
|
127
|
+
sm: "px-(--space-2)",
|
|
128
|
+
lg: "px-(--space-4)",
|
|
129
|
+
icon: "px-0",
|
|
130
|
+
"icon-xs": "px-0",
|
|
131
|
+
"icon-sm": "px-0",
|
|
132
|
+
"icon-lg": "px-0"
|
|
133
|
+
} },
|
|
134
|
+
defaultVariants: { size: "icon" }
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* One page, rendered through the provider's `Link` adapter or the `component` passed to it.
|
|
138
|
+
* @param props - `isActive` marks the current page (`aria-current="page"`); `size` keeps the previous size names
|
|
139
|
+
* and only changes the horizontal padding; every other prop reaches the link. With `aria-disabled` the link
|
|
140
|
+
* stays visible but never navigates, whether clicked or activated with Enter, and `onClick` is not called.
|
|
141
|
+
* @returns The page link.
|
|
142
|
+
*/
|
|
111
143
|
function PaginationLink(t0) {
|
|
112
|
-
const $ = _c(
|
|
144
|
+
const $ = _c(19);
|
|
113
145
|
let className;
|
|
114
146
|
let isActive;
|
|
147
|
+
let onClick;
|
|
115
148
|
let props;
|
|
116
149
|
let t1;
|
|
117
150
|
if ($[0] !== t0) {
|
|
118
|
-
({className, isActive, size: t1, ...props} = t0);
|
|
151
|
+
({className, isActive, size: t1, onClick, ...props} = t0);
|
|
119
152
|
$[0] = t0;
|
|
120
153
|
$[1] = className;
|
|
121
154
|
$[2] = isActive;
|
|
122
|
-
$[3] =
|
|
123
|
-
$[4] =
|
|
155
|
+
$[3] = onClick;
|
|
156
|
+
$[4] = props;
|
|
157
|
+
$[5] = t1;
|
|
124
158
|
} else {
|
|
125
159
|
className = $[1];
|
|
126
160
|
isActive = $[2];
|
|
127
|
-
|
|
128
|
-
|
|
161
|
+
onClick = $[3];
|
|
162
|
+
props = $[4];
|
|
163
|
+
t1 = $[5];
|
|
129
164
|
}
|
|
130
165
|
const size = t1 === undefined ? "icon" : t1;
|
|
131
|
-
const
|
|
132
|
-
let
|
|
133
|
-
if ($[
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
166
|
+
const isDisabled = props["aria-disabled"] === true || props["aria-disabled"] === "true";
|
|
167
|
+
let t2;
|
|
168
|
+
if ($[6] !== isDisabled || $[7] !== onClick) {
|
|
169
|
+
t2 = function handleClick(event) {
|
|
170
|
+
if (isDisabled) {
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
onClick?.(event);
|
|
175
|
+
};
|
|
176
|
+
$[6] = isDisabled;
|
|
177
|
+
$[7] = onClick;
|
|
178
|
+
$[8] = t2;
|
|
137
179
|
} else {
|
|
138
|
-
|
|
180
|
+
t2 = $[8];
|
|
181
|
+
}
|
|
182
|
+
const handleClick = t2;
|
|
183
|
+
const t3 = isActive ? "page" : undefined;
|
|
184
|
+
let t4;
|
|
185
|
+
if ($[9] !== className || $[10] !== size) {
|
|
186
|
+
t4 = cn(paginationLinkVariants({ size }), className);
|
|
187
|
+
$[9] = className;
|
|
188
|
+
$[10] = size;
|
|
189
|
+
$[11] = t4;
|
|
190
|
+
} else {
|
|
191
|
+
t4 = $[11];
|
|
139
192
|
}
|
|
140
|
-
const t4 = isActive ? "page" : undefined;
|
|
141
193
|
let t5;
|
|
142
|
-
if ($[
|
|
194
|
+
if ($[12] !== handleClick || $[13] !== isActive || $[14] !== props || $[15] !== size || $[16] !== t3 || $[17] !== t4) {
|
|
143
195
|
t5 = /* @__PURE__ */ _jsx(Link, {
|
|
144
|
-
"aria-current":
|
|
196
|
+
"aria-current": t3,
|
|
145
197
|
"data-slot": "pagination-link",
|
|
146
198
|
"data-active": isActive,
|
|
147
|
-
|
|
199
|
+
"data-size": size,
|
|
200
|
+
className: t4,
|
|
201
|
+
...props,
|
|
202
|
+
onClick: handleClick
|
|
148
203
|
});
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
204
|
+
$[12] = handleClick;
|
|
205
|
+
$[13] = isActive;
|
|
206
|
+
$[14] = props;
|
|
207
|
+
$[15] = size;
|
|
208
|
+
$[16] = t3;
|
|
209
|
+
$[17] = t4;
|
|
210
|
+
$[18] = t5;
|
|
211
|
+
} else {
|
|
212
|
+
t5 = $[18];
|
|
213
|
+
}
|
|
214
|
+
return t5;
|
|
215
|
+
}
|
|
216
|
+
/** A previous or next arrow: Arc presses it in, while page numbers stay still and let the mark travel. */
|
|
217
|
+
function PaginationStep(t0) {
|
|
218
|
+
const $ = _c(6);
|
|
219
|
+
let props;
|
|
220
|
+
let ref;
|
|
221
|
+
if ($[0] !== t0) {
|
|
222
|
+
({ref, ...props} = t0);
|
|
223
|
+
$[0] = t0;
|
|
224
|
+
$[1] = props;
|
|
225
|
+
$[2] = ref;
|
|
153
226
|
} else {
|
|
154
|
-
|
|
227
|
+
props = $[1];
|
|
228
|
+
ref = $[2];
|
|
155
229
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
230
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
231
|
+
const [element, attach] = useAttachedElement(ref);
|
|
232
|
+
useArcPress(element, !reduceMotion);
|
|
233
|
+
let t1;
|
|
234
|
+
if ($[3] !== attach || $[4] !== props) {
|
|
235
|
+
t1 = /* @__PURE__ */ _jsx(PaginationLink, {
|
|
236
|
+
ref: attach,
|
|
237
|
+
size: "default",
|
|
238
|
+
...props
|
|
164
239
|
});
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[14] = t5;
|
|
169
|
-
$[15] = t6;
|
|
240
|
+
$[3] = attach;
|
|
241
|
+
$[4] = props;
|
|
242
|
+
$[5] = t1;
|
|
170
243
|
} else {
|
|
171
|
-
|
|
244
|
+
t1 = $[5];
|
|
172
245
|
}
|
|
173
|
-
return
|
|
246
|
+
return t1;
|
|
174
247
|
}
|
|
175
248
|
function PaginationPrevious(t0) {
|
|
176
249
|
const $ = _c(13);
|
|
@@ -188,10 +261,10 @@ function PaginationPrevious(t0) {
|
|
|
188
261
|
props = $[2];
|
|
189
262
|
t1 = $[3];
|
|
190
263
|
}
|
|
191
|
-
const text = t1 === undefined ?
|
|
264
|
+
const text = t1 === undefined ? PAGINATION_DEFAULT_COPY.previousText : t1;
|
|
192
265
|
let t2;
|
|
193
266
|
if ($[4] !== className) {
|
|
194
|
-
t2 = cn("pl-2
|
|
267
|
+
t2 = cn("pl-(--space-2)", className);
|
|
195
268
|
$[4] = className;
|
|
196
269
|
$[5] = t2;
|
|
197
270
|
} else {
|
|
@@ -199,7 +272,10 @@ function PaginationPrevious(t0) {
|
|
|
199
272
|
}
|
|
200
273
|
let t3;
|
|
201
274
|
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
202
|
-
t3 = /* @__PURE__ */ _jsx(ChevronLeftIcon, {
|
|
275
|
+
t3 = /* @__PURE__ */ _jsx(ChevronLeftIcon, {
|
|
276
|
+
"data-icon": "inline-start",
|
|
277
|
+
"aria-hidden": "true"
|
|
278
|
+
});
|
|
203
279
|
$[6] = t3;
|
|
204
280
|
} else {
|
|
205
281
|
t3 = $[6];
|
|
@@ -217,9 +293,8 @@ function PaginationPrevious(t0) {
|
|
|
217
293
|
}
|
|
218
294
|
let t5;
|
|
219
295
|
if ($[9] !== props || $[10] !== t2 || $[11] !== t4) {
|
|
220
|
-
t5 = /* @__PURE__ */ _jsxs(
|
|
221
|
-
"aria-label":
|
|
222
|
-
size: "default",
|
|
296
|
+
t5 = /* @__PURE__ */ _jsxs(PaginationStep, {
|
|
297
|
+
"aria-label": PAGINATION_DEFAULT_COPY.previousLabel,
|
|
223
298
|
className: t2,
|
|
224
299
|
...props,
|
|
225
300
|
children: [t3, t4]
|
|
@@ -249,10 +324,10 @@ function PaginationNext(t0) {
|
|
|
249
324
|
props = $[2];
|
|
250
325
|
t1 = $[3];
|
|
251
326
|
}
|
|
252
|
-
const text = t1 === undefined ?
|
|
327
|
+
const text = t1 === undefined ? PAGINATION_DEFAULT_COPY.nextText : t1;
|
|
253
328
|
let t2;
|
|
254
329
|
if ($[4] !== className) {
|
|
255
|
-
t2 = cn("pr-2
|
|
330
|
+
t2 = cn("pr-(--space-2)", className);
|
|
256
331
|
$[4] = className;
|
|
257
332
|
$[5] = t2;
|
|
258
333
|
} else {
|
|
@@ -271,16 +346,18 @@ function PaginationNext(t0) {
|
|
|
271
346
|
}
|
|
272
347
|
let t4;
|
|
273
348
|
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
274
|
-
t4 = /* @__PURE__ */ _jsx(ChevronRightIcon, {
|
|
349
|
+
t4 = /* @__PURE__ */ _jsx(ChevronRightIcon, {
|
|
350
|
+
"data-icon": "inline-end",
|
|
351
|
+
"aria-hidden": "true"
|
|
352
|
+
});
|
|
275
353
|
$[8] = t4;
|
|
276
354
|
} else {
|
|
277
355
|
t4 = $[8];
|
|
278
356
|
}
|
|
279
357
|
let t5;
|
|
280
358
|
if ($[9] !== props || $[10] !== t2 || $[11] !== t3) {
|
|
281
|
-
t5 = /* @__PURE__ */ _jsxs(
|
|
282
|
-
"aria-label":
|
|
283
|
-
size: "default",
|
|
359
|
+
t5 = /* @__PURE__ */ _jsxs(PaginationStep, {
|
|
360
|
+
"aria-label": PAGINATION_DEFAULT_COPY.nextLabel,
|
|
284
361
|
className: t2,
|
|
285
362
|
...props,
|
|
286
363
|
children: [t3, t4]
|
|
@@ -309,7 +386,7 @@ function PaginationEllipsis(t0) {
|
|
|
309
386
|
}
|
|
310
387
|
let t1;
|
|
311
388
|
if ($[3] !== className) {
|
|
312
|
-
t1 = cn("flex size-
|
|
389
|
+
t1 = cn("flex size-(--control-height-sm) items-center justify-center text-text-muted [&_svg:not([class*='size-'])]:size-4", className);
|
|
313
390
|
$[3] = className;
|
|
314
391
|
$[4] = t1;
|
|
315
392
|
} else {
|
|
@@ -321,7 +398,7 @@ function PaginationEllipsis(t0) {
|
|
|
321
398
|
t2 = /* @__PURE__ */ _jsx(MoreHorizontalIcon, {});
|
|
322
399
|
t3 = /* @__PURE__ */ _jsx("span", {
|
|
323
400
|
className: "sr-only",
|
|
324
|
-
children:
|
|
401
|
+
children: PAGINATION_DEFAULT_COPY.morePages
|
|
325
402
|
});
|
|
326
403
|
$[5] = t2;
|
|
327
404
|
$[6] = t3;
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arc's Popover (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a raised panel with Arc's panel radius
|
|
3
|
+
* and floating shadow that starts a few pixels toward its trigger and settles on a spring, leaving faster than it
|
|
4
|
+
* arrives. It keeps the Radix composition and adds Arc's `PopoverClose`.
|
|
5
|
+
*/
|
|
1
6
|
import * as React from "react";
|
|
2
7
|
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
3
8
|
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
|
|
4
9
|
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
|
|
10
|
+
/** Closes the popover that contains it, such as a "Listo" or "Cancelar" button inside the panel. */
|
|
11
|
+
declare function PopoverClose({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Close>): React.JSX.Element;
|
|
5
12
|
/**
|
|
6
|
-
* Renders
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
13
|
+
* Renders Arc's panel: raised surface, hairline border, panel radius and floating shadow, kept inside the viewport.
|
|
14
|
+
* Content taller than the room left on the placed side scrolls inside the panel instead of running off screen.
|
|
15
|
+
* @param props - Radix content properties. `align` defaults to `center`, `sideOffset` to 6px and `collisionPadding`
|
|
16
|
+
* to 10px.
|
|
17
|
+
* @returns The portaled panel.
|
|
9
18
|
*/
|
|
10
|
-
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element;
|
|
19
|
+
declare function PopoverContent({ className, align, sideOffset, collisionPadding, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element;
|
|
11
20
|
declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): React.JSX.Element;
|
|
12
21
|
/**
|
|
13
22
|
* Groups popover headings with compact spacing.
|
|
@@ -17,4 +26,4 @@ declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof Popover
|
|
|
17
26
|
declare function PopoverHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
18
27
|
declare function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">): React.JSX.Element;
|
|
19
28
|
declare function PopoverDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
20
|
-
export { Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, };
|
|
29
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, };
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Arc's Popover (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a raised panel with Arc's panel radius
|
|
5
|
+
* and floating shadow that starts a few pixels toward its trigger and settles on a spring, leaving faster than it
|
|
6
|
+
* arrives. It keeps the Radix composition and adds Arc's `PopoverClose`.
|
|
7
|
+
*/
|
|
3
8
|
import * as React from "react";
|
|
4
9
|
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
5
|
-
import {
|
|
10
|
+
import { ArcFloatingSlot } from "../motion/arc-floating-slot.js";
|
|
6
11
|
import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../motion/presence.js";
|
|
7
12
|
import { cn } from "../lib/utils.js";
|
|
13
|
+
import { POPOVER_COLLISION_PADDING_PX, POPOVER_MOTION, POPOVER_SIDE_OFFSET_PX } from "../constants/popover.js";
|
|
8
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
15
|
function Popover(t0) {
|
|
10
16
|
const $ = _c(9);
|
|
@@ -70,79 +76,115 @@ function PopoverTrigger(t0) {
|
|
|
70
76
|
}
|
|
71
77
|
return t1;
|
|
72
78
|
}
|
|
79
|
+
/** Closes the popover that contains it, such as a "Listo" or "Cancelar" button inside the panel. */
|
|
80
|
+
function PopoverClose(t0) {
|
|
81
|
+
const $ = _c(4);
|
|
82
|
+
let props;
|
|
83
|
+
if ($[0] !== t0) {
|
|
84
|
+
({...props} = t0);
|
|
85
|
+
$[0] = t0;
|
|
86
|
+
$[1] = props;
|
|
87
|
+
} else {
|
|
88
|
+
props = $[1];
|
|
89
|
+
}
|
|
90
|
+
let t1;
|
|
91
|
+
if ($[2] !== props) {
|
|
92
|
+
t1 = /* @__PURE__ */ _jsx(PopoverPrimitive.Close, {
|
|
93
|
+
"data-slot": "popover-close",
|
|
94
|
+
...props
|
|
95
|
+
});
|
|
96
|
+
$[2] = props;
|
|
97
|
+
$[3] = t1;
|
|
98
|
+
} else {
|
|
99
|
+
t1 = $[3];
|
|
100
|
+
}
|
|
101
|
+
return t1;
|
|
102
|
+
}
|
|
103
|
+
/** Every popover enters and leaves on the same path. */
|
|
104
|
+
function resolvePopoverMotion() {
|
|
105
|
+
return POPOVER_MOTION;
|
|
106
|
+
}
|
|
73
107
|
/**
|
|
74
|
-
* Renders
|
|
75
|
-
*
|
|
76
|
-
* @
|
|
108
|
+
* Renders Arc's panel: raised surface, hairline border, panel radius and floating shadow, kept inside the viewport.
|
|
109
|
+
* Content taller than the room left on the placed side scrolls inside the panel instead of running off screen.
|
|
110
|
+
* @param props - Radix content properties. `align` defaults to `center`, `sideOffset` to 6px and `collisionPadding`
|
|
111
|
+
* to 10px.
|
|
112
|
+
* @returns The portaled panel.
|
|
77
113
|
*/
|
|
78
114
|
function PopoverContent(t0) {
|
|
79
|
-
const $ = _c(
|
|
115
|
+
const $ = _c(17);
|
|
80
116
|
let className;
|
|
81
117
|
let props;
|
|
82
118
|
let t1;
|
|
83
119
|
let t2;
|
|
120
|
+
let t3;
|
|
84
121
|
if ($[0] !== t0) {
|
|
85
|
-
({className, align: t1, sideOffset: t2, ...props} = t0);
|
|
122
|
+
({className, align: t1, sideOffset: t2, collisionPadding: t3, ...props} = t0);
|
|
86
123
|
$[0] = t0;
|
|
87
124
|
$[1] = className;
|
|
88
125
|
$[2] = props;
|
|
89
126
|
$[3] = t1;
|
|
90
127
|
$[4] = t2;
|
|
128
|
+
$[5] = t3;
|
|
91
129
|
} else {
|
|
92
130
|
className = $[1];
|
|
93
131
|
props = $[2];
|
|
94
132
|
t1 = $[3];
|
|
95
133
|
t2 = $[4];
|
|
134
|
+
t3 = $[5];
|
|
96
135
|
}
|
|
97
136
|
const align = t1 === undefined ? "center" : t1;
|
|
98
|
-
const sideOffset = t2 === undefined ?
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
$[6] =
|
|
137
|
+
const sideOffset = t2 === undefined ? POPOVER_SIDE_OFFSET_PX : t2;
|
|
138
|
+
const collisionPadding = t3 === undefined ? POPOVER_COLLISION_PADDING_PX : t3;
|
|
139
|
+
const t4 = props.forceMount;
|
|
140
|
+
let t5;
|
|
141
|
+
if ($[6] !== className) {
|
|
142
|
+
t5 = cn("z-50 flex max-h-(--radix-popover-content-available-height) w-72 max-w-[calc(100vw-20px)] origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 overflow-y-auto overscroll-contain *:shrink-0 rounded-(--radius-panel) border border-border bg-surface-raised p-(--space-4) text-sm leading-(--leading-body) text-foreground shadow-(--shadow-floating) outline-hidden", className);
|
|
143
|
+
$[6] = className;
|
|
144
|
+
$[7] = t5;
|
|
105
145
|
} else {
|
|
106
|
-
|
|
146
|
+
t5 = $[7];
|
|
107
147
|
}
|
|
108
|
-
let
|
|
109
|
-
if ($[
|
|
110
|
-
|
|
111
|
-
|
|
148
|
+
let t6;
|
|
149
|
+
if ($[8] !== align || $[9] !== collisionPadding || $[10] !== props || $[11] !== sideOffset || $[12] !== t5) {
|
|
150
|
+
t6 = /* @__PURE__ */ _jsx(ArcFloatingSlot, {
|
|
151
|
+
motion: resolvePopoverMotion,
|
|
112
152
|
children: /* @__PURE__ */ _jsx(PopoverPrimitive.Content, {
|
|
113
153
|
forceMount: true,
|
|
114
154
|
"data-slot": "popover-content",
|
|
115
155
|
align,
|
|
116
156
|
sideOffset,
|
|
117
|
-
|
|
157
|
+
collisionPadding,
|
|
158
|
+
className: t5,
|
|
118
159
|
...props
|
|
119
160
|
})
|
|
120
161
|
});
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
162
|
+
$[8] = align;
|
|
163
|
+
$[9] = collisionPadding;
|
|
164
|
+
$[10] = props;
|
|
165
|
+
$[11] = sideOffset;
|
|
166
|
+
$[12] = t5;
|
|
167
|
+
$[13] = t6;
|
|
126
168
|
} else {
|
|
127
|
-
|
|
169
|
+
t6 = $[13];
|
|
128
170
|
}
|
|
129
|
-
let
|
|
130
|
-
if ($[
|
|
131
|
-
|
|
171
|
+
let t7;
|
|
172
|
+
if ($[14] !== props.forceMount || $[15] !== t6) {
|
|
173
|
+
t7 = /* @__PURE__ */ _jsx(PopoverPrimitive.Portal, {
|
|
132
174
|
forceMount: true,
|
|
133
175
|
children: /* @__PURE__ */ _jsx(MotionPresence, {
|
|
134
176
|
scope: "popover",
|
|
135
|
-
forceMount:
|
|
136
|
-
children:
|
|
177
|
+
forceMount: t4,
|
|
178
|
+
children: t6
|
|
137
179
|
})
|
|
138
180
|
});
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
181
|
+
$[14] = props.forceMount;
|
|
182
|
+
$[15] = t6;
|
|
183
|
+
$[16] = t7;
|
|
142
184
|
} else {
|
|
143
|
-
|
|
185
|
+
t7 = $[16];
|
|
144
186
|
}
|
|
145
|
-
return
|
|
187
|
+
return t7;
|
|
146
188
|
}
|
|
147
189
|
function PopoverAnchor(t0) {
|
|
148
190
|
const $ = _c(4);
|
|
@@ -280,4 +322,4 @@ function PopoverDescription(t0) {
|
|
|
280
322
|
}
|
|
281
323
|
return t2;
|
|
282
324
|
}
|
|
283
|
-
export { Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger };
|
|
325
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger };
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
2
|
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Hosts the radios, controlled or uncontrolled like Radix's radio group, and moves the highlight of option rows.
|
|
5
|
+
* @param radioGroupProps - Every Radix radio group prop, including `ref`.
|
|
6
|
+
* @returns The radio group.
|
|
7
|
+
*/
|
|
8
|
+
declare function RadioGroup({ className, children, value, defaultValue, onValueChange, ref, asChild, ...props }: ComponentProps<typeof RadioGroupPrimitive.Root>): import("react").JSX.Element;
|
|
9
|
+
export type RadioGroupItemProps = ComponentProps<typeof RadioGroupPrimitive.Item> & {
|
|
10
|
+
/** Visible option label: turns the item into Arc's option row, which also names the radio. */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** Helper copy under the label, linked through `aria-describedby`. Shown only with a `label`. */
|
|
13
|
+
description?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* One radio of the group: a bare mark, or Arc's option row when it receives a `label`.
|
|
17
|
+
* @param radioGroupItemProps - Every Radix radio item prop, including `ref`, plus optional Arc `label` and `description`.
|
|
18
|
+
* @returns The radio, wrapped in its option row when it has a label.
|
|
19
|
+
*/
|
|
20
|
+
declare function RadioGroupItem({ className, label, description, id, value, ...props }: RadioGroupItemProps): import("react").JSX.Element;
|
|
5
21
|
export { RadioGroup, RadioGroupItem };
|