@ui-sdk/vue 0.0.0-stage → 0.1.0-beta.1

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 (262) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +10 -2
  3. package/dist/accordion.d.ts +561 -0
  4. package/dist/accordion.js +24 -0
  5. package/dist/agent.d.ts +2 -0
  6. package/dist/agent.js +7 -0
  7. package/dist/alert-dialog.d.ts +231 -0
  8. package/dist/alert-dialog.js +33 -0
  9. package/dist/async-options.d.ts +18 -0
  10. package/dist/async-options.js +40 -0
  11. package/dist/autocomplete.d.ts +384 -0
  12. package/dist/autocomplete.js +344 -0
  13. package/dist/avatar.d.ts +40 -0
  14. package/dist/avatar.js +28 -0
  15. package/dist/button.d.ts +52 -0
  16. package/dist/button.js +43 -0
  17. package/dist/calendar-context.d.ts +10 -0
  18. package/dist/calendar-context.js +7 -0
  19. package/dist/calendar.d.ts +311 -0
  20. package/dist/calendar.js +349 -0
  21. package/dist/carousel.d.ts +236 -0
  22. package/dist/carousel.js +204 -0
  23. package/dist/checkbox.d.ts +211 -0
  24. package/dist/checkbox.js +151 -0
  25. package/dist/children.d.ts +41 -0
  26. package/dist/children.js +135 -0
  27. package/dist/collapsible.d.ts +54 -0
  28. package/dist/collapsible.js +18 -0
  29. package/dist/color-picker.d.ts +187 -0
  30. package/dist/color-picker.js +158 -0
  31. package/dist/color.d.ts +2 -0
  32. package/dist/color.js +21 -0
  33. package/dist/combobox.d.ts +517 -0
  34. package/dist/combobox.js +531 -0
  35. package/dist/command.d.ts +322 -0
  36. package/dist/command.js +345 -0
  37. package/dist/controller-target.d.ts +49 -0
  38. package/dist/controller-target.js +112 -0
  39. package/dist/create-parts.d.ts +126 -0
  40. package/dist/create-parts.js +206 -0
  41. package/dist/date-input.d.ts +133 -0
  42. package/dist/date-input.js +31 -0
  43. package/dist/date-picker.d.ts +328 -0
  44. package/dist/date-picker.js +354 -0
  45. package/dist/date.d.ts +2 -0
  46. package/dist/date.js +59 -0
  47. package/dist/dialog-parts.d.ts +259 -0
  48. package/dist/dialog-parts.js +300 -0
  49. package/dist/dialog.d.ts +251 -0
  50. package/dist/dialog.js +25 -0
  51. package/dist/drawer.d.ts +304 -0
  52. package/dist/drawer.js +373 -0
  53. package/dist/editor-context.d.ts +4 -0
  54. package/dist/editor-context.js +5 -0
  55. package/dist/field-context.d.ts +26 -0
  56. package/dist/field-context.js +44 -0
  57. package/dist/field.d.ts +154 -0
  58. package/dist/field.js +240 -0
  59. package/dist/file-input.d.ts +212 -0
  60. package/dist/file-input.js +255 -0
  61. package/dist/form-inputs.d.ts +16 -0
  62. package/dist/form-inputs.js +25 -0
  63. package/dist/gesture.d.ts +1 -0
  64. package/dist/gesture.js +15 -0
  65. package/dist/history.d.ts +2 -0
  66. package/dist/history.js +11 -0
  67. package/dist/hover-card.d.ts +137 -0
  68. package/dist/hover-card.js +153 -0
  69. package/dist/image-cropper.d.ts +74 -0
  70. package/dist/image-cropper.js +36 -0
  71. package/dist/image.d.ts +2 -0
  72. package/dist/image.js +5 -0
  73. package/dist/index.d.ts +59 -0
  74. package/dist/index.js +60 -0
  75. package/dist/input.d.ts +120 -0
  76. package/dist/input.js +73 -0
  77. package/dist/item-icon.d.ts +34 -0
  78. package/dist/item-icon.js +63 -0
  79. package/dist/label.d.ts +16 -0
  80. package/dist/label.js +8 -0
  81. package/dist/lifecycle.d.ts +11 -0
  82. package/dist/lifecycle.js +91 -0
  83. package/dist/list-items.d.ts +38 -0
  84. package/dist/list-items.js +59 -0
  85. package/dist/list-text.d.ts +7 -0
  86. package/dist/list-text.js +15 -0
  87. package/dist/listbox.d.ts +273 -0
  88. package/dist/listbox.js +126 -0
  89. package/dist/menu.d.ts +678 -0
  90. package/dist/menu.js +607 -0
  91. package/dist/menubar-context.d.ts +5 -0
  92. package/dist/menubar-context.js +5 -0
  93. package/dist/menubar.d.ts +61 -0
  94. package/dist/menubar.js +48 -0
  95. package/dist/meter.d.ts +41 -0
  96. package/dist/meter.js +37 -0
  97. package/dist/navigation-menu.d.ts +228 -0
  98. package/dist/navigation-menu.js +195 -0
  99. package/dist/number-input.d.ts +176 -0
  100. package/dist/number-input.js +231 -0
  101. package/dist/number.d.ts +2 -0
  102. package/dist/number.js +39 -0
  103. package/dist/nuxt/entries.json +977 -0
  104. package/dist/nuxt/module.d.ts +18 -0
  105. package/dist/nuxt/module.js +31 -0
  106. package/dist/nuxt/registrations.d.ts +22 -0
  107. package/dist/nuxt/registrations.js +22 -0
  108. package/dist/observe.d.ts +2 -0
  109. package/dist/observe.js +7 -0
  110. package/dist/otp-input.d.ts +142 -0
  111. package/dist/otp-input.js +130 -0
  112. package/dist/overlays.d.ts +40 -0
  113. package/dist/overlays.js +118 -0
  114. package/dist/pagination.d.ts +201 -0
  115. package/dist/pagination.js +146 -0
  116. package/dist/password-input.d.ts +144 -0
  117. package/dist/password-input.js +134 -0
  118. package/dist/popover.d.ts +211 -0
  119. package/dist/popover.js +258 -0
  120. package/dist/popup.d.ts +60 -0
  121. package/dist/popup.js +89 -0
  122. package/dist/preferences.d.ts +44 -0
  123. package/dist/preferences.js +102 -0
  124. package/dist/primitive.d.ts +2 -0
  125. package/dist/primitive.js +11 -0
  126. package/dist/progress.d.ts +41 -0
  127. package/dist/progress.js +37 -0
  128. package/dist/radio.d.ts +164 -0
  129. package/dist/radio.js +145 -0
  130. package/dist/rating.d.ts +149 -0
  131. package/dist/rating.js +146 -0
  132. package/dist/renderless.d.ts +4 -0
  133. package/dist/renderless.js +28 -0
  134. package/dist/resizable.d.ts +54 -0
  135. package/dist/resizable.js +22 -0
  136. package/dist/scroll-area.d.ts +72 -0
  137. package/dist/scroll-area.js +77 -0
  138. package/dist/segmented-control.d.ts +151 -0
  139. package/dist/segmented-control.js +110 -0
  140. package/dist/segmented-input.d.ts +76 -0
  141. package/dist/segmented-input.js +115 -0
  142. package/dist/select.d.ts +458 -0
  143. package/dist/select.js +468 -0
  144. package/dist/separator.d.ts +14 -0
  145. package/dist/separator.js +8 -0
  146. package/dist/shortcuts.d.ts +32 -0
  147. package/dist/shortcuts.js +56 -0
  148. package/dist/slider.d.ts +65 -0
  149. package/dist/slider.js +194 -0
  150. package/dist/switch.d.ts +103 -0
  151. package/dist/switch.js +71 -0
  152. package/dist/tabs.d.ts +338 -0
  153. package/dist/tabs.js +27 -0
  154. package/dist/text-control.d.ts +89 -0
  155. package/dist/text-control.js +51 -0
  156. package/dist/text-match.d.ts +2 -0
  157. package/dist/text-match.js +7 -0
  158. package/dist/textarea.d.ts +106 -0
  159. package/dist/textarea.js +68 -0
  160. package/dist/time-input.d.ts +131 -0
  161. package/dist/time-input.js +32 -0
  162. package/dist/timeline.d.ts +81 -0
  163. package/dist/timeline.js +30 -0
  164. package/dist/toast-parts.d.ts +203 -0
  165. package/dist/toast-parts.js +270 -0
  166. package/dist/toast.d.ts +2 -0
  167. package/dist/toast.js +21 -0
  168. package/dist/toggle-props.d.ts +22 -0
  169. package/dist/toggle-props.js +14 -0
  170. package/dist/toggle.d.ts +199 -0
  171. package/dist/toggle.js +129 -0
  172. package/dist/token-input.d.ts +136 -0
  173. package/dist/token-input.js +214 -0
  174. package/dist/toolbar-context.d.ts +7 -0
  175. package/dist/toolbar-context.js +20 -0
  176. package/dist/toolbar.d.ts +120 -0
  177. package/dist/toolbar.js +77 -0
  178. package/dist/tooltip.d.ts +160 -0
  179. package/dist/tooltip.js +224 -0
  180. package/dist/tree.d.ts +300 -0
  181. package/dist/tree.js +209 -0
  182. package/dist/trigger-menu.d.ts +452 -0
  183. package/dist/trigger-menu.js +254 -0
  184. package/dist/use-primitive.d.ts +132 -0
  185. package/dist/use-primitive.js +462 -0
  186. package/dist/waterfall.d.ts +201 -0
  187. package/dist/waterfall.js +171 -0
  188. package/docs/README.md +89 -0
  189. package/docs/agents.md +1523 -0
  190. package/docs/components/accordion.md +1369 -0
  191. package/docs/components/alert-dialog.md +799 -0
  192. package/docs/components/autocomplete.md +1857 -0
  193. package/docs/components/avatar.md +272 -0
  194. package/docs/components/button.md +435 -0
  195. package/docs/components/calendar.md +1589 -0
  196. package/docs/components/carousel.md +1171 -0
  197. package/docs/components/checkbox.md +1008 -0
  198. package/docs/components/collapsible.md +536 -0
  199. package/docs/components/color-picker.md +706 -0
  200. package/docs/components/combobox.md +3504 -0
  201. package/docs/components/command.md +1481 -0
  202. package/docs/components/date-input.md +536 -0
  203. package/docs/components/date-picker.md +1244 -0
  204. package/docs/components/dialog.md +1397 -0
  205. package/docs/components/drawer.md +1166 -0
  206. package/docs/components/field.md +538 -0
  207. package/docs/components/file-input.md +611 -0
  208. package/docs/components/hover-card.md +505 -0
  209. package/docs/components/image-cropper.md +556 -0
  210. package/docs/components/input.md +306 -0
  211. package/docs/components/label.md +203 -0
  212. package/docs/components/listbox.md +1004 -0
  213. package/docs/components/menu.md +1229 -0
  214. package/docs/components/menubar.md +443 -0
  215. package/docs/components/meter.md +315 -0
  216. package/docs/components/navigation-menu.md +1523 -0
  217. package/docs/components/number-input.md +1029 -0
  218. package/docs/components/otp-input.md +512 -0
  219. package/docs/components/pagination.md +613 -0
  220. package/docs/components/password-input.md +649 -0
  221. package/docs/components/popover.md +1448 -0
  222. package/docs/components/preferences.md +208 -0
  223. package/docs/components/progress.md +423 -0
  224. package/docs/components/radio.md +785 -0
  225. package/docs/components/rating.md +416 -0
  226. package/docs/components/resizable.md +910 -0
  227. package/docs/components/scroll-area.md +915 -0
  228. package/docs/components/segmented-control.md +435 -0
  229. package/docs/components/select.md +2015 -0
  230. package/docs/components/separator.md +229 -0
  231. package/docs/components/slider.md +1084 -0
  232. package/docs/components/switch.md +565 -0
  233. package/docs/components/tabs.md +944 -0
  234. package/docs/components/textarea.md +299 -0
  235. package/docs/components/time-input.md +224 -0
  236. package/docs/components/timeline.md +654 -0
  237. package/docs/components/toast.md +1224 -0
  238. package/docs/components/toggle.md +500 -0
  239. package/docs/components/token-input.md +953 -0
  240. package/docs/components/toolbar.md +739 -0
  241. package/docs/components/tooltip.md +818 -0
  242. package/docs/components/tree.md +1306 -0
  243. package/docs/components/trigger-menu.md +1223 -0
  244. package/docs/components/waterfall.md +717 -0
  245. package/docs/controllers.md +71 -0
  246. package/docs/core.md +8027 -0
  247. package/docs/custom-parts.md +89 -0
  248. package/docs/first-component.md +83 -0
  249. package/docs/forms.md +122 -0
  250. package/docs/installation.md +72 -0
  251. package/docs/introduction.md +32 -0
  252. package/docs/lists-and-menus.md +122 -0
  253. package/docs/llms.txt +1502 -0
  254. package/docs/parts-and-composition.md +85 -0
  255. package/docs/popups.md +108 -0
  256. package/docs/rendering.md +56 -0
  257. package/docs/server-rendering.md +180 -0
  258. package/docs/state-and-events.md +100 -0
  259. package/docs/styling-and-animation.md +148 -0
  260. package/docs/utilities/async-options.md +348 -0
  261. package/docs/utilities/shortcuts.md +159 -0
  262. package/package.json +352 -3
@@ -0,0 +1,531 @@
1
+ // src/combobox.ts
2
+ import {
3
+ combobox as comboboxPrimitive
4
+ } from "@ui-sdk/core/combobox";
5
+ import {
6
+ comboboxChips,
7
+ comboboxCreate,
8
+ comboboxItemIcons,
9
+ comboboxSelectAll,
10
+ selectAllKey
11
+ } from "@ui-sdk/core/renderer";
12
+ import {
13
+ defineComponent,
14
+ h,
15
+ inject,
16
+ provide
17
+ } from "vue";
18
+ import {
19
+ hasChild,
20
+ learnLabels,
21
+ NotPlaced,
22
+ notLabel,
23
+ slotContent,
24
+ usePlaceContent,
25
+ usePlacedContent
26
+ } from "./children.js";
27
+ import { useFieldControl } from "./field-context.js";
28
+ import { defineItemIcon, defineValueIcon } from "./item-icon.js";
29
+ import { markSegments, slotText } from "./list-text.js";
30
+ import {
31
+ containerProp,
32
+ provideSheetHeader,
33
+ renderPopup,
34
+ sheetViewport,
35
+ useControllerEntry,
36
+ useInSheetHeader,
37
+ useSheetHeader
38
+ } from "./popup.js";
39
+ import { ListItems } from "./list-items.js";
40
+ import {
41
+ createParts,
42
+ withElement
43
+ } from "./create-parts.js";
44
+ import {
45
+ defaultSlot,
46
+ optionalBoolean,
47
+ orModel,
48
+ provideProps,
49
+ useHandle,
50
+ usePart,
51
+ usePrimitive,
52
+ useScope
53
+ } from "./use-primitive.js";
54
+ import { FormInputs } from "./form-inputs.js";
55
+ import { renderless } from "./renderless.js";
56
+ import { readOnlyOf } from "./text-control.js";
57
+ import { createComboboxController } from "@ui-sdk/core/combobox";
58
+ var ContainerKey = /* @__PURE__ */ Symbol("combobox-container");
59
+ var useCombobox = () => useHandle(comboboxPrimitive);
60
+ var parts = createParts(comboboxPrimitive, {
61
+ label: "label",
62
+ trigger: "button",
63
+ item: "div",
64
+ "item-indicator": "span",
65
+ group: "div",
66
+ "group-label": "div",
67
+ separator: "div",
68
+ status: "div",
69
+ clear: "button",
70
+ arrow: "div"
71
+ });
72
+ var anyValue = { type: null };
73
+ var Combobox = /* @__PURE__ */ renderless(
74
+ defineComponent({
75
+ name: "Combobox",
76
+ props: {
77
+ value: anyValue,
78
+ modelValue: anyValue,
79
+ defaultValue: anyValue,
80
+ query: { type: String, default: void 0 },
81
+ defaultQuery: { type: String, default: void 0 },
82
+ open: optionalBoolean,
83
+ defaultOpen: optionalBoolean,
84
+ multiple: optionalBoolean,
85
+ maxSelected: Number,
86
+ items: Array,
87
+ emptyItems: Array,
88
+ filter: {
89
+ type: [String, Boolean, Function],
90
+ default: void 0
91
+ },
92
+ announcement: Function,
93
+ itemToValue: Function,
94
+ itemToLabel: Function,
95
+ isItemEqualToValue: Function,
96
+ autoHighlight: {
97
+ type: [Boolean, String],
98
+ default: void 0
99
+ },
100
+ keepQuery: optionalBoolean,
101
+ pendingAnnouncement: String,
102
+ allowCustomValue: optionalBoolean,
103
+ status: String,
104
+ loop: optionalBoolean,
105
+ modal: {
106
+ type: [Boolean, String],
107
+ default: void 0
108
+ },
109
+ presentation: String,
110
+ disabled: optionalBoolean,
111
+ readOnly: optionalBoolean,
112
+ required: optionalBoolean,
113
+ name: String,
114
+ form: String,
115
+ controller: Object,
116
+ dismissible: optionalBoolean,
117
+ debug: optionalBoolean,
118
+ container: containerProp
119
+ },
120
+ emits: {
121
+ "update:value": (_value) => true,
122
+ "update:modelValue": (_value) => true,
123
+ valueChange: (_value, _details) => true,
124
+ "update:query": (_query) => true,
125
+ queryChange: (_query, _details) => true,
126
+ "update:open": (_open) => true,
127
+ openChange: (_open, _details) => true,
128
+ openChangeComplete: (_open) => true,
129
+ dismissAttempt: (_details) => true,
130
+ highlight: (_value, _details) => true,
131
+ loadMore: () => true
132
+ },
133
+ setup(props, { slots, attrs, emit }) {
134
+ const field = useFieldControl();
135
+ provide(ContainerKey, () => props.container);
136
+ const combobox = usePrimitive(comboboxPrimitive, () => ({
137
+ ...props,
138
+ value: orModel(props.value, props.modelValue),
139
+ container: void 0,
140
+ name: props.name ?? field?.name(),
141
+ disabled: props.disabled || field?.disabled(),
142
+ readOnly: readOnlyOf(props, attrs),
143
+ onValueChange: (value, details) => {
144
+ emit("valueChange", value, details);
145
+ if (details.canceled) {
146
+ return;
147
+ }
148
+ emit("update:value", value);
149
+ emit("update:modelValue", value);
150
+ },
151
+ onQueryChange: (query, details) => {
152
+ emit("queryChange", query, details);
153
+ if (!details.canceled) {
154
+ emit("update:query", query);
155
+ }
156
+ },
157
+ onOpenChange: (open, details) => {
158
+ emit("openChange", open, details);
159
+ if (!details.canceled) {
160
+ emit("update:open", open);
161
+ }
162
+ },
163
+ onOpenChangeComplete: (open) => emit("openChangeComplete", open),
164
+ onDismissAttempt: (details) => emit("dismissAttempt", details),
165
+ onHighlight: (value, details) => emit("highlight", value, details),
166
+ onLoadMore: () => emit("loadMore")
167
+ }));
168
+ useControllerEntry(() => props.controller, combobox);
169
+ provideSheetHeader();
170
+ const placed = usePlacedContent();
171
+ return () => {
172
+ const children = slots.default?.() ?? [];
173
+ learnLabels(combobox.api.internal, children, itemDecorations);
174
+ const own = !props.items || placed() || hasChild(children, ComboboxContent);
175
+ return [
176
+ children,
177
+ props.items && !own && h(NotPlaced, () => h(ComboboxContent)),
178
+ h(FormInputs, { handle: combobox })
179
+ ];
180
+ };
181
+ }
182
+ })
183
+ );
184
+ var ComboboxLabel = parts.Label;
185
+ var ComboboxChips = /* @__PURE__ */ withElement(
186
+ "div",
187
+ /* @__PURE__ */ defineComponent({
188
+ name: "ComboboxChips",
189
+ inheritAttrs: false,
190
+ slots: Object,
191
+ setup() {
192
+ const combobox = useCombobox();
193
+ combobox.instance.use(comboboxChips);
194
+ return usePart(combobox, "chips");
195
+ }
196
+ })
197
+ );
198
+ var ComboboxChipsOverflow = /* @__PURE__ */ withElement(
199
+ "span",
200
+ /* @__PURE__ */ defineComponent({
201
+ name: "ComboboxChipsOverflow",
202
+ inheritAttrs: false,
203
+ slots: Object,
204
+ setup(_, { slots }) {
205
+ const combobox = useCombobox();
206
+ combobox.instance.use(comboboxChips);
207
+ return usePart(combobox, "chips-overflow", void 0, void 0, {
208
+ tag: "span",
209
+ children: (state) => slotContent(slots.default, { state }) ?? `+${state.count} more`
210
+ });
211
+ }
212
+ })
213
+ );
214
+ var ComboboxInput = withElement(
215
+ "input",
216
+ defineComponent({
217
+ name: "ComboboxInput",
218
+ inheritAttrs: false,
219
+ slots: Object,
220
+ setup(_, { attrs }) {
221
+ const field = useFieldControl(attrs);
222
+ const inHeader = useInSheetHeader();
223
+ const part = usePart(comboboxPrimitive, "input", void 0, void 0, {
224
+ tag: "input",
225
+ extend: field?.props
226
+ });
227
+ return () => {
228
+ const element = part();
229
+ return element && inHeader(element);
230
+ };
231
+ }
232
+ })
233
+ );
234
+ var ComboboxTrigger = parts.Trigger;
235
+ var ComboboxContent = withElement(
236
+ "div",
237
+ defineComponent({
238
+ name: "ComboboxContent",
239
+ inheritAttrs: false,
240
+ props: {
241
+ side: String,
242
+ align: String,
243
+ sideOffset: Number,
244
+ alignOffset: Number,
245
+ collisionPadding: Number,
246
+ arrowPadding: Number,
247
+ anchor: [Object, String],
248
+ keepMounted: optionalBoolean,
249
+ container: containerProp
250
+ },
251
+ slots: Object,
252
+ setup(props, { slots }) {
253
+ usePlaceContent();
254
+ const combobox = useCombobox();
255
+ const inherited = inject(ContainerKey, () => void 0);
256
+ const content = () => {
257
+ const { container, ...content2 } = props;
258
+ return content2;
259
+ };
260
+ const header = useSheetHeader(combobox);
261
+ const part = usePart(combobox, "content", content, void 0, {
262
+ tag: "div",
263
+ children: (state) => [
264
+ header(),
265
+ defaultSlot(
266
+ slots,
267
+ state,
268
+ () => combobox.state.items && h(ComboboxList)
269
+ )
270
+ ]
271
+ });
272
+ return () => {
273
+ const element = part();
274
+ if (!element) {
275
+ return null;
276
+ }
277
+ return renderPopup(
278
+ sheetViewport(combobox, element),
279
+ props.container ?? inherited()
280
+ );
281
+ };
282
+ }
283
+ })
284
+ );
285
+ var ComboboxList = withElement(
286
+ "div",
287
+ defineComponent({
288
+ name: "ComboboxList",
289
+ inheritAttrs: false,
290
+ slots: Object,
291
+ setup(_, { slots }) {
292
+ const combobox = useCombobox();
293
+ return usePart(combobox, "list", void 0, void 0, {
294
+ tag: "div",
295
+ children: (state) => defaultSlot(
296
+ slots,
297
+ state,
298
+ () => combobox.state.items && h(ComboboxItems, { items: state.items })
299
+ )
300
+ });
301
+ }
302
+ })
303
+ );
304
+ var ComboboxItem = parts.Item;
305
+ var ComboboxItemIndicator = parts.ItemIndicator;
306
+ var ComboboxItemText = withElement(
307
+ "span",
308
+ defineComponent({
309
+ name: "ComboboxItemText",
310
+ inheritAttrs: false,
311
+ slots: Object,
312
+ setup(_, { slots }) {
313
+ const item = useScope(comboboxPrimitive)?.around.item;
314
+ if (!item) {
315
+ throw new Error(
316
+ "<ComboboxItemText> must be used inside <ComboboxItem>."
317
+ );
318
+ }
319
+ let text = "";
320
+ let own;
321
+ let ownText;
322
+ const part = usePart(
323
+ comboboxPrimitive,
324
+ "item-text",
325
+ () => ({ id: item().value, text }),
326
+ void 0,
327
+ {
328
+ tag: "span",
329
+ children: (state) => own && ownText === void 0 ? own : markSegments(state.segments)
330
+ }
331
+ );
332
+ return () => {
333
+ own = slotContent(slots.default, { state: part.state });
334
+ ownText = slotText(own);
335
+ text = ownText ?? (item().label ?? item().value);
336
+ return part();
337
+ };
338
+ }
339
+ })
340
+ );
341
+ var ComboboxSelectAll = /* @__PURE__ */ withElement(
342
+ "div",
343
+ /* @__PURE__ */ defineComponent({
344
+ name: "ComboboxSelectAll",
345
+ inheritAttrs: false,
346
+ slots: Object,
347
+ setup() {
348
+ const combobox = useCombobox();
349
+ combobox.instance.use(comboboxSelectAll);
350
+ const part = {
351
+ id: selectAllKey(
352
+ useScope(comboboxPrimitive)?.around.group?.().id
353
+ )
354
+ };
355
+ return usePart(combobox, "select-all", () => part);
356
+ }
357
+ })
358
+ );
359
+ var ComboboxItemIcon = /* @__PURE__ */ notLabel(
360
+ /* @__PURE__ */ defineItemIcon(
361
+ "ComboboxItemIcon",
362
+ comboboxPrimitive,
363
+ "item-icon",
364
+ comboboxItemIcons
365
+ )
366
+ );
367
+ var itemDecorations = /* @__PURE__ */ new Set([ComboboxItemIndicator]);
368
+ var ComboboxValueIcon = /* @__PURE__ */ defineValueIcon(
369
+ "ComboboxValueIcon",
370
+ comboboxPrimitive,
371
+ comboboxItemIcons
372
+ );
373
+ var ComboboxGroup = parts.Group;
374
+ var ComboboxGroupLabel = parts.GroupLabel;
375
+ var ComboboxSeparator = parts.Separator;
376
+ var ComboboxCreate = /* @__PURE__ */ (() => withElement(
377
+ "div",
378
+ defineComponent({
379
+ name: "ComboboxCreate",
380
+ inheritAttrs: false,
381
+ props: {
382
+ // A function prop beside the emit, so a returned Promise marks the option pending.
383
+ onCreate: Function,
384
+ minLength: Number
385
+ },
386
+ slots: Object,
387
+ setup(props, { slots }) {
388
+ const combobox = useCombobox();
389
+ combobox.instance.use(comboboxCreate);
390
+ const part = () => ({
391
+ onCreate: props.onCreate,
392
+ minLength: props.minLength
393
+ });
394
+ return usePart(combobox, "create", part, void 0, {
395
+ tag: "div",
396
+ children: (state) => slotContent(slots.default, { state }) ?? `Create \u201C${state.query}\u201D`
397
+ });
398
+ }
399
+ })
400
+ ))();
401
+ var ComboboxEmpty = withElement(
402
+ "div",
403
+ defineComponent({
404
+ name: "ComboboxEmpty",
405
+ inheritAttrs: false,
406
+ slots: Object,
407
+ setup(_, { slots }) {
408
+ return usePart(comboboxPrimitive, "empty", void 0, void 0, {
409
+ tag: "div",
410
+ children: (state) => state.empty ? slots.default?.({ state }) : null
411
+ });
412
+ }
413
+ })
414
+ );
415
+ var ComboboxStatus = parts.Status;
416
+ var ComboboxClear = parts.Clear;
417
+ var ComboboxValue = /* @__PURE__ */ renderless(
418
+ defineComponent({
419
+ name: "ComboboxValue",
420
+ props: {
421
+ maxLabels: Number,
422
+ getMoreLabel: Function
423
+ },
424
+ slots: Object,
425
+ setup(props, { slots }) {
426
+ const { state } = usePart(comboboxPrimitive, "value", () => ({
427
+ maxLabels: props.maxLabels,
428
+ getMoreLabel: props.getMoreLabel
429
+ }));
430
+ return () => slotContent(slots.default, { state, value: state.value }) ?? (state.label || null);
431
+ }
432
+ })
433
+ );
434
+ var ComboboxChip = /* @__PURE__ */ (() => withElement(
435
+ "div",
436
+ defineComponent({
437
+ name: "ComboboxChip",
438
+ inheritAttrs: false,
439
+ props: {
440
+ value: { type: null, required: true }
441
+ },
442
+ slots: Object,
443
+ setup(props, { slots }) {
444
+ const combobox = useCombobox();
445
+ combobox.instance.use(comboboxChips);
446
+ provideProps(comboboxPrimitive, "chip", () => ({ value: props.value }));
447
+ const part = () => ({
448
+ id: combobox.api.internal.keyOf(props.value),
449
+ value: props.value
450
+ });
451
+ return usePart(combobox, "chip", part, void 0, {
452
+ tag: "div",
453
+ children: (state) => slotContent(slots.default, { state }) ?? state.label
454
+ });
455
+ }
456
+ })
457
+ ))();
458
+ var ComboboxChipRemove = /* @__PURE__ */ withElement(
459
+ "button",
460
+ /* @__PURE__ */ defineComponent({
461
+ name: "ComboboxChipRemove",
462
+ inheritAttrs: false,
463
+ slots: Object,
464
+ setup() {
465
+ const combobox = useCombobox();
466
+ combobox.instance.use(comboboxChips);
467
+ const chip = useScope(comboboxPrimitive)?.around.chip;
468
+ if (!chip) {
469
+ throw new Error(
470
+ "<ComboboxChipRemove> must be used inside <ComboboxChip>."
471
+ );
472
+ }
473
+ const value = () => chip().value;
474
+ const part = () => ({
475
+ id: combobox.api.internal.keyOf(value()),
476
+ value: value()
477
+ });
478
+ return usePart(combobox, "chip-remove", part, void 0, "button");
479
+ }
480
+ })
481
+ );
482
+ var ComboboxArrow = parts.Arrow;
483
+ var ComboboxItems = defineComponent({
484
+ name: "ComboboxItems",
485
+ props: {
486
+ items: { type: Array, required: true }
487
+ },
488
+ setup(props) {
489
+ const combobox = useCombobox();
490
+ return () => h(ListItems, {
491
+ items: props.items,
492
+ parts: listParts,
493
+ keyOf: combobox.api.internal.keyOf
494
+ });
495
+ }
496
+ });
497
+ var listParts = {
498
+ Item: ComboboxItem,
499
+ Group: ComboboxGroup,
500
+ GroupLabel: ComboboxGroupLabel,
501
+ Separator: ComboboxSeparator
502
+ };
503
+ export {
504
+ Combobox,
505
+ ComboboxArrow,
506
+ ComboboxChip,
507
+ ComboboxChipRemove,
508
+ ComboboxChips,
509
+ ComboboxChipsOverflow,
510
+ ComboboxClear,
511
+ ComboboxContent,
512
+ ComboboxCreate,
513
+ ComboboxEmpty,
514
+ ComboboxGroup,
515
+ ComboboxGroupLabel,
516
+ ComboboxInput,
517
+ ComboboxItem,
518
+ ComboboxItemIcon,
519
+ ComboboxItemIndicator,
520
+ ComboboxItemText,
521
+ ComboboxItems,
522
+ ComboboxLabel,
523
+ ComboboxList,
524
+ ComboboxSelectAll,
525
+ ComboboxSeparator,
526
+ ComboboxStatus,
527
+ ComboboxTrigger,
528
+ ComboboxValue,
529
+ ComboboxValueIcon,
530
+ createComboboxController
531
+ };