keyboard-dismiss.browser.mjs + fixtures/tool-group.tsx: end-point wrap, Home / End, disabled items and a pointerdown outside that does not move focus, for the callers of the shared helpers (22 checks; same result before the refactor).
22 lines
1.0 KiB
TypeScript
22 lines
1.0 KiB
TypeScript
// Test-only host for keyboard-dismiss.browser.mjs (2026-10-20): SWToolGroup selection="single" has no current Story
|
|
// (SW/Tool was removed in 7f42923). Public @hm-design/sw API only; the host owns the pressed option.
|
|
import { useState } from "react"
|
|
import { createRoot } from "react-dom/client"
|
|
import { SWTheme, SWToolButton, SWToolGroup } from "@hm-design/sw"
|
|
import "@hm-design/sw/styles.css"
|
|
|
|
const OPTIONS = [{ id: "a", label: "모델" }, { id: "b", label: "배치" }, { id: "c", label: "단면", disabled: true }, { id: "d", label: "상세" }]
|
|
|
|
function Host() {
|
|
const [selected, setSelected] = useState("b")
|
|
return (
|
|
<SWTheme data-tool-fixture="" data-selected={selected}>
|
|
<SWToolGroup label="보기" selection="single">
|
|
{OPTIONS.map(option => <SWToolButton key={option.id} data-option={option.id} pressed={selected === option.id} disabled={option.disabled} onClick={() => setSelected(option.id)}>{option.label}</SWToolButton>)}
|
|
</SWToolGroup>
|
|
</SWTheme>
|
|
)
|
|
}
|
|
|
|
createRoot(document.getElementById("root")!).render(<Host />)
|