{"version":3,"names":["dynamic","createMemo","createRenderEffect","omit","Show","untrack","useBaseUiId","mergeRootProps","useOpenChangeComplete","resolveClassStyle","useTransitionStatus","useTabsRootContext","TabsPanel","props","root","id","undefined","open","value","keepMounted","mounted","transitionStatus","setMounted","hidden","isHidden","isKept","panelValue","registerMountedTabPanel","unregisterMountedTabPanel","panelElementRef","current","ref","onComplete","panelRef","el","userClassStyle","orientation","tabActivationDirection","userHtmlProps","internalProps","role","aria-labelledby","getTabIdByPanelValue","tabIndex","data-orientation","data-activation-direction","data-hidden","data-starting-style","data-ending-style","merged","shouldRender","Tag","as","children"],"sources":["tabs-panel.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { createMemo, createRenderEffect, omit, Show, untrack } from \"solid-js\";\nimport { useBaseUiId } from \"../../internals/base-ui-id\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { useOpenChangeComplete } from \"../../internals/popups/use-open-change-complete.ts\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport {\n\ttype TransitionStatus,\n\tuseTransitionStatus,\n} from \"../../internals/use-transition-status/use-transition-status.ts\";\nimport {\n\ttype TabsRootState,\n\ttype TabsTabValue,\n\tuseTabsRootContext,\n} from \"../tabs-root-context.ts\";\n\nexport interface TabsPanelState extends TabsRootState {\n\t/** Whether the panel is visually hidden. */\n\thidden: boolean;\n\t/** Transition-status flag (used for enter / exit animations). */\n\ttransitionStatus: TransitionStatus;\n}\n\nexport interface TabsPanelProps\n\t// `value` in our API is meaningful; drop the native `value` shape.\n\textends Omit<BaseUIComponentProps<\"div\", TabsPanelState>, \"value\"> {\n\t/** Tag/component to render. Defaults to `\"div\"`. */\n\tas?: ValidComponent;\n\t/** The value that identifies the corresponding `<Tabs.Tab>`. */\n\tvalue: TabsTabValue;\n\t/**\n\t * Whether the panel stays in the DOM when it isn't selected. Necessary for\n\t * CSS transitions that animate between panels; off by default to match\n\t * React Base UI.\n\t * @default false\n\t */\n\tkeepMounted?: boolean | undefined;\n}\n\n/**\n * The content panel that renders when its matching `<Tabs.Tab>` is active.\n * Renders a `<div role=\"tabpanel\">`.\n *\n * Solid 2 notes:\n *\n * - `<Show when={shouldRender}>` wraps the element when `keepMounted` is\n *   `false`. When `keepMounted` is `true`, the element stays in the DOM and\n *   switches between visible / `hidden` based on selection.\n * - The panel registers its DOM id with the root so the matching tab can\n *   project `aria-controls={panelId}`. Registration happens in a render\n *   effect keyed on `(hidden, keepMounted)` — matches React's\n *   `useIsoLayoutEffect`.\n */\nexport function TabsPanel(props: TabsPanelProps): JSX.Element {\n\tconst root = useTabsRootContext();\n\n\t// Id overrides are setup-time only (matches field/slider/number-field):\n\t// untrack the body read so it doesn't trip `[STRICT_READ_UNTRACKED]`.\n\tconst id = useBaseUiId(\n\t\tuntrack(() => (typeof props.id === \"string\" ? props.id : undefined)),\n\t);\n\n\tconst open = createMemo((): boolean => root.value() === props.value);\n\tconst keepMounted = (): boolean => props.keepMounted ?? false;\n\n\tconst { mounted, transitionStatus, setMounted } = useTransitionStatus(open);\n\n\tconst hidden = (): boolean => !mounted();\n\n\t// Registration effect: whenever the panel would be reachable by a tab\n\t// (mounted OR keepMounted), publish its id. Un-register on cleanup so\n\t// stale ids don't linger.\n\tcreateRenderEffect(\n\t\t// `props.value` is snapshotted in compute — the apply scope is\n\t\t// strict-read, and a changed value must re-register anyway.\n\t\t() => ({ isHidden: hidden(), isKept: keepMounted(), value: props.value }),\n\t\t({ isHidden, isKept, value: panelValue }) => {\n\t\t\tif (isHidden && !isKept) return;\n\t\t\troot.registerMountedTabPanel(panelValue, id);\n\t\t\t// Apply scope is unowned — `onCleanup` here would never fire\n\t\t\t// (`[NO_OWNER_CLEANUP]`). Returning a cleanup function from the\n\t\t\t// apply hooks into the effect's own teardown instead.\n\t\t\treturn () => {\n\t\t\t\troot.unregisterMountedTabPanel(panelValue, id);\n\t\t\t};\n\t\t},\n\t);\n\n\t// Defer unmount until CSS transitions / animations settle. `ref.current`\n\t// is populated by `panelRef` below. Matches React's\n\t// `useOpenChangeComplete({ open, ref, onComplete: () => setMounted(false) })`:\n\t// whenever `open` flips, wait for any in-flight animations on the panel,\n\t// then drop `mounted` to `false`. The hook is a no-op when there are no\n\t// animations, so the static case still closes synchronously (on the next\n\t// microtask).\n\tconst panelElementRef: { current: HTMLElement | null } = { current: null };\n\tuseOpenChangeComplete({\n\t\topen,\n\t\tref: panelElementRef,\n\t\tonComplete: () => {\n\t\t\tif (!open()) {\n\t\t\t\tsetMounted(false);\n\t\t\t}\n\t\t},\n\t});\n\tconst panelRef = (el: HTMLElement | null): void => {\n\t\tpanelElementRef.current = el;\n\t};\n\tconst userClassStyle = resolveClassStyle(props, () => ({\n\t\torientation: root.orientation(),\n\t\ttabActivationDirection: root.tabActivationDirection(),\n\t\thidden: hidden(),\n\t\ttransitionStatus: transitionStatus(),\n\t}));\n\n\tconst userHtmlProps = omit(\n\t\tprops,\n\t\t\"as\",\n\t\t\"class\",\n\t\t\"style\",\n\t\t\"attrs\",\n\t\t\"children\",\n\t\t\"keepMounted\",\n\t\t\"value\",\n\t) as Record<string, unknown>;\n\n\tconst internalProps = {\n\t\tid,\n\t\trole: \"tabpanel\" as const,\n\t\tref: panelRef,\n\t\tget \"aria-labelledby\"() {\n\t\t\treturn root.getTabIdByPanelValue(props.value) ?? \"\";\n\t\t},\n\t\tget tabIndex() {\n\t\t\treturn open() ? 0 : -1;\n\t\t},\n\t\tget hidden() {\n\t\t\treturn hidden() ? true : undefined;\n\t\t},\n\t\tget \"data-orientation\"() {\n\t\t\treturn root.orientation();\n\t\t},\n\t\tget \"data-activation-direction\"() {\n\t\t\treturn root.tabActivationDirection();\n\t\t},\n\t\tget \"data-hidden\"(): \"\" | undefined {\n\t\t\treturn hidden() ? \"\" : undefined;\n\t\t},\n\t\tget \"data-starting-style\"(): \"\" | undefined {\n\t\t\treturn transitionStatus() === \"starting\" ? \"\" : undefined;\n\t\t},\n\t\tget \"data-ending-style\"(): \"\" | undefined {\n\t\t\treturn transitionStatus() === \"ending\" ? \"\" : undefined;\n\t\t},\n\t};\n\n\tconst merged = mergeRootProps(\n\t\tmergeRootProps(internalProps, userClassStyle),\n\t\tuserHtmlProps,\n\t);\n\n\tconst shouldRender = (): boolean => keepMounted() || mounted();\n\n\tconst Tag = dynamic(() => props.as ?? \"div\");\n\treturn (\n\t\t<Show when={shouldRender()}>\n\t\t\t<Tag {...merged}>{props.children}</Tag>\n\t\t</Show>\n\t);\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,QAAQ,UAAU;AAC9E,SAASC,WAAW,QAAQ,4BAA4B;AACxD,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,qBAAqB,QAAQ,oDAAoD;AAC1F,SAASC,iBAAiB,QAAQ,qCAAqC;AAEvE,SAECC,mBAAmB,QACb,gEAAgE;AACvE,SAGCC,kBAAkB,QACZ,yBAAyB;AAyBhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,KAAqB,EAAe;EAC7D,MAAMC,IAAI,GAAGH,kBAAkB,CAAC,CAAC;;EAEjC;EACA;EACA,MAAMI,EAAE,GAAGT,WAAW,CACrBD,OAAO,CAAC,MAAO,OAAOQ,KAAK,CAACE,EAAE,KAAK,QAAQ,GAAGF,KAAK,CAACE,EAAE,GAAGC,SAAU,CACpE,CAAC;EAED,MAAMC,IAAI,GAAGhB,UAAU,CAAC,MAAea,IAAI,CAACI,KAAK,CAAC,CAAC,KAAKL,KAAK,CAACK,KAAK,CAAC;EACpE,MAAMC,WAAW,GAAGA,CAAA,KAAeN,KAAK,CAACM,WAAW,IAAI,KAAK;EAE7D,MAAM;IAAEC,OAAO;IAAEC,gBAAg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