UNPKG

@porsche-design-system/components-react

Version:

Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.

39 lines (35 loc) 1.89 kB
'use strict'; var jsxRuntime = require('react/jsx-runtime'); var react = require('react'); require('../../provider.cjs'); var splitChildren = require('../../splitChildren.cjs'); var minifyCss = require('../../minifyCss.cjs'); var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs'); var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs'); var scroller_wrapper = require('../components/scroller.wrapper.cjs'); /** * @slot {"name": "", "description": "Default slot for the `button` or `a` tags which will be rendered as tabs." } * * @controlled {"props": ["activeTabIndex"], "event": "update"} */ class DSRTabsBar extends react.Component { host; tabs = []; bar; scroller; slot; hasPTabsParent; isTabList; resizeObserver; render() { const { children} = splitChildren.splitChildren(this.props.children); const style = minifyCss.minifyCss(stylesEntry.getTabsBarCss(this.props.background, this.props.size, this.props.compact, utilsEntry.getSanitizedActiveTabIndex(this.props.activeTabIndex, children))); return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs(scroller_wrapper.PScroller, { className: "scroller", compact: this.props.compact, ...(this.props.isTabList && { aria: { role: 'tablist', ...utilsEntry.parseAndGetAriaAttributes(this.props.aria), }, }), children: [jsxRuntime.jsx("slot", {}), jsxRuntime.jsx("span", { className: "bar" })] })] }), this.props.children] })); } } exports.DSRTabsBar = DSRTabsBar;