@spectrum-web-components/dialog 0.0.0-20241209155954
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 +154 -0
- package/package.json +96 -0
- package/sp-dialog-base.d.ts +6 -0
- package/sp-dialog-base.dev.js +5 -0
- package/sp-dialog-base.dev.js.map +7 -0
- package/sp-dialog-base.js +2 -0
- package/sp-dialog-base.js.map +7 -0
- package/sp-dialog-wrapper.d.ts +6 -0
- package/sp-dialog-wrapper.dev.js +5 -0
- package/sp-dialog-wrapper.dev.js.map +7 -0
- package/sp-dialog-wrapper.js +2 -0
- package/sp-dialog-wrapper.js.map +7 -0
- package/sp-dialog.d.ts +6 -0
- package/sp-dialog.dev.js +5 -0
- package/sp-dialog.dev.js.map +7 -0
- package/sp-dialog.js +2 -0
- package/sp-dialog.js.map +7 -0
- package/src/Dialog.d.ts +47 -0
- package/src/Dialog.dev.js +161 -0
- package/src/Dialog.dev.js.map +7 -0
- package/src/Dialog.js +34 -0
- package/src/Dialog.js.map +7 -0
- package/src/DialogBase.d.ts +51 -0
- package/src/DialogBase.dev.js +213 -0
- package/src/DialogBase.dev.js.map +7 -0
- package/src/DialogBase.js +23 -0
- package/src/DialogBase.js.map +7 -0
- package/src/DialogWrapper.d.ts +38 -0
- package/src/DialogWrapper.dev.js +179 -0
- package/src/DialogWrapper.dev.js.map +7 -0
- package/src/DialogWrapper.js +61 -0
- package/src/DialogWrapper.js.map +7 -0
- package/src/dialog-overrides.css.d.ts +2 -0
- package/src/dialog-overrides.css.dev.js +7 -0
- package/src/dialog-overrides.css.dev.js.map +7 -0
- package/src/dialog-overrides.css.js +4 -0
- package/src/dialog-overrides.css.js.map +7 -0
- package/src/dialog.css.d.ts +2 -0
- package/src/dialog.css.dev.js +7 -0
- package/src/dialog.css.dev.js.map +7 -0
- package/src/dialog.css.js +4 -0
- package/src/dialog.css.js.map +7 -0
- package/src/index.d.ts +3 -0
- package/src/index.dev.js +5 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-config.js +111 -0
- package/src/spectrum-dialog.css.d.ts +2 -0
- package/src/spectrum-dialog.css.dev.js +7 -0
- package/src/spectrum-dialog.css.dev.js.map +7 -0
- package/src/spectrum-dialog.css.js +4 -0
- package/src/spectrum-dialog.css.js.map +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
`sp-dialog` displays important information that users need to acknowledge. They appear over the interface and block further interactions. When used directly the `sp-dialog` element surfaces a `slot` based API for deep customization of the content to be included in the overlay.
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@spectrum-web-components/dialog)
|
|
8
|
+
[](https://bundlephobia.com/result?p=@spectrum-web-components/dialog)
|
|
9
|
+
[](https://webcomponents.dev/edit/collection/fO75441E1Q5ZlI0e9pgq/RSDikStPmUPSioVpCsYb/src/index.ts)
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
yarn add @spectrum-web-components/dialog
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Import the side effectful registration of `<sp-dialog>` via:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
import '@spectrum-web-components/dialog/sp-dialog.js';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
When looking to leverage the `Dialog` base class as a type and/or for extension purposes, do so via:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
import { Dialog } from '@spectrum-web-components/dialog';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Sizes
|
|
28
|
+
|
|
29
|
+
<sp-tabs selected="m" auto label="Size Attribute Options">
|
|
30
|
+
<sp-tab value="s">Small</sp-tab>
|
|
31
|
+
<sp-tab-panel value="s">
|
|
32
|
+
|
|
33
|
+
```html demo
|
|
34
|
+
<sp-dialog size="s">
|
|
35
|
+
<h2 slot="heading">Disclaimer</h2>
|
|
36
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
37
|
+
tempor incididunt ut labore et dolore magna aliqua. Auctor augue mauris
|
|
38
|
+
augue neque gravida. Libero volutpat sed ornare arcu. Quisque egestas diam
|
|
39
|
+
in arcu cursus euismod quis viverra. Posuere ac ut consequat semper viverra
|
|
40
|
+
nam libero justo laoreet. Enim ut tellus elementum sagittis vitae et leo
|
|
41
|
+
duis ut. Neque laoreet suspendisse interdum consectetur libero id faucibus
|
|
42
|
+
nisl. Diam volutpat commodo sed egestas egestas. Dolor magna eget est lorem
|
|
43
|
+
ipsum dolor. Vitae suscipit tellus mauris a diam maecenas sed. Turpis in eu
|
|
44
|
+
mi bibendum neque egestas congue. Rhoncus est pellentesque elit ullamcorper
|
|
45
|
+
dignissim cras lobortis.
|
|
46
|
+
</sp-dialog>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
</sp-tab-panel>
|
|
50
|
+
<sp-tab value="m">Medium</sp-tab>
|
|
51
|
+
<sp-tab-panel value="m">
|
|
52
|
+
|
|
53
|
+
```html demo
|
|
54
|
+
<sp-dialog size="m">
|
|
55
|
+
<h2 slot="heading">Disclaimer</h2>
|
|
56
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
57
|
+
tempor incididunt ut labore et dolore magna aliqua. Auctor augue mauris
|
|
58
|
+
augue neque gravida. Libero volutpat sed ornare arcu. Quisque egestas diam
|
|
59
|
+
in arcu cursus euismod quis viverra. Posuere ac ut consequat semper viverra
|
|
60
|
+
nam libero justo laoreet. Enim ut tellus elementum sagittis vitae et leo
|
|
61
|
+
duis ut. Neque laoreet suspendisse interdum consectetur libero id faucibus
|
|
62
|
+
nisl. Diam volutpat commodo sed egestas egestas. Dolor magna eget est lorem
|
|
63
|
+
ipsum dolor. Vitae suscipit tellus mauris a diam maecenas sed. Turpis in eu
|
|
64
|
+
mi bibendum neque egestas congue. Rhoncus est pellentesque elit ullamcorper
|
|
65
|
+
dignissim cras lobortis.
|
|
66
|
+
</sp-dialog>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
</sp-tab-panel>
|
|
70
|
+
<sp-tab value="l">Large</sp-tab>
|
|
71
|
+
<sp-tab-panel value="l">
|
|
72
|
+
|
|
73
|
+
```html demo
|
|
74
|
+
<sp-dialog size="l">
|
|
75
|
+
<h2 slot="heading">Disclaimer</h2>
|
|
76
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
77
|
+
tempor incididunt ut labore et dolore magna aliqua. Auctor augue mauris
|
|
78
|
+
augue neque gravida. Libero volutpat sed ornare arcu. Quisque egestas diam
|
|
79
|
+
in arcu cursus euismod quis viverra. Posuere ac ut consequat semper viverra
|
|
80
|
+
nam libero justo laoreet. Enim ut tellus elementum sagittis vitae et leo
|
|
81
|
+
duis ut. Neque laoreet suspendisse interdum consectetur libero id faucibus
|
|
82
|
+
nisl. Diam volutpat commodo sed egestas egestas. Dolor magna eget est lorem
|
|
83
|
+
ipsum dolor. Vitae suscipit tellus mauris a diam maecenas sed. Turpis in eu
|
|
84
|
+
mi bibendum neque egestas congue. Rhoncus est pellentesque elit ullamcorper
|
|
85
|
+
dignissim cras lobortis.
|
|
86
|
+
</sp-dialog>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
</sp-tab-panel>
|
|
90
|
+
</sp-tabs>
|
|
91
|
+
|
|
92
|
+
## Variants
|
|
93
|
+
|
|
94
|
+
### Dismissable
|
|
95
|
+
|
|
96
|
+
When supplied with the `dissmissable` attribute an `<sp-dialog>` element will surface a "close" button afordance that will dispatch a DOM event with the name of `close` when pressed.
|
|
97
|
+
|
|
98
|
+
Note: the `dissmissable` attribute will not be followed when `mode="fullscreen"` or `mode="fullscreenTakeover"` are applies in accordance with the Spectrum specification.
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<sp-dialog size="m" dismissable>
|
|
102
|
+
<h2 slot="heading">Disclaimer</h2>
|
|
103
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
104
|
+
tempor incididunt ut labore et dolore magna aliqua. Auctor augue mauris
|
|
105
|
+
augue neque gravida. Libero volutpat sed ornare arcu. Quisque egestas diam
|
|
106
|
+
in arcu cursus euismod quis viverra. Posuere ac ut consequat semper viverra
|
|
107
|
+
nam libero justo laoreet. Enim ut tellus elementum sagittis vitae et leo
|
|
108
|
+
duis ut. Neque laoreet suspendisse interdum consectetur libero id faucibus
|
|
109
|
+
nisl. Diam volutpat commodo sed egestas egestas. Dolor magna eget est lorem
|
|
110
|
+
ipsum dolor. Vitae suscipit tellus mauris a diam maecenas sed. Turpis in eu
|
|
111
|
+
mi bibendum neque egestas congue. Rhoncus est pellentesque elit ullamcorper
|
|
112
|
+
dignissim cras lobortis.
|
|
113
|
+
</sp-dialog>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### No Divider
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<sp-dialog size="m" dismissable no-divider>
|
|
120
|
+
<h2 slot="heading">Disclaimer</h2>
|
|
121
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
122
|
+
tempor incididunt ut labore et dolore magna aliqua. Auctor augue mauris
|
|
123
|
+
augue neque gravida. Libero volutpat sed ornare arcu. Quisque egestas diam
|
|
124
|
+
in arcu cursus euismod quis viverra. Posuere ac ut consequat semper viverra
|
|
125
|
+
nam libero justo laoreet. Enim ut tellus elementum sagittis vitae et leo
|
|
126
|
+
duis ut. Neque laoreet suspendisse interdum consectetur libero id faucibus
|
|
127
|
+
nisl. Diam volutpat commodo sed egestas egestas. Dolor magna eget est lorem
|
|
128
|
+
ipsum dolor. Vitae suscipit tellus mauris a diam maecenas sed. Turpis in eu
|
|
129
|
+
mi bibendum neque egestas congue. Rhoncus est pellentesque elit ullamcorper
|
|
130
|
+
dignissim cras lobortis.
|
|
131
|
+
</sp-dialog>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Hero
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<sp-dialog size="medium" dismissable no-divider>
|
|
138
|
+
<div
|
|
139
|
+
slot="hero"
|
|
140
|
+
style="background-image: url(https://picsum.photos/1400/260)"
|
|
141
|
+
></div>
|
|
142
|
+
<h2 slot="heading">Disclaimer</h2>
|
|
143
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
144
|
+
tempor incididunt ut labore et dolore magna aliqua. Auctor augue mauris
|
|
145
|
+
augue neque gravida. Libero volutpat sed ornare arcu. Quisque egestas diam
|
|
146
|
+
in arcu cursus euismod quis viverra. Posuere ac ut consequat semper viverra
|
|
147
|
+
nam libero justo laoreet. Enim ut tellus elementum sagittis vitae et leo
|
|
148
|
+
duis ut. Neque laoreet suspendisse interdum consectetur libero id faucibus
|
|
149
|
+
nisl. Diam volutpat commodo sed egestas egestas. Dolor magna eget est lorem
|
|
150
|
+
ipsum dolor. Vitae suscipit tellus mauris a diam maecenas sed. Turpis in eu
|
|
151
|
+
mi bibendum neque egestas congue. Rhoncus est pellentesque elit ullamcorper
|
|
152
|
+
dignissim cras lobortis.
|
|
153
|
+
</sp-dialog>
|
|
154
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spectrum-web-components/dialog",
|
|
3
|
+
"version": "0.0.0-20241209155954",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/adobe/spectrum-web-components.git",
|
|
12
|
+
"directory": "packages/dialog"
|
|
13
|
+
},
|
|
14
|
+
"author": "",
|
|
15
|
+
"homepage": "https://opensource.adobe.com/spectrum-web-components/components/dialog",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/adobe/spectrum-web-components/issues"
|
|
18
|
+
},
|
|
19
|
+
"main": "./src/index.js",
|
|
20
|
+
"module": "./src/index.js",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"development": "./src/index.dev.js",
|
|
25
|
+
"default": "./src/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json",
|
|
28
|
+
"./src/Dialog.js": {
|
|
29
|
+
"development": "./src/Dialog.dev.js",
|
|
30
|
+
"default": "./src/Dialog.js"
|
|
31
|
+
},
|
|
32
|
+
"./src/DialogBase.js": {
|
|
33
|
+
"development": "./src/DialogBase.dev.js",
|
|
34
|
+
"default": "./src/DialogBase.js"
|
|
35
|
+
},
|
|
36
|
+
"./src/DialogWrapper.js": {
|
|
37
|
+
"development": "./src/DialogWrapper.dev.js",
|
|
38
|
+
"default": "./src/DialogWrapper.js"
|
|
39
|
+
},
|
|
40
|
+
"./src/dialog-overrides.css.js": "./src/dialog-overrides.css.js",
|
|
41
|
+
"./src/dialog.css.js": "./src/dialog.css.js",
|
|
42
|
+
"./src/index.js": {
|
|
43
|
+
"development": "./src/index.dev.js",
|
|
44
|
+
"default": "./src/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./sp-dialog.js": {
|
|
47
|
+
"development": "./sp-dialog.dev.js",
|
|
48
|
+
"default": "./sp-dialog.js"
|
|
49
|
+
},
|
|
50
|
+
"./sp-dialog-base.js": {
|
|
51
|
+
"development": "./sp-dialog-base.dev.js",
|
|
52
|
+
"default": "./sp-dialog-base.js"
|
|
53
|
+
},
|
|
54
|
+
"./sp-dialog-wrapper.js": {
|
|
55
|
+
"development": "./sp-dialog-wrapper.dev.js",
|
|
56
|
+
"default": "./sp-dialog-wrapper.js"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
|
|
61
|
+
},
|
|
62
|
+
"files": [
|
|
63
|
+
"**/*.d.ts",
|
|
64
|
+
"**/*.js",
|
|
65
|
+
"**/*.js.map",
|
|
66
|
+
"custom-elements.json",
|
|
67
|
+
"!stories/",
|
|
68
|
+
"!test/"
|
|
69
|
+
],
|
|
70
|
+
"keywords": [
|
|
71
|
+
"spectrum css",
|
|
72
|
+
"web components",
|
|
73
|
+
"lit-element",
|
|
74
|
+
"lit-html"
|
|
75
|
+
],
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@spectrum-web-components/alert-dialog": "0.0.0-20241209155954",
|
|
78
|
+
"@spectrum-web-components/base": "0.0.0-20241209155954",
|
|
79
|
+
"@spectrum-web-components/button": "0.0.0-20241209155954",
|
|
80
|
+
"@spectrum-web-components/button-group": "0.0.0-20241209155954",
|
|
81
|
+
"@spectrum-web-components/divider": "0.0.0-20241209155954",
|
|
82
|
+
"@spectrum-web-components/icons-workflow": "0.0.0-20241209155954",
|
|
83
|
+
"@spectrum-web-components/modal": "0.0.0-20241209155954",
|
|
84
|
+
"@spectrum-web-components/shared": "0.0.0-20241209155954",
|
|
85
|
+
"@spectrum-web-components/underlay": "0.0.0-20241209155954"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@spectrum-css/dialog": "^11.0.0-s2-foundations.15"
|
|
89
|
+
},
|
|
90
|
+
"types": "./src/index.d.ts",
|
|
91
|
+
"customElements": "custom-elements.json",
|
|
92
|
+
"sideEffects": [
|
|
93
|
+
"./sp-*.js",
|
|
94
|
+
"./**/*.dev.js"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-dialog-base.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*/\nimport { DialogBase } from './src/DialogBase.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-dialog-base', DialogBase);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dialog-base': DialogBase;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAE9B,cAAc,kBAAkB,UAAU;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-dialog-base.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*/\nimport { DialogBase } from './src/DialogBase.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-dialog-base', DialogBase);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dialog-base': DialogBase;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,cAAAA,MAAkB,sBAC3B,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,iBAAkBD,CAAU",
|
|
6
|
+
"names": ["DialogBase", "defineElement"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-dialog-wrapper.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*/\nimport { DialogWrapper } from './src/DialogWrapper.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-dialog-wrapper', DialogWrapper);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dialog-wrapper': DialogWrapper;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAE9B,cAAc,qBAAqB,aAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-dialog-wrapper.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*/\nimport { DialogWrapper } from './src/DialogWrapper.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-dialog-wrapper', DialogWrapper);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dialog-wrapper': DialogWrapper;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,iBAAAA,MAAqB,yBAC9B,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,oBAAqBD,CAAa",
|
|
6
|
+
"names": ["DialogWrapper", "defineElement"]
|
|
7
|
+
}
|
package/sp-dialog.d.ts
ADDED
package/sp-dialog.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-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*/\nimport { Dialog } from './src/Dialog.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-dialog', Dialog);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dialog': Dialog;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAE9B,cAAc,aAAa,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-dialog.js
ADDED
package/sp-dialog.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-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*/\nimport { Dialog } from './src/Dialog.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-dialog', Dialog);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dialog': Dialog;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,UAAAA,MAAc,kBACvB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,YAAaD,CAAM",
|
|
6
|
+
"names": ["Dialog", "defineElement"]
|
|
7
|
+
}
|
package/src/Dialog.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import '@spectrum-web-components/divider/sp-divider.js';
|
|
3
|
+
import '@spectrum-web-components/button/sp-close-button.js';
|
|
4
|
+
import '@spectrum-web-components/button-group/sp-button-group.js';
|
|
5
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';
|
|
6
|
+
import type { CloseButton } from '@spectrum-web-components/button';
|
|
7
|
+
import { AlertDialog } from '@spectrum-web-components/alert-dialog/src/AlertDialog.js';
|
|
8
|
+
declare const Dialog_base: typeof AlertDialog & {
|
|
9
|
+
new (...args: any[]): import("@spectrum-web-components/shared").SlotPresenceObservingInterface;
|
|
10
|
+
prototype: import("@spectrum-web-components/shared").SlotPresenceObservingInterface;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @element sp-dialog
|
|
14
|
+
*
|
|
15
|
+
* @slot hero - Accepts a hero image to display at the top of the dialog
|
|
16
|
+
* @slot heading - Acts as the heading of the dialog. This should be an actual heading tag `<h1-6 />`
|
|
17
|
+
* @slot - Content not addressed to a specific slot will be interpreted as the main content of the dialog
|
|
18
|
+
* @slot footer - Content addressed to the `footer` will be placed below the main content and to the side of any `[slot='button']` content
|
|
19
|
+
* @slot button - Button elements addressed to this slot may be placed below the content when not delivered in a fullscreen mode
|
|
20
|
+
* @fires close - Announces that the dialog has been closed.
|
|
21
|
+
*/
|
|
22
|
+
export declare class Dialog extends Dialog_base {
|
|
23
|
+
static get styles(): CSSResultArray;
|
|
24
|
+
closeButton?: CloseButton;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use the Alert Dialog component with `variant="error"` instead.
|
|
27
|
+
*/
|
|
28
|
+
error: boolean;
|
|
29
|
+
dismissable: boolean;
|
|
30
|
+
dismissLabel: string;
|
|
31
|
+
protected get hasFooter(): boolean;
|
|
32
|
+
protected get hasButtons(): boolean;
|
|
33
|
+
protected get hasHero(): boolean;
|
|
34
|
+
noDivider: boolean;
|
|
35
|
+
mode?: 'fullscreen' | 'fullscreenTakeover';
|
|
36
|
+
size?: 's' | 'm' | 'l';
|
|
37
|
+
close(): void;
|
|
38
|
+
protected renderHero(): TemplateResult;
|
|
39
|
+
protected renderFooter(): TemplateResult;
|
|
40
|
+
protected renderButtons(): TemplateResult;
|
|
41
|
+
protected renderDismiss(): TemplateResult;
|
|
42
|
+
protected render(): TemplateResult;
|
|
43
|
+
protected shouldUpdate(changes: PropertyValues): boolean;
|
|
44
|
+
protected firstUpdated(changes: PropertyValues): void;
|
|
45
|
+
protected updated(changes: PropertyValues): void;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
html,
|
|
14
|
+
nothing
|
|
15
|
+
} from "@spectrum-web-components/base";
|
|
16
|
+
import {
|
|
17
|
+
property,
|
|
18
|
+
query
|
|
19
|
+
} from "@spectrum-web-components/base/src/decorators.js";
|
|
20
|
+
import "@spectrum-web-components/divider/sp-divider.js";
|
|
21
|
+
import "@spectrum-web-components/button/sp-close-button.js";
|
|
22
|
+
import "@spectrum-web-components/button-group/sp-button-group.js";
|
|
23
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";
|
|
24
|
+
import { ObserveSlotPresence } from "@spectrum-web-components/shared";
|
|
25
|
+
import styles from "./dialog.css.js";
|
|
26
|
+
import { AlertDialog } from "@spectrum-web-components/alert-dialog/src/AlertDialog.js";
|
|
27
|
+
import { classMap } from "@spectrum-web-components/base/src/directives.js";
|
|
28
|
+
export class Dialog extends ObserveSlotPresence(AlertDialog, [
|
|
29
|
+
'[slot="hero"]',
|
|
30
|
+
'[slot="footer"]',
|
|
31
|
+
'[slot="button"]'
|
|
32
|
+
]) {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.error = false;
|
|
36
|
+
this.dismissable = false;
|
|
37
|
+
this.dismissLabel = "Close";
|
|
38
|
+
this.noDivider = false;
|
|
39
|
+
}
|
|
40
|
+
static get styles() {
|
|
41
|
+
return [styles];
|
|
42
|
+
}
|
|
43
|
+
get hasFooter() {
|
|
44
|
+
return this.getSlotContentPresence('[slot="footer"]');
|
|
45
|
+
}
|
|
46
|
+
get hasButtons() {
|
|
47
|
+
return this.getSlotContentPresence('[slot="button"]');
|
|
48
|
+
}
|
|
49
|
+
/* c8 ignore next 3 */
|
|
50
|
+
get hasHero() {
|
|
51
|
+
return this.getSlotContentPresence('[slot="hero"]');
|
|
52
|
+
}
|
|
53
|
+
close() {
|
|
54
|
+
this.dispatchEvent(
|
|
55
|
+
new Event("close", {
|
|
56
|
+
bubbles: true,
|
|
57
|
+
composed: true,
|
|
58
|
+
cancelable: true
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
renderHero() {
|
|
63
|
+
return html`
|
|
64
|
+
<slot name="hero"></slot>
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
renderFooter() {
|
|
68
|
+
return html`
|
|
69
|
+
<div class="footer">
|
|
70
|
+
<slot name="footer"></slot>
|
|
71
|
+
</div>
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
renderButtons() {
|
|
75
|
+
const classes = {
|
|
76
|
+
"button-group": true,
|
|
77
|
+
"button-group--noFooter": !this.hasFooter
|
|
78
|
+
};
|
|
79
|
+
return html`
|
|
80
|
+
<sp-button-group class=${classMap(classes)}>
|
|
81
|
+
<slot name="button"></slot>
|
|
82
|
+
</sp-button-group>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
renderDismiss() {
|
|
86
|
+
return html`
|
|
87
|
+
<sp-close-button
|
|
88
|
+
class="close-button"
|
|
89
|
+
label=${this.dismissLabel}
|
|
90
|
+
quiet
|
|
91
|
+
size="m"
|
|
92
|
+
@click=${this.close}
|
|
93
|
+
></sp-close-button>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
return html`
|
|
98
|
+
<div class="grid">
|
|
99
|
+
${this.renderHero()} ${this.renderHeading()}
|
|
100
|
+
${this.error ? html`
|
|
101
|
+
<sp-icon-alert class="type-icon"></sp-icon-alert>
|
|
102
|
+
` : nothing}
|
|
103
|
+
${this.noDivider ? nothing : html`
|
|
104
|
+
<sp-divider size="m" class="divider"></sp-divider>
|
|
105
|
+
`}
|
|
106
|
+
${this.renderContent()}
|
|
107
|
+
${this.hasFooter ? this.renderFooter() : nothing}
|
|
108
|
+
${this.hasButtons ? this.renderButtons() : nothing}
|
|
109
|
+
${this.dismissable ? this.renderDismiss() : nothing}
|
|
110
|
+
</div>
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
shouldUpdate(changes) {
|
|
114
|
+
if (changes.has("mode") && !!this.mode) {
|
|
115
|
+
this.dismissable = false;
|
|
116
|
+
}
|
|
117
|
+
if (changes.has("dismissable") && this.dismissable) {
|
|
118
|
+
this.dismissable = !this.mode;
|
|
119
|
+
}
|
|
120
|
+
return super.shouldUpdate(changes);
|
|
121
|
+
}
|
|
122
|
+
firstUpdated(changes) {
|
|
123
|
+
super.firstUpdated(changes);
|
|
124
|
+
this.setAttribute("role", "dialog");
|
|
125
|
+
}
|
|
126
|
+
updated(changes) {
|
|
127
|
+
super.updated(changes);
|
|
128
|
+
if (changes.has("error") && this.error) {
|
|
129
|
+
if (true) {
|
|
130
|
+
window.__swc.warn(
|
|
131
|
+
this,
|
|
132
|
+
`The "error" attribute of <${this.localName}> has been deprecated. Use the Alert Dialog component with the "variant='error'" instead. "error" will be removed in a future release.`,
|
|
133
|
+
"https://opensource.adobe.com/spectrum-web-components/components/alert-dialog/#error",
|
|
134
|
+
{ level: "deprecation" }
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
__decorateClass([
|
|
141
|
+
query(".close-button")
|
|
142
|
+
], Dialog.prototype, "closeButton", 2);
|
|
143
|
+
__decorateClass([
|
|
144
|
+
property({ type: Boolean, reflect: true })
|
|
145
|
+
], Dialog.prototype, "error", 2);
|
|
146
|
+
__decorateClass([
|
|
147
|
+
property({ type: Boolean, reflect: true })
|
|
148
|
+
], Dialog.prototype, "dismissable", 2);
|
|
149
|
+
__decorateClass([
|
|
150
|
+
property({ type: String, reflect: true, attribute: "dismiss-label" })
|
|
151
|
+
], Dialog.prototype, "dismissLabel", 2);
|
|
152
|
+
__decorateClass([
|
|
153
|
+
property({ type: Boolean, reflect: true, attribute: "no-divider" })
|
|
154
|
+
], Dialog.prototype, "noDivider", 2);
|
|
155
|
+
__decorateClass([
|
|
156
|
+
property({ type: String, reflect: true })
|
|
157
|
+
], Dialog.prototype, "mode", 2);
|
|
158
|
+
__decorateClass([
|
|
159
|
+
property({ type: String, reflect: true })
|
|
160
|
+
], Dialog.prototype, "size", 2);
|
|
161
|
+
//# sourceMappingURL=Dialog.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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 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 /**\n * @deprecated Use the Alert Dialog component with `variant=\"error\"` instead.\n */\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n @property({ type: String, reflect: true, attribute: 'dismiss-label' })\n public dismissLabel = 'Close';\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=${this.dismissLabel}\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 protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('error') && this.error) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"error\" attribute of <${this.localName}> has been deprecated. Use the Alert Dialog component with the \"variant='error'\" instead. \"error\" will be removed in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/alert-dialog/#error',\n { level: 'deprecation' }\n );\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/Dialog.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var t=(d,i,e,n)=>{for(var r=n>1?void 0:n?c(i,e):i,p=d.length-1,u;p>=0;p--)(u=d[p])&&(r=(n?u(i,e,r):u(r))||r);return n&&r&&a(i,e,r),r};import{html as o,nothing as l}from"@spectrum-web-components/base";import{property as s,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.dismissLabel="Close";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
|
+
<slot name="hero"></slot>
|
|
3
|
+
`}renderFooter(){return o`
|
|
4
|
+
<div class="footer">
|
|
5
|
+
<slot name="footer"></slot>
|
|
6
|
+
</div>
|
|
7
|
+
`}renderButtons(){const e={"button-group":!0,"button-group--noFooter":!this.hasFooter};return o`
|
|
8
|
+
<sp-button-group class=${v(e)}>
|
|
9
|
+
<slot name="button"></slot>
|
|
10
|
+
</sp-button-group>
|
|
11
|
+
`}renderDismiss(){return o`
|
|
12
|
+
<sp-close-button
|
|
13
|
+
class="close-button"
|
|
14
|
+
label=${this.dismissLabel}
|
|
15
|
+
quiet
|
|
16
|
+
size="m"
|
|
17
|
+
@click=${this.close}
|
|
18
|
+
></sp-close-button>
|
|
19
|
+
`}render(){return o`
|
|
20
|
+
<div class="grid">
|
|
21
|
+
${this.renderHero()} ${this.renderHeading()}
|
|
22
|
+
${this.error?o`
|
|
23
|
+
<sp-icon-alert class="type-icon"></sp-icon-alert>
|
|
24
|
+
`:l}
|
|
25
|
+
${this.noDivider?l:o`
|
|
26
|
+
<sp-divider size="m" class="divider"></sp-divider>
|
|
27
|
+
`}
|
|
28
|
+
${this.renderContent()}
|
|
29
|
+
${this.hasFooter?this.renderFooter():l}
|
|
30
|
+
${this.hasButtons?this.renderButtons():l}
|
|
31
|
+
${this.dismissable?this.renderDismiss():l}
|
|
32
|
+
</div>
|
|
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")}updated(e){super.updated(e),e.has("error")&&this.error}}t([m(".close-button")],Dialog.prototype,"closeButton",2),t([s({type:Boolean,reflect:!0})],Dialog.prototype,"error",2),t([s({type:Boolean,reflect:!0})],Dialog.prototype,"dismissable",2),t([s({type:String,reflect:!0,attribute:"dismiss-label"})],Dialog.prototype,"dismissLabel",2),t([s({type:Boolean,reflect:!0,attribute:"no-divider"})],Dialog.prototype,"noDivider",2),t([s({type:String,reflect:!0})],Dialog.prototype,"mode",2),t([s({type:String,reflect:!0})],Dialog.prototype,"size",2);
|
|
34
|
+
//# sourceMappingURL=Dialog.js.map
|