@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.
@@ -1,10 +1,16 @@
1
+ /*******************************************************************************
2
+ * Close Button
3
+ *
4
+ * Circular close/dismiss button.
5
+ * Uses Build Canada design system colors.
6
+ ******************************************************************************/
7
+
1
8
  .close-button {
2
- // keep in sync with CLOSE_BUTTON_SIZE in CloseButton.tsx
9
+ // Keep in sync with CLOSE_BUTTON_SIZE in CloseButton.tsx
3
10
  $size: 32px;
4
11
 
5
12
  $light-stroke: $gray-20;
6
-
7
- $active-fill: #dbe5f0;
13
+ $active-fill: $cerulean-100;
8
14
  $hover-fill: $gray-10;
9
15
 
10
16
  display: flex;
@@ -14,23 +20,30 @@
14
20
  position: relative;
15
21
  height: $size;
16
22
  width: $size;
17
- padding: 7px;
23
+ padding: 0;
18
24
 
19
- color: $light-text;
20
- background: white;
25
+ color: $gray-60;
26
+ background: $white;
21
27
  border: 1px solid $light-stroke;
22
- border-radius: 50%;
28
+ border-radius: 0;
29
+ cursor: pointer;
30
+ transition: all 150ms ease;
23
31
 
24
32
  &:hover {
25
33
  background: $hover-fill;
26
- border-color: $hover-fill;
27
- cursor: pointer;
28
- color: $dark-text;
34
+ border-color: $gray-30;
35
+ color: $charcoal;
29
36
  }
30
37
 
31
38
  &:active {
32
39
  background: $active-fill;
33
- border: 1px solid $active-fill;
40
+ border-color: $cerulean-500;
41
+ color: $cerulean-900;
42
+ }
43
+
44
+ &:focus-visible {
45
+ outline: 2px solid $auburn;
46
+ outline-offset: 2px;
34
47
  }
35
48
 
36
49
  svg {
@@ -1,89 +1,208 @@
1
1
  /*******************************************************************************
2
- * Colors
3
- */
2
+ * Colors - Build Canada Design System
3
+ *
4
+ * This file imports and extends the Build Canada color tokens for use in charts.
5
+ ******************************************************************************/
4
6
 
5
7
  @use "sass:color";
6
8
 
7
- // Brand colors
8
- $oxford-blue: #002147;
9
- $vermillion: #ce261e;
10
- $amber: #f7c020;
11
-
12
- // Blue shades
13
- $blue-100: #002147;
14
- $blue-95: #112e4f;
15
- $blue-90: #1d3d63;
16
- $blue-60: #577291;
17
- $blue-65: #46688f;
18
- $blue-50: #6e87a2;
19
- $blue-40: #98a9bd;
20
- $blue-30: #a4b6ca;
21
- $blue-20: #dbe5f0;
22
- $blue-10: #ebeef2;
23
- $blue-5: #f0f4fa;
24
-
25
- // Gray shades
26
- $gray-100: #2d2e2d;
27
- $gray-90: #4e4e4e;
28
- $gray-80: #5b5b5b;
29
- $gray-70: #767676;
30
- $gray-60: #a1a1a1;
31
- $gray-50: #c6c6c6;
32
- $gray-30: #dadada;
33
- $gray-20: #e7e7e7;
34
- $gray-10: #f2f2f2;
9
+ /*******************************************************************************
10
+ * Import Build Canada Design Tokens
11
+ ******************************************************************************/
12
+
13
+ @use "@buildcanada/components/src/styles/tokens" as bc;
14
+
15
+ /*******************************************************************************
16
+ * Brand Colors (from Build Canada design system)
17
+ ******************************************************************************/
18
+
19
+ $linen: bc.$linen;
20
+ $charcoal: bc.$charcoal;
21
+ $auburn: bc.$auburn;
22
+ $white: bc.$white;
23
+
24
+ /*******************************************************************************
25
+ * Primary Color Scale - Auburn (Red)
26
+ ******************************************************************************/
27
+
28
+ $auburn-50: bc.$auburn-50;
29
+ $auburn-100: bc.$auburn-100;
30
+ $auburn-200: bc.$auburn-200;
31
+ $auburn-300: bc.$auburn-300;
32
+ $auburn-400: bc.$auburn-400;
33
+ $auburn-500: bc.$auburn-500;
34
+ $auburn-600: bc.$auburn-600;
35
+ $auburn-700: bc.$auburn-700;
36
+ $auburn-800: bc.$auburn-800;
37
+ $auburn-900: bc.$auburn-900;
38
+ $auburn-950: bc.$auburn-950;
39
+
40
+ /*******************************************************************************
41
+ * Secondary Color Scale - Cerulean (Blue)
42
+ ******************************************************************************/
43
+
44
+ $cerulean-50: bc.$cerulean-50;
45
+ $cerulean-100: bc.$cerulean-100;
46
+ $cerulean-200: bc.$cerulean-200;
47
+ $cerulean-300: bc.$cerulean-300;
48
+ $cerulean-400: bc.$cerulean-400;
49
+ $cerulean-500: bc.$cerulean-500;
50
+ $cerulean-600: bc.$cerulean-600;
51
+ $cerulean-700: bc.$cerulean-700;
52
+ $cerulean-800: bc.$cerulean-800;
53
+ $cerulean-900: bc.$cerulean-900;
54
+ $cerulean-950: bc.$cerulean-950;
55
+
56
+ /*******************************************************************************
57
+ * Tertiary Color Scale - Sienna (Orange)
58
+ ******************************************************************************/
59
+
60
+ $sienna-50: bc.$sienna-50;
61
+ $sienna-100: bc.$sienna-100;
62
+ $sienna-200: bc.$sienna-200;
63
+ $sienna-300: bc.$sienna-300;
64
+ $sienna-400: bc.$sienna-400;
65
+ $sienna-500: bc.$sienna-500;
66
+ $sienna-600: bc.$sienna-600;
67
+ $sienna-700: bc.$sienna-700;
68
+ $sienna-800: bc.$sienna-800;
69
+ $sienna-900: bc.$sienna-900;
70
+ $sienna-950: bc.$sienna-950;
71
+
72
+ /*******************************************************************************
73
+ * Supporting Color Scale - Fantasia (Purple)
74
+ ******************************************************************************/
75
+
76
+ $fantasia-50: bc.$fantasia-50;
77
+ $fantasia-100: bc.$fantasia-100;
78
+ $fantasia-200: bc.$fantasia-200;
79
+ $fantasia-300: bc.$fantasia-300;
80
+ $fantasia-400: bc.$fantasia-400;
81
+ $fantasia-500: bc.$fantasia-500;
82
+ $fantasia-600: bc.$fantasia-600;
83
+ $fantasia-700: bc.$fantasia-700;
84
+ $fantasia-800: bc.$fantasia-800;
85
+ $fantasia-900: bc.$fantasia-900;
86
+ $fantasia-950: bc.$fantasia-950;
87
+
88
+ /*******************************************************************************
89
+ * Supporting Color Scale - Emerald (Green)
90
+ ******************************************************************************/
91
+
92
+ $emerald-50: bc.$emerald-50;
93
+ $emerald-100: bc.$emerald-100;
94
+ $emerald-200: bc.$emerald-200;
95
+ $emerald-300: bc.$emerald-300;
96
+ $emerald-400: bc.$emerald-400;
97
+ $emerald-500: bc.$emerald-500;
98
+ $emerald-600: bc.$emerald-600;
99
+ $emerald-700: bc.$emerald-700;
100
+ $emerald-800: bc.$emerald-800;
101
+ $emerald-900: bc.$emerald-900;
102
+ $emerald-950: bc.$emerald-950;
103
+
104
+ /*******************************************************************************
105
+ * Gray Scale
106
+ ******************************************************************************/
107
+
35
108
  $gray-5: #f7f7f7;
109
+ $gray-10: bc.$gray-100;
110
+ $gray-20: bc.$gray-200;
111
+ $gray-30: bc.$gray-300;
112
+ $gray-50: bc.$gray-400;
113
+ $gray-60: bc.$gray-500;
114
+ $gray-70: bc.$gray-600;
115
+ $gray-80: bc.$gray-700;
116
+ $gray-90: bc.$gray-800;
117
+ $gray-100: bc.$gray-900;
36
118
 
37
- // Amber shades
38
- $amber-110: #f9cf44;
39
- $amber-10: #f4eddb;
40
-
41
- $beige: #fbf9f3;
42
- $white: #ffffff;
43
-
44
- // Accent colors
45
- $accent-electric-blue: #2162e6;
46
- $accent-pale-blue: #e7f2ff;
47
- $accent-vermillion: #b40000;
48
-
49
- // Visited
50
- $purple-90: #631d49;
51
- $purple-60: #91577c;
52
- $visited-light: #b398a9;
53
-
54
- /* Text colors */
55
- $tertiary-text-color: $amber;
56
- $grey-text-color: #616161;
57
- $text-color: $blue-90;
58
- $secondary-text-color: $blue-60;
59
- $bluish-grey-text-color: $blue-50;
60
- $error-text-color: $vermillion;
61
-
62
- /* Category colors */
63
- $population-color: #2082a2;
64
- $health-color: #bf1b1b;
65
- $food-color: #588a0f;
66
- $energy-color: #ca6f34;
67
- $environment-color: #0c6947;
68
- $technology-color: #2774c6;
69
- $growth-inequality-color: #009655;
70
- $work-life-color: #ab348a;
71
- $public-sector-color: #eb6400;
72
- $global-connections-color: #17393d;
73
- $war-peace-color: #660000;
74
- $politics-color: #1b0655;
75
- $violence-rights-color: #cc235c;
76
- $education-color: #253f77;
77
- $media-color: #0089be;
78
- $culture-color: #af488f;
79
-
80
- /* Controls color */
81
- $controls-color: #0073e6;
119
+ /*******************************************************************************
120
+ * Legacy Brand Colors (backwards compatibility)
121
+ * Maps old OWID colors to Build Canada equivalents
122
+ ******************************************************************************/
123
+
124
+ $oxford-blue: $charcoal;
125
+ $vermillion: $auburn;
126
+ $amber: $sienna-400;
127
+
128
+ // Legacy blue shades mapped to cerulean
129
+ $blue-100: $cerulean-950;
130
+ $blue-95: $cerulean-900;
131
+ $blue-90: $cerulean-800;
132
+ $blue-65: $cerulean-700;
133
+ $blue-60: $cerulean-600;
134
+ $blue-50: $cerulean-500;
135
+ $blue-40: $cerulean-400;
136
+ $blue-30: $cerulean-300;
137
+ $blue-20: $cerulean-200;
138
+ $blue-10: $cerulean-100;
139
+ $blue-5: $cerulean-50;
140
+
141
+ // Legacy amber shades mapped to sienna
142
+ $amber-110: $sienna-300;
143
+ $amber-10: $sienna-50;
144
+
145
+ $beige: $linen;
146
+
147
+ /*******************************************************************************
148
+ * Accent Colors
149
+ ******************************************************************************/
150
+
151
+ $accent-electric-blue: $cerulean-500;
152
+ $accent-pale-blue: $cerulean-50;
153
+ $accent-vermillion: $auburn-700;
154
+
155
+ // Visited link colors mapped to fantasia (purple)
156
+ $purple-90: $fantasia-800;
157
+ $purple-60: $fantasia-600;
158
+ $visited-light: $fantasia-300;
159
+
160
+ /*******************************************************************************
161
+ * Text Colors
162
+ ******************************************************************************/
163
+
164
+ $text-color: $charcoal;
165
+ $secondary-text-color: bc.$gray-600;
166
+ $tertiary-text-color: $sienna-500;
167
+ $grey-text-color: bc.$gray-500;
168
+ $bluish-grey-text-color: $cerulean-600;
169
+ $error-text-color: $auburn;
170
+
171
+ /*******************************************************************************
172
+ * Category Colors (for data visualization)
173
+ * Using Build Canada palette
174
+ ******************************************************************************/
175
+
176
+ $population-color: $cerulean-500;
177
+ $health-color: $auburn-500;
178
+ $food-color: $emerald-600;
179
+ $energy-color: $sienna-500;
180
+ $environment-color: $emerald-800;
181
+ $technology-color: $cerulean-600;
182
+ $growth-inequality-color: $emerald-500;
183
+ $work-life-color: $fantasia-500;
184
+ $public-sector-color: $sienna-400;
185
+ $global-connections-color: $cerulean-900;
186
+ $war-peace-color: $auburn-900;
187
+ $politics-color: $fantasia-900;
188
+ $violence-rights-color: $auburn-400;
189
+ $education-color: $cerulean-800;
190
+ $media-color: $cerulean-400;
191
+ $culture-color: $fantasia-600;
192
+
193
+ /*******************************************************************************
194
+ * Controls & UI Colors
195
+ ******************************************************************************/
196
+
197
+ $controls-color: $cerulean-500;
82
198
  $light-shadow:
83
- rgba(0, 0, 0, 0.1) 0px 0px 0px 1px,
84
- rgba(0, 0, 0, 0.08) 0px 2px 2px;
199
+ rgba(39, 39, 39, 0.1) 0px 0px 0px 1px,
200
+ rgba(39, 39, 39, 0.08) 0px 2px 2px;
201
+
202
+ /*******************************************************************************
203
+ * SDG Colors (UN Sustainable Development Goals)
204
+ ******************************************************************************/
85
205
 
86
- /* SDG colors */
87
206
  $sdgColors: (
88
207
  1: color.scale(#e5243b, $lightness: -15%),
89
208
  2: #dda63a,
@@ -104,9 +223,20 @@ $sdgColors: (
104
223
  17: color.scale(#19486a, $lightness: -15%),
105
224
  );
106
225
 
226
+ /*******************************************************************************
227
+ * CSS Custom Properties Export
228
+ ******************************************************************************/
229
+
107
230
  :root {
108
- // See also gdocTypes/Gdoc.ts > GdocPostContent > cover-color
231
+ // Brand colors
232
+ --bc-linen: #{$linen};
233
+ --bc-charcoal: #{$charcoal};
234
+ --bc-auburn: #{$auburn};
235
+
236
+ // Legacy variables for backwards compatibility
109
237
  --amber: #{$amber};
238
+
239
+ // SDG colors
110
240
  @each $i, $sdgColor in $sdgColors {
111
241
  --sdg-color-#{$i}: #{$sdgColor};
112
242
  }
@@ -1,9 +1,15 @@
1
- $sans-serif-font-stack:
2
- Lato, "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
3
- $serif-font-stack:
4
- "Playfair Display", Georgia, "Times New Roman", "Liberation Serif", serif;
5
- $monospace-font-stack:
6
- "Menlo", "Courier New", Courier, monospace; // only to be used for code blocks
1
+ // Build Canada brand fonts
2
+ // Headlines: Söhne Kraftig - modern neo-grotesque
3
+ // Body: Financier Text - serif for readability
4
+ // Mono: Founder's Grotesk Mono - for data/code
5
+ $font-headline: "Soehne Kraftig", "Helvetica Neue", Helvetica, Arial, sans-serif;
6
+ $font-body: "Financier Text", Georgia, "Times New Roman", serif;
7
+ $font-mono: "Founders Grotesk Mono", "Menlo", "Courier New", monospace;
8
+
9
+ // Legacy aliases for backwards compatibility
10
+ $sans-serif-font-stack: $font-headline;
11
+ $serif-font-stack: $font-body;
12
+ $monospace-font-stack: $font-mono;
7
13
  $default-font-features: "liga", "kern", "calt", "lnum";
8
14
 
9
15
  //
@@ -1,20 +1,34 @@
1
- // gray shades
2
- export const GRAY_100 = "#2d2e2d"
3
- export const GRAY_90 = "#4e4e4e"
4
- export const GRAY_80 = "#5b5b5b"
5
- export const GRAY_70 = "#767676"
6
- export const GRAY_60 = "#a1a1a1"
7
- export const GRAY_50 = "#c6c6c6"
8
- export const GRAY_30 = "#dadada"
9
- export const GRAY_20 = "#e7e7e7"
10
- export const GRAY_10 = "#f2f2f2"
11
- export const GRAY_5 = "#f7f7f7"
1
+ /*******************************************************************************
2
+ * Color Constants
3
+ *
4
+ * Uses Build Canada design system colors.
5
+ ******************************************************************************/
12
6
 
13
- export const GRAPHER_BACKGROUND_DEFAULT = "#ffffff"
14
- export const GRAPHER_BACKGROUND_BEIGE = "#fbf9f3"
7
+ // Build Canada brand colors
8
+ export const LINEN = "#F6ECE3"
9
+ export const CHARCOAL = "#272727"
10
+ export const AUBURN = "#932F2F"
15
11
 
16
- export const GRAPHER_DARK_TEXT = GRAY_80
17
- export const GRAPHER_LIGHT_TEXT = GRAY_70
12
+ // Gray shades
13
+ export const GRAY_100 = "#171717"
14
+ export const GRAY_90 = "#272727"
15
+ export const GRAY_80 = "#404040"
16
+ export const GRAY_70 = "#525252"
17
+ export const GRAY_60 = "#737373"
18
+ export const GRAY_50 = "#a3a3a3"
19
+ export const GRAY_30 = "#d4d4d4"
20
+ export const GRAY_20 = "#e5e5e5"
21
+ export const GRAY_10 = "#f5f5f5"
22
+ export const GRAY_5 = "#fafafa"
18
23
 
24
+ // Grapher backgrounds - using Build Canada linen
25
+ export const GRAPHER_BACKGROUND_DEFAULT = LINEN
26
+ export const GRAPHER_BACKGROUND_BEIGE = LINEN
27
+
28
+ // Text colors
29
+ export const GRAPHER_DARK_TEXT = CHARCOAL
30
+ export const GRAPHER_LIGHT_TEXT = GRAY_60
31
+
32
+ // Other
19
33
  export const NO_DATA_GRAY = "#6e7581"
20
34
  export const ERROR_COLOR = "ff0002"
@@ -1,57 +1,63 @@
1
- // keep in sync with constant values in ActionButtons.tsx
2
- $actionButtonHeight: 32px; // keep in sync with BUTTON_HEIGHT
3
- $paddingBetweenActionButtons: 8px; // keep in sync with PADDING_BETWEEN_BUTTONS
4
- $paddingBetweenIconAndLabel: 8px; // keep in sync with PADDING_BETWEEN_ICON_AND_LABEL
5
- $paddingX: 12px; // keep in sync with PADDING_X
1
+ /*******************************************************************************
2
+ * Action Buttons
3
+ *
4
+ * Row of action buttons in the grapher (download, share, etc.)
5
+ * Uses Build Canada design system colors.
6
+ ******************************************************************************/
7
+
8
+ // Keep in sync with constant values in ActionButtons.tsx
9
+ $actionButtonHeight: 32px;
10
+ $paddingBetweenActionButtons: 8px;
11
+ $paddingBetweenIconAndLabel: 8px;
12
+ $paddingX: 12px;
6
13
 
7
14
  .ActionButtons {
8
15
  margin: 0;
9
16
  padding: 0;
10
- white-space: nowrap;
17
+ height: $actionButtonHeight;
11
18
 
12
19
  ul {
13
20
  display: flex;
14
21
  list-style: none;
15
- height: $actionButtonHeight;
22
+ height: 100%;
16
23
  padding: 0;
24
+ margin: 0;
25
+ gap: $paddingBetweenActionButtons;
17
26
  }
18
27
 
19
28
  li {
20
29
  height: 100%;
21
- display: inline-block;
30
+ display: flex;
22
31
  position: relative;
23
32
  }
24
-
25
- li + li {
26
- margin-left: $paddingBetweenActionButtons;
27
- }
28
33
  }
29
34
 
30
35
  div.ActionButton {
31
- --light-fill: #{$gray-10};
32
- --hover-fill: #{$gray-20};
33
- --active-fill: #{$blue-20};
34
- --text-color: #{$dark-text};
36
+ --light-fill: #{$white};
37
+ --hover-fill: #{$gray-10};
38
+ --active-fill: #{$cerulean-100};
39
+ --text-color: #{$charcoal};
40
+ --border-color: #{$gray-20};
35
41
 
36
42
  &.ActionButton--exploreData {
37
- --light-fill: #{$blue-20};
38
- --hover-fill: #{$blue-20};
39
- --active-fill: #{$blue-10};
40
- --text-color: #{$blue-90};
41
-
43
+ --light-fill: #{$cerulean-100};
44
+ --hover-fill: #{$cerulean-200};
45
+ --active-fill: #{$cerulean-100};
46
+ --text-color: #{$cerulean-900};
42
47
  --hover-decoration: underline;
43
48
  }
44
49
 
45
50
  &.ActionButton--donate {
46
- --light-fill: #{rgba($vermillion, 0.15)};
47
- --hover-fill: #{rgba(#f4a39f, 0.15)};
48
- --active-fill: var(--hover-fill);
49
- --text-color: #{$vermillion};
51
+ --light-fill: #{$auburn-100};
52
+ --hover-fill: #{$auburn-200};
53
+ --active-fill: #{$auburn-100};
54
+ --text-color: #{$auburn};
50
55
  }
51
56
 
52
57
  height: 100%;
53
- border-radius: 4px;
58
+ border-radius: 0;
54
59
  position: relative;
60
+ transition: all 150ms ease;
55
61
 
56
62
  button,
57
63
  a {
@@ -59,24 +65,32 @@ div.ActionButton {
59
65
  align-items: center;
60
66
  gap: $paddingBetweenIconAndLabel;
61
67
  height: 100%;
62
- width: 100%;
68
+ box-sizing: border-box;
63
69
  cursor: pointer;
64
70
  color: var(--text-color);
71
+ font-family: $sans-serif-font-stack;
65
72
  font-size: 13px;
66
73
  font-weight: 500;
74
+ line-height: 1;
67
75
  padding: 0 $paddingX;
68
76
  border-radius: inherit;
69
77
  background-color: var(--light-fill);
70
- position: relative;
71
78
  letter-spacing: 0.01em;
79
+ text-transform: uppercase;
80
+ transition: all 150ms ease;
81
+ border: none;
82
+ outline: none;
83
+ text-decoration: none;
84
+ white-space: nowrap;
72
85
 
73
86
  svg {
74
87
  font-size: 12px;
88
+ transition: transform 150ms ease;
75
89
  }
76
90
 
77
91
  &.icon-only {
78
92
  justify-content: center;
79
- padding: 0;
93
+ padding: 0 8px;
80
94
  }
81
95
 
82
96
  &:visited {
@@ -85,13 +99,18 @@ div.ActionButton {
85
99
 
86
100
  &:hover {
87
101
  background-color: var(--hover-fill);
88
- text-decoration: var(--hover-decoration);
102
+ text-decoration: var(--hover-decoration, none);
89
103
  }
90
104
 
91
105
  &:active,
92
106
  &.active {
93
- color: $active-text;
107
+ color: $cerulean-900;
94
108
  background-color: var(--active-fill);
95
109
  }
110
+
111
+ &:focus-visible {
112
+ outline: 2px solid $auburn;
113
+ outline-offset: 2px;
114
+ }
96
115
  }
97
116
  }