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.
- package/LICENSE +201 -0
- package/README.md +92 -2
- package/dist/components/accessory-tile.d.ts +50 -0
- package/dist/components/accessory-tile.js +46 -0
- package/dist/components/activity-indicator.d.ts +15 -0
- package/dist/components/activity-indicator.js +15 -0
- package/dist/components/alert.d.ts +29 -0
- package/dist/components/alert.js +30 -0
- package/dist/components/artwork.d.ts +44 -0
- package/dist/components/artwork.js +935 -0
- package/dist/components/automation-row.d.ts +24 -0
- package/dist/components/automation-row.js +12 -0
- package/dist/components/avatar.d.ts +33 -0
- package/dist/components/avatar.js +45 -0
- package/dist/components/badge.d.ts +24 -0
- package/dist/components/badge.js +19 -0
- package/dist/components/button.d.ts +20 -0
- package/dist/components/button.js +10 -0
- package/dist/components/calendar.d.ts +30 -0
- package/dist/components/calendar.js +47 -0
- package/dist/components/camera-view.d.ts +40 -0
- package/dist/components/camera-view.js +44 -0
- package/dist/components/card.d.ts +14 -0
- package/dist/components/card.js +21 -0
- package/dist/components/carousel.d.ts +18 -0
- package/dist/components/carousel.js +33 -0
- package/dist/components/checkbox.d.ts +13 -0
- package/dist/components/checkbox.js +16 -0
- package/dist/components/code-field.d.ts +16 -0
- package/dist/components/code-field.js +29 -0
- package/dist/components/color-well.d.ts +23 -0
- package/dist/components/color-well.js +27 -0
- package/dist/components/combo-box.d.ts +42 -0
- package/dist/components/combo-box.js +102 -0
- package/dist/components/command-palette.d.ts +33 -0
- package/dist/components/command-palette.js +55 -0
- package/dist/components/context-menu.d.ts +9 -0
- package/dist/components/context-menu.js +15 -0
- package/dist/components/date-picker.d.ts +53 -0
- package/dist/components/date-picker.js +86 -0
- package/dist/components/device-frame.d.ts +18 -0
- package/dist/components/device-frame.js +16 -0
- package/dist/components/dialog.d.ts +27 -0
- package/dist/components/dialog.js +35 -0
- package/dist/components/disclosure.d.ts +32 -0
- package/dist/components/disclosure.js +35 -0
- package/dist/components/dock.d.ts +28 -0
- package/dist/components/dock.js +80 -0
- package/dist/components/door-control.d.ts +20 -0
- package/dist/components/door-control.js +43 -0
- package/dist/components/energy-readout.d.ts +32 -0
- package/dist/components/energy-readout.js +27 -0
- package/dist/components/field.d.ts +28 -0
- package/dist/components/field.js +32 -0
- package/dist/components/gauge.d.ts +25 -0
- package/dist/components/gauge.js +42 -0
- package/dist/components/glass.d.ts +34 -0
- package/dist/components/glass.js +31 -0
- package/dist/components/home-backdrop.d.ts +23 -0
- package/dist/components/home-backdrop.js +12 -0
- package/dist/components/home-section.d.ts +19 -0
- package/dist/components/home-section.js +21 -0
- package/dist/components/home-status.d.ts +24 -0
- package/dist/components/home-status.js +14 -0
- package/dist/components/hover-card.d.ts +14 -0
- package/dist/components/hover-card.js +16 -0
- package/dist/components/level-control.d.ts +19 -0
- package/dist/components/level-control.js +13 -0
- package/dist/components/light-color-picker.d.ts +33 -0
- package/dist/components/light-color-picker.js +56 -0
- package/dist/components/list.d.ts +42 -0
- package/dist/components/list.js +42 -0
- package/dist/components/listbox.d.ts +16 -0
- package/dist/components/listbox.js +28 -0
- package/dist/components/lock-control.d.ts +20 -0
- package/dist/components/lock-control.js +35 -0
- package/dist/components/menu-bar.d.ts +14 -0
- package/dist/components/menu-bar.js +16 -0
- package/dist/components/menu.d.ts +40 -0
- package/dist/components/menu.js +54 -0
- package/dist/components/navigation-bar.d.ts +24 -0
- package/dist/components/navigation-bar.js +54 -0
- package/dist/components/outline.d.ts +21 -0
- package/dist/components/outline.js +40 -0
- package/dist/components/page-control.d.ts +10 -0
- package/dist/components/page-control.js +8 -0
- package/dist/components/popover.d.ts +16 -0
- package/dist/components/popover.js +24 -0
- package/dist/components/progress.d.ts +27 -0
- package/dist/components/progress.js +27 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.js +13 -0
- package/dist/components/rating.d.ts +10 -0
- package/dist/components/rating.js +12 -0
- package/dist/components/scene-tile.d.ts +22 -0
- package/dist/components/scene-tile.js +13 -0
- package/dist/components/scroll-view.d.ts +21 -0
- package/dist/components/scroll-view.js +13 -0
- package/dist/components/search-field.d.ts +16 -0
- package/dist/components/search-field.js +12 -0
- package/dist/components/secure-field.d.ts +23 -0
- package/dist/components/secure-field.js +21 -0
- package/dist/components/segmented-control.d.ts +12 -0
- package/dist/components/segmented-control.js +10 -0
- package/dist/components/select.d.ts +45 -0
- package/dist/components/select.js +79 -0
- package/dist/components/sensor-readout.d.ts +29 -0
- package/dist/components/sensor-readout.js +12 -0
- package/dist/components/separator.d.ts +14 -0
- package/dist/components/separator.js +11 -0
- package/dist/components/setup-code.d.ts +29 -0
- package/dist/components/setup-code.js +47 -0
- package/dist/components/sheet.d.ts +31 -0
- package/dist/components/sheet.js +51 -0
- package/dist/components/sidebar.d.ts +30 -0
- package/dist/components/sidebar.js +26 -0
- package/dist/components/slider.d.ts +27 -0
- package/dist/components/slider.js +43 -0
- package/dist/components/split-view.d.ts +11 -0
- package/dist/components/split-view.js +13 -0
- package/dist/components/squircle.d.ts +41 -0
- package/dist/components/squircle.js +63 -0
- package/dist/components/stepper.d.ts +30 -0
- package/dist/components/stepper.js +28 -0
- package/dist/components/switch.d.ts +10 -0
- package/dist/components/switch.js +10 -0
- package/dist/components/tab-bar.d.ts +20 -0
- package/dist/components/tab-bar.js +17 -0
- package/dist/components/table.d.ts +49 -0
- package/dist/components/table.js +179 -0
- package/dist/components/tabs.d.ts +16 -0
- package/dist/components/tabs.js +19 -0
- package/dist/components/text-area.d.ts +14 -0
- package/dist/components/text-area.js +9 -0
- package/dist/components/text-field.d.ts +26 -0
- package/dist/components/text-field.js +23 -0
- package/dist/components/thermostat-control.d.ts +30 -0
- package/dist/components/thermostat-control.js +139 -0
- package/dist/components/toast.d.ts +30 -0
- package/dist/components/toast.js +114 -0
- package/dist/components/toggle.d.ts +21 -0
- package/dist/components/toggle.js +19 -0
- package/dist/components/token-field.d.ts +31 -0
- package/dist/components/token-field.js +78 -0
- package/dist/components/toolbar.d.ts +27 -0
- package/dist/components/toolbar.js +39 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +18 -0
- package/dist/components/window.d.ts +56 -0
- package/dist/components/window.js +61 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +79 -0
- package/dist/lib/cx.d.ts +9 -0
- package/dist/lib/cx.js +14 -0
- package/dist/lib/derive.d.ts +53 -0
- package/dist/lib/derive.js +255 -0
- package/dist/lib/field-glyphs.d.ts +13 -0
- package/dist/lib/field-glyphs.js +28 -0
- package/dist/lib/menu-glyphs.d.ts +6 -0
- package/dist/lib/menu-glyphs.js +15 -0
- package/dist/lib/platform.d.ts +18 -0
- package/dist/lib/platform.js +17 -0
- package/dist/lib/squircle.d.ts +23 -0
- package/dist/lib/squircle.js +69 -0
- package/dist/lib/theme.d.ts +42 -0
- package/dist/lib/theme.js +62 -0
- package/dist/styles/base.css +115 -0
- package/dist/styles/components/accessory-tile.css +461 -0
- package/dist/styles/components/activity-indicator.css +63 -0
- package/dist/styles/components/alert.css +433 -0
- package/dist/styles/components/artwork.css +380 -0
- package/dist/styles/components/automation-row.css +52 -0
- package/dist/styles/components/avatar.css +230 -0
- package/dist/styles/components/badge.css +204 -0
- package/dist/styles/components/button.css +298 -0
- package/dist/styles/components/calendar.css +287 -0
- package/dist/styles/components/camera-view.css +239 -0
- package/dist/styles/components/card.css +100 -0
- package/dist/styles/components/carousel.css +210 -0
- package/dist/styles/components/checkbox.css +212 -0
- package/dist/styles/components/code-field.css +163 -0
- package/dist/styles/components/color-well.css +452 -0
- package/dist/styles/components/combo-box.css +222 -0
- package/dist/styles/components/command-palette.css +379 -0
- package/dist/styles/components/context-menu.css +43 -0
- package/dist/styles/components/date-picker.css +356 -0
- package/dist/styles/components/device-frame.css +194 -0
- package/dist/styles/components/dialog.css +366 -0
- package/dist/styles/components/disclosure.css +197 -0
- package/dist/styles/components/dock.css +404 -0
- package/dist/styles/components/door-control.css +187 -0
- package/dist/styles/components/energy-readout.css +161 -0
- package/dist/styles/components/field.css +175 -0
- package/dist/styles/components/gauge.css +239 -0
- package/dist/styles/components/glass.css +113 -0
- package/dist/styles/components/home-backdrop.css +81 -0
- package/dist/styles/components/home-section.css +100 -0
- package/dist/styles/components/home-status.css +215 -0
- package/dist/styles/components/hover-card.css +145 -0
- package/dist/styles/components/index.css +75 -0
- package/dist/styles/components/level-control.css +247 -0
- package/dist/styles/components/light-color-picker.css +94 -0
- package/dist/styles/components/list.css +411 -0
- package/dist/styles/components/listbox.css +168 -0
- package/dist/styles/components/lock-control.css +164 -0
- package/dist/styles/components/menu-bar.css +94 -0
- package/dist/styles/components/menu.css +454 -0
- package/dist/styles/components/navigation-bar.css +248 -0
- package/dist/styles/components/outline.css +248 -0
- package/dist/styles/components/page-control.css +127 -0
- package/dist/styles/components/popover.css +186 -0
- package/dist/styles/components/progress.css +228 -0
- package/dist/styles/components/radio.css +281 -0
- package/dist/styles/components/rating.css +122 -0
- package/dist/styles/components/scene-tile.css +295 -0
- package/dist/styles/components/scroll-view.css +195 -0
- package/dist/styles/components/search-field.css +128 -0
- package/dist/styles/components/secure-field.css +189 -0
- package/dist/styles/components/segmented-control.css +183 -0
- package/dist/styles/components/select.css +290 -0
- package/dist/styles/components/sensor-readout.css +231 -0
- package/dist/styles/components/separator.css +62 -0
- package/dist/styles/components/setup-code.css +138 -0
- package/dist/styles/components/sheet.css +345 -0
- package/dist/styles/components/sidebar.css +261 -0
- package/dist/styles/components/slider.css +208 -0
- package/dist/styles/components/split-view.css +75 -0
- package/dist/styles/components/squircle.css +44 -0
- package/dist/styles/components/stepper.css +278 -0
- package/dist/styles/components/switch.css +115 -0
- package/dist/styles/components/tab-bar.css +223 -0
- package/dist/styles/components/table.css +313 -0
- package/dist/styles/components/tabs.css +262 -0
- package/dist/styles/components/text-area.css +94 -0
- package/dist/styles/components/text-field.css +294 -0
- package/dist/styles/components/thermostat-control.css +214 -0
- package/dist/styles/components/toast.css +418 -0
- package/dist/styles/components/toggle.css +312 -0
- package/dist/styles/components/token-field.css +193 -0
- package/dist/styles/components/toolbar.css +370 -0
- package/dist/styles/components/tooltip.css +69 -0
- package/dist/styles/components/window.css +428 -0
- package/dist/styles/index.css +17 -0
- package/dist/styles/materials.css +263 -0
- package/dist/styles/platforms.css +214 -0
- package/dist/styles/themes/ember.css +24 -0
- package/dist/styles/themes/graphite.css +16 -0
- package/dist/styles/themes/nebula.css +16 -0
- package/dist/styles/themes/system.css +28 -0
- package/dist/styles/tokens.css +299 -0
- package/package.json +82 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Toggle as TogglePrimitive, ToggleGroup as ToggleGroupPrimitive, ToggleIcon as ToggleIconPrimitive, } from "@ui-sdk/react/toggle";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cx } from "../lib/cx.js";
|
|
5
|
+
// Bare text gets a span so the stylesheet can pad a labeled toggle differently from an icon-only one.
|
|
6
|
+
function wrapText(children) {
|
|
7
|
+
return React.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? (_jsx("span", { className: "mb-toggle-label", children: child })) : (child));
|
|
8
|
+
}
|
|
9
|
+
// No defaults written to the DOM: a toggle inside a ToggleGroup takes the group's variant and size.
|
|
10
|
+
function Toggle({ variant, tone, size, className, children, ...props }) {
|
|
11
|
+
return (_jsx(TogglePrimitive, { "data-variant": variant, "data-tone": tone, "data-size": size, className: cx("mb-toggle", className), ...props, children: typeof children === "function" ? children : wrapText(children) }));
|
|
12
|
+
}
|
|
13
|
+
function ToggleIcon({ className, ...props }) {
|
|
14
|
+
return _jsx(ToggleIconPrimitive, { className: cx("mb-toggle-icon", className), ...props });
|
|
15
|
+
}
|
|
16
|
+
function ToggleGroup({ variant = "plain", size = "md", className, ...props }) {
|
|
17
|
+
return (_jsx(ToggleGroupPrimitive, { "data-variant": variant, "data-size": size, className: cx("mb-toggle-group", className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
export { Toggle, ToggleGroup, ToggleIcon };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Token, TokenInputEditor, type TokenInputProps, TokenInputToken, TokenInputTokenRemove } from "@ui-sdk/react/token-input";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type NewToken = Omit<Token, "id">;
|
|
4
|
+
type EditorProps = React.ComponentProps<typeof TokenInputEditor>;
|
|
5
|
+
type TokenFieldProps = TokenInputProps & {
|
|
6
|
+
size?: "sm" | "md" | "lg";
|
|
7
|
+
/** `auto` is bordered on macOS and filled on touch, like `TextField`. */
|
|
8
|
+
variant?: "auto" | "bordered" | "filled";
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
className?: EditorProps["className"];
|
|
12
|
+
"aria-label"?: string;
|
|
13
|
+
"aria-labelledby"?: string;
|
|
14
|
+
/** Characters that turn the text typed before them into a token. Return and leaving the field do too. `false` turns it off. */
|
|
15
|
+
tokenizeOn?: readonly string[] | false;
|
|
16
|
+
/** Makes a token from typed text, or returns `null` to leave the text as it is. */
|
|
17
|
+
createToken?: (text: string) => NewToken | null;
|
|
18
|
+
/** Draws a remove button on each token. Backspace removes them either way. */
|
|
19
|
+
removable?: boolean;
|
|
20
|
+
/** More props for the editor, the element that draws the field. */
|
|
21
|
+
editorProps?: Omit<EditorProps, "placeholder" | "className">;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The macOS token field: text where each entry becomes a rounded, accent-tinted
|
|
25
|
+
* token. Type a name and a comma or Return to make one.
|
|
26
|
+
*/
|
|
27
|
+
declare function TokenField({ size, variant, placeholder, id, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, tokenizeOn, createToken, removable, editorProps, controller: controllerProp, onValueChange, onSubmit, renderToken, submitShortcut, children, ...options }: TokenFieldProps): React.JSX.Element;
|
|
28
|
+
declare function TokenFieldToken({ className, ...props }: React.ComponentProps<typeof TokenInputToken>): React.JSX.Element;
|
|
29
|
+
declare function TokenFieldTokenRemove({ className, children, ...props }: React.ComponentProps<typeof TokenInputTokenRemove>): React.JSX.Element;
|
|
30
|
+
export { TokenField, TokenFieldToken, TokenFieldTokenRemove };
|
|
31
|
+
export type { TokenFieldProps };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createTokenInputController, TokenInput, TokenInputEditor, TokenInputToken, TokenInputTokenRemove, } from "@ui-sdk/react/token-input";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cx } from "../lib/cx.js";
|
|
6
|
+
import { ClearGlyph } from "../lib/field-glyphs.js";
|
|
7
|
+
const defaultSeparators = [","];
|
|
8
|
+
const plainToken = (text) => ({ type: "token", value: text, label: text });
|
|
9
|
+
/**
|
|
10
|
+
* The macOS token field: text where each entry becomes a rounded, accent-tinted
|
|
11
|
+
* token. Type a name and a comma or Return to make one.
|
|
12
|
+
*/
|
|
13
|
+
function TokenField({ size = "md", variant = "auto", placeholder, id, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, tokenizeOn = defaultSeparators, createToken = plainToken, removable, editorProps, controller: controllerProp, onValueChange, onSubmit, renderToken, submitShortcut = "enter", children, ...options }) {
|
|
14
|
+
const [own] = React.useState(createTokenInputController);
|
|
15
|
+
const controller = controllerProp ?? own;
|
|
16
|
+
const separators = tokenizeOn || [];
|
|
17
|
+
const tokenize = React.useCallback((value, all) => {
|
|
18
|
+
let changed = false;
|
|
19
|
+
const next = [];
|
|
20
|
+
value.forEach((segment, i) => {
|
|
21
|
+
if (typeof segment !== "string")
|
|
22
|
+
return void next.push(segment);
|
|
23
|
+
const pieces = split(segment, separators);
|
|
24
|
+
const closeLast = all && i === value.length - 1;
|
|
25
|
+
const made = [];
|
|
26
|
+
for (const [p, piece] of pieces.entries()) {
|
|
27
|
+
const open = p === pieces.length - 1 && !closeLast;
|
|
28
|
+
const text = piece.trim();
|
|
29
|
+
if (open) {
|
|
30
|
+
const rest = pieces.length > 1 ? piece.trimStart() : piece;
|
|
31
|
+
if (rest)
|
|
32
|
+
made.push(rest);
|
|
33
|
+
}
|
|
34
|
+
else if (text) {
|
|
35
|
+
const token = createToken(text);
|
|
36
|
+
if (!token)
|
|
37
|
+
return void next.push(segment);
|
|
38
|
+
made.push(token);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (made.length !== 1 || made[0] !== segment)
|
|
42
|
+
changed = true;
|
|
43
|
+
next.push(...made);
|
|
44
|
+
});
|
|
45
|
+
if (changed) {
|
|
46
|
+
controller.setValue(next);
|
|
47
|
+
controller.focus({ at: "end" });
|
|
48
|
+
}
|
|
49
|
+
return changed;
|
|
50
|
+
}, [controller, createToken, separators]);
|
|
51
|
+
return (_jsxs(TokenInput, { controller: controller, submitShortcut: submitShortcut, onValueChange: (value, details) => {
|
|
52
|
+
onValueChange?.(value, details);
|
|
53
|
+
const typedSeparator = value.some((segment) => typeof segment === "string" && separators.some((s) => segment.includes(s)));
|
|
54
|
+
if (typedSeparator && details.reason !== "imperative")
|
|
55
|
+
queueMicrotask(() => tokenize(value, false));
|
|
56
|
+
}, onSubmit: (value, details) => {
|
|
57
|
+
if (!(tokenizeOn && tokenize(value, true)))
|
|
58
|
+
onSubmit?.(value, details);
|
|
59
|
+
}, renderToken: renderToken ??
|
|
60
|
+
((token) => (_jsxs(TokenFieldToken, { children: [token.label, removable ? _jsx(TokenFieldTokenRemove, {}) : null] }))), ...options, children: [_jsx(TokenInputEditor, { id: id, placeholder: placeholder, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "data-size": size, "data-variant": variant, className: cx("mb-token-field", className), ...editorProps, onBlur: (event) => {
|
|
61
|
+
editorProps?.onBlur?.(event);
|
|
62
|
+
if (tokenizeOn)
|
|
63
|
+
tokenize(controller.getValue(), true);
|
|
64
|
+
} }), children] }));
|
|
65
|
+
}
|
|
66
|
+
function split(text, separators) {
|
|
67
|
+
if (separators.length === 0)
|
|
68
|
+
return [text];
|
|
69
|
+
const pattern = new RegExp(separators.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"));
|
|
70
|
+
return text.split(pattern);
|
|
71
|
+
}
|
|
72
|
+
function TokenFieldToken({ className, ...props }) {
|
|
73
|
+
return _jsx(TokenInputToken, { className: cx("mb-token-field-token", className), ...props });
|
|
74
|
+
}
|
|
75
|
+
function TokenFieldTokenRemove({ className, children, ...props }) {
|
|
76
|
+
return (_jsx(TokenInputTokenRemove, { className: cx("mb-token-field-token-remove", className), ...props, children: children ?? _jsx(ClearGlyph, {}) }));
|
|
77
|
+
}
|
|
78
|
+
export { TokenField, TokenFieldToken, TokenFieldTokenRemove };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Toggle, ToggleGroup } from "@ui-sdk/react/toggle";
|
|
2
|
+
import { ToolbarButton as ToolbarButtonPrimitive, ToolbarGroup as ToolbarGroupPrimitive, ToolbarInput as ToolbarInputPrimitive, ToolbarLink as ToolbarLinkPrimitive, Toolbar as ToolbarPrimitive, ToolbarSeparator as ToolbarSeparatorPrimitive } from "@ui-sdk/react/toolbar";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
type ToolbarProps = React.ComponentProps<typeof ToolbarPrimitive> & {
|
|
5
|
+
/** `unified` sits in a macOS window's title bar; `floating` is the iOS bottom toolbar of glass capsules. */
|
|
6
|
+
variant?: "unified" | "floating";
|
|
7
|
+
};
|
|
8
|
+
declare function Toolbar({ variant, className, ...props }: ToolbarProps): React.JSX.Element;
|
|
9
|
+
declare function ToolbarButton({ className, ...props }: React.ComponentProps<typeof ToolbarButtonPrimitive>): React.JSX.Element;
|
|
10
|
+
/** A toolbar button that stays pressed, like Show Sidebar or a view mode. */
|
|
11
|
+
declare function ToolbarToggle({ className, ...props }: React.ComponentProps<typeof Toggle>): React.JSX.Element;
|
|
12
|
+
declare function ToolbarLink({ className, ...props }: React.ComponentProps<typeof ToolbarLinkPrimitive>): React.JSX.Element;
|
|
13
|
+
declare function ToolbarGroup({ className, ...props }: React.ComponentProps<typeof ToolbarGroupPrimitive>): React.JSX.Element;
|
|
14
|
+
/** One choice from a cluster of toggles, like the Finder's icon, list and column views. */
|
|
15
|
+
declare function ToolbarToggleGroup({ className, ...props }: React.ComponentProps<typeof ToggleGroup>): React.JSX.Element;
|
|
16
|
+
declare function ToolbarSeparator({ className, ...props }: React.ComponentProps<typeof ToolbarSeparatorPrimitive>): React.JSX.Element;
|
|
17
|
+
/** Flexible space: pushes what follows to the trailing edge. */
|
|
18
|
+
declare function ToolbarSpacer({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
19
|
+
type ToolbarTitleProps = React.ComponentProps<"div"> & {
|
|
20
|
+
subtitle?: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
declare function ToolbarTitle({ subtitle, className, children, ...props }: ToolbarTitleProps): React.JSX.Element;
|
|
23
|
+
type ToolbarSearchFieldProps = React.ComponentProps<typeof ToolbarInputPrimitive>;
|
|
24
|
+
/** A search field that joins the toolbar's arrow-key navigation. Name it with `aria-label`. */
|
|
25
|
+
declare function ToolbarSearchField({ className, placeholder, ...props }: ToolbarSearchFieldProps): React.JSX.Element;
|
|
26
|
+
export { Toolbar, ToolbarButton, ToolbarGroup, ToolbarLink, ToolbarSearchField, ToolbarSeparator, ToolbarSpacer, ToolbarTitle, ToolbarToggle, ToolbarToggleGroup, };
|
|
27
|
+
export type { ToolbarProps, ToolbarSearchFieldProps, ToolbarTitleProps };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Toggle, ToggleGroup } from "@ui-sdk/react/toggle";
|
|
3
|
+
import { ToolbarButton as ToolbarButtonPrimitive, ToolbarGroup as ToolbarGroupPrimitive, ToolbarInput as ToolbarInputPrimitive, ToolbarLink as ToolbarLinkPrimitive, Toolbar as ToolbarPrimitive, ToolbarSeparator as ToolbarSeparatorPrimitive, } from "@ui-sdk/react/toolbar";
|
|
4
|
+
import { cx, join } from "../lib/cx.js";
|
|
5
|
+
function Toolbar({ variant = "unified", className, ...props }) {
|
|
6
|
+
return _jsx(ToolbarPrimitive, { "data-variant": variant, className: cx("mb-toolbar", className), ...props });
|
|
7
|
+
}
|
|
8
|
+
function ToolbarButton({ className, ...props }) {
|
|
9
|
+
return _jsx(ToolbarButtonPrimitive, { className: cx("mb-toolbar-button", className), ...props });
|
|
10
|
+
}
|
|
11
|
+
/** A toolbar button that stays pressed, like Show Sidebar or a view mode. */
|
|
12
|
+
function ToolbarToggle({ className, ...props }) {
|
|
13
|
+
return _jsx(Toggle, { className: cx("mb-toolbar-button", className), ...props });
|
|
14
|
+
}
|
|
15
|
+
function ToolbarLink({ className, ...props }) {
|
|
16
|
+
return _jsx(ToolbarLinkPrimitive, { className: cx("mb-toolbar-button", className), ...props });
|
|
17
|
+
}
|
|
18
|
+
function ToolbarGroup({ className, ...props }) {
|
|
19
|
+
return _jsx(ToolbarGroupPrimitive, { className: cx("mb-toolbar-group", className), ...props });
|
|
20
|
+
}
|
|
21
|
+
/** One choice from a cluster of toggles, like the Finder's icon, list and column views. */
|
|
22
|
+
function ToolbarToggleGroup({ className, ...props }) {
|
|
23
|
+
return _jsx(ToggleGroup, { className: cx("mb-toolbar-group", className), ...props });
|
|
24
|
+
}
|
|
25
|
+
function ToolbarSeparator({ className, ...props }) {
|
|
26
|
+
return _jsx(ToolbarSeparatorPrimitive, { className: cx("mb-toolbar-separator", className), ...props });
|
|
27
|
+
}
|
|
28
|
+
/** Flexible space: pushes what follows to the trailing edge. */
|
|
29
|
+
function ToolbarSpacer({ className, ...props }) {
|
|
30
|
+
return _jsx("div", { "aria-hidden": "true", className: join("mb-toolbar-spacer", className), ...props });
|
|
31
|
+
}
|
|
32
|
+
function ToolbarTitle({ subtitle, className, children, ...props }) {
|
|
33
|
+
return (_jsxs("div", { className: join("mb-toolbar-title", className), ...props, children: [_jsx("span", { className: "mb-toolbar-title-text", children: children }), subtitle ? _jsx("span", { className: "mb-toolbar-subtitle", children: subtitle }) : null] }));
|
|
34
|
+
}
|
|
35
|
+
/** A search field that joins the toolbar's arrow-key navigation. Name it with `aria-label`. */
|
|
36
|
+
function ToolbarSearchField({ className, placeholder = "Search", ...props }) {
|
|
37
|
+
return (_jsxs("span", { className: "mb-toolbar-search", children: [_jsxs("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className: "mb-toolbar-search-icon", children: [_jsx("circle", { cx: "7", cy: "7", r: "4.75" }), _jsx("path", { d: "m10.5 10.5 3.25 3.25" })] }), _jsx(ToolbarInputPrimitive, { type: "search", placeholder: placeholder, className: cx("mb-toolbar-search-input", className), ...props })] }));
|
|
38
|
+
}
|
|
39
|
+
export { Toolbar, ToolbarButton, ToolbarGroup, ToolbarLink, ToolbarSearchField, ToolbarSeparator, ToolbarSpacer, ToolbarTitle, ToolbarToggle, ToolbarToggleGroup, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tooltip as TooltipPrimitive, TooltipContent as TooltipContentPrimitive, TooltipShortcut as TooltipShortcutPrimitive, TooltipTrigger as TooltipTriggerPrimitive } from "@ui-sdk/react/tooltip";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
type TooltipProps = React.ComponentProps<typeof TooltipPrimitive>;
|
|
4
|
+
/** A macOS help tag. It appears after a short rest; set `delay` to change how long. */
|
|
5
|
+
declare function Tooltip({ delay, ...props }: TooltipProps): React.JSX.Element;
|
|
6
|
+
declare function TooltipTrigger(props: React.ComponentProps<typeof TooltipTriggerPrimitive>): React.JSX.Element;
|
|
7
|
+
declare function TooltipContent({ side, sideOffset, collisionPadding, className, ...props }: React.ComponentProps<typeof TooltipContentPrimitive>): React.JSX.Element;
|
|
8
|
+
declare function TooltipShortcut({ className, ...props }: React.ComponentProps<typeof TooltipShortcutPrimitive>): React.JSX.Element;
|
|
9
|
+
export { createTooltipController } from "@ui-sdk/react/tooltip";
|
|
10
|
+
export { Tooltip, TooltipContent, TooltipShortcut, TooltipTrigger };
|
|
11
|
+
export type { TooltipProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as TooltipPrimitive, TooltipContent as TooltipContentPrimitive, TooltipShortcut as TooltipShortcutPrimitive, TooltipTrigger as TooltipTriggerPrimitive, } from "@ui-sdk/react/tooltip";
|
|
3
|
+
import { cx } from "../lib/cx.js";
|
|
4
|
+
/** A macOS help tag. It appears after a short rest; set `delay` to change how long. */
|
|
5
|
+
function Tooltip({ delay = 400, ...props }) {
|
|
6
|
+
return _jsx(TooltipPrimitive, { delay: delay, ...props });
|
|
7
|
+
}
|
|
8
|
+
function TooltipTrigger(props) {
|
|
9
|
+
return _jsx(TooltipTriggerPrimitive, { ...props });
|
|
10
|
+
}
|
|
11
|
+
function TooltipContent({ side = "bottom", sideOffset = 6, collisionPadding = 8, className, ...props }) {
|
|
12
|
+
return (_jsx(TooltipContentPrimitive, { side: side, sideOffset: sideOffset, collisionPadding: collisionPadding, className: cx("mb-tooltip", className), ...props }));
|
|
13
|
+
}
|
|
14
|
+
function TooltipShortcut({ className, ...props }) {
|
|
15
|
+
return _jsx(TooltipShortcutPrimitive, { className: cx("mb-tooltip-shortcut", className), ...props });
|
|
16
|
+
}
|
|
17
|
+
export { createTooltipController } from "@ui-sdk/react/tooltip";
|
|
18
|
+
export { Tooltip, TooltipContent, TooltipShortcut, TooltipTrigger };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
type WindowProps = React.ComponentProps<"div"> & {
|
|
3
|
+
/** Draws the window as it looks behind the key window: gray traffic lights, quieter chrome. */
|
|
4
|
+
inactive?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare function Window({ inactive, className, ...props }: WindowProps): React.JSX.Element;
|
|
7
|
+
type WindowTitlebarProps = React.ComponentProps<"div"> & {
|
|
8
|
+
/** `unified` is the 52px title bar that holds a toolbar; `compact` is the 28px title-only bar. */
|
|
9
|
+
variant?: "unified" | "compact";
|
|
10
|
+
/** Draws the hairline between the title bar and the content. */
|
|
11
|
+
bordered?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function WindowTitlebar({ variant, bordered, className, ...props }: WindowTitlebarProps): React.JSX.Element;
|
|
14
|
+
type WindowTitleProps = React.ComponentProps<"div"> & {
|
|
15
|
+
/**
|
|
16
|
+
* `leading` beside a unified toolbar. `center` keeps the title in the middle of the bar whatever sits on
|
|
17
|
+
* either side, and truncates it before it reaches them; no spacer needed.
|
|
18
|
+
*/
|
|
19
|
+
align?: "center" | "leading";
|
|
20
|
+
subtitle?: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
declare function WindowTitle({ align, subtitle, className, children, ...props }: WindowTitleProps): React.JSX.Element;
|
|
23
|
+
type WindowTrafficLightsProps = Omit<React.ComponentProps<"div">, "children"> & {
|
|
24
|
+
onClose?: React.MouseEventHandler<HTMLElement>;
|
|
25
|
+
onMinimize?: React.MouseEventHandler<HTMLElement>;
|
|
26
|
+
onZoom?: React.MouseEventHandler<HTMLElement>;
|
|
27
|
+
};
|
|
28
|
+
declare function WindowTrafficLights({ onClose, onMinimize, onZoom, className, ...props }: WindowTrafficLightsProps): React.JSX.Element;
|
|
29
|
+
/** What comes before a centered title: traffic lights, an app name, a menu. */
|
|
30
|
+
declare function WindowTitlebarLeading({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
31
|
+
/** A control held in the middle of the bar, like Calendar's Day, Week, Month and Year. Centers like a centered title. */
|
|
32
|
+
declare function WindowTitlebarCenter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
33
|
+
/** What comes after a centered title, held against the trailing edge: a toolbar, an account menu. */
|
|
34
|
+
declare function WindowTitlebarTrailing({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
35
|
+
type WindowSidebarProps = React.ComponentProps<"div"> & {
|
|
36
|
+
/**
|
|
37
|
+
* `edge` runs the sidebar the full height of the window, edge to edge, as current macOS does.
|
|
38
|
+
* `floating` insets it as a pane of glass with its own shadow, as macOS 26 did.
|
|
39
|
+
*/
|
|
40
|
+
variant?: "edge" | "floating";
|
|
41
|
+
};
|
|
42
|
+
declare function WindowSidebar({ variant, className, ...props }: WindowSidebarProps): React.JSX.Element;
|
|
43
|
+
/**
|
|
44
|
+
* The top of a sidebar, level with the title bar: traffic lights, an app name, a workspace menu,
|
|
45
|
+
* or nothing. It keeps its height when empty, so the list below starts where it would beside the lights.
|
|
46
|
+
*/
|
|
47
|
+
declare function WindowSidebarHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
48
|
+
type WindowAppNameProps = React.ComponentProps<"span"> & {
|
|
49
|
+
/** A 20-point app icon or workspace avatar. Decorative: the name is what's read. */
|
|
50
|
+
icon?: React.ReactNode;
|
|
51
|
+
};
|
|
52
|
+
/** The app or workspace name where the traffic lights would sit. Put it inside a MenuTrigger to make it a switcher. */
|
|
53
|
+
declare function WindowAppName({ icon, className, children, ...props }: WindowAppNameProps): React.JSX.Element;
|
|
54
|
+
declare function WindowBody({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
55
|
+
export { Window, WindowAppName, WindowBody, WindowSidebar, WindowSidebarHeader, WindowTitle, WindowTitlebar, WindowTitlebarCenter, WindowTitlebarLeading, WindowTitlebarTrailing, WindowTrafficLights, };
|
|
56
|
+
export type { WindowAppNameProps, WindowProps, WindowSidebarProps, WindowTitlebarProps, WindowTitleProps, WindowTrafficLightsProps, };
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
function Window({ inactive, className, ...props }) {
|
|
5
|
+
return (_jsx("div", { role: "group", "data-inactive": inactive ? "" : undefined, className: join("mb-window", className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
function WindowTitlebar({ variant = "unified", bordered = true, className, ...props }) {
|
|
8
|
+
return (_jsx("div", { "data-variant": variant, "data-bordered": bordered ? "" : undefined, className: join("mb-window-titlebar", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function WindowTitle({ align = "leading", subtitle, className, children, ...props }) {
|
|
11
|
+
return (_jsxs("div", { "data-align": align, className: join("mb-window-title", className), ...props, children: [_jsx("span", { className: "mb-window-title-text", children: children }), subtitle ? _jsx("span", { className: "mb-window-subtitle", children: subtitle }) : null] }));
|
|
12
|
+
}
|
|
13
|
+
const glyphs = {
|
|
14
|
+
close: _jsx("path", { d: "M3.5 3.5l5 5m0-5l-5 5", strokeWidth: "1.3", strokeLinecap: "round" }),
|
|
15
|
+
minimize: _jsx("path", { d: "M2.8 6h6.4", strokeWidth: "1.4", strokeLinecap: "round" }),
|
|
16
|
+
zoom: _jsx("path", { d: "M3.3 3.3h4L3.3 7.3zM8.7 8.7h-4l4-4z", fill: "currentColor", stroke: "none" }),
|
|
17
|
+
};
|
|
18
|
+
const lightLabels = { close: "Close", minimize: "Minimize", zoom: "Zoom" };
|
|
19
|
+
function WindowTrafficLights({ onClose, onMinimize, onZoom, className, ...props }) {
|
|
20
|
+
const handlers = {
|
|
21
|
+
close: onClose,
|
|
22
|
+
minimize: onMinimize,
|
|
23
|
+
zoom: onZoom,
|
|
24
|
+
};
|
|
25
|
+
const interactive = Boolean(onClose || onMinimize || onZoom);
|
|
26
|
+
return (_jsx("div", { role: interactive ? "group" : undefined, "aria-label": interactive ? "Window controls" : undefined, "aria-hidden": interactive ? undefined : true, className: join("mb-window-traffic-lights", className), ...props, children: Object.keys(glyphs).map((light) => {
|
|
27
|
+
const glyph = (_jsx("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", className: "mb-window-traffic-light-glyph", children: glyphs[light] }));
|
|
28
|
+
const onClick = handlers[light];
|
|
29
|
+
return onClick ? (_jsx(ButtonPrimitive, { "data-light": light, "aria-label": lightLabels[light], onClick: onClick, className: "mb-window-traffic-light", children: glyph }, light)) : (_jsx("span", { "data-light": light, className: "mb-window-traffic-light", children: glyph }, light));
|
|
30
|
+
}) }));
|
|
31
|
+
}
|
|
32
|
+
/** What comes before a centered title: traffic lights, an app name, a menu. */
|
|
33
|
+
function WindowTitlebarLeading({ className, ...props }) {
|
|
34
|
+
return _jsx("div", { className: join("mb-window-titlebar-leading", className), ...props });
|
|
35
|
+
}
|
|
36
|
+
/** A control held in the middle of the bar, like Calendar's Day, Week, Month and Year. Centers like a centered title. */
|
|
37
|
+
function WindowTitlebarCenter({ className, ...props }) {
|
|
38
|
+
return _jsx("div", { className: join("mb-window-titlebar-center", className), ...props });
|
|
39
|
+
}
|
|
40
|
+
/** What comes after a centered title, held against the trailing edge: a toolbar, an account menu. */
|
|
41
|
+
function WindowTitlebarTrailing({ className, ...props }) {
|
|
42
|
+
return _jsx("div", { className: join("mb-window-titlebar-trailing", className), ...props });
|
|
43
|
+
}
|
|
44
|
+
function WindowSidebar({ variant = "edge", className, ...props }) {
|
|
45
|
+
return _jsx("div", { "data-variant": variant, className: join("mb-window-sidebar", className), ...props });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The top of a sidebar, level with the title bar: traffic lights, an app name, a workspace menu,
|
|
49
|
+
* or nothing. It keeps its height when empty, so the list below starts where it would beside the lights.
|
|
50
|
+
*/
|
|
51
|
+
function WindowSidebarHeader({ className, ...props }) {
|
|
52
|
+
return _jsx("div", { className: join("mb-window-sidebar-header", className), ...props });
|
|
53
|
+
}
|
|
54
|
+
/** The app or workspace name where the traffic lights would sit. Put it inside a MenuTrigger to make it a switcher. */
|
|
55
|
+
function WindowAppName({ icon, className, children, ...props }) {
|
|
56
|
+
return (_jsxs("span", { className: join("mb-window-app-name", className), ...props, children: [icon ? (_jsx("span", { "aria-hidden": "true", className: "mb-window-app-name-icon", children: icon })) : null, _jsx("span", { className: "mb-window-app-name-text", children: children })] }));
|
|
57
|
+
}
|
|
58
|
+
function WindowBody({ className, ...props }) {
|
|
59
|
+
return _jsx("div", { className: join("mb-window-body", className), ...props });
|
|
60
|
+
}
|
|
61
|
+
export { Window, WindowAppName, WindowBody, WindowSidebar, WindowSidebarHeader, WindowTitle, WindowTitlebar, WindowTitlebarCenter, WindowTitlebarLeading, WindowTitlebarTrailing, WindowTrafficLights, };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export * from "./components/accessory-tile.js";
|
|
2
|
+
export * from "./components/activity-indicator.js";
|
|
3
|
+
export * from "./components/alert.js";
|
|
4
|
+
export * from "./components/artwork.js";
|
|
5
|
+
export * from "./components/automation-row.js";
|
|
6
|
+
export * from "./components/avatar.js";
|
|
7
|
+
export * from "./components/badge.js";
|
|
8
|
+
export * from "./components/button.js";
|
|
9
|
+
export * from "./components/calendar.js";
|
|
10
|
+
export * from "./components/camera-view.js";
|
|
11
|
+
export * from "./components/card.js";
|
|
12
|
+
export * from "./components/carousel.js";
|
|
13
|
+
export * from "./components/checkbox.js";
|
|
14
|
+
export * from "./components/code-field.js";
|
|
15
|
+
export * from "./components/color-well.js";
|
|
16
|
+
export * from "./components/combo-box.js";
|
|
17
|
+
export * from "./components/command-palette.js";
|
|
18
|
+
export * from "./components/context-menu.js";
|
|
19
|
+
export * from "./components/date-picker.js";
|
|
20
|
+
export * from "./components/device-frame.js";
|
|
21
|
+
export * from "./components/dialog.js";
|
|
22
|
+
export * from "./components/disclosure.js";
|
|
23
|
+
export * from "./components/dock.js";
|
|
24
|
+
export * from "./components/door-control.js";
|
|
25
|
+
export * from "./components/energy-readout.js";
|
|
26
|
+
export * from "./components/field.js";
|
|
27
|
+
export * from "./components/gauge.js";
|
|
28
|
+
export * from "./components/glass.js";
|
|
29
|
+
export * from "./components/home-backdrop.js";
|
|
30
|
+
export * from "./components/home-section.js";
|
|
31
|
+
export * from "./components/home-status.js";
|
|
32
|
+
export * from "./components/hover-card.js";
|
|
33
|
+
export * from "./components/level-control.js";
|
|
34
|
+
export * from "./components/light-color-picker.js";
|
|
35
|
+
export * from "./components/list.js";
|
|
36
|
+
export * from "./components/listbox.js";
|
|
37
|
+
export * from "./components/lock-control.js";
|
|
38
|
+
export * from "./components/menu.js";
|
|
39
|
+
export * from "./components/menu-bar.js";
|
|
40
|
+
export * from "./components/navigation-bar.js";
|
|
41
|
+
export * from "./components/outline.js";
|
|
42
|
+
export * from "./components/page-control.js";
|
|
43
|
+
export * from "./components/popover.js";
|
|
44
|
+
export * from "./components/progress.js";
|
|
45
|
+
export * from "./components/radio.js";
|
|
46
|
+
export * from "./components/rating.js";
|
|
47
|
+
export * from "./components/scene-tile.js";
|
|
48
|
+
export * from "./components/scroll-view.js";
|
|
49
|
+
export * from "./components/search-field.js";
|
|
50
|
+
export * from "./components/secure-field.js";
|
|
51
|
+
export * from "./components/segmented-control.js";
|
|
52
|
+
export * from "./components/select.js";
|
|
53
|
+
export * from "./components/sensor-readout.js";
|
|
54
|
+
export * from "./components/separator.js";
|
|
55
|
+
export * from "./components/setup-code.js";
|
|
56
|
+
export * from "./components/sheet.js";
|
|
57
|
+
export * from "./components/sidebar.js";
|
|
58
|
+
export * from "./components/slider.js";
|
|
59
|
+
export * from "./components/split-view.js";
|
|
60
|
+
export * from "./components/squircle.js";
|
|
61
|
+
export * from "./components/stepper.js";
|
|
62
|
+
export * from "./components/switch.js";
|
|
63
|
+
export * from "./components/tab-bar.js";
|
|
64
|
+
export * from "./components/table.js";
|
|
65
|
+
export * from "./components/tabs.js";
|
|
66
|
+
export * from "./components/text-area.js";
|
|
67
|
+
export * from "./components/text-field.js";
|
|
68
|
+
export * from "./components/thermostat-control.js";
|
|
69
|
+
export * from "./components/toast.js";
|
|
70
|
+
export * from "./components/toggle.js";
|
|
71
|
+
export * from "./components/token-field.js";
|
|
72
|
+
export * from "./components/toolbar.js";
|
|
73
|
+
export * from "./components/tooltip.js";
|
|
74
|
+
export * from "./components/window.js";
|
|
75
|
+
export * from "./lib/cx.js";
|
|
76
|
+
export * from "./lib/derive.js";
|
|
77
|
+
export * from "./lib/platform.js";
|
|
78
|
+
export * from "./lib/theme.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Generated by scripts/gen-index.mjs. Do not edit.
|
|
2
|
+
export * from "./components/accessory-tile.js";
|
|
3
|
+
export * from "./components/activity-indicator.js";
|
|
4
|
+
export * from "./components/alert.js";
|
|
5
|
+
export * from "./components/artwork.js";
|
|
6
|
+
export * from "./components/automation-row.js";
|
|
7
|
+
export * from "./components/avatar.js";
|
|
8
|
+
export * from "./components/badge.js";
|
|
9
|
+
export * from "./components/button.js";
|
|
10
|
+
export * from "./components/calendar.js";
|
|
11
|
+
export * from "./components/camera-view.js";
|
|
12
|
+
export * from "./components/card.js";
|
|
13
|
+
export * from "./components/carousel.js";
|
|
14
|
+
export * from "./components/checkbox.js";
|
|
15
|
+
export * from "./components/code-field.js";
|
|
16
|
+
export * from "./components/color-well.js";
|
|
17
|
+
export * from "./components/combo-box.js";
|
|
18
|
+
export * from "./components/command-palette.js";
|
|
19
|
+
export * from "./components/context-menu.js";
|
|
20
|
+
export * from "./components/date-picker.js";
|
|
21
|
+
export * from "./components/device-frame.js";
|
|
22
|
+
export * from "./components/dialog.js";
|
|
23
|
+
export * from "./components/disclosure.js";
|
|
24
|
+
export * from "./components/dock.js";
|
|
25
|
+
export * from "./components/door-control.js";
|
|
26
|
+
export * from "./components/energy-readout.js";
|
|
27
|
+
export * from "./components/field.js";
|
|
28
|
+
export * from "./components/gauge.js";
|
|
29
|
+
export * from "./components/glass.js";
|
|
30
|
+
export * from "./components/home-backdrop.js";
|
|
31
|
+
export * from "./components/home-section.js";
|
|
32
|
+
export * from "./components/home-status.js";
|
|
33
|
+
export * from "./components/hover-card.js";
|
|
34
|
+
export * from "./components/level-control.js";
|
|
35
|
+
export * from "./components/light-color-picker.js";
|
|
36
|
+
export * from "./components/list.js";
|
|
37
|
+
export * from "./components/listbox.js";
|
|
38
|
+
export * from "./components/lock-control.js";
|
|
39
|
+
export * from "./components/menu.js";
|
|
40
|
+
export * from "./components/menu-bar.js";
|
|
41
|
+
export * from "./components/navigation-bar.js";
|
|
42
|
+
export * from "./components/outline.js";
|
|
43
|
+
export * from "./components/page-control.js";
|
|
44
|
+
export * from "./components/popover.js";
|
|
45
|
+
export * from "./components/progress.js";
|
|
46
|
+
export * from "./components/radio.js";
|
|
47
|
+
export * from "./components/rating.js";
|
|
48
|
+
export * from "./components/scene-tile.js";
|
|
49
|
+
export * from "./components/scroll-view.js";
|
|
50
|
+
export * from "./components/search-field.js";
|
|
51
|
+
export * from "./components/secure-field.js";
|
|
52
|
+
export * from "./components/segmented-control.js";
|
|
53
|
+
export * from "./components/select.js";
|
|
54
|
+
export * from "./components/sensor-readout.js";
|
|
55
|
+
export * from "./components/separator.js";
|
|
56
|
+
export * from "./components/setup-code.js";
|
|
57
|
+
export * from "./components/sheet.js";
|
|
58
|
+
export * from "./components/sidebar.js";
|
|
59
|
+
export * from "./components/slider.js";
|
|
60
|
+
export * from "./components/split-view.js";
|
|
61
|
+
export * from "./components/squircle.js";
|
|
62
|
+
export * from "./components/stepper.js";
|
|
63
|
+
export * from "./components/switch.js";
|
|
64
|
+
export * from "./components/tab-bar.js";
|
|
65
|
+
export * from "./components/table.js";
|
|
66
|
+
export * from "./components/tabs.js";
|
|
67
|
+
export * from "./components/text-area.js";
|
|
68
|
+
export * from "./components/text-field.js";
|
|
69
|
+
export * from "./components/thermostat-control.js";
|
|
70
|
+
export * from "./components/toast.js";
|
|
71
|
+
export * from "./components/toggle.js";
|
|
72
|
+
export * from "./components/token-field.js";
|
|
73
|
+
export * from "./components/toolbar.js";
|
|
74
|
+
export * from "./components/tooltip.js";
|
|
75
|
+
export * from "./components/window.js";
|
|
76
|
+
export * from "./lib/cx.js";
|
|
77
|
+
export * from "./lib/derive.js";
|
|
78
|
+
export * from "./lib/platform.js";
|
|
79
|
+
export * from "./lib/theme.js";
|
package/dist/lib/cx.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ClassValue<S> = string | undefined | ((state: S) => string | undefined);
|
|
2
|
+
/**
|
|
3
|
+
* Joins macbetter's class with the caller's, which ui-sdk lets be a function
|
|
4
|
+
* of the part's state.
|
|
5
|
+
*/
|
|
6
|
+
declare function cx<S>(base: string, className?: ClassValue<S>): string | ((state: S) => string);
|
|
7
|
+
declare function join(...parts: Array<string | undefined | false | null>): string;
|
|
8
|
+
export { cx, join };
|
|
9
|
+
export type { ClassValue };
|
package/dist/lib/cx.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Joins macbetter's class with the caller's, which ui-sdk lets be a function
|
|
3
|
+
* of the part's state.
|
|
4
|
+
*/
|
|
5
|
+
function cx(base, className) {
|
|
6
|
+
if (typeof className === "function") {
|
|
7
|
+
return (state) => join(base, className(state));
|
|
8
|
+
}
|
|
9
|
+
return join(base, className);
|
|
10
|
+
}
|
|
11
|
+
function join(...parts) {
|
|
12
|
+
return parts.filter(Boolean).join(" ");
|
|
13
|
+
}
|
|
14
|
+
export { cx, join };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
type Rgb = [number, number, number];
|
|
2
|
+
type Oklch = {
|
|
3
|
+
l: number;
|
|
4
|
+
c: number;
|
|
5
|
+
h: number;
|
|
6
|
+
};
|
|
7
|
+
type Pair = {
|
|
8
|
+
light: string;
|
|
9
|
+
dark: string;
|
|
10
|
+
};
|
|
11
|
+
type Scheme = "light" | "dark";
|
|
12
|
+
declare const colorKeys: readonly ["accent", "onAccent", "accentText", "accentSecondary", "ink", "bg", "bgSecondary", "bgTertiary", "bgElevated", "bgSidebar", "tint", "green", "red"];
|
|
13
|
+
type ColorKey = (typeof colorKeys)[number];
|
|
14
|
+
type ThemeColors = Record<ColorKey, Pair>;
|
|
15
|
+
/** `#abc`, `abc`, `#aabbcc` → `#aabbcc`; anything else → null. Alpha is dropped from 8-digit hex. */
|
|
16
|
+
declare function normalizeHex(input: string): string | null;
|
|
17
|
+
declare function hexToRgb(hex: string): Rgb;
|
|
18
|
+
declare function rgbToHex(rgb: Rgb): string;
|
|
19
|
+
declare function hexToOklch(hex: string): Oklch;
|
|
20
|
+
/** OKLCH → hex, reducing chroma (keeping lightness and hue) until the color fits in sRGB. */
|
|
21
|
+
declare function oklchToHex(color: Oklch): string;
|
|
22
|
+
/** `fg` at `alpha` over an opaque `bg`, composited in sRGB as the browser paints it. */
|
|
23
|
+
declare function composite(fg: string, bg: string, alpha: number): string;
|
|
24
|
+
declare function relativeLuminance(hex: string): number;
|
|
25
|
+
/**
|
|
26
|
+
* Moves `fg`'s OKLCH lightness away from `bg` until the pair reaches `target`,
|
|
27
|
+
* keeping hue and as much chroma as fits. Returns `fg` unchanged if it already passes.
|
|
28
|
+
*/
|
|
29
|
+
declare function ensureContrast(fg: string, bg: string, target?: number): string;
|
|
30
|
+
/** Of `candidates`, the one with the most contrast against `bg`. */
|
|
31
|
+
declare function bestContrast(bg: string, candidates: string[]): string;
|
|
32
|
+
/**
|
|
33
|
+
* A complete set of color seeds from one accent: the accent kept as given in
|
|
34
|
+
* light and lifted for dark, text on it chosen by contrast, the accent as text
|
|
35
|
+
* pushed to 4.5:1, and neutrals tinted toward the accent's hue.
|
|
36
|
+
*/
|
|
37
|
+
declare function deriveFromAccent(input: string): ThemeColors;
|
|
38
|
+
type ContrastCheck = {
|
|
39
|
+
id: "on-accent" | "accent-text" | "ink" | "label-secondary" | "control-border";
|
|
40
|
+
label: string;
|
|
41
|
+
/** The seed to adjust when the pair falls short. */
|
|
42
|
+
fix: ColorKey | null;
|
|
43
|
+
ratio: number;
|
|
44
|
+
target: number;
|
|
45
|
+
pass: boolean;
|
|
46
|
+
fg: string;
|
|
47
|
+
bg: string;
|
|
48
|
+
};
|
|
49
|
+
declare function contrastChecks(colors: ThemeColors, scheme: Scheme): ContrastCheck[];
|
|
50
|
+
/** Adjusts the seed behind a failing check so it passes, leaving everything else alone. */
|
|
51
|
+
declare function fixCheck(colors: ThemeColors, scheme: Scheme, id: ContrastCheck["id"]): ThemeColors;
|
|
52
|
+
export { bestContrast, colorKeys, composite, contrastChecks, deriveFromAccent, ensureContrast, fixCheck, hexToOklch, hexToRgb, normalizeHex, oklchToHex, relativeLuminance, rgbToHex, };
|
|
53
|
+
export type { ColorKey, ContrastCheck, Oklch, Pair, Scheme, ThemeColors };
|