@vertz/ui-primitives 0.2.21 → 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.
Files changed (97) hide show
  1. package/dist/shared/{chunk-q8dm19a5.js → chunk-2db2dnp3.js} +0 -1
  2. package/dist/shared/chunk-3h1mxp95.js +148 -0
  3. package/dist/shared/chunk-3kwh27dv.js +135 -0
  4. package/dist/shared/chunk-4894pmy6.js +184 -0
  5. package/dist/shared/{chunk-v9qddmh9.js → chunk-56reyd5r.js} +20 -29
  6. package/dist/shared/chunk-67sn29eh.js +125 -0
  7. package/dist/shared/chunk-7cb3z0s8.js +287 -0
  8. package/dist/shared/chunk-8c01c8mb.js +217 -0
  9. package/dist/shared/chunk-99tk72t3.js +69 -0
  10. package/dist/shared/chunk-9gfp3ffv.js +204 -0
  11. package/dist/shared/chunk-b25npqer.js +149 -0
  12. package/dist/shared/chunk-cgb2j94g.js +141 -0
  13. package/dist/shared/chunk-e1jcf22s.js +79 -0
  14. package/dist/shared/chunk-e3h0ddmx.js +168 -0
  15. package/dist/shared/chunk-f2vx4tpw.js +168 -0
  16. package/dist/shared/chunk-h3v10x04.js +271 -0
  17. package/dist/shared/chunk-hdvdfd1c.js +96 -0
  18. package/dist/shared/{chunk-zf0rhm9e.js → chunk-j902w020.js} +1 -1
  19. package/dist/shared/chunk-jdygp28a.js +260 -0
  20. package/dist/shared/chunk-jqre4qtw.js +180 -0
  21. package/dist/shared/{chunk-pvy0tcd7.js → chunk-mgr904ap.js} +75 -35
  22. package/dist/shared/chunk-mr1tb0dp.js +167 -0
  23. package/dist/shared/chunk-nj420k31.js +54 -0
  24. package/dist/shared/chunk-p0x7hgv6.js +181 -0
  25. package/dist/shared/{chunk-gzgyfhz6.js → chunk-pn6shbcs.js} +134 -82
  26. package/dist/shared/chunk-pzx0vpq1.js +223 -0
  27. package/dist/shared/chunk-tn0m98j8.js +42 -0
  28. package/dist/shared/{chunk-g67tnd19.js → chunk-ttb2tt03.js} +49 -29
  29. package/dist/shared/{chunk-vvjyx7fe.js → chunk-vevfhpc9.js} +1 -1
  30. package/dist/shared/chunk-vy874zxe.js +68 -0
  31. package/dist/shared/chunk-ww7k2azn.js +297 -0
  32. package/dist/shared/{chunk-f501vw7e.js → chunk-xa1b96mb.js} +2 -2
  33. package/dist/shared/chunk-xs6gp369.js +245 -0
  34. package/dist/shared/chunk-y4mmmayp.js +206 -0
  35. package/dist/src/accordion/accordion.js +1 -1
  36. package/dist/src/alert-dialog/alert-dialog.js +1 -1
  37. package/dist/src/badge/badge.js +1 -1
  38. package/dist/src/button/button.js +1 -1
  39. package/dist/src/calendar/calendar.js +1 -1
  40. package/dist/src/carousel/carousel.js +1 -1
  41. package/dist/src/checkbox/checkbox.js +1 -1
  42. package/dist/src/collapsible/collapsible.js +1 -1
  43. package/dist/src/combobox/combobox.js +1 -1
  44. package/dist/src/command/command.js +1 -1
  45. package/dist/src/context-menu/context-menu.js +1 -1
  46. package/dist/src/date-picker/date-picker.js +1 -1
  47. package/dist/src/dialog/dialog.js +1 -1
  48. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  49. package/dist/src/hover-card/hover-card.js +1 -1
  50. package/dist/src/index.d.ts +281 -106
  51. package/dist/src/index.js +5779 -4266
  52. package/dist/src/menu/menu.js +1 -1
  53. package/dist/src/menubar/menubar.js +1 -1
  54. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  55. package/dist/src/popover/popover.js +1 -1
  56. package/dist/src/progress/progress.js +1 -1
  57. package/dist/src/radio/radio.js +1 -1
  58. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  59. package/dist/src/scroll-area/scroll-area.js +1 -1
  60. package/dist/src/select/select.js +1 -1
  61. package/dist/src/sheet/sheet.js +1 -1
  62. package/dist/src/slider/slider.js +1 -1
  63. package/dist/src/switch/switch.js +1 -1
  64. package/dist/src/tabs/tabs.js +1 -1
  65. package/dist/src/toast/toast.js +1 -1
  66. package/dist/src/toggle/toggle.js +1 -1
  67. package/dist/src/toggle-group/toggle-group.js +1 -1
  68. package/dist/src/tooltip/tooltip.js +1 -1
  69. package/dist/src/utils.d.ts +1 -1
  70. package/dist/src/utils.js +3 -3
  71. package/package.json +3 -3
  72. package/dist/shared/chunk-0gn67thm.js +0 -88
  73. package/dist/shared/chunk-1dzcjmfq.js +0 -46
  74. package/dist/shared/chunk-1hv9yd28.js +0 -178
  75. package/dist/shared/chunk-2d05qxdw.js +0 -282
  76. package/dist/shared/chunk-4jnweh3m.js +0 -165
  77. package/dist/shared/chunk-90hmpm0w.js +0 -34
  78. package/dist/shared/chunk-ac86qw7a.js +0 -71
  79. package/dist/shared/chunk-b02fkvts.js +0 -128
  80. package/dist/shared/chunk-bsx59bv9.js +0 -61
  81. package/dist/shared/chunk-cm2akzrm.js +0 -161
  82. package/dist/shared/chunk-cvms20w3.js +0 -132
  83. package/dist/shared/chunk-d8n8mggh.js +0 -239
  84. package/dist/shared/chunk-er9625ar.js +0 -204
  85. package/dist/shared/chunk-ewxzhtej.js +0 -117
  86. package/dist/shared/chunk-ey4485fh.js +0 -196
  87. package/dist/shared/chunk-gbxbkmte.js +0 -175
  88. package/dist/shared/chunk-je7tqf67.js +0 -133
  89. package/dist/shared/chunk-kr5qg80z.js +0 -288
  90. package/dist/shared/chunk-kytkmdpc.js +0 -199
  91. package/dist/shared/chunk-q2q20y9a.js +0 -60
  92. package/dist/shared/chunk-q9fgfgh9.js +0 -267
  93. package/dist/shared/chunk-qfk1ycfw.js +0 -142
  94. package/dist/shared/chunk-te4pdqnh.js +0 -219
  95. package/dist/shared/chunk-vm37m55w.js +0 -175
  96. package/dist/shared/chunk-y5vdb6br.js +0 -151
  97. package/dist/shared/chunk-ztvj60xp.js +0 -185
@@ -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 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Accordion
3
- } from "../../shared/chunk-1hv9yd28.js";
3
+ } from "../../shared/chunk-4894pmy6.js";
4
4
  export {
5
5
  Accordion
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AlertDialog
3
- } from "../../shared/chunk-er9625ar.js";
3
+ } from "../../shared/chunk-jdygp28a.js";
4
4
  export {
5
5
  AlertDialog
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Badge
3
- } from "../../shared/chunk-90hmpm0w.js";
3
+ } from "../../shared/chunk-tn0m98j8.js";
4
4
  export {
5
5
  Badge
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Button
3
- } from "../../shared/chunk-1dzcjmfq.js";
3
+ } from "../../shared/chunk-nj420k31.js";
4
4
  export {
5
5
  Button
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Calendar
3
- } from "../../shared/chunk-pvy0tcd7.js";
3
+ } from "../../shared/chunk-mgr904ap.js";
4
4
  export {
5
5
  Calendar
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Carousel
3
- } from "../../shared/chunk-je7tqf67.js";
3
+ } from "../../shared/chunk-cgb2j94g.js";
4
4
  export {
5
5
  Carousel
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Checkbox
3
- } from "../../shared/chunk-ac86qw7a.js";
3
+ } from "../../shared/chunk-e1jcf22s.js";
4
4
  export {
5
5
  Checkbox
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Collapsible
3
- } from "../../shared/chunk-ewxzhtej.js";
3
+ } from "../../shared/chunk-67sn29eh.js";
4
4
  export {
5
5
  Collapsible
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Combobox
3
- } from "../../shared/chunk-ey4485fh.js";
3
+ } from "../../shared/chunk-9gfp3ffv.js";
4
4
  export {
5
5
  Combobox
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Command
3
- } from "../../shared/chunk-d8n8mggh.js";
3
+ } from "../../shared/chunk-xs6gp369.js";
4
4
  export {
5
5
  Command
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ContextMenu
3
- } from "../../shared/chunk-te4pdqnh.js";
3
+ } from "../../shared/chunk-pzx0vpq1.js";
4
4
  export {
5
5
  ContextMenu
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DatePicker
3
- } from "../../shared/chunk-f501vw7e.js";
3
+ } from "../../shared/chunk-xa1b96mb.js";
4
4
  export {
5
5
  DatePicker
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Dialog
3
- } from "../../shared/chunk-kytkmdpc.js";
3
+ } from "../../shared/chunk-y4mmmayp.js";
4
4
  export {
5
5
  Dialog
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DropdownMenu
3
- } from "../../shared/chunk-zf0rhm9e.js";
3
+ } from "../../shared/chunk-j902w020.js";
4
4
  export {
5
5
  DropdownMenu
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HoverCard
3
- } from "../../shared/chunk-4jnweh3m.js";
3
+ } from "../../shared/chunk-mr1tb0dp.js";
4
4
  export {
5
5
  HoverCard
6
6
  };