@glasshome/ui 1.34.2 → 1.35.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.
@@ -39,6 +39,8 @@ type ListRowProps = {
39
39
  href?: string;
40
40
  /** Accessible name for the whole-row activation; required with href or onOpen. */
41
41
  openLabel?: string;
42
+ /** Title and subtitle wrap to show a whole sentence instead of truncating. */
43
+ wrap?: boolean;
42
44
  class?: string;
43
45
  };
44
46
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/ui",
3
- "version": "1.34.2",
3
+ "version": "1.35.0",
4
4
  "description": "SolidJS component library for GlassHome, built on Kobalte",
5
5
  "keywords": [
6
6
  "components",
@@ -1,4 +1,5 @@
1
1
  import {
2
+ children,
2
3
  type Component,
3
4
  type ComponentProps,
4
5
  createContext,
@@ -40,6 +41,32 @@ type AlertProps = ComponentProps<"div"> & {
40
41
  // parent had already resolved.
41
42
  const AlertToneContext = createContext<() => string>();
42
43
 
44
+ // Its own component so title and children resolve under AlertToneContext.
45
+ const AlertBody: Component<{ title?: JSX.Element; toneColor: string; children?: JSX.Element }> = (
46
+ props,
47
+ ) => {
48
+ const title = children(() => props.title);
49
+ const body = children(() => props.children);
50
+ return (
51
+ <>
52
+ <Show when={title()}>
53
+ <p
54
+ data-slot="alert-title"
55
+ class={ALERT_TITLE_CLASS}
56
+ style={{ color: glassToneText(props.toneColor) }}
57
+ >
58
+ {title()}
59
+ </p>
60
+ </Show>
61
+ <Show when={body()}>
62
+ <div data-slot="alert-description" class={ALERT_DESCRIPTION_CLASS}>
63
+ {body()}
64
+ </div>
65
+ </Show>
66
+ </>
67
+ );
68
+ };
69
+
43
70
  const Alert: Component<AlertProps> = (props) => {
44
71
  const [local, rest] = splitProps(props, [
45
72
  "class",
@@ -52,6 +79,8 @@ const Alert: Component<AlertProps> = (props) => {
52
79
  ]);
53
80
  const toneKey = () => local.tone ?? "info";
54
81
  const tone = () => ALERT_TONES[toneKey()];
82
+ const icon = children(() => local.icon);
83
+ const action = children(() => local.action);
55
84
  return (
56
85
  <div
57
86
  data-slot="alert"
@@ -68,7 +97,7 @@ const Alert: Component<AlertProps> = (props) => {
68
97
  >
69
98
  <span class={ALERT_ICON_BG_CLASS} style={alertIconBgStyle(tone().color)} aria-hidden="true">
70
99
  <Show
71
- when={local.icon}
100
+ when={icon()}
72
101
  fallback={
73
102
  <svg
74
103
  xmlns="http://www.w3.org/2000/svg"
@@ -82,31 +111,20 @@ const Alert: Component<AlertProps> = (props) => {
82
111
  />
83
112
  }
84
113
  >
85
- {local.icon}
114
+ {icon()}
86
115
  </Show>
87
116
  </span>
88
117
  <div class={ALERT_CONTENT_CLASS}>
89
118
  <AlertToneContext.Provider value={() => tone().color}>
90
- <Show when={local.title}>
91
- <p
92
- data-slot="alert-title"
93
- class={ALERT_TITLE_CLASS}
94
- style={{ color: glassToneText(tone().color) }}
95
- >
96
- {local.title}
97
- </p>
98
- </Show>
99
- <Show when={local.children}>
100
- <div data-slot="alert-description" class={ALERT_DESCRIPTION_CLASS}>
101
- {local.children}
102
- </div>
103
- </Show>
119
+ <AlertBody title={local.title} toneColor={tone().color}>
120
+ {local.children}
121
+ </AlertBody>
104
122
  </AlertToneContext.Provider>
105
123
  </div>
106
- <Show when={local.action}>
124
+ <Show when={action()}>
107
125
  {/* self-center: the row is items-start for the icon, which would strand
108
126
  the action at the top of a multi-line body. */}
109
- <div class="flex shrink-0 items-center self-center">{local.action}</div>
127
+ <div class="flex shrink-0 items-center self-center">{action()}</div>
110
128
  </Show>
111
129
  </div>
112
130
  );
@@ -1,5 +1,13 @@
1
1
  import { Checkbox as CheckboxPrimitive } from "@kobalte/core/checkbox";
2
- import { type Component, type ComponentProps, type JSX, splitProps } from "solid-js";
2
+ import {
3
+ children,
4
+ type Component,
5
+ type ComponentProps,
6
+ type JSX,
7
+ type ParentComponent,
8
+ Show,
9
+ splitProps,
10
+ } from "solid-js";
3
11
  import { FIELD_CHROME } from "../lib/input-classes.js";
4
12
  import { cn } from "../lib/utils.js";
5
13
  import { Icon } from "./icon.js";
@@ -13,11 +21,22 @@ const CHECKBOX_SIZE = {
13
21
 
14
22
  type CheckboxSize = keyof typeof CHECKBOX_SIZE;
15
23
 
24
+ // Its own component so the label resolves once, under the checkbox's Kobalte context.
25
+ const CheckboxText: ParentComponent = (props) => {
26
+ const label = children(() => props.children);
27
+ return (
28
+ <Show when={label()}>
29
+ <span data-slot="checkbox-text" class="text-sm leading-none">
30
+ {label()}
31
+ </span>
32
+ </Show>
33
+ );
34
+ };
35
+
16
36
  const Checkbox: Component<ComponentProps<typeof CheckboxPrimitive> & { size?: CheckboxSize }> = (
17
37
  props,
18
38
  ) => {
19
39
  const [local, others] = splitProps(props, ["class", "children", "size"]);
20
- const label = () => local.children as JSX.Element;
21
40
  const size = () => CHECKBOX_SIZE[local.size ?? "default"];
22
41
  return (
23
42
  <CheckboxPrimitive data-slot="checkbox" {...others}>
@@ -56,11 +75,7 @@ const Checkbox: Component<ComponentProps<typeof CheckboxPrimitive> & { size?: Ch
56
75
  )}
57
76
  />
58
77
  </span>
59
- {local.children && (
60
- <span data-slot="checkbox-text" class="text-sm leading-none">
61
- {label()}
62
- </span>
63
- )}
78
+ <CheckboxText>{local.children as JSX.Element}</CheckboxText>
64
79
  </CheckboxPrimitive.Label>
65
80
  )}
66
81
  </CheckboxPrimitive>
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  type Accessor,
3
+ children,
3
4
  createEffect,
4
5
  createMemo,
5
6
  createSignal,
@@ -151,6 +152,7 @@ export function DataTableRow(props: {
151
152
  class?: string;
152
153
  }) {
153
154
  const opens = () => props.onOpen !== undefined || props.href !== undefined;
155
+ const actions = children(() => props.actions);
154
156
  return (
155
157
  <div
156
158
  data-slot="data-table-row"
@@ -180,8 +182,8 @@ export function DataTableRow(props: {
180
182
  />
181
183
  </Show>
182
184
  {props.children}
183
- <Show when={props.actions}>
184
- <div class="relative flex shrink-0 items-center gap-1">{props.actions}</div>
185
+ <Show when={actions()}>
186
+ <div class="relative flex shrink-0 items-center gap-1">{actions()}</div>
185
187
  </Show>
186
188
  </div>
187
189
  );
@@ -250,22 +252,26 @@ export function TableEmpty(props: {
250
252
  message: JSX.Element;
251
253
  action?: JSX.Element;
252
254
  }) {
255
+ const icon = children(() => props.icon);
256
+ const iconName = () => {
257
+ const glyph = icon();
258
+ return typeof glyph === "string" ? glyph : undefined;
259
+ };
260
+ const action = children(() => props.action);
253
261
  return (
254
262
  <Empty class="gap-3 rounded-none py-12">
255
263
  <EmptyHeader>
256
- <Show when={props.icon}>
264
+ <Show when={icon()}>
257
265
  <EmptyMedia media="icon">
258
- {typeof props.icon === "string" ? (
259
- <Icon icon={props.icon} width={24} height={24} />
260
- ) : (
261
- props.icon
262
- )}
266
+ <Show when={iconName()} fallback={icon()}>
267
+ {(name) => <Icon icon={name()} width={24} height={24} />}
268
+ </Show>
263
269
  </EmptyMedia>
264
270
  </Show>
265
271
  <EmptyDescription>{props.message}</EmptyDescription>
266
272
  </EmptyHeader>
267
- <Show when={props.action}>
268
- <EmptyContent>{props.action}</EmptyContent>
273
+ <Show when={action()}>
274
+ <EmptyContent>{action()}</EmptyContent>
269
275
  </Show>
270
276
  </Empty>
271
277
  );
@@ -2,6 +2,7 @@ import { Button as KobalteButton } from "@kobalte/core/button";
2
2
  import { useDialogContext } from "@kobalte/core/dialog";
3
3
  import {
4
4
  type Accessor,
5
+ children,
5
6
  type Component,
6
7
  type ComponentProps,
7
8
  createContext,
@@ -116,23 +117,25 @@ export interface ModalParts {
116
117
  export function createModalParts(slot: string): ModalParts {
117
118
  const Header: Component<ModalHeaderProps> = (props) => {
118
119
  const [local, rest] = splitProps(props, ["class", "media", "action", "wrap", "children"]);
120
+ const media = children(() => local.media);
121
+ const action = children(() => local.action);
119
122
  return (
120
123
  <div
121
124
  data-slot={`${slot}-header`}
122
125
  class={cn(MODAL_HEADER, local.wrap && "flex-wrap", local.class)}
123
126
  {...rest}
124
127
  >
125
- <Show when={local.media}>
128
+ <Show when={media()}>
126
129
  <div data-slot={`${slot}-header-media`} class={MODAL_HEADER_MEDIA}>
127
- {local.media}
130
+ {media()}
128
131
  </div>
129
132
  </Show>
130
133
  <div data-slot={`${slot}-header-text`} class={MODAL_HEADER_TEXT}>
131
134
  {local.children}
132
135
  </div>
133
- <Show when={local.action}>
136
+ <Show when={action()}>
134
137
  <div data-slot={`${slot}-header-action`} class={MODAL_HEADER_ACTION}>
135
- {local.action}
138
+ {action()}
136
139
  </div>
137
140
  </Show>
138
141
  </div>
@@ -1,5 +1,6 @@
1
1
  import { cva, type VariantProps } from "cva";
2
2
  import {
3
+ children,
3
4
  type Component,
4
5
  type ComponentProps,
5
6
  createMemo,
@@ -171,20 +172,21 @@ const FieldSubGroup: Component<ComponentProps<"div">> = (props) => {
171
172
 
172
173
  const FieldSeparator: ParentComponent<ComponentProps<"div">> = (props) => {
173
174
  const [local, rest] = splitProps(props, ["children", "class"]);
175
+ const content = children(() => local.children);
174
176
  return (
175
177
  <div
176
178
  data-slot="field-separator"
177
- data-content={!!local.children}
179
+ data-content={!!content()}
178
180
  class={cn("relative h-5 text-sm", local.class)}
179
181
  {...rest}
180
182
  >
181
183
  <Separator class="absolute inset-0 top-1/2" />
182
- <Show when={local.children}>
184
+ <Show when={content()}>
183
185
  <span
184
186
  class="bg-card text-muted-foreground relative mx-auto block w-fit px-2"
185
187
  data-slot="field-separator-content"
186
188
  >
187
- {local.children}
189
+ {content()}
188
190
  </span>
189
191
  </Show>
190
192
  </div>
@@ -197,10 +199,12 @@ const FieldError: Component<
197
199
  }
198
200
  > = (props) => {
199
201
  const [local, rest] = splitProps(props, ["class", "children", "errors"] as const);
202
+ const body = children(() => local.children);
200
203
 
201
204
  const content = createMemo(() => {
202
- if (local.children) {
203
- return local.children;
205
+ const given = body();
206
+ if (given) {
207
+ return given;
204
208
  }
205
209
 
206
210
  if (!local.errors?.length) {
@@ -133,6 +133,9 @@ export function Icon(props: IconProps) {
133
133
  if (!data) return { ...EMPTY, attributes: { ...EMPTY.attributes, ...sizeOrDefault(size) } };
134
134
  return iconToSVG(data, size);
135
135
  });
136
+ const body = createMemo(() => built().body);
137
+ // A TrustedHTML is a fresh object per call, which the spread would write as a new innerHTML.
138
+ const html = createMemo(() => trusted(body()));
136
139
  return (
137
140
  <svg
138
141
  xmlns="http://www.w3.org/2000/svg"
@@ -144,7 +147,7 @@ export function Icon(props: IconProps) {
144
147
  viewBox={built().attributes.viewBox}
145
148
  width={built().attributes.width}
146
149
  height={built().attributes.height}
147
- innerHTML={trusted(built().body)}
150
+ innerHTML={html()}
148
151
  />
149
152
  );
150
153
  }
@@ -1,4 +1,4 @@
1
- import { type JSX, Show } from "solid-js";
1
+ import { children, type JSX, Show } from "solid-js";
2
2
  import { CARD_BLUR, CARD_SURFACE_BASE } from "../lib/card-classes.js";
3
3
  import { SECTION_OUTER_RADIUS } from "../lib/section-tokens.js";
4
4
  import { cn } from "../lib/utils.js";
@@ -32,6 +32,9 @@ export function PageHeader(props: {
32
32
  glass?: GlassSurface;
33
33
  }) {
34
34
  const glass = () => props.glass ?? NOOP_GLASS;
35
+ const iconNode = children(() => props.iconNode);
36
+ const subtitle = children(() => props.subtitle);
37
+ const actions = children(() => props.actions);
35
38
  return (
36
39
  <div
37
40
  data-slot="page-header"
@@ -52,7 +55,7 @@ export function PageHeader(props: {
52
55
  </Show>
53
56
  <div data-slot="page-header-row" class="relative flex items-center gap-3 p-4 sm:gap-5 sm:p-6">
54
57
  <Show
55
- when={props.iconNode}
58
+ when={iconNode()}
56
59
  fallback={
57
60
  <Show when={props.icon}>
58
61
  {(icon) => (
@@ -61,7 +64,7 @@ export function PageHeader(props: {
61
64
  </Show>
62
65
  }
63
66
  >
64
- {props.iconNode}
67
+ {iconNode()}
65
68
  </Show>
66
69
  <div data-slot="page-header-headings" class="flex min-w-0 flex-1 flex-col gap-1.5 sm:gap-2">
67
70
  <div data-slot="page-header-headline" class="flex min-w-0 items-center gap-2 sm:gap-3">
@@ -75,18 +78,18 @@ export function PageHeader(props: {
75
78
  <CountPill>{props.count}</CountPill>
76
79
  </Show>
77
80
  </div>
78
- <Show when={props.subtitle}>
81
+ <Show when={subtitle()}>
79
82
  <div
80
83
  data-slot="page-header-subtitle"
81
84
  class="text-muted-foreground flex items-center gap-2 text-sm"
82
85
  >
83
- {props.subtitle}
86
+ {subtitle()}
84
87
  </div>
85
88
  </Show>
86
89
  </div>
87
- <Show when={props.actions}>
90
+ <Show when={actions()}>
88
91
  <div data-slot="page-header-actions" class="flex shrink-0 items-center gap-2">
89
- {props.actions}
92
+ {actions()}
90
93
  </div>
91
94
  </Show>
92
95
  </div>
@@ -1,4 +1,5 @@
1
1
  import {
2
+ children,
2
3
  type Component,
3
4
  type ComponentProps,
4
5
  createSignal,
@@ -26,10 +27,11 @@ const PasswordInput: Component<
26
27
  > = (props) => {
27
28
  const [local, rest] = splitProps(props, ["class", "leading", "showLabel", "hideLabel"]);
28
29
  const [visible, setVisible] = createSignal(false);
30
+ const leading = children(() => local.leading);
29
31
 
30
32
  return (
31
33
  <div data-slot="password-input" class="relative">
32
- <Show when={local.leading}>
34
+ <Show when={leading()}>
33
35
  <span
34
36
  data-slot="password-input-leading"
35
37
  class={cn(
@@ -38,14 +40,14 @@ const PasswordInput: Component<
38
40
  )}
39
41
  aria-hidden="true"
40
42
  >
41
- {local.leading}
43
+ {leading()}
42
44
  </span>
43
45
  </Show>
44
46
  <Input
45
47
  type={visible() ? "text" : "password"}
46
48
  // Caller class first, affordance padding last: a caller-supplied px-*
47
49
  // must never win the merge and reclaim a button's space.
48
- class={cn(local.class, local.leading && LEADING_RESERVE, TOGGLE_RESERVE)}
50
+ class={cn(local.class, leading() && LEADING_RESERVE, TOGGLE_RESERVE)}
49
51
  {...rest}
50
52
  />
51
53
  <button
@@ -1,4 +1,11 @@
1
- import { type ComponentProps, type JSX, Show, splitProps, type ValidComponent } from "solid-js";
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={local.subtitle}>
70
- <div class="text-muted-foreground truncate text-xs">{local.subtitle}</div>
78
+ <Show when={subtitle()}>
79
+ <div class="text-muted-foreground truncate text-xs">{subtitle()}</div>
71
80
  </Show>
72
81
  </div>
73
- <Show when={local.meta}>
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
- {local.meta}
89
+ {meta()}
81
90
  </span>
82
91
  </Show>
83
92
  <Show
@@ -1,5 +1,12 @@
1
1
  import { RadioGroup as RadioGroupPrimitive } from "@kobalte/core/radio-group";
2
- import { type Component, type ComponentProps, Show, splitProps } from "solid-js";
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,11 +71,7 @@ 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
  );
@@ -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 || 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.
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={props.title}>
82
- <SectionTitle>{props.title}</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={props.subtitle}>
89
- <SectionMeta class={props.subtitleClass}>{props.subtitle}</SectionMeta>
91
+ <Show when={subtitle()}>
92
+ <SectionMeta class={props.subtitleClass}>{subtitle()}</SectionMeta>
90
93
  </Show>
91
94
  </div>
92
- <Show when={props.action}>
95
+ <Show when={action()}>
93
96
  <div data-slot="section-card-actions" class="flex shrink-0 items-center gap-2">
94
- {props.action}
97
+ {action()}
95
98
  </div>
96
99
  </Show>
97
100
  </header>
98
101
  </Show>
99
- <Show when={props.toolbar}>
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
- {props.toolbar}
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={props.leading}>
195
- <span class="flex shrink-0 items-center gap-2">{props.leading}</span>
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 class="truncate text-sm leading-tight font-semibold">{props.title}</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={props.subtitle}>
207
- <p class="text-muted-foreground mt-1 truncate text-xs">{props.subtitle}</p>
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={props.meta}>
215
- <div class="text-muted-foreground shrink-0 text-xs">{props.meta}</div>
232
+ <Show when={meta()}>
233
+ <div class="text-muted-foreground shrink-0 text-xs">{meta()}</div>
216
234
  </Show>
217
- <Show when={props.actions}>
218
- <div class="relative flex shrink-0 items-center gap-1">{props.actions}</div>
235
+ <Show when={actions()}>
236
+ <div class="relative flex shrink-0 items-center gap-1">{actions()}</div>
219
237
  </Show>
220
- <Show when={opens() && props.actions === undefined}>
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={props.children} fallback={props.icon ? <Icon icon={props.icon} /> : null}>
272
- {props.children}
290
+ <Show when={glyph()} fallback={props.icon ? <Icon icon={props.icon} /> : null}>
291
+ {glyph()}
273
292
  </Show>
274
293
  </span>
275
294
  );