@glasshome/ui 1.34.2 → 1.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/solid/index.js +4029 -3949
- package/dist/solid/radio-group.d.ts +2 -1
- package/dist/solid/section-card.d.ts +2 -0
- package/dist/solid/settings-row.d.ts +4 -0
- package/dist/testing/happy-dom-fidelity.d.ts +2 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +64 -1
- package/dist/{utils-GYi7-pG_.js → utils-BhU5YZKh.js} +1 -0
- package/package.json +4 -3
- package/src/lib/clipboard.ts +2 -0
- package/src/solid/alert.tsx +36 -18
- package/src/solid/area-picker.tsx +9 -1
- package/src/solid/bottom-sheet/scroll-lock.ts +2 -0
- package/src/solid/checkbox.tsx +22 -7
- package/src/solid/data-table.tsx +16 -10
- package/src/solid/dialog-parts.tsx +7 -4
- package/src/solid/field.tsx +9 -5
- package/src/solid/icon.tsx +4 -1
- package/src/solid/image-picker.tsx +8 -1
- package/src/solid/option-card.tsx +4 -2
- package/src/solid/page-header.tsx +10 -7
- package/src/solid/password-input.tsx +5 -3
- package/src/solid/picker-row.tsx +14 -5
- package/src/solid/picker-search.tsx +9 -2
- package/src/solid/preview-tile.tsx +4 -2
- package/src/solid/radio-group.tsx +27 -7
- package/src/solid/schema-form.tsx +16 -3
- package/src/solid/section-card.tsx +42 -23
- package/src/solid/settings-row.tsx +20 -6
- package/src/solid/sheet.tsx +11 -7
- package/src/solid/sonner.tsx +17 -7
- package/src/solid/widget-card.tsx +5 -4
- package/src/styles/globals.css +32 -0
- package/src/styles/theme.css +1 -1
- package/src/testing/happy-dom-fidelity.ts +105 -0
- package/src/testing/index.ts +1 -0
package/src/solid/picker-row.tsx
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
children,
|
|
3
|
+
type ComponentProps,
|
|
4
|
+
type JSX,
|
|
5
|
+
Show,
|
|
6
|
+
splitProps,
|
|
7
|
+
type ValidComponent,
|
|
8
|
+
} from "solid-js";
|
|
2
9
|
import { Dynamic } from "solid-js/web";
|
|
3
10
|
import { MENU_ITEM } from "../lib/menu-classes.js";
|
|
4
11
|
import { ICON_PILL, ICON_PILL_TINT } from "../lib/pill-classes.js";
|
|
@@ -36,6 +43,8 @@ export function PickerRow(props: PickerRowProps) {
|
|
|
36
43
|
"dimmed",
|
|
37
44
|
"class",
|
|
38
45
|
]);
|
|
46
|
+
const subtitle = children(() => local.subtitle);
|
|
47
|
+
const meta = children(() => local.meta);
|
|
39
48
|
return (
|
|
40
49
|
<Dynamic
|
|
41
50
|
component={local.as ?? "div"}
|
|
@@ -66,18 +75,18 @@ export function PickerRow(props: PickerRowProps) {
|
|
|
66
75
|
</Show>
|
|
67
76
|
<div class={cn("min-w-0 flex-1", local.dimmed && "opacity-60")}>
|
|
68
77
|
<div class="truncate font-medium">{local.title}</div>
|
|
69
|
-
<Show when={
|
|
70
|
-
<div class="text-muted-foreground truncate text-xs">{
|
|
78
|
+
<Show when={subtitle()}>
|
|
79
|
+
<div class="text-muted-foreground truncate text-xs">{subtitle()}</div>
|
|
71
80
|
</Show>
|
|
72
81
|
</div>
|
|
73
|
-
<Show when={
|
|
82
|
+
<Show when={meta()}>
|
|
74
83
|
<span
|
|
75
84
|
class={cn(
|
|
76
85
|
"text-muted-foreground max-w-24 shrink-0 truncate text-xs",
|
|
77
86
|
local.dimmed && "italic",
|
|
78
87
|
)}
|
|
79
88
|
>
|
|
80
|
-
{
|
|
89
|
+
{meta()}
|
|
81
90
|
</span>
|
|
82
91
|
</Show>
|
|
83
92
|
<Show
|
|
@@ -36,6 +36,7 @@ export function PickerSearch(props: PickerSearchProps) {
|
|
|
36
36
|
"inputRef",
|
|
37
37
|
"size",
|
|
38
38
|
]);
|
|
39
|
+
let input: HTMLInputElement | undefined;
|
|
39
40
|
return (
|
|
40
41
|
<div
|
|
41
42
|
data-slot="picker-search"
|
|
@@ -53,7 +54,10 @@ export function PickerSearch(props: PickerSearchProps) {
|
|
|
53
54
|
aria-hidden="true"
|
|
54
55
|
/>
|
|
55
56
|
<input
|
|
56
|
-
ref={
|
|
57
|
+
ref={(el) => {
|
|
58
|
+
input = el;
|
|
59
|
+
local.inputRef?.(el);
|
|
60
|
+
}}
|
|
57
61
|
data-slot="picker-search-input"
|
|
58
62
|
type="text"
|
|
59
63
|
value={local.value ?? ""}
|
|
@@ -70,7 +74,10 @@ export function PickerSearch(props: PickerSearchProps) {
|
|
|
70
74
|
data-slot="picker-search-clear"
|
|
71
75
|
aria-label={local.clearLabel}
|
|
72
76
|
class="text-muted-foreground hover:text-foreground shrink-0 rounded-sm p-1 transition-colors"
|
|
73
|
-
onClick={() =>
|
|
77
|
+
onClick={() => {
|
|
78
|
+
local.onValueChange?.("");
|
|
79
|
+
input?.focus();
|
|
80
|
+
}}
|
|
74
81
|
>
|
|
75
82
|
<Icon icon="mdi:close-circle" width={16} height={16} />
|
|
76
83
|
</button>
|
|
@@ -2,7 +2,7 @@ import type { JSX } from "solid-js";
|
|
|
2
2
|
import { Show } from "solid-js";
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
4
|
import { Icon } from "./icon.js";
|
|
5
|
-
import { RadioGroup, RadioGroupItem } from "./radio-group.js";
|
|
5
|
+
import { isItemActivation, RadioGroup, RadioGroupItem } from "./radio-group.js";
|
|
6
6
|
|
|
7
7
|
const COLUMNS = { 2: "grid-cols-2", 3: "grid-cols-3", 4: "grid-cols-4" } as const;
|
|
8
8
|
|
|
@@ -59,7 +59,9 @@ export function PreviewTile(props: {
|
|
|
59
59
|
value={props.value}
|
|
60
60
|
disabled={props.disabled}
|
|
61
61
|
showControl={false}
|
|
62
|
-
onClick={() =>
|
|
62
|
+
onClick={(event: MouseEvent) =>
|
|
63
|
+
!props.disabled && isItemActivation(event) && props.onPick?.()
|
|
64
|
+
}
|
|
63
65
|
class={cn(
|
|
64
66
|
"group/preview-tile min-w-0 [&_[data-slot=radio-group-item-content]]:flex [&_[data-slot=radio-group-item-content]]:flex-col [&_[data-slot=radio-group-item-content]]:gap-1.5 [&_[data-slot=radio-group-item-label]]:min-w-0",
|
|
65
67
|
props.class,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { RadioGroup as RadioGroupPrimitive } from "@kobalte/core/radio-group";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
children,
|
|
4
|
+
type Component,
|
|
5
|
+
type ComponentProps,
|
|
6
|
+
type ParentComponent,
|
|
7
|
+
Show,
|
|
8
|
+
splitProps,
|
|
9
|
+
} from "solid-js";
|
|
3
10
|
import { FIELD_CHROME } from "../lib/input-classes.js";
|
|
4
11
|
import { cn } from "../lib/utils.js";
|
|
5
12
|
|
|
@@ -14,6 +21,18 @@ const RadioGroup: Component<ComponentProps<typeof RadioGroupPrimitive>> = (props
|
|
|
14
21
|
);
|
|
15
22
|
};
|
|
16
23
|
|
|
24
|
+
// Its own component so the children resolve once, under the item's Kobalte context.
|
|
25
|
+
const RadioGroupItemContent: ParentComponent = (props) => {
|
|
26
|
+
const content = children(() => props.children);
|
|
27
|
+
return (
|
|
28
|
+
<Show when={content()}>
|
|
29
|
+
<div data-slot="radio-group-item-content" class="min-w-0 flex-1 text-sm">
|
|
30
|
+
{content()}
|
|
31
|
+
</div>
|
|
32
|
+
</Show>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
17
36
|
const RadioGroupItem: Component<
|
|
18
37
|
ComponentProps<typeof RadioGroupPrimitive.Item> & { showControl?: boolean }
|
|
19
38
|
> = (props) => {
|
|
@@ -52,14 +71,15 @@ const RadioGroupItem: Component<
|
|
|
52
71
|
</RadioGroupPrimitive.ItemIndicator>
|
|
53
72
|
</RadioGroupPrimitive.ItemControl>
|
|
54
73
|
</Show>
|
|
55
|
-
{local.children
|
|
56
|
-
<div data-slot="radio-group-item-content" class="min-w-0 flex-1 text-sm">
|
|
57
|
-
{local.children}
|
|
58
|
-
</div>
|
|
59
|
-
)}
|
|
74
|
+
<RadioGroupItemContent>{local.children}</RadioGroupItemContent>
|
|
60
75
|
</RadioGroupPrimitive.ItemLabel>
|
|
61
76
|
</RadioGroupPrimitive.Item>
|
|
62
77
|
);
|
|
63
78
|
};
|
|
64
79
|
|
|
65
|
-
|
|
80
|
+
// A press on the label reaches the item twice: once itself, once as the input click it forwards.
|
|
81
|
+
function isItemActivation(event: MouseEvent): boolean {
|
|
82
|
+
return event.target instanceof HTMLInputElement;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { isItemActivation, RadioGroup, RadioGroupItem };
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { JSONSchema7 } from "json-schema";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createMemo,
|
|
4
|
+
createSignal,
|
|
5
|
+
createUniqueId,
|
|
6
|
+
For,
|
|
7
|
+
Index,
|
|
8
|
+
Match,
|
|
9
|
+
Show,
|
|
10
|
+
Switch as SwitchFlow,
|
|
11
|
+
} from "solid-js";
|
|
3
12
|
import { FIELD_CHROME } from "../lib/input-classes.js";
|
|
4
13
|
import { SETTLE_MOTION } from "../lib/motion-classes.js";
|
|
5
14
|
import { cn } from "../lib/utils.js";
|
|
@@ -205,13 +214,14 @@ export function SchemaForm(props: SchemaFormProps) {
|
|
|
205
214
|
const updateField = (key: string, value: unknown) => {
|
|
206
215
|
props.onChange({ ...props.data, [key]: value });
|
|
207
216
|
};
|
|
217
|
+
const formId = createUniqueId();
|
|
208
218
|
|
|
209
219
|
return (
|
|
210
220
|
<div class={cn("flex w-full min-w-0 flex-col gap-6", props.class)} data-slot="schema-form">
|
|
211
221
|
<For each={properties()}>
|
|
212
222
|
{([key, prop]) => (
|
|
213
223
|
<LabeledField
|
|
214
|
-
id={key}
|
|
224
|
+
id={`${formId}-${key}`}
|
|
215
225
|
name={key}
|
|
216
226
|
prop={prop}
|
|
217
227
|
value={props.data[key]}
|
|
@@ -671,7 +681,10 @@ function ListControl(props: FieldProps) {
|
|
|
671
681
|
alt=""
|
|
672
682
|
decoding="async"
|
|
673
683
|
class="absolute inset-0 h-full w-full object-cover"
|
|
674
|
-
onError={() =>
|
|
684
|
+
onError={(event) => {
|
|
685
|
+
const failed = event.currentTarget.getAttribute("src");
|
|
686
|
+
if (failed) setBrokenThumbs((broken) => new Set(broken).add(failed));
|
|
687
|
+
}}
|
|
675
688
|
/>
|
|
676
689
|
)}
|
|
677
690
|
</Show>
|
|
@@ -47,10 +47,13 @@ type SectionCardProps = {
|
|
|
47
47
|
export function SectionCard(props: SectionCardProps) {
|
|
48
48
|
const glass = () => props.glass ?? NOOP_GLASS;
|
|
49
49
|
const active = () => glass().active?.() ?? false;
|
|
50
|
+
const title = children(() => props.title);
|
|
51
|
+
const subtitle = children(() => props.subtitle);
|
|
52
|
+
const action = children(() => props.action);
|
|
53
|
+
const toolbar = children(() => props.toolbar);
|
|
50
54
|
const hasHeader = () =>
|
|
51
|
-
props.icon != null ||
|
|
52
|
-
//
|
|
53
|
-
// empty body slot, and reading props.children twice would build it twice.
|
|
55
|
+
props.icon != null || title() != null || action() != null || props.count != null;
|
|
56
|
+
// A header-only card must not pay the section gap for an empty body slot.
|
|
54
57
|
const body = children(() => props.children);
|
|
55
58
|
const hasBody = () => body.toArray().some((child) => child != null && child !== false);
|
|
56
59
|
|
|
@@ -78,30 +81,30 @@ export function SectionCard(props: SectionCardProps) {
|
|
|
78
81
|
</Show>
|
|
79
82
|
<div data-slot="section-card-headings" class="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
80
83
|
<div data-slot="section-card-headline" class="flex min-w-0 items-center gap-2 sm:gap-3">
|
|
81
|
-
<Show when={
|
|
82
|
-
<SectionTitle>{
|
|
84
|
+
<Show when={title()}>
|
|
85
|
+
<SectionTitle>{title()}</SectionTitle>
|
|
83
86
|
</Show>
|
|
84
87
|
<Show when={props.count != null}>
|
|
85
88
|
<CountPill>{props.count}</CountPill>
|
|
86
89
|
</Show>
|
|
87
90
|
</div>
|
|
88
|
-
<Show when={
|
|
89
|
-
<SectionMeta class={props.subtitleClass}>{
|
|
91
|
+
<Show when={subtitle()}>
|
|
92
|
+
<SectionMeta class={props.subtitleClass}>{subtitle()}</SectionMeta>
|
|
90
93
|
</Show>
|
|
91
94
|
</div>
|
|
92
|
-
<Show when={
|
|
95
|
+
<Show when={action()}>
|
|
93
96
|
<div data-slot="section-card-actions" class="flex shrink-0 items-center gap-2">
|
|
94
|
-
{
|
|
97
|
+
{action()}
|
|
95
98
|
</div>
|
|
96
99
|
</Show>
|
|
97
100
|
</header>
|
|
98
101
|
</Show>
|
|
99
|
-
<Show when={
|
|
102
|
+
<Show when={toolbar()}>
|
|
100
103
|
<div
|
|
101
104
|
data-slot="section-card-toolbar"
|
|
102
105
|
class={cn(hasHeader() && "border-border/50 border-t pt-3")}
|
|
103
106
|
>
|
|
104
|
-
{
|
|
107
|
+
{toolbar()}
|
|
105
108
|
</div>
|
|
106
109
|
</Show>
|
|
107
110
|
<Show when={hasBody()}>
|
|
@@ -145,6 +148,8 @@ type ListRowProps = {
|
|
|
145
148
|
href?: string;
|
|
146
149
|
/** Accessible name for the whole-row activation; required with href or onOpen. */
|
|
147
150
|
openLabel?: string;
|
|
151
|
+
/** Title and subtitle wrap to show a whole sentence instead of truncating. */
|
|
152
|
+
wrap?: boolean;
|
|
148
153
|
class?: string;
|
|
149
154
|
};
|
|
150
155
|
|
|
@@ -171,6 +176,10 @@ export function FactRow(props: { label: JSX.Element; children: JSX.Element; clas
|
|
|
171
176
|
*/
|
|
172
177
|
export function ListRow(props: ListRowProps) {
|
|
173
178
|
const opens = () => props.onOpen !== undefined || props.href !== undefined;
|
|
179
|
+
const leading = children(() => props.leading);
|
|
180
|
+
const subtitle = children(() => props.subtitle);
|
|
181
|
+
const meta = children(() => props.meta);
|
|
182
|
+
const actions = children(() => props.actions);
|
|
174
183
|
return (
|
|
175
184
|
<SectionRow
|
|
176
185
|
interactive={opens()}
|
|
@@ -191,8 +200,8 @@ export function ListRow(props: ListRowProps) {
|
|
|
191
200
|
onClick={() => props.onOpen?.()}
|
|
192
201
|
/>
|
|
193
202
|
</Show>
|
|
194
|
-
<Show when={
|
|
195
|
-
<span class="flex shrink-0 items-center gap-2">{
|
|
203
|
+
<Show when={leading()}>
|
|
204
|
+
<span class="flex shrink-0 items-center gap-2">{leading()}</span>
|
|
196
205
|
</Show>
|
|
197
206
|
{/* Identity column. The floor is what gives the name priority: without
|
|
198
207
|
it this is the only shrinkable child, so flex crushes it to an
|
|
@@ -200,24 +209,33 @@ export function ListRow(props: ListRowProps) {
|
|
|
200
209
|
plus its badge. */}
|
|
201
210
|
<div class="min-w-[9rem] flex-1">
|
|
202
211
|
<div class="flex min-w-0 items-center gap-2">
|
|
203
|
-
<p
|
|
212
|
+
<p
|
|
213
|
+
class={cn(
|
|
214
|
+
"text-sm font-semibold",
|
|
215
|
+
props.wrap ? "leading-snug text-pretty" : "truncate leading-tight",
|
|
216
|
+
)}
|
|
217
|
+
>
|
|
218
|
+
{props.title}
|
|
219
|
+
</p>
|
|
204
220
|
{props.badges}
|
|
205
221
|
</div>
|
|
206
|
-
<Show when={
|
|
207
|
-
<p class="text-muted-foreground mt-1
|
|
222
|
+
<Show when={subtitle()}>
|
|
223
|
+
<p class={cn("text-muted-foreground mt-1 text-xs", !props.wrap && "truncate")}>
|
|
224
|
+
{subtitle()}
|
|
225
|
+
</p>
|
|
208
226
|
</Show>
|
|
209
227
|
</div>
|
|
210
228
|
{/* Trailing meta, centred across both identity lines. shrink-0, because
|
|
211
229
|
a squeeze-driven wrap fires off whichever meta happens to be widest
|
|
212
230
|
while the flex-1 identity column still holds unused slack. Meta that
|
|
213
231
|
wants to reflow reads @container/list-row and says so itself. */}
|
|
214
|
-
<Show when={
|
|
215
|
-
<div class="text-muted-foreground shrink-0 text-xs">{
|
|
232
|
+
<Show when={meta()}>
|
|
233
|
+
<div class="text-muted-foreground shrink-0 text-xs">{meta()}</div>
|
|
216
234
|
</Show>
|
|
217
|
-
<Show when={
|
|
218
|
-
<div class="relative flex shrink-0 items-center gap-1">{
|
|
235
|
+
<Show when={actions()}>
|
|
236
|
+
<div class="relative flex shrink-0 items-center gap-1">{actions()}</div>
|
|
219
237
|
</Show>
|
|
220
|
-
<Show when={opens() &&
|
|
238
|
+
<Show when={opens() && actions() === undefined}>
|
|
221
239
|
<Icon
|
|
222
240
|
icon="lucide:chevron-right"
|
|
223
241
|
width={16}
|
|
@@ -257,6 +275,7 @@ export function SectionIcon(props: {
|
|
|
257
275
|
if (t == null) return undefined;
|
|
258
276
|
return t in LEGACY_TONES ? LEGACY_TONES[t] : t;
|
|
259
277
|
};
|
|
278
|
+
const glyph = children(() => props.children);
|
|
260
279
|
return (
|
|
261
280
|
<span
|
|
262
281
|
data-slot="section-icon"
|
|
@@ -268,8 +287,8 @@ export function SectionIcon(props: {
|
|
|
268
287
|
)}
|
|
269
288
|
style={tone() ? { "--glass-tone": tone() } : undefined}
|
|
270
289
|
>
|
|
271
|
-
<Show when={
|
|
272
|
-
{
|
|
290
|
+
<Show when={glyph()} fallback={props.icon ? <Icon icon={props.icon} /> : null}>
|
|
291
|
+
{glyph()}
|
|
273
292
|
</Show>
|
|
274
293
|
</span>
|
|
275
294
|
);
|
|
@@ -34,10 +34,19 @@ export function RowActions(props: {
|
|
|
34
34
|
deleteDisabled?: boolean;
|
|
35
35
|
deleteTitle?: string;
|
|
36
36
|
showDelete?: boolean;
|
|
37
|
+
/** What the row is, so each button is named for it: "Edit Kitchen", "Delete Kitchen". */
|
|
38
|
+
name?: string;
|
|
37
39
|
}) {
|
|
40
|
+
const named = (verb: string) => (props.name ? `${verb} ${props.name}` : verb);
|
|
38
41
|
return (
|
|
39
42
|
<div data-slot="row-actions" class="flex items-center gap-1">
|
|
40
|
-
<Button
|
|
43
|
+
<Button
|
|
44
|
+
variant="ghost"
|
|
45
|
+
size="icon"
|
|
46
|
+
class="size-8"
|
|
47
|
+
onClick={props.onEdit}
|
|
48
|
+
aria-label={named("Edit")}
|
|
49
|
+
>
|
|
41
50
|
<Icon icon="lucide:pencil" width={14} height={14} />
|
|
42
51
|
</Button>
|
|
43
52
|
<Show when={props.showDelete ?? true}>
|
|
@@ -48,6 +57,7 @@ export function RowActions(props: {
|
|
|
48
57
|
onClick={props.onDelete}
|
|
49
58
|
disabled={props.deleteDisabled}
|
|
50
59
|
title={props.deleteTitle}
|
|
60
|
+
aria-label={named("Delete")}
|
|
51
61
|
>
|
|
52
62
|
<Icon icon="lucide:trash-2" width={14} height={14} />
|
|
53
63
|
</Button>
|
|
@@ -56,12 +66,14 @@ export function RowActions(props: {
|
|
|
56
66
|
);
|
|
57
67
|
}
|
|
58
68
|
|
|
59
|
-
|
|
69
|
+
/** `for` names one control by the label; without it the label names the group of controls. */
|
|
70
|
+
export function LabeledField(props: { label: string; for?: string; children: JSX.Element }) {
|
|
71
|
+
const id = createUniqueId();
|
|
60
72
|
return (
|
|
61
|
-
<div data-slot="labeled-field" class="flex flex-col gap-1">
|
|
62
|
-
<
|
|
73
|
+
<div data-slot="labeled-field" role="group" aria-labelledby={id} class="flex flex-col gap-1">
|
|
74
|
+
<label id={id} for={props.for} data-slot="labeled-field-label" class="text-sm font-medium">
|
|
63
75
|
{props.label}
|
|
64
|
-
</
|
|
76
|
+
</label>
|
|
65
77
|
{props.children}
|
|
66
78
|
</div>
|
|
67
79
|
);
|
|
@@ -93,9 +105,11 @@ export function LabeledInput(props: {
|
|
|
93
105
|
onInput: (value: string) => void;
|
|
94
106
|
placeholder?: string;
|
|
95
107
|
}) {
|
|
108
|
+
const id = createUniqueId();
|
|
96
109
|
return (
|
|
97
|
-
<LabeledField label={props.label}>
|
|
110
|
+
<LabeledField label={props.label} for={id}>
|
|
98
111
|
<Input
|
|
112
|
+
id={id}
|
|
99
113
|
value={props.value}
|
|
100
114
|
onInput={(e) => props.onInput(e.currentTarget.value)}
|
|
101
115
|
placeholder={props.placeholder}
|
package/src/solid/sheet.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { Dialog as DialogPrimitive, useDialogContext } from "@kobalte/core/dialo
|
|
|
2
2
|
import { usePortalMount } from "./portal-mount.js";
|
|
3
3
|
import type { VariantProps } from "cva";
|
|
4
4
|
import {
|
|
5
|
+
children,
|
|
5
6
|
type Component,
|
|
6
7
|
type ComponentProps,
|
|
7
8
|
type JSX,
|
|
@@ -97,13 +98,16 @@ type SheetContentProps = ComponentProps<typeof DialogPrimitive.Content> & {
|
|
|
97
98
|
ariaLabel?: string;
|
|
98
99
|
};
|
|
99
100
|
|
|
100
|
-
const SheetAbove: Component<{ above?: JSX.Element }> = (props) =>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
const SheetAbove: Component<{ above?: JSX.Element }> = (props) => {
|
|
102
|
+
const above = children(() => props.above);
|
|
103
|
+
return (
|
|
104
|
+
<Show when={above()}>
|
|
105
|
+
<div data-slot="sheet-content-above" class="flex w-full shrink-0 items-end justify-center">
|
|
106
|
+
{above()}
|
|
107
|
+
</div>
|
|
108
|
+
</Show>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
107
111
|
|
|
108
112
|
const SheetContent: ParentComponent<SheetContentProps> = (props) => {
|
|
109
113
|
const [local, rest] = splitProps(props, [
|
package/src/solid/sonner.tsx
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
children,
|
|
3
|
+
type Component,
|
|
4
|
+
type ComponentProps,
|
|
5
|
+
type JSX,
|
|
6
|
+
mergeProps,
|
|
7
|
+
Show,
|
|
8
|
+
} from "solid-js";
|
|
2
9
|
import { type ExternalToast, Toaster as SolidSonner, toast as sonnerToast } from "solid-sonner";
|
|
3
10
|
import {
|
|
4
11
|
ALERT_CLASS,
|
|
@@ -59,6 +66,9 @@ const GlassToast: Component<GlassToastProps> = (props) => {
|
|
|
59
66
|
const toneIcon = KIND_ICON[props.kind];
|
|
60
67
|
const watermarkGlyph: JSX.Element | null =
|
|
61
68
|
props.icon ?? (toneIcon ? <Icon icon={toneIcon} width={112} height={112} /> : null);
|
|
69
|
+
const title = children(() => props.title);
|
|
70
|
+
const description = children(() => props.description);
|
|
71
|
+
const action = children(() => props.action);
|
|
62
72
|
|
|
63
73
|
return (
|
|
64
74
|
<div
|
|
@@ -92,17 +102,17 @@ const GlassToast: Component<GlassToastProps> = (props) => {
|
|
|
92
102
|
</span>
|
|
93
103
|
</Show>
|
|
94
104
|
<div class={ALERT_CONTENT_CLASS}>
|
|
95
|
-
<Show when={
|
|
105
|
+
<Show when={title()}>
|
|
96
106
|
<p class={ALERT_TITLE_CLASS} style={tone ? { color: glassToneText(tone) } : undefined}>
|
|
97
|
-
{
|
|
107
|
+
{title()}
|
|
98
108
|
</p>
|
|
99
109
|
</Show>
|
|
100
|
-
<Show when={
|
|
101
|
-
<div class={ALERT_DESCRIPTION_CLASS}>{
|
|
110
|
+
<Show when={description()}>
|
|
111
|
+
<div class={ALERT_DESCRIPTION_CLASS}>{description()}</div>
|
|
102
112
|
</Show>
|
|
103
113
|
</div>
|
|
104
|
-
<Show when={
|
|
105
|
-
<div class="flex shrink-0 items-center">{
|
|
114
|
+
<Show when={action()}>
|
|
115
|
+
<div class="flex shrink-0 items-center">{action()}</div>
|
|
106
116
|
</Show>
|
|
107
117
|
</div>
|
|
108
118
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type JSX, mergeProps, Show } from "solid-js";
|
|
1
|
+
import { children, type JSX, mergeProps, Show } from "solid-js";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { Card } from "./card.js";
|
|
4
4
|
import { Icon } from "./icon.js";
|
|
@@ -52,7 +52,8 @@ type InternalProps = WidgetCardProps & { interactive: boolean };
|
|
|
52
52
|
function WidgetCardRow(props: InternalProps) {
|
|
53
53
|
const hasMeta = () =>
|
|
54
54
|
props.widget.downloadCount != null || (props.showVersions && props.widget.versionCount != null);
|
|
55
|
-
const
|
|
55
|
+
const trailing = children(() => props.trailing);
|
|
56
|
+
const showTrailing = () => trailing() !== undefined || props.interactive;
|
|
56
57
|
|
|
57
58
|
return (
|
|
58
59
|
<Card
|
|
@@ -74,7 +75,7 @@ function WidgetCardRow(props: InternalProps) {
|
|
|
74
75
|
</Show>
|
|
75
76
|
<Show when={showTrailing()} fallback={null}>
|
|
76
77
|
<Show
|
|
77
|
-
when={
|
|
78
|
+
when={trailing() !== undefined}
|
|
78
79
|
fallback={
|
|
79
80
|
<Icon
|
|
80
81
|
icon="lucide:chevron-right"
|
|
@@ -84,7 +85,7 @@ function WidgetCardRow(props: InternalProps) {
|
|
|
84
85
|
/>
|
|
85
86
|
}
|
|
86
87
|
>
|
|
87
|
-
{
|
|
88
|
+
{trailing()}
|
|
88
89
|
</Show>
|
|
89
90
|
</Show>
|
|
90
91
|
</Card>
|
package/src/styles/globals.css
CHANGED
|
@@ -9,6 +9,34 @@
|
|
|
9
9
|
|
|
10
10
|
@custom-variant dark (&:is(.dark *));
|
|
11
11
|
|
|
12
|
+
/* tw-animate's enter and exit, with the filter's open end written out: WebKit 26 on Linux kills a page animating a filter into an implicit none. */
|
|
13
|
+
@theme inline {
|
|
14
|
+
@keyframes enter {
|
|
15
|
+
from {
|
|
16
|
+
opacity: var(--tw-enter-opacity, 1);
|
|
17
|
+
transform: translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0)
|
|
18
|
+
scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1))
|
|
19
|
+
rotate(var(--tw-enter-rotate, 0));
|
|
20
|
+
filter: blur(var(--tw-enter-blur, 0));
|
|
21
|
+
}
|
|
22
|
+
to {
|
|
23
|
+
filter: blur(0);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
@keyframes exit {
|
|
27
|
+
from {
|
|
28
|
+
filter: blur(0);
|
|
29
|
+
}
|
|
30
|
+
to {
|
|
31
|
+
opacity: var(--tw-exit-opacity, 1);
|
|
32
|
+
transform: translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0)
|
|
33
|
+
scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1))
|
|
34
|
+
rotate(var(--tw-exit-rotate, 0));
|
|
35
|
+
filter: blur(var(--tw-exit-blur, 0));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
12
40
|
/* Typed + inherits:false: a knob never leaks into a nested glass element, each
|
|
13
41
|
* element's calc() resolves against its own value, and typed knobs animate. */
|
|
14
42
|
@property --glass-tone {
|
|
@@ -639,6 +667,10 @@
|
|
|
639
667
|
animation: none;
|
|
640
668
|
}
|
|
641
669
|
}
|
|
670
|
+
/* Ambient loops under a modal's blurred scrim would make the browser re-blur the whole page every frame. */
|
|
671
|
+
:root[data-page-covered] :is(:where(.glass-edge-orbit) > *, .animate-spin-slow, .animate-float) {
|
|
672
|
+
animation-play-state: paused;
|
|
673
|
+
}
|
|
642
674
|
|
|
643
675
|
/**
|
|
644
676
|
* Consistent, theme-aware overlay scrollbar across browsers. Firefox uses
|
package/src/styles/theme.css
CHANGED
|
@@ -596,8 +596,8 @@ html[data-motion="live"] {
|
|
|
596
596
|
.reduce-blur,
|
|
597
597
|
.reduce-blur * {
|
|
598
598
|
--tw-backdrop-blur: initial !important;
|
|
599
|
+
/* Unprefixed only: the minifier folds a pair into the -webkit- form alone, which Chromium ignores. */
|
|
599
600
|
backdrop-filter: none !important;
|
|
600
|
-
-webkit-backdrop-filter: none !important;
|
|
601
601
|
}
|
|
602
602
|
/* A control that cannot blur takes the opaque card fill, never bare see-through. */
|
|
603
603
|
.reduce-blur .glass-control {
|