@glasshome/ui 1.21.1 → 1.22.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/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/index.d.ts +9 -9
- package/dist/solid/index.js +5431 -5424
- package/dist/solid/sonner.d.ts +1 -0
- 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 +127 -127
- package/src/solid/dialog.tsx +113 -113
- package/src/solid/dock-paging.ts +9 -9
- package/src/solid/dock.tsx +339 -339
- 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 +56 -56
- 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 +164 -164
- 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 +743 -743
- 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 +165 -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,13 +1,13 @@
|
|
|
1
1
|
import { useRadioGroupContext } from "@kobalte/core/radio-group";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
children,
|
|
4
|
+
createContext,
|
|
5
|
+
createSignal,
|
|
6
|
+
type JSX,
|
|
7
|
+
onCleanup,
|
|
8
|
+
onMount,
|
|
9
|
+
Show,
|
|
10
|
+
useContext,
|
|
11
11
|
} from "solid-js";
|
|
12
12
|
import { CARD_SURFACE } from "../lib/card-classes.js";
|
|
13
13
|
import { STAGGER } from "../lib/motion-classes.js";
|
|
@@ -24,14 +24,14 @@ const OPTION_CARD_CHROME = `${CARD_SURFACE} group/option-card relative cursor-po
|
|
|
24
24
|
* 0fr -> 1fr on the morph token) while it is picked, and the content settles
|
|
25
25
|
* in behind the growing edge. Nothing appears below the card. */
|
|
26
26
|
const OPTION_CARD_DRAWER =
|
|
27
|
-
|
|
27
|
+
"grid grid-rows-[0fr] transition-[grid-template-rows] duration-(--duration-morph) ease-(--ease-morph) group-data-[checked]/option-card:grid-rows-[1fr]";
|
|
28
28
|
/* Flat: hover is a tint, the current row is the check plus full text colour.
|
|
29
29
|
* The rows start under the title text (card pad + icon + gap, less the row's own pad). */
|
|
30
30
|
const OPTION_CHOICE_ROW =
|
|
31
|
-
|
|
31
|
+
"rounded-sm text-foreground/75 transition-colors hover:bg-foreground/5 aria-checked:text-foreground";
|
|
32
32
|
|
|
33
33
|
const OPTION_CARD_DRAWER_CONTENT =
|
|
34
|
-
|
|
34
|
+
"-translate-y-2 flex flex-col gap-0.5 pr-1 pb-2 pl-[calc(var(--spacing)*3.5+54px)] opacity-0 transition-[opacity,translate] duration-(--duration-expand) ease-(--ease-morph) group-data-[checked]/option-card:translate-y-0 group-data-[checked]/option-card:opacity-100 group-data-[checked]/option-card:delay-[80ms]";
|
|
35
35
|
|
|
36
36
|
/* Sub-options are rows of the card, chosen in place: the same row a picker
|
|
37
37
|
* list shows, flat on the card (a glass pill on a glass card is a layer too
|
|
@@ -39,175 +39,175 @@ const OPTION_CARD_DRAWER_CONTENT =
|
|
|
39
39
|
* value (`subValue` / `onSubChange`); a choice registers so the card knows
|
|
40
40
|
* it has rows to name as a radiogroup. */
|
|
41
41
|
type ChoiceContext = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
subValue: () => string | undefined;
|
|
43
|
+
pick: (value: string) => void;
|
|
44
|
+
register: (value: string) => () => void;
|
|
45
45
|
};
|
|
46
46
|
const OptionChoiceContext = createContext<ChoiceContext>();
|
|
47
47
|
|
|
48
48
|
export function OptionChoice(props: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
value: string;
|
|
50
|
+
label: string;
|
|
51
|
+
hint?: string;
|
|
52
|
+
icon?: string;
|
|
53
|
+
disabled?: boolean;
|
|
54
54
|
}) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
55
|
+
const card = useContext(OptionChoiceContext);
|
|
56
|
+
if (!card) throw new Error("OptionChoice renders inside an OptionCard");
|
|
57
|
+
onMount(() => onCleanup(card.register(props.value)));
|
|
58
|
+
const selected = () => card.subValue() === props.value;
|
|
59
|
+
return (
|
|
60
|
+
<PickerRow
|
|
61
|
+
as="button"
|
|
62
|
+
type="button"
|
|
63
|
+
role="radio"
|
|
64
|
+
aria-checked={selected()}
|
|
65
|
+
data-slot="option-choice"
|
|
66
|
+
class={OPTION_CHOICE_ROW}
|
|
67
|
+
disabled={props.disabled}
|
|
68
|
+
icon={props.icon}
|
|
69
|
+
title={props.label}
|
|
70
|
+
subtitle={props.hint}
|
|
71
|
+
selected={selected()}
|
|
72
|
+
multi={false}
|
|
73
|
+
onClick={() => !props.disabled && card.pick(props.value)}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export function OptionCardGroup(props: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
value: string | null;
|
|
80
|
+
onChange: (value: string) => void;
|
|
81
|
+
"aria-label"?: string;
|
|
82
|
+
"aria-labelledby"?: string;
|
|
83
|
+
class?: string;
|
|
84
|
+
children: JSX.Element;
|
|
85
85
|
}) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
return (
|
|
87
|
+
<RadioGroup
|
|
88
|
+
class={cn("gap-2", props.class)}
|
|
89
|
+
value={props.value ?? undefined}
|
|
90
|
+
onChange={props.onChange}
|
|
91
|
+
aria-label={props["aria-label"]}
|
|
92
|
+
aria-labelledby={props["aria-labelledby"]}
|
|
93
|
+
>
|
|
94
|
+
{props.children}
|
|
95
|
+
</RadioGroup>
|
|
96
|
+
);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export function OptionCard(props: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
100
|
+
value: string;
|
|
101
|
+
title: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
icon?: string;
|
|
104
|
+
iconImage?: string;
|
|
105
|
+
/** Per-option tone (setup's brand colours); the theme primary when absent. */
|
|
106
|
+
accentVar?: string;
|
|
107
|
+
/** Drop the check when picking the card is itself the next step. */
|
|
108
|
+
ornament?: "check" | "none";
|
|
109
|
+
/** Fires on every click, including a re-pick of the already-checked card,
|
|
110
|
+
* which the group's `onChange` alone never reports. */
|
|
111
|
+
onPick?: () => void;
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
class?: string;
|
|
114
|
+
/** The current sub-option (an OptionChoice value). */
|
|
115
|
+
subValue?: string;
|
|
116
|
+
onSubChange?: (value: string) => void;
|
|
117
|
+
/** Sub-options (OptionChoice rows) or a custom body. The card grows to
|
|
118
|
+
* reveal them while it is picked. */
|
|
119
|
+
children?: JSX.Element;
|
|
120
120
|
}) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
121
|
+
const group = useRadioGroupContext();
|
|
122
|
+
const checked = () => group.isSelectedValue(props.value);
|
|
123
|
+
const [choices, setChoices] = createSignal<string[]>([]);
|
|
124
|
+
const choice: ChoiceContext = {
|
|
125
|
+
subValue: () => props.subValue,
|
|
126
|
+
pick: (value) => props.onSubChange?.(value),
|
|
127
|
+
register: (value) => {
|
|
128
|
+
setChoices((list) => [...list, value]);
|
|
129
|
+
return () => setChoices((list) => list.filter((v) => v !== value));
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
const kids = children(() => (
|
|
133
|
+
<OptionChoiceContext.Provider value={choice}>{props.children}</OptionChoiceContext.Provider>
|
|
134
|
+
));
|
|
135
|
+
return (
|
|
136
|
+
<div
|
|
137
|
+
data-slot="option-card"
|
|
138
|
+
data-checked={checked() ? "" : undefined}
|
|
139
|
+
data-disabled={props.disabled ? "" : undefined}
|
|
140
|
+
class={cn(OPTION_CARD_CHROME, props.class)}
|
|
141
|
+
style={
|
|
142
|
+
props.accentVar ? ({ "--glass-tone": props.accentVar } as JSX.CSSProperties) : undefined
|
|
143
|
+
}
|
|
144
|
+
>
|
|
145
|
+
<RadioGroupItem
|
|
146
|
+
value={props.value}
|
|
147
|
+
disabled={props.disabled}
|
|
148
|
+
showControl={false}
|
|
149
|
+
onClick={() => !props.disabled && props.onPick?.()}
|
|
150
|
+
class="relative w-full cursor-pointer overflow-hidden rounded-[inherit] text-left"
|
|
151
|
+
>
|
|
152
|
+
{/* On the header row, not the card: a grown card keeps its rows clear. */}
|
|
153
|
+
<Ornament kind={props.ornament ?? "check"} />
|
|
154
|
+
<div data-slot="option-card-row" class="flex w-full items-center gap-3.5 p-3.5">
|
|
155
|
+
<OptionIconWell icon={props.icon} image={props.iconImage} />
|
|
156
|
+
<div class="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
157
|
+
<span data-slot="option-card-title" class="text-[15px] leading-snug font-semibold">
|
|
158
|
+
{props.title}
|
|
159
|
+
</span>
|
|
160
|
+
<Show when={props.description}>
|
|
161
|
+
{(description) => (
|
|
162
|
+
<span
|
|
163
|
+
data-slot="option-card-description"
|
|
164
|
+
class="text-muted-foreground text-sm leading-normal"
|
|
165
|
+
>
|
|
166
|
+
{description()}
|
|
167
|
+
</span>
|
|
168
|
+
)}
|
|
169
|
+
</Show>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
</RadioGroupItem>
|
|
173
|
+
<Show when={kids.toArray().length > 0}>
|
|
174
|
+
<div data-slot="option-card-drawer" class={OPTION_CARD_DRAWER}>
|
|
175
|
+
<div class="min-h-0 overflow-hidden">
|
|
176
|
+
{/* biome-ignore lint/a11y/useAriaPropsSupportedByRole: the role is always radiogroup or group, both take aria-label */}
|
|
177
|
+
<div
|
|
178
|
+
role={choices().length > 0 ? "radiogroup" : "group"}
|
|
179
|
+
aria-label={`${props.title} options`}
|
|
180
|
+
class={OPTION_CARD_DRAWER_CONTENT}
|
|
181
|
+
classList={{ [STAGGER]: checked() }}
|
|
182
|
+
>
|
|
183
|
+
{kids()}
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</Show>
|
|
188
|
+
</div>
|
|
189
|
+
);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
function OptionIconWell(props: { icon?: string; image?: string }) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
193
|
+
return (
|
|
194
|
+
<Show when={props.icon || props.image}>
|
|
195
|
+
<span
|
|
196
|
+
data-slot="option-card-icon"
|
|
197
|
+
aria-hidden="true"
|
|
198
|
+
class="grid size-10 shrink-0 place-items-center rounded-[14px] bg-[color-mix(in_oklab,var(--surface-tone)_80%,black)] [color:oklch(from_var(--surface-tone)_calc((0.75_-_l)*100)_0_0)]"
|
|
199
|
+
>
|
|
200
|
+
<Show
|
|
201
|
+
when={props.image}
|
|
202
|
+
fallback={
|
|
203
|
+
<Show when={props.icon}>{(icon) => <Icon icon={icon()} width={20} height={20} />}</Show>
|
|
204
|
+
}
|
|
205
|
+
>
|
|
206
|
+
{(src) => <img src={src()} alt="" class="size-5 object-contain" />}
|
|
207
|
+
</Show>
|
|
208
|
+
</span>
|
|
209
|
+
</Show>
|
|
210
|
+
);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
/**
|
package/src/solid/ornament.tsx
CHANGED
|
@@ -7,47 +7,47 @@ import { ALERT_ICON_BG_CLASS, alertIconBgStyle, iconBgMaskStyle } from "../lib/a
|
|
|
7
7
|
* well, fading in while an ancestor carries data-checked. Absolutely positioned, a sibling of the
|
|
8
8
|
* card's row, so it never competes for row gap. */
|
|
9
9
|
export function Ornament(props: { kind: "arrow" | "check" | "none" }) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
10
|
+
return (
|
|
11
|
+
<Switch>
|
|
12
|
+
<Match when={props.kind === "arrow"}>
|
|
13
|
+
<span
|
|
14
|
+
data-slot="ornament-arrow"
|
|
15
|
+
class={`${ALERT_ICON_BG_CLASS} transition-transform duration-(--duration-state) group-hover:translate-x-1`}
|
|
16
|
+
style={alertIconBgStyle("var(--surface-tone)")}
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
>
|
|
19
|
+
<svg
|
|
20
|
+
aria-hidden="true"
|
|
21
|
+
viewBox="0 0 24 24"
|
|
22
|
+
fill="none"
|
|
23
|
+
stroke="currentColor"
|
|
24
|
+
stroke-linecap="round"
|
|
25
|
+
stroke-linejoin="round"
|
|
26
|
+
>
|
|
27
|
+
<path d="M5 12h14" />
|
|
28
|
+
<path d="m12 5 7 7-7 7" />
|
|
29
|
+
</svg>
|
|
30
|
+
</span>
|
|
31
|
+
</Match>
|
|
32
|
+
<Match when={props.kind === "check"}>
|
|
33
|
+
<span
|
|
34
|
+
data-slot="ornament-check"
|
|
35
|
+
class={`${ALERT_ICON_BG_CLASS} opacity-0 transition-opacity duration-(--duration-state) [[data-checked]_&]:opacity-[0.32]`}
|
|
36
|
+
style={iconBgMaskStyle("var(--surface-tone)")}
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
>
|
|
39
|
+
<svg
|
|
40
|
+
aria-hidden="true"
|
|
41
|
+
viewBox="0 0 24 24"
|
|
42
|
+
fill="none"
|
|
43
|
+
stroke="currentColor"
|
|
44
|
+
stroke-linecap="round"
|
|
45
|
+
stroke-linejoin="round"
|
|
46
|
+
>
|
|
47
|
+
<path d="M20 6 9 17l-5-5" />
|
|
48
|
+
</svg>
|
|
49
|
+
</span>
|
|
50
|
+
</Match>
|
|
51
|
+
</Switch>
|
|
52
|
+
);
|
|
53
53
|
}
|
package/src/solid/overlay.tsx
CHANGED
|
@@ -7,10 +7,10 @@ import { cn } from "../lib/utils.js";
|
|
|
7
7
|
* a Popover/Menu primitive. Radius and motion come from FLOATING_PANEL/
|
|
8
8
|
* OVERLAY_MOTION; caller owns padding and positioning. */
|
|
9
9
|
const Overlay: Component<ComponentProps<"div">> = (props) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const [local, others] = splitProps(props, ["class"]);
|
|
11
|
+
return (
|
|
12
|
+
<div data-slot="overlay" class={cn(FLOATING_PANEL, OVERLAY_MOTION, local.class)} {...others} />
|
|
13
|
+
);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export { Overlay };
|
|
@@ -16,80 +16,80 @@ import { type GlassSurface, NOOP_GLASS, SectionIcon } from "./section-card.js";
|
|
|
16
16
|
* watermark (the package ships no asset).
|
|
17
17
|
*/
|
|
18
18
|
export function PageHeader(props: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
/** Iconify icon name for the banner glyph. */
|
|
20
|
+
icon?: string;
|
|
21
|
+
/** Custom glyph, overrides `icon`. */
|
|
22
|
+
iconNode?: JSX.Element;
|
|
23
|
+
title: JSX.Element;
|
|
24
|
+
subtitle?: JSX.Element;
|
|
25
|
+
/** Small count pill next to the title. Rendered only when not null/undefined. */
|
|
26
|
+
count?: number | string;
|
|
27
|
+
/** Right-side actions. */
|
|
28
|
+
actions?: JSX.Element;
|
|
29
|
+
/** Watermark image src (e.g. the app logo). Omit for no watermark. */
|
|
30
|
+
logo?: string;
|
|
31
|
+
/** Performant-blur injection (dash). Omit for a normal frosted banner. */
|
|
32
|
+
glass?: GlassSurface;
|
|
33
33
|
}) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
34
|
+
const glass = () => props.glass ?? NOOP_GLASS;
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
data-slot="page-header"
|
|
38
|
+
ref={glass().ref}
|
|
39
|
+
class={cn(CARD_SURFACE_BASE, SECTION_OUTER_RADIUS, "relative overflow-hidden")}
|
|
40
|
+
classList={{ [CARD_BLUR]: !(glass().active?.() ?? false) }}
|
|
41
|
+
style={glass().style?.() ?? {}}
|
|
42
|
+
>
|
|
43
|
+
<Show when={props.logo}>
|
|
44
|
+
{(logo) => (
|
|
45
|
+
<img
|
|
46
|
+
data-slot="page-header-watermark"
|
|
47
|
+
src={logo()}
|
|
48
|
+
alt=""
|
|
49
|
+
class="pointer-events-none absolute -top-4 -right-8 size-48 rotate-[14deg] [mask-image:radial-gradient(circle_at_70%_30%,black,transparent_80%)] opacity-[0.13]"
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
</Show>
|
|
53
|
+
<div data-slot="page-header-row" class="relative flex items-center gap-3 p-4 sm:gap-5 sm:p-6">
|
|
54
|
+
<Show
|
|
55
|
+
when={props.iconNode}
|
|
56
|
+
fallback={
|
|
57
|
+
<Show when={props.icon}>
|
|
58
|
+
{(icon) => (
|
|
59
|
+
<SectionIcon icon={icon()} size="lg" tone="var(--primary)" class="shrink-0" />
|
|
60
|
+
)}
|
|
61
|
+
</Show>
|
|
62
|
+
}
|
|
63
|
+
>
|
|
64
|
+
{props.iconNode}
|
|
65
|
+
</Show>
|
|
66
|
+
<div data-slot="page-header-headings" class="flex min-w-0 flex-1 flex-col gap-1.5 sm:gap-2">
|
|
67
|
+
<div data-slot="page-header-headline" class="flex min-w-0 items-center gap-2 sm:gap-3">
|
|
68
|
+
<h1
|
|
69
|
+
data-slot="page-header-title"
|
|
70
|
+
class="text-foreground min-w-0 truncate pb-0.5 text-[1.75rem] leading-none font-bold tracking-[-0.035em] sm:text-[2.5rem]"
|
|
71
|
+
>
|
|
72
|
+
{props.title}
|
|
73
|
+
</h1>
|
|
74
|
+
<Show when={props.count != null}>
|
|
75
|
+
<CountPill>{props.count}</CountPill>
|
|
76
|
+
</Show>
|
|
77
|
+
</div>
|
|
78
|
+
<Show when={props.subtitle}>
|
|
79
|
+
<div
|
|
80
|
+
data-slot="page-header-subtitle"
|
|
81
|
+
class="text-muted-foreground flex items-center gap-2 text-sm"
|
|
82
|
+
>
|
|
83
|
+
{props.subtitle}
|
|
84
|
+
</div>
|
|
85
|
+
</Show>
|
|
86
|
+
</div>
|
|
87
|
+
<Show when={props.actions}>
|
|
88
|
+
<div data-slot="page-header-actions" class="flex shrink-0 items-center gap-2">
|
|
89
|
+
{props.actions}
|
|
90
|
+
</div>
|
|
91
|
+
</Show>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
95
|
}
|