// Example E — the SW popup frame with project content (no Header). SWPopup keeps the property window design;
// children are free: SWPopupSection / SWPopupRow rows with SWHeaderInput, the unit SWSelect, the SWSlider gauge and the
// popup layer / color pickers (SWPopupPropertyRow). The SWHeader field dropdowns are header-only: never in a popup.
import { useId, useState } from "react"
import { SWHeaderInput, SWPopup, SWPopupPropertyRow, SWPopupRow, SWPopupSection, SWSelect, SWSlider, SWTheme } from "@hm-design/sw"
import { colors, layers } from "./sample-data"
export function ExampleECustomPopup({ onEvent }: { onEvent?: (name: string) => void }) {
const [open, setOpen] = useState(true)
const nameId = useId()
const [name, setName] = useState("평면도-01")
const [scale, setScale] = useState("100")
const [x, setX] = useState("1200.5")
const unitId = useId()
const [unit, setUnit] = useState("mm")
const [opacity, setOpacity] = useState(60)
const [activeLayerId, setActiveLayerId] = useState("0")
const [color, setColor] = useState("255,0,0")
if (!open) return
return (
{ setOpen(false); onEvent?.("popup:close") }}>
{ setName(next); onEvent?.(`name:${next}`) }} />
{ setScale(next); onEvent?.(`scale:${next}`) }} />
{ setUnit(next); onEvent?.(`unit:${next}`) }} />
onEvent?.(`opacity:${next}`)} />
{ setX(next); onEvent?.(`x:${next}`) }} />
{/* The property window pickers; their lists open as a fixed overlay, so the scrolling body never clips them. */}
({ id, name })) }}
menus={{ layers }} onPropertyChange={(_, value) => { setActiveLayerId(value); onEvent?.(`layer:${value}`) }} />
{ setColor(value); onEvent?.(`color:${value}`) }} />
)
}