{"version":3,"file":"sidebar.Bb9Le4Kr.js","sources":["../../../../../packages/web-components/src/lib/components/sidebar/sidebar.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { pdsCustomElement as customElement } from '../../decorators/pds-custom-element';\nimport { PdsElement } from '../PdsElement';\nimport styles from './sidebar.scss?inline';\nimport { requiredSlot } from '../../decorators/requiredSlot';\n\n/**\n * @summary This components provides a layout for webpages containing sidebars\n *\n * @slot default Required: Main content\n * @slot left-sidebar Optional: Content to be rendered at left sidebar\n * @slot right-sidebar Optional: Content to be rendered at right sidebar\n */\n@customElement('pds-sidebar', {\n category: 'layout',\n type: 'component',\n state: 'stable',\n styles,\n})\nexport class PdsSidebar extends PdsElement {\n /**\n * - **default** stacks at (64rem/ 1024px) viewport\n * - **faster** stacks at a smaller viewport (48rem/ 768px)\n * - **slower** stacks at a larger viewport (85.375rem/ 1366px)\n */\n @property()\n break: 'faster' | 'slower' | 'default' = 'default';\n\n /**\n * - **default** spaced with a default gap (24px)\n * - **none** no gap between content and sidebar\n * - **sm** spaced with a smaller gap (8px)\n * - **lg** spaced with a larger gap (32px)\n */\n @property()\n gap: 'none' | 'sm' | 'lg' | 'default' = 'default';\n\n protected override firstUpdated() {\n super.firstUpdated();\n this.setWindowResizeHandler();\n }\n\n /**\n * @internal\n */\n get classNames() {\n return {\n [`break-${this.break}`]: !!this.break,\n [`gap-${this.gap}`]: !!this.gap,\n 'right-sidebar': !!(\n this.slotNotEmpty('right-sidebar') && this.slotEmpty('left-sidebar')\n ),\n 'left-sidebar': !!(\n this.slotNotEmpty('left-sidebar') && this.slotEmpty('right-sidebar')\n ),\n 'leftandright-sidebars': !!(\n this.slotNotEmpty('left-sidebar') && this.slotNotEmpty('right-sidebar')\n ),\n };\n }\n\n /**\n * @internal\n */\n checkForMobileView() {\n if (\n ['xs', 'sm', 'md'].includes(this.responsiveViewportSize) &&\n this.break === 'default'\n ) {\n return true;\n }\n if (\n ['xs', 'sm'].includes(this.responsiveViewportSize) &&\n this.break === 'faster'\n ) {\n return true;\n }\n if (\n ['xs', 'sm', 'md', 'lg'].includes(this.responsiveViewportSize) &&\n this.break === 'slower'\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * @internal\n */\n getSlots() {\n const leftSidebarSlot = this.slotNotEmpty('left-sidebar')\n ? html``\n : nothing;\n const mainContentSlot = html``;\n\n const rightSidebarSlot = this.slotNotEmpty('right-sidebar')\n ? html``\n : nothing;\n\n return {\n leftSidebar: leftSidebarSlot,\n mainContent: mainContentSlot,\n rightSidebar: rightSidebarSlot,\n };\n }\n\n @requiredSlot(['default'])\n render() {\n const slots = this.getSlots();\n return html`
\n ${this.checkForMobileView()\n ? html`\n ${slots.mainContent} ${slots.leftSidebar} ${slots.rightSidebar}\n `\n : html`\n ${slots.leftSidebar} ${slots.mainContent} ${slots.rightSidebar}\n `}\n
`;\n }\n}\n"],"names":["PdsSidebar","PdsElement","leftSidebarSlot","html","nothing","mainContentSlot","rightSidebarSlot","slots","__decorateClass","property","requiredSlot","customElement","styles"],"mappings":";;;;;;;;;AAoBa,IAAAA,IAAN,cAAyBC,EAAW;AAAA,EAApC,cAAA;AAAA,UAAA,GAAA,SAAA,GAOoC,KAAA,QAAA,WASD,KAAA,MAAA;AAAA,EAAA;AAAA,EAErB,eAAe;AAChC,UAAM,aAAa,GACnB,KAAK,uBAAuB;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAM9B,IAAI,aAAa;AACR,WAAA;AAAA,MACL,CAAC,SAAS,KAAK,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK;AAAA,MAChC,CAAC,OAAO,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK;AAAA,MAC5B,iBAAiB,CAAC,EAChB,KAAK,aAAa,eAAe,KAAK,KAAK,UAAU,cAAc;AAAA,MAErE,gBAAgB,CAAC,EACf,KAAK,aAAa,cAAc,KAAK,KAAK,UAAU,eAAe;AAAA,MAErE,yBAAyB,CAAC,EAC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