feat(design): the field family, the dropdown trigger, native controls, the no-raw-input lint rule (E28 S3c)
- ui/Input, Textarea, InnerInput + fieldClass (A4): the >= 3:1 edge, a 2px accent focus edge, the danger edge for invalid, md/sm/xs/heading rungs, 1rem and 44 on touch - ui/SelectTrigger (A5): SortControl, FilterSelect, the view switcher and the date filter on one trigger, a pill in a toolbar, r8 in a form - ui/NativeControls (A6): Checkbox, CheckRow, Slider, ColorInput - every raw input swept (~100 sites); inputCls retired; local/input-primitive - useReturnFocus: an in-place editor hands the focus back to its trigger on Enter/Escape (the playlist and Plex title renames, the priority number); the Plex playlist rename gains Escape and an accessible name - back to top: a round 48 FAB (owner decision); DESIGN.md A2 and the log
This commit is contained in:
@@ -41,6 +41,8 @@ import {
|
||||
useSortableA11y,
|
||||
useSortableItem,
|
||||
} from "./ui/sortableA11y";
|
||||
import { Input } from "./ui/Input";
|
||||
import { useReturnFocus } from "./ui/useReturnFocus";
|
||||
|
||||
// A playlist's items, grouped for readability: movies stay standalone, while a run of episodes from the
|
||||
// same show collapses into a season/show group so a whole series doesn't sprawl into an endless flat
|
||||
@@ -374,6 +376,7 @@ export default function PlexPlaylistView({
|
||||
const qc = useQueryClient();
|
||||
const confirm = useConfirm();
|
||||
const [renaming, setRenaming] = useState(false);
|
||||
const renameFocus = useReturnFocus(renaming);
|
||||
const [name, setName] = useState("");
|
||||
const [layout, setLayout] = useState<Layout>(() =>
|
||||
getAccountRaw(LS.plexPlaylistLayout) === "tree" ? "tree" : "accordion",
|
||||
@@ -525,13 +528,25 @@ export default function PlexPlaylistView({
|
||||
<div className="mb-4 flex flex-wrap items-center gap-3">
|
||||
<div className="min-w-0 flex-1">
|
||||
{renaming ? (
|
||||
<input
|
||||
<Input
|
||||
className="w-full text-lg font-bold"
|
||||
size="heading"
|
||||
autoFocus
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Enter" && rename()}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
renameFocus.arm();
|
||||
rename();
|
||||
}
|
||||
// Unmounting the field fires no blur, so Escape really does cancel.
|
||||
if (e.key === "Escape") {
|
||||
renameFocus.arm();
|
||||
setRenaming(false);
|
||||
}
|
||||
}}
|
||||
onBlur={rename}
|
||||
className="glass-card w-full rounded-lg px-3 py-1.5 text-lg font-bold focus:outline-hidden focus:ring-2 focus:ring-accent/40"
|
||||
aria-label={t("plex.playlist.rename")}
|
||||
/>
|
||||
) : (
|
||||
<h1 className="truncate text-2xl font-bold">{q.data?.title ?? " "}</h1>
|
||||
@@ -551,6 +566,7 @@ export default function PlexPlaylistView({
|
||||
label={t("plex.playlist.layoutLabel")}
|
||||
/>
|
||||
<IconButton
|
||||
ref={renameFocus.target}
|
||||
variant="glass"
|
||||
size="md"
|
||||
onClick={() => {
|
||||
|
||||
Reference in New Issue
Block a user