@aurodesignsystem/auro-dialog 2.0.1 → 2.2.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/demo/index.min.js CHANGED
@@ -1,3 +1,11 @@
1
+ import AuroLibraryRuntimeUtils from '@aurodesignsystem/auro-library/scripts/utils/runtimeUtils.mjs';
2
+ import { css, LitElement } from 'lit';
3
+ import { html } from 'lit/static-html.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import { AuroDependencyVersioning } from '@aurodesignsystem/auro-library/scripts/runtime/dependencyTagVersioning.mjs';
6
+ import { AuroButton } from '@aurodesignsystem/auro-button/src/auro-button.js';
7
+ import { AuroIcon } from '@aurodesignsystem/auro-icon/src/auro-icon.js';
8
+
1
9
  function initBasicExample() {
2
10
  const buttons = [document.querySelector('#openBasic'), document.querySelector('#closeBasic')];
3
11
  const dialog = document.querySelector('#defaultDialog');
@@ -28,6 +36,337 @@ function initCustomExample() {
28
36
  });
29
37
  }
30
38
 
39
+ var styleCss = css`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.heading{margin:1.75rem 0;letter-spacing:var(--ds-text-heading-default-spacing, -0.2px);font-weight:var(--ds-text-heading-default-weight, 500)}.heading--display{margin-top:0;font-size:var(--ds-text-heading-display-size-breakpoint-sm, 2.75rem);font-weight:var(--ds-text-heading-display-weight, 100);line-height:var(--ds-text-heading-display-height-breakpoint-sm, 3.375rem)}@media screen and (min-width: 768px){.heading--display{font-size:var(--ds-text-heading-display-size-breakpoint-md, 3rem);line-height:var(--ds-text-heading-display-height-breakpoint-md, 3.75rem)}}@media screen and (min-width: 1024px){.heading--display{font-size:var(--ds-text-heading-display-size-breakpoint-lg, 3.5rem);line-height:var(--ds-text-heading-display-height-breakpoint-lg, 4.25rem)}}.heading--800{font-size:var(--ds-text-heading-800-size-breakpoint-sm, 2rem);font-weight:var(--ds-text-heading-800-weight, 500);line-height:var(--ds-text-heading-800-height-breakpoint-sm, 2.375rem)}@media screen and (min-width: 768px){.heading--800{font-size:var(--ds-text-heading-800-size-breakpoint-md, 2.25rem);line-height:var(--ds-text-heading-800-height-breakpoint-md, 2.625rem)}}@media screen and (min-width: 1024px){.heading--800{font-size:var(--ds-text-heading-800-size-breakpoint-lg, 2.5rem);line-height:var(--ds-text-heading-800-height-breakpoint-lg, 3rem)}}.heading--700{font-size:var(--ds-text-heading-700-size-breakpoint-sm, 1.75rem);font-weight:var(--ds-text-heading-700-weight, 500);line-height:var(--ds-text-heading-700-height-breakpoint-sm, 2.125rem)}@media screen and (min-width: 768px){.heading--700{font-size:var(--ds-text-heading-700-size-breakpoint-md, 2rem);line-height:var(--ds-text-heading-700-height-breakpoint-md, 2.375rem)}}@media screen and (min-width: 1024px){.heading--700{font-size:var(--ds-text-heading-700-size-breakpoint-lg, 2.25rem);line-height:var(--ds-text-heading-700-height-breakpoint-lg, 2.75rem)}}.heading--600{margin:1rem 0;font-size:var(--ds-text-heading-600-size-breakpoint-sm, 1.625rem);font-weight:var(--ds-text-heading-600-weight, 300);line-height:var(--ds-text-heading-600-height-breakpoint-sm, 1.875rem)}@media screen and (min-width: 768px){.heading--600{font-size:var(--ds-text-heading-600-size-breakpoint-md, 1.75rem);line-height:var(--ds-text-heading-600-height-breakpoint-md, 2.125rem)}}@media screen and (min-width: 1024px){.heading--600{font-size:var(--ds-text-heading-600-size-breakpoint-lg, 1.75rem);line-height:var(--ds-text-heading-600-height-breakpoint-lg, 2.25rem)}}.heading--500{margin:1rem 0;font-size:var(--ds-text-heading-500-size-breakpoint-sm, 1.375rem);font-weight:var(--ds-text-heading-500-weight, 300);line-height:var(--ds-text-heading-500-height-breakpoint-sm, 1.625rem)}@media screen and (min-width: 768px){.heading--500{font-size:var(--ds-text-heading-500-size-breakpoint-md, 1.5rem);line-height:var(--ds-text-heading-500-height-breakpoint-md, 1.875rem)}}@media screen and (min-width: 1024px){.heading--500{font-size:var(--ds-text-heading-500-size-breakpoint-lg, 1.5rem);line-height:var(--ds-text-heading-500-height-breakpoint-lg, 2rem)}}.heading--400{margin:.75rem 0;font-size:var(--ds-text-heading-400-size, 1.25rem);font-weight:var(--ds-text-heading-400-weight, 300);line-height:var(--ds-text-heading-400-height, 1.625rem)}.heading--300{margin:.75rem 0;font-size:var(--ds-text-heading-300-size, 1.125rem);font-weight:var(--ds-text-heading-300-weight, 300);line-height:var(--ds-text-heading-300-height, 1.625rem)}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}.util_inlinePaddingNone--left{padding-left:0}.util_inlinePaddingNone--right{padding-right:0}.util_inlineMarginNone--left{margin-left:0}.util_inlineMarginNone--right{margin-right:0}.util_inlinePadding25--left{padding-left:.125rem}.util_inlinePadding25--right{padding-right:.125rem}.util_inlineMargin25--left{margin-left:.125rem}.util_inlineMargin25--right{margin-right:.125rem}.util_inlinePadding50--left{padding-left:.25rem}.util_inlinePadding50--right{padding-right:.25rem}.util_inlineMargin50--left{margin-left:.25rem}.util_inlineMargin50--right{margin-right:.25rem}.util_inlinePadding100--left{padding-left:.5rem}.util_inlinePadding100--right{padding-right:.5rem}.util_inlineMargin100--left{margin-left:.5rem}.util_inlineMargin100--right{margin-right:.5rem}.util_inlinePadding200--left{padding-left:1rem}.util_inlinePadding200--right{padding-right:1rem}.util_inlineMargin200--left{margin-left:1rem}.util_inlineMargin200--right{margin-right:1rem}.util_inlinePadding300--left{padding-left:1.5rem}.util_inlinePadding300--right{padding-right:1.5rem}.util_inlineMargin300--left{margin-left:1.5rem}.util_inlineMargin300--right{margin-right:1.5rem}.util_inlinePadding400--left{padding-left:2rem}.util_inlinePadding400--right{padding-right:2rem}.util_inlineMargin400--left{margin-left:2rem}.util_inlineMargin400--right{margin-right:2rem}.util_inlinePadding500--left{padding-left:2.5rem}.util_inlinePadding500--right{padding-right:2.5rem}.util_inlineMargin500--left{margin-left:2.5rem}.util_inlineMargin500--right{margin-right:2.5rem}.util_inlinePadding600--left{padding-left:3rem}.util_inlinePadding600--right{padding-right:3rem}.util_inlineMargin600--left{margin-left:3rem}.util_inlineMargin600--right{margin-right:3rem}.util_inlinePadding700--left{padding-left:3.5rem}.util_inlinePadding700--right{padding-right:3.5rem}.util_inlineMargin700--left{margin-left:3.5rem}.util_inlineMargin700--right{margin-right:3.5rem}.util_inlinePadding800--left{padding-left:4rem}.util_inlinePadding800--right{padding-right:4rem}.util_inlineMargin800--left{margin-left:4rem}.util_inlineMargin800--right{margin-right:4rem}.util_inlinePadding900--left{padding-left:4.5rem}.util_inlinePadding900--right{padding-right:4.5rem}.util_inlineMargin900--left{margin-left:4.5rem}.util_inlineMargin900--right{margin-right:4.5rem}.util_inlinePadding1000--left{padding-left:5rem}.util_inlinePadding1000--right{padding-right:5rem}.util_inlineMargin1000--left{margin-left:5rem}.util_inlineMargin1000--right{margin-right:5rem}.util_stackPaddingNone--top{padding-top:0}.util_stackPaddingNone--bottom{padding-bottom:0}.util_stackMarginNone--top{margin-top:0}.util_stackMarginNone--bottom{margin-bottom:0}.util_stackPadding25--top{padding-top:.125rem}.util_stackPadding25--bottom{padding-bottom:.125rem}.util_stackMargin25--top{margin-top:.125rem}.util_stackMargin25--bottom{margin-bottom:.125rem}.util_stackPadding50--top{padding-top:.25rem}.util_stackPadding50--bottom{padding-bottom:.25rem}.util_stackMargin50--top{margin-top:.25rem}.util_stackMargin50--bottom{margin-bottom:.25rem}.util_stackPadding100--top{padding-top:.5rem}.util_stackPadding100--bottom{padding-bottom:.5rem}.util_stackMargin100--top{margin-top:.5rem}.util_stackMargin100--bottom{margin-bottom:.5rem}.util_stackPadding200--top{padding-top:1rem}.util_stackPadding200--bottom{padding-bottom:1rem}.util_stackMargin200--top{margin-top:1rem}.util_stackMargin200--bottom{margin-bottom:1rem}.util_stackPadding300--top{padding-top:1.5rem}.util_stackPadding300--bottom{padding-bottom:1.5rem}.util_stackMargin300--top{margin-top:1.5rem}.util_stackMargin300--bottom{margin-bottom:1.5rem}.util_stackPadding400--top{padding-top:2rem}.util_stackPadding400--bottom{padding-bottom:2rem}.util_stackMargin400--top{margin-top:2rem}.util_stackMargin400--bottom{margin-bottom:2rem}.util_stackPadding500--top{padding-top:2.5rem}.util_stackPadding500--bottom{padding-bottom:2.5rem}.util_stackMargin500--top{margin-top:2.5rem}.util_stackMargin500--bottom{margin-bottom:2.5rem}.util_stackPadding600--top{padding-top:3rem}.util_stackPadding600--bottom{padding-bottom:3rem}.util_stackMargin600--top{margin-top:3rem}.util_stackMargin600--bottom{margin-bottom:3rem}.util_stackPadding700--top{padding-top:3.5rem}.util_stackPadding700--bottom{padding-bottom:3.5rem}.util_stackMargin700--top{margin-top:3.5rem}.util_stackMargin700--bottom{margin-bottom:3.5rem}.util_stackPadding800--top{padding-top:4rem}.util_stackPadding800--bottom{padding-bottom:4rem}.util_stackMargin800--top{margin-top:4rem}.util_stackMargin800--bottom{margin-bottom:4rem}.util_stackPadding900--top{padding-top:4.5rem}.util_stackPadding900--bottom{padding-bottom:4.5rem}.util_stackMargin900--top{margin-top:4.5rem}.util_stackMargin900--bottom{margin-bottom:4.5rem}.util_stackPadding1000--top{padding-top:5rem}.util_stackPadding1000--bottom{padding-bottom:5rem}.util_stackMargin1000--top{margin-top:5rem}.util_stackMargin1000--bottom{margin-bottom:5rem}:host{--insetPaddingXl: 0 var(--ds-size-400, $ds-size-400) var(--ds-size-400, $ds-size-400) var(--ds-size-400, $ds-size-400);--insetPaddingXxl: 0 var(--ds-size-600, $ds-size-600) var(--ds-size-600, $ds-size-600) var(--ds-size-600, $ds-size-600);--insetPaddingXxxl: 0 var(--ds-size-800, $ds-size-800) var(--ds-size-800, $ds-size-800) var(--ds-size-800, $ds-size-800)}[auro-icon]{--ds-auro-icon-size: var(--ds-size-300, $ds-size-300)}.dialogOverlay{position:fixed;z-index:-1;bottom:0;left:0;width:100%;height:100%}.dialogOverlay--open{z-index:var(--ds-depth-overlay);transition:background .3s cubic-bezier(0.4, 0, 0.2, 0)}.dialogOverlay--modal{z-index:var(--ds-depth-overlay);transition:background .3s cubic-bezier(0.4, 0, 0.5, 0)}.dialog{position:fixed;z-index:-1;right:0;bottom:0;left:0;display:flex;flex-direction:column;visibility:hidden;overflow:visible;width:100%;max-height:90%;padding:var(--insetPaddingXl);transform:translateY(100%);opacity:0;border:0;transition:all .3s ease-in-out}@media screen and (min-width: 768px){.dialog{top:10%;bottom:unset;max-width:80%;max-height:80%;margin:auto;padding:var(--insetPaddingXxxl);transform:scale(0)}.dialog--open{transform:scale(1)}}@media screen and (min-width: 1024px){.dialog{max-width:986px}}.dialog--open{z-index:var(--ds-depth-modal, 400);visibility:visible;transform:translateY(0%);opacity:1}.dialog-footer{padding-top:var(--ds-size-400, 2rem)}@media screen and (min-width: 768px){.dialog-footer ::slotted(*){display:flex;justify-content:flex-end}}.dialog-header{display:flex;align-items:flex-start;justify-content:space-between;padding-top:var(--ds-size-800, 4rem)}.dialog-header--action{margin:0;padding:0}.dialog-header--action:hover{cursor:pointer}.dialog-content{flex:1;overflow:auto;overscroll-behavior:contain}::slotted([slot=content]){position:relative}:host([unformatted]) .dialog-header--action{position:absolute;top:var(--ds-size-400, 2rem);right:var(--ds-size-400, 2rem)}@media screen and (min-width: 768px){:host([unformatted]) .dialog-header--action{top:var(--ds-size-800, 4rem);right:var(--ds-size-800, 4rem)}}:host([sm]) .dialog{max-height:30%}@media screen and (min-width: 768px){:host([sm]) .dialog{top:10%;max-width:40%;max-height:80%;padding:var(--insetPaddingXxl)}}@media screen and (min-width: 1024px){:host([sm]) .dialog{max-width:740px}}:host([md]) .dialog{max-height:50%}@media screen and (min-width: 768px){:host([md]) .dialog{top:10%;max-width:70%;max-height:80%}}@media screen and (min-width: 1024px){:host([md]) .dialog{top:10%;max-width:986px}}@media screen and (min-width: 768px){:host([sm][lg]) .dialog,:host([md][lg]) .dialog{max-height:80%}}:host([sm][lg]) .dialog,:host([md][lg]) .dialog{max-height:90%}:host([unformatted]) .dialog{padding:0}`;
40
+
41
+ var styleUnformattedCss = css`[unformatted] .unformattedWrapper{padding:var(--ds-size-400, 2rem)}@media screen and (min-width: 768px){[unformatted] .unformattedWrapper{padding:var(--ds-size-800, 4rem);padding-top:var(--ds-size-400, 2rem)}}`;
42
+
43
+ var colorCss = css`.dialogOverlay--open{background:var(--ds-auro-dialog-overlay-open-background-color)}.dialogOverlay--modal{background:var(--ds-auro-dialog-overlay-modal-background-color)}.dialog{background:var(--ds-auro-dialog-container-color);color:var(--ds-auro-dialog-text-color)}@media screen and (min-width: 768px){.dialog{box-shadow:var(--ds-auro-dialog-boxshadow-color)}}.dialog-header--action{border:2px solid transparent;border-radius:var(--ds-border-radius, 0.375rem);background-color:transparent}`;
44
+
45
+ var tokensCss = css`:host{--ds-auro-dialog-container-color: var(--ds-color-container-primary-default, #ffffff);--ds-auro-dialog-boxshadow-color: var(--ds-elevation-300, 0px 0px 15px rgba(0, 0, 0, 0.2));--ds-auro-dialog-overlay-modal-background-color: var(--ds-color-background-scrimmed-default, rgba(0, 0, 0, 0.5));--ds-auro-dialog-overlay-open-background-color: var(--ds-color-background-scrimmed-default, rgba(0, 0, 0, 0.5));--ds-auro-dialog-text-color: var(--ds-color-text-primary-default, #2a2a2a)}`;
46
+
47
+ var buttonVersion = '8.1.0';
48
+
49
+ var iconVersion = '6.0.1';
50
+
51
+ // Copyright (c) 2024 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
52
+ // See LICENSE in the project root for license information.
53
+
54
+
55
+ const ESCAPE_KEYCODE = 27,
56
+ FOCUS_TIMEOUT = 50;
57
+
58
+ // See https://git.io/JJ6SJ for "How to document your components using JSDoc"
59
+ /**
60
+ * auro-dialog appear above the page and require the user's attention.
61
+ *
62
+ * @attr {Boolean} modal - Modal dialog restricts the user to take an action (no default close actions)
63
+ * @attr {Boolean} unformatted - Unformatted dialog window, edge-to-edge fill for content
64
+ * @attr {Boolean} sm - Sets dialog box to small style. Adding both sm and lg will set the dialog to sm for desktop and lg for mobile.
65
+ * @attr {Boolean} md - Sets dialog box to medium style. Adding both md and lg will set the dialog to md for desktop and lg for mobile.
66
+ * @attr {Boolean} onDark - Sets close icon to white for dark backgrounds
67
+ * @attr {Boolean} open - Sets state of dialog to open
68
+ * @prop {HTMLElement} triggerElement - The element to focus when the dialog is closed. If not set, defaults to the value of document.activeElement when the dialog is opened.
69
+ * @slot header - Text to display as the header of the modal
70
+ * @slot content - Injects content into the body of the modal
71
+ * @slot footer - Used for action options, e.g. buttons
72
+ * @function toggleViewable - toggles the 'open' property on the element
73
+ * @event toggle - Event fires when the element is closed
74
+ * @csspart close-button - adjust position of the close X icon in the dialog window
75
+ * @csspart dialog-overlay - apply CSS on the overlay of the dialog
76
+ * @csspart dialog - apply CSS to the entire dialog
77
+ * @csspart dialog-header - apply CSS to the header of the dialog
78
+ * @csspart dialog-content - apply CSS to the content of the dialog
79
+ * @csspart dialog-footer - apply CSS to the footer of the dialog
80
+ */
81
+
82
+ class ComponentBase extends LitElement {
83
+ constructor() {
84
+ super();
85
+
86
+ this.modal = false;
87
+ this.unformatted = false;
88
+
89
+ const versioning = new AuroDependencyVersioning();
90
+
91
+ /**
92
+ * @private
93
+ */
94
+ this.buttonTag = versioning.generateTag('auro-button', buttonVersion, AuroButton);
95
+
96
+ /**
97
+ * @private
98
+ */
99
+ this.iconTag = versioning.generateTag('auro-icon', iconVersion, AuroIcon);
100
+
101
+
102
+ /**
103
+ * @private
104
+ */
105
+ this.runtimeUtils = new AuroLibraryRuntimeUtils();
106
+ }
107
+
108
+ static get properties() {
109
+ return {
110
+ modal: { type: Boolean },
111
+ unformatted: {
112
+ type: Boolean,
113
+ reflect: true
114
+ },
115
+ open: {
116
+ type: Boolean,
117
+ reflect: true
118
+ },
119
+ triggerElement: {
120
+ attribute: false
121
+ }
122
+ };
123
+ }
124
+
125
+ firstUpdated() {
126
+ // Add the tag name as an attribute if it is different than the component name
127
+ this.runtimeUtils.handleComponentTagRename(this, 'auro-dialog');
128
+
129
+ const slot = this.shadowRoot.querySelector("#footer"),
130
+ slotWrapper = this.shadowRoot.querySelector("#footerWrapper");
131
+
132
+ this.dialog = this.shadowRoot.getElementById('dialog');
133
+
134
+ if (!this.unformatted && slot.assignedNodes().length === 0) {
135
+ slotWrapper.classList.remove("dialog-footer");
136
+ }
137
+ }
138
+
139
+ /**
140
+ * LitElement lifecycle method. Called after the DOM has been updated.
141
+ * @param {Map<string, any>} changedProperties - Keys are the names of changed properties, values are the corresponding previous values.
142
+ * @returns {void}
143
+ */
144
+ updated(changedProperties) {
145
+ if (changedProperties.has('open')) {
146
+ if (this.open) {
147
+ this.openDialog();
148
+ } else {
149
+ this.closeDialog();
150
+ }
151
+ }
152
+ }
153
+
154
+ connectedCallback() {
155
+ super.connectedCallback();
156
+ this.keydownEventHandler = this.handleKeydown.bind(this);
157
+ window.addEventListener('keydown', this.keydownEventHandler);
158
+ }
159
+
160
+ disconnectedCallback() {
161
+ super.disconnectedCallback();
162
+ window.removeEventListener('keydown', this.keydownEventHandler);
163
+ }
164
+
165
+ /**
166
+ * @private
167
+ * @returns {void}
168
+ */
169
+ openDialog() {
170
+ this.defaultTrigger = document.activeElement;
171
+
172
+ setTimeout(() => {
173
+ this.focus();
174
+
175
+ this.handleFocusLoss();
176
+ }, FOCUS_TIMEOUT);
177
+ }
178
+
179
+ /**
180
+ * @private
181
+ * @returns {void}
182
+ */
183
+ closeDialog() {
184
+ this.dispatchToggleEvent();
185
+ }
186
+
187
+ /**
188
+ * @private
189
+ * @returns {void}
190
+ */
191
+ dispatchToggleEvent() {
192
+ // replace with Event constructor once IE support dropped
193
+ const toggleEvent = document.createEvent("HTMLEvents");
194
+
195
+ toggleEvent.initEvent("toggle", true, false);
196
+ this.dispatchEvent(toggleEvent);
197
+ }
198
+
199
+ /**
200
+ * @private
201
+ * @returns {void} Determines if dropdown bib should be closed on focus change.
202
+ */
203
+ handleFocusLoss() {
204
+ const focusable = [...this.querySelectorAll('button, auro-button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')];
205
+
206
+ const firstFocusableElement = focusable[0];
207
+ const lastFocusableElement = focusable[focusable.length - 1];
208
+
209
+ const closeButton = this.shadowRoot.getElementById('dialog-close');
210
+
211
+ if (lastFocusableElement) {
212
+ lastFocusableElement.addEventListener('focusout', () => {
213
+ if (closeButton !== null) {
214
+ closeButton.focus();
215
+ } else {
216
+ firstFocusableElement.focus();
217
+ }
218
+ });
219
+ }
220
+ }
221
+
222
+ /**
223
+ * @private
224
+ * @returns {void}
225
+ */
226
+ handleOverlayClick() {
227
+ if (this.open && !this.modal) {
228
+ this.handleCloseButtonClick();
229
+ }
230
+ }
231
+
232
+ /**
233
+ * @private
234
+ * @returns {void}
235
+ */
236
+ handleCloseButtonClick() {
237
+ this.open = false;
238
+ }
239
+
240
+ /**
241
+ * @private
242
+ * @param {KeyboardEvent} event - The keyboard event containing the key and keyCode.
243
+ * @returns {void}
244
+ */
245
+ handleKeydown({ key, keyCode }) {
246
+ if (this.open && !this.modal && (key === 'Escape' || keyCode === ESCAPE_KEYCODE)) {
247
+ this.open = false;
248
+ }
249
+ }
250
+
251
+ /**
252
+ * Focus the dialog.
253
+ * @private
254
+ * @returns {void}
255
+ */
256
+ focus() {
257
+ if (this.open) {
258
+ this.dialog.focus();
259
+ }
260
+ }
261
+
262
+ static get styles() {
263
+ return [
264
+ styleCss,
265
+ styleUnformattedCss,
266
+ colorCss,
267
+ tokensCss
268
+ ];
269
+ }
270
+
271
+ /**
272
+ * @private
273
+ * @returns {TemplateResult} - The close button template.
274
+ */
275
+ getCloseButton() {
276
+ return this.modal
277
+ ? html``
278
+ : html`
279
+ <${this.buttonTag} variant="flat" ?onDark=${this.hasAttribute('onDark')} class="dialog-header--action" id="dialog-close" @click="${this.handleCloseButtonClick}" part="close-button">
280
+ <${this.iconTag} customColor category="interface" name="x-lg"></${this.iconTag}>
281
+ <span class="util_displayHiddenVisually">Close</span>
282
+ </${this.buttonTag}>
283
+ `;
284
+ }
285
+
286
+ render() {
287
+ const classes = {
288
+ 'dialogOverlay': true,
289
+ 'dialogOverlay--modal': this.modal && this.open,
290
+ 'dialogOverlay--open': this.open,
291
+ 'util_displayHidden': !this.open
292
+ },
293
+
294
+ contentClasses = {
295
+ 'dialog': true,
296
+ 'dialog--open': this.open
297
+ };
298
+
299
+ return html`
300
+ <div class="${classMap(classes)}" id="dialog-overlay" part="dialog-overlay" @click=${this.handleOverlayClick}></div>
301
+
302
+ <div role="dialog" id="dialog" class="${classMap(contentClasses)}" part="dialog" aria-labelledby="dialog-header" tabindex="-1">
303
+ ${this.unformatted
304
+ ? html`
305
+ <slot name="content"></slot>
306
+ ${this.getCloseButton()}
307
+ `
308
+ : html`
309
+ <div class="dialog-header" part="dialog-header">
310
+ <h1 class="heading heading--700 util_stackMarginNone--top" id="dialog-header">
311
+ <slot name="header">Default header ...</slot>
312
+ </h1>
313
+ ${this.getCloseButton()}
314
+ </div>
315
+ <div class="dialog-content" part="dialog-content">
316
+ <slot name="content"></slot>
317
+ </div>
318
+ <div class="dialog-footer" id="footerWrapper" part="dialog-footer">
319
+ <slot name="footer" id="footer"></slot>
320
+ </div>
321
+ `
322
+ }
323
+ </div>
324
+ `;
325
+ }
326
+ }
327
+
328
+ // Copyright (c) 2024 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
329
+ // See LICENSE in the project root for license information.
330
+
331
+
332
+ // build the component class
333
+ class AuroDialog extends ComponentBase {
334
+ // constructor() {
335
+ // super();
336
+ // }
337
+
338
+ // function to define props used within the scope of this component
339
+ static get properties() {
340
+ return {
341
+ ...super.properties,
342
+ // use custom accessors on base class
343
+ open: {
344
+ ...super.properties.open,
345
+ noAccessor: true
346
+ }
347
+ };
348
+ }
349
+
350
+ static get styles() {
351
+ return [super.styles];
352
+ }
353
+
354
+ /**
355
+ * This will register this element with the browser.
356
+ * @param {string} [name="auro-dialog"] - The name of element that you want to register to.
357
+ *
358
+ * @example
359
+ * AuroDialog.register("custom-dialog") // this will register this element to <custom-dialog/>
360
+ *
361
+ */
362
+ static register(name = "auro-dialog") {
363
+ AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroDialog);
364
+ }
365
+ }
366
+
367
+ AuroDialog.register();
368
+ AuroDialog.register('custom-dialog');
369
+
31
370
  function initExamples(initCount) {
32
371
  initCount = initCount || 0;
33
372
 
@@ -17,6 +17,15 @@ export class AuroDialog extends ComponentBase {
17
17
  };
18
18
  };
19
19
  static get styles(): import("lit").CSSResult[][];
20
+ /**
21
+ * This will register this element with the browser.
22
+ * @param {string} [name="auro-dialog"] - The name of element that you want to register to.
23
+ *
24
+ * @example
25
+ * AuroDialog.register("custom-dialog") // this will register this element to <custom-dialog/>
26
+ *
27
+ */
28
+ static register(name?: string): void;
20
29
  }
21
30
  import ComponentBase from './componentBase.js';
22
31
  //# sourceMappingURL=auro-dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auro-dialog.d.ts","sourceRoot":"","sources":["../src/auro-dialog.js"],"names":[],"mappings":"AAQA;IAME;;;;;;;;;;;;;;;;MASC;IAED,iDAEC;CACF;0BAvByB,oBAAoB"}
1
+ {"version":3,"file":"auro-dialog.d.ts","sourceRoot":"","sources":["../src/auro-dialog.js"],"names":[],"mappings":"AASA;IAME;;;;;;;;;;;;;;;;MASC;IAED,iDAEC;IAED;;;;;;;OAOG;IACH,uBANW,MAAM,QAQhB;CACF;0BAnCyB,oBAAoB"}