@aurodesignsystem/auro-dialog 4.2.2 → 4.2.3
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/CHANGELOG.md +3 -4
- package/README.md +35 -35
- package/demo/accessibility.js +3 -19
- package/demo/accessibility.md +22 -107
- package/demo/accessibility.min.js +122 -113
- package/demo/api.md +63 -40
- package/demo/customize.js +0 -2
- package/demo/customize.md +32 -82
- package/demo/customize.min.js +119 -85
- package/demo/design.js +0 -2
- package/demo/design.md +51 -94
- package/demo/design.min.js +119 -85
- package/demo/getting-started.md +61 -71
- package/demo/index.md +42 -42
- package/demo/index.min.js +119 -71
- package/demo/keyboard-behavior.md +15 -15
- package/demo/readme.md +34 -35
- package/demo/readme.min.js +119 -71
- package/demo/voiceover.md +9 -9
- package/demo/why-dialog.md +6 -6
- package/dist/auro-dialog-DwEbkZ4d.js +157 -0
- package/dist/index.d.ts +140 -87
- package/dist/index.js +1 -1
- package/dist/registered.js +1 -1
- package/package.json +8 -8
- package/dist/auro-dialog-FFeXiEB1.js +0 -134
package/demo/getting-started.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<auro-header level="1" id="overview">Dialog - Getting
|
|
1
|
+
<auro-header level="1" id="overview">Dialog - Getting started</auro-header>
|
|
2
2
|
<div class="contentWrapper">
|
|
3
3
|
<nav>
|
|
4
4
|
<auro-nav anchorNavContent=".scrollWrapper">
|
|
5
|
-
<span slot="mobileToggleCollapsed">View
|
|
6
|
-
<span slot="mobileToggleExpanded">View
|
|
5
|
+
<span slot="mobileToggleCollapsed">View more</span>
|
|
6
|
+
<span slot="mobileToggleExpanded">View less</span>
|
|
7
7
|
<auro-anchorlink fluid href="#setup">Setup</auro-anchorlink>
|
|
8
8
|
<auro-anchorlink fluid href="#recommendedAccordion" class="level2 body-xs" onclick="openAccordion('recommendedAccordion')">Recommended</auro-anchorlink>
|
|
9
9
|
<auro-anchorlink fluid href="#autoAccordion" class="level2 body-xs" onclick="openAccordion('autoAccordion')">Auto</auro-anchorlink>
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
<auro-anchorlink fluid href="#frameworks">Frameworks</auro-anchorlink>
|
|
12
12
|
<auro-anchorlink fluid href="#react" class="level2 body-xs" onclick="openAccordion('react')">React</auro-anchorlink>
|
|
13
13
|
<auro-anchorlink fluid href="#svelte" class="level2 body-xs" onclick="openAccordion('svelte')">Svelte</auro-anchorlink>
|
|
14
|
-
<auro-anchorlink fluid href="#minimalConfig">Minimal
|
|
14
|
+
<auro-anchorlink fluid href="#minimalConfig">Minimal config</auro-anchorlink>
|
|
15
15
|
<auro-anchorlink fluid href="#slots">Slots</auro-anchorlink>
|
|
16
|
-
<auro-anchorlink fluid href="#stateManagement">State
|
|
16
|
+
<auro-anchorlink fluid href="#stateManagement">State management</auro-anchorlink>
|
|
17
17
|
<auro-anchorlink fluid href="#open" class="level2 body-xs">open</auro-anchorlink>
|
|
18
18
|
<auro-anchorlink fluid href="#modal" class="level2 body-xs">modal</auro-anchorlink>
|
|
19
19
|
<auro-anchorlink fluid href="#triggerElement" class="level2 body-xs">triggerElement</auro-anchorlink>
|
|
@@ -27,25 +27,24 @@
|
|
|
27
27
|
<auro-header level="2" id="setup">Setup</auro-header>
|
|
28
28
|
<auro-accordion-group Emphasis>
|
|
29
29
|
<auro-accordion expanded class="section" id="recommendedAccordion">
|
|
30
|
-
<span slot="trigger">Recommended
|
|
30
|
+
<span slot="trigger">Recommended installation and implementation</span>
|
|
31
31
|
<div class="accordion-content">
|
|
32
32
|
<auro-header level="3">Install</auro-header>
|
|
33
33
|
<p>Install the <code>@aurodesignsystem/auro-dialog</code> package from npm:</p>
|
|
34
34
|
|
|
35
35
|
<pre class="language-shell"><code class="language-shell">$ npm i @aurodesignsystem/auro-dialog</code></pre>
|
|
36
36
|
|
|
37
|
-
<p>Installing as a dependency automatically installs its own dependencies (<code>auro-button</code> and <code>auro-icon</code>), which are registered internally under versioned tag names
|
|
37
|
+
<p>Installing as a dependency automatically installs its own dependencies (<code>auro-button</code> and <code>auro-icon</code>), which are registered internally under versioned tag names, so you don't need to register them yourself.</p>
|
|
38
38
|
<auro-header level="3">Implementation</auro-header>
|
|
39
39
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/customRegistration.md) -->
|
|
40
40
|
<!-- The below content is automatically added from ./../docs/partials/getting-started/customRegistration.md -->
|
|
41
41
|
<p>Every Auro component consists of a JavaScript <auro-hyperlink href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</auro-hyperlink> and a <auro-hyperlink href="https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define">custom element registration</auro-hyperlink>. The class defines the component's behavior, and the registration maps it to an HTML tag name so it can be used in markup.</p>
|
|
42
42
|
<p>The default import handles both steps automatically, registering the component under its standard <code><auro-dialog></code> tag name.</p>
|
|
43
|
-
<p>
|
|
43
|
+
<p>When two projects on the same page depend on different versions of the component, register the class under a custom tag name to avoid conflicts. Import the component class directly and call its <code>register(name)</code> method with a unique name:</p>
|
|
44
44
|
|
|
45
45
|
<pre class="language-js"><code class="language-js">// Import the class only
|
|
46
46
|
import { AuroDialog } from '@aurodesignsystem/auro-dialog/class';
|
|
47
|
-
|
|
48
|
-
// Register with a custom name
|
|
47
|
+
// Register with a custom name
|
|
49
48
|
AuroDialog.register('custom-dialog');</code></pre>
|
|
50
49
|
|
|
51
50
|
<p>This creates a new custom element <code><custom-dialog></code> that behaves exactly like <code><auro-dialog></code>, allowing both to coexist on the same page without interfering with each other.</p>
|
|
@@ -56,12 +55,12 @@ AuroDialog.register('custom-dialog');</code></pre>
|
|
|
56
55
|
<div slot="footer">
|
|
57
56
|
<auro-button id="closeCustom">Close</auro-button>
|
|
58
57
|
</div>
|
|
59
|
-
</custom-dialog></code></pre>
|
|
58
|
+
</custom-dialog></code></pre>
|
|
60
59
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
61
60
|
</div>
|
|
62
61
|
</auro-accordion>
|
|
63
62
|
<auro-accordion class="section" id="autoAccordion">
|
|
64
|
-
<span slot="trigger">Auto
|
|
63
|
+
<span slot="trigger">Auto installation and implementation</span>
|
|
65
64
|
<div class="accordion-content">
|
|
66
65
|
<p class="warning"><strong>Warning:</strong> Default registration can cause conflicts if another package registers the same tag name using a different version of the component, leading to unexpected behavior. Use custom registration to avoid this risk.</p>
|
|
67
66
|
<auro-header level="3">Implementation</auro-header>
|
|
@@ -71,7 +70,7 @@ AuroDialog.register('custom-dialog');</code></pre>
|
|
|
71
70
|
|
|
72
71
|
<pre class="language-js"><code class="language-js">import '@aurodesignsystem/auro-dialog';</code></pre>
|
|
73
72
|
|
|
74
|
-
<p>This import registers the <code><auro-dialog></code> custom element globally.
|
|
73
|
+
<p>This import registers the <code><auro-dialog></code> custom element globally. Then use it in your HTML:</p>
|
|
75
74
|
|
|
76
75
|
<pre class="language-html"><code class="language-html"><auro-dialog id="default-dialog">
|
|
77
76
|
<span slot="header">Dialog header</span>
|
|
@@ -79,21 +78,21 @@ AuroDialog.register('custom-dialog');</code></pre>
|
|
|
79
78
|
<div slot="footer">
|
|
80
79
|
<auro-button id="closeDefault">Close</auro-button>
|
|
81
80
|
</div>
|
|
82
|
-
</auro-dialog></code></pre>
|
|
81
|
+
</auro-dialog></code></pre>
|
|
83
82
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
84
83
|
</div>
|
|
85
84
|
</auro-accordion>
|
|
86
85
|
<auro-accordion class="section" id="cdnAccordion">
|
|
87
|
-
<span slot="trigger">CDN
|
|
86
|
+
<span slot="trigger">CDN installation</span>
|
|
88
87
|
<div class="accordion-content">
|
|
89
88
|
<p class="warning"><strong>Warning:</strong> CDN registration can cause conflicts if another package registers the same tag name using a different version of the component, leading to unexpected behavior. Use custom registration to avoid this risk.</p>
|
|
90
89
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/cdnRegistration.md) -->
|
|
91
90
|
<!-- The below content is automatically added from ./../docs/partials/getting-started/cdnRegistration.md -->
|
|
92
91
|
<p>Add the following script tag to your HTML to load the component directly from a CDN:</p>
|
|
93
92
|
|
|
94
|
-
<pre class="language-html"><code class="language-html"><script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-dialog@latest/+esm"></script></code></pre>
|
|
93
|
+
<pre class="language-html"><code class="language-html"><script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-dialog@latest/+esm"></script></code></pre>
|
|
95
94
|
|
|
96
|
-
<p>This script registers the <code><auro-dialog></code> custom element globally.
|
|
95
|
+
<p>This script registers the <code><auro-dialog></code> custom element globally. Then use it in your HTML:</p>
|
|
97
96
|
|
|
98
97
|
<pre class="language-html"><code class="language-html"><auro-dialog id="cdn-dialog">
|
|
99
98
|
<span slot="header">Dialog header</span>
|
|
@@ -101,7 +100,7 @@ AuroDialog.register('custom-dialog');</code></pre>
|
|
|
101
100
|
<div slot="footer">
|
|
102
101
|
<auro-button id="closeCdn">Close</auro-button>
|
|
103
102
|
</div>
|
|
104
|
-
</auro-dialog></code></pre>
|
|
103
|
+
</auro-dialog></code></pre>
|
|
105
104
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
106
105
|
</div>
|
|
107
106
|
</auro-accordion>
|
|
@@ -115,20 +114,18 @@ AuroDialog.register('custom-dialog');</code></pre>
|
|
|
115
114
|
<!-- The below content is automatically added from ./../docs/partials/getting-started/react.md -->
|
|
116
115
|
React 19 includes <auro-hyperlink href="https://react.dev/blog/2024/12/05/react-19#support-for-custom-elements">native support for custom elements</auro-hyperlink>, so <code><auro-dialog></code> works directly in JSX without any wrapper library.
|
|
117
116
|
|
|
118
|
-
<auro-header level="3" id="reactImport">Import the
|
|
119
|
-
Import and register the component at the top level of your application (
|
|
117
|
+
<auro-header level="3" id="reactImport">Import the component</auro-header>
|
|
118
|
+
Import and register the component at the top level of your application (for example, in your root `main.tsx` or `App.tsx`):
|
|
120
119
|
|
|
121
120
|
<pre class="language-js"><code class="language-js">import { AuroDialog } from '@aurodesignsystem/auro-dialog/class';
|
|
122
|
-
|
|
123
|
-
AuroDialog.register('custom-dialog');</code></pre>
|
|
121
|
+
AuroDialog.register('custom-dialog');</code></pre>
|
|
124
122
|
|
|
125
|
-
<auro-header level="3" id="reactTypeScript">TypeScript
|
|
126
|
-
The component ships with TypeScript type definitions for the `AuroDialog` class. However, React's JSX
|
|
123
|
+
<auro-header level="3" id="reactTypeScript">TypeScript declarations</auro-header>
|
|
124
|
+
The component ships with TypeScript type definitions for the `AuroDialog` class. However, React's JSX doesn't automatically map custom element tag names to their types. React 19 removed the global `JSX` namespace, so custom element types are registered by augmenting the `react` module rather than using `declare global`. Add the following declaration to a `.d.ts` file in your project:
|
|
127
125
|
|
|
128
126
|
<pre class="language-ts"><code class="language-ts">import type { HTMLAttributes } from 'react';
|
|
129
127
|
import type { AuroDialog } from '@aurodesignsystem/auro-dialog/class';
|
|
130
|
-
|
|
131
|
-
declare module 'react' {
|
|
128
|
+
declare module 'react' {
|
|
132
129
|
namespace JSX {
|
|
133
130
|
interface IntrinsicElements {
|
|
134
131
|
'custom-dialog': HTMLAttributes<AuroDialog> & Partial<AuroDialog>;
|
|
@@ -136,25 +133,22 @@ declare module 'react' {
|
|
|
136
133
|
}
|
|
137
134
|
}</code></pre>
|
|
138
135
|
|
|
139
|
-
If your `tsconfig.json` uses the automatic runtime (`"jsx": "react-jsx"`, the React 19 default) and the types
|
|
136
|
+
If your `tsconfig.json` uses the automatic runtime (`"jsx": "react-jsx"`, the React 19 default) and the types aren't picked up, augment `'react/jsx-runtime'` instead of `'react'`.
|
|
140
137
|
|
|
141
|
-
<auro-header level="3" id="reactState">Controlling the
|
|
138
|
+
<auro-header level="3" id="reactState">Controlling the open state</auro-header>
|
|
142
139
|
The dialog's visibility is controlled by the `open` attribute. Use component state to toggle it, and listen for the component's `toggle` event (which fires when the dialog closes) to keep your state in sync:
|
|
143
140
|
|
|
144
141
|
<pre class="language-jsx"><code class="language-jsx">import { useState, useRef, useEffect } from 'react';
|
|
145
|
-
|
|
146
|
-
export default function Example() {
|
|
142
|
+
export default function Example() {
|
|
147
143
|
const dialogRef = useRef(null);
|
|
148
144
|
const [open, setOpen] = useState(false);
|
|
149
|
-
|
|
150
|
-
useEffect(() => {
|
|
145
|
+
useEffect(() => {
|
|
151
146
|
const dialog = dialogRef.current;
|
|
152
147
|
const handleToggle = () => setOpen(false);
|
|
153
148
|
dialog?.addEventListener('toggle', handleToggle);
|
|
154
149
|
return () => dialog?.removeEventListener('toggle', handleToggle);
|
|
155
150
|
}, []);
|
|
156
|
-
|
|
157
|
-
return (
|
|
151
|
+
return (
|
|
158
152
|
<>
|
|
159
153
|
<auro-button onClick={() => setOpen(true)}>Open dialog</auro-button>
|
|
160
154
|
<custom-dialog ref={dialogRef} open={open || undefined}>
|
|
@@ -177,46 +171,42 @@ export default function Example() {
|
|
|
177
171
|
<!-- The below content is automatically added from ./../docs/partials/getting-started/svelte.md -->
|
|
178
172
|
Svelte works with custom elements out of the box, so <code><auro-dialog></code> can be used directly in your markup.
|
|
179
173
|
|
|
180
|
-
<auro-header level="3" id="svelteImport">Import the
|
|
181
|
-
Import and register the component in a script block
|
|
174
|
+
<auro-header level="3" id="svelteImport">Import the component</auro-header>
|
|
175
|
+
Import and register the component in a script block, either once at the app root or in the component that uses it:
|
|
182
176
|
|
|
183
177
|
<pre class="language-html"><code class="language-html"><script lang="ts">
|
|
184
178
|
import { AuroDialog } from '@aurodesignsystem/auro-dialog/class';
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
</script></code></pre>
|
|
179
|
+
AuroDialog.register('custom-dialog');
|
|
180
|
+
</script></code></pre>
|
|
188
181
|
|
|
189
|
-
<auro-header level="3" id="svelteTypeScript">TypeScript
|
|
190
|
-
Svelte
|
|
182
|
+
<auro-header level="3" id="svelteTypeScript">TypeScript declarations</auro-header>
|
|
183
|
+
Svelte doesn't automatically know about custom element attributes. To get autocomplete and type checking for `<auro-dialog>` props in templates, add the following to a `.d.ts` file in your project, such as `src/auro-elements.d.ts`:
|
|
191
184
|
|
|
192
185
|
<pre class="language-ts"><code class="language-ts">import type { AuroDialog } from '@aurodesignsystem/auro-dialog/class';
|
|
193
|
-
|
|
194
|
-
declare namespace svelteHTML {
|
|
186
|
+
declare namespace svelteHTML {
|
|
195
187
|
interface IntrinsicElements {
|
|
196
188
|
'custom-dialog': Partial<AuroDialog> & svelteHTML.HTMLAttributes<AuroDialog>;
|
|
197
189
|
}
|
|
198
190
|
}</code></pre>
|
|
199
191
|
|
|
200
|
-
<auro-header level="3" id="svelteState">Controlling the
|
|
192
|
+
<auro-header level="3" id="svelteState">Controlling the open state</auro-header>
|
|
201
193
|
Bind the `open` attribute to a reactive state value, and listen for the component's `toggle` event to reset it when the dialog is dismissed:
|
|
202
194
|
|
|
203
195
|
<pre class="language-html"><code class="language-html"><script lang="ts">
|
|
204
196
|
import { AuroDialog } from '@aurodesignsystem/auro-dialog/class';
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
<auro-button onclick={() => (open = true)}>Open dialog</auro-button>
|
|
211
|
-
<custom-dialog {open} ontoggle={() => (open = false)}>
|
|
197
|
+
AuroDialog.register('custom-dialog');
|
|
198
|
+
let open = $state(false);
|
|
199
|
+
</script>
|
|
200
|
+
<auro-button onclick={() => (open = true)}>Open dialog</auro-button>
|
|
201
|
+
<custom-dialog {open} ontoggle={() => (open = false)}>
|
|
212
202
|
<span slot="header">Dialog header</span>
|
|
213
203
|
<div slot="content">Dialog content</div>
|
|
214
204
|
<div slot="footer">
|
|
215
205
|
<auro-button onclick={() => (open = false)}>Close</auro-button>
|
|
216
206
|
</div>
|
|
217
|
-
</custom-dialog></code></pre>
|
|
207
|
+
</custom-dialog></code></pre>
|
|
218
208
|
|
|
219
|
-
<auro-header level="3" id="svelteModuleResolution">Module
|
|
209
|
+
<auro-header level="3" id="svelteModuleResolution">Module resolution</auro-header>
|
|
220
210
|
Ensure your `tsconfig.json` uses `"moduleResolution": "bundler"` so TypeScript can resolve the component's package exports:
|
|
221
211
|
|
|
222
212
|
<pre class="language-json"><code class="language-json">{
|
|
@@ -230,13 +220,14 @@ Ensure your `tsconfig.json` uses `"moduleResolution": "bundler"` so TypeScript c
|
|
|
230
220
|
</auro-accordion-group>
|
|
231
221
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/minimal-config.md) -->
|
|
232
222
|
<!-- The below content is automatically added from ./../docs/partials/getting-started/minimal-config.md -->
|
|
233
|
-
<auro-header level="2" id="minimalConfig">Minimal
|
|
234
|
-
<p>
|
|
223
|
+
<auro-header level="2" id="minimalConfig">Minimal configuration</auro-header>
|
|
224
|
+
<p>A minimal <code><auro-dialog></code> has:</p>
|
|
235
225
|
<ul>
|
|
236
|
-
<li><strong>A unique <code>id</code
|
|
237
|
-
<li><strong>Content in the <code>header</code
|
|
238
|
-
<li><strong>A trigger that
|
|
239
|
-
</ul>
|
|
226
|
+
<li><strong>A unique <code>id</code></strong>: Lets the control that opens the dialog find it.</li>
|
|
227
|
+
<li><strong>Content in the <code>header</code> and <code>content</code> slots</strong>: The <code>header</code> slot labels the dialog for screen readers, and the <code>content</code> slot holds the body.</li>
|
|
228
|
+
<li><strong>A trigger that sets <code>open</code></strong>: The dialog doesn't open on its own, so a control on the page must set its <code>open</code> attribute or property.</li>
|
|
229
|
+
</ul>
|
|
230
|
+
<p>Add a button in the <code>footer</code> slot so people can close the dialog. A <code>modal</code> dialog needs one, because it has no close button.</p>
|
|
240
231
|
|
|
241
232
|
<pre class="language-html"><code class="language-html"><auro-dialog id="minimal">
|
|
242
233
|
<span slot="header">Header content</span>
|
|
@@ -244,44 +235,43 @@ Ensure your `tsconfig.json` uses `"moduleResolution": "bundler"` so TypeScript c
|
|
|
244
235
|
<div slot="footer">
|
|
245
236
|
<auro-button id="closeMinimal">Close</auro-button>
|
|
246
237
|
</div>
|
|
247
|
-
</auro-dialog></code></pre>
|
|
238
|
+
</auro-dialog></code></pre>
|
|
248
239
|
|
|
249
240
|
<auro-header level="3" id="minimalConfigTrigger">Opening and closing the dialog</auro-header>
|
|
250
|
-
<p>
|
|
241
|
+
<p>Control the open state with the <code>open</code> attribute, or set the <code>open</code> property to <code>true</code> in JavaScript. The example below toggles the attribute from a helper function:</p>
|
|
251
242
|
|
|
252
243
|
<pre class="language-js"><code class="language-js">function toggleDialog(dialogID) {
|
|
253
244
|
const dialog = document.querySelector(dialogID);
|
|
254
|
-
|
|
255
|
-
if (dialog.hasAttribute('open')) {
|
|
245
|
+
if (dialog.hasAttribute('open')) {
|
|
256
246
|
dialog.removeAttribute('open');
|
|
257
247
|
} else {
|
|
258
248
|
dialog.setAttribute('open', true);
|
|
259
249
|
}
|
|
260
250
|
}</code></pre>
|
|
261
251
|
|
|
262
|
-
<pre class="language-html"><code class="language-html"><auro-button onclick="toggleDialog('#minimal')">Open dialog</auro-button></code></pre>
|
|
252
|
+
<pre class="language-html"><code class="language-html"><auro-button onclick="toggleDialog('#minimal')">Open dialog</auro-button></code></pre>
|
|
263
253
|
|
|
264
|
-
<p>The component also
|
|
254
|
+
<p>The component also has <code>show()</code> and <code>hide()</code> methods, and dispatches a <code>toggle</code> event when it closes.</p>
|
|
265
255
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
266
256
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/slots.md) -->
|
|
267
257
|
<!-- The below content is automatically added from ./../docs/partials/getting-started/slots.md -->
|
|
268
258
|
<auro-header level="2" id="slots">Slots</auro-header>
|
|
269
259
|
<p>The following slots are available on the <code><auro-dialog></code> element.</p>
|
|
270
260
|
<auro-header level="3" id="slot-header">header</auro-header>
|
|
271
|
-
<p>Text
|
|
261
|
+
<p>Text for the dialog's heading, which also names the dialog for screen readers. Isn't shown when <code>unformatted</code> is set.</p>
|
|
272
262
|
<auro-header level="3" id="slot-content">content</auro-header>
|
|
273
|
-
<p>
|
|
263
|
+
<p>Content for the body of the dialog. In an <code>unformatted</code> dialog, this slot fills the whole dialog window edge to edge.</p>
|
|
274
264
|
<auro-header level="3" id="slot-footer">footer</auro-header>
|
|
275
|
-
<p>
|
|
265
|
+
<p>Action buttons for the dialog, such as Close. A <code>modal</code> dialog needs a button here, because it has no close button. Isn't shown when <code>unformatted</code> is set.</p>
|
|
276
266
|
<auro-header level="3" id="slot-ariaLabel-dialog-close">ariaLabel.dialog.close</auro-header>
|
|
277
|
-
<p>Text
|
|
267
|
+
<p>Text screen readers read for the close button, for example "Close dialog". Defaults to "Close". Has no effect when <code>modal</code> is set, because a modal dialog has no close button.</p>
|
|
278
268
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
279
|
-
<auro-header level="2" id="stateManagement">State
|
|
269
|
+
<auro-header level="2" id="stateManagement">State management</auro-header>
|
|
280
270
|
<p>The following properties reflect and control the current state of the component and can be accessed via JavaScript.</p>
|
|
281
271
|
<auro-header level="3" id="open">open</auro-header>
|
|
282
272
|
<p>Gets or sets the visibility of the dialog. Setting <code>open</code> to <code>true</code> shows the dialog; setting it to <code>false</code> hides it. Reflected to the <code>open</code> attribute.</p>
|
|
283
273
|
<auro-header level="3" id="modal">modal</auro-header>
|
|
284
|
-
<p>When <code>true</code>, the dialog is blocking: the close button
|
|
274
|
+
<p>When <code>true</code>, the dialog is blocking: the close button isn't rendered, <code>Esc</code> and backdrop clicks don't dismiss it, and the user must resolve it with an explicit footer action.</p>
|
|
285
275
|
<auro-header level="3" id="triggerElement">triggerElement</auro-header>
|
|
286
276
|
<p>A fallback element to focus when the dialog closes. By default focus returns to whatever element was active (<code>document.activeElement</code>) when the dialog opened; <code>triggerElement</code> is used only when no element was active at that moment.</p>
|
|
287
277
|
<auro-header level="2" id="publicFunctions">Functions</auro-header>
|
package/demo/index.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<auro-header level="1" id="overview">Dialog - Overview and UX
|
|
1
|
+
<auro-header level="1" id="overview">Dialog - Overview and UX guide</auro-header>
|
|
2
2
|
<div class="contentWrapper">
|
|
3
3
|
<nav>
|
|
4
4
|
<auro-nav anchorNavContent=".scrollWrapper">
|
|
5
|
-
<span slot="mobileToggleCollapsed">View
|
|
6
|
-
<span slot="mobileToggleExpanded">View
|
|
5
|
+
<span slot="mobileToggleCollapsed">View more</span>
|
|
6
|
+
<span slot="mobileToggleExpanded">View less</span>
|
|
7
7
|
<auro-anchorlink fluid href="#description">Description</auro-anchorlink>
|
|
8
|
-
<auro-anchorlink fluid href="#useCases">Use
|
|
9
|
-
<auro-anchorlink fluid href="#userStories">User
|
|
8
|
+
<auro-anchorlink fluid href="#useCases">Use cases</auro-anchorlink>
|
|
9
|
+
<auro-anchorlink fluid href="#userStories">User stories</auro-anchorlink>
|
|
10
10
|
<auro-anchorlink fluid href="#modalExample">Modal</auro-anchorlink>
|
|
11
11
|
</auro-nav>
|
|
12
12
|
</nav>
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
<auro-header level="2" id="description">Description</auro-header>
|
|
16
16
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
|
|
17
17
|
<!-- The below content is automatically added from ./../docs/partials/description.md -->
|
|
18
|
-
<p>The <code><auro-dialog></code> component
|
|
19
|
-
<p>
|
|
20
|
-
<p>Auro
|
|
18
|
+
<p>The <code><auro-dialog></code> component interrupts the page and moves focus into the dialog. Use it when people need to notice the content right away.</p>
|
|
19
|
+
<p>Use <code>modal</code> when people must act before they continue. A modal dialog can't be dismissed passively, so add a footer button that closes it.</p>
|
|
20
|
+
<p>Auro follows the <a class="hyperlink" href="https://www.nngroup.com/articles/modal-nonmodal-dialog/" target="_blank">Nielsen Norman Group</a>'s guidance on dialogs and modals.</p>
|
|
21
21
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
22
22
|
<div class="exampleWrapper">
|
|
23
23
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/basic.html) -->
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<auro-button id="openBasic">Open default dialog</auro-button>
|
|
27
27
|
</div>
|
|
28
28
|
<auro-dialog id="defaultDialog">
|
|
29
|
-
<span slot="header">Default
|
|
29
|
+
<span slot="header">Default dialog</span>
|
|
30
30
|
<div slot="content">
|
|
31
31
|
<p>When traveling on Alaska Airlines flights, Alaska Airlines checked baggage fees may apply. See <auro-hyperlink href="https://www.alaskaair.com/bagrules" target="_blank">alaskaair.com/bagrules</auro-hyperlink> for our rules. For itineraries that include other airlines, their checked baggage fees may apply, as displayed on their websites.</p>
|
|
32
32
|
<p>Baggage rules and fees will be based on the specific itinerary chosen. The applicable first and second bag fees will be displayed after you have added flights to the cart.</p>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</ul>
|
|
40
40
|
</div>
|
|
41
41
|
<div slot="footer">
|
|
42
|
-
<auro-button secondary id="closeBasic">Close</auro-button>
|
|
42
|
+
<auro-button variant="secondary" id="closeBasic">Close</auro-button>
|
|
43
43
|
</div>
|
|
44
44
|
</auro-dialog>
|
|
45
45
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
|
|
52
52
|
<pre class="language-html"><code class="language-html"><div>
|
|
53
53
|
<auro-button id="openBasic">Open default dialog</auro-button>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<span slot="header">Default
|
|
54
|
+
</div>
|
|
55
|
+
<auro-dialog id="defaultDialog">
|
|
56
|
+
<span slot="header">Default dialog</span>
|
|
57
57
|
<div slot="content">
|
|
58
58
|
<p>When traveling on Alaska Airlines flights, Alaska Airlines checked baggage fees may apply. See <auro-hyperlink href="https://www.alaskaair.com/bagrules" target="_blank">alaskaair.com/bagrules</auro-hyperlink> for our rules. For itineraries that include other airlines, their checked baggage fees may apply, as displayed on their websites.</p>
|
|
59
59
|
<p>Baggage rules and fees will be based on the specific itinerary chosen. The applicable first and second bag fees will be displayed after you have added flights to the cart.</p>
|
|
@@ -66,34 +66,34 @@
|
|
|
66
66
|
</ul>
|
|
67
67
|
</div>
|
|
68
68
|
<div slot="footer">
|
|
69
|
-
<auro-button secondary id="closeBasic">Close</auro-button>
|
|
69
|
+
<auro-button variant="secondary" id="closeBasic">Close</auro-button>
|
|
70
70
|
</div>
|
|
71
|
-
</auro-dialog></code></pre>
|
|
71
|
+
</auro-dialog></code></pre>
|
|
72
72
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
73
73
|
</auro-accordion>
|
|
74
|
-
<auro-header level="2" id="useCases">Use
|
|
74
|
+
<auro-header level="2" id="useCases">Use cases</auro-header>
|
|
75
75
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/useCases.md) -->
|
|
76
76
|
<!-- The below content is automatically added from ./../docs/partials/useCases.md -->
|
|
77
|
-
<p>
|
|
77
|
+
<p>Use <code><auro-dialog></code> when people need to:</p>
|
|
78
78
|
<ul>
|
|
79
|
-
<li>
|
|
80
|
-
<li>
|
|
79
|
+
<li>Take an action before they do anything else or go back</li>
|
|
80
|
+
<li>View content that they can close when they're done</li>
|
|
81
81
|
</ul>
|
|
82
82
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
83
|
-
<auro-header level="2" id="userStories">User
|
|
83
|
+
<auro-header level="2" id="userStories">User stories</auro-header>
|
|
84
84
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/index/userStories.md) -->
|
|
85
85
|
<!-- The below content is automatically added from ./../docs/partials/index/userStories.md -->
|
|
86
86
|
<p>The following user stories describe the primary ways the <code><auro-dialog></code> component is intended to be used.</p>
|
|
87
87
|
<auro-header level="3" id="story-dismissible">Dismissible dialog</auro-header>
|
|
88
|
-
<p>As a user, I want to be shown important supplemental information in a focused overlay that I can dismiss
|
|
88
|
+
<p>As a user, I want to be shown important supplemental information in a focused overlay that I can dismiss by pressing the close button, pressing <code>Esc</code>, or clicking outside the dialog, so I can return to the main content when I'm done reading.</p>
|
|
89
89
|
<auro-header level="3" id="story-modal">Modal (blocking) dialog</auro-header>
|
|
90
90
|
<p>As a user, I need to be prompted to make a decision or acknowledge information before I can continue, so the experience presents a modal dialog that I must resolve with an explicit action before returning to the page.</p>
|
|
91
91
|
<auro-header level="3" id="story-unformatted">Unformatted dialog</auro-header>
|
|
92
92
|
<p>As a developer, I want the open/close behavior, focus management, and accessibility tooling of the dialog while supplying my own edge-to-edge layout, so I can present rich media or a fully custom composition inside the dialog window.</p>
|
|
93
93
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
94
94
|
<auro-header level="2" id="modalExample">Modal</auro-header>
|
|
95
|
-
<p>The <code>modal</code> attribute locks the user into interacting with the dialog. The close icon
|
|
96
|
-
<p>Freezing the page behind the dialog
|
|
95
|
+
<p>The <code>modal</code> attribute locks the user into interacting with the dialog. The close icon isn't rendered and clicking outside the dialog doesn't dismiss it, so a <code>modal</code> dialog must include an explicit action button in the footer to dismiss it.</p>
|
|
96
|
+
<p>Freezing the page behind the dialog isn't what <code>modal</code> controls. Every dialog does that while it's open, and restores the scroll position on close. What <code>modal</code> changes is how the dialog can be dismissed. See the Accessibility page for details.</p>
|
|
97
97
|
<div class="exampleWrapper">
|
|
98
98
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/modal.html) -->
|
|
99
99
|
<!-- The below content is automatically added from ./../apiExamples/modal.html -->
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
<auro-button id="openSmallModal">Open small modal</auro-button>
|
|
104
104
|
</div>
|
|
105
105
|
<auro-dialog id="defaultModalDialog" modal>
|
|
106
|
-
<span slot="header">Default
|
|
106
|
+
<span slot="header">Default modal dialog</span>
|
|
107
107
|
<div slot="content">
|
|
108
108
|
<p>When traveling on Alaska Airlines flights, Alaska Airlines checked baggage fees may apply. See <auro-hyperlink href="https://www.alaskaair.com/bagrules" target="_blank">alaskaair.com/bagrules</auro-hyperlink> for our rules. For itineraries that include other airlines, their checked baggage fees may apply, as displayed on their websites.</p>
|
|
109
109
|
<p>Baggage rules and fees will be based on the specific itinerary chosen. The applicable first and second bag fees will be displayed after you have added flights to the cart.</p>
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
</div>
|
|
118
118
|
<div slot="footer">
|
|
119
119
|
<auro-button id="closeDefaultModal">I understand
|
|
120
|
-
<auro-icon category="interface" name="chevron-right"
|
|
120
|
+
<auro-icon category="interface" name="chevron-right" appearance="inverse"></auro-icon>
|
|
121
121
|
</auro-button>
|
|
122
122
|
</div>
|
|
123
123
|
</auro-dialog>
|
|
124
124
|
<auro-dialog id="mediumModalDialog" md modal>
|
|
125
|
-
<span slot="header">Medium
|
|
125
|
+
<span slot="header">Medium modal dialog</span>
|
|
126
126
|
<div slot="content">
|
|
127
127
|
<p>When traveling on Alaska Airlines flights, Alaska Airlines checked baggage fees may apply. See <auro-hyperlink href="https://www.alaskaair.com/bagrules" target="_blank">alaskaair.com/bagrules</auro-hyperlink> for our rules. For itineraries that include other airlines, their checked baggage fees may apply, as displayed on their websites.</p>
|
|
128
128
|
<p>Baggage rules and fees will be based on the specific itinerary chosen. The applicable first and second bag fees will be displayed after you have added flights to the cart.</p>
|
|
@@ -136,12 +136,12 @@
|
|
|
136
136
|
</div>
|
|
137
137
|
<div slot="footer">
|
|
138
138
|
<auro-button id="closeMediumModal">I understand
|
|
139
|
-
<auro-icon category="interface" name="chevron-right"
|
|
139
|
+
<auro-icon category="interface" name="chevron-right" appearance="inverse"></auro-icon>
|
|
140
140
|
</auro-button>
|
|
141
141
|
</div>
|
|
142
142
|
</auro-dialog>
|
|
143
143
|
<auro-dialog id="smallModalDialog" sm modal>
|
|
144
|
-
<span slot="header">Small
|
|
144
|
+
<span slot="header">Small modal dialog</span>
|
|
145
145
|
<div slot="content">
|
|
146
146
|
<p>When traveling on Alaska Airlines flights, Alaska Airlines checked baggage fees may apply. See <auro-hyperlink href="https://www.alaskaair.com/bagrules" target="_blank">alaskaair.com/bagrules</auro-hyperlink> for our rules. For itineraries that include other airlines, their checked baggage fees may apply, as displayed on their websites.</p>
|
|
147
147
|
<p>Baggage rules and fees will be based on the specific itinerary chosen. The applicable first and second bag fees will be displayed after you have added flights to the cart.</p>
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
</div>
|
|
156
156
|
<div slot="footer">
|
|
157
157
|
<auro-button id="closeSmallModal">I understand
|
|
158
|
-
<auro-icon category="interface" name="chevron-right"
|
|
158
|
+
<auro-icon category="interface" name="chevron-right" appearance="inverse"></auro-icon>
|
|
159
159
|
</auro-button>
|
|
160
160
|
</div>
|
|
161
161
|
</auro-dialog>
|
|
@@ -170,9 +170,9 @@
|
|
|
170
170
|
<auro-button id="openDefaultModal">Open default modal</auro-button>
|
|
171
171
|
<auro-button id="openMediumModal">Open medium modal</auro-button>
|
|
172
172
|
<auro-button id="openSmallModal">Open small modal</auro-button>
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
<span slot="header">Default
|
|
173
|
+
</div>
|
|
174
|
+
<auro-dialog id="defaultModalDialog" modal>
|
|
175
|
+
<span slot="header">Default modal dialog</span>
|
|
176
176
|
<div slot="content">
|
|
177
177
|
<p>When traveling on Alaska Airlines flights, Alaska Airlines checked baggage fees may apply. See <auro-hyperlink href="https://www.alaskaair.com/bagrules" target="_blank">alaskaair.com/bagrules</auro-hyperlink> for our rules. For itineraries that include other airlines, their checked baggage fees may apply, as displayed on their websites.</p>
|
|
178
178
|
<p>Baggage rules and fees will be based on the specific itinerary chosen. The applicable first and second bag fees will be displayed after you have added flights to the cart.</p>
|
|
@@ -186,12 +186,12 @@
|
|
|
186
186
|
</div>
|
|
187
187
|
<div slot="footer">
|
|
188
188
|
<auro-button id="closeDefaultModal">I understand
|
|
189
|
-
<auro-icon category="interface" name="chevron-right"
|
|
189
|
+
<auro-icon category="interface" name="chevron-right" appearance="inverse"></auro-icon>
|
|
190
190
|
</auro-button>
|
|
191
191
|
</div>
|
|
192
|
-
</auro-dialog>
|
|
193
|
-
|
|
194
|
-
<span slot="header">Medium
|
|
192
|
+
</auro-dialog>
|
|
193
|
+
<auro-dialog id="mediumModalDialog" md modal>
|
|
194
|
+
<span slot="header">Medium modal dialog</span>
|
|
195
195
|
<div slot="content">
|
|
196
196
|
<p>When traveling on Alaska Airlines flights, Alaska Airlines checked baggage fees may apply. See <auro-hyperlink href="https://www.alaskaair.com/bagrules" target="_blank">alaskaair.com/bagrules</auro-hyperlink> for our rules. For itineraries that include other airlines, their checked baggage fees may apply, as displayed on their websites.</p>
|
|
197
197
|
<p>Baggage rules and fees will be based on the specific itinerary chosen. The applicable first and second bag fees will be displayed after you have added flights to the cart.</p>
|
|
@@ -205,12 +205,12 @@
|
|
|
205
205
|
</div>
|
|
206
206
|
<div slot="footer">
|
|
207
207
|
<auro-button id="closeMediumModal">I understand
|
|
208
|
-
<auro-icon category="interface" name="chevron-right"
|
|
208
|
+
<auro-icon category="interface" name="chevron-right" appearance="inverse"></auro-icon>
|
|
209
209
|
</auro-button>
|
|
210
210
|
</div>
|
|
211
|
-
</auro-dialog>
|
|
212
|
-
|
|
213
|
-
<span slot="header">Small
|
|
211
|
+
</auro-dialog>
|
|
212
|
+
<auro-dialog id="smallModalDialog" sm modal>
|
|
213
|
+
<span slot="header">Small modal dialog</span>
|
|
214
214
|
<div slot="content">
|
|
215
215
|
<p>When traveling on Alaska Airlines flights, Alaska Airlines checked baggage fees may apply. See <auro-hyperlink href="https://www.alaskaair.com/bagrules" target="_blank">alaskaair.com/bagrules</auro-hyperlink> for our rules. For itineraries that include other airlines, their checked baggage fees may apply, as displayed on their websites.</p>
|
|
216
216
|
<p>Baggage rules and fees will be based on the specific itinerary chosen. The applicable first and second bag fees will be displayed after you have added flights to the cart.</p>
|
|
@@ -224,10 +224,10 @@
|
|
|
224
224
|
</div>
|
|
225
225
|
<div slot="footer">
|
|
226
226
|
<auro-button id="closeSmallModal">I understand
|
|
227
|
-
<auro-icon category="interface" name="chevron-right"
|
|
227
|
+
<auro-icon category="interface" name="chevron-right" appearance="inverse"></auro-icon>
|
|
228
228
|
</auro-button>
|
|
229
229
|
</div>
|
|
230
|
-
</auro-dialog></code></pre>
|
|
230
|
+
</auro-dialog></code></pre>
|
|
231
231
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
232
232
|
</auro-accordion>
|
|
233
233
|
</div>
|