@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,177 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/carousel/carousel-composed.tsx
6
+ import { computed, signal } from "@vertz/ui";
7
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
8
+ import { createContext, useContext } from "@vertz/ui";
9
+ var CarouselContext = createContext(undefined, "@vertz/ui-primitives::CarouselContext");
10
+ function CarouselSlide(__props) {
11
+ const __mfDepth = __pushMountFrame();
12
+ try {
13
+ const ctx = useContext(CarouselContext);
14
+ if (!ctx) {
15
+ throw new Error("<Carousel.Slide> must be used inside <Carousel>. " + "Ensure it is a direct or nested child of the Carousel root component.");
16
+ }
17
+ const index = computed(() => ctx.registerSlide());
18
+ const __mfResult0 = (() => {
19
+ const __el0 = __element("div");
20
+ __el0.setAttribute("role", "group");
21
+ __el0.setAttribute("aria-roledescription", "slide");
22
+ __el0.setAttribute("data-carousel-slide", "");
23
+ __attr(__el0, "aria-hidden", () => String(index.value !== ctx.currentIndex));
24
+ __attr(__el0, "aria-label", () => `Slide ${index.value + 1} of ${ctx.getSlideCount()}`);
25
+ __attr(__el0, "data-state", () => index.value === ctx.currentIndex ? "active" : "inactive");
26
+ __attr(__el0, "class", () => cn(ctx.classes?.slide, __props.className ?? __props.class));
27
+ __enterChildren(__el0);
28
+ __append(__el0, __child(() => __props.children));
29
+ __exitChildren();
30
+ return __el0;
31
+ })();
32
+ __flushMountFrame();
33
+ return __mfResult0;
34
+ } catch (__mfErr) {
35
+ __discardMountFrame(__mfDepth);
36
+ throw __mfErr;
37
+ }
38
+ }
39
+ function CarouselPrevious(__props) {
40
+ const __mfDepth = __pushMountFrame();
41
+ try {
42
+ const ctx = useContext(CarouselContext);
43
+ if (!ctx) {
44
+ throw new Error("<Carousel.Previous> must be used inside <Carousel>. " + "Ensure it is a direct or nested child of the Carousel root component.");
45
+ }
46
+ const __mfResult0 = (() => {
47
+ const __el0 = __element("button");
48
+ __el0.setAttribute("type", "button");
49
+ __el0.setAttribute("aria-label", "Previous slide");
50
+ __el0.setAttribute("data-carousel-prev", "");
51
+ __attr(__el0, "disabled", () => !ctx.loop && ctx.currentIndex <= 0);
52
+ __attr(__el0, "class", () => cn(ctx.classes?.prevButton));
53
+ __enterChildren(__el0);
54
+ __append(__el0, __child(() => __props.children ?? "‹"));
55
+ __exitChildren();
56
+ return __el0;
57
+ })();
58
+ __flushMountFrame();
59
+ return __mfResult0;
60
+ } catch (__mfErr) {
61
+ __discardMountFrame(__mfDepth);
62
+ throw __mfErr;
63
+ }
64
+ }
65
+ function CarouselNext(__props) {
66
+ const __mfDepth = __pushMountFrame();
67
+ try {
68
+ const ctx = useContext(CarouselContext);
69
+ if (!ctx) {
70
+ throw new Error("<Carousel.Next> must be used inside <Carousel>. " + "Ensure it is a direct or nested child of the Carousel root component.");
71
+ }
72
+ const __mfResult0 = (() => {
73
+ const __el0 = __element("button");
74
+ __el0.setAttribute("type", "button");
75
+ __el0.setAttribute("aria-label", "Next slide");
76
+ __el0.setAttribute("data-carousel-next", "");
77
+ __attr(__el0, "disabled", () => !ctx.loop && ctx.currentIndex >= ctx.getSlideCount() - 1);
78
+ __attr(__el0, "class", () => cn(ctx.classes?.nextButton));
79
+ __enterChildren(__el0);
80
+ __append(__el0, __child(() => __props.children ?? "›"));
81
+ __exitChildren();
82
+ return __el0;
83
+ })();
84
+ __flushMountFrame();
85
+ return __mfResult0;
86
+ } catch (__mfErr) {
87
+ __discardMountFrame(__mfDepth);
88
+ throw __mfErr;
89
+ }
90
+ }
91
+ function ComposedCarouselRoot(__props) {
92
+ const __mfDepth = __pushMountFrame();
93
+ try {
94
+ let registerSlide = function() {
95
+ const idx = _reg.nextIdx++;
96
+ slideCount.value = _reg.nextIdx;
97
+ return idx;
98
+ }, goTo = function(index) {
99
+ const count = _reg.nextIdx;
100
+ if (count === 0)
101
+ return;
102
+ let next = index;
103
+ if (__props.loop ?? false) {
104
+ next = (index % count + count) % count;
105
+ } else {
106
+ next = Math.max(0, Math.min(count - 1, index));
107
+ }
108
+ if (next === currentIndex.value)
109
+ return;
110
+ currentIndex.value = next;
111
+ __props.onSlideChange?.(next);
112
+ }, handleClick = function(e) {
113
+ const target = e.target;
114
+ if (target.closest("[data-carousel-prev]"))
115
+ goTo(currentIndex.value - 1);
116
+ if (target.closest("[data-carousel-next]"))
117
+ goTo(currentIndex.value + 1);
118
+ }, handleKeydown = function(e) {
119
+ const prevKey = (__props.orientation ?? "horizontal") === "horizontal" ? "ArrowLeft" : "ArrowUp";
120
+ const nextKey = (__props.orientation ?? "horizontal") === "horizontal" ? "ArrowRight" : "ArrowDown";
121
+ if (e.key === prevKey) {
122
+ e.preventDefault();
123
+ goTo(currentIndex.value - 1);
124
+ }
125
+ if (e.key === nextKey) {
126
+ e.preventDefault();
127
+ goTo(currentIndex.value + 1);
128
+ }
129
+ };
130
+ const currentIndex = signal(__props.defaultIndex ?? 0, "currentIndex");
131
+ const _reg = { nextIdx: 0 };
132
+ const slideCount = signal(0, "slideCount");
133
+ const ctx = {
134
+ registerSlide,
135
+ currentIndex,
136
+ getSlideCount: () => slideCount.value,
137
+ loop: __props.loop ?? false,
138
+ classes: __props.classes
139
+ };
140
+ const __mfResult0 = CarouselContext.Provider({ get value() {
141
+ return ctx;
142
+ }, children: () => (() => {
143
+ const __el0 = __element("div");
144
+ __el0.setAttribute("role", "region");
145
+ __el0.setAttribute("aria-roledescription", "carousel");
146
+ __el0.setAttribute("data-carousel-root", "");
147
+ __attr(__el0, "data-orientation", () => __props.orientation ?? "horizontal");
148
+ __attr(__el0, "class", () => cn(__props.classes?.root));
149
+ __on(__el0, "click", handleClick);
150
+ __on(__el0, "keydown", handleKeydown);
151
+ __enterChildren(__el0);
152
+ __append(__el0, (() => {
153
+ const __el1 = __element("div");
154
+ __el1.setAttribute("data-carousel-viewport", "");
155
+ __attr(__el1, "class", () => cn(__props.classes?.viewport));
156
+ __enterChildren(__el1);
157
+ __append(__el1, __child(() => __props.children));
158
+ __exitChildren();
159
+ return __el1;
160
+ })());
161
+ __exitChildren();
162
+ return __el0;
163
+ })() });
164
+ __flushMountFrame();
165
+ return __mfResult0;
166
+ } catch (__mfErr) {
167
+ __discardMountFrame(__mfDepth);
168
+ throw __mfErr;
169
+ }
170
+ }
171
+ var ComposedCarousel = Object.assign(ComposedCarouselRoot, {
172
+ Slide: CarouselSlide,
173
+ Previous: CarouselPrevious,
174
+ Next: CarouselNext
175
+ });
176
+
177
+ export { ComposedCarousel };
@@ -0,0 +1,410 @@
1
+ import {
2
+ applyAttrs
3
+ } from "./chunk-2db2dnp3.js";
4
+
5
+ // src/calendar/calendar.tsx
6
+ import { __append, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __list, __on, __pushMountFrame } from "@vertz/ui/internals";
7
+ import { signal } from "@vertz/ui";
8
+ var MONTH_NAMES = [
9
+ "January",
10
+ "February",
11
+ "March",
12
+ "April",
13
+ "May",
14
+ "June",
15
+ "July",
16
+ "August",
17
+ "September",
18
+ "October",
19
+ "November",
20
+ "December"
21
+ ];
22
+ var DAY_NAMES = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
23
+ function getDaysInMonth(year, month) {
24
+ return new Date(year, month + 1, 0).getDate();
25
+ }
26
+ function isSameDay(a, b) {
27
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
28
+ }
29
+ function addDays(date, days) {
30
+ const result = new Date(date);
31
+ result.setDate(result.getDate() + days);
32
+ return result;
33
+ }
34
+ function addMonths(date, months) {
35
+ const result = new Date(date);
36
+ result.setMonth(result.getMonth() + months);
37
+ return result;
38
+ }
39
+ function CalendarTitleEl() {
40
+ const __mfDepth = __pushMountFrame();
41
+ try {
42
+ const __mfResult0 = (() => {
43
+ const __el0 = __element("div");
44
+ return __el0;
45
+ })();
46
+ __flushMountFrame();
47
+ return __mfResult0;
48
+ } catch (__mfErr) {
49
+ __discardMountFrame(__mfDepth);
50
+ throw __mfErr;
51
+ }
52
+ }
53
+ function CalendarNavButton(onClick) {
54
+ const __mfDepth = __pushMountFrame();
55
+ try {
56
+ const __mfResult0 = (() => {
57
+ const __el0 = __element("button");
58
+ __el0.setAttribute("type", "button");
59
+ __on(__el0, "click", onClick);
60
+ return __el0;
61
+ })();
62
+ __flushMountFrame();
63
+ return __mfResult0;
64
+ } catch (__mfErr) {
65
+ __discardMountFrame(__mfDepth);
66
+ throw __mfErr;
67
+ }
68
+ }
69
+ function CalendarHeaderEl(prevButton, title, nextButton) {
70
+ const __mfDepth = __pushMountFrame();
71
+ try {
72
+ const __mfResult0 = (() => {
73
+ const __el0 = __element("div");
74
+ __enterChildren(__el0);
75
+ __insert(__el0, prevButton);
76
+ __insert(__el0, title);
77
+ __insert(__el0, nextButton);
78
+ __exitChildren();
79
+ return __el0;
80
+ })();
81
+ __flushMountFrame();
82
+ return __mfResult0;
83
+ } catch (__mfErr) {
84
+ __discardMountFrame(__mfDepth);
85
+ throw __mfErr;
86
+ }
87
+ }
88
+ function CalendarGridEl(onKeydown) {
89
+ const __mfDepth = __pushMountFrame();
90
+ try {
91
+ const __mfResult0 = (() => {
92
+ const __el0 = __element("table");
93
+ __el0.setAttribute("role", "grid");
94
+ __on(__el0, "keydown", onKeydown);
95
+ return __el0;
96
+ })();
97
+ __flushMountFrame();
98
+ return __mfResult0;
99
+ } catch (__mfErr) {
100
+ __discardMountFrame(__mfDepth);
101
+ throw __mfErr;
102
+ }
103
+ }
104
+ function CalendarRootEl(header, grid) {
105
+ const __mfDepth = __pushMountFrame();
106
+ try {
107
+ const __mfResult0 = (() => {
108
+ const __el0 = __element("div");
109
+ __enterChildren(__el0);
110
+ __insert(__el0, header);
111
+ __insert(__el0, grid);
112
+ __exitChildren();
113
+ return __el0;
114
+ })();
115
+ __flushMountFrame();
116
+ return __mfResult0;
117
+ } catch (__mfErr) {
118
+ __discardMountFrame(__mfDepth);
119
+ throw __mfErr;
120
+ }
121
+ }
122
+ function CalendarRoot(options = {}) {
123
+ const __mfDepth = __pushMountFrame();
124
+ try {
125
+ let updateTitle = function() {
126
+ const month = state.displayMonth.peek();
127
+ title.textContent = `${MONTH_NAMES[month.getMonth()]} ${month.getFullYear()}`;
128
+ }, isDateDisabled = function(date) {
129
+ if (disabled?.(date))
130
+ return true;
131
+ if (minDate && date < minDate && !isSameDay(date, minDate)) {
132
+ return true;
133
+ }
134
+ if (maxDate && date > maxDate && !isSameDay(date, maxDate)) {
135
+ return true;
136
+ }
137
+ return false;
138
+ }, isSelected = function(date) {
139
+ const val = state.value.peek();
140
+ if (val === null)
141
+ return false;
142
+ if (val instanceof Date)
143
+ return isSameDay(val, date);
144
+ if (Array.isArray(val))
145
+ return val.some((d) => isSameDay(d, date));
146
+ if ("from" in val && "to" in val) {
147
+ return isSameDay(val.from, date) || isSameDay(val.to, date);
148
+ }
149
+ return false;
150
+ }, isInRange = function(date) {
151
+ const val = state.value.peek();
152
+ if (val === null || !("from" in val))
153
+ return false;
154
+ const range = val;
155
+ return date > range.from && date < range.to;
156
+ }, selectDate = function(date) {
157
+ if (isDateDisabled(date))
158
+ return;
159
+ if (mode === "single") {
160
+ state.value.value = date;
161
+ } else if (mode === "multiple") {
162
+ const current = state.value.peek() ?? [];
163
+ const existing = current.findIndex((d) => isSameDay(d, date));
164
+ if (existing >= 0) {
165
+ const next = [...current];
166
+ next.splice(existing, 1);
167
+ state.value.value = next;
168
+ } else {
169
+ state.value.value = [...current, date];
170
+ }
171
+ } else if (mode === "range") {
172
+ const current = state.value.peek();
173
+ if (!current || "to" in current && current.to) {
174
+ state.value.value = { from: date, to: date };
175
+ } else {
176
+ if (date < current.from) {
177
+ state.value.value = { from: date, to: current.from };
178
+ } else {
179
+ state.value.value = { from: current.from, to: date };
180
+ }
181
+ }
182
+ }
183
+ onValueChange?.(state.value.peek());
184
+ }, computeGridRows = function(year, month) {
185
+ const daysInMonth = getDaysInMonth(year, month);
186
+ const firstDay = new Date(year, month, 1);
187
+ const firstDayOfWeek = firstDay.getDay();
188
+ const offset = (firstDayOfWeek - weekStartsOn + 7) % 7;
189
+ const startDate = addDays(firstDay, -offset);
190
+ const totalCells = offset + daysInMonth;
191
+ const totalRows = Math.ceil(totalCells / 7);
192
+ const rows = [];
193
+ let current = startDate;
194
+ for (let row = 0;row < totalRows; row++) {
195
+ const rowDates = [];
196
+ for (let col = 0;col < 7; col++) {
197
+ rowDates.push(new Date(current));
198
+ current = addDays(current, 1);
199
+ }
200
+ rows.push(rowDates);
201
+ }
202
+ return rows;
203
+ }, buildDayButton = function(cellDate, month) {
204
+ const dateStr = cellDate.toISOString().split("T")[0] ?? "";
205
+ const isOutside = cellDate.getMonth() !== month;
206
+ const rangeVal = mode === "range" ? state.value.peek() : null;
207
+ return (() => {
208
+ const __el0 = __element("button");
209
+ __el0.setAttribute("type", "button");
210
+ {
211
+ const __v = dateStr;
212
+ if (__v != null && __v !== false)
213
+ __el0.setAttribute("data-date", __v === true ? "" : __v);
214
+ }
215
+ {
216
+ const __v = isOutside ? "true" : undefined;
217
+ if (__v != null && __v !== false)
218
+ __el0.setAttribute("data-outside-month", __v === true ? "" : __v);
219
+ }
220
+ {
221
+ const __v = isSameDay(cellDate, now) ? "true" : undefined;
222
+ if (__v != null && __v !== false)
223
+ __el0.setAttribute("data-today", __v === true ? "" : __v);
224
+ }
225
+ {
226
+ const __v = isDateDisabled(cellDate) ? "true" : undefined;
227
+ if (__v != null && __v !== false)
228
+ __el0.setAttribute("aria-disabled", __v === true ? "" : __v);
229
+ }
230
+ {
231
+ const __v = isSelected(cellDate) ? "true" : undefined;
232
+ if (__v != null && __v !== false)
233
+ __el0.setAttribute("aria-selected", __v === true ? "" : __v);
234
+ }
235
+ {
236
+ const __v = rangeVal && "from" in rangeVal && isSameDay(cellDate, rangeVal.from) ? "true" : undefined;
237
+ if (__v != null && __v !== false)
238
+ __el0.setAttribute("data-range-start", __v === true ? "" : __v);
239
+ }
240
+ {
241
+ const __v = rangeVal && "to" in rangeVal && isSameDay(cellDate, rangeVal.to) ? "true" : undefined;
242
+ if (__v != null && __v !== false)
243
+ __el0.setAttribute("data-range-end", __v === true ? "" : __v);
244
+ }
245
+ {
246
+ const __v = rangeVal && isInRange(cellDate) ? "true" : undefined;
247
+ if (__v != null && __v !== false)
248
+ __el0.setAttribute("data-in-range", __v === true ? "" : __v);
249
+ }
250
+ __on(__el0, "click", () => {
251
+ selectDate(cellDate);
252
+ rebuildGrid();
253
+ });
254
+ __enterChildren(__el0);
255
+ __insert(__el0, cellDate.getDate());
256
+ __exitChildren();
257
+ return __el0;
258
+ })();
259
+ }, buildGrid = function() {
260
+ const display = state.displayMonth.peek();
261
+ const year = display.getFullYear();
262
+ const month = display.getMonth();
263
+ const rows = computeGridRows(year, month);
264
+ const thead = (() => {
265
+ const __el1 = __element("thead");
266
+ __enterChildren(__el1);
267
+ __append(__el1, (() => {
268
+ const __el2 = __element("tr");
269
+ __enterChildren(__el2);
270
+ __insert(__el2, Array.from({ length: 7 }, (_, i) => {
271
+ const dayIndex = (weekStartsOn + i) % 7;
272
+ return (() => {
273
+ const __el3 = __element("th");
274
+ __el3.setAttribute("scope", "col");
275
+ __enterChildren(__el3);
276
+ __insert(__el3, DAY_NAMES[dayIndex] ?? "");
277
+ __exitChildren();
278
+ return __el3;
279
+ })();
280
+ }));
281
+ __exitChildren();
282
+ return __el2;
283
+ })());
284
+ __exitChildren();
285
+ return __el1;
286
+ })();
287
+ const tbody = (() => {
288
+ const __el4 = __element("tbody");
289
+ __enterChildren(__el4);
290
+ __list(__el4, () => rows, null, (rowDates) => (() => {
291
+ const __el5 = __element("tr");
292
+ __enterChildren(__el5);
293
+ __list(__el5, () => rowDates, null, (cellDate) => (() => {
294
+ const __el6 = __element("td");
295
+ __el6.setAttribute("role", "gridcell");
296
+ __enterChildren(__el6);
297
+ __insert(__el6, buildDayButton(cellDate, month));
298
+ __exitChildren();
299
+ return __el6;
300
+ })());
301
+ __exitChildren();
302
+ return __el5;
303
+ })());
304
+ __exitChildren();
305
+ return __el4;
306
+ })();
307
+ grid.replaceChildren(thead, tbody);
308
+ }, rebuildGrid = function() {
309
+ updateTitle();
310
+ buildGrid();
311
+ }, navigateMonth = function(delta) {
312
+ state.displayMonth.value = addMonths(state.displayMonth.peek(), delta);
313
+ onMonthChange?.(state.displayMonth.peek());
314
+ rebuildGrid();
315
+ }, destroy = function() {};
316
+ const {
317
+ mode: modeOpt,
318
+ defaultValue,
319
+ defaultMonth: defaultMonthOpt,
320
+ minDate,
321
+ maxDate,
322
+ disabled,
323
+ weekStartsOn: weekStartsOnOpt,
324
+ onValueChange,
325
+ onMonthChange,
326
+ ...attrs
327
+ } = options;
328
+ const now = new Date;
329
+ const defaultMonth = defaultMonthOpt ?? now;
330
+ const weekStartsOn = weekStartsOnOpt ?? 0;
331
+ const mode = modeOpt ?? "single";
332
+ const state = {
333
+ value: signal(defaultValue ?? null),
334
+ focusedDate: signal(defaultMonth),
335
+ displayMonth: signal(defaultMonth)
336
+ };
337
+ const title = CalendarTitleEl();
338
+ const prevButton = CalendarNavButton(() => navigateMonth(-1));
339
+ const nextButton = CalendarNavButton(() => navigateMonth(1));
340
+ const header = CalendarHeaderEl(prevButton, title, nextButton);
341
+ const grid = CalendarGridEl((event) => {
342
+ const active = document.activeElement;
343
+ if (!active || active.tagName !== "BUTTON")
344
+ return;
345
+ const dateStr = active.getAttribute("data-date");
346
+ if (!dateStr)
347
+ return;
348
+ const focused = new Date(`${dateStr}T00:00:00`);
349
+ let next = null;
350
+ if (event.key === "ArrowLeft") {
351
+ event.preventDefault();
352
+ next = addDays(focused, -1);
353
+ } else if (event.key === "ArrowRight") {
354
+ event.preventDefault();
355
+ next = addDays(focused, 1);
356
+ } else if (event.key === "ArrowUp") {
357
+ event.preventDefault();
358
+ next = addDays(focused, -7);
359
+ } else if (event.key === "ArrowDown") {
360
+ event.preventDefault();
361
+ next = addDays(focused, 7);
362
+ } else if (event.key === "Home") {
363
+ event.preventDefault();
364
+ const dayOfWeek = (focused.getDay() - weekStartsOn + 7) % 7;
365
+ next = addDays(focused, -dayOfWeek);
366
+ } else if (event.key === "End") {
367
+ event.preventDefault();
368
+ const dayOfWeek = (focused.getDay() - weekStartsOn + 7) % 7;
369
+ next = addDays(focused, 6 - dayOfWeek);
370
+ } else if (event.key === "PageUp") {
371
+ event.preventDefault();
372
+ next = event.shiftKey ? addMonths(focused, -12) : addMonths(focused, -1);
373
+ } else if (event.key === "PageDown") {
374
+ event.preventDefault();
375
+ next = event.shiftKey ? addMonths(focused, 12) : addMonths(focused, 1);
376
+ } else if (event.key === "Enter" || event.key === " ") {
377
+ event.preventDefault();
378
+ selectDate(focused);
379
+ rebuildGrid();
380
+ return;
381
+ }
382
+ if (next) {
383
+ state.focusedDate.value = next;
384
+ if (next.getMonth() !== state.displayMonth.peek().getMonth() || next.getFullYear() !== state.displayMonth.peek().getFullYear()) {
385
+ state.displayMonth.value = new Date(next.getFullYear(), next.getMonth(), 1);
386
+ onMonthChange?.(state.displayMonth.peek());
387
+ rebuildGrid();
388
+ }
389
+ const dateKey = next.toISOString().split("T")[0];
390
+ const btn = grid.querySelector(`button[data-date="${dateKey}"]`);
391
+ btn?.focus();
392
+ }
393
+ });
394
+ updateTitle();
395
+ buildGrid();
396
+ const root = CalendarRootEl(header, grid);
397
+ applyAttrs(root, attrs);
398
+ const __mfResult0 = { root, header, title, prevButton, nextButton, grid, state, destroy };
399
+ __flushMountFrame();
400
+ return __mfResult0;
401
+ } catch (__mfErr) {
402
+ __discardMountFrame(__mfDepth);
403
+ throw __mfErr;
404
+ }
405
+ }
406
+ var Calendar = {
407
+ Root: CalendarRoot
408
+ };
409
+
410
+ export { Calendar };