@vertz/ui-primitives 0.2.23 → 0.2.25

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 (191) hide show
  1. package/dist/shared/{chunk-pzx0vpq1.js → chunk-00fqgnq1.js} +6 -11
  2. package/dist/shared/chunk-1dx23qnr.js +232 -0
  3. package/dist/shared/chunk-1hm0mbke.js +258 -0
  4. package/dist/shared/{chunk-ww7k2azn.js → chunk-20kwns82.js} +5 -9
  5. package/dist/shared/chunk-3jack97k.js +509 -0
  6. package/dist/shared/{chunk-xs6gp369.js → chunk-455p0jbk.js} +3 -7
  7. package/dist/shared/chunk-4z006v1j.js +467 -0
  8. package/dist/shared/{chunk-b25npqer.js → chunk-585ysr70.js} +1 -1
  9. package/dist/shared/chunk-5964gmv0.js +416 -0
  10. package/dist/shared/chunk-75pegjs7.js +26 -0
  11. package/dist/shared/{chunk-mr1tb0dp.js → chunk-7a2nqmeh.js} +1 -1
  12. package/dist/shared/chunk-7wem1bhb.js +252 -0
  13. package/dist/shared/{chunk-7cb3z0s8.js → chunk-8evj43jn.js} +5 -8
  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-9eedsnnk.js +164 -0
  18. package/dist/shared/{chunk-8c01c8mb.js → chunk-9hv3vc72.js} +0 -2
  19. package/dist/shared/{chunk-4894pmy6.js → chunk-9ydd4pn3.js} +6 -1
  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-bc2qqkhr.js +194 -0
  24. package/dist/shared/chunk-brk0drrk.js +202 -0
  25. package/dist/shared/chunk-czv0kqj4.js +107 -0
  26. package/dist/shared/chunk-d83ag07h.js +189 -0
  27. package/dist/shared/{chunk-3kwh27dv.js → chunk-de18ashk.js} +0 -1
  28. package/dist/shared/{chunk-cgb2j94g.js → chunk-dvk4h36t.js} +0 -1
  29. package/dist/shared/chunk-e6660g7e.js +179 -0
  30. package/dist/shared/{chunk-3h1mxp95.js → chunk-eq4d9b0w.js} +0 -1
  31. package/dist/shared/chunk-ev367pq3.js +102 -0
  32. package/dist/shared/chunk-fjykbv0v.js +214 -0
  33. package/dist/shared/chunk-ghkw5bjq.js +55 -0
  34. package/dist/shared/chunk-gqb1n1hj.js +60 -0
  35. package/dist/shared/chunk-hfjtkytb.js +310 -0
  36. package/dist/shared/chunk-hpvjfj0j.js +31 -0
  37. package/dist/shared/chunk-hxmxvp56.js +67 -0
  38. package/dist/shared/chunk-j9m2f0rd.js +162 -0
  39. package/dist/shared/chunk-jpyjk616.js +52 -0
  40. package/dist/shared/{chunk-ttb2tt03.js → chunk-jsa3byag.js} +1 -1
  41. package/dist/shared/{chunk-9gfp3ffv.js → chunk-jzy1bkdk.js} +0 -1
  42. package/dist/shared/{chunk-f2vx4tpw.js → chunk-knzg86am.js} +5 -5
  43. package/dist/shared/chunk-metxdt5x.js +28 -0
  44. package/dist/shared/chunk-mhn2aazf.js +353 -0
  45. package/dist/shared/chunk-mtx2cfbx.js +175 -0
  46. package/dist/shared/chunk-nsmvdxgp.js +213 -0
  47. package/dist/shared/{chunk-pn6shbcs.js → chunk-pdzmg245.js} +1 -5
  48. package/dist/shared/chunk-pzknpa1y.js +327 -0
  49. package/dist/shared/chunk-q1ff3xp3.js +95 -0
  50. package/dist/shared/chunk-q7xbcj9q.js +7 -0
  51. package/dist/shared/{chunk-p0x7hgv6.js → chunk-qhnany7w.js} +0 -2
  52. package/dist/shared/chunk-qrm43tr3.js +357 -0
  53. package/dist/shared/{chunk-xa1b96mb.js → chunk-qsp7sfhp.js} +2 -2
  54. package/dist/shared/{chunk-j902w020.js → chunk-qwqnjjg8.js} +1 -1
  55. package/dist/shared/{chunk-h3v10x04.js → chunk-r0rz7z03.js} +6 -11
  56. package/dist/shared/chunk-r3ngaa64.js +418 -0
  57. package/dist/shared/chunk-r3pffzss.js +13 -0
  58. package/dist/shared/chunk-rrt62bp0.js +353 -0
  59. package/dist/shared/chunk-s24gkmna.js +131 -0
  60. package/dist/shared/chunk-s62e7jf4.js +30 -0
  61. package/dist/shared/chunk-spng4yb9.js +73 -0
  62. package/dist/shared/chunk-v0b5pkcq.js +30 -0
  63. package/dist/shared/chunk-v11kd39k.js +162 -0
  64. package/dist/shared/{chunk-0mcr52hc.js → chunk-vef3sepw.js} +17 -1
  65. package/dist/shared/chunk-vkscwzpr.js +294 -0
  66. package/dist/shared/chunk-vv187snj.js +112 -0
  67. package/dist/shared/chunk-wqsek87j.js +311 -0
  68. package/dist/shared/chunk-wtkxz2te.js +157 -0
  69. package/dist/shared/chunk-y1hpsqzy.js +185 -0
  70. package/dist/shared/chunk-yfzddvxc.js +71 -0
  71. package/dist/src/accordion/accordion-composed.d.ts +30 -0
  72. package/dist/src/accordion/accordion-composed.js +6 -0
  73. package/dist/src/accordion/accordion.js +1 -1
  74. package/dist/src/alert/alert-composed.d.ts +26 -0
  75. package/dist/src/alert/alert-composed.js +6 -0
  76. package/dist/src/alert-dialog/alert-dialog-composed.d.ts +40 -0
  77. package/dist/src/alert-dialog/alert-dialog-composed.js +6 -0
  78. package/dist/src/avatar/avatar-composed.d.ts +33 -0
  79. package/dist/src/avatar/avatar-composed.js +6 -0
  80. package/dist/src/badge/badge-composed.d.ts +33 -0
  81. package/dist/src/badge/badge-composed.js +6 -0
  82. package/dist/src/breadcrumb/breadcrumb-composed.d.ts +34 -0
  83. package/dist/src/breadcrumb/breadcrumb-composed.js +6 -0
  84. package/dist/src/button/button-composed.d.ts +34 -0
  85. package/dist/src/button/button-composed.js +6 -0
  86. package/dist/src/calendar/calendar-composed.d.ts +42 -0
  87. package/dist/src/calendar/calendar-composed.js +6 -0
  88. package/dist/src/calendar/calendar.js +1 -1
  89. package/dist/src/card/card-composed.d.ts +34 -0
  90. package/dist/src/card/card-composed.js +6 -0
  91. package/dist/src/carousel/carousel-composed.d.ts +32 -0
  92. package/dist/src/carousel/carousel-composed.js +6 -0
  93. package/dist/src/carousel/carousel.js +1 -1
  94. package/dist/src/checkbox/checkbox-composed.d.ts +18 -0
  95. package/dist/src/checkbox/checkbox-composed.js +6 -0
  96. package/dist/src/collapsible/collapsible-composed.d.ts +26 -0
  97. package/dist/src/collapsible/collapsible-composed.js +6 -0
  98. package/dist/src/combobox/combobox-composed.d.ts +30 -0
  99. package/dist/src/combobox/combobox-composed.js +6 -0
  100. package/dist/src/combobox/combobox.js +1 -1
  101. package/dist/src/command/command-composed.d.ts +67 -0
  102. package/dist/src/command/command-composed.js +6 -0
  103. package/dist/src/command/command.js +1 -1
  104. package/dist/src/composed/with-styles.d.ts +38 -0
  105. package/dist/src/composed/with-styles.js +6 -0
  106. package/dist/src/context-menu/context-menu-composed.d.ts +51 -0
  107. package/dist/src/context-menu/context-menu-composed.js +6 -0
  108. package/dist/src/context-menu/context-menu.js +1 -1
  109. package/dist/src/date-picker/date-picker-composed.d.ts +77 -0
  110. package/dist/src/date-picker/date-picker-composed.js +6 -0
  111. package/dist/src/date-picker/date-picker.js +1 -1
  112. package/dist/src/dialog/dialog-composed.d.ts +36 -0
  113. package/dist/src/dialog/dialog-composed.js +6 -0
  114. package/dist/src/dialog/dialog-stack-parts.d.ts +16 -0
  115. package/dist/src/dialog/dialog-stack-parts.js +18 -0
  116. package/dist/src/dropdown-menu/dropdown-menu-composed.d.ts +51 -0
  117. package/dist/src/dropdown-menu/dropdown-menu-composed.js +6 -0
  118. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  119. package/dist/src/empty-state/empty-state-composed.d.ts +30 -0
  120. package/dist/src/empty-state/empty-state-composed.js +6 -0
  121. package/dist/src/form-group/form-group-composed.d.ts +24 -0
  122. package/dist/src/form-group/form-group-composed.js +6 -0
  123. package/dist/src/hover-card/hover-card-composed.d.ts +38 -0
  124. package/dist/src/hover-card/hover-card-composed.js +6 -0
  125. package/dist/src/hover-card/hover-card.js +1 -1
  126. package/dist/src/index.d.ts +1312 -812
  127. package/dist/src/index.js +79 -6566
  128. package/dist/src/input/input-composed.d.ts +35 -0
  129. package/dist/src/input/input-composed.js +6 -0
  130. package/dist/src/label/label-composed.d.ts +32 -0
  131. package/dist/src/label/label-composed.js +6 -0
  132. package/dist/src/list/list-composed.d.ts +34 -0
  133. package/dist/src/list/list-composed.js +6 -0
  134. package/dist/src/menu/menu-composed.d.ts +51 -0
  135. package/dist/src/menu/menu-composed.js +6 -0
  136. package/dist/src/menu/menu.js +1 -1
  137. package/dist/src/menubar/menubar-composed.d.ts +56 -0
  138. package/dist/src/menubar/menubar-composed.js +6 -0
  139. package/dist/src/menubar/menubar.js +1 -1
  140. package/dist/src/navigation-menu/navigation-menu-composed.d.ts +56 -0
  141. package/dist/src/navigation-menu/navigation-menu-composed.js +6 -0
  142. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  143. package/dist/src/pagination/pagination-composed.d.ts +30 -0
  144. package/dist/src/pagination/pagination-composed.js +6 -0
  145. package/dist/src/popover/popover-composed.d.ts +36 -0
  146. package/dist/src/popover/popover-composed.js +6 -0
  147. package/dist/src/popover/popover.js +1 -1
  148. package/dist/src/progress/progress-composed.d.ts +17 -0
  149. package/dist/src/progress/progress-composed.js +6 -0
  150. package/dist/src/radio/radio-composed.d.ts +24 -0
  151. package/dist/src/radio/radio-composed.js +6 -0
  152. package/dist/src/radio/radio.js +1 -1
  153. package/dist/src/resizable-panel/resizable-panel-composed.d.ts +33 -0
  154. package/dist/src/resizable-panel/resizable-panel-composed.js +6 -0
  155. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  156. package/dist/src/scroll-area/scroll-area-composed.d.ts +17 -0
  157. package/dist/src/scroll-area/scroll-area-composed.js +6 -0
  158. package/dist/src/scroll-area/scroll-area.js +1 -1
  159. package/dist/src/select/select-composed.d.ts +53 -0
  160. package/dist/src/select/select-composed.js +6 -0
  161. package/dist/src/select/select.js +1 -1
  162. package/dist/src/separator/separator-composed.d.ts +32 -0
  163. package/dist/src/separator/separator-composed.js +6 -0
  164. package/dist/src/sheet/sheet-composed.d.ts +34 -0
  165. package/dist/src/sheet/sheet-composed.js +6 -0
  166. package/dist/src/skeleton/skeleton-composed.d.ts +65 -0
  167. package/dist/src/skeleton/skeleton-composed.js +6 -0
  168. package/dist/src/slider/slider-composed.d.ts +22 -0
  169. package/dist/src/slider/slider-composed.js +6 -0
  170. package/dist/src/switch/switch-composed.d.ts +17 -0
  171. package/dist/src/switch/switch-composed.js +6 -0
  172. package/dist/src/table/table-composed.d.ts +34 -0
  173. package/dist/src/table/table-composed.js +6 -0
  174. package/dist/src/tabs/tabs-composed.d.ts +33 -0
  175. package/dist/src/tabs/tabs-composed.js +6 -0
  176. package/dist/src/tabs/tabs.js +1 -1
  177. package/dist/src/textarea/textarea-composed.d.ts +35 -0
  178. package/dist/src/textarea/textarea-composed.js +6 -0
  179. package/dist/src/toast/toast.js +1 -1
  180. package/dist/src/toggle/toggle-composed.d.ts +16 -0
  181. package/dist/src/toggle/toggle-composed.js +6 -0
  182. package/dist/src/toggle-group/toggle-group-composed.d.ts +24 -0
  183. package/dist/src/toggle-group/toggle-group-composed.js +6 -0
  184. package/dist/src/toggle-group/toggle-group.js +1 -1
  185. package/dist/src/tooltip/tooltip-composed.d.ts +36 -0
  186. package/dist/src/tooltip/tooltip-composed.js +6 -0
  187. package/dist/src/tooltip/tooltip.js +1 -1
  188. package/dist/src/utils.js +1 -1
  189. package/package.json +3 -3
  190. package/dist/shared/chunk-56reyd5r.js +0 -64
  191. package/dist/shared/chunk-mgr904ap.js +0 -370
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-a6wp8c32.js";
4
4
  import {
5
5
  createFloatingPosition
6
- } from "./chunk-0mcr52hc.js";
6
+ } from "./chunk-vef3sepw.js";
7
7
  import {
8
8
  Keys,
9
9
  handleListNavigation,
@@ -85,7 +85,7 @@ function SelectRoot(options = {}) {
85
85
  dismissCleanup?.();
86
86
  dismissCleanup = null;
87
87
  trigger.focus();
88
- }, createItem = function(value, label, parent) {
88
+ }, createItem = function(value, label) {
89
89
  const isSelectedItem = value === defaultValue;
90
90
  const item = (() => {
91
91
  const __el3 = __element("div");
@@ -116,7 +116,6 @@ function SelectRoot(options = {}) {
116
116
  triggerText.textContent = item.textContent ?? value;
117
117
  }
118
118
  items.push(item);
119
- (parent ?? content).appendChild(item);
120
119
  return item;
121
120
  }, Item = function(value, label) {
122
121
  return createItem(value, label);
@@ -131,19 +130,17 @@ function SelectRoot(options = {}) {
131
130
  }
132
131
  return __el4;
133
132
  })();
134
- content.appendChild(el);
135
133
  return {
136
134
  el,
137
- Item: (value, itemLabel) => createItem(value, itemLabel, el)
135
+ Item: (value, itemLabel) => createItem(value, itemLabel)
138
136
  };
139
137
  }, Separator = function() {
140
- const hr = (() => {
138
+ return (() => {
141
139
  const __el5 = __element("hr");
140
+ __el5.setAttribute("data-v-id", "SelectRoot");
142
141
  __el5.setAttribute("role", "separator");
143
142
  return __el5;
144
143
  })();
145
- content.appendChild(hr);
146
- return hr;
147
144
  };
148
145
  const { defaultValue = "", placeholder = "", onValueChange, positioning, ...attrs } = options;
149
146
  const ids = linkedIds("select");
@@ -0,0 +1,152 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/card/card-composed.tsx
6
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __pushMountFrame } from "@vertz/ui/internals";
7
+ import { createContext, useContext } from "@vertz/ui";
8
+ var CardContext = createContext(undefined, "@vertz/ui-primitives::CardContext");
9
+ function CardHeader(__props) {
10
+ const __mfDepth = __pushMountFrame();
11
+ try {
12
+ const ctx = useContext(CardContext);
13
+ const __mfResult0 = (() => {
14
+ const __el0 = __element("div");
15
+ __attr(__el0, "class", () => cn(ctx?.classes?.header, __props.className ?? __props.class));
16
+ __enterChildren(__el0);
17
+ __append(__el0, __child(() => __props.children));
18
+ __exitChildren();
19
+ return __el0;
20
+ })();
21
+ __flushMountFrame();
22
+ return __mfResult0;
23
+ } catch (__mfErr) {
24
+ __discardMountFrame(__mfDepth);
25
+ throw __mfErr;
26
+ }
27
+ }
28
+ function CardTitle(__props) {
29
+ const __mfDepth = __pushMountFrame();
30
+ try {
31
+ const ctx = useContext(CardContext);
32
+ const __mfResult0 = (() => {
33
+ const __el0 = __element("h3");
34
+ __attr(__el0, "class", () => cn(ctx?.classes?.title, __props.className ?? __props.class));
35
+ __enterChildren(__el0);
36
+ __append(__el0, __child(() => __props.children));
37
+ __exitChildren();
38
+ return __el0;
39
+ })();
40
+ __flushMountFrame();
41
+ return __mfResult0;
42
+ } catch (__mfErr) {
43
+ __discardMountFrame(__mfDepth);
44
+ throw __mfErr;
45
+ }
46
+ }
47
+ function CardDescription(__props) {
48
+ const __mfDepth = __pushMountFrame();
49
+ try {
50
+ const ctx = useContext(CardContext);
51
+ const __mfResult0 = (() => {
52
+ const __el0 = __element("p");
53
+ __attr(__el0, "class", () => cn(ctx?.classes?.description, __props.className ?? __props.class));
54
+ __enterChildren(__el0);
55
+ __append(__el0, __child(() => __props.children));
56
+ __exitChildren();
57
+ return __el0;
58
+ })();
59
+ __flushMountFrame();
60
+ return __mfResult0;
61
+ } catch (__mfErr) {
62
+ __discardMountFrame(__mfDepth);
63
+ throw __mfErr;
64
+ }
65
+ }
66
+ function CardContent(__props) {
67
+ const __mfDepth = __pushMountFrame();
68
+ try {
69
+ const ctx = useContext(CardContext);
70
+ const __mfResult0 = (() => {
71
+ const __el0 = __element("div");
72
+ __attr(__el0, "class", () => cn(ctx?.classes?.content, __props.className ?? __props.class));
73
+ __enterChildren(__el0);
74
+ __append(__el0, __child(() => __props.children));
75
+ __exitChildren();
76
+ return __el0;
77
+ })();
78
+ __flushMountFrame();
79
+ return __mfResult0;
80
+ } catch (__mfErr) {
81
+ __discardMountFrame(__mfDepth);
82
+ throw __mfErr;
83
+ }
84
+ }
85
+ function CardFooter(__props) {
86
+ const __mfDepth = __pushMountFrame();
87
+ try {
88
+ const ctx = useContext(CardContext);
89
+ const __mfResult0 = (() => {
90
+ const __el0 = __element("div");
91
+ __attr(__el0, "class", () => cn(ctx?.classes?.footer, __props.className ?? __props.class));
92
+ __enterChildren(__el0);
93
+ __append(__el0, __child(() => __props.children));
94
+ __exitChildren();
95
+ return __el0;
96
+ })();
97
+ __flushMountFrame();
98
+ return __mfResult0;
99
+ } catch (__mfErr) {
100
+ __discardMountFrame(__mfDepth);
101
+ throw __mfErr;
102
+ }
103
+ }
104
+ function CardAction(__props) {
105
+ const __mfDepth = __pushMountFrame();
106
+ try {
107
+ const ctx = useContext(CardContext);
108
+ const __mfResult0 = (() => {
109
+ const __el0 = __element("div");
110
+ __attr(__el0, "class", () => cn(ctx?.classes?.action, __props.className ?? __props.class));
111
+ __enterChildren(__el0);
112
+ __append(__el0, __child(() => __props.children));
113
+ __exitChildren();
114
+ return __el0;
115
+ })();
116
+ __flushMountFrame();
117
+ return __mfResult0;
118
+ } catch (__mfErr) {
119
+ __discardMountFrame(__mfDepth);
120
+ throw __mfErr;
121
+ }
122
+ }
123
+ function ComposedCardRoot(__props) {
124
+ const __mfDepth = __pushMountFrame();
125
+ try {
126
+ const __mfResult0 = CardContext.Provider({ get value() {
127
+ return { classes: __props.classes };
128
+ }, children: () => (() => {
129
+ const __el0 = __element("div");
130
+ __attr(__el0, "class", () => cn(__props.classes?.root, __props.className ?? __props.class));
131
+ __enterChildren(__el0);
132
+ __append(__el0, __child(() => __props.children));
133
+ __exitChildren();
134
+ return __el0;
135
+ })() });
136
+ __flushMountFrame();
137
+ return __mfResult0;
138
+ } catch (__mfErr) {
139
+ __discardMountFrame(__mfDepth);
140
+ throw __mfErr;
141
+ }
142
+ }
143
+ var ComposedCard = Object.assign(ComposedCardRoot, {
144
+ Header: CardHeader,
145
+ Title: CardTitle,
146
+ Description: CardDescription,
147
+ Content: CardContent,
148
+ Footer: CardFooter,
149
+ Action: CardAction
150
+ });
151
+
152
+ export { ComposedCard };
@@ -0,0 +1,28 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/separator/separator-composed.tsx
6
+ import { computed } from "@vertz/ui";
7
+ import { __attr, __discardMountFrame, __element, __flushMountFrame, __pushMountFrame } from "@vertz/ui/internals";
8
+ function ComposedSeparatorRoot(__props) {
9
+ const __mfDepth = __pushMountFrame();
10
+ try {
11
+ const orientationClass = computed(() => (__props.orientation ?? "horizontal") === "vertical" ? __props.classes?.vertical : __props.classes?.horizontal);
12
+ const __mfResult0 = (() => {
13
+ const __el0 = __element("hr");
14
+ __attr(__el0, "class", () => cn(__props.classes?.base, orientationClass.value, __props.className ?? __props.class));
15
+ __el0.setAttribute("role", "separator");
16
+ __attr(__el0, "aria-orientation", () => __props.orientation ?? "horizontal");
17
+ return __el0;
18
+ })();
19
+ __flushMountFrame();
20
+ return __mfResult0;
21
+ } catch (__mfErr) {
22
+ __discardMountFrame(__mfDepth);
23
+ throw __mfErr;
24
+ }
25
+ }
26
+ var ComposedSeparator = ComposedSeparatorRoot;
27
+
28
+ export { ComposedSeparator };
@@ -0,0 +1,398 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ createDismiss
6
+ } from "./chunk-a6wp8c32.js";
7
+ import {
8
+ createFloatingPosition
9
+ } from "./chunk-vef3sepw.js";
10
+ import {
11
+ Keys,
12
+ handleListNavigation,
13
+ isKey
14
+ } from "./chunk-7867pr13.js";
15
+ import {
16
+ setHiddenAnimated
17
+ } from "./chunk-vevfhpc9.js";
18
+ import {
19
+ linkedIds
20
+ } from "./chunk-8y1jf6xr.js";
21
+
22
+ // src/select/select-composed.tsx
23
+ import { computed, signal } from "@vertz/ui";
24
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
25
+ import { createContext, onMount, ref, useContext } from "@vertz/ui";
26
+ var SelectContext = createContext(undefined, "@vertz/ui-primitives::SelectContext");
27
+ function useSelectContext(componentName) {
28
+ const ctx = useContext(SelectContext);
29
+ if (!ctx) {
30
+ throw new Error(`<Select.${componentName}> must be used inside <Select>. ` + "Ensure it is a direct or nested child of the Select root component.");
31
+ }
32
+ return ctx;
33
+ }
34
+ function SelectTrigger(__props) {
35
+ const __mfDepth = __pushMountFrame();
36
+ try {
37
+ const ctx = useSelectContext("Trigger");
38
+ const displayText = computed(() => __props.children ?? (ctx.selectedValue() || ctx.placeholder || ""));
39
+ const __mfResult0 = (() => {
40
+ const __el0 = __element("button");
41
+ __el0.setAttribute("type", "button");
42
+ __el0.setAttribute("role", "combobox");
43
+ __el0.setAttribute("data-select-trigger", "");
44
+ {
45
+ const __v = ctx.contentId;
46
+ if (__v != null && __v !== false)
47
+ __el0.setAttribute("aria-controls", __v === true ? "" : __v);
48
+ }
49
+ __el0.setAttribute("aria-haspopup", "listbox");
50
+ __el0.setAttribute("aria-expanded", "false");
51
+ __el0.setAttribute("data-state", "closed");
52
+ __attr(__el0, "class", () => cn(ctx.classes?.trigger, __props.className ?? __props.class));
53
+ __on(__el0, "click", () => ctx.toggle());
54
+ __on(__el0, "keydown", (event) => {
55
+ if (isKey(event, Keys.ArrowDown, Keys.ArrowUp, Keys.Enter, Keys.Space)) {
56
+ event.preventDefault();
57
+ if (!ctx.isOpen())
58
+ ctx.open();
59
+ }
60
+ });
61
+ __enterChildren(__el0);
62
+ __append(__el0, (() => {
63
+ const __el1 = __element("span");
64
+ __el1.setAttribute("data-part", "text");
65
+ {
66
+ const __v = {
67
+ flex: 1,
68
+ textAlign: "start",
69
+ overflow: "hidden",
70
+ textOverflow: "ellipsis",
71
+ whiteSpace: "nowrap"
72
+ };
73
+ if (__v != null && __v !== false)
74
+ __el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
75
+ }
76
+ __enterChildren(__el1);
77
+ __append(__el1, __child(() => displayText.value));
78
+ __exitChildren();
79
+ return __el1;
80
+ })());
81
+ __append(__el0, (() => {
82
+ const __el2 = __element("span");
83
+ __el2.setAttribute("data-part", "chevron");
84
+ __enterChildren(__el2);
85
+ __append(__el2, (() => {
86
+ const __el3 = __element("svg");
87
+ __el3.setAttribute("xmlns", "http://www.w3.org/2000/svg");
88
+ __el3.setAttribute("width", "16");
89
+ __el3.setAttribute("height", "16");
90
+ __el3.setAttribute("viewBox", "0 0 24 24");
91
+ __el3.setAttribute("fill", "none");
92
+ __el3.setAttribute("stroke", "currentColor");
93
+ __el3.setAttribute("stroke-width", "2");
94
+ __el3.setAttribute("stroke-linecap", "round");
95
+ __el3.setAttribute("stroke-linejoin", "round");
96
+ __el3.setAttribute("aria-hidden", "true");
97
+ __enterChildren(__el3);
98
+ __append(__el3, (() => {
99
+ const __el4 = __element("path");
100
+ __el4.setAttribute("d", "m6 9 6 6 6-6");
101
+ return __el4;
102
+ })());
103
+ __exitChildren();
104
+ return __el3;
105
+ })());
106
+ __exitChildren();
107
+ return __el2;
108
+ })());
109
+ __exitChildren();
110
+ return __el0;
111
+ })();
112
+ __flushMountFrame();
113
+ return __mfResult0;
114
+ } catch (__mfErr) {
115
+ __discardMountFrame(__mfDepth);
116
+ throw __mfErr;
117
+ }
118
+ }
119
+ function SelectContent(__props) {
120
+ const __mfDepth = __pushMountFrame();
121
+ try {
122
+ const ctx = useSelectContext("Content");
123
+ const instanceIndex = ctx._contentCount.value++;
124
+ if (instanceIndex > 0) {
125
+ console.warn("Duplicate <Select.Content> detected – only the first is used");
126
+ }
127
+ onMount(() => {
128
+ const el = ctx.contentRef.current;
129
+ if (!el || el.__selectWired)
130
+ return;
131
+ el.__selectWired = true;
132
+ el.addEventListener("keydown", (event) => {
133
+ if (isKey(event, Keys.Escape)) {
134
+ event.preventDefault();
135
+ ctx.close();
136
+ return;
137
+ }
138
+ const items = [...el.querySelectorAll('[role="option"]')];
139
+ const focusedIdx = items.indexOf(document.activeElement);
140
+ if (isKey(event, Keys.Enter, Keys.Space)) {
141
+ event.preventDefault();
142
+ const active = items[focusedIdx];
143
+ if (active) {
144
+ const val = active.getAttribute("data-value");
145
+ if (val !== null)
146
+ ctx.selectItem(val);
147
+ }
148
+ return;
149
+ }
150
+ const result = handleListNavigation(event, items, { orientation: "vertical" });
151
+ if (result)
152
+ return;
153
+ if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
154
+ const char = event.key.toLowerCase();
155
+ const match = items.find((item) => item.textContent?.toLowerCase().startsWith(char));
156
+ if (match)
157
+ match.focus();
158
+ }
159
+ });
160
+ });
161
+ const __mfResult0 = (() => {
162
+ const __el0 = __element("div");
163
+ ctx.contentRef.current = __el0;
164
+ __el0.setAttribute("role", "listbox");
165
+ __el0.setAttribute("tabindex", "-1");
166
+ {
167
+ const __v = ctx.contentId;
168
+ if (__v != null && __v !== false)
169
+ __el0.setAttribute("id", __v === true ? "" : __v);
170
+ }
171
+ __el0.setAttribute("data-select-content", "");
172
+ __el0.setAttribute("aria-hidden", "true");
173
+ __el0.setAttribute("data-state", "closed");
174
+ {
175
+ const __v = { display: "none" };
176
+ if (__v != null && __v !== false)
177
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
178
+ }
179
+ __attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
180
+ __enterChildren(__el0);
181
+ __append(__el0, __child(() => __props.children));
182
+ __exitChildren();
183
+ return __el0;
184
+ })();
185
+ __flushMountFrame();
186
+ return __mfResult0;
187
+ } catch (__mfErr) {
188
+ __discardMountFrame(__mfDepth);
189
+ throw __mfErr;
190
+ }
191
+ }
192
+ function SelectItem(__props) {
193
+ const __mfDepth = __pushMountFrame();
194
+ try {
195
+ const ctx = useSelectContext("Item");
196
+ const isSelected = computed(() => ctx.selectedValue() === __props.value);
197
+ const __mfResult0 = (() => {
198
+ const __el0 = __element("div");
199
+ __el0.setAttribute("role", "option");
200
+ __attr(__el0, "data-value", () => __props.value);
201
+ __el0.setAttribute("tabindex", "-1");
202
+ __attr(__el0, "aria-selected", () => isSelected.value ? "true" : "false");
203
+ __attr(__el0, "data-state", () => isSelected.value ? "active" : "inactive");
204
+ __attr(__el0, "class", () => cn(ctx.classes?.item, __props.className ?? __props.class));
205
+ __on(__el0, "click", () => ctx.selectItem(__props.value));
206
+ __enterChildren(__el0);
207
+ __append(__el0, __child(() => __props.children ?? __props.value));
208
+ __append(__el0, (() => {
209
+ const __el1 = __element("span");
210
+ __el1.setAttribute("data-part", "indicator");
211
+ __attr(__el1, "style", () => ({ display: isSelected.value ? "" : "none" }));
212
+ {
213
+ const __v = cn(ctx.classes?.itemIndicator);
214
+ if (__v != null && __v !== false)
215
+ __el1.setAttribute("class", __v === true ? "" : __v);
216
+ }
217
+ return __el1;
218
+ })());
219
+ __exitChildren();
220
+ return __el0;
221
+ })();
222
+ __flushMountFrame();
223
+ return __mfResult0;
224
+ } catch (__mfErr) {
225
+ __discardMountFrame(__mfDepth);
226
+ throw __mfErr;
227
+ }
228
+ }
229
+ function SelectGroup(__props) {
230
+ const __mfDepth = __pushMountFrame();
231
+ try {
232
+ const ctx = useSelectContext("Group");
233
+ const __mfResult0 = (() => {
234
+ const __el0 = __element("div");
235
+ __el0.setAttribute("role", "group");
236
+ __attr(__el0, "aria-label", () => __props.label);
237
+ __attr(__el0, "class", () => cn(ctx.classes?.group, __props.className ?? __props.class));
238
+ __enterChildren(__el0);
239
+ __append(__el0, (() => {
240
+ const __el1 = __element("div");
241
+ __el1.setAttribute("data-part", "group-label");
242
+ __el1.setAttribute("role", "none");
243
+ __attr(__el1, "class", () => cn(ctx.classes?.label));
244
+ __enterChildren(__el1);
245
+ __append(__el1, __child(() => __props.label));
246
+ __exitChildren();
247
+ return __el1;
248
+ })());
249
+ __append(__el0, __child(() => __props.children));
250
+ __exitChildren();
251
+ return __el0;
252
+ })();
253
+ __flushMountFrame();
254
+ return __mfResult0;
255
+ } catch (__mfErr) {
256
+ __discardMountFrame(__mfDepth);
257
+ throw __mfErr;
258
+ }
259
+ }
260
+ function SelectSeparator(__props) {
261
+ const __mfDepth = __pushMountFrame();
262
+ try {
263
+ const { classes } = useSelectContext("Separator");
264
+ const __mfResult0 = (() => {
265
+ const __el0 = __element("hr");
266
+ __el0.setAttribute("role", "separator");
267
+ __attr(__el0, "class", () => cn(classes?.separator, __props.className ?? __props.class));
268
+ return __el0;
269
+ })();
270
+ __flushMountFrame();
271
+ return __mfResult0;
272
+ } catch (__mfErr) {
273
+ __discardMountFrame(__mfDepth);
274
+ throw __mfErr;
275
+ }
276
+ }
277
+ function ComposedSelectRoot(__props) {
278
+ const __mfDepth = __pushMountFrame();
279
+ try {
280
+ let getContentEl = function() {
281
+ return contentRef.current ?? null;
282
+ }, getTriggerEl = function() {
283
+ const content = getContentEl();
284
+ return content?.parentElement?.querySelector("[data-select-trigger]");
285
+ }, syncTriggerAttrs = function(nowOpen) {
286
+ const trigger = getTriggerEl();
287
+ if (!trigger)
288
+ return;
289
+ trigger.setAttribute("aria-expanded", nowOpen ? "true" : "false");
290
+ trigger.setAttribute("data-state", nowOpen ? "open" : "closed");
291
+ }, showContent = function() {
292
+ const content = getContentEl();
293
+ if (!content)
294
+ return;
295
+ content.setAttribute("data-state", "open");
296
+ content.setAttribute("aria-hidden", "false");
297
+ content.style.display = "";
298
+ }, hideContent = function() {
299
+ const content = getContentEl();
300
+ if (!content)
301
+ return;
302
+ content.setAttribute("data-state", "closed");
303
+ setHiddenAnimated(content, true);
304
+ }, open = function() {
305
+ isOpen.value = true;
306
+ syncTriggerAttrs(true);
307
+ showContent();
308
+ const contentEl = getContentEl();
309
+ const triggerEl = getTriggerEl();
310
+ if (!contentEl)
311
+ return;
312
+ contentEl.style.position = "fixed";
313
+ if (triggerEl) {
314
+ const floatingOpts = { matchReferenceWidth: true, ...__props.positioning };
315
+ const result = createFloatingPosition(triggerEl, contentEl, floatingOpts);
316
+ state.floatingCleanup = result.cleanup;
317
+ }
318
+ const insideElements = [contentEl, ...triggerEl ? [triggerEl] : []];
319
+ state.dismissCleanup = createDismiss({
320
+ onDismiss: close,
321
+ insideElements
322
+ });
323
+ const items = [...contentEl.querySelectorAll('[role="option"]')];
324
+ const selectedIdx = items.findIndex((el) => el.getAttribute("data-value") === selectedValue.value);
325
+ if (selectedIdx >= 0) {
326
+ items.forEach((el, i) => el.setAttribute("tabindex", i === selectedIdx ? "0" : "-1"));
327
+ items[selectedIdx]?.focus();
328
+ } else {
329
+ contentEl.focus();
330
+ }
331
+ }, close = function() {
332
+ isOpen.value = false;
333
+ syncTriggerAttrs(false);
334
+ hideContent();
335
+ state.floatingCleanup?.();
336
+ state.floatingCleanup = null;
337
+ state.dismissCleanup?.();
338
+ state.dismissCleanup = null;
339
+ getTriggerEl()?.focus();
340
+ }, toggle = function() {
341
+ if (isOpen.value)
342
+ close();
343
+ else
344
+ open();
345
+ }, selectItem = function(value) {
346
+ selectedValue.value = value;
347
+ __props.onValueChange?.(value);
348
+ close();
349
+ };
350
+ const ids = linkedIds("select");
351
+ const contentRef = ref();
352
+ const isOpen = signal(false, "isOpen");
353
+ const selectedValue = signal(__props.defaultValue ?? "", "selectedValue");
354
+ const state = { floatingCleanup: null, dismissCleanup: null };
355
+ const ctx = {
356
+ isOpen: () => isOpen.value,
357
+ selectedValue: () => selectedValue.value,
358
+ placeholder: __props.placeholder,
359
+ contentId: ids.contentId,
360
+ contentRef,
361
+ classes: __props.classes,
362
+ open,
363
+ close,
364
+ toggle,
365
+ selectItem,
366
+ _contentCount: { value: 0 }
367
+ };
368
+ const __mfResult0 = SelectContext.Provider({ get value() {
369
+ return ctx;
370
+ }, children: () => (() => {
371
+ const __el0 = __element("span");
372
+ {
373
+ const __v = { display: "contents" };
374
+ if (__v != null && __v !== false)
375
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
376
+ }
377
+ __el0.setAttribute("data-select-root", "");
378
+ __enterChildren(__el0);
379
+ __append(__el0, __child(() => __props.children));
380
+ __exitChildren();
381
+ return __el0;
382
+ })() });
383
+ __flushMountFrame();
384
+ return __mfResult0;
385
+ } catch (__mfErr) {
386
+ __discardMountFrame(__mfDepth);
387
+ throw __mfErr;
388
+ }
389
+ }
390
+ var ComposedSelect = Object.assign(ComposedSelectRoot, {
391
+ Trigger: SelectTrigger,
392
+ Content: SelectContent,
393
+ Item: SelectItem,
394
+ Group: SelectGroup,
395
+ Separator: SelectSeparator
396
+ });
397
+
398
+ export { ComposedSelect };