macbetter 0.0.0-stage → 0.1.0-beta.2

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 (310) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +92 -2
  3. package/dist/components/accessory-tile.d.ts +50 -0
  4. package/dist/components/accessory-tile.js +46 -0
  5. package/dist/components/activity-indicator.d.ts +15 -0
  6. package/dist/components/activity-indicator.js +15 -0
  7. package/dist/components/alert.d.ts +29 -0
  8. package/dist/components/alert.js +30 -0
  9. package/dist/components/artifact-card.d.ts +41 -0
  10. package/dist/components/artifact-card.js +57 -0
  11. package/dist/components/artwork.d.ts +44 -0
  12. package/dist/components/artwork.js +935 -0
  13. package/dist/components/attachment.d.ts +48 -0
  14. package/dist/components/attachment.js +65 -0
  15. package/dist/components/automation-row.d.ts +24 -0
  16. package/dist/components/automation-row.js +12 -0
  17. package/dist/components/avatar.d.ts +33 -0
  18. package/dist/components/avatar.js +45 -0
  19. package/dist/components/badge.d.ts +24 -0
  20. package/dist/components/badge.js +19 -0
  21. package/dist/components/button.d.ts +20 -0
  22. package/dist/components/button.js +10 -0
  23. package/dist/components/calendar.d.ts +30 -0
  24. package/dist/components/calendar.js +47 -0
  25. package/dist/components/camera-view.d.ts +40 -0
  26. package/dist/components/camera-view.js +44 -0
  27. package/dist/components/card.d.ts +14 -0
  28. package/dist/components/card.js +21 -0
  29. package/dist/components/carousel.d.ts +18 -0
  30. package/dist/components/carousel.js +33 -0
  31. package/dist/components/chat.d.ts +29 -0
  32. package/dist/components/chat.js +29 -0
  33. package/dist/components/checkbox.d.ts +13 -0
  34. package/dist/components/checkbox.js +16 -0
  35. package/dist/components/code-block.d.ts +39 -0
  36. package/dist/components/code-block.js +65 -0
  37. package/dist/components/code-field.d.ts +16 -0
  38. package/dist/components/code-field.js +29 -0
  39. package/dist/components/color-well.d.ts +23 -0
  40. package/dist/components/color-well.js +27 -0
  41. package/dist/components/combo-box.d.ts +42 -0
  42. package/dist/components/combo-box.js +102 -0
  43. package/dist/components/command-palette.d.ts +33 -0
  44. package/dist/components/command-palette.js +55 -0
  45. package/dist/components/confirmation.d.ts +24 -0
  46. package/dist/components/confirmation.js +50 -0
  47. package/dist/components/content-unavailable.d.ts +19 -0
  48. package/dist/components/content-unavailable.js +21 -0
  49. package/dist/components/context-menu.d.ts +9 -0
  50. package/dist/components/context-menu.js +15 -0
  51. package/dist/components/date-picker.d.ts +53 -0
  52. package/dist/components/date-picker.js +86 -0
  53. package/dist/components/description-list.d.ts +18 -0
  54. package/dist/components/description-list.js +17 -0
  55. package/dist/components/device-frame.d.ts +18 -0
  56. package/dist/components/device-frame.js +16 -0
  57. package/dist/components/dialog.d.ts +27 -0
  58. package/dist/components/dialog.js +35 -0
  59. package/dist/components/disclosure.d.ts +32 -0
  60. package/dist/components/disclosure.js +35 -0
  61. package/dist/components/dock.d.ts +28 -0
  62. package/dist/components/dock.js +80 -0
  63. package/dist/components/door-control.d.ts +20 -0
  64. package/dist/components/door-control.js +43 -0
  65. package/dist/components/energy-readout.d.ts +32 -0
  66. package/dist/components/energy-readout.js +27 -0
  67. package/dist/components/field.d.ts +28 -0
  68. package/dist/components/field.js +32 -0
  69. package/dist/components/gauge.d.ts +25 -0
  70. package/dist/components/gauge.js +42 -0
  71. package/dist/components/generated-image.d.ts +39 -0
  72. package/dist/components/generated-image.js +47 -0
  73. package/dist/components/glass.d.ts +34 -0
  74. package/dist/components/glass.js +31 -0
  75. package/dist/components/home-backdrop.d.ts +23 -0
  76. package/dist/components/home-backdrop.js +12 -0
  77. package/dist/components/home-section.d.ts +19 -0
  78. package/dist/components/home-section.js +21 -0
  79. package/dist/components/home-status.d.ts +24 -0
  80. package/dist/components/home-status.js +14 -0
  81. package/dist/components/hover-card.d.ts +14 -0
  82. package/dist/components/hover-card.js +16 -0
  83. package/dist/components/inspector.d.ts +29 -0
  84. package/dist/components/inspector.js +40 -0
  85. package/dist/components/level-control.d.ts +19 -0
  86. package/dist/components/level-control.js +13 -0
  87. package/dist/components/light-color-picker.d.ts +33 -0
  88. package/dist/components/light-color-picker.js +56 -0
  89. package/dist/components/list.d.ts +42 -0
  90. package/dist/components/list.js +42 -0
  91. package/dist/components/listbox.d.ts +16 -0
  92. package/dist/components/listbox.js +28 -0
  93. package/dist/components/lock-control.d.ts +20 -0
  94. package/dist/components/lock-control.js +35 -0
  95. package/dist/components/menu-bar.d.ts +14 -0
  96. package/dist/components/menu-bar.js +16 -0
  97. package/dist/components/menu.d.ts +40 -0
  98. package/dist/components/menu.js +54 -0
  99. package/dist/components/message.d.ts +65 -0
  100. package/dist/components/message.js +69 -0
  101. package/dist/components/model-picker.d.ts +61 -0
  102. package/dist/components/model-picker.js +59 -0
  103. package/dist/components/navigation-bar.d.ts +24 -0
  104. package/dist/components/navigation-bar.js +54 -0
  105. package/dist/components/outline.d.ts +21 -0
  106. package/dist/components/outline.js +40 -0
  107. package/dist/components/page-control.d.ts +10 -0
  108. package/dist/components/page-control.js +8 -0
  109. package/dist/components/plan.d.ts +25 -0
  110. package/dist/components/plan.js +43 -0
  111. package/dist/components/popover.d.ts +16 -0
  112. package/dist/components/popover.js +24 -0
  113. package/dist/components/progress.d.ts +27 -0
  114. package/dist/components/progress.js +27 -0
  115. package/dist/components/prompt-input.d.ts +93 -0
  116. package/dist/components/prompt-input.js +172 -0
  117. package/dist/components/radio.d.ts +16 -0
  118. package/dist/components/radio.js +13 -0
  119. package/dist/components/rating.d.ts +10 -0
  120. package/dist/components/rating.js +12 -0
  121. package/dist/components/reasoning.d.ts +28 -0
  122. package/dist/components/reasoning.js +52 -0
  123. package/dist/components/response.d.ts +14 -0
  124. package/dist/components/response.js +14 -0
  125. package/dist/components/scene-tile.d.ts +22 -0
  126. package/dist/components/scene-tile.js +13 -0
  127. package/dist/components/scroll-view.d.ts +21 -0
  128. package/dist/components/scroll-view.js +13 -0
  129. package/dist/components/search-field.d.ts +16 -0
  130. package/dist/components/search-field.js +12 -0
  131. package/dist/components/secure-field.d.ts +23 -0
  132. package/dist/components/secure-field.js +21 -0
  133. package/dist/components/segmented-control.d.ts +12 -0
  134. package/dist/components/segmented-control.js +10 -0
  135. package/dist/components/select.d.ts +45 -0
  136. package/dist/components/select.js +79 -0
  137. package/dist/components/sensor-readout.d.ts +29 -0
  138. package/dist/components/sensor-readout.js +12 -0
  139. package/dist/components/separator.d.ts +14 -0
  140. package/dist/components/separator.js +11 -0
  141. package/dist/components/setup-code.d.ts +29 -0
  142. package/dist/components/setup-code.js +47 -0
  143. package/dist/components/sheet.d.ts +31 -0
  144. package/dist/components/sheet.js +51 -0
  145. package/dist/components/shimmer.d.ts +18 -0
  146. package/dist/components/shimmer.js +17 -0
  147. package/dist/components/sidebar.d.ts +30 -0
  148. package/dist/components/sidebar.js +26 -0
  149. package/dist/components/slider.d.ts +27 -0
  150. package/dist/components/slider.js +43 -0
  151. package/dist/components/sources.d.ts +51 -0
  152. package/dist/components/sources.js +46 -0
  153. package/dist/components/split-view.d.ts +11 -0
  154. package/dist/components/split-view.js +13 -0
  155. package/dist/components/squircle.d.ts +41 -0
  156. package/dist/components/squircle.js +63 -0
  157. package/dist/components/stepper.d.ts +30 -0
  158. package/dist/components/stepper.js +28 -0
  159. package/dist/components/suggestion.d.ts +23 -0
  160. package/dist/components/suggestion.js +29 -0
  161. package/dist/components/switch.d.ts +10 -0
  162. package/dist/components/switch.js +10 -0
  163. package/dist/components/tab-bar.d.ts +20 -0
  164. package/dist/components/tab-bar.js +17 -0
  165. package/dist/components/table.d.ts +49 -0
  166. package/dist/components/table.js +179 -0
  167. package/dist/components/tabs.d.ts +16 -0
  168. package/dist/components/tabs.js +19 -0
  169. package/dist/components/text-area.d.ts +14 -0
  170. package/dist/components/text-area.js +9 -0
  171. package/dist/components/text-field.d.ts +26 -0
  172. package/dist/components/text-field.js +23 -0
  173. package/dist/components/thermostat-control.d.ts +30 -0
  174. package/dist/components/thermostat-control.js +139 -0
  175. package/dist/components/toast.d.ts +30 -0
  176. package/dist/components/toast.js +114 -0
  177. package/dist/components/toggle.d.ts +21 -0
  178. package/dist/components/toggle.js +19 -0
  179. package/dist/components/token-field.d.ts +31 -0
  180. package/dist/components/token-field.js +78 -0
  181. package/dist/components/tool-call.d.ts +48 -0
  182. package/dist/components/tool-call.js +77 -0
  183. package/dist/components/toolbar.d.ts +27 -0
  184. package/dist/components/toolbar.js +39 -0
  185. package/dist/components/tooltip.d.ts +11 -0
  186. package/dist/components/tooltip.js +18 -0
  187. package/dist/components/window.d.ts +56 -0
  188. package/dist/components/window.js +61 -0
  189. package/dist/index.d.ts +97 -0
  190. package/dist/index.js +98 -0
  191. package/dist/lib/agent-glyphs.d.ts +10 -0
  192. package/dist/lib/agent-glyphs.js +19 -0
  193. package/dist/lib/cx.d.ts +9 -0
  194. package/dist/lib/cx.js +14 -0
  195. package/dist/lib/derive.d.ts +53 -0
  196. package/dist/lib/derive.js +255 -0
  197. package/dist/lib/field-glyphs.d.ts +13 -0
  198. package/dist/lib/field-glyphs.js +28 -0
  199. package/dist/lib/menu-glyphs.d.ts +6 -0
  200. package/dist/lib/menu-glyphs.js +15 -0
  201. package/dist/lib/platform.d.ts +18 -0
  202. package/dist/lib/platform.js +17 -0
  203. package/dist/lib/squircle.d.ts +23 -0
  204. package/dist/lib/squircle.js +69 -0
  205. package/dist/lib/theme.d.ts +42 -0
  206. package/dist/lib/theme.js +62 -0
  207. package/dist/styles/base.css +115 -0
  208. package/dist/styles/components/accessory-tile.css +461 -0
  209. package/dist/styles/components/activity-indicator.css +63 -0
  210. package/dist/styles/components/alert.css +433 -0
  211. package/dist/styles/components/artifact-card.css +238 -0
  212. package/dist/styles/components/artwork.css +380 -0
  213. package/dist/styles/components/attachment.css +540 -0
  214. package/dist/styles/components/automation-row.css +52 -0
  215. package/dist/styles/components/avatar.css +230 -0
  216. package/dist/styles/components/badge.css +204 -0
  217. package/dist/styles/components/button.css +298 -0
  218. package/dist/styles/components/calendar.css +287 -0
  219. package/dist/styles/components/camera-view.css +239 -0
  220. package/dist/styles/components/card.css +100 -0
  221. package/dist/styles/components/carousel.css +210 -0
  222. package/dist/styles/components/chat.css +209 -0
  223. package/dist/styles/components/checkbox.css +212 -0
  224. package/dist/styles/components/code-block.css +162 -0
  225. package/dist/styles/components/code-field.css +163 -0
  226. package/dist/styles/components/color-well.css +452 -0
  227. package/dist/styles/components/combo-box.css +222 -0
  228. package/dist/styles/components/command-palette.css +379 -0
  229. package/dist/styles/components/confirmation.css +189 -0
  230. package/dist/styles/components/content-unavailable.css +105 -0
  231. package/dist/styles/components/context-menu.css +43 -0
  232. package/dist/styles/components/date-picker.css +356 -0
  233. package/dist/styles/components/description-list.css +92 -0
  234. package/dist/styles/components/device-frame.css +202 -0
  235. package/dist/styles/components/dialog.css +366 -0
  236. package/dist/styles/components/disclosure.css +197 -0
  237. package/dist/styles/components/dock.css +404 -0
  238. package/dist/styles/components/door-control.css +187 -0
  239. package/dist/styles/components/energy-readout.css +161 -0
  240. package/dist/styles/components/field.css +175 -0
  241. package/dist/styles/components/gauge.css +239 -0
  242. package/dist/styles/components/generated-image.css +248 -0
  243. package/dist/styles/components/glass.css +113 -0
  244. package/dist/styles/components/home-backdrop.css +81 -0
  245. package/dist/styles/components/home-section.css +100 -0
  246. package/dist/styles/components/home-status.css +215 -0
  247. package/dist/styles/components/hover-card.css +145 -0
  248. package/dist/styles/components/index.css +94 -0
  249. package/dist/styles/components/inspector.css +236 -0
  250. package/dist/styles/components/level-control.css +247 -0
  251. package/dist/styles/components/light-color-picker.css +94 -0
  252. package/dist/styles/components/list.css +411 -0
  253. package/dist/styles/components/listbox.css +168 -0
  254. package/dist/styles/components/lock-control.css +164 -0
  255. package/dist/styles/components/menu-bar.css +94 -0
  256. package/dist/styles/components/menu.css +454 -0
  257. package/dist/styles/components/message.css +236 -0
  258. package/dist/styles/components/model-picker.css +64 -0
  259. package/dist/styles/components/navigation-bar.css +249 -0
  260. package/dist/styles/components/outline.css +248 -0
  261. package/dist/styles/components/page-control.css +127 -0
  262. package/dist/styles/components/plan.css +212 -0
  263. package/dist/styles/components/popover.css +186 -0
  264. package/dist/styles/components/progress.css +228 -0
  265. package/dist/styles/components/prompt-input.css +503 -0
  266. package/dist/styles/components/radio.css +281 -0
  267. package/dist/styles/components/rating.css +122 -0
  268. package/dist/styles/components/reasoning.css +214 -0
  269. package/dist/styles/components/response.css +303 -0
  270. package/dist/styles/components/scene-tile.css +295 -0
  271. package/dist/styles/components/scroll-view.css +195 -0
  272. package/dist/styles/components/search-field.css +128 -0
  273. package/dist/styles/components/secure-field.css +189 -0
  274. package/dist/styles/components/segmented-control.css +183 -0
  275. package/dist/styles/components/select.css +290 -0
  276. package/dist/styles/components/sensor-readout.css +231 -0
  277. package/dist/styles/components/separator.css +62 -0
  278. package/dist/styles/components/setup-code.css +138 -0
  279. package/dist/styles/components/sheet.css +345 -0
  280. package/dist/styles/components/shimmer.css +60 -0
  281. package/dist/styles/components/sidebar.css +261 -0
  282. package/dist/styles/components/slider.css +208 -0
  283. package/dist/styles/components/sources.css +349 -0
  284. package/dist/styles/components/split-view.css +75 -0
  285. package/dist/styles/components/squircle.css +44 -0
  286. package/dist/styles/components/stepper.css +278 -0
  287. package/dist/styles/components/suggestion.css +203 -0
  288. package/dist/styles/components/switch.css +115 -0
  289. package/dist/styles/components/tab-bar.css +223 -0
  290. package/dist/styles/components/table.css +313 -0
  291. package/dist/styles/components/tabs.css +262 -0
  292. package/dist/styles/components/text-area.css +94 -0
  293. package/dist/styles/components/text-field.css +294 -0
  294. package/dist/styles/components/thermostat-control.css +214 -0
  295. package/dist/styles/components/toast.css +418 -0
  296. package/dist/styles/components/toggle.css +312 -0
  297. package/dist/styles/components/token-field.css +193 -0
  298. package/dist/styles/components/tool-call.css +391 -0
  299. package/dist/styles/components/toolbar.css +370 -0
  300. package/dist/styles/components/tooltip.css +69 -0
  301. package/dist/styles/components/window.css +428 -0
  302. package/dist/styles/index.css +17 -0
  303. package/dist/styles/materials.css +263 -0
  304. package/dist/styles/platforms.css +214 -0
  305. package/dist/styles/themes/ember.css +24 -0
  306. package/dist/styles/themes/graphite.css +16 -0
  307. package/dist/styles/themes/nebula.css +16 -0
  308. package/dist/styles/themes/system.css +28 -0
  309. package/dist/styles/tokens.css +299 -0
  310. package/package.json +82 -3
@@ -0,0 +1,19 @@
1
+ import { type RenderProp } from "@ui-sdk/react/primitive";
2
+ import type * as React from "react";
3
+ type ContentUnavailableProps = React.ComponentProps<"div"> & {
4
+ /** `sm` fits a sidebar or popover, `md` a pane, `lg` an empty window. */
5
+ size?: "sm" | "md" | "lg";
6
+ };
7
+ /** The empty state: an icon, a title, a description and actions, centered in the space it fills. */
8
+ declare function ContentUnavailable({ size, className, ...props }: ContentUnavailableProps): React.JSX.Element;
9
+ /** A large glyph above the title. Decorative: the title says what happened. */
10
+ declare function ContentUnavailableIcon({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
11
+ type ContentUnavailableTitleProps = React.ComponentProps<"h2"> & {
12
+ /** Renders a different heading level, such as `<h3 />`, to fit the page's outline. */
13
+ render?: RenderProp;
14
+ };
15
+ declare function ContentUnavailableTitle({ className, render, ...props }: ContentUnavailableTitleProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
16
+ declare function ContentUnavailableDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
17
+ declare function ContentUnavailableActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
18
+ export { ContentUnavailable, ContentUnavailableActions, ContentUnavailableDescription, ContentUnavailableIcon, ContentUnavailableTitle, };
19
+ export type { ContentUnavailableProps, ContentUnavailableTitleProps };
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { renderElement } from "@ui-sdk/react/primitive";
3
+ import { join } from "../lib/cx.js";
4
+ /** The empty state: an icon, a title, a description and actions, centered in the space it fills. */
5
+ function ContentUnavailable({ size = "md", className, ...props }) {
6
+ return _jsx("div", { "data-size": size, className: join("mb-content-unavailable", className), ...props });
7
+ }
8
+ /** A large glyph above the title. Decorative: the title says what happened. */
9
+ function ContentUnavailableIcon({ className, ...props }) {
10
+ return _jsx("span", { "aria-hidden": "true", className: join("mb-content-unavailable-icon", className), ...props });
11
+ }
12
+ function ContentUnavailableTitle({ className, render, ...props }) {
13
+ return renderElement("h2", { ...props, className: join("mb-content-unavailable-title", className) }, render);
14
+ }
15
+ function ContentUnavailableDescription({ className, ...props }) {
16
+ return _jsx("p", { className: join("mb-content-unavailable-description", className), ...props });
17
+ }
18
+ function ContentUnavailableActions({ className, ...props }) {
19
+ return _jsx("div", { className: join("mb-content-unavailable-actions", className), ...props });
20
+ }
21
+ export { ContentUnavailable, ContentUnavailableActions, ContentUnavailableDescription, ContentUnavailableIcon, ContentUnavailableTitle, };
@@ -0,0 +1,9 @@
1
+ import { MenuContent as MenuContentPrimitive, MenuContextTrigger as MenuContextTriggerPrimitive } from "@ui-sdk/react/menu";
2
+ import type { MenuProps } from "@ui-sdk/react/menu";
3
+ import type * as React from "react";
4
+ /** A menu opened from an area by right-click, long press, Shift+F10 or the context-menu key. */
5
+ declare function ContextMenu(props: MenuProps): React.JSX.Element;
6
+ /** The area that opens the menu. Give it `tabIndex={0}` so the keyboard can open it too. */
7
+ declare function ContextMenuTrigger({ className, ...props }: React.ComponentProps<typeof MenuContextTriggerPrimitive>): React.JSX.Element;
8
+ declare function ContextMenuContent<Payload = unknown>({ className, ...props }: React.ComponentProps<typeof MenuContentPrimitive<Payload>>): React.JSX.Element;
9
+ export { ContextMenu, ContextMenuContent, ContextMenuTrigger };
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Menu, MenuContent as MenuContentPrimitive, MenuContextTrigger as MenuContextTriggerPrimitive, } from "@ui-sdk/react/menu";
3
+ import { cx } from "../lib/cx.js";
4
+ /** A menu opened from an area by right-click, long press, Shift+F10 or the context-menu key. */
5
+ function ContextMenu(props) {
6
+ return _jsx(Menu, { ...props });
7
+ }
8
+ /** The area that opens the menu. Give it `tabIndex={0}` so the keyboard can open it too. */
9
+ function ContextMenuTrigger({ className, ...props }) {
10
+ return (_jsx(MenuContextTriggerPrimitive, { className: cx("mb-menu-context-trigger mb-context-menu-trigger", className), ...props }));
11
+ }
12
+ function ContextMenuContent({ className, ...props }) {
13
+ return (_jsx(MenuContentPrimitive, { className: cx("mb-menu-content mb-context-menu-content", className), ...props }));
14
+ }
15
+ export { ContextMenu, ContextMenuContent, ContextMenuTrigger };
@@ -0,0 +1,53 @@
1
+ import { DateInput } from "@ui-sdk/react/date-input";
2
+ import { DatePicker as DatePickerPrimitive, DatePickerContent as DatePickerContentPrimitive, DatePickerTrigger as DatePickerTriggerPrimitive } from "@ui-sdk/react/date-picker";
3
+ import { TimeInput } from "@ui-sdk/react/time-input";
4
+ import * as React from "react";
5
+ type FieldSize = "sm" | "md" | "lg";
6
+ type FieldVariant = "auto" | "bordered" | "filled";
7
+ type DateFieldProps = React.ComponentProps<typeof DateInput> & {
8
+ size?: FieldSize;
9
+ /** `auto` is bordered on macOS and filled on touch, like `TextField`. */
10
+ variant?: FieldVariant;
11
+ };
12
+ /** A date typed one part at a time: month, day and year in the locale's order. Arrow keys step a part. */
13
+ declare function DateField({ size, variant, className, children, ...props }: DateFieldProps): React.JSX.Element;
14
+ type TimeFieldProps = React.ComponentProps<typeof TimeInput> & {
15
+ size?: FieldSize;
16
+ variant?: FieldVariant;
17
+ };
18
+ /** A time of day, typed or stepped one part at a time, on the locale's clock. */
19
+ declare function TimeField({ size, variant, className, children, ...props }: TimeFieldProps): React.JSX.Element;
20
+ type PrimitiveProps = React.ComponentProps<typeof DatePickerPrimitive>;
21
+ type DateValue = string | null;
22
+ type PickerDetails = Parameters<NonNullable<PrimitiveProps["onValueChange"]>>[1];
23
+ type SegmentDetails = Parameters<NonNullable<React.ComponentProps<typeof DateInput>["onValueChange"]>>[1];
24
+ type DatePickerProps = Omit<PrimitiveProps, "mode" | "value" | "defaultValue" | "onValueChange"> & {
25
+ value?: DateValue;
26
+ defaultValue?: DateValue;
27
+ /** Runs when a day is picked in the calendar, or typing completes a date in the segments. */
28
+ onValueChange?: (value: DateValue, details: PickerDetails | SegmentDetails) => void;
29
+ /**
30
+ * `field` is the macOS date field: segments you type or step, and a calendar
31
+ * button. `compact` is a button showing the date, as on iOS.
32
+ */
33
+ variant?: "field" | "compact";
34
+ size?: FieldSize;
35
+ "aria-label"?: string;
36
+ "aria-labelledby"?: string;
37
+ id?: string;
38
+ };
39
+ /**
40
+ * A date field whose calendar opens in a popover, or a sheet on a small touch
41
+ * screen. Without children it renders the field, the button and the calendar.
42
+ */
43
+ declare function DatePicker({ variant, size, value: valueProp, defaultValue, onValueChange, presentation, weekdayFormat, fixedWeeks, showOutsideDays, months, locale, min, max, unavailable, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, id, controller: controllerProp, className, children, ...props }: DatePickerProps): React.JSX.Element;
44
+ /** Opens and closes the calendar. Without children it's a calendar glyph. */
45
+ declare function DatePickerTrigger({ className, children, ...props }: React.ComponentProps<typeof DatePickerTriggerPrimitive>): React.JSX.Element;
46
+ type DatePickerContentProps = React.ComponentProps<typeof DatePickerContentPrimitive> & {
47
+ /** How many month grids the default calendar shows. */
48
+ months?: number;
49
+ };
50
+ /** The calendar's popover: a translucent material. Without children it holds the compact calendar. */
51
+ declare function DatePickerContent({ months, sideOffset, align, className, children, ...props }: DatePickerContentProps): React.JSX.Element;
52
+ export { DateField, DatePicker, DatePickerContent, DatePickerTrigger, TimeField };
53
+ export type { DateFieldProps, DatePickerContentProps, DatePickerProps, TimeFieldProps };
@@ -0,0 +1,86 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { createDateInputController, DateInput, DateInputSegment } from "@ui-sdk/react/date-input";
4
+ import { createDatePickerController, DatePicker as DatePickerPrimitive, DatePickerContent as DatePickerContentPrimitive, DatePickerTrigger as DatePickerTriggerPrimitive, } from "@ui-sdk/react/date-picker";
5
+ import { TimeInput, TimeInputSegment } from "@ui-sdk/react/time-input";
6
+ import * as React from "react";
7
+ import { cx } from "../lib/cx.js";
8
+ import { CalendarGlyph } from "../lib/field-glyphs.js";
9
+ import { CalendarBody } from "./calendar.js";
10
+ const rtlLanguages = new Set(["ar", "ckb", "dv", "fa", "he", "ps", "sd", "ug", "ur", "yi"]);
11
+ /**
12
+ * Segments follow the direction of the locale that formats them, not the page:
13
+ * "11/14/2026" stays in that order on a right-to-left page, as AppKit's date field does.
14
+ */
15
+ function localeDir(locale) {
16
+ const resolved = new Intl.DateTimeFormat(locale).resolvedOptions().locale;
17
+ return rtlLanguages.has(resolved.split("-")[0] ?? "") ? "rtl" : "ltr";
18
+ }
19
+ /** A date typed one part at a time: month, day and year in the locale's order. Arrow keys step a part. */
20
+ function DateField({ size = "md", variant = "auto", className, children, ...props }) {
21
+ return (_jsx(DateInput, { dir: localeDir(props.locale), "data-size": size, "data-variant": variant, className: cx("mb-date-field", className), ...props, children: children ??
22
+ (({ segments }) => segments.map((segment) => (_jsx(DateInputSegment, { segment: segment, className: "mb-date-field-segment" }, segment.key)))) }));
23
+ }
24
+ /** A time of day, typed or stepped one part at a time, on the locale's clock. */
25
+ function TimeField({ size = "md", variant = "auto", className, children, ...props }) {
26
+ return (_jsx(TimeInput, { dir: localeDir(props.locale), "data-size": size, "data-variant": variant, className: cx("mb-date-field mb-time-field", className), ...props, children: children ??
27
+ (({ segments }) => segments.map((segment) => (_jsx(TimeInputSegment, { segment: segment, className: "mb-date-field-segment" }, segment.key)))) }));
28
+ }
29
+ /**
30
+ * A date field whose calendar opens in a popover, or a sheet on a small touch
31
+ * screen. Without children it renders the field, the button and the calendar.
32
+ */
33
+ function DatePicker({ variant = "field", size = "md", value: valueProp, defaultValue = null, onValueChange, presentation = "auto", weekdayFormat = "narrow", fixedWeeks = true, showOutsideDays = false, months = 1, locale, min, max, unavailable, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, id, controller: controllerProp, className, children, ...props }) {
34
+ const [own] = React.useState(createDatePickerController);
35
+ const picker = controllerProp ?? own;
36
+ const [current, setCurrent] = React.useState(defaultValue);
37
+ const value = valueProp !== undefined ? valueProp : current;
38
+ const [anchor, setAnchor] = React.useState(null);
39
+ const [segments] = React.useState(createDateInputController);
40
+ const typed = React.useRef(false);
41
+ // A date picked in the calendar shows in the segments; one typed there is already showing.
42
+ React.useEffect(() => {
43
+ if (variant !== "field")
44
+ return;
45
+ if (typed.current) {
46
+ typed.current = false;
47
+ return;
48
+ }
49
+ if (segments.getValue() !== value)
50
+ segments.setValue(value);
51
+ }, [segments, value, variant]);
52
+ const commit = (next, details) => {
53
+ const date = typeof next === "string" ? next : null;
54
+ onValueChange?.(date, details);
55
+ if (!details.canceled && valueProp === undefined)
56
+ setCurrent(date);
57
+ };
58
+ return (_jsx(DatePickerPrimitive, { value: value, onValueChange: commit, controller: picker, presentation: presentation, weekdayFormat: weekdayFormat, fixedWeeks: fixedWeeks, showOutsideDays: showOutsideDays, months: months, locale: locale, min: min, max: max, unavailable: unavailable, "data-variant": variant, "data-size": size, className: cx("mb-date-picker", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [variant === "compact" ? (_jsx(DatePickerTriggerPrimitive, { id: id, "aria-label": ariaLabel && `${ariaLabel}, ${format(value, locale) ?? "none"}`, "aria-labelledby": ariaLabelledBy, className: "mb-date-picker-button", children: format(value, locale) ?? "Choose a date" })) : (_jsxs("div", { ref: setAnchor, "data-size": size, className: "mb-date-picker-field", onKeyDown: (event) => {
59
+ if (event.altKey && event.key === "ArrowDown") {
60
+ event.preventDefault();
61
+ picker.setOpen(true);
62
+ }
63
+ }, children: [_jsx(DateInput, { controller: segments, defaultValue: value, locale: locale, min: min, max: max, unavailable: unavailable, id: id, dir: localeDir(locale), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className: "mb-date-picker-segments", onValueChange: (next, details) => {
64
+ if (details.reason === "imperative")
65
+ return;
66
+ typed.current = true;
67
+ commit(next, details);
68
+ }, children: ({ segments: parts }) => parts.map((segment) => (_jsx(DateInputSegment, { segment: segment, className: "mb-date-field-segment" }, segment.key))) }), _jsx(DatePickerTrigger, { "aria-label": "Show calendar" })] })), _jsx(DatePickerContent, { anchor: variant === "compact" ? undefined : anchor, months: months })] })) }));
69
+ }
70
+ function format(value, locale) {
71
+ if (!value)
72
+ return null;
73
+ const [y, m, d] = value.split("-").map(Number);
74
+ if (!y || !m || !d)
75
+ return null;
76
+ return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone: "UTC" }).format(Date.UTC(y, m - 1, d));
77
+ }
78
+ /** Opens and closes the calendar. Without children it's a calendar glyph. */
79
+ function DatePickerTrigger({ className, children, ...props }) {
80
+ return (_jsx(DatePickerTriggerPrimitive, { className: cx("mb-date-picker-trigger", className), ...props, children: children ?? _jsx(CalendarGlyph, {}) }));
81
+ }
82
+ /** The calendar's popover: a translucent material. Without children it holds the compact calendar. */
83
+ function DatePickerContent({ months, sideOffset = 6, align = "start", className, children, ...props }) {
84
+ return (_jsx(DatePickerContentPrimitive, { sideOffset: sideOffset, align: align, className: cx("mb-date-picker-content", className), ...props, children: children ?? (_jsx("div", { className: "mb-calendar mb-date-picker-calendar", "data-size": "sm", children: _jsx(CalendarBody, { months: months }) })) }));
85
+ }
86
+ export { DateField, DatePicker, DatePickerContent, DatePickerTrigger, TimeField };
@@ -0,0 +1,18 @@
1
+ import type * as React from "react";
2
+ type DescriptionListProps = React.ComponentProps<"dl"> & {
3
+ /** `rows` puts each label in a column beside its value; `stacked` puts the label above the value. */
4
+ layout?: "rows" | "stacked";
5
+ size?: "sm" | "md";
6
+ };
7
+ /** Label and value pairs, on a real `<dl>`. Wrap each pair in a DescriptionItem. */
8
+ declare function DescriptionList({ layout, size, className, ...props }: DescriptionListProps): React.JSX.Element;
9
+ /** One label and its value (or values). A `div`, which is the one wrapper a `<dl>` allows. */
10
+ declare function DescriptionItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
11
+ declare function DescriptionTerm({ className, ...props }: React.ComponentProps<"dt">): React.JSX.Element;
12
+ type DescriptionDetailsProps = React.ComponentProps<"dd"> & {
13
+ /** Sets the value in the monospaced font, for ids, hashes and paths. */
14
+ mono?: boolean;
15
+ };
16
+ declare function DescriptionDetails({ mono, className, ...props }: DescriptionDetailsProps): React.JSX.Element;
17
+ export { DescriptionDetails, DescriptionItem, DescriptionList, DescriptionTerm };
18
+ export type { DescriptionDetailsProps, DescriptionListProps };
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { join } from "../lib/cx.js";
3
+ /** Label and value pairs, on a real `<dl>`. Wrap each pair in a DescriptionItem. */
4
+ function DescriptionList({ layout = "rows", size = "md", className, ...props }) {
5
+ return _jsx("dl", { "data-layout": layout, "data-size": size, className: join("mb-description-list", className), ...props });
6
+ }
7
+ /** One label and its value (or values). A `div`, which is the one wrapper a `<dl>` allows. */
8
+ function DescriptionItem({ className, ...props }) {
9
+ return _jsx("div", { className: join("mb-description-item", className), ...props });
10
+ }
11
+ function DescriptionTerm({ className, ...props }) {
12
+ return _jsx("dt", { className: join("mb-description-term", className), ...props });
13
+ }
14
+ function DescriptionDetails({ mono, className, ...props }) {
15
+ return (_jsx("dd", { "data-mono": mono ? "" : undefined, className: join("mb-description-details", className), ...props }));
16
+ }
17
+ export { DescriptionDetails, DescriptionItem, DescriptionList, DescriptionTerm };
@@ -0,0 +1,18 @@
1
+ import type * as React from "react";
2
+ type DeviceFrameProps = React.ComponentProps<"div"> & {
3
+ device?: "iphone" | "ipad";
4
+ /** The iPad's orientation. iPhone frames are portrait. */
5
+ orientation?: "portrait" | "landscape";
6
+ /** The status bar's clock. */
7
+ time?: string;
8
+ /** The date beside the clock on iPad. */
9
+ date?: string;
10
+ /** Shows the status bar's time, signal, Wi-Fi and battery. */
11
+ statusBar?: boolean;
12
+ homeIndicator?: boolean;
13
+ /** Scales the whole device, for fitting a phone into a column. 1 is actual size in points. */
14
+ scale?: number;
15
+ };
16
+ declare function DeviceFrame({ device, orientation, time, date, statusBar, homeIndicator, scale, className, style, children, ...props }: DeviceFrameProps): React.JSX.Element;
17
+ export { DeviceFrame };
18
+ export type { DeviceFrameProps };
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { join } from "../lib/cx.js";
3
+ function DeviceFrame({ device = "iphone", orientation = device === "ipad" ? "landscape" : "portrait", time = "9:41", date = "Mon Jun 9", statusBar = true, homeIndicator = true, scale, className, style, children, ...props }) {
4
+ const platform = device === "ipad" ? "ipados" : "ios";
5
+ return (_jsx("div", { "data-device": device, "data-orientation": orientation, className: join("mb-device-frame", className), style: scale ? { "--mb-device-scale": scale, ...style } : style, ...props, children: _jsxs("div", { "data-platform": platform, "data-macbetter": "", className: "mb-device-frame-screen", children: [children, statusBar ? (_jsxs("div", { "aria-hidden": "true", className: "mb-device-frame-status-bar", children: [_jsx("span", { className: "mb-device-frame-time", children: time }), device === "ipad" ? _jsx("span", { className: "mb-device-frame-date", children: date }) : null, _jsxs("span", { className: "mb-device-frame-indicators", children: [_jsx(SignalIcon, {}), _jsx(WifiIcon, {}), _jsx(BatteryIcon, {})] })] })) : null, device === "iphone" ? _jsx("div", { "aria-hidden": "true", className: "mb-device-frame-island" }) : null, homeIndicator ? _jsx("div", { "aria-hidden": "true", className: "mb-device-frame-home-indicator" }) : null] }) }));
6
+ }
7
+ function SignalIcon() {
8
+ return (_jsxs("svg", { viewBox: "0 0 18 12", className: "mb-device-frame-icon", "data-icon": "signal", children: [_jsx("rect", { x: "0", y: "7.5", width: "3", height: "4.5", rx: "0.9" }), _jsx("rect", { x: "5", y: "5", width: "3", height: "7", rx: "0.9" }), _jsx("rect", { x: "10", y: "2.5", width: "3", height: "9.5", rx: "0.9" }), _jsx("rect", { x: "15", y: "0", width: "3", height: "12", rx: "0.9" })] }));
9
+ }
10
+ function WifiIcon() {
11
+ return (_jsxs("svg", { viewBox: "0 0 16 12", className: "mb-device-frame-icon", "data-icon": "wifi", children: [_jsx("path", { d: "M8 2.3c2.3 0 4.4.9 6 2.4l1.2-1.2A10.2 10.2 0 0 0 8 .6C5.2.6 2.6 1.7.8 3.5L2 4.7a8.5 8.5 0 0 1 6-2.4z" }), _jsx("path", { d: "M8 5.7c1.4 0 2.6.5 3.6 1.4l1.2-1.2A6.9 6.9 0 0 0 8 4c-1.8 0-3.5.7-4.8 1.9l1.2 1.2c1-.9 2.2-1.4 3.6-1.4z" }), _jsx("path", { d: "M8 9.1c.5 0 .9.2 1.2.5L8 11.4 6.8 9.6c.3-.3.7-.5 1.2-.5z" }), _jsx("path", { d: "M8 7.4c.9 0 1.7.3 2.4.9L9.2 9.5A1.8 1.8 0 0 0 8 9.1c-.5 0-.9.2-1.2.4L5.6 8.3A3.6 3.6 0 0 1 8 7.4z" })] }));
12
+ }
13
+ function BatteryIcon() {
14
+ return (_jsxs("svg", { viewBox: "0 0 27 13", className: "mb-device-frame-icon", "data-icon": "battery", children: [_jsx("rect", { x: "0.5", y: "0.5", width: "23", height: "12", rx: "3.8", fill: "none", stroke: "currentColor", opacity: "0.4" }), _jsx("rect", { x: "2", y: "2", width: "20", height: "9", rx: "2.5" }), _jsx("path", { d: "M25 4.5v4c.8-.3 1.4-1.1 1.4-2s-.6-1.7-1.4-2z", opacity: "0.45" })] }));
15
+ }
16
+ export { DeviceFrame };
@@ -0,0 +1,27 @@
1
+ import { Dialog as DialogPrimitive, DialogClose as DialogClosePrimitive, DialogContent as DialogContentPrimitive, DialogDescription as DialogDescriptionPrimitive, DialogTitle as DialogTitlePrimitive, DialogTrigger as DialogTriggerPrimitive } from "@ui-sdk/react/dialog";
2
+ import type * as React from "react";
3
+ type DialogProps = React.ComponentProps<typeof DialogPrimitive>;
4
+ /** `presentation` defaults to `auto`: a swipeable page sheet on phones, a centered panel elsewhere. */
5
+ declare function Dialog({ presentation, ...props }: DialogProps): React.JSX.Element;
6
+ declare function DialogTrigger(props: React.ComponentProps<typeof DialogTriggerPrimitive>): React.JSX.Element;
7
+ type DialogContentProps<Payload = unknown> = React.ComponentProps<typeof DialogContentPrimitive<Payload>> & {
8
+ /** The panel's width on macOS and iPadOS. iPhone always fills the screen. */
9
+ size?: "sm" | "md" | "lg";
10
+ };
11
+ declare function DialogContent<Payload = unknown>({ size, className, ...props }: DialogContentProps<Payload>): React.JSX.Element;
12
+ /** Holds the title and description. On iOS and iPadOS it becomes the navigation bar. */
13
+ declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
14
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogTitlePrimitive>): React.JSX.Element;
15
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogDescriptionPrimitive>): React.JSX.Element;
16
+ declare function DialogBody({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
17
+ /** Right-aligned buttons on macOS. On iOS and iPadOS its cancel and primary buttons move into the navigation bar. */
18
+ declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
19
+ type DialogCloseProps = React.ComponentProps<typeof DialogClosePrimitive> & {
20
+ /** `primary` is the default action (Done, Save); `cancel` dismisses. On touch they sit at the ends of the navigation bar. */
21
+ variant?: "default" | "primary" | "cancel";
22
+ tone?: "accent" | "destructive";
23
+ };
24
+ declare function DialogClose({ variant, tone, className, ...props }: DialogCloseProps): React.JSX.Element;
25
+ export { createDialogController } from "@ui-sdk/react/dialog";
26
+ export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, };
27
+ export type { DialogCloseProps, DialogContentProps, DialogProps };
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Dialog as DialogPrimitive, DialogBackdrop, DialogClose as DialogClosePrimitive, DialogContent as DialogContentPrimitive, DialogDescription as DialogDescriptionPrimitive, DialogTitle as DialogTitlePrimitive, DialogTrigger as DialogTriggerPrimitive, } from "@ui-sdk/react/dialog";
3
+ import { cx, join } from "../lib/cx.js";
4
+ /** `presentation` defaults to `auto`: a swipeable page sheet on phones, a centered panel elsewhere. */
5
+ function Dialog({ presentation = "auto", ...props }) {
6
+ return _jsx(DialogPrimitive, { presentation: presentation, ...props });
7
+ }
8
+ function DialogTrigger(props) {
9
+ return _jsx(DialogTriggerPrimitive, { ...props });
10
+ }
11
+ function DialogContent({ size = "md", className, ...props }) {
12
+ return (_jsxs(_Fragment, { children: [_jsx(DialogBackdrop, { className: "mb-dialog-backdrop" }), _jsx(DialogContentPrimitive, { "data-size": size, className: cx("mb-dialog", className), ...props })] }));
13
+ }
14
+ /** Holds the title and description. On iOS and iPadOS it becomes the navigation bar. */
15
+ function DialogHeader({ className, ...props }) {
16
+ return _jsx("div", { className: join("mb-dialog-header", className), ...props });
17
+ }
18
+ function DialogTitle({ className, ...props }) {
19
+ return _jsx(DialogTitlePrimitive, { className: cx("mb-dialog-title", className), ...props });
20
+ }
21
+ function DialogDescription({ className, ...props }) {
22
+ return _jsx(DialogDescriptionPrimitive, { className: cx("mb-dialog-description", className), ...props });
23
+ }
24
+ function DialogBody({ className, ...props }) {
25
+ return _jsx("div", { className: join("mb-dialog-body", className), ...props });
26
+ }
27
+ /** Right-aligned buttons on macOS. On iOS and iPadOS its cancel and primary buttons move into the navigation bar. */
28
+ function DialogFooter({ className, ...props }) {
29
+ return _jsx("div", { className: join("mb-dialog-footer", className), ...props });
30
+ }
31
+ function DialogClose({ variant = "default", tone = "accent", className, ...props }) {
32
+ return (_jsx(DialogClosePrimitive, { "data-variant": variant, "data-tone": tone, className: cx("mb-dialog-close", className), ...props }));
33
+ }
34
+ export { createDialogController } from "@ui-sdk/react/dialog";
35
+ export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, };
@@ -0,0 +1,32 @@
1
+ import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, AccordionTrigger } from "@ui-sdk/react/accordion";
2
+ import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@ui-sdk/react/collapsible";
3
+ import type * as React from "react";
4
+ type DisclosureVariant = "grouped" | "plain";
5
+ type DisclosureGroupProps = React.ComponentProps<typeof Accordion> & {
6
+ /** `grouped` draws the rows in an inset grouped box, like a Settings list; `plain` draws bare rows. */
7
+ variant?: DisclosureVariant;
8
+ };
9
+ /** Several disclosures in a group: by default one opens at a time; `multiple` lets several open. */
10
+ declare function DisclosureGroup({ variant, className, ...props }: DisclosureGroupProps): React.JSX.Element;
11
+ declare function DisclosureItem({ className, ...props }: React.ComponentProps<typeof AccordionItem>): React.JSX.Element;
12
+ /** The heading around a trigger. It renders an `h3`; pick the level that fits with `render`. */
13
+ declare function DisclosureHeader({ className, ...props }: React.ComponentProps<typeof AccordionHeader>): React.JSX.Element;
14
+ declare function DisclosureTrigger({ className, children, ...props }: Omit<React.ComponentProps<typeof AccordionTrigger>, "children"> & {
15
+ children?: React.ReactNode;
16
+ }): React.JSX.Element;
17
+ declare function DisclosurePanel({ className, children, ...props }: Omit<React.ComponentProps<typeof AccordionPanel>, "children"> & {
18
+ children?: React.ReactNode;
19
+ }): React.JSX.Element;
20
+ type DisclosureProps = React.ComponentProps<typeof Collapsible> & {
21
+ variant?: DisclosureVariant;
22
+ };
23
+ /** One disclosure on its own, like "Advanced" under a form. */
24
+ declare function Disclosure({ variant, className, ...props }: DisclosureProps): React.JSX.Element;
25
+ declare function DisclosureButton({ className, children, ...props }: Omit<React.ComponentProps<typeof CollapsibleTrigger>, "children"> & {
26
+ children?: React.ReactNode;
27
+ }): React.JSX.Element;
28
+ declare function DisclosureContent({ className, children, ...props }: Omit<React.ComponentProps<typeof CollapsiblePanel>, "children"> & {
29
+ children?: React.ReactNode;
30
+ }): React.JSX.Element;
31
+ export { Disclosure, DisclosureButton, DisclosureContent, DisclosureGroup, DisclosureHeader, DisclosureItem, DisclosurePanel, DisclosureTrigger, };
32
+ export type { DisclosureGroupProps, DisclosureProps, DisclosureVariant };
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, AccordionTrigger, } from "@ui-sdk/react/accordion";
3
+ import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@ui-sdk/react/collapsible";
4
+ import { cx } from "../lib/cx.js";
5
+ function Chevron() {
6
+ return (_jsx("svg", { className: "mb-disclosure-chevron", viewBox: "0 0 8 14", "aria-hidden": "true", children: _jsx("path", { d: "M1.5 1.5 6.5 7l-5 5.5" }) }));
7
+ }
8
+ /** Several disclosures in a group: by default one opens at a time; `multiple` lets several open. */
9
+ function DisclosureGroup({ variant = "grouped", className, ...props }) {
10
+ return _jsx(Accordion, { "data-variant": variant, className: cx("mb-disclosure-group", className), ...props });
11
+ }
12
+ function DisclosureItem({ className, ...props }) {
13
+ return _jsx(AccordionItem, { className: cx("mb-disclosure-item", className), ...props });
14
+ }
15
+ /** The heading around a trigger. It renders an `h3`; pick the level that fits with `render`. */
16
+ function DisclosureHeader({ className, ...props }) {
17
+ return _jsx(AccordionHeader, { className: cx("mb-disclosure-header", className), ...props });
18
+ }
19
+ function DisclosureTrigger({ className, children, ...props }) {
20
+ return (_jsxs(AccordionTrigger, { className: cx("mb-disclosure-trigger", className), ...props, children: [_jsx(Chevron, {}), _jsx("span", { className: "mb-disclosure-label", children: children })] }));
21
+ }
22
+ function DisclosurePanel({ className, children, ...props }) {
23
+ return (_jsx(AccordionPanel, { className: cx("mb-disclosure-panel", className), ...props, children: _jsx("div", { className: "mb-disclosure-content", children: children }) }));
24
+ }
25
+ /** One disclosure on its own, like "Advanced" under a form. */
26
+ function Disclosure({ variant = "plain", className, ...props }) {
27
+ return _jsx(Collapsible, { "data-variant": variant, className: cx("mb-disclosure", className), ...props });
28
+ }
29
+ function DisclosureButton({ className, children, ...props }) {
30
+ return (_jsxs(CollapsibleTrigger, { className: cx("mb-disclosure-trigger", className), ...props, children: [_jsx(Chevron, {}), _jsx("span", { className: "mb-disclosure-label", children: children })] }));
31
+ }
32
+ function DisclosureContent({ className, children, ...props }) {
33
+ return (_jsx(CollapsiblePanel, { className: cx("mb-disclosure-panel", className), ...props, children: _jsx("div", { className: "mb-disclosure-content", children: children }) }));
34
+ }
35
+ export { Disclosure, DisclosureButton, DisclosureContent, DisclosureGroup, DisclosureHeader, DisclosureItem, DisclosurePanel, DisclosureTrigger, };
@@ -0,0 +1,28 @@
1
+ import { Toolbar, ToolbarSeparator } from "@ui-sdk/react/toolbar";
2
+ import * as React from "react";
3
+ type DockAppearance = "default" | "dark" | "clear" | "tinted";
4
+ type DockProps = React.ComponentProps<typeof Toolbar> & {
5
+ /** How large the icon under the pointer grows, as a multiple of its size. 1 turns magnification off. */
6
+ magnification?: number;
7
+ /** The app-icon style, as people choose it in macOS: full color, dark, clear glass, or one tint. */
8
+ appearance?: DockAppearance;
9
+ };
10
+ declare function Dock({ magnification, appearance, className, onPointerMove, onPointerLeave, ...props }: DockProps): React.JSX.Element;
11
+ type DockItemProps = {
12
+ /** The app's name: the item's accessible name and the label shown above it. */
13
+ label: string;
14
+ /** Draws the dot under an app that's open. */
15
+ running?: boolean;
16
+ /** The icon's background color, drawn as a gradient that's lighter at the top. Any CSS color. */
17
+ tint?: string;
18
+ /** Renders the item as a link. */
19
+ href?: string;
20
+ disabled?: boolean;
21
+ className?: string;
22
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
23
+ children: React.ReactNode;
24
+ };
25
+ declare function DockItem({ label, running, tint, href, disabled, className, onClick, children }: DockItemProps): React.JSX.Element;
26
+ declare function DockSeparator({ className, ...props }: React.ComponentProps<typeof ToolbarSeparator>): React.JSX.Element;
27
+ export { Dock, DockItem, DockSeparator };
28
+ export type { DockAppearance, DockItemProps, DockProps };
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Toolbar, ToolbarButton, ToolbarLink, ToolbarSeparator } from "@ui-sdk/react/toolbar";
4
+ import * as React from "react";
5
+ import { cx, join } from "../lib/cx.js";
6
+ const ITEM = ".mb-dock-item";
7
+ function Dock({ magnification = 1.75, appearance = "default", className, onPointerMove, onPointerLeave, ...props }) {
8
+ const ref = React.useRef(null);
9
+ const frame = React.useRef(0);
10
+ const pointer = React.useRef(null);
11
+ React.useEffect(() => () => cancelAnimationFrame(frame.current), []);
12
+ const update = React.useCallback(() => {
13
+ frame.current = 0;
14
+ const root = ref.current;
15
+ if (!root)
16
+ return;
17
+ const x = pointer.current;
18
+ const items = root.querySelectorAll(ITEM);
19
+ if (x === null) {
20
+ root.removeAttribute("data-magnifying");
21
+ for (const item of items)
22
+ item.style.removeProperty("--mb-dock-scale");
23
+ return;
24
+ }
25
+ root.setAttribute("data-magnifying", "");
26
+ const base = Number.parseFloat(getComputedStyle(root).getPropertyValue("--mb-dock-icon-size")) || 48;
27
+ const reach = base * 3;
28
+ for (const item of items) {
29
+ const rect = item.getBoundingClientRect();
30
+ const distance = Math.min(Math.abs(x - (rect.left + rect.width / 2)) / reach, 1);
31
+ const scale = 1 + (magnification - 1) * ((1 + Math.cos(Math.PI * distance)) / 2);
32
+ item.style.setProperty("--mb-dock-scale", scale.toFixed(3));
33
+ }
34
+ }, [magnification]);
35
+ const schedule = () => {
36
+ if (!frame.current)
37
+ frame.current = requestAnimationFrame(update);
38
+ };
39
+ return (_jsx(Toolbar, { ref: ref, className: cx("mb-dock", className), "data-appearance": appearance, onPointerMove: (event) => {
40
+ onPointerMove?.(event);
41
+ if (event.pointerType !== "mouse" || magnification <= 1)
42
+ return;
43
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches &&
44
+ document.documentElement.dataset.motion !== "full")
45
+ return;
46
+ pointer.current = event.clientX;
47
+ schedule();
48
+ }, onPointerLeave: (event) => {
49
+ onPointerLeave?.(event);
50
+ if (pointer.current === null)
51
+ return;
52
+ pointer.current = null;
53
+ schedule();
54
+ }, ...props }));
55
+ }
56
+ function DockItem({ label, running, tint, href, disabled, className, onClick, children }) {
57
+ const [bouncing, setBouncing] = React.useState(false);
58
+ const shared = {
59
+ "aria-label": label,
60
+ "data-running": running ? "" : undefined,
61
+ "data-bouncing": bouncing ? "" : undefined,
62
+ className: join("mb-dock-item", className),
63
+ onClick: (event) => {
64
+ // An app that isn't open bounces while it launches, as the Dock does.
65
+ if (!running)
66
+ setBouncing(true);
67
+ onClick?.(event);
68
+ },
69
+ onAnimationEnd: (event) => {
70
+ if (event.animationName === "mb-dock-bounce")
71
+ setBouncing(false);
72
+ },
73
+ };
74
+ const content = (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: "mb-dock-item-label", children: label }), _jsx("span", { className: "mb-dock-item-icon", style: tint ? { "--mb-dock-item-tint": tint } : undefined, children: children })] }));
75
+ return href ? (_jsx(ToolbarLink, { href: href, ...shared, children: content })) : (_jsx(ToolbarButton, { disabled: disabled, ...shared, children: content }));
76
+ }
77
+ function DockSeparator({ className, ...props }) {
78
+ return _jsx(ToolbarSeparator, { className: cx("mb-dock-separator", className), ...props });
79
+ }
80
+ export { Dock, DockItem, DockSeparator };
@@ -0,0 +1,20 @@
1
+ import * as React from "react";
2
+ type DoorState = "open" | "closed" | "opening" | "closing" | "stopped";
3
+ type DoorTarget = "open" | "closed";
4
+ type DoorControlProps = Omit<React.ComponentProps<"div">, "children"> & {
5
+ /** The door's current state, from HomeKit's current door state. */
6
+ state: DoorState;
7
+ /** Something is in the way, as when a garage door can't close. */
8
+ obstructed?: boolean;
9
+ onTargetChange?: (target: DoorTarget) => void;
10
+ /** The door's name, like "Garage door". */
11
+ name: string;
12
+ /** Asks before opening. Pass it for a garage door or a gate. */
13
+ confirmOpen?: boolean;
14
+ confirmDescription?: string;
15
+ kind?: "garage" | "door" | "gate";
16
+ disabled?: boolean;
17
+ };
18
+ declare function DoorControl({ state, obstructed, onTargetChange, name, confirmOpen, confirmDescription, kind, disabled, className, ...props }: DoorControlProps): React.JSX.Element;
19
+ export { DoorControl };
20
+ export type { DoorControlProps, DoorState, DoorTarget };
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // Client-only: it holds the confirmation alert's open state.
4
+ import { Button as ButtonPrimitive } from "@ui-sdk/react/button";
5
+ import * as React from "react";
6
+ import { join } from "../lib/cx.js";
7
+ import { Alert, AlertAction, AlertActions, AlertContent, AlertDescription, AlertTitle } from "./alert.js";
8
+ function DoorGlyph({ kind }) {
9
+ const clip = `mb-door-control-${React.useId().replace(/[^\w-]/g, "")}`;
10
+ if (kind === "door") {
11
+ return (_jsxs("svg", { viewBox: "0 0 48 48", "aria-hidden": "true", className: "mb-door-control-glyph", children: [_jsx("path", { className: "mb-door-control-frame", d: "M12 42V8.5A2.5 2.5 0 0 1 14.5 6h19A2.5 2.5 0 0 1 36 8.5V42M8 42h32" }), _jsx("path", { className: "mb-door-control-leaf", d: "M15 9h18v33H15Z" }), _jsx("circle", { className: "mb-door-control-knob", cx: "29", cy: "26", r: "1.8" })] }));
12
+ }
13
+ if (kind === "gate") {
14
+ return (_jsxs("svg", { viewBox: "0 0 48 48", "aria-hidden": "true", className: "mb-door-control-glyph", children: [_jsx("path", { className: "mb-door-control-frame", d: "M7 42V10M41 42V10M5 42h38" }), _jsx("g", { className: "mb-door-control-leaf", children: _jsx("path", { className: "mb-door-control-bars", d: "M12 16v24M18 14v26M24 13v27M30 14v26M36 16v24M10 22h28M10 34h28" }) })] }));
15
+ }
16
+ return (_jsxs("svg", { viewBox: "0 0 48 48", "aria-hidden": "true", className: "mb-door-control-glyph", children: [_jsx("path", { className: "mb-door-control-frame", d: "M5 19.5 24 7l19 12.5M10 42V20.5M38 42V20.5" }), _jsx("clipPath", { id: clip, children: _jsx("rect", { x: "13", y: "22", width: "22", height: "20" }) }), _jsx("g", { clipPath: `url(#${clip})`, children: _jsxs("g", { className: "mb-door-control-leaf", children: [_jsx("rect", { x: "13", y: "22", width: "22", height: "4.2", rx: "1" }), _jsx("rect", { x: "13", y: "27.3", width: "22", height: "4.2", rx: "1" }), _jsx("rect", { x: "13", y: "32.6", width: "22", height: "4.2", rx: "1" }), _jsx("rect", { x: "13", y: "37.9", width: "22", height: "4.1", rx: "1" })] }) })] }));
17
+ }
18
+ const STATUS = {
19
+ open: "Open",
20
+ closed: "Closed",
21
+ opening: "Opening…",
22
+ closing: "Closing…",
23
+ stopped: "Stopped",
24
+ };
25
+ function DoorControl({ state, obstructed, onTargetChange, name, confirmOpen = false, confirmDescription, kind = "garage", disabled, className, ...props }) {
26
+ const [asking, setAsking] = React.useState(false);
27
+ const moving = state === "opening" || state === "closing";
28
+ const towardOpen = state === "open" || state === "opening";
29
+ const next = towardOpen || state === "stopped" ? "closed" : "open";
30
+ const status = obstructed ? "Obstruction detected" : STATUS[state];
31
+ const action = `${next === "open" ? "Open" : "Close"} ${name}`;
32
+ return (_jsxs("div", { "data-state": state, "data-kind": kind, "data-position": towardOpen || state === "stopped" ? "open" : "closed", "data-pending": moving ? "" : undefined, "data-obstructed": obstructed ? "" : undefined, className: join("mb-door-control", className), ...props, children: [_jsx(ButtonPrimitive, { "aria-label": action, disabled: disabled, className: "mb-door-control-button", onClick: () => {
33
+ if (next === "open" && confirmOpen)
34
+ setAsking(true);
35
+ else
36
+ onTargetChange?.(next);
37
+ }, children: _jsx(DoorGlyph, { kind: kind }) }), _jsx("span", { className: "mb-door-control-status", "aria-live": "polite", children: status }), _jsx(Alert, { open: asking, onOpenChange: (open, details) => {
38
+ setAsking(open);
39
+ if (!open && details?.returnValue === "open")
40
+ onTargetChange?.("open");
41
+ }, children: _jsxs(AlertContent, { children: [_jsxs(AlertTitle, { children: ["Open ", name, "?"] }), _jsx(AlertDescription, { children: confirmDescription ?? "Make sure nothing is in the way before it moves." }), _jsxs(AlertActions, { children: [_jsx(AlertAction, { variant: "cancel", children: "Cancel" }), _jsx(AlertAction, { variant: "primary", value: "open", children: "Open" })] })] }) })] }));
42
+ }
43
+ export { DoorControl };