{"version":3,"file":"pagination.BsMHysiS.js","sources":["../../../../../packages/web-components/src/lib/components/pagination/pagination.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport { PdsElement } from '../PdsElement';\nimport styles from './pagination.scss?inline';\nimport '@principal/design-system-icons-web/chevrons-left';\nimport '@principal/design-system-icons-web/chevron-left';\nimport '@principal/design-system-icons-web/chevrons-right';\nimport '@principal/design-system-icons-web/chevron-right';\nimport { pdsCustomElement as customElement } from '../../decorators/pds-custom-element';\nimport '../pagination-item/pagination-item';\n\n/**\n * @summary This component renders a pagination control\n *\n * @slot default Required: Holds pds-pagination-item components\n *\n * @fires pds-pagination-click A custom event dispatched on click with the following event detail summary messages:\n *\n * **fly-first** - a click registered on the 'fly to first page' control;\n * **step-backward** - a click registered on the 'step backward' control;\n * **step-forward** - a click registered on the 'step forward' control;\n * **fly-last** - a click registered on the 'fly to last page' control\n */\n@customElement('pds-pagination', {\n category: 'component',\n type: 'component',\n state: 'stable',\n styles,\n})\nexport class PdsPagination extends PdsElement {\n connectedCallback() {\n super.connectedCallback();\n this.initLocalization();\n }\n\n /**\n * Style variant\n * - **default** renders the default pagination\n * - **arrows** renders only arrows for pagination navigation, should only be used when horizontal space is extremely limited\n * - **no-arrows** renders pagination navigation without arrows, should only be used when there are only two or three pages of data\n */\n @property({ type: String })\n variant: 'default' | 'arrows' | 'no-arrows' = 'default';\n\n /**\n * Backward controls disabled\n */\n @property({ type: Boolean })\n backwardDisabled: boolean = false;\n\n /**\n * Forward controls disabled\n */\n @property({ type: Boolean })\n forwardDisabled: boolean = false;\n\n /**\n * Hides the fly to first and fly to last buttons, should only be true if a technical limitation prevents their use\n */\n @property({ type: Boolean })\n hideFlyers: boolean = false;\n\n /**\n * ARIA label string that describes pagination control for screen reader users\n */\n @property()\n ariaLabel: string;\n\n /**\n * If page navigation should be the result of the interaction, supply a url for the href for going to the first item\n */\n @property({ type: String })\n flyFirsthref: string;\n\n /**\n * If page navigation should be the result of the interaction, supply a url for the href for going to the next item\n */\n @property({ type: String })\n stepForwardhref: string;\n\n /**\n * If page navigation should be the result of the interaction, supply a url for the href for going to the last item\n */\n @property({ type: String })\n flyLasthref: string;\n\n /**\n * If page navigation should be the result of the interaction, supply a url for the href for going to the previous item\n */\n @property()\n stepBackwardhref: string;\n\n /**\n * @internal\n */\n @queryAssignedElements({ slot: undefined, selector: 'pds-pagination-item' })\n paginationItems: HTMLElement[];\n\n handleClick(e: Event) {\n const receivedEvent = e.target as Element;\n const buttonElement = receivedEvent.closest('.pds-c-pagination__button');\n const detailSummaryMessage = buttonElement?.classList\n .toString()\n .split('--')\n .pop();\n const customEvent = new CustomEvent('pds-pagination-click', {\n bubbles: true,\n composed: true,\n detail: {\n summary: detailSummaryMessage,\n },\n });\n\n this.dispatchEvent(customEvent);\n }\n\n /**\n * @internal\n * provides the arrow markup for the backward arrows\n */\n private backArrowMarkup() {\n return html`${this.hideFlyers\n ? ''\n : html`