-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayout-tests-2021.html
206 lines (190 loc) · 5.96 KB
/
layout-tests-2021.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SimpleBars layout tests 2021</title>
</head>
<body>
<header>
<h1>SimpleBars</h1>
<h2>Come with CSV data. Leave with flexible bar charts made from semantic, accessible HTML tables.</h2>
</header>
<form>
<fieldset>
<h2>Input</h2>
<label for="chart-title">Chart Title</label><br>
<input type="text" id="chart-title" size="40" value="The Beatles, ranked"><br>
<label for="chart-description">Chart Description</label><br>
<textarea id="chart-description" rows="5" cols="40">For the ranking of the Beatles</textarea><br>
<label for="chart-csv">CSV Data</label><br>
<textarea id="chart-csv" rows="10" cols="40">Beatle,Value
George Harrison,3
John Lennon,2
Paul McCartney,4
Ringo Starr,1</textarea><br>
<button id="generateEmbed">Generate Embed Code</button>
</fieldset>
<fieldset>
<h2>Output</h2>
<label for="output">Embed Code</label><br>
<textarea id="output" rows="10" cols="40"></textarea><br>
<button id="copyEmbed">Copy Embed Code</button>
</fieldset>
</form>
<style>
.simplebars,
.simplebars * {
border: none;
box-sizing: border-box;
color: var(--text-color);
display: block;
font-family: inherit;
font-weight: normal;
line-height: 1.2;
margin: 0;
padding: 0;
text-align: start;
vertical-align: baseline;
}
.simplebars {
background: var(--bg-color);
padding: 1em;
}
.simplebars .sb-legend,
.simplebars .sb-data {
margin-block-start: 1em;
}
.simplebars .sb-title strong {
font-weight: bold;
}
.simplebars .sb-legend-items {
display: flex;
}
.simplebars .sb-data {
border-block-start: var(--border);
}
.simplebars .sb-amount {
--bar-area: calc(100% - (var(--max-chars) + var(--min-chars)));
align-items: center;
display: flex;
font-feature-settings: 'tnum' 1;
}
.simplebars .sb-amount::before {
--bar: calc((var(--abs-val) / (var(--abs-max) + var(--abs-min))) * var(--bar-area));
background: hsl(var(--amt-h),var(--amt-s),var(--amt-l));
content: '';
display: block;
flex-shrink: 0;
height: 1.2em;
min-width: 1px;
width: var(--bar);
}
.simplebars .sb-pos::before {
margin-inline-end: 1ch;
}
.simplebars .sb-neg {
flex-direction: row-reverse;
}
.simplebars .sb-neg::before {
margin-inline-start: 1ch;
}
.simplebars .sb-amount[style*="--abs-val:0"]::before {
min-width: 0;
}
/* SB-ALLPOS */
.simplebars.sb-allpos .sb-datum {
margin-block-start: 0.75em;
}
.simplebars.sb-allpos .sb-amount[style*="--abs-val:0"]::before {
margin: 0;
}
/* SB-ALLNEG */
.simplebars.sb-allneg .sb-datum {
margin-block-start: 0.75em;
}
.simplebars.sb-allneg .sb-label {
text-align: end;
}
.simplebars.sb-allneg .sb-amount[style*="--abs-val:0"]::before {
margin: 0;
}
/* SB-POSNEG */
.simplebars.sb-posneg .sb-data {
position: relative;
}
.simplebars.sb-posneg .sb-datum {
border-block-end: var(--border);
padding-block-end: 0.75em;
padding-block-start: 0.75em;
}
.simplebars.sb-posneg .sb-label {
background: var(--bg-color);
display: inline-block;
position: relative;
z-index: 1;
}
.simplebars.sb-posneg .sb-amount {
--neg-width: calc((var(--abs-min) / (var(--abs-max) + var(--abs-min))) * var(--bar-area) + var(--min-chars));
--pos-width: calc((var(--abs-max) / (var(--abs-max) + var(--abs-min))) * var(--bar-area) + var(--max-chars));
}
.simplebars.sb-posneg .sb-pos::after {
background: var(--text-color);
display: block;
content: '';
height: 100%;
margin-inline-start: calc(var(--neg-width) - 1px);
position: absolute;
top: 0;
width: 2px;
}
.simplebars.sb-posneg .sb-pos::before {
margin-inline-start: var(--neg-width);
}
.simplebars.sb-posneg .sb-neg::before {
margin-inline-end: var(--pos-width);
}
</style>
<table role="table" aria-describedby="caption-the-beatles-ranked" class="simplebars sb-posneg" id="the-beatles-ranked" style="--amt-h:0;--amt-s:100%;--amt-l:50%;--bg-color:#eee;--text-color:black;--border:1px dotted var(--text-color);--min-chars:4ch;--max-chars:2ch;--abs-max:4;--abs-min:0.1">
<caption class="sb-caption" id="caption-the-beatles-ranked">
<p class="sb-title"><strong>The Beatles, Ranked</strong></p>
<p class="sb-description">For the ranking of the Beatles</p>
</caption>
<thead role="rowgroup" class="sb-legend">
<tr role="row" class="sb-legend-items">
<th role="columnheader" class="sb-legend-item">Beatle</th>
<th role="columnheader" class="sb-legend-item">2020</th>
<th role="columnheader" class="sb-legend-item">2021</th>
</tr>
</thead>
<tbody role="rowgroup" class="sb-data">
<tr role="row" class="sb-datum">
<td role="cell" class="sb-label">Paul McCartney</td>
<td role="cell" class="sb-amount sb-pos" style="--amt-l:66%;--abs-val:4">4</td>
<td role="cell" class="sb-amount sb-pos" style="--amt-l:33%;--abs-val:3">3</td>
</tr>
<tr role="row" class="sb-datum">
<td role="cell" class="sb-label">George Harrison</td>
<td role="cell" class="sb-amount sb-pos" style="--amt-l:66%;--abs-val:4">4</td>
<td role="cell" class="sb-amount sb-pos" style="--amt-l:33%;--abs-val:2">2</td>
</tr>
<tr role="row" class="sb-datum">
<td role="cell" class="sb-label">John Lennon</td>
<td role="cell" class="sb-amount sb-pos" style="--amt-l:66%;--abs-val:2">2</td>
<td role="cell" class="sb-amount sb-pos" style="--amt-l:33%;--abs-val:1">1</td>
</tr>
<tr role="row" class="sb-datum">
<td role="cell" class="sb-label">Ringo Starr</td>
<td role="cell" class="sb-amount sb-pos" style="--amt-l:66%;--abs-val:1">1</td>
<td role="cell" class="sb-amount sb-pos" style="--amt-l:33%;--abs-val:0">0</td>
</tr>
<tr role="row" class="sb-datum">
<td role="cell" class="sb-label">Rob Weychert</td>
<td role="cell" class="sb-amount sb-pos" style="--amt-l:66%;--abs-val:3">3</td>
<td role="cell" class="sb-amount sb-neg" style="--amt-l:33%;--abs-val:0.1">-0.1</td>
</tr>
</tbody>
</table>
<script src="scripts2.js"></script>
</body>