@aurodesignsystem/auro-dialog 4.1.1 → 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 (43) hide show
  1. package/CHANGELOG.md +4 -3
  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 +12 -759
  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 -137
  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/readme.min.js +3965 -0
  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-T9I85UZL.js +134 -0
  37. package/dist/index.d.ts +200 -91
  38. package/dist/index.js +1 -1
  39. package/dist/registered.js +1 -1
  40. package/package.json +8 -8
  41. package/demo/api.min.js +0 -219
  42. package/demo/auro-dialog.min.js +0 -950
  43. package/dist/auro-dialog-BNnIwNXB.js +0 -128
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,154 +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"];
85
+ /** If true, the dialog bib is in fullscreen mode. */
86
+ isBibFullscreen?: AuroDialog["isBibFullscreen"];
89
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.
90
88
  Must be used in conjunction with sm or md to have an effect. */
91
- "lg"?: AuroDialog['lg'];
89
+ lg?: AuroDialog["lg"];
92
90
  /** Sets dialog box to medium style. Adding both md and lg will set the dialog to md for desktop and lg for mobile. */
93
- "md"?: AuroDialog['md'];
91
+ md?: AuroDialog["md"];
94
92
  /** Modal dialog restricts the user to take an action (no default close actions). */
95
- "modal"?: AuroDialog['modal'];
93
+ modal?: AuroDialog["modal"];
96
94
  /** DEPRECATED - use `close-button-appearance="inverse" instead. */
97
- "onDark"?: AuroDialog['onDark'];
95
+ onDark?: AuroDialog["onDark"];
96
+ /** Sets state of dialog to open. */
97
+ open?: AuroDialog["isPopoverVisible"];
98
98
  /** Sets state of dialog to open. */
99
- "open"?: AuroDialog['open'];
99
+ isPopoverVisible?: AuroDialog["isPopoverVisible"];
100
100
  /** Sets dialog box to small style. Adding both sm and lg will set the dialog to sm for desktop and lg for mobile. */
101
- "sm"?: AuroDialog['sm'];
101
+ sm?: AuroDialog["sm"];
102
102
  /** Unformatted dialog window, edge-to-edge fill for content. */
103
- "unformatted"?: AuroDialog['unformatted'];
103
+ unformatted?: AuroDialog["unformatted"];
104
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. */
105
- "triggerElement"?: AuroDialog['triggerElement'];
105
+ triggerElement?: AuroDialog["triggerElement"];
106
106
 
107
107
  /** Event fires when the element is closed */
108
- "ontoggle"?: (e: CustomEvent<never>) => void;
109
- }
110
-
108
+ ontoggle?: (e: Event) => void;
109
+ };
111
110
 
112
- 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;
113
139
 
140
+ /** Set the innerHTML of the element */
141
+ innerHTML?: string;
142
+ /** Set the textContent of the element */
143
+ textContent?: string | number;
144
+ };
114
145
 
146
+ export type CustomElements = {
115
147
  /**
116
- * The `auro-dialog` appears on top of the page and presents information that requires the users immediate attention.
117
- *
118
- * ## Attributes & Properties
119
- *
120
- * Component attributes and properties that can be applied to the element or by using JavaScript.
121
- *
122
- * - `close-button-appearance`/`closeButtonAppearance`: Defines whether the close button should be light colored for use on dark backgrounds.
123
- * - `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.
124
- * Must be used in conjunction with sm or md to have an effect.
125
- * - `md`: Sets dialog box to medium style. Adding both md and lg will set the dialog to md for desktop and lg for mobile.
126
- * - `modal`: Modal dialog restricts the user to take an action (no default close actions).
127
- * - `onDark`: DEPRECATED - use `close-button-appearance="inverse" instead.
128
- * - `open`: Sets state of dialog to open.
129
- * - `sm`: Sets dialog box to small style. Adding both sm and lg will set the dialog to sm for desktop and lg for mobile.
130
- * - `unformatted`: Unformatted dialog window, edge-to-edge fill for content.
131
- * - `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)
132
- *
133
- * ## Events
134
- *
135
- * Events that will be emitted by the component.
136
- *
137
- * - `toggle`: Event fires when the element is closed
138
- *
139
- * ## Slots
140
- *
141
- * Areas where markup can be added to the component.
142
- *
143
- * - `ariaLabel.dialog.close`: Text to describe the "x" icon close button for screen readers. Default: "Close".
144
- * - `content`: Injects content into the body of the modal
145
- * - `footer`: Used for action options, e.g. buttons
146
- * - `header`: Text to display as the header of the modal
147
- *
148
- * ## Methods
149
- *
150
- * Methods that can be called to access component functionality.
151
- *
152
- * - `_initializeDefaults() => void`: undefined
153
- * - `register(name?: string = "auro-dialog") => void`: This will register this element with the browser.
154
- *
155
- * ## CSS Parts
156
- *
157
- * Custom selectors for styling elements within the component.
158
- *
159
- * - `close-button`: adjust position of the close X icon in the dialog window
160
- * - `dialog`: apply CSS to the entire dialog
161
- * - `dialog-content`: apply CSS to the content of the dialog
162
- * - `dialog-footer`: apply CSS to the footer of the dialog
163
- * - `dialog-header`: apply CSS to the header of the dialog
164
- * - `dialog-overlay`: apply CSS on the overlay of the dialog
165
- */
166
- "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
+ };
167
205
 
168
- }
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
+ };
169
270
 
170
- export type CustomCssProperties = {
271
+ export type CustomCssProperties = {};
171
272
 
273
+ declare module "react" {
274
+ namespace JSX {
275
+ interface IntrinsicElements extends CustomElements {}
276
+ }
172
277
  }
173
278
 
279
+ declare module "react/jsx-runtime" {
280
+ namespace JSX {
281
+ interface IntrinsicElements extends CustomElements {}
282
+ }
283
+ }
174
284
 
175
- declare module 'react' {
285
+ declare module "react/jsx-dev-runtime" {
176
286
  namespace JSX {
177
287
  interface IntrinsicElements extends CustomElements {}
178
288
  }
179
-
180
289
  }
181
290
 
182
- declare module 'preact' {
291
+ declare module "preact" {
183
292
  namespace JSX {
184
293
  interface IntrinsicElements extends CustomElements {}
185
294
  }
186
-
187
295
  }
188
296
 
189
- declare module '@builder.io/qwik' {
297
+ declare module "@builder.io/qwik" {
190
298
  namespace JSX {
191
299
  interface IntrinsicElements extends CustomElements {}
192
300
  }
193
-
194
301
  }
195
302
 
196
- declare module '@stencil/core' {
303
+ declare module "@stencil/core" {
197
304
  namespace JSX {
198
305
  interface IntrinsicElements extends CustomElements {}
199
306
  }
200
-
201
307
  }
202
308
 
203
- declare module 'hono/jsx' {
309
+ declare module "hono/jsx" {
204
310
  namespace JSX {
205
311
  interface IntrinsicElements extends CustomElements {}
206
312
  }
207
-
208
313
  }
209
314
 
210
- declare module 'react-native' {
315
+ declare module "react-native" {
211
316
  namespace JSX {
212
317
  interface IntrinsicElements extends CustomElements {}
213
318
  }
214
-
319
+ }
320
+
321
+ declare module "solid-js" {
322
+ namespace JSX {
323
+ interface IntrinsicElements extends CustomElementsSolidJs {}
324
+ }
215
325
  }
216
326
 
217
327
  declare global {
218
328
  namespace JSX {
219
329
  interface IntrinsicElements extends CustomElements {}
220
330
  }
221
-
222
331
  }
223
332
  declare global {
224
333
  namespace svelteHTML {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{A as AuroDialog}from"./auro-dialog-BNnIwNXB.js";import"lit";import"lit/directives/class-map.js";import"lit/static-html.js";import"lit/directives/if-defined.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-BNnIwNXB.js";import"lit";import"lit/directives/class-map.js";import"lit/static-html.js";import"lit/directives/if-defined.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.1.1",
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
- "@aurodesignsystem/auro-button": "^12.3.0",
28
- "@aurodesignsystem/auro-cli": "^3.5.0",
27
+ "@aurodesignsystem/auro-button": "^12.3.2",
28
+ "@aurodesignsystem/auro-cli": "^3.7.1",
29
29
  "@aurodesignsystem/auro-config": "^1.3.1",
30
- "@aurodesignsystem/auro-icon": "^9.1.1",
31
- "@aurodesignsystem/auro-library": "^5.5.4",
32
- "@aurodesignsystem/design-tokens": "^8.7.0",
33
- "@aurodesignsystem/webcorestylesheets": "^10.1.4",
30
+ "@aurodesignsystem/auro-icon": "^9.2.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 };