@glasshome/ui 1.18.0 → 1.20.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 +84 -2
- package/dist/index.js +2 -2
- package/dist/lib/anchor-placement.d.ts +5 -0
- package/dist/lib/button-variants.d.ts +4 -1
- package/dist/lib/card-classes.d.ts +4 -4
- package/dist/lib/motion-classes.d.ts +2 -0
- package/dist/lib/overlay-classes.d.ts +4 -2
- package/dist/lib/spotlight-geometry.d.ts +22 -0
- package/dist/solid/button.d.ts +8 -3
- package/dist/solid/color-disc.d.ts +33 -0
- package/dist/solid/dashboard-preview.d.ts +24 -0
- package/dist/solid/dialog-parts.d.ts +1 -0
- package/dist/solid/dialog.d.ts +3 -0
- package/dist/solid/dock.d.ts +9 -0
- package/dist/solid/docked-panel.d.ts +11 -0
- package/dist/solid/image-picker.d.ts +3 -0
- package/dist/solid/index.d.ts +9 -3
- package/dist/solid/index.js +6254 -5475
- package/dist/solid/media-store.d.ts +10 -0
- package/dist/solid/option-card.d.ts +2 -1
- package/dist/solid/page-header.d.ts +2 -2
- package/dist/solid/preview-tile.d.ts +35 -0
- package/dist/solid/responsive-dialog.d.ts +2 -0
- package/dist/solid/schema-form.d.ts +6 -1
- package/dist/solid/sliding-indicator.d.ts +2 -0
- package/dist/solid/spotlight.d.ts +14 -0
- package/dist/solid/swatch-picker.d.ts +12 -0
- package/dist/solid/tabs.d.ts +4 -1
- package/dist/solid/toggle-group.d.ts +4 -1
- package/dist/solid/widget-identity.d.ts +2 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +336 -118
- package/dist/tokens/material.d.ts +40 -0
- package/dist/tokens/presets.d.ts +3 -0
- package/dist/tokens/theme-colors.d.ts +13 -3
- package/dist/tokens/theme-recipe.d.ts +8 -0
- package/dist/{utils-COITV1s9.js → utils-CMk7R3zM.js} +488 -485
- package/package.json +2 -2
- package/scripts/check-ui-drift.mjs +5 -0
- package/src/lib/anchor-placement.ts +30 -0
- package/src/lib/button-variants.ts +13 -12
- package/src/lib/card-classes.ts +4 -3
- package/src/lib/motion-classes.ts +10 -0
- package/src/lib/overlay-classes.ts +10 -2
- package/src/lib/spotlight-geometry.ts +90 -0
- package/src/solid/bottom-sheet/bottom-sheet.tsx +8 -1
- package/src/solid/button.tsx +17 -2
- package/src/solid/color-disc.tsx +253 -0
- package/src/solid/dashboard-preview.tsx +128 -0
- package/src/solid/dialog-parts.tsx +5 -1
- package/src/solid/dialog.tsx +47 -5
- package/src/solid/dock.tsx +67 -9
- package/src/solid/docked-panel.tsx +56 -0
- package/src/solid/entity-selector.tsx +2 -2
- package/src/solid/hero-action.tsx +2 -2
- package/src/solid/image-picker.tsx +232 -147
- package/src/solid/index.ts +20 -2
- package/src/solid/media-store.ts +20 -1
- package/src/solid/option-card.tsx +27 -31
- package/src/solid/page-header.tsx +9 -16
- package/src/solid/preview-tile.tsx +89 -0
- package/src/solid/radio-group.tsx +7 -2
- package/src/solid/responsive-dialog.tsx +10 -2
- package/src/solid/schema-form.tsx +30 -4
- package/src/solid/section-card.tsx +4 -2
- package/src/solid/sliding-indicator.tsx +34 -17
- package/src/solid/spotlight.tsx +179 -0
- package/src/solid/swatch-picker.tsx +47 -0
- package/src/solid/tabs.tsx +20 -4
- package/src/solid/toggle-group.tsx +43 -8
- package/src/solid/widget-identity.tsx +3 -1
- package/src/styles/globals.css +166 -14
- package/src/styles/theme.css +25 -3
- package/src/tokens/index.ts +1 -0
- package/src/tokens/material.ts +116 -0
- package/src/tokens/presets.ts +195 -56
- package/src/tokens/theme-colors.ts +15 -3
- package/src/tokens/theme-recipe.ts +18 -4
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { For, type JSX, Show } from "solid-js";
|
|
2
|
+
import { SECTION_ROW_SURFACE } from "../lib/card-classes.js";
|
|
3
|
+
import { FIELD_CHROME } from "../lib/input-classes.js";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { Icon } from "./icon.js";
|
|
6
|
+
|
|
7
|
+
/** Dash's lattice: the grid a widget render is shot on. */
|
|
8
|
+
const CELL = { w: 90, h: 70, gap: 16 } as const;
|
|
9
|
+
|
|
10
|
+
export interface DashboardPreviewTile {
|
|
11
|
+
key: string;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
/** A render shot at exactly this w x h; never a render of another size. */
|
|
17
|
+
src?: string;
|
|
18
|
+
icon: string;
|
|
19
|
+
label: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const span = (n: number, cell: number) => n * cell + (n - 1) * CELL.gap;
|
|
24
|
+
|
|
25
|
+
/** A dashboard drawn from widget renders at their true grid positions, scaled to its box. */
|
|
26
|
+
export function DashboardPreview(props: {
|
|
27
|
+
columns: number;
|
|
28
|
+
tiles: DashboardPreviewTile[];
|
|
29
|
+
/** Rows shown at most; the rest is cut at the bottom edge. */
|
|
30
|
+
maxRows?: number;
|
|
31
|
+
/** Sit the dashboard in a recessed well, the ground it would stand on. */
|
|
32
|
+
stage?: boolean;
|
|
33
|
+
class?: string;
|
|
34
|
+
style?: JSX.CSSProperties;
|
|
35
|
+
}) {
|
|
36
|
+
const rows = () => {
|
|
37
|
+
const used = Math.max(1, ...props.tiles.map((t) => t.y + t.h));
|
|
38
|
+
return props.maxRows ? Math.min(used, props.maxRows) : used;
|
|
39
|
+
};
|
|
40
|
+
const width = () => span(props.columns, CELL.w);
|
|
41
|
+
const height = () => span(rows(), CELL.h);
|
|
42
|
+
const pct = (value: number, of: number) => `${(value / of) * 100}%`;
|
|
43
|
+
|
|
44
|
+
const board = () => (
|
|
45
|
+
<div
|
|
46
|
+
data-slot="dashboard-preview"
|
|
47
|
+
class={cn("@container relative w-full overflow-hidden", props.class)}
|
|
48
|
+
style={{ "aspect-ratio": `${width()} / ${height()}`, ...props.style }}
|
|
49
|
+
>
|
|
50
|
+
<div
|
|
51
|
+
class="absolute inset-0"
|
|
52
|
+
style={{ "--dp-unit": `calc(100cqw / ${width()})` } as JSX.CSSProperties}
|
|
53
|
+
>
|
|
54
|
+
<For each={props.tiles}>
|
|
55
|
+
{(tile) => (
|
|
56
|
+
<div
|
|
57
|
+
data-slot="dashboard-preview-tile"
|
|
58
|
+
class="absolute"
|
|
59
|
+
style={{
|
|
60
|
+
left: pct(tile.x * (CELL.w + CELL.gap), width()),
|
|
61
|
+
top: pct(tile.y * (CELL.h + CELL.gap), height()),
|
|
62
|
+
width: pct(span(tile.w, CELL.w), width()),
|
|
63
|
+
height: pct(span(tile.h, CELL.h), height()),
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<Show when={tile.src} fallback={<IconTile tile={tile} />}>
|
|
67
|
+
{(src) => (
|
|
68
|
+
<img
|
|
69
|
+
src={src()}
|
|
70
|
+
alt={tile.label}
|
|
71
|
+
loading="lazy"
|
|
72
|
+
decoding="async"
|
|
73
|
+
class="block h-full w-full"
|
|
74
|
+
/>
|
|
75
|
+
)}
|
|
76
|
+
</Show>
|
|
77
|
+
</div>
|
|
78
|
+
)}
|
|
79
|
+
</For>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
return (
|
|
84
|
+
<Show when={props.stage} fallback={board()}>
|
|
85
|
+
<div
|
|
86
|
+
data-slot="dashboard-preview-stage"
|
|
87
|
+
class={cn(FIELD_CHROME, "flex justify-center rounded-xl p-3")}
|
|
88
|
+
>
|
|
89
|
+
{board()}
|
|
90
|
+
</div>
|
|
91
|
+
</Show>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const u = (n: number) => `calc(var(--dp-unit) * ${n})`;
|
|
96
|
+
|
|
97
|
+
function IconTile(props: { tile: DashboardPreviewTile }) {
|
|
98
|
+
const roomy = () => props.tile.w >= 2 && props.tile.h >= 2;
|
|
99
|
+
return (
|
|
100
|
+
<div
|
|
101
|
+
data-slot="dashboard-preview-icon-tile"
|
|
102
|
+
class={cn(
|
|
103
|
+
SECTION_ROW_SURFACE,
|
|
104
|
+
"flex h-full w-full items-center overflow-hidden text-muted-foreground",
|
|
105
|
+
roomy() ? "flex-col justify-center text-center" : "justify-center",
|
|
106
|
+
)}
|
|
107
|
+
style={{ "border-radius": u(20), gap: u(roomy() ? 8 : 10), padding: u(12) }}
|
|
108
|
+
>
|
|
109
|
+
<Icon
|
|
110
|
+
icon={props.tile.icon}
|
|
111
|
+
width="1em"
|
|
112
|
+
height="1em"
|
|
113
|
+
style={{ "font-size": u(roomy() ? 32 : 22) }}
|
|
114
|
+
class="shrink-0 text-foreground/80"
|
|
115
|
+
/>
|
|
116
|
+
<div class="flex min-w-0 flex-col" style={{ gap: u(4) }}>
|
|
117
|
+
<span class="truncate font-medium text-foreground/90" style={{ "font-size": u(13) }}>
|
|
118
|
+
{props.tile.label}
|
|
119
|
+
</span>
|
|
120
|
+
<Show when={roomy() && props.tile.description}>
|
|
121
|
+
<span class="line-clamp-2" style={{ "font-size": u(11), "line-height": 1.3 }}>
|
|
122
|
+
{props.tile.description}
|
|
123
|
+
</span>
|
|
124
|
+
</Show>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "solid-js";
|
|
19
19
|
import { Dynamic } from "solid-js/web";
|
|
20
20
|
import { Z_CLASS } from "../lib/layers.js";
|
|
21
|
-
import { MODAL_MOTION, SCRIM_MOTION } from "../lib/motion-classes.js";
|
|
21
|
+
import { ANCHORED_MOTION, MODAL_MOTION, SCRIM_MOTION } from "../lib/motion-classes.js";
|
|
22
22
|
import { OVERLAY_SURFACE, SCRIM_CLASS } from "../lib/overlay-classes.js";
|
|
23
23
|
import { cn } from "../lib/utils.js";
|
|
24
24
|
import { acquireScrollLock, releaseScrollLock } from "./bottom-sheet/scroll-lock.js";
|
|
@@ -61,6 +61,10 @@ export const MODAL_ANCHOR: Record<ModalSize, string> = {
|
|
|
61
61
|
* panel edge instead of under the header. */
|
|
62
62
|
export const MODAL_PANEL = `${OVERLAY_SURFACE} ${MODAL_MOTION} fixed left-1/2 flex ${MODAL_MAX_H} w-[calc(100%-2rem)] -translate-x-1/2 flex-col overflow-hidden rounded-lg outline-none ${Z_CLASS.overlay}`;
|
|
63
63
|
|
|
64
|
+
/* A panel anchored on the element that opened it: placed and sized inline (lib/anchor-placement),
|
|
65
|
+
* so it drops the centring, and it unrolls out of that element instead of rising in. */
|
|
66
|
+
export const ANCHORED_PANEL = `${OVERLAY_SURFACE} ${ANCHORED_MOTION} fixed flex ${MODAL_MAX_H} flex-col overflow-hidden rounded-lg outline-none ${Z_CLASS.overlay}`;
|
|
67
|
+
|
|
64
68
|
export const MODAL_SCRIM = `${SCRIM_MOTION} fixed inset-0 ${Z_CLASS.overlay} ${SCRIM_CLASS}`;
|
|
65
69
|
|
|
66
70
|
const MODAL_HEADER = "flex shrink-0 items-start gap-4 px-6 pt-6 pb-3";
|
package/src/solid/dialog.tsx
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { Dialog as DialogPrimitive, useDialogContext } from "@kobalte/core/dialog";
|
|
2
2
|
import type { VariantProps } from "cva";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type Component,
|
|
5
|
+
type ComponentProps,
|
|
6
|
+
createEffect,
|
|
7
|
+
createSignal,
|
|
8
|
+
onCleanup,
|
|
9
|
+
type ParentComponent,
|
|
10
|
+
splitProps,
|
|
11
|
+
} from "solid-js";
|
|
12
|
+
import { overAnchor } from "../lib/anchor-placement.js";
|
|
4
13
|
import { buttonVariants } from "../lib/button-variants.js";
|
|
5
14
|
import { cn } from "../lib/utils.js";
|
|
6
15
|
import {
|
|
16
|
+
ANCHORED_PANEL,
|
|
7
17
|
createModalDismiss,
|
|
8
18
|
createModalParts,
|
|
9
19
|
MODAL_ANCHOR,
|
|
@@ -55,11 +65,42 @@ type DialogContentProps = ComponentProps<typeof DialogPrimitive.Content> & {
|
|
|
55
65
|
size?: ModalSize;
|
|
56
66
|
/** Names a panel that has no `DialogTitle`. A registered Title wins. */
|
|
57
67
|
ariaLabel?: string;
|
|
68
|
+
/** Opens the panel out of this element (the tile it came from): it grows from the element's box
|
|
69
|
+
* over it instead of appearing centred, and closes back into it. */
|
|
70
|
+
anchor?: HTMLElement;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/* Pixel widths of the sizes an anchored panel keeps (Tailwind's max-w-sm/md/lg/3xl/5xl). */
|
|
74
|
+
const ANCHORED_WIDTH: Record<ModalSize, number> = {
|
|
75
|
+
sm: 384,
|
|
76
|
+
md: 448,
|
|
77
|
+
lg: 512,
|
|
78
|
+
xl: 768,
|
|
79
|
+
full: 1024,
|
|
58
80
|
};
|
|
59
81
|
|
|
60
82
|
const DialogContent: ParentComponent<DialogContentProps> = (props) => {
|
|
61
|
-
const [local, others] = splitProps(props, [
|
|
83
|
+
const [local, others] = splitProps(props, [
|
|
84
|
+
"class",
|
|
85
|
+
"children",
|
|
86
|
+
"size",
|
|
87
|
+
"ariaLabel",
|
|
88
|
+
"anchor",
|
|
89
|
+
"style",
|
|
90
|
+
]);
|
|
62
91
|
const context = useDialogContext();
|
|
92
|
+
const [viewport, setViewport] = createSignal(0);
|
|
93
|
+
createEffect(() => {
|
|
94
|
+
if (!local.anchor || !context.isOpen()) return;
|
|
95
|
+
const measure = () => setViewport((n) => n + 1);
|
|
96
|
+
window.addEventListener("resize", measure);
|
|
97
|
+
onCleanup(() => window.removeEventListener("resize", measure));
|
|
98
|
+
});
|
|
99
|
+
const placement = () => {
|
|
100
|
+
viewport();
|
|
101
|
+
const a = local.anchor;
|
|
102
|
+
return a ? overAnchor(a, ANCHORED_WIDTH[local.size ?? "lg"]) : undefined;
|
|
103
|
+
};
|
|
63
104
|
return (
|
|
64
105
|
<DialogPrimitive.Portal>
|
|
65
106
|
<ModalScrollLock />
|
|
@@ -69,11 +110,12 @@ const DialogContent: ParentComponent<DialogContentProps> = (props) => {
|
|
|
69
110
|
role="dialog"
|
|
70
111
|
aria-label={context.titleId() ? undefined : local.ariaLabel}
|
|
71
112
|
class={cn(
|
|
72
|
-
MODAL_PANEL,
|
|
73
|
-
MODAL_WIDTH[local.size ?? "lg"],
|
|
74
|
-
MODAL_ANCHOR[local.size ?? "lg"],
|
|
113
|
+
local.anchor ? ANCHORED_PANEL : MODAL_PANEL,
|
|
114
|
+
!local.anchor && MODAL_WIDTH[local.size ?? "lg"],
|
|
115
|
+
!local.anchor && MODAL_ANCHOR[local.size ?? "lg"],
|
|
75
116
|
local.class,
|
|
76
117
|
)}
|
|
118
|
+
style={{ ...(typeof local.style === "object" ? local.style : {}), ...placement() }}
|
|
77
119
|
{...others}
|
|
78
120
|
>
|
|
79
121
|
{local.children}
|
package/src/solid/dock.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
type Component,
|
|
3
3
|
type ComponentProps,
|
|
4
4
|
createEffect,
|
|
5
|
+
createMemo,
|
|
5
6
|
createSignal,
|
|
6
7
|
Index,
|
|
7
8
|
type JSX,
|
|
@@ -27,6 +28,8 @@ interface DockItem {
|
|
|
27
28
|
isActive?: boolean;
|
|
28
29
|
/** Optional count badge on the item (e.g. pending updates). */
|
|
29
30
|
badge?: number;
|
|
31
|
+
/** Something dragged is held over this item and will land here on release. */
|
|
32
|
+
isDropTarget?: boolean;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
interface DockProps extends ComponentProps<"div"> {
|
|
@@ -36,19 +39,31 @@ interface DockProps extends ComponentProps<"div"> {
|
|
|
36
39
|
hold?: { x: number; y: number; fired: boolean } | null;
|
|
37
40
|
/** A rim light that orbits for as long as a mode is on. */
|
|
38
41
|
glow?: boolean;
|
|
42
|
+
/** Where a drag from outside the dock is pointing, in client coordinates. */
|
|
43
|
+
dragPoint?: { x: number; y: number } | null;
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
interface DockIconButtonProps extends ComponentProps<"button"> {
|
|
42
47
|
icon: Component<{ class?: string }> | JSX.Element;
|
|
43
48
|
label: string;
|
|
44
49
|
isActive?: boolean;
|
|
50
|
+
/** Sits on the sliding pill: the active item, or the one a drag would land on. */
|
|
51
|
+
lit?: boolean;
|
|
45
52
|
badge?: number;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
const DockIconButton: Component<DockIconButtonProps> = (props) => {
|
|
49
56
|
// Kobalte's button root narrows `type`; Solid's ComponentProps<"button"> also
|
|
50
57
|
// admits "menu", so it is split off rather than spread.
|
|
51
|
-
const [local, rest] = splitProps(props, [
|
|
58
|
+
const [local, rest] = splitProps(props, [
|
|
59
|
+
"icon",
|
|
60
|
+
"label",
|
|
61
|
+
"class",
|
|
62
|
+
"isActive",
|
|
63
|
+
"badge",
|
|
64
|
+
"type",
|
|
65
|
+
"lit",
|
|
66
|
+
]);
|
|
52
67
|
const isElement = () => typeof local.icon !== "function";
|
|
53
68
|
|
|
54
69
|
return (
|
|
@@ -68,8 +83,8 @@ const DockIconButton: Component<DockIconButtonProps> = (props) => {
|
|
|
68
83
|
<div
|
|
69
84
|
data-slot="dock-item-icon"
|
|
70
85
|
class={cn(
|
|
71
|
-
"flex items-center justify-center transition-colors duration-
|
|
72
|
-
local.
|
|
86
|
+
"flex items-center justify-center transition-colors duration-(--duration-state)",
|
|
87
|
+
local.lit ? "text-primary" : "text-foreground group-hover:text-primary/80",
|
|
73
88
|
)}
|
|
74
89
|
>
|
|
75
90
|
{isElement() ? (
|
|
@@ -100,7 +115,14 @@ const DockIconButton: Component<DockIconButtonProps> = (props) => {
|
|
|
100
115
|
};
|
|
101
116
|
|
|
102
117
|
const Dock: Component<DockProps> = (props) => {
|
|
103
|
-
const [local, rest] = splitProps(props, [
|
|
118
|
+
const [local, rest] = splitProps(props, [
|
|
119
|
+
"items",
|
|
120
|
+
"class",
|
|
121
|
+
"dockMode",
|
|
122
|
+
"hold",
|
|
123
|
+
"glow",
|
|
124
|
+
"dragPoint",
|
|
125
|
+
]);
|
|
104
126
|
// The drain plays where the fill grew, so the point outlives the hold.
|
|
105
127
|
const [holdPoint, setHoldPoint] = createSignal({ x: 0, y: 0, r: 0 });
|
|
106
128
|
let surfaceRef: HTMLDivElement | undefined;
|
|
@@ -124,10 +146,16 @@ const Dock: Component<DockProps> = (props) => {
|
|
|
124
146
|
const [viewportWidth, setViewportWidth] = createSignal(0);
|
|
125
147
|
|
|
126
148
|
// The moving background: the shared SlidingIndicator tracks the active item.
|
|
127
|
-
|
|
149
|
+
// A memo: the items list is rebuilt on every hover change, and only a new active item may scroll the strip.
|
|
150
|
+
const activeIndex = createMemo(() => {
|
|
128
151
|
const i = local.items.findIndex((it) => it.isActive);
|
|
129
152
|
return i < 0 ? null : i;
|
|
130
|
-
};
|
|
153
|
+
});
|
|
154
|
+
// A drag borrows the pill: it slides to where the drop would land and back when the drag leaves.
|
|
155
|
+
const pillIndex = createMemo(() => {
|
|
156
|
+
const i = local.items.findIndex((it) => it.isDropTarget);
|
|
157
|
+
return i < 0 ? activeIndex() : i;
|
|
158
|
+
});
|
|
131
159
|
|
|
132
160
|
const gapWidth = () =>
|
|
133
161
|
containerRef ? Number.parseFloat(getComputedStyle(containerRef).columnGap) || 0 : 0;
|
|
@@ -174,12 +202,39 @@ const Dock: Component<DockProps> = (props) => {
|
|
|
174
202
|
});
|
|
175
203
|
};
|
|
176
204
|
|
|
205
|
+
// A drag cannot click a page dot, so resting on the dot row turns to the page under it.
|
|
206
|
+
createEffect(() => {
|
|
207
|
+
const point = local.dragPoint;
|
|
208
|
+
if (!point || pages() < 2 || !surfaceRef || !containerRef) return;
|
|
209
|
+
const strip = containerRef.getBoundingClientRect();
|
|
210
|
+
const surface = surfaceRef.getBoundingClientRect();
|
|
211
|
+
const onDotRow =
|
|
212
|
+
point.y > strip.bottom &&
|
|
213
|
+
point.y <= surface.bottom &&
|
|
214
|
+
point.x >= surface.left &&
|
|
215
|
+
point.x <= surface.right;
|
|
216
|
+
if (!onDotRow) return;
|
|
217
|
+
const target = Math.min(
|
|
218
|
+
pages() - 1,
|
|
219
|
+
Math.floor(((point.x - surface.left) / surface.width) * pages()),
|
|
220
|
+
);
|
|
221
|
+
if (target === page()) return;
|
|
222
|
+
const timer = setTimeout(() => goToPage(target), 300);
|
|
223
|
+
onCleanup(() => clearTimeout(timer));
|
|
224
|
+
});
|
|
225
|
+
|
|
177
226
|
// The active dashboard may sit on another page after a switch elsewhere.
|
|
178
227
|
createEffect(() => {
|
|
179
228
|
const i = activeIndex();
|
|
180
229
|
if (i === null || !containerRef || !needsScroll()) return;
|
|
181
230
|
const item = containerRef.querySelectorAll('[data-slot="dock-item"]')[i];
|
|
182
|
-
item
|
|
231
|
+
if (!item || viewportWidth() <= 0) return;
|
|
232
|
+
// The strip only: scrollIntoView would also scroll the page and any frame embedding it.
|
|
233
|
+
const left =
|
|
234
|
+
item.getBoundingClientRect().left -
|
|
235
|
+
containerRef.getBoundingClientRect().left +
|
|
236
|
+
containerRef.scrollLeft;
|
|
237
|
+
goToPage(Math.floor(left / viewportWidth()));
|
|
183
238
|
});
|
|
184
239
|
|
|
185
240
|
onMount(() => {
|
|
@@ -275,16 +330,19 @@ const Dock: Component<DockProps> = (props) => {
|
|
|
275
330
|
"min-width": needsScroll() ? "auto" : "fit-content",
|
|
276
331
|
}}
|
|
277
332
|
>
|
|
278
|
-
<SlidingIndicator active={
|
|
333
|
+
<SlidingIndicator active={pillIndex()} class="flex items-center gap-0.5 sm:gap-1">
|
|
279
334
|
<Index each={local.items}>
|
|
280
|
-
{(item) => (
|
|
335
|
+
{(item, i) => (
|
|
281
336
|
<DockIconButton
|
|
282
337
|
class={needsScroll() ? "snap-start" : undefined}
|
|
283
338
|
icon={item().icon}
|
|
284
339
|
label={item().label}
|
|
285
340
|
onClick={item().onClick}
|
|
286
341
|
isActive={item().isActive}
|
|
342
|
+
lit={i === pillIndex()}
|
|
287
343
|
badge={item().badge}
|
|
344
|
+
data-drop-target={item().isDropTarget ? "" : undefined}
|
|
345
|
+
data-dock-id={item().id}
|
|
288
346
|
/>
|
|
289
347
|
)}
|
|
290
348
|
</Index>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import { Show } from "solid-js";
|
|
3
|
+
import { Portal } from "solid-js/web";
|
|
4
|
+
import { Z_CLASS } from "../lib/layers.js";
|
|
5
|
+
import { OVERLAY_SURFACE_OPAQUE } from "../lib/overlay-classes.js";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
import { createModalParts } from "./dialog-parts.js";
|
|
8
|
+
|
|
9
|
+
/* Non-modal: no scrim, no scroll lock, no focus trap, so the page behind stays
|
|
10
|
+
* live. Opaque: an editor stays readable over any material, blur 0 included. Below md it docks to the bottom and a handle folds it to its header;
|
|
11
|
+
* z-sheet keeps menus opened from inside it (z-overlay) above it. */
|
|
12
|
+
const DOCKED_PANEL = `fixed ${Z_CLASS.sheet} flex flex-col overflow-hidden ${OVERLAY_SURFACE_OPAQUE} text-popover-foreground animate-in fade-in duration-300 max-md:inset-x-0 max-md:bottom-0 max-md:max-h-[min(60dvh,38rem)] max-md:rounded-t-2xl max-md:slide-in-from-bottom-8 md:inset-y-3 md:right-3 md:w-[25rem] md:rounded-2xl md:slide-in-from-right-8 max-md:data-[collapsed]:[&_[data-slot=docked-panel-body]]:hidden max-md:data-[collapsed]:[&_[data-slot=docked-panel-footer]]:hidden [&_[data-slot=docked-panel-footer]]:flex-row`;
|
|
13
|
+
|
|
14
|
+
export function DockedPanel(props: {
|
|
15
|
+
open: boolean;
|
|
16
|
+
ariaLabel: string;
|
|
17
|
+
collapsed?: boolean;
|
|
18
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
19
|
+
class?: string;
|
|
20
|
+
children: JSX.Element;
|
|
21
|
+
}) {
|
|
22
|
+
return (
|
|
23
|
+
<Show when={props.open}>
|
|
24
|
+
<Portal>
|
|
25
|
+
<aside
|
|
26
|
+
data-slot="docked-panel"
|
|
27
|
+
aria-label={props.ariaLabel}
|
|
28
|
+
data-collapsed={props.collapsed ? "" : undefined}
|
|
29
|
+
class={cn(DOCKED_PANEL, props.class)}
|
|
30
|
+
>
|
|
31
|
+
<Show when={props.onCollapsedChange}>
|
|
32
|
+
<button
|
|
33
|
+
type="button"
|
|
34
|
+
data-slot="docked-panel-handle"
|
|
35
|
+
aria-label={props.collapsed ? "Show panel" : "Hide panel"}
|
|
36
|
+
aria-expanded={!props.collapsed}
|
|
37
|
+
class="mx-auto flex h-6 w-full shrink-0 items-center justify-center md:hidden"
|
|
38
|
+
onClick={() => props.onCollapsedChange?.(!props.collapsed)}
|
|
39
|
+
>
|
|
40
|
+
<span class="h-1.5 w-10 rounded-full bg-foreground/25" />
|
|
41
|
+
</button>
|
|
42
|
+
</Show>
|
|
43
|
+
{props.children}
|
|
44
|
+
</aside>
|
|
45
|
+
</Portal>
|
|
46
|
+
</Show>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const {
|
|
51
|
+
Header: DockedPanelHeader,
|
|
52
|
+
Body: DockedPanelBody,
|
|
53
|
+
Footer: DockedPanelFooter,
|
|
54
|
+
} = createModalParts("docked-panel");
|
|
55
|
+
|
|
56
|
+
export { DockedPanelBody, DockedPanelFooter, DockedPanelHeader };
|
|
@@ -507,7 +507,7 @@ export function EntitySelector(props: EntitySelectorProps) {
|
|
|
507
507
|
</span>
|
|
508
508
|
<button
|
|
509
509
|
type="button"
|
|
510
|
-
class="text-primary text-sm hover:underline"
|
|
510
|
+
class="text-primary-tint-foreground text-sm hover:underline"
|
|
511
511
|
onClick={() => setShowDiagnostics(true)}
|
|
512
512
|
>
|
|
513
513
|
Show diagnostic entities
|
|
@@ -520,7 +520,7 @@ export function EntitySelector(props: EntitySelectorProps) {
|
|
|
520
520
|
</span>
|
|
521
521
|
<button
|
|
522
522
|
type="button"
|
|
523
|
-
class="text-primary text-sm hover:underline"
|
|
523
|
+
class="text-primary-tint-foreground text-sm hover:underline"
|
|
524
524
|
onClick={() => setSearch("")}
|
|
525
525
|
>
|
|
526
526
|
Clear search
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type JSX, Show } from "solid-js";
|
|
2
2
|
import { glassToneText, isNeutralTone, NEUTRAL_KNOBS } from "../lib/glass-tone.js";
|
|
3
|
-
import { SECTION_OUTER_RADIUS } from "../lib/section-tokens.js";
|
|
4
3
|
import { cn } from "../lib/utils.js";
|
|
5
4
|
import { Badge } from "./badge.js";
|
|
6
5
|
import { Icon } from "./icon.js";
|
|
@@ -11,7 +10,8 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
|
11
10
|
* wizard's connect/sign-in steps and People's pick-one dialogs. Chrome lives
|
|
12
11
|
* here once; the two call shapes below (nav button vs. grouped radio item)
|
|
13
12
|
* share it so neither surface can drift from the other. */
|
|
14
|
-
const HERO_ACTION_CHROME =
|
|
13
|
+
const HERO_ACTION_CHROME =
|
|
14
|
+
"glass group relative flex min-h-[6.25rem] items-center gap-4 overflow-hidden rounded-[calc(var(--radius)+8px)] p-4 text-left transition-glass duration-200 [--glass-lift:0.4] [--glass-wash:20%] hover:[--glass-wash:30%] [--glass-edge:oklch(from_var(--glass-tone)_l_c_h/0.5)] [&_[data-slot=ornament-arrow]]:opacity-35 hover:-translate-y-0.5 active:translate-y-0 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 hover:[--glass-lift:0.85] data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:translate-y-0";
|
|
15
15
|
|
|
16
16
|
/* glassToneText tints a label toward its own tone, which stops being legible
|
|
17
17
|
* on a dark surface once the tone itself is dark (the GlassHome deep blue).
|