@moi952/decky-ui-kit 0.1.1 → 0.3.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
@@ -62,8 +62,14 @@ import { AnchoredDropdown } from "@moi952/decky-ui-kit";
62
62
  | `borderColor` | `string` | `"transparent"` | Trigger and list border color. |
63
63
  | `blurBackground` | `boolean` | `true` | Blurs the panel behind the list while it's open. |
64
64
  | `multiple` | `boolean` | `false` | Multi-select mode (comma-joined value). |
65
- | `maxDisplayLines` | `number` | `1` | Lines the trigger's selected-value summary can wrap before clipping. |
66
- | `maxVisibleOptions` | `number` | — | Rows visible before the list scrolls. Defaults to a fixed max height. |
65
+ | `selectedValuesLayout` | `"inline" \| "stacked"` | `"inline"` | Multi-select summary as one comma-joined line, or one value per line. |
66
+ | `selectedCountLabel` | `(count: number) => ReactNode` | — | Multi-select only: small caption above the trigger once ≥1 option is picked (e.g. `n => \`${n} selected\``). No i18n of its own — the caller formats the text. |
67
+ | `onSecondaryButton` | `() => void` | — | Fires on gamepad X / Steam "Secondary" while the trigger or open list has focus. |
68
+ | `onSecondaryActionDescription` | `ReactNode` | — | Shown in Steam's own bottom action-legend bar next to the X prompt (only while `onSecondaryButton` is set). Same names/shape as `@decky/ui`'s own `FooterLegendProps`. |
69
+ | `onOptionsButton` | `() => void` | — | Fires on gamepad Y / Steam "Options" while the trigger or open list has focus. |
70
+ | `onOptionsActionDescription` | `ReactNode` | — | Shown in Steam's own bottom action-legend bar next to the Y prompt (only while `onOptionsButton` is set). |
71
+ | `maxDisplayLines` | `number` | `1` | Lines the trigger's selected-value summary can wrap before clipping. `0` shows it in full, unclamped. |
72
+ | `maxVisibleOptions` | `number` | — | Rows visible before the list scrolls. `0` shows every option, no cap. Defaults to a fixed max height. |
67
73
  | `highlightOnFocus` | `boolean` | `true` | Native Steam focus highlight band, themeable via CSS Loader. |
68
74
  | `bottomSeparator` | `boolean` | `true` | Native Steam separator line below the trigger. |
69
75
 
@@ -94,3 +100,64 @@ import { CollapsibleSection } from "@moi952/decky-ui-kit";
94
100
  | `children` | `ReactNode` | — | Rendered below the header while `expanded` is `true`. |
95
101
 
96
102
  </details>
103
+
104
+ ### `FieldTextInput`
105
+
106
+ A text input with the standard Field row look (bottom separator, focus highlight, size) — `@decky/ui`'s own `TextField` doesn't extend the same row contract `ToggleField`/`SliderField` do, so it renders bare by default.
107
+
108
+ ```tsx
109
+ import { FieldTextInput } from "@moi952/decky-ui-kit";
110
+
111
+ <FieldTextInput label="Frame Rate Limit" mustBeNumeric value={value} onChange={setValue} />
112
+ ```
113
+
114
+ <details>
115
+ <summary>Props</summary>
116
+
117
+ | Prop | Type | Default | Description |
118
+ | --- | --- | --- | --- |
119
+ | `value` | `string` | — | Current value. |
120
+ | `onChange` | `(value: string) => void` | — | Called with the new value on every keystroke. |
121
+ | `label` | `ReactNode` | — | Label text/content. |
122
+ | `size` | `"default" \| "small"` | `"default"` | Input font size and padding. |
123
+ | `labelPosition` | `"top" \| "left" \| "right"` | `"top"` | Where the label sits relative to the input. |
124
+ | `mustBeNumeric` | `boolean` | `false` | Restricts input to numeric characters. |
125
+ | `bottomSeparator` | `boolean` | `true` | Native Steam separator line below the row. |
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
+ ### `InlineConfirm`
134
+
135
+ 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.
136
+
137
+ ```tsx
138
+ import { InlineConfirm } from "@moi952/decky-ui-kit";
139
+
140
+ {confirming && (
141
+ <InlineConfirm
142
+ description="Remove the wrapper from this game?"
143
+ confirmLabel="Remove"
144
+ onCancel={() => setConfirming(false)}
145
+ onConfirm={() => { removeWrapper(); setConfirming(false); }}
146
+ />
147
+ )}
148
+ ```
149
+
150
+ <details>
151
+ <summary>Props</summary>
152
+
153
+ | Prop | Type | Default | Description |
154
+ | --- | --- | --- | --- |
155
+ | `description` | `ReactNode` | — | The confirmation message. |
156
+ | `onCancel` | `() => void` | — | Called when Cancel is picked. |
157
+ | `onConfirm` | `() => void` | — | Called when the confirm button is picked. |
158
+ | `cancelLabel` | `ReactNode` | `"Cancel"` | Cancel button text. |
159
+ | `confirmLabel` | `ReactNode` | `"Delete"` | Confirm button text. |
160
+ | `size` | `"small" \| "medium" \| "large"` | `"small"` | Button padding/font size. |
161
+ | `variant` | `"danger" \| "primary"` | `"danger"` | Red confirm button for a destructive action, or blue for a plain confirm. |
162
+
163
+ </details>
@@ -15,6 +15,12 @@ export interface AnchoredDropdownProps {
15
15
  borderColor?: string;
16
16
  blurBackground?: boolean;
17
17
  multiple?: boolean;
18
+ selectedValuesLayout?: "inline" | "stacked";
19
+ selectedCountLabel?: (count: number) => React.ReactNode;
20
+ onSecondaryButton?: () => void;
21
+ onSecondaryActionDescription?: React.ReactNode;
22
+ onOptionsButton?: () => void;
23
+ onOptionsActionDescription?: React.ReactNode;
18
24
  maxDisplayLines?: number;
19
25
  maxVisibleOptions?: number;
20
26
  highlightOnFocus?: boolean;
@@ -6,9 +6,7 @@ const DEFAULT_BG = "#35373c";
6
6
  const DEFAULT_TEXT = "#bfbfbf";
7
7
  const DEFAULT_BORDER = "transparent";
8
8
  const FALLBACK_RADIUS = "6px";
9
- // Shared across every instance so a "row" dropdown reuses the real native
10
- // radius a "boxed" one already measured, instead of measuring its own
11
- // differently-shaped native element (Field vs DialogButton).
9
+ // Shared across instances so "row" reuses a "boxed" one's measured radius.
12
10
  let sharedBoxedRadius = null;
13
11
  let uidCounter = 0;
14
12
  const splitCsv = (value) => value.split(",").map((v) => v.trim()).filter(Boolean);
@@ -22,9 +20,8 @@ const toggleCsv = (csv, value, options) => {
22
20
  .map((o) => o.value)
23
21
  .join(",");
24
22
  };
25
- // Native Steam popups reset the whole plugin panel on close — this renders
26
- // an inline overlay anchored to its own trigger instead.
27
- 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, maxDisplayLines = 1, maxVisibleOptions, highlightOnFocus = true, bottomSeparator = true, }) => {
23
+ // 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, }) => {
28
25
  // Scoped per instance so sibling dropdowns don't share class names.
29
26
  const [uid] = useState(() => `dck-anchored-dd${uidCounter++}`);
30
27
  const [expanded, setExpanded] = useState(false);
@@ -35,9 +32,7 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
35
32
  const [openUp, setOpenUp] = useState(false);
36
33
  // Mirrors the trigger's real computed radius instead of a guessed CSS var.
37
34
  const [listRadius, setListRadius] = useState(FALLBACK_RADIUS);
38
- // text-overflow only works against a real pixel width — CSS alone (flex
39
- // shrink, % width) proved unreliable through Field's own layout, so this
40
- // measures the trigger's actual rendered width instead of guessing it.
35
+ // CSS-only truncation proved unreliable through Field's layout — measure instead.
41
36
  const [labelMaxWidth, setLabelMaxWidth] = useState(undefined);
42
37
  useLayoutEffect(() => {
43
38
  if (variant !== "boxed" || !triggerRef.current)
@@ -47,9 +42,14 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
47
42
  const overhead = horizontalPadding * 2 + 12 + 8;
48
43
  const measure = () => setLabelMaxWidth(Math.max(0, el.clientWidth - overhead));
49
44
  measure();
45
+ // One more pass next frame — a remount can measure before the panel settles.
46
+ const raf = requestAnimationFrame(measure);
50
47
  const ro = new ResizeObserver(measure);
51
48
  ro.observe(el);
52
- return () => ro.disconnect();
49
+ return () => {
50
+ cancelAnimationFrame(raf);
51
+ ro.disconnect();
52
+ };
53
53
  }, [variant, size]);
54
54
  useEffect(() => {
55
55
  if (variant === "boxed" && triggerRef.current) {
@@ -68,7 +68,7 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
68
68
  const displayLabel = multiple
69
69
  ? selectedValues
70
70
  .map((v) => options.find((o) => o.value === v)?.label ?? v)
71
- .join(", ") || selectedValue
71
+ .join(selectedValuesLayout === "stacked" ? "\n" : ", ") || selectedValue
72
72
  : singleSelected?.label ?? selectedValue;
73
73
  useEffect(() => {
74
74
  if (!expanded)
@@ -95,8 +95,7 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
95
95
  closeList();
96
96
  }
97
97
  };
98
- // Steam's focus engine picks by screen geometry — handle DIR_UP/DOWN
99
- // ourselves to stay inside the list.
98
+ // Steam's focus engine picks by geometry — handle DIR_UP/DOWN ourselves.
100
99
  const handleListButtonDown = (evt) => {
101
100
  if (evt.detail.button === GamepadButton.DIR_DOWN) {
102
101
  evt.stopPropagation();
@@ -110,13 +109,19 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
110
109
  evt.stopPropagation();
111
110
  closeList();
112
111
  }
112
+ else if (evt.detail.button === GamepadButton.SECONDARY && onSecondaryButton) {
113
+ evt.stopPropagation();
114
+ onSecondaryButton();
115
+ }
116
+ else if (evt.detail.button === GamepadButton.OPTIONS && onOptionsButton) {
117
+ evt.stopPropagation();
118
+ onOptionsButton();
119
+ }
113
120
  };
114
- // Padding + font line-height + the option's own 2px top/bottom border
115
- // (previously missing from this estimate, clipping the last visible row).
121
+ // Padding + line-height + the option's 2px border.
116
122
  const rowHeight = size === "small" ? 26 : 42;
117
- const listMaxHeight = maxVisibleOptions
118
- ? maxVisibleOptions * (rowHeight + 2)
119
- : 220;
123
+ // 0 means "show every option, no scroll cap".
124
+ const listMaxHeight = maxVisibleOptions === 0 ? undefined : maxVisibleOptions ? maxVisibleOptions * (rowHeight + 2) : 220;
120
125
  const toggle = () => {
121
126
  setExpanded((prev) => {
122
127
  const next = !prev;
@@ -124,7 +129,7 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
124
129
  const r = wrapperRef.current.getBoundingClientRect();
125
130
  const spaceBelow = window.innerHeight - r.bottom;
126
131
  const spaceAbove = r.top;
127
- setOpenUp(spaceBelow < listMaxHeight && spaceAbove > spaceBelow);
132
+ setOpenUp(spaceBelow < (listMaxHeight ?? Infinity) && spaceAbove > spaceBelow);
128
133
  }
129
134
  return next;
130
135
  });
@@ -133,10 +138,12 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
133
138
  const selectedCls = `${uid}-selected`;
134
139
  const triggerCls = `${uid}-trigger`;
135
140
  const triggerLabelCls = `${uid}-trigger-label`;
141
+ const countCls = `${uid}-count`;
136
142
  const wrapperCls = `${uid}-wrapper`;
137
143
  const optionPadding = size === "small" ? "4px 8px" : "10px 14px";
138
144
  const optionFontSize = size === "small" ? "11px" : "14px";
139
- const triggerPadding = size === "small" ? "6px 10px" : "10px 14px";
145
+ const triggerPaddingH = size === "small" ? "10px" : "14px";
146
+ const triggerPadding = size === "small" ? `6px ${triggerPaddingH}` : `10px ${triggerPaddingH}`;
140
147
  const triggerFontSize = size === "small" ? "12px" : "15px";
141
148
  return (_jsxs("div", { ref: wrapperRef, className: wrapperCls, style: { position: "relative", width: "100%", maxWidth: "100%", boxSizing: "border-box" }, children: [_jsx("style", { children: `
142
149
  .${optionCls} {
@@ -168,13 +175,25 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
168
175
  background: ${bgColor} !important;
169
176
  border: 1px solid ${borderColor} !important;
170
177
  color: ${textColor} !important;
178
+ overflow: hidden !important;
179
+ }
180
+ .${countCls} {
181
+ font-size: 11px !important;
182
+ opacity: 0.75 !important;
183
+ text-align: left !important;
184
+ color: ${textColor} !important;
171
185
  }
172
186
  .${triggerLabelCls} {
187
+ ${maxDisplayLines > 0
188
+ ? `
173
189
  display: -webkit-box !important;
174
190
  -webkit-box-orient: vertical !important;
175
191
  -webkit-line-clamp: ${maxDisplayLines} !important;
176
192
  overflow: hidden !important;
177
193
  text-overflow: ellipsis !important;
194
+ `
195
+ : ""}
196
+ ${selectedValuesLayout === "stacked" ? "white-space: pre-line !important;" : ""}
178
197
  text-align: left !important;
179
198
  flex: 1 !important;
180
199
  min-width: 0 !important;
@@ -213,11 +232,17 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
213
232
  color: #111 !important;
214
233
  }
215
234
  `}
216
- ` }), variant === "boxed" ? (_jsx(Field, { focusable: true, highlightOnFocus: highlightOnFocus, bottomSeparator: bottomSeparator ? "standard" : "none", childrenContainerWidth: "max", onActivate: toggle, onClick: toggle, children: _jsxs(DialogButton, { className: triggerCls, ref: (el) => {
235
+ ` }), (() => {
236
+ const countNode = multiple && selectedCountLabel && selectedValues.length > 0 ? (_jsx("div", { className: countCls, children: selectedCountLabel(selectedValues.length) })) : null;
237
+ 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) => {
239
+ triggerRef.current = el;
240
+ }, children: [_jsx("span", { className: triggerLabelCls, style: labelMaxWidth !== undefined ? { maxWidth: labelMaxWidth } : undefined, children: displayLabel }), _jsx(FaChevronDown, { size: 12, style: { flexShrink: 0 } })] })] }) }));
241
+ }
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) => {
217
243
  triggerRef.current = el;
218
- }, children: [_jsx("span", { className: triggerLabelCls, style: labelMaxWidth !== undefined ? { maxWidth: labelMaxWidth } : undefined, children: displayLabel }), _jsx(FaChevronDown, { size: 12, style: { flexShrink: 0 } })] }) })) : (_jsx(Field, { focusable: true, highlightOnFocus: highlightOnFocus, bottomSeparator: bottomSeparator ? "standard" : "none", onActivate: toggle, onClick: toggle, label: displayLabel, childrenLayout: "inline", ref: (el) => {
219
- triggerRef.current = el;
220
- }, children: expanded ? _jsx(FaChevronDown, { size: 12 }) : _jsx(FaChevronRight, { size: 12 }) })), expanded && blurBackground && (_jsx("div", { onClick: closeList, style: {
244
+ }, children: expanded ? _jsx(FaChevronDown, { size: 12 }) : _jsx(FaChevronRight, { size: 12 }) }));
245
+ })(), expanded && blurBackground && (_jsx("div", { onClick: closeList, style: {
221
246
  position: "fixed",
222
247
  inset: 0,
223
248
  zIndex: 49,
@@ -225,9 +250,7 @@ export const AnchoredDropdown = ({ options, selectedValue, onChange, variant = "
225
250
  backdropFilter: "blur(6px)",
226
251
  WebkitBackdropFilter: "blur(6px)",
227
252
  } })), expanded && (
228
- // This div owns the rounded/clipped box; Focusable inside only
229
- // handles scrolling and gamepad focus (it's a native Steam module,
230
- // its own classes can beat an inline style).
253
+ // This div clips/rounds; Focusable inside only handles scroll + gamepad focus.
231
254
  _jsx("div", { style: {
232
255
  boxSizing: "border-box",
233
256
  position: "absolute",
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ export interface FieldTextInputProps {
3
+ label?: React.ReactNode;
4
+ value: string;
5
+ onChange: (value: string) => void;
6
+ size?: "default" | "small";
7
+ mustBeNumeric?: boolean;
8
+ bottomSeparator?: boolean;
9
+ highlightOnFocus?: boolean;
10
+ labelPosition?: "top" | "left" | "right";
11
+ placeholder?: string;
12
+ iconStart?: React.ReactNode;
13
+ iconEnd?: React.ReactNode;
14
+ }
15
+ export declare const FieldTextInput: React.FC<FieldTextInputProps>;
@@ -0,0 +1,49 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Field, TextField } from "@decky/ui";
3
+ // 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", placeholder, iconStart, iconEnd, }) => {
5
+ const padV = size === "small" ? 6 : 10;
6
+ const padH = size === "small" ? 8 : 12;
7
+ // Fixed regardless of size, so icon margins stay identical in both.
8
+ const iconSlot = 30;
9
+ const fontSize = size === "small" ? 12 : 14;
10
+ const input = (_jsxs("div", { style: { position: "relative", width: "100%" }, children: [_jsx(TextField, { mustBeNumeric: mustBeNumeric, value: value, onChange: (e) => onChange(e.target.value), style: {
11
+ fontSize,
12
+ width: "100%",
13
+ boxSizing: "border-box",
14
+ padding: `${padV}px ${iconEnd ? iconSlot : padH}px ${padV}px ${iconStart ? iconSlot : padH}px`,
15
+ } }), !value && placeholder && (_jsx("span", { style: {
16
+ position: "absolute",
17
+ left: iconStart ? iconSlot : padH,
18
+ top: "50%",
19
+ transform: "translateY(-50%)",
20
+ fontSize,
21
+ color: "rgba(255, 255, 255, 0.4)",
22
+ pointerEvents: "none",
23
+ whiteSpace: "nowrap",
24
+ overflow: "hidden",
25
+ textOverflow: "ellipsis",
26
+ maxWidth: `calc(100% - ${(iconStart ? iconSlot : padH) + (iconEnd ? iconSlot : padH)}px)`,
27
+ }, children: placeholder })), iconStart && (_jsx("span", { style: {
28
+ position: "absolute",
29
+ left: (iconSlot - 16) / 2,
30
+ top: "50%",
31
+ transform: "translateY(-50%)",
32
+ display: "flex",
33
+ pointerEvents: "none",
34
+ }, children: iconStart })), iconEnd && (_jsx("span", { style: {
35
+ position: "absolute",
36
+ right: (iconSlot - 16) / 2,
37
+ top: "50%",
38
+ transform: "translateY(-50%)",
39
+ display: "flex",
40
+ pointerEvents: "none",
41
+ }, children: iconEnd }))] }));
42
+ 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: {
43
+ display: "flex",
44
+ alignItems: "center",
45
+ justifyContent: "space-between",
46
+ gap: 12,
47
+ width: "100%",
48
+ }, children: [input, label] })) : (input) }));
49
+ };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ export interface InlineConfirmProps {
3
+ description: React.ReactNode;
4
+ onCancel: () => void;
5
+ onConfirm: () => void;
6
+ cancelLabel?: React.ReactNode;
7
+ confirmLabel?: React.ReactNode;
8
+ size?: "small" | "medium" | "large";
9
+ variant?: "danger" | "primary";
10
+ }
11
+ 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
+ const SIZE_STYLE = {
5
+ small: { padding: "4px 8px", fontSize: 12, minHeight: 28 },
6
+ medium: { padding: "6px 12px", fontSize: 14, minHeight: 32 },
7
+ large: { padding: "8px 16px", fontSize: 16, minHeight: 36 },
8
+ };
9
+ const VARIANT_COLOR = {
10
+ danger: "#ef4444",
11
+ primary: "#3b82f6",
12
+ };
13
+ // A confirmation shown inline, below whatever triggered it — not a modal.
14
+ // Description line + an equal-width Cancel/Confirm pair.
15
+ export const InlineConfirm = ({ description, onCancel, onConfirm, cancelLabel = "Cancel", confirmLabel = "Delete", size = "small", variant = "danger", }) => {
16
+ const confirmCls = `dck-inline-confirm${useId().replace(/[^a-zA-Z0-9]/g, "")}`;
17
+ const buttonStyle = SIZE_STYLE[size];
18
+ const color = VARIANT_COLOR[variant];
19
+ return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8, width: "100%" }, children: [_jsx("style", { children: `
20
+ .${confirmCls} {
21
+ background-color: ${color} !important;
22
+ color: #fff !important;
23
+ }
24
+ .${confirmCls}:focus,
25
+ .${confirmCls}:hover {
26
+ background-color: #fff !important;
27
+ color: ${color} !important;
28
+ }
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: {
37
+ ...buttonStyle,
38
+ width: "100%",
39
+ display: "flex",
40
+ alignItems: "center",
41
+ justifyContent: "center",
42
+ minWidth: "unset",
43
+ }, children: confirmLabel }) })] })] }));
44
+ };
package/dist/index.d.ts CHANGED
@@ -2,3 +2,7 @@ export { AnchoredDropdown } from "./AnchoredDropdown";
2
2
  export type { AnchoredDropdownProps } from "./AnchoredDropdown";
3
3
  export { CollapsibleSection } from "./CollapsibleSection";
4
4
  export type { CollapsibleSectionProps } from "./CollapsibleSection";
5
+ export { FieldTextInput } from "./FieldTextInput";
6
+ export type { FieldTextInputProps } from "./FieldTextInput";
7
+ export { InlineConfirm } from "./InlineConfirm";
8
+ export type { InlineConfirmProps } from "./InlineConfirm";
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
1
  export { AnchoredDropdown } from "./AnchoredDropdown";
2
2
  export { CollapsibleSection } from "./CollapsibleSection";
3
+ export { FieldTextInput } from "./FieldTextInput";
4
+ export { InlineConfirm } from "./InlineConfirm";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moi952/decky-ui-kit",
3
- "version": "0.1.1",
3
+ "version": "0.3.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",