{"version":3,"file":"footer-nav-item.Ds9rlee9.js","sources":["../../../../../packages/web-components/src/lib/components/footer-nav-item/footer-nav-item.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport { pdsCustomElement as customElement } from '../../decorators/pds-custom-element';\nimport { PdsElement } from '../PdsElement';\nimport styles from './footer-nav-item.scss?inline';\nimport '../list/list';\nimport '../list-item/list-item';\nimport '../link/link';\nimport '../heading/heading';\nimport '../accordion/accordion';\nimport { requiredSlot } from '../../decorators/requiredSlot';\n\n/**\n * @summary A component that renders a single link list at desktop and a accordion at mobile\n *\n * @slot default Required: A list of links to display in the footer nav section, restricted to pds-list elements\n */\n@customElement('pds-footer-nav-item', {\n category: 'component',\n type: 'component',\n state: 'stable',\n styles,\n})\nexport class PdsFooterNavItem extends PdsElement {\n /**\n * - **inverted** renders the footer-nav-item used for primary actions on a dark background\n * - **strong** renders the footer-nav-item used for primary actions on a subtle background\n */\n @property()\n variant: 'inverted' | 'strong' = 'inverted';\n\n /**\n * Top level label for the nav item group\n */\n @property()\n label: string = '';\n\n /**\n * @internal\n */\n @queryAssignedElements({ slot: undefined, selector: 'pds-list' })\n footerNavItemLinks: HTMLElement[];\n\n /**\n * @internal\n * This turns the label prop to an alphanumeric value and replaces spaces with hyphens\n */\n getIdFromLabel() {\n return this.label\n .replace(/[^a-z0-9\\s]/gi, '')\n .replace(/\\s+/g, '-')\n .toLowerCase();\n }\n\n /**\n * @internal\n * Duplicated from pds-footer until we refactor to utils\n */\n isSmallScreen() {\n return (\n this.responsiveViewportSize === 'xs' ||\n this.responsiveViewportSize === 'sm'\n );\n }\n\n /**\n * @internal\n */\n handleSlotChange(e: Event) {\n this.handleSlotValidation(e);\n\n this.footerNavItemLinks.forEach((list) => {\n list.setAttribute('spacing', 'sm');\n });\n }\n\n /**\n * @internal\n */\n getView() {\n return this.isSmallScreen() ? 'mobile' : 'desktop';\n }\n\n /**\n * @internal\n */\n getHeadingMarkup() {\n return html`\n ${this.label}\n `;\n }\n\n /**\n * @internal\n */\n getNavMarkup() {\n return html`\n \n `;\n }\n\n /**\n * @internal\n */\n get classNames() {\n return {\n [this.variant]: !!this.variant,\n };\n }\n\n /**\n * @internal\n */\n protected override firstUpdated() {\n super.firstUpdated();\n this.setWindowResizeHandler();\n this.handleSlotValidation();\n\n this.footerNavItemLinks.forEach((list) => {\n list.setAttribute('spacing', 'sm');\n });\n }\n\n @requiredSlot(['default'])\n render() {\n if (this.variant !== 'inverted' && this.variant !== 'strong') {\n console.error(\n 'Footer nav items must have a variant of strong or inverted defined.',\n this,\n );\n return nothing;\n }\n return html`
\n
\n ${this.isSmallScreen()\n ? html`\n ${this.getHeadingMarkup()}\n
${this.getNavMarkup()}
\n
`\n : html` ${this.getHeadingMarkup()} ${this.getNavMarkup()} `}\n
\n
`;\n }\n}\n"],"names":["PdsFooterNavItem","PdsElement","list","html","nothing","__decorateClass","property","queryAssignedElements","requiredSlot","customElement","styles"],"mappings":";;;;;;;;;;;;;;AAuBa,IAAAA,IAAN,cAA+BC,EAAW;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA,GAM4B,KAAA,UAAA,YAMjB,KAAA,QAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYhB,iBAAiB;AACR,WAAA,KAAK,MACT,QAAQ,iBAAiB,EAAE,EAC3B,QAAQ,QAAQ,GAAG,EACnB,YAAY;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjB,gBAAgB;AACd,WACE,KAAK,2BAA2B,QAChC,KAAK,2BAA2B;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAOpC,iBAAiB,GAAU;AACzB,SAAK,qBAAqB,CAAC,GAEtB,KAAA,mBAAmB,QAAQ,CAACC,MAAS;AACnC,MAAAA,EAAA,aAAa,WAAW,IAAI;AAAA,IAAA,CAClC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMH,UAAU;AACD,WAAA,KA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