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.

32 lines (29 loc) 2.13 kB
import { jsxs, Fragment, jsx } from 'react/jsx-runtime'; import { Component } from 'react'; import '../../provider.mjs'; import { splitChildren } from '../../splitChildren.mjs'; import { minifyCss } from '../../minifyCss.mjs'; import { stripFocusAndHoverStyles } from '../../stripFocusAndHoverStyles.mjs'; import { getFlyoutMultilevelItemCss as getComponentCss$T } from '../../../../../../components/dist/styles/esm/styles-entry.mjs'; import { PButtonPure } from '../components/button-pure.wrapper.mjs'; /** * @slot {"name": "", "description": "Default slot for the main content." } * * @experimental */ class DSRFlyoutMultilevelItem extends Component { host; scroller; get theme() { return this.props.theme || 'light'; // default as fallback (internal private prop is controlled by flyout-multilevel) } componentDidRender() { this.props.scroller.scrollTo(0, 0); // Reset scroll position when navigated } render() { splitChildren(this.props.children); const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$T(this.props.primary, this.props.secondary, this.props.cascade, this.theme))); return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsx(PButtonPure, { inert: this.props.primary || this.props.cascade, className: "button", type: "button", size: "medium", alignLabel: "start", stretch: true, icon: "arrow-head-right", active: this.props.secondary, aria: { 'aria-expanded': this.props.secondary }, theme: this.theme, children: this.props.label }), jsx(PButtonPure, { className: "back", type: "button", size: "small", alignLabel: "end", stretch: true, icon: "arrow-left", theme: this.theme, hideLabel: { base: true, s: false }, children: this.props.label }), jsx("h2", { children: this.props.label }), jsx("div", { className: "drawer", children: jsx("div", { className: "scroller", children: jsx("slot", {}) }) })] })] }), this.props.children] })); } } export { DSRFlyoutMultilevelItem };