@moi952/decky-ui-kit 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionButton.d.ts +2 -0
- package/dist/ActionButton.js +35 -25
- package/dist/AnchoredDropdown.d.ts +2 -0
- package/dist/AnchoredDropdown.js +7 -5
- package/dist/InfoTable.js +1 -1
- package/dist/InlineConfirm.js +5 -0
- package/dist/MediaRow.d.ts +3 -0
- package/dist/MediaRow.js +3 -3
- package/package.json +1 -1
package/dist/ActionButton.d.ts
CHANGED
|
@@ -7,8 +7,10 @@ export interface ActionButtonProps {
|
|
|
7
7
|
onClick: () => void;
|
|
8
8
|
size?: ComponentSize;
|
|
9
9
|
variant?: "normal" | "bordered" | "danger" | "primary";
|
|
10
|
+
pressed?: boolean;
|
|
10
11
|
width?: string | number;
|
|
11
12
|
disabled?: boolean;
|
|
13
|
+
preferredFocus?: boolean;
|
|
12
14
|
onSecondaryButton?: (evt: GamepadEvt) => void;
|
|
13
15
|
onSecondaryActionDescription?: React.ReactNode;
|
|
14
16
|
onOptionsButton?: (evt: GamepadEvt) => void;
|
package/dist/ActionButton.js
CHANGED
|
@@ -1,55 +1,53 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DialogButton } from "@decky/ui";
|
|
3
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
4
|
const PADDING_V = { small: 4, medium: 6, large: 8 };
|
|
10
5
|
const PADDING_H = { small: 8, medium: 12, large: 16 };
|
|
11
6
|
const SOLID_VARIANT_COLOR = {
|
|
12
7
|
danger: ACCENT_DANGER,
|
|
13
8
|
primary: ACCENT_INFO,
|
|
14
9
|
};
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
// Resting-state color only — pressed's own focus/hover is the same
|
|
11
|
+
// plain white every other button uses (see below).
|
|
12
|
+
const PRESSED_COLOR = {
|
|
13
|
+
normal: "#4a4f57",
|
|
14
|
+
bordered: "#4a4f57",
|
|
15
|
+
primary: "#2f6db8",
|
|
16
|
+
danger: "#a83333",
|
|
17
|
+
};
|
|
18
|
+
export const ActionButton = ({ children, onClick, size = "small", variant = "normal", pressed, width, disabled, preferredFocus, onSecondaryButton, onSecondaryActionDescription, onOptionsButton, onOptionsActionDescription, onMenuButton, onMenuActionDescription, onOKButton, onOKActionDescription, }) => {
|
|
19
|
+
const isPressed = pressed === true;
|
|
21
20
|
const { fontSize, minHeight } = SIZE_STYLE[size];
|
|
22
21
|
const style = {
|
|
23
22
|
padding: `${PADDING_V[size]}px ${PADDING_H[size]}px`,
|
|
24
23
|
fontSize,
|
|
25
24
|
minHeight,
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
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" } : {}),
|
|
25
|
+
// No border, ever — a box-shadow (below) draws the visible ring
|
|
26
|
+
// instead, since a border would resize the button whenever it
|
|
27
|
+
// appears (no fixed width here, buttons size to their content).
|
|
35
28
|
};
|
|
36
|
-
const cls = variant !== "normal" ? `dck-action-btn-${variant}` :
|
|
29
|
+
const cls = [variant !== "normal" ? `dck-action-btn-${variant}` : null, isPressed ? `dck-action-btn-pressed-${variant}` : null]
|
|
30
|
+
.filter(Boolean)
|
|
31
|
+
.join(" ") || undefined;
|
|
32
|
+
// Compound selector so the pressed rule reliably outranks the plain
|
|
33
|
+
// variant rule regardless of style-tag mount order.
|
|
34
|
+
const pressedVariantCls = variant !== "normal" ? `.dck-action-btn-${variant}` : "";
|
|
37
35
|
return (_jsxs(_Fragment, { children: [variant === "bordered" && (_jsx("style", { children: `
|
|
38
36
|
.dck-action-btn-bordered {
|
|
39
37
|
background: rgba(255, 255, 255, 0.08) !important;
|
|
40
|
-
|
|
38
|
+
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18) !important;
|
|
41
39
|
}
|
|
42
40
|
.dck-action-btn-bordered:focus,
|
|
43
41
|
.dck-action-btn-bordered:hover {
|
|
44
42
|
background: #dcdedf !important;
|
|
45
43
|
color: #000 !important;
|
|
46
|
-
|
|
44
|
+
box-shadow: inset 0 0 0 1px #dcdedf !important;
|
|
47
45
|
}
|
|
48
46
|
.dck-action-btn-bordered:disabled,
|
|
49
47
|
.dck-action-btn-bordered[disabled] {
|
|
50
48
|
opacity: 1 !important;
|
|
51
49
|
background: #2a2e35 !important;
|
|
52
|
-
|
|
50
|
+
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15) !important;
|
|
53
51
|
color: #6b7076 !important;
|
|
54
52
|
}
|
|
55
53
|
` })), (variant === "danger" || variant === "primary") && (_jsx("style", { children: `
|
|
@@ -62,6 +60,18 @@ export const ActionButton = ({ children, onClick, size = "small", variant = "nor
|
|
|
62
60
|
background-color: #fff !important;
|
|
63
61
|
color: ${SOLID_VARIANT_COLOR[variant]} !important;
|
|
64
62
|
}
|
|
63
|
+
` })), isPressed && (_jsx("style", { children: `
|
|
64
|
+
.dck-action-btn-pressed-${variant}${pressedVariantCls ? `, ${pressedVariantCls}.dck-action-btn-pressed-${variant}` : ""} {
|
|
65
|
+
background-color: ${PRESSED_COLOR[variant]} !important;
|
|
66
|
+
color: #fff !important;
|
|
67
|
+
}
|
|
68
|
+
.dck-action-btn-pressed-${variant}:focus,
|
|
69
|
+
.dck-action-btn-pressed-${variant}:hover${pressedVariantCls ? `,
|
|
70
|
+
${pressedVariantCls}.dck-action-btn-pressed-${variant}:focus,
|
|
71
|
+
${pressedVariantCls}.dck-action-btn-pressed-${variant}:hover` : ""} {
|
|
72
|
+
background-color: #fff !important;
|
|
73
|
+
color: #111 !important;
|
|
74
|
+
}
|
|
65
75
|
` })), _jsx(DialogButton, { className: cls, style: {
|
|
66
76
|
...style,
|
|
67
77
|
// Without this, sizing is content-box by default (the
|
|
@@ -73,5 +83,5 @@ export const ActionButton = ({ children, onClick, size = "small", variant = "nor
|
|
|
73
83
|
justifyContent: "center",
|
|
74
84
|
width: width ?? "fit-content",
|
|
75
85
|
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 })] }));
|
|
86
|
+
}, onClick: onClick, disabled: disabled, preferredFocus: preferredFocus, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryActionDescription, onOptionsButton: onOptionsButton, onOptionsActionDescription: onOptionsActionDescription, onMenuButton: onMenuButton, onMenuActionDescription: onMenuActionDescription, onOKButton: onOKButton, onOKActionDescription: onOKActionDescription, children: children })] }));
|
|
77
87
|
};
|
|
@@ -9,6 +9,7 @@ export interface AnchoredDropdownProps {
|
|
|
9
9
|
selectedValue: string;
|
|
10
10
|
onChange: (value: string) => void;
|
|
11
11
|
label?: React.ReactNode;
|
|
12
|
+
labelFontSize?: number;
|
|
12
13
|
variant?: "row" | "boxed";
|
|
13
14
|
focusStyle?: "fill" | "outline";
|
|
14
15
|
size?: ComponentSize;
|
|
@@ -27,6 +28,7 @@ export interface AnchoredDropdownProps {
|
|
|
27
28
|
maxVisibleOptions?: number;
|
|
28
29
|
highlightOnFocus?: boolean;
|
|
29
30
|
bottomSeparator?: boolean;
|
|
31
|
+
valueFontSize?: number;
|
|
30
32
|
}
|
|
31
33
|
export declare const AnchoredDropdown: React.FC<AnchoredDropdownProps>;
|
|
32
34
|
export {};
|
package/dist/AnchoredDropdown.js
CHANGED
|
@@ -37,7 +37,7 @@ const toggleCsv = (csv, value, options) => {
|
|
|
37
37
|
.join(",");
|
|
38
38
|
};
|
|
39
39
|
// Native Steam popups reset the panel on close — this is an inline overlay instead.
|
|
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, }) => {
|
|
40
|
+
export const AnchoredDropdown = ({ options, selectedValue, onChange, label, labelFontSize, 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, valueFontSize, }) => {
|
|
41
41
|
// Scoped per instance so sibling dropdowns don't share class names.
|
|
42
42
|
const [uid] = useState(() => `dck-anchored-dd${uidCounter++}`);
|
|
43
43
|
const [expanded, setExpanded] = useState(false);
|
|
@@ -159,7 +159,8 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, label, vari
|
|
|
159
159
|
const optionPadding = OPTION_PADDING[size];
|
|
160
160
|
const optionFontSize = OPTION_FONT_SIZE[size];
|
|
161
161
|
const triggerPadding = `${TRIGGER_PADDING_V[size]}px ${TRIGGER_PADDING_H[size]}px`;
|
|
162
|
-
const { fontSize:
|
|
162
|
+
const { fontSize: sizeFontSize, minHeight: triggerMinHeight } = SIZE_STYLE[size];
|
|
163
|
+
const triggerFontSize = valueFontSize ?? sizeFontSize;
|
|
163
164
|
return (_jsxs("div", { ref: wrapperRef, className: wrapperCls, style: { position: "relative", width: "100%", maxWidth: "100%", boxSizing: "border-box" }, children: [_jsx("style", { children: `
|
|
164
165
|
.${optionCls} {
|
|
165
166
|
box-sizing: border-box !important;
|
|
@@ -185,7 +186,7 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, label, vari
|
|
|
185
186
|
align-items: center !important;
|
|
186
187
|
gap: 8px !important;
|
|
187
188
|
padding: ${triggerPadding} !important;
|
|
188
|
-
font-size: ${triggerFontSize} !important;
|
|
189
|
+
font-size: ${triggerFontSize}px !important;
|
|
189
190
|
min-height: ${triggerMinHeight}px !important;
|
|
190
191
|
background: ${bgColor} !important;
|
|
191
192
|
border: 1px solid ${borderColor} !important;
|
|
@@ -248,9 +249,10 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, label, vari
|
|
|
248
249
|
}
|
|
249
250
|
`}
|
|
250
251
|
` }), (() => {
|
|
252
|
+
const styledLabel = label && labelFontSize !== undefined ? (_jsx("span", { style: { fontSize: labelFontSize }, children: label })) : (label);
|
|
251
253
|
const countNode = multiple && selectedCountLabel && selectedValues.length > 0 ? (_jsx("div", { className: countCls, children: selectedCountLabel(selectedValues.length) })) : null;
|
|
252
254
|
if (variant === "boxed") {
|
|
253
|
-
return (_jsx(Field, { focusable: true, label:
|
|
255
|
+
return (_jsx(Field, { focusable: true, label: styledLabel,
|
|
254
256
|
// Field's own default isn't "label sits above the
|
|
255
257
|
// control" — explicit here so a caller-supplied label
|
|
256
258
|
// renders on top, the same convention FieldTextInput's own
|
|
@@ -259,7 +261,7 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, label, vari
|
|
|
259
261
|
triggerRef.current = el;
|
|
260
262
|
}, children: [_jsx("span", { className: triggerLabelCls, style: labelMaxWidth !== undefined ? { maxWidth: labelMaxWidth } : undefined, children: displayLabel }), _jsx(FaChevronDown, { size: 12, style: { flexShrink: 0 } })] })] }) }));
|
|
261
263
|
}
|
|
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: [
|
|
264
|
+
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: [styledLabel, countNode, displayLabel] })) : (displayLabel), childrenLayout: "inline", ref: (el) => {
|
|
263
265
|
triggerRef.current = el;
|
|
264
266
|
}, children: expanded ? _jsx(FaChevronDown, { size: 12 }) : _jsx(FaChevronRight, { size: 12 }) }));
|
|
265
267
|
})(), expanded && blurBackground && (_jsx("div", { onClick: closeList, style: {
|
package/dist/InfoTable.js
CHANGED
|
@@ -17,8 +17,8 @@ const InfoTableRowView = ({ icon, label, value, accent, last, labelWidth, labelC
|
|
|
17
17
|
color: accent ?? valueColor,
|
|
18
18
|
marginLeft: "auto",
|
|
19
19
|
textAlign: "right",
|
|
20
|
+
// No wordBreak: break-all — it split ordinary words mid-word.
|
|
20
21
|
overflowWrap: "anywhere",
|
|
21
|
-
wordBreak: "break-all",
|
|
22
22
|
}, children: value })] }));
|
|
23
23
|
// A bordered, rounded key/value table — icon, short label, value
|
|
24
24
|
// right-aligned. Purely presentational: what each row means (an app's
|
package/dist/InlineConfirm.js
CHANGED
|
@@ -33,6 +33,11 @@ export const InlineConfirm = ({ description, onCancel, onConfirm, cancelLabel =
|
|
|
33
33
|
background-color: #fff !important;
|
|
34
34
|
color: #1a1a1a !important;
|
|
35
35
|
}
|
|
36
|
+
.${cancelCls}:focus,
|
|
37
|
+
.${cancelCls}:hover {
|
|
38
|
+
background-color: #b8bcbf !important;
|
|
39
|
+
color: #1a1a1a !important;
|
|
40
|
+
}
|
|
36
41
|
` }), _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
42
|
...buttonStyle,
|
|
38
43
|
width: "100%",
|
package/dist/MediaRow.d.ts
CHANGED
|
@@ -24,5 +24,8 @@ export interface MediaRowProps {
|
|
|
24
24
|
bottomSeparator?: boolean;
|
|
25
25
|
onSecondaryButton?: (evt: GamepadEvent) => void;
|
|
26
26
|
onSecondaryActionDescription?: React.ReactNode;
|
|
27
|
+
onOptionsButton?: (evt: GamepadEvent) => void;
|
|
28
|
+
onOptionsActionDescription?: React.ReactNode;
|
|
29
|
+
onOKActionDescription?: React.ReactNode;
|
|
27
30
|
}
|
|
28
31
|
export declare const MediaRow: React.FC<MediaRowProps>;
|
package/dist/MediaRow.js
CHANGED
|
@@ -40,7 +40,7 @@ export const MediaRow = ({ media, mediaWidth = 32, mediaLayout = "fixed", mediaH
|
|
|
40
40
|
// changed every existing mediaLayout="stretch" caller's look (e.g.
|
|
41
41
|
// decky-proton-launch's own GameRow cover art) the moment they upgraded
|
|
42
42
|
// — this keeps that exact prior look until a caller opts in.
|
|
43
|
-
mediaAlign = mediaLayout === "stretch" ? "top" : "center", title, titleLines = 1, details, onPress, actions, collapsedByDefault = false, color, accentBorderColor, accentBorderWidth = 2, accentBackground, highlightOnFocus = true, borderOnFocus = true, highlightColor = DEFAULT_HIGHLIGHT_COLOR, highlightBackground = DEFAULT_HIGHLIGHT_BACKGROUND, spacing = 0, bottomSeparator = false, onSecondaryButton, onSecondaryActionDescription, }) => {
|
|
43
|
+
mediaAlign = mediaLayout === "stretch" ? "top" : "center", title, titleLines = 1, details, onPress, actions, collapsedByDefault = false, color, accentBorderColor, accentBorderWidth = 2, accentBackground, highlightOnFocus = true, borderOnFocus = true, highlightColor = DEFAULT_HIGHLIGHT_COLOR, highlightBackground = DEFAULT_HIGHLIGHT_BACKGROUND, spacing = 0, bottomSeparator = false, onSecondaryButton, onSecondaryActionDescription, onOptionsButton, onOptionsActionDescription, onOKActionDescription, }) => {
|
|
44
44
|
const { cls, styleTag } = useFocusHighlightClass("dck-media-row", {
|
|
45
45
|
highlightOnFocus,
|
|
46
46
|
borderOnFocus,
|
|
@@ -146,7 +146,7 @@ mediaAlign = mediaLayout === "stretch" ? "top" : "center", title, titleLines = 1
|
|
|
146
146
|
// open" capsule (e.g. a game cover) had before this became a shared
|
|
147
147
|
// component. Only an actions row (below) needs something to wrap.
|
|
148
148
|
if (!hasActions) {
|
|
149
|
-
return (_jsxs(_Fragment, { children: [highlightStyle, _jsxs(DialogButton, { className: cls, onClick: handleClick, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryActionDescription, style: {
|
|
149
|
+
return (_jsxs(_Fragment, { children: [highlightStyle, _jsxs(DialogButton, { className: cls, onClick: handleClick, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryActionDescription, onOptionsButton: onOptionsButton, onOptionsActionDescription: onOptionsActionDescription, onOKActionDescription: onOKActionDescription, style: {
|
|
150
150
|
...cardStyle,
|
|
151
151
|
width: "100%",
|
|
152
152
|
boxSizing: "border-box",
|
|
@@ -156,7 +156,7 @@ mediaAlign = mediaLayout === "stretch" ? "top" : "center", title, titleLines = 1
|
|
|
156
156
|
padding: stretch ? 0 : "4px 8px",
|
|
157
157
|
}, children: [mediaBox, textBox] }), bottomSeparator && _jsx(Separator, { marginTop: 1 })] }));
|
|
158
158
|
}
|
|
159
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: cls, style: { width: "100%", boxSizing: "border-box", ...cardStyle }, children: [highlightStyle, _jsxs(DialogButton, { onClick: handleClick, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryActionDescription, style: {
|
|
159
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: cls, style: { width: "100%", boxSizing: "border-box", ...cardStyle }, children: [highlightStyle, _jsxs(DialogButton, { onClick: handleClick, onSecondaryButton: onSecondaryButton, onSecondaryActionDescription: onSecondaryActionDescription, onOptionsButton: onOptionsButton, onOptionsActionDescription: onOptionsActionDescription, onOKActionDescription: onOKActionDescription, style: {
|
|
160
160
|
width: "100%",
|
|
161
161
|
boxSizing: "border-box",
|
|
162
162
|
display: "flex",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moi952/decky-ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Reusable UI components for Decky Loader plugins that need popups/dropdowns without triggering the native panel-remount bug",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|