@buildcanada/charts 0.2.2 → 0.3.2
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/package.json +8 -2
- package/src/components/Button/Button.scss +174 -53
- package/src/components/Checkbox.scss +32 -20
- package/src/components/LabeledSwitch/LabeledSwitch.scss +43 -30
- package/src/components/RadioButton.scss +29 -9
- package/src/components/closeButton/CloseButton.scss +24 -11
- package/src/components/styles/colors.scss +209 -79
- package/src/components/styles/typography.scss +12 -6
- package/src/grapher/color/ColorConstants.ts +29 -15
- package/src/grapher/controls/ActionButtons.scss +50 -31
- package/src/grapher/controls/ActionButtons.tsx +13 -192
- package/src/grapher/controls/ContentSwitchers.scss +23 -14
- package/src/grapher/controls/Controls.scss +52 -38
- package/src/grapher/controls/Dropdown.scss +81 -50
- package/src/grapher/controls/SearchField.scss +39 -23
- package/src/grapher/controls/SettingsMenu.scss +3 -2
- package/src/grapher/controls/ShareMenu.scss +3 -2
- package/src/grapher/core/grapher.scss +9 -9
- package/src/grapher/entitySelector/EntitySelector.scss +1 -1
- package/src/grapher/footer/Footer.tsx +22 -92
- package/src/grapher/modal/Modal.scss +2 -1
- package/src/grapher/noDataModal/NoDataModal.tsx +3 -9
- package/src/grapher/tabs/Tabs.scss +63 -36
- package/src/grapher/timeline/TimelineComponent.scss +75 -21
- package/src/grapher/tooltip/Tooltip.scss +4 -4
- package/src/styles/charts.scss +3 -0
|
@@ -1,26 +1,33 @@
|
|
|
1
|
+
/*******************************************************************************
|
|
2
|
+
* Dropdown
|
|
3
|
+
*
|
|
4
|
+
* Select/dropdown component styling.
|
|
5
|
+
* Uses Build Canada design system colors.
|
|
6
|
+
******************************************************************************/
|
|
7
|
+
|
|
1
8
|
@import "dropdown-icons";
|
|
2
9
|
|
|
3
10
|
$grapher-dropdown-hover-fill: $gray-10;
|
|
4
|
-
$grapher-dropdown-active-fill: $
|
|
5
|
-
$grapher-dropdown-selected-fill:
|
|
11
|
+
$grapher-dropdown-active-fill: $auburn-100;
|
|
12
|
+
$grapher-dropdown-selected-fill: $auburn-200;
|
|
6
13
|
|
|
7
14
|
.grapher-dropdown {
|
|
8
15
|
position: relative;
|
|
9
16
|
font: 400 13px/16px $sans-serif-font-stack;
|
|
10
17
|
|
|
11
|
-
//
|
|
12
|
-
//
|
|
18
|
+
// Fixes a Firefox bug where long labels would cause the dropdown to resize
|
|
19
|
+
// See: https://github.com/JedWatson/react-select/issues/5170
|
|
13
20
|
display: grid;
|
|
14
21
|
grid-template-columns: minmax(0, 1fr);
|
|
15
22
|
|
|
16
23
|
.clear-indicator {
|
|
17
24
|
padding-right: 10px;
|
|
18
25
|
position: absolute;
|
|
19
|
-
right: 29px;
|
|
26
|
+
right: 29px;
|
|
20
27
|
top: 50%;
|
|
21
28
|
transform: translateY(-50%);
|
|
22
29
|
cursor: pointer;
|
|
23
|
-
border-right: 1px solid
|
|
30
|
+
border-right: 1px solid $gray-20;
|
|
24
31
|
background: none;
|
|
25
32
|
display: flex;
|
|
26
33
|
align-items: center;
|
|
@@ -47,18 +54,18 @@ $grapher-dropdown-selected-fill: #c7ced7;
|
|
|
47
54
|
display: flex;
|
|
48
55
|
align-items: center;
|
|
49
56
|
border: 1px solid $gray-20;
|
|
50
|
-
border-radius:
|
|
51
|
-
padding:
|
|
52
|
-
color: $
|
|
53
|
-
background: white;
|
|
57
|
+
border-radius: 0;
|
|
58
|
+
padding: 8px 12px;
|
|
59
|
+
color: $charcoal;
|
|
60
|
+
background: $white;
|
|
54
61
|
cursor: pointer;
|
|
55
62
|
position: relative;
|
|
56
63
|
width: 100%;
|
|
64
|
+
transition: all 150ms ease;
|
|
57
65
|
|
|
58
66
|
&:focus-visible {
|
|
59
|
-
|
|
60
|
-
outline:
|
|
61
|
-
outline-offset: -1px;
|
|
67
|
+
outline: 2px solid $auburn;
|
|
68
|
+
outline-offset: 2px;
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
&:hover {
|
|
@@ -66,8 +73,8 @@ $grapher-dropdown-selected-fill: #c7ced7;
|
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
&[data-disabled] {
|
|
69
|
-
opacity: 0.
|
|
70
|
-
cursor:
|
|
76
|
+
opacity: 0.5;
|
|
77
|
+
cursor: not-allowed;
|
|
71
78
|
background: $gray-10;
|
|
72
79
|
}
|
|
73
80
|
|
|
@@ -77,6 +84,7 @@ $grapher-dropdown-selected-fill: #c7ced7;
|
|
|
77
84
|
width: 16px;
|
|
78
85
|
height: 16px;
|
|
79
86
|
margin-left: auto;
|
|
87
|
+
flex-shrink: 0;
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
&.loading:after {
|
|
@@ -84,14 +92,15 @@ $grapher-dropdown-selected-fill: #c7ced7;
|
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
&[data-pressed] {
|
|
87
|
-
border-color: $
|
|
95
|
+
border-color: $auburn-500;
|
|
96
|
+
background: $auburn-50;
|
|
88
97
|
&:after {
|
|
89
98
|
background: url($menu-caret-up) no-repeat center;
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
.label {
|
|
94
|
-
color: $gray-
|
|
103
|
+
color: $gray-60;
|
|
95
104
|
|
|
96
105
|
svg {
|
|
97
106
|
margin-left: 1px;
|
|
@@ -107,7 +116,7 @@ $grapher-dropdown-selected-fill: #c7ced7;
|
|
|
107
116
|
width: 100%;
|
|
108
117
|
|
|
109
118
|
&[data-placeholder] {
|
|
110
|
-
color: $gray-
|
|
119
|
+
color: $gray-50;
|
|
111
120
|
white-space: nowrap;
|
|
112
121
|
}
|
|
113
122
|
}
|
|
@@ -118,42 +127,44 @@ $grapher-dropdown-selected-fill: #c7ced7;
|
|
|
118
127
|
overflow-y: auto;
|
|
119
128
|
|
|
120
129
|
&:focus-visible {
|
|
121
|
-
// Override global focus-visible style.
|
|
122
130
|
outline: none;
|
|
123
131
|
}
|
|
124
132
|
}
|
|
125
133
|
|
|
126
134
|
.grapher-dropdown-menu {
|
|
127
|
-
$option-checkmark: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+
|
|
135
|
+
$option-checkmark: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xMS4wMTU2IDAuOTg0Mzc1QzExLjMyMDMgMS4yNjU2MiAxMS4zMjAzIDEuNzU3ODEgMTEuMDE1NiAyLjAzOTA2TDUuMDE1NjIgOC4wMzkwNkM0LjczNDM4IDguMzQzNzUgNC4yNDIxOSA4LjM0Mzc1IDMuOTYwOTQgOC4wMzkwNkwwLjk2MDkzOCA1LjAzOTA2QzAuNjU2MjUgNC43NTc4MSAwLjY1NjI1IDQuMjY1NjIgMC45NjA5MzggMy45ODQzOEMxLjI0MjE5IDMuNjc5NjkgMS43MzQzOCAzLjY3OTY5IDIuMDE1NjIgMy45ODQzOEw0LjQ3NjU2IDYuNDQ1MzFMOS45NjA5NCAwLjk4NDM3NUMxMC4yNDIyIDAuNjc5Njg4IDEwLjczNDQgMC42Nzk2ODggMTEuMDE1NiAwLjk4NDM3NVoiIGZpbGw9IiMxZjVmN2YiLz4KPC9zdmc+";
|
|
128
136
|
$option-checkmark-width: 12px;
|
|
129
137
|
font: 400 13px/16px $sans-serif-font-stack;
|
|
130
138
|
|
|
131
|
-
margin-top:
|
|
132
|
-
border-radius:
|
|
133
|
-
background: white;
|
|
134
|
-
box-shadow: 0px 4px
|
|
139
|
+
margin-top: 4px;
|
|
140
|
+
border-radius: 0;
|
|
141
|
+
background: $white;
|
|
142
|
+
box-shadow: 0px 4px 20px 0px rgba(39, 39, 39, 0.15);
|
|
135
143
|
z-index: $zindex-controls-popup;
|
|
136
|
-
color: $
|
|
144
|
+
color: $charcoal;
|
|
137
145
|
width: var(--trigger-width);
|
|
138
146
|
overflow-y: hidden;
|
|
147
|
+
border: 1px solid $gray-20;
|
|
139
148
|
|
|
140
149
|
.group-heading {
|
|
141
150
|
@include grapher_h5-black-caps;
|
|
142
151
|
font-size: 11px;
|
|
143
|
-
color: $
|
|
144
|
-
margin: 12px
|
|
152
|
+
color: $gray-60;
|
|
153
|
+
margin: 12px 12px 4px 12px;
|
|
145
154
|
font-weight: 700;
|
|
155
|
+
letter-spacing: 0.05em;
|
|
146
156
|
}
|
|
147
157
|
|
|
148
158
|
.group + .group .group-heading {
|
|
149
159
|
margin-top: 8px;
|
|
150
|
-
padding: 12px 0
|
|
151
|
-
border-top: 1px solid
|
|
160
|
+
padding: 12px 0 4px 0;
|
|
161
|
+
border-top: 1px solid $gray-10;
|
|
152
162
|
}
|
|
153
163
|
|
|
154
164
|
.option {
|
|
155
165
|
padding: 10px calc(16px + $option-checkmark-width + 2px) 10px 16px;
|
|
156
166
|
cursor: pointer;
|
|
167
|
+
transition: all 100ms ease;
|
|
157
168
|
|
|
158
169
|
&[data-hovered],
|
|
159
170
|
&[data-focused] {
|
|
@@ -161,19 +172,19 @@ $grapher-dropdown-selected-fill: #c7ced7;
|
|
|
161
172
|
}
|
|
162
173
|
|
|
163
174
|
&:focus-visible {
|
|
164
|
-
// Override global focus-visible style.
|
|
165
175
|
outline: none !important;
|
|
166
176
|
}
|
|
167
177
|
|
|
168
178
|
&[data-pressed] {
|
|
169
|
-
color: $
|
|
179
|
+
color: $auburn;
|
|
170
180
|
background: $grapher-dropdown-active-fill;
|
|
171
181
|
}
|
|
172
182
|
|
|
173
183
|
&[data-selected] {
|
|
174
184
|
position: relative;
|
|
175
|
-
color: $
|
|
185
|
+
color: $auburn;
|
|
176
186
|
background: $grapher-dropdown-active-fill;
|
|
187
|
+
font-weight: 500;
|
|
177
188
|
|
|
178
189
|
&:hover {
|
|
179
190
|
background: $grapher-dropdown-selected-fill;
|
|
@@ -185,29 +196,40 @@ $grapher-dropdown-selected-fill: #c7ced7;
|
|
|
185
196
|
width: $option-checkmark-width;
|
|
186
197
|
height: 9px;
|
|
187
198
|
position: absolute;
|
|
188
|
-
right:
|
|
199
|
+
right: 16px;
|
|
189
200
|
top: 50%;
|
|
190
201
|
transform: translateY(-50%);
|
|
191
202
|
}
|
|
192
203
|
}
|
|
193
204
|
|
|
194
205
|
.detail {
|
|
195
|
-
color: $gray-
|
|
206
|
+
color: $gray-60;
|
|
207
|
+
font-size: 12px;
|
|
196
208
|
}
|
|
197
209
|
|
|
198
210
|
&[data-selected] .detail {
|
|
199
|
-
color: $
|
|
211
|
+
color: $auburn-700;
|
|
200
212
|
}
|
|
201
213
|
}
|
|
202
214
|
}
|
|
203
215
|
|
|
216
|
+
/*******************************************************************************
|
|
217
|
+
* Dropdown Search
|
|
218
|
+
******************************************************************************/
|
|
219
|
+
|
|
204
220
|
.grapher-dropdown-search {
|
|
205
221
|
display: flex;
|
|
206
222
|
align-items: center;
|
|
207
|
-
margin:
|
|
223
|
+
margin: 8px;
|
|
208
224
|
border: 1px solid $gray-20;
|
|
209
|
-
border-radius:
|
|
210
|
-
height:
|
|
225
|
+
border-radius: 0;
|
|
226
|
+
height: 36px;
|
|
227
|
+
background: $white;
|
|
228
|
+
transition: all 150ms ease;
|
|
229
|
+
|
|
230
|
+
&:focus-within {
|
|
231
|
+
border-color: $auburn-500;
|
|
232
|
+
}
|
|
211
233
|
}
|
|
212
234
|
|
|
213
235
|
.grapher-dropdown-search-input {
|
|
@@ -216,34 +238,43 @@ $grapher-dropdown-selected-fill: #c7ced7;
|
|
|
216
238
|
border: none;
|
|
217
239
|
outline: 0;
|
|
218
240
|
font: 400 13px/16px $sans-serif-font-stack;
|
|
219
|
-
color: $
|
|
220
|
-
background:
|
|
221
|
-
padding:
|
|
241
|
+
color: $charcoal;
|
|
242
|
+
background: transparent;
|
|
243
|
+
padding: 8px;
|
|
222
244
|
|
|
223
245
|
&:focus-visible {
|
|
224
|
-
// Override global focus-visible style.
|
|
225
246
|
outline: none;
|
|
226
247
|
}
|
|
248
|
+
|
|
249
|
+
&::placeholder {
|
|
250
|
+
color: $gray-50;
|
|
251
|
+
}
|
|
227
252
|
}
|
|
228
253
|
|
|
229
254
|
.grapher-dropdown-search-icon {
|
|
230
|
-
$magnifying-glass: "data:image/svg+xml;base64,
|
|
231
|
-
margin-left:
|
|
232
|
-
width:
|
|
233
|
-
height:
|
|
255
|
+
$magnifying-glass: "data:image/svg+xml;base64,PHN2ZwogICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICAgdmlld0JveD0iMCAwIDUxMiA1MTIiCj4KICA8cGF0aAogICAgZD0iTTQxNiAyMDhjMCA0NS45LTE0LjkgODguMy00MCAxMjIuN0w1MDIuNiA0NTcuNGMxMi41IDEyLjUgMTIuNSAzMi44IDAgNDUuM3MtMzIuOCAxMi41LTQ1LjMgMEwzMzAuNyAzNzZjLTM0LjQgMjUuMi03Ni44IDQwLTEyMi43IDQwQzkzLjEgNDE2IDAgMzIyLjkgMCAyMDhTOTMuMSAwIDIwOCAwUzQxNiA5My4xIDQxNiAyMDh6TTIwOCAzNTJhMTQ0IDE0NCAwIDEgMCAwLTI4OCAxNDQgMTQ0IDAgMSAwIDAgMjg4eiIKICAgIGZpbGw9IiM3MzczNzMiCiAgLz4KPC9zdmc+Cg==";
|
|
256
|
+
margin-left: 10px;
|
|
257
|
+
width: 14px;
|
|
258
|
+
height: 14px;
|
|
234
259
|
background: url($magnifying-glass) no-repeat center;
|
|
260
|
+
background-size: contain;
|
|
261
|
+
flex-shrink: 0;
|
|
235
262
|
}
|
|
236
263
|
|
|
237
264
|
.grapher-dropdown-search-reset {
|
|
238
|
-
margin-right:
|
|
265
|
+
margin-right: 10px;
|
|
239
266
|
border: none;
|
|
240
267
|
background: none;
|
|
241
|
-
padding:
|
|
268
|
+
padding: 4px;
|
|
242
269
|
cursor: pointer;
|
|
243
|
-
color: $gray-
|
|
270
|
+
color: $gray-50;
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
justify-content: center;
|
|
274
|
+
transition: color 150ms ease;
|
|
244
275
|
|
|
245
276
|
&:hover {
|
|
246
|
-
color: $
|
|
277
|
+
color: $charcoal;
|
|
247
278
|
}
|
|
248
279
|
}
|
|
249
280
|
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
/*******************************************************************************
|
|
2
|
+
* Search Field
|
|
3
|
+
*
|
|
4
|
+
* Search input field styling.
|
|
5
|
+
* Uses Build Canada design system colors.
|
|
6
|
+
******************************************************************************/
|
|
7
|
+
|
|
1
8
|
.grapher-search-field {
|
|
2
|
-
//
|
|
3
|
-
$svg-margin:
|
|
4
|
-
$svg-size:
|
|
9
|
+
// Search icon
|
|
10
|
+
$svg-margin: 10px;
|
|
11
|
+
$svg-size: 14px;
|
|
5
12
|
|
|
6
|
-
$placeholder: $gray-
|
|
7
|
-
$focus:
|
|
13
|
+
$placeholder: $gray-50;
|
|
14
|
+
$focus: 2px solid $auburn-500;
|
|
8
15
|
|
|
9
16
|
position: relative;
|
|
10
17
|
|
|
@@ -12,14 +19,14 @@
|
|
|
12
19
|
position: absolute;
|
|
13
20
|
top: 50%;
|
|
14
21
|
left: $svg-margin;
|
|
15
|
-
color: $
|
|
22
|
+
color: $gray-50;
|
|
16
23
|
transform: translateY(-50%);
|
|
17
24
|
font-size: $svg-size;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
.clear {
|
|
21
28
|
margin: 0;
|
|
22
|
-
padding:
|
|
29
|
+
padding: 4px;
|
|
23
30
|
background: none;
|
|
24
31
|
border: none;
|
|
25
32
|
position: absolute;
|
|
@@ -27,31 +34,40 @@
|
|
|
27
34
|
right: $svg-margin;
|
|
28
35
|
transform: translateY(-50%);
|
|
29
36
|
font-size: $svg-size;
|
|
30
|
-
color: $
|
|
37
|
+
color: $gray-50;
|
|
31
38
|
cursor: pointer;
|
|
39
|
+
transition: color 150ms ease;
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
color: $charcoal;
|
|
43
|
+
}
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
input[type="search"] {
|
|
35
47
|
@include grapher_label-2-regular;
|
|
36
48
|
width: 100%;
|
|
37
|
-
height:
|
|
49
|
+
height: 36px;
|
|
38
50
|
border: 1px solid $gray-20;
|
|
39
|
-
padding-left: $svg-margin + $svg-size +
|
|
40
|
-
padding-right: $svg-margin + $svg-size +
|
|
41
|
-
border-radius:
|
|
42
|
-
background:
|
|
43
|
-
color: $
|
|
51
|
+
padding-left: $svg-margin + $svg-size + 6px;
|
|
52
|
+
padding-right: $svg-margin + $svg-size + 6px;
|
|
53
|
+
border-radius: 0;
|
|
54
|
+
background: $white;
|
|
55
|
+
color: $charcoal;
|
|
56
|
+
transition: all 150ms ease;
|
|
44
57
|
|
|
45
|
-
|
|
58
|
+
&::placeholder {
|
|
59
|
+
color: $placeholder;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Style focus state
|
|
46
63
|
&:focus {
|
|
47
64
|
outline: none;
|
|
48
|
-
border: $
|
|
49
|
-
}
|
|
50
|
-
&:focus:not(:focus-visible) {
|
|
51
|
-
border: none;
|
|
65
|
+
border-color: $auburn-500;
|
|
52
66
|
}
|
|
67
|
+
|
|
53
68
|
&:focus-visible {
|
|
54
|
-
|
|
69
|
+
outline: 2px solid $auburn;
|
|
70
|
+
outline-offset: 2px;
|
|
55
71
|
}
|
|
56
72
|
}
|
|
57
73
|
|
|
@@ -61,18 +77,18 @@
|
|
|
61
77
|
pointer-events: none;
|
|
62
78
|
position: absolute;
|
|
63
79
|
top: 50%;
|
|
64
|
-
left: $svg-size + $svg-margin +
|
|
80
|
+
left: $svg-size + $svg-margin + 8px;
|
|
65
81
|
transform: translateY(-50%);
|
|
66
82
|
|
|
67
83
|
white-space: nowrap;
|
|
68
84
|
overflow: hidden;
|
|
69
85
|
text-overflow: ellipsis;
|
|
70
|
-
width: calc(100% - $svg-size - $svg-margin - 2 *
|
|
86
|
+
width: calc(100% - $svg-size - $svg-margin - 2 * 8px);
|
|
71
87
|
}
|
|
72
88
|
|
|
73
89
|
&.grapher-search-field--empty {
|
|
74
90
|
input[type="search"] {
|
|
75
|
-
padding-right:
|
|
91
|
+
padding-right: 12px;
|
|
76
92
|
}
|
|
77
93
|
}
|
|
78
94
|
}
|
|
@@ -18,7 +18,8 @@ $control-row-height: 32px;
|
|
|
18
18
|
|
|
19
19
|
@at-root .GrapherSettingsPopover {
|
|
20
20
|
background: white;
|
|
21
|
-
border-radius:
|
|
21
|
+
border-radius: 0;
|
|
22
|
+
border: 1px solid $gray-20;
|
|
22
23
|
box-shadow: 0px 4px 23px 4px #0000000f;
|
|
23
24
|
z-index: $zindex-controls-popup;
|
|
24
25
|
overflow-y: auto;
|
|
@@ -49,7 +50,7 @@ $control-row-height: 32px;
|
|
|
49
50
|
border: 1px solid $light-stroke;
|
|
50
51
|
font: $medium 13px/16px $lato;
|
|
51
52
|
letter-spacing: 0.01em;
|
|
52
|
-
border-radius:
|
|
53
|
+
border-radius: 0;
|
|
53
54
|
padding: 7px;
|
|
54
55
|
height: 40px;
|
|
55
56
|
|
|
@@ -8,7 +8,7 @@ $zindex-ControlsFooter: 2;
|
|
|
8
8
|
|
|
9
9
|
.ShareMenu {
|
|
10
10
|
$hover-fill: $gray-10;
|
|
11
|
-
$active-fill: $
|
|
11
|
+
$active-fill: $cerulean-100;
|
|
12
12
|
|
|
13
13
|
position: absolute;
|
|
14
14
|
bottom: $timelineHeight + 8px;
|
|
@@ -17,7 +17,8 @@ $zindex-ControlsFooter: 2;
|
|
|
17
17
|
box-shadow: 0px 4px 40px 0px rgba(0, 0, 0, 0.06);
|
|
18
18
|
padding: 4px 0;
|
|
19
19
|
z-index: $zindex-ControlsFooterMenu;
|
|
20
|
-
border-radius:
|
|
20
|
+
border-radius: 0;
|
|
21
|
+
border: 1px solid $gray-20;
|
|
21
22
|
|
|
22
23
|
h2 {
|
|
23
24
|
font-family: $sans-serif-font-stack;
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
@import "./typography.scss";
|
|
18
18
|
|
|
19
19
|
// grapher frame
|
|
20
|
-
$frame-color: $gray-
|
|
20
|
+
$frame-color: $gray-20;
|
|
21
21
|
|
|
22
22
|
// text
|
|
23
|
-
$dark-text: $
|
|
24
|
-
$light-text: $gray-
|
|
25
|
-
$active-text: $
|
|
23
|
+
$dark-text: $charcoal;
|
|
24
|
+
$light-text: $gray-60;
|
|
25
|
+
$active-text: $cerulean-900;
|
|
26
26
|
|
|
27
27
|
// These should be between 0–100 in order to avoid conflicting with
|
|
28
28
|
// site dropdowns, search overlays, etc.
|
|
@@ -119,8 +119,8 @@ $zindex-controls-drawer: 150;
|
|
|
119
119
|
|
|
120
120
|
line-height: 1em;
|
|
121
121
|
|
|
122
|
-
background:
|
|
123
|
-
color: $
|
|
122
|
+
background: $linen;
|
|
123
|
+
color: $charcoal;
|
|
124
124
|
|
|
125
125
|
position: relative;
|
|
126
126
|
container-type: size;
|
|
@@ -212,9 +212,9 @@ $zindex-controls-drawer: 150;
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
.tippy-box[data-theme="grapher-dark"] {
|
|
215
|
-
background-color: $
|
|
215
|
+
background-color: $charcoal;
|
|
216
216
|
color: white;
|
|
217
|
-
border-radius:
|
|
217
|
+
border-radius: 0;
|
|
218
218
|
font-size: 12px;
|
|
219
219
|
line-height: 16px;
|
|
220
220
|
padding: 8px;
|
|
@@ -224,7 +224,7 @@ $zindex-controls-drawer: 150;
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
.tippy-arrow {
|
|
227
|
-
color: $
|
|
227
|
+
color: $charcoal;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
@@ -22,8 +22,13 @@ import {
|
|
|
22
22
|
GRAPHER_FRAME_PADDING_HORIZONTAL,
|
|
23
23
|
GrapherModal,
|
|
24
24
|
} from "../core/GrapherConstants"
|
|
25
|
+
|
|
25
26
|
import { GRAPHER_LIGHT_TEXT } from "../color/ColorConstants"
|
|
26
27
|
|
|
28
|
+
// Estimated dimensions of action buttons for layout calculations
|
|
29
|
+
const ESTIMATED_ACTION_BUTTONS_WIDTH = 400
|
|
30
|
+
const ACTION_BUTTONS_HEIGHT = 32
|
|
31
|
+
|
|
27
32
|
/*
|
|
28
33
|
|
|
29
34
|
The footer contains the sources, the note (optional), the action buttons and the license and origin URL (optional).
|
|
@@ -168,13 +173,7 @@ abstract class AbstractFooter<
|
|
|
168
173
|
}
|
|
169
174
|
|
|
170
175
|
@computed protected get finalUrlText(): string | undefined {
|
|
171
|
-
const {
|
|
172
|
-
correctedUrlText,
|
|
173
|
-
licenseText,
|
|
174
|
-
fontSize,
|
|
175
|
-
maxWidth,
|
|
176
|
-
actionButtons,
|
|
177
|
-
} = this
|
|
176
|
+
const { correctedUrlText, licenseText, fontSize, maxWidth } = this
|
|
178
177
|
|
|
179
178
|
if (this.hideOriginUrl) return undefined
|
|
180
179
|
|
|
@@ -193,7 +192,7 @@ abstract class AbstractFooter<
|
|
|
193
192
|
// If the URL is too long, don't show it
|
|
194
193
|
if (
|
|
195
194
|
licenseAndOriginUrlWidth + HORIZONTAL_PADDING >
|
|
196
|
-
maxWidth -
|
|
195
|
+
maxWidth - ESTIMATED_ACTION_BUTTONS_WIDTH
|
|
197
196
|
)
|
|
198
197
|
return undefined
|
|
199
198
|
|
|
@@ -230,47 +229,35 @@ abstract class AbstractFooter<
|
|
|
230
229
|
return !this.manager.hideNote && !!this.noteText
|
|
231
230
|
}
|
|
232
231
|
|
|
233
|
-
@computed private get actionButtonsWidthWithIconsOnly(): number {
|
|
234
|
-
return new ActionButtons({
|
|
235
|
-
manager: this.manager,
|
|
236
|
-
maxWidth: this.maxWidth,
|
|
237
|
-
}).widthWithIconsOnly
|
|
238
|
-
}
|
|
239
|
-
|
|
240
232
|
@computed private get useFullWidthSources(): boolean {
|
|
241
|
-
const {
|
|
242
|
-
showNote,
|
|
243
|
-
sourcesFontSize,
|
|
244
|
-
maxWidth,
|
|
245
|
-
sourcesText,
|
|
246
|
-
actionButtonsWidthWithIconsOnly,
|
|
247
|
-
} = this
|
|
233
|
+
const { showNote, sourcesFontSize, maxWidth, sourcesText } = this
|
|
248
234
|
if (showNote) return true
|
|
249
235
|
const sourcesWidth = Bounds.forText(sourcesText, {
|
|
250
236
|
fontSize: sourcesFontSize,
|
|
251
237
|
}).width
|
|
252
|
-
return
|
|
238
|
+
return (
|
|
239
|
+
sourcesWidth > 2 * (maxWidth - ESTIMATED_ACTION_BUTTONS_WIDTH)
|
|
240
|
+
)
|
|
253
241
|
}
|
|
254
242
|
|
|
255
243
|
@computed private get useFullWidthNote(): boolean {
|
|
256
|
-
const {
|
|
257
|
-
fontSize,
|
|
258
|
-
maxWidth,
|
|
259
|
-
noteText,
|
|
260
|
-
actionButtonsWidthWithIconsOnly,
|
|
261
|
-
} = this
|
|
244
|
+
const { fontSize, maxWidth, noteText } = this
|
|
262
245
|
const noteWidth = Bounds.forText(noteText, { fontSize }).width
|
|
263
|
-
return noteWidth > 2 * (maxWidth -
|
|
246
|
+
return noteWidth > 2 * (maxWidth - ESTIMATED_ACTION_BUTTONS_WIDTH)
|
|
264
247
|
}
|
|
265
248
|
|
|
266
249
|
@computed protected get sourcesMaxWidth(): number {
|
|
267
250
|
if (this.useFullWidthSources) return this.maxWidth
|
|
268
|
-
return
|
|
251
|
+
return (
|
|
252
|
+
this.maxWidth - ESTIMATED_ACTION_BUTTONS_WIDTH - HORIZONTAL_PADDING
|
|
253
|
+
)
|
|
269
254
|
}
|
|
270
255
|
|
|
271
256
|
@computed protected get noteMaxWidth(): number {
|
|
272
257
|
if (this.useFullWidthNote) return this.maxWidth
|
|
273
|
-
return
|
|
258
|
+
return (
|
|
259
|
+
this.maxWidth - ESTIMATED_ACTION_BUTTONS_WIDTH - HORIZONTAL_PADDING
|
|
260
|
+
)
|
|
274
261
|
}
|
|
275
262
|
|
|
276
263
|
@computed protected get licenseAndOriginUrlMaxWidth(): number {
|
|
@@ -326,60 +313,6 @@ abstract class AbstractFooter<
|
|
|
326
313
|
})
|
|
327
314
|
}
|
|
328
315
|
|
|
329
|
-
@computed private get actionButtonsMaxWidth(): number {
|
|
330
|
-
const {
|
|
331
|
-
correctedUrlText,
|
|
332
|
-
licenseText,
|
|
333
|
-
maxWidth,
|
|
334
|
-
fontSize,
|
|
335
|
-
sourcesFontSize,
|
|
336
|
-
useFullWidthSources,
|
|
337
|
-
sourcesText,
|
|
338
|
-
noteText,
|
|
339
|
-
showNote,
|
|
340
|
-
useFullWidthNote,
|
|
341
|
-
} = this
|
|
342
|
-
|
|
343
|
-
const sourcesWidth = Bounds.forText(sourcesText, {
|
|
344
|
-
fontSize: sourcesFontSize,
|
|
345
|
-
}).width
|
|
346
|
-
const noteWidth = Bounds.forText(noteText, { fontSize }).width
|
|
347
|
-
|
|
348
|
-
// text next to the action buttons
|
|
349
|
-
const leftTextWidth = !useFullWidthSources
|
|
350
|
-
? sourcesWidth
|
|
351
|
-
: showNote && !useFullWidthNote
|
|
352
|
-
? noteWidth
|
|
353
|
-
: 0
|
|
354
|
-
// text above the action buttons
|
|
355
|
-
// (taken into account to ensure the action buttons are not too close to clickable text)
|
|
356
|
-
const topTextWidth = useFullWidthSources
|
|
357
|
-
? useFullWidthNote
|
|
358
|
-
? noteWidth
|
|
359
|
-
: sourcesWidth
|
|
360
|
-
: 0
|
|
361
|
-
const licenseAndOriginUrlWidth = Bounds.forText(
|
|
362
|
-
AbstractFooter.constructLicenseAndOriginUrlText(
|
|
363
|
-
correctedUrlText,
|
|
364
|
-
licenseText
|
|
365
|
-
),
|
|
366
|
-
{ fontSize }
|
|
367
|
-
).width
|
|
368
|
-
|
|
369
|
-
return (
|
|
370
|
-
maxWidth -
|
|
371
|
-
Math.max(topTextWidth, leftTextWidth, licenseAndOriginUrlWidth) -
|
|
372
|
-
HORIZONTAL_PADDING
|
|
373
|
-
)
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
@computed private get actionButtons(): ActionButtons {
|
|
377
|
-
return new ActionButtons({
|
|
378
|
-
manager: this.manager,
|
|
379
|
-
maxWidth: this.actionButtonsMaxWidth,
|
|
380
|
-
})
|
|
381
|
-
}
|
|
382
|
-
|
|
383
316
|
@computed get height(): number {
|
|
384
317
|
return this.topContentHeight + this.bottomContentHeight
|
|
385
318
|
}
|
|
@@ -555,7 +488,7 @@ abstract class AbstractFooter<
|
|
|
555
488
|
}
|
|
556
489
|
|
|
557
490
|
@computed private get bottomContentHeight(): number {
|
|
558
|
-
const {
|
|
491
|
+
const { sources, note } = this
|
|
559
492
|
|
|
560
493
|
const renderSources = !this.useFullWidthSources
|
|
561
494
|
const renderNote = this.showNote && !this.useFullWidthNote
|
|
@@ -567,7 +500,7 @@ abstract class AbstractFooter<
|
|
|
567
500
|
(renderPadding ? this.verticalPadding : 0) +
|
|
568
501
|
(renderLicense ? this.licenseAndOriginUrl.height : 0)
|
|
569
502
|
|
|
570
|
-
return Math.max(textHeight,
|
|
503
|
+
return Math.max(textHeight, ACTION_BUTTONS_HEIGHT)
|
|
571
504
|
}
|
|
572
505
|
|
|
573
506
|
// renders the action buttons and the content next to it
|
|
@@ -600,10 +533,7 @@ abstract class AbstractFooter<
|
|
|
600
533
|
{renderPadding && this.renderVerticalSpace()}
|
|
601
534
|
{renderLicense && this.renderLicense()}
|
|
602
535
|
</div>
|
|
603
|
-
<ActionButtons
|
|
604
|
-
manager={this.manager}
|
|
605
|
-
maxWidth={this.actionButtonsMaxWidth}
|
|
606
|
-
/>
|
|
536
|
+
<ActionButtons manager={this.manager} />
|
|
607
537
|
</div>
|
|
608
538
|
)
|
|
609
539
|
}
|