@moi952/decky-ui-kit 0.2.0 → 0.4.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/README.md CHANGED
@@ -124,5 +124,179 @@ import { FieldTextInput } from "@moi952/decky-ui-kit";
124
124
  | `mustBeNumeric` | `boolean` | `false` | Restricts input to numeric characters. |
125
125
  | `bottomSeparator` | `boolean` | `true` | Native Steam separator line below the row. |
126
126
  | `highlightOnFocus` | `boolean` | `true` | Background highlight while the input has focus. |
127
+ | `placeholder` | `string` | — | Shown when empty (TextField has no native placeholder, this is a positioned overlay). |
128
+ | `iconStart` | `ReactNode` | — | Icon at the start of the input. |
129
+ | `iconEnd` | `ReactNode` | — | Icon at the end of the input. |
130
+
131
+ </details>
132
+
133
+ ### `InfoTable`
134
+
135
+ A bordered, rounded key/value table for a single entity's details — icon, short label, value right-aligned. Built for a detail screen (an app, a package, a save file, ...) sitting below its header: version, source, file path, and so on, one row each. A row's `accent` color (e.g. green for an available update) tints both its icon and its value.
136
+
137
+ ```tsx
138
+ import { InfoTable } from "@moi952/decky-ui-kit";
139
+ import { FiTag, FiUpload, FiFile } from "react-icons/fi";
140
+
141
+ <InfoTable
142
+ rows={[
143
+ { icon: <FiTag size={13} />, label: "Version", value: "1.4.2" },
144
+ {
145
+ icon: <FiUpload size={13} />,
146
+ label: "Available",
147
+ value: "1.5.0",
148
+ accent: "#4caf50",
149
+ },
150
+ { icon: <FiFile size={13} />, label: "Path", value: "/home/deck/App.AppImage" },
151
+ ]}
152
+ />
153
+ ```
154
+
155
+ <details>
156
+ <summary>Props</summary>
157
+
158
+ | Prop | Type | Default | Description |
159
+ | --- | --- | --- | --- |
160
+ | `rows` | `InfoTableRow[]` | — | The rows to render, top to bottom. |
161
+ | `labelWidth` | `number` | `90` | Label column width — every row's value starts at this same x position. |
162
+ | `labelColor` | `string` | Steam-like light gray | Label text color. |
163
+ | `iconColor` | `string` | Steam-like dark gray | A row's icon color, when it has no `accent`. |
164
+ | `valueColor` | `string` | `"#fff"` | A row's value color, when it has no `accent`. |
165
+ | `bgColor` | `string` | Steam-like dark, translucent | Table background. |
166
+ | `borderColor` | `string` | Steam-like dark, translucent | Table border. |
167
+
168
+ `InfoTableRow`:
169
+
170
+ | Field | Type | Description |
171
+ | --- | --- | --- |
172
+ | `icon` | `ReactNode` | — |
173
+ | `label` | `ReactNode` | Short label on the left (fixed width, so values stay aligned across rows). |
174
+ | `value` | `ReactNode` | Right-aligned; wraps on overflow rather than clipping. |
175
+ | `accent` | `string` | Tints this row's icon and value (default: neutral gray icon, white value). |
176
+
177
+ </details>
178
+
179
+ ### `InlineConfirm`
180
+
181
+ A destructive-action confirmation shown inline, right below whatever triggered it — not a modal. A description line plus an equal-width Cancel/Confirm button pair. No i18n of its own — pass your own translated labels.
182
+
183
+ ```tsx
184
+ import { InlineConfirm } from "@moi952/decky-ui-kit";
185
+
186
+ {confirming && (
187
+ <InlineConfirm
188
+ description="Remove the wrapper from this game?"
189
+ confirmLabel="Remove"
190
+ onCancel={() => setConfirming(false)}
191
+ onConfirm={() => { removeWrapper(); setConfirming(false); }}
192
+ />
193
+ )}
194
+ ```
195
+
196
+ <details>
197
+ <summary>Props</summary>
198
+
199
+ | Prop | Type | Default | Description |
200
+ | --- | --- | --- | --- |
201
+ | `description` | `ReactNode` | — | The confirmation message. |
202
+ | `onCancel` | `() => void` | — | Called when Cancel is picked. |
203
+ | `onConfirm` | `() => void` | — | Called when the confirm button is picked. |
204
+ | `cancelLabel` | `ReactNode` | `"Cancel"` | Cancel button text. |
205
+ | `confirmLabel` | `ReactNode` | `"Delete"` | Confirm button text. |
206
+ | `size` | `"small" \| "medium" \| "large"` | `"small"` | Button padding/font size. |
207
+ | `variant` | `"danger" \| "primary"` | `"danger"` | Red confirm button for a destructive action, or blue for a plain confirm. |
208
+
209
+ </details>
210
+
211
+ ### `MediaRow`
212
+
213
+ A focusable media+title(+details)(+actions) row. The same shape covers both "a list of apps, each with a status stack and inline Update/Exclude buttons" and "a grid of game capsules, each just a cover and a title" — which of the two a given instance looks like follows entirely from which props are passed: give it `actions` and it splits into a header + a separate collapsible action row; leave `actions` out and the whole thing is one single-press card. `mediaLayout="stretch"` swaps the centered-icon box for a fixed-height, auto-width cover-image box instead of the icon's centered square — the media sizes itself from its own aspect ratio, so it's never cropped.
214
+
215
+ ```tsx
216
+ import { MediaRow } from "@moi952/decky-ui-kit";
217
+ import { FiEyeOff } from "react-icons/fi";
218
+
219
+ // A status-stack app row, with an inline action row
220
+ <MediaRow
221
+ media={<img src={iconUrl} style={{ maxWidth: "100%", maxHeight: "100%" }} />}
222
+ title="Firefox"
223
+ details={
224
+ <div style={{ fontSize: 11, color: "#9aa1a8" }}>128.0</div>
225
+ }
226
+ onPress={() => openDetails()}
227
+ actions={
228
+ <ActionButton onClick={exclude}><FiEyeOff size={12} /></ActionButton>
229
+ }
230
+ color="transparent"
231
+ bottomSeparator
232
+ />
233
+
234
+ // A cover-image capsule, no actions row at all
235
+ <MediaRow
236
+ mediaLayout="stretch"
237
+ mediaHeight={37}
238
+ media={<img src={coverUrl} style={{ height: "100%", width: "auto" }} />}
239
+ title="Half-Life 2"
240
+ titleLines={2}
241
+ onPress={() => launch()}
242
+ spacing={4}
243
+ color="light"
244
+ />
245
+ ```
246
+
247
+ <details>
248
+ <summary>Props</summary>
249
+
250
+ | Prop | Type | Default | Description |
251
+ | --- | --- | --- | --- |
252
+ | `media` | `ReactNode` | — | The leading visual — an `<img>`, a placeholder, badges overlaid on it. This component only sizes/positions the box around it. |
253
+ | `mediaWidth` | `number` | `32` | Media box width — only used by `mediaLayout="fixed"`. |
254
+ | `mediaHeight` | `number` | `32` | Media box height. |
255
+ | `mediaLayout` | `"fixed" \| "stretch"` | `"fixed"` | `"fixed"`: media centered in an exact `mediaWidth`×`mediaHeight` box (a small icon). `"stretch"`: exactly `mediaHeight` tall, but no fixed width at all — the media renders at whatever width its own aspect ratio calls for at that height (e.g. `<img style={{ height: "100%", width: "auto" }} />`), so a cover image always shows in full. |
256
+ | `title` | `ReactNode` | — | The row's title. |
257
+ | `titleLines` | `number` | `1` | `1`: ellipsis-truncated single line. `>1`: line-clamped over that many lines. |
258
+ | `details` | `ReactNode` | — | Extra content under the title — your own pre-colored status line(s). Omit for a title-only row. |
259
+ | `onPress` | `() => void` | — | Called when the header is pressed. |
260
+ | `actions` | `ReactNode` | — | Rendered in its own row below the header, inside a `Focusable`. Omit entirely for a single-button card with no action row. Given without `onPress`, pressing the header toggles this row instead of navigating. |
261
+ | `collapsedByDefault` | `boolean` | `false` | Only relevant when `actions` is given and `onPress` isn't — starts with the actions row hidden until the header is pressed once. |
262
+ | `color` | `"light" \| "dark" \| "transparent" \| "success" \| "danger" \| "info" \| "warning"` | — (required) | The row's own look — border + matching background. There's no "no color" state, so a row's border width never shifts depending on which color a sibling happens to have. `"light"`/`"dark"` are the two plain card backgrounds with no state implied; `"transparent"` is for a flush row inside a `bottomSeparator` list, which must show no card look of its own; the rest are accent colors for flagging a real state (e.g. `"success"` for "currently active"). |
263
+ | `accentBorderColor` | `string` | — | Overrides `color`'s border color. |
264
+ | `accentBorderWidth` | `number` | `2` | Border width — the same value applies to every color, so a row's size never shifts between states. |
265
+ | `accentBackground` | `string` | — | Overrides `color`'s background color. |
266
+ | `borderOnFocus` | `boolean` | `true` | A real border on focus/hover, via an inset box-shadow (not `outline` — outline doesn't respect border-radius). Independent of `highlightOnFocus` below — same convention as `ScreenshotCarousel`'s own `borderOnFocus`. |
267
+ | `highlightColor` | `string` | `"#dcdedf"` | Border color on focus/hover (used when `borderOnFocus`). Same default across every focusable component in this library. |
268
+ | `highlightOnFocus` | `boolean` | `true` | A background tint on focus/hover, independent of `borderOnFocus` above. |
269
+ | `highlightBackground` | `string` | `"#2a3a4a"` | Background color on focus/hover (used when `highlightOnFocus`). |
270
+ | `spacing` | `number` | `0` | Gap below the row, for a list of spaced-apart cards. An alternative to `bottomSeparator`, not meant combined with it. |
271
+ | `bottomSeparator` | `boolean` | `false` | A bottom divider line, for a continuous divided list — the alternative to `spacing`. Pair with `color="transparent"` so the row shows no card background of its own, just the divider and the focus highlight. |
272
+ | `onSecondaryButton` | `(evt) => void` | — | Fires on gamepad X / Steam "Secondary" while the row has focus. |
273
+ | `onSecondaryActionDescription` | `ReactNode` | — | Shown in Steam's own bottom action-legend bar next to the X prompt (only while `onSecondaryButton` is set). |
274
+
275
+ </details>
276
+
277
+ ### `ScreenshotCarousel`
278
+
279
+ A single screenshot "stage" — app store/catalog "photos", one shown at a time, reading as one pressable card (same rounded corners, same `bottomSeparator`/focus-border conventions as `MediaRow`). Moved with DIR_LEFT/DIR_RIGHT or LB/RB (advertised in Steam's own bottom action-legend bar) — no on-screen prev/next buttons on this inline view, those only live in the full-screen zoom pressing the photo opens (a real Steam modal, via `showModal`/`ModalRoot`). Renders nothing at all when `screenshots` is empty, so a caller never needs its own length check around it.
280
+
281
+ ```tsx
282
+ import { ScreenshotCarousel } from "@moi952/decky-ui-kit";
283
+
284
+ <ScreenshotCarousel screenshots={entry.screenshots} height={140} />
285
+ ```
286
+
287
+ <details>
288
+ <summary>Props</summary>
289
+
290
+ | Prop | Type | Default | Description |
291
+ | --- | --- | --- | --- |
292
+ | `screenshots` | `string[]` | — | Image URLs (or data URIs). Renders nothing when empty. |
293
+ | `height` | `number` | `120` | Height of the inline (non-zoomed) view. |
294
+ | `bottomSeparator` | `boolean` | `false` | A bottom divider line, for sitting inside a continuous divided list — same convention as `MediaRow`'s own `bottomSeparator`. |
295
+ | `borderOnFocus` | `boolean` | `true` | A real border on focus/hover, via an inset box-shadow (not `outline`). Independent of `highlightOnFocus` below — same convention as `MediaRow`'s own `borderOnFocus`. |
296
+ | `highlightColor` | `string` | `"#dcdedf"` | Border color on focus/hover (used when `borderOnFocus`). Same default across every focusable component in this library. |
297
+ | `highlightOnFocus` | `boolean` | `true` | A background tint behind the stage on focus/hover (only visible where the photo doesn't already fill the box), independent of `borderOnFocus` above. |
298
+ | `highlightBackground` | `string` | `"#2a3a4a"` | Background color on focus/hover (used when `highlightOnFocus`). |
299
+ | `prevActionDescription` | `ReactNode` | `"Previous"` | Shown in Steam's own bottom action-legend bar next to the LB prompt (only while there's more than one screenshot). |
300
+ | `nextActionDescription` | `ReactNode` | `"Next"` | Shown next to the RB prompt. |
127
301
 
128
302
  </details>
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { FooterLegendProps } from "@decky/ui";
3
+ import { ComponentSize } from "./internal/theme";
4
+ type GamepadEvt = Parameters<NonNullable<FooterLegendProps["onSecondaryButton"]>>[0];
5
+ export interface ActionButtonProps {
6
+ children: React.ReactNode;
7
+ onClick: () => void;
8
+ size?: ComponentSize;
9
+ variant?: "normal" | "bordered" | "danger" | "primary";
10
+ width?: string | number;
11
+ disabled?: boolean;
12
+ onSecondaryButton?: (evt: GamepadEvt) => void;
13
+ onSecondaryActionDescription?: React.ReactNode;
14
+ onOptionsButton?: (evt: GamepadEvt) => void;
15
+ onOptionsActionDescription?: React.ReactNode;
16
+ onMenuButton?: (evt: GamepadEvt) => void;
17
+ onMenuActionDescription?: React.ReactNode;
18
+ onOKButton?: (evt: GamepadEvt) => void;
19
+ onOKActionDescription?: React.ReactNode;
20
+ }
21
+ export declare const ActionButton: React.FC<ActionButtonProps>;
22
+ export {};
@@ -0,0 +1,77 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DialogButton } from "@decky/ui";
3
+ import { ACCENT_DANGER, ACCENT_INFO, SIZE_STYLE } from "./internal/theme";
4
+ // Padding only — vertical rhythm (fontSize/minHeight) comes from the
5
+ // shared SIZE_STYLE table instead, the same one FieldTextInput and
6
+ // AnchoredDropdown's own trigger use, so all three actually line up
7
+ // instead of each deriving a close-but-not-guaranteed height from their
8
+ // own padding+font independently.
9
+ const PADDING_V = { small: 4, medium: 6, large: 8 };
10
+ const PADDING_H = { small: 8, medium: 12, large: 16 };
11
+ const SOLID_VARIANT_COLOR = {
12
+ danger: ACCENT_DANGER,
13
+ primary: ACCENT_INFO,
14
+ };
15
+ // Never sets its own border-radius, for any variant — Steam's own native
16
+ // DialogButton chrome already gives every button a sensible radius on
17
+ // its own (a CSSLoader "round corners" theme controls it same as
18
+ // anywhere else), so there's nothing for this component to add or
19
+ // override there.
20
+ export const ActionButton = ({ children, onClick, size = "small", variant = "normal", width, disabled, onSecondaryButton, onSecondaryActionDescription, onOptionsButton, onOptionsActionDescription, onMenuButton, onMenuActionDescription, onOKButton, onOKActionDescription, }) => {
21
+ const { fontSize, minHeight } = SIZE_STYLE[size];
22
+ const style = {
23
+ padding: `${PADDING_V[size]}px ${PADDING_H[size]}px`,
24
+ fontSize,
25
+ minHeight,
26
+ // Reserved for every variant that gets a background override below
27
+ // (bordered/danger/primary) — even the ones with no visible border
28
+ // of their own (danger/primary) still occupy the same 1px of
29
+ // box-model space "bordered" uses for its own real one, so all
30
+ // three add up to the exact same height instead of "bordered" alone
31
+ // needing 2px more room than the others at the same size. "normal"
32
+ // stays fully untouched, per its own documented promise above — no
33
+ // override at all, not even an invisible one.
34
+ ...(variant !== "normal" ? { border: "1px solid transparent" } : {}),
35
+ };
36
+ const cls = variant !== "normal" ? `dck-action-btn-${variant}` : undefined;
37
+ return (_jsxs(_Fragment, { children: [variant === "bordered" && (_jsx("style", { children: `
38
+ .dck-action-btn-bordered {
39
+ background: rgba(255, 255, 255, 0.08) !important;
40
+ border-color: rgba(255, 255, 255, 0.18) !important;
41
+ }
42
+ .dck-action-btn-bordered:focus,
43
+ .dck-action-btn-bordered:hover {
44
+ background: #dcdedf !important;
45
+ color: #000 !important;
46
+ border-color: #dcdedf !important;
47
+ }
48
+ .dck-action-btn-bordered:disabled,
49
+ .dck-action-btn-bordered[disabled] {
50
+ opacity: 1 !important;
51
+ background: #2a2e35 !important;
52
+ border-color: rgba(255, 255, 255, 0.15) !important;
53
+ color: #6b7076 !important;
54
+ }
55
+ ` })), (variant === "danger" || variant === "primary") && (_jsx("style", { children: `
56
+ .dck-action-btn-${variant} {
57
+ background-color: ${SOLID_VARIANT_COLOR[variant]} !important;
58
+ color: #fff !important;
59
+ }
60
+ .dck-action-btn-${variant}:focus,
61
+ .dck-action-btn-${variant}:hover {
62
+ background-color: #fff !important;
63
+ color: ${SOLID_VARIANT_COLOR[variant]} !important;
64
+ }
65
+ ` })), _jsx(DialogButton, { className: cls, style: {
66
+ ...style,
67
+ // Without this, sizing is content-box by default (the
68
+ // browser's own native default) — padding would add on top of
69
+ // minHeight instead of being absorbed inside it.
70
+ boxSizing: "border-box",
71
+ display: "inline-flex",
72
+ alignItems: "center",
73
+ justifyContent: "center",
74
+ width: width ?? "fit-content",
75
+ minWidth: "unset",
76
+ }, onClick: onClick, disabled: disabled, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryActionDescription, onOptionsButton: onOptionsButton, onOptionsActionDescription: onOptionsActionDescription, onMenuButton: onMenuButton, onMenuActionDescription: onMenuActionDescription, onOKButton: onOKButton, onOKActionDescription: onOKActionDescription, children: children })] }));
77
+ };
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { ComponentSize } from "./internal/theme";
2
3
  interface DropdownOption {
3
4
  value: string;
4
5
  label: string;
@@ -7,9 +8,10 @@ export interface AnchoredDropdownProps {
7
8
  options: DropdownOption[];
8
9
  selectedValue: string;
9
10
  onChange: (value: string) => void;
11
+ label?: React.ReactNode;
10
12
  variant?: "row" | "boxed";
11
13
  focusStyle?: "fill" | "outline";
12
- size?: "default" | "small";
14
+ size?: ComponentSize;
13
15
  bgColor?: string;
14
16
  textColor?: string;
15
17
  borderColor?: string;
@@ -2,10 +2,26 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useLayoutEffect, useRef, useState } from "react";
3
3
  import { DialogButton, Field, Focusable, GamepadButton } from "@decky/ui";
4
4
  import { FaChevronDown, FaChevronRight, FaCheck } from "react-icons/fa";
5
- const DEFAULT_BG = "#35373c";
5
+ import { DEFAULT_PANEL_BACKGROUND, SIZE_STYLE } from "./internal/theme";
6
+ const DEFAULT_BG = DEFAULT_PANEL_BACKGROUND;
6
7
  const DEFAULT_TEXT = "#bfbfbf";
7
8
  const DEFAULT_BORDER = "transparent";
8
9
  const FALLBACK_RADIUS = "6px";
10
+ // The trigger's own horizontal padding/vertical rhythm — fontSize and
11
+ // minHeight (the actual height-determining values) come from the shared
12
+ // SIZE_STYLE table instead (see internal/theme.ts), the same one
13
+ // ActionButton/FieldTextInput use, so this trigger lines up with them at
14
+ // "the same size" instead of merely resembling it — but only ever grows
15
+ // from there (min-height, not height), so a long selected-value label
16
+ // wrapping to 2+ lines (see maxDisplayLines) still has room to grow into
17
+ // instead of getting clipped. The open option list below stays on its
18
+ // own separate scale (OPTION_PADDING/OPTION_FONT_SIZE) — it has no
19
+ // reason to match an external row's height.
20
+ const TRIGGER_PADDING_V = { small: 6, medium: 10, large: 14 };
21
+ const TRIGGER_PADDING_H = { small: 10, medium: 14, large: 18 };
22
+ const OPTION_PADDING = { small: "4px 8px", medium: "10px 14px", large: "12px 16px" };
23
+ const OPTION_FONT_SIZE = { small: "11px", medium: "14px", large: "16px" };
24
+ const OPTION_ROW_HEIGHT = { small: 26, medium: 42, large: 48 };
9
25
  // Shared across instances so "row" reuses a "boxed" one's measured radius.
10
26
  let sharedBoxedRadius = null;
11
27
  let uidCounter = 0;
@@ -21,7 +37,7 @@ const toggleCsv = (csv, value, options) => {
21
37
  .join(",");
22
38
  };
23
39
  // Native Steam popups reset the panel on close — this is an inline overlay instead.
24
- export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "boxed", focusStyle = "fill", size = "default", bgColor = DEFAULT_BG, textColor = DEFAULT_TEXT, borderColor = DEFAULT_BORDER, blurBackground = true, multiple = false, selectedValuesLayout = "inline", selectedCountLabel, onSecondaryButton, onSecondaryActionDescription, onOptionsButton, onOptionsActionDescription, maxDisplayLines = 1, maxVisibleOptions, highlightOnFocus = true, bottomSeparator = true, }) => {
40
+ export const AnchoredDropdown = ({ options, selectedValue, onChange, label, variant = "boxed", focusStyle = "fill", size = "medium", bgColor = DEFAULT_BG, textColor = DEFAULT_TEXT, borderColor = DEFAULT_BORDER, blurBackground = true, multiple = false, selectedValuesLayout = "inline", selectedCountLabel, onSecondaryButton, onSecondaryActionDescription, onOptionsButton, onOptionsActionDescription, maxDisplayLines = 1, maxVisibleOptions, highlightOnFocus = true, bottomSeparator = true, }) => {
25
41
  // Scoped per instance so sibling dropdowns don't share class names.
26
42
  const [uid] = useState(() => `dck-anchored-dd${uidCounter++}`);
27
43
  const [expanded, setExpanded] = useState(false);
@@ -38,7 +54,7 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
38
54
  if (variant !== "boxed" || !triggerRef.current)
39
55
  return;
40
56
  const el = triggerRef.current;
41
- const horizontalPadding = size === "small" ? 10 : 14;
57
+ const horizontalPadding = TRIGGER_PADDING_H[size];
42
58
  const overhead = horizontalPadding * 2 + 12 + 8;
43
59
  const measure = () => setLabelMaxWidth(Math.max(0, el.clientWidth - overhead));
44
60
  measure();
@@ -119,7 +135,7 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
119
135
  }
120
136
  };
121
137
  // Padding + line-height + the option's 2px border.
122
- const rowHeight = size === "small" ? 26 : 42;
138
+ const rowHeight = OPTION_ROW_HEIGHT[size];
123
139
  // 0 means "show every option, no scroll cap".
124
140
  const listMaxHeight = maxVisibleOptions === 0 ? undefined : maxVisibleOptions ? maxVisibleOptions * (rowHeight + 2) : 220;
125
141
  const toggle = () => {
@@ -140,11 +156,10 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
140
156
  const triggerLabelCls = `${uid}-trigger-label`;
141
157
  const countCls = `${uid}-count`;
142
158
  const wrapperCls = `${uid}-wrapper`;
143
- const optionPadding = size === "small" ? "4px 8px" : "10px 14px";
144
- const optionFontSize = size === "small" ? "11px" : "14px";
145
- const triggerPaddingH = size === "small" ? "10px" : "14px";
146
- const triggerPadding = size === "small" ? `6px ${triggerPaddingH}` : `10px ${triggerPaddingH}`;
147
- const triggerFontSize = size === "small" ? "12px" : "15px";
159
+ const optionPadding = OPTION_PADDING[size];
160
+ const optionFontSize = OPTION_FONT_SIZE[size];
161
+ const triggerPadding = `${TRIGGER_PADDING_V[size]}px ${TRIGGER_PADDING_H[size]}px`;
162
+ const { fontSize: triggerFontSize, minHeight: triggerMinHeight } = SIZE_STYLE[size];
148
163
  return (_jsxs("div", { ref: wrapperRef, className: wrapperCls, style: { position: "relative", width: "100%", maxWidth: "100%", boxSizing: "border-box" }, children: [_jsx("style", { children: `
149
164
  .${optionCls} {
150
165
  box-sizing: border-box !important;
@@ -163,15 +178,15 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
163
178
  }
164
179
  .${triggerCls} {
165
180
  box-sizing: border-box !important;
166
- width: calc(100% - 6px) !important;
167
- max-width: calc(100% - 6px) !important;
168
- margin: 3px !important;
181
+ width: 100% !important;
182
+ max-width: 100% !important;
169
183
  display: flex !important;
170
184
  justify-content: space-between !important;
171
185
  align-items: center !important;
172
186
  gap: 8px !important;
173
187
  padding: ${triggerPadding} !important;
174
188
  font-size: ${triggerFontSize} !important;
189
+ min-height: ${triggerMinHeight}px !important;
175
190
  background: ${bgColor} !important;
176
191
  border: 1px solid ${borderColor} !important;
177
192
  color: ${textColor} !important;
@@ -235,11 +250,16 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
235
250
  ` }), (() => {
236
251
  const countNode = multiple && selectedCountLabel && selectedValues.length > 0 ? (_jsx("div", { className: countCls, children: selectedCountLabel(selectedValues.length) })) : null;
237
252
  if (variant === "boxed") {
238
- return (_jsx(Field, { focusable: true, highlightOnFocus: highlightOnFocus, bottomSeparator: bottomSeparator ? "standard" : "none", childrenContainerWidth: "max", onActivate: toggle, onClick: toggle, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryButton ? onSecondaryActionDescription : undefined, onOptionsButton: onOptionsButton, onOptionsActionDescription: onOptionsButton ? onOptionsActionDescription : undefined, children: _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 2, width: "100%" }, children: [countNode, _jsxs(DialogButton, { className: triggerCls, ref: (el) => {
253
+ return (_jsx(Field, { focusable: true, label: label,
254
+ // Field's own default isn't "label sits above the
255
+ // control" — explicit here so a caller-supplied label
256
+ // renders on top, the same convention FieldTextInput's own
257
+ // labelPosition="top" already uses.
258
+ childrenLayout: label ? "below" : undefined, highlightOnFocus: highlightOnFocus, bottomSeparator: bottomSeparator ? "standard" : "none", childrenContainerWidth: "max", onActivate: toggle, onClick: toggle, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryButton ? onSecondaryActionDescription : undefined, onOptionsButton: onOptionsButton, onOptionsActionDescription: onOptionsButton ? onOptionsActionDescription : undefined, children: _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 2, width: "100%" }, children: [countNode, _jsxs(DialogButton, { className: triggerCls, ref: (el) => {
239
259
  triggerRef.current = el;
240
260
  }, children: [_jsx("span", { className: triggerLabelCls, style: labelMaxWidth !== undefined ? { maxWidth: labelMaxWidth } : undefined, children: displayLabel }), _jsx(FaChevronDown, { size: 12, style: { flexShrink: 0 } })] })] }) }));
241
261
  }
242
- return (_jsx(Field, { focusable: true, highlightOnFocus: highlightOnFocus, bottomSeparator: bottomSeparator ? "standard" : "none", onActivate: toggle, onClick: toggle, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryButton ? onSecondaryActionDescription : undefined, onOptionsButton: onOptionsButton, onOptionsActionDescription: onOptionsButton ? onOptionsActionDescription : undefined, label: countNode ? (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 2, width: "100%" }, children: [countNode, displayLabel] })) : (displayLabel), childrenLayout: "inline", ref: (el) => {
262
+ return (_jsx(Field, { focusable: true, highlightOnFocus: highlightOnFocus, bottomSeparator: bottomSeparator ? "standard" : "none", onActivate: toggle, onClick: toggle, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryButton ? onSecondaryActionDescription : undefined, onOptionsButton: onOptionsButton, onOptionsActionDescription: onOptionsButton ? onOptionsActionDescription : undefined, label: label || countNode ? (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 2, width: "100%" }, children: [label, countNode, displayLabel] })) : (displayLabel), childrenLayout: "inline", ref: (el) => {
243
263
  triggerRef.current = el;
244
264
  }, children: expanded ? _jsx(FaChevronDown, { size: 12 }) : _jsx(FaChevronRight, { size: 12 }) }));
245
265
  })(), expanded && blurBackground && (_jsx("div", { onClick: closeList, style: {
@@ -4,5 +4,6 @@ export interface CollapsibleSectionProps {
4
4
  expanded: boolean;
5
5
  onToggle: () => void;
6
6
  children: React.ReactNode;
7
+ contentBottomSeparator?: boolean;
7
8
  }
8
9
  export declare const CollapsibleSection: React.FC<CollapsibleSectionProps>;
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Field } from "@decky/ui";
3
3
  import { FaChevronDown, FaChevronRight } from "react-icons/fa";
4
+ const DIVIDER_COLOR = "rgba(255, 255, 255, 0.08)";
4
5
  // Field is the generic building block Decky's own ToggleField/SliderField
5
6
  // are built on — using it here gets native padding/separator for free,
6
7
  // instead of approximating them with a hand-styled button.
7
- export const CollapsibleSection = ({ label, expanded, onToggle, children, }) => (_jsxs(_Fragment, { children: [_jsx(Field, { label: label, onActivate: onToggle, onClick: onToggle, focusable: true, bottomSeparator: "standard", childrenLayout: "inline", children: expanded ? _jsx(FaChevronDown, { size: 12 }) : _jsx(FaChevronRight, { size: 12 }) }), expanded && children] }));
8
+ export const CollapsibleSection = ({ label, expanded, onToggle, children, contentBottomSeparator = false, }) => (_jsxs(_Fragment, { children: [_jsx(Field, { label: label, onActivate: onToggle, onClick: onToggle, focusable: true, bottomSeparator: "standard", childrenLayout: "inline", children: expanded ? _jsx(FaChevronDown, { size: 12 }) : _jsx(FaChevronRight, { size: 12 }) }), expanded && children, expanded && contentBottomSeparator && (_jsx("div", { style: { marginTop: 8, borderBottom: `1px solid ${DIVIDER_COLOR}` } }))] }));
@@ -1,12 +1,16 @@
1
1
  import React from "react";
2
+ import { ComponentSize } from "./internal/theme";
2
3
  export interface FieldTextInputProps {
3
4
  label?: React.ReactNode;
4
5
  value: string;
5
6
  onChange: (value: string) => void;
6
- size?: "default" | "small";
7
+ size?: ComponentSize;
7
8
  mustBeNumeric?: boolean;
8
9
  bottomSeparator?: boolean;
9
10
  highlightOnFocus?: boolean;
10
11
  labelPosition?: "top" | "left" | "right";
12
+ placeholder?: string;
13
+ iconStart?: React.ReactNode;
14
+ iconEnd?: React.ReactNode;
11
15
  }
12
16
  export declare const FieldTextInput: React.FC<FieldTextInputProps>;
@@ -1,11 +1,58 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Field, TextField } from "@decky/ui";
3
+ import { DEFAULT_ROUNDNESS, SIZE_STYLE } from "./internal/theme";
3
4
  // TextField lacks bottomSeparator/highlightOnFocus/size, so this wraps it in Field.
4
- export const FieldTextInput = ({ label, value, onChange, size = "default", mustBeNumeric, bottomSeparator = true, highlightOnFocus = true, labelPosition = "top", }) => {
5
- const input = (_jsx(TextField, { mustBeNumeric: mustBeNumeric, value: value, onChange: (e) => onChange(e.target.value), style: {
6
- fontSize: size === "small" ? 12 : 14,
7
- padding: size === "small" ? "6px 8px" : "10px 12px",
8
- } }));
5
+ export const FieldTextInput = ({ label, value, onChange, size = "medium", mustBeNumeric, bottomSeparator = true, highlightOnFocus = true, labelPosition = "top", placeholder, iconStart, iconEnd, }) => {
6
+ const { fontSize, minHeight } = SIZE_STYLE[size];
7
+ // Horizontal-only — vertical rhythm comes entirely from the shared
8
+ // table's own minHeight below, not from padding, so this can never
9
+ // drift from what ActionButton/AnchoredDropdown's own trigger resolve
10
+ // to at "the same size". A native <input> never wraps to more than one
11
+ // line regardless, so minHeight vs. a fixed height makes no practical
12
+ // difference here — kept as minHeight anyway, only for consistency
13
+ // with the other two (which do need the real floor, not a hard cap).
14
+ const padH = { small: 8, medium: 12, large: 16 }[size];
15
+ // Fixed regardless of size, so icon margins stay identical in both.
16
+ const iconSlot = 30;
17
+ const input = (_jsxs("div", { style: { position: "relative", width: "100%" }, children: [_jsx(TextField, { mustBeNumeric: mustBeNumeric, value: value, onChange: (e) => onChange(e.target.value), style: {
18
+ fontSize,
19
+ width: "100%",
20
+ boxSizing: "border-box",
21
+ // No vertical padding — a native <input> already centers its
22
+ // own text within its box regardless of extra height, so
23
+ // minHeight alone reserves the room, guaranteeing this lines
24
+ // up with ActionButton/AnchoredDropdown's own trigger at "the
25
+ // same size" instead of merely resembling it.
26
+ padding: `0 ${iconEnd ? iconSlot : padH}px 0 ${iconStart ? iconSlot : padH}px`,
27
+ minHeight,
28
+ borderRadius: DEFAULT_ROUNDNESS,
29
+ } }), !value && placeholder && (_jsx("span", { style: {
30
+ position: "absolute",
31
+ left: iconStart ? iconSlot : padH,
32
+ top: "50%",
33
+ transform: "translateY(-50%)",
34
+ fontSize,
35
+ color: "rgba(255, 255, 255, 0.4)",
36
+ pointerEvents: "none",
37
+ whiteSpace: "nowrap",
38
+ overflow: "hidden",
39
+ textOverflow: "ellipsis",
40
+ maxWidth: `calc(100% - ${(iconStart ? iconSlot : padH) + (iconEnd ? iconSlot : padH)}px)`,
41
+ }, children: placeholder })), iconStart && (_jsx("span", { style: {
42
+ position: "absolute",
43
+ left: (iconSlot - 16) / 2,
44
+ top: "50%",
45
+ transform: "translateY(-50%)",
46
+ display: "flex",
47
+ pointerEvents: "none",
48
+ }, children: iconStart })), iconEnd && (_jsx("span", { style: {
49
+ position: "absolute",
50
+ right: (iconSlot - 16) / 2,
51
+ top: "50%",
52
+ transform: "translateY(-50%)",
53
+ display: "flex",
54
+ pointerEvents: "none",
55
+ }, children: iconEnd }))] }));
9
56
  return (_jsx(Field, { label: labelPosition === "right" ? undefined : label, bottomSeparator: bottomSeparator ? "standard" : "none", childrenLayout: labelPosition === "top" ? "below" : "inline", highlightOnFocus: highlightOnFocus, children: labelPosition === "right" ? (_jsxs("div", { style: {
10
57
  display: "flex",
11
58
  alignItems: "center",
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ export interface InfoTableRow {
3
+ icon: React.ReactNode;
4
+ label: React.ReactNode;
5
+ value: React.ReactNode;
6
+ accent?: string;
7
+ }
8
+ export interface InfoTableProps {
9
+ rows: InfoTableRow[];
10
+ labelWidth?: number;
11
+ labelColor?: string;
12
+ iconColor?: string;
13
+ valueColor?: string;
14
+ bgColor?: string;
15
+ borderColor?: string;
16
+ }
17
+ export declare const InfoTable: React.FC<InfoTableProps>;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DEFAULT_ROUNDNESS } from "./internal/theme";
3
+ const DEFAULT_LABEL_WIDTH = 90;
4
+ const DEFAULT_LABEL_COLOR = "#9aa1a8";
5
+ const DEFAULT_ICON_COLOR = "#6b7076";
6
+ const DEFAULT_VALUE_COLOR = "#fff";
7
+ const DEFAULT_BG = "rgba(255, 255, 255, 0.03)";
8
+ const DEFAULT_BORDER = "rgba(255, 255, 255, 0.08)";
9
+ const InfoTableRowView = ({ icon, label, value, accent, last, labelWidth, labelColor, iconColor, valueColor }) => (_jsxs("div", { style: {
10
+ display: "flex",
11
+ alignItems: "center",
12
+ gap: 10,
13
+ padding: "8px 10px",
14
+ borderBottom: last ? "none" : "1px solid rgba(255, 255, 255, 0.06)",
15
+ }, children: [_jsx("span", { style: { color: accent ?? iconColor, flexShrink: 0, display: "flex" }, children: icon }), _jsx("span", { style: { fontSize: 11, color: labelColor, flexShrink: 0, width: labelWidth }, children: label }), _jsx("span", { style: {
16
+ fontSize: 12,
17
+ color: accent ?? valueColor,
18
+ marginLeft: "auto",
19
+ textAlign: "right",
20
+ overflowWrap: "anywhere",
21
+ wordBreak: "break-all",
22
+ }, children: value })] }));
23
+ // A bordered, rounded key/value table — icon, short label, value
24
+ // right-aligned. Purely presentational: what each row means (an app's
25
+ // version, a save file's size, a save slot's date, ...) is entirely up to
26
+ // the caller. Built for a "detail" screen sitting below its header, but
27
+ // nothing here assumes any particular kind of entity. Rows with an
28
+ // `accent` (e.g. an available update in green) stand out against the rest.
29
+ export const InfoTable = ({ rows, labelWidth = DEFAULT_LABEL_WIDTH, labelColor = DEFAULT_LABEL_COLOR, iconColor = DEFAULT_ICON_COLOR, valueColor = DEFAULT_VALUE_COLOR, bgColor = DEFAULT_BG, borderColor = DEFAULT_BORDER, }) => (_jsx("div", { style: {
30
+ background: bgColor,
31
+ border: `1px solid ${borderColor}`,
32
+ borderRadius: DEFAULT_ROUNDNESS,
33
+ overflow: "hidden",
34
+ }, children: rows.map((row, i) => (_jsx(InfoTableRowView, { ...row, last: i === rows.length - 1, labelWidth: labelWidth, labelColor: labelColor, iconColor: iconColor, valueColor: valueColor }, i))) }));
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { ComponentSize } from "./internal/theme";
3
+ export interface InlineConfirmProps {
4
+ description: React.ReactNode;
5
+ onCancel: () => void;
6
+ onConfirm: () => void;
7
+ cancelLabel?: React.ReactNode;
8
+ confirmLabel?: React.ReactNode;
9
+ size?: ComponentSize;
10
+ variant?: "danger" | "primary";
11
+ }
12
+ export declare const InlineConfirm: React.FC<InlineConfirmProps>;
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { DialogButton, Focusable } from "@decky/ui";
4
+ import { ActionButton } from "./ActionButton";
5
+ import { SIZE_STYLE } from "./internal/theme";
6
+ // Cancel (this file's own hand-styled button, its "always white" look
7
+ // has no ActionButton variant to match) and Confirm (ActionButton
8
+ // itself) need to line up at the same height regardless of size — same
9
+ // shared table ActionButton/FieldTextInput/AnchoredDropdown's own
10
+ // trigger all use, so this can never quietly drift from what Confirm
11
+ // itself actually renders at.
12
+ const PADDING_V = { small: 4, medium: 6, large: 8 };
13
+ const PADDING_H = { small: 8, medium: 12, large: 16 };
14
+ // A confirmation shown inline, below whatever triggered it — not a modal.
15
+ // Description line + an equal-width Cancel/Confirm pair.
16
+ export const InlineConfirm = ({ description, onCancel, onConfirm, cancelLabel = "Cancel", confirmLabel = "Delete", size = "small", variant = "danger", }) => {
17
+ const cancelCls = `dck-inline-cancel${useId().replace(/[^a-zA-Z0-9]/g, "")}`;
18
+ const { fontSize, minHeight } = SIZE_STYLE[size];
19
+ const buttonStyle = {
20
+ padding: `${PADDING_V[size]}px ${PADDING_H[size]}px`,
21
+ fontSize,
22
+ minHeight,
23
+ boxSizing: "border-box",
24
+ // Reserved even though Cancel never shows a visible border — Confirm
25
+ // (ActionButton itself, variant="danger"/"primary") reserves the
26
+ // same 1px on its own side now, precisely so a border some variants
27
+ // show and others don't never changes how much of the shared
28
+ // minHeight budget either one actually needs.
29
+ border: "1px solid transparent",
30
+ };
31
+ return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8, width: "100%" }, children: [_jsx("style", { children: `
32
+ .${cancelCls} {
33
+ background-color: #fff !important;
34
+ color: #1a1a1a !important;
35
+ }
36
+ ` }), _jsx("span", { style: { fontSize: 11, color: "#aaa" }, children: description }), _jsxs(Focusable, { style: { display: "flex", gap: 8, width: "100%" }, "flow-children": "horizontal", children: [_jsx("div", { style: { flex: 1 }, children: _jsx(DialogButton, { className: cancelCls, onClick: onCancel, style: {
37
+ ...buttonStyle,
38
+ width: "100%",
39
+ display: "flex",
40
+ alignItems: "center",
41
+ justifyContent: "center",
42
+ minWidth: "unset",
43
+ }, children: cancelLabel }) }), _jsx("div", { style: { flex: 1 }, children: _jsx(ActionButton, { variant: variant, size: size, width: "100%", onClick: onConfirm, children: confirmLabel }) })] })] }));
44
+ };