{"version":3,"names":["createContext","createMemo","useContext","makeSlotRefDirective","readOption","mergeRootProps","SNAPSHOT_KEYS","snapshotKeys","RadioGroupApiContext","useRadioGroup","ctx","Error","createRadioGroup","options","value","name","disabled","Boolean","readOnly","required","orientation","setValue","next","event","reason","ev","Event","cancelable","onValueChange","rootInternal","role","aria-disabled","undefined","aria-readonly","aria-required","aria-orientation","o","data-disabled","data-readonly","data-required","data-orientation","root","userProps","rootRef","api","Provider","props","children","RADIO_GROUP_SNAPSHOT_KEYS"],"sources":["create-radio-group.tsx"],"sourcesContent":["import type { JSX } from \"@solidjs/web\";\nimport { type Accessor, createContext, createMemo, useContext } from \"solid-js\";\nimport { makeSlotRefDirective } from \"../internals/make-slot-ref-directive\";\nimport { type MaybeAccessor, readOption } from \"../internals/maybe-accessor\";\nimport { mergeRootProps } from \"../internals/merge-root-props\";\nimport {\n\tSNAPSHOT_KEYS,\n\ttype Snapshottable,\n\tsnapshotKeys,\n} from \"../internals/observability/snapshot\";\n\n/**\n * Why the group's `value` changed. Emitted on the third arg of\n * `onValueChange(next, event, reason)` and accepted by\n * `c.setValue(next, event?, reason?)`.\n *\n * - `\"trigger-press\"` — a child radio was clicked / activated.\n * - `\"imperative\"` — programmatic `setValue` with no originating DOM event.\n *\n * Wrappers translate this to their public taxonomy\n * (`BaseUIChangeEventDetails<...>`).\n */\nexport type RadioGroupChangeReason = \"trigger-press\" | \"imperative\";\n\n/**\n * Orientation hint exposed via the group's slot bag.\n */\nexport type RadioGroupOrientation = \"horizontal\" | \"vertical\" | \"both\";\n\n/**\n * Options for {@link createRadioGroup}.\n *\n * **Solid-native shape (2026-04-30).** No internal state. `value` is required\n * and the consumer always owns the signal. See `solidify.md` §6.\n */\nexport interface CreateRadioGroupOptions<Value = unknown> {\n\t/**\n\t * Selected value. Consumer-owned signal — the primitive reads through the\n\t * accessor and does NOT keep an internal copy. Writes happen via\n\t * `onValueChange` (the consumer's responsibility to update their signal).\n\t */\n\tvalue: MaybeAccessor<Value | undefined>;\n\t/** Whether interaction is suppressed. @default false */\n\tdisabled?: MaybeAccessor<boolean>;\n\t/** Whether the group rejects user-driven changes. @default false */\n\treadOnly?: MaybeAccessor<boolean>;\n\t/** Whether selection is required for form submission. @default false */\n\trequired?: MaybeAccessor<boolean>;\n\t/**\n\t * Shared `name` for child radios' hidden inputs.\n\t */\n\tname?: MaybeAccessor<string | undefined>;\n\t/** Navigation orientation. @default \"both\" */\n\torientation?: MaybeAccessor<RadioGroupOrientation>;\n\t/**\n\t * Change callback. Called synchronously with `(next, event, reason)`.\n\t * `event.preventDefault()` is now a no-op for the primitive (the\n\t * consumer's signal write is the only writer).\n\t */\n\tonValueChange?: (\n\t\tvalue: Value,\n\t\tevent: Event,\n\t\treason: RadioGroupChangeReason,\n\t) => void;\n}\n\n/**\n * Public API returned by {@link createRadioGroup}.\n */\nexport interface RadioGroupApi<Value = unknown> {\n\tvalue: Accessor<Value | undefined>;\n\tdisabled: Accessor<boolean>;\n\treadOnly: Accessor<boolean>;\n\trequired: Accessor<boolean>;\n\tname: Accessor<string | undefined>;\n\torientation: Accessor<RadioGroupOrientation>;\n\n\t/**\n\t * Imperative value setter. Fires `onValueChange(next, event, reason)`.\n\t * No-op while `disabled` / `readOnly`. There is no internal state to\n\t * write — the consumer's signal write is the only writer.\n\t */\n\tsetValue: (\n\t\tnext: Value,\n\t\tevent?: Event,\n\t\treason?: RadioGroupChangeReason,\n\t) => void;\n\n\t/**\n\t * Root slot — getter-bag of attributes ready for spreading onto a\n\t * `<div role=\"radiogroup\">`.\n\t */\n\troot: <U extends object | undefined = undefined>(\n\t\tuserProps?: U,\n\t) => RadioGroupRootSlotProps & (U extends object ? U : object);\n\n\t/**\n\t * Directive form of {@link root}.\n\t */\n\trootRef: () => (el: HTMLElement | null) => void;\n\n\t/** Context provider — descendants read via `useRadioGroup()`. */\n\tProvider: (props: { children: JSX.Element }) => JSX.Element;\n}\n\n/** Shape of attributes emitted by `c.root()`. */\nexport interface RadioGroupRootSlotProps {\n\trole: \"radiogroup\";\n\t\"aria-disabled\": \"true\" | undefined;\n\t\"aria-readonly\": \"true\" | undefined;\n\t\"aria-required\": \"true\" | undefined;\n\t\"aria-orientation\": \"horizontal\" | \"vertical\" | undefined;\n\t\"data-disabled\": \"\" | undefined;\n\t\"data-readonly\": \"\" | undefined;\n\t\"data-required\": \"\" | undefined;\n\t\"data-orientation\": \"horizontal\" | \"vertical\" | \"both\";\n}\n\nconst RadioGroupApiContext = createContext<RadioGroupApi<unknown> | null>(null);\n\n/**\n * Read the nearest {@link RadioGroupApi} provided by `c.Provider`. Throws if\n * used outside a Provider.\n */\nexport function useRadioGroup<Value = unknown>(): RadioGroupApi<Value> {\n\tconst ctx = useContext(RadioGroupApiContext);\n\tif (ctx == null) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: useRadioGroup() must be called inside a <c.Provider>.\",\n\t\t);\n\t}\n\treturn ctx as RadioGroupApi<Value>;\n}\n\n/**\n * Solid 2.0-native compound primitive for a radio-group root. Owns the\n * single selected `value` (controlled or uncontrolled) plus the shared\n * `disabled` / `readOnly` / `required` / `name` / `orientation` slots that\n * descendant radios pull from. Composite-list arrow-key navigation, hidden\n * input form wiring, and field-control validation are the `<RadioGroup>`\n * wrapper's job — those are integration concerns layered on top.\n */\nexport function createRadioGroup<Value = unknown>(\n\toptions: CreateRadioGroupOptions<Value>,\n): RadioGroupApi<Value> {\n\t// `value` reads through the consumer's accessor — no internal signal,\n\t// no controlled-or-internal branching. Memoized so dependents see the\n\t// same identity within a tracking scope.\n\tconst value = createMemo<Value | undefined>(() => readOption(options.value), {\n\t\tname: \"radio-group.value\",\n\t});\n\n\tconst disabled = createMemo<boolean>(\n\t\t() => Boolean(readOption(options.disabled)),\n\t\t{ name: \"radio-group.disabled\" },\n\t);\n\tconst readOnly = createMemo<boolean>(\n\t\t() => Boolean(readOption(options.readOnly)),\n\t\t{ name: \"radio-group.readOnly\" },\n\t);\n\tconst required = createMemo<boolean>(\n\t\t() => Boolean(readOption(options.required)),\n\t\t{ name: \"radio-group.required\" },\n\t);\n\tconst name = createMemo<string | undefined>(() => readOption(options.name), {\n\t\tname: \"radio-group.name\",\n\t});\n\tconst orientation = createMemo<RadioGroupOrientation>(\n\t\t() => readOption(options.orientation) ?? \"both\",\n\t\t{ name: \"radio-group.orientation\" },\n\t);\n\n\t// `setValue` is a pure event-emitter. It fires `onValueChange(next, event, reason)`;\n\t// the consumer is responsible for updating their value-signal in response.\n\t// There is no internal state to write — `event.preventDefault()` is now a\n\t// no-op for the primitive (the consumer's handler is the only writer).\n\tconst setValue = (\n\t\tnext: Value,\n\t\tevent?: Event,\n\t\treason: RadioGroupChangeReason = \"imperative\",\n\t): void => {\n\t\tif (disabled() || readOnly()) return;\n\t\tconst ev = event ?? new Event(\"valuechange\", { cancelable: true });\n\t\toptions.onValueChange?.(next, ev, reason);\n\t};\n\n\tconst rootInternal = {\n\t\trole: \"radiogroup\" as const,\n\t\tget \"aria-disabled\"() {\n\t\t\treturn disabled() ? (\"true\" as const) : undefined;\n\t\t},\n\t\tget \"aria-readonly\"() {\n\t\t\treturn readOnly() ? (\"true\" as const) : undefined;\n\t\t},\n\t\tget \"aria-required\"() {\n\t\t\treturn required() ? (\"true\" as const) : undefined;\n\t\t},\n\t\tget \"aria-orientation\"() {\n\t\t\tconst o = orientation();\n\t\t\t// `aria-orientation` only takes \"horizontal\" / \"vertical\" — the\n\t\t\t// \"both\" hint is internal-only and is not surfaced via ARIA.\n\t\t\treturn o === \"horizontal\" || o === \"vertical\" ? o : undefined;\n\t\t},\n\t\tget \"data-disabled\"() {\n\t\t\treturn disabled() ? \"\" : undefined;\n\t\t},\n\t\tget \"data-readonly\"() {\n\t\t\treturn readOnly() ? \"\" : undefined;\n\t\t},\n\t\tget \"data-required\"() {\n\t\t\treturn required() ? \"\" : undefined;\n\t\t},\n\t\tget \"data-orientation\"() {\n\t\t\treturn orientation();\n\t\t},\n\t};\n\n\tconst root = <U extends object | undefined>(userProps?: U) =>\n\t\tmergeRootProps(rootInternal, userProps) as RadioGroupRootSlotProps &\n\t\t\t(U extends object ? U : object);\n\n\tconst rootRef = (): ((el: HTMLElement | null) => void) =>\n\t\tmakeSlotRefDirective(() => root());\n\n\tconst api: RadioGroupApi<Value> = {\n\t\tvalue,\n\t\tdisabled,\n\t\treadOnly,\n\t\trequired,\n\t\tname,\n\t\torientation,\n\t\tsetValue,\n\t\troot,\n\t\trootRef,\n\t\tProvider: (props) => (\n\t\t\t<RadioGroupApiContext value={api as RadioGroupApi<unknown>}>\n\t\t\t\t{props.children}\n\t\t\t</RadioGroupApiContext>\n\t\t),\n\t};\n\t(api as RadioGroupApi<Value> & Snapshottable)[SNAPSHOT_KEYS] =\n\t\tRADIO_GROUP_SNAPSHOT_KEYS;\n\treturn api;\n}\n\nconst RADIO_GROUP_SNAPSHOT_KEYS = snapshotKeys<RadioGroupApi>(\n\t\"value\",\n\t\"disabled\",\n\t\"readOnly\",\n\t\"required\",\n\t\"name\",\n\t\"orientation\",\n);\n"],"mappings":"AACA,SAAwBA,aAAa,EAAEC,UAAU,EAAEC,UAAU,QAAQ,UAAU;AAC/E,SAASC,oBAAoB,QAAQ,sCAAsC;AAC3E,SAA6BC,UAAU,QAAQ,6BAA6B;AAC5E,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SACCC,aAAa,EAEbC,YAAY,QACN,qCAAqC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAgCA;AACA;AACA;;AAqCA;;AAaA,MAAMC,oBAAoB,GAAGR,aAAa,CAAgC,IAAI,CAAC;;AAE/E;AACA;AACA;AACA;AACA,OAAO,SAASS,aAAaA,CAAA,EAA0C;EACtE,MAAMC,GAAG,GAAGR,UAAU,CAACM,oBAAoB,CAAC;EAC5C,IAAIE,GAAG,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIC,KAAK,CACd,gEACD,CAAC;EACF;EACA,OA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