@glasshome/ui 1.39.0 → 1.41.0
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/SPEC.md +26 -4
- package/dist/index.js +1 -1
- package/dist/lib/overlay-classes.d.ts +1 -1
- package/dist/solid/alert-dialog.d.ts +10 -9
- package/dist/solid/bottom-sheet/bottom-sheet.d.ts +1 -5
- package/dist/solid/confirm-dialog.d.ts +22 -0
- package/dist/solid/dialog-parts.d.ts +27 -1
- package/dist/solid/dialog.d.ts +3 -6
- package/dist/solid/dock-edit.d.ts +1 -1
- package/dist/solid/dock.d.ts +6 -1
- package/dist/solid/docked-panel.d.ts +1 -5
- package/dist/solid/icon-nodes.d.ts +13 -0
- package/dist/solid/index.d.ts +6 -4
- package/dist/solid/index.js +5080 -4841
- package/dist/solid/responsive-dialog.d.ts +3 -6
- package/dist/solid/sheet.d.ts +1 -5
- package/dist/solid/tabs.d.ts +3 -1
- package/dist/solid/term.d.ts +14 -0
- package/dist/{utils-DXEj_oXa.js → utils-CGN4X-2O.js} +1 -1
- package/package.json +14 -3
- package/scripts/check-gallery.ts +22 -4
- package/src/lib/overlay-classes.ts +2 -4
- package/src/solid/alert-dialog.tsx +13 -0
- package/src/solid/alert.tsx +1 -1
- package/src/solid/confirm-dialog.tsx +62 -0
- package/src/solid/dialog-parts.tsx +51 -1
- package/src/solid/dialog.tsx +4 -0
- package/src/solid/dock-edit.tsx +11 -16
- package/src/solid/dock.tsx +115 -25
- package/src/solid/icon-nodes.ts +71 -0
- package/src/solid/icon.tsx +44 -39
- package/src/solid/image-picker.tsx +9 -9
- package/src/solid/index.ts +6 -1
- package/src/solid/option-card.tsx +1 -1
- package/src/solid/responsive-dialog.tsx +8 -1
- package/src/solid/select.tsx +7 -2
- package/src/solid/tabs.tsx +11 -10
- package/src/solid/term.tsx +51 -0
- package/src/solid/toggle-group.tsx +12 -5
- package/src/styles/globals.css +6 -2
- package/src/styles/theme.css +7 -5
|
@@ -23,16 +23,13 @@ type ResponsiveDialogContentProps = ComponentProps<"div"> & {
|
|
|
23
23
|
anchor?: HTMLElement;
|
|
24
24
|
};
|
|
25
25
|
declare const ResponsiveDialogContent: ParentComponent<ResponsiveDialogContentProps>;
|
|
26
|
-
declare const ResponsiveDialogHeader: Component<JSX.HTMLAttributes<HTMLDivElement> & {
|
|
27
|
-
media?: JSX.Element;
|
|
28
|
-
action?: JSX.Element;
|
|
29
|
-
wrap?: boolean;
|
|
30
|
-
}>, ResponsiveDialogBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
|
|
26
|
+
declare const ResponsiveDialogHeader: Component<import("./dialog-parts.js").ModalHeaderProps>, ResponsiveDialogBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
|
|
31
27
|
as?: ValidComponent;
|
|
32
28
|
}>, ResponsiveDialogFooter: Component<JSX.HTMLAttributes<HTMLDivElement>>;
|
|
33
29
|
declare const ResponsiveDialogTitle: Component<ComponentProps<"h2">>;
|
|
34
30
|
declare const ResponsiveDialogDescription: Component<ComponentProps<"p">>;
|
|
31
|
+
declare const ResponsiveDialogHead: Component<import("./dialog-parts.js").ModalHeadProps>;
|
|
35
32
|
/** Defaults to the footer's outline button; an icon-only close passes `ghost`
|
|
36
33
|
* so the glyph is not boxed. */
|
|
37
34
|
declare const ResponsiveDialogClose: ParentComponent<ComponentProps<"button"> & VariantProps<typeof buttonVariants>>;
|
|
38
|
-
export { ResponsiveDialog, ResponsiveDialogBody, ResponsiveDialogClose, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle, ResponsiveDialogTrigger, };
|
|
35
|
+
export { ResponsiveDialog, ResponsiveDialogBody, ResponsiveDialogClose, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHead, ResponsiveDialogHeader, ResponsiveDialogTitle, ResponsiveDialogTrigger, };
|
package/dist/solid/sheet.d.ts
CHANGED
|
@@ -24,11 +24,7 @@ type SheetContentProps = ComponentProps<typeof DialogPrimitive.Content> & {
|
|
|
24
24
|
ariaLabel?: string;
|
|
25
25
|
};
|
|
26
26
|
declare const SheetContent: ParentComponent<SheetContentProps>;
|
|
27
|
-
declare const SheetHeader: Component<JSX.HTMLAttributes<HTMLDivElement> & {
|
|
28
|
-
media?: JSX.Element;
|
|
29
|
-
action?: JSX.Element;
|
|
30
|
-
wrap?: boolean;
|
|
31
|
-
}>, SheetBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
|
|
27
|
+
declare const SheetHeader: Component<import("./dialog-parts.js").ModalHeaderProps>, SheetBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
|
|
32
28
|
as?: import("solid-js").ValidComponent;
|
|
33
29
|
}>, SheetFooter: Component<JSX.HTMLAttributes<HTMLDivElement>>;
|
|
34
30
|
declare const SheetTitle: Component<ComponentProps<typeof DialogPrimitive.Title>>;
|
package/dist/solid/tabs.d.ts
CHANGED
|
@@ -9,9 +9,11 @@ type TabsProps = ComponentProps<typeof TabsPrimitive> & {
|
|
|
9
9
|
};
|
|
10
10
|
declare const Tabs: Component<TabsProps>;
|
|
11
11
|
declare const TabsList: Component<ComponentProps<typeof TabsPrimitive.List>>;
|
|
12
|
-
/** `icon` stacks a glyph over the word, so a tab row reads apart from the toggle groups under it.
|
|
12
|
+
/** `icon` stacks a glyph over the word, so a tab row reads apart from the toggle groups under it.
|
|
13
|
+
* `inline` sets the glyph beside the word instead, for a row that stands alone. */
|
|
13
14
|
declare const TabsTrigger: Component<ComponentProps<typeof TabsPrimitive.Trigger> & {
|
|
14
15
|
icon?: string;
|
|
16
|
+
inline?: boolean;
|
|
15
17
|
}>;
|
|
16
18
|
declare const TabsContent: Component<ComponentProps<typeof TabsPrimitive.Content>>;
|
|
17
19
|
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export interface TermDefinition {
|
|
3
|
+
icon: string;
|
|
4
|
+
title: string;
|
|
5
|
+
/** One sentence a homeowner reads in a glance. */
|
|
6
|
+
line: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
}
|
|
9
|
+
/** A word a homeowner may not know; tapping it explains it in place. */
|
|
10
|
+
export declare function Term(props: {
|
|
11
|
+
term: TermDefinition;
|
|
12
|
+
children?: JSX.Element;
|
|
13
|
+
class?: string;
|
|
14
|
+
}): JSX.Element;
|
|
@@ -341,7 +341,7 @@ function bt(e) {
|
|
|
341
341
|
}
|
|
342
342
|
//#endregion
|
|
343
343
|
//#region src/lib/overlay-classes.ts
|
|
344
|
-
var xt = "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)]", St = "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[calc(var(--_material-vibrancy,1)*1.2)] backdrop-brightness-[calc(1+(var(--_material-vibrancy,1)-1)*0.2)]", Ct = `${xt} [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)]`, wt = `${Ct} ${St}`, Tt = `${xt} [--glass-base:var(--popover)]`, Et = "bg-scrim backdrop-blur-md", Dt = `${Ye.overlay} rounded-md text-popover-foreground outline-hidden`;
|
|
344
|
+
var xt = "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)]", St = "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[calc(var(--_material-vibrancy,1)*1.2)] backdrop-brightness-[calc(1+(var(--_material-vibrancy,1)-1)*0.2)]", Ct = `${xt} [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)]`, wt = `${Ct} ${St}`, Tt = `${xt} [--glass-base:var(--popover)]`, Et = "bg-scrim backdrop-blur-md pointer-coarse:backdrop-blur-none", Dt = `${Ye.overlay} rounded-md text-popover-foreground outline-hidden`;
|
|
345
345
|
`${wt}${Dt}`;
|
|
346
346
|
var Ot = `${wt} relative ${Dt}`, kt = (e) => {
|
|
347
347
|
let t = e?.getBoundingClientRect();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glasshome/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.0",
|
|
4
4
|
"description": "SolidJS component library for GlassHome, built on Kobalte",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -85,10 +85,15 @@
|
|
|
85
85
|
"check:publish": "publint && attw --pack . --profile esm-only --exclude-entrypoints ./styles ./styles/theme && bun scripts/check-pack.ts",
|
|
86
86
|
"dev": "tsc -b tsconfig.build.json --force && vite build --watch",
|
|
87
87
|
"lint": "oxlint --type-aware . && oxfmt --check .",
|
|
88
|
-
"test": "vitest run",
|
|
88
|
+
"test": "vitest run --project '!visual'",
|
|
89
|
+
"test:visual": "vitest run --project visual",
|
|
90
|
+
"test:visual:image": "sh dev/visual-in-image.sh",
|
|
91
|
+
"test:visual:update": "sh dev/visual-in-image.sh --update",
|
|
89
92
|
"test:watch": "vitest",
|
|
90
93
|
"dev:gallery": "vite --config vite.dev.config.ts",
|
|
91
|
-
"gallery:shots": "
|
|
94
|
+
"gallery:shots": "bun dev/shoot.mjs",
|
|
95
|
+
"drive": "bun dev/drive/main.ts",
|
|
96
|
+
"preview": "bun dev/drive/main.ts preview"
|
|
92
97
|
},
|
|
93
98
|
"dependencies": {
|
|
94
99
|
"@iconify/types": "^2.0.0",
|
|
@@ -105,6 +110,9 @@
|
|
|
105
110
|
},
|
|
106
111
|
"devDependencies": {
|
|
107
112
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
113
|
+
"@fontsource-variable/geist": "^5.3.0",
|
|
114
|
+
"@fontsource-variable/geist-mono": "^5.3.0",
|
|
115
|
+
"@guidepup/virtual-screen-reader": "^0.33.0",
|
|
108
116
|
"@iconify-json/lucide": "^1.2.130",
|
|
109
117
|
"@iconify-json/mdi": "^1.2.3",
|
|
110
118
|
"@iconify-json/simple-icons": "^1.2.95",
|
|
@@ -113,6 +121,8 @@
|
|
|
113
121
|
"@types/bun": "^1.4.0",
|
|
114
122
|
"@types/node": "^25.2.2",
|
|
115
123
|
"@vitest/browser-playwright": "4.1.11",
|
|
124
|
+
"axe-core": "^4.14.0",
|
|
125
|
+
"dom-accessibility-api": "^0.7.1",
|
|
116
126
|
"fallow": "3.17.0",
|
|
117
127
|
"happy-dom": "^20.14.0",
|
|
118
128
|
"oxfmt": "0.65.0",
|
|
@@ -142,6 +152,7 @@
|
|
|
142
152
|
"node": ">=20"
|
|
143
153
|
},
|
|
144
154
|
"patchedDependencies": {
|
|
155
|
+
"@guidepup/virtual-screen-reader@0.33.0": "patches/@guidepup%2Fvirtual-screen-reader@0.33.0.patch",
|
|
145
156
|
"@kobalte/core@0.13.13": "patches/@kobalte%2Fcore@0.13.13.patch"
|
|
146
157
|
}
|
|
147
158
|
}
|
package/scripts/check-gallery.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readdirSync } from "node:fs";
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import {
|
|
@@ -25,11 +25,18 @@ const pkg = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
|
25
25
|
const CONFIG = join(pkg, "tsconfig.json");
|
|
26
26
|
const ENTRY = join(pkg, "src/solid/index.ts");
|
|
27
27
|
const GROUPS = join(pkg, "dev/groups");
|
|
28
|
+
const SCENARIOS = join(pkg, "dev/components");
|
|
28
29
|
const SCREAMING_CASE = /^[A-Z][A-Z0-9_]*$/;
|
|
29
30
|
|
|
30
31
|
export type Component = { name: string; module: string };
|
|
31
32
|
export type SpecimenUse = { name: string; renders: string[] };
|
|
32
|
-
|
|
33
|
+
/** `scenarios` names each export a `dev/components/<kebab(name)>/scenarios.tsx` declares. */
|
|
34
|
+
export type Inventory = {
|
|
35
|
+
exports: string[];
|
|
36
|
+
components: Component[];
|
|
37
|
+
specimens: SpecimenUse[];
|
|
38
|
+
scenarios: string[];
|
|
39
|
+
};
|
|
33
40
|
export type Report = {
|
|
34
41
|
uncovered: string[];
|
|
35
42
|
unknownSpecimens: string[];
|
|
@@ -40,7 +47,7 @@ type Allow = ReadonlyArray<readonly [name: string, reason: string]>;
|
|
|
40
47
|
|
|
41
48
|
export function judge(inventory: Inventory, allow: Allow): Report {
|
|
42
49
|
const moduleOf = new Map(inventory.components.map((c) => [c.name, c.module]));
|
|
43
|
-
const named = new Set(inventory.specimens.map((s) => s.name));
|
|
50
|
+
const named = new Set([...inventory.specimens.map((s) => s.name), ...inventory.scenarios]);
|
|
44
51
|
const exportNames = new Set(inventory.exports);
|
|
45
52
|
const renderedByOwnModule = (c: Component) =>
|
|
46
53
|
inventory.specimens.some(
|
|
@@ -49,7 +56,7 @@ export function judge(inventory: Inventory, allow: Allow): Report {
|
|
|
49
56
|
const uncovered = inventory.components
|
|
50
57
|
.filter((c) => !named.has(c.name) && !renderedByOwnModule(c))
|
|
51
58
|
.map((c) => c.name);
|
|
52
|
-
const unknown =
|
|
59
|
+
const unknown = inventory.specimens.map((s) => s.name).filter((name) => !exportNames.has(name));
|
|
53
60
|
const allowed = new Set(allow.map(([name]) => name));
|
|
54
61
|
const failing = new Set([...uncovered, ...unknown]);
|
|
55
62
|
return {
|
|
@@ -101,6 +108,16 @@ function specimenName(node: Node): string | undefined {
|
|
|
101
108
|
return "{no name}";
|
|
102
109
|
}
|
|
103
110
|
|
|
111
|
+
function scenarioComponents(): string[] {
|
|
112
|
+
return readdirSync(SCENARIOS).flatMap((folder) => {
|
|
113
|
+
const file = join(SCENARIOS, folder, "scenarios.tsx");
|
|
114
|
+
if (!existsSync(file)) return [];
|
|
115
|
+
const name = /\bcomponent:\s*"([A-Za-z]+)"/.exec(readFileSync(file, "utf8"))?.[1];
|
|
116
|
+
const kebab = name?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
117
|
+
return name !== undefined && kebab === folder ? [name] : [];
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
104
121
|
export async function collectInventory(): Promise<Inventory> {
|
|
105
122
|
const api = new API({ cwd: pkg });
|
|
106
123
|
try {
|
|
@@ -158,6 +175,7 @@ export async function collectInventory(): Promise<Inventory> {
|
|
|
158
175
|
exports,
|
|
159
176
|
components,
|
|
160
177
|
specimens: [...specimens].map(([name, renders]) => ({ name, renders: [...renders] })),
|
|
178
|
+
scenarios: scenarioComponents(),
|
|
161
179
|
};
|
|
162
180
|
} finally {
|
|
163
181
|
await api.close();
|
|
@@ -22,10 +22,8 @@ export const OVERLAY_SURFACE = `${OVERLAY_SURFACE_BASE} ${OVERLAY_BLUR}`;
|
|
|
22
22
|
* behind it would just be see-through. */
|
|
23
23
|
export const OVERLAY_SURFACE_OPAQUE = `${OVERLAY_KNOBS} [--glass-base:var(--popover)]`;
|
|
24
24
|
|
|
25
|
-
/*
|
|
26
|
-
|
|
27
|
-
* unblurred scrim (backdrop-blur is too slow on mobile). */
|
|
28
|
-
export const SCRIM_CLASS = "bg-scrim backdrop-blur-md";
|
|
25
|
+
/* Touch screens only dim: a full-screen blur over moving widgets re-blurs every frame on a tablet GPU. */
|
|
26
|
+
export const SCRIM_CLASS = "bg-scrim backdrop-blur-md pointer-coarse:backdrop-blur-none";
|
|
29
27
|
|
|
30
28
|
export const PANEL_TAIL = `${Z_CLASS.overlay} rounded-md text-popover-foreground outline-hidden`;
|
|
31
29
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type Component,
|
|
7
7
|
type ComponentProps,
|
|
8
8
|
createSignal,
|
|
9
|
+
type JSX,
|
|
9
10
|
type ParentComponent,
|
|
10
11
|
splitProps,
|
|
11
12
|
} from "solid-js";
|
|
@@ -14,7 +15,9 @@ import { buttonVariants } from "../lib/button-variants.js";
|
|
|
14
15
|
import { cn } from "../lib/utils.js";
|
|
15
16
|
import {
|
|
16
17
|
createModalDismiss,
|
|
18
|
+
createModalHead,
|
|
17
19
|
createModalParts,
|
|
20
|
+
type ModalHeadProps,
|
|
18
21
|
MODAL_ANCHOR,
|
|
19
22
|
MODAL_DESCRIPTION,
|
|
20
23
|
MODAL_PANEL,
|
|
@@ -133,6 +136,15 @@ const AlertDialogDescription: Component<ComponentProps<typeof AlertDialogPrimiti
|
|
|
133
136
|
);
|
|
134
137
|
};
|
|
135
138
|
|
|
139
|
+
/** An alert dialog is read aloud as a description, and the line carries the consequence. */
|
|
140
|
+
type AlertDialogHeadProps = ModalHeadProps & { line: JSX.Element };
|
|
141
|
+
|
|
142
|
+
const AlertDialogHead = createModalHead<AlertDialogHeadProps>(
|
|
143
|
+
AlertDialogHeader,
|
|
144
|
+
AlertDialogTitle,
|
|
145
|
+
AlertDialogDescription,
|
|
146
|
+
);
|
|
147
|
+
|
|
136
148
|
type AlertDialogButtonProps = ModalDismissProps &
|
|
137
149
|
Partial<Pick<VariantProps<typeof buttonVariants>, "variant" | "size">>;
|
|
138
150
|
|
|
@@ -175,6 +187,7 @@ export {
|
|
|
175
187
|
AlertDialogContent,
|
|
176
188
|
AlertDialogDescription,
|
|
177
189
|
AlertDialogFooter,
|
|
190
|
+
AlertDialogHead,
|
|
178
191
|
AlertDialogHeader,
|
|
179
192
|
AlertDialogTitle,
|
|
180
193
|
AlertDialogTrigger,
|
package/src/solid/alert.tsx
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import { children, Show } from "solid-js";
|
|
3
|
+
import {
|
|
4
|
+
AlertDialog,
|
|
5
|
+
AlertDialogAction,
|
|
6
|
+
AlertDialogBody,
|
|
7
|
+
AlertDialogCancel,
|
|
8
|
+
AlertDialogContent,
|
|
9
|
+
AlertDialogFooter,
|
|
10
|
+
AlertDialogHead,
|
|
11
|
+
} from "./alert-dialog.js";
|
|
12
|
+
|
|
13
|
+
export interface ConfirmDialogProps {
|
|
14
|
+
open: boolean;
|
|
15
|
+
onOpenChange: (open: boolean) => void;
|
|
16
|
+
/** The glyph that tells this confirm from the next. */
|
|
17
|
+
icon: string;
|
|
18
|
+
/** Defaults to destructive red when `destructive`, else the material accent. */
|
|
19
|
+
tone?: string;
|
|
20
|
+
/** The question or the outcome, naming its object: "Remove Anna?". */
|
|
21
|
+
title: string;
|
|
22
|
+
/** The consequence, one line. */
|
|
23
|
+
line: JSX.Element;
|
|
24
|
+
actionLabel: string;
|
|
25
|
+
/** Defaults to true: nearly every confirm is a delete or a removal. */
|
|
26
|
+
destructive?: boolean;
|
|
27
|
+
busy?: boolean;
|
|
28
|
+
onConfirm: () => void;
|
|
29
|
+
/** The thing the confirm is about (avatars, a preview), shown instead of described. */
|
|
30
|
+
children?: JSX.Element;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A yes/no on one object: media, a short question, the consequence, Cancel and the action. */
|
|
34
|
+
export function ConfirmDialog(props: ConfirmDialogProps): JSX.Element {
|
|
35
|
+
const destructive = () => props.destructive ?? true;
|
|
36
|
+
const thing = children(() => props.children);
|
|
37
|
+
return (
|
|
38
|
+
<AlertDialog open={props.open} onOpenChange={props.onOpenChange}>
|
|
39
|
+
<AlertDialogContent>
|
|
40
|
+
<AlertDialogHead
|
|
41
|
+
icon={props.icon}
|
|
42
|
+
tone={props.tone ?? (destructive() ? "var(--destructive)" : "var(--material-accent)")}
|
|
43
|
+
title={props.title}
|
|
44
|
+
line={props.line}
|
|
45
|
+
/>
|
|
46
|
+
<Show when={thing()}>
|
|
47
|
+
<AlertDialogBody>{thing()}</AlertDialogBody>
|
|
48
|
+
</Show>
|
|
49
|
+
<AlertDialogFooter>
|
|
50
|
+
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
51
|
+
<AlertDialogAction
|
|
52
|
+
variant={destructive() ? "destructive" : "default"}
|
|
53
|
+
busy={props.busy}
|
|
54
|
+
onClick={() => props.onConfirm()}
|
|
55
|
+
>
|
|
56
|
+
{props.actionLabel}
|
|
57
|
+
</AlertDialogAction>
|
|
58
|
+
</AlertDialogFooter>
|
|
59
|
+
</AlertDialogContent>
|
|
60
|
+
</AlertDialog>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -24,6 +24,7 @@ import { ANCHORED_MOTION, MODAL_MOTION, SCRIM_MOTION } from "../lib/motion-class
|
|
|
24
24
|
import { OVERLAY_SURFACE, SCRIM_CLASS } from "../lib/overlay-classes.js";
|
|
25
25
|
import { cn } from "../lib/utils.js";
|
|
26
26
|
import { acquireScrollLock, releaseScrollLock } from "./bottom-sheet/scroll-lock.js";
|
|
27
|
+
import { SectionIcon } from "./section-card.js";
|
|
27
28
|
|
|
28
29
|
/* kobalte 0.13.13 builds AlertDialog with Object.assign(DialogRoot, ...), the
|
|
29
30
|
* same object Dialog is built from, so whichever of the two modules a bundle
|
|
@@ -96,7 +97,7 @@ const MODAL_FOOTER =
|
|
|
96
97
|
export const MODAL_TITLE = "font-semibold text-foreground text-lg leading-none tracking-tight";
|
|
97
98
|
export const MODAL_DESCRIPTION = "text-muted-foreground text-sm";
|
|
98
99
|
|
|
99
|
-
type ModalHeaderProps = ComponentProps<"div"> & {
|
|
100
|
+
export type ModalHeaderProps = ComponentProps<"div"> & {
|
|
100
101
|
/** Avatar or icon, rendered ahead of the title column. */
|
|
101
102
|
media?: JSX.Element;
|
|
102
103
|
action?: JSX.Element;
|
|
@@ -176,6 +177,55 @@ export function createModalParts(slot: string): ModalParts {
|
|
|
176
177
|
return { Header, Body, Footer };
|
|
177
178
|
}
|
|
178
179
|
|
|
180
|
+
export type ModalMedia =
|
|
181
|
+
| { icon: string; tone?: string; avatar?: never }
|
|
182
|
+
| { avatar: JSX.Element; icon?: never; tone?: never };
|
|
183
|
+
|
|
184
|
+
export type ModalHeadProps = ModalMedia & {
|
|
185
|
+
/** A few words: the outcome or the question. */
|
|
186
|
+
title: string;
|
|
187
|
+
/** One line under the title; a `Term` goes here. */
|
|
188
|
+
line?: JSX.Element;
|
|
189
|
+
/** Badges after the title. */
|
|
190
|
+
status?: JSX.Element;
|
|
191
|
+
/** The title is a key or an id: mono, breaks anywhere. */
|
|
192
|
+
mono?: boolean;
|
|
193
|
+
/** A step indicator, tabs, a close or a link; the work's buttons live in the Footer. */
|
|
194
|
+
action?: JSX.Element;
|
|
195
|
+
wrap?: boolean;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/** The header door: media, a title and one line, no free children. A family
|
|
199
|
+
* hands in its own Header, Title and Description so ResponsiveDialog still
|
|
200
|
+
* switches between dialog and sheet parts at render time. */
|
|
201
|
+
export function createModalHead<P extends ModalHeadProps = ModalHeadProps>(
|
|
202
|
+
Header: Component<ModalHeaderProps>,
|
|
203
|
+
Title: Component<ComponentProps<"h2">>,
|
|
204
|
+
Description: Component<ComponentProps<"p">>,
|
|
205
|
+
): Component<P> {
|
|
206
|
+
return (props) => {
|
|
207
|
+
const line = children(() => props.line);
|
|
208
|
+
const status = children(() => props.status);
|
|
209
|
+
return (
|
|
210
|
+
<Header
|
|
211
|
+
wrap={props.wrap}
|
|
212
|
+
action={props.action}
|
|
213
|
+
media={props.avatar ?? <SectionIcon icon={props.icon} tone={props.tone} size="md" />}
|
|
214
|
+
>
|
|
215
|
+
<Title
|
|
216
|
+
class={cn(status() && "flex items-center gap-2", props.mono && "font-mono break-all")}
|
|
217
|
+
>
|
|
218
|
+
{props.title}
|
|
219
|
+
{status()}
|
|
220
|
+
</Title>
|
|
221
|
+
<Show when={line()}>
|
|
222
|
+
<Description>{line()}</Description>
|
|
223
|
+
</Show>
|
|
224
|
+
</Header>
|
|
225
|
+
);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
179
229
|
/** Solid's handler prop is a union: a plain function, or the bound
|
|
180
230
|
* `[handler, data]` form that calls `handler(data, event)`. A wrapper that
|
|
181
231
|
* only checks for a function silently drops the bound one. */
|
package/src/solid/dialog.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import { cn } from "../lib/utils.js";
|
|
|
17
17
|
import {
|
|
18
18
|
ANCHORED_PANEL,
|
|
19
19
|
createModalDismiss,
|
|
20
|
+
createModalHead,
|
|
20
21
|
createModalParts,
|
|
21
22
|
MODAL_ANCHOR,
|
|
22
23
|
MODAL_DESCRIPTION,
|
|
@@ -181,6 +182,8 @@ const DialogDescription: Component<ComponentProps<typeof DialogPrimitive.Descrip
|
|
|
181
182
|
);
|
|
182
183
|
};
|
|
183
184
|
|
|
185
|
+
const DialogHead = createModalHead(DialogHeader, DialogTitle, DialogDescription);
|
|
186
|
+
|
|
184
187
|
export {
|
|
185
188
|
Dialog,
|
|
186
189
|
DialogBody,
|
|
@@ -188,6 +191,7 @@ export {
|
|
|
188
191
|
DialogContent,
|
|
189
192
|
DialogDescription,
|
|
190
193
|
DialogFooter,
|
|
194
|
+
DialogHead,
|
|
191
195
|
DialogHeader,
|
|
192
196
|
DialogTitle,
|
|
193
197
|
DialogTrigger,
|
package/src/solid/dock-edit.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { Portal } from "solid-js/web";
|
|
|
3
3
|
import { Z_CLASS } from "../lib/layers.js";
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
import { type EdgeZone, edgeZone, moveId, slotAt } from "./dock-paging.js";
|
|
6
|
+
import { Icon } from "./icon.js";
|
|
6
7
|
import { usePortalMount } from "./portal-mount.js";
|
|
7
8
|
|
|
8
9
|
const DRAG_SLOP = 6;
|
|
@@ -168,19 +169,7 @@ const ZONE_BOX: Record<EdgeZone, string> = {
|
|
|
168
169
|
bottom: "inset-x-1/4 bottom-0 h-2/5 border-t-2",
|
|
169
170
|
};
|
|
170
171
|
|
|
171
|
-
|
|
172
|
-
bottom: "top-0 left-1/2 h-3 w-12 -translate-x-1/2",
|
|
173
|
-
left: "top-1/2 left-0 h-12 w-3 -translate-y-1/2",
|
|
174
|
-
right: "top-1/2 right-0 h-12 w-3 -translate-y-1/2",
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const GRIP_PILL: Record<EdgeZone, string> = {
|
|
178
|
-
bottom: "h-1 w-8",
|
|
179
|
-
left: "h-8 w-1",
|
|
180
|
-
right: "h-8 w-1",
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
/** The grip on a dock's outer edge: carry it toward a screen edge and the three landing zones light up. */
|
|
172
|
+
/** The grip at the start of a dock (its top on a side, its left end at the bottom): carry it toward a screen edge and the three landing zones light up. */
|
|
184
173
|
export function DockMoveGrip(props: {
|
|
185
174
|
placement: EdgeZone;
|
|
186
175
|
onMove: (placement: EdgeZone) => void;
|
|
@@ -233,11 +222,17 @@ export function DockMoveGrip(props: {
|
|
|
233
222
|
aria-hidden="true"
|
|
234
223
|
onPointerDown={onPointerDown}
|
|
235
224
|
class={cn(
|
|
236
|
-
"absolute z-10 flex cursor-grab touch-none items-center justify-center",
|
|
237
|
-
|
|
225
|
+
"text-foreground/50 absolute z-10 flex cursor-grab touch-none items-center justify-center",
|
|
226
|
+
props.placement === "bottom"
|
|
227
|
+
? "top-1/2 left-0 h-12 w-5 -translate-y-1/2 sm:w-6"
|
|
228
|
+
: "top-0 left-1/2 h-5 w-12 -translate-x-1/2 sm:h-6",
|
|
238
229
|
)}
|
|
239
230
|
>
|
|
240
|
-
<
|
|
231
|
+
<Icon
|
|
232
|
+
icon={props.placement === "bottom" ? "lucide:grip-vertical" : "lucide:grip-horizontal"}
|
|
233
|
+
width={16}
|
|
234
|
+
height={16}
|
|
235
|
+
/>
|
|
241
236
|
</div>
|
|
242
237
|
<Show when={carrying()}>
|
|
243
238
|
<Portal mount={usePortalMount()}>
|