@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
@@ -1,219 +0,0 @@
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 { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";
27
- import { signal } from "@vertz/ui";
28
- function ContextMenuRoot(options = {}) {
29
- const { onSelect, positioning, ...attrs } = options;
30
- const state = {
31
- open: signal(false),
32
- activeIndex: signal(-1)
33
- };
34
- const items = [];
35
- let floatingCleanup = null;
36
- let dismissCleanup = null;
37
- function handleClickOutside(event) {
38
- const target = event.target;
39
- if (!trigger.contains(target) && !content.contains(target)) {
40
- close();
41
- }
42
- }
43
- function updateActiveItem(index) {
44
- for (let i = 0;i < items.length; i++) {
45
- items[i]?.setAttribute("tabindex", i === index ? "0" : "-1");
46
- }
47
- }
48
- function openMenu(x, y) {
49
- state.open.value = true;
50
- setHidden(content, false);
51
- setDataState(content, "open");
52
- if (positioning) {
53
- const result = createFloatingPosition(virtualElement(x, y), content, {
54
- strategy: "fixed",
55
- ...positioning
56
- });
57
- floatingCleanup = result.cleanup;
58
- dismissCleanup = createDismiss({
59
- onDismiss: close,
60
- insideElements: [trigger, content],
61
- escapeKey: false
62
- });
63
- } else {
64
- content.style.left = `${x}px`;
65
- content.style.top = `${y}px`;
66
- document.addEventListener("mousedown", handleClickOutside);
67
- }
68
- state.activeIndex.value = 0;
69
- updateActiveItem(0);
70
- items[0]?.focus();
71
- }
72
- function close() {
73
- state.open.value = false;
74
- setDataState(content, "closed");
75
- setHiddenAnimated(content, true);
76
- if (positioning) {
77
- floatingCleanup?.();
78
- floatingCleanup = null;
79
- dismissCleanup?.();
80
- dismissCleanup = null;
81
- } else {
82
- document.removeEventListener("mousedown", handleClickOutside);
83
- }
84
- }
85
- const trigger = (() => {
86
- const __el0 = __element("div");
87
- __on(__el0, "contextmenu", (event) => {
88
- event.preventDefault();
89
- if (state.open.peek()) {
90
- close();
91
- }
92
- openMenu(event.clientX, event.clientY);
93
- });
94
- return __el0;
95
- })();
96
- const contentId = uniqueId("ctx-menu");
97
- const content = (() => {
98
- const __el1 = __element("div");
99
- __el1.setAttribute("role", "menu");
100
- {
101
- const __v = contentId;
102
- if (__v != null && __v !== false)
103
- __el1.setAttribute("id", __v === true ? "" : __v);
104
- }
105
- __el1.setAttribute("style", "position: fixed; display: none;");
106
- __el1.setAttribute("aria-hidden", "true");
107
- __el1.setAttribute("data-state", "closed");
108
- __on(__el1, "keydown", (event) => {
109
- if (isKey(event, Keys.Escape)) {
110
- event.preventDefault();
111
- close();
112
- return;
113
- }
114
- if (isKey(event, Keys.Enter, Keys.Space)) {
115
- event.preventDefault();
116
- const active = items[state.activeIndex.peek()];
117
- if (active) {
118
- const val = active.getAttribute("data-value");
119
- if (val !== null) {
120
- onSelect?.(val);
121
- close();
122
- }
123
- }
124
- return;
125
- }
126
- const result = handleListNavigation(event, items, { orientation: "vertical" });
127
- if (result) {
128
- const idx = items.indexOf(result);
129
- if (idx >= 0) {
130
- state.activeIndex.value = idx;
131
- updateActiveItem(idx);
132
- }
133
- return;
134
- }
135
- if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
136
- const char = event.key.toLowerCase();
137
- const match = items.find((item) => item.textContent?.toLowerCase().startsWith(char));
138
- if (match) {
139
- const idx = items.indexOf(match);
140
- state.activeIndex.value = idx;
141
- updateActiveItem(idx);
142
- match.focus();
143
- }
144
- }
145
- });
146
- return __el1;
147
- })();
148
- function createItem(value, label, parent) {
149
- const item = (() => {
150
- const __el2 = __element("div");
151
- __el2.setAttribute("role", "menuitem");
152
- {
153
- const __v = value;
154
- if (__v != null && __v !== false)
155
- __el2.setAttribute("data-value", __v === true ? "" : __v);
156
- }
157
- __el2.setAttribute("tabindex", "-1");
158
- __on(__el2, "click", () => {
159
- onSelect?.(value);
160
- close();
161
- });
162
- __enterChildren(__el2);
163
- __insert(__el2, label ?? value);
164
- __exitChildren();
165
- return __el2;
166
- })();
167
- items.push(item);
168
- (parent ?? content).appendChild(item);
169
- return item;
170
- }
171
- function Item(value, label) {
172
- return createItem(value, label);
173
- }
174
- function Group(label) {
175
- const el = (() => {
176
- const __el3 = __element("div");
177
- __el3.setAttribute("role", "group");
178
- {
179
- const __v = label;
180
- if (__v != null && __v !== false)
181
- __el3.setAttribute("aria-label", __v === true ? "" : __v);
182
- }
183
- return __el3;
184
- })();
185
- content.appendChild(el);
186
- return {
187
- el,
188
- Item: (value, itemLabel) => createItem(value, itemLabel, el)
189
- };
190
- }
191
- function Separator() {
192
- const hr = (() => {
193
- const __el4 = __element("hr");
194
- __el4.setAttribute("role", "separator");
195
- return __el4;
196
- })();
197
- content.appendChild(hr);
198
- return hr;
199
- }
200
- function Label(text) {
201
- const el = (() => {
202
- const __el5 = __element("div");
203
- __el5.setAttribute("role", "none");
204
- __enterChildren(__el5);
205
- __insert(__el5, text);
206
- __exitChildren();
207
- return __el5;
208
- })();
209
- content.appendChild(el);
210
- return el;
211
- }
212
- applyAttrs(trigger, attrs);
213
- return { trigger, content, state, Item, Group, Separator, Label };
214
- }
215
- var ContextMenu = {
216
- Root: ContextMenuRoot
217
- };
218
-
219
- export { ContextMenu };
@@ -1,185 +0,0 @@
1
- import {
2
- setRovingTabindex
3
- } from "./chunk-e2v1c9ex.js";
4
- import {
5
- handleListNavigation
6
- } from "./chunk-7867pr13.js";
7
- import {
8
- setDataState,
9
- setHidden,
10
- setSelected
11
- } from "./chunk-vevfhpc9.js";
12
- import {
13
- uniqueId
14
- } from "./chunk-8y1jf6xr.js";
15
- import {
16
- applyAttrs
17
- } from "./chunk-2db2dnp3.js";
18
-
19
- // src/tabs/tabs.tsx
20
- import { __element, __enterChildren, __exitChildren, __insert, __on, __styleStr } from "@vertz/ui/internals";
21
- import { signal } from "@vertz/ui";
22
- function TabList(orientation, triggers, tabValues, selectTab) {
23
- return (() => {
24
- const __el0 = __element("div");
25
- __el0.setAttribute("role", "tablist");
26
- {
27
- const __v = orientation === "vertical" ? "vertical" : undefined;
28
- if (__v != null && __v !== false)
29
- __el0.setAttribute("aria-orientation", __v === true ? "" : __v);
30
- }
31
- __on(__el0, "keydown", (event) => {
32
- const result = handleListNavigation(event, triggers, {
33
- orientation
34
- });
35
- if (result) {
36
- const idx = triggers.indexOf(result);
37
- if (idx >= 0) {
38
- const val = tabValues[idx];
39
- if (val !== undefined)
40
- selectTab(val);
41
- }
42
- }
43
- });
44
- return __el0;
45
- })();
46
- }
47
- function TabTrigger(triggerId, panelId, value, label, isActive, selectTab) {
48
- return (() => {
49
- const __el0 = __element("button");
50
- __el0.setAttribute("type", "button");
51
- __el0.setAttribute("role", "tab");
52
- {
53
- const __v = triggerId;
54
- if (__v != null && __v !== false)
55
- __el0.setAttribute("id", __v === true ? "" : __v);
56
- }
57
- {
58
- const __v = panelId;
59
- if (__v != null && __v !== false)
60
- __el0.setAttribute("aria-controls", __v === true ? "" : __v);
61
- }
62
- {
63
- const __v = value;
64
- if (__v != null && __v !== false)
65
- __el0.setAttribute("data-value", __v === true ? "" : __v);
66
- }
67
- {
68
- const __v = isActive ? "true" : "false";
69
- if (__v != null && __v !== false)
70
- __el0.setAttribute("aria-selected", __v === true ? "" : __v);
71
- }
72
- {
73
- const __v = isActive ? "active" : "inactive";
74
- if (__v != null && __v !== false)
75
- __el0.setAttribute("data-state", __v === true ? "" : __v);
76
- }
77
- __on(__el0, "click", () => {
78
- selectTab(value);
79
- });
80
- __enterChildren(__el0);
81
- __insert(__el0, label ?? value);
82
- __exitChildren();
83
- return __el0;
84
- })();
85
- }
86
- function TabsContainer(list) {
87
- return (() => {
88
- const __el0 = __element("div");
89
- __enterChildren(__el0);
90
- __insert(__el0, list);
91
- __exitChildren();
92
- return __el0;
93
- })();
94
- }
95
- function TabPanel(panelId, triggerId, isActive) {
96
- return (() => {
97
- const __el0 = __element("div");
98
- __el0.setAttribute("role", "tabpanel");
99
- {
100
- const __v = panelId;
101
- if (__v != null && __v !== false)
102
- __el0.setAttribute("id", __v === true ? "" : __v);
103
- }
104
- {
105
- const __v = triggerId;
106
- if (__v != null && __v !== false)
107
- __el0.setAttribute("aria-labelledby", __v === true ? "" : __v);
108
- }
109
- __el0.setAttribute("tabindex", "0");
110
- {
111
- const __v = isActive ? "false" : "true";
112
- if (__v != null && __v !== false)
113
- __el0.setAttribute("aria-hidden", __v === true ? "" : __v);
114
- }
115
- {
116
- const __v = isActive ? "active" : "inactive";
117
- if (__v != null && __v !== false)
118
- __el0.setAttribute("data-state", __v === true ? "" : __v);
119
- }
120
- {
121
- const __v = isActive ? "" : "display: none";
122
- if (__v != null && __v !== false)
123
- __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
124
- }
125
- return __el0;
126
- })();
127
- }
128
- function TabsRoot(options = {}) {
129
- const { defaultValue = "", orientation = "horizontal", onValueChange, ...attrs } = options;
130
- const state = { value: signal(defaultValue) };
131
- const triggers = [];
132
- const panels = [];
133
- const tabValues = [];
134
- function selectTab(value) {
135
- state.value.value = value;
136
- for (let i = 0;i < tabValues.length; i++) {
137
- const isActive = tabValues[i] === value;
138
- const trig = triggers[i];
139
- const panel = panels[i];
140
- if (!trig || !panel)
141
- continue;
142
- setSelected(trig, isActive);
143
- setDataState(trig, isActive ? "active" : "inactive");
144
- trig.setAttribute("tabindex", isActive ? "0" : "-1");
145
- setHidden(panel, !isActive);
146
- setDataState(panel, isActive ? "active" : "inactive");
147
- }
148
- onValueChange?.(value);
149
- }
150
- const list = TabList(orientation, triggers, tabValues, selectTab);
151
- const root = TabsContainer(list);
152
- const cleanups = [];
153
- function Tab(value, label) {
154
- const baseId = uniqueId("tab");
155
- const triggerId = `${baseId}-trigger`;
156
- const panelId = `${baseId}-panel`;
157
- const isActive = value === state.value.peek();
158
- const trig = TabTrigger(triggerId, panelId, value, label, isActive, selectTab);
159
- const handleClick = () => {
160
- trig.focus();
161
- };
162
- trig.addEventListener("click", handleClick);
163
- cleanups.push(() => trig.removeEventListener("click", handleClick));
164
- const panel = TabPanel(panelId, triggerId, isActive);
165
- triggers.push(trig);
166
- panels.push(panel);
167
- tabValues.push(value);
168
- list.appendChild(trig);
169
- root.appendChild(panel);
170
- setRovingTabindex(triggers, triggers.findIndex((t) => tabValues[triggers.indexOf(t)] === state.value.peek()));
171
- return { trigger: trig, panel };
172
- }
173
- function destroy() {
174
- for (const cleanup of cleanups)
175
- cleanup();
176
- cleanups.length = 0;
177
- }
178
- applyAttrs(root, attrs);
179
- return { root, list, state, Tab, destroy };
180
- }
181
- var Tabs = {
182
- Root: TabsRoot
183
- };
184
-
185
- export { Tabs };
@@ -1,175 +0,0 @@
1
- import {
2
- Keys,
3
- isKey
4
- } from "./chunk-7867pr13.js";
5
- import {
6
- setDataState,
7
- setValueRange
8
- } from "./chunk-vevfhpc9.js";
9
- import {
10
- applyAttrs
11
- } from "./chunk-2db2dnp3.js";
12
-
13
- // src/resizable-panel/resizable-panel.tsx
14
- import { __element, __on, __styleStr } from "@vertz/ui/internals";
15
- import { signal } from "@vertz/ui";
16
- function ResizablePanelRoot(options = {}) {
17
- const { orientation = "horizontal", onResize, ...attrs } = options;
18
- const state = { sizes: signal([]) };
19
- const panels = [];
20
- const handles = [];
21
- function updateSizes(newSizes) {
22
- state.sizes.value = [...newSizes];
23
- for (let i = 0;i < panels.length; i++) {
24
- const panel = panels[i];
25
- if (!panel)
26
- continue;
27
- const size = newSizes[i] ?? 0;
28
- panel.el.style.flex = `0 0 ${size}%`;
29
- }
30
- for (let i = 0;i < handles.length; i++) {
31
- const handle = handles[i];
32
- const leftPanel = panels[i];
33
- if (handle && leftPanel) {
34
- const size = newSizes[i] ?? 0;
35
- setValueRange(handle, Math.round(size), Math.round(leftPanel.minSize), Math.round(leftPanel.maxSize));
36
- }
37
- }
38
- onResize?.(newSizes);
39
- }
40
- const root = (() => {
41
- const __el0 = __element("div");
42
- {
43
- const __v = `display: flex; flex-direction: ${orientation === "horizontal" ? "row" : "column"};`;
44
- if (__v != null && __v !== false)
45
- __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
46
- }
47
- {
48
- const __v = orientation;
49
- if (__v != null && __v !== false)
50
- __el0.setAttribute("data-orientation", __v === true ? "" : __v);
51
- }
52
- return __el0;
53
- })();
54
- function Panel(panelOptions = {}) {
55
- const { defaultSize, minSize = 0, maxSize = 100 } = panelOptions;
56
- const el = (() => {
57
- const __el1 = __element("div");
58
- __el1.setAttribute("data-panel", "");
59
- return __el1;
60
- })();
61
- panels.push({ el, minSize, maxSize });
62
- const sizes = state.sizes.peek();
63
- if (defaultSize != null) {
64
- sizes.push(defaultSize);
65
- } else {
66
- const equalSize = 100 / panels.length;
67
- sizes.length = 0;
68
- for (let i = 0;i < panels.length; i++) {
69
- sizes.push(equalSize);
70
- }
71
- }
72
- updateSizes(sizes);
73
- root.appendChild(el);
74
- return el;
75
- }
76
- function Handle() {
77
- const handleIndex = handles.length;
78
- const handle = (() => {
79
- const __el2 = __element("div");
80
- __el2.setAttribute("role", "separator");
81
- __el2.setAttribute("tabindex", "0");
82
- {
83
- const __v = orientation;
84
- if (__v != null && __v !== false)
85
- __el2.setAttribute("data-orientation", __v === true ? "" : __v);
86
- }
87
- __el2.setAttribute("data-state", "idle");
88
- __on(__el2, "keydown", (event) => {
89
- const sizes = [...state.sizes.peek()];
90
- const leftIdx = handleIndex;
91
- const rightIdx = handleIndex + 1;
92
- const leftPanel = panels[leftIdx];
93
- const rightPanel = panels[rightIdx];
94
- if (!leftPanel || !rightPanel)
95
- return;
96
- let leftSize = sizes[leftIdx] ?? 0;
97
- let rightSize = sizes[rightIdx] ?? 0;
98
- const STEP = 5;
99
- const growKey = orientation === "horizontal" ? Keys.ArrowRight : Keys.ArrowDown;
100
- const shrinkKey = orientation === "horizontal" ? Keys.ArrowLeft : Keys.ArrowUp;
101
- if (isKey(event, growKey)) {
102
- event.preventDefault();
103
- const delta = Math.min(STEP, rightSize - rightPanel.minSize, leftPanel.maxSize - leftSize);
104
- leftSize += delta;
105
- rightSize -= delta;
106
- } else if (isKey(event, shrinkKey)) {
107
- event.preventDefault();
108
- const delta = Math.min(STEP, leftSize - leftPanel.minSize, rightPanel.maxSize - rightSize);
109
- leftSize -= delta;
110
- rightSize += delta;
111
- } else if (isKey(event, Keys.Home)) {
112
- event.preventDefault();
113
- const delta = leftSize - leftPanel.minSize;
114
- leftSize -= delta;
115
- rightSize += delta;
116
- } else if (isKey(event, Keys.End)) {
117
- event.preventDefault();
118
- const delta = rightSize - rightPanel.minSize;
119
- leftSize += delta;
120
- rightSize -= delta;
121
- } else {
122
- return;
123
- }
124
- sizes[leftIdx] = leftSize;
125
- sizes[rightIdx] = rightSize;
126
- updateSizes(sizes);
127
- });
128
- __on(__el2, "pointerdown", (event) => {
129
- event.preventDefault();
130
- handle.setPointerCapture(event.pointerId);
131
- setDataState(handle, "dragging");
132
- const startPos = orientation === "horizontal" ? event.clientX : event.clientY;
133
- const rootSize = orientation === "horizontal" ? root.offsetWidth : root.offsetHeight;
134
- const startSizes = [...state.sizes.peek()];
135
- function onMove(e) {
136
- const currentPos = orientation === "horizontal" ? e.clientX : e.clientY;
137
- const delta = (currentPos - startPos) / rootSize * 100;
138
- const sizes = [...startSizes];
139
- const leftIdx = handleIndex;
140
- const rightIdx = handleIndex + 1;
141
- const leftPanel = panels[leftIdx];
142
- const rightPanel = panels[rightIdx];
143
- if (!leftPanel || !rightPanel)
144
- return;
145
- let newLeft = (startSizes[leftIdx] ?? 0) + delta;
146
- let newRight = (startSizes[rightIdx] ?? 0) - delta;
147
- newLeft = Math.max(leftPanel.minSize, Math.min(leftPanel.maxSize, newLeft));
148
- newRight = Math.max(rightPanel.minSize, Math.min(rightPanel.maxSize, newRight));
149
- sizes[leftIdx] = newLeft;
150
- sizes[rightIdx] = newRight;
151
- updateSizes(sizes);
152
- }
153
- function onUp(e) {
154
- handle.releasePointerCapture(e.pointerId);
155
- setDataState(handle, "idle");
156
- handle.removeEventListener("pointermove", onMove);
157
- handle.removeEventListener("pointerup", onUp);
158
- }
159
- handle.addEventListener("pointermove", onMove);
160
- handle.addEventListener("pointerup", onUp);
161
- });
162
- return __el2;
163
- })();
164
- handles.push(handle);
165
- root.appendChild(handle);
166
- return handle;
167
- }
168
- applyAttrs(root, attrs);
169
- return { root, state, Panel, Handle };
170
- }
171
- var ResizablePanel = {
172
- Root: ResizablePanelRoot
173
- };
174
-
175
- export { ResizablePanel };
@@ -1,46 +0,0 @@
1
- import {
2
- handleActivation
3
- } from "./chunk-7867pr13.js";
4
- import {
5
- applyAttrs
6
- } from "./chunk-2db2dnp3.js";
7
-
8
- // src/button/button.tsx
9
- import { __element, __on } from "@vertz/ui/internals";
10
- function ButtonRoot(options = {}) {
11
- const { disabled = false, onClick, ...attrs } = options;
12
- const el = (() => {
13
- const __el0 = __element("button");
14
- __el0.setAttribute("type", "button");
15
- {
16
- const __v = disabled;
17
- if (__v != null && __v !== false)
18
- __el0.setAttribute("disabled", __v === true ? "" : __v);
19
- }
20
- {
21
- const __v = disabled ? "true" : undefined;
22
- if (__v != null && __v !== false)
23
- __el0.setAttribute("aria-disabled", __v === true ? "" : __v);
24
- }
25
- __on(__el0, "click", () => {
26
- if (disabled)
27
- return;
28
- onClick?.();
29
- });
30
- __on(__el0, "keydown", (event) => {
31
- if (disabled)
32
- return;
33
- handleActivation(event, () => {
34
- event.target.click();
35
- });
36
- });
37
- return __el0;
38
- })();
39
- applyAttrs(el, attrs);
40
- return el;
41
- }
42
- var Button = {
43
- Root: ButtonRoot
44
- };
45
-
46
- export { Button };