import { type Default, handler, ifElse, NAME, pattern, UI, type VNode, Writable, } from "commonfabric"; // Fixture for the `waitForDisabled` browser helper. A cf-checkbox renders an // in its shadow root and no , so it exercises // the helper's fallback to the host's `disabled` / `aria-disabled` state. Its // disabled state is driven by a cell that a button toggles, letting a test // observe the helper resolve both the enabled and the disabled reading. interface Input { controlDisabled: Writable>; } interface Output { [NAME]: string; [UI]: VNode; controlDisabled: boolean; } const toggleDisabled = handler }>( (_event, { controlDisabled }) => controlDisabled.set(!controlDisabled.get()), ); const CfCheckboxDisabled = pattern(({ controlDisabled }) => { return { [NAME]: "cf-checkbox-disabled", [UI]: ( Probe checkbox {ifElse(controlDisabled, "Checkbox disabled", "Checkbox enabled")} Toggle disabled ), controlDisabled, }; }); export default CfCheckboxDisabled;
{ifElse(controlDisabled, "Checkbox disabled", "Checkbox enabled")}