@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.
Files changed (91) hide show
  1. package/dist/shared/chunk-3h1mxp95.js +148 -0
  2. package/dist/shared/chunk-3kwh27dv.js +135 -0
  3. package/dist/shared/chunk-4894pmy6.js +184 -0
  4. package/dist/shared/chunk-67sn29eh.js +125 -0
  5. package/dist/shared/chunk-7cb3z0s8.js +287 -0
  6. package/dist/shared/chunk-8c01c8mb.js +217 -0
  7. package/dist/shared/chunk-99tk72t3.js +69 -0
  8. package/dist/shared/chunk-9gfp3ffv.js +204 -0
  9. package/dist/shared/chunk-b25npqer.js +149 -0
  10. package/dist/shared/chunk-cgb2j94g.js +141 -0
  11. package/dist/shared/chunk-e1jcf22s.js +79 -0
  12. package/dist/shared/chunk-e3h0ddmx.js +168 -0
  13. package/dist/shared/chunk-f2vx4tpw.js +168 -0
  14. package/dist/shared/chunk-h3v10x04.js +271 -0
  15. package/dist/shared/chunk-hdvdfd1c.js +96 -0
  16. package/dist/shared/{chunk-dhyr0s9n.js → chunk-j902w020.js} +1 -1
  17. package/dist/shared/chunk-jdygp28a.js +260 -0
  18. package/dist/shared/chunk-jqre4qtw.js +180 -0
  19. package/dist/shared/{chunk-k8nabsxm.js → chunk-mgr904ap.js} +74 -34
  20. package/dist/shared/chunk-mr1tb0dp.js +167 -0
  21. package/dist/shared/chunk-nj420k31.js +54 -0
  22. package/dist/shared/chunk-p0x7hgv6.js +181 -0
  23. package/dist/shared/{chunk-w9dag6ce.js → chunk-pn6shbcs.js} +132 -80
  24. package/dist/shared/chunk-pzx0vpq1.js +223 -0
  25. package/dist/shared/chunk-tn0m98j8.js +42 -0
  26. package/dist/shared/{chunk-myq79qew.js → chunk-ttb2tt03.js} +47 -27
  27. package/dist/shared/chunk-vy874zxe.js +68 -0
  28. package/dist/shared/chunk-ww7k2azn.js +297 -0
  29. package/dist/shared/{chunk-jda3v59q.js → chunk-xa1b96mb.js} +2 -2
  30. package/dist/shared/chunk-xs6gp369.js +245 -0
  31. package/dist/shared/chunk-y4mmmayp.js +206 -0
  32. package/dist/src/accordion/accordion.js +1 -1
  33. package/dist/src/alert-dialog/alert-dialog.js +1 -1
  34. package/dist/src/badge/badge.js +1 -1
  35. package/dist/src/button/button.js +1 -1
  36. package/dist/src/calendar/calendar.js +1 -1
  37. package/dist/src/carousel/carousel.js +1 -1
  38. package/dist/src/checkbox/checkbox.js +1 -1
  39. package/dist/src/collapsible/collapsible.js +1 -1
  40. package/dist/src/combobox/combobox.js +1 -1
  41. package/dist/src/command/command.js +1 -1
  42. package/dist/src/context-menu/context-menu.js +1 -1
  43. package/dist/src/date-picker/date-picker.js +1 -1
  44. package/dist/src/dialog/dialog.js +1 -1
  45. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  46. package/dist/src/hover-card/hover-card.js +1 -1
  47. package/dist/src/index.d.ts +14 -1
  48. package/dist/src/index.js +5595 -4310
  49. package/dist/src/menu/menu.js +1 -1
  50. package/dist/src/menubar/menubar.js +1 -1
  51. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  52. package/dist/src/popover/popover.js +1 -1
  53. package/dist/src/progress/progress.js +1 -1
  54. package/dist/src/radio/radio.js +1 -1
  55. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  56. package/dist/src/scroll-area/scroll-area.js +1 -1
  57. package/dist/src/select/select.js +1 -1
  58. package/dist/src/sheet/sheet.js +1 -1
  59. package/dist/src/slider/slider.js +1 -1
  60. package/dist/src/switch/switch.js +1 -1
  61. package/dist/src/tabs/tabs.js +1 -1
  62. package/dist/src/toggle/toggle.js +1 -1
  63. package/dist/src/toggle-group/toggle-group.js +1 -1
  64. package/dist/src/tooltip/tooltip.js +1 -1
  65. package/package.json +3 -3
  66. package/dist/shared/chunk-07yzsaaw.js +0 -165
  67. package/dist/shared/chunk-279bzynx.js +0 -132
  68. package/dist/shared/chunk-27xs9apd.js +0 -288
  69. package/dist/shared/chunk-2k8gxzdf.js +0 -151
  70. package/dist/shared/chunk-3rp73gkd.js +0 -175
  71. package/dist/shared/chunk-4rf1m34c.js +0 -267
  72. package/dist/shared/chunk-7bxsf80c.js +0 -60
  73. package/dist/shared/chunk-8qtexw5s.js +0 -199
  74. package/dist/shared/chunk-9ezgd78r.js +0 -142
  75. package/dist/shared/chunk-ajpj10z0.js +0 -282
  76. package/dist/shared/chunk-c46v0fsw.js +0 -117
  77. package/dist/shared/chunk-e4mm5e59.js +0 -178
  78. package/dist/shared/chunk-fqa5bwn1.js +0 -128
  79. package/dist/shared/chunk-g8hnc95b.js +0 -219
  80. package/dist/shared/chunk-j2tdpxgc.js +0 -185
  81. package/dist/shared/chunk-kcnq15je.js +0 -175
  82. package/dist/shared/chunk-mqs4qq0b.js +0 -46
  83. package/dist/shared/chunk-pg2yjn8f.js +0 -88
  84. package/dist/shared/chunk-rb53v045.js +0 -71
  85. package/dist/shared/chunk-s6a2yph8.js +0 -239
  86. package/dist/shared/chunk-vhx3sqw6.js +0 -196
  87. package/dist/shared/chunk-w318par6.js +0 -204
  88. package/dist/shared/chunk-wcdq7bew.js +0 -133
  89. package/dist/shared/chunk-z0gwkzgp.js +0 -34
  90. package/dist/shared/chunk-z850et33.js +0 -161
  91. package/dist/shared/chunk-zyfc6cx3.js +0 -61
@@ -0,0 +1,223 @@
1
+ import {
2
+ createDismiss
3
+ } from "./chunk-a6wp8c32.js";
4
+ import {
5
+ createFloatingPosition,
6
+ virtualElement
7
+ } from "./chunk-0mcr52hc.js";
8
+ import {
9
+ Keys,
10
+ handleListNavigation,
11
+ isKey
12
+ } from "./chunk-7867pr13.js";
13
+ import {
14
+ setDataState,
15
+ setHidden,
16
+ setHiddenAnimated
17
+ } from "./chunk-vevfhpc9.js";
18
+ import {
19
+ uniqueId
20
+ } from "./chunk-8y1jf6xr.js";
21
+ import {
22
+ applyAttrs
23
+ } from "./chunk-2db2dnp3.js";
24
+
25
+ // src/context-menu/context-menu.tsx
26
+ import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
27
+ import { signal } from "@vertz/ui";
28
+ function ContextMenuRoot(options = {}) {
29
+ const __mfDepth = __pushMountFrame();
30
+ try {
31
+ let handleClickOutside = function(event) {
32
+ const target = event.target;
33
+ if (!trigger.contains(target) && !content.contains(target)) {
34
+ close();
35
+ }
36
+ }, updateActiveItem = function(index) {
37
+ for (let i = 0;i < items.length; i++) {
38
+ items[i]?.setAttribute("tabindex", i === index ? "0" : "-1");
39
+ }
40
+ }, openMenu = function(x, y) {
41
+ state.open.value = true;
42
+ setHidden(content, false);
43
+ setDataState(content, "open");
44
+ if (positioning) {
45
+ const result = createFloatingPosition(virtualElement(x, y), content, {
46
+ strategy: "fixed",
47
+ ...positioning
48
+ });
49
+ floatingCleanup = result.cleanup;
50
+ dismissCleanup = createDismiss({
51
+ onDismiss: close,
52
+ insideElements: [trigger, content],
53
+ escapeKey: false
54
+ });
55
+ } else {
56
+ content.style.left = `${x}px`;
57
+ content.style.top = `${y}px`;
58
+ document.addEventListener("mousedown", handleClickOutside);
59
+ }
60
+ state.activeIndex.value = 0;
61
+ updateActiveItem(0);
62
+ items[0]?.focus();
63
+ }, close = function() {
64
+ state.open.value = false;
65
+ setDataState(content, "closed");
66
+ setHiddenAnimated(content, true);
67
+ if (positioning) {
68
+ floatingCleanup?.();
69
+ floatingCleanup = null;
70
+ dismissCleanup?.();
71
+ dismissCleanup = null;
72
+ } else {
73
+ document.removeEventListener("mousedown", handleClickOutside);
74
+ }
75
+ }, createItem = function(value, label, parent) {
76
+ const item = (() => {
77
+ const __el2 = __element("div");
78
+ __el2.setAttribute("role", "menuitem");
79
+ {
80
+ const __v = value;
81
+ if (__v != null && __v !== false)
82
+ __el2.setAttribute("data-value", __v === true ? "" : __v);
83
+ }
84
+ __el2.setAttribute("tabindex", "-1");
85
+ __on(__el2, "click", () => {
86
+ onSelect?.(value);
87
+ close();
88
+ });
89
+ __enterChildren(__el2);
90
+ __insert(__el2, label ?? value);
91
+ __exitChildren();
92
+ return __el2;
93
+ })();
94
+ items.push(item);
95
+ (parent ?? content).appendChild(item);
96
+ return item;
97
+ }, Item = function(value, label) {
98
+ return createItem(value, label);
99
+ }, Group = function(label) {
100
+ const el = (() => {
101
+ const __el3 = __element("div");
102
+ __el3.setAttribute("role", "group");
103
+ {
104
+ const __v = label;
105
+ if (__v != null && __v !== false)
106
+ __el3.setAttribute("aria-label", __v === true ? "" : __v);
107
+ }
108
+ return __el3;
109
+ })();
110
+ content.appendChild(el);
111
+ return {
112
+ el,
113
+ Item: (value, itemLabel) => createItem(value, itemLabel, el)
114
+ };
115
+ }, Separator = function() {
116
+ const hr = (() => {
117
+ const __el4 = __element("hr");
118
+ __el4.setAttribute("role", "separator");
119
+ return __el4;
120
+ })();
121
+ content.appendChild(hr);
122
+ return hr;
123
+ }, Label = function(text) {
124
+ const el = (() => {
125
+ const __el5 = __element("div");
126
+ __el5.setAttribute("role", "none");
127
+ __enterChildren(__el5);
128
+ __insert(__el5, text);
129
+ __exitChildren();
130
+ return __el5;
131
+ })();
132
+ content.appendChild(el);
133
+ return el;
134
+ };
135
+ const { onSelect, positioning, ...attrs } = options;
136
+ const state = {
137
+ open: signal(false),
138
+ activeIndex: signal(-1)
139
+ };
140
+ const items = [];
141
+ let floatingCleanup = null;
142
+ let dismissCleanup = null;
143
+ const trigger = (() => {
144
+ const __el0 = __element("div");
145
+ __on(__el0, "contextmenu", (event) => {
146
+ event.preventDefault();
147
+ if (state.open.peek()) {
148
+ close();
149
+ }
150
+ openMenu(event.clientX, event.clientY);
151
+ });
152
+ return __el0;
153
+ })();
154
+ const contentId = uniqueId("ctx-menu");
155
+ const content = (() => {
156
+ const __el1 = __element("div");
157
+ __el1.setAttribute("role", "menu");
158
+ {
159
+ const __v = contentId;
160
+ if (__v != null && __v !== false)
161
+ __el1.setAttribute("id", __v === true ? "" : __v);
162
+ }
163
+ {
164
+ const __v = { position: "fixed", display: "none" };
165
+ if (__v != null && __v !== false)
166
+ __el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
167
+ }
168
+ __el1.setAttribute("aria-hidden", "true");
169
+ __el1.setAttribute("data-state", "closed");
170
+ __on(__el1, "keydown", (event) => {
171
+ if (isKey(event, Keys.Escape)) {
172
+ event.preventDefault();
173
+ close();
174
+ return;
175
+ }
176
+ if (isKey(event, Keys.Enter, Keys.Space)) {
177
+ event.preventDefault();
178
+ const active = items[state.activeIndex.peek()];
179
+ if (active) {
180
+ const val = active.getAttribute("data-value");
181
+ if (val !== null) {
182
+ onSelect?.(val);
183
+ close();
184
+ }
185
+ }
186
+ return;
187
+ }
188
+ const result = handleListNavigation(event, items, { orientation: "vertical" });
189
+ if (result) {
190
+ const idx = items.indexOf(result);
191
+ if (idx >= 0) {
192
+ state.activeIndex.value = idx;
193
+ updateActiveItem(idx);
194
+ }
195
+ return;
196
+ }
197
+ if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
198
+ const char = event.key.toLowerCase();
199
+ const match = items.find((item) => item.textContent?.toLowerCase().startsWith(char));
200
+ if (match) {
201
+ const idx = items.indexOf(match);
202
+ state.activeIndex.value = idx;
203
+ updateActiveItem(idx);
204
+ match.focus();
205
+ }
206
+ }
207
+ });
208
+ return __el1;
209
+ })();
210
+ applyAttrs(trigger, attrs);
211
+ const __mfResult0 = { trigger, content, state, Item, Group, Separator, Label };
212
+ __flushMountFrame();
213
+ return __mfResult0;
214
+ } catch (__mfErr) {
215
+ __discardMountFrame(__mfDepth);
216
+ throw __mfErr;
217
+ }
218
+ }
219
+ var ContextMenu = {
220
+ Root: ContextMenuRoot
221
+ };
222
+
223
+ export { ContextMenu };
@@ -0,0 +1,42 @@
1
+ import {
2
+ uniqueId
3
+ } from "./chunk-8y1jf6xr.js";
4
+ import {
5
+ applyAttrs
6
+ } from "./chunk-2db2dnp3.js";
7
+
8
+ // src/badge/badge.tsx
9
+ import { __discardMountFrame, __element, __flushMountFrame, __pushMountFrame } from "@vertz/ui/internals";
10
+ function BadgeRoot(options = {}) {
11
+ const __mfDepth = __pushMountFrame();
12
+ try {
13
+ const { variant = "default", ...attrs } = options;
14
+ const badge = (() => {
15
+ const __el0 = __element("span");
16
+ {
17
+ const __v = uniqueId("badge");
18
+ if (__v != null && __v !== false)
19
+ __el0.setAttribute("id", __v === true ? "" : __v);
20
+ }
21
+ __el0.setAttribute("data-slot", "badge");
22
+ {
23
+ const __v = variant;
24
+ if (__v != null && __v !== false)
25
+ __el0.setAttribute("data-variant", __v === true ? "" : __v);
26
+ }
27
+ return __el0;
28
+ })();
29
+ applyAttrs(badge, attrs);
30
+ const __mfResult0 = { badge };
31
+ __flushMountFrame();
32
+ return __mfResult0;
33
+ } catch (__mfErr) {
34
+ __discardMountFrame(__mfDepth);
35
+ throw __mfErr;
36
+ }
37
+ }
38
+ var Badge = {
39
+ Root: BadgeRoot
40
+ };
41
+
42
+ export { Badge };
@@ -19,37 +19,57 @@ import {
19
19
  } from "./chunk-2db2dnp3.js";
20
20
 
21
21
  // src/tooltip/tooltip.tsx
22
- import { __element, __on } from "@vertz/ui/internals";
22
+ import { __discardMountFrame, __element, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
23
23
  import { signal } from "@vertz/ui";
24
24
  function TooltipTrigger(show, hide) {
25
- return (() => {
26
- const __el0 = __element("span");
27
- __on(__el0, "mouseenter", show);
28
- __on(__el0, "mouseleave", hide);
29
- __on(__el0, "focus", show);
30
- __on(__el0, "blur", hide);
31
- __on(__el0, "keydown", (event) => {
32
- if (isKey(event, Keys.Escape)) {
33
- hide();
34
- }
35
- });
36
- return __el0;
37
- })();
25
+ const __mfDepth = __pushMountFrame();
26
+ try {
27
+ const __mfResult0 = (() => {
28
+ const __el0 = __element("span");
29
+ __on(__el0, "mouseenter", show);
30
+ __on(__el0, "mouseleave", hide);
31
+ __on(__el0, "focus", show);
32
+ __on(__el0, "blur", hide);
33
+ __on(__el0, "keydown", (event) => {
34
+ if (isKey(event, Keys.Escape)) {
35
+ hide();
36
+ }
37
+ });
38
+ return __el0;
39
+ })();
40
+ __flushMountFrame();
41
+ return __mfResult0;
42
+ } catch (__mfErr) {
43
+ __discardMountFrame(__mfDepth);
44
+ throw __mfErr;
45
+ }
38
46
  }
39
47
  function TooltipContent(contentId) {
40
- return (() => {
41
- const __el0 = __element("div");
42
- __el0.setAttribute("role", "tooltip");
43
- {
44
- const __v = contentId;
45
- if (__v != null && __v !== false)
46
- __el0.setAttribute("id", __v === true ? "" : __v);
47
- }
48
- __el0.setAttribute("aria-hidden", "true");
49
- __el0.setAttribute("data-state", "closed");
50
- __el0.setAttribute("style", "display: none");
51
- return __el0;
52
- })();
48
+ const __mfDepth = __pushMountFrame();
49
+ try {
50
+ const __mfResult0 = (() => {
51
+ const __el0 = __element("div");
52
+ __el0.setAttribute("role", "tooltip");
53
+ {
54
+ const __v = contentId;
55
+ if (__v != null && __v !== false)
56
+ __el0.setAttribute("id", __v === true ? "" : __v);
57
+ }
58
+ __el0.setAttribute("aria-hidden", "true");
59
+ __el0.setAttribute("data-state", "closed");
60
+ {
61
+ const __v = { display: "none" };
62
+ if (__v != null && __v !== false)
63
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
64
+ }
65
+ return __el0;
66
+ })();
67
+ __flushMountFrame();
68
+ return __mfResult0;
69
+ } catch (__mfErr) {
70
+ __discardMountFrame(__mfDepth);
71
+ throw __mfErr;
72
+ }
53
73
  }
54
74
  function TooltipRoot(options = {}) {
55
75
  const { delay = 300, onOpenChange, positioning, ...attrs } = options;
@@ -0,0 +1,68 @@
1
+ import {
2
+ Keys,
3
+ isKey
4
+ } from "./chunk-7867pr13.js";
5
+ import {
6
+ uniqueId
7
+ } from "./chunk-8y1jf6xr.js";
8
+ import {
9
+ applyAttrs
10
+ } from "./chunk-2db2dnp3.js";
11
+
12
+ // src/toggle/toggle.tsx
13
+ import { computed, signal } from "@vertz/ui";
14
+ import { __attr, __discardMountFrame, __element, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
15
+ function ToggleRoot(options = {}) {
16
+ const __mfDepth = __pushMountFrame();
17
+ try {
18
+ let toggle = function() {
19
+ if (disabled)
20
+ return;
21
+ pressed.value = !pressed.value;
22
+ onPressedChange?.(pressed.value);
23
+ };
24
+ const { defaultPressed = false, disabled = false, onPressedChange, ...attrs } = options;
25
+ const pressed = signal(defaultPressed, "pressed");
26
+ const el = computed(() => (() => {
27
+ const __el0 = __element("button");
28
+ __el0.setAttribute("type", "button");
29
+ {
30
+ const __v = uniqueId("toggle");
31
+ if (__v != null && __v !== false)
32
+ __el0.setAttribute("id", __v === true ? "" : __v);
33
+ }
34
+ __attr(__el0, "aria-pressed", () => pressed.value ? "true" : "false");
35
+ __attr(__el0, "data-state", () => pressed.value ? "on" : "off");
36
+ {
37
+ const __v = disabled;
38
+ if (__v != null && __v !== false)
39
+ __el0.setAttribute("disabled", __v === true ? "" : __v);
40
+ }
41
+ {
42
+ const __v = disabled ? "true" : undefined;
43
+ if (__v != null && __v !== false)
44
+ __el0.setAttribute("aria-disabled", __v === true ? "" : __v);
45
+ }
46
+ __on(__el0, "click", toggle);
47
+ __on(__el0, "keydown", (e) => {
48
+ if (isKey(e, Keys.Space)) {
49
+ e.preventDefault();
50
+ toggle();
51
+ }
52
+ });
53
+ return __el0;
54
+ })());
55
+ applyAttrs(el.value, attrs);
56
+ const __mfResult0 = el.value;
57
+ __flushMountFrame();
58
+ return __mfResult0;
59
+ } catch (__mfErr) {
60
+ __discardMountFrame(__mfDepth);
61
+ throw __mfErr;
62
+ }
63
+ }
64
+ var Toggle = {
65
+ Root: ToggleRoot
66
+ };
67
+
68
+ export { Toggle };