@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,311 @@
1
+ import type { ChangeDetails } from "@ui-sdk/core";
2
+ import { type CalendarAnchorChangeReason, type CalendarController, type CalendarFocusedChangeReason, type CalendarGridCell, type CalendarMode, type CalendarMonthChangeReason, type CalendarSelectState, type CalendarValue, type CalendarValueChangeReason, type DateMatchers, type ISOMonth } from "@ui-sdk/core/calendar";
3
+ import type { ISODate } from "@ui-sdk/core/date";
4
+ import { type PropType, type SlotsType, type VNode } from "vue";
5
+ import { type PartSlots } from "./use-primitive.js";
6
+ /**
7
+ * Months of days with one tab stop. Without content it renders Previous, the
8
+ * heading and Next, and a grid for each month.
9
+ * @stable
10
+ */
11
+ declare const Calendar: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
12
+ mode: PropType<CalendarMode>;
13
+ value: {
14
+ type: PropType<CalendarValue>;
15
+ default: undefined;
16
+ };
17
+ modelValue: {
18
+ type: PropType<CalendarValue>;
19
+ default: undefined;
20
+ };
21
+ defaultValue: {
22
+ type: PropType<CalendarValue>;
23
+ default: undefined;
24
+ };
25
+ month: PropType<ISOMonth>;
26
+ defaultMonth: PropType<ISOMonth>;
27
+ min: StringConstructor;
28
+ max: StringConstructor;
29
+ unavailable: PropType<DateMatchers>;
30
+ disabled: {
31
+ type: BooleanConstructor;
32
+ default: undefined;
33
+ };
34
+ readOnly: {
35
+ type: BooleanConstructor;
36
+ default: undefined;
37
+ };
38
+ deselectable: {
39
+ type: BooleanConstructor;
40
+ default: undefined;
41
+ };
42
+ months: NumberConstructor;
43
+ pageBy: PropType<"month" | "page">;
44
+ locale: StringConstructor;
45
+ weekStartsOn: NumberConstructor;
46
+ weekdayFormat: PropType<"narrow" | "short" | "long">;
47
+ monthFormat: PropType<"narrow" | "short" | "long">;
48
+ fixedWeeks: {
49
+ type: BooleanConstructor;
50
+ default: undefined;
51
+ };
52
+ showOutsideDays: {
53
+ type: BooleanConstructor;
54
+ default: undefined;
55
+ };
56
+ today: StringConstructor;
57
+ timeZone: StringConstructor;
58
+ minDays: NumberConstructor;
59
+ maxDays: NumberConstructor;
60
+ allowUnavailable: {
61
+ type: BooleanConstructor;
62
+ default: undefined;
63
+ };
64
+ controller: PropType<CalendarController>;
65
+ debug: {
66
+ type: BooleanConstructor;
67
+ default: undefined;
68
+ };
69
+ }>, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
70
+ [key: string]: any;
71
+ }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
72
+ [key: string]: any;
73
+ }>[] | null) & {
74
+ state: NoInfer<import("@ui-sdk/core/calendar").CalendarState>;
75
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
76
+ "update:value": (_value: CalendarValue) => true;
77
+ "update:modelValue": (_value: CalendarValue) => true;
78
+ valueChange: (_value: CalendarValue, _details: ChangeDetails<CalendarValueChangeReason>) => true;
79
+ "update:month": (_month: ISOMonth) => true;
80
+ monthChange: (_month: ISOMonth, _details: ChangeDetails<CalendarMonthChangeReason>) => true;
81
+ focusedChange: (_date: ISODate, _details: ChangeDetails<CalendarFocusedChangeReason>) => true;
82
+ anchorChange: (_anchor: ISODate | null, _details: ChangeDetails<CalendarAnchorChangeReason>) => true;
83
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
84
+ mode: PropType<CalendarMode>;
85
+ value: {
86
+ type: PropType<CalendarValue>;
87
+ default: undefined;
88
+ };
89
+ modelValue: {
90
+ type: PropType<CalendarValue>;
91
+ default: undefined;
92
+ };
93
+ defaultValue: {
94
+ type: PropType<CalendarValue>;
95
+ default: undefined;
96
+ };
97
+ month: PropType<ISOMonth>;
98
+ defaultMonth: PropType<ISOMonth>;
99
+ min: StringConstructor;
100
+ max: StringConstructor;
101
+ unavailable: PropType<DateMatchers>;
102
+ disabled: {
103
+ type: BooleanConstructor;
104
+ default: undefined;
105
+ };
106
+ readOnly: {
107
+ type: BooleanConstructor;
108
+ default: undefined;
109
+ };
110
+ deselectable: {
111
+ type: BooleanConstructor;
112
+ default: undefined;
113
+ };
114
+ months: NumberConstructor;
115
+ pageBy: PropType<"month" | "page">;
116
+ locale: StringConstructor;
117
+ weekStartsOn: NumberConstructor;
118
+ weekdayFormat: PropType<"narrow" | "short" | "long">;
119
+ monthFormat: PropType<"narrow" | "short" | "long">;
120
+ fixedWeeks: {
121
+ type: BooleanConstructor;
122
+ default: undefined;
123
+ };
124
+ showOutsideDays: {
125
+ type: BooleanConstructor;
126
+ default: undefined;
127
+ };
128
+ today: StringConstructor;
129
+ timeZone: StringConstructor;
130
+ minDays: NumberConstructor;
131
+ maxDays: NumberConstructor;
132
+ allowUnavailable: {
133
+ type: BooleanConstructor;
134
+ default: undefined;
135
+ };
136
+ controller: PropType<CalendarController>;
137
+ debug: {
138
+ type: BooleanConstructor;
139
+ default: undefined;
140
+ };
141
+ }>> & Readonly<{
142
+ "onUpdate:modelValue"?: ((_value: CalendarValue) => any) | undefined;
143
+ "onUpdate:value"?: ((_value: CalendarValue) => any) | undefined;
144
+ onValueChange?: ((_value: CalendarValue, _details: ChangeDetails<CalendarValueChangeReason>) => any) | undefined;
145
+ "onUpdate:month"?: ((_month: string) => any) | undefined;
146
+ onMonthChange?: ((_month: string, _details: ChangeDetails<CalendarMonthChangeReason>) => any) | undefined;
147
+ onFocusedChange?: ((_date: string, _details: ChangeDetails<CalendarFocusedChangeReason>) => any) | undefined;
148
+ onAnchorChange?: ((_anchor: string | null, _details: ChangeDetails<CalendarAnchorChangeReason>) => any) | undefined;
149
+ }>, {
150
+ value: CalendarValue;
151
+ disabled: boolean;
152
+ debug: boolean;
153
+ defaultValue: CalendarValue;
154
+ readOnly: boolean;
155
+ deselectable: boolean;
156
+ modelValue: CalendarValue;
157
+ fixedWeeks: boolean;
158
+ showOutsideDays: boolean;
159
+ allowUnavailable: boolean;
160
+ }, PartSlots<import("@ui-sdk/core/calendar").CalendarPrimitive, "root">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
161
+ /**
162
+ * The months shown, like "October 2026". Screen readers hear it change.
163
+ * @stable
164
+ */
165
+ declare const CalendarHeading: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
166
+ [key: string]: any;
167
+ }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
168
+ [key: string]: any;
169
+ }>[] | null) & {
170
+ state: NoInfer<import("@ui-sdk/core/calendar").CalendarHeadingState>;
171
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/calendar").CalendarPrimitive, "heading">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "h2">;
172
+ /**
173
+ * A native select of the months, in the locale, that turns the first month shown.
174
+ * @stable
175
+ */
176
+ declare const CalendarMonthSelect: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
177
+ [key: string]: any;
178
+ }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
179
+ [key: string]: any;
180
+ }>[] | null) & {
181
+ state: NoInfer<CalendarSelectState>;
182
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/calendar").CalendarPrimitive, "month-select">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "select">;
183
+ /**
184
+ * A native select of the years from `min` to `max`, or 10 either side of the year shown.
185
+ * @stable
186
+ */
187
+ declare const CalendarYearSelect: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
188
+ [key: string]: any;
189
+ }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
190
+ [key: string]: any;
191
+ }>[] | null) & {
192
+ state: NoInfer<CalendarSelectState>;
193
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/calendar").CalendarPrimitive, "year-select">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "select">;
194
+ /**
195
+ * Shows the month before. Named "Previous month"; pass `aria-label` in another language.
196
+ * @stable
197
+ */
198
+ declare const CalendarPrevious: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
199
+ [key: string]: any;
200
+ }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
201
+ [key: string]: any;
202
+ }>[] | null) & {
203
+ state: NoInfer<import("@ui-sdk/core/calendar").CalendarStepState>;
204
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/calendar").CalendarPrimitive, "previous">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "button">;
205
+ /**
206
+ * Shows the month after. Named "Next month"; pass `aria-label` in another language.
207
+ * @stable
208
+ */
209
+ declare const CalendarNext: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
210
+ [key: string]: any;
211
+ }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
212
+ [key: string]: any;
213
+ }>[] | null) & {
214
+ state: NoInfer<import("@ui-sdk/core/calendar").CalendarStepState>;
215
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/calendar").CalendarPrimitive, "next">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "button">;
216
+ /**
217
+ * One month's grid, a table. `offset` picks which of the months shown, from 0.
218
+ * Without content it renders its weekdays and weeks.
219
+ * @stable
220
+ */
221
+ declare const CalendarGrid: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
222
+ offset: {
223
+ type: NumberConstructor;
224
+ default: number;
225
+ };
226
+ }>, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
227
+ [key: string]: any;
228
+ }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
229
+ [key: string]: any;
230
+ }>[] | null) & {
231
+ state: NoInfer<import("@ui-sdk/core/calendar").CalendarGridState>;
232
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
233
+ offset: {
234
+ type: NumberConstructor;
235
+ default: number;
236
+ };
237
+ }>> & Readonly<{}>, {
238
+ offset: number;
239
+ }, PartSlots<import("@ui-sdk/core/calendar").CalendarPrimitive, "grid">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "table">;
240
+ /**
241
+ * The header row of weekday names, a weekday in each column. Its default slot
242
+ * gets `{ index }` and renders the column's header, like
243
+ * `<CalendarWeekday :index="index" class="…" />`.
244
+ * @stable
245
+ */
246
+ declare const CalendarWeekdays: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
247
+ [key: string]: any;
248
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, SlotsType<{
249
+ default?: (scope: {
250
+ index: number;
251
+ }) => VNode[];
252
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "thead">;
253
+ /**
254
+ * A weekday's column header. Shows its name in `weekdayFormat` unless it has content.
255
+ * @stable
256
+ */
257
+ declare const CalendarWeekday: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
258
+ index: {
259
+ type: NumberConstructor;
260
+ required: true;
261
+ };
262
+ }>, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
263
+ [key: string]: any;
264
+ }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
265
+ [key: string]: any;
266
+ }>[] | null) & {
267
+ state: NoInfer<import("@ui-sdk/core/calendar").CalendarWeekdayState>;
268
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
269
+ index: {
270
+ type: NumberConstructor;
271
+ required: true;
272
+ };
273
+ }>> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/calendar").CalendarPrimitive, "weekday">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "th">;
274
+ /**
275
+ * The weeks of the grid's month, a row each, with a day in each cell. Its
276
+ * default slot gets `{ cell }` and renders the cell's day, like
277
+ * `<CalendarDay :value="cell.date" class="…" />`. A cell that shows nothing
278
+ * stays an empty cell.
279
+ * @stable
280
+ */
281
+ declare const CalendarWeeks: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
282
+ [key: string]: any;
283
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, SlotsType<{
284
+ default?: (scope: {
285
+ cell: CalendarGridCell;
286
+ }) => VNode[];
287
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "tbody">;
288
+ /**
289
+ * A day. Shows the day of the month unless it has content; arrow keys move between days.
290
+ * @stable
291
+ */
292
+ declare const CalendarDay: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
293
+ value: {
294
+ type: StringConstructor;
295
+ required: true;
296
+ };
297
+ }>, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
298
+ [key: string]: any;
299
+ }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
300
+ [key: string]: any;
301
+ }>[] | null) & {
302
+ state: NoInfer<import("@ui-sdk/core/calendar").CalendarDayState>;
303
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
304
+ value: {
305
+ type: StringConstructor;
306
+ required: true;
307
+ };
308
+ }>> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/calendar").CalendarPrimitive, "day">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "td">;
309
+ export { createCalendarController } from "@ui-sdk/core/calendar";
310
+ export type { CalendarAnchorChangeReason, CalendarApi, CalendarChangeOptions, CalendarController, CalendarDayProps, CalendarDayState, CalendarFocusedChangeReason, CalendarGridCell, CalendarGridProps, CalendarGridState, CalendarHeadingState, CalendarMode, CalendarMonthChangeReason, CalendarOptions, CalendarPrimitive, CalendarSelectOption, CalendarSelectState, CalendarState, CalendarStepState, CalendarValue, CalendarValueChangeReason, CalendarWeekdayProps, CalendarWeekdayState, DateMatcher, DateMatchers, ISOMonth, } from "@ui-sdk/core/calendar";
311
+ export { Calendar, CalendarDay, CalendarGrid, CalendarHeading, CalendarMonthSelect, CalendarNext, CalendarPrevious, CalendarWeekday, CalendarWeekdays, CalendarWeeks, CalendarYearSelect, };
@@ -0,0 +1,349 @@
1
+ // src/calendar.ts
2
+ import {
3
+ calendar as calendarPrimitive
4
+ } from "@ui-sdk/core/calendar";
5
+ import {
6
+ defineComponent,
7
+ Fragment,
8
+ h,
9
+ inject,
10
+ provide
11
+ } from "vue";
12
+ import { CalendarKey, GridKey } from "./calendar-context.js";
13
+ import { slotContent } from "./children.js";
14
+ import { withElement } from "./create-parts.js";
15
+ import {
16
+ optionalBoolean,
17
+ orModel,
18
+ usePart,
19
+ usePrimitive
20
+ } from "./use-primitive.js";
21
+ import { readOnlyOf } from "./text-control.js";
22
+ import { createCalendarController } from "@ui-sdk/core/calendar";
23
+ function useCalendar(part) {
24
+ const context = inject(CalendarKey);
25
+ if (!context) {
26
+ throw new Error(
27
+ `${part} must be used inside <Calendar> or <DatePickerContent>.`
28
+ );
29
+ }
30
+ return context;
31
+ }
32
+ function useGrid(part) {
33
+ const context = inject(GridKey);
34
+ if (!context) {
35
+ throw new Error(`${part} must be used inside <CalendarGrid>.`);
36
+ }
37
+ return context;
38
+ }
39
+ var calendarValue = {
40
+ type: null,
41
+ default: void 0
42
+ };
43
+ var Calendar = withElement(
44
+ "div",
45
+ defineComponent({
46
+ name: "Calendar",
47
+ inheritAttrs: false,
48
+ props: {
49
+ mode: String,
50
+ value: calendarValue,
51
+ modelValue: calendarValue,
52
+ defaultValue: calendarValue,
53
+ month: String,
54
+ defaultMonth: String,
55
+ min: String,
56
+ max: String,
57
+ unavailable: null,
58
+ disabled: optionalBoolean,
59
+ readOnly: optionalBoolean,
60
+ deselectable: optionalBoolean,
61
+ months: Number,
62
+ pageBy: String,
63
+ locale: String,
64
+ weekStartsOn: Number,
65
+ weekdayFormat: String,
66
+ monthFormat: String,
67
+ fixedWeeks: optionalBoolean,
68
+ showOutsideDays: optionalBoolean,
69
+ today: String,
70
+ timeZone: String,
71
+ minDays: Number,
72
+ maxDays: Number,
73
+ allowUnavailable: optionalBoolean,
74
+ controller: Object,
75
+ debug: optionalBoolean
76
+ },
77
+ emits: {
78
+ "update:value": (_value) => true,
79
+ "update:modelValue": (_value) => true,
80
+ valueChange: (_value, _details) => true,
81
+ "update:month": (_month) => true,
82
+ monthChange: (_month, _details) => true,
83
+ focusedChange: (_date, _details) => true,
84
+ anchorChange: (_anchor, _details) => true
85
+ },
86
+ slots: Object,
87
+ setup(props, { slots, attrs, emit }) {
88
+ const calendar = usePrimitive(calendarPrimitive, () => ({
89
+ mode: props.mode,
90
+ value: orModel(props.value, props.modelValue),
91
+ defaultValue: props.defaultValue,
92
+ month: props.month,
93
+ defaultMonth: props.defaultMonth,
94
+ min: props.min,
95
+ max: props.max,
96
+ unavailable: props.unavailable,
97
+ disabled: props.disabled,
98
+ readOnly: readOnlyOf(props, attrs),
99
+ deselectable: props.deselectable,
100
+ onFocusedChange: (date, details) => emit("focusedChange", date, details),
101
+ onAnchorChange: (anchor, details) => emit("anchorChange", anchor, details),
102
+ months: props.months,
103
+ pageBy: props.pageBy,
104
+ locale: props.locale,
105
+ weekStartsOn: props.weekStartsOn,
106
+ weekdayFormat: props.weekdayFormat,
107
+ monthFormat: props.monthFormat,
108
+ fixedWeeks: props.fixedWeeks,
109
+ showOutsideDays: props.showOutsideDays,
110
+ today: props.today,
111
+ timeZone: props.timeZone,
112
+ minDays: props.minDays,
113
+ maxDays: props.maxDays,
114
+ allowUnavailable: props.allowUnavailable,
115
+ controller: props.controller,
116
+ debug: props.debug,
117
+ // The change events run first, so canceling one also keeps v-model as it was.
118
+ onValueChange: (value, details) => {
119
+ emit("valueChange", value, details);
120
+ if (details.canceled) {
121
+ return;
122
+ }
123
+ emit("update:value", value);
124
+ emit("update:modelValue", value);
125
+ },
126
+ onMonthChange: (month, details) => {
127
+ emit("monthChange", month, details);
128
+ if (!details.canceled) {
129
+ emit("update:month", month);
130
+ }
131
+ }
132
+ }));
133
+ provide(CalendarKey, calendar);
134
+ const defaultContent = () => [
135
+ h("div", [h(CalendarPrevious), h(CalendarHeading), h(CalendarNext)]),
136
+ ...Array.from(
137
+ { length: Math.max(1, Math.floor(props.months ?? 1) || 1) },
138
+ (_, offset) => h(CalendarGrid, { key: offset, offset })
139
+ )
140
+ ];
141
+ return usePart(calendar, "root", void 0, void 0, {
142
+ tag: "div",
143
+ children: (state) => slotContent(slots.default, { state }) ?? defaultContent()
144
+ });
145
+ }
146
+ })
147
+ );
148
+ var CalendarHeading = withElement(
149
+ "h2",
150
+ defineComponent({
151
+ name: "CalendarHeading",
152
+ inheritAttrs: false,
153
+ slots: Object,
154
+ setup(_, { slots }) {
155
+ const calendar = useCalendar("CalendarHeading");
156
+ return usePart(calendar, "heading", void 0, void 0, {
157
+ tag: "h2",
158
+ children: (state) => slotContent(slots.default, { state }) ?? state.label
159
+ });
160
+ }
161
+ })
162
+ );
163
+ function selectPart(name, slot) {
164
+ return withElement(
165
+ "select",
166
+ defineComponent({
167
+ name,
168
+ inheritAttrs: false,
169
+ slots: Object,
170
+ setup(_, { slots }) {
171
+ const calendar = useCalendar(name);
172
+ const options = (state) => state.options.map(
173
+ (option) => h(
174
+ "option",
175
+ {
176
+ key: option.value,
177
+ value: option.value,
178
+ disabled: option.disabled,
179
+ selected: option.value === state.value
180
+ },
181
+ option.label
182
+ )
183
+ );
184
+ return usePart(calendar, slot, void 0, void 0, {
185
+ tag: "select",
186
+ children: (state) => slotContent(slots.default, { state }) ?? options(state),
187
+ // The selected option carries the value, not the select.
188
+ extend: ({ value: _2, ...part }) => part
189
+ });
190
+ }
191
+ })
192
+ );
193
+ }
194
+ var CalendarMonthSelect = selectPart("CalendarMonthSelect", "month-select");
195
+ var CalendarYearSelect = selectPart("CalendarYearSelect", "year-select");
196
+ function stepPart(name, slot, text) {
197
+ return withElement(
198
+ "button",
199
+ defineComponent({
200
+ name,
201
+ inheritAttrs: false,
202
+ slots: Object,
203
+ setup(_, { slots }) {
204
+ const calendar = useCalendar(name);
205
+ return usePart(calendar, slot, void 0, void 0, {
206
+ tag: "button",
207
+ children: (state) => slotContent(slots.default, { state }) ?? text
208
+ });
209
+ }
210
+ })
211
+ );
212
+ }
213
+ var CalendarPrevious = stepPart("CalendarPrevious", "previous", "\u2039");
214
+ var CalendarNext = stepPart("CalendarNext", "next", "\u203A");
215
+ var CalendarGrid = withElement(
216
+ "table",
217
+ defineComponent({
218
+ name: "CalendarGrid",
219
+ inheritAttrs: false,
220
+ props: { offset: { type: Number, default: 0 } },
221
+ slots: Object,
222
+ setup(props, { slots }) {
223
+ const calendar = useCalendar("CalendarGrid");
224
+ const part = () => ({ offset: props.offset, id: String(props.offset) });
225
+ const grid = usePart(calendar, "grid", part, void 0, {
226
+ tag: "table",
227
+ children: (state) => slotContent(slots.default, { state }) ?? [
228
+ h(CalendarWeekdays),
229
+ h(CalendarWeeks)
230
+ ]
231
+ });
232
+ provide(GridKey, { offset: () => props.offset, state: grid.state });
233
+ return grid;
234
+ }
235
+ })
236
+ );
237
+ var CalendarWeekdays = withElement(
238
+ "thead",
239
+ defineComponent({
240
+ name: "CalendarWeekdays",
241
+ inheritAttrs: false,
242
+ slots: Object,
243
+ setup(_, { slots, attrs }) {
244
+ const calendar = useCalendar("CalendarWeekdays");
245
+ const grid = useGrid("CalendarWeekdays");
246
+ return () => h(
247
+ "thead",
248
+ attrs,
249
+ h(
250
+ "tr",
251
+ calendar.slot("weekdays", { id: String(grid.offset()) }),
252
+ grid.state.weekdays.map(
253
+ (weekday, index) => slots.default ? h(Fragment, { key: weekday }, slots.default({ index })) : h(CalendarWeekday, { key: weekday, index })
254
+ )
255
+ )
256
+ );
257
+ }
258
+ })
259
+ );
260
+ var CalendarWeekday = withElement(
261
+ "th",
262
+ defineComponent({
263
+ name: "CalendarWeekday",
264
+ inheritAttrs: false,
265
+ props: { index: { type: Number, required: true } },
266
+ slots: Object,
267
+ setup(props, { slots, attrs }) {
268
+ const calendar = useCalendar("CalendarWeekday");
269
+ const grid = useGrid("CalendarWeekday");
270
+ const part = () => ({
271
+ index: props.index,
272
+ id: `${grid.offset()}-${props.index}`
273
+ });
274
+ return usePart(
275
+ calendar,
276
+ "weekday",
277
+ part,
278
+ () => ({ scope: "col", ...attrs }),
279
+ {
280
+ tag: "th",
281
+ children: (state) => slotContent(slots.default, { state }) ?? state.label
282
+ }
283
+ );
284
+ }
285
+ })
286
+ );
287
+ var CalendarWeeks = withElement(
288
+ "tbody",
289
+ defineComponent({
290
+ name: "CalendarWeeks",
291
+ inheritAttrs: false,
292
+ slots: Object,
293
+ setup(_, { slots, attrs }) {
294
+ const calendar = useCalendar("CalendarWeeks");
295
+ const grid = useGrid("CalendarWeeks");
296
+ return () => {
297
+ const offset = grid.offset();
298
+ return h(
299
+ "tbody",
300
+ attrs,
301
+ grid.state.weeks.map(
302
+ (week, index) => h(
303
+ "tr",
304
+ {
305
+ key: week[0].date,
306
+ ...calendar.slot("week", { id: `${offset}-${index}` })
307
+ },
308
+ week.map(
309
+ (cell) => cell.hidden ? h("td", { key: cell.date }) : slots.default ? h(Fragment, { key: cell.date }, slots.default({ cell })) : h(CalendarDay, { key: cell.date, value: cell.date })
310
+ )
311
+ )
312
+ )
313
+ );
314
+ };
315
+ }
316
+ })
317
+ );
318
+ var CalendarDay = withElement(
319
+ "td",
320
+ defineComponent({
321
+ name: "CalendarDay",
322
+ inheritAttrs: false,
323
+ props: { value: { type: String, required: true } },
324
+ slots: Object,
325
+ setup(props, { slots }) {
326
+ const calendar = useCalendar("CalendarDay");
327
+ const grid = inject(GridKey, null);
328
+ const part = () => ({ value: props.value, offset: grid?.offset() ?? 0 });
329
+ return usePart(calendar, "day", part, void 0, {
330
+ tag: "td",
331
+ children: (state) => slotContent(slots.default, { state }) ?? state.label
332
+ });
333
+ }
334
+ })
335
+ );
336
+ export {
337
+ Calendar,
338
+ CalendarDay,
339
+ CalendarGrid,
340
+ CalendarHeading,
341
+ CalendarMonthSelect,
342
+ CalendarNext,
343
+ CalendarPrevious,
344
+ CalendarWeekday,
345
+ CalendarWeekdays,
346
+ CalendarWeeks,
347
+ CalendarYearSelect,
348
+ createCalendarController
349
+ };