beez-ui 2.7.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -0
- package/README.md +43 -13
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/components/account-menu.d.ts +4 -3
- package/dist/components/account-menu.js +63 -54
- package/dist/components/alert.d.ts +15 -15
- package/dist/components/alert.js +289 -270
- package/dist/components/animated-theme-toggler.js +1 -1
- package/dist/components/avatar.d.ts +56 -31
- package/dist/components/avatar.js +394 -277
- package/dist/components/badge.d.ts +8 -28
- package/dist/components/badge.js +55 -108
- package/dist/components/calendar.d.ts +36 -26
- package/dist/components/calendar.js +132 -1227
- package/dist/components/card.d.ts +36 -25
- package/dist/components/card.js +895 -72
- package/dist/components/carousel.d.ts +63 -47
- package/dist/components/carousel.js +496 -777
- package/dist/components/data-table.d.ts +5 -4
- package/dist/components/data-table.js +7 -6
- package/dist/components/dialog-surface.d.ts +23 -1
- package/dist/components/dialog-surface.js +99 -3
- package/dist/components/dialog.d.ts +80 -45
- package/dist/components/dialog.js +258 -503
- package/dist/components/dropdown-menu.d.ts +56 -73
- package/dist/components/dropdown-menu.js +79 -714
- package/dist/components/field.d.ts +3 -1
- package/dist/components/field.js +49 -39
- package/dist/components/filter-presets-bar.js +2 -2
- package/dist/components/filter-query-bar.js +1 -1
- package/dist/components/hover-card.d.ts +42 -41
- package/dist/components/hover-card.js +57 -483
- package/dist/components/pagination.d.ts +53 -31
- package/dist/components/pagination.js +176 -412
- package/dist/components/popover.d.ts +11 -23
- package/dist/components/popover.js +19 -304
- package/dist/components/{alert-dialog.d.ts → primitives/alert-dialog.d.ts} +17 -5
- package/dist/components/{alert-dialog.js → primitives/alert-dialog.js} +102 -54
- package/dist/components/primitives/avatar.d.ts +46 -0
- package/dist/components/primitives/avatar.js +267 -0
- package/dist/components/primitives/calendar.d.ts +37 -0
- package/dist/components/primitives/calendar.js +1250 -0
- package/dist/components/primitives/carousel.d.ts +106 -0
- package/dist/components/primitives/carousel.js +928 -0
- package/dist/components/primitives/dialog.d.ts +62 -0
- package/dist/components/primitives/dialog.js +490 -0
- package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
- package/dist/components/primitives/dropdown-menu-items.js +265 -0
- package/dist/components/primitives/dropdown-menu.d.ts +64 -0
- package/dist/components/primitives/dropdown-menu.js +557 -0
- package/dist/components/primitives/hover-card.d.ts +50 -0
- package/dist/components/primitives/hover-card.js +507 -0
- package/dist/components/primitives/pagination.d.ts +65 -0
- package/dist/components/primitives/pagination.js +373 -0
- package/dist/components/primitives/popover.d.ts +22 -0
- package/dist/components/primitives/popover.js +213 -0
- package/dist/components/primitives/select.d.ts +36 -0
- package/dist/components/primitives/select.js +407 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.js +277 -0
- package/dist/components/radio-group.d.ts +30 -17
- package/dist/components/radio-group.js +266 -315
- package/dist/components/rich-link-editor.js +2 -2
- package/dist/components/select.d.ts +51 -42
- package/dist/components/select.js +163 -495
- package/dist/components/skeleton.d.ts +16 -15
- package/dist/components/skeleton.js +99 -205
- package/dist/components/split-button.js +1 -1
- package/dist/components/switch.d.ts +3 -6
- package/dist/components/switch.js +163 -170
- package/dist/components/tabs.d.ts +3 -11
- package/dist/components/tabs.js +61 -75
- package/dist/components/themed-toaster.d.ts +1 -1
- package/dist/components/themed-toaster.js +1 -1
- package/dist/components/toaster.d.ts +1 -1
- package/dist/components/toaster.js +1 -1
- package/dist/components/tooltip.d.ts +36 -31
- package/dist/components/tooltip.js +44 -284
- package/dist/constants/alert.d.ts +5 -1
- package/dist/constants/alert.js +5 -1
- package/dist/constants/avatar.d.ts +24 -1
- package/dist/constants/avatar.js +19 -0
- package/dist/constants/calendar.d.ts +12 -0
- package/dist/constants/calendar.js +12 -0
- package/dist/constants/card.d.ts +23 -0
- package/dist/constants/card.js +20 -0
- package/dist/constants/carousel.d.ts +31 -13
- package/dist/constants/carousel.js +32 -11
- package/dist/constants/dialog.d.ts +6 -1
- package/dist/constants/dialog.js +5 -1
- package/dist/constants/dropdown-menu.d.ts +2 -2
- package/dist/constants/dropdown-menu.js +2 -2
- package/dist/constants/pagination.d.ts +13 -2
- package/dist/constants/pagination.js +13 -2
- package/dist/constants/select.d.ts +4 -2
- package/dist/constants/select.js +4 -2
- package/dist/constants/switch.d.ts +5 -16
- package/dist/constants/switch.js +6 -14
- package/dist/hooks/use-today.d.ts +7 -0
- package/dist/hooks/use-today.js +50 -0
- package/dist/hooks.d.ts +1 -0
- package/dist/hooks.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/motion/glide-indicator.d.ts +1 -1
- package/dist/motion/glide-indicator.js +1 -1
- package/dist/motion/presence.d.ts +0 -1
- package/dist/motion/presence.js +0 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -6
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal composition behind Arc's Dialog (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): Radix's
|
|
3
|
+
* dialog parts on Arc's overlay, raised panel, title and description type and bordered close button, with Arc's swap
|
|
4
|
+
* of a title or description changed while open, Arc's dialog transition and the viewport close button
|
|
5
|
+
* placement. Not exported from the package: the public `Dialog` in `../dialog.tsx` builds Arc's API on these parts.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
9
|
+
import { type DialogCloseButtonPlacement } from "../dialog-surface.js";
|
|
10
|
+
/**
|
|
11
|
+
* Root that keeps the open state so the content can animate out. Controlled or uncontrolled, as Radix.
|
|
12
|
+
* @param props - Radix root props.
|
|
13
|
+
* @returns The dialog root.
|
|
14
|
+
*/
|
|
15
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element;
|
|
16
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): React.JSX.Element;
|
|
17
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): React.JSX.Element;
|
|
18
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): React.JSX.Element;
|
|
19
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* Renders compact dialog content with viewport-safe scrolling. The panel rises 8px and scales
|
|
22
|
+
* from 0.96 on Arc's smooth spring while it fades in, and leaves with a short drop and fade.
|
|
23
|
+
* @param props - Primitive properties and optional consumer overrides.
|
|
24
|
+
* @param props.showCloseButton - Whether the dialog renders its own close button.
|
|
25
|
+
* @param props.closeButtonPlacement - `viewport` pins the close button to the viewport corner
|
|
26
|
+
* and shows it only once the panel has settled; `content` (default) keeps it in the panel.
|
|
27
|
+
* @param props.closeLabel - Accessible name of the close button.
|
|
28
|
+
* @param props.closeButtonRef - Ref of the close button, when it is rendered.
|
|
29
|
+
* @returns The styled primitive with its original interaction contract.
|
|
30
|
+
*/
|
|
31
|
+
declare function DialogContent({ className, children, showCloseButton, closeButtonPlacement, closeLabel, closeButtonRef, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
32
|
+
showCloseButton?: boolean;
|
|
33
|
+
closeButtonPlacement?: DialogCloseButtonPlacement;
|
|
34
|
+
closeLabel?: string;
|
|
35
|
+
closeButtonRef?: React.Ref<HTMLButtonElement>;
|
|
36
|
+
}): React.JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Stacks the title and description. While the panel shows its own close button, the header keeps Arc's gap to it so
|
|
39
|
+
* long copy never runs under the button.
|
|
40
|
+
* @param props - Native div properties and optional consumer overrides.
|
|
41
|
+
* @returns The header block.
|
|
42
|
+
*/
|
|
43
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Separates dialog actions with an edge-to-edge footer under a hairline, bleeding through the panel padding.
|
|
46
|
+
* @param props - Native div properties and optional consumer overrides.
|
|
47
|
+
* @returns The footer block.
|
|
48
|
+
*/
|
|
49
|
+
declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
50
|
+
/**
|
|
51
|
+
* Renders the dialog heading in Arc's title type. Plain text that changes while open swaps with Arc's rise.
|
|
52
|
+
* @param props - Primitive properties and optional consumer overrides.
|
|
53
|
+
* @returns The styled primitive with its original interaction contract.
|
|
54
|
+
*/
|
|
55
|
+
declare function DialogTitle({ className, children, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
|
|
56
|
+
/**
|
|
57
|
+
* Renders the dialog description in Arc's secondary text. Plain text that changes while open swaps with Arc's rise.
|
|
58
|
+
* @param props - Primitive properties and optional consumer overrides.
|
|
59
|
+
* @returns The styled primitive with its original interaction contract.
|
|
60
|
+
*/
|
|
61
|
+
declare function DialogDescription({ className, children, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
|
|
62
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Internal composition behind Arc's Dialog (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): Radix's
|
|
5
|
+
* dialog parts on Arc's overlay, raised panel, title and description type and bordered close button, with Arc's swap
|
|
6
|
+
* of a title or description changed while open, Arc's dialog transition and the viewport close button
|
|
7
|
+
* placement. Not exported from the package: the public `Dialog` in `../dialog.tsx` builds Arc's API on these parts.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
11
|
+
import { MotionSlot } from "../../motion/motion-slot.js";
|
|
12
|
+
import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../../motion/presence.js";
|
|
13
|
+
import { cn } from "../../lib/utils.js";
|
|
14
|
+
import { keepOpenOnToastInteraction } from "../../lib/toast-layer.js";
|
|
15
|
+
import { DialogSurfaceCloseButton, withDialogSwapText, dialogDescriptionClassName, dialogFooterClassName, dialogOverlayClassName, dialogSurfaceClassName, dialogTitleClassName } from "../dialog-surface.js";
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
/**
|
|
18
|
+
* Root that keeps the open state so the content can animate out. Controlled or uncontrolled, as Radix.
|
|
19
|
+
* @param props - Radix root props.
|
|
20
|
+
* @returns The dialog root.
|
|
21
|
+
*/
|
|
22
|
+
function Dialog(t0) {
|
|
23
|
+
const $ = _c(9);
|
|
24
|
+
let props;
|
|
25
|
+
if ($[0] !== t0) {
|
|
26
|
+
({...props} = t0);
|
|
27
|
+
$[0] = t0;
|
|
28
|
+
$[1] = props;
|
|
29
|
+
} else {
|
|
30
|
+
props = $[1];
|
|
31
|
+
}
|
|
32
|
+
const [motionOpen, setMotionOpen] = useMotionOpenState(props);
|
|
33
|
+
let t1;
|
|
34
|
+
if ($[2] !== motionOpen || $[3] !== props || $[4] !== setMotionOpen) {
|
|
35
|
+
t1 = /* @__PURE__ */ _jsx(DialogPrimitive.Root, {
|
|
36
|
+
"data-slot": "dialog",
|
|
37
|
+
...props,
|
|
38
|
+
open: motionOpen,
|
|
39
|
+
onOpenChange: setMotionOpen
|
|
40
|
+
});
|
|
41
|
+
$[2] = motionOpen;
|
|
42
|
+
$[3] = props;
|
|
43
|
+
$[4] = setMotionOpen;
|
|
44
|
+
$[5] = t1;
|
|
45
|
+
} else {
|
|
46
|
+
t1 = $[5];
|
|
47
|
+
}
|
|
48
|
+
let t2;
|
|
49
|
+
if ($[6] !== motionOpen || $[7] !== t1) {
|
|
50
|
+
t2 = /* @__PURE__ */ _jsx(MotionOpenProvider, {
|
|
51
|
+
scope: "dialog",
|
|
52
|
+
open: motionOpen,
|
|
53
|
+
children: t1
|
|
54
|
+
});
|
|
55
|
+
$[6] = motionOpen;
|
|
56
|
+
$[7] = t1;
|
|
57
|
+
$[8] = t2;
|
|
58
|
+
} else {
|
|
59
|
+
t2 = $[8];
|
|
60
|
+
}
|
|
61
|
+
return t2;
|
|
62
|
+
}
|
|
63
|
+
function DialogTrigger(t0) {
|
|
64
|
+
const $ = _c(4);
|
|
65
|
+
let props;
|
|
66
|
+
if ($[0] !== t0) {
|
|
67
|
+
({...props} = t0);
|
|
68
|
+
$[0] = t0;
|
|
69
|
+
$[1] = props;
|
|
70
|
+
} else {
|
|
71
|
+
props = $[1];
|
|
72
|
+
}
|
|
73
|
+
let t1;
|
|
74
|
+
if ($[2] !== props) {
|
|
75
|
+
t1 = /* @__PURE__ */ _jsx(DialogPrimitive.Trigger, {
|
|
76
|
+
"data-slot": "dialog-trigger",
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
$[2] = props;
|
|
80
|
+
$[3] = t1;
|
|
81
|
+
} else {
|
|
82
|
+
t1 = $[3];
|
|
83
|
+
}
|
|
84
|
+
return t1;
|
|
85
|
+
}
|
|
86
|
+
function DialogPortal(t0) {
|
|
87
|
+
const $ = _c(4);
|
|
88
|
+
let props;
|
|
89
|
+
if ($[0] !== t0) {
|
|
90
|
+
({...props} = t0);
|
|
91
|
+
$[0] = t0;
|
|
92
|
+
$[1] = props;
|
|
93
|
+
} else {
|
|
94
|
+
props = $[1];
|
|
95
|
+
}
|
|
96
|
+
let t1;
|
|
97
|
+
if ($[2] !== props) {
|
|
98
|
+
t1 = /* @__PURE__ */ _jsx(DialogPrimitive.Portal, {
|
|
99
|
+
"data-slot": "dialog-portal",
|
|
100
|
+
...props
|
|
101
|
+
});
|
|
102
|
+
$[2] = props;
|
|
103
|
+
$[3] = t1;
|
|
104
|
+
} else {
|
|
105
|
+
t1 = $[3];
|
|
106
|
+
}
|
|
107
|
+
return t1;
|
|
108
|
+
}
|
|
109
|
+
function DialogClose(t0) {
|
|
110
|
+
const $ = _c(4);
|
|
111
|
+
let props;
|
|
112
|
+
if ($[0] !== t0) {
|
|
113
|
+
({...props} = t0);
|
|
114
|
+
$[0] = t0;
|
|
115
|
+
$[1] = props;
|
|
116
|
+
} else {
|
|
117
|
+
props = $[1];
|
|
118
|
+
}
|
|
119
|
+
let t1;
|
|
120
|
+
if ($[2] !== props) {
|
|
121
|
+
t1 = /* @__PURE__ */ _jsx(DialogPrimitive.Close, {
|
|
122
|
+
"data-slot": "dialog-close",
|
|
123
|
+
...props
|
|
124
|
+
});
|
|
125
|
+
$[2] = props;
|
|
126
|
+
$[3] = t1;
|
|
127
|
+
} else {
|
|
128
|
+
t1 = $[3];
|
|
129
|
+
}
|
|
130
|
+
return t1;
|
|
131
|
+
}
|
|
132
|
+
function DialogOverlay(t0) {
|
|
133
|
+
const $ = _c(8);
|
|
134
|
+
let className;
|
|
135
|
+
let props;
|
|
136
|
+
if ($[0] !== t0) {
|
|
137
|
+
({className, ...props} = t0);
|
|
138
|
+
$[0] = t0;
|
|
139
|
+
$[1] = className;
|
|
140
|
+
$[2] = props;
|
|
141
|
+
} else {
|
|
142
|
+
className = $[1];
|
|
143
|
+
props = $[2];
|
|
144
|
+
}
|
|
145
|
+
let t1;
|
|
146
|
+
if ($[3] !== className) {
|
|
147
|
+
t1 = cn(dialogOverlayClassName, className);
|
|
148
|
+
$[3] = className;
|
|
149
|
+
$[4] = t1;
|
|
150
|
+
} else {
|
|
151
|
+
t1 = $[4];
|
|
152
|
+
}
|
|
153
|
+
let t2;
|
|
154
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
155
|
+
t2 = /* @__PURE__ */ _jsx(DialogPrimitive.Overlay, {
|
|
156
|
+
"data-slot": "dialog-overlay",
|
|
157
|
+
className: t1,
|
|
158
|
+
...props
|
|
159
|
+
});
|
|
160
|
+
$[5] = props;
|
|
161
|
+
$[6] = t1;
|
|
162
|
+
$[7] = t2;
|
|
163
|
+
} else {
|
|
164
|
+
t2 = $[7];
|
|
165
|
+
}
|
|
166
|
+
return t2;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Renders compact dialog content with viewport-safe scrolling. The panel rises 8px and scales
|
|
170
|
+
* from 0.96 on Arc's smooth spring while it fades in, and leaves with a short drop and fade.
|
|
171
|
+
* @param props - Primitive properties and optional consumer overrides.
|
|
172
|
+
* @param props.showCloseButton - Whether the dialog renders its own close button.
|
|
173
|
+
* @param props.closeButtonPlacement - `viewport` pins the close button to the viewport corner
|
|
174
|
+
* and shows it only once the panel has settled; `content` (default) keeps it in the panel.
|
|
175
|
+
* @param props.closeLabel - Accessible name of the close button.
|
|
176
|
+
* @param props.closeButtonRef - Ref of the close button, when it is rendered.
|
|
177
|
+
* @returns The styled primitive with its original interaction contract.
|
|
178
|
+
*/
|
|
179
|
+
function DialogContent(t0) {
|
|
180
|
+
const $ = _c(29);
|
|
181
|
+
let children;
|
|
182
|
+
let className;
|
|
183
|
+
let closeButtonRef;
|
|
184
|
+
let closeLabel;
|
|
185
|
+
let props;
|
|
186
|
+
let t1;
|
|
187
|
+
let t2;
|
|
188
|
+
if ($[0] !== t0) {
|
|
189
|
+
({className, children, showCloseButton: t1, closeButtonPlacement: t2, closeLabel, closeButtonRef, ...props} = t0);
|
|
190
|
+
$[0] = t0;
|
|
191
|
+
$[1] = children;
|
|
192
|
+
$[2] = className;
|
|
193
|
+
$[3] = closeButtonRef;
|
|
194
|
+
$[4] = closeLabel;
|
|
195
|
+
$[5] = props;
|
|
196
|
+
$[6] = t1;
|
|
197
|
+
$[7] = t2;
|
|
198
|
+
} else {
|
|
199
|
+
children = $[1];
|
|
200
|
+
className = $[2];
|
|
201
|
+
closeButtonRef = $[3];
|
|
202
|
+
closeLabel = $[4];
|
|
203
|
+
props = $[5];
|
|
204
|
+
t1 = $[6];
|
|
205
|
+
t2 = $[7];
|
|
206
|
+
}
|
|
207
|
+
const showCloseButton = t1 === undefined ? true : t1;
|
|
208
|
+
const closeButtonPlacement = t2 === undefined ? "content" : t2;
|
|
209
|
+
const t3 = props.forceMount;
|
|
210
|
+
let t4;
|
|
211
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
212
|
+
t4 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
213
|
+
kind: "overlay",
|
|
214
|
+
children: /* @__PURE__ */ _jsx(DialogOverlay, { forceMount: true })
|
|
215
|
+
});
|
|
216
|
+
$[8] = t4;
|
|
217
|
+
} else {
|
|
218
|
+
t4 = $[8];
|
|
219
|
+
}
|
|
220
|
+
const t5 = showCloseButton ? closeButtonPlacement : undefined;
|
|
221
|
+
const t6 = closeButtonPlacement === "viewport" ? "inset-0 m-auto h-fit" : "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2";
|
|
222
|
+
let t7;
|
|
223
|
+
if ($[9] !== className || $[10] !== t6) {
|
|
224
|
+
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);
|
|
225
|
+
$[9] = className;
|
|
226
|
+
$[10] = t6;
|
|
227
|
+
$[11] = t7;
|
|
228
|
+
} else {
|
|
229
|
+
t7 = $[11];
|
|
230
|
+
}
|
|
231
|
+
let t8;
|
|
232
|
+
if ($[12] !== props.onInteractOutside) {
|
|
233
|
+
t8 = keepOpenOnToastInteraction(props.onInteractOutside);
|
|
234
|
+
$[12] = props.onInteractOutside;
|
|
235
|
+
$[13] = t8;
|
|
236
|
+
} else {
|
|
237
|
+
t8 = $[13];
|
|
238
|
+
}
|
|
239
|
+
let t9;
|
|
240
|
+
if ($[14] !== closeButtonPlacement || $[15] !== closeButtonRef || $[16] !== closeLabel || $[17] !== showCloseButton) {
|
|
241
|
+
t9 = showCloseButton && /* @__PURE__ */ _jsx(DialogSurfaceCloseButton, {
|
|
242
|
+
kind: "dialog",
|
|
243
|
+
placement: closeButtonPlacement,
|
|
244
|
+
label: closeLabel,
|
|
245
|
+
buttonRef: closeButtonRef
|
|
246
|
+
});
|
|
247
|
+
$[14] = closeButtonPlacement;
|
|
248
|
+
$[15] = closeButtonRef;
|
|
249
|
+
$[16] = closeLabel;
|
|
250
|
+
$[17] = showCloseButton;
|
|
251
|
+
$[18] = t9;
|
|
252
|
+
} else {
|
|
253
|
+
t9 = $[18];
|
|
254
|
+
}
|
|
255
|
+
let t10;
|
|
256
|
+
if ($[19] !== children || $[20] !== props || $[21] !== t5 || $[22] !== t7 || $[23] !== t8 || $[24] !== t9) {
|
|
257
|
+
t10 = /* @__PURE__ */ _jsxs(React.Fragment, { children: [t4, /* @__PURE__ */ _jsx(MotionSlot, {
|
|
258
|
+
kind: "dialog",
|
|
259
|
+
children: /* @__PURE__ */ _jsxs(DialogPrimitive.Content, {
|
|
260
|
+
forceMount: true,
|
|
261
|
+
"data-slot": "dialog-content",
|
|
262
|
+
"data-close-button-placement": t5,
|
|
263
|
+
className: t7,
|
|
264
|
+
...props,
|
|
265
|
+
onInteractOutside: t8,
|
|
266
|
+
children: [children, t9]
|
|
267
|
+
})
|
|
268
|
+
})] });
|
|
269
|
+
$[19] = children;
|
|
270
|
+
$[20] = props;
|
|
271
|
+
$[21] = t5;
|
|
272
|
+
$[22] = t7;
|
|
273
|
+
$[23] = t8;
|
|
274
|
+
$[24] = t9;
|
|
275
|
+
$[25] = t10;
|
|
276
|
+
} else {
|
|
277
|
+
t10 = $[25];
|
|
278
|
+
}
|
|
279
|
+
let t11;
|
|
280
|
+
if ($[26] !== props.forceMount || $[27] !== t10) {
|
|
281
|
+
t11 = /* @__PURE__ */ _jsx(DialogPortal, {
|
|
282
|
+
forceMount: true,
|
|
283
|
+
children: /* @__PURE__ */ _jsx(MotionPresence, {
|
|
284
|
+
scope: "dialog",
|
|
285
|
+
forceMount: t3,
|
|
286
|
+
children: t10
|
|
287
|
+
})
|
|
288
|
+
});
|
|
289
|
+
$[26] = props.forceMount;
|
|
290
|
+
$[27] = t10;
|
|
291
|
+
$[28] = t11;
|
|
292
|
+
} else {
|
|
293
|
+
t11 = $[28];
|
|
294
|
+
}
|
|
295
|
+
return t11;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Stacks the title and description. While the panel shows its own close button, the header keeps Arc's gap to it so
|
|
299
|
+
* long copy never runs under the button.
|
|
300
|
+
* @param props - Native div properties and optional consumer overrides.
|
|
301
|
+
* @returns The header block.
|
|
302
|
+
*/
|
|
303
|
+
function DialogHeader(t0) {
|
|
304
|
+
const $ = _c(8);
|
|
305
|
+
let className;
|
|
306
|
+
let props;
|
|
307
|
+
if ($[0] !== t0) {
|
|
308
|
+
({className, ...props} = t0);
|
|
309
|
+
$[0] = t0;
|
|
310
|
+
$[1] = className;
|
|
311
|
+
$[2] = props;
|
|
312
|
+
} else {
|
|
313
|
+
className = $[1];
|
|
314
|
+
props = $[2];
|
|
315
|
+
}
|
|
316
|
+
let t1;
|
|
317
|
+
if ($[3] !== className) {
|
|
318
|
+
t1 = cn("flex flex-col gap-(--space-2) in-data-[close-button-placement=content]:pr-[calc(var(--space-8)+var(--space-5))]", className);
|
|
319
|
+
$[3] = className;
|
|
320
|
+
$[4] = t1;
|
|
321
|
+
} else {
|
|
322
|
+
t1 = $[4];
|
|
323
|
+
}
|
|
324
|
+
let t2;
|
|
325
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
326
|
+
t2 = /* @__PURE__ */ _jsx("div", {
|
|
327
|
+
"data-slot": "dialog-header",
|
|
328
|
+
className: t1,
|
|
329
|
+
...props
|
|
330
|
+
});
|
|
331
|
+
$[5] = props;
|
|
332
|
+
$[6] = t1;
|
|
333
|
+
$[7] = t2;
|
|
334
|
+
} else {
|
|
335
|
+
t2 = $[7];
|
|
336
|
+
}
|
|
337
|
+
return t2;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Separates dialog actions with an edge-to-edge footer under a hairline, bleeding through the panel padding.
|
|
341
|
+
* @param props - Native div properties and optional consumer overrides.
|
|
342
|
+
* @returns The footer block.
|
|
343
|
+
*/
|
|
344
|
+
function DialogFooter(t0) {
|
|
345
|
+
const $ = _c(8);
|
|
346
|
+
let className;
|
|
347
|
+
let props;
|
|
348
|
+
if ($[0] !== t0) {
|
|
349
|
+
({className, ...props} = t0);
|
|
350
|
+
$[0] = t0;
|
|
351
|
+
$[1] = className;
|
|
352
|
+
$[2] = props;
|
|
353
|
+
} else {
|
|
354
|
+
className = $[1];
|
|
355
|
+
props = $[2];
|
|
356
|
+
}
|
|
357
|
+
let t1;
|
|
358
|
+
if ($[3] !== className) {
|
|
359
|
+
t1 = cn(dialogFooterClassName, className);
|
|
360
|
+
$[3] = className;
|
|
361
|
+
$[4] = t1;
|
|
362
|
+
} else {
|
|
363
|
+
t1 = $[4];
|
|
364
|
+
}
|
|
365
|
+
let t2;
|
|
366
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
367
|
+
t2 = /* @__PURE__ */ _jsx("div", {
|
|
368
|
+
"data-slot": "dialog-footer",
|
|
369
|
+
className: t1,
|
|
370
|
+
...props
|
|
371
|
+
});
|
|
372
|
+
$[5] = props;
|
|
373
|
+
$[6] = t1;
|
|
374
|
+
$[7] = t2;
|
|
375
|
+
} else {
|
|
376
|
+
t2 = $[7];
|
|
377
|
+
}
|
|
378
|
+
return t2;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Renders the dialog heading in Arc's title type. Plain text that changes while open swaps with Arc's rise.
|
|
382
|
+
* @param props - Primitive properties and optional consumer overrides.
|
|
383
|
+
* @returns The styled primitive with its original interaction contract.
|
|
384
|
+
*/
|
|
385
|
+
function DialogTitle(t0) {
|
|
386
|
+
const $ = _c(13);
|
|
387
|
+
let children;
|
|
388
|
+
let className;
|
|
389
|
+
let props;
|
|
390
|
+
if ($[0] !== t0) {
|
|
391
|
+
({className, children, ...props} = t0);
|
|
392
|
+
$[0] = t0;
|
|
393
|
+
$[1] = children;
|
|
394
|
+
$[2] = className;
|
|
395
|
+
$[3] = props;
|
|
396
|
+
} else {
|
|
397
|
+
children = $[1];
|
|
398
|
+
className = $[2];
|
|
399
|
+
props = $[3];
|
|
400
|
+
}
|
|
401
|
+
let t1;
|
|
402
|
+
if ($[4] !== className) {
|
|
403
|
+
t1 = cn(dialogTitleClassName, className);
|
|
404
|
+
$[4] = className;
|
|
405
|
+
$[5] = t1;
|
|
406
|
+
} else {
|
|
407
|
+
t1 = $[5];
|
|
408
|
+
}
|
|
409
|
+
let t2;
|
|
410
|
+
if ($[6] !== children || $[7] !== props.asChild) {
|
|
411
|
+
t2 = withDialogSwapText(children, props.asChild);
|
|
412
|
+
$[6] = children;
|
|
413
|
+
$[7] = props.asChild;
|
|
414
|
+
$[8] = t2;
|
|
415
|
+
} else {
|
|
416
|
+
t2 = $[8];
|
|
417
|
+
}
|
|
418
|
+
let t3;
|
|
419
|
+
if ($[9] !== props || $[10] !== t1 || $[11] !== t2) {
|
|
420
|
+
t3 = /* @__PURE__ */ _jsx(DialogPrimitive.Title, {
|
|
421
|
+
"data-slot": "dialog-title",
|
|
422
|
+
className: t1,
|
|
423
|
+
...props,
|
|
424
|
+
children: t2
|
|
425
|
+
});
|
|
426
|
+
$[9] = props;
|
|
427
|
+
$[10] = t1;
|
|
428
|
+
$[11] = t2;
|
|
429
|
+
$[12] = t3;
|
|
430
|
+
} else {
|
|
431
|
+
t3 = $[12];
|
|
432
|
+
}
|
|
433
|
+
return t3;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Renders the dialog description in Arc's secondary text. Plain text that changes while open swaps with Arc's rise.
|
|
437
|
+
* @param props - Primitive properties and optional consumer overrides.
|
|
438
|
+
* @returns The styled primitive with its original interaction contract.
|
|
439
|
+
*/
|
|
440
|
+
function DialogDescription(t0) {
|
|
441
|
+
const $ = _c(13);
|
|
442
|
+
let children;
|
|
443
|
+
let className;
|
|
444
|
+
let props;
|
|
445
|
+
if ($[0] !== t0) {
|
|
446
|
+
({className, children, ...props} = t0);
|
|
447
|
+
$[0] = t0;
|
|
448
|
+
$[1] = children;
|
|
449
|
+
$[2] = className;
|
|
450
|
+
$[3] = props;
|
|
451
|
+
} else {
|
|
452
|
+
children = $[1];
|
|
453
|
+
className = $[2];
|
|
454
|
+
props = $[3];
|
|
455
|
+
}
|
|
456
|
+
let t1;
|
|
457
|
+
if ($[4] !== className) {
|
|
458
|
+
t1 = cn(dialogDescriptionClassName, className);
|
|
459
|
+
$[4] = className;
|
|
460
|
+
$[5] = t1;
|
|
461
|
+
} else {
|
|
462
|
+
t1 = $[5];
|
|
463
|
+
}
|
|
464
|
+
let t2;
|
|
465
|
+
if ($[6] !== children || $[7] !== props.asChild) {
|
|
466
|
+
t2 = withDialogSwapText(children, props.asChild);
|
|
467
|
+
$[6] = children;
|
|
468
|
+
$[7] = props.asChild;
|
|
469
|
+
$[8] = t2;
|
|
470
|
+
} else {
|
|
471
|
+
t2 = $[8];
|
|
472
|
+
}
|
|
473
|
+
let t3;
|
|
474
|
+
if ($[9] !== props || $[10] !== t1 || $[11] !== t2) {
|
|
475
|
+
t3 = /* @__PURE__ */ _jsx(DialogPrimitive.Description, {
|
|
476
|
+
"data-slot": "dialog-description",
|
|
477
|
+
className: t1,
|
|
478
|
+
...props,
|
|
479
|
+
children: t2
|
|
480
|
+
});
|
|
481
|
+
$[9] = props;
|
|
482
|
+
$[10] = t1;
|
|
483
|
+
$[11] = t2;
|
|
484
|
+
$[12] = t3;
|
|
485
|
+
} else {
|
|
486
|
+
t3 = $[12];
|
|
487
|
+
}
|
|
488
|
+
return t3;
|
|
489
|
+
}
|
|
490
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal renderer of Arc's data-driven menu items (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md):
|
|
3
|
+
* turns `DropdownItem` objects into action, link, checkbox and radio rows of the dropdown menu primitive, with Arc's
|
|
4
|
+
* separators and danger tone. Shared by the public closed `DropdownMenu` and by composite components, such as
|
|
5
|
+
* `AccountMenu` and `DataTable`, that take extra items from their consumers.
|
|
6
|
+
*/
|
|
7
|
+
import type { AriaAttributes, HTMLAttributeAnchorTarget, ReactNode } from "react";
|
|
8
|
+
/** Extra attributes for one item row: `data-*` attributes and ARIA attributes such as `aria-current`. */
|
|
9
|
+
export type DropdownItemAttributes = AriaAttributes & {
|
|
10
|
+
[attribute: `data-${string}`]: string | number | boolean | undefined;
|
|
11
|
+
};
|
|
12
|
+
/** One row of a dropdown menu. */
|
|
13
|
+
export type DropdownItem = {
|
|
14
|
+
/** Stable key. Defaults to `label` when it is a string, so keep string labels unique. */
|
|
15
|
+
id?: string;
|
|
16
|
+
/** Visible text of the row. */
|
|
17
|
+
label: ReactNode;
|
|
18
|
+
/** Called when the row is chosen. Call `event.preventDefault()` to keep the menu open. */
|
|
19
|
+
onSelect?: (event: Event) => void;
|
|
20
|
+
/** Skipped by the keyboard and dimmed. */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Leading icon. */
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
/** Draws Arc's danger tone; say what the action destroys in the label. */
|
|
25
|
+
destructive?: boolean;
|
|
26
|
+
/** Draws a separator before the row, to group the items around it. */
|
|
27
|
+
separatorBefore?: boolean;
|
|
28
|
+
/** Renders the row as a link through the provider's `Link`, so routers can navigate client-side. */
|
|
29
|
+
href?: string;
|
|
30
|
+
/** Target of a link row. */
|
|
31
|
+
target?: HTMLAttributeAnchorTarget;
|
|
32
|
+
/** Relationship of a link row, such as `noreferrer` for external pages. */
|
|
33
|
+
rel?: string;
|
|
34
|
+
/** Renders the row as a checkbox with this state and its check at the end. */
|
|
35
|
+
checked?: boolean;
|
|
36
|
+
/** Content at the end of the row, such as a shortcut or a count. */
|
|
37
|
+
trailing?: ReactNode;
|
|
38
|
+
/** Value of the row inside a menu with `selection`; the row becomes a radio item. */
|
|
39
|
+
value?: string;
|
|
40
|
+
/** Class added to the row. */
|
|
41
|
+
className?: string;
|
|
42
|
+
/** Extra `data-*` and ARIA attributes of the row. */
|
|
43
|
+
itemProps?: DropdownItemAttributes;
|
|
44
|
+
};
|
|
45
|
+
/** Single selection of a menu: rows with a `value` render as radio items. */
|
|
46
|
+
export type DropdownMenuSelection = {
|
|
47
|
+
value: string;
|
|
48
|
+
onValueChange: (value: string) => void;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Renders a list of rows inside a dropdown menu content, with the separators they ask for. With a `selection`, the
|
|
52
|
+
* rows live in one radio group and the rows that carry a `value` become its radio items.
|
|
53
|
+
* @param props - The rows and the optional single selection.
|
|
54
|
+
* @returns The rows.
|
|
55
|
+
*/
|
|
56
|
+
export declare function DropdownMenuItems({ items, selection }: {
|
|
57
|
+
items: DropdownItem[];
|
|
58
|
+
selection?: DropdownMenuSelection;
|
|
59
|
+
}): import("react").JSX.Element;
|