@spectrum-web-components/dialog 0.37.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -137,7 +137,7 @@ Note: the `dissmissable` attribute will not be followed when `mode="fullscreen"`
137
137
  <sp-dialog size="medium" dismissable no-divider>
138
138
  <div
139
139
  slot="hero"
140
- style="background-image: url(https://place.dog/500/280)"
140
+ style="background-image: url(https://picsum.photos/1400/260)"
141
141
  ></div>
142
142
  <h2 slot="heading">Disclaimer</h2>
143
143
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/dialog",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -73,14 +73,14 @@
73
73
  "lit-html"
74
74
  ],
75
75
  "dependencies": {
76
- "@spectrum-web-components/base": "^0.37.0",
77
- "@spectrum-web-components/button": "^0.37.0",
78
- "@spectrum-web-components/button-group": "^0.37.0",
79
- "@spectrum-web-components/divider": "^0.37.0",
80
- "@spectrum-web-components/icons-workflow": "^0.37.0",
81
- "@spectrum-web-components/modal": "^0.37.0",
82
- "@spectrum-web-components/shared": "^0.37.0",
83
- "@spectrum-web-components/underlay": "^0.37.0"
76
+ "@spectrum-web-components/base": "^0.38.0",
77
+ "@spectrum-web-components/button": "^0.38.0",
78
+ "@spectrum-web-components/button-group": "^0.38.0",
79
+ "@spectrum-web-components/divider": "^0.38.0",
80
+ "@spectrum-web-components/icons-workflow": "^0.38.0",
81
+ "@spectrum-web-components/modal": "^0.38.0",
82
+ "@spectrum-web-components/shared": "^0.38.0",
83
+ "@spectrum-web-components/underlay": "^0.38.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@spectrum-css/dialog": "^6.0.66"
@@ -91,5 +91,5 @@
91
91
  "./sp-*.js",
92
92
  "./**/*.dev.js"
93
93
  ],
94
- "gitHead": "d771f62f0d8063070af43283bb0fd5e3400bad06"
94
+ "gitHead": "9a099b7543672f2fd4030833ab813b16c2cad62e"
95
95
  }
package/src/Dialog.dev.js CHANGED
@@ -188,6 +188,9 @@ const _Dialog = class _Dialog extends FocusVisiblePolyfillMixin(
188
188
  onContentSlotChange({
189
189
  target
190
190
  }) {
191
+ requestAnimationFrame(() => {
192
+ this.shouldManageTabOrderForScrolling();
193
+ });
191
194
  if (this.conditionDescribedby) {
192
195
  this.conditionDescribedby();
193
196
  delete this.conditionDescribedby;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Dialog.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\nimport { conditionAttributeWithId } from '@spectrum-web-components/base/src/condition-attribute-with-id.js';\n\nimport '@spectrum-web-components/divider/sp-divider.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport {\n FocusVisiblePolyfillMixin,\n ObserveSlotPresence,\n} from '@spectrum-web-components/shared';\n\nimport styles from './dialog.css.js';\nimport type { CloseButton } from '@spectrum-web-components/button';\n\nlet appliedIds = 0;\n\nfunction gatherAppliedIdsFromSlottedChildren(\n slot: HTMLSlotElement,\n idBase: string\n): string[] {\n const assignedElements = slot.assignedElements();\n const ids: string[] = [];\n assignedElements.forEach((el) => {\n if (el.id) {\n ids.push(el.id);\n } else {\n const id = idBase + `-${appliedIds++}`;\n el.id = id;\n ids.push(id);\n }\n });\n return ids;\n}\n\n/**\n * @element sp-dialog\n *\n * @slot hero - Accepts a hero image to display at the top of the dialog\n * @slot heading - Acts as the heading of the dialog. This should be an actual heading tag `<h1-6 />`\n * @slot - Content not addressed to a specific slot will be interpreted as the main content of the dialog\n * @slot footer - Content addressed to the `footer` will be placed below the main content and to the side of any `[slot='button']` content\n * @slot button - Button elements addressed to this slot may be placed below the content when not delivered in a fullscreen mode\n * @fires close - Announces that the dialog has been closed.\n */\nexport class Dialog extends FocusVisiblePolyfillMixin(\n ObserveSlotPresence(SpectrumElement, [\n '[slot=\"hero\"]',\n '[slot=\"footer\"]',\n '[slot=\"button\"]',\n ])\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @query('.close-button')\n closeButton?: CloseButton;\n\n @query('.content')\n private contentElement!: HTMLDivElement;\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n protected get hasFooter(): boolean {\n return this.getSlotContentPresence('[slot=\"footer\"]');\n }\n\n protected get hasButtons(): boolean {\n return this.getSlotContentPresence('[slot=\"button\"]');\n }\n\n /* c8 ignore next 3 */\n protected get hasHero(): boolean {\n return this.getSlotContentPresence('[slot=\"hero\"]');\n }\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n public close(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n protected renderHero(): TemplateResult {\n return html`\n <slot name=\"hero\"></slot>\n `;\n }\n\n protected renderHeading(): TemplateResult {\n return html`\n <slot name=\"heading\" @slotchange=${this.onHeadingSlotchange}></slot>\n `;\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <div class=\"content\">\n <slot @slotchange=${this.onContentSlotChange}></slot>\n </div>\n `;\n }\n\n protected renderFooter(): TemplateResult {\n return html`\n <div class=\"footer\">\n <slot name=\"footer\"></slot>\n </div>\n `;\n }\n\n protected renderButtons(): TemplateResult {\n const classes = {\n 'button-group': true,\n 'button-group--noFooter': !this.hasFooter,\n };\n return html`\n <sp-button-group class=${classMap(classes)}>\n <slot name=\"button\"></slot>\n </sp-button-group>\n `;\n }\n\n protected renderDismiss(): TemplateResult {\n return html`\n <sp-close-button\n class=\"close-button\"\n label=\"Close\"\n quiet\n size=\"m\"\n @click=${this.close}\n ></sp-close-button>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"grid\">\n ${this.renderHero()} ${this.renderHeading()}\n ${this.error\n ? html`\n <sp-icon-alert class=\"type-icon\"></sp-icon-alert>\n `\n : nothing}\n ${this.noDivider\n ? nothing\n : html`\n <sp-divider size=\"m\" class=\"divider\"></sp-divider>\n `}\n ${this.renderContent()}\n ${this.hasFooter ? this.renderFooter() : nothing}\n ${this.hasButtons ? this.renderButtons() : nothing}\n ${this.dismissable ? this.renderDismiss() : nothing}\n </div>\n `;\n }\n\n public shouldManageTabOrderForScrolling = (): void => {\n const { offsetHeight, scrollHeight } = this.contentElement;\n if (offsetHeight < scrollHeight) {\n this.contentElement.tabIndex = 0;\n } else {\n this.contentElement.removeAttribute('tabindex');\n }\n };\n\n protected override shouldUpdate(changes: PropertyValues): boolean {\n if (changes.has('mode') && !!this.mode) {\n this.dismissable = false;\n }\n if (changes.has('dismissable') && this.dismissable) {\n this.dismissable = !this.mode;\n }\n return super.shouldUpdate(changes);\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('role', 'dialog');\n }\n\n static instanceCount = 0;\n private labelledbyId = `sp-dialog-label-${Dialog.instanceCount++}`;\n private conditionLabelledby?: () => void;\n private conditionDescribedby?: () => void;\n\n private onHeadingSlotchange({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n if (this.conditionLabelledby) {\n this.conditionLabelledby();\n delete this.conditionLabelledby;\n }\n const ids = gatherAppliedIdsFromSlottedChildren(\n target,\n this.labelledbyId\n );\n if (ids.length) {\n this.conditionLabelledby = conditionAttributeWithId(\n this,\n 'aria-labelledby',\n ids\n );\n }\n }\n\n private describedbyId = `sp-dialog-description-${Dialog.instanceCount++}`;\n\n protected onContentSlotChange({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n if (this.conditionDescribedby) {\n this.conditionDescribedby();\n delete this.conditionDescribedby;\n }\n const ids = gatherAppliedIdsFromSlottedChildren(\n target,\n this.describedbyId\n );\n if (ids.length && ids.length < 4) {\n this.conditionDescribedby = conditionAttributeWithId(\n this,\n 'aria-describedby',\n ids\n );\n } else if (!ids.length) {\n const idProvided = !!this.id;\n if (!idProvided) this.id = this.describedbyId;\n const conditionDescribedby = conditionAttributeWithId(\n this,\n 'aria-describedby',\n this.id\n );\n this.conditionDescribedby = () => {\n conditionDescribedby();\n if (!idProvided) {\n this.removeAttribute('id');\n }\n };\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n }\n\n public override disconnectedCallback(): void {\n window.removeEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n super.disconnectedCallback();\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,EAEA;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,gBAAgB;AACzB,SAAS,gCAAgC;AAEzC,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP,OAAO,YAAY;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AAM,qBAAqB;AAAA,EAC/B;AACJ;AArOa,QAyJF,gBAAgB;AA7IvB;AAAA,EADC,MAAM,eAAe;AAAA,GAXb,QAYT;AAGQ;AAAA,EADP,MAAM,UAAU;AAAA,GAdR,QAeD;AAGD;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAjBjC,QAkBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GApBjC,QAqBF;AAgBA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,aAAa,CAAC;AAAA,GApC1D,QAqCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAvChC,QAwCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GA1ChC,QA2CF;AA3CJ,WAAM,SAAN;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\nimport { conditionAttributeWithId } from '@spectrum-web-components/base/src/condition-attribute-with-id.js';\n\nimport '@spectrum-web-components/divider/sp-divider.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport {\n FocusVisiblePolyfillMixin,\n ObserveSlotPresence,\n} from '@spectrum-web-components/shared';\n\nimport styles from './dialog.css.js';\nimport type { CloseButton } from '@spectrum-web-components/button';\n\nlet appliedIds = 0;\n\nfunction gatherAppliedIdsFromSlottedChildren(\n slot: HTMLSlotElement,\n idBase: string\n): string[] {\n const assignedElements = slot.assignedElements();\n const ids: string[] = [];\n assignedElements.forEach((el) => {\n if (el.id) {\n ids.push(el.id);\n } else {\n const id = idBase + `-${appliedIds++}`;\n el.id = id;\n ids.push(id);\n }\n });\n return ids;\n}\n\n/**\n * @element sp-dialog\n *\n * @slot hero - Accepts a hero image to display at the top of the dialog\n * @slot heading - Acts as the heading of the dialog. This should be an actual heading tag `<h1-6 />`\n * @slot - Content not addressed to a specific slot will be interpreted as the main content of the dialog\n * @slot footer - Content addressed to the `footer` will be placed below the main content and to the side of any `[slot='button']` content\n * @slot button - Button elements addressed to this slot may be placed below the content when not delivered in a fullscreen mode\n * @fires close - Announces that the dialog has been closed.\n */\nexport class Dialog extends FocusVisiblePolyfillMixin(\n ObserveSlotPresence(SpectrumElement, [\n '[slot=\"hero\"]',\n '[slot=\"footer\"]',\n '[slot=\"button\"]',\n ])\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @query('.close-button')\n closeButton?: CloseButton;\n\n @query('.content')\n private contentElement!: HTMLDivElement;\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n protected get hasFooter(): boolean {\n return this.getSlotContentPresence('[slot=\"footer\"]');\n }\n\n protected get hasButtons(): boolean {\n return this.getSlotContentPresence('[slot=\"button\"]');\n }\n\n /* c8 ignore next 3 */\n protected get hasHero(): boolean {\n return this.getSlotContentPresence('[slot=\"hero\"]');\n }\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n public close(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n protected renderHero(): TemplateResult {\n return html`\n <slot name=\"hero\"></slot>\n `;\n }\n\n protected renderHeading(): TemplateResult {\n return html`\n <slot name=\"heading\" @slotchange=${this.onHeadingSlotchange}></slot>\n `;\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <div class=\"content\">\n <slot @slotchange=${this.onContentSlotChange}></slot>\n </div>\n `;\n }\n\n protected renderFooter(): TemplateResult {\n return html`\n <div class=\"footer\">\n <slot name=\"footer\"></slot>\n </div>\n `;\n }\n\n protected renderButtons(): TemplateResult {\n const classes = {\n 'button-group': true,\n 'button-group--noFooter': !this.hasFooter,\n };\n return html`\n <sp-button-group class=${classMap(classes)}>\n <slot name=\"button\"></slot>\n </sp-button-group>\n `;\n }\n\n protected renderDismiss(): TemplateResult {\n return html`\n <sp-close-button\n class=\"close-button\"\n label=\"Close\"\n quiet\n size=\"m\"\n @click=${this.close}\n ></sp-close-button>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"grid\">\n ${this.renderHero()} ${this.renderHeading()}\n ${this.error\n ? html`\n <sp-icon-alert class=\"type-icon\"></sp-icon-alert>\n `\n : nothing}\n ${this.noDivider\n ? nothing\n : html`\n <sp-divider size=\"m\" class=\"divider\"></sp-divider>\n `}\n ${this.renderContent()}\n ${this.hasFooter ? this.renderFooter() : nothing}\n ${this.hasButtons ? this.renderButtons() : nothing}\n ${this.dismissable ? this.renderDismiss() : nothing}\n </div>\n `;\n }\n\n public shouldManageTabOrderForScrolling = (): void => {\n const { offsetHeight, scrollHeight } = this.contentElement;\n if (offsetHeight < scrollHeight) {\n this.contentElement.tabIndex = 0;\n } else {\n this.contentElement.removeAttribute('tabindex');\n }\n };\n\n protected override shouldUpdate(changes: PropertyValues): boolean {\n if (changes.has('mode') && !!this.mode) {\n this.dismissable = false;\n }\n if (changes.has('dismissable') && this.dismissable) {\n this.dismissable = !this.mode;\n }\n return super.shouldUpdate(changes);\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('role', 'dialog');\n }\n\n static instanceCount = 0;\n private labelledbyId = `sp-dialog-label-${Dialog.instanceCount++}`;\n private conditionLabelledby?: () => void;\n private conditionDescribedby?: () => void;\n\n private onHeadingSlotchange({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n if (this.conditionLabelledby) {\n this.conditionLabelledby();\n delete this.conditionLabelledby;\n }\n const ids = gatherAppliedIdsFromSlottedChildren(\n target,\n this.labelledbyId\n );\n if (ids.length) {\n this.conditionLabelledby = conditionAttributeWithId(\n this,\n 'aria-labelledby',\n ids\n );\n }\n }\n\n private describedbyId = `sp-dialog-description-${Dialog.instanceCount++}`;\n\n protected onContentSlotChange({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n requestAnimationFrame(() => {\n // Content must be available _AND_ styles must be applied.\n this.shouldManageTabOrderForScrolling();\n });\n if (this.conditionDescribedby) {\n this.conditionDescribedby();\n delete this.conditionDescribedby;\n }\n const ids = gatherAppliedIdsFromSlottedChildren(\n target,\n this.describedbyId\n );\n if (ids.length && ids.length < 4) {\n this.conditionDescribedby = conditionAttributeWithId(\n this,\n 'aria-describedby',\n ids\n );\n } else if (!ids.length) {\n const idProvided = !!this.id;\n if (!idProvided) this.id = this.describedbyId;\n const conditionDescribedby = conditionAttributeWithId(\n this,\n 'aria-describedby',\n this.id\n );\n this.conditionDescribedby = () => {\n conditionDescribedby();\n if (!idProvided) {\n this.removeAttribute('id');\n }\n };\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n }\n\n public override disconnectedCallback(): void {\n window.removeEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n super.disconnectedCallback();\n }\n}\n"],
5
+ "mappings": ";;;;;;;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AC9B,6BAAqB;AACrB,YAAI,CAAC,YAAY;AACb,eAAK,gBAAgB,IAAI;AAAA,QAC7B;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAAA,EAEgB,oBAA0B;AACtC,UAAM,kBAAkB;AACxB,WAAO;AAAA,MACH;AAAA,MACA,KAAK;AAAA,IACT;AAAA,EACJ;AAAA,EAEgB,uBAA6B;AACzC,WAAO;AAAA,MACH;AAAA,MACA,KAAK;AAAA,IACT;AACA,UAAM,qBAAqB;AAAA,EAC/B;AACJ;AAzOa,QAyJF,gBAAgB;AA7IvB;AAAA,EADC,MAAM,eAAe;AAAA,GAXb,QAYT;AAGQ;AAAA,EADP,MAAM,UAAU;AAAA,GAdR,QAeD;AAGD;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAjBjC,QAkBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GApBjC,QAqBF;AAgBA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,aAAa,CAAC;AAAA,GApC1D,QAqCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAvChC,QAwCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GA1ChC,QA2CF;AA3CJ,WAAM,SAAN;",
6
6
  "names": []
7
7
  }
package/src/Dialog.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var m=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var n=(a,l,e,t)=>{for(var o=t>1?void 0:t?v(l,e):l,r=a.length-1,p;r>=0;r--)(p=a[r])&&(o=(t?p(l,e,o):p(o))||o);return t&&o&&m(l,e,o),o};import{html as i,nothing as d,SpectrumElement as f}from"@spectrum-web-components/base";import{property as c,query as b}from"@spectrum-web-components/base/src/decorators.js";import{classMap as g}from"@spectrum-web-components/base/src/directives.js";import{conditionAttributeWithId as u}from"@spectrum-web-components/base/src/condition-attribute-with-id.js";import"@spectrum-web-components/divider/sp-divider.js";import"@spectrum-web-components/button/sp-close-button.js";import"@spectrum-web-components/button-group/sp-button-group.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";import{FocusVisiblePolyfillMixin as y,ObserveSlotPresence as C}from"@spectrum-web-components/shared";import S from"./dialog.css.js";let E=0;function h(a,l){const e=a.assignedElements(),t=[];return e.forEach(o=>{if(o.id)t.push(o.id);else{const r=l+`-${E++}`;o.id=r,t.push(r)}}),t}const s=class s extends y(C(f,['[slot="hero"]','[slot="footer"]','[slot="button"]'])){constructor(){super(...arguments);this.error=!1;this.dismissable=!1;this.noDivider=!1;this.shouldManageTabOrderForScrolling=()=>{const{offsetHeight:e,scrollHeight:t}=this.contentElement;e<t?this.contentElement.tabIndex=0:this.contentElement.removeAttribute("tabindex")};this.labelledbyId=`sp-dialog-label-${s.instanceCount++}`;this.describedbyId=`sp-dialog-description-${s.instanceCount++}`}static get styles(){return[S]}get hasFooter(){return this.getSlotContentPresence('[slot="footer"]')}get hasButtons(){return this.getSlotContentPresence('[slot="button"]')}get hasHero(){return this.getSlotContentPresence('[slot="hero"]')}close(){this.dispatchEvent(new Event("close",{bubbles:!0,composed:!0,cancelable:!0}))}renderHero(){return i`
1
+ "use strict";var m=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var n=(a,l,e,t)=>{for(var o=t>1?void 0:t?v(l,e):l,r=a.length-1,u;r>=0;r--)(u=a[r])&&(o=(t?u(l,e,o):u(o))||o);return t&&o&&m(l,e,o),o};import{html as i,nothing as d,SpectrumElement as f}from"@spectrum-web-components/base";import{property as c,query as p}from"@spectrum-web-components/base/src/decorators.js";import{classMap as g}from"@spectrum-web-components/base/src/directives.js";import{conditionAttributeWithId as b}from"@spectrum-web-components/base/src/condition-attribute-with-id.js";import"@spectrum-web-components/divider/sp-divider.js";import"@spectrum-web-components/button/sp-close-button.js";import"@spectrum-web-components/button-group/sp-button-group.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";import{FocusVisiblePolyfillMixin as y,ObserveSlotPresence as S}from"@spectrum-web-components/shared";import C from"./dialog.css.js";let E=0;function h(a,l){const e=a.assignedElements(),t=[];return e.forEach(o=>{if(o.id)t.push(o.id);else{const r=l+`-${E++}`;o.id=r,t.push(r)}}),t}const s=class s extends y(S(f,['[slot="hero"]','[slot="footer"]','[slot="button"]'])){constructor(){super(...arguments);this.error=!1;this.dismissable=!1;this.noDivider=!1;this.shouldManageTabOrderForScrolling=()=>{const{offsetHeight:e,scrollHeight:t}=this.contentElement;e<t?this.contentElement.tabIndex=0:this.contentElement.removeAttribute("tabindex")};this.labelledbyId=`sp-dialog-label-${s.instanceCount++}`;this.describedbyId=`sp-dialog-description-${s.instanceCount++}`}static get styles(){return[C]}get hasFooter(){return this.getSlotContentPresence('[slot="footer"]')}get hasButtons(){return this.getSlotContentPresence('[slot="button"]')}get hasHero(){return this.getSlotContentPresence('[slot="hero"]')}close(){this.dispatchEvent(new Event("close",{bubbles:!0,composed:!0,cancelable:!0}))}renderHero(){return i`
2
2
  <slot name="hero"></slot>
3
3
  `}renderHeading(){return i`
4
4
  <slot name="heading" @slotchange=${this.onHeadingSlotchange}></slot>
@@ -36,5 +36,5 @@
36
36
  ${this.hasButtons?this.renderButtons():d}
37
37
  ${this.dismissable?this.renderDismiss():d}
38
38
  </div>
39
- `}shouldUpdate(e){return e.has("mode")&&this.mode&&(this.dismissable=!1),e.has("dismissable")&&this.dismissable&&(this.dismissable=!this.mode),super.shouldUpdate(e)}firstUpdated(e){super.firstUpdated(e),this.setAttribute("role","dialog")}onHeadingSlotchange({target:e}){this.conditionLabelledby&&(this.conditionLabelledby(),delete this.conditionLabelledby);const t=h(e,this.labelledbyId);t.length&&(this.conditionLabelledby=u(this,"aria-labelledby",t))}onContentSlotChange({target:e}){this.conditionDescribedby&&(this.conditionDescribedby(),delete this.conditionDescribedby);const t=h(e,this.describedbyId);if(t.length&&t.length<4)this.conditionDescribedby=u(this,"aria-describedby",t);else if(!t.length){const o=!!this.id;o||(this.id=this.describedbyId);const r=u(this,"aria-describedby",this.id);this.conditionDescribedby=()=>{r(),o||this.removeAttribute("id")}}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.shouldManageTabOrderForScrolling)}disconnectedCallback(){window.removeEventListener("resize",this.shouldManageTabOrderForScrolling),super.disconnectedCallback()}};s.instanceCount=0,n([b(".close-button")],s.prototype,"closeButton",2),n([b(".content")],s.prototype,"contentElement",2),n([c({type:Boolean,reflect:!0})],s.prototype,"error",2),n([c({type:Boolean,reflect:!0})],s.prototype,"dismissable",2),n([c({type:Boolean,reflect:!0,attribute:"no-divider"})],s.prototype,"noDivider",2),n([c({type:String,reflect:!0})],s.prototype,"mode",2),n([c({type:String,reflect:!0})],s.prototype,"size",2);export let Dialog=s;
39
+ `}shouldUpdate(e){return e.has("mode")&&this.mode&&(this.dismissable=!1),e.has("dismissable")&&this.dismissable&&(this.dismissable=!this.mode),super.shouldUpdate(e)}firstUpdated(e){super.firstUpdated(e),this.setAttribute("role","dialog")}onHeadingSlotchange({target:e}){this.conditionLabelledby&&(this.conditionLabelledby(),delete this.conditionLabelledby);const t=h(e,this.labelledbyId);t.length&&(this.conditionLabelledby=b(this,"aria-labelledby",t))}onContentSlotChange({target:e}){requestAnimationFrame(()=>{this.shouldManageTabOrderForScrolling()}),this.conditionDescribedby&&(this.conditionDescribedby(),delete this.conditionDescribedby);const t=h(e,this.describedbyId);if(t.length&&t.length<4)this.conditionDescribedby=b(this,"aria-describedby",t);else if(!t.length){const o=!!this.id;o||(this.id=this.describedbyId);const r=b(this,"aria-describedby",this.id);this.conditionDescribedby=()=>{r(),o||this.removeAttribute("id")}}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.shouldManageTabOrderForScrolling)}disconnectedCallback(){window.removeEventListener("resize",this.shouldManageTabOrderForScrolling),super.disconnectedCallback()}};s.instanceCount=0,n([p(".close-button")],s.prototype,"closeButton",2),n([p(".content")],s.prototype,"contentElement",2),n([c({type:Boolean,reflect:!0})],s.prototype,"error",2),n([c({type:Boolean,reflect:!0})],s.prototype,"dismissable",2),n([c({type:Boolean,reflect:!0,attribute:"no-divider"})],s.prototype,"noDivider",2),n([c({type:String,reflect:!0})],s.prototype,"mode",2),n([c({type:String,reflect:!0})],s.prototype,"size",2);export let Dialog=s;
40
40
  //# sourceMappingURL=Dialog.js.map
package/src/Dialog.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Dialog.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\nimport { conditionAttributeWithId } from '@spectrum-web-components/base/src/condition-attribute-with-id.js';\n\nimport '@spectrum-web-components/divider/sp-divider.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport {\n FocusVisiblePolyfillMixin,\n ObserveSlotPresence,\n} from '@spectrum-web-components/shared';\n\nimport styles from './dialog.css.js';\nimport type { CloseButton } from '@spectrum-web-components/button';\n\nlet appliedIds = 0;\n\nfunction gatherAppliedIdsFromSlottedChildren(\n slot: HTMLSlotElement,\n idBase: string\n): string[] {\n const assignedElements = slot.assignedElements();\n const ids: string[] = [];\n assignedElements.forEach((el) => {\n if (el.id) {\n ids.push(el.id);\n } else {\n const id = idBase + `-${appliedIds++}`;\n el.id = id;\n ids.push(id);\n }\n });\n return ids;\n}\n\n/**\n * @element sp-dialog\n *\n * @slot hero - Accepts a hero image to display at the top of the dialog\n * @slot heading - Acts as the heading of the dialog. This should be an actual heading tag `<h1-6 />`\n * @slot - Content not addressed to a specific slot will be interpreted as the main content of the dialog\n * @slot footer - Content addressed to the `footer` will be placed below the main content and to the side of any `[slot='button']` content\n * @slot button - Button elements addressed to this slot may be placed below the content when not delivered in a fullscreen mode\n * @fires close - Announces that the dialog has been closed.\n */\nexport class Dialog extends FocusVisiblePolyfillMixin(\n ObserveSlotPresence(SpectrumElement, [\n '[slot=\"hero\"]',\n '[slot=\"footer\"]',\n '[slot=\"button\"]',\n ])\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @query('.close-button')\n closeButton?: CloseButton;\n\n @query('.content')\n private contentElement!: HTMLDivElement;\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n protected get hasFooter(): boolean {\n return this.getSlotContentPresence('[slot=\"footer\"]');\n }\n\n protected get hasButtons(): boolean {\n return this.getSlotContentPresence('[slot=\"button\"]');\n }\n\n /* c8 ignore next 3 */\n protected get hasHero(): boolean {\n return this.getSlotContentPresence('[slot=\"hero\"]');\n }\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n public close(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n protected renderHero(): TemplateResult {\n return html`\n <slot name=\"hero\"></slot>\n `;\n }\n\n protected renderHeading(): TemplateResult {\n return html`\n <slot name=\"heading\" @slotchange=${this.onHeadingSlotchange}></slot>\n `;\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <div class=\"content\">\n <slot @slotchange=${this.onContentSlotChange}></slot>\n </div>\n `;\n }\n\n protected renderFooter(): TemplateResult {\n return html`\n <div class=\"footer\">\n <slot name=\"footer\"></slot>\n </div>\n `;\n }\n\n protected renderButtons(): TemplateResult {\n const classes = {\n 'button-group': true,\n 'button-group--noFooter': !this.hasFooter,\n };\n return html`\n <sp-button-group class=${classMap(classes)}>\n <slot name=\"button\"></slot>\n </sp-button-group>\n `;\n }\n\n protected renderDismiss(): TemplateResult {\n return html`\n <sp-close-button\n class=\"close-button\"\n label=\"Close\"\n quiet\n size=\"m\"\n @click=${this.close}\n ></sp-close-button>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"grid\">\n ${this.renderHero()} ${this.renderHeading()}\n ${this.error\n ? html`\n <sp-icon-alert class=\"type-icon\"></sp-icon-alert>\n `\n : nothing}\n ${this.noDivider\n ? nothing\n : html`\n <sp-divider size=\"m\" class=\"divider\"></sp-divider>\n `}\n ${this.renderContent()}\n ${this.hasFooter ? this.renderFooter() : nothing}\n ${this.hasButtons ? this.renderButtons() : nothing}\n ${this.dismissable ? this.renderDismiss() : nothing}\n </div>\n `;\n }\n\n public shouldManageTabOrderForScrolling = (): void => {\n const { offsetHeight, scrollHeight } = this.contentElement;\n if (offsetHeight < scrollHeight) {\n this.contentElement.tabIndex = 0;\n } else {\n this.contentElement.removeAttribute('tabindex');\n }\n };\n\n protected override shouldUpdate(changes: PropertyValues): boolean {\n if (changes.has('mode') && !!this.mode) {\n this.dismissable = false;\n }\n if (changes.has('dismissable') && this.dismissable) {\n this.dismissable = !this.mode;\n }\n return super.shouldUpdate(changes);\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('role', 'dialog');\n }\n\n static instanceCount = 0;\n private labelledbyId = `sp-dialog-label-${Dialog.instanceCount++}`;\n private conditionLabelledby?: () => void;\n private conditionDescribedby?: () => void;\n\n private onHeadingSlotchange({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n if (this.conditionLabelledby) {\n this.conditionLabelledby();\n delete this.conditionLabelledby;\n }\n const ids = gatherAppliedIdsFromSlottedChildren(\n target,\n this.labelledbyId\n );\n if (ids.length) {\n this.conditionLabelledby = conditionAttributeWithId(\n this,\n 'aria-labelledby',\n ids\n );\n }\n }\n\n private describedbyId = `sp-dialog-description-${Dialog.instanceCount++}`;\n\n protected onContentSlotChange({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n if (this.conditionDescribedby) {\n this.conditionDescribedby();\n delete this.conditionDescribedby;\n }\n const ids = gatherAppliedIdsFromSlottedChildren(\n target,\n this.describedbyId\n );\n if (ids.length && ids.length < 4) {\n this.conditionDescribedby = conditionAttributeWithId(\n this,\n 'aria-describedby',\n ids\n );\n } else if (!ids.length) {\n const idProvided = !!this.id;\n if (!idProvided) this.id = this.describedbyId;\n const conditionDescribedby = conditionAttributeWithId(\n this,\n 'aria-describedby',\n this.id\n );\n this.conditionDescribedby = () => {\n conditionDescribedby();\n if (!idProvided) {\n this.removeAttribute('id');\n }\n };\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n }\n\n public override disconnectedCallback(): void {\n window.removeEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n super.disconnectedCallback();\n }\n}\n"],
5
- "mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,EAEA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,4BAAAC,MAAgC,mEAEzC,MAAO,iDACP,MAAO,qDACP,MAAO,2DACP,MAAO,iEACP,OACI,6BAAAC,EACA,uBAAAC,MACG,kCAEP,OAAOC,MAAY,kBAGnB,IAAIC,EAAa,EAEjB,SAASC,EACLC,EACAC,E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AC1B,OAAO,KAAK,sBAEhB,MAAMR,EAAMJ,EACRY,EACA,KAAK,aACT,EACA,GAAIR,EAAI,QAAUA,EAAI,OAAS,EAC3B,KAAK,qBAAuBT,EACxB,KACA,mBACAS,CACJ,UACO,CAACA,EAAI,OAAQ,CACpB,MAAMS,EAAa,CAAC,CAAC,KAAK,GACrBA,IAAY,KAAK,GAAK,KAAK,eAChC,MAAMC,EAAuBnB,EACzB,KACA,mBACA,KAAK,EACT,EACA,KAAK,qBAAuB,IAAM,CAC9BmB,EAAqB,EAChBD,GACD,KAAK,gBAAgB,IAAI,CAEjC,CACJ,CACJ,CAEgB,mBAA0B,CACtC,MAAM,kBAAkB,EACxB,OAAO,iBACH,SACA,KAAK,gCACT,CACJ,CAEgB,sBAA6B,CACzC,OAAO,oBACH,SACA,KAAK,gCACT,EACA,MAAM,qBAAqB,CAC/B,CACJ,EArOaN,EAyJF,cAAgB,EA7IvBQ,EAAA,CADCtB,EAAM,eAAe,GAXbc,EAYT,2BAGQQ,EAAA,CADPtB,EAAM,UAAU,GAdRc,EAeD,8BAGDQ,EAAA,CADNvB,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAjBjCe,EAkBF,qBAGAQ,EAAA,CADNvB,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GApBjCe,EAqBF,2BAgBAQ,EAAA,CADNvB,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,YAAa,CAAC,GApC1De,EAqCF,yBAGAQ,EAAA,CADNvB,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAvChCe,EAwCF,oBAGAQ,EAAA,CADNvB,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GA1ChCe,EA2CF,oBA3CJ,WAAM,OAANA",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\nimport { conditionAttributeWithId } from '@spectrum-web-components/base/src/condition-attribute-with-id.js';\n\nimport '@spectrum-web-components/divider/sp-divider.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport {\n FocusVisiblePolyfillMixin,\n ObserveSlotPresence,\n} from '@spectrum-web-components/shared';\n\nimport styles from './dialog.css.js';\nimport type { CloseButton } from '@spectrum-web-components/button';\n\nlet appliedIds = 0;\n\nfunction gatherAppliedIdsFromSlottedChildren(\n slot: HTMLSlotElement,\n idBase: string\n): string[] {\n const assignedElements = slot.assignedElements();\n const ids: string[] = [];\n assignedElements.forEach((el) => {\n if (el.id) {\n ids.push(el.id);\n } else {\n const id = idBase + `-${appliedIds++}`;\n el.id = id;\n ids.push(id);\n }\n });\n return ids;\n}\n\n/**\n * @element sp-dialog\n *\n * @slot hero - Accepts a hero image to display at the top of the dialog\n * @slot heading - Acts as the heading of the dialog. This should be an actual heading tag `<h1-6 />`\n * @slot - Content not addressed to a specific slot will be interpreted as the main content of the dialog\n * @slot footer - Content addressed to the `footer` will be placed below the main content and to the side of any `[slot='button']` content\n * @slot button - Button elements addressed to this slot may be placed below the content when not delivered in a fullscreen mode\n * @fires close - Announces that the dialog has been closed.\n */\nexport class Dialog extends FocusVisiblePolyfillMixin(\n ObserveSlotPresence(SpectrumElement, [\n '[slot=\"hero\"]',\n '[slot=\"footer\"]',\n '[slot=\"button\"]',\n ])\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @query('.close-button')\n closeButton?: CloseButton;\n\n @query('.content')\n private contentElement!: HTMLDivElement;\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n protected get hasFooter(): boolean {\n return this.getSlotContentPresence('[slot=\"footer\"]');\n }\n\n protected get hasButtons(): boolean {\n return this.getSlotContentPresence('[slot=\"button\"]');\n }\n\n /* c8 ignore next 3 */\n protected get hasHero(): boolean {\n return this.getSlotContentPresence('[slot=\"hero\"]');\n }\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n public close(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n protected renderHero(): TemplateResult {\n return html`\n <slot name=\"hero\"></slot>\n `;\n }\n\n protected renderHeading(): TemplateResult {\n return html`\n <slot name=\"heading\" @slotchange=${this.onHeadingSlotchange}></slot>\n `;\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <div class=\"content\">\n <slot @slotchange=${this.onContentSlotChange}></slot>\n </div>\n `;\n }\n\n protected renderFooter(): TemplateResult {\n return html`\n <div class=\"footer\">\n <slot name=\"footer\"></slot>\n </div>\n `;\n }\n\n protected renderButtons(): TemplateResult {\n const classes = {\n 'button-group': true,\n 'button-group--noFooter': !this.hasFooter,\n };\n return html`\n <sp-button-group class=${classMap(classes)}>\n <slot name=\"button\"></slot>\n </sp-button-group>\n `;\n }\n\n protected renderDismiss(): TemplateResult {\n return html`\n <sp-close-button\n class=\"close-button\"\n label=\"Close\"\n quiet\n size=\"m\"\n @click=${this.close}\n ></sp-close-button>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"grid\">\n ${this.renderHero()} ${this.renderHeading()}\n ${this.error\n ? html`\n <sp-icon-alert class=\"type-icon\"></sp-icon-alert>\n `\n : nothing}\n ${this.noDivider\n ? nothing\n : html`\n <sp-divider size=\"m\" class=\"divider\"></sp-divider>\n `}\n ${this.renderContent()}\n ${this.hasFooter ? this.renderFooter() : nothing}\n ${this.hasButtons ? this.renderButtons() : nothing}\n ${this.dismissable ? this.renderDismiss() : nothing}\n </div>\n `;\n }\n\n public shouldManageTabOrderForScrolling = (): void => {\n const { offsetHeight, scrollHeight } = this.contentElement;\n if (offsetHeight < scrollHeight) {\n this.contentElement.tabIndex = 0;\n } else {\n this.contentElement.removeAttribute('tabindex');\n }\n };\n\n protected override shouldUpdate(changes: PropertyValues): boolean {\n if (changes.has('mode') && !!this.mode) {\n this.dismissable = false;\n }\n if (changes.has('dismissable') && this.dismissable) {\n this.dismissable = !this.mode;\n }\n return super.shouldUpdate(changes);\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('role', 'dialog');\n }\n\n static instanceCount = 0;\n private labelledbyId = `sp-dialog-label-${Dialog.instanceCount++}`;\n private conditionLabelledby?: () => void;\n private conditionDescribedby?: () => void;\n\n private onHeadingSlotchange({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n if (this.conditionLabelledby) {\n this.conditionLabelledby();\n delete this.conditionLabelledby;\n }\n const ids = gatherAppliedIdsFromSlottedChildren(\n target,\n this.labelledbyId\n );\n if (ids.length) {\n this.conditionLabelledby = conditionAttributeWithId(\n this,\n 'aria-labelledby',\n ids\n );\n }\n }\n\n private describedbyId = `sp-dialog-description-${Dialog.instanceCount++}`;\n\n protected onContentSlotChange({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n requestAnimationFrame(() => {\n // Content must be available _AND_ styles must be applied.\n this.shouldManageTabOrderForScrolling();\n });\n if (this.conditionDescribedby) {\n this.conditionDescribedby();\n delete this.conditionDescribedby;\n }\n const ids = gatherAppliedIdsFromSlottedChildren(\n target,\n this.describedbyId\n );\n if (ids.length && ids.length < 4) {\n this.conditionDescribedby = conditionAttributeWithId(\n this,\n 'aria-describedby',\n ids\n );\n } else if (!ids.length) {\n const idProvided = !!this.id;\n if (!idProvided) this.id = this.describedbyId;\n const conditionDescribedby = conditionAttributeWithId(\n this,\n 'aria-describedby',\n this.id\n );\n this.conditionDescribedby = () => {\n conditionDescribedby();\n if (!idProvided) {\n this.removeAttribute('id');\n }\n };\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n }\n\n public override disconnectedCallback(): void {\n window.removeEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n super.disconnectedCallback();\n }\n}\n"],
5
+ "mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,EAEA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,4BAAAC,MAAgC,mEAEzC,MAAO,iDACP,MAAO,qDACP,MAAO,2DACP,MAAO,iEACP,OACI,6BAAAC,EACA,uBAAAC,MACG,kCAEP,OAAOC,MAAY,kBAGnB,IAAIC,EAAa,EAEjB,SAASC,EACLC,EACAC,EACQ,CACR,MAAMC,EAAmBF,EAAK,iBAAiB,EACzCG,EAAgB,CAAC,EACvB,OAAAD,EAAiB,QAASE,GAAO,CAC7B,GAAIA,EAAG,GACHD,EAAI,KAAKC,EAAG,EAAE,MACX,CACH,MAAMC,EAAKJ,EAAS,IAAIH,GAAY,GACpCM,EAAG,GAAKC,EACRF,EAAI,KAAKE,CAAE,CACf,CACJ,CAAC,EACMF,CACX,CAYO,MAAMG,EAAN,MAAMA,UAAeX,EACxBC,EAAoBN,EAAiB,CACjC,gBACA,kBACA,iBACJ,CAAC,CACL,CAAE,CANK,kCAkBH,KAAO,MAAQ,GAGf,KAAO,YAAc,GAgBrB,KAAO,UAA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jC,CACJ,CACJ,CAEgB,mBAA0B,CACtC,MAAM,kBAAkB,EACxB,OAAO,iBACH,SACA,KAAK,gCACT,CACJ,CAEgB,sBAA6B,CACzC,OAAO,oBACH,SACA,KAAK,gCACT,EACA,MAAM,qBAAqB,CAC/B,CACJ,EAzOaN,EAyJF,cAAgB,EA7IvBQ,EAAA,CADCtB,EAAM,eAAe,GAXbc,EAYT,2BAGQQ,EAAA,CADPtB,EAAM,UAAU,GAdRc,EAeD,8BAGDQ,EAAA,CADNvB,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAjBjCe,EAkBF,qBAGAQ,EAAA,CADNvB,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GApBjCe,EAqBF,2BAgBAQ,EAAA,CADNvB,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,YAAa,CAAC,GApC1De,EAqCF,yBAGAQ,EAAA,CADNvB,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAvChCe,EAwCF,oBAGAQ,EAAA,CADNvB,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GA1ChCe,EA2CF,oBA3CJ,WAAM,OAANA",
6
6
  "names": ["html", "nothing", "SpectrumElement", "property", "query", "classMap", "conditionAttributeWithId", "FocusVisiblePolyfillMixin", "ObserveSlotPresence", "styles", "appliedIds", "gatherAppliedIdsFromSlottedChildren", "slot", "idBase", "assignedElements", "ids", "el", "id", "_Dialog", "offsetHeight", "scrollHeight", "classes", "changes", "target", "idProvided", "conditionDescribedby", "__decorateClass"]
7
7
  }
@@ -12,6 +12,7 @@ var __decorateClass = (decorators, target, key, kind) => {
12
12
  };
13
13
  import {
14
14
  html,
15
+ nothing,
15
16
  SpectrumElement
16
17
  } from "@spectrum-web-components/base";
17
18
  import { property } from "@spectrum-web-components/base/src/decorators.js";
@@ -143,7 +144,7 @@ export class DialogBase extends FocusVisiblePolyfillMixin(SpectrumElement) {
143
144
  @transitionend=${this.handleUnderlayTransitionend}
144
145
  @transitioncancel=${this.handleTransitionEvent}
145
146
  ></sp-underlay>
146
- ` : html``}
147
+ ` : nothing}
147
148
  <div
148
149
  class="modal ${this.mode}"
149
150
  @transitionrun=${this.handleTransitionEvent}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["DialogBase.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport modalWrapperStyles from '@spectrum-web-components/modal/src/modal-wrapper.css.js';\nimport modalStyles from '@spectrum-web-components/modal/src/modal.css.js';\nimport { Dialog } from './Dialog.dev.js'\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\n\n/**\n * @element sp-dialog-base\n *\n * @slot - A Dialog element to display.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogBase extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [modalWrapperStyles, modalStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n /**\n * When set to true, fills screens smaller than 350px high and 400px wide with the full dialog.\n */\n @property({ type: Boolean })\n public responsive = false;\n\n private transitionPromise = Promise.resolve();\n\n private resolveTransitionPromise = (): void => {\n return;\n };\n\n @property({ type: Boolean })\n public underlay = false;\n\n protected get dialog(): Dialog {\n const dialog = (\n this.shadowRoot.querySelector('slot') as HTMLSlotElement\n ).assignedElements()[0] as Dialog;\n if (window.__swc.DEBUG) {\n if (!dialog) {\n window.__swc.warn(\n this,\n `<${this.localName}> expects to be provided dialog content via its default slot.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-base/#dialog'\n );\n }\n }\n return dialog || this;\n }\n\n public override async focus(): Promise<void> {\n if (this.shadowRoot) {\n const firstFocusable = firstFocusableIn(this.dialog);\n if (firstFocusable) {\n if ((firstFocusable as SpectrumElement).updateComplete) {\n await firstFocusable.updateComplete;\n }\n firstFocusable.focus();\n } else {\n this.dialog.focus();\n }\n /* c8 ignore next 3 */\n } else {\n super.focus();\n }\n }\n\n private animating = false;\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return this.animating;\n this.close();\n return true;\n }\n\n private dismiss(): void {\n if (!this.dismissable) {\n return;\n }\n this.close();\n }\n\n protected handleClose(event: Event): void {\n event.stopPropagation();\n this.close();\n }\n\n public close(): void {\n this.open = false;\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n private handleTransitionEvent(event: TransitionEvent): void {\n this.dispatchEvent(\n new TransitionEvent(event.type, {\n bubbles: true,\n composed: true,\n propertyName: event.propertyName,\n })\n );\n }\n\n protected handleUnderlayTransitionend(event: TransitionEvent): void {\n if (!this.open && event.propertyName === 'visibility') {\n this.resolveTransitionPromise();\n }\n this.handleTransitionEvent(event);\n }\n\n protected handleModalTransitionend(event: TransitionEvent): void {\n if (this.open || !this.underlay) {\n this.resolveTransitionPromise();\n }\n this.handleTransitionEvent(event);\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (changes.has('open') && changes.get('open') !== undefined) {\n this.animating = true;\n this.transitionPromise = new Promise((res) => {\n this.resolveTransitionPromise = () => {\n this.animating = false;\n res();\n };\n });\n if (!this.open) {\n this.dispatchClosed();\n }\n }\n super.update(changes);\n }\n\n protected renderDialog(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.underlay\n ? html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.dismiss}\n @transitionrun=${this.handleTransitionEvent}\n @transitionend=${this.handleUnderlayTransitionend}\n @transitioncancel=${this.handleTransitionEvent}\n ></sp-underlay>\n `\n : html``}\n <div\n class=\"modal ${this.mode}\"\n @transitionrun=${this.handleTransitionEvent}\n @transitionend=${this.handleModalTransitionend}\n @transitioncancel=${this.handleTransitionEvent}\n @close=${this.handleClose}\n >\n ${this.renderDialog()}\n </div>\n `;\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('open')) {\n if (this.open) {\n if (\n 'updateComplete' in this.dialog &&\n 'shouldManageTabOrderForScrolling' in this.dialog\n ) {\n this.dialog.updateComplete.then(() => {\n this.dialog.shouldManageTabOrderForScrolling();\n });\n }\n }\n }\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO;AACP,OAAO;AAGP,OAAO;AACP,OAAO,wBAAwB;AAC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K,qBAAqB;AAAA;AAAA,sBAGtD,MAAM;AAAA;AAAA,+BAEO,KAAK,IAAI;AAAA,iCACP,KAAK,qBAAqB;AAAA,iCAC1B,KAAK,wBAAwB;AAAA,oCAC1B,KAAK,qBAAqB;AAAA,yBACrC,KAAK,WAAW;AAAA;AAAA,kBAEvB,KAAK,aAAa,CAAC;AAAA;AAAA;AAAA,EAGjC;AAAA,EAEmB,QAAQ,SAAqC;AAC5D,QAAI,QAAQ,IAAI,MAAM,GAAG;AACrB,UAAI,KAAK,MAAM;AACX,YACI,oBAAoB,KAAK,UACzB,sCAAsC,KAAK,QAC7C;AACE,eAAK,OAAO,eAAe,KAAK,MAAM;AAClC,iBAAK,OAAO,iCAAiC;AAAA,UACjD,CAAC;AAAA,QACL;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAyB,oBAAsC;AAC3D,UAAM,WAAY,MAAM,MAAM,kBAAkB;AAChD,UAAM,KAAK;AACX,WAAO;AAAA,EACX;AACJ;AA3LW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GALjC,WAMF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GARjC,WASF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAXhC,WAYF;AAMA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GAjBlB,WAkBF;AASA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GA1BlB,WA2BF;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport modalWrapperStyles from '@spectrum-web-components/modal/src/modal-wrapper.css.js';\nimport modalStyles from '@spectrum-web-components/modal/src/modal.css.js';\nimport { Dialog } from './Dialog.dev.js'\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\n\n/**\n * @element sp-dialog-base\n *\n * @slot - A Dialog element to display.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogBase extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [modalWrapperStyles, modalStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n /**\n * When set to true, fills screens smaller than 350px high and 400px wide with the full dialog.\n */\n @property({ type: Boolean })\n public responsive = false;\n\n private transitionPromise = Promise.resolve();\n\n private resolveTransitionPromise = (): void => {\n return;\n };\n\n @property({ type: Boolean })\n public underlay = false;\n\n protected get dialog(): Dialog {\n const dialog = (\n this.shadowRoot.querySelector('slot') as HTMLSlotElement\n ).assignedElements()[0] as Dialog;\n if (window.__swc.DEBUG) {\n if (!dialog) {\n window.__swc.warn(\n this,\n `<${this.localName}> expects to be provided dialog content via its default slot.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-base/#dialog'\n );\n }\n }\n return dialog || this;\n }\n\n public override async focus(): Promise<void> {\n if (this.shadowRoot) {\n const firstFocusable = firstFocusableIn(this.dialog);\n if (firstFocusable) {\n if ((firstFocusable as SpectrumElement).updateComplete) {\n await firstFocusable.updateComplete;\n }\n firstFocusable.focus();\n } else {\n this.dialog.focus();\n }\n /* c8 ignore next 3 */\n } else {\n super.focus();\n }\n }\n\n private animating = false;\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return this.animating;\n this.close();\n return true;\n }\n\n private dismiss(): void {\n if (!this.dismissable) {\n return;\n }\n this.close();\n }\n\n protected handleClose(event: Event): void {\n event.stopPropagation();\n this.close();\n }\n\n public close(): void {\n this.open = false;\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n private handleTransitionEvent(event: TransitionEvent): void {\n this.dispatchEvent(\n new TransitionEvent(event.type, {\n bubbles: true,\n composed: true,\n propertyName: event.propertyName,\n })\n );\n }\n\n protected handleUnderlayTransitionend(event: TransitionEvent): void {\n if (!this.open && event.propertyName === 'visibility') {\n this.resolveTransitionPromise();\n }\n this.handleTransitionEvent(event);\n }\n\n protected handleModalTransitionend(event: TransitionEvent): void {\n if (this.open || !this.underlay) {\n this.resolveTransitionPromise();\n }\n this.handleTransitionEvent(event);\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (changes.has('open') && changes.get('open') !== undefined) {\n this.animating = true;\n this.transitionPromise = new Promise((res) => {\n this.resolveTransitionPromise = () => {\n this.animating = false;\n res();\n };\n });\n if (!this.open) {\n this.dispatchClosed();\n }\n }\n super.update(changes);\n }\n\n protected renderDialog(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.underlay\n ? html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.dismiss}\n @transitionrun=${this.handleTransitionEvent}\n @transitionend=${this.handleUnderlayTransitionend}\n @transitioncancel=${this.handleTransitionEvent}\n ></sp-underlay>\n `\n : nothing}\n <div\n class=\"modal ${this.mode}\"\n @transitionrun=${this.handleTransitionEvent}\n @transitionend=${this.handleModalTransitionend}\n @transitioncancel=${this.handleTransitionEvent}\n @close=${this.handleClose}\n >\n ${this.renderDialog()}\n </div>\n `;\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('open')) {\n if (this.open) {\n if (\n 'updateComplete' in this.dialog &&\n 'shouldManageTabOrderForScrolling' in this.dialog\n ) {\n this.dialog.updateComplete.then(() => {\n this.dialog.shouldManageTabOrderForScrolling();\n });\n }\n }\n }\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO;AACP,OAAO;AAGP,OAAO;AACP,OAAO,wBAAwB;AAC/B,OAAO,iBAAiB;AAExB,SAAS,iCAAiC;AAC1C,SAAS,wBAAwB;AAQ1B,aAAM,mBAAmB,0BAA0B,eAAe,EAAE;AAAA,EAApE;AAAA;AAMH,SAAO,cAAc;AAGrB,SAAO,OAAO;AASd,SAAO,aAAa;AAEpB,SAAQ,oBAAoB,QAAQ,QAAQ;AAE5C,SAAQ,2BAA2B,MAAY;AAC3C;AAAA,IACJ;AAGA,SAAO,WAAW;AAmClB,SAAQ,YAAY;AAAA;AAAA,EA7DpB,WAA2B,SAAyB;AAChD,WAAO,CAAC,oBAAoB,WAAW;AAAA,EAC3C;AA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;AACE,eAAK,OAAO,eAAe,KAAK,MAAM;AAClC,iBAAK,OAAO,iCAAiC;AAAA,UACjD,CAAC;AAAA,QACL;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAyB,oBAAsC;AAC3D,UAAM,WAAY,MAAM,MAAM,kBAAkB;AAChD,UAAM,KAAK;AACX,WAAO;AAAA,EACX;AACJ;AA3LW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GALjC,WAMF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GARjC,WASF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAXhC,WAYF;AAMA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GAjBlB,WAkBF;AASA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GA1BlB,WA2BF;",
6
6
  "names": []
7
7
  }
package/src/DialogBase.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var o=(a,s,e,i)=>{for(var t=i>1?void 0:i?h(s,e):s,l=a.length-1,d;l>=0;l--)(d=a[l])&&(t=(i?d(s,e,t):d(t))||t);return i&&t&&p(s,e,t),t};import{html as n,SpectrumElement as u}from"@spectrum-web-components/base";import{property as r}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/underlay/sp-underlay.js";import"@spectrum-web-components/button/sp-button.js";import"@spectrum-web-components/dialog/sp-dialog.js";import c from"@spectrum-web-components/modal/src/modal-wrapper.css.js";import m from"@spectrum-web-components/modal/src/modal.css.js";import{FocusVisiblePolyfillMixin as v}from"@spectrum-web-components/shared";import{firstFocusableIn as f}from"@spectrum-web-components/shared/src/first-focusable-in.js";export class DialogBase extends v(u){constructor(){super(...arguments);this.dismissable=!1;this.open=!1;this.responsive=!1;this.transitionPromise=Promise.resolve();this.resolveTransitionPromise=()=>{};this.underlay=!1;this.animating=!1}static get styles(){return[c,m]}get dialog(){return this.shadowRoot.querySelector("slot").assignedElements()[0]||this}async focus(){if(this.shadowRoot){const e=f(this.dialog);e?(e.updateComplete&&await e.updateComplete,e.focus()):this.dialog.focus()}else super.focus()}overlayWillCloseCallback(){return this.open?(this.close(),!0):this.animating}dismiss(){this.dismissable&&this.close()}handleClose(e){e.stopPropagation(),this.close()}close(){this.open=!1}dispatchClosed(){this.dispatchEvent(new Event("close",{bubbles:!0}))}handleTransitionEvent(e){this.dispatchEvent(new TransitionEvent(e.type,{bubbles:!0,composed:!0,propertyName:e.propertyName}))}handleUnderlayTransitionend(e){!this.open&&e.propertyName==="visibility"&&this.resolveTransitionPromise(),this.handleTransitionEvent(e)}handleModalTransitionend(e){(this.open||!this.underlay)&&this.resolveTransitionPromise(),this.handleTransitionEvent(e)}update(e){e.has("open")&&e.get("open")!==void 0&&(this.animating=!0,this.transitionPromise=new Promise(i=>{this.resolveTransitionPromise=()=>{this.animating=!1,i()}}),this.open||this.dispatchClosed()),super.update(e)}renderDialog(){return n`
1
+ "use strict";var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var o=(n,s,e,i)=>{for(var t=i>1?void 0:i?h(s,e):s,a=n.length-1,l;a>=0;a--)(l=n[a])&&(t=(i?l(s,e,t):l(t))||t);return i&&t&&p(s,e,t),t};import{html as d,nothing as u,SpectrumElement as c}from"@spectrum-web-components/base";import{property as r}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/underlay/sp-underlay.js";import"@spectrum-web-components/button/sp-button.js";import"@spectrum-web-components/dialog/sp-dialog.js";import m from"@spectrum-web-components/modal/src/modal-wrapper.css.js";import v from"@spectrum-web-components/modal/src/modal.css.js";import{FocusVisiblePolyfillMixin as f}from"@spectrum-web-components/shared";import{firstFocusableIn as b}from"@spectrum-web-components/shared/src/first-focusable-in.js";export class DialogBase extends f(c){constructor(){super(...arguments);this.dismissable=!1;this.open=!1;this.responsive=!1;this.transitionPromise=Promise.resolve();this.resolveTransitionPromise=()=>{};this.underlay=!1;this.animating=!1}static get styles(){return[m,v]}get dialog(){return this.shadowRoot.querySelector("slot").assignedElements()[0]||this}async focus(){if(this.shadowRoot){const e=b(this.dialog);e?(e.updateComplete&&await e.updateComplete,e.focus()):this.dialog.focus()}else super.focus()}overlayWillCloseCallback(){return this.open?(this.close(),!0):this.animating}dismiss(){this.dismissable&&this.close()}handleClose(e){e.stopPropagation(),this.close()}close(){this.open=!1}dispatchClosed(){this.dispatchEvent(new Event("close",{bubbles:!0}))}handleTransitionEvent(e){this.dispatchEvent(new TransitionEvent(e.type,{bubbles:!0,composed:!0,propertyName:e.propertyName}))}handleUnderlayTransitionend(e){!this.open&&e.propertyName==="visibility"&&this.resolveTransitionPromise(),this.handleTransitionEvent(e)}handleModalTransitionend(e){(this.open||!this.underlay)&&this.resolveTransitionPromise(),this.handleTransitionEvent(e)}update(e){e.has("open")&&e.get("open")!==void 0&&(this.animating=!0,this.transitionPromise=new Promise(i=>{this.resolveTransitionPromise=()=>{this.animating=!1,i()}}),this.open||this.dispatchClosed()),super.update(e)}renderDialog(){return d`
2
2
  <slot></slot>
3
- `}render(){return n`
4
- ${this.underlay?n`
3
+ `}render(){return d`
4
+ ${this.underlay?d`
5
5
  <sp-underlay
6
6
  ?open=${this.open}
7
7
  @click=${this.dismiss}
@@ -9,7 +9,7 @@
9
9
  @transitionend=${this.handleUnderlayTransitionend}
10
10
  @transitioncancel=${this.handleTransitionEvent}
11
11
  ></sp-underlay>
12
- `:n``}
12
+ `:u}
13
13
  <div
14
14
  class="modal ${this.mode}"
15
15
  @transitionrun=${this.handleTransitionEvent}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["DialogBase.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport modalWrapperStyles from '@spectrum-web-components/modal/src/modal-wrapper.css.js';\nimport modalStyles from '@spectrum-web-components/modal/src/modal.css.js';\nimport { Dialog } from './Dialog.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\n\n/**\n * @element sp-dialog-base\n *\n * @slot - A Dialog element to display.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogBase extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [modalWrapperStyles, modalStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n /**\n * When set to true, fills screens smaller than 350px high and 400px wide with the full dialog.\n */\n @property({ type: Boolean })\n public responsive = false;\n\n private transitionPromise = Promise.resolve();\n\n private resolveTransitionPromise = (): void => {\n return;\n };\n\n @property({ type: Boolean })\n public underlay = false;\n\n protected get dialog(): Dialog {\n const dialog = (\n this.shadowRoot.querySelector('slot') as HTMLSlotElement\n ).assignedElements()[0] as Dialog;\n if (window.__swc.DEBUG) {\n if (!dialog) {\n window.__swc.warn(\n this,\n `<${this.localName}> expects to be provided dialog content via its default slot.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-base/#dialog'\n );\n }\n }\n return dialog || this;\n }\n\n public override async focus(): Promise<void> {\n if (this.shadowRoot) {\n const firstFocusable = firstFocusableIn(this.dialog);\n if (firstFocusable) {\n if ((firstFocusable as SpectrumElement).updateComplete) {\n await firstFocusable.updateComplete;\n }\n firstFocusable.focus();\n } else {\n this.dialog.focus();\n }\n /* c8 ignore next 3 */\n } else {\n super.focus();\n }\n }\n\n private animating = false;\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return this.animating;\n this.close();\n return true;\n }\n\n private dismiss(): void {\n if (!this.dismissable) {\n return;\n }\n this.close();\n }\n\n protected handleClose(event: Event): void {\n event.stopPropagation();\n this.close();\n }\n\n public close(): void {\n this.open = false;\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n private handleTransitionEvent(event: TransitionEvent): void {\n this.dispatchEvent(\n new TransitionEvent(event.type, {\n bubbles: true,\n composed: true,\n propertyName: event.propertyName,\n })\n );\n }\n\n protected handleUnderlayTransitionend(event: TransitionEvent): void {\n if (!this.open && event.propertyName === 'visibility') {\n this.resolveTransitionPromise();\n }\n this.handleTransitionEvent(event);\n }\n\n protected handleModalTransitionend(event: TransitionEvent): void {\n if (this.open || !this.underlay) {\n this.resolveTransitionPromise();\n }\n this.handleTransitionEvent(event);\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (changes.has('open') && changes.get('open') !== undefined) {\n this.animating = true;\n this.transitionPromise = new Promise((res) => {\n this.resolveTransitionPromise = () => {\n this.animating = false;\n res();\n };\n });\n if (!this.open) {\n this.dispatchClosed();\n }\n }\n super.update(changes);\n }\n\n protected renderDialog(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.underlay\n ? html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.dismiss}\n @transitionrun=${this.handleTransitionEvent}\n @transitionend=${this.handleUnderlayTransitionend}\n @transitioncancel=${this.handleTransitionEvent}\n ></sp-underlay>\n `\n : html``}\n <div\n class=\"modal ${this.mode}\"\n @transitionrun=${this.handleTransitionEvent}\n @transitionend=${this.handleModalTransitionend}\n @transitioncancel=${this.handleTransitionEvent}\n @close=${this.handleClose}\n >\n ${this.renderDialog()}\n </div>\n `;\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('open')) {\n if (this.open) {\n if (\n 'updateComplete' in this.dialog &&\n 'shouldManageTabOrderForScrolling' in this.dialog\n ) {\n this.dialog.updateComplete.then(() => {\n this.dialog.shouldManageTabOrderForScrolling();\n });\n }\n }\n }\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"],
5
- "mappings": "qNAYA,OAEI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,MAAO,mDACP,MAAO,+CAGP,MAAO,+CACP,OAAOC,MAAwB,0DAC/B,OAAOC,MAAiB,kDAExB,OAAS,6BAAAC,MAAiC,kCAC1C,OAAS,oBAAAC,MAAwB,4DAQ1B,aAAM,mBAAmBD,EAA0BJ,CAAe,CAAE,CAApE,kCAMH,KAAO,YAAc,GAGrB,KAAO,KAAO,GASd,KAAO,WAAa,GAEpB,KAAQ,kBAAoB,QAAQ,QAAQ,EAE5C,KAAQ,yBAA2B,IAAY,CAE/C,EAGA,KAAO,SAAW,GAmClB,K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yles", "FocusVisiblePolyfillMixin", "firstFocusableIn", "firstFocusable", "event", "changes", "res", "complete", "__decorateClass"]
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport modalWrapperStyles from '@spectrum-web-components/modal/src/modal-wrapper.css.js';\nimport modalStyles from '@spectrum-web-components/modal/src/modal.css.js';\nimport { Dialog } from './Dialog.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\n\n/**\n * @element sp-dialog-base\n *\n * @slot - A Dialog element to display.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogBase extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [modalWrapperStyles, modalStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n /**\n * When set to true, fills screens smaller than 350px high and 400px wide with the full dialog.\n */\n @property({ type: Boolean })\n public responsive = false;\n\n private transitionPromise = Promise.resolve();\n\n private resolveTransitionPromise = (): void => {\n return;\n };\n\n @property({ type: Boolean })\n public underlay = false;\n\n protected get dialog(): Dialog {\n const dialog = (\n this.shadowRoot.querySelector('slot') as HTMLSlotElement\n ).assignedElements()[0] as Dialog;\n if (window.__swc.DEBUG) {\n if (!dialog) {\n window.__swc.warn(\n this,\n `<${this.localName}> expects to be provided dialog content via its default slot.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-base/#dialog'\n );\n }\n }\n return dialog || this;\n }\n\n public override async focus(): Promise<void> {\n if (this.shadowRoot) {\n const firstFocusable = firstFocusableIn(this.dialog);\n if (firstFocusable) {\n if ((firstFocusable as SpectrumElement).updateComplete) {\n await firstFocusable.updateComplete;\n }\n firstFocusable.focus();\n } else {\n this.dialog.focus();\n }\n /* c8 ignore next 3 */\n } else {\n super.focus();\n }\n }\n\n private animating = false;\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return this.animating;\n this.close();\n return true;\n }\n\n private dismiss(): void {\n if (!this.dismissable) {\n return;\n }\n this.close();\n }\n\n protected handleClose(event: Event): void {\n event.stopPropagation();\n this.close();\n }\n\n public close(): void {\n this.open = false;\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n private handleTransitionEvent(event: TransitionEvent): void {\n this.dispatchEvent(\n new TransitionEvent(event.type, {\n bubbles: true,\n composed: true,\n propertyName: event.propertyName,\n })\n );\n }\n\n protected handleUnderlayTransitionend(event: TransitionEvent): void {\n if (!this.open && event.propertyName === 'visibility') {\n this.resolveTransitionPromise();\n }\n this.handleTransitionEvent(event);\n }\n\n protected handleModalTransitionend(event: TransitionEvent): void {\n if (this.open || !this.underlay) {\n this.resolveTransitionPromise();\n }\n this.handleTransitionEvent(event);\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (changes.has('open') && changes.get('open') !== undefined) {\n this.animating = true;\n this.transitionPromise = new Promise((res) => {\n this.resolveTransitionPromise = () => {\n this.animating = false;\n res();\n };\n });\n if (!this.open) {\n this.dispatchClosed();\n }\n }\n super.update(changes);\n }\n\n protected renderDialog(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.underlay\n ? html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.dismiss}\n @transitionrun=${this.handleTransitionEvent}\n @transitionend=${this.handleUnderlayTransitionend}\n @transitioncancel=${this.handleTransitionEvent}\n ></sp-underlay>\n `\n : nothing}\n <div\n class=\"modal ${this.mode}\"\n @transitionrun=${this.handleTransitionEvent}\n @transitionend=${this.handleModalTransitionend}\n @transitioncancel=${this.handleTransitionEvent}\n @close=${this.handleClose}\n >\n ${this.renderDialog()}\n </div>\n `;\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('open')) {\n if (this.open) {\n if (\n 'updateComplete' in this.dialog &&\n 'shouldManageTabOrderForScrolling' in this.dialog\n ) {\n this.dialog.updateComplete.then(() => {\n this.dialog.shouldManageTabOrderForScrolling();\n });\n }\n }\n }\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"],
5
+ "mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,EAEA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,MAAO,mDACP,MAAO,+CAGP,MAAO,+CACP,OAAOC,MAAwB,0DAC/B,OAAOC,MAAiB,kDAExB,OAAS,6BAAAC,MAAiC,kCAC1C,OAAS,oBAAAC,MAAwB,4DAQ1B,aAAM,mBAAmBD,EAA0BJ,CAAe,CAAE,CAAp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AAS,CAAE,KAAM,OAAQ,CAAC,GAjBlB,WAkBF,0BASAU,EAAA,CADNV,EAAS,CAAE,KAAM,OAAQ,CAAC,GA1BlB,WA2BF",
6
+ "names": ["html", "nothing", "SpectrumElement", "property", "modalWrapperStyles", "modalStyles", "FocusVisiblePolyfillMixin", "firstFocusableIn", "firstFocusable", "event", "changes", "res", "complete", "__decorateClass"]
7
7
  }
@@ -11,7 +11,8 @@ var __decorateClass = (decorators, target, key, kind) => {
11
11
  return result;
12
12
  };
13
13
  import {
14
- html
14
+ html,
15
+ nothing
15
16
  } from "@spectrum-web-components/base";
16
17
  import { property } from "@spectrum-web-components/base/src/decorators.js";
17
18
  import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
@@ -92,7 +93,7 @@ export class DialogWrapper extends DialogBase {
92
93
  this.heroLabel ? this.heroLabel : void 0
93
94
  )}
94
95
  />
95
- ` : html``}
96
+ ` : nothing}
96
97
  ${this.headline ? html`
97
98
  <h2
98
99
  slot="heading"
@@ -100,11 +101,11 @@ export class DialogWrapper extends DialogBase {
100
101
  >
101
102
  ${this.headline}
102
103
  </h2>
103
- ` : html``}
104
+ ` : nothing}
104
105
  <slot></slot>
105
106
  ${this.footer ? html`
106
107
  <div slot="footer">${this.footer}</div>
107
- ` : html``}
108
+ ` : nothing}
108
109
  ${this.cancelLabel ? html`
109
110
  <sp-button
110
111
  variant="secondary"
@@ -114,7 +115,7 @@ export class DialogWrapper extends DialogBase {
114
115
  >
115
116
  ${this.cancelLabel}
116
117
  </sp-button>
117
- ` : html``}
118
+ ` : nothing}
118
119
  ${this.secondaryLabel ? html`
119
120
  <sp-button
120
121
  variant="primary"
@@ -124,7 +125,7 @@ export class DialogWrapper extends DialogBase {
124
125
  >
125
126
  ${this.secondaryLabel}
126
127
  </sp-button>
127
- ` : html``}
128
+ ` : nothing}
128
129
  ${this.confirmLabel ? html`
129
130
  <sp-button
130
131
  variant="accent"
@@ -133,7 +134,7 @@ export class DialogWrapper extends DialogBase {
133
134
  >
134
135
  ${this.confirmLabel}
135
136
  </sp-button>
136
- ` : html``}
137
+ ` : nothing}
137
138
  </sp-dialog>
138
139
  `;
139
140
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["DialogWrapper.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js'\nimport { DialogBase } from './DialogBase.dev.js'\nimport { Dialog } from './Dialog.dev.js'\n\n/**\n * @element sp-dialog-wrapper\n *\n * @slot - content for the dialog\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @fires cancel - Announces that the \"cancel\" button has been clicked.\n * @fires confirm - Announces that the \"confirm\" button has been clicked.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogWrapper extends DialogBase {\n public static override get styles(): CSSResultArray {\n return [...super.styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ attribute: 'cancel-label' })\n public cancelLabel = '';\n\n @property({ attribute: 'confirm-label' })\n public confirmLabel = '';\n\n @property()\n public footer = '';\n\n @property()\n public hero = '';\n\n @property({ attribute: 'hero-label' })\n public heroLabel = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n @property({ attribute: 'secondary-label' })\n public secondaryLabel = '';\n\n @property()\n public headline = '';\n\n @property({ type: String, attribute: 'headline-visibility' })\n public headlineVisibility: 'none' | undefined;\n\n protected override get dialog(): Dialog {\n return this.shadowRoot.querySelector('sp-dialog') as Dialog;\n }\n\n private clickSecondary(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n })\n );\n }\n\n private clickCancel(): void {\n this.dispatchEvent(\n new Event('cancel', {\n bubbles: true,\n })\n );\n }\n\n private clickConfirm(): void {\n this.dispatchEvent(\n new Event('confirm', {\n bubbles: true,\n })\n );\n }\n\n protected override renderDialog(): TemplateResult {\n const hideDivider =\n this.noDivider ||\n !this.headline ||\n this.headlineVisibility === 'none';\n\n if (window.__swc.DEBUG) {\n if (!this.headline) {\n window.__swc.warn(\n this,\n `<${this.localName}> elements will not be accessible to screen readers without a \"headline\" attribute or property.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-wrapper/#accessibility',\n {\n type: 'accessibility',\n }\n );\n }\n }\n\n return html`\n <sp-dialog\n ?dismissable=${this.dismissable}\n ?no-divider=${hideDivider}\n ?error=${this.error}\n mode=${ifDefined(this.mode)}\n size=${ifDefined(this.size)}\n >\n ${this.hero\n ? html`\n <img\n src=\"${this.hero}\"\n slot=\"hero\"\n aria-hidden=${ifDefined(\n this.heroLabel ? undefined : 'true'\n )}\n alt=${ifDefined(\n this.heroLabel ? this.heroLabel : undefined\n )}\n />\n `\n : html``}\n ${this.headline\n ? html`\n <h2\n slot=\"heading\"\n ?hidden=${this.headlineVisibility === 'none'}\n >\n ${this.headline}\n </h2>\n `\n : html``}\n <slot></slot>\n ${this.footer\n ? html`\n <div slot=\"footer\">${this.footer}</div>\n `\n : html``}\n ${this.cancelLabel\n ? html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickCancel}\n >\n ${this.cancelLabel}\n </sp-button>\n `\n : html``}\n ${this.secondaryLabel\n ? html`\n <sp-button\n variant=\"primary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickSecondary}\n >\n ${this.secondaryLabel}\n </sp-button>\n `\n : html``}\n ${this.confirmLabel\n ? html`\n <sp-button\n variant=\"accent\"\n slot=\"button\"\n @click=${this.clickConfirm}\n >\n ${this.confirmLabel}\n </sp-button>\n `\n : html``}\n </sp-dialog>\n `;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAE1B,OAAO;AACP,OAAO;AAGP,OAAO;AACP,SAAS,kBAAkB;AAYpB,aAAM,sBAAsB,WAAW;AAAA,EAAvC;AAAA;AAMH,SAAO,QAAQ;AAGf,SAAO,cAAc;AAGrB,SAAO,eAAe;AAGtB,SAAO,SAAS;AAGhB,SAAO,OAAO;AAGd,SAAO,YAAY;AAGnB,SAAO,YAAY;AAMnB,SAAO,iBAAiB;AAGxB,SAAO,WAAW;AAAA;AAAA,EAhClB,WAA2B,SAAyB;AAChD,WAAO,CAAC,GAAG,MAAM,MAAM;AAAA,EAC3B;AAAA,EAmCA,IAAuB,SAAiB;AACpC,WAAO,KAAK,WAAW,cAAc,WAAW;AAAA,EACpD;AAAA,EAEQ,iBAAuB;AAC3B,SAAK;AAAA,MACD,IAAI,MAAM,aAAa;AAAA,QACnB,SAAS;AAAA,MACb,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAEQ,cAAoB;AACxB,SAAK;AAAA,MACD,IAAI,MAAM,UAAU;AAAA,QAChB,SAAS;AAAA,MACb,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAEQ,eAAqB;AACzB,SAAK;AAAA,MACD,IAAI,MAAM,WAAW;AAAA,QACjB,SAAS;AAAA,MACb,CAAC;AAAA,IACL;A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,YAAY;AAAA;AAAA,0BAG3B,MAAM;AAAA;AAAA;AAAA,EAGxB;AACJ;AA3JW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GALjC,cAMF;AAGA;AAAA,EADN,SAAS,EAAE,WAAW,eAAe,CAAC;AAAA,GAR9B,cASF;AAGA;AAAA,EADN,SAAS,EAAE,WAAW,gBAAgB,CAAC;AAAA,GAX/B,cAYF;AAGA;AAAA,EADN,SAAS;AAAA,GAdD,cAeF;AAGA;AAAA,EADN,SAAS;AAAA,GAjBD,cAkBF;AAGA;AAAA,EADN,SAAS,EAAE,WAAW,aAAa,CAAC;AAAA,GApB5B,cAqBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,aAAa,CAAC;AAAA,GAvB1D,cAwBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GA1BhC,cA2BF;AAGA;AAAA,EADN,SAAS,EAAE,WAAW,kBAAkB,CAAC;AAAA,GA7BjC,cA8BF;AAGA;AAAA,EADN,SAAS;AAAA,GAhCD,cAiCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,sBAAsB,CAAC;AAAA,GAnCnD,cAoCF;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport { DialogBase } from './DialogBase.dev.js'\nimport { Dialog } from './Dialog.dev.js'\n\n/**\n * @element sp-dialog-wrapper\n *\n * @slot - content for the dialog\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @fires cancel - Announces that the \"cancel\" button has been clicked.\n * @fires confirm - Announces that the \"confirm\" button has been clicked.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogWrapper extends DialogBase {\n public static override get styles(): CSSResultArray {\n return [...super.styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ attribute: 'cancel-label' })\n public cancelLabel = '';\n\n @property({ attribute: 'confirm-label' })\n public confirmLabel = '';\n\n @property()\n public footer = '';\n\n @property()\n public hero = '';\n\n @property({ attribute: 'hero-label' })\n public heroLabel = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n @property({ attribute: 'secondary-label' })\n public secondaryLabel = '';\n\n @property()\n public headline = '';\n\n @property({ type: String, attribute: 'headline-visibility' })\n public headlineVisibility: 'none' | undefined;\n\n protected override get dialog(): Dialog {\n return this.shadowRoot.querySelector('sp-dialog') as Dialog;\n }\n\n private clickSecondary(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n })\n );\n }\n\n private clickCancel(): void {\n this.dispatchEvent(\n new Event('cancel', {\n bubbles: true,\n })\n );\n }\n\n private clickConfirm(): void {\n this.dispatchEvent(\n new Event('confirm', {\n bubbles: true,\n })\n );\n }\n\n protected override renderDialog(): TemplateResult {\n const hideDivider =\n this.noDivider ||\n !this.headline ||\n this.headlineVisibility === 'none';\n\n if (window.__swc.DEBUG) {\n if (!this.headline) {\n window.__swc.warn(\n this,\n `<${this.localName}> elements will not be accessible to screen readers without a \"headline\" attribute or property.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-wrapper/#accessibility',\n {\n type: 'accessibility',\n }\n );\n }\n }\n\n return html`\n <sp-dialog\n ?dismissable=${this.dismissable}\n ?no-divider=${hideDivider}\n ?error=${this.error}\n mode=${ifDefined(this.mode)}\n size=${ifDefined(this.size)}\n >\n ${this.hero\n ? html`\n <img\n src=\"${this.hero}\"\n slot=\"hero\"\n aria-hidden=${ifDefined(\n this.heroLabel ? undefined : 'true'\n )}\n alt=${ifDefined(\n this.heroLabel ? this.heroLabel : undefined\n )}\n />\n `\n : nothing}\n ${this.headline\n ? html`\n <h2\n slot=\"heading\"\n ?hidden=${this.headlineVisibility === 'none'}\n >\n ${this.headline}\n </h2>\n `\n : nothing}\n <slot></slot>\n ${this.footer\n ? html`\n <div slot=\"footer\">${this.footer}</div>\n `\n : nothing}\n ${this.cancelLabel\n ? html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickCancel}\n >\n ${this.cancelLabel}\n </sp-button>\n `\n : nothing}\n ${this.secondaryLabel\n ? html`\n <sp-button\n variant=\"primary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickSecondary}\n >\n ${this.secondaryLabel}\n </sp-button>\n `\n : nothing}\n ${this.confirmLabel\n ? html`\n <sp-button\n variant=\"accent\"\n slot=\"button\"\n @click=${this.clickConfirm}\n >\n ${this.confirmLabel}\n </sp-button>\n `\n : nothing}\n </sp-dialog>\n `;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAE1B,OAAO;AACP,OAAO;AAGP,OAAO;AACP,SAAS,kBAAkB;AAYpB,aAAM,sBAAsB,WAAW;AAAA,EAAvC;AAAA;AAMH,SAAO,QAAQ;AA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K,CAAC;AAAA,GA1BhC,cA2BF;AAGA;AAAA,EADN,SAAS,EAAE,WAAW,kBAAkB,CAAC;AAAA,GA7BjC,cA8BF;AAGA;AAAA,EADN,SAAS;AAAA,GAhCD,cAiCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,sBAAsB,CAAC;AAAA,GAnCnD,cAoCF;",
6
6
  "names": []
7
7
  }
@@ -1,32 +1,32 @@
1
- "use strict";var b=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var t=(c,o,l,r)=>{for(var s=r>1?void 0:r?h(o,l):o,a=c.length-1,d;a>=0;a--)(d=c[a])&&(s=(r?d(o,l,s):d(s))||s);return r&&s&&b(o,l,s),s};import{html as e}from"@spectrum-web-components/base";import{property as i}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as n}from"@spectrum-web-components/base/src/directives.js";import"@spectrum-web-components/underlay/sp-underlay.js";import"@spectrum-web-components/button/sp-button.js";import"@spectrum-web-components/dialog/sp-dialog.js";import{DialogBase as u}from"./DialogBase.js";export class DialogWrapper extends u{constructor(){super(...arguments);this.error=!1;this.cancelLabel="";this.confirmLabel="";this.footer="";this.hero="";this.heroLabel="";this.noDivider=!1;this.secondaryLabel="";this.headline=""}static get styles(){return[...super.styles]}get dialog(){return this.shadowRoot.querySelector("sp-dialog")}clickSecondary(){this.dispatchEvent(new Event("secondary",{bubbles:!0}))}clickCancel(){this.dispatchEvent(new Event("cancel",{bubbles:!0}))}clickConfirm(){this.dispatchEvent(new Event("confirm",{bubbles:!0}))}renderDialog(){const l=this.noDivider||!this.headline||this.headlineVisibility==="none";return e`
1
+ "use strict";var h=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var e=(a,l,r,n)=>{for(var i=n>1?void 0:n?u(l,r):l,d=a.length-1,b;d>=0;d--)(b=a[d])&&(i=(n?b(l,r,i):b(i))||i);return n&&i&&h(l,r,i),i};import{html as o,nothing as s}from"@spectrum-web-components/base";import{property as t}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as c}from"@spectrum-web-components/base/src/directives.js";import"@spectrum-web-components/underlay/sp-underlay.js";import"@spectrum-web-components/button/sp-button.js";import"@spectrum-web-components/dialog/sp-dialog.js";import{DialogBase as m}from"./DialogBase.js";export class DialogWrapper extends m{constructor(){super(...arguments);this.error=!1;this.cancelLabel="";this.confirmLabel="";this.footer="";this.hero="";this.heroLabel="";this.noDivider=!1;this.secondaryLabel="";this.headline=""}static get styles(){return[...super.styles]}get dialog(){return this.shadowRoot.querySelector("sp-dialog")}clickSecondary(){this.dispatchEvent(new Event("secondary",{bubbles:!0}))}clickCancel(){this.dispatchEvent(new Event("cancel",{bubbles:!0}))}clickConfirm(){this.dispatchEvent(new Event("confirm",{bubbles:!0}))}renderDialog(){const r=this.noDivider||!this.headline||this.headlineVisibility==="none";return o`
2
2
  <sp-dialog
3
3
  ?dismissable=${this.dismissable}
4
- ?no-divider=${l}
4
+ ?no-divider=${r}
5
5
  ?error=${this.error}
6
- mode=${n(this.mode)}
7
- size=${n(this.size)}
6
+ mode=${c(this.mode)}
7
+ size=${c(this.size)}
8
8
  >
9
- ${this.hero?e`
9
+ ${this.hero?o`
10
10
  <img
11
11
  src="${this.hero}"
12
12
  slot="hero"
13
- aria-hidden=${n(this.heroLabel?void 0:"true")}
14
- alt=${n(this.heroLabel?this.heroLabel:void 0)}
13
+ aria-hidden=${c(this.heroLabel?void 0:"true")}
14
+ alt=${c(this.heroLabel?this.heroLabel:void 0)}
15
15
  />
16
- `:e``}
17
- ${this.headline?e`
16
+ `:s}
17
+ ${this.headline?o`
18
18
  <h2
19
19
  slot="heading"
20
20
  ?hidden=${this.headlineVisibility==="none"}
21
21
  >
22
22
  ${this.headline}
23
23
  </h2>
24
- `:e``}
24
+ `:s}
25
25
  <slot></slot>
26
- ${this.footer?e`
26
+ ${this.footer?o`
27
27
  <div slot="footer">${this.footer}</div>
28
- `:e``}
29
- ${this.cancelLabel?e`
28
+ `:s}
29
+ ${this.cancelLabel?o`
30
30
  <sp-button
31
31
  variant="secondary"
32
32
  treatment="outline"
@@ -35,8 +35,8 @@
35
35
  >
36
36
  ${this.cancelLabel}
37
37
  </sp-button>
38
- `:e``}
39
- ${this.secondaryLabel?e`
38
+ `:s}
39
+ ${this.secondaryLabel?o`
40
40
  <sp-button
41
41
  variant="primary"
42
42
  treatment="outline"
@@ -45,8 +45,8 @@
45
45
  >
46
46
  ${this.secondaryLabel}
47
47
  </sp-button>
48
- `:e``}
49
- ${this.confirmLabel?e`
48
+ `:s}
49
+ ${this.confirmLabel?o`
50
50
  <sp-button
51
51
  variant="accent"
52
52
  slot="button"
@@ -54,7 +54,7 @@
54
54
  >
55
55
  ${this.confirmLabel}
56
56
  </sp-button>
57
- `:e``}
57
+ `:s}
58
58
  </sp-dialog>
59
- `}}t([i({type:Boolean,reflect:!0})],DialogWrapper.prototype,"error",2),t([i({attribute:"cancel-label"})],DialogWrapper.prototype,"cancelLabel",2),t([i({attribute:"confirm-label"})],DialogWrapper.prototype,"confirmLabel",2),t([i()],DialogWrapper.prototype,"footer",2),t([i()],DialogWrapper.prototype,"hero",2),t([i({attribute:"hero-label"})],DialogWrapper.prototype,"heroLabel",2),t([i({type:Boolean,reflect:!0,attribute:"no-divider"})],DialogWrapper.prototype,"noDivider",2),t([i({type:String,reflect:!0})],DialogWrapper.prototype,"size",2),t([i({attribute:"secondary-label"})],DialogWrapper.prototype,"secondaryLabel",2),t([i()],DialogWrapper.prototype,"headline",2),t([i({type:String,attribute:"headline-visibility"})],DialogWrapper.prototype,"headlineVisibility",2);
59
+ `}}e([t({type:Boolean,reflect:!0})],DialogWrapper.prototype,"error",2),e([t({attribute:"cancel-label"})],DialogWrapper.prototype,"cancelLabel",2),e([t({attribute:"confirm-label"})],DialogWrapper.prototype,"confirmLabel",2),e([t()],DialogWrapper.prototype,"footer",2),e([t()],DialogWrapper.prototype,"hero",2),e([t({attribute:"hero-label"})],DialogWrapper.prototype,"heroLabel",2),e([t({type:Boolean,reflect:!0,attribute:"no-divider"})],DialogWrapper.prototype,"noDivider",2),e([t({type:String,reflect:!0})],DialogWrapper.prototype,"size",2),e([t({attribute:"secondary-label"})],DialogWrapper.prototype,"secondaryLabel",2),e([t()],DialogWrapper.prototype,"headline",2),e([t({type:String,attribute:"headline-visibility"})],DialogWrapper.prototype,"headlineVisibility",2);
60
60
  //# sourceMappingURL=DialogWrapper.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["DialogWrapper.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js'\nimport { DialogBase } from './DialogBase.js';\nimport { Dialog } from './Dialog.js';\n\n/**\n * @element sp-dialog-wrapper\n *\n * @slot - content for the dialog\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @fires cancel - Announces that the \"cancel\" button has been clicked.\n * @fires confirm - Announces that the \"confirm\" button has been clicked.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogWrapper extends DialogBase {\n public static override get styles(): CSSResultArray {\n return [...super.styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ attribute: 'cancel-label' })\n public cancelLabel = '';\n\n @property({ attribute: 'confirm-label' })\n public confirmLabel = '';\n\n @property()\n public footer = '';\n\n @property()\n public hero = '';\n\n @property({ attribute: 'hero-label' })\n public heroLabel = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n @property({ attribute: 'secondary-label' })\n public secondaryLabel = '';\n\n @property()\n public headline = '';\n\n @property({ type: String, attribute: 'headline-visibility' })\n public headlineVisibility: 'none' | undefined;\n\n protected override get dialog(): Dialog {\n return this.shadowRoot.querySelector('sp-dialog') as Dialog;\n }\n\n private clickSecondary(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n })\n );\n }\n\n private clickCancel(): void {\n this.dispatchEvent(\n new Event('cancel', {\n bubbles: true,\n })\n );\n }\n\n private clickConfirm(): void {\n this.dispatchEvent(\n new Event('confirm', {\n bubbles: true,\n })\n );\n }\n\n protected override renderDialog(): TemplateResult {\n const hideDivider =\n this.noDivider ||\n !this.headline ||\n this.headlineVisibility === 'none';\n\n if (window.__swc.DEBUG) {\n if (!this.headline) {\n window.__swc.warn(\n this,\n `<${this.localName}> elements will not be accessible to screen readers without a \"headline\" attribute or property.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-wrapper/#accessibility',\n {\n type: 'accessibility',\n }\n );\n }\n }\n\n return html`\n <sp-dialog\n ?dismissable=${this.dismissable}\n ?no-divider=${hideDivider}\n ?error=${this.error}\n mode=${ifDefined(this.mode)}\n size=${ifDefined(this.size)}\n >\n ${this.hero\n ? html`\n <img\n src=\"${this.hero}\"\n slot=\"hero\"\n aria-hidden=${ifDefined(\n this.heroLabel ? undefined : 'true'\n )}\n alt=${ifDefined(\n this.heroLabel ? this.heroLabel : undefined\n )}\n />\n `\n : html``}\n ${this.headline\n ? html`\n <h2\n slot=\"heading\"\n ?hidden=${this.headlineVisibility === 'none'}\n >\n ${this.headline}\n </h2>\n `\n : html``}\n <slot></slot>\n ${this.footer\n ? html`\n <div slot=\"footer\">${this.footer}</div>\n `\n : html``}\n ${this.cancelLabel\n ? html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickCancel}\n >\n ${this.cancelLabel}\n </sp-button>\n `\n : html``}\n ${this.secondaryLabel\n ? html`\n <sp-button\n variant=\"primary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickSecondary}\n >\n ${this.secondaryLabel}\n </sp-button>\n `\n : html``}\n ${this.confirmLabel\n ? html`\n <sp-button\n variant=\"accent\"\n slot=\"button\"\n @click=${this.clickConfirm}\n >\n ${this.confirmLabel}\n </sp-button>\n `\n : html``}\n </sp-dialog>\n `;\n }\n}\n"],
5
- "mappings": "qNAYA,OAEI,QAAAA,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,aAAAC,MAAiB,kDAE1B,MAAO,mDACP,MAAO,+CAGP,MAAO,+CACP,OAAS,cAAAC,MAAkB,kBAYpB,aAAM,sBAAsBA,CAAW,CAAvC,kCAMH,KAAO,MAAQ,GAGf,KAAO,YAAc,GAGrB,KAAO,aAAe,GAGtB,KAAO,OAAS,GAGhB,KAAO,KAAO,GAGd,KAAO,UAAY,GAGnB,KAAO,UAAY,GAMnB,KAAO,eAAiB,GAGxB,KAAO,SAAW,GAhClB,WAA2B,QAAyB,CAChD,MAAO,CAAC,GAAG,MAAM,MAAM,CAC3B,CAmCA,IAAuB,QAAiB,CACpC,OAAO,KAAK,WAAW,cAAc,WAAW,CACpD,CAEQ,gBAAuB,CAC3B,KAAK,cACD,IAAI,MAAM,YAAa,CACnB,QAAS,EACb,CAAC,CACL,CACJ,CAEQ,aAAoB,CACxB,KAAK,cACD,IAAI,MAAM,SAAU,CAChB,QAAS,EACb,CAAC,CACL,CACJ,CAEQ,cAAqB,CACzB,KAAK,cACD,IAAI,MAAM,UAAW,CACjB,QAAS,EACb,CAAC,CACL,CACJ,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ADNJ,EAAS,CAAE,UAAW,eAAgB,CAAC,GAX/B,cAYF,4BAGAI,EAAA,CADNJ,EAAS,GAdD,cAeF,sBAGAI,EAAA,CADNJ,EAAS,GAjBD,cAkBF,oBAGAI,EAAA,CADNJ,EAAS,CAAE,UAAW,YAAa,CAAC,GApB5B,cAqBF,yBAGAI,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,YAAa,CAAC,GAvB1D,cAwBF,yBAGAI,EAAA,CADNJ,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GA1BhC,cA2BF,oBAGAI,EAAA,CADNJ,EAAS,CAAE,UAAW,iBAAkB,CAAC,GA7BjC,cA8BF,8BAGAI,EAAA,CADNJ,EAAS,GAhCD,cAiCF,wBAGAI,EAAA,CADNJ,EAAS,CAAE,KAAM,OAAQ,UAAW,qBAAsB,CAAC,GAnCnD,cAoCF",
6
- "names": ["html", "property", "ifDefined", "DialogBase", "hideDivider", "__decorateClass"]
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport { DialogBase } from './DialogBase.js';\nimport { Dialog } from './Dialog.js';\n\n/**\n * @element sp-dialog-wrapper\n *\n * @slot - content for the dialog\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @fires cancel - Announces that the \"cancel\" button has been clicked.\n * @fires confirm - Announces that the \"confirm\" button has been clicked.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogWrapper extends DialogBase {\n public static override get styles(): CSSResultArray {\n return [...super.styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ attribute: 'cancel-label' })\n public cancelLabel = '';\n\n @property({ attribute: 'confirm-label' })\n public confirmLabel = '';\n\n @property()\n public footer = '';\n\n @property()\n public hero = '';\n\n @property({ attribute: 'hero-label' })\n public heroLabel = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n @property({ attribute: 'secondary-label' })\n public secondaryLabel = '';\n\n @property()\n public headline = '';\n\n @property({ type: String, attribute: 'headline-visibility' })\n public headlineVisibility: 'none' | undefined;\n\n protected override get dialog(): Dialog {\n return this.shadowRoot.querySelector('sp-dialog') as Dialog;\n }\n\n private clickSecondary(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n })\n );\n }\n\n private clickCancel(): void {\n this.dispatchEvent(\n new Event('cancel', {\n bubbles: true,\n })\n );\n }\n\n private clickConfirm(): void {\n this.dispatchEvent(\n new Event('confirm', {\n bubbles: true,\n })\n );\n }\n\n protected override renderDialog(): TemplateResult {\n const hideDivider =\n this.noDivider ||\n !this.headline ||\n this.headlineVisibility === 'none';\n\n if (window.__swc.DEBUG) {\n if (!this.headline) {\n window.__swc.warn(\n this,\n `<${this.localName}> elements will not be accessible to screen readers without a \"headline\" attribute or property.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-wrapper/#accessibility',\n {\n type: 'accessibility',\n }\n );\n }\n }\n\n return html`\n <sp-dialog\n ?dismissable=${this.dismissable}\n ?no-divider=${hideDivider}\n ?error=${this.error}\n mode=${ifDefined(this.mode)}\n size=${ifDefined(this.size)}\n >\n ${this.hero\n ? html`\n <img\n src=\"${this.hero}\"\n slot=\"hero\"\n aria-hidden=${ifDefined(\n this.heroLabel ? undefined : 'true'\n )}\n alt=${ifDefined(\n this.heroLabel ? this.heroLabel : undefined\n )}\n />\n `\n : nothing}\n ${this.headline\n ? html`\n <h2\n slot=\"heading\"\n ?hidden=${this.headlineVisibility === 'none'}\n >\n ${this.headline}\n </h2>\n `\n : nothing}\n <slot></slot>\n ${this.footer\n ? html`\n <div slot=\"footer\">${this.footer}</div>\n `\n : nothing}\n ${this.cancelLabel\n ? html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickCancel}\n >\n ${this.cancelLabel}\n </sp-button>\n `\n : nothing}\n ${this.secondaryLabel\n ? html`\n <sp-button\n variant=\"primary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickSecondary}\n >\n ${this.secondaryLabel}\n </sp-button>\n `\n : nothing}\n ${this.confirmLabel\n ? html`\n <sp-button\n variant=\"accent\"\n slot=\"button\"\n @click=${this.clickConfirm}\n >\n ${this.confirmLabel}\n </sp-button>\n `\n : nothing}\n </sp-dialog>\n `;\n }\n}\n"],
5
+ "mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,aAAAC,MAAiB,kDAE1B,MAAO,mDACP,MAAO,+CAGP,MAAO,+CACP,OAAS,cAAAC,MAAkB,kBAYpB,aAAM,sBAAsBA,CAAW,CAAvC,kCAMH,KAAO,MAAQ,GAGf,KAAO,YAAc,GAGrB,KAAO,aAAe,GAGtB,KAAO,OAAS,GAGhB,KAAO,KAAO,GAGd,KAAO,UAAY,GAGnB,KAAO,UAAY,GAMnB,KAAO,eAAiB,GAGxB,KAAO,SAAW,GAhClB,WAA2B,QAAyB,CAChD,MAAO,CAAC,G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c;AAAA;AAAA,wBAG7BC,CAAO;AAAA,kBACX,KAAK,aACDD;AAAA;AAAA;AAAA;AAAA,uCAIiB,KAAK,YAAY;AAAA;AAAA,gCAExB,KAAK,YAAY;AAAA;AAAA,wBAG3BC,CAAO;AAAA;AAAA,SAGzB,CACJ,CA3JWK,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GALjC,cAMF,qBAGAI,EAAA,CADNJ,EAAS,CAAE,UAAW,cAAe,CAAC,GAR9B,cASF,2BAGAI,EAAA,CADNJ,EAAS,CAAE,UAAW,eAAgB,CAAC,GAX/B,cAYF,4BAGAI,EAAA,CADNJ,EAAS,GAdD,cAeF,sBAGAI,EAAA,CADNJ,EAAS,GAjBD,cAkBF,oBAGAI,EAAA,CADNJ,EAAS,CAAE,UAAW,YAAa,CAAC,GApB5B,cAqBF,yBAGAI,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,YAAa,CAAC,GAvB1D,cAwBF,yBAGAI,EAAA,CADNJ,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GA1BhC,cA2BF,oBAGAI,EAAA,CADNJ,EAAS,CAAE,UAAW,iBAAkB,CAAC,GA7BjC,cA8BF,8BAGAI,EAAA,CADNJ,EAAS,GAhCD,cAiCF,wBAGAI,EAAA,CADNJ,EAAS,CAAE,KAAM,OAAQ,UAAW,qBAAsB,CAAC,GAnCnD,cAoCF",
6
+ "names": ["html", "nothing", "property", "ifDefined", "DialogBase", "hideDivider", "__decorateClass"]
7
7
  }
@@ -7,6 +7,7 @@ import "@spectrum-web-components/overlay/sp-overlay.js";
7
7
  import "@spectrum-web-components/checkbox/sp-checkbox.js";
8
8
  import { alertDestructive } from "./dialog.stories.js";
9
9
  import { portrait } from "./images.js";
10
+ import "./helpers.js";
10
11
  export default {
11
12
  title: "Dialog Base",
12
13
  component: "sp-dialog-base",
@@ -48,7 +49,7 @@ export const disabledButton = () => {
48
49
  );
49
50
  }
50
51
  }}
51
- @sp-opened=${() => {
52
+ @sp-opened=${({ target }) => {
52
53
  let count = 5;
53
54
  const timer = setInterval(() => {
54
55
  count -= 1;
@@ -60,6 +61,7 @@ export const disabledButton = () => {
60
61
  "#changing-button"
61
62
  ).disabled = false;
62
63
  clearInterval(timer);
64
+ target.dispatchEvent(new Event("countdown-complete"));
63
65
  }
64
66
  document.querySelector(".time").textContent = count.toString();
65
67
  }, 1e3);
@@ -88,6 +90,14 @@ export const disabledButton = () => {
88
90
  </sp-dialog-base>
89
91
  `;
90
92
  };
93
+ disabledButton.decorators = [
94
+ (story) => {
95
+ return html`
96
+ ${story()}
97
+ <countdown-complete-watcher></countdown-complete-watcher>
98
+ `;
99
+ }
100
+ ];
91
101
  export const notAgain = () => html`
92
102
  <sp-dialog-base
93
103
  underlay
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["dialog-base.stories.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/dialog/sp-dialog-base.js';\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport '@spectrum-web-components/checkbox/sp-checkbox.js';\nimport { alertDestructive } from './dialog.stories.js';\nimport { portrait } from './images.js';\n\nexport default {\n title: 'Dialog Base',\n component: 'sp-dialog-base',\n decorators: [\n (story: () => TemplateResult): TemplateResult => {\n return html`\n <sp-button variant=\"primary\" id=\"trigger\">\n Toggle Dialog\n </sp-button>\n <sp-overlay type=\"modal\" trigger=\"trigger@click\" open>\n ${story()}\n </sp-overlay>\n `;\n },\n ],\n};\n\nexport const Slotted = (): TemplateResult => html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'sp-button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n >\n ${alertDestructive()}\n </sp-dialog-base>\n`;\n\nexport const disabledButton = (): TemplateResult => {\n return html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'sp-button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n @sp-opened=${() => {\n let count = 5;\n const timer = setInterval(() => {\n count -= 1;\n if (!count) {\n (\n document.querySelector(\n '#changing-header'\n ) as HTMLElement\n ).textContent =\n 'The button in this dialog is now enabled';\n (\n document.querySelector(\n '#changing-button'\n ) as HTMLButtonElement\n ).disabled = false;\n clearInterval(timer);\n }\n (\n document.querySelector('.time') as HTMLElement\n ).textContent = count.toString();\n }, 1000);\n }}\n @close=${() => {\n (\n document.querySelector('#changing-header') as HTMLElement\n ).textContent = 'The button in this dialog is disabled';\n (\n document.querySelector(\n '#changing-button'\n ) as HTMLButtonElement\n ).disabled = true;\n (document.querySelector('.time') as HTMLElement).textContent =\n '5';\n }}\n >\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\" id=\"changing-header\">\n The button in this dialog is disabled\n </h2>\n <p>\n After about\n <span class=\"time\">5</span>\n seconds the button with be enabled.\n </p>\n <sp-button disabled slot=\"button\" id=\"changing-button\">\n Ok\n </sp-button>\n </sp-dialog>\n </sp-dialog-base>\n `;\n};\n\nexport const notAgain = (): TemplateResult => html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'sp-button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n >\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\">A thing is about to happen</h2>\n <p>Something that might happen a lot is about to happen.</p>\n <p>\n The click events for the \"OK\" button are bound to the story not\n to the components in specific.\n </p>\n <sp-button variant=\"secondary\" treatment=\"fill\" slot=\"button\">\n Ok\n </sp-button>\n <sp-checkbox slot=\"footer\">Don't show me this again</sp-checkbox>\n </sp-dialog>\n </sp-dialog-base>\n`;\n\nexport const moreCustom = (): TemplateResult => html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'sp-button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n >\n <div style=\"display: flex;\">\n <div\n style=\"\n display: grid;\n place-content: center;\n grid-template-columns: calc(100% - 40px);\n grid-template-rows: calc(100% - 40px);\n \"\n >\n <img\n src=${portrait}\n alt=\"\"\n style=\"\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-placement: center;\n \"\n />\n </div>\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\">Look at that image</h2>\n <p>\n Its position has been customized beyond the language of\n Spectrum. Be careful with all this power. There's no\n \"mobile\" default for delivering content like this.\n </p>\n <sp-button variant=\"accent\" treatment=\"outline\" slot=\"button\">\n Ok\n </sp-button>\n </sp-dialog>\n </div>\n </sp-dialog-base>\n`;\n\nexport const fullyCustom = (): TemplateResult => html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n >\n <div id=\"fully-custom-dialog\">\n <style>\n #fully-custom-dialog {\n margin: 1em;\n }\n </style>\n <h2>Custom headline</h2>\n <p>\n The click events for the \"Done\" button are bound to the story\n not to the components in specific.\n </p>\n <p>\n This is a demonstration of what is possible with\n &lt;sp-dialog-base&gt;, only, and should not be seen as an\n endorsement for fully custom dialog UIs.\n </p>\n <p>Fully open content area, for whatever DOM you would like.</p>\n <button>Done</button>\n </div>\n </sp-dialog-base>\n`;\n"],
5
- "mappings": ";AAWA,SAAS,YAA4B;AACrC,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,wBAAwB;AACjC,SAAS,gBAAgB;AAEzB,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,YAAY;AAAA,IACR,CAAC,UAAgD;AAC7C,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKG,MAAM,CAAC;AAAA;AAAA;AAAA,IAGrB;AAAA,EACJ;AACJ;AAEO,aAAM,UAAU,MAAsB;AAAA;AAAA;AAAA,iBAG5B,CAAC,UAAiB;AACvB,MAAK,MAAM,OAAuB,cAAc,aAAa;AACzD,IAAC,MAAM,OAAuB;AAAA,MAC1B,IAAI,MAAM,SAAS,EAAE,SAAS,MAAM,UAAU,KAAK,CAAC;AAAA,IACxD;AAAA,EACJ;AACJ,CAAC;AAAA;AAAA,UAEC,iBAAiB,CAAC;AAAA;AAAA;AAIrB,aAAM,iBAAiB,MAAsB;AAChD,SAAO;AAAA;AAAA;AAAA,qBAGU,CAAC,UAAiB;AACvB,QAAK,MAAM,OAAuB,cAAc,aAAa;AACzD,MAAC,MAAM,OAAuB;AAAA,QAC1B,IAAI,MAAM,SAAS,EAAE,SAAS,MAAM,UAAU,KAAK,CAAC;AAAA,MACxD;AAAA,IACJ;AAAA,EACJ,CAAC;AAAA,yBACY,MAAM;AACf,QAAI,QAAQ;AACZ,UAAM,QAAQ,YAAY,MAAM;AAC5B,eAAS;AACT,UAAI,CAAC,OAAO;AACR,QACI,SAAS;AAAA,UACL;AAAA,QACJ,EACF,cACE;AACJ,QACI,SAAS;AAAA,UACL;AAAA,QACJ,EACF,WAAW;AACb,sBAAc,KAAK;AAAA,MACvB;AACA,MACI,SAAS,cAAc,OAAO,EAChC,cAAc,MAAM,SAAS;AAAA,IACnC,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I,MAAM,SAAS,EAAE,SAAS,MAAM,UAAU,KAAK,CAAC;AAAA,IACxD;AAAA,EACJ;AACJ,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/dialog/sp-dialog-base.js';\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport '@spectrum-web-components/checkbox/sp-checkbox.js';\nimport { alertDestructive } from './dialog.stories.js';\nimport { portrait } from './images.js';\nimport './helpers.js';\n\nexport default {\n title: 'Dialog Base',\n component: 'sp-dialog-base',\n decorators: [\n (story: () => TemplateResult): TemplateResult => {\n return html`\n <sp-button variant=\"primary\" id=\"trigger\">\n Toggle Dialog\n </sp-button>\n <sp-overlay type=\"modal\" trigger=\"trigger@click\" open>\n ${story()}\n </sp-overlay>\n `;\n },\n ],\n};\n\nexport const Slotted = (): TemplateResult => html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'sp-button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n >\n ${alertDestructive()}\n </sp-dialog-base>\n`;\n\nexport const disabledButton = (): TemplateResult => {\n return html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'sp-button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n @sp-opened=${({ target }: Event & { target: HTMLElement }) => {\n let count = 5;\n const timer = setInterval(() => {\n count -= 1;\n if (!count) {\n (\n document.querySelector(\n '#changing-header'\n ) as HTMLElement\n ).textContent =\n 'The button in this dialog is now enabled';\n (\n document.querySelector(\n '#changing-button'\n ) as HTMLButtonElement\n ).disabled = false;\n clearInterval(timer);\n target.dispatchEvent(new Event('countdown-complete'));\n }\n (\n document.querySelector('.time') as HTMLElement\n ).textContent = count.toString();\n }, 1000);\n }}\n @close=${() => {\n (\n document.querySelector('#changing-header') as HTMLElement\n ).textContent = 'The button in this dialog is disabled';\n (\n document.querySelector(\n '#changing-button'\n ) as HTMLButtonElement\n ).disabled = true;\n (document.querySelector('.time') as HTMLElement).textContent =\n '5';\n }}\n >\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\" id=\"changing-header\">\n The button in this dialog is disabled\n </h2>\n <p>\n After about\n <span class=\"time\">5</span>\n seconds the button with be enabled.\n </p>\n <sp-button disabled slot=\"button\" id=\"changing-button\">\n Ok\n </sp-button>\n </sp-dialog>\n </sp-dialog-base>\n `;\n};\n\ndisabledButton.decorators = [\n (story: () => TemplateResult): TemplateResult => {\n return html`\n ${story()}\n <countdown-complete-watcher></countdown-complete-watcher>\n `;\n },\n];\n\nexport const notAgain = (): TemplateResult => html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'sp-button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n >\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\">A thing is about to happen</h2>\n <p>Something that might happen a lot is about to happen.</p>\n <p>\n The click events for the \"OK\" button are bound to the story not\n to the components in specific.\n </p>\n <sp-button variant=\"secondary\" treatment=\"fill\" slot=\"button\">\n Ok\n </sp-button>\n <sp-checkbox slot=\"footer\">Don't show me this again</sp-checkbox>\n </sp-dialog>\n </sp-dialog-base>\n`;\n\nexport const moreCustom = (): TemplateResult => html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'sp-button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n >\n <div style=\"display: flex;\">\n <div\n style=\"\n display: grid;\n place-content: center;\n grid-template-columns: calc(100% - 40px);\n grid-template-rows: calc(100% - 40px);\n \"\n >\n <img\n src=${portrait}\n alt=\"\"\n style=\"\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-placement: center;\n \"\n />\n </div>\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\">Look at that image</h2>\n <p>\n Its position has been customized beyond the language of\n Spectrum. Be careful with all this power. There's no\n \"mobile\" default for delivering content like this.\n </p>\n <sp-button variant=\"accent\" treatment=\"outline\" slot=\"button\">\n Ok\n </sp-button>\n </sp-dialog>\n </div>\n </sp-dialog-base>\n`;\n\nexport const fullyCustom = (): TemplateResult => html`\n <sp-dialog-base\n underlay\n @click=${(event: Event) => {\n if ((event.target as HTMLElement).localName === 'button') {\n (event.target as HTMLElement).dispatchEvent(\n new Event('close', { bubbles: true, composed: true })\n );\n }\n }}\n >\n <div id=\"fully-custom-dialog\">\n <style>\n #fully-custom-dialog {\n margin: 1em;\n }\n </style>\n <h2>Custom headline</h2>\n <p>\n The click events for the \"Done\" button are bound to the story\n not to the components in specific.\n </p>\n <p>\n This is a demonstration of what is possible with\n &lt;sp-dialog-base&gt;, only, and should not be seen as an\n endorsement for fully custom dialog UIs.\n </p>\n <p>Fully open content area, for whatever DOM you would like.</p>\n <button>Done</button>\n </div>\n </sp-dialog-base>\n`;\n"],
5
+ "mappings": ";AAWA,SAAS,YAA4B;AACrC,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,wBAAw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AM,SAAS,EAAE,SAAS,MAAM,UAAU,KAAK,CAAC;AAAA,IACxD;AAAA,EACJ;AACJ,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -467,4 +467,44 @@ export const fullscreenTakeover = () => {
467
467
  </sp-dialog>
468
468
  `;
469
469
  };
470
+ export const forcedScrolling = () => html`
471
+ <style>
472
+ .container {
473
+ max-height: 300px;
474
+ border: 1px solid white;
475
+ }
476
+ </style>
477
+ <div class="container">
478
+ <sp-dialog size="m">
479
+ <h2 slot="heading">Disclaimer</h2>
480
+ <div class="contents">
481
+ The contents of this dialog is specifically prepared to force
482
+ scrolling, allowing us to test whether the scroll bar is
483
+ appopriately activated in this context.
484
+ <span style="color: red;">
485
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
486
+ do eiusmod tempor incididunt ut labore et dolore magna
487
+ aliqua. Auctor augue mauris augue neque gravida. Libero
488
+ volutpat sed ornare arcu. Quisque egestas diam in arcu
489
+ cursus euismod quis viverra.
490
+ </span>
491
+ <span style="color: green;">
492
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
493
+ do eiusmod tempor incididunt ut labore et dolore magna
494
+ aliqua. Auctor augue mauris augue neque gravida. Libero
495
+ volutpat sed ornare arcu. Quisque egestas diam in arcu
496
+ cursus euismod quis viverra.
497
+ </span>
498
+ <span style="color: blue;">
499
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
500
+ do eiusmod tempor incididunt ut labore et dolore magna
501
+ aliqua. Auctor augue mauris augue neque gravida. Libero
502
+ volutpat sed ornare arcu. Quisque egestas diam in arcu
503
+ cursus euismod quis viverra.
504
+ </span>
505
+ </div>
506
+ <sp-button slot="button">Footer button</sp-button>
507
+ </sp-dialog>
508
+ </div>
509
+ `;
470
510
  //# sourceMappingURL=dialog.stories.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["dialog.stories.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport { landscape } from './images.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nexport default {\n title: 'Dialog',\n component: 'sp-dialog',\n};\n\nexport const small = (): TemplateResult => {\n return html`\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const medium = (): TemplateResult => {\n return html`\n <sp-dialog size=\"m\">\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const large = (): TemplateResult => {\n return html`\n <sp-dialog size=\"l\">\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const dismissable = (): TemplateResult => {\n return html`\n <sp-dialog size=\"m\" dismissable>\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const noDivider = (): TemplateResult => {\n return html`\n <sp-dialog size=\"m\" dismissable no-divider>\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const hero = (): TemplateResult => {\n return html`\n <sp-dialog size=\"m\" dismissable no-divider>\n <div slot=\"hero\" style=\"background-image: url(${landscape})\"></div>\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const alertConfirmation = (): TemplateResult => {\n return html`\n <sp-dialog>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"accent\" slot=\"button\">Enable</sp-button>\n </sp-dialog>\n `;\n};\n\nexport const alertInformation = (): TemplateResult => {\n return html`\n <sp-dialog>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"primary\" treatment=\"outline\" slot=\"button\">\n Enable\n </sp-button>\n </sp-dialog>\n `;\n};\n\nexport const alertDestructive = (): TemplateResult => {\n return html`\n <sp-dialog>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"negative\" slot=\"button\">Enable</sp-button>\n </sp-dialog>\n `;\n};\n\nexport const alertError = (): TemplateResult => {\n return html`\n <sp-dialog error>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"primary\" treatment=\"outline\" slot=\"button\">\n Enable\n </sp-button>\n </sp-dialog>\n `;\n};\n\nexport const alertErrorWithLongTitle = (): TemplateResult => {\n return html`\n <sp-dialog error>\n <h2 slot=\"heading\">Unable to Share Project to Behance Community</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"primary\" treatment=\"outline\" slot=\"button\">\n Enable\n </sp-button>\n </sp-dialog>\n `;\n};\n\nexport const fullscreen = (): TemplateResult => {\n return html`\n <sp-dialog mode=\"fullscreen\" dismissable>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <div slot=\"footer\">\n Anything in the footer is sticky and aligned right.\n </div>\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"accent\" slot=\"button\">Enable</sp-button>\n </sp-dialog>\n `;\n};\n\nexport const fullscreenTakeover = (): TemplateResult => {\n return html`\n <sp-dialog mode=\"fullscreenTakeover\">\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <div slot=\"footer\">\n Anything in the footer is sticky and aligned right.\n </div>\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"accent\" slot=\"button\">Enable</sp-button>\n </sp-dialog>\n `;\n};\n"],
5
- "mappings": ";AAYA,SAAS,YAA4B;AAErC,OAAO;AACP,SAAS,iBAAiB;AAC1B,OAAO;AAEP,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AACf;AAEO,aAAM,QAAQ,MAAsB;AACvC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBX;AAEO,aAAM,SAAS,MAAsB;AACxC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBX;AAEO,aAAM,QAAQ,MAAsB;AACvC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBX;AAEO,aAAM,cAAc,MAAsB;AAC7C,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBX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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0IX;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport { landscape } from './images.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nexport default {\n title: 'Dialog',\n component: 'sp-dialog',\n};\n\nexport const small = (): TemplateResult => {\n return html`\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const medium = (): TemplateResult => {\n return html`\n <sp-dialog size=\"m\">\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const large = (): TemplateResult => {\n return html`\n <sp-dialog size=\"l\">\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const dismissable = (): TemplateResult => {\n return html`\n <sp-dialog size=\"m\" dismissable>\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const noDivider = (): TemplateResult => {\n return html`\n <sp-dialog size=\"m\" dismissable no-divider>\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const hero = (): TemplateResult => {\n return html`\n <sp-dialog size=\"m\" dismissable no-divider>\n <div slot=\"hero\" style=\"background-image: url(${landscape})\"></div>\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Auctor\n augue mauris augue neque gravida. Libero volutpat sed ornare arcu.\n Quisque egestas diam in arcu cursus euismod quis viverra. Posuere ac\n ut consequat semper viverra nam libero justo laoreet. Enim ut tellus\n elementum sagittis vitae et leo duis ut. Neque laoreet suspendisse\n interdum consectetur libero id faucibus nisl. Diam volutpat commodo\n sed egestas egestas. Dolor magna eget est lorem ipsum dolor. Vitae\n suscipit tellus mauris a diam maecenas sed. Turpis in eu mi bibendum\n neque egestas congue. Rhoncus est pellentesque elit ullamcorper\n dignissim cras lobortis.\n </sp-dialog>\n `;\n};\n\nexport const alertConfirmation = (): TemplateResult => {\n return html`\n <sp-dialog>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"accent\" slot=\"button\">Enable</sp-button>\n </sp-dialog>\n `;\n};\n\nexport const alertInformation = (): TemplateResult => {\n return html`\n <sp-dialog>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"primary\" treatment=\"outline\" slot=\"button\">\n Enable\n </sp-button>\n </sp-dialog>\n `;\n};\n\nexport const alertDestructive = (): TemplateResult => {\n return html`\n <sp-dialog>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"negative\" slot=\"button\">Enable</sp-button>\n </sp-dialog>\n `;\n};\n\nexport const alertError = (): TemplateResult => {\n return html`\n <sp-dialog error>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"primary\" treatment=\"outline\" slot=\"button\">\n Enable\n </sp-button>\n </sp-dialog>\n `;\n};\n\nexport const alertErrorWithLongTitle = (): TemplateResult => {\n return html`\n <sp-dialog error>\n <h2 slot=\"heading\">Unable to Share Project to Behance Community</h2>\n Smart filters are nondestructive and will preserve your original\n images.\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"primary\" treatment=\"outline\" slot=\"button\">\n Enable\n </sp-button>\n </sp-dialog>\n `;\n};\n\nexport const fullscreen = (): TemplateResult => {\n return html`\n <sp-dialog mode=\"fullscreen\" dismissable>\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <div slot=\"footer\">\n Anything in the footer is sticky and aligned right.\n </div>\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"accent\" slot=\"button\">Enable</sp-button>\n </sp-dialog>\n `;\n};\n\nexport const fullscreenTakeover = (): TemplateResult => {\n return html`\n <sp-dialog mode=\"fullscreenTakeover\">\n <h2 slot=\"heading\">Enable Smart Filters?</h2>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n enim ad minim veniam, quis nostrud exercitation ullamco laboris\n nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\n in reprehenderit in voluptate velit esse cillum dolore eu fugiat\n nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n <p>\n Sed ut perspiciatis unde omnis iste natus error sit voluptatem\n accusantium doloremque laudantium, totam rem aperiam, eaque ipsa\n quae ab illo inventore veritatis et quasi architecto beatae\n vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia\n voluptas sit aspernatur aut odit aut fugit, sed quia\n consequuntur magni dolores eos qui ratione voluptatem sequi\n nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor\n sit amet, consectetur, adipisci velit, sed quia non numquam eius\n modi tempora incidunt ut labore et dolore magnam aliquam quaerat\n voluptatem. Ut enim ad minima veniam, quis nostrum\n exercitationem ullam corporis suscipit laboriosam, nisi ut\n aliquid ex ea commodi consequatur? Quis autem vel eum iure\n reprehenderit qui in ea voluptate velit esse quam nihil\n molestiae consequatur, vel illum qui dolorem eum fugiat quo\n voluptas nulla pariatur?\n </p>\n <p>\n At vero eos et accusamus et iusto odio dignissimos ducimus qui\n blanditiis praesentium voluptatum deleniti atque corrupti quos\n dolores et quas molestias excepturi sint occaecati cupiditate\n non provident, similique sunt in culpa qui officia deserunt\n mollitia animi, id est laborum et dolorum fuga. Et harum quidem\n rerum facilis est et expedita distinctio. Nam libero tempore,\n cum soluta nobis est eligendi optio cumque nihil impedit quo\n minus id quod maxime placeat facere possimus, omnis voluptas\n assumenda est, omnis dolor repellendus. Temporibus autem\n quibusdam et aut officiis debitis aut rerum necessitatibus saepe\n eveniet ut et voluptates repudiandae sint et molestiae non\n recusandae. Itaque earum rerum hic tenetur a sapiente delectus,\n ut aut reiciendis voluptatibus maiores alias consequatur aut\n perferendis doloribus asperiores repellat.\n </p>\n <div slot=\"footer\">\n Anything in the footer is sticky and aligned right.\n </div>\n <sp-button variant=\"secondary\" treatment=\"outline\" slot=\"button\">\n Cancel\n </sp-button>\n <sp-button variant=\"accent\" slot=\"button\">Enable</sp-button>\n </sp-dialog>\n `;\n};\n\nexport const forcedScrolling = (): TemplateResult => html`\n <style>\n .container {\n max-height: 300px;\n border: 1px solid white;\n }\n </style>\n <div class=\"container\">\n <sp-dialog size=\"m\">\n <h2 slot=\"heading\">Disclaimer</h2>\n <div class=\"contents\">\n The contents of this dialog is specifically prepared to force\n scrolling, allowing us to test whether the scroll bar is\n appopriately activated in this context.\n <span style=\"color: red;\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed\n do eiusmod tempor incididunt ut labore et dolore magna\n aliqua. Auctor augue mauris augue neque gravida. Libero\n volutpat sed ornare arcu. Quisque egestas diam in arcu\n cursus euismod quis viverra.\n </span>\n <span style=\"color: green;\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed\n do eiusmod tempor incididunt ut labore et dolore magna\n aliqua. Auctor augue mauris augue neque gravida. Libero\n volutpat sed ornare arcu. Quisque egestas diam in arcu\n cursus euismod quis viverra.\n </span>\n <span style=\"color: blue;\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed\n do eiusmod tempor incididunt ut labore et dolore magna\n aliqua. Auctor augue mauris augue neque gravida. Libero\n volutpat sed ornare arcu. Quisque egestas diam in arcu\n cursus euismod quis viverra.\n </span>\n </div>\n <sp-button slot=\"button\">Footer button</sp-button>\n </sp-dialog>\n </div>\n`;\n"],
5
+ "mappings": ";AAYA,SAAS,YAA4B;AAErC,OAAO;AACP,SAAS,iBAAiB;AAC1B,OAAO;AAEP,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AACf;AAEO,aAAM,QAAQ,MAAsB;AACvC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBX;AAEO,aAAM,SAAS,MAAsB;AACxC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBX;AAEO,aAAM,QAAQ,MAAsB;AACvC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBX;AAEO,aAAM,cAAc,MAAsB;AAC7C,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBX;AAEO,aAAM,YAAY,MAAsB;AAC3C,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBX;AAEO,aAAM,OAAO,MAAsB;AACtC,SAAO;AAAA;AAAA,4DAEiD,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAerE;AAEO,aAAM,oBAAoB,MAAsB;AACnD,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ export class CountdownWatcher extends HTMLElement {
3
+ constructor() {
4
+ super();
5
+ this.readyPromise = Promise.resolve(false);
6
+ this.readyPromise = new Promise((res) => {
7
+ this.ready = res;
8
+ this.setup();
9
+ });
10
+ }
11
+ setup() {
12
+ this.previousElementSibling.addEventListener(
13
+ "countdown-complete",
14
+ () => {
15
+ this.ready(true);
16
+ }
17
+ );
18
+ }
19
+ get updateComplete() {
20
+ return this.readyPromise;
21
+ }
22
+ }
23
+ customElements.define("countdown-complete-watcher", CountdownWatcher);
24
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["helpers.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport class CountdownWatcher extends HTMLElement {\n ready!: (value: boolean | PromiseLike<boolean>) => void;\n\n constructor() {\n super();\n this.readyPromise = new Promise((res) => {\n this.ready = res;\n this.setup();\n });\n }\n\n setup(): void {\n (this.previousElementSibling as HTMLElement).addEventListener(\n 'countdown-complete',\n () => {\n this.ready(true);\n }\n );\n }\n\n private readyPromise: Promise<boolean> = Promise.resolve(false);\n\n get updateComplete(): Promise<boolean> {\n return this.readyPromise;\n }\n}\n\ncustomElements.define('countdown-complete-watcher', CountdownWatcher);\n"],
5
+ "mappings": ";AAYO,aAAM,yBAAyB,YAAY;AAAA,EAG9C,cAAc;AACV,UAAM;AAgBV,SAAQ,eAAiC,QAAQ,QAAQ,KAAK;AAf1D,SAAK,eAAe,IAAI,QAAQ,CAAC,QAAQ;AACrC,WAAK,QAAQ;AACb,WAAK,MAAM;AAAA,IACf,CAAC;AAAA,EACL;AAAA,EAEA,QAAc;AACV,IAAC,KAAK,uBAAuC;AAAA,MACzC;AAAA,MACA,MAAM;AACF,aAAK,MAAM,IAAI;AAAA,MACnB;AAAA,IACJ;AAAA,EACJ;AAAA,EAIA,IAAI,iBAAmC;AACnC,WAAO,KAAK;AAAA,EAChB;AACJ;AAEA,eAAe,OAAO,8BAA8B,gBAAgB;",
6
+ "names": []
7
+ }