@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.
@@ -18,8 +18,9 @@
18
18
 
19
19
  .modal-content {
20
20
  position: absolute;
21
- border-radius: 4px;
21
+ border-radius: 0;
22
22
  background: #fff;
23
+ border: 1px solid $gray-20;
23
24
  box-shadow: 0px 4px 30px 0px rgba(0, 0, 0, 0.15);
24
25
  min-height: 150px;
25
26
  }
@@ -69,14 +69,12 @@ export class NoDataModal extends React.Component<NoDataModalProps> {
69
69
  const helpText = this.props.helpText ?? defaultHelpText
70
70
 
71
71
  const center = bounds.centerPos
72
- const padding = 0.75 * this.fontSize
72
+ const padding = 1.25 * this.fontSize
73
73
  const showHelpText = !isStatic && !!helpText
74
- const helpTextFontSize = 0.9 * this.fontSize
74
+ const helpTextFontSize = 0.85 * this.fontSize
75
75
 
76
76
  return (
77
77
  <g className="no-data">
78
- <rect {...bounds.toProps()} fill="#fff" opacity={0.6} />
79
-
80
78
  <Halo
81
79
  id="no-data-message"
82
80
  outlineWidth={GRAPHER_TEXT_OUTLINE_FACTOR * this.fontSize}
@@ -85,11 +83,7 @@ export class NoDataModal extends React.Component<NoDataModalProps> {
85
83
  <text
86
84
  x={center.x}
87
85
  y={center.y}
88
- dy={
89
- showHelpText
90
- ? -padding / 2
91
- : dyFromAlign(VerticalAlign.middle)
92
- }
86
+ dy={showHelpText ? -padding / 4 : 4}
93
87
  textAnchor="middle"
94
88
  fontSize={this.fontSize}
95
89
  fontWeight={500}
@@ -1,3 +1,10 @@
1
+ /*******************************************************************************
2
+ * Tabs
3
+ *
4
+ * Tab component styling for chart/table switchers.
5
+ * Uses Build Canada design system colors - no rounded edges.
6
+ ******************************************************************************/
7
+
1
8
  .Tabs {
2
9
  position: relative;
3
10
 
@@ -16,23 +23,30 @@
16
23
  flex-shrink: 0;
17
24
  display: inline-block;
18
25
  margin: 0 8px 8px 0;
19
- padding: 8px;
20
- border: 1px solid $blue-10;
21
- background: #fff;
22
- color: $dark-text;
26
+ padding: 10px 16px;
27
+ border: 1px solid $gray-20;
28
+ border-radius: 0;
29
+ background: $white;
30
+ color: $charcoal;
23
31
  white-space: normal;
24
32
  cursor: pointer;
25
33
  text-wrap: balance;
34
+ transition: all 150ms ease;
26
35
 
27
36
  &[data-hovered] {
28
37
  background-color: $gray-10;
29
- border-color: $gray-10;
38
+ border-color: $gray-30;
30
39
  }
31
40
 
32
41
  &[data-selected] {
33
- background: $accent-pale-blue;
34
- border-color: $accent-pale-blue;
35
- color: $blue-90;
42
+ background: $cerulean-100;
43
+ border-color: $cerulean-500;
44
+ color: $cerulean-900;
45
+ }
46
+
47
+ &:focus-visible {
48
+ outline: 2px solid $auburn;
49
+ outline-offset: 2px;
36
50
  }
37
51
  }
38
52
  }
@@ -58,73 +72,79 @@
58
72
  );
59
73
  }
60
74
 
61
- // Variant: slim
75
+ // Variant: slim (for Chart/Table switcher)
62
76
  &.Tabs--variant-slim {
63
77
  $font-size: var(--tabs-font-size, 13px);
64
78
  --tab-padding: 16px;
65
79
 
66
80
  $light-stroke: $gray-20;
67
-
68
81
  $hover-fill: $gray-10;
69
- $active-fill: $blue-20;
70
-
71
- $border-radius: 4px;
72
- $visual-gap: 2px;
82
+ $active-fill: $auburn-500;
83
+ $visual-gap: 0;
73
84
 
74
85
  display: flex;
75
86
  height: $controlRowHeight;
76
87
  margin: 0;
77
- padding: $visual-gap;
78
- // using a box-shadow instead of a border fixes a bug
79
- // where the tab items weren't centered when zoomed in or out
88
+ padding: 0;
80
89
  box-shadow: inset 0 0 0 1px $light-stroke;
81
- border-radius: $border-radius;
90
+ border-radius: 0;
82
91
 
83
92
  .Tabs__Tab {
84
93
  position: relative;
85
94
 
86
- $height: $controlRowHeight - 2 * $visual-gap;
95
+ $height: $controlRowHeight;
87
96
 
88
97
  display: block;
89
- text-transform: capitalize;
90
- color: $light-text;
98
+ text-transform: uppercase;
99
+ letter-spacing: 0.02em;
100
+ color: $charcoal;
91
101
  font-size: $font-size;
92
102
  font-weight: 500;
93
103
  height: $height;
94
104
  line-height: $height;
95
- border-radius: $border-radius - $visual-gap;
105
+ border-radius: 0;
96
106
  padding: 0 var(--tab-padding);
97
107
  cursor: pointer;
98
- letter-spacing: 0.01em;
99
108
  white-space: nowrap;
100
109
  user-select: none;
101
110
  text-align: center;
102
111
  text-overflow: ellipsis;
103
112
  overflow: hidden;
113
+ transition: all 150ms ease;
114
+ background-color: $white;
104
115
 
105
116
  &[data-hovered] {
106
117
  background-color: $hover-fill;
107
118
  }
108
119
 
109
120
  &[data-selected] {
110
- color: $active-text;
121
+ color: $white;
111
122
  background-color: $active-fill;
123
+
124
+ svg {
125
+ color: $white;
126
+ }
127
+ }
128
+
129
+ &:focus-visible {
130
+ outline: 2px solid $auburn;
131
+ outline-offset: -2px;
112
132
  }
113
133
  }
114
134
 
115
- // separators between tabs
135
+ // Separators between tabs
116
136
  .Tabs__Tab + .Tabs__Tab::before {
117
137
  content: "";
118
138
  display: block;
119
139
  width: 1px;
120
- height: calc(100% - 12px);
140
+ height: calc(100% - 8px);
121
141
  position: absolute;
122
- top: 6px;
142
+ top: 4px;
123
143
  background-color: $light-stroke;
124
144
  left: -0.5px;
125
145
  }
126
146
 
127
- // hide separators when a tab is hovered over or when a tab is active
147
+ // Hide separators when a tab is hovered over or when a tab is active
128
148
  .Tabs__Tab[data-selected]::before,
129
149
  .Tabs__Tab[data-hovered]::before,
130
150
  .Tabs__Tab[data-selected] + .Tabs__Tab::before,
@@ -139,7 +159,7 @@
139
159
  gap: 8px;
140
160
 
141
161
  $hover-fill: $gray-10;
142
- $active-fill: $accent-pale-blue;
162
+ $active-fill: $cerulean-100;
143
163
 
144
164
  .Tabs__Tab {
145
165
  flex-grow: 1;
@@ -147,22 +167,29 @@
147
167
 
148
168
  @include grapher_label-2-medium;
149
169
  display: inline-block;
150
- padding: 8px;
151
- border: 1px solid $blue-10;
152
- background: #fff;
153
- color: $dark-text;
170
+ padding: 10px 16px;
171
+ border: 1px solid $gray-20;
172
+ border-radius: 0;
173
+ background: $white;
174
+ color: $charcoal;
154
175
  cursor: pointer;
155
176
  text-wrap: balance;
177
+ transition: all 150ms ease;
156
178
 
157
179
  &[data-hovered] {
158
180
  background-color: $hover-fill;
159
- border-color: $hover-fill;
181
+ border-color: $gray-30;
160
182
  }
161
183
 
162
184
  &[data-selected] {
163
185
  background: $active-fill;
164
- border-color: $active-fill;
165
- color: $blue-90;
186
+ border-color: $cerulean-500;
187
+ color: $cerulean-900;
188
+ }
189
+
190
+ &:focus-visible {
191
+ outline: 2px solid $auburn;
192
+ outline-offset: 2px;
166
193
  }
167
194
  }
168
195
  }
@@ -1,22 +1,29 @@
1
+ /*******************************************************************************
2
+ * Timeline Component
3
+ *
4
+ * Year slider and playback controls.
5
+ * Uses Build Canada design system colors.
6
+ ******************************************************************************/
7
+
1
8
  $timelineHeight: 32px;
2
9
 
3
10
  .timeline-component {
4
- // diameter of the start and and handle
5
- $handle-diameter: 20px; // keep in sync with HANDLE_DIAMETER in TimelineComponent.tsx
11
+ // Diameter of the start and end handle
12
+ $handle-diameter: 20px; // Keep in sync with HANDLE_DIAMETER in TimelineComponent.tsx
6
13
 
7
- // start and end handles
8
- $default-knob: $gray-60;
9
- $active-knob: $blue-50;
14
+ // Start and end handles
15
+ $default-knob: $gray-50;
16
+ $active-knob: $auburn;
10
17
 
11
- // timeline slider and interval
18
+ // Timeline slider and interval
12
19
  $light-timeline: $gray-20;
13
- $active-timeline: $blue-30;
14
- $hover-timeline: $default-knob;
20
+ $active-timeline: $auburn-500;
21
+ $hover-timeline: $auburn;
15
22
 
16
- // start/end year label
17
- $light-fill: $gray-10;
18
- $hover-fill: $gray-20;
19
- $active-fill: $blue-20;
23
+ // Start/end year label
24
+ $light-fill: $white;
25
+ $hover-fill: $gray-10;
26
+ $active-fill: $cerulean-100;
20
27
 
21
28
  width: 100%;
22
29
  height: $timelineHeight;
@@ -34,24 +41,34 @@ $timelineHeight: 32px;
34
41
 
35
42
  .date {
36
43
  height: 100%;
44
+ font-family: $sans-serif-font-stack;
37
45
  font-size: 13px;
38
- font-weight: 400;
39
- color: $dark-text;
40
- padding: 0 8px;
41
- border-radius: 4px;
46
+ font-weight: 500;
47
+ color: $charcoal;
48
+ padding: 0 12px;
49
+ border-radius: 0;
42
50
  display: grid;
43
51
  place-content: center;
44
52
  margin-right: 0;
45
53
  background-color: $light-fill;
46
54
  user-select: none;
55
+ border: 1px solid $gray-20;
56
+ transition: all 150ms ease;
47
57
 
48
58
  &:hover {
49
59
  background: $hover-fill;
60
+ cursor: pointer;
50
61
  }
51
62
 
52
63
  &:active {
53
64
  background: $active-fill;
54
- color: $active-text;
65
+ border-color: $cerulean-500;
66
+ color: $cerulean-900;
67
+ }
68
+
69
+ &:focus-visible {
70
+ outline: 2px solid $auburn;
71
+ outline-offset: 2px;
55
72
  }
56
73
  }
57
74
 
@@ -88,15 +105,15 @@ $timelineHeight: 32px;
88
105
  > .icon {
89
106
  height: $handle-diameter;
90
107
  width: $handle-diameter;
91
- border-radius: 100%;
108
+ border-radius: 0;
92
109
 
93
110
  background: $default-knob;
94
- border: 2px solid #fff;
111
+ border: 2px solid $white;
95
112
  z-index: 1;
96
113
  pointer-events: none;
97
114
 
98
115
  transform: scale(1);
99
- transition: transform 0.1s ease-out;
116
+ transition: transform 0.15s ease-out, background 0.15s ease;
100
117
  }
101
118
  }
102
119
 
@@ -129,7 +146,7 @@ $timelineHeight: 32px;
129
146
 
130
147
  &.hover {
131
148
  .handle > .icon {
132
- transform: scale(1.3);
149
+ transform: scale(1.2);
133
150
  }
134
151
 
135
152
  .handle:not(.hoverMarker) > .icon {
@@ -137,3 +154,40 @@ $timelineHeight: 32px;
137
154
  }
138
155
  }
139
156
  }
157
+
158
+ /*******************************************************************************
159
+ * Play/Pause Button
160
+ ******************************************************************************/
161
+
162
+ .timeline-play-button {
163
+ display: flex;
164
+ align-items: center;
165
+ justify-content: center;
166
+ width: $timelineHeight;
167
+ height: $timelineHeight;
168
+ background: $white;
169
+ border: 1px solid $gray-20;
170
+ border-radius: 0;
171
+ cursor: pointer;
172
+ color: $charcoal;
173
+ transition: all 150ms ease;
174
+
175
+ &:hover {
176
+ background: $gray-20;
177
+ }
178
+
179
+ &:active {
180
+ background: $cerulean-100;
181
+ border-color: $cerulean-500;
182
+ color: $cerulean-900;
183
+ }
184
+
185
+ &:focus-visible {
186
+ outline: 2px solid $auburn;
187
+ outline-offset: 2px;
188
+ }
189
+
190
+ svg {
191
+ font-size: 12px;
192
+ }
193
+ }
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  > .Tooltip {
37
- border-radius: 4px;
37
+ border-radius: 0;
38
38
  border: 1px solid $background-stroke;
39
39
  box-shadow: 0px 4px 40px rgba(0, 0, 0, 0.2);
40
40
  background: white;
@@ -57,7 +57,7 @@
57
57
  background: $background-fill;
58
58
  color: black;
59
59
  padding: 8px 12px;
60
- border-radius: 3px 3px 0 0;
60
+ border-radius: 0;
61
61
 
62
62
  .title,
63
63
  .subtitle {
@@ -93,7 +93,7 @@
93
93
  }
94
94
 
95
95
  &.plain header {
96
- border-radius: 3px;
96
+ border-radius: 0;
97
97
  background: white;
98
98
  }
99
99
 
@@ -383,7 +383,7 @@
383
383
  position: relative;
384
384
  color: $grey;
385
385
  padding: 4px 12px;
386
- border-radius: 0 0 3px 3px;
386
+ border-radius: 0;
387
387
  border-top: 1px solid $light-grey;
388
388
 
389
389
  .line {
@@ -7,6 +7,9 @@
7
7
  * import '@buildcanada/charts/styles.css'
8
8
  */
9
9
 
10
+ // Import Build Canada design system fonts
11
+ @use "@buildcanada/components/src/styles/fonts";
12
+
10
13
  // Import the main grapher styles which include all component styles
11
14
  @import "../grapher/core/grapher.scss";
12
15