@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,204 +0,0 @@
1
- import {
2
- saveFocus,
3
- trapFocus
4
- } from "./chunk-e2v1c9ex.js";
5
- import {
6
- setDataState,
7
- setExpanded,
8
- setHidden,
9
- setHiddenAnimated
10
- } from "./chunk-vevfhpc9.js";
11
- import {
12
- linkedIds
13
- } from "./chunk-8y1jf6xr.js";
14
-
15
- // src/alert-dialog/alert-dialog.tsx
16
- import { __element, __on, __styleStr } from "@vertz/ui/internals";
17
- import { signal } from "@vertz/ui";
18
- function AlertDialogTriggerEl(triggerId, contentId, defaultOpen, onClick) {
19
- return (() => {
20
- const __el0 = __element("button");
21
- __el0.setAttribute("type", "button");
22
- {
23
- const __v = triggerId;
24
- if (__v != null && __v !== false)
25
- __el0.setAttribute("id", __v === true ? "" : __v);
26
- }
27
- {
28
- const __v = contentId;
29
- if (__v != null && __v !== false)
30
- __el0.setAttribute("aria-controls", __v === true ? "" : __v);
31
- }
32
- {
33
- const __v = defaultOpen ? "true" : "false";
34
- if (__v != null && __v !== false)
35
- __el0.setAttribute("aria-expanded", __v === true ? "" : __v);
36
- }
37
- {
38
- const __v = defaultOpen ? "open" : "closed";
39
- if (__v != null && __v !== false)
40
- __el0.setAttribute("data-state", __v === true ? "" : __v);
41
- }
42
- __on(__el0, "click", onClick);
43
- return __el0;
44
- })();
45
- }
46
- function AlertDialogOverlayEl(defaultOpen) {
47
- return (() => {
48
- const __el0 = __element("div");
49
- __el0.setAttribute("data-alertdialog-overlay", "");
50
- {
51
- const __v = defaultOpen ? "false" : "true";
52
- if (__v != null && __v !== false)
53
- __el0.setAttribute("aria-hidden", __v === true ? "" : __v);
54
- }
55
- {
56
- const __v = defaultOpen ? "open" : "closed";
57
- if (__v != null && __v !== false)
58
- __el0.setAttribute("data-state", __v === true ? "" : __v);
59
- }
60
- {
61
- const __v = defaultOpen ? "" : "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
- }
68
- function AlertDialogContentEl(contentId, titleId, descriptionId, defaultOpen) {
69
- return (() => {
70
- const __el0 = __element("div");
71
- __el0.setAttribute("role", "alertdialog");
72
- {
73
- const __v = contentId;
74
- if (__v != null && __v !== false)
75
- __el0.setAttribute("id", __v === true ? "" : __v);
76
- }
77
- __el0.setAttribute("aria-modal", "true");
78
- {
79
- const __v = titleId;
80
- if (__v != null && __v !== false)
81
- __el0.setAttribute("aria-labelledby", __v === true ? "" : __v);
82
- }
83
- {
84
- const __v = descriptionId;
85
- if (__v != null && __v !== false)
86
- __el0.setAttribute("aria-describedby", __v === true ? "" : __v);
87
- }
88
- {
89
- const __v = defaultOpen ? "false" : "true";
90
- if (__v != null && __v !== false)
91
- __el0.setAttribute("aria-hidden", __v === true ? "" : __v);
92
- }
93
- {
94
- const __v = defaultOpen ? "open" : "closed";
95
- if (__v != null && __v !== false)
96
- __el0.setAttribute("data-state", __v === true ? "" : __v);
97
- }
98
- {
99
- const __v = defaultOpen ? "" : "display: none";
100
- if (__v != null && __v !== false)
101
- __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
102
- }
103
- return __el0;
104
- })();
105
- }
106
- function AlertDialogTitleEl(titleId) {
107
- return (() => {
108
- const __el0 = __element("h2");
109
- {
110
- const __v = titleId;
111
- if (__v != null && __v !== false)
112
- __el0.setAttribute("id", __v === true ? "" : __v);
113
- }
114
- return __el0;
115
- })();
116
- }
117
- function AlertDialogDescriptionEl(descriptionId) {
118
- return (() => {
119
- const __el0 = __element("p");
120
- {
121
- const __v = descriptionId;
122
- if (__v != null && __v !== false)
123
- __el0.setAttribute("id", __v === true ? "" : __v);
124
- }
125
- return __el0;
126
- })();
127
- }
128
- function AlertDialogCancelBtn(onClick) {
129
- return (() => {
130
- const __el0 = __element("button");
131
- __el0.setAttribute("type", "button");
132
- __on(__el0, "click", onClick);
133
- return __el0;
134
- })();
135
- }
136
- function AlertDialogActionBtn(onClick) {
137
- return (() => {
138
- const __el0 = __element("button");
139
- __el0.setAttribute("type", "button");
140
- __on(__el0, "click", onClick);
141
- return __el0;
142
- })();
143
- }
144
- function AlertDialogRoot(options = {}) {
145
- const { defaultOpen = false, onOpenChange, onAction } = options;
146
- const ids = linkedIds("alertdialog");
147
- const titleId = `${ids.contentId}-title`;
148
- const descriptionId = `${ids.contentId}-description`;
149
- const state = { open: signal(defaultOpen) };
150
- let restoreFocus = null;
151
- let removeTrap = null;
152
- function show() {
153
- if (state.open.peek())
154
- return;
155
- state.open.value = true;
156
- setExpanded(trigger, true);
157
- setHidden(overlay, false);
158
- setHidden(content, false);
159
- setDataState(trigger, "open");
160
- setDataState(overlay, "open");
161
- setDataState(content, "open");
162
- restoreFocus = saveFocus();
163
- removeTrap = trapFocus(content);
164
- queueMicrotask(() => cancel.focus());
165
- onOpenChange?.(true);
166
- }
167
- function hide() {
168
- if (!state.open.peek())
169
- return;
170
- state.open.value = false;
171
- setExpanded(trigger, false);
172
- setDataState(trigger, "closed");
173
- setDataState(overlay, "closed");
174
- setDataState(content, "closed");
175
- setHiddenAnimated(overlay, true);
176
- setHiddenAnimated(content, true);
177
- removeTrap?.();
178
- removeTrap = null;
179
- restoreFocus?.();
180
- restoreFocus = null;
181
- onOpenChange?.(false);
182
- }
183
- const trigger = AlertDialogTriggerEl(ids.triggerId, ids.contentId, defaultOpen, show);
184
- const overlay = AlertDialogOverlayEl(defaultOpen);
185
- const content = AlertDialogContentEl(ids.contentId, titleId, descriptionId, defaultOpen);
186
- const title = AlertDialogTitleEl(titleId);
187
- const description = AlertDialogDescriptionEl(descriptionId);
188
- const cancel = AlertDialogCancelBtn(() => hide());
189
- const action = AlertDialogActionBtn(() => {
190
- onAction?.();
191
- hide();
192
- });
193
- if (defaultOpen) {
194
- restoreFocus = saveFocus();
195
- removeTrap = trapFocus(content);
196
- queueMicrotask(() => cancel.focus());
197
- }
198
- return { trigger, overlay, content, title, description, cancel, action, state, show, hide };
199
- }
200
- var AlertDialog = {
201
- Root: AlertDialogRoot
202
- };
203
-
204
- export { AlertDialog };
@@ -1,133 +0,0 @@
1
- import {
2
- Keys,
3
- isKey
4
- } from "./chunk-7867pr13.js";
5
- import {
6
- setDataState
7
- } from "./chunk-vevfhpc9.js";
8
- import {
9
- applyAttrs
10
- } from "./chunk-2db2dnp3.js";
11
-
12
- // src/carousel/carousel.tsx
13
- import { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";
14
- import { signal } from "@vertz/ui";
15
- function CarouselRoot(options = {}) {
16
- const {
17
- orientation = "horizontal",
18
- loop = false,
19
- defaultIndex = 0,
20
- onSlideChange,
21
- ...attrs
22
- } = options;
23
- const state = {
24
- currentIndex: signal(defaultIndex),
25
- slideCount: signal(0)
26
- };
27
- const slides = [];
28
- function updateSlideVisibility() {
29
- const current = state.currentIndex.peek();
30
- for (let i = 0;i < slides.length; i++) {
31
- const slide = slides[i];
32
- if (!slide)
33
- continue;
34
- slide.setAttribute("aria-hidden", String(i !== current));
35
- slide.setAttribute("aria-label", `Slide ${i + 1} of ${slides.length}`);
36
- setDataState(slide, i === current ? "active" : "inactive");
37
- }
38
- if (!loop) {
39
- prevButton.disabled = current <= 0;
40
- nextButton.disabled = current >= slides.length - 1;
41
- }
42
- const translateProp = orientation === "horizontal" ? "translateX" : "translateY";
43
- viewport.style.transform = `${translateProp}(-${current * 100}%)`;
44
- }
45
- function goTo(index) {
46
- const total = slides.length;
47
- if (total === 0)
48
- return;
49
- let next = index;
50
- if (loop) {
51
- next = (index % total + total) % total;
52
- } else {
53
- next = Math.max(0, Math.min(total - 1, index));
54
- }
55
- if (next === state.currentIndex.peek())
56
- return;
57
- state.currentIndex.value = next;
58
- updateSlideVisibility();
59
- onSlideChange?.(next);
60
- }
61
- function goNext() {
62
- goTo(state.currentIndex.peek() + 1);
63
- }
64
- function goPrev() {
65
- goTo(state.currentIndex.peek() - 1);
66
- }
67
- const viewport = (() => {
68
- const __el0 = __element("div");
69
- __el0.setAttribute("style", "overflow: hidden;");
70
- return __el0;
71
- })();
72
- const prevButton = (() => {
73
- const __el1 = __element("button");
74
- __el1.setAttribute("type", "button");
75
- __el1.setAttribute("aria-label", "Previous slide");
76
- __on(__el1, "click", goPrev);
77
- return __el1;
78
- })();
79
- const nextButton = (() => {
80
- const __el2 = __element("button");
81
- __el2.setAttribute("type", "button");
82
- __el2.setAttribute("aria-label", "Next slide");
83
- __on(__el2, "click", goNext);
84
- return __el2;
85
- })();
86
- const root = (() => {
87
- const __el3 = __element("div");
88
- __el3.setAttribute("role", "region");
89
- __el3.setAttribute("aria-roledescription", "carousel");
90
- {
91
- const __v = orientation;
92
- if (__v != null && __v !== false)
93
- __el3.setAttribute("data-orientation", __v === true ? "" : __v);
94
- }
95
- __on(__el3, "keydown", (event) => {
96
- const prevKey = orientation === "horizontal" ? Keys.ArrowLeft : Keys.ArrowUp;
97
- const nextKey = orientation === "horizontal" ? Keys.ArrowRight : Keys.ArrowDown;
98
- if (isKey(event, prevKey)) {
99
- event.preventDefault();
100
- goPrev();
101
- }
102
- if (isKey(event, nextKey)) {
103
- event.preventDefault();
104
- goNext();
105
- }
106
- });
107
- __enterChildren(__el3);
108
- __insert(__el3, viewport);
109
- __exitChildren();
110
- return __el3;
111
- })();
112
- function Slide() {
113
- const slide = (() => {
114
- const __el4 = __element("div");
115
- __el4.setAttribute("role", "group");
116
- __el4.setAttribute("aria-roledescription", "slide");
117
- return __el4;
118
- })();
119
- slides.push(slide);
120
- state.slideCount.value = slides.length;
121
- viewport.appendChild(slide);
122
- updateSlideVisibility();
123
- return slide;
124
- }
125
- updateSlideVisibility();
126
- applyAttrs(root, attrs);
127
- return { root, viewport, prevButton, nextButton, state, Slide, goTo, goNext, goPrev };
128
- }
129
- var Carousel = {
130
- Root: CarouselRoot
131
- };
132
-
133
- export { Carousel };
@@ -1,34 +0,0 @@
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 { __element } from "@vertz/ui/internals";
10
- function BadgeRoot(options = {}) {
11
- const { variant = "default", ...attrs } = options;
12
- const badge = (() => {
13
- const __el0 = __element("span");
14
- {
15
- const __v = uniqueId("badge");
16
- if (__v != null && __v !== false)
17
- __el0.setAttribute("id", __v === true ? "" : __v);
18
- }
19
- __el0.setAttribute("data-slot", "badge");
20
- {
21
- const __v = variant;
22
- if (__v != null && __v !== false)
23
- __el0.setAttribute("data-variant", __v === true ? "" : __v);
24
- }
25
- return __el0;
26
- })();
27
- applyAttrs(badge, attrs);
28
- return { badge };
29
- }
30
- var Badge = {
31
- Root: BadgeRoot
32
- };
33
-
34
- export { Badge };
@@ -1,161 +0,0 @@
1
- import {
2
- applyAttrs
3
- } from "./chunk-2db2dnp3.js";
4
-
5
- // src/scroll-area/scroll-area.tsx
6
- import { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";
7
- import { signal } from "@vertz/ui";
8
- function ScrollAreaRoot(options = {}) {
9
- const { orientation = "vertical", type: _type, ...attrs } = options;
10
- const state = {
11
- scrollTop: signal(0),
12
- scrollLeft: signal(0)
13
- };
14
- let isDraggingY = false;
15
- let startY = 0;
16
- let startScrollTop = 0;
17
- let isDraggingX = false;
18
- let startX = 0;
19
- let startScrollLeft = 0;
20
- function syncThumbY() {
21
- const { scrollTop, scrollHeight, clientHeight } = viewport;
22
- if (scrollHeight <= clientHeight) {
23
- thumbY.style.height = "0";
24
- return;
25
- }
26
- const ratio = clientHeight / scrollHeight;
27
- thumbY.style.height = `${ratio * 100}%`;
28
- const scrollRatio = scrollTop / (scrollHeight - clientHeight);
29
- thumbY.style.transform = `translateY(${scrollRatio * (1 / ratio - 1) * 100}%)`;
30
- state.scrollTop.value = scrollTop;
31
- }
32
- function syncThumbX() {
33
- const { scrollLeft, scrollWidth, clientWidth } = viewport;
34
- if (scrollWidth <= clientWidth) {
35
- thumbX.style.width = "0";
36
- return;
37
- }
38
- const ratio = clientWidth / scrollWidth;
39
- thumbX.style.width = `${ratio * 100}%`;
40
- const scrollRatio = scrollLeft / (scrollWidth - clientWidth);
41
- thumbX.style.transform = `translateX(${scrollRatio * (1 / ratio - 1) * 100}%)`;
42
- state.scrollLeft.value = scrollLeft;
43
- }
44
- function update() {
45
- syncThumbY();
46
- syncThumbX();
47
- }
48
- function handleViewportScroll() {
49
- if (orientation === "vertical" || orientation === "both")
50
- syncThumbY();
51
- if (orientation === "horizontal" || orientation === "both")
52
- syncThumbX();
53
- }
54
- function handleThumbYDown(e) {
55
- isDraggingY = true;
56
- startY = e.clientY;
57
- startScrollTop = viewport.scrollTop;
58
- thumbY.setPointerCapture(e.pointerId);
59
- e.preventDefault();
60
- }
61
- function handleThumbYMove(e) {
62
- if (!isDraggingY)
63
- return;
64
- const delta = e.clientY - startY;
65
- const scrollbarHeight = scrollbarY.clientHeight;
66
- const scrollRange = viewport.scrollHeight - viewport.clientHeight;
67
- if (scrollbarHeight > 0) {
68
- viewport.scrollTop = startScrollTop + delta / scrollbarHeight * scrollRange;
69
- }
70
- }
71
- function handleThumbYUp(e) {
72
- isDraggingY = false;
73
- thumbY.releasePointerCapture(e.pointerId);
74
- }
75
- function handleThumbXDown(e) {
76
- isDraggingX = true;
77
- startX = e.clientX;
78
- startScrollLeft = viewport.scrollLeft;
79
- thumbX.setPointerCapture(e.pointerId);
80
- e.preventDefault();
81
- }
82
- function handleThumbXMove(e) {
83
- if (!isDraggingX)
84
- return;
85
- const delta = e.clientX - startX;
86
- const scrollbarWidth = scrollbarX.clientWidth;
87
- const scrollRange = viewport.scrollWidth - viewport.clientWidth;
88
- if (scrollbarWidth > 0) {
89
- viewport.scrollLeft = startScrollLeft + delta / scrollbarWidth * scrollRange;
90
- }
91
- }
92
- function handleThumbXUp(e) {
93
- isDraggingX = false;
94
- thumbX.releasePointerCapture(e.pointerId);
95
- }
96
- const thumbY = (() => {
97
- const __el0 = __element("div");
98
- __on(__el0, "pointerdown", handleThumbYDown);
99
- __on(__el0, "pointermove", handleThumbYMove);
100
- __on(__el0, "pointerup", handleThumbYUp);
101
- return __el0;
102
- })();
103
- const scrollbarY = (() => {
104
- const __el1 = __element("div");
105
- __el1.setAttribute("aria-hidden", "true");
106
- __el1.setAttribute("data-orientation", "vertical");
107
- __enterChildren(__el1);
108
- __insert(__el1, thumbY);
109
- __exitChildren();
110
- return __el1;
111
- })();
112
- const thumbX = (() => {
113
- const __el2 = __element("div");
114
- __on(__el2, "pointerdown", handleThumbXDown);
115
- __on(__el2, "pointermove", handleThumbXMove);
116
- __on(__el2, "pointerup", handleThumbXUp);
117
- return __el2;
118
- })();
119
- const scrollbarX = (() => {
120
- const __el3 = __element("div");
121
- __el3.setAttribute("aria-hidden", "true");
122
- __el3.setAttribute("data-orientation", "horizontal");
123
- __enterChildren(__el3);
124
- __insert(__el3, thumbX);
125
- __exitChildren();
126
- return __el3;
127
- })();
128
- const content = (() => {
129
- const __el4 = __element("div");
130
- return __el4;
131
- })();
132
- const viewport = (() => {
133
- const __el5 = __element("div");
134
- __el5.setAttribute("style", "overflow: scroll;");
135
- __on(__el5, "scroll", handleViewportScroll);
136
- __enterChildren(__el5);
137
- __insert(__el5, content);
138
- __exitChildren();
139
- return __el5;
140
- })();
141
- viewport.style.scrollbarWidth = "none";
142
- const root = (() => {
143
- const __el6 = __element("div");
144
- __el6.setAttribute("style", "position: relative; overflow: hidden;");
145
- __enterChildren(__el6);
146
- __insert(__el6, viewport);
147
- __exitChildren();
148
- return __el6;
149
- })();
150
- if (orientation === "vertical" || orientation === "both")
151
- root.appendChild(scrollbarY);
152
- if (orientation === "horizontal" || orientation === "both")
153
- root.appendChild(scrollbarX);
154
- applyAttrs(root, attrs);
155
- return { root, viewport, content, scrollbarY, thumbY, scrollbarX, thumbX, state, update };
156
- }
157
- var ScrollArea = {
158
- Root: ScrollAreaRoot
159
- };
160
-
161
- export { ScrollArea };
@@ -1,61 +0,0 @@
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/switch/switch.tsx
13
- import { computed, signal } from "@vertz/ui";
14
- import { __attr, __element, __on } from "@vertz/ui/internals";
15
- function SwitchRoot(options = {}) {
16
- const { defaultChecked = false, disabled = false, onCheckedChange, ...attrs } = options;
17
- const checked = signal(defaultChecked, "checked");
18
- function toggle() {
19
- if (disabled)
20
- return;
21
- checked.value = !checked.value;
22
- onCheckedChange?.(checked.value);
23
- }
24
- const el = computed(() => (() => {
25
- const __el0 = __element("button");
26
- __el0.setAttribute("type", "button");
27
- __el0.setAttribute("role", "switch");
28
- {
29
- const __v = uniqueId("switch");
30
- if (__v != null && __v !== false)
31
- __el0.setAttribute("id", __v === true ? "" : __v);
32
- }
33
- __attr(__el0, "aria-checked", () => checked.value ? "true" : "false");
34
- __attr(__el0, "data-state", () => checked.value ? "checked" : "unchecked");
35
- {
36
- const __v = disabled;
37
- if (__v != null && __v !== false)
38
- __el0.setAttribute("disabled", __v === true ? "" : __v);
39
- }
40
- {
41
- const __v = disabled ? "true" : undefined;
42
- if (__v != null && __v !== false)
43
- __el0.setAttribute("aria-disabled", __v === true ? "" : __v);
44
- }
45
- __on(__el0, "click", toggle);
46
- __on(__el0, "keydown", (e) => {
47
- if (isKey(e, Keys.Space)) {
48
- e.preventDefault();
49
- toggle();
50
- }
51
- });
52
- return __el0;
53
- })());
54
- applyAttrs(el.value, attrs);
55
- return el.value;
56
- }
57
- var Switch = {
58
- Root: SwitchRoot
59
- };
60
-
61
- export { Switch };