@spectrum-web-components/dialog 1.3.0-beta.6 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +0 -4
- package/package.json +11 -12
- package/src/Dialog.d.ts +3 -6
- package/src/Dialog.dev.js +3 -13
- package/src/Dialog.dev.js.map +2 -2
- package/src/Dialog.js +9 -9
- package/src/Dialog.js.map +3 -3
- package/src/DialogWrapper.d.ts +2 -5
- package/src/DialogWrapper.dev.js +1 -1
- package/src/DialogWrapper.dev.js.map +2 -2
- package/src/DialogWrapper.js +1 -1
- package/src/DialogWrapper.js.map +2 -2
- package/LICENSE +0 -201
- package/stories/dialog-base.stories.js +0 -230
- package/stories/dialog-base.stories.js.map +0 -7
- package/stories/dialog-wrapper.stories.js +0 -582
- package/stories/dialog-wrapper.stories.js.map +0 -7
- package/stories/dialog.stories.js +0 -510
- package/stories/dialog.stories.js.map +0 -7
- package/stories/images.js +0 -4
- package/stories/images.js.map +0 -7
- package/stories/index.js +0 -41
- package/stories/index.js.map +0 -7
- package/test/benchmark/basic-test.js +0 -20
- package/test/benchmark/basic-test.js.map +0 -7
- package/test/dialog-base.test-vrt.js +0 -5
- package/test/dialog-base.test-vrt.js.map +0 -7
- package/test/dialog-base.test.js +0 -106
- package/test/dialog-base.test.js.map +0 -7
- package/test/dialog-memory.test.js +0 -5
- package/test/dialog-memory.test.js.map +0 -7
- package/test/dialog-wrapper.test-vrt.js +0 -5
- package/test/dialog-wrapper.test-vrt.js.map +0 -7
- package/test/dialog-wrapper.test.js +0 -320
- package/test/dialog-wrapper.test.js.map +0 -7
- package/test/dialog.test-vrt.js +0 -5
- package/test/dialog.test-vrt.js.map +0 -7
- package/test/dialog.test.js +0 -221
- package/test/dialog.test.js.map +0 -7
package/custom-elements.json
CHANGED
|
@@ -93,7 +93,6 @@
|
|
|
93
93
|
},
|
|
94
94
|
"privacy": "public",
|
|
95
95
|
"default": "false",
|
|
96
|
-
"deprecated": "Use the Alert Dialog component with `variant=\"error\"` instead.",
|
|
97
96
|
"attribute": "error",
|
|
98
97
|
"reflects": true
|
|
99
98
|
},
|
|
@@ -244,7 +243,6 @@
|
|
|
244
243
|
"text": "boolean"
|
|
245
244
|
},
|
|
246
245
|
"default": "false",
|
|
247
|
-
"deprecated": "Use the Alert Dialog component with `variant=\"error\"` instead.",
|
|
248
246
|
"fieldName": "error"
|
|
249
247
|
},
|
|
250
248
|
{
|
|
@@ -668,7 +666,6 @@
|
|
|
668
666
|
},
|
|
669
667
|
"privacy": "public",
|
|
670
668
|
"default": "false",
|
|
671
|
-
"deprecated": "Use the Alert Dialog component with `variant=\"error\"` instead.",
|
|
672
669
|
"attribute": "error",
|
|
673
670
|
"reflects": true
|
|
674
671
|
},
|
|
@@ -1180,7 +1177,6 @@
|
|
|
1180
1177
|
"text": "boolean"
|
|
1181
1178
|
},
|
|
1182
1179
|
"default": "false",
|
|
1183
|
-
"deprecated": "Use the Alert Dialog component with `variant=\"error\"` instead.",
|
|
1184
1180
|
"fieldName": "error"
|
|
1185
1181
|
},
|
|
1186
1182
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/dialog",
|
|
3
|
-
"version": "1.3.0
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -74,15 +74,15 @@
|
|
|
74
74
|
"lit-html"
|
|
75
75
|
],
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@spectrum-web-components/alert-dialog": "
|
|
78
|
-
"@spectrum-web-components/base": "
|
|
79
|
-
"@spectrum-web-components/button": "
|
|
80
|
-
"@spectrum-web-components/button-group": "
|
|
81
|
-
"@spectrum-web-components/divider": "
|
|
82
|
-
"@spectrum-web-components/icons-workflow": "
|
|
83
|
-
"@spectrum-web-components/modal": "
|
|
84
|
-
"@spectrum-web-components/shared": "
|
|
85
|
-
"@spectrum-web-components/underlay": "
|
|
77
|
+
"@spectrum-web-components/alert-dialog": "1.3.0",
|
|
78
|
+
"@spectrum-web-components/base": "1.3.0",
|
|
79
|
+
"@spectrum-web-components/button": "1.3.0",
|
|
80
|
+
"@spectrum-web-components/button-group": "1.3.0",
|
|
81
|
+
"@spectrum-web-components/divider": "1.3.0",
|
|
82
|
+
"@spectrum-web-components/icons-workflow": "1.3.0",
|
|
83
|
+
"@spectrum-web-components/modal": "1.3.0",
|
|
84
|
+
"@spectrum-web-components/shared": "1.3.0",
|
|
85
|
+
"@spectrum-web-components/underlay": "1.3.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@spectrum-css/dialog": "11.0.0-s2-foundations.15"
|
|
@@ -92,6 +92,5 @@
|
|
|
92
92
|
"sideEffects": [
|
|
93
93
|
"./sp-*.js",
|
|
94
94
|
"./**/*.dev.js"
|
|
95
|
-
]
|
|
96
|
-
"gitHead": "7a244ef2b2cad9f06962483af6fdff89828d9a83"
|
|
95
|
+
]
|
|
97
96
|
}
|
package/src/Dialog.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
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
2
|
import '@spectrum-web-components/button-group/sp-button-group.js';
|
|
3
|
+
import '@spectrum-web-components/button/sp-close-button.js';
|
|
4
|
+
import '@spectrum-web-components/divider/sp-divider.js';
|
|
5
5
|
import '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';
|
|
6
|
-
import type { CloseButton } from '@spectrum-web-components/button';
|
|
7
6
|
import { AlertDialog } from '@spectrum-web-components/alert-dialog/src/AlertDialog.js';
|
|
7
|
+
import type { CloseButton } from '@spectrum-web-components/button';
|
|
8
8
|
declare const Dialog_base: typeof AlertDialog & {
|
|
9
9
|
new (...args: any[]): import("@spectrum-web-components/shared").SlotPresenceObservingInterface;
|
|
10
10
|
prototype: import("@spectrum-web-components/shared").SlotPresenceObservingInterface;
|
|
@@ -22,9 +22,6 @@ declare const Dialog_base: typeof AlertDialog & {
|
|
|
22
22
|
export declare class Dialog extends Dialog_base {
|
|
23
23
|
static get styles(): CSSResultArray;
|
|
24
24
|
closeButton?: CloseButton;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Use the Alert Dialog component with `variant="error"` instead.
|
|
27
|
-
*/
|
|
28
25
|
error: boolean;
|
|
29
26
|
dismissable: boolean;
|
|
30
27
|
dismissLabel: string;
|
package/src/Dialog.dev.js
CHANGED
|
@@ -17,14 +17,14 @@ import {
|
|
|
17
17
|
property,
|
|
18
18
|
query
|
|
19
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
20
|
import "@spectrum-web-components/button-group/sp-button-group.js";
|
|
21
|
+
import "@spectrum-web-components/button/sp-close-button.js";
|
|
22
|
+
import "@spectrum-web-components/divider/sp-divider.js";
|
|
23
23
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";
|
|
24
24
|
import { ObserveSlotPresence } from "@spectrum-web-components/shared";
|
|
25
|
-
import styles from "./dialog.css.js";
|
|
26
25
|
import { AlertDialog } from "@spectrum-web-components/alert-dialog/src/AlertDialog.js";
|
|
27
26
|
import { classMap } from "@spectrum-web-components/base/src/directives.js";
|
|
27
|
+
import styles from "./dialog.css.js";
|
|
28
28
|
export class Dialog extends ObserveSlotPresence(AlertDialog, [
|
|
29
29
|
'[slot="hero"]',
|
|
30
30
|
'[slot="footer"]',
|
|
@@ -125,16 +125,6 @@ export class Dialog extends ObserveSlotPresence(AlertDialog, [
|
|
|
125
125
|
}
|
|
126
126
|
updated(changes) {
|
|
127
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
128
|
}
|
|
139
129
|
}
|
|
140
130
|
__decorateClass([
|
package/src/Dialog.dev.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 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/
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAGG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,2BAA2B;AAEpC,
|
|
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/button-group/sp-button-group.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/divider/sp-divider.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared';\n\nimport { AlertDialog } from '@spectrum-web-components/alert-dialog/src/AlertDialog.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\nimport type { CloseButton } from '@spectrum-web-components/button';\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 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 @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 }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAGG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,2BAA2B;AAEpC,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAEzB,OAAO,YAAY;AAYZ,aAAM,eAAe,oBAAoB,aAAa;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AACJ,CAAC,EAAE;AAAA,EAJI;AAAA;AAaH,SAAO,QAAQ;AAGf,SAAO,cAAc;AAGrB,SAAO,eAAe;AAgBtB,SAAO,YAAY;AAAA;AAAA,EA9BnB,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAcA,IAAc,YAAqB;AAC/B,WAAO,KAAK,uBAAuB,iBAAiB;AAAA,EACxD;AAAA,EAEA,IAAc,aAAsB;AAChC,WAAO,KAAK,uBAAuB,iBAAiB;AAAA,EACxD;AAAA;AAAA,EAGA,IAAc,UAAmB;AAC7B,WAAO,KAAK,uBAAuB,eAAe;AAAA,EACtD;AAAA,EAWO,QAAc;AACjB,SAAK;AAAA,MACD,IAAI,MAAM,SAAS;AAAA,QACf,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,MAChB,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAEU,aAA6B;AACnC,WAAO;AAAA;AAAA;AAAA,EAGX;AAAA,EAEU,eAA+B;AACrC,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKX;AAAA,EAEmB,gBAAgC;AAC/C,UAAM,UAAU;AAAA,MACZ,gBAAgB;AAAA,MAChB,0BAA0B,CAAC,KAAK;AAAA,IACpC;AACA,WAAO;AAAA,qCACsB,SAAS,OAAO,CAA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S,MAAM,WAAW,gBAAgB,CAAC;AAAA,GAlB5D,OAmBF;AAgBA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,aAAa,CAAC;AAAA,GAlC1D,OAmCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GArChC,OAsCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAxChC,OAyCF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Dialog.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var t=(
|
|
1
|
+
"use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var t=(u,i,e,n)=>{for(var r=n>1?void 0:n?c(i,e):i,p=u.length-1,d;p>=0;p--)(d=u[p])&&(r=(n?d(i,e,r):d(r))||r);return n&&r&&a(i,e,r),r};import{html as s,nothing as l}from"@spectrum-web-components/base";import{property as o,query as m}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/button-group/sp-button-group.js";import"@spectrum-web-components/button/sp-close-button.js";import"@spectrum-web-components/divider/sp-divider.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";import{ObserveSlotPresence as b}from"@spectrum-web-components/shared";import{AlertDialog as h}from"@spectrum-web-components/alert-dialog/src/AlertDialog.js";import{classMap as f}from"@spectrum-web-components/base/src/directives.js";import v from"./dialog.css.js";export class Dialog extends b(h,['[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[v]}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 s`
|
|
2
2
|
<slot name="hero"></slot>
|
|
3
|
-
`}renderFooter(){return
|
|
3
|
+
`}renderFooter(){return s`
|
|
4
4
|
<div class="footer">
|
|
5
5
|
<slot name="footer"></slot>
|
|
6
6
|
</div>
|
|
7
|
-
`}renderButtons(){const e={"button-group":!0,"button-group--noFooter":!this.hasFooter};return
|
|
8
|
-
<sp-button-group class=${
|
|
7
|
+
`}renderButtons(){const e={"button-group":!0,"button-group--noFooter":!this.hasFooter};return s`
|
|
8
|
+
<sp-button-group class=${f(e)}>
|
|
9
9
|
<slot name="button"></slot>
|
|
10
10
|
</sp-button-group>
|
|
11
|
-
`}renderDismiss(){return
|
|
11
|
+
`}renderDismiss(){return s`
|
|
12
12
|
<sp-close-button
|
|
13
13
|
class="close-button"
|
|
14
14
|
label=${this.dismissLabel}
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
size="m"
|
|
17
17
|
@click=${this.close}
|
|
18
18
|
></sp-close-button>
|
|
19
|
-
`}render(){return
|
|
19
|
+
`}render(){return s`
|
|
20
20
|
<div class="grid">
|
|
21
21
|
${this.renderHero()} ${this.renderHeading()}
|
|
22
|
-
${this.error?
|
|
22
|
+
${this.error?s`
|
|
23
23
|
<sp-icon-alert class="type-icon"></sp-icon-alert>
|
|
24
24
|
`:l}
|
|
25
|
-
${this.noDivider?l:
|
|
25
|
+
${this.noDivider?l:s`
|
|
26
26
|
<sp-divider size="m" class="divider"></sp-divider>
|
|
27
27
|
`}
|
|
28
28
|
${this.renderContent()}
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
${this.hasButtons?this.renderButtons():l}
|
|
31
31
|
${this.dismissable?this.renderDismiss():l}
|
|
32
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)
|
|
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)}}t([m(".close-button")],Dialog.prototype,"closeButton",2),t([o({type:Boolean,reflect:!0})],Dialog.prototype,"error",2),t([o({type:Boolean,reflect:!0})],Dialog.prototype,"dismissable",2),t([o({type:String,reflect:!0,attribute:"dismiss-label"})],Dialog.prototype,"dismissLabel",2),t([o({type:Boolean,reflect:!0,attribute:"no-divider"})],Dialog.prototype,"noDivider",2),t([o({type:String,reflect:!0})],Dialog.prototype,"mode",2),t([o({type:String,reflect:!0})],Dialog.prototype,"size",2);
|
|
34
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 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/
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,MAGG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDAEP,MAAO,
|
|
6
|
-
"names": ["html", "nothing", "property", "query", "ObserveSlotPresence", "
|
|
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/button-group/sp-button-group.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/divider/sp-divider.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared';\n\nimport { AlertDialog } from '@spectrum-web-components/alert-dialog/src/AlertDialog.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\nimport type { CloseButton } from '@spectrum-web-components/button';\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 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 @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 }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,MAGG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDAEP,MAAO,2DACP,MAAO,qDACP,MAAO,iDACP,MAAO,iEACP,OAAS,uBAAAC,MAA2B,kCAEpC,OAAS,eAAAC,MAAmB,2DAC5B,OAAS,YAAAC,MAAgB,kDAEzB,OAAOC,MAAY,kBAYZ,aAAM,eAAeH,EAAoBC,EAAa,CACzD,gBACA,kBACA,iBACJ,CAAC,CAAE,CAJI,kCAaH,KAAO,MAAQ,GAGf,KAAO,YAAc,GAGrB,KAAO,aAAe,QAgBtB,KAAO,UAAY,GA9BnB,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAM,CAClB,CAcA,IAAc,WAAqB,CAC/B,OAAO,KAAK,uBAAuB,iBAAiB,CACxD,CAEA,IAAc,YAAsB,CAChC,OAAO,KAAK,uBAAuB,iBAAiB,CACxD,CAGA,IAAc,SAAmB,CAC7B,OAAO,KAAK,uBAAuB,eAAe,CACtD,CAWO,OAAc,CACjB,KAAK,cACD,IAAI,MAAM,QAAS,CACf,QAAS,GACT,SAAU,GACV,WAAY,EAChB,CAAC,CACL,CACJ,CAEU,YAA6B,CACnC,OAAOP;AAAA;AAAA,SAGX,CAEU,cAA+B,CACrC,OAAOA;AAAA;AAAA;AAAA;AAAA,SAKX,CAEmB,eAAgC,CAC/C,MAAMQ,EAAU,CACZ,eAAgB,GAChB,yBAA0B,CAAC,KAAK,SACpC,EACA,OAAOR;AAAA,qCACsBM,EA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AS,GAAM,UAAW,YAAa,CAAC,GAlC1D,OAmCF,yBAGAQ,EAAA,CADNR,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GArChC,OAsCF,oBAGAQ,EAAA,CADNR,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAxChC,OAyCF",
|
|
6
|
+
"names": ["html", "nothing", "property", "query", "ObserveSlotPresence", "AlertDialog", "classMap", "styles", "classes", "changes", "__decorateClass"]
|
|
7
7
|
}
|
package/src/DialogWrapper.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CSSResultArray, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
-
import '@spectrum-web-components/underlay/sp-underlay.js';
|
|
3
2
|
import '@spectrum-web-components/button/sp-button.js';
|
|
3
|
+
import '@spectrum-web-components/underlay/sp-underlay.js';
|
|
4
4
|
import '@spectrum-web-components/dialog/sp-dialog.js';
|
|
5
|
-
import { DialogBase } from './DialogBase.js';
|
|
6
5
|
import { Dialog } from './Dialog.js';
|
|
6
|
+
import { DialogBase } from './DialogBase.js';
|
|
7
7
|
/**
|
|
8
8
|
* @element sp-dialog-wrapper
|
|
9
9
|
*
|
|
@@ -15,9 +15,6 @@ import { Dialog } from './Dialog.js';
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class DialogWrapper extends DialogBase {
|
|
17
17
|
static get styles(): CSSResultArray;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Use the Alert Dialog component with `variant="error"` instead.
|
|
20
|
-
*/
|
|
21
18
|
error: boolean;
|
|
22
19
|
cancelLabel: string;
|
|
23
20
|
confirmLabel: string;
|
package/src/DialogWrapper.dev.js
CHANGED
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
} from "@spectrum-web-components/base";
|
|
16
16
|
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
17
17
|
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
18
|
-
import "@spectrum-web-components/underlay/sp-underlay.js";
|
|
19
18
|
import "@spectrum-web-components/button/sp-button.js";
|
|
19
|
+
import "@spectrum-web-components/underlay/sp-underlay.js";
|
|
20
20
|
import "@spectrum-web-components/dialog/sp-dialog.js";
|
|
21
21
|
import { DialogBase } from "./DialogBase.dev.js";
|
|
22
22
|
export class DialogWrapper extends DialogBase {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["DialogWrapper.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAE1B,OAAO;AACP,OAAO;AAGP,OAAO;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/underlay/sp-underlay.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport { Dialog } from './Dialog.dev.js'\nimport { DialogBase } from './DialogBase.dev.js'\n\n/**\n * @element sp-dialog-wrapper\n *\n * @slot - content for the dialog\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @fires cancel - Announces that the \"cancel\" button has been clicked.\n * @fires confirm - Announces that the \"confirm\" button has been clicked.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogWrapper extends DialogBase {\n public static override get styles(): CSSResultArray {\n return [...super.styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ attribute: 'cancel-label' })\n public cancelLabel = '';\n\n @property({ attribute: 'confirm-label' })\n public confirmLabel = '';\n\n @property({ attribute: 'dismiss-label' })\n public dismissLabel = 'Close';\n\n @property()\n public footer = '';\n\n @property()\n public hero = '';\n\n @property({ attribute: 'hero-label' })\n public heroLabel = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n @property({ attribute: 'secondary-label' })\n public secondaryLabel = '';\n\n @property()\n public headline = '';\n\n @property({ type: String, attribute: 'headline-visibility' })\n public headlineVisibility: 'none' | undefined;\n\n protected override get dialog(): Dialog {\n return this.shadowRoot.querySelector('sp-dialog') as Dialog;\n }\n\n private clickSecondary(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n })\n );\n }\n\n private clickCancel(): void {\n this.dispatchEvent(\n new Event('cancel', {\n bubbles: true,\n })\n );\n }\n\n private clickConfirm(): void {\n this.dispatchEvent(\n new Event('confirm', {\n bubbles: true,\n })\n );\n }\n\n protected override renderDialog(): TemplateResult {\n const hideDivider =\n this.noDivider ||\n !this.headline ||\n this.headlineVisibility === 'none';\n\n if (window.__swc.DEBUG) {\n if (!this.headline) {\n window.__swc.warn(\n this,\n `<${this.localName}> elements will not be accessible to screen readers without a \"headline\" attribute or property.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-wrapper/#accessibility',\n {\n type: 'accessibility',\n }\n );\n }\n }\n\n return html`\n <sp-dialog\n ?dismissable=${this.dismissable}\n dismiss-label=${this.dismissLabel}\n ?no-divider=${hideDivider}\n ?error=${this.error}\n mode=${ifDefined(this.mode)}\n size=${ifDefined(this.size)}\n >\n ${this.hero\n ? html`\n <img\n src=\"${this.hero}\"\n slot=\"hero\"\n aria-hidden=${ifDefined(\n this.heroLabel ? undefined : 'true'\n )}\n alt=${ifDefined(\n this.heroLabel ? this.heroLabel : undefined\n )}\n />\n `\n : nothing}\n ${this.headline\n ? html`\n <h2\n slot=\"heading\"\n ?hidden=${this.headlineVisibility === 'none'}\n >\n ${this.headline}\n </h2>\n `\n : nothing}\n <slot></slot>\n ${this.footer\n ? html`\n <div slot=\"footer\">${this.footer}</div>\n `\n : nothing}\n ${this.cancelLabel\n ? html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickCancel}\n >\n ${this.cancelLabel}\n </sp-button>\n `\n : nothing}\n ${this.secondaryLabel\n ? html`\n <sp-button\n variant=\"primary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickSecondary}\n >\n ${this.secondaryLabel}\n </sp-button>\n `\n : nothing}\n ${this.confirmLabel\n ? html`\n <sp-button\n variant=\"accent\"\n slot=\"button\"\n @click=${this.clickConfirm}\n >\n ${this.confirmLabel}\n </sp-button>\n `\n : nothing}\n </sp-dialog>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAA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Ad/B,cAeF;AAGA;AAAA,EADN,SAAS;AAAA,GAjBD,cAkBF;AAGA;AAAA,EADN,SAAS;AAAA,GApBD,cAqBF;AAGA;AAAA,EADN,SAAS,EAAE,WAAW,aAAa,CAAC;AAAA,GAvB5B,cAwBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,aAAa,CAAC;AAAA,GA1B1D,cA2BF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GA7BhC,cA8BF;AAGA;AAAA,EADN,SAAS,EAAE,WAAW,kBAAkB,CAAC;AAAA,GAhCjC,cAiCF;AAGA;AAAA,EADN,SAAS;AAAA,GAnCD,cAoCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,sBAAsB,CAAC;AAAA,GAtCnD,cAuCF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/DialogWrapper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var h=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var e=(c,o,r,n)=>{for(var i=n>1?void 0:n?u(o,r):o,b=c.length-1,d;b>=0;b--)(d=c[b])&&(i=(n?d(o,r,i):d(i))||i);return n&&i&&h(o,r,i),i};import{html as s,nothing as l}from"@spectrum-web-components/base";import{property as t}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as a}from"@spectrum-web-components/base/src/directives.js";import"@spectrum-web-components/
|
|
1
|
+
"use strict";var h=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var e=(c,o,r,n)=>{for(var i=n>1?void 0:n?u(o,r):o,b=c.length-1,d;b>=0;b--)(d=c[b])&&(i=(n?d(o,r,i):d(i))||i);return n&&i&&h(o,r,i),i};import{html as s,nothing as l}from"@spectrum-web-components/base";import{property as t}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as a}from"@spectrum-web-components/base/src/directives.js";import"@spectrum-web-components/button/sp-button.js";import"@spectrum-web-components/underlay/sp-underlay.js";import"@spectrum-web-components/dialog/sp-dialog.js";import{DialogBase as m}from"./DialogBase.js";export class DialogWrapper extends m{constructor(){super(...arguments);this.error=!1;this.cancelLabel="";this.confirmLabel="";this.dismissLabel="Close";this.footer="";this.hero="";this.heroLabel="";this.noDivider=!1;this.secondaryLabel="";this.headline=""}static get styles(){return[...super.styles]}get dialog(){return this.shadowRoot.querySelector("sp-dialog")}clickSecondary(){this.dispatchEvent(new Event("secondary",{bubbles:!0}))}clickCancel(){this.dispatchEvent(new Event("cancel",{bubbles:!0}))}clickConfirm(){this.dispatchEvent(new Event("confirm",{bubbles:!0}))}renderDialog(){const r=this.noDivider||!this.headline||this.headlineVisibility==="none";return s`
|
|
2
2
|
<sp-dialog
|
|
3
3
|
?dismissable=${this.dismissable}
|
|
4
4
|
dismiss-label=${this.dismissLabel}
|
package/src/DialogWrapper.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["DialogWrapper.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,aAAAC,MAAiB,kDAE1B,MAAO,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/underlay/sp-underlay.js';\n\n// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport { Dialog } from './Dialog.js';\nimport { DialogBase } from './DialogBase.js';\n\n/**\n * @element sp-dialog-wrapper\n *\n * @slot - content for the dialog\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @fires cancel - Announces that the \"cancel\" button has been clicked.\n * @fires confirm - Announces that the \"confirm\" button has been clicked.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogWrapper extends DialogBase {\n public static override get styles(): CSSResultArray {\n return [...super.styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ attribute: 'cancel-label' })\n public cancelLabel = '';\n\n @property({ attribute: 'confirm-label' })\n public confirmLabel = '';\n\n @property({ attribute: 'dismiss-label' })\n public dismissLabel = 'Close';\n\n @property()\n public footer = '';\n\n @property()\n public hero = '';\n\n @property({ attribute: 'hero-label' })\n public heroLabel = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n @property({ attribute: 'secondary-label' })\n public secondaryLabel = '';\n\n @property()\n public headline = '';\n\n @property({ type: String, attribute: 'headline-visibility' })\n public headlineVisibility: 'none' | undefined;\n\n protected override get dialog(): Dialog {\n return this.shadowRoot.querySelector('sp-dialog') as Dialog;\n }\n\n private clickSecondary(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n })\n );\n }\n\n private clickCancel(): void {\n this.dispatchEvent(\n new Event('cancel', {\n bubbles: true,\n })\n );\n }\n\n private clickConfirm(): void {\n this.dispatchEvent(\n new Event('confirm', {\n bubbles: true,\n })\n );\n }\n\n protected override renderDialog(): TemplateResult {\n const hideDivider =\n this.noDivider ||\n !this.headline ||\n this.headlineVisibility === 'none';\n\n if (window.__swc.DEBUG) {\n if (!this.headline) {\n window.__swc.warn(\n this,\n `<${this.localName}> elements will not be accessible to screen readers without a \"headline\" attribute or property.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/dialog-wrapper/#accessibility',\n {\n type: 'accessibility',\n }\n );\n }\n }\n\n return html`\n <sp-dialog\n ?dismissable=${this.dismissable}\n dismiss-label=${this.dismissLabel}\n ?no-divider=${hideDivider}\n ?error=${this.error}\n mode=${ifDefined(this.mode)}\n size=${ifDefined(this.size)}\n >\n ${this.hero\n ? html`\n <img\n src=\"${this.hero}\"\n slot=\"hero\"\n aria-hidden=${ifDefined(\n this.heroLabel ? undefined : 'true'\n )}\n alt=${ifDefined(\n this.heroLabel ? this.heroLabel : undefined\n )}\n />\n `\n : nothing}\n ${this.headline\n ? html`\n <h2\n slot=\"heading\"\n ?hidden=${this.headlineVisibility === 'none'}\n >\n ${this.headline}\n </h2>\n `\n : nothing}\n <slot></slot>\n ${this.footer\n ? html`\n <div slot=\"footer\">${this.footer}</div>\n `\n : nothing}\n ${this.cancelLabel\n ? html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickCancel}\n >\n ${this.cancelLabel}\n </sp-button>\n `\n : nothing}\n ${this.secondaryLabel\n ? html`\n <sp-button\n variant=\"primary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickSecondary}\n >\n ${this.secondaryLabel}\n </sp-button>\n `\n : nothing}\n ${this.confirmLabel\n ? html`\n <sp-button\n variant=\"accent\"\n slot=\"button\"\n @click=${this.clickConfirm}\n >\n ${this.confirmLabel}\n </sp-button>\n `\n : nothing}\n </sp-dialog>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,aAAAC,MAAiB,kDAE1B,MAAO,+CACP,MAAO,mDAGP,MAAO,+CAEP,OAAS,cAAAC,MAAkB,kBAWpB,aAAM,sBAAsBA,CAAW,CAAvC,kCAMH,KAAO,MAAQ,GAGf,KAAO,YAAc,GAGrB,KAAO,aAAe,GAGtB,KAAO,aAAe,QAGtB,KAAO,OAAS,GAGhB,KAAO,KAAO,GAGd,KAAO,UAAY,GAGnB,KAAO,UAAY,GAMnB,KAAO,eAAiB,GAGxB,KAAO,SAAW,GAnClB,WAA2B,QAAyB,CAChD,MAAO,CAAC,GAAG,MAAM,MAAM,CAC3B,CAsCA,IAAuB,QAAiB,CACpC,OAAO,KAAK,WAAW,cAAc,WAAW,CACpD,CAEQ,gBAAuB,CAC3B,KAAK,cACD,IAAI,MAAM,YAAa,CACnB,QAAS,EACb,CAAC,CACL,CACJ,CAEQ,aAAoB,CACxB,KAAK,cACD,IAAI,MAAM,SAAU,CAChB,QAAS,EACb,CAAC,CACL,CACJ,CAEQ,cAAqB,CACzB,KAAK,cACD,IAAI,MAAM,UAAW,CACjB,QAAS,EACb,CAAC,CACL,CACJ,CAEmB,cAA+B,CAC9C,MAAMC,EACF,KAAK,WACL,CAAC,KAAK,UACN,KAAK,qBAAuB,OAehC,OAAOL;AAAA;AAAA,+BAEgB,KAAK,WAAW;AAAA,gCACf,KAAK,YAAY;AAAA,8BACnBK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