{"version":3,"names":["dynamic","createRenderEffect","omit","Show","createMountTransition","useCollapsible","CollapsiblePanel","props","c","id","undefined","idProp","setPanelId","m","open","keepMounted","Boolean","hiddenUntilFound","onBeforematch","event","setOpen","userProps","lifecycleAttrs","data-starting-style","transitionStatus","data-ending-style","panelProps","panel","mergePanelProps","Tag","as","shouldRender","panelId"],"sources":["collapsible-panel.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { createRenderEffect, omit, Show } from \"solid-js\";\nimport { createMountTransition } from \"../../internals/use-mount-transition/use-mount-transition\";\nimport { useCollapsible } from \"../create-collapsible.tsx\";\n\n/**\n * Props for {@link CollapsiblePanel}.\n *\n * Stage-01c rewire: this wrapper is now a structural adapter over\n * `useCollapsible()` + `createMountTransition` (axes A + G + P). `render={}`\n * is gone — use `as=` to swap the underlying tag/component.\n */\nexport interface CollapsiblePanelProps\n\textends JSX.HTMLAttributes<HTMLDivElement> {\n\t/**\n\t * Tag/component to render. Defaults to `\"div\"`. Replaces the\n\t * pre-spike `render` prop (axis G).\n\t */\n\tas?: ValidComponent;\n\t/**\n\t * When `true`, the browser's built-in page search can find and expand the\n\t * panel's contents. The panel stays in the DOM even when closed, and uses\n\t * `hidden=\"until-found\"` to hide without removing.\n\t *\n\t * Overrides {@link keepMounted} (forces it to `true`).\n\t * @default false\n\t */\n\thiddenUntilFound?: boolean | undefined;\n\t/**\n\t * Whether to keep the element in the DOM after the exit animation\n\t * completes. Ignored when {@link hiddenUntilFound} is `true`\n\t * (which forces it to `true`).\n\t *\n\t * **Exit animations are honored regardless of this prop** — the panel\n\t * always plays its CSS exit transition before either unmounting (when\n\t * `keepMounted={false}`) or flipping to `hidden={true}` (when\n\t * `keepMounted={true}`). This prop only controls what happens *after*\n\t * that transition finishes:\n\t *\n\t * - `false` (default) → panel unmounts; re-mounts on next open.\n\t * - `true` → panel stays in the DOM with `hidden={true}`.\n\t *\n\t * @default false\n\t */\n\tkeepMounted?: boolean | undefined;\n}\n\n/**\n * The collapsible panel. Renders a `<div>` element (or `as` override).\n *\n * Solid 2 notes:\n *\n * - Reads the collapsible API via `useCollapsible()` — works both under\n *   `<Collapsible.Root>` and inside accordion items (both provide the new\n *   `CollapsibleContext`).\n * - `createMountTransition` owns the full animation lifecycle (mount state,\n *   enter/exit measurement, CSS vars, `beforematch` listener, `hidden` attr).\n * - The panel id is registered into `c.setPanelId()` at setup, so the trigger's\n *   `aria-controls` binding reflects the correct id.\n *\n * ### `c.panel()` shape decision — option (b)\n *\n * `c.panel()` still emits `hidden`, `style`, and `ref` (the full slot bag).\n * `m.mergePanelProps(userProps)` spreads AFTER `c.panel()`, so\n * `createMountTransition`'s `hidden`, `style`, and `ref` win on collision.\n * This keeps inline-headless working (`<div {...c.panel()}>`) without requiring\n * callers to compose `createMountTransition` separately. The cost is that\n * `c.panel()` emits keys that become unreachable when this wrapper is used —\n * those keys are dormant rather than harmful.\n *\n * Clean-up option (a) (slim `c.panel()` to drop lifecycle keys) is left for a\n * later stage when inline-headless ergonomics have been confirmed across all\n * compounds.\n */\nexport function CollapsiblePanel(props: CollapsiblePanelProps): JSX.Element {\n\tconst c = useCollapsible();\n\n\t// The panel renders with the SHARED `c.panelId()` (seeded with the\n\t// primitive's `createUniqueId()` fallback) — the SAME value the trigger\n\t// reads for `aria-controls`. This keeps trigger↔panel linked even under SSR,\n\t// where the trigger serializes before the panel runs (matches React, which\n\t// renders the panel with the context `panelId` and only registers an\n\t// explicit `id` prop via effect). An explicit `id` prop is registered into\n\t// the shared signal so it takes effect once the write propagates\n\t// (client-side / post-hydration).\n\tcreateRenderEffect(\n\t\t() => (typeof props.id === \"string\" ? (props.id as string) : undefined),\n\t\t(idProp) => {\n\t\t\tif (!idProp) return undefined;\n\t\t\tc.setPanelId(idProp);\n\t\t\treturn undefined;\n\t\t},\n\t);\n\n\tconst m = createMountTransition(c.open, {\n\t\tkeepMounted: () => Boolean(props.keepMounted),\n\t\thiddenUntilFound: () => Boolean(props.hiddenUntilFound),\n\t\tonBeforematch: (event) => {\n\t\t\tc.setOpen(true, event);\n\t\t},\n\t});\n\n\t// Strip our config keys before passing user props into the slot.\n\t// `id` is stripped so it doesn't collide with the explicit id prop below.\n\tconst userProps = omit(props, \"as\", \"hiddenUntilFound\", \"id\", \"keepMounted\");\n\n\t// Animation-state data attrs come from the local `createMountTransition`\n\t// — the primitive's `c.panel()` no longer carries them (stage-01c\n\t// cleanup chain).\n\tconst lifecycleAttrs = {\n\t\tget \"data-starting-style\"(): \"\" | undefined {\n\t\t\treturn m.transitionStatus() === \"starting\" ? \"\" : undefined;\n\t\t},\n\t\tget \"data-ending-style\"(): \"\" | undefined {\n\t\t\treturn m.transitionStatus() === \"ending\" ? \"\" : undefined;\n\t\t},\n\t};\n\n\t// Bind the merged slot bag to a `const` BEFORE the JSX spread — hydration-\n\t// critical. Spreading an inline call (`{...c.panel(m.mergePanelProps(...))}`)\n\t// makes the Solid SSR compiler wrap it in a lazy thunk, whose server-side\n\t// `dynamic()` element resolution diverges from the client's child-id allocation and\n\t// throws \"Hydration Mismatch\". A pre-bound variable spread (`{...panelProps}`)\n\t// is passed straight through. See `collapsible-root.tsx` for the full\n\t// explanation and `<Tabs.Panel>` for the same `const merged` shape.\n\tconst panelProps = c.panel(m.mergePanelProps(userProps));\n\n\tconst Tag = dynamic(() => props.as ?? \"div\");\n\treturn (\n\t\t<Show when={m.shouldRender()}>\n\t\t\t<Tag {...panelProps} {...lifecycleAttrs} id={c.panelId()} />\n\t\t</Show>\n\t);\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,kBAAkB,EAAEC,IAAI,EAAEC,IAAI,QAAQ,UAAU;AACzD,SAASC,qBAAqB,QAAQ,2DAA2D;AACjG,SAASC,cAAc,QAAQ,2BAA2B;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;;AAoCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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