@vertz/ui-primitives 0.2.41 → 0.2.42
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-06m8prfg.js +52 -0
- package/dist/shared/chunk-0n9jj8xr.js +24 -0
- package/dist/shared/chunk-1ben27xq.js +317 -0
- package/dist/shared/chunk-1j2mj0sa.js +45 -0
- package/dist/shared/chunk-250hj18f.js +243 -0
- package/dist/shared/chunk-2h4m9c71.js +38 -0
- package/dist/shared/chunk-2sbx20hv.js +128 -0
- package/dist/shared/chunk-2ye674gr.js +70 -0
- package/dist/shared/chunk-34d8385y.js +15 -0
- package/dist/shared/chunk-4d7bm8h0.js +113 -0
- package/dist/shared/chunk-4zjgxr7x.js +157 -0
- package/dist/shared/chunk-5c150wvr.js +140 -0
- package/dist/shared/chunk-5gycdypd.js +58 -0
- package/dist/shared/chunk-6mm7fhp8.js +105 -0
- package/dist/shared/chunk-6zmnqvh6.js +109 -0
- package/dist/shared/{chunk-yy3ft5mb.js → chunk-7amn5d71.js} +2 -2
- package/dist/shared/chunk-7pbff2hg.js +118 -0
- package/dist/shared/chunk-7zpjshwz.js +194 -0
- package/dist/shared/chunk-993ff51d.js +155 -0
- package/dist/shared/chunk-9pdt5aw7.js +24 -0
- package/dist/shared/chunk-a71m4xkv.js +106 -0
- package/dist/shared/chunk-aj8m39pk.js +127 -0
- package/dist/shared/chunk-ajawpc05.js +305 -0
- package/dist/shared/chunk-b7mzwqhj.js +125 -0
- package/dist/shared/chunk-bb887de4.js +200 -0
- package/dist/shared/chunk-bfsmbrxc.js +111 -0
- package/dist/shared/chunk-c2f63m5n.js +56 -0
- package/dist/shared/chunk-c5r3s5km.js +263 -0
- package/dist/shared/chunk-caba5bhd.js +427 -0
- package/dist/shared/chunk-crym07yc.js +264 -0
- package/dist/shared/{chunk-5964gmv0.js → chunk-csjtyvam.js} +62 -88
- package/dist/shared/chunk-d6rtejz3.js +128 -0
- package/dist/shared/chunk-dvaf0bmq.js +140 -0
- package/dist/shared/chunk-dwkv9ya6.js +22 -0
- package/dist/shared/chunk-e0ckxrjg.js +41 -0
- package/dist/shared/chunk-ennxcymj.js +225 -0
- package/dist/shared/{chunk-1jd1n0dt.js → chunk-ey38de46.js} +19 -47
- package/dist/shared/chunk-f0v1gs5e.js +52 -0
- package/dist/shared/chunk-f86rsf84.js +231 -0
- package/dist/shared/{chunk-3sahbk4d.js → chunk-fdse46x5.js} +6 -1
- package/dist/shared/chunk-gj4hrssn.js +135 -0
- package/dist/shared/chunk-gyvq4gk9.js +24 -0
- package/dist/shared/chunk-hbnps9sq.js +229 -0
- package/dist/shared/{chunk-fhss32ya.js → chunk-hdmpyeq9.js} +43 -132
- package/dist/shared/chunk-hgnkd4he.js +256 -0
- package/dist/shared/chunk-hpcyffm7.js +185 -0
- package/dist/shared/chunk-hpmvwx0h.js +99 -0
- package/dist/shared/chunk-hz0e504p.js +69 -0
- package/dist/shared/chunk-hzk4wfq9.js +43 -0
- package/dist/shared/chunk-j7znzkpa.js +48 -0
- package/dist/shared/chunk-j9kxgrnn.js +167 -0
- package/dist/shared/chunk-jetwnv0w.js +130 -0
- package/dist/shared/chunk-jjdg26c1.js +155 -0
- package/dist/shared/chunk-k0m4yh86.js +123 -0
- package/dist/shared/chunk-k43q9cjr.js +82 -0
- package/dist/shared/chunk-k9k8tbr5.js +119 -0
- package/dist/shared/chunk-meaj7br1.js +232 -0
- package/dist/shared/chunk-mgj0n08k.js +34 -0
- package/dist/shared/chunk-mjz4rp6c.js +46 -0
- package/dist/shared/chunk-n4rr5gme.js +239 -0
- package/dist/shared/chunk-nk55etpp.js +65 -0
- package/dist/shared/chunk-nkh1ks3k.js +264 -0
- package/dist/shared/chunk-pgvpvbpe.js +26 -0
- package/dist/shared/chunk-pma8gnv7.js +178 -0
- package/dist/shared/chunk-q7xv6xze.js +131 -0
- package/dist/shared/chunk-qey801nq.js +22 -0
- package/dist/shared/chunk-s6b4c3tj.js +58 -0
- package/dist/shared/chunk-sq27a4h0.js +36 -0
- package/dist/shared/chunk-taa5pj15.js +103 -0
- package/dist/shared/chunk-tc5rpvyx.js +127 -0
- package/dist/shared/chunk-tescm0b3.js +192 -0
- package/dist/shared/chunk-tkftdwnq.js +71 -0
- package/dist/shared/chunk-tqhnjcfp.js +116 -0
- package/dist/shared/chunk-vfknb5ht.js +183 -0
- package/dist/shared/chunk-vsc369w3.js +185 -0
- package/dist/shared/chunk-whq9s8v5.js +301 -0
- package/dist/shared/{chunk-hze1f32t.js → chunk-wrqddgaj.js} +1 -1
- package/dist/shared/chunk-yzbmkx4r.js +155 -0
- package/dist/shared/chunk-zaen0ajc.js +347 -0
- package/dist/src/accordion/accordion-composed.js +1 -1
- package/dist/src/accordion/accordion.js +1 -1
- package/dist/src/alert/alert-composed.js +1 -1
- package/dist/src/alert-dialog/alert-dialog-composed.js +1 -1
- package/dist/src/alert-dialog/alert-dialog.js +1 -1
- package/dist/src/avatar/avatar-composed.js +1 -1
- package/dist/src/badge/badge-composed.js +1 -1
- package/dist/src/badge/badge.js +1 -1
- package/dist/src/breadcrumb/breadcrumb-composed.js +1 -1
- package/dist/src/button/button-composed.js +1 -1
- package/dist/src/button/button.js +1 -1
- package/dist/src/calendar/calendar-composed.js +1 -1
- package/dist/src/calendar/calendar.js +1 -1
- package/dist/src/card/card-composed.js +1 -1
- package/dist/src/carousel/carousel-composed.js +1 -1
- package/dist/src/carousel/carousel.js +1 -1
- package/dist/src/checkbox/checkbox-composed.js +1 -1
- package/dist/src/checkbox/checkbox.js +1 -1
- package/dist/src/collapsible/collapsible-composed.js +1 -1
- package/dist/src/collapsible/collapsible.js +1 -1
- package/dist/src/combobox/combobox-composed.js +1 -1
- package/dist/src/combobox/combobox.js +1 -1
- package/dist/src/command/command-composed.js +1 -1
- package/dist/src/command/command.js +1 -1
- package/dist/src/composed/with-styles.js +1 -1
- package/dist/src/context-menu/context-menu-composed.js +1 -1
- package/dist/src/context-menu/context-menu.js +1 -1
- package/dist/src/date-picker/date-picker-composed.js +1 -1
- package/dist/src/date-picker/date-picker.js +1 -1
- package/dist/src/dialog/dialog-composed.js +1 -1
- package/dist/src/dialog/dialog-stack-parts.js +1 -1
- package/dist/src/dialog/dialog.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu-composed.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/src/empty-state/empty-state-composed.js +1 -1
- package/dist/src/form-group/form-group-composed.js +1 -1
- package/dist/src/hover-card/hover-card-composed.js +1 -1
- package/dist/src/hover-card/hover-card.js +1 -1
- package/dist/src/input/input-composed.js +1 -1
- package/dist/src/label/label-composed.js +1 -1
- package/dist/src/list/list-composed.js +1 -1
- package/dist/src/menu/menu-composed.js +1 -1
- package/dist/src/menu/menu.js +1 -1
- package/dist/src/menubar/menubar-composed.js +1 -1
- package/dist/src/menubar/menubar.js +1 -1
- package/dist/src/navigation-menu/navigation-menu-composed.js +1 -1
- package/dist/src/navigation-menu/navigation-menu.js +1 -1
- package/dist/src/pagination/pagination-composed.js +1 -1
- package/dist/src/popover/popover-composed.js +1 -1
- package/dist/src/popover/popover.js +1 -1
- package/dist/src/progress/progress-composed.js +1 -1
- package/dist/src/progress/progress.js +1 -1
- package/dist/src/radio/radio-composed.js +1 -1
- package/dist/src/radio/radio.js +1 -1
- package/dist/src/resizable-panel/resizable-panel-composed.js +1 -1
- package/dist/src/resizable-panel/resizable-panel.js +1 -1
- package/dist/src/scroll-area/scroll-area-composed.js +1 -1
- package/dist/src/scroll-area/scroll-area.js +1 -1
- package/dist/src/select/select-composed.js +1 -1
- package/dist/src/select/select.js +1 -1
- package/dist/src/separator/separator-composed.js +1 -1
- package/dist/src/sheet/sheet-composed.js +1 -1
- package/dist/src/sheet/sheet.js +1 -1
- package/dist/src/skeleton/skeleton-composed.js +1 -1
- package/dist/src/slider/slider-composed.js +1 -1
- package/dist/src/slider/slider.js +1 -1
- package/dist/src/switch/switch-composed.js +1 -1
- package/dist/src/switch/switch.js +1 -1
- package/dist/src/table/table-composed.js +1 -1
- package/dist/src/tabs/tabs-composed.js +1 -1
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/textarea/textarea-composed.js +1 -1
- package/dist/src/toast/toast.js +1 -1
- package/dist/src/toggle/toggle-composed.js +1 -1
- package/dist/src/toggle/toggle.js +1 -1
- package/dist/src/toggle-group/toggle-group-composed.js +1 -1
- package/dist/src/toggle-group/toggle-group.js +1 -1
- package/dist/src/tooltip/tooltip-composed.js +1 -1
- package/dist/src/tooltip/tooltip.js +1 -1
- package/package.json +3 -3
- package/dist/shared/chunk-144kbnmx.js +0 -95
- package/dist/shared/chunk-1ewxfgsa.js +0 -167
- package/dist/shared/chunk-1hm0mbke.js +0 -258
- package/dist/shared/chunk-22rt6ws9.js +0 -69
- package/dist/shared/chunk-2ssqz188.js +0 -162
- package/dist/shared/chunk-33he7ay9.js +0 -218
- package/dist/shared/chunk-3jack97k.js +0 -509
- package/dist/shared/chunk-75pegjs7.js +0 -26
- package/dist/shared/chunk-862x7dja.js +0 -398
- package/dist/shared/chunk-8pk1pn5h.js +0 -215
- package/dist/shared/chunk-8t0nm721.js +0 -152
- package/dist/shared/chunk-94twh4s4.js +0 -28
- package/dist/shared/chunk-9yb26c0w.js +0 -232
- package/dist/shared/chunk-a82r2pnq.js +0 -67
- package/dist/shared/chunk-axpbdpgx.js +0 -177
- package/dist/shared/chunk-b3j6mym6.js +0 -203
- package/dist/shared/chunk-b4zzg457.js +0 -410
- package/dist/shared/chunk-b9qxfcsy.js +0 -60
- package/dist/shared/chunk-bc2qqkhr.js +0 -194
- package/dist/shared/chunk-bv12nkdm.js +0 -149
- package/dist/shared/chunk-bvxc1ww4.js +0 -164
- package/dist/shared/chunk-czv0kqj4.js +0 -107
- package/dist/shared/chunk-d83ag07h.js +0 -189
- package/dist/shared/chunk-de18ashk.js +0 -134
- package/dist/shared/chunk-dvk4h36t.js +0 -140
- package/dist/shared/chunk-dxvnerw2.js +0 -353
- package/dist/shared/chunk-e399pzdq.js +0 -241
- package/dist/shared/chunk-e4qha9as.js +0 -180
- package/dist/shared/chunk-eb2d9v6k.js +0 -68
- package/dist/shared/chunk-ect26sp5.js +0 -353
- package/dist/shared/chunk-ev367pq3.js +0 -102
- package/dist/shared/chunk-fjykbv0v.js +0 -214
- package/dist/shared/chunk-gdddk6nh.js +0 -96
- package/dist/shared/chunk-ghkw5bjq.js +0 -55
- package/dist/shared/chunk-hfjtkytb.js +0 -310
- package/dist/shared/chunk-hpvjfj0j.js +0 -31
- package/dist/shared/chunk-jpyjk616.js +0 -52
- package/dist/shared/chunk-k6d53tne.js +0 -206
- package/dist/shared/chunk-knzg86am.js +0 -168
- package/dist/shared/chunk-ktbf6xrt.js +0 -179
- package/dist/shared/chunk-m8y2p66x.js +0 -252
- package/dist/shared/chunk-metxdt5x.js +0 -28
- package/dist/shared/chunk-mgae1d93.js +0 -157
- package/dist/shared/chunk-mtx2cfbx.js +0 -175
- package/dist/shared/chunk-n436p5cb.js +0 -260
- package/dist/shared/chunk-nj420k31.js +0 -54
- package/dist/shared/chunk-nsmvdxgp.js +0 -213
- package/dist/shared/chunk-pcms04vq.js +0 -162
- package/dist/shared/chunk-pqskzq8t.js +0 -79
- package/dist/shared/chunk-pwr60kyd.js +0 -321
- package/dist/shared/chunk-pzknpa1y.js +0 -327
- package/dist/shared/chunk-q77y3rg4.js +0 -189
- package/dist/shared/chunk-qhnany7w.js +0 -179
- package/dist/shared/chunk-rdr0rtpr.js +0 -131
- package/dist/shared/chunk-rj52ty6r.js +0 -147
- package/dist/shared/chunk-rnqc7735.js +0 -125
- package/dist/shared/chunk-rtk30950.js +0 -202
- package/dist/shared/chunk-s0xgd8vg.js +0 -266
- package/dist/shared/chunk-s415735j.js +0 -357
- package/dist/shared/chunk-s62e7jf4.js +0 -30
- package/dist/shared/chunk-snd8e6r8.js +0 -418
- package/dist/shared/chunk-spng4yb9.js +0 -73
- package/dist/shared/chunk-t887wwjc.js +0 -168
- package/dist/shared/chunk-tn0m98j8.js +0 -42
- package/dist/shared/chunk-v0b5pkcq.js +0 -30
- package/dist/shared/chunk-v5tj7veh.js +0 -284
- package/dist/shared/chunk-vkscwzpr.js +0 -294
- package/dist/shared/chunk-vv187snj.js +0 -112
- package/dist/shared/chunk-xv4wd0kf.js +0 -293
- package/dist/shared/chunk-y1hpsqzy.js +0 -185
- package/dist/shared/chunk-yfzddvxc.js +0 -71
- package/dist/shared/chunk-yzgzx2dh.js +0 -311
- package/dist/shared/chunk-z5j7ztf2.js +0 -467
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
uniqueId
|
|
3
|
+
} from "./chunk-8y1jf6xr.js";
|
|
4
|
+
import {
|
|
5
|
+
setDataState
|
|
6
|
+
} from "./chunk-vevfhpc9.js";
|
|
7
|
+
import {
|
|
8
|
+
applyAttrs
|
|
9
|
+
} from "./chunk-2db2dnp3.js";
|
|
10
|
+
|
|
11
|
+
// src/toast/toast.tsx
|
|
12
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
13
|
+
import { signal } from "@vertz/ui";
|
|
14
|
+
function RegionElement(politeness) {
|
|
15
|
+
return jsxDEV_7x81h0kn("div", {
|
|
16
|
+
role: "status",
|
|
17
|
+
"aria-live": politeness,
|
|
18
|
+
"aria-atomic": "false",
|
|
19
|
+
"data-state": "empty"
|
|
20
|
+
}, undefined, false, undefined, this);
|
|
21
|
+
}
|
|
22
|
+
function MessageElement(id, content) {
|
|
23
|
+
return jsxDEV_7x81h0kn("div", {
|
|
24
|
+
role: "status",
|
|
25
|
+
"data-toast-id": id,
|
|
26
|
+
"data-state": "open",
|
|
27
|
+
children: content
|
|
28
|
+
}, undefined, false, undefined, this);
|
|
29
|
+
}
|
|
30
|
+
function ToastRoot(options = {}) {
|
|
31
|
+
const { duration = 5000, politeness = "polite", ...attrs } = options;
|
|
32
|
+
const state = { messages: signal([]) };
|
|
33
|
+
const region = RegionElement(politeness);
|
|
34
|
+
applyAttrs(region, attrs);
|
|
35
|
+
function announce(content) {
|
|
36
|
+
const id = uniqueId("toast");
|
|
37
|
+
const el = MessageElement(id, content);
|
|
38
|
+
const msg = { id, content, el };
|
|
39
|
+
state.messages.value = [...state.messages.peek(), msg];
|
|
40
|
+
region.appendChild(el);
|
|
41
|
+
setDataState(region, "active");
|
|
42
|
+
if (duration > 0) {
|
|
43
|
+
setTimeout(() => dismiss(id), duration);
|
|
44
|
+
}
|
|
45
|
+
return msg;
|
|
46
|
+
}
|
|
47
|
+
function dismiss(id) {
|
|
48
|
+
const messages = state.messages.peek().filter((m) => m.id !== id);
|
|
49
|
+
state.messages.value = messages;
|
|
50
|
+
const el = region.querySelector(`[data-toast-id="${id}"]`);
|
|
51
|
+
if (el) {
|
|
52
|
+
setDataState(el, "closed");
|
|
53
|
+
el.remove();
|
|
54
|
+
}
|
|
55
|
+
if (messages.length === 0) {
|
|
56
|
+
setDataState(region, "empty");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return { region, state, announce, dismiss };
|
|
60
|
+
}
|
|
61
|
+
var Toast = {
|
|
62
|
+
Root: ToastRoot
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { Toast };
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDismiss
|
|
3
|
+
} from "./chunk-a6wp8c32.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-q7xbcj9q.js";
|
|
7
|
+
import {
|
|
8
|
+
createFloatingPosition,
|
|
9
|
+
resolveLayoutElement
|
|
10
|
+
} from "./chunk-vef3sepw.js";
|
|
11
|
+
import {
|
|
12
|
+
linkedIds
|
|
13
|
+
} from "./chunk-8y1jf6xr.js";
|
|
14
|
+
import {
|
|
15
|
+
Keys,
|
|
16
|
+
handleListNavigation,
|
|
17
|
+
isKey
|
|
18
|
+
} from "./chunk-7867pr13.js";
|
|
19
|
+
|
|
20
|
+
// src/dropdown-menu/dropdown-menu-composed.tsx
|
|
21
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
22
|
+
import { createContext, ref, useContext } from "@vertz/ui";
|
|
23
|
+
var DropdownMenuContext = createContext(undefined, "@vertz/ui-primitives::DropdownMenuContext");
|
|
24
|
+
function useDropdownMenuContext(componentName) {
|
|
25
|
+
const ctx = useContext(DropdownMenuContext);
|
|
26
|
+
if (!ctx) {
|
|
27
|
+
throw new Error(`<DropdownMenu.${componentName}> must be used inside <DropdownMenu>. ` + "Ensure it is a direct or nested child of the DropdownMenu root component.");
|
|
28
|
+
}
|
|
29
|
+
return ctx;
|
|
30
|
+
}
|
|
31
|
+
function MenuTrigger({ children }) {
|
|
32
|
+
const ctx = useDropdownMenuContext("Trigger");
|
|
33
|
+
return jsxDEV_7x81h0kn("span", {
|
|
34
|
+
style: { display: "contents" },
|
|
35
|
+
"data-dropdownmenu-trigger": "",
|
|
36
|
+
"aria-haspopup": "menu",
|
|
37
|
+
"aria-controls": ctx.contentId,
|
|
38
|
+
"aria-expanded": "false",
|
|
39
|
+
"data-state": "closed",
|
|
40
|
+
onClick: () => ctx.toggle(),
|
|
41
|
+
onKeydown: (event) => {
|
|
42
|
+
if (isKey(event, Keys.ArrowDown, Keys.Enter, Keys.Space)) {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
if (!ctx.isOpen())
|
|
45
|
+
ctx.open(true);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
children
|
|
49
|
+
}, undefined, false, undefined, this);
|
|
50
|
+
}
|
|
51
|
+
function MenuContent({ children, className: cls, class: classProp }) {
|
|
52
|
+
const ctx = useDropdownMenuContext("Content");
|
|
53
|
+
const instanceIndex = ctx._contentCount.value++;
|
|
54
|
+
if (instanceIndex > 0) {
|
|
55
|
+
console.warn("Duplicate <DropdownMenu.Content> detected – only the first is used");
|
|
56
|
+
}
|
|
57
|
+
return jsxDEV_7x81h0kn("div", {
|
|
58
|
+
ref: ctx.contentRef,
|
|
59
|
+
role: "menu",
|
|
60
|
+
tabindex: "-1",
|
|
61
|
+
id: ctx.contentId,
|
|
62
|
+
"data-dropdownmenu-content": "",
|
|
63
|
+
"aria-hidden": "true",
|
|
64
|
+
"data-state": "closed",
|
|
65
|
+
style: { display: "none" },
|
|
66
|
+
class: cn(ctx.classes?.content, cls ?? classProp),
|
|
67
|
+
onKeydown: (event) => {
|
|
68
|
+
if (isKey(event, Keys.Escape)) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
ctx.close();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const el = event.currentTarget ?? event.target;
|
|
74
|
+
const items = [...el.querySelectorAll('[role="menuitem"]')];
|
|
75
|
+
const focusedIdx = items.indexOf(document.activeElement);
|
|
76
|
+
if (isKey(event, Keys.Enter, Keys.Space)) {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
const active = items[focusedIdx];
|
|
79
|
+
if (active) {
|
|
80
|
+
const val = active.getAttribute("data-value");
|
|
81
|
+
if (val !== null) {
|
|
82
|
+
ctx.onSelect?.(val);
|
|
83
|
+
ctx.close();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
handleListNavigation(event, items, { orientation: "vertical" });
|
|
89
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
90
|
+
const char = event.key.toLowerCase();
|
|
91
|
+
const match = items.find((item) => item.textContent?.toLowerCase().startsWith(char));
|
|
92
|
+
if (match)
|
|
93
|
+
match.focus();
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
onClick: (event) => {
|
|
97
|
+
const target = event.target.closest('[role="menuitem"]');
|
|
98
|
+
if (target)
|
|
99
|
+
ctx.close();
|
|
100
|
+
},
|
|
101
|
+
children
|
|
102
|
+
}, undefined, false, undefined, this);
|
|
103
|
+
}
|
|
104
|
+
function MenuItem({ value, children, className: cls, class: classProp }) {
|
|
105
|
+
const ctx = useDropdownMenuContext("Item");
|
|
106
|
+
return jsxDEV_7x81h0kn("div", {
|
|
107
|
+
role: "menuitem",
|
|
108
|
+
"data-value": value,
|
|
109
|
+
tabindex: "-1",
|
|
110
|
+
class: cn(ctx.classes?.item, cls ?? classProp),
|
|
111
|
+
onClick: () => {
|
|
112
|
+
ctx.onSelect?.(value);
|
|
113
|
+
ctx.close();
|
|
114
|
+
},
|
|
115
|
+
children
|
|
116
|
+
}, undefined, false, undefined, this);
|
|
117
|
+
}
|
|
118
|
+
function MenuGroup({ label, children, className: cls, class: classProp }) {
|
|
119
|
+
const ctx = useDropdownMenuContext("Group");
|
|
120
|
+
return jsxDEV_7x81h0kn("div", {
|
|
121
|
+
role: "group",
|
|
122
|
+
"aria-label": label,
|
|
123
|
+
class: cn(ctx.classes?.group, cls ?? classProp),
|
|
124
|
+
children
|
|
125
|
+
}, undefined, false, undefined, this);
|
|
126
|
+
}
|
|
127
|
+
function MenuLabel({ children, className: cls, class: classProp }) {
|
|
128
|
+
const { classes } = useDropdownMenuContext("Label");
|
|
129
|
+
return jsxDEV_7x81h0kn("div", {
|
|
130
|
+
role: "none",
|
|
131
|
+
class: cn(classes?.label, cls ?? classProp),
|
|
132
|
+
children
|
|
133
|
+
}, undefined, false, undefined, this);
|
|
134
|
+
}
|
|
135
|
+
function MenuSeparator({ className: cls, class: classProp }) {
|
|
136
|
+
const { classes } = useDropdownMenuContext("Separator");
|
|
137
|
+
return jsxDEV_7x81h0kn("hr", {
|
|
138
|
+
role: "separator",
|
|
139
|
+
class: cn(classes?.separator, cls ?? classProp)
|
|
140
|
+
}, undefined, false, undefined, this);
|
|
141
|
+
}
|
|
142
|
+
function ComposedDropdownMenuRoot({
|
|
143
|
+
children,
|
|
144
|
+
classes,
|
|
145
|
+
onSelect,
|
|
146
|
+
onOpenChange,
|
|
147
|
+
positioning
|
|
148
|
+
}) {
|
|
149
|
+
const ids = linkedIds("menu");
|
|
150
|
+
const contentRef = ref();
|
|
151
|
+
let isOpen = false;
|
|
152
|
+
const state = { activeIndex: -1, floatingCleanup: null, dismissCleanup: null };
|
|
153
|
+
function getContentEl() {
|
|
154
|
+
return contentRef.current ?? null;
|
|
155
|
+
}
|
|
156
|
+
function getItems() {
|
|
157
|
+
const content = getContentEl();
|
|
158
|
+
if (!content)
|
|
159
|
+
return [];
|
|
160
|
+
return [...content.querySelectorAll('[role="menuitem"]')];
|
|
161
|
+
}
|
|
162
|
+
function getTriggerEl() {
|
|
163
|
+
const content = getContentEl();
|
|
164
|
+
const triggerSpan = content?.parentElement?.querySelector("[data-dropdownmenu-trigger]");
|
|
165
|
+
if (!triggerSpan)
|
|
166
|
+
return null;
|
|
167
|
+
return resolveLayoutElement(triggerSpan);
|
|
168
|
+
}
|
|
169
|
+
function updateActiveItem(items, index) {
|
|
170
|
+
items.forEach((item, i) => {
|
|
171
|
+
item.setAttribute("tabindex", i === index ? "0" : "-1");
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function syncContentAttrs() {
|
|
175
|
+
const contentEl = getContentEl();
|
|
176
|
+
if (!contentEl)
|
|
177
|
+
return;
|
|
178
|
+
const open2 = isOpen;
|
|
179
|
+
contentEl.style.display = open2 ? "" : "none";
|
|
180
|
+
contentEl.setAttribute("aria-hidden", open2 ? "false" : "true");
|
|
181
|
+
contentEl.setAttribute("data-state", open2 ? "open" : "closed");
|
|
182
|
+
const triggerEl = getTriggerEl();
|
|
183
|
+
if (triggerEl) {
|
|
184
|
+
triggerEl.setAttribute("aria-expanded", open2 ? "true" : "false");
|
|
185
|
+
triggerEl.setAttribute("data-state", open2 ? "open" : "closed");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function open(activateFirst = false) {
|
|
189
|
+
isOpen = true;
|
|
190
|
+
state.activeIndex = -1;
|
|
191
|
+
syncContentAttrs();
|
|
192
|
+
onOpenChange?.(true);
|
|
193
|
+
const contentEl = getContentEl();
|
|
194
|
+
const triggerEl = getTriggerEl();
|
|
195
|
+
if (!contentEl)
|
|
196
|
+
return;
|
|
197
|
+
{
|
|
198
|
+
const floatingOpts = positioning ?? { placement: "bottom-start", offset: 4 };
|
|
199
|
+
const refEl = floatingOpts.referenceElement ?? triggerEl ?? contentEl;
|
|
200
|
+
contentEl.style.position = "fixed";
|
|
201
|
+
const result = createFloatingPosition(refEl, contentEl, floatingOpts);
|
|
202
|
+
state.floatingCleanup = result.cleanup;
|
|
203
|
+
state.dismissCleanup = createDismiss({
|
|
204
|
+
onDismiss: close,
|
|
205
|
+
insideElements: [refEl, contentEl, ...triggerEl ? [triggerEl] : []],
|
|
206
|
+
escapeKey: false
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
const items = getItems();
|
|
210
|
+
if (activateFirst && items.length > 0) {
|
|
211
|
+
state.activeIndex = 0;
|
|
212
|
+
updateActiveItem(items, 0);
|
|
213
|
+
items[0]?.focus();
|
|
214
|
+
} else {
|
|
215
|
+
updateActiveItem(items, -1);
|
|
216
|
+
contentEl.focus();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function close() {
|
|
220
|
+
isOpen = false;
|
|
221
|
+
syncContentAttrs();
|
|
222
|
+
state.floatingCleanup?.();
|
|
223
|
+
state.floatingCleanup = null;
|
|
224
|
+
state.dismissCleanup?.();
|
|
225
|
+
state.dismissCleanup = null;
|
|
226
|
+
onOpenChange?.(false);
|
|
227
|
+
getTriggerEl()?.focus();
|
|
228
|
+
}
|
|
229
|
+
function toggle() {
|
|
230
|
+
if (isOpen)
|
|
231
|
+
close();
|
|
232
|
+
else
|
|
233
|
+
open();
|
|
234
|
+
}
|
|
235
|
+
const ctx = {
|
|
236
|
+
isOpen: () => isOpen,
|
|
237
|
+
contentId: ids.contentId,
|
|
238
|
+
contentRef,
|
|
239
|
+
classes,
|
|
240
|
+
onSelect,
|
|
241
|
+
open,
|
|
242
|
+
close,
|
|
243
|
+
toggle,
|
|
244
|
+
_contentCount: { value: 0 }
|
|
245
|
+
};
|
|
246
|
+
return jsxDEV_7x81h0kn(DropdownMenuContext.Provider, {
|
|
247
|
+
value: ctx,
|
|
248
|
+
children: jsxDEV_7x81h0kn("span", {
|
|
249
|
+
style: { display: "contents" },
|
|
250
|
+
"data-dropdownmenu-root": "",
|
|
251
|
+
children
|
|
252
|
+
}, undefined, false, undefined, this)
|
|
253
|
+
}, undefined, false, undefined, this);
|
|
254
|
+
}
|
|
255
|
+
var ComposedDropdownMenu = Object.assign(ComposedDropdownMenuRoot, {
|
|
256
|
+
Trigger: MenuTrigger,
|
|
257
|
+
Content: MenuContent,
|
|
258
|
+
Item: MenuItem,
|
|
259
|
+
Group: MenuGroup,
|
|
260
|
+
Label: MenuLabel,
|
|
261
|
+
Separator: MenuSeparator
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
export { ComposedDropdownMenu };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
|
|
5
|
+
// src/button/button-composed.tsx
|
|
6
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
7
|
+
function ComposedButtonRoot({
|
|
8
|
+
classes,
|
|
9
|
+
className,
|
|
10
|
+
class: classProp,
|
|
11
|
+
children,
|
|
12
|
+
disabled,
|
|
13
|
+
type,
|
|
14
|
+
...rest
|
|
15
|
+
}) {
|
|
16
|
+
return jsxDEV_7x81h0kn("button", {
|
|
17
|
+
type: type ?? "button",
|
|
18
|
+
class: cn(classes?.base, className ?? classProp),
|
|
19
|
+
disabled: disabled || undefined,
|
|
20
|
+
...rest,
|
|
21
|
+
children
|
|
22
|
+
}, undefined, false, undefined, this);
|
|
23
|
+
}
|
|
24
|
+
var ComposedButton = ComposedButtonRoot;
|
|
25
|
+
|
|
26
|
+
export { ComposedButton };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
|
|
5
|
+
// src/scroll-area/scroll-area-composed.tsx
|
|
6
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
7
|
+
import { ref } from "@vertz/ui";
|
|
8
|
+
function ComposedScrollAreaRoot({
|
|
9
|
+
children,
|
|
10
|
+
classes,
|
|
11
|
+
orientation = "vertical"
|
|
12
|
+
}) {
|
|
13
|
+
const viewportRef = ref();
|
|
14
|
+
const scrollbarYRef = ref();
|
|
15
|
+
const scrollbarXRef = ref();
|
|
16
|
+
const thumbYRef = ref();
|
|
17
|
+
const thumbXRef = ref();
|
|
18
|
+
let isDraggingY = false;
|
|
19
|
+
let startY = 0;
|
|
20
|
+
let startScrollTop = 0;
|
|
21
|
+
let isDraggingX = false;
|
|
22
|
+
let startX = 0;
|
|
23
|
+
let startScrollLeft = 0;
|
|
24
|
+
function syncThumbY() {
|
|
25
|
+
const vp = viewportRef.current;
|
|
26
|
+
const thumb = thumbYRef.current;
|
|
27
|
+
if (!vp || !thumb)
|
|
28
|
+
return;
|
|
29
|
+
const { scrollTop, scrollHeight, clientHeight } = vp;
|
|
30
|
+
if (scrollHeight <= clientHeight) {
|
|
31
|
+
thumb.style.height = "0";
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const ratio = clientHeight / scrollHeight;
|
|
35
|
+
thumb.style.height = `${ratio * 100}%`;
|
|
36
|
+
const scrollRatio = scrollTop / (scrollHeight - clientHeight);
|
|
37
|
+
thumb.style.transform = `translateY(${scrollRatio * (1 / ratio - 1) * 100}%)`;
|
|
38
|
+
}
|
|
39
|
+
function syncThumbX() {
|
|
40
|
+
const vp = viewportRef.current;
|
|
41
|
+
const thumb = thumbXRef.current;
|
|
42
|
+
if (!vp || !thumb)
|
|
43
|
+
return;
|
|
44
|
+
const { scrollLeft, scrollWidth, clientWidth } = vp;
|
|
45
|
+
if (scrollWidth <= clientWidth) {
|
|
46
|
+
thumb.style.width = "0";
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const ratio = clientWidth / scrollWidth;
|
|
50
|
+
thumb.style.width = `${ratio * 100}%`;
|
|
51
|
+
const scrollRatio = scrollLeft / (scrollWidth - clientWidth);
|
|
52
|
+
thumb.style.transform = `translateX(${scrollRatio * (1 / ratio - 1) * 100}%)`;
|
|
53
|
+
}
|
|
54
|
+
function handleViewportScroll() {
|
|
55
|
+
if (orientation === "vertical" || orientation === "both")
|
|
56
|
+
syncThumbY();
|
|
57
|
+
if (orientation === "horizontal" || orientation === "both")
|
|
58
|
+
syncThumbX();
|
|
59
|
+
}
|
|
60
|
+
function handleThumbYDown(e) {
|
|
61
|
+
const vp = viewportRef.current;
|
|
62
|
+
const thumb = thumbYRef.current;
|
|
63
|
+
if (!vp || !thumb)
|
|
64
|
+
return;
|
|
65
|
+
isDraggingY = true;
|
|
66
|
+
startY = e.clientY;
|
|
67
|
+
startScrollTop = vp.scrollTop;
|
|
68
|
+
thumb.setPointerCapture(e.pointerId);
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
}
|
|
71
|
+
function handleThumbYMove(e) {
|
|
72
|
+
if (!isDraggingY)
|
|
73
|
+
return;
|
|
74
|
+
const vp = viewportRef.current;
|
|
75
|
+
const scrollbar = scrollbarYRef.current;
|
|
76
|
+
if (!vp || !scrollbar)
|
|
77
|
+
return;
|
|
78
|
+
const delta = e.clientY - startY;
|
|
79
|
+
const scrollbarHeight = scrollbar.clientHeight;
|
|
80
|
+
const scrollRange = vp.scrollHeight - vp.clientHeight;
|
|
81
|
+
if (scrollbarHeight > 0) {
|
|
82
|
+
vp.scrollTop = startScrollTop + delta / scrollbarHeight * scrollRange;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function handleThumbYUp(e) {
|
|
86
|
+
isDraggingY = false;
|
|
87
|
+
const thumb = thumbYRef.current;
|
|
88
|
+
if (thumb)
|
|
89
|
+
thumb.releasePointerCapture(e.pointerId);
|
|
90
|
+
}
|
|
91
|
+
function handleThumbXDown(e) {
|
|
92
|
+
const vp = viewportRef.current;
|
|
93
|
+
const thumb = thumbXRef.current;
|
|
94
|
+
if (!vp || !thumb)
|
|
95
|
+
return;
|
|
96
|
+
isDraggingX = true;
|
|
97
|
+
startX = e.clientX;
|
|
98
|
+
startScrollLeft = vp.scrollLeft;
|
|
99
|
+
thumb.setPointerCapture(e.pointerId);
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
}
|
|
102
|
+
function handleThumbXMove(e) {
|
|
103
|
+
if (!isDraggingX)
|
|
104
|
+
return;
|
|
105
|
+
const vp = viewportRef.current;
|
|
106
|
+
const scrollbar = scrollbarXRef.current;
|
|
107
|
+
if (!vp || !scrollbar)
|
|
108
|
+
return;
|
|
109
|
+
const delta = e.clientX - startX;
|
|
110
|
+
const scrollbarWidth = scrollbar.clientWidth;
|
|
111
|
+
const scrollRange = vp.scrollWidth - vp.clientWidth;
|
|
112
|
+
if (scrollbarWidth > 0) {
|
|
113
|
+
vp.scrollLeft = startScrollLeft + delta / scrollbarWidth * scrollRange;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function handleThumbXUp(e) {
|
|
117
|
+
isDraggingX = false;
|
|
118
|
+
const thumb = thumbXRef.current;
|
|
119
|
+
if (thumb)
|
|
120
|
+
thumb.releasePointerCapture(e.pointerId);
|
|
121
|
+
}
|
|
122
|
+
const showY = orientation === "vertical" || orientation === "both";
|
|
123
|
+
const showX = orientation === "horizontal" || orientation === "both";
|
|
124
|
+
queueMicrotask(() => handleViewportScroll());
|
|
125
|
+
return jsxDEV_7x81h0kn("div", {
|
|
126
|
+
"data-part": "scroll-area",
|
|
127
|
+
style: { position: "relative", overflow: "hidden" },
|
|
128
|
+
class: cn(classes?.root),
|
|
129
|
+
children: [
|
|
130
|
+
jsxDEV_7x81h0kn("div", {
|
|
131
|
+
ref: viewportRef,
|
|
132
|
+
"data-part": "scroll-area-viewport",
|
|
133
|
+
style: { overflow: "scroll", scrollbarWidth: "none" },
|
|
134
|
+
class: cn(classes?.viewport),
|
|
135
|
+
onScroll: handleViewportScroll,
|
|
136
|
+
children: jsxDEV_7x81h0kn("div", {
|
|
137
|
+
"data-part": "scroll-area-content",
|
|
138
|
+
children
|
|
139
|
+
}, undefined, false, undefined, this)
|
|
140
|
+
}, undefined, false, undefined, this),
|
|
141
|
+
showY && jsxDEV_7x81h0kn("div", {
|
|
142
|
+
ref: scrollbarYRef,
|
|
143
|
+
"data-part": "scroll-area-scrollbar",
|
|
144
|
+
"aria-hidden": "true",
|
|
145
|
+
"data-orientation": "vertical",
|
|
146
|
+
style: { position: "absolute", top: "0", right: "0", bottom: "0" },
|
|
147
|
+
class: cn(classes?.scrollbar),
|
|
148
|
+
children: jsxDEV_7x81h0kn("div", {
|
|
149
|
+
ref: thumbYRef,
|
|
150
|
+
"data-part": "scroll-area-thumb",
|
|
151
|
+
class: cn(classes?.thumb),
|
|
152
|
+
onPointerdown: handleThumbYDown,
|
|
153
|
+
onPointermove: handleThumbYMove,
|
|
154
|
+
onPointerup: handleThumbYUp
|
|
155
|
+
}, undefined, false, undefined, this)
|
|
156
|
+
}, undefined, false, undefined, this),
|
|
157
|
+
showX && jsxDEV_7x81h0kn("div", {
|
|
158
|
+
ref: scrollbarXRef,
|
|
159
|
+
"data-part": "scroll-area-scrollbar",
|
|
160
|
+
"aria-hidden": "true",
|
|
161
|
+
"data-orientation": "horizontal",
|
|
162
|
+
style: { position: "absolute", bottom: "0", left: "0", right: "0" },
|
|
163
|
+
class: cn(classes?.scrollbar),
|
|
164
|
+
children: jsxDEV_7x81h0kn("div", {
|
|
165
|
+
ref: thumbXRef,
|
|
166
|
+
"data-part": "scroll-area-thumb",
|
|
167
|
+
class: cn(classes?.thumb),
|
|
168
|
+
onPointerdown: handleThumbXDown,
|
|
169
|
+
onPointermove: handleThumbXMove,
|
|
170
|
+
onPointerup: handleThumbXUp
|
|
171
|
+
}, undefined, false, undefined, this)
|
|
172
|
+
}, undefined, false, undefined, this)
|
|
173
|
+
]
|
|
174
|
+
}, undefined, true, undefined, this);
|
|
175
|
+
}
|
|
176
|
+
var ComposedScrollArea = ComposedScrollAreaRoot;
|
|
177
|
+
|
|
178
|
+
export { ComposedScrollArea };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {
|
|
2
|
+
focusFirst,
|
|
3
|
+
saveFocus,
|
|
4
|
+
trapFocus
|
|
5
|
+
} from "./chunk-e2v1c9ex.js";
|
|
6
|
+
import {
|
|
7
|
+
linkedIds
|
|
8
|
+
} from "./chunk-8y1jf6xr.js";
|
|
9
|
+
import {
|
|
10
|
+
Keys,
|
|
11
|
+
isKey
|
|
12
|
+
} from "./chunk-7867pr13.js";
|
|
13
|
+
import {
|
|
14
|
+
setDataState,
|
|
15
|
+
setDescribedBy,
|
|
16
|
+
setExpanded,
|
|
17
|
+
setHidden,
|
|
18
|
+
setHiddenAnimated,
|
|
19
|
+
setLabelledBy
|
|
20
|
+
} from "./chunk-vevfhpc9.js";
|
|
21
|
+
import {
|
|
22
|
+
applyAttrs
|
|
23
|
+
} from "./chunk-2db2dnp3.js";
|
|
24
|
+
|
|
25
|
+
// src/dialog/dialog.tsx
|
|
26
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
27
|
+
import { signal } from "@vertz/ui";
|
|
28
|
+
function DialogRoot(options = {}) {
|
|
29
|
+
const { modal = true, defaultOpen = false, onOpenChange, ...attrs } = options;
|
|
30
|
+
const ids = linkedIds("dialog");
|
|
31
|
+
const titleId = `${ids.contentId}-title`;
|
|
32
|
+
const descriptionId = `${ids.contentId}-description`;
|
|
33
|
+
const state = { open: signal(defaultOpen) };
|
|
34
|
+
let restoreFocus = null;
|
|
35
|
+
let removeTrap = null;
|
|
36
|
+
function openDialog() {
|
|
37
|
+
state.open.value = true;
|
|
38
|
+
setExpanded(trigger, true);
|
|
39
|
+
setHidden(overlay, false);
|
|
40
|
+
setHidden(content, false);
|
|
41
|
+
setDataState(trigger, "open");
|
|
42
|
+
setDataState(overlay, "open");
|
|
43
|
+
setDataState(content, "open");
|
|
44
|
+
restoreFocus = saveFocus();
|
|
45
|
+
if (modal) {
|
|
46
|
+
removeTrap = trapFocus(content);
|
|
47
|
+
}
|
|
48
|
+
queueMicrotask(() => focusFirst(content));
|
|
49
|
+
onOpenChange?.(true);
|
|
50
|
+
}
|
|
51
|
+
function closeDialog() {
|
|
52
|
+
state.open.value = false;
|
|
53
|
+
setExpanded(trigger, false);
|
|
54
|
+
setDataState(trigger, "closed");
|
|
55
|
+
setDataState(overlay, "closed");
|
|
56
|
+
setDataState(content, "closed");
|
|
57
|
+
setHiddenAnimated(overlay, true);
|
|
58
|
+
setHiddenAnimated(content, true);
|
|
59
|
+
removeTrap?.();
|
|
60
|
+
removeTrap = null;
|
|
61
|
+
restoreFocus?.();
|
|
62
|
+
restoreFocus = null;
|
|
63
|
+
onOpenChange?.(false);
|
|
64
|
+
}
|
|
65
|
+
const trigger = jsxDEV_7x81h0kn("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
id: ids.triggerId,
|
|
68
|
+
"aria-controls": ids.contentId,
|
|
69
|
+
"aria-expanded": defaultOpen ? "true" : "false",
|
|
70
|
+
"data-state": defaultOpen ? "open" : "closed",
|
|
71
|
+
onClick: () => {
|
|
72
|
+
if (state.open.peek()) {
|
|
73
|
+
closeDialog();
|
|
74
|
+
} else {
|
|
75
|
+
openDialog();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, undefined, false, undefined, this);
|
|
79
|
+
const overlay = jsxDEV_7x81h0kn("div", {
|
|
80
|
+
"data-dialog-overlay": "",
|
|
81
|
+
"aria-hidden": defaultOpen ? "false" : "true",
|
|
82
|
+
"data-state": defaultOpen ? "open" : "closed",
|
|
83
|
+
style: { display: defaultOpen ? "" : "none" },
|
|
84
|
+
onClick: () => closeDialog()
|
|
85
|
+
}, undefined, false, undefined, this);
|
|
86
|
+
const content = jsxDEV_7x81h0kn("div", {
|
|
87
|
+
role: "dialog",
|
|
88
|
+
id: ids.contentId,
|
|
89
|
+
"aria-modal": modal ? "true" : undefined,
|
|
90
|
+
"aria-hidden": defaultOpen ? "false" : "true",
|
|
91
|
+
"data-state": defaultOpen ? "open" : "closed",
|
|
92
|
+
style: { display: defaultOpen ? "" : "none" },
|
|
93
|
+
onKeydown: (event) => {
|
|
94
|
+
if (isKey(event, Keys.Escape)) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
closeDialog();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, undefined, false, undefined, this);
|
|
101
|
+
setLabelledBy(content, titleId);
|
|
102
|
+
setDescribedBy(content, descriptionId);
|
|
103
|
+
const title = jsxDEV_7x81h0kn("h2", {
|
|
104
|
+
id: titleId
|
|
105
|
+
}, undefined, false, undefined, this);
|
|
106
|
+
const description = jsxDEV_7x81h0kn("p", {
|
|
107
|
+
id: descriptionId
|
|
108
|
+
}, undefined, false, undefined, this);
|
|
109
|
+
const close = jsxDEV_7x81h0kn("button", {
|
|
110
|
+
type: "button",
|
|
111
|
+
"aria-label": "Close",
|
|
112
|
+
onClick: () => closeDialog()
|
|
113
|
+
}, undefined, false, undefined, this);
|
|
114
|
+
applyAttrs(content, attrs);
|
|
115
|
+
return {
|
|
116
|
+
trigger,
|
|
117
|
+
overlay,
|
|
118
|
+
content,
|
|
119
|
+
title,
|
|
120
|
+
description,
|
|
121
|
+
close,
|
|
122
|
+
state,
|
|
123
|
+
show: openDialog,
|
|
124
|
+
hide: closeDialog
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
var Dialog = {
|
|
128
|
+
Root: DialogRoot
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { Dialog };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
|
|
5
|
+
// src/separator/separator-composed.tsx
|
|
6
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
7
|
+
function ComposedSeparatorRoot({
|
|
8
|
+
classes,
|
|
9
|
+
className,
|
|
10
|
+
class: classProp,
|
|
11
|
+
orientation = "horizontal"
|
|
12
|
+
}) {
|
|
13
|
+
const orientationClass = orientation === "vertical" ? classes?.vertical : classes?.horizontal;
|
|
14
|
+
return jsxDEV_7x81h0kn("hr", {
|
|
15
|
+
class: cn(classes?.base, orientationClass, className ?? classProp),
|
|
16
|
+
role: "separator",
|
|
17
|
+
"aria-orientation": orientation
|
|
18
|
+
}, undefined, false, undefined, this);
|
|
19
|
+
}
|
|
20
|
+
var ComposedSeparator = ComposedSeparatorRoot;
|
|
21
|
+
|
|
22
|
+
export { ComposedSeparator };
|