{"version":3,"names":["dynamic","createSignal","omit","onCleanup","useDirection","CompositeRootContext","CompositeList","useCompositeRoot","mergeRootProps","resolveClassStyle","TabsListContext","useTabsRootContext","TabsList","props","rootContext","direction","activateOnFocus","loopFocus","tabsListElement","setTabsListElement","ownedWrite","tabResizeObserverElements","Set","resizeObserver","ensureObserver","ResizeObserver","registerTabResizeObserverElement","element","add","observer","observe","delete","unobserve","disconnect","clear","attachListObserver","el","onTabActivation","newValue","eventDetails","value","onValueChange","composite","orientation","enableHomeAndEndKeys","compositeRootContext","highlightedIndex","onHighlightedIndexChange","highlightItemOnHover","relayKeyboardEvent","present","tabsListContextValue","highlightedTabIndex","setHighlightedTabIndex","userClassStyle","tabActivationDirection","userHtmlProps","internalProps","ref","rootRef","role","aria-orientation","undefined","data-orientation","data-activation-direction","merged","Tag","as","elementsRef","map","setTabMap","onMapChange","children"],"sources":["tabs-list.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { createSignal, omit, onCleanup } from \"solid-js\";\nimport { useDirection } from \"../../direction-provider/direction-provider-context.ts\";\nimport {\n\tCompositeRootContext,\n\ttype CompositeRootContextValue,\n} from \"../../internals/composite/composite-context.ts\";\nimport { CompositeList } from \"../../internals/composite/composite-list.tsx\";\nimport { useCompositeRoot } from \"../../internals/composite/composite-root.ts\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport {\n\tTabsListContext,\n\ttype TabsListContextValue,\n} from \"../tabs-list-context.ts\";\nimport {\n\ttype TabsRootChangeEventDetails,\n\ttype TabsRootState,\n\ttype TabsTabMetadata,\n\ttype TabsTabValue,\n\tuseTabsRootContext,\n} from \"../tabs-root-context.ts\";\n\nexport interface TabsListState extends TabsRootState {}\n\nexport interface TabsListProps\n\textends BaseUIComponentProps<\"div\", TabsListState> {\n\t/** Tag/component to render. Defaults to `\"div\"`. */\n\tas?: ValidComponent;\n\t/**\n\t * Whether to activate the tab the user moves focus to (via arrow keys or\n\t * programmatic focus) without requiring a click. When `false`, Enter /\n\t * Space is still required to activate the focused tab.\n\t * @default false\n\t */\n\tactivateOnFocus?: boolean | undefined;\n\t/**\n\t * Whether arrow-key navigation wraps from the last tab to the first and\n\t * vice versa.\n\t * @default true\n\t */\n\tloopFocus?: boolean | undefined;\n}\n\n/**\n * Groups the `<Tabs.Tab>` buttons + (optionally) the `<Tabs.Indicator>` into\n * a single keyboard-navigable widget. Renders a `<div role=\"tablist\">`.\n *\n * Composite-focus wiring: arrow keys move the roving focus between tabs,\n * Home/End jump to the first/last non-disabled tab, and Enter/Space activates\n * the focused tab (via `<Tabs.Tab>`'s `useButton`). When `activateOnFocus` is\n * `true`, focus alone activates the tab — child tabs read this through the\n * list context + apply it inside their own `onFocus` handler.\n */\nexport function TabsList(props: TabsListProps): JSX.Element {\n\tconst rootContext = useTabsRootContext();\n\tconst direction = useDirection();\n\n\tconst activateOnFocus = (): boolean => props.activateOnFocus ?? false;\n\tconst loopFocus = (): boolean => props.loopFocus ?? true;\n\n\tconst [tabsListElement, setTabsListElement] =\n\t\tcreateSignal<HTMLElement | null>(null, { ownedWrite: true });\n\n\t// Resize observer bookkeeping. Child tabs register their element via\n\t// `registerTabResizeObserverElement`; the indicator rerenders on every\n\t// observed size change (through its own subscription — tier-3b MVP\n\t// doesn't ship the full observer, so this is exposed as a register/unregister\n\t// pair for forward compatibility + to satisfy tab signatures).\n\tconst tabResizeObserverElements = new Set<HTMLElement>();\n\tlet resizeObserver: ResizeObserver | null = null;\n\n\tconst ensureObserver = (): ResizeObserver | null => {\n\t\tif (resizeObserver) return resizeObserver;\n\t\tif (typeof ResizeObserver === \"undefined\") return null;\n\t\tresizeObserver = new ResizeObserver(() => {\n\t\t\t// Intentionally empty — indicator measurement is recomputed in its\n\t\t\t// own render effect from the live DOM, and the observer's role is\n\t\t\t// to trigger a re-measure. A future iteration will expose a\n\t\t\t// listener API here.\n\t\t});\n\t\treturn resizeObserver;\n\t};\n\n\tconst registerTabResizeObserverElement = (\n\t\telement: HTMLElement,\n\t): (() => void) => {\n\t\ttabResizeObserverElements.add(element);\n\t\tconst observer = ensureObserver();\n\t\tobserver?.observe(element);\n\t\treturn () => {\n\t\t\ttabResizeObserverElements.delete(element);\n\t\t\tobserver?.unobserve(element);\n\t\t};\n\t};\n\n\tonCleanup(() => {\n\t\tresizeObserver?.disconnect();\n\t\tresizeObserver = null;\n\t\ttabResizeObserverElements.clear();\n\t});\n\n\t// Observe the list element itself (for indicator-on-resize hooks).\n\tconst attachListObserver = (el: HTMLElement | null): void => {\n\t\tif (!el) return;\n\t\tensureObserver()?.observe(el);\n\t};\n\n\tconst onTabActivation = (\n\t\tnewValue: TabsTabValue,\n\t\teventDetails: TabsRootChangeEventDetails,\n\t): void => {\n\t\tif (newValue !== rootContext.value()) {\n\t\t\trootContext.onValueChange(newValue, eventDetails);\n\t\t}\n\t};\n\n\tconst composite = useCompositeRoot({\n\t\tget orientation() {\n\t\t\treturn rootContext.orientation();\n\t\t},\n\t\tget loopFocus() {\n\t\t\treturn loopFocus();\n\t\t},\n\t\tdirection,\n\t\tenableHomeAndEndKeys: true,\n\t});\n\n\tconst compositeRootContext: CompositeRootContextValue = {\n\t\thighlightedIndex: composite.highlightedIndex,\n\t\tonHighlightedIndexChange: composite.onHighlightedIndexChange,\n\t\thighlightItemOnHover: () => false,\n\t\trelayKeyboardEvent: composite.relayKeyboardEvent,\n\t\tpresent: true,\n\t};\n\n\tconst tabsListContextValue: TabsListContextValue = {\n\t\tactivateOnFocus,\n\t\thighlightedTabIndex: composite.highlightedIndex,\n\t\tregisterTabResizeObserverElement,\n\t\tonTabActivation,\n\t\tsetHighlightedTabIndex: composite.onHighlightedIndexChange,\n\t\ttabsListElement,\n\t\tpresent: true,\n\t};\n\tconst userClassStyle = resolveClassStyle(props, () => ({\n\t\torientation: rootContext.orientation(),\n\t\ttabActivationDirection: rootContext.tabActivationDirection(),\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\"activateOnFocus\",\n\t\t\"children\",\n\t\t\"loopFocus\",\n\t) as Record<string, unknown>;\n\n\tconst internalProps = {\n\t\tref: (el: HTMLElement | null): void => {\n\t\t\tsetTabsListElement(el);\n\t\t\tcomposite.rootRef(el);\n\t\t\tattachListObserver(el);\n\t\t},\n\t\trole: \"tablist\" as const,\n\t\tget \"aria-orientation\"() {\n\t\t\treturn rootContext.orientation() === \"vertical\" ? \"vertical\" : undefined;\n\t\t},\n\t\tget \"data-orientation\"() {\n\t\t\treturn rootContext.orientation();\n\t\t},\n\t\tget \"data-activation-direction\"() {\n\t\t\treturn rootContext.tabActivationDirection();\n\t\t},\n\t};\n\n\tconst merged = mergeRootProps(\n\t\tmergeRootProps(\n\t\t\tmergeRootProps(internalProps, composite.props),\n\t\t\tuserClassStyle,\n\t\t),\n\t\tuserHtmlProps,\n\t);\n\n\tconst Tag = dynamic(() => props.as ?? \"div\");\n\treturn (\n\t\t<Tag {...merged}>\n\t\t\t<TabsListContext value={tabsListContextValue}>\n\t\t\t\t<CompositeRootContext value={compositeRootContext}>\n\t\t\t\t\t<CompositeList<TabsTabMetadata>\n\t\t\t\t\t\telementsRef={composite.elementsRef}\n\t\t\t\t\t\tonMapChange={(map) => {\n\t\t\t\t\t\t\trootContext.setTabMap(map);\n\t\t\t\t\t\t\tcomposite.onMapChange(map);\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.children}\n\t\t\t\t\t</CompositeList>\n\t\t\t\t</CompositeRootContext>\n\t\t\t</TabsListContext>\n\t\t</Tag>\n\t);\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,YAAY,EAAEC,IAAI,EAAEC,SAAS,QAAQ,UAAU;AACxD,SAASC,YAAY,QAAQ,wDA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