@moi952/decky-ui-kit 0.3.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 +139 -0
- package/dist/ActionButton.d.ts +22 -0
- package/dist/ActionButton.js +77 -0
- package/dist/AnchoredDropdown.d.ts +3 -1
- package/dist/AnchoredDropdown.js +34 -14
- package/dist/CollapsibleSection.d.ts +1 -0
- package/dist/CollapsibleSection.js +2 -1
- package/dist/FieldTextInput.d.ts +2 -1
- package/dist/FieldTextInput.js +19 -5
- package/dist/InfoTable.d.ts +17 -0
- package/dist/InfoTable.js +34 -0
- package/dist/InlineConfirm.d.ts +2 -1
- package/dist/InlineConfirm.js +28 -28
- package/dist/MediaRow.d.ts +27 -0
- package/dist/MediaRow.js +153 -0
- package/dist/ScreenshotCarousel.d.ts +14 -0
- package/dist/ScreenshotCarousel.js +149 -0
- package/dist/StatusCard.d.ts +9 -0
- package/dist/StatusCard.js +45 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +5 -0
- package/dist/internal/Separator.d.ts +7 -0
- package/dist/internal/Separator.js +15 -0
- package/dist/internal/focusHighlight.d.ts +16 -0
- package/dist/internal/focusHighlight.js +57 -0
- package/dist/internal/theme.d.ts +23 -0
- package/dist/internal/theme.js +73 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,6 +130,52 @@ import { FieldTextInput } from "@moi952/decky-ui-kit";
|
|
|
130
130
|
|
|
131
131
|
</details>
|
|
132
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
|
+
|
|
133
179
|
### `InlineConfirm`
|
|
134
180
|
|
|
135
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.
|
|
@@ -161,3 +207,96 @@ import { InlineConfirm } from "@moi952/decky-ui-kit";
|
|
|
161
207
|
| `variant` | `"danger" \| "primary"` | `"danger"` | Red confirm button for a destructive action, or blue for a plain confirm. |
|
|
162
208
|
|
|
163
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. |
|
|
301
|
+
|
|
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?:
|
|
14
|
+
size?: ComponentSize;
|
|
13
15
|
bgColor?: string;
|
|
14
16
|
textColor?: string;
|
|
15
17
|
borderColor?: string;
|
package/dist/AnchoredDropdown.js
CHANGED
|
@@ -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
|
-
|
|
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 = "
|
|
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
|
|
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
|
|
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
|
|
144
|
-
const optionFontSize = size
|
|
145
|
-
const
|
|
146
|
-
const
|
|
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:
|
|
167
|
-
max-width:
|
|
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,
|
|
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: {
|
|
@@ -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}` } }))] }));
|
package/dist/FieldTextInput.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
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?:
|
|
7
|
+
size?: ComponentSize;
|
|
7
8
|
mustBeNumeric?: boolean;
|
|
8
9
|
bottomSeparator?: boolean;
|
|
9
10
|
highlightOnFocus?: boolean;
|
package/dist/FieldTextInput.js
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
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 = "
|
|
5
|
-
const
|
|
6
|
-
|
|
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];
|
|
7
15
|
// Fixed regardless of size, so icon margins stay identical in both.
|
|
8
16
|
const iconSlot = 30;
|
|
9
|
-
const fontSize = size === "small" ? 12 : 14;
|
|
10
17
|
const input = (_jsxs("div", { style: { position: "relative", width: "100%" }, children: [_jsx(TextField, { mustBeNumeric: mustBeNumeric, value: value, onChange: (e) => onChange(e.target.value), style: {
|
|
11
18
|
fontSize,
|
|
12
19
|
width: "100%",
|
|
13
20
|
boxSizing: "border-box",
|
|
14
|
-
|
|
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,
|
|
15
29
|
} }), !value && placeholder && (_jsx("span", { style: {
|
|
16
30
|
position: "absolute",
|
|
17
31
|
left: iconStart ? iconSlot : padH,
|
|
@@ -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))) }));
|
package/dist/InlineConfirm.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { ComponentSize } from "./internal/theme";
|
|
2
3
|
export interface InlineConfirmProps {
|
|
3
4
|
description: React.ReactNode;
|
|
4
5
|
onCancel: () => void;
|
|
5
6
|
onConfirm: () => void;
|
|
6
7
|
cancelLabel?: React.ReactNode;
|
|
7
8
|
confirmLabel?: React.ReactNode;
|
|
8
|
-
size?:
|
|
9
|
+
size?: ComponentSize;
|
|
9
10
|
variant?: "danger" | "primary";
|
|
10
11
|
}
|
|
11
12
|
export declare const InlineConfirm: React.FC<InlineConfirmProps>;
|
package/dist/InlineConfirm.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
3
|
import { DialogButton, Focusable } from "@decky/ui";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
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 };
|
|
13
14
|
// A confirmation shown inline, below whatever triggered it — not a modal.
|
|
14
15
|
// Description line + an equal-width Cancel/Confirm pair.
|
|
15
16
|
export const InlineConfirm = ({ description, onCancel, onConfirm, cancelLabel = "Cancel", confirmLabel = "Delete", size = "small", variant = "danger", }) => {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
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
|
+
};
|
|
19
31
|
return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8, width: "100%" }, children: [_jsx("style", { children: `
|
|
20
|
-
.${
|
|
21
|
-
background-color: ${color} !important;
|
|
22
|
-
color: #fff !important;
|
|
23
|
-
}
|
|
24
|
-
.${confirmCls}:focus,
|
|
25
|
-
.${confirmCls}:hover {
|
|
32
|
+
.${cancelCls} {
|
|
26
33
|
background-color: #fff !important;
|
|
27
|
-
color:
|
|
34
|
+
color: #1a1a1a !important;
|
|
28
35
|
}
|
|
29
|
-
` }), _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, { onClick: onCancel, style: {
|
|
30
|
-
...buttonStyle,
|
|
31
|
-
width: "100%",
|
|
32
|
-
display: "flex",
|
|
33
|
-
alignItems: "center",
|
|
34
|
-
justifyContent: "center",
|
|
35
|
-
minWidth: "unset",
|
|
36
|
-
}, children: cancelLabel }) }), _jsx("div", { style: { flex: 1 }, children: _jsx(DialogButton, { className: confirmCls, onClick: onConfirm, style: {
|
|
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
37
|
...buttonStyle,
|
|
38
38
|
width: "100%",
|
|
39
39
|
display: "flex",
|
|
40
40
|
alignItems: "center",
|
|
41
41
|
justifyContent: "center",
|
|
42
42
|
minWidth: "unset",
|
|
43
|
-
}, children: confirmLabel }) })] })] }));
|
|
43
|
+
}, children: cancelLabel }) }), _jsx("div", { style: { flex: 1 }, children: _jsx(ActionButton, { variant: variant, size: size, width: "100%", onClick: onConfirm, children: confirmLabel }) })] })] }));
|
|
44
44
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { GamepadEvent } from "@decky/ui";
|
|
3
|
+
export interface MediaRowProps {
|
|
4
|
+
media?: React.ReactNode;
|
|
5
|
+
mediaWidth?: number;
|
|
6
|
+
mediaLayout?: "fixed" | "stretch";
|
|
7
|
+
mediaHeight?: number;
|
|
8
|
+
title: React.ReactNode;
|
|
9
|
+
titleLines?: number;
|
|
10
|
+
details?: React.ReactNode;
|
|
11
|
+
onPress?: () => void;
|
|
12
|
+
actions?: React.ReactNode;
|
|
13
|
+
collapsedByDefault?: boolean;
|
|
14
|
+
color: "light" | "dark" | "transparent" | "success" | "danger" | "info" | "warning";
|
|
15
|
+
accentBorderColor?: string;
|
|
16
|
+
accentBorderWidth?: number;
|
|
17
|
+
accentBackground?: string;
|
|
18
|
+
highlightOnFocus?: boolean;
|
|
19
|
+
borderOnFocus?: boolean;
|
|
20
|
+
highlightColor?: string;
|
|
21
|
+
highlightBackground?: string;
|
|
22
|
+
spacing?: number;
|
|
23
|
+
bottomSeparator?: boolean;
|
|
24
|
+
onSecondaryButton?: (evt: GamepadEvent) => void;
|
|
25
|
+
onSecondaryActionDescription?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export declare const MediaRow: React.FC<MediaRowProps>;
|