@glasshome/ui 1.21.0 → 1.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/use-is-mobile.d.ts +3 -1
- package/dist/solid/alert-dialog.d.ts +7 -1
- package/dist/solid/bottom-sheet/bottom-sheet.d.ts +7 -1
- package/dist/solid/dialog-parts.d.ts +3 -2
- package/dist/solid/dialog.d.ts +7 -1
- package/dist/solid/docked-panel.d.ts +7 -1
- package/dist/solid/index.d.ts +9 -9
- package/dist/solid/index.js +5456 -5447
- package/dist/solid/media-store.d.ts +4 -1
- package/dist/solid/option-card.d.ts +4 -1
- package/dist/solid/responsive-dialog.d.ts +7 -1
- package/dist/solid/sheet.d.ts +7 -1
- package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
- package/package.json +128 -126
- package/scripts/check-gallery.ts +142 -142
- package/scripts/check-pack.ts +13 -13
- package/scripts/check-structural-classes.ts +20 -20
- package/scripts/check-tokens.ts +27 -27
- package/scripts/check-ui-drift.mjs +103 -103
- package/src/index.ts +75 -80
- package/src/lib/alert-tones.ts +41 -41
- package/src/lib/anchor-placement.ts +21 -21
- package/src/lib/button-variants.ts +28 -28
- package/src/lib/card-classes.ts +9 -9
- package/src/lib/carousel-classes.ts +14 -14
- package/src/lib/glass-tone.ts +11 -11
- package/src/lib/input-classes.ts +6 -6
- package/src/lib/layers.ts +4 -4
- package/src/lib/logo-lockup.ts +8 -8
- package/src/lib/menu-classes.ts +2 -2
- package/src/lib/motion-classes.ts +8 -8
- package/src/lib/motion-window.ts +24 -24
- package/src/lib/overlay-classes.ts +6 -6
- package/src/lib/pill-classes.ts +3 -3
- package/src/lib/position-bar-classes.ts +1 -1
- package/src/lib/spotlight-geometry.ts +67 -67
- package/src/lib/thumb-classes.ts +2 -2
- package/src/lib/tier-badge.ts +16 -16
- package/src/lib/use-is-mobile.ts +17 -14
- package/src/lib/utils.ts +1 -1
- package/src/solid/accordion.tsx +41 -41
- package/src/solid/alert-dialog.tsx +95 -95
- package/src/solid/alert.tsx +88 -88
- package/src/solid/area-picker.tsx +204 -204
- package/src/solid/aspect-ratio.tsx +13 -13
- package/src/solid/avatar.tsx +27 -27
- package/src/solid/badge.tsx +49 -49
- package/src/solid/bottom-sheet/arbitration.ts +22 -22
- package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
- package/src/solid/bottom-sheet/drag-controller.ts +201 -201
- package/src/solid/bottom-sheet/focus-trap.ts +51 -47
- package/src/solid/bottom-sheet/index.ts +12 -12
- package/src/solid/bottom-sheet/keyboard.ts +25 -25
- package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
- package/src/solid/bottom-sheet/state-machine.ts +28 -28
- package/src/solid/bottom-sheet/velocity.ts +29 -29
- package/src/solid/breadcrumb.tsx +76 -76
- package/src/solid/button-group.tsx +46 -46
- package/src/solid/button.tsx +19 -19
- package/src/solid/card.tsx +67 -67
- package/src/solid/carousel.tsx +246 -246
- package/src/solid/charts.tsx +253 -253
- package/src/solid/checkbox.tsx +51 -51
- package/src/solid/collapsible.tsx +22 -22
- package/src/solid/color-disc.tsx +213 -213
- package/src/solid/color-slider.tsx +81 -81
- package/src/solid/color-wheel.tsx +61 -61
- package/src/solid/context-menu.tsx +63 -63
- package/src/solid/copy-button.tsx +31 -31
- package/src/solid/count-pill.tsx +11 -11
- package/src/solid/dashboard-preview.tsx +104 -104
- package/src/solid/data-table.tsx +228 -228
- package/src/solid/dialog-parts.tsx +129 -129
- package/src/solid/dialog.tsx +113 -113
- package/src/solid/dock-paging.ts +9 -9
- package/src/solid/dock.tsx +339 -338
- package/src/solid/docked-panel.tsx +35 -35
- package/src/solid/dropdown-menu.tsx +77 -77
- package/src/solid/empty.tsx +70 -70
- package/src/solid/entity-data.ts +38 -38
- package/src/solid/entity-selector.tsx +634 -634
- package/src/solid/field.tsx +205 -205
- package/src/solid/form.tsx +159 -159
- package/src/solid/hero-action.tsx +85 -85
- package/src/solid/hover-card.tsx +11 -11
- package/src/solid/icon-picker.tsx +401 -401
- package/src/solid/icon.tsx +101 -78
- package/src/solid/image-picker.tsx +416 -414
- package/src/solid/index.ts +265 -304
- package/src/solid/input-group.tsx +123 -123
- package/src/solid/input-otp.tsx +143 -143
- package/src/solid/input.tsx +4 -4
- package/src/solid/item.tsx +130 -130
- package/src/solid/kbd.tsx +20 -20
- package/src/solid/label.tsx +12 -12
- package/src/solid/list-reorder.ts +122 -122
- package/src/solid/logo.tsx +60 -60
- package/src/solid/media-copy.ts +21 -21
- package/src/solid/media-store.ts +60 -57
- package/src/solid/media-tile.tsx +85 -85
- package/src/solid/menu-parts.tsx +164 -164
- package/src/solid/number-field.tsx +56 -56
- package/src/solid/option-card.tsx +168 -165
- package/src/solid/ornament.tsx +43 -43
- package/src/solid/overlay.tsx +4 -4
- package/src/solid/page-header.tsx +75 -75
- package/src/solid/pagination.tsx +80 -80
- package/src/solid/password-input.tsx +51 -51
- package/src/solid/picker-row.tsx +83 -83
- package/src/solid/picker-search.tsx +65 -63
- package/src/solid/picker-trigger.tsx +59 -57
- package/src/solid/popover.tsx +54 -54
- package/src/solid/preview-tile.tsx +67 -67
- package/src/solid/progress.tsx +21 -21
- package/src/solid/radio-group.tsx +51 -51
- package/src/solid/resizable.tsx +128 -128
- package/src/solid/responsive-dialog.tsx +134 -134
- package/src/solid/schema-form.tsx +746 -739
- package/src/solid/scope-indicator.tsx +5 -5
- package/src/solid/scroll-area.tsx +16 -16
- package/src/solid/section-card.tsx +281 -281
- package/src/solid/select.tsx +101 -101
- package/src/solid/separator.tsx +25 -25
- package/src/solid/settings-row.tsx +122 -122
- package/src/solid/sheet.tsx +96 -96
- package/src/solid/skeleton.tsx +8 -8
- package/src/solid/slider.tsx +132 -132
- package/src/solid/sliding-indicator.tsx +280 -265
- package/src/solid/sonner.tsx +164 -164
- package/src/solid/spinner.tsx +12 -12
- package/src/solid/spotlight.tsx +140 -140
- package/src/solid/step-indicator.tsx +18 -18
- package/src/solid/swatch-picker.tsx +38 -38
- package/src/solid/switch.tsx +52 -52
- package/src/solid/table.tsx +63 -63
- package/src/solid/tabs.tsx +93 -93
- package/src/solid/textarea.tsx +8 -8
- package/src/solid/toggle-group.tsx +83 -83
- package/src/solid/toggle.tsx +33 -33
- package/src/solid/tooltip.tsx +16 -16
- package/src/solid/widget-card.tsx +90 -90
- package/src/solid/widget-identity.tsx +99 -99
- package/src/solid/widget-trust-badge.tsx +20 -20
- package/src/styles/globals.css +316 -319
- package/src/styles/theme.css +448 -448
- package/src/tokens/hex.ts +29 -29
- package/src/tokens/material.ts +75 -75
- package/src/tokens/presets.ts +303 -303
- package/src/tokens/readability.ts +32 -32
- package/src/tokens/theme-colors.ts +95 -95
- package/src/tokens/theme-css.ts +22 -22
- package/src/tokens/theme-recipe.ts +106 -106
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type ComponentProps, children, type JSX, Show, splitProps } from "solid-js";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
CARD_BLUR,
|
|
4
|
+
CARD_SURFACE_BASE,
|
|
5
|
+
SECTION_ROW_INTERACTIVE,
|
|
6
|
+
SECTION_ROW_SURFACE,
|
|
7
7
|
} from "../lib/card-classes.js";
|
|
8
8
|
import { ICON_PILL, ICON_PILL_TINT } from "../lib/pill-classes.js";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
SECTION_INNER_RADIUS,
|
|
11
|
+
SECTION_OUTER_RADIUS,
|
|
12
|
+
SECTION_PADDING,
|
|
13
13
|
} from "../lib/section-tokens.js";
|
|
14
14
|
import { cn } from "../lib/utils.js";
|
|
15
15
|
import { CountPill } from "./count-pill.js";
|
|
@@ -18,134 +18,134 @@ import { Icon } from "./icon.js";
|
|
|
18
18
|
/* Performant-blur injection (dash): when active() the card gates CARD_BLUR off
|
|
19
19
|
* and paints the engine's precomputed slice via style() instead. */
|
|
20
20
|
export type GlassSurface = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
ref?: (el: HTMLElement) => void;
|
|
22
|
+
style?: () => JSX.CSSProperties;
|
|
23
|
+
active?: () => boolean;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export const NOOP_GLASS: Required<GlassSurface> = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
ref: () => {},
|
|
28
|
+
style: () => ({}),
|
|
29
|
+
active: () => false,
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
type SectionCardProps = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
icon?: string;
|
|
34
|
+
title?: JSX.Element;
|
|
35
|
+
subtitle?: JSX.Element;
|
|
36
|
+
count?: number | string;
|
|
37
|
+
action?: JSX.Element;
|
|
38
|
+
toolbar?: JSX.Element;
|
|
39
|
+
headerClass?: string;
|
|
40
|
+
subtitleClass?: string;
|
|
41
|
+
class?: string;
|
|
42
|
+
glass?: GlassSurface;
|
|
43
|
+
children?: JSX.Element;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
// The section owns every gap; the header, toolbar and rows inside it add none.
|
|
47
47
|
export function SectionCard(props: SectionCardProps) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
const glass = () => props.glass ?? NOOP_GLASS;
|
|
49
|
+
const active = () => glass().active?.() ?? false;
|
|
50
|
+
const hasHeader = () =>
|
|
51
|
+
props.icon != null || props.title != null || props.action != null || props.count != null;
|
|
52
|
+
// Resolved once: a header-only card must not pay the section gap for an
|
|
53
|
+
// empty body slot, and reading props.children twice would build it twice.
|
|
54
|
+
const body = children(() => props.children);
|
|
55
|
+
const hasBody = () => body.toArray().some((child) => child != null && child !== false);
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
57
|
+
return (
|
|
58
|
+
<section
|
|
59
|
+
data-slot="section-card"
|
|
60
|
+
ref={glass().ref}
|
|
61
|
+
class={cn(
|
|
62
|
+
CARD_SURFACE_BASE,
|
|
63
|
+
SECTION_OUTER_RADIUS,
|
|
64
|
+
SECTION_PADDING,
|
|
65
|
+
"transition-glass relative flex flex-col gap-3 overflow-hidden [contain:layout_style_paint] md:gap-4",
|
|
66
|
+
props.class,
|
|
67
|
+
)}
|
|
68
|
+
classList={{ [CARD_BLUR]: !active() }}
|
|
69
|
+
style={glass().style?.() ?? {}}
|
|
70
|
+
>
|
|
71
|
+
<Show when={hasHeader()}>
|
|
72
|
+
<header
|
|
73
|
+
data-slot="section-card-header"
|
|
74
|
+
class={cn("flex items-center gap-2 sm:gap-3", props.headerClass)}
|
|
75
|
+
>
|
|
76
|
+
<Show when={props.icon}>
|
|
77
|
+
{(icon) => <SectionIcon icon={icon()} tone="var(--primary)" />}
|
|
78
|
+
</Show>
|
|
79
|
+
<div data-slot="section-card-headings" class="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
80
|
+
<div data-slot="section-card-headline" class="flex min-w-0 items-center gap-2 sm:gap-3">
|
|
81
|
+
<Show when={props.title}>
|
|
82
|
+
<SectionTitle>{props.title}</SectionTitle>
|
|
83
|
+
</Show>
|
|
84
|
+
<Show when={props.count != null}>
|
|
85
|
+
<CountPill>{props.count}</CountPill>
|
|
86
|
+
</Show>
|
|
87
|
+
</div>
|
|
88
|
+
<Show when={props.subtitle}>
|
|
89
|
+
<SectionMeta class={props.subtitleClass}>{props.subtitle}</SectionMeta>
|
|
90
|
+
</Show>
|
|
91
|
+
</div>
|
|
92
|
+
<Show when={props.action}>
|
|
93
|
+
<div data-slot="section-card-actions" class="flex shrink-0 items-center gap-2">
|
|
94
|
+
{props.action}
|
|
95
|
+
</div>
|
|
96
|
+
</Show>
|
|
97
|
+
</header>
|
|
98
|
+
</Show>
|
|
99
|
+
<Show when={props.toolbar}>
|
|
100
|
+
<div
|
|
101
|
+
data-slot="section-card-toolbar"
|
|
102
|
+
class={cn(hasHeader() && "border-border/50 border-t pt-3")}
|
|
103
|
+
>
|
|
104
|
+
{props.toolbar}
|
|
105
|
+
</div>
|
|
106
|
+
</Show>
|
|
107
|
+
<Show when={hasBody()}>
|
|
108
|
+
<div data-slot="section-card-body">{body()}</div>
|
|
109
|
+
</Show>
|
|
110
|
+
</section>
|
|
111
|
+
);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
export function SectionRow(props: ComponentProps<"div"> & { interactive?: boolean }) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
const [local, rest] = splitProps(props, ["class", "interactive"]);
|
|
116
|
+
return (
|
|
117
|
+
<div
|
|
118
|
+
data-slot="section-row"
|
|
119
|
+
class={cn(
|
|
120
|
+
SECTION_ROW_SURFACE,
|
|
121
|
+
SECTION_INNER_RADIUS,
|
|
122
|
+
SECTION_PADDING,
|
|
123
|
+
local.interactive && SECTION_ROW_INTERACTIVE,
|
|
124
|
+
local.class,
|
|
125
|
+
)}
|
|
126
|
+
{...rest}
|
|
127
|
+
/>
|
|
128
|
+
);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
type ListRowProps = {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
132
|
+
/** Leading visual: SectionIcon, Avatar, drag handle. */
|
|
133
|
+
leading?: JSX.Element;
|
|
134
|
+
title: JSX.Element;
|
|
135
|
+
/** Chips inline after the title. */
|
|
136
|
+
badges?: JSX.Element;
|
|
137
|
+
subtitle?: JSX.Element;
|
|
138
|
+
/** Quiet trailing text: versions, timestamps, counts. */
|
|
139
|
+
meta?: JSX.Element;
|
|
140
|
+
/** Controls at the row's end. Stacked above the open overlay. */
|
|
141
|
+
actions?: JSX.Element;
|
|
142
|
+
/** Activates the whole row. Renders a chevron when there are no actions. */
|
|
143
|
+
onOpen?: () => void;
|
|
144
|
+
/** The whole row is a link. Same chevron and press target as onOpen. */
|
|
145
|
+
href?: string;
|
|
146
|
+
/** Accessible name for the whole-row activation; required with href or onOpen. */
|
|
147
|
+
openLabel?: string;
|
|
148
|
+
class?: string;
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
/**
|
|
@@ -154,15 +154,15 @@ type ListRowProps = {
|
|
|
154
154
|
* rather than navigable items.
|
|
155
155
|
*/
|
|
156
156
|
export function FactRow(props: { label: JSX.Element; children: JSX.Element; class?: string }) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
return (
|
|
158
|
+
<div
|
|
159
|
+
data-slot="fact-row"
|
|
160
|
+
class={cn("flex items-baseline justify-between gap-3 py-1.5", props.class)}
|
|
161
|
+
>
|
|
162
|
+
<span class="text-muted-foreground shrink-0 text-xs">{props.label}</span>
|
|
163
|
+
<span class="min-w-0 text-right text-sm">{props.children}</span>
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
/**
|
|
@@ -170,140 +170,140 @@ export function FactRow(props: { label: JSX.Element; children: JSX.Element; clas
|
|
|
170
170
|
* whatever it holds; the row itself, not a nested button, is what you press.
|
|
171
171
|
*/
|
|
172
172
|
export function ListRow(props: ListRowProps) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
173
|
+
const opens = () => props.onOpen !== undefined || props.href !== undefined;
|
|
174
|
+
return (
|
|
175
|
+
<SectionRow
|
|
176
|
+
interactive={opens()}
|
|
177
|
+
class={cn("@container/list-row relative flex items-center gap-3", props.class)}
|
|
178
|
+
>
|
|
179
|
+
<Show when={props.href}>
|
|
180
|
+
{(href) => (
|
|
181
|
+
<a href={href()} class="absolute inset-0 rounded-[inherit] outline-none">
|
|
182
|
+
<span class="sr-only">{props.openLabel}</span>
|
|
183
|
+
</a>
|
|
184
|
+
)}
|
|
185
|
+
</Show>
|
|
186
|
+
<Show when={props.href === undefined && props.onOpen}>
|
|
187
|
+
<button
|
|
188
|
+
type="button"
|
|
189
|
+
class="absolute inset-0 rounded-[inherit] outline-none"
|
|
190
|
+
aria-label={props.openLabel}
|
|
191
|
+
onClick={() => props.onOpen?.()}
|
|
192
|
+
/>
|
|
193
|
+
</Show>
|
|
194
|
+
<Show when={props.leading}>
|
|
195
|
+
<span class="flex shrink-0 items-center gap-2">{props.leading}</span>
|
|
196
|
+
</Show>
|
|
197
|
+
{/* Identity column. The floor is what gives the name priority: without
|
|
198
198
|
it this is the only shrinkable child, so flex crushes it to an
|
|
199
199
|
ellipsis and hands every spare pixel to meta. Sized to hold a name
|
|
200
200
|
plus its badge. */}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
201
|
+
<div class="min-w-[9rem] flex-1">
|
|
202
|
+
<div class="flex min-w-0 items-center gap-2">
|
|
203
|
+
<p class="truncate text-sm leading-tight font-semibold">{props.title}</p>
|
|
204
|
+
{props.badges}
|
|
205
|
+
</div>
|
|
206
|
+
<Show when={props.subtitle}>
|
|
207
|
+
<p class="text-muted-foreground mt-1 truncate text-xs">{props.subtitle}</p>
|
|
208
|
+
</Show>
|
|
209
|
+
</div>
|
|
210
|
+
{/* Trailing meta, centred across both identity lines. shrink-0, because
|
|
211
211
|
a squeeze-driven wrap fires off whichever meta happens to be widest
|
|
212
212
|
while the flex-1 identity column still holds unused slack. Meta that
|
|
213
213
|
wants to reflow reads @container/list-row and says so itself. */}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
214
|
+
<Show when={props.meta}>
|
|
215
|
+
<div class="text-muted-foreground shrink-0 text-xs">{props.meta}</div>
|
|
216
|
+
</Show>
|
|
217
|
+
<Show when={props.actions}>
|
|
218
|
+
<div class="relative flex shrink-0 items-center gap-1">{props.actions}</div>
|
|
219
|
+
</Show>
|
|
220
|
+
<Show when={opens() && props.actions === undefined}>
|
|
221
|
+
<Icon
|
|
222
|
+
icon="lucide:chevron-right"
|
|
223
|
+
width={16}
|
|
224
|
+
height={16}
|
|
225
|
+
class="text-muted-foreground shrink-0"
|
|
226
|
+
aria-hidden="true"
|
|
227
|
+
/>
|
|
228
|
+
</Show>
|
|
229
|
+
</SectionRow>
|
|
230
|
+
);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
type SectionIconSize = "sm" | "md" | "lg";
|
|
234
234
|
|
|
235
235
|
const ICON_DIMENSIONS: Record<SectionIconSize, string> = {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
sm: "size-7 [&>[data-slot=icon]]:text-[16px]",
|
|
237
|
+
md: "size-10 sm:size-11 [&>[data-slot=icon]]:text-[20px] sm:[&>[data-slot=icon]]:text-[22px]",
|
|
238
|
+
lg: "size-12 sm:size-14 [&>[data-slot=icon]]:text-[24px] sm:[&>[data-slot=icon]]:text-[28px]",
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
/** @deprecated pass a CSS color to `tone` instead. */
|
|
242
242
|
const LEGACY_TONES: Record<string, string | undefined> = {
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
neutral: undefined,
|
|
244
|
+
primary: "var(--primary)",
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
export function SectionIcon(props: {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
248
|
+
icon?: string;
|
|
249
|
+
children?: JSX.Element;
|
|
250
|
+
size?: SectionIconSize;
|
|
251
|
+
/** Any CSS color. `"neutral"` and `"primary"` are the deprecated old enum. */
|
|
252
|
+
tone?: string;
|
|
253
|
+
class?: string;
|
|
254
254
|
}) {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
255
|
+
const tone = () => {
|
|
256
|
+
const t = props.tone;
|
|
257
|
+
if (t == null) return undefined;
|
|
258
|
+
return t in LEGACY_TONES ? LEGACY_TONES[t] : t;
|
|
259
|
+
};
|
|
260
|
+
return (
|
|
261
|
+
<span
|
|
262
|
+
data-slot="section-icon"
|
|
263
|
+
class={cn(
|
|
264
|
+
tone() ? ICON_PILL_TINT : `${ICON_PILL} text-foreground/80`,
|
|
265
|
+
SECTION_INNER_RADIUS,
|
|
266
|
+
ICON_DIMENSIONS[props.size ?? "md"],
|
|
267
|
+
props.class,
|
|
268
|
+
)}
|
|
269
|
+
style={tone() ? { "--glass-tone": tone() } : undefined}
|
|
270
|
+
>
|
|
271
|
+
<Show when={props.children} fallback={props.icon ? <Icon icon={props.icon} /> : null}>
|
|
272
|
+
{props.children}
|
|
273
|
+
</Show>
|
|
274
|
+
</span>
|
|
275
|
+
);
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
export function SectionTitle(props: { children: JSX.Element; class?: string }) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
279
|
+
return (
|
|
280
|
+
<h2
|
|
281
|
+
data-slot="section-title"
|
|
282
|
+
class={cn(
|
|
283
|
+
"text-foreground truncate text-lg font-bold tracking-tight sm:text-xl",
|
|
284
|
+
props.class,
|
|
285
|
+
)}
|
|
286
|
+
>
|
|
287
|
+
{props.children}
|
|
288
|
+
</h2>
|
|
289
|
+
);
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
function SectionHeading(props: { children: JSX.Element; class?: string }) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
293
|
+
return (
|
|
294
|
+
<h3
|
|
295
|
+
data-slot="section-subtitle"
|
|
296
|
+
class={cn("text-base leading-tight font-semibold", props.class)}
|
|
297
|
+
>
|
|
298
|
+
{props.children}
|
|
299
|
+
</h3>
|
|
300
|
+
);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
/** @deprecated A bare heading has no owner: `SectionGroup` for a labelled group
|
|
304
304
|
* inside a card, `FieldLegend` for a titled group of form rows. */
|
|
305
305
|
export function SectionSubtitle(props: { children: JSX.Element; class?: string }) {
|
|
306
|
-
|
|
306
|
+
return <SectionHeading class={props.class}>{props.children}</SectionHeading>;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
/** One labelled group inside a `SectionCard`: icon, label, optional count and
|
|
@@ -311,68 +311,68 @@ export function SectionSubtitle(props: { children: JSX.Element; class?: string }
|
|
|
311
311
|
* its own rows and far from the group above; no rule is drawn. A zero count
|
|
312
312
|
* renders no pill: the empty group below already says it. */
|
|
313
313
|
export function SectionGroup(props: {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
314
|
+
icon: string;
|
|
315
|
+
label: JSX.Element;
|
|
316
|
+
count?: number | string;
|
|
317
|
+
action?: JSX.Element;
|
|
318
|
+
class?: string;
|
|
319
|
+
children: JSX.Element;
|
|
320
320
|
}) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
321
|
+
return (
|
|
322
|
+
<section data-slot="section-group" class={cn("mt-7 first:mt-3", props.class)}>
|
|
323
|
+
<header
|
|
324
|
+
data-slot="section-group-header"
|
|
325
|
+
class="mb-2 flex flex-wrap items-center justify-between gap-2"
|
|
326
|
+
>
|
|
327
|
+
<div data-slot="section-group-heading" class="flex min-w-0 items-center gap-2">
|
|
328
|
+
<SectionIcon icon={props.icon} size="sm" tone="var(--primary)" />
|
|
329
|
+
<SectionHeading>{props.label}</SectionHeading>
|
|
330
|
+
<Show when={props.count}>
|
|
331
|
+
<CountPill>{props.count}</CountPill>
|
|
332
|
+
</Show>
|
|
333
|
+
</div>
|
|
334
|
+
{props.action}
|
|
335
|
+
</header>
|
|
336
|
+
{props.children}
|
|
337
|
+
</section>
|
|
338
|
+
);
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
/** @deprecated SectionMeta, or FieldLegend for a titled group of rows. */
|
|
342
342
|
export function SectionLabel(props: { children: JSX.Element; class?: string }) {
|
|
343
|
-
|
|
343
|
+
return <SectionMeta class={cn("font-medium", props.class)}>{props.children}</SectionMeta>;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
export function SectionMeta(props: { children: JSX.Element; class?: string }) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
347
|
+
return (
|
|
348
|
+
<p data-slot="section-meta" class={cn("text-muted-foreground text-xs", props.class)}>
|
|
349
|
+
{props.children}
|
|
350
|
+
</p>
|
|
351
|
+
);
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
export function SectionRowSkeleton(props: { class?: string }) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
355
|
+
return (
|
|
356
|
+
<div
|
|
357
|
+
data-slot="section-row-skeleton"
|
|
358
|
+
aria-hidden="true"
|
|
359
|
+
class={cn(
|
|
360
|
+
SECTION_ROW_SURFACE,
|
|
361
|
+
SECTION_INNER_RADIUS,
|
|
362
|
+
"h-14 animate-pulse [--glass-rim:0.15]",
|
|
363
|
+
props.class,
|
|
364
|
+
)}
|
|
365
|
+
/>
|
|
366
|
+
);
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
export function SectionRowSkeletons(props: { count?: number }) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
370
|
+
const n = props.count ?? 3;
|
|
371
|
+
return (
|
|
372
|
+
<div data-slot="section-row-skeletons" class="flex flex-col gap-2" aria-busy="true">
|
|
373
|
+
{Array.from({ length: n }, () => (
|
|
374
|
+
<SectionRowSkeleton />
|
|
375
|
+
))}
|
|
376
|
+
</div>
|
|
377
|
+
);
|
|
378
378
|
}
|