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.
Files changed (110) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +43 -13
  3. package/THIRD_PARTY_NOTICES.md +1 -1
  4. package/dist/components/account-menu.d.ts +4 -3
  5. package/dist/components/account-menu.js +63 -54
  6. package/dist/components/alert.d.ts +15 -15
  7. package/dist/components/alert.js +289 -270
  8. package/dist/components/animated-theme-toggler.js +1 -1
  9. package/dist/components/avatar.d.ts +56 -31
  10. package/dist/components/avatar.js +394 -277
  11. package/dist/components/badge.d.ts +8 -28
  12. package/dist/components/badge.js +55 -108
  13. package/dist/components/calendar.d.ts +36 -26
  14. package/dist/components/calendar.js +132 -1227
  15. package/dist/components/card.d.ts +36 -25
  16. package/dist/components/card.js +895 -72
  17. package/dist/components/carousel.d.ts +63 -47
  18. package/dist/components/carousel.js +496 -777
  19. package/dist/components/data-table.d.ts +5 -4
  20. package/dist/components/data-table.js +7 -6
  21. package/dist/components/dialog-surface.d.ts +23 -1
  22. package/dist/components/dialog-surface.js +99 -3
  23. package/dist/components/dialog.d.ts +80 -45
  24. package/dist/components/dialog.js +258 -503
  25. package/dist/components/dropdown-menu.d.ts +56 -73
  26. package/dist/components/dropdown-menu.js +79 -714
  27. package/dist/components/field.d.ts +3 -1
  28. package/dist/components/field.js +49 -39
  29. package/dist/components/filter-presets-bar.js +2 -2
  30. package/dist/components/filter-query-bar.js +1 -1
  31. package/dist/components/hover-card.d.ts +42 -41
  32. package/dist/components/hover-card.js +57 -483
  33. package/dist/components/pagination.d.ts +53 -31
  34. package/dist/components/pagination.js +176 -412
  35. package/dist/components/popover.d.ts +11 -23
  36. package/dist/components/popover.js +19 -304
  37. package/dist/components/{alert-dialog.d.ts → primitives/alert-dialog.d.ts} +17 -5
  38. package/dist/components/{alert-dialog.js → primitives/alert-dialog.js} +102 -54
  39. package/dist/components/primitives/avatar.d.ts +46 -0
  40. package/dist/components/primitives/avatar.js +267 -0
  41. package/dist/components/primitives/calendar.d.ts +37 -0
  42. package/dist/components/primitives/calendar.js +1250 -0
  43. package/dist/components/primitives/carousel.d.ts +106 -0
  44. package/dist/components/primitives/carousel.js +928 -0
  45. package/dist/components/primitives/dialog.d.ts +62 -0
  46. package/dist/components/primitives/dialog.js +490 -0
  47. package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
  48. package/dist/components/primitives/dropdown-menu-items.js +265 -0
  49. package/dist/components/primitives/dropdown-menu.d.ts +64 -0
  50. package/dist/components/primitives/dropdown-menu.js +557 -0
  51. package/dist/components/primitives/hover-card.d.ts +50 -0
  52. package/dist/components/primitives/hover-card.js +507 -0
  53. package/dist/components/primitives/pagination.d.ts +65 -0
  54. package/dist/components/primitives/pagination.js +373 -0
  55. package/dist/components/primitives/popover.d.ts +22 -0
  56. package/dist/components/primitives/popover.js +213 -0
  57. package/dist/components/primitives/select.d.ts +36 -0
  58. package/dist/components/primitives/select.js +407 -0
  59. package/dist/components/primitives/tooltip.d.ts +30 -0
  60. package/dist/components/primitives/tooltip.js +277 -0
  61. package/dist/components/radio-group.d.ts +30 -17
  62. package/dist/components/radio-group.js +266 -315
  63. package/dist/components/rich-link-editor.js +2 -2
  64. package/dist/components/select.d.ts +51 -42
  65. package/dist/components/select.js +163 -495
  66. package/dist/components/skeleton.d.ts +16 -15
  67. package/dist/components/skeleton.js +99 -205
  68. package/dist/components/split-button.js +1 -1
  69. package/dist/components/switch.d.ts +3 -6
  70. package/dist/components/switch.js +163 -170
  71. package/dist/components/tabs.d.ts +3 -11
  72. package/dist/components/tabs.js +61 -75
  73. package/dist/components/themed-toaster.d.ts +1 -1
  74. package/dist/components/themed-toaster.js +1 -1
  75. package/dist/components/toaster.d.ts +1 -1
  76. package/dist/components/toaster.js +1 -1
  77. package/dist/components/tooltip.d.ts +36 -31
  78. package/dist/components/tooltip.js +44 -284
  79. package/dist/constants/alert.d.ts +5 -1
  80. package/dist/constants/alert.js +5 -1
  81. package/dist/constants/avatar.d.ts +24 -1
  82. package/dist/constants/avatar.js +19 -0
  83. package/dist/constants/calendar.d.ts +12 -0
  84. package/dist/constants/calendar.js +12 -0
  85. package/dist/constants/card.d.ts +23 -0
  86. package/dist/constants/card.js +20 -0
  87. package/dist/constants/carousel.d.ts +31 -13
  88. package/dist/constants/carousel.js +32 -11
  89. package/dist/constants/dialog.d.ts +6 -1
  90. package/dist/constants/dialog.js +5 -1
  91. package/dist/constants/dropdown-menu.d.ts +2 -2
  92. package/dist/constants/dropdown-menu.js +2 -2
  93. package/dist/constants/pagination.d.ts +13 -2
  94. package/dist/constants/pagination.js +13 -2
  95. package/dist/constants/select.d.ts +4 -2
  96. package/dist/constants/select.js +4 -2
  97. package/dist/constants/switch.d.ts +5 -16
  98. package/dist/constants/switch.js +6 -14
  99. package/dist/hooks/use-today.d.ts +7 -0
  100. package/dist/hooks/use-today.js +50 -0
  101. package/dist/hooks.d.ts +1 -0
  102. package/dist/hooks.js +1 -0
  103. package/dist/index.d.ts +0 -1
  104. package/dist/index.js +0 -1
  105. package/dist/motion/glide-indicator.d.ts +1 -1
  106. package/dist/motion/glide-indicator.js +1 -1
  107. package/dist/motion/presence.d.ts +0 -1
  108. package/dist/motion/presence.js +0 -1
  109. package/dist/styles.css +1 -1
  110. 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, on Arc's overlay, raised panel, title and description type and bordered close button, with Arc's swap of
6
- * a title or description changed while open, and Arc's dialog transition: the panel rises and scales in on the smooth
7
- * spring and leaves quickly. It keeps beez-ui's composable parts and the viewport close button placement instead of
8
- * Arc's single `title`/`description` content.
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 * as React from "react";
11
- import { Dialog as DialogPrimitive } from "radix-ui";
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 { keepOpenOnToastInteraction } from "../lib/toast-layer.js";
16
- import { Button } from "./button.js";
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(9);
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] = props;
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
- return t1;
84
- }
85
- function DialogPortal(t0) {
86
- const $ = _c(4);
87
- let props;
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
- $[2] = props;
102
- $[3] = t1;
103
- } else {
104
- t1 = $[3];
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
- props = $[1];
54
+ t2 = $[7];
117
55
  }
118
- let t1;
119
- if ($[2] !== props) {
120
- t1 = /* @__PURE__ */ _jsx(DialogPrimitive.Close, {
121
- "data-slot": "dialog-close",
122
- ...props
56
+ let t3;
57
+ if ($[8] !== alert || $[9] !== t2) {
58
+ t3 = /* @__PURE__ */ _jsx(DialogAlertContext.Provider, {
59
+ value: alert,
60
+ children: t2
123
61
  });
124
- $[2] = props;
125
- $[3] = t1;
62
+ $[8] = alert;
63
+ $[9] = t2;
64
+ $[10] = t3;
126
65
  } else {
127
- t1 = $[3];
66
+ t3 = $[10];
128
67
  }
129
- return t1;
68
+ return t3;
130
69
  }
131
- function DialogOverlay(t0) {
132
- const $ = _c(8);
133
- let className;
134
- let props;
135
- if ($[0] !== t0) {
136
- ({className, ...props} = t0);
137
- $[0] = t0;
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
- * Renders a close button pinned to the viewport corner. It stays hidden while the panel
169
- * enters, because the entrance transform would otherwise carry it along with the panel, and
170
- * fades in once the panel settles. It hides at once when the dialog starts closing.
171
- * While hidden it is also `visibility: hidden`, so the dialog's initial focus and the
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 DialogViewportCloseButton() {
176
- const $ = _c(2);
84
+ function DialogClose(props) {
85
+ const $ = _c(1);
177
86
  let t0;
178
87
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
179
- t0 = cn(dialogCloseButtonClassName, "fixed top-4 right-4 transition-opacity duration-200 ease-out in-data-motion-entering:invisible in-data-motion-entering:opacity-0 in-data-motion-entering:transition-none in-data-[state=closed]:invisible in-data-[state=closed]:opacity-0 in-data-[state=closed]:transition-none motion-reduce:transition-none");
88
+ t0 = { [DIALOG_CLOSE_ACTION_ATTRIBUTE]: "" };
180
89
  $[0] = t0;
181
90
  } else {
182
91
  t0 = $[0];
183
92
  }
184
- let t1;
185
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
186
- t1 = /* @__PURE__ */ _jsx(DialogPrimitive.Close, {
187
- "data-slot": "dialog-close",
188
- asChild: true,
189
- children: /* @__PURE__ */ _jsxs(ControlButton, {
190
- variant: "ghost",
191
- className: t0,
192
- size: "icon-sm",
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
- * Renders compact dialog content with viewport-safe scrolling. The panel rises 8px and scales
207
- * from 0.96 on Arc's smooth spring while it fades in, and leaves with a short drop and fade.
208
- * @param props - Primitive properties and optional consumer overrides.
209
- * @param props.showCloseButton - Whether the dialog renders its own close button.
210
- * @param props.closeButtonPlacement - `viewport` pins the close button to the viewport corner
211
- * and shows it only once the panel has settled; `content` (default) keeps it in the panel.
212
- * @returns The styled primitive with its original interaction contract.
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(29);
122
+ const $ = _c(60);
216
123
  let children;
217
- let className;
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
- ({className, children, showCloseButton: t1, closeButtonPlacement: t2, ...props} = t0);
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] = className;
226
- $[3] = props;
227
- $[4] = t1;
228
- $[5] = t2;
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
- className = $[2];
232
- props = $[3];
233
- t1 = $[4];
234
- t2 = $[5];
235
- }
236
- const showCloseButton = t1 === undefined ? true : t1;
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 t3 = props.forceMount;
239
- let t4;
240
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
241
- t4 = /* @__PURE__ */ _jsx(MotionSlot, {
242
- kind: "overlay",
243
- children: /* @__PURE__ */ _jsx(DialogOverlay, { forceMount: true })
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
- $[6] = t4;
212
+ $[23] = Title;
213
+ $[24] = t5;
214
+ $[25] = title;
215
+ $[26] = t6;
246
216
  } else {
247
- t4 = $[6];
217
+ t6 = $[26];
248
218
  }
249
- const t5 = showCloseButton ? closeButtonPlacement : undefined;
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 ($[7] !== className || $[8] !== t6) {
253
- t7 = cn(dialogSurfaceClassName, "fixed grid w-full max-w-[calc(100%-2rem)] max-h-[calc(100svh-2rem)] overflow-y-auto overscroll-contain sm:max-w-[440px]", t6, className);
254
- $[7] = className;
255
- $[8] = t6;
256
- $[9] = t7;
257
- } else {
258
- t7 = $[9];
259
- }
260
- let t8;
261
- if ($[10] !== props.onInteractOutside) {
262
- t8 = keepOpenOnToastInteraction(props.onInteractOutside);
263
- $[10] = props.onInteractOutside;
264
- $[11] = t8;
265
- } else {
266
- t8 = $[11];
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 ($[12] !== closeButtonPlacement || $[13] !== showCloseButton) {
270
- t9 = showCloseButton && closeButtonPlacement === "viewport" && /* @__PURE__ */ _jsx(DialogViewportCloseButton, {});
271
- $[12] = closeButtonPlacement;
272
- $[13] = showCloseButton;
273
- $[14] = t9;
274
- } else {
275
- t9 = $[14];
276
- }
277
- let t10;
278
- if ($[15] !== closeButtonPlacement || $[16] !== showCloseButton) {
279
- t10 = showCloseButton && closeButtonPlacement === "content" && /* @__PURE__ */ _jsx(DialogPrimitive.Close, {
280
- "data-slot": "dialog-close",
281
- asChild: true,
282
- children: /* @__PURE__ */ _jsx(MotionSlot, {
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 ($[18] !== children || $[19] !== props || $[20] !== t10 || $[21] !== t5 || $[22] !== t7 || $[23] !== t8 || $[24] !== t9) {
303
- t11 = /* @__PURE__ */ _jsxs(React.Fragment, { children: [t4, /* @__PURE__ */ _jsx(MotionSlot, {
304
- kind: "dialog",
305
- children: /* @__PURE__ */ _jsxs(DialogPrimitive.Content, {
306
- forceMount: true,
307
- "data-slot": "dialog-content",
308
- "data-close-button-placement": t5,
309
- className: t7,
310
- ...props,
311
- onInteractOutside: t8,
312
- children: [
313
- children,
314
- t9,
315
- t10
316
- ]
317
- })
318
- })] });
319
- $[18] = children;
320
- $[19] = props;
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 ($[26] !== props.forceMount || $[27] !== t11) {
332
- t12 = /* @__PURE__ */ _jsx(DialogPortal, {
333
- forceMount: true,
334
- children: /* @__PURE__ */ _jsx(MotionPresence, {
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
- $[9] = props;
502
- $[10] = t1;
503
- $[11] = t2;
504
- $[12] = t3;
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
- t2 = $[8];
283
+ t12 = $[46];
547
284
  }
548
- let t3;
549
- if ($[9] !== props || $[10] !== t1 || $[11] !== t2) {
550
- t3 = /* @__PURE__ */ _jsx(DialogPrimitive.Description, {
551
- "data-slot": "dialog-description",
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
- children: t2
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
- $[9] = props;
557
- $[10] = t1;
558
- $[11] = t2;
559
- $[12] = t3;
560
- } else {
561
- t3 = $[12];
562
- }
563
- return t3;
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, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
320
+ export { Dialog, DialogClose, DialogContent, DialogTrigger };