@spectrum-web-components/dialog 0.9.2-express.9 → 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.
@@ -1,293 +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/underlay/sp-underlay.js';
17
- import '@spectrum-web-components/button/sp-button.js';
18
- import '../sp-dialog.js';
19
- import modalWrapperStyles from '@spectrum-web-components/modal/src/modal-wrapper.css.js';
20
- import modalStyles from '@spectrum-web-components/modal/src/modal.css.js';
21
- import { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';
22
- import { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';
23
- /**
24
- * @element sp-dialog-wrapper
25
- *
26
- * @slot - content for the dialog
27
- * @fires secondary - Announces that the "secondary" button has been clicked.
28
- * @fires cancel - Announces that the "cancel" button has been clicked.
29
- * @fires confirm - Announces that the "confirm" button has been clicked.
30
- * @fires close - Announces that the dialog has been closed.
31
- */
32
- export class DialogWrapper extends FocusVisiblePolyfillMixin(SpectrumElement) {
33
- constructor() {
34
- super(...arguments);
35
- this.error = false;
36
- this.cancelLabel = '';
37
- this.confirmLabel = '';
38
- this.dismissable = false;
39
- this.footer = '';
40
- this.hero = '';
41
- this.heroLabel = '';
42
- this.noDivider = false;
43
- this.open = false;
44
- this.secondaryLabel = '';
45
- this.headline = '';
46
- this.responsive = false;
47
- this.transitionPromise = Promise.resolve();
48
- this.underlay = false;
49
- }
50
- static get styles() {
51
- return [modalWrapperStyles, modalStyles];
52
- }
53
- focus() {
54
- if (this.shadowRoot) {
55
- const firstFocusable = firstFocusableIn(this.dialog);
56
- if (firstFocusable) {
57
- if (firstFocusable.updateComplete) {
58
- firstFocusable.updateComplete.then(() => firstFocusable.focus());
59
- /* c8 ignore next 3 */
60
- }
61
- else {
62
- firstFocusable.focus();
63
- }
64
- this.removeAttribute('tabindex');
65
- }
66
- else {
67
- this.dialog.focus();
68
- }
69
- /* c8 ignore next 3 */
70
- }
71
- else {
72
- super.focus();
73
- }
74
- }
75
- overlayWillCloseCallback() {
76
- if (!this.open)
77
- return false;
78
- this.close();
79
- return true;
80
- }
81
- dismiss() {
82
- if (!this.dismissable) {
83
- return;
84
- }
85
- this.close();
86
- }
87
- clickSecondary() {
88
- this.dispatchEvent(new Event('secondary', {
89
- bubbles: true,
90
- }));
91
- }
92
- clickCancel() {
93
- this.dispatchEvent(new Event('cancel', {
94
- bubbles: true,
95
- }));
96
- }
97
- clickConfirm() {
98
- this.dispatchEvent(new Event('confirm', {
99
- bubbles: true,
100
- }));
101
- }
102
- handleClose(event) {
103
- event.stopPropagation();
104
- this.close();
105
- }
106
- close() {
107
- this.open = false;
108
- }
109
- dispatchClosed() {
110
- this.dispatchEvent(new Event('close', {
111
- bubbles: true,
112
- }));
113
- }
114
- handleUnderlayTransitionend() {
115
- if (!this.open) {
116
- this.dispatchClosed();
117
- this.resolveTransitionPromise();
118
- }
119
- }
120
- handleModalTransitionend() {
121
- if (this.open || !this.underlay) {
122
- this.resolveTransitionPromise();
123
- if (!this.open) {
124
- this.dispatchClosed();
125
- }
126
- }
127
- }
128
- update(changes) {
129
- if (changes.has('open') && changes.get('open') !== undefined) {
130
- this.transitionPromise = new Promise((res) => (this.resolveTransitionPromise = res));
131
- }
132
- super.update(changes);
133
- }
134
- render() {
135
- return html `
136
- ${this.underlay
137
- ? html `
138
- <sp-underlay
139
- ?open=${this.open}
140
- @click=${this.dismiss}
141
- @transitionend=${this.handleUnderlayTransitionend}
142
- ></sp-underlay>
143
- `
144
- : html ``}
145
- <div
146
- class="modal ${this.mode}"
147
- @transitionend=${this.handleModalTransitionend}
148
- >
149
- <sp-dialog
150
- ?dismissable=${this.dismissable}
151
- ?no-divider=${this.noDivider}
152
- ?error=${this.error}
153
- mode=${ifDefined(this.mode ? this.mode : undefined)}
154
- size=${ifDefined(this.size ? this.size : undefined)}
155
- @close=${this.handleClose}
156
- >
157
- ${this.hero
158
- ? html `
159
- <img
160
- src="${this.hero}"
161
- slot="hero"
162
- aria-hidden=${ifDefined(this.heroLabel ? undefined : 'true')}
163
- alt=${ifDefined(this.heroLabel
164
- ? this.heroLabel
165
- : undefined)}
166
- />
167
- `
168
- : html ``}
169
- ${this.headline
170
- ? html `
171
- <h2 slot="heading">${this.headline}</h2>
172
- `
173
- : html ``}
174
- <slot></slot>
175
- ${this.footer
176
- ? html `
177
- <div slot="footer">${this.footer}</div>
178
- `
179
- : html ``}
180
- ${this.secondaryLabel
181
- ? html `
182
- <sp-button
183
- variant="primary"
184
- treatment="outline"
185
- slot="button"
186
- @click=${this.clickSecondary}
187
- >
188
- ${this.secondaryLabel}
189
- </sp-button>
190
- `
191
- : html ``}
192
- ${this.cancelLabel
193
- ? html `
194
- <sp-button
195
- variant="secondary"
196
- treatment="outline"
197
- slot="button"
198
- @click=${this.clickCancel}
199
- >
200
- ${this.cancelLabel}
201
- </sp-button>
202
- `
203
- : html ``}
204
- ${this.confirmLabel
205
- ? html `
206
- <sp-button
207
- variant="accent"
208
- slot="button"
209
- @click=${this.clickConfirm}
210
- >
211
- ${this.confirmLabel}
212
- </sp-button>
213
- `
214
- : html ``}
215
- </sp-dialog>
216
- </div>
217
- `;
218
- }
219
- updated(changes) {
220
- if (changes.has('open')) {
221
- if (this.open) {
222
- this.dialog.updateComplete.then(() => {
223
- this.dialog.shouldManageTabOrderForScrolling();
224
- });
225
- }
226
- else {
227
- this.tabIndex = 0;
228
- }
229
- }
230
- }
231
- /**
232
- * Bind the open/close transition into the update complete lifecycle so
233
- * that the overlay system can wait for it to be "visibly ready" before
234
- * attempting to throw focus into the content contained herein. Not
235
- * waiting for this can cause small amounts of page scroll to happen
236
- * while opening the Tray when focusable content is included: e.g. Menu
237
- * elements whose selected Menu Item is not the first Menu Item.
238
- */
239
- async getUpdateComplete() {
240
- const complete = (await super.getUpdateComplete());
241
- await this.transitionPromise;
242
- return complete;
243
- }
244
- }
245
- __decorate([
246
- property({ type: Boolean, reflect: true })
247
- ], DialogWrapper.prototype, "error", void 0);
248
- __decorate([
249
- property({ attribute: 'cancel-label' })
250
- ], DialogWrapper.prototype, "cancelLabel", void 0);
251
- __decorate([
252
- property({ attribute: 'confirm-label' })
253
- ], DialogWrapper.prototype, "confirmLabel", void 0);
254
- __decorate([
255
- property({ type: Boolean, reflect: true })
256
- ], DialogWrapper.prototype, "dismissable", void 0);
257
- __decorate([
258
- property()
259
- ], DialogWrapper.prototype, "footer", void 0);
260
- __decorate([
261
- property()
262
- ], DialogWrapper.prototype, "hero", void 0);
263
- __decorate([
264
- property({ attribute: 'hero-label' })
265
- ], DialogWrapper.prototype, "heroLabel", void 0);
266
- __decorate([
267
- property({ type: Boolean, reflect: true, attribute: 'no-divider' })
268
- ], DialogWrapper.prototype, "noDivider", void 0);
269
- __decorate([
270
- property({ type: Boolean, reflect: true })
271
- ], DialogWrapper.prototype, "open", void 0);
272
- __decorate([
273
- property({ type: String, reflect: true })
274
- ], DialogWrapper.prototype, "mode", void 0);
275
- __decorate([
276
- property({ type: String, reflect: true })
277
- ], DialogWrapper.prototype, "size", void 0);
278
- __decorate([
279
- property({ attribute: 'secondary-label' })
280
- ], DialogWrapper.prototype, "secondaryLabel", void 0);
281
- __decorate([
282
- property()
283
- ], DialogWrapper.prototype, "headline", void 0);
284
- __decorate([
285
- property({ type: Boolean })
286
- ], DialogWrapper.prototype, "responsive", void 0);
287
- __decorate([
288
- property({ type: Boolean })
289
- ], DialogWrapper.prototype, "underlay", void 0);
290
- __decorate([
291
- query('sp-dialog')
292
- ], DialogWrapper.prototype, "dialog", void 0);
293
- //# sourceMappingURL=DialogWrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DialogWrapper.js","sourceRoot":"","sources":["DialogWrapper.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,kDAAkD,CAAC;AAC1D,OAAO,8CAA8C,CAAC;AAEtD,OAAO,iBAAiB,CAAC;AACzB,OAAO,kBAAkB,MAAM,yDAAyD,CAAC;AACzF,OAAO,WAAW,MAAM,iDAAiD,CAAC;AAE1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAE7F;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAc,SAAQ,yBAAyB,CAAC,eAAe,CAAC;IAA7E;;QAMW,UAAK,GAAG,KAAK,CAAC;QAGd,gBAAW,GAAG,EAAE,CAAC;QAGjB,iBAAY,GAAG,EAAE,CAAC;QAGlB,gBAAW,GAAG,KAAK,CAAC;QAGpB,WAAM,GAAG,EAAE,CAAC;QAGZ,SAAI,GAAG,EAAE,CAAC;QAGV,cAAS,GAAG,EAAE,CAAC;QAGf,cAAS,GAAG,KAAK,CAAC;QAGlB,SAAI,GAAG,KAAK,CAAC;QASb,mBAAc,GAAG,EAAE,CAAC;QAGpB,aAAQ,GAAG,EAAE,CAAC;QAGd,eAAU,GAAG,KAAK,CAAC;QAElB,sBAAiB,GAAG,OAAO,CA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ADC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;gDAChB;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;gDAC3C;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACvB;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACQ;AAGlD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACZ;AAG9B;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;qDAChB;AAG3B;IADC,QAAQ,EAAE;+CACU;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACF;AAO1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACJ;AAGxB;IADC,KAAK,CAAC,WAAW,CAAC;6CACK","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/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nimport '../sp-dialog.js';\nimport modalWrapperStyles from '@spectrum-web-components/modal/src/modal-wrapper.css.js';\nimport modalStyles from '@spectrum-web-components/modal/src/modal.css.js';\nimport { Dialog } from './Dialog.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\n\n/**\n * @element sp-dialog-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 FocusVisiblePolyfillMixin(SpectrumElement) {\n public static get styles(): CSSResultArray {\n return [modalWrapperStyles, modalStyles];\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({ type: Boolean, reflect: true })\n public dismissable = false;\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: Boolean, reflect: true })\n public open = 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 @property({ attribute: 'secondary-label' })\n public secondaryLabel = '';\n\n @property()\n public headline = '';\n\n @property({ type: Boolean })\n public responsive = false;\n\n private transitionPromise = Promise.resolve();\n\n private resolveTransitionPromise!: () => void;\n\n @property({ type: Boolean })\n public underlay = false;\n\n @query('sp-dialog')\n private dialog!: Dialog;\n\n public focus(): void {\n if (this.shadowRoot) {\n const firstFocusable = firstFocusableIn(this.dialog);\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 } else {\n this.dialog.focus();\n }\n /* c8 ignore next 3 */\n } else {\n super.focus();\n }\n }\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return false;\n this.close();\n return true;\n }\n\n private dismiss(): void {\n if (!this.dismissable) {\n return;\n }\n this.close();\n }\n\n 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 handleClose(event: Event): void {\n event.stopPropagation();\n this.close();\n }\n\n public close(): void {\n this.open = false;\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n protected handleUnderlayTransitionend(): void {\n if (!this.open) {\n this.dispatchClosed();\n this.resolveTransitionPromise();\n }\n }\n\n protected handleModalTransitionend(): void {\n if (this.open || !this.underlay) {\n this.resolveTransitionPromise();\n if (!this.open) {\n this.dispatchClosed();\n }\n }\n }\n\n protected update(changes: PropertyValues<this>): void {\n if (changes.has('open') && changes.get('open') !== undefined) {\n this.transitionPromise = new Promise(\n (res) => (this.resolveTransitionPromise = res)\n );\n }\n super.update(changes);\n }\n\n protected render(): TemplateResult {\n return html`\n ${this.underlay\n ? html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.dismiss}\n @transitionend=${this.handleUnderlayTransitionend}\n ></sp-underlay>\n `\n : html``}\n <div\n class=\"modal ${this.mode}\"\n @transitionend=${this.handleModalTransitionend}\n >\n <sp-dialog\n ?dismissable=${this.dismissable}\n ?no-divider=${this.noDivider}\n ?error=${this.error}\n mode=${ifDefined(this.mode ? this.mode : undefined)}\n size=${ifDefined(this.size ? this.size : undefined)}\n @close=${this.handleClose}\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\n ? this.heroLabel\n : undefined\n )}\n />\n `\n : html``}\n ${this.headline\n ? html`\n <h2 slot=\"heading\">${this.headline}</h2>\n `\n : html``}\n <slot></slot>\n ${this.footer\n ? html`\n <div slot=\"footer\">${this.footer}</div>\n `\n : html``}\n ${this.secondaryLabel\n ? html`\n <sp-button\n variant=\"primary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickSecondary}\n >\n ${this.secondaryLabel}\n </sp-button>\n `\n : html``}\n ${this.cancelLabel\n ? html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickCancel}\n >\n ${this.cancelLabel}\n </sp-button>\n `\n : html``}\n ${this.confirmLabel\n ? html`\n <sp-button\n variant=\"accent\"\n slot=\"button\"\n @click=${this.clickConfirm}\n >\n ${this.confirmLabel}\n </sp-button>\n `\n : html``}\n </sp-dialog>\n </div>\n `;\n }\n\n protected updated(changes: PropertyValues<this>): void {\n if (changes.has('open')) {\n if (this.open) {\n this.dialog.updateComplete.then(() => {\n this.dialog.shouldManageTabOrderForScrolling();\n });\n } else {\n this.tabIndex = 0;\n }\n }\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- declare const styles: import("@spectrum-web-components/base").CSSResult;
2
- export default styles;
package/src/dialog.css.js DELETED
@@ -1,106 +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 { css } from '@spectrum-web-components/base';
13
- const styles = css `
14
- :host{--spectrum-dialog-fullscreen-header-text-size:28px;--spectrum-dialog-confirm-small-width:400px;--spectrum-dialog-confirm-medium-width:480px;--spectrum-dialog-confirm-large-width:640px;--spectrum-dialog-error-width:var(--spectrum-dialog-confirm-medium-width);--spectrum-dialog-confirm-hero-height:var(
15
- --spectrum-global-dimension-size-1600
16
- );--spectrum-dialog-confirm-description-padding:var(
17
- --spectrum-global-dimension-size-25
18
- );--spectrum-dialog-confirm-description-margin:calc(var(--spectrum-global-dimension-size-25)*-1);--spectrum-dialog-confirm-footer-padding-top:var(
19
- --spectrum-global-dimension-static-size-500,40px
20
- );--spectrum-dialog-confirm-gap-size:var(
21
- --spectrum-global-dimension-size-200
22
- );--spectrum-dialog-confirm-buttongroup-padding-top:var(
23
- --spectrum-global-dimension-static-size-500,40px
24
- );--spectrum-dialog-confirm-close-button-size:var(
25
- --spectrum-global-dimension-size-400
26
- );--spectrum-dialog-confirm-close-button-padding:calc(26px - var(--spectrum-global-dimension-size-175));--spectrum-dialog-confirm-divider-height:var(
27
- --spectrum-global-dimension-static-size-25,2px
28
- )}:host{box-sizing:border-box;display:flex;max-height:inherit;max-width:100%;min-width:var(
29
- --spectrum-dialog-confirm-min-width,var(--spectrum-global-dimension-static-size-3600)
30
- );outline:none;width:-moz-fit-content;width:fit-content}:host([size=s]){width:var(
31
- --spectrum-dialog-confirm-small-width
32
- )}:host([size=m]){width:var(
33
- --spectrum-dialog-confirm-medium-width
34
- )}:host([size=l]){width:var(
35
- --spectrum-dialog-confirm-large-width
36
- )}::slotted([slot=hero]){background-position:50%;background-size:cover;border-top-left-radius:var(
37
- --spectrum-dialog-confirm-border-radius,var(--spectrum-alias-component-border-radius)
38
- );border-top-right-radius:var(
39
- --spectrum-dialog-confirm-border-radius,var(--spectrum-alias-component-border-radius)
40
- );grid-area:hero;height:var(--spectrum-dialog-confirm-hero-height);overflow:hidden}.grid{display:grid;grid-template-areas:"hero hero hero hero hero hero" ". . . . . ." ". heading header header typeIcon ." ". divider divider divider divider ." ". content content content content ." ". footer footer buttonGroup buttonGroup ." ". . . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto 1fr auto var(
41
- --spectrum-dialog-confirm-padding
42
- );width:100%}:host([dir=ltr]) ::slotted([slot=heading]){padding-right:var(
43
- --spectrum-dialog-confirm-gap-size
44
- )}:host([dir=rtl]) ::slotted([slot=heading]){padding-left:var(
45
- --spectrum-dialog-confirm-gap-size
46
- )}::slotted([slot=heading]){font-size:var(--spectrum-dialog-confirm-title-text-size);font-weight:var(
47
- --spectrum-dialog-confirm-title-text-font-weight,var(--spectrum-alias-heading-text-font-weight-regular)
48
- );grid-area:heading;line-height:var(
49
- --spectrum-dialog-confirm-title-text-line-height,var(--spectrum-alias-heading-text-line-height)
50
- );margin:0;outline:none}:host([dir=ltr]) .no-header::slotted([slot=heading]){padding-right:0}:host([dir=rtl]) .no-header::slotted([slot=heading]){padding-left:0}.no-header::slotted([slot=heading]){grid-area:heading-start/heading-start/header-end/header-end}.header{align-items:center;box-sizing:border-box;display:flex;grid-area:header;justify-content:flex-end;outline:none}.type-icon{grid-area:typeIcon}.divider{grid-area:divider;margin-bottom:var(
51
- --spectrum-dialog-confirm-divider-margin-bottom,var(--spectrum-global-dimension-static-size-200)
52
- );margin-top:var(
53
- --spectrum-dialog-confirm-divider-margin-top,var(--spectrum-global-dimension-static-size-150)
54
- );width:100%}:host([no-divider]) .divider{display:none}:host([no-divider]) ::slotted([slot=heading]){padding-bottom:calc(var(
55
- --spectrum-dialog-confirm-divider-margin-top,
56
- var(--spectrum-global-dimension-static-size-150)
57
- ) + var(
58
- --spectrum-dialog-confirm-divider-margin-bottom,
59
- var(--spectrum-global-dimension-static-size-200)
60
- ) + var(
61
- --spectrum-dialog-confirm-divider-height,
62
- var(--spectrum-global-dimension-size-25)
63
- ))}.content{-webkit-overflow-scrolling:touch;box-sizing:border-box;font-size:var(--spectrum-dialog-confirm-description-text-size);font-weight:var(
64
- --spectrum-dialog-confirm-description-text-font-weight,var(--spectrum-global-font-weight-regular)
65
- );grid-area:content;line-height:var(
66
- --spectrum-dialog-confirm-description-text-line-height,var(--spectrum-alias-component-text-line-height)
67
- );margin:0 var(--spectrum-dialog-confirm-description-margin);overflow-y:auto;padding:0 var(--spectrum-dialog-confirm-description-padding)}.content,.footer{outline:none}.footer{display:flex;flex-wrap:wrap;grid-area:footer;padding-top:var(--spectrum-dialog-confirm-footer-padding-top)}.footer>.button+.button,.footer>::slotted(*){margin-bottom:0}:host([dir=ltr]) .button-group{padding-left:var(
68
- --spectrum-dialog-confirm-gap-size
69
- )}:host([dir=rtl]) .button-group{padding-right:var(
70
- --spectrum-dialog-confirm-gap-size
71
- )}.button-group{display:flex;grid-area:buttonGroup;justify-content:flex-end;padding-top:var(--spectrum-dialog-confirm-buttongroup-padding-top)}.button-group.button-group--noFooter{grid-area:footer-start/footer-start/buttonGroup-end/buttonGroup-end}:host([dismissable]) .grid{grid-template-areas:"hero hero hero hero hero hero hero" ". . . . . closeButton closeButton" ". heading header header typeIcon closeButton closeButton" ". divider divider divider divider divider ." ". content content content content content ." ". footer footer buttonGroup buttonGroup buttonGroup ." ". . . . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) minmax(0,var(--spectrum-dialog-confirm-close-button-size)) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto 1fr auto var(
72
- --spectrum-dialog-confirm-padding
73
- )}:host([dismissable]) .grid .button-group{display:none}:host([dismissable]) .grid .footer{grid-area:footer/footer/buttonGroup/buttonGroup}:host([dir=ltr]) .close-button{margin-right:var(
74
- --spectrum-dialog-confirm-close-button-padding
75
- )}:host([dir=rtl]) .close-button{margin-left:var(
76
- --spectrum-dialog-confirm-close-button-padding
77
- )}.close-button{align-self:start;grid-area:closeButton;justify-self:end;margin-top:var(--spectrum-dialog-confirm-close-button-padding)}:host([error]){width:var(
78
- --spectrum-dialog-error-width,90%
79
- )}:host([mode=fullscreen]){height:100%;width:100%}:host([mode=fullscreenTakeover]){border-radius:0;height:100%;width:100%}:host([mode=fullscreenTakeover]),:host([mode=fullscreen]){max-height:none;max-width:none}:host([mode=fullscreenTakeover]) .grid,:host([mode=fullscreen]) .grid{display:grid;grid-template-areas:". . . . ." ". heading header buttonGroup ." ". divider divider divider ." ". content content content ." ". . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) 1fr auto auto var(
80
- --spectrum-dialog-confirm-padding
81
- );grid-template-rows:var(--spectrum-dialog-confirm-padding) auto auto 1fr var(
82
- --spectrum-dialog-confirm-padding
83
- )}:host([mode=fullscreenTakeover]) ::slotted([slot=heading]),:host([mode=fullscreen]) ::slotted([slot=heading]){font-size:var(
84
- --spectrum-dialog-fullscreen-header-text-size
85
- )}:host([mode=fullscreenTakeover]) .content,:host([mode=fullscreen]) .content{max-height:none}:host([mode=fullscreenTakeover]) .button-group,:host([mode=fullscreenTakeover]) .footer,:host([mode=fullscreen]) .button-group,:host([mode=fullscreen]) .footer{padding-top:0}:host([mode=fullscreenTakeover]) .footer,:host([mode=fullscreen]) .footer{display:none}:host([mode=fullscreenTakeover]) .button-group,:host([mode=fullscreen]) .button-group{align-self:start;grid-area:buttonGroup}@media screen and (max-width:700px){.grid{grid-template-areas:"hero hero hero hero hero hero" ". . . . . ." ". heading heading heading typeIcon ." ". header header header header ." ". divider divider divider divider ." ". content content content content ." ". footer footer buttonGroup buttonGroup ." ". . . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto auto 1fr auto var(
86
- --spectrum-dialog-confirm-padding
87
- )}:host([dismissable]) .grid{grid-template-areas:"hero hero hero hero hero hero hero" ". . . . . closeButton closeButton" ". heading heading heading typeIcon closeButton closeButton" ". header header header header header ." ". divider divider divider divider divider ." ". content content content content content ." ". footer footer buttonGroup buttonGroup buttonGroup ." ". . . . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) minmax(0,var(--spectrum-dialog-confirm-close-button-size)) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto auto 1fr auto var(
88
- --spectrum-dialog-confirm-padding
89
- )}.header{justify-content:flex-start}:host([mode=fullscreenTakeover]) .grid,:host([mode=fullscreen]) .grid{display:grid;grid-template-areas:". . ." ". heading ." ". header ." ". divider ." ". content ." ". buttonGroup ." ". . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) 1fr var(
90
- --spectrum-dialog-confirm-padding
91
- );grid-template-rows:var(--spectrum-dialog-confirm-padding) auto auto auto 1fr auto var(
92
- --spectrum-dialog-confirm-padding
93
- )}:host([mode=fullscreenTakeover]) .button-group,:host([mode=fullscreen]) .button-group{padding-top:var(--spectrum-dialog-confirm-buttongroup-padding-top)}:host([mode=fullscreenTakeover]) ::slotted([slot=heading]),:host([mode=fullscreen]) ::slotted([slot=heading]){font-size:var(--spectrum-dialog-confirm-title-text-size)}}@media (forced-colors:active){:host{border:solid}}::slotted([slot=heading]){color:var(
94
- --spectrum-dialog-confirm-title-text-color,var(--spectrum-alias-heading-text-color)
95
- )}.content,.footer{color:var(
96
- --spectrum-dialog-confirm-description-text-color,var(--spectrum-global-color-gray-800)
97
- )}.type-icon{color:var(
98
- --spectrum-dialog-confirm-icon-color,var(--spectrum-global-color-gray-900)
99
- )}:host([error]) .type-icon{color:var(
100
- --spectrum-dialog-error-icon-color,var(--spectrum-semantic-negative-icon-color)
101
- )}.content{overflow:hidden}.footer{color:var(
102
- --spectrum-dialog-confirm-description-text-color,var(--spectrum-global-color-gray-800)
103
- )}.content[tabindex]{overflow:auto}::slotted(img[slot=hero]){height:auto;width:100%}
104
- `;
105
- export default styles;
106
- //# sourceMappingURL=dialog.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dialog.css.js","sourceRoot":"","sources":["dialog.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2FjB,CAAC;AACF,eAAe,MAAM,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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-dialog-fullscreen-header-text-size:28px;--spectrum-dialog-confirm-small-width:400px;--spectrum-dialog-confirm-medium-width:480px;--spectrum-dialog-confirm-large-width:640px;--spectrum-dialog-error-width:var(--spectrum-dialog-confirm-medium-width);--spectrum-dialog-confirm-hero-height:var(\n--spectrum-global-dimension-size-1600\n);--spectrum-dialog-confirm-description-padding:var(\n--spectrum-global-dimension-size-25\n);--spectrum-dialog-confirm-description-margin:calc(var(--spectrum-global-dimension-size-25)*-1);--spectrum-dialog-confirm-footer-padding-top:var(\n--spectrum-global-dimension-static-size-500,40px\n);--spectrum-dialog-confirm-gap-size:var(\n--spectrum-global-dimension-size-200\n);--spectrum-dialog-confirm-buttongroup-padding-top:var(\n--spectrum-global-dimension-static-size-500,40px\n);--spectrum-dialog-confirm-close-button-size:var(\n--spectrum-global-dimension-size-400\n);--spectrum-dialog-confirm-close-button-padding:calc(26px - var(--spectrum-global-dimension-size-175));--spectrum-dialog-confirm-divider-height:var(\n--spectrum-global-dimension-static-size-25,2px\n)}:host{box-sizing:border-box;display:flex;max-height:inherit;max-width:100%;min-width:var(\n--spectrum-dialog-confirm-min-width,var(--spectrum-global-dimension-static-size-3600)\n);outline:none;width:-moz-fit-content;width:fit-content}:host([size=s]){width:var(\n--spectrum-dialog-confirm-small-width\n)}:host([size=m]){width:var(\n--spectrum-dialog-confirm-medium-width\n)}:host([size=l]){width:var(\n--spectrum-dialog-confirm-large-width\n)}::slotted([slot=hero]){background-position:50%;background-size:cover;border-top-left-radius:var(\n--spectrum-dialog-confirm-border-radius,var(--spectrum-alias-component-border-radius)\n);border-top-right-radius:var(\n--spectrum-dialog-confirm-border-radius,var(--spectrum-alias-component-border-radius)\n);grid-area:hero;height:var(--spectrum-dialog-confirm-hero-height);overflow:hidden}.grid{display:grid;grid-template-areas:\"hero hero hero hero hero hero\" \". . . . . .\" \". heading header header typeIcon .\" \". divider divider divider divider .\" \". content content content content .\" \". footer footer buttonGroup buttonGroup .\" \". . . . . .\";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto 1fr auto var(\n--spectrum-dialog-confirm-padding\n);width:100%}:host([dir=ltr]) ::slotted([slot=heading]){padding-right:var(\n--spectrum-dialog-confirm-gap-size\n)}:host([dir=rtl]) ::slotted([slot=heading]){padding-left:var(\n--spectrum-dialog-confirm-gap-size\n)}::slotted([slot=heading]){font-size:var(--spectrum-dialog-confirm-title-text-size);font-weight:var(\n--spectrum-dialog-confirm-title-text-font-weight,var(--spectrum-alias-heading-text-font-weight-regular)\n);grid-area:heading;line-height:var(\n--spectrum-dialog-confirm-title-text-line-height,var(--spectrum-alias-heading-text-line-height)\n);margin:0;outline:none}:host([dir=ltr]) .no-header::slotted([slot=heading]){padding-right:0}:host([dir=rtl]) .no-header::slotted([slot=heading]){padding-left:0}.no-header::slotted([slot=heading]){grid-area:heading-start/heading-start/header-end/header-end}.header{align-items:center;box-sizing:border-box;display:flex;grid-area:header;justify-content:flex-end;outline:none}.type-icon{grid-area:typeIcon}.divider{grid-area:divider;margin-bottom:var(\n--spectrum-dialog-confirm-divider-margin-bottom,var(--spectrum-global-dimension-static-size-200)\n);margin-top:var(\n--spectrum-dialog-confirm-divider-margin-top,var(--spectrum-global-dimension-static-size-150)\n);width:100%}:host([no-divider]) .divider{display:none}:host([no-divider]) ::slotted([slot=heading]){padding-bottom:calc(var(\n--spectrum-dialog-confirm-divider-margin-top,\nvar(--spectrum-global-dimension-static-size-150)\n) + var(\n--spectrum-dialog-confirm-divider-margin-bottom,\nvar(--spectrum-global-dimension-static-size-200)\n) + var(\n--spectrum-dialog-confirm-divider-height,\nvar(--spectrum-global-dimension-size-25)\n))}.content{-webkit-overflow-scrolling:touch;box-sizing:border-box;font-size:var(--spectrum-dialog-confirm-description-text-size);font-weight:var(\n--spectrum-dialog-confirm-description-text-font-weight,var(--spectrum-global-font-weight-regular)\n);grid-area:content;line-height:var(\n--spectrum-dialog-confirm-description-text-line-height,var(--spectrum-alias-component-text-line-height)\n);margin:0 var(--spectrum-dialog-confirm-description-margin);overflow-y:auto;padding:0 var(--spectrum-dialog-confirm-description-padding)}.content,.footer{outline:none}.footer{display:flex;flex-wrap:wrap;grid-area:footer;padding-top:var(--spectrum-dialog-confirm-footer-padding-top)}.footer>.button+.button,.footer>::slotted(*){margin-bottom:0}:host([dir=ltr]) .button-group{padding-left:var(\n--spectrum-dialog-confirm-gap-size\n)}:host([dir=rtl]) .button-group{padding-right:var(\n--spectrum-dialog-confirm-gap-size\n)}.button-group{display:flex;grid-area:buttonGroup;justify-content:flex-end;padding-top:var(--spectrum-dialog-confirm-buttongroup-padding-top)}.button-group.button-group--noFooter{grid-area:footer-start/footer-start/buttonGroup-end/buttonGroup-end}:host([dismissable]) .grid{grid-template-areas:\"hero hero hero hero hero hero hero\" \". . . . . closeButton closeButton\" \". heading header header typeIcon closeButton closeButton\" \". divider divider divider divider divider .\" \". content content content content content .\" \". footer footer buttonGroup buttonGroup buttonGroup .\" \". . . . . . .\";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) minmax(0,var(--spectrum-dialog-confirm-close-button-size)) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto 1fr auto var(\n--spectrum-dialog-confirm-padding\n)}:host([dismissable]) .grid .button-group{display:none}:host([dismissable]) .grid .footer{grid-area:footer/footer/buttonGroup/buttonGroup}:host([dir=ltr]) .close-button{margin-right:var(\n--spectrum-dialog-confirm-close-button-padding\n)}:host([dir=rtl]) .close-button{margin-left:var(\n--spectrum-dialog-confirm-close-button-padding\n)}.close-button{align-self:start;grid-area:closeButton;justify-self:end;margin-top:var(--spectrum-dialog-confirm-close-button-padding)}:host([error]){width:var(\n--spectrum-dialog-error-width,90%\n)}:host([mode=fullscreen]){height:100%;width:100%}:host([mode=fullscreenTakeover]){border-radius:0;height:100%;width:100%}:host([mode=fullscreenTakeover]),:host([mode=fullscreen]){max-height:none;max-width:none}:host([mode=fullscreenTakeover]) .grid,:host([mode=fullscreen]) .grid{display:grid;grid-template-areas:\". . . . .\" \". heading header buttonGroup .\" \". divider divider divider .\" \". content content content .\" \". . . . .\";grid-template-columns:var(--spectrum-dialog-confirm-padding) 1fr auto auto var(\n--spectrum-dialog-confirm-padding\n);grid-template-rows:var(--spectrum-dialog-confirm-padding) auto auto 1fr var(\n--spectrum-dialog-confirm-padding\n)}:host([mode=fullscreenTakeover]) ::slotted([slot=heading]),:host([mode=fullscreen]) ::slotted([slot=heading]){font-size:var(\n--spectrum-dialog-fullscreen-header-text-size\n)}:host([mode=fullscreenTakeover]) .content,:host([mode=fullscreen]) .content{max-height:none}:host([mode=fullscreenTakeover]) .button-group,:host([mode=fullscreenTakeover]) .footer,:host([mode=fullscreen]) .button-group,:host([mode=fullscreen]) .footer{padding-top:0}:host([mode=fullscreenTakeover]) .footer,:host([mode=fullscreen]) .footer{display:none}:host([mode=fullscreenTakeover]) .button-group,:host([mode=fullscreen]) .button-group{align-self:start;grid-area:buttonGroup}@media screen and (max-width:700px){.grid{grid-template-areas:\"hero hero hero hero hero hero\" \". . . . . .\" \". heading heading heading typeIcon .\" \". header header header header .\" \". divider divider divider divider .\" \". content content content content .\" \". footer footer buttonGroup buttonGroup .\" \". . . . . .\";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto auto 1fr auto var(\n--spectrum-dialog-confirm-padding\n)}:host([dismissable]) .grid{grid-template-areas:\"hero hero hero hero hero hero hero\" \". . . . . closeButton closeButton\" \". heading heading heading typeIcon closeButton closeButton\" \". header header header header header .\" \". divider divider divider divider divider .\" \". content content content content content .\" \". footer footer buttonGroup buttonGroup buttonGroup .\" \". . . . . . .\";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) minmax(0,var(--spectrum-dialog-confirm-close-button-size)) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto auto 1fr auto var(\n--spectrum-dialog-confirm-padding\n)}.header{justify-content:flex-start}:host([mode=fullscreenTakeover]) .grid,:host([mode=fullscreen]) .grid{display:grid;grid-template-areas:\". . .\" \". heading .\" \". header .\" \". divider .\" \". content .\" \". buttonGroup .\" \". . .\";grid-template-columns:var(--spectrum-dialog-confirm-padding) 1fr var(\n--spectrum-dialog-confirm-padding\n);grid-template-rows:var(--spectrum-dialog-confirm-padding) auto auto auto 1fr auto var(\n--spectrum-dialog-confirm-padding\n)}:host([mode=fullscreenTakeover]) .button-group,:host([mode=fullscreen]) .button-group{padding-top:var(--spectrum-dialog-confirm-buttongroup-padding-top)}:host([mode=fullscreenTakeover]) ::slotted([slot=heading]),:host([mode=fullscreen]) ::slotted([slot=heading]){font-size:var(--spectrum-dialog-confirm-title-text-size)}}@media (forced-colors:active){:host{border:solid}}::slotted([slot=heading]){color:var(\n--spectrum-dialog-confirm-title-text-color,var(--spectrum-alias-heading-text-color)\n)}.content,.footer{color:var(\n--spectrum-dialog-confirm-description-text-color,var(--spectrum-global-color-gray-800)\n)}.type-icon{color:var(\n--spectrum-dialog-confirm-icon-color,var(--spectrum-global-color-gray-900)\n)}:host([error]) .type-icon{color:var(\n--spectrum-dialog-error-icon-color,var(--spectrum-semantic-negative-icon-color)\n)}.content{overflow:hidden}.footer{color:var(\n--spectrum-dialog-confirm-description-text-color,var(--spectrum-global-color-gray-800)\n)}.content[tabindex]{overflow:auto}::slotted(img[slot=hero]){height:auto;width:100%}\n`;\nexport default styles;"]}
package/src/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './Dialog.js';
2
- export * from './DialogWrapper.js';
package/src/index.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
- export * from './Dialog.js';
13
- export * from './DialogWrapper.js';
14
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,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*/\nexport * from './Dialog.js';\nexport * from './DialogWrapper.js';\n"]}
@@ -1,2 +0,0 @@
1
- declare const styles: import("@spectrum-web-components/base").CSSResult;
2
- export default styles;
@@ -1,104 +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 { css } from '@spectrum-web-components/base';
13
- const styles = css `
14
- :host{--spectrum-dialog-fullscreen-header-text-size:28px;--spectrum-dialog-confirm-small-width:400px;--spectrum-dialog-confirm-medium-width:480px;--spectrum-dialog-confirm-large-width:640px;--spectrum-dialog-error-width:var(--spectrum-dialog-confirm-medium-width);--spectrum-dialog-confirm-hero-height:var(
15
- --spectrum-global-dimension-size-1600
16
- );--spectrum-dialog-confirm-description-padding:var(
17
- --spectrum-global-dimension-size-25
18
- );--spectrum-dialog-confirm-description-margin:calc(var(--spectrum-global-dimension-size-25)*-1);--spectrum-dialog-confirm-footer-padding-top:var(
19
- --spectrum-global-dimension-static-size-500,40px
20
- );--spectrum-dialog-confirm-gap-size:var(
21
- --spectrum-global-dimension-size-200
22
- );--spectrum-dialog-confirm-buttongroup-padding-top:var(
23
- --spectrum-global-dimension-static-size-500,40px
24
- );--spectrum-dialog-confirm-close-button-size:var(
25
- --spectrum-global-dimension-size-400
26
- );--spectrum-dialog-confirm-close-button-padding:calc(26px - var(--spectrum-global-dimension-size-175));--spectrum-dialog-confirm-divider-height:var(
27
- --spectrum-global-dimension-static-size-25,2px
28
- )}:host{box-sizing:border-box;display:flex;max-height:inherit;max-width:100%;min-width:var(
29
- --spectrum-dialog-confirm-min-width,var(--spectrum-global-dimension-static-size-3600)
30
- );outline:none;width:-moz-fit-content;width:fit-content}:host([size=s]){width:var(
31
- --spectrum-dialog-confirm-small-width
32
- )}:host([size=m]){width:var(
33
- --spectrum-dialog-confirm-medium-width
34
- )}:host([size=l]){width:var(
35
- --spectrum-dialog-confirm-large-width
36
- )}::slotted([slot=hero]){background-position:50%;background-size:cover;border-top-left-radius:var(
37
- --spectrum-dialog-confirm-border-radius,var(--spectrum-alias-component-border-radius)
38
- );border-top-right-radius:var(
39
- --spectrum-dialog-confirm-border-radius,var(--spectrum-alias-component-border-radius)
40
- );grid-area:hero;height:var(--spectrum-dialog-confirm-hero-height);overflow:hidden}.grid{display:grid;grid-template-areas:"hero hero hero hero hero hero" ". . . . . ." ". heading header header typeIcon ." ". divider divider divider divider ." ". content content content content ." ". footer footer buttonGroup buttonGroup ." ". . . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto 1fr auto var(
41
- --spectrum-dialog-confirm-padding
42
- );width:100%}:host([dir=ltr]) ::slotted([slot=heading]){padding-right:var(
43
- --spectrum-dialog-confirm-gap-size
44
- )}:host([dir=rtl]) ::slotted([slot=heading]){padding-left:var(
45
- --spectrum-dialog-confirm-gap-size
46
- )}::slotted([slot=heading]){font-size:var(--spectrum-dialog-confirm-title-text-size);font-weight:var(
47
- --spectrum-dialog-confirm-title-text-font-weight,var(--spectrum-alias-heading-text-font-weight-regular)
48
- );grid-area:heading;line-height:var(
49
- --spectrum-dialog-confirm-title-text-line-height,var(--spectrum-alias-heading-text-line-height)
50
- );margin:0;outline:none}:host([dir=ltr]) .no-header::slotted([slot=heading]){padding-right:0}:host([dir=rtl]) .no-header::slotted([slot=heading]){padding-left:0}.no-header::slotted([slot=heading]){grid-area:heading-start/heading-start/header-end/header-end}.header{align-items:center;box-sizing:border-box;display:flex;grid-area:header;justify-content:flex-end;outline:none}.type-icon{grid-area:typeIcon}.divider{grid-area:divider;margin-bottom:var(
51
- --spectrum-dialog-confirm-divider-margin-bottom,var(--spectrum-global-dimension-static-size-200)
52
- );margin-top:var(
53
- --spectrum-dialog-confirm-divider-margin-top,var(--spectrum-global-dimension-static-size-150)
54
- );width:100%}:host([no-divider]) .divider{display:none}:host([no-divider]) ::slotted([slot=heading]){padding-bottom:calc(var(
55
- --spectrum-dialog-confirm-divider-margin-top,
56
- var(--spectrum-global-dimension-static-size-150)
57
- ) + var(
58
- --spectrum-dialog-confirm-divider-margin-bottom,
59
- var(--spectrum-global-dimension-static-size-200)
60
- ) + var(
61
- --spectrum-dialog-confirm-divider-height,
62
- var(--spectrum-global-dimension-size-25)
63
- ))}.content{-webkit-overflow-scrolling:touch;box-sizing:border-box;font-size:var(--spectrum-dialog-confirm-description-text-size);font-weight:var(
64
- --spectrum-dialog-confirm-description-text-font-weight,var(--spectrum-global-font-weight-regular)
65
- );grid-area:content;line-height:var(
66
- --spectrum-dialog-confirm-description-text-line-height,var(--spectrum-alias-component-text-line-height)
67
- );margin:0 var(--spectrum-dialog-confirm-description-margin);overflow-y:auto;padding:0 var(--spectrum-dialog-confirm-description-padding)}.content,.footer{outline:none}.footer{display:flex;flex-wrap:wrap;grid-area:footer;padding-top:var(--spectrum-dialog-confirm-footer-padding-top)}.footer>.button+.button,.footer>::slotted(*){margin-bottom:0}:host([dir=ltr]) .button-group{padding-left:var(
68
- --spectrum-dialog-confirm-gap-size
69
- )}:host([dir=rtl]) .button-group{padding-right:var(
70
- --spectrum-dialog-confirm-gap-size
71
- )}.button-group{display:flex;grid-area:buttonGroup;justify-content:flex-end;padding-top:var(--spectrum-dialog-confirm-buttongroup-padding-top)}.button-group.button-group--noFooter{grid-area:footer-start/footer-start/buttonGroup-end/buttonGroup-end}:host([dismissable]) .grid{grid-template-areas:"hero hero hero hero hero hero hero" ". . . . . closeButton closeButton" ". heading header header typeIcon closeButton closeButton" ". divider divider divider divider divider ." ". content content content content content ." ". footer footer buttonGroup buttonGroup buttonGroup ." ". . . . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) minmax(0,var(--spectrum-dialog-confirm-close-button-size)) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto 1fr auto var(
72
- --spectrum-dialog-confirm-padding
73
- )}:host([dismissable]) .grid .button-group{display:none}:host([dismissable]) .grid .footer{grid-area:footer/footer/buttonGroup/buttonGroup}:host([dir=ltr]) .close-button{margin-right:var(
74
- --spectrum-dialog-confirm-close-button-padding
75
- )}:host([dir=rtl]) .close-button{margin-left:var(
76
- --spectrum-dialog-confirm-close-button-padding
77
- )}.close-button{align-self:start;grid-area:closeButton;justify-self:end;margin-top:var(--spectrum-dialog-confirm-close-button-padding)}:host([error]){width:var(
78
- --spectrum-dialog-error-width,90%
79
- )}:host([mode=fullscreen]){height:100%;width:100%}:host([mode=fullscreenTakeover]){border-radius:0;height:100%;width:100%}:host([mode=fullscreenTakeover]),:host([mode=fullscreen]){max-height:none;max-width:none}:host([mode=fullscreenTakeover]) .grid,:host([mode=fullscreen]) .grid{display:grid;grid-template-areas:". . . . ." ". heading header buttonGroup ." ". divider divider divider ." ". content content content ." ". . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) 1fr auto auto var(
80
- --spectrum-dialog-confirm-padding
81
- );grid-template-rows:var(--spectrum-dialog-confirm-padding) auto auto 1fr var(
82
- --spectrum-dialog-confirm-padding
83
- )}:host([mode=fullscreenTakeover]) ::slotted([slot=heading]),:host([mode=fullscreen]) ::slotted([slot=heading]){font-size:var(
84
- --spectrum-dialog-fullscreen-header-text-size
85
- )}:host([mode=fullscreenTakeover]) .content,:host([mode=fullscreen]) .content{max-height:none}:host([mode=fullscreenTakeover]) .button-group,:host([mode=fullscreenTakeover]) .footer,:host([mode=fullscreen]) .button-group,:host([mode=fullscreen]) .footer{padding-top:0}:host([mode=fullscreenTakeover]) .footer,:host([mode=fullscreen]) .footer{display:none}:host([mode=fullscreenTakeover]) .button-group,:host([mode=fullscreen]) .button-group{align-self:start;grid-area:buttonGroup}@media screen and (max-width:700px){.grid{grid-template-areas:"hero hero hero hero hero hero" ". . . . . ." ". heading heading heading typeIcon ." ". header header header header ." ". divider divider divider divider ." ". content content content content ." ". footer footer buttonGroup buttonGroup ." ". . . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto auto 1fr auto var(
86
- --spectrum-dialog-confirm-padding
87
- )}:host([dismissable]) .grid{grid-template-areas:"hero hero hero hero hero hero hero" ". . . . . closeButton closeButton" ". heading heading heading typeIcon closeButton closeButton" ". header header header header header ." ". divider divider divider divider divider ." ". content content content content content ." ". footer footer buttonGroup buttonGroup buttonGroup ." ". . . . . . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0,auto) minmax(0,var(--spectrum-dialog-confirm-close-button-size)) var(--spectrum-dialog-confirm-padding);grid-template-rows:auto var(--spectrum-dialog-confirm-padding) auto auto auto 1fr auto var(
88
- --spectrum-dialog-confirm-padding
89
- )}.header{justify-content:flex-start}:host([mode=fullscreenTakeover]) .grid,:host([mode=fullscreen]) .grid{display:grid;grid-template-areas:". . ." ". heading ." ". header ." ". divider ." ". content ." ". buttonGroup ." ". . .";grid-template-columns:var(--spectrum-dialog-confirm-padding) 1fr var(
90
- --spectrum-dialog-confirm-padding
91
- );grid-template-rows:var(--spectrum-dialog-confirm-padding) auto auto auto 1fr auto var(
92
- --spectrum-dialog-confirm-padding
93
- )}:host([mode=fullscreenTakeover]) .button-group,:host([mode=fullscreen]) .button-group{padding-top:var(--spectrum-dialog-confirm-buttongroup-padding-top)}:host([mode=fullscreenTakeover]) ::slotted([slot=heading]),:host([mode=fullscreen]) ::slotted([slot=heading]){font-size:var(--spectrum-dialog-confirm-title-text-size)}}@media (forced-colors:active){:host{border:solid}}::slotted([slot=heading]){color:var(
94
- --spectrum-dialog-confirm-title-text-color,var(--spectrum-alias-heading-text-color)
95
- )}.content,.footer{color:var(
96
- --spectrum-dialog-confirm-description-text-color,var(--spectrum-global-color-gray-800)
97
- )}.type-icon{color:var(
98
- --spectrum-dialog-confirm-icon-color,var(--spectrum-global-color-gray-900)
99
- )}:host([error]) .type-icon{color:var(
100
- --spectrum-dialog-error-icon-color,var(--spectrum-semantic-negative-icon-color)
101
- )}
102
- `;
103
- export default styles;
104
- //# sourceMappingURL=spectrum-dialog.css.js.map