macbetter 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 (251) 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/artwork.d.ts +44 -0
  10. package/dist/components/artwork.js +935 -0
  11. package/dist/components/automation-row.d.ts +24 -0
  12. package/dist/components/automation-row.js +12 -0
  13. package/dist/components/avatar.d.ts +33 -0
  14. package/dist/components/avatar.js +45 -0
  15. package/dist/components/badge.d.ts +24 -0
  16. package/dist/components/badge.js +19 -0
  17. package/dist/components/button.d.ts +20 -0
  18. package/dist/components/button.js +10 -0
  19. package/dist/components/calendar.d.ts +30 -0
  20. package/dist/components/calendar.js +47 -0
  21. package/dist/components/camera-view.d.ts +40 -0
  22. package/dist/components/camera-view.js +44 -0
  23. package/dist/components/card.d.ts +14 -0
  24. package/dist/components/card.js +21 -0
  25. package/dist/components/carousel.d.ts +18 -0
  26. package/dist/components/carousel.js +33 -0
  27. package/dist/components/checkbox.d.ts +13 -0
  28. package/dist/components/checkbox.js +16 -0
  29. package/dist/components/code-field.d.ts +16 -0
  30. package/dist/components/code-field.js +29 -0
  31. package/dist/components/color-well.d.ts +23 -0
  32. package/dist/components/color-well.js +27 -0
  33. package/dist/components/combo-box.d.ts +42 -0
  34. package/dist/components/combo-box.js +102 -0
  35. package/dist/components/command-palette.d.ts +33 -0
  36. package/dist/components/command-palette.js +55 -0
  37. package/dist/components/context-menu.d.ts +9 -0
  38. package/dist/components/context-menu.js +15 -0
  39. package/dist/components/date-picker.d.ts +53 -0
  40. package/dist/components/date-picker.js +86 -0
  41. package/dist/components/device-frame.d.ts +18 -0
  42. package/dist/components/device-frame.js +16 -0
  43. package/dist/components/dialog.d.ts +27 -0
  44. package/dist/components/dialog.js +35 -0
  45. package/dist/components/disclosure.d.ts +32 -0
  46. package/dist/components/disclosure.js +35 -0
  47. package/dist/components/dock.d.ts +28 -0
  48. package/dist/components/dock.js +80 -0
  49. package/dist/components/door-control.d.ts +20 -0
  50. package/dist/components/door-control.js +43 -0
  51. package/dist/components/energy-readout.d.ts +32 -0
  52. package/dist/components/energy-readout.js +27 -0
  53. package/dist/components/field.d.ts +28 -0
  54. package/dist/components/field.js +32 -0
  55. package/dist/components/gauge.d.ts +25 -0
  56. package/dist/components/gauge.js +42 -0
  57. package/dist/components/glass.d.ts +34 -0
  58. package/dist/components/glass.js +31 -0
  59. package/dist/components/home-backdrop.d.ts +23 -0
  60. package/dist/components/home-backdrop.js +12 -0
  61. package/dist/components/home-section.d.ts +19 -0
  62. package/dist/components/home-section.js +21 -0
  63. package/dist/components/home-status.d.ts +24 -0
  64. package/dist/components/home-status.js +14 -0
  65. package/dist/components/hover-card.d.ts +14 -0
  66. package/dist/components/hover-card.js +16 -0
  67. package/dist/components/level-control.d.ts +19 -0
  68. package/dist/components/level-control.js +13 -0
  69. package/dist/components/light-color-picker.d.ts +33 -0
  70. package/dist/components/light-color-picker.js +56 -0
  71. package/dist/components/list.d.ts +42 -0
  72. package/dist/components/list.js +42 -0
  73. package/dist/components/listbox.d.ts +16 -0
  74. package/dist/components/listbox.js +28 -0
  75. package/dist/components/lock-control.d.ts +20 -0
  76. package/dist/components/lock-control.js +35 -0
  77. package/dist/components/menu-bar.d.ts +14 -0
  78. package/dist/components/menu-bar.js +16 -0
  79. package/dist/components/menu.d.ts +40 -0
  80. package/dist/components/menu.js +54 -0
  81. package/dist/components/navigation-bar.d.ts +24 -0
  82. package/dist/components/navigation-bar.js +54 -0
  83. package/dist/components/outline.d.ts +21 -0
  84. package/dist/components/outline.js +40 -0
  85. package/dist/components/page-control.d.ts +10 -0
  86. package/dist/components/page-control.js +8 -0
  87. package/dist/components/popover.d.ts +16 -0
  88. package/dist/components/popover.js +24 -0
  89. package/dist/components/progress.d.ts +27 -0
  90. package/dist/components/progress.js +27 -0
  91. package/dist/components/radio.d.ts +16 -0
  92. package/dist/components/radio.js +13 -0
  93. package/dist/components/rating.d.ts +10 -0
  94. package/dist/components/rating.js +12 -0
  95. package/dist/components/scene-tile.d.ts +22 -0
  96. package/dist/components/scene-tile.js +13 -0
  97. package/dist/components/scroll-view.d.ts +21 -0
  98. package/dist/components/scroll-view.js +13 -0
  99. package/dist/components/search-field.d.ts +16 -0
  100. package/dist/components/search-field.js +12 -0
  101. package/dist/components/secure-field.d.ts +23 -0
  102. package/dist/components/secure-field.js +21 -0
  103. package/dist/components/segmented-control.d.ts +12 -0
  104. package/dist/components/segmented-control.js +10 -0
  105. package/dist/components/select.d.ts +45 -0
  106. package/dist/components/select.js +79 -0
  107. package/dist/components/sensor-readout.d.ts +29 -0
  108. package/dist/components/sensor-readout.js +12 -0
  109. package/dist/components/separator.d.ts +14 -0
  110. package/dist/components/separator.js +11 -0
  111. package/dist/components/setup-code.d.ts +29 -0
  112. package/dist/components/setup-code.js +47 -0
  113. package/dist/components/sheet.d.ts +31 -0
  114. package/dist/components/sheet.js +51 -0
  115. package/dist/components/sidebar.d.ts +30 -0
  116. package/dist/components/sidebar.js +26 -0
  117. package/dist/components/slider.d.ts +27 -0
  118. package/dist/components/slider.js +43 -0
  119. package/dist/components/split-view.d.ts +11 -0
  120. package/dist/components/split-view.js +13 -0
  121. package/dist/components/squircle.d.ts +41 -0
  122. package/dist/components/squircle.js +63 -0
  123. package/dist/components/stepper.d.ts +30 -0
  124. package/dist/components/stepper.js +28 -0
  125. package/dist/components/switch.d.ts +10 -0
  126. package/dist/components/switch.js +10 -0
  127. package/dist/components/tab-bar.d.ts +20 -0
  128. package/dist/components/tab-bar.js +17 -0
  129. package/dist/components/table.d.ts +49 -0
  130. package/dist/components/table.js +179 -0
  131. package/dist/components/tabs.d.ts +16 -0
  132. package/dist/components/tabs.js +19 -0
  133. package/dist/components/text-area.d.ts +14 -0
  134. package/dist/components/text-area.js +9 -0
  135. package/dist/components/text-field.d.ts +26 -0
  136. package/dist/components/text-field.js +23 -0
  137. package/dist/components/thermostat-control.d.ts +30 -0
  138. package/dist/components/thermostat-control.js +139 -0
  139. package/dist/components/toast.d.ts +30 -0
  140. package/dist/components/toast.js +114 -0
  141. package/dist/components/toggle.d.ts +21 -0
  142. package/dist/components/toggle.js +19 -0
  143. package/dist/components/token-field.d.ts +31 -0
  144. package/dist/components/token-field.js +78 -0
  145. package/dist/components/toolbar.d.ts +27 -0
  146. package/dist/components/toolbar.js +39 -0
  147. package/dist/components/tooltip.d.ts +11 -0
  148. package/dist/components/tooltip.js +18 -0
  149. package/dist/components/window.d.ts +56 -0
  150. package/dist/components/window.js +61 -0
  151. package/dist/index.d.ts +78 -0
  152. package/dist/index.js +79 -0
  153. package/dist/lib/cx.d.ts +9 -0
  154. package/dist/lib/cx.js +14 -0
  155. package/dist/lib/derive.d.ts +53 -0
  156. package/dist/lib/derive.js +255 -0
  157. package/dist/lib/field-glyphs.d.ts +13 -0
  158. package/dist/lib/field-glyphs.js +28 -0
  159. package/dist/lib/menu-glyphs.d.ts +6 -0
  160. package/dist/lib/menu-glyphs.js +15 -0
  161. package/dist/lib/platform.d.ts +18 -0
  162. package/dist/lib/platform.js +17 -0
  163. package/dist/lib/squircle.d.ts +23 -0
  164. package/dist/lib/squircle.js +69 -0
  165. package/dist/lib/theme.d.ts +42 -0
  166. package/dist/lib/theme.js +62 -0
  167. package/dist/styles/base.css +115 -0
  168. package/dist/styles/components/accessory-tile.css +461 -0
  169. package/dist/styles/components/activity-indicator.css +63 -0
  170. package/dist/styles/components/alert.css +433 -0
  171. package/dist/styles/components/artwork.css +380 -0
  172. package/dist/styles/components/automation-row.css +52 -0
  173. package/dist/styles/components/avatar.css +230 -0
  174. package/dist/styles/components/badge.css +204 -0
  175. package/dist/styles/components/button.css +298 -0
  176. package/dist/styles/components/calendar.css +287 -0
  177. package/dist/styles/components/camera-view.css +239 -0
  178. package/dist/styles/components/card.css +100 -0
  179. package/dist/styles/components/carousel.css +210 -0
  180. package/dist/styles/components/checkbox.css +212 -0
  181. package/dist/styles/components/code-field.css +163 -0
  182. package/dist/styles/components/color-well.css +452 -0
  183. package/dist/styles/components/combo-box.css +222 -0
  184. package/dist/styles/components/command-palette.css +379 -0
  185. package/dist/styles/components/context-menu.css +43 -0
  186. package/dist/styles/components/date-picker.css +356 -0
  187. package/dist/styles/components/device-frame.css +194 -0
  188. package/dist/styles/components/dialog.css +366 -0
  189. package/dist/styles/components/disclosure.css +197 -0
  190. package/dist/styles/components/dock.css +404 -0
  191. package/dist/styles/components/door-control.css +187 -0
  192. package/dist/styles/components/energy-readout.css +161 -0
  193. package/dist/styles/components/field.css +175 -0
  194. package/dist/styles/components/gauge.css +239 -0
  195. package/dist/styles/components/glass.css +113 -0
  196. package/dist/styles/components/home-backdrop.css +81 -0
  197. package/dist/styles/components/home-section.css +100 -0
  198. package/dist/styles/components/home-status.css +215 -0
  199. package/dist/styles/components/hover-card.css +145 -0
  200. package/dist/styles/components/index.css +75 -0
  201. package/dist/styles/components/level-control.css +247 -0
  202. package/dist/styles/components/light-color-picker.css +94 -0
  203. package/dist/styles/components/list.css +411 -0
  204. package/dist/styles/components/listbox.css +168 -0
  205. package/dist/styles/components/lock-control.css +164 -0
  206. package/dist/styles/components/menu-bar.css +94 -0
  207. package/dist/styles/components/menu.css +454 -0
  208. package/dist/styles/components/navigation-bar.css +248 -0
  209. package/dist/styles/components/outline.css +248 -0
  210. package/dist/styles/components/page-control.css +127 -0
  211. package/dist/styles/components/popover.css +186 -0
  212. package/dist/styles/components/progress.css +228 -0
  213. package/dist/styles/components/radio.css +281 -0
  214. package/dist/styles/components/rating.css +122 -0
  215. package/dist/styles/components/scene-tile.css +295 -0
  216. package/dist/styles/components/scroll-view.css +195 -0
  217. package/dist/styles/components/search-field.css +128 -0
  218. package/dist/styles/components/secure-field.css +189 -0
  219. package/dist/styles/components/segmented-control.css +183 -0
  220. package/dist/styles/components/select.css +290 -0
  221. package/dist/styles/components/sensor-readout.css +231 -0
  222. package/dist/styles/components/separator.css +62 -0
  223. package/dist/styles/components/setup-code.css +138 -0
  224. package/dist/styles/components/sheet.css +345 -0
  225. package/dist/styles/components/sidebar.css +261 -0
  226. package/dist/styles/components/slider.css +208 -0
  227. package/dist/styles/components/split-view.css +75 -0
  228. package/dist/styles/components/squircle.css +44 -0
  229. package/dist/styles/components/stepper.css +278 -0
  230. package/dist/styles/components/switch.css +115 -0
  231. package/dist/styles/components/tab-bar.css +223 -0
  232. package/dist/styles/components/table.css +313 -0
  233. package/dist/styles/components/tabs.css +262 -0
  234. package/dist/styles/components/text-area.css +94 -0
  235. package/dist/styles/components/text-field.css +294 -0
  236. package/dist/styles/components/thermostat-control.css +214 -0
  237. package/dist/styles/components/toast.css +418 -0
  238. package/dist/styles/components/toggle.css +312 -0
  239. package/dist/styles/components/token-field.css +193 -0
  240. package/dist/styles/components/toolbar.css +370 -0
  241. package/dist/styles/components/tooltip.css +69 -0
  242. package/dist/styles/components/window.css +428 -0
  243. package/dist/styles/index.css +17 -0
  244. package/dist/styles/materials.css +263 -0
  245. package/dist/styles/platforms.css +214 -0
  246. package/dist/styles/themes/ember.css +24 -0
  247. package/dist/styles/themes/graphite.css +16 -0
  248. package/dist/styles/themes/nebula.css +16 -0
  249. package/dist/styles/themes/system.css +28 -0
  250. package/dist/styles/tokens.css +299 -0
  251. package/package.json +82 -3
@@ -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 };
@@ -0,0 +1,32 @@
1
+ import type * as React from "react";
2
+ type EnergyForecastHour = {
3
+ /** The hour, already formatted: "4 PM". */
4
+ label: string;
5
+ /** Cleaner electricity is forecast for this hour. */
6
+ cleaner: boolean;
7
+ };
8
+ type EnergyReadoutProps = Omit<React.ComponentProps<"section">, "title"> & {
9
+ /** One entry per hour, in order. */
10
+ forecast: EnergyForecastHour[];
11
+ /** Which hour is now, by index. */
12
+ now?: number;
13
+ title?: React.ReactNode;
14
+ /** The forecast in a sentence: "Cleaner energy 4–10 PM". Without one, it's worked out from the hours. */
15
+ summary?: React.ReactNode;
16
+ /** A reading beside the forecast, like the home's use today. */
17
+ usage?: {
18
+ value: string;
19
+ label: string;
20
+ };
21
+ /** The words for the two kinds of hour, in the page's language. */
22
+ cleanerLabel?: string;
23
+ lessCleanLabel?: string;
24
+ nowLabel?: string;
25
+ };
26
+ /**
27
+ * The Grid Forecast: the hours ahead, with the cleaner ones raised and green. Each bar is
28
+ * labeled in words for assistive tech, and the summary says the same in a sentence.
29
+ */
30
+ declare function EnergyReadout({ forecast, now, title, summary, usage, cleanerLabel, lessCleanLabel, nowLabel, className, ...props }: EnergyReadoutProps): React.JSX.Element;
31
+ export { EnergyReadout };
32
+ export type { EnergyForecastHour, EnergyReadoutProps };
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { join } from "../lib/cx.js";
3
+ function cleanerRuns(forecast) {
4
+ const runs = [];
5
+ let start = -1;
6
+ forecast.forEach((hour, i) => {
7
+ if (hour.cleaner && start < 0)
8
+ start = i;
9
+ const ends = start >= 0 && (!hour.cleaner || i === forecast.length - 1);
10
+ if (ends) {
11
+ const last = hour.cleaner ? i : i - 1;
12
+ runs.push(start === last ? forecast[start].label : `${forecast[start].label}–${forecast[last].label}`);
13
+ start = -1;
14
+ }
15
+ });
16
+ return runs;
17
+ }
18
+ /**
19
+ * The Grid Forecast: the hours ahead, with the cleaner ones raised and green. Each bar is
20
+ * labeled in words for assistive tech, and the summary says the same in a sentence.
21
+ */
22
+ function EnergyReadout({ forecast, now = 0, title = "Grid Forecast", summary, usage, cleanerLabel = "Cleaner", lessCleanLabel = "Less clean", nowLabel = "Now", className, ...props }) {
23
+ const runs = cleanerRuns(forecast);
24
+ const sentence = summary ?? (runs.length ? `Cleaner energy ${runs.join(", ")}` : "No cleaner periods forecast");
25
+ return (_jsxs("section", { className: join("mb-energy-readout", className), ...props, children: [_jsxs("header", { className: "mb-energy-readout-header", children: [_jsxs("div", { className: "mb-energy-readout-heading", children: [_jsx("h3", { className: "mb-energy-readout-title", children: title }), _jsx("p", { className: "mb-energy-readout-summary", children: sentence })] }), usage ? (_jsxs("p", { className: "mb-energy-readout-usage", children: [_jsx("span", { className: "mb-energy-readout-usage-value", children: usage.value }), _jsx("span", { className: "mb-energy-readout-usage-label", children: usage.label })] })) : null] }), _jsx("ol", { className: "mb-energy-readout-bars", children: forecast.map((hour, i) => (_jsx("li", { "data-cleaner": hour.cleaner ? "" : undefined, "data-now": i === now ? "" : undefined, className: "mb-energy-readout-bar", children: _jsx("span", { className: "mb-visually-hidden", children: `${hour.label}: ${hour.cleaner ? cleanerLabel : lessCleanLabel}${i === now ? `, ${nowLabel}` : ""}` }) }, `${i}-${hour.label}`))) }), _jsxs("div", { className: "mb-energy-readout-axis", "aria-hidden": "true", children: [_jsx("span", { children: forecast[0]?.label }), _jsx("span", { children: forecast[Math.floor(forecast.length / 2)]?.label }), _jsx("span", { children: forecast[forecast.length - 1]?.label })] })] }));
26
+ }
27
+ export { EnergyReadout };
@@ -0,0 +1,28 @@
1
+ import { Field as FieldPrimitive, FieldDescription as FieldDescriptionPrimitive, FieldError as FieldErrorPrimitive, FieldGroup as FieldGroupPrimitive, FieldLabel as FieldLabelPrimitive, FieldLegend as FieldLegendPrimitive, FieldSet as FieldSetPrimitive } from "@ui-sdk/react/field";
2
+ import { Label as LabelPrimitive } from "@ui-sdk/react/label";
3
+ import type * as React from "react";
4
+ type FieldLayout = "stacked" | "horizontal";
5
+ type FieldProps = React.ComponentProps<typeof FieldPrimitive> & {
6
+ /**
7
+ * `horizontal` puts the label beside the control, as in macOS forms and
8
+ * inspectors; `stacked` puts it above. Inside a horizontal `FieldGroup` it
9
+ * follows the group.
10
+ */
11
+ layout?: FieldLayout;
12
+ };
13
+ declare function Field({ layout, className, ...props }: FieldProps): React.JSX.Element;
14
+ declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof FieldLabelPrimitive>): React.JSX.Element;
15
+ /** Renders a `div`, so a host page's paragraph margins never move it. */
16
+ declare function FieldDescription({ className, ...props }: React.ComponentProps<typeof FieldDescriptionPrimitive>): React.JSX.Element;
17
+ declare function FieldError({ className, ...props }: React.ComponentProps<typeof FieldErrorPrimitive>): React.JSX.Element;
18
+ type FieldGroupProps = React.ComponentProps<typeof FieldGroupPrimitive> & {
19
+ /** `horizontal` lines every field's label up in one right-aligned column, like a macOS form. */
20
+ layout?: FieldLayout;
21
+ };
22
+ declare function FieldGroup({ layout, className, ...props }: FieldGroupProps): React.JSX.Element;
23
+ declare function FieldSet({ className, ...props }: React.ComponentProps<typeof FieldSetPrimitive>): React.JSX.Element;
24
+ declare function FieldLegend({ className, ...props }: React.ComponentProps<typeof FieldLegendPrimitive>): React.JSX.Element;
25
+ /** A label for a control outside a `Field`, pointed at it with `htmlFor`. */
26
+ declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive>): React.JSX.Element;
27
+ export { Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSet, Label };
28
+ export type { FieldGroupProps, FieldLayout, FieldProps };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Field as FieldPrimitive, FieldDescription as FieldDescriptionPrimitive, FieldError as FieldErrorPrimitive, FieldGroup as FieldGroupPrimitive, FieldLabel as FieldLabelPrimitive, FieldLegend as FieldLegendPrimitive, FieldSet as FieldSetPrimitive, } from "@ui-sdk/react/field";
4
+ import { Label as LabelPrimitive } from "@ui-sdk/react/label";
5
+ import { cx } from "../lib/cx.js";
6
+ function Field({ layout, className, ...props }) {
7
+ return _jsx(FieldPrimitive, { "data-layout": layout, className: cx("mb-field", className), ...props });
8
+ }
9
+ function FieldLabel({ className, ...props }) {
10
+ return _jsx(FieldLabelPrimitive, { className: cx("mb-field-label", className), ...props });
11
+ }
12
+ /** Renders a `div`, so a host page's paragraph margins never move it. */
13
+ function FieldDescription({ className, ...props }) {
14
+ return _jsx(FieldDescriptionPrimitive, { render: _jsx("div", {}), className: cx("mb-field-description", className), ...props });
15
+ }
16
+ function FieldError({ className, ...props }) {
17
+ return _jsx(FieldErrorPrimitive, { className: cx("mb-field-error", className), ...props });
18
+ }
19
+ function FieldGroup({ layout = "stacked", className, ...props }) {
20
+ return _jsx(FieldGroupPrimitive, { "data-layout": layout, className: cx("mb-field-group", className), ...props });
21
+ }
22
+ function FieldSet({ className, ...props }) {
23
+ return _jsx(FieldSetPrimitive, { className: cx("mb-field-set", className), ...props });
24
+ }
25
+ function FieldLegend({ className, ...props }) {
26
+ return _jsx(FieldLegendPrimitive, { className: cx("mb-field-legend", className), ...props });
27
+ }
28
+ /** A label for a control outside a `Field`, pointed at it with `htmlFor`. */
29
+ function Label({ className, ...props }) {
30
+ return _jsx(LabelPrimitive, { className: cx("mb-field-label", className), ...props });
31
+ }
32
+ export { Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSet, Label };
@@ -0,0 +1,25 @@
1
+ import { MeterLabel, Meter as MeterPrimitive, MeterValue } from "@ui-sdk/react/meter";
2
+ import type * as React from "react";
3
+ type GaugeVariant = "linear" | "level" | "circular";
4
+ type GaugeLevel = "optimum" | "suboptimal" | "critical";
5
+ type GaugeProps = Omit<React.ComponentProps<typeof MeterPrimitive>, "children"> & {
6
+ children?: React.ReactNode;
7
+ /** `level` is the macOS segmented level indicator; `circular` is the open ring from watchOS and iOS widgets. */
8
+ variant?: GaugeVariant;
9
+ size?: "sm" | "md" | "lg";
10
+ /** Where the low region ends. With `high` and `optimum`, picks green, yellow or red as for an HTML meter. */
11
+ low?: number;
12
+ /** Where the high region starts. */
13
+ high?: number;
14
+ /** The best value. Below `low` means lower is better; above `high` means higher is better. */
15
+ optimum?: number;
16
+ /** How many segments a `level` gauge draws. */
17
+ segments?: number;
18
+ /** Draws the whole ring in a green-to-red gradient with a marker at the value, for a `circular` gauge. */
19
+ gradient?: boolean;
20
+ };
21
+ declare function Gauge({ variant, size, value, min, max, low, high, optimum, segments, gradient, className, children, ...props }: GaugeProps): React.JSX.Element;
22
+ declare function GaugeLabel({ className, ...props }: React.ComponentProps<typeof MeterLabel>): React.JSX.Element;
23
+ declare function GaugeValue({ className, ...props }: React.ComponentProps<typeof MeterValue>): React.JSX.Element;
24
+ export { Gauge, GaugeLabel, GaugeValue };
25
+ export type { GaugeLevel, GaugeProps, GaugeVariant };
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MeterIndicator, MeterLabel, Meter as MeterPrimitive, MeterTrack, MeterValue, } from "@ui-sdk/react/meter";
3
+ import { cx } from "../lib/cx.js";
4
+ function levelOf(value, min, max, low, high, optimum) {
5
+ if (low === undefined && high === undefined)
6
+ return undefined;
7
+ const lo = Math.min(Math.max(low ?? min, min), max);
8
+ const hi = Math.min(Math.max(high ?? max, lo), max);
9
+ const best = optimum ?? (min + max) / 2;
10
+ if (best < lo)
11
+ return value <= lo ? "optimum" : value <= hi ? "suboptimal" : "critical";
12
+ if (best > hi)
13
+ return value >= hi ? "optimum" : value >= lo ? "suboptimal" : "critical";
14
+ return value >= lo && value <= hi ? "optimum" : "suboptimal";
15
+ }
16
+ // A 270° arc open at the bottom, in a 100-unit box.
17
+ const arc = "M20.3 79.7A42 42 0 1 1 79.7 79.7";
18
+ function Gauge({ variant = "linear", size = "md", value, min = 0, max = 100, low, high, optimum, segments = 10, gradient, className, children, ...props }) {
19
+ const fraction = Math.min(Math.max((value - min) / (max - min || 1), 0), 1);
20
+ const level = levelOf(value, min, max, low, high, optimum);
21
+ const lit = Math.round(fraction * segments);
22
+ const higherIsBetter = optimum !== undefined && high !== undefined && optimum > high;
23
+ let visual;
24
+ if (variant === "circular") {
25
+ const angle = ((135 + 270 * fraction) * Math.PI) / 180;
26
+ visual = (_jsxs("span", { "aria-hidden": "true", className: "mb-gauge-dial", children: [gradient ? _jsx("span", { className: "mb-gauge-gradient" }) : null, _jsx("svg", { viewBox: "0 0 100 100", className: "mb-gauge-ring", children: gradient ? (_jsx("circle", { className: "mb-gauge-marker", cx: 50 + 42 * Math.cos(angle), cy: 50 + 42 * Math.sin(angle), r: "6" })) : (_jsxs(_Fragment, { children: [_jsx("path", { className: "mb-gauge-arc-track", d: arc, pathLength: 100 }), _jsx("path", { className: "mb-gauge-arc-edge", d: arc, pathLength: 100, strokeDasharray: `${fraction * 100} 100` }), _jsx("path", { className: "mb-gauge-arc-fill", d: arc, pathLength: 100, strokeDasharray: `${fraction * 100} 100` })] })) })] }));
27
+ }
28
+ else if (variant === "level") {
29
+ visual = (_jsx(MeterTrack, { className: "mb-gauge-track", children: Array.from({ length: segments }, (_, index) => (_jsx("span", { "data-lit": index < lit ? "" : undefined, className: "mb-gauge-segment" }, index))) }));
30
+ }
31
+ else {
32
+ visual = (_jsx(MeterTrack, { className: "mb-gauge-track", children: _jsx(MeterIndicator, { className: "mb-gauge-indicator" }) }));
33
+ }
34
+ return (_jsxs(MeterPrimitive, { value: value, min: min, max: max, "data-variant": variant, "data-size": size, "data-level": level, "data-gradient": gradient ? (higherIsBetter ? "reverse" : "") : undefined, className: cx("mb-gauge", className), ...props, children: [children, visual] }));
35
+ }
36
+ function GaugeLabel({ className, ...props }) {
37
+ return _jsx(MeterLabel, { className: cx("mb-gauge-label", className), ...props });
38
+ }
39
+ function GaugeValue({ className, ...props }) {
40
+ return _jsx(MeterValue, { className: cx("mb-gauge-value", className), ...props });
41
+ }
42
+ export { Gauge, GaugeLabel, GaugeValue };
@@ -0,0 +1,34 @@
1
+ import { type RenderProp } from "@ui-sdk/react/primitive";
2
+ import type * as React from "react";
3
+ type MaterialThickness = "ultrathin" | "thin" | "regular" | "thick" | "chrome" | "sidebar";
4
+ type GlassShape = "rounded" | "capsule" | "circle";
5
+ type MaterialProps = React.ComponentProps<"div"> & {
6
+ /** Thicker materials hide more of what's behind them. Use thicker ones for bigger surfaces. */
7
+ material?: MaterialThickness;
8
+ /** Renders a different element, such as `<aside />` or `<nav />`, with the material's props. */
9
+ render?: RenderProp;
10
+ };
11
+ /** A translucent surface that blurs what's behind it: bars, sidebars, popovers, sheets. */
12
+ declare function Material({ material, className, render, ...props }: MaterialProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
13
+ type GlassProps = React.ComponentProps<"div"> & {
14
+ /** `clear` is more transparent, for glass over media; `tinted` carries the accent. */
15
+ variant?: "regular" | "clear" | "tinted";
16
+ shape?: GlassShape;
17
+ /** Responds to hover and press, for glass that is itself a control. */
18
+ interactive?: boolean;
19
+ render?: RenderProp;
20
+ };
21
+ /** Liquid Glass: the clear, lensing layer for controls that float over content. */
22
+ declare function Glass({ variant, shape, interactive, className, render, ...props }: GlassProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
23
+ type GlassGroupProps = React.ComponentProps<"div"> & {
24
+ orientation?: "horizontal" | "vertical";
25
+ variant?: "regular" | "clear";
26
+ render?: RenderProp;
27
+ };
28
+ /**
29
+ * One capsule of glass holding a cluster of plain controls, like a toolbar's
30
+ * trailing buttons or a map's zoom controls. Give it an `aria-label`.
31
+ */
32
+ declare function GlassGroup({ orientation, variant, className, render, ...props }: GlassGroupProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
33
+ export { Glass, GlassGroup, Material };
34
+ export type { GlassGroupProps, GlassProps, GlassShape, MaterialProps, MaterialThickness };
@@ -0,0 +1,31 @@
1
+ import { renderElement } from "@ui-sdk/react/primitive";
2
+ import { join } from "../lib/cx.js";
3
+ /** A translucent surface that blurs what's behind it: bars, sidebars, popovers, sheets. */
4
+ function Material({ material = "regular", className, render, ...props }) {
5
+ return renderElement("div", { ...props, "data-material": material, className: join("mb-material", className) }, render);
6
+ }
7
+ /** Liquid Glass: the clear, lensing layer for controls that float over content. */
8
+ function Glass({ variant = "regular", shape = "rounded", interactive, className, render, ...props }) {
9
+ return renderElement("div", {
10
+ ...props,
11
+ "data-variant": variant,
12
+ "data-shape": shape,
13
+ "data-interactive": interactive ? "" : undefined,
14
+ className: join("mb-glass", className),
15
+ }, render);
16
+ }
17
+ /**
18
+ * One capsule of glass holding a cluster of plain controls, like a toolbar's
19
+ * trailing buttons or a map's zoom controls. Give it an `aria-label`.
20
+ */
21
+ function GlassGroup({ orientation = "horizontal", variant = "regular", className, render, ...props }) {
22
+ return renderElement("div", {
23
+ role: "group",
24
+ ...props,
25
+ "data-orientation": orientation,
26
+ "data-variant": variant,
27
+ "data-shape": "capsule",
28
+ className: join("mb-glass mb-glass-group", className),
29
+ }, render);
30
+ }
31
+ export { Glass, GlassGroup, Material };
@@ -0,0 +1,23 @@
1
+ import type * as React from "react";
2
+ import { type ArtworkPalette, type ArtworkTime, type ArtworkVariant } from "./artwork.js";
3
+ type HomeBackdropProps = React.ComponentProps<"div"> & {
4
+ /** The home's or the room's name. The same name draws the same wallpaper. */
5
+ seed: string;
6
+ /** `wash` is a soft color field; `horizon` and `window` are the other background variants. */
7
+ variant?: ArtworkVariant;
8
+ palette?: ArtworkPalette;
9
+ time?: ArtworkTime;
10
+ /** Width over height of the screen it fills. The art is drawn for it and cropped to fit. */
11
+ aspect?: number;
12
+ /** How far the wallpaper recedes behind tiles and text, from 0 to 1. */
13
+ dim?: number;
14
+ /** A photo to show instead of drawn art, like one a person chose for the room. It's blurred and dimmed the same way. */
15
+ src?: string;
16
+ };
17
+ /**
18
+ * A home's or a room's wallpaper, painted behind its children. The wallpaper stays put; make a child
19
+ * the scrolling element so tiles move over it.
20
+ */
21
+ declare function HomeBackdrop({ seed, variant, palette, time, aspect, dim, src, className, style, children, ...props }: HomeBackdropProps): React.JSX.Element;
22
+ export { HomeBackdrop };
23
+ export type { HomeBackdropProps };
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { join } from "../lib/cx.js";
3
+ import { Artwork } from "./artwork.js";
4
+ /**
5
+ * A home's or a room's wallpaper, painted behind its children. The wallpaper stays put; make a child
6
+ * the scrolling element so tiles move over it.
7
+ */
8
+ function HomeBackdrop({ seed, variant = "wash", palette, time, aspect = 1, dim = 0.35, src, className, style, children, ...props }) {
9
+ const veil = Number.isFinite(dim) ? Math.min(1, Math.max(0, dim)) : 0.35;
10
+ return (_jsxs("div", { className: join("mb-home-backdrop", className), style: { "--mb-home-backdrop-dim": String(veil), ...style }, ...props, children: [_jsx("div", { className: "mb-home-backdrop-layer", "aria-hidden": "true", children: src ? (_jsx("img", { className: "mb-home-backdrop-image", src: src, alt: "", decoding: "async" })) : (_jsx(Artwork, { seed: seed, variant: variant, palette: palette, time: time, aspect: aspect, shape: "square", finish: "flat" })) }), children] }));
11
+ }
12
+ export { HomeBackdrop };
@@ -0,0 +1,19 @@
1
+ import { Button as ButtonPrimitive } from "@ui-sdk/react/button";
2
+ import type * as React from "react";
3
+ /** A section of the Home tab: Favorites, Scenes, Cameras, or a room. */
4
+ declare function HomeSection({ className, ...props }: React.ComponentProps<"section">): React.JSX.Element;
5
+ declare function HomeSectionHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
6
+ type HomeSectionTitleProps = Omit<React.ComponentProps<"h2">, "onClick"> & {
7
+ level?: 2 | 3;
8
+ /** Makes the title a link to the room or category, with a chevron, like "Kitchen ›". */
9
+ href?: string;
10
+ /** Makes the title a button, for an app that shows the room in place. */
11
+ onClick?: React.MouseEventHandler<HTMLElement>;
12
+ /** A router's link element, in place of `href`. */
13
+ render?: React.ComponentProps<typeof ButtonPrimitive>["render"];
14
+ };
15
+ declare function HomeSectionTitle({ level, href, onClick, render, className, children, ...props }: HomeSectionTitleProps): React.JSX.Element;
16
+ /** A room's conditions in a line: "72° · 2 lights on · Humidity 41%". */
17
+ declare function HomeSectionSummary({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
18
+ export { HomeSection, HomeSectionHeader, HomeSectionSummary, HomeSectionTitle };
19
+ export type { HomeSectionTitleProps };
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button as ButtonPrimitive } from "@ui-sdk/react/button";
3
+ import { join } from "../lib/cx.js";
4
+ /** A section of the Home tab: Favorites, Scenes, Cameras, or a room. */
5
+ function HomeSection({ className, ...props }) {
6
+ return _jsx("section", { className: join("mb-home-section", className), ...props });
7
+ }
8
+ function HomeSectionHeader({ className, ...props }) {
9
+ return _jsx("div", { className: join("mb-home-section-header", className), ...props });
10
+ }
11
+ const chevron = (_jsx("svg", { className: "mb-home-section-chevron", viewBox: "0 0 8 14", "aria-hidden": "true", children: _jsx("path", { d: "M1.5 1.5 6.5 7l-5 5.5" }) }));
12
+ function HomeSectionTitle({ level = 2, href, onClick, render, className, children, ...props }) {
13
+ const Heading = level === 3 ? "h3" : "h2";
14
+ const interactive = href !== undefined || onClick !== undefined || render !== undefined;
15
+ return (_jsx(Heading, { className: join("mb-home-section-title", className), ...props, children: interactive ? (_jsxs(ButtonPrimitive, { render: render ?? (href !== undefined ? _jsx("a", { href: href }) : undefined), onClick: onClick, className: "mb-home-section-link", children: [children, chevron] })) : (children) }));
16
+ }
17
+ /** A room's conditions in a line: "72° · 2 lights on · Humidity 41%". */
18
+ function HomeSectionSummary({ className, ...props }) {
19
+ return _jsx("p", { className: join("mb-home-section-summary", className), ...props });
20
+ }
21
+ export { HomeSection, HomeSectionHeader, HomeSectionSummary, HomeSectionTitle };
@@ -0,0 +1,24 @@
1
+ import { Toggle as TogglePrimitive, ToggleGroup as ToggleGroupPrimitive } from "@ui-sdk/react/toggle";
2
+ import type * as React from "react";
3
+ import type { AccessoryTint } from "./accessory-tile.js";
4
+ type HomeStatusProps = React.ComponentProps<typeof ToggleGroupPrimitive>;
5
+ /**
6
+ * The category buttons under the home's name: Climate, Lights, Security, Speakers & TVs, Water, Energy.
7
+ * Each one sums up its category; choosing one shows that category's accessories. One at a time.
8
+ */
9
+ declare function HomeStatus({ className, ...props }: HomeStatusProps): React.JSX.Element;
10
+ type HomeStatusItemProps = Omit<React.ComponentProps<typeof TogglePrimitive>, "children"> & {
11
+ /** Identifies the category in the group's value, like "lights". */
12
+ value: string;
13
+ icon?: React.ReactNode;
14
+ /** The category: "Lights". */
15
+ label: React.ReactNode;
16
+ /** What's going on in it: "3 on", "68–72°", "Leak Detected". */
17
+ summary?: React.ReactNode;
18
+ tint?: AccessoryTint;
19
+ /** Something needs attention, like an unlocked door at night or a detected leak. Say what in `summary`. */
20
+ alert?: boolean;
21
+ };
22
+ declare function HomeStatusItem({ icon, label, summary, tint, alert, className, ...props }: HomeStatusItemProps): React.JSX.Element;
23
+ export { HomeStatus, HomeStatusItem };
24
+ export type { HomeStatusItemProps, HomeStatusProps };
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Toggle as TogglePrimitive, ToggleGroup as ToggleGroupPrimitive, } from "@ui-sdk/react/toggle";
3
+ import { cx } from "../lib/cx.js";
4
+ /**
5
+ * The category buttons under the home's name: Climate, Lights, Security, Speakers & TVs, Water, Energy.
6
+ * Each one sums up its category; choosing one shows that category's accessories. One at a time.
7
+ */
8
+ function HomeStatus({ className, ...props }) {
9
+ return _jsx(ToggleGroupPrimitive, { className: cx("mb-home-status", className), ...props });
10
+ }
11
+ function HomeStatusItem({ icon, label, summary, tint = "accent", alert, className, ...props }) {
12
+ return (_jsxs(TogglePrimitive, { "data-tint": tint, "data-alert": alert ? "" : undefined, className: cx("mb-home-status-item", className), ...props, children: [icon ? (_jsx("span", { className: "mb-home-status-icon", "aria-hidden": "true", children: icon })) : null, _jsxs("span", { className: "mb-home-status-text", children: [_jsx("span", { className: "mb-home-status-label", children: label }), summary ? _jsx("span", { className: "mb-home-status-summary", children: summary }) : null] })] }));
13
+ }
14
+ export { HomeStatus, HomeStatusItem };
@@ -0,0 +1,14 @@
1
+ import { HoverCard as HoverCardPrimitive, HoverCardContent as HoverCardContentPrimitive, HoverCardTrigger as HoverCardTriggerPrimitive } from "@ui-sdk/react/hover-card";
2
+ import type * as React from "react";
3
+ type HoverCardProps = React.ComponentProps<typeof HoverCardPrimitive>;
4
+ declare function HoverCard(props: HoverCardProps): React.JSX.Element;
5
+ /** The link. It stays a link: pressing it navigates, and the card only previews. */
6
+ declare function HoverCardTrigger({ className, ...props }: React.ComponentProps<typeof HoverCardTriggerPrimitive>): React.JSX.Element;
7
+ type HoverCardContentProps<Payload = unknown> = React.ComponentProps<typeof HoverCardContentPrimitive<Payload>> & {
8
+ /** Draws an arrow that points at the link. Link previews on Apple platforms usually have none. */
9
+ arrow?: boolean;
10
+ };
11
+ declare function HoverCardContent<Payload = unknown>({ arrow, sideOffset, arrowPadding, className, children, ...props }: HoverCardContentProps<Payload>): React.JSX.Element;
12
+ export { createHoverCardController } from "@ui-sdk/react/hover-card";
13
+ export { HoverCard, HoverCardContent, HoverCardTrigger };
14
+ export type { HoverCardContentProps, HoverCardProps };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { HoverCard as HoverCardPrimitive, HoverCardArrow, HoverCardContent as HoverCardContentPrimitive, HoverCardTrigger as HoverCardTriggerPrimitive, } from "@ui-sdk/react/hover-card";
4
+ import { cx } from "../lib/cx.js";
5
+ function HoverCard(props) {
6
+ return _jsx(HoverCardPrimitive, { ...props });
7
+ }
8
+ /** The link. It stays a link: pressing it navigates, and the card only previews. */
9
+ function HoverCardTrigger({ className, ...props }) {
10
+ return _jsx(HoverCardTriggerPrimitive, { className: cx("mb-hover-card-trigger", className), ...props });
11
+ }
12
+ function HoverCardContent({ arrow = false, sideOffset, arrowPadding = 14, className, children, ...props }) {
13
+ return (_jsx(HoverCardContentPrimitive, { sideOffset: sideOffset ?? (arrow ? 12 : 8), arrowPadding: arrowPadding, className: cx("mb-hover-card", className), ...props, children: (state) => (_jsxs(_Fragment, { children: [arrow ? _jsx(HoverCardArrow, { className: "mb-hover-card-arrow" }) : null, typeof children === "function" ? children(state) : children] })) }));
14
+ }
15
+ export { createHoverCardController } from "@ui-sdk/react/hover-card";
16
+ export { HoverCard, HoverCardContent, HoverCardTrigger };
@@ -0,0 +1,19 @@
1
+ import { Slider as SliderPrimitive, SliderValue as SliderValuePrimitive } from "@ui-sdk/react/slider";
2
+ import type * as React from "react";
3
+ type LevelControlProps = Omit<React.ComponentProps<typeof SliderPrimitive>, "children"> & {
4
+ /** `lg` is the tall control of an accessory sheet; `md` fits a Mac popover. */
5
+ size?: "md" | "lg";
6
+ /** The fill: warm white-yellow for lights, the accent, or plain white for shades, fans and speakers. */
7
+ tone?: "light" | "accent" | "neutral";
8
+ /** A glyph drawn inside the track at the minimum end. It changes color to read on the fill. */
9
+ icon?: React.ReactNode;
10
+ /** Names the control for assistive tech, like "Pendant lights brightness". */
11
+ label: string;
12
+ /** Draws this many equal segments, for discrete levels like a fan's speeds. */
13
+ steps?: number;
14
+ children?: React.ReactNode;
15
+ };
16
+ declare function LevelControl({ orientation, size, tone, icon, label, steps, className, children, ...props }: LevelControlProps): React.JSX.Element;
17
+ declare function LevelControlValue({ className, ...props }: React.ComponentProps<typeof SliderValuePrimitive>): React.JSX.Element;
18
+ export { LevelControl, LevelControlValue };
19
+ export type { LevelControlProps };