{"version":3,"names":["dynamic","createSignal","omit","FieldsetContext","mergeRootProps","resolveClassStyle","FieldsetRoot","props","disabled","legendId","setLegendId","undefined","ownedWrite","name","contextValue","present","userStyling","userHtmlProps","internalProps","data-disabled","aria-labelledby","styledUserProps","merged","Tag","as","children"],"sources":["fieldset-root.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { createSignal, omit } from \"solid-js\";\nimport {\n\tFieldsetContext,\n\ttype FieldsetContextValue,\n} from \"../../internals/fieldset-context.ts\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\n\nexport interface FieldsetRootState {\n\t/** Whether the fieldset group is disabled. */\n\tdisabled: boolean;\n}\n\nexport interface FieldsetRootProps\n\textends Omit<\n\t\tBaseUIComponentProps<\"fieldset\", FieldsetRootState>,\n\t\t\"aria-labelledby\"\n\t> {\n\t/** Tag/component to render. Defaults to `\"fieldset\"`. */\n\tas?: ValidComponent;\n\t/**\n\t * Whether the whole fieldset group should ignore user interaction.\n\t * @default false\n\t */\n\tdisabled?: boolean | undefined;\n}\n\n/**\n * Groups a shared legend with related controls.\n * Renders a `<fieldset>` element (or `as` override).\n *\n * Documentation: [Base UI Fieldset](https://base-ui.com/react/components/fieldset)\n */\nexport function FieldsetRoot(props: FieldsetRootProps): JSX.Element {\n\tconst disabled = (): boolean => props.disabled ?? false;\n\n\t// Internal legend-id registration: `<Fieldset.Legend>` writes its\n\t// generated id here during setup (owned scope) and clears it on cleanup.\n\t// `ownedWrite` opts out of Solid 2's write-in-owned-scope check — this is\n\t// pure internal plumbing, never surfaced to consumers.\n\tconst [legendId, setLegendId] = createSignal<string | undefined>(undefined, {\n\t\townedWrite: true,\n\t\tname: \"fieldset.legendId\",\n\t});\n\n\tconst contextValue: FieldsetContextValue = {\n\t\tdisabled,\n\t\tlegendId,\n\t\tsetLegendId,\n\t\tpresent: true,\n\t};\n\n\tconst userStyling = resolveClassStyle(props, () => ({\n\t\tdisabled: disabled(),\n\t}));\n\n\tconst userHtmlProps = omit(\n\t\tprops,\n\t\t\"class\",\n\t\t\"style\",\n\t\t\"attrs\",\n\t\t\"as\",\n\t\t\"disabled\",\n\t\t\"children\",\n\t) as Record<string, unknown>;\n\n\tconst internalProps = {\n\t\tget disabled() {\n\t\t\t// Emit the native `disabled` attribute so the browser actually\n\t\t\t// disables form controls inside the fieldset.\n\t\t\treturn disabled();\n\t\t},\n\t\tget \"data-disabled\"(): \"\" | undefined {\n\t\t\treturn disabled() ? \"\" : undefined;\n\t\t},\n\t\tget \"aria-labelledby\"() {\n\t\t\t// Empty string keeps the key present in ownKeys from first render\n\t\t\t// so a late-mounting legend can write into `legendId` and have\n\t\t\t// the binding update. Matches progress/meter-root pattern.\n\t\t\treturn legendId() ?? \"\";\n\t\t},\n\t};\n\n\tconst styledUserProps = mergeRootProps(userStyling, userHtmlProps);\n\n\tconst merged = mergeRootProps(internalProps, styledUserProps);\n\n\tconst Tag = dynamic(() => props.as ?? \"fieldset\");\n\treturn (\n\t\t<Tag {...merged}>\n\t\t\t<FieldsetContext value={contextValue}>{props.children}</FieldsetContext>\n\t\t</Tag>\n\t);\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,YAAY,EAAEC,IAAI,QAAQ,UAAU;AAC7C,SACCC,eAAe,QAET,qCAAqC;AAC5C,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,iBAAiB,QAAQ,qCAAqC;AAsBvE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,KAAwB,EAAe;EACnE,MAAMC,QAAQ,GAAGA,CAAA,KAAeD,KAAK,CAACC,QAAQ,IAAI,KAAK;;EAEvD;EACA;EACA;EACA;EACA,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGT,YAAY,CAAqBU,SAAS,EAAE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