feat(ui): add momentary keyboard control surface
This commit is contained in:
@@ -4302,3 +4302,13 @@ textarea.nodedc-field__control {
|
||||
}
|
||||
}
|
||||
.nodedc-landing-stage__eyebrow { color: var(--nodedc-text-muted); font-size: var(--nodedc-font-size-xs); font-weight: var(--nodedc-font-weight-strong); letter-spacing: .12em; }
|
||||
|
||||
/* Explicit key outline: approved momentary-input affordance, not a card rim. */
|
||||
.nodedc-key-button { display:inline-grid; place-items:center; width:46px; height:46px;
|
||||
border:1px solid var(--nodedc-text-secondary); border-radius:var(--nodedc-radius-sm, 8px);
|
||||
background:transparent; color:var(--nodedc-text-primary); font:inherit; font-weight:600;
|
||||
cursor:pointer; user-select:none; touch-action:none; }
|
||||
.nodedc-key-button:hover:not(:disabled) { background:var(--nodedc-glass-control-hover); }
|
||||
.nodedc-key-button[aria-pressed="true"]:not(:disabled) { background:#fff; color:#000; border-color:#fff; }
|
||||
.nodedc-key-button:disabled { opacity:.4; cursor:not-allowed; }
|
||||
.nodedc-key-button:focus-visible { outline:2px solid rgb(var(--nodedc-accent-rgb)); outline-offset:3px; }
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import {forwardRef, type ButtonHTMLAttributes} from 'react';
|
||||
import {cn} from './cn.js';
|
||||
|
||||
export interface KeyButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
/** Controlled physical/pointer input indication; this is never a toggle. */
|
||||
pressed?: boolean;
|
||||
label: string;
|
||||
}
|
||||
|
||||
/** A momentary key surface. The consumer owns input, focus scope and release policy. */
|
||||
export const KeyButton = forwardRef<HTMLButtonElement, KeyButtonProps>(function KeyButton(
|
||||
{pressed=false,label,children,className,type='button',disabled,...props},ref,
|
||||
) {
|
||||
return <button {...props} ref={ref} type={type} disabled={disabled}
|
||||
aria-label={label} title={label} aria-pressed={pressed && !disabled}
|
||||
className={cn('nodedc-key-button',className)}>{children}</button>;
|
||||
});
|
||||
@@ -35,3 +35,4 @@ export * from "./EnvironmentSettingsWindow.js";
|
||||
export * from "./EnvironmentMediaPlaylistEditor.js";
|
||||
export * from "./EnvironmentBackgroundMedia.js";
|
||||
export * from "./LandingStage.js";
|
||||
export {KeyButton, type KeyButtonProps} from './KeyButton.js';
|
||||
|
||||
Reference in New Issue
Block a user