@vertz/ui-primitives 0.2.22 → 0.2.24

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 (236) hide show
  1. package/dist/shared/chunk-00fqgnq1.js +218 -0
  2. package/dist/shared/chunk-1hm0mbke.js +258 -0
  3. package/dist/shared/chunk-20kwns82.js +293 -0
  4. package/dist/shared/chunk-3jack97k.js +509 -0
  5. package/dist/shared/chunk-455p0jbk.js +241 -0
  6. package/dist/shared/chunk-4gyg71bn.js +178 -0
  7. package/dist/shared/chunk-4z006v1j.js +467 -0
  8. package/dist/shared/chunk-585ysr70.js +149 -0
  9. package/dist/shared/chunk-67sn29eh.js +125 -0
  10. package/dist/shared/chunk-75pegjs7.js +26 -0
  11. package/dist/shared/chunk-7a2nqmeh.js +167 -0
  12. package/dist/shared/chunk-7wem1bhb.js +252 -0
  13. package/dist/shared/chunk-8evj43jn.js +284 -0
  14. package/dist/shared/chunk-8t0nm721.js +152 -0
  15. package/dist/shared/chunk-94twh4s4.js +28 -0
  16. package/dist/shared/chunk-98y1sw9y.js +398 -0
  17. package/dist/shared/chunk-99tk72t3.js +69 -0
  18. package/dist/shared/chunk-9eedsnnk.js +164 -0
  19. package/dist/shared/chunk-9hv3vc72.js +215 -0
  20. package/dist/shared/chunk-aa3w85hn.js +321 -0
  21. package/dist/shared/chunk-axpbdpgx.js +177 -0
  22. package/dist/shared/chunk-b4zzg457.js +410 -0
  23. package/dist/shared/chunk-brk0drrk.js +202 -0
  24. package/dist/shared/chunk-czv0kqj4.js +107 -0
  25. package/dist/shared/chunk-d83ag07h.js +189 -0
  26. package/dist/shared/chunk-de18ashk.js +134 -0
  27. package/dist/shared/chunk-dvk4h36t.js +140 -0
  28. package/dist/shared/chunk-e1jcf22s.js +79 -0
  29. package/dist/shared/chunk-e3h0ddmx.js +168 -0
  30. package/dist/shared/chunk-e6660g7e.js +179 -0
  31. package/dist/shared/chunk-eq4d9b0w.js +147 -0
  32. package/dist/shared/chunk-ev367pq3.js +102 -0
  33. package/dist/shared/chunk-f0wy7k56.js +183 -0
  34. package/dist/shared/chunk-fjykbv0v.js +214 -0
  35. package/dist/shared/chunk-ghkw5bjq.js +55 -0
  36. package/dist/shared/chunk-gqb1n1hj.js +60 -0
  37. package/dist/shared/chunk-hdvdfd1c.js +96 -0
  38. package/dist/shared/chunk-hfjtkytb.js +310 -0
  39. package/dist/shared/chunk-hpvjfj0j.js +31 -0
  40. package/dist/shared/chunk-hxmxvp56.js +67 -0
  41. package/dist/shared/chunk-j9m2f0rd.js +162 -0
  42. package/dist/shared/chunk-jdygp28a.js +260 -0
  43. package/dist/shared/chunk-jpyjk616.js +52 -0
  44. package/dist/shared/chunk-jqre4qtw.js +180 -0
  45. package/dist/shared/{chunk-myq79qew.js → chunk-jsa3byag.js} +48 -28
  46. package/dist/shared/chunk-jzy1bkdk.js +203 -0
  47. package/dist/shared/chunk-knzg86am.js +168 -0
  48. package/dist/shared/chunk-kskxxc2q.js +228 -0
  49. package/dist/shared/chunk-metxdt5x.js +28 -0
  50. package/dist/shared/chunk-mhn2aazf.js +353 -0
  51. package/dist/shared/chunk-mtx2cfbx.js +175 -0
  52. package/dist/shared/chunk-nj420k31.js +54 -0
  53. package/dist/shared/chunk-nsmvdxgp.js +213 -0
  54. package/dist/shared/{chunk-w9dag6ce.js → chunk-pdzmg245.js} +133 -85
  55. package/dist/shared/chunk-pzknpa1y.js +327 -0
  56. package/dist/shared/chunk-q1ff3xp3.js +95 -0
  57. package/dist/shared/chunk-q7xbcj9q.js +7 -0
  58. package/dist/shared/chunk-qhnany7w.js +179 -0
  59. package/dist/shared/chunk-qrm43tr3.js +357 -0
  60. package/dist/shared/{chunk-jda3v59q.js → chunk-qsp7sfhp.js} +2 -2
  61. package/dist/shared/{chunk-dhyr0s9n.js → chunk-qwqnjjg8.js} +1 -1
  62. package/dist/shared/chunk-r0rz7z03.js +266 -0
  63. package/dist/shared/chunk-r3ngaa64.js +418 -0
  64. package/dist/shared/chunk-r3pffzss.js +13 -0
  65. package/dist/shared/chunk-rrt62bp0.js +353 -0
  66. package/dist/shared/chunk-s24gkmna.js +131 -0
  67. package/dist/shared/chunk-s62e7jf4.js +30 -0
  68. package/dist/shared/chunk-spng4yb9.js +73 -0
  69. package/dist/shared/chunk-tn0m98j8.js +42 -0
  70. package/dist/shared/chunk-v0b5pkcq.js +30 -0
  71. package/dist/shared/chunk-v11kd39k.js +162 -0
  72. package/dist/shared/{chunk-0mcr52hc.js → chunk-vef3sepw.js} +17 -1
  73. package/dist/shared/chunk-vkscwzpr.js +294 -0
  74. package/dist/shared/chunk-vv187snj.js +112 -0
  75. package/dist/shared/chunk-vy874zxe.js +68 -0
  76. package/dist/shared/chunk-wqsek87j.js +311 -0
  77. package/dist/shared/chunk-wtkxz2te.js +157 -0
  78. package/dist/shared/chunk-y1hpsqzy.js +185 -0
  79. package/dist/shared/chunk-y4mmmayp.js +206 -0
  80. package/dist/shared/chunk-yfzddvxc.js +71 -0
  81. package/dist/src/accordion/accordion-composed.d.ts +30 -0
  82. package/dist/src/accordion/accordion-composed.js +6 -0
  83. package/dist/src/accordion/accordion.js +1 -1
  84. package/dist/src/alert/alert-composed.d.ts +26 -0
  85. package/dist/src/alert/alert-composed.js +6 -0
  86. package/dist/src/alert-dialog/alert-dialog-composed.d.ts +40 -0
  87. package/dist/src/alert-dialog/alert-dialog-composed.js +6 -0
  88. package/dist/src/alert-dialog/alert-dialog.js +1 -1
  89. package/dist/src/avatar/avatar-composed.d.ts +33 -0
  90. package/dist/src/avatar/avatar-composed.js +6 -0
  91. package/dist/src/badge/badge-composed.d.ts +33 -0
  92. package/dist/src/badge/badge-composed.js +6 -0
  93. package/dist/src/badge/badge.js +1 -1
  94. package/dist/src/breadcrumb/breadcrumb-composed.d.ts +34 -0
  95. package/dist/src/breadcrumb/breadcrumb-composed.js +6 -0
  96. package/dist/src/button/button-composed.d.ts +34 -0
  97. package/dist/src/button/button-composed.js +6 -0
  98. package/dist/src/button/button.js +1 -1
  99. package/dist/src/calendar/calendar-composed.d.ts +42 -0
  100. package/dist/src/calendar/calendar-composed.js +6 -0
  101. package/dist/src/calendar/calendar.js +1 -1
  102. package/dist/src/card/card-composed.d.ts +34 -0
  103. package/dist/src/card/card-composed.js +6 -0
  104. package/dist/src/carousel/carousel-composed.d.ts +32 -0
  105. package/dist/src/carousel/carousel-composed.js +6 -0
  106. package/dist/src/carousel/carousel.js +1 -1
  107. package/dist/src/checkbox/checkbox-composed.d.ts +18 -0
  108. package/dist/src/checkbox/checkbox-composed.js +6 -0
  109. package/dist/src/checkbox/checkbox.js +1 -1
  110. package/dist/src/collapsible/collapsible-composed.d.ts +26 -0
  111. package/dist/src/collapsible/collapsible-composed.js +6 -0
  112. package/dist/src/collapsible/collapsible.js +1 -1
  113. package/dist/src/combobox/combobox-composed.d.ts +30 -0
  114. package/dist/src/combobox/combobox-composed.js +6 -0
  115. package/dist/src/combobox/combobox.js +1 -1
  116. package/dist/src/command/command-composed.d.ts +67 -0
  117. package/dist/src/command/command-composed.js +6 -0
  118. package/dist/src/command/command.js +1 -1
  119. package/dist/src/composed/with-styles.d.ts +38 -0
  120. package/dist/src/composed/with-styles.js +6 -0
  121. package/dist/src/context-menu/context-menu-composed.d.ts +51 -0
  122. package/dist/src/context-menu/context-menu-composed.js +6 -0
  123. package/dist/src/context-menu/context-menu.js +1 -1
  124. package/dist/src/date-picker/date-picker-composed.d.ts +77 -0
  125. package/dist/src/date-picker/date-picker-composed.js +6 -0
  126. package/dist/src/date-picker/date-picker.js +1 -1
  127. package/dist/src/dialog/dialog-composed.d.ts +36 -0
  128. package/dist/src/dialog/dialog-composed.js +6 -0
  129. package/dist/src/dialog/dialog-stack-parts.d.ts +16 -0
  130. package/dist/src/dialog/dialog-stack-parts.js +18 -0
  131. package/dist/src/dialog/dialog.js +1 -1
  132. package/dist/src/dropdown-menu/dropdown-menu-composed.d.ts +51 -0
  133. package/dist/src/dropdown-menu/dropdown-menu-composed.js +6 -0
  134. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  135. package/dist/src/empty-state/empty-state-composed.d.ts +30 -0
  136. package/dist/src/empty-state/empty-state-composed.js +6 -0
  137. package/dist/src/form-group/form-group-composed.d.ts +24 -0
  138. package/dist/src/form-group/form-group-composed.js +6 -0
  139. package/dist/src/hover-card/hover-card-composed.d.ts +38 -0
  140. package/dist/src/hover-card/hover-card-composed.js +6 -0
  141. package/dist/src/hover-card/hover-card.js +1 -1
  142. package/dist/src/index.d.ts +1284 -804
  143. package/dist/src/index.js +78 -5281
  144. package/dist/src/input/input-composed.d.ts +35 -0
  145. package/dist/src/input/input-composed.js +6 -0
  146. package/dist/src/label/label-composed.d.ts +32 -0
  147. package/dist/src/label/label-composed.js +6 -0
  148. package/dist/src/menu/menu-composed.d.ts +51 -0
  149. package/dist/src/menu/menu-composed.js +6 -0
  150. package/dist/src/menu/menu.js +1 -1
  151. package/dist/src/menubar/menubar-composed.d.ts +56 -0
  152. package/dist/src/menubar/menubar-composed.js +6 -0
  153. package/dist/src/menubar/menubar.js +1 -1
  154. package/dist/src/navigation-menu/navigation-menu-composed.d.ts +56 -0
  155. package/dist/src/navigation-menu/navigation-menu-composed.js +6 -0
  156. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  157. package/dist/src/pagination/pagination-composed.d.ts +30 -0
  158. package/dist/src/pagination/pagination-composed.js +6 -0
  159. package/dist/src/popover/popover-composed.d.ts +36 -0
  160. package/dist/src/popover/popover-composed.js +6 -0
  161. package/dist/src/popover/popover.js +1 -1
  162. package/dist/src/progress/progress-composed.d.ts +17 -0
  163. package/dist/src/progress/progress-composed.js +6 -0
  164. package/dist/src/progress/progress.js +1 -1
  165. package/dist/src/radio/radio-composed.d.ts +24 -0
  166. package/dist/src/radio/radio-composed.js +6 -0
  167. package/dist/src/radio/radio.js +1 -1
  168. package/dist/src/resizable-panel/resizable-panel-composed.d.ts +33 -0
  169. package/dist/src/resizable-panel/resizable-panel-composed.js +6 -0
  170. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  171. package/dist/src/scroll-area/scroll-area-composed.d.ts +17 -0
  172. package/dist/src/scroll-area/scroll-area-composed.js +6 -0
  173. package/dist/src/scroll-area/scroll-area.js +1 -1
  174. package/dist/src/select/select-composed.d.ts +53 -0
  175. package/dist/src/select/select-composed.js +6 -0
  176. package/dist/src/select/select.js +1 -1
  177. package/dist/src/separator/separator-composed.d.ts +32 -0
  178. package/dist/src/separator/separator-composed.js +6 -0
  179. package/dist/src/sheet/sheet-composed.d.ts +34 -0
  180. package/dist/src/sheet/sheet-composed.js +6 -0
  181. package/dist/src/sheet/sheet.js +1 -1
  182. package/dist/src/skeleton/skeleton-composed.d.ts +65 -0
  183. package/dist/src/skeleton/skeleton-composed.js +6 -0
  184. package/dist/src/slider/slider-composed.d.ts +22 -0
  185. package/dist/src/slider/slider-composed.js +6 -0
  186. package/dist/src/slider/slider.js +1 -1
  187. package/dist/src/switch/switch-composed.d.ts +17 -0
  188. package/dist/src/switch/switch-composed.js +6 -0
  189. package/dist/src/switch/switch.js +1 -1
  190. package/dist/src/table/table-composed.d.ts +34 -0
  191. package/dist/src/table/table-composed.js +6 -0
  192. package/dist/src/tabs/tabs-composed.d.ts +33 -0
  193. package/dist/src/tabs/tabs-composed.js +6 -0
  194. package/dist/src/tabs/tabs.js +1 -1
  195. package/dist/src/textarea/textarea-composed.d.ts +35 -0
  196. package/dist/src/textarea/textarea-composed.js +6 -0
  197. package/dist/src/toast/toast.js +1 -1
  198. package/dist/src/toggle/toggle-composed.d.ts +16 -0
  199. package/dist/src/toggle/toggle-composed.js +6 -0
  200. package/dist/src/toggle/toggle.js +1 -1
  201. package/dist/src/toggle-group/toggle-group-composed.d.ts +24 -0
  202. package/dist/src/toggle-group/toggle-group-composed.js +6 -0
  203. package/dist/src/toggle-group/toggle-group.js +1 -1
  204. package/dist/src/tooltip/tooltip-composed.d.ts +36 -0
  205. package/dist/src/tooltip/tooltip-composed.js +6 -0
  206. package/dist/src/tooltip/tooltip.js +1 -1
  207. package/dist/src/utils.js +1 -1
  208. package/package.json +3 -3
  209. package/dist/shared/chunk-07yzsaaw.js +0 -165
  210. package/dist/shared/chunk-279bzynx.js +0 -132
  211. package/dist/shared/chunk-27xs9apd.js +0 -288
  212. package/dist/shared/chunk-2k8gxzdf.js +0 -151
  213. package/dist/shared/chunk-3rp73gkd.js +0 -175
  214. package/dist/shared/chunk-4rf1m34c.js +0 -267
  215. package/dist/shared/chunk-56reyd5r.js +0 -64
  216. package/dist/shared/chunk-7bxsf80c.js +0 -60
  217. package/dist/shared/chunk-8qtexw5s.js +0 -199
  218. package/dist/shared/chunk-9ezgd78r.js +0 -142
  219. package/dist/shared/chunk-ajpj10z0.js +0 -282
  220. package/dist/shared/chunk-c46v0fsw.js +0 -117
  221. package/dist/shared/chunk-e4mm5e59.js +0 -178
  222. package/dist/shared/chunk-fqa5bwn1.js +0 -128
  223. package/dist/shared/chunk-g8hnc95b.js +0 -219
  224. package/dist/shared/chunk-j2tdpxgc.js +0 -185
  225. package/dist/shared/chunk-k8nabsxm.js +0 -330
  226. package/dist/shared/chunk-kcnq15je.js +0 -175
  227. package/dist/shared/chunk-mqs4qq0b.js +0 -46
  228. package/dist/shared/chunk-pg2yjn8f.js +0 -88
  229. package/dist/shared/chunk-rb53v045.js +0 -71
  230. package/dist/shared/chunk-s6a2yph8.js +0 -239
  231. package/dist/shared/chunk-vhx3sqw6.js +0 -196
  232. package/dist/shared/chunk-w318par6.js +0 -204
  233. package/dist/shared/chunk-wcdq7bew.js +0 -133
  234. package/dist/shared/chunk-z0gwkzgp.js +0 -34
  235. package/dist/shared/chunk-z850et33.js +0 -161
  236. package/dist/shared/chunk-zyfc6cx3.js +0 -61
@@ -0,0 +1,241 @@
1
+ import {
2
+ Keys,
3
+ isKey
4
+ } from "./chunk-7867pr13.js";
5
+ import {
6
+ setHidden
7
+ } from "./chunk-vevfhpc9.js";
8
+ import {
9
+ uniqueId
10
+ } from "./chunk-8y1jf6xr.js";
11
+ import {
12
+ applyAttrs
13
+ } from "./chunk-2db2dnp3.js";
14
+
15
+ // src/command/command.tsx
16
+ import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
17
+ import { signal } from "@vertz/ui";
18
+ function CommandRoot(options = {}) {
19
+ const __mfDepth = __pushMountFrame();
20
+ try {
21
+ let getVisibleItems = function() {
22
+ return allItems.filter((item) => item.getAttribute("aria-hidden") !== "true");
23
+ }, updateActiveItem = function() {
24
+ const visible = getVisibleItems();
25
+ const activeIdx = state.activeIndex.peek();
26
+ for (const item of allItems) {
27
+ item.setAttribute("aria-selected", "false");
28
+ }
29
+ if (visible.length > 0 && activeIdx >= 0 && activeIdx < visible.length) {
30
+ visible[activeIdx]?.setAttribute("aria-selected", "true");
31
+ }
32
+ }, runFilter = function() {
33
+ const search = state.inputValue.peek();
34
+ let visibleCount = 0;
35
+ for (const item of allItems) {
36
+ const value = item.getAttribute("data-value") ?? "";
37
+ const text = item.textContent ?? "";
38
+ const keywords = item.getAttribute("data-keywords") ?? "";
39
+ const searchable = `${value} ${text} ${keywords}`;
40
+ const matches = search === "" || filterFn(searchable, search);
41
+ setHidden(item, !matches);
42
+ if (matches)
43
+ visibleCount++;
44
+ }
45
+ for (const [groupEl, group] of groups) {
46
+ const hasVisible = group.items.some((item) => item.getAttribute("aria-hidden") !== "true");
47
+ setHidden(group.heading, !hasVisible);
48
+ if (!hasVisible) {
49
+ groupEl.style.display = "none";
50
+ } else {
51
+ groupEl.style.display = "";
52
+ }
53
+ }
54
+ setHidden(empty, visibleCount > 0);
55
+ state.activeIndex.value = 0;
56
+ updateActiveItem();
57
+ }, createItem = function(value, label, keywords) {
58
+ const item = (() => {
59
+ const __el4 = __element("div");
60
+ __el4.setAttribute("role", "option");
61
+ {
62
+ const __v = value;
63
+ if (__v != null && __v !== false)
64
+ __el4.setAttribute("data-value", __v === true ? "" : __v);
65
+ }
66
+ __el4.setAttribute("aria-selected", "false");
67
+ {
68
+ const __v = keywords && keywords.length > 0 ? keywords.join(" ") : undefined;
69
+ if (__v != null && __v !== false)
70
+ __el4.setAttribute("data-keywords", __v === true ? "" : __v);
71
+ }
72
+ __on(__el4, "click", () => {
73
+ onSelect?.(value);
74
+ });
75
+ __enterChildren(__el4);
76
+ __insert(__el4, label ?? value);
77
+ __exitChildren();
78
+ return __el4;
79
+ })();
80
+ allItems.push(item);
81
+ updateActiveItem();
82
+ return item;
83
+ }, Item = function(value, label, keywords) {
84
+ return createItem(value, label, keywords);
85
+ }, Group = function(label) {
86
+ const headingId = uniqueId("command-group");
87
+ const heading = (() => {
88
+ const __el5 = __element("div");
89
+ {
90
+ const __v = headingId;
91
+ if (__v != null && __v !== false)
92
+ __el5.setAttribute("id", __v === true ? "" : __v);
93
+ }
94
+ __enterChildren(__el5);
95
+ __insert(__el5, label);
96
+ __exitChildren();
97
+ return __el5;
98
+ })();
99
+ const el = (() => {
100
+ const __el6 = __element("div");
101
+ __el6.setAttribute("role", "group");
102
+ {
103
+ const __v = headingId;
104
+ if (__v != null && __v !== false)
105
+ __el6.setAttribute("aria-labelledby", __v === true ? "" : __v);
106
+ }
107
+ __enterChildren(__el6);
108
+ __insert(__el6, heading);
109
+ __exitChildren();
110
+ return __el6;
111
+ })();
112
+ const groupItems = [];
113
+ groups.set(el, { heading, items: groupItems });
114
+ return {
115
+ el,
116
+ Item: (value, itemLabel, keywords) => {
117
+ const item = createItem(value, itemLabel, keywords);
118
+ groupItems.push(item);
119
+ return item;
120
+ }
121
+ };
122
+ }, Separator = function() {
123
+ return (() => {
124
+ const __el7 = __element("hr");
125
+ __el7.setAttribute("role", "separator");
126
+ return __el7;
127
+ })();
128
+ };
129
+ const { filter: customFilter, onSelect, onInputChange, placeholder, ...attrs } = options;
130
+ const listId = uniqueId("command-list");
131
+ const state = {
132
+ inputValue: signal(""),
133
+ activeIndex: signal(0)
134
+ };
135
+ const allItems = [];
136
+ const groups = new Map;
137
+ const defaultFilter = (value, search) => {
138
+ return value.toLowerCase().includes(search.toLowerCase());
139
+ };
140
+ const filterFn = customFilter ?? defaultFilter;
141
+ const input = (() => {
142
+ const __el0 = __element("input");
143
+ __el0.setAttribute("type", "text");
144
+ __el0.setAttribute("role", "combobox");
145
+ __el0.setAttribute("aria-autocomplete", "list");
146
+ __el0.setAttribute("aria-expanded", "true");
147
+ {
148
+ const __v = listId;
149
+ if (__v != null && __v !== false)
150
+ __el0.setAttribute("aria-controls", __v === true ? "" : __v);
151
+ }
152
+ {
153
+ const __v = placeholder;
154
+ if (__v != null && __v !== false)
155
+ __el0.setAttribute("placeholder", __v === true ? "" : __v);
156
+ }
157
+ __on(__el0, "input", () => {
158
+ state.inputValue.value = input.value;
159
+ onInputChange?.(input.value);
160
+ runFilter();
161
+ });
162
+ __on(__el0, "keydown", (event) => {
163
+ const visible = getVisibleItems();
164
+ if (isKey(event, Keys.ArrowDown)) {
165
+ event.preventDefault();
166
+ const next = Math.min(state.activeIndex.peek() + 1, visible.length - 1);
167
+ state.activeIndex.value = next;
168
+ updateActiveItem();
169
+ return;
170
+ }
171
+ if (isKey(event, Keys.ArrowUp)) {
172
+ event.preventDefault();
173
+ const prev = Math.max(state.activeIndex.peek() - 1, 0);
174
+ state.activeIndex.value = prev;
175
+ updateActiveItem();
176
+ return;
177
+ }
178
+ if (isKey(event, Keys.Enter)) {
179
+ event.preventDefault();
180
+ const active = visible[state.activeIndex.peek()];
181
+ if (active) {
182
+ const val = active.getAttribute("data-value");
183
+ if (val !== null) {
184
+ onSelect?.(val);
185
+ }
186
+ }
187
+ return;
188
+ }
189
+ if (isKey(event, Keys.Escape)) {
190
+ event.preventDefault();
191
+ input.value = "";
192
+ state.inputValue.value = "";
193
+ onInputChange?.("");
194
+ runFilter();
195
+ }
196
+ });
197
+ return __el0;
198
+ })();
199
+ const list = (() => {
200
+ const __el1 = __element("div");
201
+ __el1.setAttribute("role", "listbox");
202
+ {
203
+ const __v = listId;
204
+ if (__v != null && __v !== false)
205
+ __el1.setAttribute("id", __v === true ? "" : __v);
206
+ }
207
+ return __el1;
208
+ })();
209
+ const empty = (() => {
210
+ const __el2 = __element("div");
211
+ __el2.setAttribute("aria-hidden", "true");
212
+ {
213
+ const __v = { display: "none" };
214
+ if (__v != null && __v !== false)
215
+ __el2.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
216
+ }
217
+ return __el2;
218
+ })();
219
+ const root = (() => {
220
+ const __el3 = __element("div");
221
+ __enterChildren(__el3);
222
+ __insert(__el3, input);
223
+ __insert(__el3, list);
224
+ __insert(__el3, empty);
225
+ __exitChildren();
226
+ return __el3;
227
+ })();
228
+ applyAttrs(root, attrs);
229
+ const __mfResult0 = { root, input, list, empty, state, Item, Group, Separator };
230
+ __flushMountFrame();
231
+ return __mfResult0;
232
+ } catch (__mfErr) {
233
+ __discardMountFrame(__mfDepth);
234
+ throw __mfErr;
235
+ }
236
+ }
237
+ var Command = {
238
+ Root: CommandRoot
239
+ };
240
+
241
+ export { Command };
@@ -0,0 +1,178 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/pagination/pagination-composed.tsx
6
+ import { computed } from "@vertz/ui";
7
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
8
+ function generatePaginationRange(current, total, siblings) {
9
+ const range = [];
10
+ const left = Math.max(2, current - siblings);
11
+ const right = Math.min(total - 1, current + siblings);
12
+ range.push(1);
13
+ if (left > 2) {
14
+ range.push("...");
15
+ }
16
+ for (let idx = left;idx <= right; idx++) {
17
+ if (idx !== 1 && idx !== total) {
18
+ range.push(idx);
19
+ }
20
+ }
21
+ if (right < total - 1) {
22
+ range.push("...");
23
+ }
24
+ if (total > 1) {
25
+ range.push(total);
26
+ }
27
+ return range;
28
+ }
29
+ function PageButton(__props) {
30
+ const __mfDepth = __pushMountFrame();
31
+ try {
32
+ if (__props.page === __props.currentPage) {
33
+ const __mfResult0 = (() => {
34
+ const __el0 = __element("button");
35
+ __el0.setAttribute("type", "button");
36
+ __attr(__el0, "class", () => cn(__props.classes?.linkActive));
37
+ __el0.setAttribute("aria-current", "page");
38
+ __enterChildren(__el0);
39
+ __append(__el0, __child(() => String(__props.page)));
40
+ __exitChildren();
41
+ return __el0;
42
+ })();
43
+ __flushMountFrame();
44
+ return __mfResult0;
45
+ }
46
+ const __mfResult1 = (() => {
47
+ const __el1 = __element("button");
48
+ __el1.setAttribute("type", "button");
49
+ __attr(__el1, "class", () => cn(__props.classes?.link));
50
+ __on(__el1, "click", () => __props.onPageChange(__props.page));
51
+ __enterChildren(__el1);
52
+ __append(__el1, __child(() => String(__props.page)));
53
+ __exitChildren();
54
+ return __el1;
55
+ })();
56
+ __flushMountFrame();
57
+ return __mfResult1;
58
+ } catch (__mfErr) {
59
+ __discardMountFrame(__mfDepth);
60
+ throw __mfErr;
61
+ }
62
+ }
63
+ function ComposedPaginationRoot(__props) {
64
+ const __mfDepth = __pushMountFrame();
65
+ try {
66
+ const range = computed(() => generatePaginationRange(__props.currentPage, __props.totalPages, __props.siblingCount ?? 1));
67
+ const pageItems = [];
68
+ for (const page of range.value) {
69
+ if (page === "...") {
70
+ pageItems.push((() => {
71
+ const __el0 = __element("li");
72
+ __attr(__el0, "class", () => cn(__props.classes?.item));
73
+ __enterChildren(__el0);
74
+ __append(__el0, (() => {
75
+ const __el1 = __element("span");
76
+ __el1.setAttribute("aria-hidden", "true");
77
+ __attr(__el1, "class", () => cn(__props.classes?.ellipsis));
78
+ __enterChildren(__el1);
79
+ __append(__el1, __child(() => __props.ellipsisContent ?? "..."));
80
+ __exitChildren();
81
+ return __el1;
82
+ })());
83
+ __exitChildren();
84
+ return __el0;
85
+ })());
86
+ } else {
87
+ pageItems.push((() => {
88
+ const __el2 = __element("li");
89
+ __attr(__el2, "class", () => cn(__props.classes?.item));
90
+ __enterChildren(__el2);
91
+ __append(__el2, PageButton({ get page() {
92
+ return page;
93
+ }, get currentPage() {
94
+ return __props.currentPage;
95
+ }, get onPageChange() {
96
+ return __props.onPageChange;
97
+ }, get classes() {
98
+ return __props.classes;
99
+ } }));
100
+ __exitChildren();
101
+ return __el2;
102
+ })());
103
+ }
104
+ }
105
+ const __mfResult0 = (() => {
106
+ const __el3 = __element("nav");
107
+ __el3.setAttribute("aria-label", "Pagination");
108
+ __attr(__el3, "class", () => cn(__props.classes?.nav, __props.className ?? __props.class));
109
+ __enterChildren(__el3);
110
+ __append(__el3, (() => {
111
+ const __el4 = __element("ul");
112
+ __attr(__el4, "class", () => cn(__props.classes?.list));
113
+ __enterChildren(__el4);
114
+ __append(__el4, (() => {
115
+ const __el5 = __element("li");
116
+ __attr(__el5, "class", () => cn(__props.classes?.item));
117
+ __enterChildren(__el5);
118
+ __append(__el5, (() => {
119
+ const __el6 = __element("button");
120
+ __el6.setAttribute("type", "button");
121
+ __attr(__el6, "class", () => cn(__props.classes?.navButton));
122
+ {
123
+ const __v = { paddingLeft: "0.375rem", paddingRight: "0.625rem" };
124
+ if (__v != null && __v !== false)
125
+ __el6.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
126
+ }
127
+ __el6.setAttribute("aria-label", "Previous page");
128
+ __attr(__el6, "disabled", () => __props.currentPage <= 1);
129
+ __on(__el6, "click", () => __props.onPageChange(__props.currentPage - 1));
130
+ __enterChildren(__el6);
131
+ __append(__el6, __child(() => __props.prevContent ?? "Previous"));
132
+ __exitChildren();
133
+ return __el6;
134
+ })());
135
+ __exitChildren();
136
+ return __el5;
137
+ })());
138
+ __insert(__el4, pageItems);
139
+ __append(__el4, (() => {
140
+ const __el7 = __element("li");
141
+ __attr(__el7, "class", () => cn(__props.classes?.item));
142
+ __enterChildren(__el7);
143
+ __append(__el7, (() => {
144
+ const __el8 = __element("button");
145
+ __el8.setAttribute("type", "button");
146
+ __attr(__el8, "class", () => cn(__props.classes?.navButton));
147
+ {
148
+ const __v = { paddingLeft: "0.625rem", paddingRight: "0.375rem" };
149
+ if (__v != null && __v !== false)
150
+ __el8.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
151
+ }
152
+ __el8.setAttribute("aria-label", "Next page");
153
+ __attr(__el8, "disabled", () => __props.currentPage >= __props.totalPages);
154
+ __on(__el8, "click", () => __props.onPageChange(__props.currentPage + 1));
155
+ __enterChildren(__el8);
156
+ __append(__el8, __child(() => __props.nextContent ?? "Next"));
157
+ __exitChildren();
158
+ return __el8;
159
+ })());
160
+ __exitChildren();
161
+ return __el7;
162
+ })());
163
+ __exitChildren();
164
+ return __el4;
165
+ })());
166
+ __exitChildren();
167
+ return __el3;
168
+ })();
169
+ __flushMountFrame();
170
+ return __mfResult0;
171
+ } catch (__mfErr) {
172
+ __discardMountFrame(__mfDepth);
173
+ throw __mfErr;
174
+ }
175
+ }
176
+ var ComposedPagination = ComposedPaginationRoot;
177
+
178
+ export { ComposedPagination };