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
|
@@ -2,564 +2,319 @@
|
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
/**
|
|
4
4
|
* Arc's Dialog (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a focused surface for decisions that need
|
|
5
|
-
* attention
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* attention. Arc's API (`Dialog`, `DialogTrigger`, `DialogContent` with its `title`, `description` and built-in close
|
|
6
|
+
* button, `DialogClose`) on Arc's overlay, raised panel, text swap and dialog transition. beez-ui
|
|
7
|
+
* extends it with a footer slot, a hidden title, the viewport close button placement, Spanish copy and an `alert` mode
|
|
8
|
+
* that replaces the former `AlertDialog`.
|
|
9
9
|
*/
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import { MotionSlot } from "../motion/motion-slot.js";
|
|
13
|
-
import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../motion/presence.js";
|
|
10
|
+
import { createContext, useContext } from "react";
|
|
11
|
+
import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
|
|
14
12
|
import { cn } from "../lib/utils.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { ControlButton } from "./control-button.js";
|
|
18
|
-
import { XIcon } from "lucide-react";
|
|
19
|
-
import { withDialogSwapText, dialogCloseButtonClassName, dialogDescriptionClassName, dialogFooterClassName, dialogOverlayClassName, dialogSurfaceClassName, dialogTitleClassName } from "./dialog-surface.js";
|
|
13
|
+
import { AlertDialog as AlertDialogRoot, AlertDialogContent as AlertDialogContentPrimitive, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "./primitives/alert-dialog.js";
|
|
14
|
+
import { Dialog as DialogRoot, DialogClose as DialogClosePrimitive, DialogContent as DialogContentPrimitive, DialogDescription as DialogDescriptionPrimitive, DialogFooter as DialogFooterPrimitive, DialogHeader as DialogHeaderPrimitive, DialogTitle as DialogTitlePrimitive, DialogTrigger as DialogTriggerPrimitive } from "./primitives/dialog.js";
|
|
20
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
/** Marks the consumer's close controls, so an alert dialog can focus the first one when it opens. */
|
|
17
|
+
const DIALOG_CLOSE_ACTION_ATTRIBUTE = "data-dialog-close-action";
|
|
18
|
+
/** Whether the surrounding `Dialog` runs in `alert` mode. */
|
|
19
|
+
const DialogAlertContext = createContext(false);
|
|
20
|
+
/**
|
|
21
|
+
* Root that tracks the open state so the content can animate out. Controlled (`open`, `onOpenChange`) or uncontrolled
|
|
22
|
+
* (`defaultOpen`).
|
|
23
|
+
* @param props - Radix root props and `alert`.
|
|
24
|
+
* @returns The dialog root.
|
|
25
|
+
*/
|
|
21
26
|
function Dialog(t0) {
|
|
22
|
-
const $ = _c(
|
|
27
|
+
const $ = _c(11);
|
|
28
|
+
let modal;
|
|
23
29
|
let props;
|
|
24
|
-
if ($[0] !== t0) {
|
|
25
|
-
({...props} = t0);
|
|
26
|
-
$[0] = t0;
|
|
27
|
-
$[1] = props;
|
|
28
|
-
} else {
|
|
29
|
-
props = $[1];
|
|
30
|
-
}
|
|
31
|
-
const [motionOpen, setMotionOpen] = useMotionOpenState(props);
|
|
32
30
|
let t1;
|
|
33
|
-
if ($[2] !== motionOpen || $[3] !== props || $[4] !== setMotionOpen) {
|
|
34
|
-
t1 = /* @__PURE__ */ _jsx(DialogPrimitive.Root, {
|
|
35
|
-
"data-slot": "dialog",
|
|
36
|
-
...props,
|
|
37
|
-
open: motionOpen,
|
|
38
|
-
onOpenChange: setMotionOpen
|
|
39
|
-
});
|
|
40
|
-
$[2] = motionOpen;
|
|
41
|
-
$[3] = props;
|
|
42
|
-
$[4] = setMotionOpen;
|
|
43
|
-
$[5] = t1;
|
|
44
|
-
} else {
|
|
45
|
-
t1 = $[5];
|
|
46
|
-
}
|
|
47
|
-
let t2;
|
|
48
|
-
if ($[6] !== motionOpen || $[7] !== t1) {
|
|
49
|
-
t2 = /* @__PURE__ */ _jsx(MotionOpenProvider, {
|
|
50
|
-
scope: "dialog",
|
|
51
|
-
open: motionOpen,
|
|
52
|
-
children: t1
|
|
53
|
-
});
|
|
54
|
-
$[6] = motionOpen;
|
|
55
|
-
$[7] = t1;
|
|
56
|
-
$[8] = t2;
|
|
57
|
-
} else {
|
|
58
|
-
t2 = $[8];
|
|
59
|
-
}
|
|
60
|
-
return t2;
|
|
61
|
-
}
|
|
62
|
-
function DialogTrigger(t0) {
|
|
63
|
-
const $ = _c(4);
|
|
64
|
-
let props;
|
|
65
31
|
if ($[0] !== t0) {
|
|
66
|
-
({...props} = t0);
|
|
32
|
+
({alert: t1, modal, ...props} = t0);
|
|
67
33
|
$[0] = t0;
|
|
68
|
-
$[1] =
|
|
69
|
-
} else {
|
|
70
|
-
props = $[1];
|
|
71
|
-
}
|
|
72
|
-
let t1;
|
|
73
|
-
if ($[2] !== props) {
|
|
74
|
-
t1 = /* @__PURE__ */ _jsx(DialogPrimitive.Trigger, {
|
|
75
|
-
"data-slot": "dialog-trigger",
|
|
76
|
-
...props
|
|
77
|
-
});
|
|
34
|
+
$[1] = modal;
|
|
78
35
|
$[2] = props;
|
|
79
36
|
$[3] = t1;
|
|
80
37
|
} else {
|
|
38
|
+
modal = $[1];
|
|
39
|
+
props = $[2];
|
|
81
40
|
t1 = $[3];
|
|
82
41
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if ($[0] !== t0) {
|
|
89
|
-
({...props} = t0);
|
|
90
|
-
$[0] = t0;
|
|
91
|
-
$[1] = props;
|
|
92
|
-
} else {
|
|
93
|
-
props = $[1];
|
|
94
|
-
}
|
|
95
|
-
let t1;
|
|
96
|
-
if ($[2] !== props) {
|
|
97
|
-
t1 = /* @__PURE__ */ _jsx(DialogPrimitive.Portal, {
|
|
98
|
-
"data-slot": "dialog-portal",
|
|
42
|
+
const alert = t1 === undefined ? false : t1;
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[4] !== alert || $[5] !== modal || $[6] !== props) {
|
|
45
|
+
t2 = alert ? /* @__PURE__ */ _jsx(AlertDialogRoot, { ...props }) : /* @__PURE__ */ _jsx(DialogRoot, {
|
|
46
|
+
modal,
|
|
99
47
|
...props
|
|
100
48
|
});
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
return t1;
|
|
107
|
-
}
|
|
108
|
-
function DialogClose(t0) {
|
|
109
|
-
const $ = _c(4);
|
|
110
|
-
let props;
|
|
111
|
-
if ($[0] !== t0) {
|
|
112
|
-
({...props} = t0);
|
|
113
|
-
$[0] = t0;
|
|
114
|
-
$[1] = props;
|
|
49
|
+
$[4] = alert;
|
|
50
|
+
$[5] = modal;
|
|
51
|
+
$[6] = props;
|
|
52
|
+
$[7] = t2;
|
|
115
53
|
} else {
|
|
116
|
-
|
|
54
|
+
t2 = $[7];
|
|
117
55
|
}
|
|
118
|
-
let
|
|
119
|
-
if ($[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
56
|
+
let t3;
|
|
57
|
+
if ($[8] !== alert || $[9] !== t2) {
|
|
58
|
+
t3 = /* @__PURE__ */ _jsx(DialogAlertContext.Provider, {
|
|
59
|
+
value: alert,
|
|
60
|
+
children: t2
|
|
123
61
|
});
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
62
|
+
$[8] = alert;
|
|
63
|
+
$[9] = t2;
|
|
64
|
+
$[10] = t3;
|
|
126
65
|
} else {
|
|
127
|
-
|
|
66
|
+
t3 = $[10];
|
|
128
67
|
}
|
|
129
|
-
return
|
|
68
|
+
return t3;
|
|
130
69
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
$[1] = className;
|
|
139
|
-
$[2] = props;
|
|
140
|
-
} else {
|
|
141
|
-
className = $[1];
|
|
142
|
-
props = $[2];
|
|
143
|
-
}
|
|
144
|
-
let t1;
|
|
145
|
-
if ($[3] !== className) {
|
|
146
|
-
t1 = cn(dialogOverlayClassName, className);
|
|
147
|
-
$[3] = className;
|
|
148
|
-
$[4] = t1;
|
|
149
|
-
} else {
|
|
150
|
-
t1 = $[4];
|
|
151
|
-
}
|
|
152
|
-
let t2;
|
|
153
|
-
if ($[5] !== props || $[6] !== t1) {
|
|
154
|
-
t2 = /* @__PURE__ */ _jsx(DialogPrimitive.Overlay, {
|
|
155
|
-
"data-slot": "dialog-overlay",
|
|
156
|
-
className: t1,
|
|
157
|
-
...props
|
|
158
|
-
});
|
|
159
|
-
$[5] = props;
|
|
160
|
-
$[6] = t1;
|
|
161
|
-
$[7] = t2;
|
|
162
|
-
} else {
|
|
163
|
-
t2 = $[7];
|
|
164
|
-
}
|
|
165
|
-
return t2;
|
|
70
|
+
/**
|
|
71
|
+
* Opens the dialog. Use `asChild` to render your own button.
|
|
72
|
+
* @param props - Radix trigger props.
|
|
73
|
+
* @returns The trigger.
|
|
74
|
+
*/
|
|
75
|
+
function DialogTrigger(props) {
|
|
76
|
+
return useContext(DialogAlertContext) ? /* @__PURE__ */ _jsx(AlertDialogTrigger, { ...props }) : /* @__PURE__ */ _jsx(DialogTriggerPrimitive, { ...props });
|
|
166
77
|
}
|
|
167
78
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* keyboard can never land on a control that cannot be seen.
|
|
173
|
-
* @returns The close control for wide layouts that keep the panel clear of controls.
|
|
79
|
+
* Closes the dialog from a custom control, such as a cancel button. In `alert` mode it cancels the confirmation, and
|
|
80
|
+
* the first one receives the focus when the dialog opens.
|
|
81
|
+
* @param props - Radix close props.
|
|
82
|
+
* @returns The close control.
|
|
174
83
|
*/
|
|
175
|
-
function
|
|
176
|
-
const $ = _c(
|
|
84
|
+
function DialogClose(props) {
|
|
85
|
+
const $ = _c(1);
|
|
177
86
|
let t0;
|
|
178
87
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
179
|
-
t0 =
|
|
88
|
+
t0 = { [DIALOG_CLOSE_ACTION_ATTRIBUTE]: "" };
|
|
180
89
|
$[0] = t0;
|
|
181
90
|
} else {
|
|
182
91
|
t0 = $[0];
|
|
183
92
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
children: [/* @__PURE__ */ _jsx(XIcon, {}), /* @__PURE__ */ _jsx("span", {
|
|
194
|
-
className: "sr-only",
|
|
195
|
-
children: "Cerrar"
|
|
196
|
-
})]
|
|
197
|
-
})
|
|
198
|
-
});
|
|
199
|
-
$[1] = t1;
|
|
200
|
-
} else {
|
|
201
|
-
t1 = $[1];
|
|
202
|
-
}
|
|
203
|
-
return t1;
|
|
93
|
+
const closeActionProps = t0;
|
|
94
|
+
return useContext(DialogAlertContext) ? /* @__PURE__ */ _jsx(AlertDialogPrimitive.Cancel, {
|
|
95
|
+
"data-slot": "dialog-close",
|
|
96
|
+
...closeActionProps,
|
|
97
|
+
...props
|
|
98
|
+
}) : /* @__PURE__ */ _jsx(DialogClosePrimitive, {
|
|
99
|
+
...closeActionProps,
|
|
100
|
+
...props
|
|
101
|
+
});
|
|
204
102
|
}
|
|
205
103
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
104
|
+
* Focuses the first consumer close control of an alert dialog when it opens, or the panel when there is none.
|
|
105
|
+
* @param event - Radix's open auto-focus event, already handed to the consumer's handler.
|
|
106
|
+
*/
|
|
107
|
+
function focusFirstCloseAction(event) {
|
|
108
|
+
if (event.defaultPrevented) return;
|
|
109
|
+
const panel = event.currentTarget ?? event.target;
|
|
110
|
+
if (!(panel instanceof HTMLElement)) return;
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
const firstCloseAction = panel.querySelector(`[${DIALOG_CLOSE_ACTION_ATTRIBUTE}]`);
|
|
113
|
+
(firstCloseAction ?? panel).focus({ preventScroll: true });
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The portaled overlay and panel with a titled header, the body, an optional footer and the built-in close button.
|
|
117
|
+
* @param props - Title, header content, description, body, footer, close button options and ref, part classes and
|
|
118
|
+
* Radix content props.
|
|
119
|
+
* @returns The dialog panel.
|
|
213
120
|
*/
|
|
214
121
|
function DialogContent(t0) {
|
|
215
|
-
const $ = _c(
|
|
122
|
+
const $ = _c(60);
|
|
216
123
|
let children;
|
|
217
|
-
let
|
|
124
|
+
let closeButtonRef;
|
|
125
|
+
let closeLabel;
|
|
126
|
+
let description;
|
|
127
|
+
let descriptionClassName;
|
|
128
|
+
let footer;
|
|
129
|
+
let footerClassName;
|
|
130
|
+
let headerClassName;
|
|
131
|
+
let headerContent;
|
|
132
|
+
let onOpenAutoFocus;
|
|
218
133
|
let props;
|
|
134
|
+
let showCloseButton;
|
|
219
135
|
let t1;
|
|
220
136
|
let t2;
|
|
137
|
+
let title;
|
|
138
|
+
let titleClassName;
|
|
221
139
|
if ($[0] !== t0) {
|
|
222
|
-
({
|
|
140
|
+
({title, description, children, footer, hideTitle: t1, showCloseButton, closeButtonPlacement: t2, closeLabel, closeButtonRef, headerContent, headerClassName, titleClassName, descriptionClassName, footerClassName, onOpenAutoFocus, ...props} = t0);
|
|
223
141
|
$[0] = t0;
|
|
224
142
|
$[1] = children;
|
|
225
|
-
$[2] =
|
|
226
|
-
$[3] =
|
|
227
|
-
$[4] =
|
|
228
|
-
$[5] =
|
|
143
|
+
$[2] = closeButtonRef;
|
|
144
|
+
$[3] = closeLabel;
|
|
145
|
+
$[4] = description;
|
|
146
|
+
$[5] = descriptionClassName;
|
|
147
|
+
$[6] = footer;
|
|
148
|
+
$[7] = footerClassName;
|
|
149
|
+
$[8] = headerClassName;
|
|
150
|
+
$[9] = headerContent;
|
|
151
|
+
$[10] = onOpenAutoFocus;
|
|
152
|
+
$[11] = props;
|
|
153
|
+
$[12] = showCloseButton;
|
|
154
|
+
$[13] = t1;
|
|
155
|
+
$[14] = t2;
|
|
156
|
+
$[15] = title;
|
|
157
|
+
$[16] = titleClassName;
|
|
229
158
|
} else {
|
|
230
159
|
children = $[1];
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
160
|
+
closeButtonRef = $[2];
|
|
161
|
+
closeLabel = $[3];
|
|
162
|
+
description = $[4];
|
|
163
|
+
descriptionClassName = $[5];
|
|
164
|
+
footer = $[6];
|
|
165
|
+
footerClassName = $[7];
|
|
166
|
+
headerClassName = $[8];
|
|
167
|
+
headerContent = $[9];
|
|
168
|
+
onOpenAutoFocus = $[10];
|
|
169
|
+
props = $[11];
|
|
170
|
+
showCloseButton = $[12];
|
|
171
|
+
t1 = $[13];
|
|
172
|
+
t2 = $[14];
|
|
173
|
+
title = $[15];
|
|
174
|
+
titleClassName = $[16];
|
|
175
|
+
}
|
|
176
|
+
const hideTitle = t1 === undefined ? false : t1;
|
|
237
177
|
const closeButtonPlacement = t2 === undefined ? "content" : t2;
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
178
|
+
const alert = useContext(DialogAlertContext);
|
|
179
|
+
const Content = alert ? AlertDialogContentPrimitive : DialogContentPrimitive;
|
|
180
|
+
const Header = alert ? AlertDialogHeader : DialogHeaderPrimitive;
|
|
181
|
+
const Title = alert ? AlertDialogTitle : DialogTitlePrimitive;
|
|
182
|
+
const Description = alert ? AlertDialogDescription : DialogDescriptionPrimitive;
|
|
183
|
+
const Footer = alert ? AlertDialogFooter : DialogFooterPrimitive;
|
|
184
|
+
const hasDescription = description !== undefined && description !== null && description !== false;
|
|
185
|
+
const hasHeaderContent = headerContent !== undefined && headerContent !== null && headerContent !== false;
|
|
186
|
+
let t3;
|
|
187
|
+
if ($[17] !== hasDescription || $[18] !== props) {
|
|
188
|
+
t3 = hasDescription || "aria-describedby" in props ? {} : { "aria-describedby": undefined };
|
|
189
|
+
$[17] = hasDescription;
|
|
190
|
+
$[18] = props;
|
|
191
|
+
$[19] = t3;
|
|
192
|
+
} else {
|
|
193
|
+
t3 = $[19];
|
|
194
|
+
}
|
|
195
|
+
const describedBy = t3;
|
|
196
|
+
const t4 = hideTitle && "sr-only";
|
|
197
|
+
let t5;
|
|
198
|
+
if ($[20] !== t4 || $[21] !== titleClassName) {
|
|
199
|
+
t5 = cn(t4, titleClassName);
|
|
200
|
+
$[20] = t4;
|
|
201
|
+
$[21] = titleClassName;
|
|
202
|
+
$[22] = t5;
|
|
203
|
+
} else {
|
|
204
|
+
t5 = $[22];
|
|
205
|
+
}
|
|
206
|
+
let t6;
|
|
207
|
+
if ($[23] !== Title || $[24] !== t5 || $[25] !== title) {
|
|
208
|
+
t6 = /* @__PURE__ */ _jsx(Title, {
|
|
209
|
+
className: t5,
|
|
210
|
+
children: title
|
|
244
211
|
});
|
|
245
|
-
$[
|
|
212
|
+
$[23] = Title;
|
|
213
|
+
$[24] = t5;
|
|
214
|
+
$[25] = title;
|
|
215
|
+
$[26] = t6;
|
|
246
216
|
} else {
|
|
247
|
-
|
|
217
|
+
t6 = $[26];
|
|
248
218
|
}
|
|
249
|
-
const
|
|
250
|
-
const t6 = closeButtonPlacement === "viewport" ? "inset-0 m-auto h-fit" : "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2";
|
|
219
|
+
const titleElement = t6;
|
|
251
220
|
let t7;
|
|
252
|
-
if ($[
|
|
253
|
-
t7 =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
$[
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
221
|
+
if ($[27] !== Description || $[28] !== description || $[29] !== descriptionClassName || $[30] !== hasDescription) {
|
|
222
|
+
t7 = hasDescription ? /* @__PURE__ */ _jsx(Description, {
|
|
223
|
+
className: descriptionClassName,
|
|
224
|
+
children: description
|
|
225
|
+
}) : null;
|
|
226
|
+
$[27] = Description;
|
|
227
|
+
$[28] = description;
|
|
228
|
+
$[29] = descriptionClassName;
|
|
229
|
+
$[30] = hasDescription;
|
|
230
|
+
$[31] = t7;
|
|
231
|
+
} else {
|
|
232
|
+
t7 = $[31];
|
|
233
|
+
}
|
|
234
|
+
const descriptionElement = t7;
|
|
235
|
+
const t8 = showCloseButton ?? !alert;
|
|
268
236
|
let t9;
|
|
269
|
-
if ($[
|
|
270
|
-
t9 =
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
kind: "delayed-pop",
|
|
284
|
-
children: /* @__PURE__ */ _jsxs(ControlButton, {
|
|
285
|
-
variant: "ghost",
|
|
286
|
-
className: cn(dialogCloseButtonClassName, "absolute top-[calc(var(--space-6)+(var(--text-lg)*var(--leading-body)-var(--space-8))/2)] right-(--space-6)"),
|
|
287
|
-
size: "icon-sm",
|
|
288
|
-
children: [/* @__PURE__ */ _jsx(XIcon, {}), /* @__PURE__ */ _jsx("span", {
|
|
289
|
-
className: "sr-only",
|
|
290
|
-
children: "Cerrar"
|
|
291
|
-
})]
|
|
292
|
-
})
|
|
293
|
-
})
|
|
294
|
-
});
|
|
295
|
-
$[15] = closeButtonPlacement;
|
|
296
|
-
$[16] = showCloseButton;
|
|
297
|
-
$[17] = t10;
|
|
298
|
-
} else {
|
|
299
|
-
t10 = $[17];
|
|
300
|
-
}
|
|
237
|
+
if ($[32] !== alert || $[33] !== onOpenAutoFocus) {
|
|
238
|
+
t9 = (event) => {
|
|
239
|
+
onOpenAutoFocus?.(event);
|
|
240
|
+
if (alert) {
|
|
241
|
+
focusFirstCloseAction(event);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
$[32] = alert;
|
|
245
|
+
$[33] = onOpenAutoFocus;
|
|
246
|
+
$[34] = t9;
|
|
247
|
+
} else {
|
|
248
|
+
t9 = $[34];
|
|
249
|
+
}
|
|
250
|
+
const t10 = hideTitle ? titleElement : null;
|
|
301
251
|
let t11;
|
|
302
|
-
if ($[
|
|
303
|
-
t11 =
|
|
304
|
-
|
|
305
|
-
children:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
$[
|
|
321
|
-
$[20] = t10;
|
|
322
|
-
$[21] = t5;
|
|
323
|
-
$[22] = t7;
|
|
324
|
-
$[23] = t8;
|
|
325
|
-
$[24] = t9;
|
|
326
|
-
$[25] = t11;
|
|
327
|
-
} else {
|
|
328
|
-
t11 = $[25];
|
|
252
|
+
if ($[35] !== Header || $[36] !== descriptionElement || $[37] !== hasHeaderContent || $[38] !== headerClassName || $[39] !== headerContent || $[40] !== hideTitle || $[41] !== titleElement) {
|
|
253
|
+
t11 = !hideTitle || descriptionElement || hasHeaderContent ? /* @__PURE__ */ _jsxs(Header, {
|
|
254
|
+
className: headerClassName,
|
|
255
|
+
children: [
|
|
256
|
+
hideTitle ? null : titleElement,
|
|
257
|
+
hasHeaderContent ? headerContent : null,
|
|
258
|
+
descriptionElement
|
|
259
|
+
]
|
|
260
|
+
}) : null;
|
|
261
|
+
$[35] = Header;
|
|
262
|
+
$[36] = descriptionElement;
|
|
263
|
+
$[37] = hasHeaderContent;
|
|
264
|
+
$[38] = headerClassName;
|
|
265
|
+
$[39] = headerContent;
|
|
266
|
+
$[40] = hideTitle;
|
|
267
|
+
$[41] = titleElement;
|
|
268
|
+
$[42] = t11;
|
|
269
|
+
} else {
|
|
270
|
+
t11 = $[42];
|
|
329
271
|
}
|
|
330
272
|
let t12;
|
|
331
|
-
if ($[
|
|
332
|
-
t12 = /* @__PURE__ */ _jsx(
|
|
333
|
-
|
|
334
|
-
children:
|
|
335
|
-
scope: "dialog",
|
|
336
|
-
forceMount: t3,
|
|
337
|
-
children: t11
|
|
338
|
-
})
|
|
339
|
-
});
|
|
340
|
-
$[26] = props.forceMount;
|
|
341
|
-
$[27] = t11;
|
|
342
|
-
$[28] = t12;
|
|
343
|
-
} else {
|
|
344
|
-
t12 = $[28];
|
|
345
|
-
}
|
|
346
|
-
return t12;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Stacks the title and description. While the panel shows its own close button, the header keeps Arc's gap to it so
|
|
350
|
-
* long copy never runs under the button.
|
|
351
|
-
* @param props - Native div properties and optional consumer overrides.
|
|
352
|
-
* @returns The header block.
|
|
353
|
-
*/
|
|
354
|
-
function DialogHeader(t0) {
|
|
355
|
-
const $ = _c(8);
|
|
356
|
-
let className;
|
|
357
|
-
let props;
|
|
358
|
-
if ($[0] !== t0) {
|
|
359
|
-
({className, ...props} = t0);
|
|
360
|
-
$[0] = t0;
|
|
361
|
-
$[1] = className;
|
|
362
|
-
$[2] = props;
|
|
363
|
-
} else {
|
|
364
|
-
className = $[1];
|
|
365
|
-
props = $[2];
|
|
366
|
-
}
|
|
367
|
-
let t1;
|
|
368
|
-
if ($[3] !== className) {
|
|
369
|
-
t1 = cn("flex flex-col gap-(--space-2) in-data-[close-button-placement=content]:pr-[calc(var(--space-8)+var(--space-5))]", className);
|
|
370
|
-
$[3] = className;
|
|
371
|
-
$[4] = t1;
|
|
372
|
-
} else {
|
|
373
|
-
t1 = $[4];
|
|
374
|
-
}
|
|
375
|
-
let t2;
|
|
376
|
-
if ($[5] !== props || $[6] !== t1) {
|
|
377
|
-
t2 = /* @__PURE__ */ _jsx("div", {
|
|
378
|
-
"data-slot": "dialog-header",
|
|
379
|
-
className: t1,
|
|
380
|
-
...props
|
|
381
|
-
});
|
|
382
|
-
$[5] = props;
|
|
383
|
-
$[6] = t1;
|
|
384
|
-
$[7] = t2;
|
|
385
|
-
} else {
|
|
386
|
-
t2 = $[7];
|
|
387
|
-
}
|
|
388
|
-
return t2;
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Separates dialog actions with an edge-to-edge footer under a hairline, bleeding through the panel padding.
|
|
392
|
-
* @param props - Primitive properties and optional consumer overrides.
|
|
393
|
-
* @returns The styled primitive with its original interaction contract.
|
|
394
|
-
*/
|
|
395
|
-
function DialogFooter(t0) {
|
|
396
|
-
const $ = _c(14);
|
|
397
|
-
let children;
|
|
398
|
-
let className;
|
|
399
|
-
let props;
|
|
400
|
-
let t1;
|
|
401
|
-
if ($[0] !== t0) {
|
|
402
|
-
({className, showCloseButton: t1, children, ...props} = t0);
|
|
403
|
-
$[0] = t0;
|
|
404
|
-
$[1] = children;
|
|
405
|
-
$[2] = className;
|
|
406
|
-
$[3] = props;
|
|
407
|
-
$[4] = t1;
|
|
408
|
-
} else {
|
|
409
|
-
children = $[1];
|
|
410
|
-
className = $[2];
|
|
411
|
-
props = $[3];
|
|
412
|
-
t1 = $[4];
|
|
413
|
-
}
|
|
414
|
-
const showCloseButton = t1 === undefined ? false : t1;
|
|
415
|
-
let t2;
|
|
416
|
-
if ($[5] !== className) {
|
|
417
|
-
t2 = cn(dialogFooterClassName, className);
|
|
418
|
-
$[5] = className;
|
|
419
|
-
$[6] = t2;
|
|
420
|
-
} else {
|
|
421
|
-
t2 = $[6];
|
|
422
|
-
}
|
|
423
|
-
let t3;
|
|
424
|
-
if ($[7] !== showCloseButton) {
|
|
425
|
-
t3 = showCloseButton && /* @__PURE__ */ _jsx(DialogPrimitive.Close, {
|
|
426
|
-
asChild: true,
|
|
427
|
-
children: /* @__PURE__ */ _jsx(Button, {
|
|
428
|
-
variant: "secondary",
|
|
429
|
-
children: "Cerrar"
|
|
430
|
-
})
|
|
431
|
-
});
|
|
432
|
-
$[7] = showCloseButton;
|
|
433
|
-
$[8] = t3;
|
|
434
|
-
} else {
|
|
435
|
-
t3 = $[8];
|
|
436
|
-
}
|
|
437
|
-
let t4;
|
|
438
|
-
if ($[9] !== children || $[10] !== props || $[11] !== t2 || $[12] !== t3) {
|
|
439
|
-
t4 = /* @__PURE__ */ _jsxs("div", {
|
|
440
|
-
"data-slot": "dialog-footer",
|
|
441
|
-
className: t2,
|
|
442
|
-
...props,
|
|
443
|
-
children: [children, t3]
|
|
444
|
-
});
|
|
445
|
-
$[9] = children;
|
|
446
|
-
$[10] = props;
|
|
447
|
-
$[11] = t2;
|
|
448
|
-
$[12] = t3;
|
|
449
|
-
$[13] = t4;
|
|
450
|
-
} else {
|
|
451
|
-
t4 = $[13];
|
|
452
|
-
}
|
|
453
|
-
return t4;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Renders the dialog heading in Arc's title type. Plain text that changes while open swaps with Arc's rise.
|
|
457
|
-
* @param props - Primitive properties and optional consumer overrides.
|
|
458
|
-
* @returns The styled primitive with its original interaction contract.
|
|
459
|
-
*/
|
|
460
|
-
function DialogTitle(t0) {
|
|
461
|
-
const $ = _c(13);
|
|
462
|
-
let children;
|
|
463
|
-
let className;
|
|
464
|
-
let props;
|
|
465
|
-
if ($[0] !== t0) {
|
|
466
|
-
({className, children, ...props} = t0);
|
|
467
|
-
$[0] = t0;
|
|
468
|
-
$[1] = children;
|
|
469
|
-
$[2] = className;
|
|
470
|
-
$[3] = props;
|
|
471
|
-
} else {
|
|
472
|
-
children = $[1];
|
|
473
|
-
className = $[2];
|
|
474
|
-
props = $[3];
|
|
475
|
-
}
|
|
476
|
-
let t1;
|
|
477
|
-
if ($[4] !== className) {
|
|
478
|
-
t1 = cn(dialogTitleClassName, className);
|
|
479
|
-
$[4] = className;
|
|
480
|
-
$[5] = t1;
|
|
481
|
-
} else {
|
|
482
|
-
t1 = $[5];
|
|
483
|
-
}
|
|
484
|
-
let t2;
|
|
485
|
-
if ($[6] !== children || $[7] !== props.asChild) {
|
|
486
|
-
t2 = withDialogSwapText(children, props.asChild);
|
|
487
|
-
$[6] = children;
|
|
488
|
-
$[7] = props.asChild;
|
|
489
|
-
$[8] = t2;
|
|
490
|
-
} else {
|
|
491
|
-
t2 = $[8];
|
|
492
|
-
}
|
|
493
|
-
let t3;
|
|
494
|
-
if ($[9] !== props || $[10] !== t1 || $[11] !== t2) {
|
|
495
|
-
t3 = /* @__PURE__ */ _jsx(DialogPrimitive.Title, {
|
|
496
|
-
"data-slot": "dialog-title",
|
|
497
|
-
className: t1,
|
|
498
|
-
...props,
|
|
499
|
-
children: t2
|
|
273
|
+
if ($[43] !== Footer || $[44] !== footer || $[45] !== footerClassName) {
|
|
274
|
+
t12 = footer === undefined || footer === null || footer === false ? null : /* @__PURE__ */ _jsx(Footer, {
|
|
275
|
+
className: footerClassName,
|
|
276
|
+
children: footer
|
|
500
277
|
});
|
|
501
|
-
$[
|
|
502
|
-
$[
|
|
503
|
-
$[
|
|
504
|
-
$[
|
|
505
|
-
} else {
|
|
506
|
-
t3 = $[12];
|
|
507
|
-
}
|
|
508
|
-
return t3;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Renders the dialog description in Arc's secondary text. Plain text that changes while open swaps with Arc's rise.
|
|
512
|
-
* @param props - Primitive properties and optional consumer overrides.
|
|
513
|
-
* @returns The styled primitive with its original interaction contract.
|
|
514
|
-
*/
|
|
515
|
-
function DialogDescription(t0) {
|
|
516
|
-
const $ = _c(13);
|
|
517
|
-
let children;
|
|
518
|
-
let className;
|
|
519
|
-
let props;
|
|
520
|
-
if ($[0] !== t0) {
|
|
521
|
-
({className, children, ...props} = t0);
|
|
522
|
-
$[0] = t0;
|
|
523
|
-
$[1] = children;
|
|
524
|
-
$[2] = className;
|
|
525
|
-
$[3] = props;
|
|
526
|
-
} else {
|
|
527
|
-
children = $[1];
|
|
528
|
-
className = $[2];
|
|
529
|
-
props = $[3];
|
|
530
|
-
}
|
|
531
|
-
let t1;
|
|
532
|
-
if ($[4] !== className) {
|
|
533
|
-
t1 = cn(dialogDescriptionClassName, className);
|
|
534
|
-
$[4] = className;
|
|
535
|
-
$[5] = t1;
|
|
536
|
-
} else {
|
|
537
|
-
t1 = $[5];
|
|
538
|
-
}
|
|
539
|
-
let t2;
|
|
540
|
-
if ($[6] !== children || $[7] !== props.asChild) {
|
|
541
|
-
t2 = withDialogSwapText(children, props.asChild);
|
|
542
|
-
$[6] = children;
|
|
543
|
-
$[7] = props.asChild;
|
|
544
|
-
$[8] = t2;
|
|
278
|
+
$[43] = Footer;
|
|
279
|
+
$[44] = footer;
|
|
280
|
+
$[45] = footerClassName;
|
|
281
|
+
$[46] = t12;
|
|
545
282
|
} else {
|
|
546
|
-
|
|
283
|
+
t12 = $[46];
|
|
547
284
|
}
|
|
548
|
-
let
|
|
549
|
-
if ($[
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
className: t1,
|
|
285
|
+
let t13;
|
|
286
|
+
if ($[47] !== Content || $[48] !== children || $[49] !== closeButtonPlacement || $[50] !== closeButtonRef || $[51] !== closeLabel || $[52] !== describedBy || $[53] !== props || $[54] !== t10 || $[55] !== t11 || $[56] !== t12 || $[57] !== t8 || $[58] !== t9) {
|
|
287
|
+
t13 = /* @__PURE__ */ _jsxs(Content, {
|
|
288
|
+
...describedBy,
|
|
553
289
|
...props,
|
|
554
|
-
|
|
290
|
+
showCloseButton: t8,
|
|
291
|
+
closeButtonPlacement,
|
|
292
|
+
closeLabel,
|
|
293
|
+
closeButtonRef,
|
|
294
|
+
onOpenAutoFocus: t9,
|
|
295
|
+
children: [
|
|
296
|
+
t10,
|
|
297
|
+
t11,
|
|
298
|
+
children,
|
|
299
|
+
t12
|
|
300
|
+
]
|
|
555
301
|
});
|
|
556
|
-
$[
|
|
557
|
-
$[
|
|
558
|
-
$[
|
|
559
|
-
$[
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
302
|
+
$[47] = Content;
|
|
303
|
+
$[48] = children;
|
|
304
|
+
$[49] = closeButtonPlacement;
|
|
305
|
+
$[50] = closeButtonRef;
|
|
306
|
+
$[51] = closeLabel;
|
|
307
|
+
$[52] = describedBy;
|
|
308
|
+
$[53] = props;
|
|
309
|
+
$[54] = t10;
|
|
310
|
+
$[55] = t11;
|
|
311
|
+
$[56] = t12;
|
|
312
|
+
$[57] = t8;
|
|
313
|
+
$[58] = t9;
|
|
314
|
+
$[59] = t13;
|
|
315
|
+
} else {
|
|
316
|
+
t13 = $[59];
|
|
317
|
+
}
|
|
318
|
+
return t13;
|
|
564
319
|
}
|
|
565
|
-
export { Dialog, DialogClose, DialogContent,
|
|
320
|
+
export { Dialog, DialogClose, DialogContent, DialogTrigger };
|