@vertz/ui-primitives 0.2.22 → 0.2.23
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/dist/shared/chunk-3h1mxp95.js +148 -0
- package/dist/shared/chunk-3kwh27dv.js +135 -0
- package/dist/shared/chunk-4894pmy6.js +184 -0
- package/dist/shared/chunk-67sn29eh.js +125 -0
- package/dist/shared/chunk-7cb3z0s8.js +287 -0
- package/dist/shared/chunk-8c01c8mb.js +217 -0
- package/dist/shared/chunk-99tk72t3.js +69 -0
- package/dist/shared/chunk-9gfp3ffv.js +204 -0
- package/dist/shared/chunk-b25npqer.js +149 -0
- package/dist/shared/chunk-cgb2j94g.js +141 -0
- package/dist/shared/chunk-e1jcf22s.js +79 -0
- package/dist/shared/chunk-e3h0ddmx.js +168 -0
- package/dist/shared/chunk-f2vx4tpw.js +168 -0
- package/dist/shared/chunk-h3v10x04.js +271 -0
- package/dist/shared/chunk-hdvdfd1c.js +96 -0
- package/dist/shared/{chunk-dhyr0s9n.js → chunk-j902w020.js} +1 -1
- package/dist/shared/chunk-jdygp28a.js +260 -0
- package/dist/shared/chunk-jqre4qtw.js +180 -0
- package/dist/shared/{chunk-k8nabsxm.js → chunk-mgr904ap.js} +74 -34
- package/dist/shared/chunk-mr1tb0dp.js +167 -0
- package/dist/shared/chunk-nj420k31.js +54 -0
- package/dist/shared/chunk-p0x7hgv6.js +181 -0
- package/dist/shared/{chunk-w9dag6ce.js → chunk-pn6shbcs.js} +132 -80
- package/dist/shared/chunk-pzx0vpq1.js +223 -0
- package/dist/shared/chunk-tn0m98j8.js +42 -0
- package/dist/shared/{chunk-myq79qew.js → chunk-ttb2tt03.js} +47 -27
- package/dist/shared/chunk-vy874zxe.js +68 -0
- package/dist/shared/chunk-ww7k2azn.js +297 -0
- package/dist/shared/{chunk-jda3v59q.js → chunk-xa1b96mb.js} +2 -2
- package/dist/shared/chunk-xs6gp369.js +245 -0
- package/dist/shared/chunk-y4mmmayp.js +206 -0
- package/dist/src/accordion/accordion.js +1 -1
- package/dist/src/alert-dialog/alert-dialog.js +1 -1
- package/dist/src/badge/badge.js +1 -1
- package/dist/src/button/button.js +1 -1
- package/dist/src/calendar/calendar.js +1 -1
- package/dist/src/carousel/carousel.js +1 -1
- package/dist/src/checkbox/checkbox.js +1 -1
- package/dist/src/collapsible/collapsible.js +1 -1
- package/dist/src/combobox/combobox.js +1 -1
- package/dist/src/command/command.js +1 -1
- package/dist/src/context-menu/context-menu.js +1 -1
- package/dist/src/date-picker/date-picker.js +1 -1
- package/dist/src/dialog/dialog.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/src/hover-card/hover-card.js +1 -1
- package/dist/src/index.d.ts +14 -1
- package/dist/src/index.js +5595 -4310
- package/dist/src/menu/menu.js +1 -1
- package/dist/src/menubar/menubar.js +1 -1
- package/dist/src/navigation-menu/navigation-menu.js +1 -1
- package/dist/src/popover/popover.js +1 -1
- package/dist/src/progress/progress.js +1 -1
- package/dist/src/radio/radio.js +1 -1
- package/dist/src/resizable-panel/resizable-panel.js +1 -1
- package/dist/src/scroll-area/scroll-area.js +1 -1
- package/dist/src/select/select.js +1 -1
- package/dist/src/sheet/sheet.js +1 -1
- package/dist/src/slider/slider.js +1 -1
- package/dist/src/switch/switch.js +1 -1
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/toggle/toggle.js +1 -1
- package/dist/src/toggle-group/toggle-group.js +1 -1
- package/dist/src/tooltip/tooltip.js +1 -1
- package/package.json +3 -3
- package/dist/shared/chunk-07yzsaaw.js +0 -165
- package/dist/shared/chunk-279bzynx.js +0 -132
- package/dist/shared/chunk-27xs9apd.js +0 -288
- package/dist/shared/chunk-2k8gxzdf.js +0 -151
- package/dist/shared/chunk-3rp73gkd.js +0 -175
- package/dist/shared/chunk-4rf1m34c.js +0 -267
- package/dist/shared/chunk-7bxsf80c.js +0 -60
- package/dist/shared/chunk-8qtexw5s.js +0 -199
- package/dist/shared/chunk-9ezgd78r.js +0 -142
- package/dist/shared/chunk-ajpj10z0.js +0 -282
- package/dist/shared/chunk-c46v0fsw.js +0 -117
- package/dist/shared/chunk-e4mm5e59.js +0 -178
- package/dist/shared/chunk-fqa5bwn1.js +0 -128
- package/dist/shared/chunk-g8hnc95b.js +0 -219
- package/dist/shared/chunk-j2tdpxgc.js +0 -185
- package/dist/shared/chunk-kcnq15je.js +0 -175
- package/dist/shared/chunk-mqs4qq0b.js +0 -46
- package/dist/shared/chunk-pg2yjn8f.js +0 -88
- package/dist/shared/chunk-rb53v045.js +0 -71
- package/dist/shared/chunk-s6a2yph8.js +0 -239
- package/dist/shared/chunk-vhx3sqw6.js +0 -196
- package/dist/shared/chunk-w318par6.js +0 -204
- package/dist/shared/chunk-wcdq7bew.js +0 -133
- package/dist/shared/chunk-z0gwkzgp.js +0 -34
- package/dist/shared/chunk-z850et33.js +0 -161
- package/dist/shared/chunk-zyfc6cx3.js +0 -61
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
focusFirst,
|
|
3
|
+
saveFocus,
|
|
4
|
+
trapFocus
|
|
5
|
+
} from "./chunk-e2v1c9ex.js";
|
|
6
|
+
import {
|
|
7
|
+
Keys,
|
|
8
|
+
isKey
|
|
9
|
+
} from "./chunk-7867pr13.js";
|
|
10
|
+
import {
|
|
11
|
+
setDataState,
|
|
12
|
+
setDescribedBy,
|
|
13
|
+
setExpanded,
|
|
14
|
+
setHidden,
|
|
15
|
+
setHiddenAnimated,
|
|
16
|
+
setLabelledBy
|
|
17
|
+
} from "./chunk-vevfhpc9.js";
|
|
18
|
+
import {
|
|
19
|
+
linkedIds
|
|
20
|
+
} from "./chunk-8y1jf6xr.js";
|
|
21
|
+
import {
|
|
22
|
+
applyAttrs
|
|
23
|
+
} from "./chunk-2db2dnp3.js";
|
|
24
|
+
|
|
25
|
+
// src/dialog/dialog.tsx
|
|
26
|
+
import { __discardMountFrame, __element, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
27
|
+
import { signal } from "@vertz/ui";
|
|
28
|
+
function DialogRoot(options = {}) {
|
|
29
|
+
const __mfDepth = __pushMountFrame();
|
|
30
|
+
try {
|
|
31
|
+
let openDialog = function() {
|
|
32
|
+
state.open.value = true;
|
|
33
|
+
setExpanded(trigger, true);
|
|
34
|
+
setHidden(overlay, false);
|
|
35
|
+
setHidden(content, false);
|
|
36
|
+
setDataState(trigger, "open");
|
|
37
|
+
setDataState(overlay, "open");
|
|
38
|
+
setDataState(content, "open");
|
|
39
|
+
restoreFocus = saveFocus();
|
|
40
|
+
if (modal) {
|
|
41
|
+
removeTrap = trapFocus(content);
|
|
42
|
+
}
|
|
43
|
+
queueMicrotask(() => focusFirst(content));
|
|
44
|
+
onOpenChange?.(true);
|
|
45
|
+
}, closeDialog = function() {
|
|
46
|
+
state.open.value = false;
|
|
47
|
+
setExpanded(trigger, false);
|
|
48
|
+
setDataState(trigger, "closed");
|
|
49
|
+
setDataState(overlay, "closed");
|
|
50
|
+
setDataState(content, "closed");
|
|
51
|
+
setHiddenAnimated(overlay, true);
|
|
52
|
+
setHiddenAnimated(content, true);
|
|
53
|
+
removeTrap?.();
|
|
54
|
+
removeTrap = null;
|
|
55
|
+
restoreFocus?.();
|
|
56
|
+
restoreFocus = null;
|
|
57
|
+
onOpenChange?.(false);
|
|
58
|
+
};
|
|
59
|
+
const { modal = true, defaultOpen = false, onOpenChange, ...attrs } = options;
|
|
60
|
+
const ids = linkedIds("dialog");
|
|
61
|
+
const titleId = `${ids.contentId}-title`;
|
|
62
|
+
const descriptionId = `${ids.contentId}-description`;
|
|
63
|
+
const state = { open: signal(defaultOpen) };
|
|
64
|
+
let restoreFocus = null;
|
|
65
|
+
let removeTrap = null;
|
|
66
|
+
const trigger = (() => {
|
|
67
|
+
const __el0 = __element("button");
|
|
68
|
+
__el0.setAttribute("type", "button");
|
|
69
|
+
{
|
|
70
|
+
const __v = ids.triggerId;
|
|
71
|
+
if (__v != null && __v !== false)
|
|
72
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
73
|
+
}
|
|
74
|
+
{
|
|
75
|
+
const __v = ids.contentId;
|
|
76
|
+
if (__v != null && __v !== false)
|
|
77
|
+
__el0.setAttribute("aria-controls", __v === true ? "" : __v);
|
|
78
|
+
}
|
|
79
|
+
{
|
|
80
|
+
const __v = defaultOpen ? "true" : "false";
|
|
81
|
+
if (__v != null && __v !== false)
|
|
82
|
+
__el0.setAttribute("aria-expanded", __v === true ? "" : __v);
|
|
83
|
+
}
|
|
84
|
+
{
|
|
85
|
+
const __v = defaultOpen ? "open" : "closed";
|
|
86
|
+
if (__v != null && __v !== false)
|
|
87
|
+
__el0.setAttribute("data-state", __v === true ? "" : __v);
|
|
88
|
+
}
|
|
89
|
+
__on(__el0, "click", () => {
|
|
90
|
+
if (state.open.peek()) {
|
|
91
|
+
closeDialog();
|
|
92
|
+
} else {
|
|
93
|
+
openDialog();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return __el0;
|
|
97
|
+
})();
|
|
98
|
+
const overlay = (() => {
|
|
99
|
+
const __el1 = __element("div");
|
|
100
|
+
__el1.setAttribute("data-dialog-overlay", "");
|
|
101
|
+
{
|
|
102
|
+
const __v = defaultOpen ? "false" : "true";
|
|
103
|
+
if (__v != null && __v !== false)
|
|
104
|
+
__el1.setAttribute("aria-hidden", __v === true ? "" : __v);
|
|
105
|
+
}
|
|
106
|
+
{
|
|
107
|
+
const __v = defaultOpen ? "open" : "closed";
|
|
108
|
+
if (__v != null && __v !== false)
|
|
109
|
+
__el1.setAttribute("data-state", __v === true ? "" : __v);
|
|
110
|
+
}
|
|
111
|
+
{
|
|
112
|
+
const __v = { display: defaultOpen ? "" : "none" };
|
|
113
|
+
if (__v != null && __v !== false)
|
|
114
|
+
__el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
115
|
+
}
|
|
116
|
+
__on(__el1, "click", () => closeDialog());
|
|
117
|
+
return __el1;
|
|
118
|
+
})();
|
|
119
|
+
const content = (() => {
|
|
120
|
+
const __el2 = __element("div");
|
|
121
|
+
__el2.setAttribute("role", "dialog");
|
|
122
|
+
{
|
|
123
|
+
const __v = ids.contentId;
|
|
124
|
+
if (__v != null && __v !== false)
|
|
125
|
+
__el2.setAttribute("id", __v === true ? "" : __v);
|
|
126
|
+
}
|
|
127
|
+
{
|
|
128
|
+
const __v = modal ? "true" : undefined;
|
|
129
|
+
if (__v != null && __v !== false)
|
|
130
|
+
__el2.setAttribute("aria-modal", __v === true ? "" : __v);
|
|
131
|
+
}
|
|
132
|
+
{
|
|
133
|
+
const __v = defaultOpen ? "false" : "true";
|
|
134
|
+
if (__v != null && __v !== false)
|
|
135
|
+
__el2.setAttribute("aria-hidden", __v === true ? "" : __v);
|
|
136
|
+
}
|
|
137
|
+
{
|
|
138
|
+
const __v = defaultOpen ? "open" : "closed";
|
|
139
|
+
if (__v != null && __v !== false)
|
|
140
|
+
__el2.setAttribute("data-state", __v === true ? "" : __v);
|
|
141
|
+
}
|
|
142
|
+
{
|
|
143
|
+
const __v = { display: defaultOpen ? "" : "none" };
|
|
144
|
+
if (__v != null && __v !== false)
|
|
145
|
+
__el2.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
146
|
+
}
|
|
147
|
+
__on(__el2, "keydown", (event) => {
|
|
148
|
+
if (isKey(event, Keys.Escape)) {
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
event.stopPropagation();
|
|
151
|
+
closeDialog();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return __el2;
|
|
155
|
+
})();
|
|
156
|
+
setLabelledBy(content, titleId);
|
|
157
|
+
setDescribedBy(content, descriptionId);
|
|
158
|
+
const title = (() => {
|
|
159
|
+
const __el3 = __element("h2");
|
|
160
|
+
{
|
|
161
|
+
const __v = titleId;
|
|
162
|
+
if (__v != null && __v !== false)
|
|
163
|
+
__el3.setAttribute("id", __v === true ? "" : __v);
|
|
164
|
+
}
|
|
165
|
+
return __el3;
|
|
166
|
+
})();
|
|
167
|
+
const description = (() => {
|
|
168
|
+
const __el4 = __element("p");
|
|
169
|
+
{
|
|
170
|
+
const __v = descriptionId;
|
|
171
|
+
if (__v != null && __v !== false)
|
|
172
|
+
__el4.setAttribute("id", __v === true ? "" : __v);
|
|
173
|
+
}
|
|
174
|
+
return __el4;
|
|
175
|
+
})();
|
|
176
|
+
const close = (() => {
|
|
177
|
+
const __el5 = __element("button");
|
|
178
|
+
__el5.setAttribute("type", "button");
|
|
179
|
+
__el5.setAttribute("aria-label", "Close");
|
|
180
|
+
__on(__el5, "click", () => closeDialog());
|
|
181
|
+
return __el5;
|
|
182
|
+
})();
|
|
183
|
+
applyAttrs(content, attrs);
|
|
184
|
+
const __mfResult0 = {
|
|
185
|
+
trigger,
|
|
186
|
+
overlay,
|
|
187
|
+
content,
|
|
188
|
+
title,
|
|
189
|
+
description,
|
|
190
|
+
close,
|
|
191
|
+
state,
|
|
192
|
+
show: openDialog,
|
|
193
|
+
hide: closeDialog
|
|
194
|
+
};
|
|
195
|
+
__flushMountFrame();
|
|
196
|
+
return __mfResult0;
|
|
197
|
+
} catch (__mfErr) {
|
|
198
|
+
__discardMountFrame(__mfDepth);
|
|
199
|
+
throw __mfErr;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
var Dialog = {
|
|
203
|
+
Root: DialogRoot
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export { Dialog };
|
package/dist/src/badge/badge.js
CHANGED
package/dist/src/index.d.ts
CHANGED
|
@@ -794,6 +794,8 @@ interface CalendarClasses {
|
|
|
794
794
|
headCell?: string;
|
|
795
795
|
cell?: string;
|
|
796
796
|
dayButton?: string;
|
|
797
|
+
monthSelect?: string;
|
|
798
|
+
yearSelect?: string;
|
|
797
799
|
}
|
|
798
800
|
type CalendarClassKey = keyof CalendarClasses;
|
|
799
801
|
interface ComposedCalendarProps {
|
|
@@ -813,6 +815,13 @@ interface ComposedCalendarProps {
|
|
|
813
815
|
to: Date;
|
|
814
816
|
} | null) => void;
|
|
815
817
|
onMonthChange?: (month: Date) => void;
|
|
818
|
+
/**
|
|
819
|
+
* Controls how the calendar header navigation is rendered.
|
|
820
|
+
* - 'buttons' (default): prev/next arrow buttons only
|
|
821
|
+
* - 'dropdown': month + year <select> elements, no arrow buttons
|
|
822
|
+
* - 'dropdown-buttons': month + year <select> elements AND arrow buttons
|
|
823
|
+
*/
|
|
824
|
+
captionLayout?: "buttons" | "dropdown" | "dropdown-buttons";
|
|
816
825
|
}
|
|
817
826
|
declare const ComposedCalendar: ((props: ComposedCalendarProps) => HTMLElement) & {
|
|
818
827
|
__classKeys?: CalendarClassKey;
|
|
@@ -1052,6 +1061,7 @@ interface ComposedDatePickerProps {
|
|
|
1052
1061
|
to: Date;
|
|
1053
1062
|
} | null) => void;
|
|
1054
1063
|
onOpenChange?: (open: boolean) => void;
|
|
1064
|
+
captionLayout?: ComposedCalendarProps["captionLayout"];
|
|
1055
1065
|
}
|
|
1056
1066
|
declare const ComposedDatePicker: ((props: ComposedDatePickerProps) => HTMLElement) & {
|
|
1057
1067
|
__classKeys?: DatePickerClassKey;
|
|
@@ -1319,11 +1329,14 @@ interface ResizablePanelClasses {
|
|
|
1319
1329
|
handle?: string;
|
|
1320
1330
|
}
|
|
1321
1331
|
type ResizablePanelClassKey = keyof ResizablePanelClasses;
|
|
1322
|
-
interface PanelSlotProps
|
|
1332
|
+
interface PanelSlotProps {
|
|
1323
1333
|
children?: ChildValue18;
|
|
1324
1334
|
className?: string;
|
|
1325
1335
|
/** @deprecated Use `className` instead. */
|
|
1326
1336
|
class?: string;
|
|
1337
|
+
defaultSize?: number;
|
|
1338
|
+
minSize?: number;
|
|
1339
|
+
maxSize?: number;
|
|
1327
1340
|
}
|
|
1328
1341
|
interface HandleSlotProps {
|
|
1329
1342
|
className?: string;
|