@aurodesignsystem/auro-dialog 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/CHANGELOG.md +24 -0
- package/LICENSE +201 -0
- package/README.md +226 -0
- package/demo/api.md +725 -0
- package/demo/index.md +200 -0
- package/dist/auro-dialog.d.ts +22 -0
- package/dist/auro-dialog.d.ts.map +1 -0
- package/dist/auro-dialog__bundled.js +362 -0
- package/dist/componentBase.d.ts +113 -0
- package/dist/componentBase.d.ts.map +1 -0
- package/dist/componentBase.js +278 -0
- package/dist/style-css.d.ts +3 -0
- package/dist/style-css.d.ts.map +1 -0
- package/dist/style-fixed-css.d.ts +3 -0
- package/dist/style-fixed-css.d.ts.map +1 -0
- package/dist/style-fixed-css.js +2 -0
- package/dist/style-unformatted-css.d.ts +3 -0
- package/dist/style-unformatted-css.d.ts.map +1 -0
- package/dist/style-unformatted-css.js +2 -0
- package/dist/style-unformatted-fixed-css.d.ts +3 -0
- package/dist/style-unformatted-fixed-css.d.ts.map +1 -0
- package/dist/style-unformatted-fixed-css.js +2 -0
- package/index.js +15 -0
- package/package.json +160 -0
- package/packageScripts/postinstall.mjs +28 -0
- package/src/auro-dialog.js +36 -0
- package/src/componentBase.js +278 -0
- package/src/style-css.js +2 -0
- package/src/style-fixed-css.js +2 -0
- package/src/style-unformatted-css.js +2 -0
- package/src/style-unformatted-fixed-css.js +2 -0
package/demo/index.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
The demo.md file is a compiled document. No edits should be made directly to this file.
|
|
3
|
+
README.md is created by running `npm run build:docs`.
|
|
4
|
+
This file is generated based on a template fetched from `./docs/partials/demo.md`
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
# Dialog
|
|
8
|
+
|
|
9
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./description.md) -->
|
|
10
|
+
<!-- The below content is automatically added from ./description.md -->
|
|
11
|
+
The `<auro-dialog>` component is an intrusive interactive component, not passive. The component is best used when there is a requirement the user be made aware of the content being shown, moving focus from the main content to the dialog content.
|
|
12
|
+
|
|
13
|
+
The component also supports a modal (blocking) state where the user must interact with the content of the component in order to continue. Passive dismissal of the content is not allowed. Users of this state must add a trigger for the user to move beyond this content.
|
|
14
|
+
|
|
15
|
+
Auro holds the opinions of the [Nielsen Norman Group](https://www.nngroup.com/articles/modal-nonmodal-dialog/) on dialog and modal use to be true.
|
|
16
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
17
|
+
|
|
18
|
+
## auro-dialog use cases
|
|
19
|
+
|
|
20
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./useCases.md) -->
|
|
21
|
+
<!-- The below content is automatically added from ./useCases.md -->
|
|
22
|
+
The `<auro-dialog>` component should be used in situations where users may:
|
|
23
|
+
|
|
24
|
+
* Be prompted to take an action before doing anything else or going back
|
|
25
|
+
* Be prompted to view content with the option of closing it
|
|
26
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
27
|
+
|
|
28
|
+
## Additional Information
|
|
29
|
+
|
|
30
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./readmeAddlInfo.md) -->
|
|
31
|
+
<!-- The below content is automatically added from ./readmeAddlInfo.md -->
|
|
32
|
+
**Important Notice**: This component no longer lives within the `auro-interruption` repository, as that is now being deprecated. `<auro-dialog>` is now a standalone component and users will be required to install it seperately. See the [Install Page](https://auro.alaskaair.com/components/auro/dialog/install) for instructions on how to install the component.
|
|
33
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
34
|
+
|
|
35
|
+
## Set Up
|
|
36
|
+
|
|
37
|
+
Triggering the dialog relies on functions being installed. See the following example code that is installed into this demo.
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
function toggleDialog(elem) {
|
|
41
|
+
let dialog = document.querySelector(elem);
|
|
42
|
+
|
|
43
|
+
dialog.hasAttribute('open')
|
|
44
|
+
? dialog.removeAttribute("open")
|
|
45
|
+
: (dialog.removeAttribute("open"),
|
|
46
|
+
dialog.setAttribute("open", true));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// This function can be retrieved from https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-dialog@latest/dist/toggleDialog.js
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Once the JavaScript is added to the scope of the experience, the next part is adding a trigger. In this example, the button component will toggle a dialog with the ID of `#demo1`.
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
<auro-button onClick="toggleDialog('#demo1')">Open Default Dialog</auro-button>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## The Structure
|
|
59
|
+
|
|
60
|
+
The structure of the dialog itself consists of three slots. The `header`, `content` and `footer` slots. See the scaffolding example below for adding content to the component.
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
<auro-dialog id="[unique ID]">
|
|
64
|
+
<span slot="header">[header content]</span>
|
|
65
|
+
<span slot="content">
|
|
66
|
+
[body content]
|
|
67
|
+
</span>
|
|
68
|
+
<span slot="footer">
|
|
69
|
+
[footer content]
|
|
70
|
+
</span>
|
|
71
|
+
</auro-dialog>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
It should be noted that the `footer` slot is reserved for the placement of action buttons.
|
|
75
|
+
|
|
76
|
+
## Example(s)
|
|
77
|
+
|
|
78
|
+
<div class="exampleWrapper">
|
|
79
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/basic.html) -->
|
|
80
|
+
<!-- The below content is automatically added from ./../../apiExamples/basic.html -->
|
|
81
|
+
<div>
|
|
82
|
+
<auro-button onClick="toggleDialog('#defaultDialog')">Open default dialog</auro-button>
|
|
83
|
+
</div>
|
|
84
|
+
<auro-dialog id="defaultDialog">
|
|
85
|
+
<span slot="header">Default Dialog</span>
|
|
86
|
+
<div slot="content">
|
|
87
|
+
<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>
|
|
88
|
+
<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>
|
|
89
|
+
<auro-header level="3" display="500">Before checking your bags, remember to:</auro-header>
|
|
90
|
+
<ul>
|
|
91
|
+
<li>Caerphilly croque monsieur fondue</li>
|
|
92
|
+
<li>Taleggio goat mascarpone cow manchego cheese and wine emmental cheese strings</li>
|
|
93
|
+
<li>Cheddar cheese and biscuits chalk and cheese</li>
|
|
94
|
+
<li>Camembert de normandie stinking bishop bavarian bergkase</li>
|
|
95
|
+
</ul>
|
|
96
|
+
</div>
|
|
97
|
+
<div slot="footer">
|
|
98
|
+
<auro-button secondary onClick="toggleDialog('#defaultDialog')">Close</auro-button>
|
|
99
|
+
</div>
|
|
100
|
+
</auro-dialog>
|
|
101
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
102
|
+
</div>
|
|
103
|
+
<auro-accordion alignRight>
|
|
104
|
+
<span slot="trigger">See code</span>
|
|
105
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../apiExamples/basic.html) -->
|
|
106
|
+
<!-- The below code snippet is automatically added from ./../../apiExamples/basic.html -->
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<div>
|
|
110
|
+
<auro-button onClick="toggleDialog('#defaultDialog')">Open default dialog</auro-button>
|
|
111
|
+
</div>
|
|
112
|
+
<auro-dialog id="defaultDialog">
|
|
113
|
+
<span slot="header">Default Dialog</span>
|
|
114
|
+
<div slot="content">
|
|
115
|
+
<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>
|
|
116
|
+
<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
|
+
<auro-header level="3" display="500">Before checking your bags, remember to:</auro-header>
|
|
118
|
+
<ul>
|
|
119
|
+
<li>Caerphilly croque monsieur fondue</li>
|
|
120
|
+
<li>Taleggio goat mascarpone cow manchego cheese and wine emmental cheese strings</li>
|
|
121
|
+
<li>Cheddar cheese and biscuits chalk and cheese</li>
|
|
122
|
+
<li>Camembert de normandie stinking bishop bavarian bergkase</li>
|
|
123
|
+
</ul>
|
|
124
|
+
</div>
|
|
125
|
+
<div slot="footer">
|
|
126
|
+
<auro-button secondary onClick="toggleDialog('#defaultDialog')">Close</auro-button>
|
|
127
|
+
</div>
|
|
128
|
+
</auro-dialog>
|
|
129
|
+
```
|
|
130
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
131
|
+
</auro-accordion>
|
|
132
|
+
Having a closing statement about your example helps to really complete the thought with your reader.
|
|
133
|
+
|
|
134
|
+
## Recommended Use and Version Control
|
|
135
|
+
|
|
136
|
+
There are two important parts of every Auro component. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</a> and the custom clement. The class is exported and then used as part of defining the Web Component. When importing this component as described in the <a href="#install">install</a> section, the class is imported and the `auro-dialog` custom element is defined automatically.
|
|
137
|
+
|
|
138
|
+
To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our `registerComponent(name)` method and pass in a unique name.
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
import './node_modules/@aurodesignsystem/auro-dialog';
|
|
142
|
+
registerComponent('custom-dialog');
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
This will create a new custom element that you can use in your HTML that will function identically to the `auro-dialog` element.
|
|
146
|
+
|
|
147
|
+
<div class="exampleWrapper">
|
|
148
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/custom.html) -->
|
|
149
|
+
<!-- The below content is automatically added from ./../../apiExamples/custom.html -->
|
|
150
|
+
<div>
|
|
151
|
+
<auro-button onClick="toggleDialog('#customDialog')">Open default dialog</auro-button>
|
|
152
|
+
</div>
|
|
153
|
+
<custom-dialog id="customDialog">
|
|
154
|
+
<span slot="header">Default Dialog</span>
|
|
155
|
+
<div slot="content">
|
|
156
|
+
<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>
|
|
157
|
+
<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>
|
|
158
|
+
<auro-header level="3" display="500">Before checking your bags, remember to:</auro-header>
|
|
159
|
+
<ul>
|
|
160
|
+
<li>Caerphilly croque monsieur fondue</li>
|
|
161
|
+
<li>Taleggio goat mascarpone cow manchego cheese and wine emmental cheese strings</li>
|
|
162
|
+
<li>Cheddar cheese and biscuits chalk and cheese</li>
|
|
163
|
+
<li>Camembert de normandie stinking bishop bavarian bergkase</li>
|
|
164
|
+
</ul>
|
|
165
|
+
</div>
|
|
166
|
+
<div slot="footer">
|
|
167
|
+
<auro-button secondary onClick="toggleDialog('#customDialog')">Close</auro-button>
|
|
168
|
+
</div>
|
|
169
|
+
</custom-dialog>
|
|
170
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
171
|
+
</div>
|
|
172
|
+
<auro-accordion alignRight>
|
|
173
|
+
<span slot="trigger">See code</span>
|
|
174
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../apiExamples/custom.html) -->
|
|
175
|
+
<!-- The below code snippet is automatically added from ./../../apiExamples/custom.html -->
|
|
176
|
+
|
|
177
|
+
```html
|
|
178
|
+
<div>
|
|
179
|
+
<auro-button onClick="toggleDialog('#customDialog')">Open default dialog</auro-button>
|
|
180
|
+
</div>
|
|
181
|
+
<custom-dialog id="customDialog">
|
|
182
|
+
<span slot="header">Default Dialog</span>
|
|
183
|
+
<div slot="content">
|
|
184
|
+
<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>
|
|
185
|
+
<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
|
+
<auro-header level="3" display="500">Before checking your bags, remember to:</auro-header>
|
|
187
|
+
<ul>
|
|
188
|
+
<li>Caerphilly croque monsieur fondue</li>
|
|
189
|
+
<li>Taleggio goat mascarpone cow manchego cheese and wine emmental cheese strings</li>
|
|
190
|
+
<li>Cheddar cheese and biscuits chalk and cheese</li>
|
|
191
|
+
<li>Camembert de normandie stinking bishop bavarian bergkase</li>
|
|
192
|
+
</ul>
|
|
193
|
+
</div>
|
|
194
|
+
<div slot="footer">
|
|
195
|
+
<auro-button secondary onClick="toggleDialog('#customDialog')">Close</auro-button>
|
|
196
|
+
</div>
|
|
197
|
+
</custom-dialog>
|
|
198
|
+
```
|
|
199
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
200
|
+
</auro-accordion>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class AuroDialog extends ComponentBase {
|
|
2
|
+
static get properties(): {
|
|
3
|
+
open: {
|
|
4
|
+
noAccessor: boolean;
|
|
5
|
+
type: BooleanConstructor;
|
|
6
|
+
reflect: boolean;
|
|
7
|
+
};
|
|
8
|
+
modal: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
};
|
|
11
|
+
unformatted: {
|
|
12
|
+
type: BooleanConstructor;
|
|
13
|
+
reflect: boolean;
|
|
14
|
+
};
|
|
15
|
+
triggerElement: {
|
|
16
|
+
attribute: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
static get styles(): import("lit").CSSResult[][];
|
|
20
|
+
}
|
|
21
|
+
import ComponentBase from './componentBase';
|
|
22
|
+
//# sourceMappingURL=auro-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auro-dialog.d.ts","sourceRoot":"","sources":["../src/auro-dialog.js"],"names":[],"mappings":"AAQA;IAME;;;;;;;;;;;;;;;;MASC;IAED,iDAEC;CACF;0BAvByB,iBAAiB"}
|