@aurodesignsystem-dev/auro-button 0.0.0-pr356.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/CHANGELOG.md +779 -0
- package/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README.md +161 -0
- package/demo/api.html +60 -0
- package/demo/api.js +21 -0
- package/demo/api.md +708 -0
- package/demo/api.min.js +66 -0
- package/demo/auro-button.min.js +1134 -0
- package/demo/button-sheet.html +379 -0
- package/demo/form.html +49 -0
- package/demo/icon-sheet.html +279 -0
- package/demo/index.html +47 -0
- package/demo/index.js +20 -0
- package/demo/index.md +415 -0
- package/demo/index.min.js +22 -0
- package/dist/auro-button-CqedMd4x.js +47 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +1 -0
- package/dist/registered.js +1 -0
- package/package.json +84 -0
package/demo/index.md
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
The index.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/index.md`
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
# Button
|
|
8
|
+
|
|
9
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
|
|
10
|
+
<!-- The below content is automatically added from ./../docs/partials/description.md -->
|
|
11
|
+
`<auro-button>` is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) for the purpose being a clickable element to trigger a specific action.
|
|
12
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
13
|
+
|
|
14
|
+
## Auro-Button use cases
|
|
15
|
+
|
|
16
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/useCases.md) -->
|
|
17
|
+
<!-- The below content is automatically added from ./../docs/partials/useCases.md -->
|
|
18
|
+
The auro-button element should be used in situations where users may:
|
|
19
|
+
|
|
20
|
+
* submit a form
|
|
21
|
+
* begin a new task
|
|
22
|
+
* trigger a new UI element to appear to the page
|
|
23
|
+
* specificy a new or next step in a process
|
|
24
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
25
|
+
|
|
26
|
+
## Buttons are not Hyperlinks
|
|
27
|
+
|
|
28
|
+
In cases were the action of the button would not fit the criteria above, it is most likely a Hyperlink. In that situation it is recommended that the [auro-hyperlink](https://www.alaskaair.com/components/auro/hyperlink) element be used.
|
|
29
|
+
|
|
30
|
+
## Default Examples
|
|
31
|
+
|
|
32
|
+
<div class="exampleWrapper">
|
|
33
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/basic.html) -->
|
|
34
|
+
<!-- The below content is automatically added from ./../apiExamples/basic.html -->
|
|
35
|
+
<auro-button>Primary</auro-button>
|
|
36
|
+
<auro-button variant="secondary">Secondary</auro-button>
|
|
37
|
+
<auro-button variant="tertiary">Tertiary</auro-button>
|
|
38
|
+
<auro-button variant="ghost">Ghost</auro-button>
|
|
39
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
40
|
+
</div>
|
|
41
|
+
<auro-accordion alignRight>
|
|
42
|
+
<span slot="trigger">See code</span>
|
|
43
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/basic.html) -->
|
|
44
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/basic.html -->
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<auro-button>Primary</auro-button>
|
|
48
|
+
<auro-button variant="secondary">Secondary</auro-button>
|
|
49
|
+
<auro-button variant="tertiary">Tertiary</auro-button>
|
|
50
|
+
<auro-button variant="ghost">Ghost</auro-button>
|
|
51
|
+
```
|
|
52
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
53
|
+
</auro-accordion>
|
|
54
|
+
<div class="exampleWrapper">
|
|
55
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/iconButtons.html) -->
|
|
56
|
+
<!-- The below content is automatically added from ./../apiExamples/iconButtons.html -->
|
|
57
|
+
<auro-button shape="circle" size="xl"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
58
|
+
<auro-button shape="circle" size="lg" variant="secondary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
59
|
+
<auro-button shape="circle" size="md" variant="tertiary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
60
|
+
<auro-button shape="circle" size="sm" variant="ghost"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
61
|
+
<auro-button shape="circle" size="xs" variant="flat"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
62
|
+
<br /><br/>
|
|
63
|
+
<auro-button shape="square" size="xl"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
64
|
+
<auro-button shape="square" size="lg" variant="secondary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
65
|
+
<auro-button shape="square" size="md" variant="tertiary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
66
|
+
<auro-button shape="square" size="sm" variant="ghost"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
67
|
+
<auro-button shape="square" size="xs" variant="flat"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
68
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
69
|
+
</div>
|
|
70
|
+
<auro-accordion alignRight>
|
|
71
|
+
<span slot="trigger">See code</span>
|
|
72
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/iconButtons.html) -->
|
|
73
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/iconButtons.html -->
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<auro-button shape="circle" size="xl"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
77
|
+
<auro-button shape="circle" size="lg" variant="secondary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
78
|
+
<auro-button shape="circle" size="md" variant="tertiary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
79
|
+
<auro-button shape="circle" size="sm" variant="ghost"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
80
|
+
<auro-button shape="circle" size="xs" variant="flat"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
81
|
+
<br /><br/>
|
|
82
|
+
<auro-button shape="square" size="xl"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
83
|
+
<auro-button shape="square" size="lg" variant="secondary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
84
|
+
<auro-button shape="square" size="md" variant="tertiary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
85
|
+
<auro-button shape="square" size="sm" variant="ghost"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
86
|
+
<auro-button shape="square" size="xs" variant="flat"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
87
|
+
```
|
|
88
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
89
|
+
</auro-accordion>
|
|
90
|
+
|
|
91
|
+
## On Dark
|
|
92
|
+
|
|
93
|
+
These examples illustrate the core button types and a `disabled` state on dark backgrounds using the `onDark` attribute.
|
|
94
|
+
|
|
95
|
+
<div class="exampleWrapper--ondark">
|
|
96
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/onDark.html) -->
|
|
97
|
+
<!-- The below content is automatically added from ./../apiExamples/onDark.html -->
|
|
98
|
+
<auro-button ondark>Primary</auro-button>
|
|
99
|
+
<auro-button variant="secondary" ondark>Secondary</auro-button>
|
|
100
|
+
<auro-button variant="tertiary" ondark>Tertiary</auro-button>
|
|
101
|
+
<auro-button variant="ghost" ondark>Ghost</auro-button>
|
|
102
|
+
<br /><br/>
|
|
103
|
+
<auro-button ondark shape="circle" size="xl"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
104
|
+
<auro-button ondark shape="circle" size="lg" variant="secondary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
105
|
+
<auro-button ondark shape="circle" size="md" variant="tertiary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
106
|
+
<auro-button ondark shape="circle" size="sm" variant="ghost"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
107
|
+
<auro-button ondark shape="circle" size="xs" variant="flat"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
108
|
+
<br /><br/>
|
|
109
|
+
<auro-button ondark shape="square" size="xl"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
110
|
+
<auro-button ondark shape="square" size="lg" variant="secondary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
111
|
+
<auro-button ondark shape="square" size="md" variant="tertiary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
112
|
+
<auro-button ondark shape="square" size="sm" variant="ghost"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
113
|
+
<auro-button ondark shape="square" size="xs" variant="flat"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
114
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
115
|
+
</div>
|
|
116
|
+
<auro-accordion alignRight>
|
|
117
|
+
<span slot="trigger">See code</span>
|
|
118
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/onDark.html) -->
|
|
119
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/onDark.html -->
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<auro-button ondark>Primary</auro-button>
|
|
123
|
+
<auro-button variant="secondary" ondark>Secondary</auro-button>
|
|
124
|
+
<auro-button variant="tertiary" ondark>Tertiary</auro-button>
|
|
125
|
+
<auro-button variant="ghost" ondark>Ghost</auro-button>
|
|
126
|
+
<br /><br/>
|
|
127
|
+
<auro-button ondark shape="circle" size="xl"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
128
|
+
<auro-button ondark shape="circle" size="lg" variant="secondary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
129
|
+
<auro-button ondark shape="circle" size="md" variant="tertiary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
130
|
+
<auro-button ondark shape="circle" size="sm" variant="ghost"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
131
|
+
<auro-button ondark shape="circle" size="xs" variant="flat"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
132
|
+
<br /><br/>
|
|
133
|
+
<auro-button ondark shape="square" size="xl"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
134
|
+
<auro-button ondark shape="square" size="lg" variant="secondary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
135
|
+
<auro-button ondark shape="square" size="md" variant="tertiary"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
136
|
+
<auro-button ondark shape="square" size="sm" variant="ghost"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
137
|
+
<auro-button ondark shape="square" size="xs" variant="flat"><auro-icon customColor category="interface" name="heart-filled"></auro-icon></auro-button>
|
|
138
|
+
```
|
|
139
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
140
|
+
</auro-accordion>
|
|
141
|
+
|
|
142
|
+
## Disabled
|
|
143
|
+
|
|
144
|
+
This example demonstrates `auro-button` in it's `disabled` state.
|
|
145
|
+
|
|
146
|
+
<div class="exampleWrapper">
|
|
147
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/disabled.html) -->
|
|
148
|
+
<!-- The below content is automatically added from ./../apiExamples/disabled.html -->
|
|
149
|
+
<auro-button disabled>Primary</auro-button>
|
|
150
|
+
<auro-button variant="secondary" disabled>Secondary</auro-button>
|
|
151
|
+
<auro-button variant="tertiary" disabled>Tertiary</auro-button>
|
|
152
|
+
<auro-button variant="ghost" disabled>Ghost</auro-button>
|
|
153
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
154
|
+
</div>
|
|
155
|
+
<auro-accordion alignRight>
|
|
156
|
+
<span slot="trigger">See code</span>
|
|
157
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/disabled.html) -->
|
|
158
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/disabled.html -->
|
|
159
|
+
|
|
160
|
+
```html
|
|
161
|
+
<auro-button disabled>Primary</auro-button>
|
|
162
|
+
<auro-button variant="secondary" disabled>Secondary</auro-button>
|
|
163
|
+
<auro-button variant="tertiary" disabled>Tertiary</auro-button>
|
|
164
|
+
<auro-button variant="ghost" disabled>Ghost</auro-button>
|
|
165
|
+
```
|
|
166
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
167
|
+
</auro-accordion>
|
|
168
|
+
<div class="exampleWrapper--ondark">
|
|
169
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/disabledOnDark.html) -->
|
|
170
|
+
<!-- The below content is automatically added from ./../apiExamples/disabledOnDark.html -->
|
|
171
|
+
<auro-button disabled ondark>Primary</auro-button>
|
|
172
|
+
<auro-button variant="secondary" disabled ondark>Secondary</auro-button>
|
|
173
|
+
<auro-button variant="tertiary" disabled ondark>Tertiary</auro-button>
|
|
174
|
+
<auro-button variant="ghost" disabled ondark>Ghost</auro-button>
|
|
175
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
176
|
+
</div>
|
|
177
|
+
<auro-accordion alignRight>
|
|
178
|
+
<span slot="trigger">See code</span>
|
|
179
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/disabledOnDark.html) -->
|
|
180
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/disabledOnDark.html -->
|
|
181
|
+
|
|
182
|
+
```html
|
|
183
|
+
<auro-button disabled ondark>Primary</auro-button>
|
|
184
|
+
<auro-button variant="secondary" disabled ondark>Secondary</auro-button>
|
|
185
|
+
<auro-button variant="tertiary" disabled ondark>Tertiary</auro-button>
|
|
186
|
+
<auro-button variant="ghost" disabled ondark>Ghost</auro-button>
|
|
187
|
+
```
|
|
188
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
189
|
+
</auro-accordion>
|
|
190
|
+
|
|
191
|
+
## Icon Support
|
|
192
|
+
|
|
193
|
+
Adding icons to the auro-button component is as easy as nesting any other HTML. The [auro-icon component](https://www.alaskaair.com/components/auro/icon) has access to all the icons listed in the [Auro Icons library](https://www.alaskaair.com/icons/usage) for quick and easy use.
|
|
194
|
+
|
|
195
|
+
Be sure to use the `customColor` attribute on the auro-icon component to allow colors set in your parent element to pass through to the icon.
|
|
196
|
+
|
|
197
|
+
<div class="exampleWrapper">
|
|
198
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/icon.html) -->
|
|
199
|
+
<!-- The below content is automatically added from ./../apiExamples/icon.html -->
|
|
200
|
+
<auro-button arialabel="wifi">
|
|
201
|
+
<span>Activate WiFi</span>
|
|
202
|
+
<auro-icon customColor category="in-flight" name="wifi"></auro-icon>
|
|
203
|
+
</auro-button>
|
|
204
|
+
<auro-button variant="secondary" arialabel="arrow-left">
|
|
205
|
+
<span>Previous action</span>
|
|
206
|
+
<auro-icon customcolor category="interface" name="arrow-left" ></auro-icon>
|
|
207
|
+
</auro-button>
|
|
208
|
+
<auro-button variant="tertiary" arialabel="heart-filled">
|
|
209
|
+
<span>Love this ...</span>
|
|
210
|
+
<auro-icon customcolor category="interface" name="heart-filled" ></auro-icon>
|
|
211
|
+
</auro-button>
|
|
212
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
213
|
+
</div>
|
|
214
|
+
<auro-accordion alignRight>
|
|
215
|
+
<span slot="trigger">See code</span>
|
|
216
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/icon.html) -->
|
|
217
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/icon.html -->
|
|
218
|
+
|
|
219
|
+
```html
|
|
220
|
+
<auro-button arialabel="wifi">
|
|
221
|
+
<span>Activate WiFi</span>
|
|
222
|
+
<auro-icon customColor category="in-flight" name="wifi"></auro-icon>
|
|
223
|
+
</auro-button>
|
|
224
|
+
<auro-button variant="secondary" arialabel="arrow-left">
|
|
225
|
+
<span>Previous action</span>
|
|
226
|
+
<auro-icon customcolor category="interface" name="arrow-left" ></auro-icon>
|
|
227
|
+
</auro-button>
|
|
228
|
+
<auro-button variant="tertiary" arialabel="heart-filled">
|
|
229
|
+
<span>Love this ...</span>
|
|
230
|
+
<auro-icon customcolor category="interface" name="heart-filled" ></auro-icon>
|
|
231
|
+
</auro-button>
|
|
232
|
+
```
|
|
233
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
234
|
+
</auro-accordion>
|
|
235
|
+
|
|
236
|
+
## Size <a name="size"></a>
|
|
237
|
+
The size of the button can be set in t-shirt sizes from `xs` to `xl`
|
|
238
|
+
|
|
239
|
+
<div class="exampleWrapper">
|
|
240
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/size.html) -->
|
|
241
|
+
<!-- The below content is automatically added from ./../apiExamples/size.html -->
|
|
242
|
+
<auro-button size="xs">Extra Small</auro-button>
|
|
243
|
+
<auro-button size="sm">Small</auro-button>
|
|
244
|
+
<auro-button size="md">Medium</auro-button>
|
|
245
|
+
<auro-button size="lg">Large</auro-button>
|
|
246
|
+
<auro-button size="xl">Extra Large</auro-button>
|
|
247
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
248
|
+
</div>
|
|
249
|
+
<auro-accordion alignRight>
|
|
250
|
+
<span slot="trigger">See code</span>
|
|
251
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/size.html) -->
|
|
252
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/size.html -->
|
|
253
|
+
|
|
254
|
+
```html
|
|
255
|
+
<auro-button size="xs">Extra Small</auro-button>
|
|
256
|
+
<auro-button size="sm">Small</auro-button>
|
|
257
|
+
<auro-button size="md">Medium</auro-button>
|
|
258
|
+
<auro-button size="lg">Large</auro-button>
|
|
259
|
+
<auro-button size="xl">Extra Large</auro-button>
|
|
260
|
+
```
|
|
261
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
262
|
+
</auro-accordion>
|
|
263
|
+
|
|
264
|
+
## Shape <a name="shape"></a>
|
|
265
|
+
The button comes with several different shapes available, `pill`, `rounded`, `circle`, and `square`.
|
|
266
|
+
|
|
267
|
+
<div class="exampleWrapper">
|
|
268
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/shape.html) -->
|
|
269
|
+
<!-- The below content is automatically added from ./../apiExamples/shape.html -->
|
|
270
|
+
<auro-button shape="rounded">Rounded Button</auro-button>
|
|
271
|
+
<auro-button shape="pill">Pill Button</auro-button>
|
|
272
|
+
<auro-button shape="circle">
|
|
273
|
+
<auro-icon customcolor category="interface" name="account-filled" ondark="true"></auro-icon>
|
|
274
|
+
</auro-button>
|
|
275
|
+
<auro-button shape="square">
|
|
276
|
+
<auro-icon customcolor category="interface" name="account-filled" ondark="true"></auro-icon>
|
|
277
|
+
</auro-button>
|
|
278
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
279
|
+
</div>
|
|
280
|
+
<auro-accordion alignRight>
|
|
281
|
+
<span slot="trigger">See code</span>
|
|
282
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/shape.html) -->
|
|
283
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/shape.html -->
|
|
284
|
+
|
|
285
|
+
```html
|
|
286
|
+
<auro-button shape="rounded">Rounded Button</auro-button>
|
|
287
|
+
<auro-button shape="pill">Pill Button</auro-button>
|
|
288
|
+
<auro-button shape="circle">
|
|
289
|
+
<auro-icon customcolor category="interface" name="account-filled" ondark="true"></auro-icon>
|
|
290
|
+
</auro-button>
|
|
291
|
+
<auro-button shape="square">
|
|
292
|
+
<auro-icon customcolor category="interface" name="account-filled" ondark="true"></auro-icon>
|
|
293
|
+
</auro-button>
|
|
294
|
+
```
|
|
295
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
296
|
+
</auro-accordion>
|
|
297
|
+
|
|
298
|
+
## Variant <a name="variant"></a>
|
|
299
|
+
Auro button can use several different variants, including `primary`, `secondary`, `tertiary`, `ghost`, and `flat`.
|
|
300
|
+
|
|
301
|
+
The flat variant should only be used for interface elements that should only have a focus style such as close buttons on dialogs and clear buttons on form elements.
|
|
302
|
+
|
|
303
|
+
<div class="exampleWrapper">
|
|
304
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/variant.html) -->
|
|
305
|
+
<!-- The below content is automatically added from ./../apiExamples/variant.html -->
|
|
306
|
+
<auro-button variant="primary">Primary</auro-button>
|
|
307
|
+
<auro-button variant="secondary">Secondary</auro-button>
|
|
308
|
+
<auro-button variant="tertiary">Tertiary</auro-button>
|
|
309
|
+
<auro-button variant="ghost">Ghost</auro-button>
|
|
310
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
311
|
+
</div>
|
|
312
|
+
<auro-accordion alignRight>
|
|
313
|
+
<span slot="trigger">See code</span>
|
|
314
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/variant.html) -->
|
|
315
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/variant.html -->
|
|
316
|
+
|
|
317
|
+
```html
|
|
318
|
+
<auro-button variant="primary">Primary</auro-button>
|
|
319
|
+
<auro-button variant="secondary">Secondary</auro-button>
|
|
320
|
+
<auro-button variant="tertiary">Tertiary</auro-button>
|
|
321
|
+
<auro-button variant="ghost">Ghost</auro-button>
|
|
322
|
+
```
|
|
323
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
324
|
+
</auro-accordion>
|
|
325
|
+
|
|
326
|
+
## Pass a Function to Button
|
|
327
|
+
|
|
328
|
+
These examples illustrate a common use case where a user will want to pass a function into a button to support a click event. See the code examples for how this is achieved.
|
|
329
|
+
|
|
330
|
+
<div class="exampleWrapper">
|
|
331
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/passFunction.html) -->
|
|
332
|
+
<!-- The below content is automatically added from ./../apiExamples/passFunction.html -->
|
|
333
|
+
<auro-button onclick="alert('YOU CLICKED ME!');">Primary</auro-button>
|
|
334
|
+
<auro-button disabled onclick="alert('YOU CLICKED ME!');">Primary</auro-button>
|
|
335
|
+
<auro-button loading onclick="alert('YOU CLICKED ME!');">Primary</auro-button>
|
|
336
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
337
|
+
</div>
|
|
338
|
+
<auro-accordion alignRight>
|
|
339
|
+
<span slot="trigger">See code</span>
|
|
340
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/passFunction.html) -->
|
|
341
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/passFunction.html -->
|
|
342
|
+
|
|
343
|
+
```html
|
|
344
|
+
<auro-button onclick="alert('YOU CLICKED ME!');">Primary</auro-button>
|
|
345
|
+
<auro-button disabled onclick="alert('YOU CLICKED ME!');">Primary</auro-button>
|
|
346
|
+
<auro-button loading onclick="alert('YOU CLICKED ME!');">Primary</auro-button>
|
|
347
|
+
```
|
|
348
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
349
|
+
</auro-accordion>
|
|
350
|
+
|
|
351
|
+
## Do's and don'ts
|
|
352
|
+
|
|
353
|
+
Don't combine `disabled` and `loading` attributes on any single instance of `auro-button`. An `auro-button` with `loading` *is* affectively a disabled instance. There is no need for both.
|
|
354
|
+
|
|
355
|
+
<div class="exampleWrapper">
|
|
356
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/doAndDont.html) -->
|
|
357
|
+
<!-- The below content is automatically added from ./../apiExamples/doAndDont.html -->
|
|
358
|
+
<auro-alert type="error" noIcon>
|
|
359
|
+
<auro-button loading disabled>Primary</auro-button>
|
|
360
|
+
</auro-alert>
|
|
361
|
+
<auro-alert type="success" noIcon style="padding-top: 5px;">
|
|
362
|
+
<auro-button loading>Primary</auro-button>
|
|
363
|
+
</auro-alert>
|
|
364
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
365
|
+
</div>
|
|
366
|
+
<auro-accordion alignRight>
|
|
367
|
+
<span slot="trigger">See code</span>
|
|
368
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/doAndDont.html) -->
|
|
369
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/doAndDont.html -->
|
|
370
|
+
|
|
371
|
+
```html
|
|
372
|
+
<auro-alert type="error" noIcon>
|
|
373
|
+
<auro-button loading disabled>Primary</auro-button>
|
|
374
|
+
</auro-alert>
|
|
375
|
+
<auro-alert type="success" noIcon style="padding-top: 5px;">
|
|
376
|
+
<auro-button loading>Primary</auro-button>
|
|
377
|
+
</auro-alert>
|
|
378
|
+
```
|
|
379
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
380
|
+
</auro-accordion>
|
|
381
|
+
|
|
382
|
+
## Recommended Use and Version Control
|
|
383
|
+
|
|
384
|
+
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 element. 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-button` custom element is defined automatically.
|
|
385
|
+
|
|
386
|
+
To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our `AuroButton.register(name)` method and pass in a unique name.
|
|
387
|
+
|
|
388
|
+
```js
|
|
389
|
+
import { AuroButton } from '@aurodesignsystem/auro-button/class';
|
|
390
|
+
|
|
391
|
+
AuroButton.register('custom-button');
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
This will create a new custom element that you can use in your HTML that will function identically to the `<auro-button>` element.
|
|
395
|
+
|
|
396
|
+
<div class="exampleWrapper exampleWrapper--flex">
|
|
397
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/custom.html) -->
|
|
398
|
+
<!-- The below content is automatically added from ./../apiExamples/custom.html -->
|
|
399
|
+
<custom-button>Primary</custom-button>
|
|
400
|
+
<custom-button variant="secondary">Secondary</custom-button>
|
|
401
|
+
<custom-button variant="tertiary">Tertiary</custom-button>
|
|
402
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
403
|
+
</div>
|
|
404
|
+
<auro-accordion alignRight>
|
|
405
|
+
<span slot="trigger">See code</span>
|
|
406
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/custom.html) -->
|
|
407
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/custom.html -->
|
|
408
|
+
|
|
409
|
+
```html
|
|
410
|
+
<custom-button>Primary</custom-button>
|
|
411
|
+
<custom-button variant="secondary">Secondary</custom-button>
|
|
412
|
+
<custom-button variant="tertiary">Tertiary</custom-button>
|
|
413
|
+
```
|
|
414
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
415
|
+
</auro-accordion>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { A as AuroButton } from './auro-button.min.js';
|
|
2
|
+
|
|
3
|
+
AuroButton.register();
|
|
4
|
+
AuroButton.register("custom-button");
|
|
5
|
+
|
|
6
|
+
function initExamples(initCount) {
|
|
7
|
+
// biome-ignore lint: no-unused-vars
|
|
8
|
+
initCount = initCount || 0;
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
console.log("Initializing examples");
|
|
12
|
+
} catch {
|
|
13
|
+
if (initCount <= 20) {
|
|
14
|
+
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
initExamples(initCount + 1);
|
|
17
|
+
}, 100);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { initExamples };
|