{"version":3,"names":["createContext","useContext","CheckboxRootContext","useCheckboxRootContext","context","Error"],"sources":["checkbox-root-context.ts"],"sourcesContent":["import { type Accessor, createContext, useContext } from \"solid-js\";\nimport type { FieldRootState } from \"../internals/field-constants\";\n\n/**\n * State accessible to `<Checkbox.Indicator>` (and any future checkbox parts).\n *\n * Mirrors React's `CheckboxRootState` but exposed as `Accessor<T>` fields so\n * descendants can read each slot lazily — matches the tier-1 compound\n * convention used by `<Progress.Root>` / `<Avatar.Root>`, and honours the\n * no-top-level-reactive-reads rule from Solid 2 RFC 01.\n *\n * `state` is a composite accessor handed to `renderElement` for the `data-*`\n * projection; individual accessors (`checked`, `indeterminate`, …) are the\n * read surface for `<Checkbox.Indicator>` so it doesn't need to destructure\n * `state()` at the top of its body.\n */\nexport interface CheckboxRootContextValue {\n\t/** Whether the checkbox is currently ticked. */\n\tchecked: Accessor<boolean>;\n\t/** Whether the checkbox is in a mixed state (neither ticked nor unticked). */\n\tindeterminate: Accessor<boolean>;\n\t/** Whether the component ignores user interaction. */\n\tdisabled: Accessor<boolean>;\n\t/** Whether user interaction is blocked without disabling the control. */\n\treadOnly: Accessor<boolean>;\n\t/** Whether the checkbox must be ticked before submitting a form. */\n\trequired: Accessor<boolean>;\n\t/** Composite state accessor — fed directly to `renderElement`'s projection. */\n\tstate: Accessor<CheckboxRootState>;\n}\n\n/**\n * Full checkbox state: field-root state merged with checkbox-specific flags.\n *\n * The order of the extension matters only for clarity — `data-disabled` is\n * sourced from `disabled`, and `checked` / `indeterminate` drive the\n * checkbox-specific `data-checked` / `data-unchecked` / `data-indeterminate`\n * triplet via the custom state-attributes mapping.\n */\nexport interface CheckboxRootState extends FieldRootState {\n\t/** Whether the checkbox is currently ticked. */\n\tchecked: boolean;\n\t/** Whether the component ignores user interaction. */\n\tdisabled: boolean;\n\t/** Whether the user should be unable to tick/untick the checkbox. */\n\treadOnly: boolean;\n\t/** Whether the checkbox must be ticked before submitting a form. */\n\trequired: boolean;\n\t/** Whether the checkbox is in a mixed state. */\n\tindeterminate: boolean;\n}\n\n/**\n * Checkbox root context. `createContext<T | null>(null)` + `== null` sentinel\n * — Solid 2's `useContext` throws `ContextNotFoundError` when\n * the default is `undefined`, which would shadow the intended Base UI error\n * message below.\n */\nexport const CheckboxRootContext =\n\tcreateContext<CheckboxRootContextValue | null>(null);\n\n/**\n * Read the `<Checkbox.Root>` context. Throws a descriptive error if the\n * caller forgot to wrap their subtree in `<Checkbox.Root>` — matches Base UI\n * React.\n */\nexport function useCheckboxRootContext(): CheckboxRootContextValue {\n\tconst context = useContext(CheckboxRootContext);\n\tif (context == null) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.\",\n\t\t);\n\t}\n\treturn context;\n}\n"],"mappings":"AAAA,SAAwBA,aAAa,EAAEC,UAAU,QAAQ,UAAU;;AAGnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAC/BF,aAAa,CAAkC,IAAI,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,sBAAsBA,CAAA,EAA6B;EAClE,MAAMC,OAAO,GAAGH,UAAU,CAACC,mBAAmB,CAAC;EAC/C,IAAIE,OAAO,IAAI,IAAI,EAAE;IACpB,MAAM,IAAIC,KAAK,CACd,gGACD,CAAC;EACF;EACA,OAAOD,OAAO;AACf","ignoreList":[]}