@spectrum-web-components/dialog 0.38.0 → 0.39.1

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.
@@ -85,14 +85,6 @@
85
85
  "text": "CloseButton | undefined"
86
86
  }
87
87
  },
88
- {
89
- "kind": "field",
90
- "name": "contentElement",
91
- "type": {
92
- "text": "HTMLDivElement"
93
- },
94
- "privacy": "private"
95
- },
96
88
  {
97
89
  "kind": "field",
98
90
  "name": "error",
@@ -193,26 +185,6 @@
193
185
  }
194
186
  }
195
187
  },
196
- {
197
- "kind": "method",
198
- "name": "renderHeading",
199
- "privacy": "protected",
200
- "return": {
201
- "type": {
202
- "text": "TemplateResult"
203
- }
204
- }
205
- },
206
- {
207
- "kind": "method",
208
- "name": "renderContent",
209
- "privacy": "protected",
210
- "return": {
211
- "type": {
212
- "text": "TemplateResult"
213
- }
214
- }
215
- },
216
188
  {
217
189
  "kind": "method",
218
190
  "name": "renderFooter",
@@ -242,84 +214,6 @@
242
214
  "text": "TemplateResult"
243
215
  }
244
216
  }
245
- },
246
- {
247
- "kind": "field",
248
- "name": "shouldManageTabOrderForScrolling",
249
- "privacy": "public"
250
- },
251
- {
252
- "kind": "field",
253
- "name": "instanceCount",
254
- "type": {
255
- "text": "number"
256
- },
257
- "static": true,
258
- "default": "0"
259
- },
260
- {
261
- "kind": "field",
262
- "name": "labelledbyId",
263
- "privacy": "private",
264
- "default": "`sp-dialog-label-${Dialog.instanceCount++}`"
265
- },
266
- {
267
- "kind": "field",
268
- "name": "conditionLabelledby",
269
- "type": {
270
- "text": "() => void | undefined"
271
- },
272
- "privacy": "private"
273
- },
274
- {
275
- "kind": "field",
276
- "name": "conditionDescribedby",
277
- "type": {
278
- "text": "() => void | undefined"
279
- },
280
- "privacy": "private"
281
- },
282
- {
283
- "kind": "method",
284
- "name": "onHeadingSlotchange",
285
- "privacy": "private",
286
- "return": {
287
- "type": {
288
- "text": "void"
289
- }
290
- },
291
- "parameters": [
292
- {
293
- "name": "{\n target,\n }",
294
- "type": {
295
- "text": "Event & { target: HTMLSlotElement }"
296
- }
297
- }
298
- ]
299
- },
300
- {
301
- "kind": "field",
302
- "name": "describedbyId",
303
- "privacy": "private",
304
- "default": "`sp-dialog-description-${Dialog.instanceCount++}`"
305
- },
306
- {
307
- "kind": "method",
308
- "name": "onContentSlotChange",
309
- "privacy": "protected",
310
- "return": {
311
- "type": {
312
- "text": "void"
313
- }
314
- },
315
- "parameters": [
316
- {
317
- "name": "{\n target,\n }",
318
- "type": {
319
- "text": "Event & { target: HTMLSlotElement }"
320
- }
321
- }
322
- ]
323
217
  }
324
218
  ],
325
219
  "events": [
@@ -372,18 +266,14 @@
372
266
  }
373
267
  ],
374
268
  "mixins": [
375
- {
376
- "name": "FocusVisiblePolyfillMixin",
377
- "package": "@spectrum-web-components/shared"
378
- },
379
269
  {
380
270
  "name": "ObserveSlotPresence",
381
271
  "package": "@spectrum-web-components/shared"
382
272
  }
383
273
  ],
384
274
  "superclass": {
385
- "name": "SpectrumElement",
386
- "package": "@spectrum-web-components/base"
275
+ "name": "AlertDialog",
276
+ "package": "@spectrum-web-components/alert-dialog/src/AlertDialog.js"
387
277
  },
388
278
  "tagName": "sp-dialog",
389
279
  "customElement": true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/dialog",
3
- "version": "0.38.0",
3
+ "version": "0.39.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -73,17 +73,18 @@
73
73
  "lit-html"
74
74
  ],
75
75
  "dependencies": {
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"
76
+ "@spectrum-web-components/alert-dialog": "^0.39.1",
77
+ "@spectrum-web-components/base": "^0.39.1",
78
+ "@spectrum-web-components/button": "^0.39.1",
79
+ "@spectrum-web-components/button-group": "^0.39.1",
80
+ "@spectrum-web-components/divider": "^0.39.1",
81
+ "@spectrum-web-components/icons-workflow": "^0.39.1",
82
+ "@spectrum-web-components/modal": "^0.39.1",
83
+ "@spectrum-web-components/shared": "^0.39.1",
84
+ "@spectrum-web-components/underlay": "^0.39.1"
84
85
  },
85
86
  "devDependencies": {
86
- "@spectrum-css/dialog": "^6.0.66"
87
+ "@spectrum-css/dialog": "^6.0.68"
87
88
  },
88
89
  "types": "./src/index.d.ts",
89
90
  "customElements": "custom-elements.json",
@@ -91,5 +92,5 @@
91
92
  "./sp-*.js",
92
93
  "./**/*.dev.js"
93
94
  ],
94
- "gitHead": "9a099b7543672f2fd4030833ab813b16c2cad62e"
95
+ "gitHead": "d374f8645b54b978d830c95ff777b5b1e9172ac7"
95
96
  }
package/src/Dialog.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
1
+ import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
2
2
  import '@spectrum-web-components/divider/sp-divider.js';
3
3
  import '@spectrum-web-components/button/sp-close-button.js';
4
4
  import '@spectrum-web-components/button-group/sp-button-group.js';
5
5
  import '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';
6
6
  import type { CloseButton } from '@spectrum-web-components/button';
7
- declare const Dialog_base: typeof SpectrumElement & {
7
+ import { AlertDialog } from '@spectrum-web-components/alert-dialog/src/AlertDialog.js';
8
+ declare const Dialog_base: typeof AlertDialog & {
8
9
  new (...args: any[]): import("@spectrum-web-components/shared").SlotPresenceObservingInterface;
9
10
  prototype: import("@spectrum-web-components/shared").SlotPresenceObservingInterface;
10
11
  };
@@ -21,7 +22,6 @@ declare const Dialog_base: typeof SpectrumElement & {
21
22
  export declare class Dialog extends Dialog_base {
22
23
  static get styles(): CSSResultArray;
23
24
  closeButton?: CloseButton;
24
- private contentElement;
25
25
  error: boolean;
26
26
  dismissable: boolean;
27
27
  protected get hasFooter(): boolean;
@@ -32,25 +32,11 @@ export declare class Dialog extends Dialog_base {
32
32
  size?: 's' | 'm' | 'l';
33
33
  close(): void;
34
34
  protected renderHero(): TemplateResult;
35
- protected renderHeading(): TemplateResult;
36
- protected renderContent(): TemplateResult;
37
35
  protected renderFooter(): TemplateResult;
38
36
  protected renderButtons(): TemplateResult;
39
37
  protected renderDismiss(): TemplateResult;
40
38
  protected render(): TemplateResult;
41
- shouldManageTabOrderForScrolling: () => void;
42
39
  protected shouldUpdate(changes: PropertyValues): boolean;
43
40
  protected firstUpdated(changes: PropertyValues): void;
44
- static instanceCount: number;
45
- private labelledbyId;
46
- private conditionLabelledby?;
47
- private conditionDescribedby?;
48
- private onHeadingSlotchange;
49
- private describedbyId;
50
- protected onContentSlotChange({ target, }: Event & {
51
- target: HTMLSlotElement;
52
- }): void;
53
- connectedCallback(): void;
54
- disconnectedCallback(): void;
55
41
  }
56
42
  export {};
package/src/Dialog.dev.js CHANGED
@@ -12,61 +12,30 @@ var __decorateClass = (decorators, target, key, kind) => {
12
12
  };
13
13
  import {
14
14
  html,
15
- nothing,
16
- SpectrumElement
15
+ nothing
17
16
  } from "@spectrum-web-components/base";
18
17
  import {
19
18
  property,
20
19
  query
21
20
  } from "@spectrum-web-components/base/src/decorators.js";
22
- import { classMap } from "@spectrum-web-components/base/src/directives.js";
23
- import { conditionAttributeWithId } from "@spectrum-web-components/base/src/condition-attribute-with-id.js";
24
21
  import "@spectrum-web-components/divider/sp-divider.js";
25
22
  import "@spectrum-web-components/button/sp-close-button.js";
26
23
  import "@spectrum-web-components/button-group/sp-button-group.js";
27
24
  import "@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";
28
- import {
29
- FocusVisiblePolyfillMixin,
30
- ObserveSlotPresence
31
- } from "@spectrum-web-components/shared";
25
+ import { ObserveSlotPresence } from "@spectrum-web-components/shared";
32
26
  import styles from "./dialog.css.js";
33
- let appliedIds = 0;
34
- function gatherAppliedIdsFromSlottedChildren(slot, idBase) {
35
- const assignedElements = slot.assignedElements();
36
- const ids = [];
37
- assignedElements.forEach((el) => {
38
- if (el.id) {
39
- ids.push(el.id);
40
- } else {
41
- const id = idBase + `-${appliedIds++}`;
42
- el.id = id;
43
- ids.push(id);
44
- }
45
- });
46
- return ids;
47
- }
48
- const _Dialog = class _Dialog extends FocusVisiblePolyfillMixin(
49
- ObserveSlotPresence(SpectrumElement, [
50
- '[slot="hero"]',
51
- '[slot="footer"]',
52
- '[slot="button"]'
53
- ])
54
- ) {
27
+ import { AlertDialog } from "@spectrum-web-components/alert-dialog/src/AlertDialog.js";
28
+ import { classMap } from "@spectrum-web-components/base/src/directives.js";
29
+ export class Dialog extends ObserveSlotPresence(AlertDialog, [
30
+ '[slot="hero"]',
31
+ '[slot="footer"]',
32
+ '[slot="button"]'
33
+ ]) {
55
34
  constructor() {
56
35
  super(...arguments);
57
36
  this.error = false;
58
37
  this.dismissable = false;
59
38
  this.noDivider = false;
60
- this.shouldManageTabOrderForScrolling = () => {
61
- const { offsetHeight, scrollHeight } = this.contentElement;
62
- if (offsetHeight < scrollHeight) {
63
- this.contentElement.tabIndex = 0;
64
- } else {
65
- this.contentElement.removeAttribute("tabindex");
66
- }
67
- };
68
- this.labelledbyId = `sp-dialog-label-${_Dialog.instanceCount++}`;
69
- this.describedbyId = `sp-dialog-description-${_Dialog.instanceCount++}`;
70
39
  }
71
40
  static get styles() {
72
41
  return [styles];
@@ -95,18 +64,6 @@ const _Dialog = class _Dialog extends FocusVisiblePolyfillMixin(
95
64
  <slot name="hero"></slot>
96
65
  `;
97
66
  }
98
- renderHeading() {
99
- return html`
100
- <slot name="heading" @slotchange=${this.onHeadingSlotchange}></slot>
101
- `;
102
- }
103
- renderContent() {
104
- return html`
105
- <div class="content">
106
- <slot @slotchange=${this.onContentSlotChange}></slot>
107
- </div>
108
- `;
109
- }
110
67
  renderFooter() {
111
68
  return html`
112
69
  <div class="footer">
@@ -166,98 +123,23 @@ const _Dialog = class _Dialog extends FocusVisiblePolyfillMixin(
166
123
  super.firstUpdated(changes);
167
124
  this.setAttribute("role", "dialog");
168
125
  }
169
- onHeadingSlotchange({
170
- target
171
- }) {
172
- if (this.conditionLabelledby) {
173
- this.conditionLabelledby();
174
- delete this.conditionLabelledby;
175
- }
176
- const ids = gatherAppliedIdsFromSlottedChildren(
177
- target,
178
- this.labelledbyId
179
- );
180
- if (ids.length) {
181
- this.conditionLabelledby = conditionAttributeWithId(
182
- this,
183
- "aria-labelledby",
184
- ids
185
- );
186
- }
187
- }
188
- onContentSlotChange({
189
- target
190
- }) {
191
- requestAnimationFrame(() => {
192
- this.shouldManageTabOrderForScrolling();
193
- });
194
- if (this.conditionDescribedby) {
195
- this.conditionDescribedby();
196
- delete this.conditionDescribedby;
197
- }
198
- const ids = gatherAppliedIdsFromSlottedChildren(
199
- target,
200
- this.describedbyId
201
- );
202
- if (ids.length && ids.length < 4) {
203
- this.conditionDescribedby = conditionAttributeWithId(
204
- this,
205
- "aria-describedby",
206
- ids
207
- );
208
- } else if (!ids.length) {
209
- const idProvided = !!this.id;
210
- if (!idProvided)
211
- this.id = this.describedbyId;
212
- const conditionDescribedby = conditionAttributeWithId(
213
- this,
214
- "aria-describedby",
215
- this.id
216
- );
217
- this.conditionDescribedby = () => {
218
- conditionDescribedby();
219
- if (!idProvided) {
220
- this.removeAttribute("id");
221
- }
222
- };
223
- }
224
- }
225
- connectedCallback() {
226
- super.connectedCallback();
227
- window.addEventListener(
228
- "resize",
229
- this.shouldManageTabOrderForScrolling
230
- );
231
- }
232
- disconnectedCallback() {
233
- window.removeEventListener(
234
- "resize",
235
- this.shouldManageTabOrderForScrolling
236
- );
237
- super.disconnectedCallback();
238
- }
239
- };
240
- _Dialog.instanceCount = 0;
126
+ }
241
127
  __decorateClass([
242
128
  query(".close-button")
243
- ], _Dialog.prototype, "closeButton", 2);
244
- __decorateClass([
245
- query(".content")
246
- ], _Dialog.prototype, "contentElement", 2);
129
+ ], Dialog.prototype, "closeButton", 2);
247
130
  __decorateClass([
248
131
  property({ type: Boolean, reflect: true })
249
- ], _Dialog.prototype, "error", 2);
132
+ ], Dialog.prototype, "error", 2);
250
133
  __decorateClass([
251
134
  property({ type: Boolean, reflect: true })
252
- ], _Dialog.prototype, "dismissable", 2);
135
+ ], Dialog.prototype, "dismissable", 2);
253
136
  __decorateClass([
254
137
  property({ type: Boolean, reflect: true, attribute: "no-divider" })
255
- ], _Dialog.prototype, "noDivider", 2);
138
+ ], Dialog.prototype, "noDivider", 2);
256
139
  __decorateClass([
257
140
  property({ type: String, reflect: true })
258
- ], _Dialog.prototype, "mode", 2);
141
+ ], Dialog.prototype, "mode", 2);
259
142
  __decorateClass([
260
143
  property({ type: String, reflect: true })
261
- ], _Dialog.prototype, "size", 2);
262
- export let Dialog = _Dialog;
144
+ ], Dialog.prototype, "size", 2);
263
145
  //# sourceMappingURL=Dialog.dev.js.map
@@ -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 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": ";;;;;;;;;;;;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;AAGnB,IAAI,aAAa;AAEjB,SAAS,oCACL,MACA,QACQ;AACR,QAAM,mBAAmB,KAAK,iBAAiB;AAC/C,QAAM,MAAgB,CAAC;AACvB,mBAAiB,QAAQ,CAAC,OAAO;AAC7B,QAAI,GAAG,IAAI;AACP,UAAI,KAAK,GAAG,EAAE;AAAA,IAClB,OAAO;AACH,YAAM,KAAK,SAAS,IAAI,YAAY;AACpC,SAAG,KAAK;AACR,UAAI,KAAK,EAAE;AAAA,IACf;AAAA,EACJ,CAAC;AACD,SAAO;AACX;AAYO,MAAM,UAAN,MAAM,gBAAe;AAAA,EACxB,oBAAoB,iBAAiB;AAAA,IACjC;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AACL,EAAE;AAAA,EANK;AAAA;AAkBH,SAAO,QAAQ;AAGf,SAAO,cAAc;AAgBrB,SAAO,YAAY;AA4FnB,SAAO,mCAAmC,MAAY;AAClD,YAAM,EAAE,cAAc,aAAa,IAAI,KAAK;AAC5C,UAAI,eAAe,cAAc;AAC7B,aAAK,eAAe,WAAW;AAAA,MACnC,OAAO;AACH,aAAK,eAAe,gBAAgB,UAAU;AAAA,MAClD;AAAA,IACJ;AAkBA,SAAQ,eAAe,mBAAmB,QAAO,eAAe;AAwBhE,SAAQ,gBAAgB,yBAAyB,QAAO,eAAe;AAAA;AAAA,EA3KvE,WAA2B,SAAyB;AA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K;AAC1B,UAAI,CAAC;AAAY,aAAK,KAAK,KAAK;AAChC,YAAM,uBAAuB;AAAA,QACzB;AAAA,QACA;AAAA,QACA,KAAK;AAAA,MACT;AACA,WAAK,uBAAuB,MAAM;AAC9B,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;",
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 TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.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 { ObserveSlotPresence } from '@spectrum-web-components/shared';\n\nimport styles from './dialog.css.js';\nimport type { CloseButton } from '@spectrum-web-components/button';\nimport { AlertDialog } from '@spectrum-web-components/alert-dialog/src/AlertDialog.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\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 ObserveSlotPresence(AlertDialog, [\n '[slot=\"hero\"]',\n '[slot=\"footer\"]',\n '[slot=\"button\"]',\n]) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @query('.close-button')\n closeButton?: CloseButton;\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 renderFooter(): TemplateResult {\n return html`\n <div class=\"footer\">\n <slot name=\"footer\"></slot>\n </div>\n `;\n }\n\n protected override 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 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"],
5
+ "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAA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1,14 @@
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`
1
+ "use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var r=(u,s,e,n)=>{for(var t=n>1?void 0:n?c(s,e):s,p=u.length-1,d;p>=0;p--)(d=u[p])&&(t=(n?d(s,e,t):d(t))||t);return n&&t&&a(s,e,t),t};import{html as o,nothing as l}from"@spectrum-web-components/base";import{property as i,query as m}from"@spectrum-web-components/base/src/decorators.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{ObserveSlotPresence as b}from"@spectrum-web-components/shared";import h from"./dialog.css.js";import{AlertDialog as f}from"@spectrum-web-components/alert-dialog/src/AlertDialog.js";import{classMap as v}from"@spectrum-web-components/base/src/directives.js";export class Dialog extends b(f,['[slot="hero"]','[slot="footer"]','[slot="button"]']){constructor(){super(...arguments);this.error=!1;this.dismissable=!1;this.noDivider=!1}static get styles(){return[h]}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 o`
2
2
  <slot name="hero"></slot>
3
- `}renderHeading(){return i`
4
- <slot name="heading" @slotchange=${this.onHeadingSlotchange}></slot>
5
- `}renderContent(){return i`
6
- <div class="content">
7
- <slot @slotchange=${this.onContentSlotChange}></slot>
8
- </div>
9
- `}renderFooter(){return i`
3
+ `}renderFooter(){return o`
10
4
  <div class="footer">
11
5
  <slot name="footer"></slot>
12
6
  </div>
13
- `}renderButtons(){const e={"button-group":!0,"button-group--noFooter":!this.hasFooter};return i`
14
- <sp-button-group class=${g(e)}>
7
+ `}renderButtons(){const e={"button-group":!0,"button-group--noFooter":!this.hasFooter};return o`
8
+ <sp-button-group class=${v(e)}>
15
9
  <slot name="button"></slot>
16
10
  </sp-button-group>
17
- `}renderDismiss(){return i`
11
+ `}renderDismiss(){return o`
18
12
  <sp-close-button
19
13
  class="close-button"
20
14
  label="Close"
@@ -22,19 +16,19 @@
22
16
  size="m"
23
17
  @click=${this.close}
24
18
  ></sp-close-button>
25
- `}render(){return i`
19
+ `}render(){return o`
26
20
  <div class="grid">
27
21
  ${this.renderHero()} ${this.renderHeading()}
28
- ${this.error?i`
22
+ ${this.error?o`
29
23
  <sp-icon-alert class="type-icon"></sp-icon-alert>
30
- `:d}
31
- ${this.noDivider?d:i`
24
+ `:l}
25
+ ${this.noDivider?l:o`
32
26
  <sp-divider size="m" class="divider"></sp-divider>
33
27
  `}
34
28
  ${this.renderContent()}
35
- ${this.hasFooter?this.renderFooter():d}
36
- ${this.hasButtons?this.renderButtons():d}
37
- ${this.dismissable?this.renderDismiss():d}
29
+ ${this.hasFooter?this.renderFooter():l}
30
+ ${this.hasButtons?this.renderButtons():l}
31
+ ${this.dismissable?this.renderDismiss():l}
38
32
  </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=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;
33
+ `}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")}}r([m(".close-button")],Dialog.prototype,"closeButton",2),r([i({type:Boolean,reflect:!0})],Dialog.prototype,"error",2),r([i({type:Boolean,reflect:!0})],Dialog.prototype,"dismissable",2),r([i({type:Boolean,reflect:!0,attribute:"no-divider"})],Dialog.prototype,"noDivider",2),r([i({type:String,reflect:!0})],Dialog.prototype,"mode",2),r([i({type:String,reflect:!0})],Dialog.prototype,"size",2);
40
34
  //# 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 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,UAAY,GA4FnB,KAAO,iCAAmC,IAAY,CAClD,KAAM,CAAE,aAAAiB,EAAc,aAAAC,CAAa,EAAI,KAAK,eACxCD,EAAeC,EACf,KAAK,eAAe,SAAW,EAE/B,KAAK,eAAe,gBAAgB,UAAU,CAEtD,EAkBA,KAAQ,aAAe,mBAAmBF,EAAO,eAAe,GAwBhE,KAAQ,cAAgB,yBAAyBA,EAAO,eAAe,GA3KvE,WAA2B,QAAyB,CAChD,MAAO,CAACT,CAAM,CAClB,CAcA,IAAc,WAAqB,CAC/B,OAAO,KAAK,uBAAuB,iBAAiB,CACxD,CAEA,IAAc,YAAsB,CAChC,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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
- "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"]
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 TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.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 { ObserveSlotPresence } from '@spectrum-web-components/shared';\n\nimport styles from './dialog.css.js';\nimport type { CloseButton } from '@spectrum-web-components/button';\nimport { AlertDialog } from '@spectrum-web-components/alert-dialog/src/AlertDialog.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\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 ObserveSlotPresence(AlertDialog, [\n '[slot=\"hero\"]',\n '[slot=\"footer\"]',\n '[slot=\"button\"]',\n]) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @query('.close-button')\n closeButton?: CloseButton;\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 renderFooter(): TemplateResult {\n return html`\n <div class=\"footer\">\n <slot name=\"footer\"></slot>\n </div>\n `;\n }\n\n protected override 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 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"],
5
+ "mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,MAGG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDAEP,MAAO,iDACP,MAAO,qDACP,MAAO,2DACP,MAAO,iEACP,OAAS,uBAAAC,MAA2B,kCAEpC,OAAOC,MAAY,kBAEnB,OAAS,eAAAC,MAAmB,2DAC5B,OAAS,YAAAC,MAAgB,kDAYlB,aAAM,eAAeH,EAAoBE,EAAa,CACzD,gBACA,kBACA,iBACJ,CAAC,CAAE,CAJI,kCAaH,KAAO,MAAQ,GAGf,KAAO,YAAc,GAgBrB,KAAO,UAAY,GA3BnB,WAA2B,QAAyB,CAChD,MAAO,CAACD,CAAM,CAClB,CAWA,IAAc,WAAqB,CAC/B,OAAO,KAAK,uBAAuB,iBAAiB,CACxD,CAEA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