@aurodesignsystem/auro-dialog 4.2.0 → 4.2.1

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +3 -19
  2. package/README.md +8 -9
  3. package/demo/accessibility.html +42 -0
  4. package/demo/accessibility.js +21 -0
  5. package/demo/accessibility.md +129 -0
  6. package/demo/accessibility.min.js +3969 -0
  7. package/demo/api.html +16 -40
  8. package/demo/api.md +0 -750
  9. package/demo/customize.html +45 -0
  10. package/demo/{api.js → customize.js} +2 -14
  11. package/demo/customize.md +226 -0
  12. package/demo/customize.min.js +3974 -0
  13. package/demo/demo-nav.css +32 -0
  14. package/demo/design.html +42 -0
  15. package/demo/design.js +23 -0
  16. package/demo/design.md +306 -0
  17. package/demo/design.min.js +4041 -0
  18. package/demo/getting-started.html +38 -0
  19. package/demo/getting-started.md +295 -0
  20. package/demo/index.html +17 -36
  21. package/demo/index.js +2 -3
  22. package/demo/index.md +220 -144
  23. package/demo/index.min.js +3984 -7
  24. package/demo/keyboard-behavior.html +38 -0
  25. package/demo/keyboard-behavior.md +51 -0
  26. package/demo/pages.json +1 -0
  27. package/demo/readme.html +42 -0
  28. package/demo/readme.js +24 -0
  29. package/demo/readme.md +176 -0
  30. package/demo/{auro-dialog.min.js → readme.min.js} +434 -281
  31. package/demo/support/demo-support.js +140 -0
  32. package/demo/voiceover.html +38 -0
  33. package/demo/voiceover.md +19 -0
  34. package/demo/why-dialog.html +38 -0
  35. package/demo/why-dialog.md +36 -0
  36. package/dist/{auro-dialog-CWkXz5VA.js → auro-dialog-T9I85UZL.js} +20 -20
  37. package/dist/index.d.ts +198 -98
  38. package/dist/index.js +1 -1
  39. package/dist/registered.js +1 -1
  40. package/package.json +6 -6
  41. package/demo/api.min.js +0 -219
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  import type { AuroDialog } from "src/auro-dialog.js";
3
2
  import type { ComponentBase } from "src/componentBase.js";
4
3
 
@@ -22,13 +21,14 @@ import type { ComponentBase } from "src/componentBase.js";
22
21
  */
23
22
  export type ScopedElements<
24
23
  Prefix extends string = "",
25
- Suffix extends string = ""
24
+ Suffix extends string = "",
26
25
  > = {
27
- [Key in keyof CustomElements as `${Prefix}${Key}${Suffix}`]: CustomElements[Key];
26
+ [
27
+ Key in keyof CustomElements as `${Prefix}${Key}${Suffix}`
28
+ ]: CustomElements[Key];
28
29
  };
29
30
 
30
31
  type BaseProps<T extends HTMLElement> = {
31
-
32
32
  /** Content added between the opening and closing tags of the element */
33
33
  children?: any;
34
34
  /** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
@@ -51,6 +51,8 @@ type BaseProps<T extends HTMLElement> = {
51
51
  key?: string | number;
52
52
  /** Specifies the language of the element. */
53
53
  lang?: string;
54
+ /** Defines the element's semantic role for accessibility APIs. */
55
+ role?: string;
54
56
  /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
55
57
  part?: string;
56
58
  /** Use the ref attribute with a variable to assign a DOM element to the variable once the element is rendered. */
@@ -71,163 +73,261 @@ type BaseProps<T extends HTMLElement> = {
71
73
  popovertarget?: "top" | "bottom" | "left" | "right" | "auto";
72
74
  /** Specifies the action to be performed on a popover element being controlled by a control element. */
73
75
  popovertargetaction?: "show" | "hide" | "toggle";
74
-
75
- } ;
76
-
77
- type BaseEvents = {
78
-
79
-
80
76
  };
81
77
 
82
-
78
+ type BaseEvents = {};
83
79
 
84
80
  export type AuroDialogProps = {
85
81
  /** Defines whether the close button should be light colored for use on dark backgrounds. */
86
- "close-button-appearance"?: AuroDialog['closeButtonAppearance'];
82
+ "close-button-appearance"?: AuroDialog["closeButtonAppearance"];
87
83
  /** Defines whether the close button should be light colored for use on dark backgrounds. */
88
- "closeButtonAppearance"?: AuroDialog['closeButtonAppearance'];
84
+ closeButtonAppearance?: AuroDialog["closeButtonAppearance"];
89
85
  /** If true, the dialog bib is in fullscreen mode. */
90
- "isBibFullscreen"?: AuroDialog['isBibFullscreen'];
86
+ isBibFullscreen?: AuroDialog["isBibFullscreen"];
91
87
  /** Sets dialog box to large style. Adding both lg and sm/md will set the dialog to lg for mobile and sm/md for desktop.
92
88
  Must be used in conjunction with sm or md to have an effect. */
93
- "lg"?: AuroDialog['lg'];
89
+ lg?: AuroDialog["lg"];
94
90
  /** Sets dialog box to medium style. Adding both md and lg will set the dialog to md for desktop and lg for mobile. */
95
- "md"?: AuroDialog['md'];
91
+ md?: AuroDialog["md"];
96
92
  /** Modal dialog restricts the user to take an action (no default close actions). */
97
- "modal"?: AuroDialog['modal'];
93
+ modal?: AuroDialog["modal"];
98
94
  /** DEPRECATED - use `close-button-appearance="inverse" instead. */
99
- "onDark"?: AuroDialog['onDark'];
95
+ onDark?: AuroDialog["onDark"];
100
96
  /** Sets state of dialog to open. */
101
- "open"?: AuroDialog['isPopoverVisible'];
97
+ open?: AuroDialog["isPopoverVisible"];
102
98
  /** Sets state of dialog to open. */
103
- "isPopoverVisible"?: AuroDialog['isPopoverVisible'];
99
+ isPopoverVisible?: AuroDialog["isPopoverVisible"];
104
100
  /** Sets dialog box to small style. Adding both sm and lg will set the dialog to sm for desktop and lg for mobile. */
105
- "sm"?: AuroDialog['sm'];
101
+ sm?: AuroDialog["sm"];
106
102
  /** Unformatted dialog window, edge-to-edge fill for content. */
107
- "unformatted"?: AuroDialog['unformatted'];
103
+ unformatted?: AuroDialog["unformatted"];
108
104
  /** The element to focus when the dialog is closed. If not set, defaults to the value of document.activeElement when the dialog is opened. */
109
- "triggerElement"?: AuroDialog['triggerElement'];
105
+ triggerElement?: AuroDialog["triggerElement"];
110
106
 
111
107
  /** Event fires when the element is closed */
112
- "ontoggle"?: (e: CustomEvent<never>) => void;
113
- }
114
-
108
+ ontoggle?: (e: Event) => void;
109
+ };
115
110
 
116
- export type CustomElements = {
111
+ export type AuroDialogSolidJsProps = {
112
+ /** Defines whether the close button should be light colored for use on dark backgrounds. */
113
+ "attr:close-button-appearance"?: AuroDialog["closeButtonAppearance"];
114
+ /** Defines whether the close button should be light colored for use on dark backgrounds. */
115
+ "prop:closeButtonAppearance"?: AuroDialog["closeButtonAppearance"];
116
+ /** If true, the dialog bib is in fullscreen mode. */
117
+ "prop:isBibFullscreen"?: AuroDialog["isBibFullscreen"];
118
+ /** Sets dialog box to large style. Adding both lg and sm/md will set the dialog to lg for mobile and sm/md for desktop.
119
+ Must be used in conjunction with sm or md to have an effect. */
120
+ "prop:lg"?: AuroDialog["lg"];
121
+ /** Sets dialog box to medium style. Adding both md and lg will set the dialog to md for desktop and lg for mobile. */
122
+ "prop:md"?: AuroDialog["md"];
123
+ /** Modal dialog restricts the user to take an action (no default close actions). */
124
+ "prop:modal"?: AuroDialog["modal"];
125
+ /** DEPRECATED - use `close-button-appearance="inverse" instead. */
126
+ "prop:onDark"?: AuroDialog["onDark"];
127
+ /** Sets state of dialog to open. */
128
+ "bool:open"?: AuroDialog["isPopoverVisible"];
129
+ /** Sets state of dialog to open. */
130
+ "prop:isPopoverVisible"?: AuroDialog["isPopoverVisible"];
131
+ /** Sets dialog box to small style. Adding both sm and lg will set the dialog to sm for desktop and lg for mobile. */
132
+ "prop:sm"?: AuroDialog["sm"];
133
+ /** Unformatted dialog window, edge-to-edge fill for content. */
134
+ "prop:unformatted"?: AuroDialog["unformatted"];
135
+ /** The element to focus when the dialog is closed. If not set, defaults to the value of document.activeElement when the dialog is opened. */
136
+ "prop:triggerElement"?: AuroDialog["triggerElement"];
137
+ /** Event fires when the element is closed */
138
+ "on:toggle"?: (e: Event) => void;
117
139
 
140
+ /** Set the innerHTML of the element */
141
+ innerHTML?: string;
142
+ /** Set the textContent of the element */
143
+ textContent?: string | number;
144
+ };
118
145
 
146
+ export type CustomElements = {
119
147
  /**
120
- * The `auro-dialog` appears on top of the page and presents information that requires the users immediate attention.
121
- *
122
- * ## Attributes & Properties
123
- *
124
- * Component attributes and properties that can be applied to the element or by using JavaScript.
125
- *
126
- * - `close-button-appearance`/`closeButtonAppearance`: Defines whether the close button should be light colored for use on dark backgrounds.
127
- * - `isBibFullscreen`: If true, the dialog bib is in fullscreen mode.
128
- * - `lg`: Sets dialog box to large style. Adding both lg and sm/md will set the dialog to lg for mobile and sm/md for desktop.
129
- * Must be used in conjunction with sm or md to have an effect.
130
- * - `md`: Sets dialog box to medium style. Adding both md and lg will set the dialog to md for desktop and lg for mobile.
131
- * - `modal`: Modal dialog restricts the user to take an action (no default close actions).
132
- * - `onDark`: DEPRECATED - use `close-button-appearance="inverse" instead.
133
- * - `open`/`isPopoverVisible`: Sets state of dialog to open.
134
- * - `sm`: Sets dialog box to small style. Adding both sm and lg will set the dialog to sm for desktop and lg for mobile.
135
- * - `unformatted`: Unformatted dialog window, edge-to-edge fill for content.
136
- * - `behavior`: undefined (property only) (readonly)
137
- * - `open`: undefined (property only)
138
- * - `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. (property only)
139
- *
140
- * ## Events
141
- *
142
- * Events that will be emitted by the component.
143
- *
144
- * - `toggle`: Event fires when the element is closed
145
- *
146
- * ## Slots
147
- *
148
- * Areas where markup can be added to the component.
149
- *
150
- * - `ariaLabel.dialog.close`: Text to describe the "x" icon close button for screen readers. Default: "Close".
151
- * - `content`: Injects content into the body of the modal
152
- * - `footer`: Used for action options, e.g. buttons
153
- * - `header`: Text to display as the header of the modal
154
- *
155
- * ## Methods
156
- *
157
- * Methods that can be called to access component functionality.
158
- *
159
- * - `_initializeDefaults() => void`: undefined
160
- * - `hide() => void`: Closes the dialog.
161
- * - `register(name?: string = "auro-dialog") => void`: This will register this element with the browser.
162
- * - `show() => void`: Opens the dialog.
163
- *
164
- * ## CSS Parts
165
- *
166
- * Custom selectors for styling elements within the component.
167
- *
168
- * - `close-button`: adjust position of the close X icon in the dialog window
169
- * - `dialog`: apply CSS to the entire dialog
170
- * - `dialog-content`: apply CSS to the content of the dialog
171
- * - `dialog-footer`: apply CSS to the footer of the dialog
172
- * - `dialog-header`: apply CSS to the header of the dialog
173
- * - `dialog-overlay`: DEPRECATED. Use `--ds-auro-dialog-overlay-modal-background-color` or `--ds-auro-dialog-overlay-open-background-color` for backdrop styling instead.
174
- */
175
- "auro-dialog": Partial<AuroDialogProps & BaseProps<AuroDialog> & BaseEvents>;
148
+ * The `auro-dialog` appears on top of the page and presents information that requires the users immediate attention.
149
+ *
150
+ * ## Attributes & Properties
151
+ *
152
+ * Component attributes and properties that can be applied to the element or by using JavaScript.
153
+ *
154
+ * - `close-button-appearance`/`closeButtonAppearance`: Defines whether the close button should be light colored for use on dark backgrounds.
155
+ * - `isBibFullscreen`: If true, the dialog bib is in fullscreen mode.
156
+ * - `lg`: Sets dialog box to large style. Adding both lg and sm/md will set the dialog to lg for mobile and sm/md for desktop.
157
+ * Must be used in conjunction with sm or md to have an effect.
158
+ * - `md`: Sets dialog box to medium style. Adding both md and lg will set the dialog to md for desktop and lg for mobile.
159
+ * - `modal`: Modal dialog restricts the user to take an action (no default close actions).
160
+ * - `onDark`: DEPRECATED - use `close-button-appearance="inverse" instead.
161
+ * - `open`/`isPopoverVisible`: Sets state of dialog to open.
162
+ * - `sm`: Sets dialog box to small style. Adding both sm and lg will set the dialog to sm for desktop and lg for mobile.
163
+ * - `unformatted`: Unformatted dialog window, edge-to-edge fill for content.
164
+ * - `behavior`: undefined (property only) (readonly)
165
+ * - `open`: undefined (property only)
166
+ * - `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. (property only)
167
+ *
168
+ * ## Events
169
+ *
170
+ * Events that will be emitted by the component.
171
+ *
172
+ * - `toggle`: Event fires when the element is closed
173
+ *
174
+ * ## Slots
175
+ *
176
+ * Areas where markup can be added to the component.
177
+ *
178
+ * - `ariaLabel.dialog.close`: Text to describe the "x" icon close button for screen readers. Default: "Close".
179
+ * - `content`: Injects content into the body of the modal
180
+ * - `footer`: Used for action options, e.g. buttons
181
+ * - `header`: Text to display as the header of the modal
182
+ *
183
+ * ## Methods
184
+ *
185
+ * Methods that can be called to access component functionality.
186
+ *
187
+ * - `_initializeDefaults() => void`: undefined
188
+ * - `hide() => void`: Closes the dialog.
189
+ * - `register(name?: string = "auro-dialog") => void`: This will register this element with the browser.
190
+ * - `show() => void`: Opens the dialog.
191
+ *
192
+ * ## CSS Parts
193
+ *
194
+ * Custom selectors for styling elements within the component.
195
+ *
196
+ * - `close-button`: adjust position of the close X icon in the dialog window
197
+ * - `dialog`: apply CSS to the entire dialog
198
+ * - `dialog-content`: apply CSS to the content of the dialog
199
+ * - `dialog-footer`: apply CSS to the footer of the dialog
200
+ * - `dialog-header`: apply CSS to the header of the dialog
201
+ * - `dialog-overlay`: DEPRECATED. Use `--ds-auro-dialog-overlay-modal-background-color` or `--ds-auro-dialog-overlay-open-background-color` for backdrop styling instead.
202
+ */
203
+ "auro-dialog": Partial<AuroDialogProps & BaseProps<AuroDialog> & BaseEvents>;
204
+ };
176
205
 
177
- }
206
+ export type CustomElementsSolidJs = {
207
+ /**
208
+ * The `auro-dialog` appears on top of the page and presents information that requires the users immediate attention.
209
+ *
210
+ * ## Attributes & Properties
211
+ *
212
+ * Component attributes and properties that can be applied to the element or by using JavaScript.
213
+ *
214
+ * - `close-button-appearance`/`closeButtonAppearance`: Defines whether the close button should be light colored for use on dark backgrounds.
215
+ * - `isBibFullscreen`: If true, the dialog bib is in fullscreen mode.
216
+ * - `lg`: Sets dialog box to large style. Adding both lg and sm/md will set the dialog to lg for mobile and sm/md for desktop.
217
+ * Must be used in conjunction with sm or md to have an effect.
218
+ * - `md`: Sets dialog box to medium style. Adding both md and lg will set the dialog to md for desktop and lg for mobile.
219
+ * - `modal`: Modal dialog restricts the user to take an action (no default close actions).
220
+ * - `onDark`: DEPRECATED - use `close-button-appearance="inverse" instead.
221
+ * - `open`/`isPopoverVisible`: Sets state of dialog to open.
222
+ * - `sm`: Sets dialog box to small style. Adding both sm and lg will set the dialog to sm for desktop and lg for mobile.
223
+ * - `unformatted`: Unformatted dialog window, edge-to-edge fill for content.
224
+ * - `behavior`: undefined (property only) (readonly)
225
+ * - `open`: undefined (property only)
226
+ * - `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. (property only)
227
+ *
228
+ * ## Events
229
+ *
230
+ * Events that will be emitted by the component.
231
+ *
232
+ * - `toggle`: Event fires when the element is closed
233
+ *
234
+ * ## Slots
235
+ *
236
+ * Areas where markup can be added to the component.
237
+ *
238
+ * - `ariaLabel.dialog.close`: Text to describe the "x" icon close button for screen readers. Default: "Close".
239
+ * - `content`: Injects content into the body of the modal
240
+ * - `footer`: Used for action options, e.g. buttons
241
+ * - `header`: Text to display as the header of the modal
242
+ *
243
+ * ## Methods
244
+ *
245
+ * Methods that can be called to access component functionality.
246
+ *
247
+ * - `_initializeDefaults() => void`: undefined
248
+ * - `hide() => void`: Closes the dialog.
249
+ * - `register(name?: string = "auro-dialog") => void`: This will register this element with the browser.
250
+ * - `show() => void`: Opens the dialog.
251
+ *
252
+ * ## CSS Parts
253
+ *
254
+ * Custom selectors for styling elements within the component.
255
+ *
256
+ * - `close-button`: adjust position of the close X icon in the dialog window
257
+ * - `dialog`: apply CSS to the entire dialog
258
+ * - `dialog-content`: apply CSS to the content of the dialog
259
+ * - `dialog-footer`: apply CSS to the footer of the dialog
260
+ * - `dialog-header`: apply CSS to the header of the dialog
261
+ * - `dialog-overlay`: DEPRECATED. Use `--ds-auro-dialog-overlay-modal-background-color` or `--ds-auro-dialog-overlay-open-background-color` for backdrop styling instead.
262
+ */
263
+ "auro-dialog": Partial<
264
+ AuroDialogProps &
265
+ AuroDialogSolidJsProps &
266
+ BaseProps<AuroDialog> &
267
+ BaseEvents
268
+ >;
269
+ };
178
270
 
179
- export type CustomCssProperties = {
271
+ export type CustomCssProperties = {};
180
272
 
273
+ declare module "react" {
274
+ namespace JSX {
275
+ interface IntrinsicElements extends CustomElements {}
276
+ }
181
277
  }
182
278
 
279
+ declare module "react/jsx-runtime" {
280
+ namespace JSX {
281
+ interface IntrinsicElements extends CustomElements {}
282
+ }
283
+ }
183
284
 
184
- declare module 'react' {
285
+ declare module "react/jsx-dev-runtime" {
185
286
  namespace JSX {
186
287
  interface IntrinsicElements extends CustomElements {}
187
288
  }
188
-
189
289
  }
190
290
 
191
- declare module 'preact' {
291
+ declare module "preact" {
192
292
  namespace JSX {
193
293
  interface IntrinsicElements extends CustomElements {}
194
294
  }
195
-
196
295
  }
197
296
 
198
- declare module '@builder.io/qwik' {
297
+ declare module "@builder.io/qwik" {
199
298
  namespace JSX {
200
299
  interface IntrinsicElements extends CustomElements {}
201
300
  }
202
-
203
301
  }
204
302
 
205
- declare module '@stencil/core' {
303
+ declare module "@stencil/core" {
206
304
  namespace JSX {
207
305
  interface IntrinsicElements extends CustomElements {}
208
306
  }
209
-
210
307
  }
211
308
 
212
- declare module 'hono/jsx' {
309
+ declare module "hono/jsx" {
213
310
  namespace JSX {
214
311
  interface IntrinsicElements extends CustomElements {}
215
312
  }
216
-
217
313
  }
218
314
 
219
- declare module 'react-native' {
315
+ declare module "react-native" {
220
316
  namespace JSX {
221
317
  interface IntrinsicElements extends CustomElements {}
222
318
  }
223
-
319
+ }
320
+
321
+ declare module "solid-js" {
322
+ namespace JSX {
323
+ interface IntrinsicElements extends CustomElementsSolidJs {}
324
+ }
224
325
  }
225
326
 
226
327
  declare global {
227
328
  namespace JSX {
228
329
  interface IntrinsicElements extends CustomElements {}
229
330
  }
230
-
231
331
  }
232
332
  declare global {
233
333
  namespace svelteHTML {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{A as AuroDialog}from"./auro-dialog-CWkXz5VA.js";import"lit";import"lit/directives/class-map.js";import"lit/directives/if-defined.js";import"lit/static-html.js";
1
+ export{A as AuroDialog}from"./auro-dialog-T9I85UZL.js";import"lit";import"lit/directives/class-map.js";import"lit/directives/if-defined.js";import"lit/static-html.js";
@@ -1 +1 @@
1
- import{A as i}from"./auro-dialog-CWkXz5VA.js";import"lit";import"lit/directives/class-map.js";import"lit/directives/if-defined.js";import"lit/static-html.js";i.register();
1
+ import{A as i}from"./auro-dialog-T9I85UZL.js";import"lit";import"lit/directives/class-map.js";import"lit/directives/if-defined.js";import"lit/static-html.js";i.register();
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "================================================================================"
8
8
  ],
9
9
  "name": "@aurodesignsystem/auro-dialog",
10
- "version": "4.2.0",
10
+ "version": "4.2.1",
11
11
  "description": "auro-dialog HTML custom element",
12
12
  "repository": {
13
13
  "type": "git",
@@ -21,16 +21,16 @@
21
21
  "node": ">=20"
22
22
  },
23
23
  "dependencies": {
24
- "lit": "^3.3.1"
24
+ "lit": "^3.3.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@aurodesignsystem/auro-button": "^12.3.2",
28
- "@aurodesignsystem/auro-cli": "^3.6.0",
28
+ "@aurodesignsystem/auro-cli": "^3.7.1",
29
29
  "@aurodesignsystem/auro-config": "^1.3.1",
30
30
  "@aurodesignsystem/auro-icon": "^9.2.0",
31
- "@aurodesignsystem/auro-library": "^5.12.3",
32
- "@aurodesignsystem/design-tokens": "^8.18.0",
33
- "@aurodesignsystem/webcorestylesheets": "^11.0.0",
31
+ "@aurodesignsystem/auro-library": "^5.13.3",
32
+ "@aurodesignsystem/design-tokens": "^9.3.2",
33
+ "@aurodesignsystem/webcorestylesheets": "^11.1.3",
34
34
  "husky": "^9.1.7"
35
35
  },
36
36
  "browserslist": [
package/demo/api.min.js DELETED
@@ -1,219 +0,0 @@
1
- import { A as AuroDialog, i as initBasicExample } from './auro-dialog.min.js';
2
-
3
- function initAccessibilityExample() {
4
- const button = document.querySelector("#openAccessibility");
5
- const dialog = document.querySelector("#unformattedMdDialog");
6
-
7
- button.addEventListener("click", () => {
8
- if (dialog.hasAttribute("open")) {
9
- dialog.removeAttribute("open");
10
- } else {
11
- dialog.setAttribute("open", true);
12
- }
13
- });
14
- }
15
-
16
- function initDecoupledExample() {
17
- const smLgButtons = [
18
- document.querySelector("#openSmLg"),
19
- document.querySelector("#closeSmLg"),
20
- ];
21
- const smLgDialog = document.querySelector("#smLgDialog");
22
-
23
- const mdLgButtons = [
24
- document.querySelector("#openMdLg"),
25
- document.querySelector("#closeMdLg"),
26
- ];
27
- const mdLgDialog = document.querySelector("#mdLgDialog");
28
-
29
- smLgButtons.forEach((button) => {
30
- button.addEventListener("click", () => {
31
- if (smLgDialog.hasAttribute("open")) {
32
- smLgDialog.removeAttribute("open");
33
- } else {
34
- smLgDialog.setAttribute("open", true);
35
- }
36
- });
37
- });
38
-
39
- mdLgButtons.forEach((button) => {
40
- button.addEventListener("click", () => {
41
- if (mdLgDialog.hasAttribute("open")) {
42
- mdLgDialog.removeAttribute("open");
43
- } else {
44
- mdLgDialog.setAttribute("open", true);
45
- }
46
- });
47
- });
48
- }
49
-
50
- function initEditCloseButtonExample() {
51
- const button = document.querySelector("#openEditDialog");
52
- const dialog = document.querySelector("#unformattedCustomMdDialog");
53
-
54
- button.addEventListener("click", () => {
55
- if (dialog.hasAttribute("open")) {
56
- dialog.removeAttribute("open");
57
- } else {
58
- dialog.setAttribute("open", true);
59
- }
60
- });
61
- }
62
-
63
- function initModalExample() {
64
- const defaultButtons = [
65
- document.querySelector("#openDefaultModal"),
66
- document.querySelector("#closeDefaultModal"),
67
- ];
68
- const defaultDialog = document.querySelector("#defaultModalDialog");
69
-
70
- const mediumButtons = [
71
- document.querySelector("#openMediumModal"),
72
- document.querySelector("#closeMediumModal"),
73
- ];
74
- const mediumDialog = document.querySelector("#mediumModalDialog");
75
-
76
- const smallButtons = [
77
- document.querySelector("#openSmallModal"),
78
- document.querySelector("#closeSmallModal"),
79
- ];
80
- const smallDialog = document.querySelector("#smallModalDialog");
81
-
82
- defaultButtons.forEach((button) => {
83
- button.addEventListener("click", () => {
84
- if (defaultDialog.hasAttribute("open")) {
85
- defaultDialog.removeAttribute("open");
86
- } else {
87
- defaultDialog.setAttribute("open", true);
88
- }
89
- });
90
- });
91
-
92
- mediumButtons.forEach((button) => {
93
- button.addEventListener("click", () => {
94
- if (mediumDialog.hasAttribute("open")) {
95
- mediumDialog.removeAttribute("open");
96
- } else {
97
- mediumDialog.setAttribute("open", true);
98
- }
99
- });
100
- });
101
-
102
- smallButtons.forEach((button) => {
103
- button.addEventListener("click", () => {
104
- if (smallDialog.hasAttribute("open")) {
105
- smallDialog.removeAttribute("open");
106
- } else {
107
- smallDialog.setAttribute("open", true);
108
- }
109
- });
110
- });
111
- }
112
-
113
- function initPopoverAndDropdownExample() {
114
- const buttons = [
115
- document.querySelector("#openPopAndDrop"),
116
- document.querySelector("#closePopAndDrop"),
117
- ];
118
- const dialog = document.querySelector("#popover-dialog");
119
-
120
- buttons.forEach((button) => {
121
- button.addEventListener("click", () => {
122
- if (dialog.hasAttribute("open")) {
123
- dialog.removeAttribute("open");
124
- } else {
125
- dialog.setAttribute("open", true);
126
- }
127
- });
128
- });
129
- }
130
-
131
- function initSizeOptionsExample() {
132
- const defaultButtons = [
133
- document.querySelector("#openDefaultSize"),
134
- document.querySelector("#closeDefaultSize"),
135
- ];
136
- const defaultDialog = document.querySelector("#defaultSizeDialog");
137
-
138
- const mediumButtons = [
139
- document.querySelector("#openMediumSize"),
140
- document.querySelector("#closeMediumSize"),
141
- ];
142
- const mediumDialog = document.querySelector("#mediumSizeDialog");
143
-
144
- const smallButtons = [
145
- document.querySelector("#openSmallSize"),
146
- document.querySelector("#closeSmallSize"),
147
- ];
148
- const smallDialog = document.querySelector("#smallSizeDialog");
149
-
150
- defaultButtons.forEach((button) => {
151
- button.addEventListener("click", () => {
152
- if (defaultDialog.hasAttribute("open")) {
153
- defaultDialog.removeAttribute("open");
154
- } else {
155
- defaultDialog.setAttribute("open", true);
156
- }
157
- });
158
- });
159
-
160
- mediumButtons.forEach((button) => {
161
- button.addEventListener("click", () => {
162
- if (mediumDialog.hasAttribute("open")) {
163
- mediumDialog.removeAttribute("open");
164
- } else {
165
- mediumDialog.setAttribute("open", true);
166
- }
167
- });
168
- });
169
-
170
- smallButtons.forEach((button) => {
171
- button.addEventListener("click", () => {
172
- if (smallDialog.hasAttribute("open")) {
173
- smallDialog.removeAttribute("open");
174
- } else {
175
- smallDialog.setAttribute("open", true);
176
- }
177
- });
178
- });
179
- }
180
-
181
- function initAriaLabelSlotExample() {
182
- const button = document.querySelector("#openAriaLabelSlot");
183
- const dialog = document.querySelector("#ariaLabelMdDialog");
184
-
185
- button.addEventListener("click", () => {
186
- if (dialog.hasAttribute("open")) {
187
- dialog.removeAttribute("open");
188
- } else {
189
- dialog.setAttribute("open", true);
190
- }
191
- });
192
- }
193
-
194
- AuroDialog.register();
195
-
196
- function initExamples(initCount) {
197
- // biome-ignore lint/style/noParameterAssign: legacy error handling
198
- initCount = initCount || 0;
199
-
200
- try {
201
- initBasicExample();
202
- initSizeOptionsExample();
203
- initModalExample();
204
- initDecoupledExample();
205
- initPopoverAndDropdownExample();
206
- initEditCloseButtonExample();
207
- initAriaLabelSlotExample();
208
- initAccessibilityExample();
209
- } catch (_err) {
210
- if (initCount <= 20) {
211
- // setTimeout handles issue where content is sometimes loaded after the functions get called
212
- setTimeout(() => {
213
- initExamples(initCount + 1);
214
- }, 100);
215
- }
216
- }
217
- }
218
-
219
- export { initExamples };