@spectrum-web-components/dialog 0.9.0 → 0.10.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.
@@ -63,6 +63,13 @@
63
63
  }
64
64
  ],
65
65
  "members": [
66
+ {
67
+ "kind": "field",
68
+ "name": "closeButton",
69
+ "type": {
70
+ "text": "ActionButton | undefined"
71
+ }
72
+ },
66
73
  {
67
74
  "kind": "field",
68
75
  "name": "contentElement",
@@ -150,7 +157,7 @@
150
157
  },
151
158
  {
152
159
  "kind": "method",
153
- "name": "focus",
160
+ "name": "close",
154
161
  "privacy": "public",
155
162
  "return": {
156
163
  "type": {
@@ -158,20 +165,65 @@
158
165
  }
159
166
  }
160
167
  },
168
+ {
169
+ "kind": "field",
170
+ "name": "shouldManageTabOrderForScrolling",
171
+ "privacy": "public"
172
+ },
173
+ {
174
+ "kind": "field",
175
+ "name": "instanceCount",
176
+ "type": {
177
+ "text": "number"
178
+ },
179
+ "static": true,
180
+ "default": "0"
181
+ },
182
+ {
183
+ "kind": "field",
184
+ "name": "labelledbyId",
185
+ "privacy": "private",
186
+ "default": "`sp-dialog-label-${Dialog.instanceCount++}`"
187
+ },
188
+ {
189
+ "kind": "field",
190
+ "name": "conditionLabelledby",
191
+ "type": {
192
+ "text": "() => void | undefined"
193
+ },
194
+ "privacy": "private"
195
+ },
196
+ {
197
+ "kind": "field",
198
+ "name": "conditionDescribedby",
199
+ "type": {
200
+ "text": "() => void | undefined"
201
+ },
202
+ "privacy": "private"
203
+ },
161
204
  {
162
205
  "kind": "method",
163
- "name": "close",
164
- "privacy": "public",
206
+ "name": "onHeadingSlotchange",
207
+ "privacy": "private",
165
208
  "return": {
166
209
  "type": {
167
210
  "text": "void"
168
211
  }
169
- }
212
+ },
213
+ "parameters": [
214
+ {
215
+ "name": "{\n target,\n }",
216
+ "type": {
217
+ "text": "Event & { target: HTMLSlotElement }"
218
+ }
219
+ }
220
+ ]
170
221
  },
171
222
  {
172
223
  "kind": "field",
173
- "name": "shouldManageTabOrderForScrolling",
174
- "privacy": "public"
224
+ "name": "describedbyId",
225
+ "privacy": "private",
226
+ "default": "`sp-dialog-description-${Dialog.instanceCount++}`"
175
227
  },
176
228
  {
177
229
  "kind": "method",
@@ -181,7 +233,15 @@
181
233
  "type": {
182
234
  "text": "void"
183
235
  }
184
- }
236
+ },
237
+ "parameters": [
238
+ {
239
+ "name": "{\n target,\n }",
240
+ "type": {
241
+ "text": "Event & { target: HTMLSlotElement }"
242
+ }
243
+ }
244
+ ]
185
245
  }
186
246
  ],
187
247
  "events": [
@@ -462,6 +522,16 @@
462
522
  }
463
523
  }
464
524
  },
525
+ {
526
+ "kind": "method",
527
+ "name": "overlayWillCloseCallback",
528
+ "privacy": "public",
529
+ "return": {
530
+ "type": {
531
+ "text": "boolean"
532
+ }
533
+ }
534
+ },
465
535
  {
466
536
  "kind": "method",
467
537
  "name": "dismiss",
@@ -502,6 +572,24 @@
502
572
  }
503
573
  }
504
574
  },
575
+ {
576
+ "kind": "method",
577
+ "name": "handleClose",
578
+ "privacy": "protected",
579
+ "return": {
580
+ "type": {
581
+ "text": "void"
582
+ }
583
+ },
584
+ "parameters": [
585
+ {
586
+ "name": "event",
587
+ "type": {
588
+ "text": "Event"
589
+ }
590
+ }
591
+ ]
592
+ },
505
593
  {
506
594
  "kind": "method",
507
595
  "name": "close",
@@ -512,6 +600,16 @@
512
600
  }
513
601
  }
514
602
  },
603
+ {
604
+ "kind": "method",
605
+ "name": "dispatchClosed",
606
+ "privacy": "private",
607
+ "return": {
608
+ "type": {
609
+ "text": "void"
610
+ }
611
+ }
612
+ },
515
613
  {
516
614
  "kind": "method",
517
615
  "name": "handleUnderlayTransitionend",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/dialog",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -46,26 +46,26 @@
46
46
  "lit-html"
47
47
  ],
48
48
  "dependencies": {
49
- "@spectrum-web-components/action-button": "^0.7.3",
50
- "@spectrum-web-components/base": "^0.5.1",
51
- "@spectrum-web-components/button": "^0.16.3",
52
- "@spectrum-web-components/button-group": "^0.8.2",
53
- "@spectrum-web-components/divider": "^0.4.2",
54
- "@spectrum-web-components/icon": "^0.11.2",
55
- "@spectrum-web-components/icons-ui": "^0.8.2",
56
- "@spectrum-web-components/icons-workflow": "^0.8.2",
57
- "@spectrum-web-components/modal": "^0.6.0",
58
- "@spectrum-web-components/shared": "^0.13.3",
59
- "@spectrum-web-components/underlay": "^0.8.2",
49
+ "@spectrum-web-components/action-button": "^0.8.0",
50
+ "@spectrum-web-components/base": "^0.5.3",
51
+ "@spectrum-web-components/button": "^0.17.0",
52
+ "@spectrum-web-components/button-group": "^0.8.4",
53
+ "@spectrum-web-components/divider": "^0.4.4",
54
+ "@spectrum-web-components/icon": "^0.11.4",
55
+ "@spectrum-web-components/icons-ui": "^0.8.4",
56
+ "@spectrum-web-components/icons-workflow": "^0.8.4",
57
+ "@spectrum-web-components/modal": "^0.6.2",
58
+ "@spectrum-web-components/shared": "^0.13.5",
59
+ "@spectrum-web-components/underlay": "^0.8.4",
60
60
  "tslib": "^2.0.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@spectrum-css/dialog": "^5.0.0"
63
+ "@spectrum-css/dialog": "^6.0.3"
64
64
  },
65
65
  "types": "./src/index.d.ts",
66
66
  "customElements": "custom-elements.json",
67
67
  "sideEffects": [
68
68
  "./sp-*.js"
69
69
  ],
70
- "gitHead": "f23b15ec952d7450272a8275524c905e028b4ddc"
70
+ "gitHead": "57aba8030b6af96af4015a0aa830e342a17dc219"
71
71
  }
@@ -1,6 +0,0 @@
1
- import { DialogWrapper } from './src/DialogWrapper.js';
2
- declare global {
3
- interface HTMLElementTagNameMap {
4
- 'sp-dialog-wrapper': DialogWrapper;
5
- }
6
- }
@@ -1,14 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { DialogWrapper } from './src/DialogWrapper.js';
13
- customElements.define('sp-dialog-wrapper', DialogWrapper);
14
- //# sourceMappingURL=sp-dialog-wrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sp-dialog-wrapper.js","sourceRoot":"","sources":["sp-dialog-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC","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*/\nimport { DialogWrapper } from './src/DialogWrapper.js';\n\ncustomElements.define('sp-dialog-wrapper', DialogWrapper);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dialog-wrapper': DialogWrapper;\n }\n}\n"]}
package/sp-dialog.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Dialog } from './src/Dialog.js';
2
- declare global {
3
- interface HTMLElementTagNameMap {
4
- 'sp-dialog': Dialog;
5
- }
6
- }
package/sp-dialog.js DELETED
@@ -1,14 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { Dialog } from './src/Dialog.js';
13
- customElements.define('sp-dialog', Dialog);
14
- //# sourceMappingURL=sp-dialog.js.map
package/sp-dialog.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sp-dialog.js","sourceRoot":"","sources":["sp-dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC","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*/\nimport { Dialog } from './src/Dialog.js';\n\ncustomElements.define('sp-dialog', Dialog);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dialog': Dialog;\n }\n}\n"]}
package/src/Dialog.d.ts DELETED
@@ -1,41 +0,0 @@
1
- import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
2
- import '@spectrum-web-components/divider/sp-divider.js';
3
- import '@spectrum-web-components/action-button/sp-action-button.js';
4
- import '@spectrum-web-components/button-group/sp-button-group.js';
5
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross500.js';
6
- import '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';
7
- declare const Dialog_base: typeof SpectrumElement & {
8
- new (...args: any[]): import("@spectrum-web-components/shared").SlotPresenceObservingInterface;
9
- prototype: import("@spectrum-web-components/shared").SlotPresenceObservingInterface;
10
- };
11
- /**
12
- * @element sp-dialog
13
- *
14
- * @slot hero - Accepts a hero image to display at the top of the dialog
15
- * @slot heading - Acts as the heading of the dialog. This should be an actual heading tag `<h1-6 />`
16
- * @slot - Content not addressed to a specific slot will be interpreted as the main content of the dialog
17
- * @slot footer - Content addressed to the `footer` will be placed below the main content and to the side of any `[slot='button']` content
18
- * @slot button - Button elements addressed to this slot may be placed below the content when not delivered in a fullscreen mode
19
- * @fires close - Announces that the dialog has been closed.
20
- */
21
- export declare class Dialog extends Dialog_base {
22
- static get styles(): CSSResultArray;
23
- private contentElement;
24
- error: boolean;
25
- dismissable: boolean;
26
- protected get hasFooter(): boolean;
27
- protected get hasButtons(): boolean;
28
- protected get hasHero(): boolean;
29
- noDivider: boolean;
30
- mode?: 'fullscreen' | 'fullscreenTakeover';
31
- size?: 's' | 'm' | 'l';
32
- focus(): void;
33
- close(): void;
34
- protected render(): TemplateResult;
35
- shouldManageTabOrderForScrolling: () => void;
36
- protected shouldUpdate(changes: PropertyValues): boolean;
37
- protected onContentSlotChange(): void;
38
- connectedCallback(): void;
39
- disconnectedCallback(): void;
40
- }
41
- export {};
package/src/Dialog.js DELETED
@@ -1,188 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { __decorate } from "tslib";
13
- import { html, SpectrumElement, } from '@spectrum-web-components/base';
14
- import { property, query, } from '@spectrum-web-components/base/src/decorators.js';
15
- import { ifDefined } from '@spectrum-web-components/base/src/directives.js';
16
- import '@spectrum-web-components/divider/sp-divider.js';
17
- import '@spectrum-web-components/action-button/sp-action-button.js';
18
- import '@spectrum-web-components/button-group/sp-button-group.js';
19
- import crossStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';
20
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross500.js';
21
- import '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';
22
- import { FocusVisiblePolyfillMixin, ObserveSlotPresence, } from '@spectrum-web-components/shared';
23
- import { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';
24
- import styles from './dialog.css.js';
25
- /**
26
- * @element sp-dialog
27
- *
28
- * @slot hero - Accepts a hero image to display at the top of the dialog
29
- * @slot heading - Acts as the heading of the dialog. This should be an actual heading tag `<h1-6 />`
30
- * @slot - Content not addressed to a specific slot will be interpreted as the main content of the dialog
31
- * @slot footer - Content addressed to the `footer` will be placed below the main content and to the side of any `[slot='button']` content
32
- * @slot button - Button elements addressed to this slot may be placed below the content when not delivered in a fullscreen mode
33
- * @fires close - Announces that the dialog has been closed.
34
- */
35
- export class Dialog extends FocusVisiblePolyfillMixin(ObserveSlotPresence(SpectrumElement, [
36
- '[slot="hero"]',
37
- '[slot="footer"]',
38
- '[slot="button"]',
39
- ])) {
40
- constructor() {
41
- super(...arguments);
42
- this.error = false;
43
- this.dismissable = false;
44
- this.noDivider = false;
45
- this.shouldManageTabOrderForScrolling = () => {
46
- const { offsetHeight, scrollHeight } = this.contentElement;
47
- if (offsetHeight < scrollHeight) {
48
- this.contentElement.tabIndex = 0;
49
- }
50
- else {
51
- this.contentElement.removeAttribute('tabindex');
52
- }
53
- };
54
- }
55
- static get styles() {
56
- return [styles, crossStyles];
57
- }
58
- get hasFooter() {
59
- return this.getSlotContentPresence('[slot="footer"]');
60
- }
61
- get hasButtons() {
62
- return this.getSlotContentPresence('[slot="button"]');
63
- }
64
- get hasHero() {
65
- return this.getSlotContentPresence('[slot="hero"]');
66
- }
67
- focus() {
68
- if (this.shadowRoot) {
69
- const firstFocusable = firstFocusableIn(this.shadowRoot);
70
- if (firstFocusable) {
71
- if (firstFocusable.updateComplete) {
72
- firstFocusable.updateComplete.then(() => firstFocusable.focus());
73
- /* c8 ignore next 3 */
74
- }
75
- else {
76
- firstFocusable.focus();
77
- }
78
- this.removeAttribute('tabindex');
79
- }
80
- /* c8 ignore next 3 */
81
- }
82
- else {
83
- super.focus();
84
- }
85
- }
86
- close() {
87
- this.dispatchEvent(new Event('close', {
88
- bubbles: true,
89
- }));
90
- }
91
- render() {
92
- return html `
93
- <div class="grid">
94
- <slot name="hero"></slot>
95
- <slot
96
- name="heading"
97
- class=${ifDefined(this.hasHero ? this.hasHero : undefined)}
98
- ></slot>
99
- ${this.error
100
- ? html `
101
- <sp-icon-alert class="type-icon"></sp-icon-alert>
102
- `
103
- : html ``}
104
- ${this.noDivider
105
- ? html ``
106
- : html `
107
- <sp-divider size="m" class="divider"></sp-divider>
108
- `}
109
- <div class="content">
110
- <slot @slotchange=${this.onContentSlotChange}></slot>
111
- </div>
112
- ${this.hasFooter
113
- ? html `
114
- <div class="footer">
115
- <slot name="footer"></slot>
116
- </div>
117
- `
118
- : html ``}
119
- ${this.hasButtons
120
- ? html `
121
- <sp-button-group
122
- class="button-group ${this.hasFooter
123
- ? ''
124
- : 'button-group--noFooter'}"
125
- >
126
- <slot name="button"></slot>
127
- </sp-button-group>
128
- `
129
- : html ``}
130
- ${this.dismissable
131
- ? html `
132
- <sp-action-button
133
- class="close-button"
134
- label="Close"
135
- quiet
136
- size="m"
137
- @click=${this.close}
138
- >
139
- <sp-icon-cross500
140
- class="spectrum-UIIcon-Cross500"
141
- slot="icon"
142
- ></sp-icon-cross500>
143
- </sp-action-button>
144
- `
145
- : html ``}
146
- </div>
147
- `;
148
- }
149
- shouldUpdate(changes) {
150
- if (changes.has('mode') && !!this.mode) {
151
- this.dismissable = false;
152
- }
153
- if (changes.has('dismissable') && this.dismissable) {
154
- this.dismissable = !this.mode;
155
- }
156
- return super.shouldUpdate(changes);
157
- }
158
- onContentSlotChange() {
159
- this.shouldManageTabOrderForScrolling();
160
- }
161
- connectedCallback() {
162
- super.connectedCallback();
163
- window.addEventListener('resize', this.shouldManageTabOrderForScrolling);
164
- }
165
- disconnectedCallback() {
166
- window.removeEventListener('resize', this.shouldManageTabOrderForScrolling);
167
- super.disconnectedCallback();
168
- }
169
- }
170
- __decorate([
171
- query('.content')
172
- ], Dialog.prototype, "contentElement", void 0);
173
- __decorate([
174
- property({ type: Boolean, reflect: true })
175
- ], Dialog.prototype, "error", void 0);
176
- __decorate([
177
- property({ type: Boolean, reflect: true })
178
- ], Dialog.prototype, "dismissable", void 0);
179
- __decorate([
180
- property({ type: Boolean, reflect: true, attribute: 'no-divider' })
181
- ], Dialog.prototype, "noDivider", void 0);
182
- __decorate([
183
- property({ type: String, reflect: true })
184
- ], Dialog.prototype, "mode", void 0);
185
- __decorate([
186
- property({ type: String, reflect: true })
187
- ], Dialog.prototype, "size", void 0);
188
- //# sourceMappingURL=Dialog.js.map
package/src/Dialog.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["Dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EAEJ,eAAe,GAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,QAAQ,EACR,KAAK,GACR,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAE5E,OAAO,gDAAgD,CAAC;AACxD,OAAO,4DAA4D,CAAC;AACpE,OAAO,0DAA0D,CAAC;AAClE,OAAO,WAAW,MAAM,8DAA8D,CAAC;AACvF,OAAO,6DAA6D,CAAC;AACrE,OA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,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oCACZ","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 {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/divider/sp-divider.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\nimport crossStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross500.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport {\n FocusVisiblePolyfillMixin,\n ObserveSlotPresence,\n} from '@spectrum-web-components/shared';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\n\nimport styles from './dialog.css.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 FocusVisiblePolyfillMixin(\n ObserveSlotPresence(SpectrumElement, [\n '[slot=\"hero\"]',\n '[slot=\"footer\"]',\n '[slot=\"button\"]',\n ])\n) {\n public static get styles(): CSSResultArray {\n return [styles, crossStyles];\n }\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 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 focus(): void {\n if (this.shadowRoot) {\n const firstFocusable = firstFocusableIn(this.shadowRoot);\n if (firstFocusable) {\n if (firstFocusable.updateComplete) {\n firstFocusable.updateComplete.then(() =>\n firstFocusable.focus()\n );\n /* c8 ignore next 3 */\n } else {\n firstFocusable.focus();\n }\n this.removeAttribute('tabindex');\n }\n /* c8 ignore next 3 */\n } else {\n super.focus();\n }\n }\n\n public close(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n protected render(): TemplateResult {\n return html`\n <div class=\"grid\">\n <slot name=\"hero\"></slot>\n <slot\n name=\"heading\"\n class=${ifDefined(this.hasHero ? this.hasHero : undefined)}\n ></slot>\n ${this.error\n ? html`\n <sp-icon-alert class=\"type-icon\"></sp-icon-alert>\n `\n : html``}\n ${this.noDivider\n ? html``\n : html`\n <sp-divider size=\"m\" class=\"divider\"></sp-divider>\n `}\n <div class=\"content\">\n <slot @slotchange=${this.onContentSlotChange}></slot>\n </div>\n ${this.hasFooter\n ? html`\n <div class=\"footer\">\n <slot name=\"footer\"></slot>\n </div>\n `\n : html``}\n ${this.hasButtons\n ? html`\n <sp-button-group\n class=\"button-group ${this.hasFooter\n ? ''\n : 'button-group--noFooter'}\"\n >\n <slot name=\"button\"></slot>\n </sp-button-group>\n `\n : html``}\n ${this.dismissable\n ? html`\n <sp-action-button\n class=\"close-button\"\n label=\"Close\"\n quiet\n size=\"m\"\n @click=${this.close}\n >\n <sp-icon-cross500\n class=\"spectrum-UIIcon-Cross500\"\n slot=\"icon\"\n ></sp-icon-cross500>\n </sp-action-button>\n `\n : html``}\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 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 onContentSlotChange(): void {\n this.shouldManageTabOrderForScrolling();\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n }\n\n public disconnectedCallback(): void {\n window.removeEventListener(\n 'resize',\n this.shouldManageTabOrderForScrolling\n );\n super.disconnectedCallback();\n }\n}\n"]}
@@ -1,56 +0,0 @@
1
- import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
2
- import '@spectrum-web-components/underlay/sp-underlay.js';
3
- import '@spectrum-web-components/button/sp-button.js';
4
- import '../sp-dialog.js';
5
- declare const DialogWrapper_base: typeof SpectrumElement;
6
- /**
7
- * @element sp-dialog-wrapper
8
- *
9
- * @slot - content for the dialog
10
- * @fires secondary - Announces that the "secondary" button has been clicked.
11
- * @fires cancel - Announces that the "cancel" button has been clicked.
12
- * @fires confirm - Announces that the "confirm" button has been clicked.
13
- * @fires close - Announces that the dialog has been closed.
14
- */
15
- export declare class DialogWrapper extends DialogWrapper_base {
16
- static get styles(): CSSResultArray;
17
- error: boolean;
18
- cancelLabel: string;
19
- confirmLabel: string;
20
- dismissable: boolean;
21
- footer: string;
22
- hero: string;
23
- heroLabel: string;
24
- noDivider: boolean;
25
- open: boolean;
26
- mode?: 'fullscreen' | 'fullscreenTakeover';
27
- size?: 's' | 'm' | 'l';
28
- secondaryLabel: string;
29
- headline: string;
30
- responsive: boolean;
31
- private transitionPromise;
32
- private resolveTransitionPromise;
33
- underlay: boolean;
34
- private dialog;
35
- focus(): void;
36
- private dismiss;
37
- private clickSecondary;
38
- private clickCancel;
39
- private clickConfirm;
40
- close(): void;
41
- protected handleUnderlayTransitionend(): void;
42
- protected handleModalTransitionend(): void;
43
- protected update(changes: PropertyValues<this>): void;
44
- protected render(): TemplateResult;
45
- protected updated(changes: PropertyValues<this>): void;
46
- /**
47
- * Bind the open/close transition into the update complete lifecycle so
48
- * that the overlay system can wait for it to be "visibly ready" before
49
- * attempting to throw focus into the content contained herein. Not
50
- * waiting for this can cause small amounts of page scroll to happen
51
- * while opening the Tray when focusable content is included: e.g. Menu
52
- * elements whose selected Menu Item is not the first Menu Item.
53
- */
54
- protected getUpdateComplete(): Promise<boolean>;
55
- }
56
- export {};