-
Notifications
You must be signed in to change notification settings - Fork 1
/
button.html
236 lines (197 loc) · 12.6 KB
/
button.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>button</title>
<script type="module" src="https://js.arcgis.com/calcite-components/1.0.0-beta.91/calcite.esm.js"></script>
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/1.0.0-beta.91/calcite.css" />
<style>
h1 {
margin-bottom: 5rem;
}
h2 {
margin-top: 3rem;
}
h2,
calcite-button {
margin-bottom: 3rem;
}
body {
font-family: var(--calcite-sans-family);
font-size: var(--calcite-font-size-0);
color: var(--calcite-ui-text-1);
max-width: 1024px;
min-width: 280px;
width: 70vw;
padding: 0 var(--calcite-spacing-double);
margin: 0 auto;
background-color: var(--calcite-ui-background);
}
/* Theme Switcher */
#theme-label {
position: fixed;
top: 20px;
right: 20px;
z-index: 2;
background-color: var(--calcite-ui-background);
border: 1px solid;
border-color: var(--calcite-ui-border-1);
border-radius: var(--calcite-border-radius);
margin: 0;
padding: 10px;
}
#theme-label label {
margin: 0;
}
</style>
</head>
<body>
<main>
<!-- calcite-switch -->
<div id="theme-label">
<calcite-label layout="inline">
Toggle theme
<calcite-switch id="theme-switch"></calcite-switch>
</calcite-label>
</div>
<h1><code>button</code></h1>
<h2>Additional instructions</h2>
<ol>
<li>For tests 1 and 2, please also perform color contrast tests with and without the theme toggle (at the top of the page).</li>
<li>For test 8, a switch is present to toggle loading animation.</li>
</ol>
<br>
<h2>Test 1. Default: Ensure color contrast tests are performed</h2>
<!-- Solid brand -->
<calcite-button color="blue" scale="s">Solid brand, small</calcite-button>
<calcite-button color="blue" scale="m">Solid brand, medium</calcite-button>
<calcite-button color="blue" scale="l">Solid brand, large</calcite-button>
<br>
<!-- Solid neutral -->
<calcite-button color="neutral" scale="s">Solid neutral, small</calcite-button>
<calcite-button color="neutral" scale="m">Solid neutral, medium</calcite-button>
<calcite-button color="neutral" scale="l">Solid neutral, large</calcite-button>
<br>
<!-- Solid inverse -->
<calcite-button color="inverse" scale="s">Solid inverse, small</calcite-button>
<calcite-button color="inverse" scale="m">Solid inverse, medium</calcite-button>
<calcite-button color="inverse" scale="l">Solid inverse, large</calcite-button>
<br>
<!-- Solid danger -->
<calcite-button color="red" scale="s">Solid danger, small</calcite-button>
<calcite-button color="red" scale="m">Solid danger, medium</calcite-button>
<calcite-button color="red" scale="l">Solid danger, large</calcite-button>
<h2>Test 2. Clear Default: Ensure color contrast tests are performed</h2>
<!-- Clear brand -->
<calcite-button appearance="clear" color="blue" scale="s">Clear brand, small</calcite-button>
<calcite-button appearance="clear" color="blue" scale="m">Clear brand, medium</calcite-button>
<calcite-button appearance="clear" color="blue" scale="l">Clear brand, large</calcite-button>
<br>
<!-- Clear neutral -->
<calcite-button appearance="clear" color="neutral" scale="s">Clear neutral, small</calcite-button>
<calcite-button appearance="clear" color="neutral" scale="m">Clear neutral, medium</calcite-button>
<calcite-button appearance="clear" color="neutral" scale="l">Clear neutral, large</calcite-button>
<br>
<!-- Clear inverse -->
<calcite-button appearance="clear" color="inverse" scale="s">Clear inverse, small</calcite-button>
<calcite-button appearance="clear" color="inverse" scale="m">Clear inverse, medium</calcite-button>
<calcite-button appearance="clear" color="inverse" scale="l">Clear inverse, large</calcite-button>
<br>
<!-- Clear danger -->
<calcite-button appearance="clear" color="red" scale="s">Clear danger, small</calcite-button>
<calcite-button appearance="clear" color="red" scale="m">Clear danger, medium</calcite-button>
<calcite-button appearance="clear" color="red" scale="l">Clear danger, large</calcite-button>
<h2>Test 3. Default with Icons </h2>
<calcite-button icon-start="arrow-left" icon-end="arrow-right" color="blue" scale="s">Default with icons, small scale</calcite-button>
<calcite-button icon-start="arrow-left" icon-end="arrow-right" color="blue" scale="m">Default with icons, medium scale</calcite-button>
<calcite-button icon-start="arrow-left" icon-end="arrow-right" color="blue" scale="l">Default with icons, large scale</calcite-button>
<h2>Test 4. Icons only</h2>
<calcite-button icon-start="save" color="blue" scale="s" text-label="Save" label="Icon only small scale save"></calcite-button>
<calcite-button icon-start="save" color="blue" scale="m" text-label="Save" label="Icon only medium scale save"></calcite-button>
<calcite-button icon-start="save" color="blue" scale="l" text-label="Save" label="Icon only large scale save"></calcite-button>
<h2>Test 5. Rounded</h2>
<calcite-button label="Rounded, small scale" color="blue" scale="s" round>Button</calcite-button>
<calcite-button label="Rounded, medium scale" color="blue" scale="m" round>Button</calcite-button>
<calcite-button label="Rounded, large scale" color="blue" scale="l" round>Button</calcite-button>
<h2>Test 6. Rounded with Icons</h2>
<calcite-button label="Rounded with icons, small scale" icon-start="arrow-left" icon-end="arrow-right" color="blue" scale="s" round>Button</calcite-button>
<calcite-button label="Rounded with icons, medium scale" icon-start="arrow-left" icon-end="arrow-right" color="blue" scale="m" round>Button</calcite-button>
<calcite-button label="Rounded with icons, large scale" icon-start="arrow-left" icon-end="arrow-right" color="blue" scale="l" round>Button</calcite-button>
<h2>Test 7. Rounded Icon only</h2>
<calcite-button icon-start="save" color="blue" scale="s" round label="Icon only and rounded, small scale"></calcite-button>
<calcite-button icon-start="save" color="blue" scale="m" round label="Icon only and rounded, medium scale"></calcite-button>
<calcite-button icon-start="save" color="blue" scale="l" round label="Icon only and rounded, large scale"></calcite-button>
<h2>Test 8. Loading: Enable via toggle loading animation switch</h2>
<!-- Switcher to add loading class-->
<calcite-label layout="inline">
<h3> Toggle loading animation: </h3>
<calcite-switch id="loading-switch"></calcite-switch>
</calcite-label>
<br>
<calcite-button class="loading-transition" color="blue" appearance="solid" icon-end="download" label="Loading button status">Attachments</calcite-button>
<h2>Test 9. Widths</h2>
<calcite-button title="Auto width (default)">Auto width (default)</calcite-button>
<calcite-button title="Half width" width="half">Half width</calcite-button>
<calcite-button title="Full width" width="full">Full width</calcite-button>
<calcite-button title="Full width with icon" icon-start="layers" width="full">Full width with icon</calcite-button>
<h2>Test 10. Alignments</h2>
<calcite-button title="Alignment center (default))" icon-start="layers" icon-end="chevron-down" width="half">Alignment center (default)</calcite-button>
<calcite-button title="Alignment start" alignment="start" icon-start="layers" icon-end="chevron-down" width="half">Alignment start</calcite-button>
<calcite-button title="Alignment end" alignment="end" icon-start="layers" icon-end="chevron-down" width="half">Alignment end</calcite-button>
<calcite-button title="Alignment space-between" alignment="space-between" icon-start="layers" icon-end="chevron-down" width="half">Alignment space-between</calcite-button>
<calcite-button title="Alignment icon-start space-between" alignment="icon-start-space-between" icon-start="layers" icon-end="chevron-down" width="half">Alignment icon-start space-between</calcite-button>
<calcite-button title="Alignment icon-end space-between" alignment="icon-end-space-between" icon-start="layers" icon-end="chevron-down" width="half">Alignment icon-end space-between</calcite-button>
<h3>Test 10b. Right-to-Left Alignments: For localizations that read content right-to-left</h3>
<calcite-button dir="rtl" title="Alignment center (default))" icon-start="layers" icon-end="chevron-down" width="half" label="RTL Alignment center (default)">Alignment center (default)</calcite-button>
<calcite-button dir="rtl" title="Alignment start" alignment="start" icon-start="layers" icon-end="chevron-down" width="half" label="RTL Alignment start">Alignment start</calcite-button>
<calcite-button dir="rtl" title="Alignment end" alignment="end" icon-start="layers" icon-end="chevron-down" width="half" label="RTL Alignment end">Alignment end</calcite-button>
<calcite-button dir="rtl" title="Alignment space-between" alignment="space-between" icon-start="layers" icon-end="chevron-down" width="half" label="RTL Alignment space-between">Alignment space-between</calcite-button>
<calcite-button dir="rtl" title="Alignment icon-start space-between" alignment="icon-start-space-between" icon-start="layers" icon-end="chevron-down" width="half" label="RTL Alignment icon-start space-between">Alignment icon-start space-between</calcite-button>
<calcite-button dir="rtl" title="Alignment icon-end space-between" alignment="icon-end-space-between" icon-start="layers" icon-end="chevron-down" width="half" label="RTL Alignment icon-end space-between">Alignment icon-end space-between</calcite-button>
<h2>Test 11. Icons within Buttons</h2>
<calcite-button label="Share layer">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 30 30">
<path fill="#fff" d="M22.117 7H7.883A.883.883 0 0 0 7 7.883v14.234c0 .487.396.883.883.883H15v-7h-3v-2h3v-.992c0-2.066 1.277-3.192 3.121-3.192.883 0 1.879.066 1.879.096V12h-1.764c-1.002 0-1.236.148-1.236.848V14h2.73l-.911 2H17v7h5.117a.884.884 0 0 0 .883-.883V7.883A.883.883 0 0 0 22.117 7z"/>
</svg>
</calcite-button>
<calcite-button label="Add layer small scale">
<calcite-icon scale="s" icon="layer" text-label="layer"></calcite-icon>
</calcite-button>
<calcite-button label="Add layer medium scale">
<calcite-icon scale="m" icon="layer" text-label="layer"></calcite-icon>
</calcite-button>
<calcite-button label="Add layer large scale">
<calcite-icon scale="l" icon="layer" text-label="layer"></calcite-icon>
</calcite-button>
<h2>Test 12. Setting Focus: Setting focus on buttons and input</h2>
<calcite-button appearance="clear" onclick="document.querySelector('#button-focus-example-1').setFocus()">Set Focus to Button 1</calcite-button>
<calcite-button appearance="clear" onclick="document.querySelector('#button-focus-example-2').setFocus()">Set Focus to Button 2</calcite-button>
<calcite-button appearance="clear" onclick="document.querySelector('#button-focus-input').setFocus()">Set Focus to Input</calcite-button>
<div>
<calcite-button id="button-focus-example-1">Button 1 for focus</calcite-button>
<calcite-button id="button-focus-example-2">Button 2 for focus</calcite-button>
<calcite-label layout="inline">Label for input focus
<calcite-input value="" id="button-focus-input" placeholder="Input for focus placeholder" min="10" max="30"></calcite-input>
</calcite-label>
</div>
</main>
</body>
<script>
// On load
window.onload = () => {
// Theme Switcher
const themeSwitch = document.getElementById("theme-switch");
themeSwitch.addEventListener("calciteSwitchChange", () => {
document.body.classList.toggle("calcite-theme-dark");
});
// Loading switch
const loadingSwitch = document.querySelector("#loading-switch");
loadingSwitch.addEventListener("calciteSwitchChange", () => {
document.querySelectorAll(".loading-transition").forEach((button) => {
button.toggleAttribute("loading");
});
});
};
</script>
</html>