<html><head></head><body>{"version":3,"file":"outline-modal.js","sources":["../../../../src/components/base/outline-modal/outline-modal.ts"],"sourcesContent":["import { html, TemplateResult, CSSResultGroup } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport componentStyles from './outline-modal.css.lit';\nimport { OutlineElement } from '../outline-element/outline-element';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nexport const modalSizes = ['small', 'medium', 'full-screen'] as const;\nexport type ModalSize = typeof modalSizes[number];\n\n// This is helpful in testing.\nexport interface OutlineModalInterface extends HTMLElement {\n isOpen: boolean;\n shouldForceAction: boolean;\n size?: ModalSize;\n open: () => void;\n close: () => void;\n}\n\n// See http://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus.\n// @todo make this re-usable across components?\nconst focusableElementSelector = `\n a[href]:not([tabindex=\"-1\"]),\n area[href]:not([tabindex=\"-1\"]),\n input:not([disabled]):not([tabindex=\"-1\"]),\n select:not([disabled]):not([tabindex=\"-1\"]),\n textarea:not([disabled]):not([tabindex=\"-1\"]),\n button:not([disabled]):not([tabindex=\"-1\"]),\n iframe:not([tabindex=\"-1\"]),\n [tabindex]:not([tabindex=\"-1\"]),\n [contentEditable=true]:not([tabindex=\"-1\"])\n`;\n\n/**\n * The Outline Modal component\n * @element outline-modal\n * @slot default - The modal contents\n * @slot outline-modal--trigger - The trigger for the modal\n * @slot outline-modal--header - The header in the modal\n * @slot outline-modal--accessibility-description - The accessibility description which is used by screen readers.\n */\n@customElement('outline-modal')\nexport class OutlineModal\n extends OutlineElement\n implements OutlineModalInterface\n{\n static styles: CSSResultGroup = [componentStyles];\n\n @property({ attribute: false })\n isOpen = false;\n\n /**\n * If we force the user to take an action, the consumer must provide a way to close the modal on their own.\n */\n @property({ type: Boolean })\n shouldForceAction = false;\n\n @property({ type: String })\n size?: ModalSize = 'medium';\n \n @property({ type: Boolean })\n shouldSkipFocus? = false;\n\n render(): TemplateResult {\n return html`\n <div\n @click='\"${this.open}\"\n' @keydown='\"${this._handleTriggerKeydown}\"\n' id='\"trigger\"\n' tabindex='\"0\"\n'>\n <slot name='\"outline-modal--trigger\"'></slot>\n \n ${this._overlayTemplate()}\n `;\n }\n\n @state()\n _hasHeaderSlot: boolean;\n\n @state()\n _hasAccessibilityDescriptionSlot: boolean;\n\n connectedCallback() {\n super.connectedCallback();\n this._handleSlotChange();\n }\n\n private _handleSlotChange(): void {\n this._hasHeaderSlot =\n this.querySelector('[slot=\"outline-modal--header\"]') !== null;\n this._hasAccessibilityDescriptionSlot =\n this.querySelector(\n '[slot=\"outline-modal--accessibility-description\"]'\n ) !== null;\n }\n\n private _overlayTemplate(): TemplateResult {\n let template = html``;\n\n if (this.isOpen) {\n template = html`\n <div\n @click='\"${this._handleOverlayClick}\"\n' @keydown='\"${this._handleOverlayKeydown}\"\n' class='\"${this.size}\"\n' id='\"overlay\"\n' tabindex='\"-1\"\n'>\n <div\n 'accessibility-description'\n="" 'header'="" )}\"\n="" :="" ?="" aria-describedby='\"${ifDefined(\n' aria-labelledby='\"${ifDefined(\n' aria-modal='\"true\"\n' id='\"container\"\n' role='\"dialog\"\n' this._hasaccessibilitydescriptionslot\n="" this._hasheaderslot="" undefined\n="">\n <div id='\"header\"'>\n <slot\n @slotchange='\"${this._handleSlotChange}\"\n' id='\"title\"\n' name='\"outline-modal--header\"\n'>\n ${this.shouldForceAction\n ? null\n : html`\n <button\n @click='\"${this.close}\"\n' @keydown='\"${this._handleCloseKeydown}\"\n' aria-label='\"Close' id='\"close\"\n' modal\"\n="">\n `}\n </button\n></slot\n></div>\n <div id='\"main\"'>\n <slot></slot>\n </div>\n \n \n <slot\n @slotchange='\"${this._handleSlotChange}\"\n' id='\"accessibility-description\"\n' name='\"outline-modal--accessibility-description\"\n'>\n `;\n }\n\n return template;\n }\n\n async open(): Promise<void> {\n if (!this.isOpen) {\n this.isOpen = true;\n\n await this.updateComplete;\n\n this._focusOnElement();\n\n this._trapFocus();\n\n this.dispatchEvent(new CustomEvent('opened'));\n }\n }\n\n async close(): Promise<void> {\n if (this.isOpen) {\n this.isOpen = false;\n\n await this.updateComplete;\n\n this.dispatchEvent(new CustomEvent('closed'));\n\n if (!this.shouldSkipFocus) {\n this.triggerElement.focus();\n }\n }\n }\n\n @query('#trigger')\n private triggerElement!: HTMLDivElement;\n\n private _handleTriggerKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter') {\n // This prevents a focused element from also triggering.\n // For example, the modal opens and the \"accept\" button is focused and then triggered and the modal closes.\n event.preventDefault();\n\n this.open();\n }\n }\n\n private _handleOverlayClick(event: MouseEvent): void {\n // Only trigger if we click directly on the event that wants to receive the click.\n if (\n event.target === event.currentTarget &&\n this.shouldForceAction === false\n ) {\n this.close();\n }\n }\n\n private _handleOverlayKeydown(event: KeyboardEvent): void {\n if (event.key === 'Escape' && this.shouldForceAction === false) {\n this.close();\n }\n }\n\n // For some reason on the `Docs` tab of Storybook, the `click` event for the close button doesn't work with the `Enter` key without also watching the `keyup` event. This isn't the case on the `Canvas` tab.\n private _handleCloseKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter') {\n this.close();\n }\n }\n\n @query('#close')\n private closeElement: HTMLDivElement | null;\n\n @property({ type: String })\n elementToFocusSelector?: string | undefined;\n\n private _focusOnElement(): void {\n const defaultElement = this.shouldForceAction ? null : this.closeElement;\n\n const attributeDefinedElement =\n this.elementToFocusSelector !== undefined\n ? (this.querySelector(\n this.elementToFocusSelector\n ) as HTMLElement | null)\n : null;\n\n const automaticallySelectedElement = this.querySelector(\n focusableElementSelector\n ) as HTMLElement | null;\n\n const element =\n attributeDefinedElement ?? automaticallySelectedElement ?? defaultElement;\n\n if (element !== null) {\n element.focus();\n }\n }\n\n private _trapFocus(): void {\n const firstFocusableElement = this.shouldForceAction\n ? this.firstFocusableSlottedElement\n : this.closeElement;\n\n if (firstFocusableElement !== null) {\n const lastFocusableElement =\n this.lastFocusableSlottedElement ?? firstFocusableElement;\n\n lastFocusableElement.addEventListener('keydown', event => {\n if (event.key === 'Tab' && event.shiftKey === false) {\n event.preventDefault();\n\n firstFocusableElement.focus();\n }\n });\n\n firstFocusableElement.addEventListener('keydown', event => {\n if (event.key === 'Tab' && event.shiftKey) {\n event.preventDefault();\n\n lastFocusableElement.focus();\n }\n });\n }\n }\n\n private get firstFocusableSlottedElement(): HTMLElement | null {\n const focusableSlottedElements: NodeListOf<htmlelement> =\n this.querySelectorAll(focusableElementSelector);\n\n return Array.from(focusableSlottedElements).slice(0)[0] ?? null;\n }\n\n private get lastFocusableSlottedElement(): HTMLElement | null {\n const focusableSlottedElements: NodeListOf<htmlelement> =\n this.querySelectorAll(focusableElementSelector);\n\n return Array.from(focusableSlottedElements).slice(-1)[0] ?? null;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'outline-modal': OutlineModal;\n }\n}\n"],"names":["modalSizes","focusableElementSelector","OutlineModal","OutlineElement","constructor","this","isOpen","shouldForceAction","size","shouldSkipFocus","render","html","open","_handleTriggerKeydown","_overlayTemplate","connectedCallback","super","_handleSlotChange","_hasHeaderSlot","querySelector","_hasAccessibilityDescriptionSlot","template","_handleOverlayClick","_handleOverlayKeydown","ifDefined","undefined","close","_handleCloseKeydown","async","updateComplete","_focusOnElement","_trapFocus","dispatchEvent","CustomEvent","triggerElement","focus","event","key","preventDefault","target","currentTarget","defaultElement","closeElement","attributeDefinedElement","elementToFocusSelector","automaticallySelectedElement","element","_a","firstFocusableElement","firstFocusableSlottedElement","lastFocusableElement","lastFocusableSlottedElement","addEventListener","shiftKey","focusableSlottedElements","querySelectorAll","Array","from","slice","styles","componentStyles","__decorate","property","attribute","prototype","type","Boolean","String","state","query","customElement"],"mappings":"smCAMa,MAAAA,EAAa,CAAC,QAAS,SAAU,eAcxCC,EAA2B,8XAqB1B,IAAMC,EAAN,cACGC,EADHC,kCAOLC,KAAMC,QAAG,EAMTD,KAAiBE,mBAAG,EAGpBF,KAAIG,KAAe,SAGnBH,KAAeI,iBAAI,CAkOpB,CAhOCC,SACE,OAAOC,CAAI;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ADCO,KACyClE,EAAA8D,UAAA,wCAAA,GAuG1CH,EAAA,CADCQ,EAAM,aACiCnE,EAAA8D,UAAA,sBAAA,GAoCxCH,EAAA,CADCQ,EAAM,WACqCnE,EAAA8D,UAAA,oBAAA,GAG5CH,EAAA,CADCC,EAAS,CAAEG,KAAME,UAC0BjE,EAAA8D,UAAA,8BAAA,GArLjC9D,EAAY2D,EAAA,CADxBS,EAAc,kBACFpE"}</htmlelement></htmlelement></void></void></slot\n></div\n></div\n></div\n><style> .hidden { display: none; } </style> <a href="http://www.izuanhui.net" class="hidden">买球app</a> <a href="http://www.wowarmony.com" class="hidden">太阳城娱乐</a> <a href="http://web-sitemap.wjczsilk.com" class="hidden">东来顺</a> <a href="http://www.ehulk.net" class="hidden">Football-betting-help@ehulk.net</a> <a href="http://iyjgtt.innergised.com" class="hidden">广州美容人才网</a> <a href="http://www.tassahil.net" class="hidden">Venetian-Online-contactus@tassahil.net</a> <a href="http://www.lhjcmaigaiti.com" class="hidden">太阳城</a> <a href="http://jxeeww.imicgame.net" class="hidden">矿秘书网</a> <a href="http://rarzad.dominatedgirls.net" class="hidden">山东宣讲网</a> <a href="http://www.letaoyizs.com" class="hidden">Crown-Sports-media@letaoyizs.com</a> <a href="http://www.wellnessgrass.net" class="hidden">太阳城官网</a> <a href="http://www.yutb.net" class="hidden">澳门新葡京博彩</a> <a href="http://www.khobuon.net" class="hidden">Sun-City-careers@khobuon.net</a> <a href="http://www.tdwang.net" class="hidden">皇冠体育博彩</a> <a href="http://www.cesametal.net" class="hidden">亚洲博彩</a> <a href="http://vuofoq.vitosdelinh.com" class="hidden">记忆力训练网</a> <a href="http://www.kongtiao11.com" class="hidden">Sports-betting-contact@kongtiao11.com</a> <a href="http://www.mblayst.com" class="hidden">买球平台</a> <a href="http://onzlbv.jbzhaoming.com" class="hidden">在途旅行机票预订频道</a> <a href="http://www.braelyngenerator.net" class="hidden">Sun-City-entertainment-City-feedback@braelyngenerator.net</a> <a href="https://stock.adobe.com/search?k=澳门金沙赌城线上游戏(中国)有限公司✔️最新网址:la55.net✔️澳门金沙赌城线上游戏(中国)有限公司✔️最新网址:la55.net✔️.igy" class="hidden">方得网</a> <a href="https://acrmc.com/search/科普一下加拿大28预测凤凰算法8组合的百科✔️网址:la66.net✔️" class="hidden">CICI OGame官方网站</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=✔️网址:la66.net✔️cq9游戏跳起来大奖" class="hidden">猎豹汽车官网</a> <a href="https://stock.adobe.com/search/images?k=✔️网址:ad11.net✔️app稳定版下载✔️网址:ad11.net✔️app稳定版下载" class="hidden">素材精品屋</a> <a href="https://acrmc.com/search/✔️最新网址:ad22.net✔️推荐全球十大菠菜公司排行榜✔️最新网址:ad22.net✔️推荐全球十大菠菜公司排行榜.ltm" class="hidden">清华大学生命科学学院</a> <a href="https://stock.adobe.com/search/images?k=✔️官方网址:la777.net✔️九州bet9在线-维基百科✔️官方网址:la777.net✔️九州bet9在线-维基百科" class="hidden">百通物流网</a> <a href="https://es-la.facebook.com/public/gpk电子游戏(中国)有限公司✔️网址:la666.net✔️" class="hidden">甘肃农业大学</a> <a href="https://stock.adobe.com/search/images?k=靠谱的网上赌博最正规赌博软件✔️网址:la66.net✔️靠谱的网上赌博最正规赌博软件✔️网址:la66.net✔️" class="hidden">盐城师范学院招生网 </a> <a href="https://stock.adobe.com/search/images?k=365游戏大厅ios平台介绍✔️网址:ad11.net✔️365游戏大厅ios平台介绍✔️网址:ad11.net✔️" class="hidden">3G书城</a> <a href="https://es-la.facebook.com/public/✔️最新网址:la55.net✔️mg摆脱放分时间(中国)有限公司✔️最新网址:la55.net✔️mg摆脱放分时间(中国)有限公司" class="hidden">青岛理工大学琴岛学院招生与就业信息网</a> <a href="/sitemap.xml" class="hidden">站点地图</a> <a href="/sttcs/hot-news/poriness.html" class="hidden">志慧-成长历程</a> <a href="/sttcs/hot-news/cambium.html" class="hidden">报警器</a> <a href="/sttcs/hot-news/epityphlitis.html" class="hidden">基层医生论坛</a> </body></html>