@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
package/dist/drawer.js ADDED
@@ -0,0 +1,373 @@
1
+ // src/drawer.ts
2
+ import {
3
+ drawer as drawerPrimitive
4
+ } from "@ui-sdk/core/drawer";
5
+ import {
6
+ defineComponent,
7
+ h,
8
+ inject,
9
+ onMounted,
10
+ provide,
11
+ ref,
12
+ useId
13
+ } from "vue";
14
+ import { slotContent } from "./children.js";
15
+ import {
16
+ containerProp,
17
+ renderPopup,
18
+ renderUnbound,
19
+ sheetViewport,
20
+ useConnectedPart,
21
+ useControllerEntry,
22
+ useControllerTarget,
23
+ usePopupContainer,
24
+ withPayload
25
+ } from "./popup.js";
26
+ import { createParts, withElement } from "./create-parts.js";
27
+ import {
28
+ optionalBoolean,
29
+ orModel,
30
+ useHandle,
31
+ usePart,
32
+ usePrimitive,
33
+ useScope
34
+ } from "./use-primitive.js";
35
+ import { renderless } from "./renderless.js";
36
+ import { createDrawerController, sheetPhysics } from "@ui-sdk/core/drawer";
37
+ var ContainerKey = /* @__PURE__ */ Symbol("Drawer-container");
38
+ var TriggerKey = /* @__PURE__ */ Symbol("drawer-trigger");
39
+ var useDrawer = () => useHandle(drawerPrimitive);
40
+ var parts = createParts(drawerPrimitive, {
41
+ handle: "button",
42
+ title: "h2",
43
+ description: "p"
44
+ });
45
+ var snapPointProp = {
46
+ type: [Number, String],
47
+ default: void 0
48
+ };
49
+ var Drawer = /* @__PURE__ */ renderless(
50
+ defineComponent({
51
+ name: "Drawer",
52
+ props: {
53
+ open: optionalBoolean,
54
+ modelValue: optionalBoolean,
55
+ defaultOpen: optionalBoolean,
56
+ modal: {
57
+ type: [Boolean, String],
58
+ default: void 0
59
+ },
60
+ closeOnOutsidePress: optionalBoolean,
61
+ controller: Object,
62
+ dismissible: optionalBoolean,
63
+ persistentElements: [Array, Function],
64
+ pendingAnnouncement: String,
65
+ debug: optionalBoolean,
66
+ container: containerProp,
67
+ snapPoints: Array,
68
+ snapPoint: snapPointProp,
69
+ defaultSnapPoint: {
70
+ type: [Number, String],
71
+ default: void 0
72
+ },
73
+ side: String,
74
+ modalAbove: {
75
+ type: [Number, String],
76
+ default: void 0
77
+ },
78
+ driver: String,
79
+ expandOnScroll: optionalBoolean,
80
+ physics: Object,
81
+ themeColor: optionalBoolean,
82
+ preventEdgeSwipe: optionalBoolean
83
+ },
84
+ emits: {
85
+ "update:open": (_open) => true,
86
+ "update:modelValue": (_open) => true,
87
+ openChange: (_open, _details) => true,
88
+ openChangeComplete: (_open) => true,
89
+ payloadChange: (_payload, _details) => true,
90
+ dismissAttempt: (_details) => true,
91
+ "update:snapPoint": (_snapPoint) => true,
92
+ snapPointChange: (_snapPoint, _details) => true
93
+ },
94
+ setup(props, { slots, emit }) {
95
+ provide(ContainerKey, () => props.container);
96
+ const drawer = usePrimitive(drawerPrimitive, () => ({
97
+ ...props,
98
+ open: orModel(props.open, props.modelValue),
99
+ container: void 0,
100
+ onOpenChange: (open, details) => {
101
+ emit("openChange", open, details);
102
+ if (details.canceled) {
103
+ return;
104
+ }
105
+ emit("update:open", open);
106
+ emit("update:modelValue", open);
107
+ },
108
+ onOpenChangeComplete: (open) => emit("openChangeComplete", open),
109
+ onPayloadChange: (payload, details) => emit("payloadChange", payload, details),
110
+ onDismissAttempt: (details) => emit("dismissAttempt", details),
111
+ onSnapPointChange: (snapPoint, details) => {
112
+ emit("snapPointChange", snapPoint, details);
113
+ if (!details.canceled) {
114
+ emit("update:snapPoint", snapPoint);
115
+ }
116
+ }
117
+ }));
118
+ useControllerEntry(() => props.controller, drawer);
119
+ return () => slots.default?.();
120
+ }
121
+ })
122
+ );
123
+ var DrawerTrigger = withElement(
124
+ "button",
125
+ defineComponent({
126
+ name: "DrawerTrigger",
127
+ inheritAttrs: false,
128
+ props: {
129
+ disabled: optionalBoolean,
130
+ focusableWhenDisabled: optionalBoolean,
131
+ payload: null,
132
+ // A keyboard shortcut that presses the trigger, like "mod+k".
133
+ shortcut: String,
134
+ // Connects a trigger outside the drawer to the drawer with this controller.
135
+ controller: Object
136
+ },
137
+ slots: Object,
138
+ setup(props, { slots, attrs }) {
139
+ const connected = useControllerTarget(
140
+ drawerPrimitive,
141
+ () => props.controller
142
+ );
143
+ provide(TriggerKey, { shortcut: () => props.shortcut, drawer: connected });
144
+ const id = useId();
145
+ const part = () => ({
146
+ id,
147
+ disabled: props.disabled,
148
+ focusableWhenDisabled: props.focusableWhenDisabled,
149
+ payload: props.payload,
150
+ shortcut: props.shortcut
151
+ });
152
+ return useConnectedPart(
153
+ connected,
154
+ (drawer) => usePart(drawer, "trigger", part, void 0, "button"),
155
+ // Until the drawer it names mounts, a trigger outside the drawer is a plain button.
156
+ () => renderUnbound(
157
+ "button",
158
+ {
159
+ type: "button",
160
+ disabled: props.disabled && !props.focusableWhenDisabled,
161
+ "aria-disabled": props.disabled && props.focusableWhenDisabled || void 0,
162
+ ...attrs
163
+ },
164
+ { slots, state: { open: false, disabled: !!props.disabled } }
165
+ )
166
+ );
167
+ }
168
+ })
169
+ );
170
+ var DrawerBackdrop = withElement(
171
+ "div",
172
+ defineComponent({
173
+ name: "DrawerBackdrop",
174
+ inheritAttrs: false,
175
+ slots: Object,
176
+ setup() {
177
+ const target = usePopupContainer(inject(ContainerKey, () => void 0));
178
+ const part = usePart(useDrawer(), "backdrop");
179
+ return () => {
180
+ const element = part();
181
+ return element && renderPopup(element, target());
182
+ };
183
+ }
184
+ })
185
+ );
186
+ var DrawerContent = withPayload(
187
+ withElement(
188
+ "div",
189
+ defineComponent({
190
+ name: "DrawerContent",
191
+ inheritAttrs: false,
192
+ props: {
193
+ initialFocus: [
194
+ String,
195
+ Object,
196
+ Function
197
+ ],
198
+ finalFocus: [String, Object, Function],
199
+ keepMounted: optionalBoolean,
200
+ // Renders the drawer into this element instead of in place.
201
+ container: containerProp
202
+ },
203
+ slots: Object,
204
+ setup(props) {
205
+ const drawer = useDrawer();
206
+ const fromRoot = inject(ContainerKey, () => void 0);
207
+ const target = usePopupContainer(() => props.container ?? fromRoot());
208
+ const content = () => ({
209
+ initialFocus: props.initialFocus,
210
+ finalFocus: props.finalFocus,
211
+ keepMounted: props.keepMounted
212
+ });
213
+ const part = usePart(drawer, "content", content);
214
+ return () => {
215
+ const element = part();
216
+ if (!element) {
217
+ return null;
218
+ }
219
+ return renderPopup(sheetViewport(drawer, element), target());
220
+ };
221
+ }
222
+ })
223
+ )
224
+ );
225
+ var DrawerHandle = parts.Handle;
226
+ var DrawerTitle = parts.Title;
227
+ var DrawerDescription = parts.Description;
228
+ var DrawerClose = withElement(
229
+ "button",
230
+ defineComponent({
231
+ name: "DrawerClose",
232
+ inheritAttrs: false,
233
+ props: {
234
+ // Reported as `returnValue` when this closes the drawer.
235
+ value: String,
236
+ // Runs before the drawer closes. A returned Promise keeps it open and pending until it settles.
237
+ action: Function,
238
+ // `@action="save"` binds here, so the part gets the handler's Promise.
239
+ onAction: Function
240
+ },
241
+ slots: Object,
242
+ setup(props) {
243
+ const id = useId();
244
+ const part = () => ({
245
+ id,
246
+ value: props.value,
247
+ action: props.action ?? props.onAction
248
+ });
249
+ return usePart(useDrawer(), "close", part, void 0, "button");
250
+ }
251
+ })
252
+ );
253
+ var ShortcutBinding = defineComponent({
254
+ name: "DrawerShortcutBinding",
255
+ inheritAttrs: false,
256
+ props: {
257
+ drawer: { type: Object, required: true },
258
+ shortcut: String
259
+ },
260
+ setup(props, { slots }) {
261
+ return usePart(
262
+ props.drawer,
263
+ "shortcut",
264
+ () => ({ shortcut: props.shortcut }),
265
+ void 0,
266
+ {
267
+ tag: "span",
268
+ children: (state) => slotContent(slots.default, { state }) ?? state.text
269
+ }
270
+ );
271
+ }
272
+ });
273
+ var DrawerShortcut = withElement(
274
+ "span",
275
+ defineComponent({
276
+ name: "DrawerShortcut",
277
+ inheritAttrs: false,
278
+ props: {
279
+ // The keys to show. Inside a trigger, its shortcut.
280
+ shortcut: String
281
+ },
282
+ slots: Object,
283
+ setup(props, { slots, attrs }) {
284
+ const context = useScope(drawerPrimitive)?.handle;
285
+ const trigger = inject(TriggerKey, null);
286
+ if (!context && !trigger) {
287
+ throw new Error("Drawer parts must be used inside <Drawer>.");
288
+ }
289
+ const mounted = ref(!!context);
290
+ onMounted(() => mounted.value = true);
291
+ return () => {
292
+ const drawer = context ?? (mounted.value ? trigger?.drawer() : void 0);
293
+ if (!drawer) {
294
+ return null;
295
+ }
296
+ const shortcut = props.shortcut ?? trigger?.shortcut();
297
+ return h(
298
+ ShortcutBinding,
299
+ { ...attrs, key: drawer.instance.id, drawer, shortcut },
300
+ slots
301
+ );
302
+ };
303
+ }
304
+ })
305
+ );
306
+ var OutletBinding = defineComponent({
307
+ name: "DrawerOutletBinding",
308
+ inheritAttrs: false,
309
+ props: {
310
+ drawer: { type: Object, required: true },
311
+ keyframes: Object
312
+ },
313
+ setup(props) {
314
+ const id = useId();
315
+ return usePart(props.drawer, "outlet", () => ({
316
+ id,
317
+ keyframes: props.keyframes
318
+ }));
319
+ }
320
+ });
321
+ var DrawerOutlet = withElement(
322
+ "div",
323
+ defineComponent({
324
+ name: "DrawerOutlet",
325
+ inheritAttrs: false,
326
+ props: {
327
+ // Keyframes it plays as the drawer expands, like `{ scale: [1, 0.94] }`.
328
+ keyframes: Object,
329
+ controller: Object
330
+ },
331
+ slots: Object,
332
+ setup(props, { slots, attrs }) {
333
+ const connected = useControllerTarget(
334
+ drawerPrimitive,
335
+ () => props.controller
336
+ );
337
+ return () => {
338
+ const drawer = connected();
339
+ if (!drawer) {
340
+ return renderUnbound(
341
+ "div",
342
+ { ...attrs },
343
+ { slots, state: { open: false } }
344
+ );
345
+ }
346
+ return h(
347
+ OutletBinding,
348
+ {
349
+ ...attrs,
350
+ key: drawer.instance.id,
351
+ drawer,
352
+ keyframes: props.keyframes
353
+ },
354
+ slots
355
+ );
356
+ };
357
+ }
358
+ })
359
+ );
360
+ export {
361
+ Drawer,
362
+ DrawerBackdrop,
363
+ DrawerClose,
364
+ DrawerContent,
365
+ DrawerDescription,
366
+ DrawerHandle,
367
+ DrawerOutlet,
368
+ DrawerShortcut,
369
+ DrawerTitle,
370
+ DrawerTrigger,
371
+ createDrawerController,
372
+ sheetPhysics
373
+ };
@@ -0,0 +1,4 @@
1
+ import type { TextEditorAdapter } from "@ui-sdk/core/trigger-menu";
2
+ import type { InjectionKey } from "vue";
3
+ declare const EditorKey: InjectionKey<() => TextEditorAdapter | undefined>;
4
+ export { EditorKey };
@@ -0,0 +1,5 @@
1
+ // src/editor-context.ts
2
+ var EditorKey = /* @__PURE__ */ Symbol("text-editor");
3
+ export {
4
+ EditorKey
5
+ };
@@ -0,0 +1,26 @@
1
+ import type { field } from "@ui-sdk/core/field";
2
+ import { type InjectionKey } from "vue";
3
+ import type { PrimitiveHandle } from "./use-primitive.js";
4
+ type FieldContext = PrimitiveHandle<typeof field> & {
5
+ name: () => string | undefined;
6
+ disabled: () => boolean | undefined;
7
+ };
8
+ declare const FieldKey: InjectionKey<FieldContext>;
9
+ /**
10
+ * Controls inside a field take its name and disabled state, and its ids and
11
+ * validity through the field's control slot. Null outside a field. The
12
+ * control takes the field's id, so the label points at it from the server's
13
+ * HTML on, unless its own props give one. A control whose component makes the
14
+ * id it renders, like a select's trigger, passes its attributes as `own`.
15
+ * @stable
16
+ */
17
+ declare function useFieldControl(own?: Record<string, unknown>): {
18
+ name: () => string | undefined;
19
+ disabled: () => boolean | undefined;
20
+ props: (props: Record<string, any>) => {
21
+ "aria-labelledby": any;
22
+ "data-slot": any;
23
+ };
24
+ } | null;
25
+ declare function useFieldControlId(): string | undefined;
26
+ export { type FieldContext, FieldKey, useFieldControl, useFieldControlId };
@@ -0,0 +1,44 @@
1
+ // src/field-context.ts
2
+ import { fieldControlId, madeLabel } from "@ui-sdk/core/renderer";
3
+ import { inject } from "vue";
4
+ var FieldKey = /* @__PURE__ */ Symbol("field");
5
+ function useFieldControl(own) {
6
+ const field = inject(FieldKey, null);
7
+ if (!field) {
8
+ return null;
9
+ }
10
+ return {
11
+ name: field.name,
12
+ disabled: field.disabled,
13
+ // Merges the field's attributes for its control into the control's props,
14
+ // keeping the control's own description ahead of the field's. The field
15
+ // decides the id.
16
+ props: (props) => {
17
+ const id = (own ?? props).id;
18
+ const label = props["aria-labelledby"];
19
+ const merged = field.slot(
20
+ "control",
21
+ { id, describedBy: props["aria-describedby"] },
22
+ {
23
+ ...props,
24
+ id: void 0,
25
+ "aria-labelledby": madeLabel(label) ? void 0 : label
26
+ }
27
+ );
28
+ return {
29
+ ...merged,
30
+ "aria-labelledby": merged["aria-labelledby"] ?? label,
31
+ "data-slot": props["data-slot"]
32
+ };
33
+ }
34
+ };
35
+ }
36
+ function useFieldControlId() {
37
+ const field = inject(FieldKey, null);
38
+ return field ? fieldControlId(field.api.id) : void 0;
39
+ }
40
+ export {
41
+ FieldKey,
42
+ useFieldControl,
43
+ useFieldControlId
44
+ };
@@ -0,0 +1,154 @@
1
+ import { type FieldDescriptionState, type ValidityKey } from "@ui-sdk/core/field";
2
+ import { type PropType } from "vue";
3
+ import { type PartSlots, type StateSlots } from "./use-primitive.js";
4
+ /**
5
+ * Ties a form control to its label, description and error messages.
6
+ * @stable
7
+ */
8
+ declare const Field: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
9
+ name: StringConstructor;
10
+ disabled: {
11
+ type: BooleanConstructor;
12
+ default: undefined;
13
+ };
14
+ invalid: {
15
+ type: BooleanConstructor;
16
+ default: undefined;
17
+ };
18
+ debug: {
19
+ type: BooleanConstructor;
20
+ default: undefined;
21
+ };
22
+ }>, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
23
+ [key: string]: any;
24
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
25
+ [key: string]: any;
26
+ }>[] | null) & {
27
+ state: NoInfer<import("@ui-sdk/core/field").FieldState>;
28
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
29
+ name: StringConstructor;
30
+ disabled: {
31
+ type: BooleanConstructor;
32
+ default: undefined;
33
+ };
34
+ invalid: {
35
+ type: BooleanConstructor;
36
+ default: undefined;
37
+ };
38
+ debug: {
39
+ type: BooleanConstructor;
40
+ default: undefined;
41
+ };
42
+ }>> & Readonly<{}>, {
43
+ invalid: boolean;
44
+ disabled: boolean;
45
+ debug: boolean;
46
+ }, PartSlots<import("@ui-sdk/core/field").FieldPrimitive, "root">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
47
+ /**
48
+ * The field's label, which names its control. Outside a Field it's a plain
49
+ * <label>, which labels the control inside it, like a card around a whole Field.
50
+ * @stable
51
+ */
52
+ declare const FieldLabel: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
53
+ [key: string]: any;
54
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
55
+ [key: string]: any;
56
+ }>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/field").FieldPrimitive, "label">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "label">;
57
+ /**
58
+ * Describes its Field. Right inside a FieldSet, outside any Field, it describes
59
+ * the group, so screen readers say it as focus enters the group.
60
+ * @stable
61
+ */
62
+ declare const FieldDescription: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
63
+ [key: string]: any;
64
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
65
+ [key: string]: any;
66
+ }>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, StateSlots<FieldDescriptionState>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "p">;
67
+ /**
68
+ * Shows while the field shows as invalid. Without content, it shows the
69
+ * browser's message for the current problem.
70
+ * @stable
71
+ */
72
+ declare const FieldError: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
73
+ match: {
74
+ type: PropType<boolean | ValidityKey>;
75
+ default: undefined;
76
+ };
77
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
78
+ [key: string]: any;
79
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
80
+ [key: string]: any;
81
+ }>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
82
+ match: {
83
+ type: PropType<boolean | ValidityKey>;
84
+ default: undefined;
85
+ };
86
+ }>> & Readonly<{}>, {
87
+ match: boolean | ValidityKey;
88
+ }, PartSlots<import("@ui-sdk/core/field").FieldPrimitive, "error">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
89
+ /**
90
+ * A native control: an <input> by default, or anything through the `render` slot.
91
+ * @stable
92
+ */
93
+ declare const FieldControl: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
94
+ [key: string]: any;
95
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
96
+ [key: string]: any;
97
+ }>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/field").FieldPrimitive, "control">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "input">;
98
+ /**
99
+ * A native <fieldset>, so `disabled` disables every control inside it.
100
+ * @stable
101
+ */
102
+ declare const FieldSet: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
103
+ disabled: {
104
+ type: BooleanConstructor;
105
+ default: undefined;
106
+ };
107
+ debug: {
108
+ type: BooleanConstructor;
109
+ default: undefined;
110
+ };
111
+ }>, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
112
+ [key: string]: any;
113
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
114
+ [key: string]: any;
115
+ }>[] | null) & {
116
+ state: NoInfer<import("@ui-sdk/core/field").FieldSetState>;
117
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
118
+ disabled: {
119
+ type: BooleanConstructor;
120
+ default: undefined;
121
+ };
122
+ debug: {
123
+ type: BooleanConstructor;
124
+ default: undefined;
125
+ };
126
+ }>> & Readonly<{}>, {
127
+ disabled: boolean;
128
+ debug: boolean;
129
+ }, PartSlots<import("@ui-sdk/core/field").FieldSetPrimitive, "set">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "fieldset">;
130
+ /**
131
+ * Names the field set. Keep it the set's first child, where a <legend> names it natively.
132
+ * @stable
133
+ */
134
+ declare const FieldLegend: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
135
+ [key: string]: any;
136
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
137
+ [key: string]: any;
138
+ }>[] | null) & {
139
+ state: NoInfer<import("@ui-sdk/core/field").FieldSetState>;
140
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/field").FieldSetPrimitive, "legend">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "legend">;
141
+ /**
142
+ * Lays fields out. It has no role: a FieldSet is what names and disables a group.
143
+ * @stable
144
+ */
145
+ declare const FieldGroup: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
146
+ [key: string]: any;
147
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
148
+ [key: string]: any;
149
+ }>[] | null) & {
150
+ state: {};
151
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/field").FieldGroupPrimitive, "group">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
152
+ export { useFieldControl } from "./field-context.js";
153
+ export { Field, FieldControl, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSet, };
154
+ export type { FieldApi, FieldDescriptionState, FieldErrorProps, FieldErrorState, FieldGroupPrimitive, FieldOptions, FieldPrimitive, FieldSetOptions, FieldSetPrimitive, FieldSetState, FieldState, ValidityKey, } from "@ui-sdk/core/field";