@react-magma/charts 16.0.0-next.0 → 16.0.0-next.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-magma/charts",
3
- "version": "16.0.0-next.0",
3
+ "version": "16.0.0-next.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,7 +50,7 @@
50
50
  "identity-obj-proxy": "3.0.0",
51
51
  "react": "18.3.1",
52
52
  "react-dom": "18.3.1",
53
- "react-magma-dom": "^7.0.0-next.0",
53
+ "react-magma-dom": "^7.0.0-next.1",
54
54
  "react-magma-icons": "^3.2.5",
55
55
  "rollup": "^4.52.4",
56
56
  "rollup-plugin-postcss": "^4.0.2"
@@ -60,7 +60,7 @@
60
60
  "@emotion/styled": "^11.14.0",
61
61
  "react": "^18.3.1",
62
62
  "react-dom": "^18.3.1",
63
- "react-magma-dom": "^7.0.0",
63
+ "react-magma-dom": "^7.0.0-next.1",
64
64
  "react-magma-icons": "^3.2.5"
65
65
  },
66
66
  "engines": {
@@ -99,7 +99,7 @@ describe('CarbonChart', () => {
99
99
  });
100
100
 
101
101
  describe('Magma Theme Values Applied to Styles', () => {
102
- it('should apply theme.colors.neutral700 to data table cells', () => {
102
+ it('should apply theme.colors.brand.navy to data table cells', () => {
103
103
  const testId = 'table-color-test';
104
104
  const { getByTestId } = render(
105
105
  <ThemeContext.Provider value={magma}>
@@ -114,12 +114,56 @@ describe('CarbonChart', () => {
114
114
 
115
115
  const wrapper = getByTestId(testId);
116
116
 
117
- // CarbonChartWrapper applies theme.colors.neutral700 to .cds--data-table td
118
- expect(wrapper).toHaveStyleRule('color', magma.colors.neutral700, {
117
+ expect(wrapper).toHaveStyleRule('color', magma.colors.brand.navy, {
119
118
  target: '.cds--data-table td',
120
119
  });
121
120
  });
122
121
 
122
+ it('should apply theme.colors.brand.navy to chart text', () => {
123
+ const testId = 'chart-text-color-test';
124
+ const { getByTestId } = render(
125
+ <ThemeContext.Provider value={magma}>
126
+ <CarbonChart
127
+ testId={testId}
128
+ dataSet={dataSet}
129
+ options={chartOptions}
130
+ type={CarbonChartType.bar}
131
+ />
132
+ </ThemeContext.Provider>
133
+ );
134
+
135
+ const wrapper = getByTestId(testId);
136
+
137
+ expect(wrapper).toHaveStyleRule('color', magma.colors.brand.navy, {
138
+ target: 'p',
139
+ });
140
+ expect(wrapper).toHaveStyleRule(
141
+ 'fill',
142
+ `${magma.colors.brand.navy}!important`,
143
+ { target: '.chart-holder text' }
144
+ );
145
+ });
146
+
147
+ it('should apply theme.colors.brand.navy to the chart title', () => {
148
+ const testId = 'title-color-test';
149
+ const { getByTestId } = render(
150
+ <ThemeContext.Provider value={magma}>
151
+ <CarbonChart
152
+ testId={testId}
153
+ dataSet={dataSet}
154
+ options={chartOptions}
155
+ type={CarbonChartType.bar}
156
+ />
157
+ </ThemeContext.Provider>
158
+ );
159
+
160
+ expect(getByTestId(testId)).toHaveStyleRule(
161
+ 'color',
162
+ `${magma.colors.brand.navy}!important`,
163
+ { target: '.cds--cc--title p.title' }
164
+ );
165
+ });
166
+
123
167
  it('should apply theme.colors.primary for button background in non-inverse mode', () => {
124
168
  const testId = 'button-color-test';
125
169
  const { getByTestId } = render(
@@ -142,7 +186,7 @@ describe('CarbonChart', () => {
142
186
  });
143
187
  });
144
188
 
145
- it('should apply theme.colors.tertiary500 for button background when isInverse is true', () => {
189
+ it('should apply theme.colors.cyan500 for button background when isInverse is true', () => {
146
190
  const testId = 'button-inverse-test';
147
191
  const { getByTestId } = render(
148
192
  <ThemeContext.Provider value={magma}>
@@ -158,13 +202,13 @@ describe('CarbonChart', () => {
158
202
 
159
203
  const wrapper = getByTestId(testId);
160
204
 
161
- // CarbonChartWrapper applies theme.colors.tertiary500 to .cds--btn--primary when inverse
162
- expect(wrapper).toHaveStyleRule('background', magma.colors.tertiary500, {
205
+ // CarbonChartWrapper applies theme.colors.cyan500 to .cds--btn--primary when inverse
206
+ expect(wrapper).toHaveStyleRule('background', magma.colors.cyan500, {
163
207
  target: '.chart-holder .cds--btn--primary',
164
208
  });
165
209
  });
166
210
 
167
- it('should apply theme.colors.primary700 for inverse table header background', () => {
211
+ it('should apply theme.colors.indigo700 for inverse table header background', () => {
168
212
  const testId = 'table-inverse-test';
169
213
  const { getByTestId } = render(
170
214
  <ThemeContext.Provider value={magma}>
@@ -180,10 +224,10 @@ describe('CarbonChart', () => {
180
224
 
181
225
  const wrapper = getByTestId(testId);
182
226
 
183
- // CarbonChartWrapper applies theme.colors.primary700 to table header when inverse
227
+ // CarbonChartWrapper applies theme.colors.indigo700 to table header when inverse
184
228
  expect(wrapper).toHaveStyleRule(
185
229
  'background',
186
- `${magma.colors.primary700}!important`,
230
+ `${magma.colors.indigo700}!important`,
187
231
  {
188
232
  target: '.cds--data-table thead tr th',
189
233
  }
@@ -206,7 +250,7 @@ describe('CarbonChart', () => {
206
250
 
207
251
  expect(getByTestId(testId)).toHaveStyleRule(
208
252
  'background-color',
209
- magma.colors.primary600,
253
+ magma.colors.indigo600,
210
254
  { target: '.cds--chart-holder.filled' }
211
255
  );
212
256
  });
@@ -476,7 +520,7 @@ describe('CarbonChart', () => {
476
520
  });
477
521
  });
478
522
 
479
- it('should apply theme.colors.primary600 to modal header background when isInverse', () => {
523
+ it('should apply theme.colors.indigo600 to modal header background when isInverse', () => {
480
524
  const testId = 'modal-header-inverse-test';
481
525
  const { getByTestId } = render(
482
526
  <ThemeContext.Provider value={magma}>
@@ -492,8 +536,8 @@ describe('CarbonChart', () => {
492
536
 
493
537
  const wrapper = getByTestId(testId);
494
538
 
495
- // CarbonChartWrapper applies theme.colors.primary600 to modal header when inverse
496
- expect(wrapper).toHaveStyleRule('background', magma.colors.primary600, {
539
+ // CarbonChartWrapper applies theme.colors.indigo600 to modal header when inverse
540
+ expect(wrapper).toHaveStyleRule('background', magma.colors.indigo600, {
497
541
  target: '.chart-holder .cds--modal-header',
498
542
  });
499
543
  });
@@ -545,7 +589,7 @@ describe('CarbonChart', () => {
545
589
  );
546
590
  });
547
591
 
548
- it('should apply theme.colors.primary600 to modal footer background when isInverse', () => {
592
+ it('should apply theme.colors.indigo600 to modal footer background when isInverse', () => {
549
593
  const testId = 'modal-footer-inverse-test';
550
594
  const { getByTestId } = render(
551
595
  <ThemeContext.Provider value={magma}>
@@ -561,10 +605,10 @@ describe('CarbonChart', () => {
561
605
 
562
606
  const wrapper = getByTestId(testId);
563
607
 
564
- // CarbonChartWrapper applies theme.colors.primary600 to modal footer when inverse
608
+ // CarbonChartWrapper applies theme.colors.indigo600 to modal footer when inverse
565
609
  expect(wrapper).toHaveStyleRule(
566
610
  'background',
567
- `${magma.colors.primary600}!important`,
611
+ `${magma.colors.indigo600}!important`,
568
612
  {
569
613
  target: '.cds--modal-footer.cds--modal-footer',
570
614
  }
@@ -185,7 +185,7 @@ const FullscreenRoot = styled.div<{
185
185
  &:-webkit-full-screen {
186
186
  background: ${props =>
187
187
  props.isInverse
188
- ? props.theme.colors.primary700
188
+ ? props.theme.colors.indigo700
189
189
  : props.theme.colors.neutral100};
190
190
 
191
191
  ${props =>
@@ -244,7 +244,7 @@ const CarbonChartWrapper = styled.div<{
244
244
  &:-webkit-full-screen {
245
245
  background: ${props =>
246
246
  props.isInverse
247
- ? props.theme.colors.primary700
247
+ ? props.theme.colors.indigo700
248
248
  : props.theme.colors.neutral100};
249
249
 
250
250
  .cds--chart-holder {
@@ -256,17 +256,20 @@ const CarbonChartWrapper = styled.div<{
256
256
  .cds--chart-holder.filled .cds--cc--chart-wrapper {
257
257
  background-color: ${props =>
258
258
  props.isInverse
259
- ? props.theme.colors.primary600
259
+ ? props.theme.colors.indigo600
260
260
  : props.theme.colors.neutral100};
261
261
  }
262
262
 
263
263
  .cds--data-table thead tr th {
264
264
  background: ${props =>
265
- props.isInverse ? props.theme.colors.primary700 : ''} !important;
265
+ props.isInverse ? props.theme.colors.indigo700 : ''} !important;
266
266
  }
267
267
  .cds--data-table td,
268
- .cds--data-table tbody th {
269
- color: ${props => props.theme.colors.neutral700};
268
+ .cds--data-table th {
269
+ color: ${props =>
270
+ props.isInverse
271
+ ? props.theme.colors.neutral100
272
+ : props.theme.colors.brand.navy};
270
273
  }
271
274
  .cds--data-table tbody tr,
272
275
  .cds--data-table tbody tr td,
@@ -283,7 +286,7 @@ const CarbonChartWrapper = styled.div<{
283
286
  color: ${props =>
284
287
  props.isInverse
285
288
  ? props.theme.colors.neutral100
286
- : props.theme.colors.neutral700};
289
+ : props.theme.colors.brand.navy};
287
290
  max-width: 142px;
288
291
  white-space: normal;
289
292
  }
@@ -291,10 +294,10 @@ const CarbonChartWrapper = styled.div<{
291
294
  .cds--modal-container {
292
295
  clip-path: inset(0% 0% 0% 0% round ${props => props.theme.borderRadius});
293
296
  background: ${props =>
294
- props.isInverse ? props.theme.colors.primary700 : ''};
297
+ props.isInverse ? props.theme.colors.indigo700 : ''};
295
298
  .cds--data-table th {
296
299
  background: ${props =>
297
- props.isInverse ? props.theme.colors.primary600 : ''};
300
+ props.isInverse ? props.theme.colors.indigo600 : ''};
298
301
  }
299
302
  .cds--data-table td {
300
303
  border-top: 1px solid
@@ -311,7 +314,7 @@ const CarbonChartWrapper = styled.div<{
311
314
  }
312
315
  .cds--data-table tr:hover td {
313
316
  background: ${props =>
314
- props.isInverse ? props.theme.colors.primary600 : ''};
317
+ props.isInverse ? props.theme.colors.indigo600 : ''};
315
318
  }
316
319
  }
317
320
 
@@ -319,13 +322,28 @@ const CarbonChartWrapper = styled.div<{
319
322
  .chart-holder div,
320
323
  .chart-holder text,
321
324
  .cds--cc--axes g.axis .axis-title,
322
- .cds--cc--title p.title,
323
325
  .cds--cc--axes g.axis g.tick text {
324
326
  font-family: ${props => props.theme.bodyFont} !important;
325
327
  color: ${props =>
326
328
  props.isInverse
327
329
  ? props.theme.colors.neutral100
328
- : props.theme.colors.neutral700};
330
+ : props.theme.colors.brand.navy};
331
+ }
332
+
333
+ .chart-holder text,
334
+ .cds--cc--axes g.axis .axis-title,
335
+ .cds--cc--axes g.axis g.tick text {
336
+ fill: ${props =>
337
+ props.isInverse
338
+ ? props.theme.colors.neutral100
339
+ : props.theme.colors.brand.navy} !important;
340
+ }
341
+
342
+ .cds--cc--title p.title {
343
+ color: ${props =>
344
+ props.isInverse
345
+ ? props.theme.colors.neutral100
346
+ : props.theme.colors.brand.navy} !important;
329
347
  }
330
348
 
331
349
  .cds--cc--axes {
@@ -412,28 +430,28 @@ const CarbonChartWrapper = styled.div<{
412
430
  1px 0px 0px
413
431
  ${props =>
414
432
  props.isInverse
415
- ? props.theme.colors.primary600
433
+ ? props.theme.colors.indigo600
416
434
  : props.theme.colors.neutral100}
417
435
  )
418
436
  drop-shadow(
419
437
  -1px 0px 0px
420
438
  ${props =>
421
439
  props.isInverse
422
- ? props.theme.colors.primary600
440
+ ? props.theme.colors.indigo600
423
441
  : props.theme.colors.neutral100}
424
442
  )
425
443
  drop-shadow(
426
444
  0px 1px 0px
427
445
  ${props =>
428
446
  props.isInverse
429
- ? props.theme.colors.primary600
447
+ ? props.theme.colors.indigo600
430
448
  : props.theme.colors.neutral100}
431
449
  )
432
450
  drop-shadow(
433
451
  0px -1px 0px
434
452
  ${props =>
435
453
  props.isInverse
436
- ? props.theme.colors.primary600
454
+ ? props.theme.colors.indigo600
437
455
  : props.theme.colors.neutral100}
438
456
  );
439
457
  }
@@ -444,28 +462,28 @@ const CarbonChartWrapper = styled.div<{
444
462
  1px 0px 0px
445
463
  ${props =>
446
464
  props.isInverse
447
- ? props.theme.colors.primary600
465
+ ? props.theme.colors.indigo600
448
466
  : props.theme.colors.neutral100}
449
467
  )
450
468
  drop-shadow(
451
469
  -1px 0px 0px
452
470
  ${props =>
453
471
  props.isInverse
454
- ? props.theme.colors.primary600
472
+ ? props.theme.colors.indigo600
455
473
  : props.theme.colors.neutral100}
456
474
  )
457
475
  drop-shadow(
458
476
  0px 1px 0px
459
477
  ${props =>
460
478
  props.isInverse
461
- ? props.theme.colors.primary600
479
+ ? props.theme.colors.indigo600
462
480
  : props.theme.colors.neutral100}
463
481
  )
464
482
  drop-shadow(
465
483
  0px -1px 0px
466
484
  ${props =>
467
485
  props.isInverse
468
- ? props.theme.colors.primary600
486
+ ? props.theme.colors.indigo600
469
487
  : props.theme.colors.neutral100}
470
488
  );
471
489
  }
@@ -486,28 +504,28 @@ const CarbonChartWrapper = styled.div<{
486
504
  1px 0px 0px
487
505
  ${props =>
488
506
  props.isInverse
489
- ? props.theme.colors.primary600
507
+ ? props.theme.colors.indigo600
490
508
  : props.theme.colors.neutral100}
491
509
  )
492
510
  drop-shadow(
493
511
  -1px 0px 0px
494
512
  ${props =>
495
513
  props.isInverse
496
- ? props.theme.colors.primary600
514
+ ? props.theme.colors.indigo600
497
515
  : props.theme.colors.neutral100}
498
516
  )
499
517
  drop-shadow(
500
518
  0px 1px 0px
501
519
  ${props =>
502
520
  props.isInverse
503
- ? props.theme.colors.primary600
521
+ ? props.theme.colors.indigo600
504
522
  : props.theme.colors.neutral100}
505
523
  )
506
524
  drop-shadow(
507
525
  0px -1px 0px
508
526
  ${props =>
509
527
  props.isInverse
510
- ? props.theme.colors.primary600
528
+ ? props.theme.colors.indigo600
511
529
  : props.theme.colors.neutral100}
512
530
  );
513
531
  }
@@ -564,7 +582,7 @@ const CarbonChartWrapper = styled.div<{
564
582
  .cds--btn--primary {
565
583
  background: ${props =>
566
584
  props.isInverse
567
- ? props.theme.colors.tertiary500
585
+ ? props.theme.colors.cyan500
568
586
  : props.theme.colors.primary};
569
587
  color: ${props => (props.isInverse ? props.theme.colors.neutral900 : '')};
570
588
  }
@@ -624,7 +642,7 @@ const CarbonChartWrapper = styled.div<{
624
642
  .cds--modal-header {
625
643
  background: ${props =>
626
644
  props.isInverse
627
- ? props.theme.colors.primary600
645
+ ? props.theme.colors.indigo600
628
646
  : props.theme.colors.neutral100};
629
647
  margin-bottom: 0;
630
648
  border-bottom: 1px solid
@@ -664,7 +682,7 @@ const CarbonChartWrapper = styled.div<{
664
682
  : props.theme.colors.neutral300};
665
683
  background: ${props =>
666
684
  props.isInverse
667
- ? props.theme.colors.primary600
685
+ ? props.theme.colors.indigo600
668
686
  : props.theme.colors.neutral100} !important;
669
687
  }
670
688
  .layout-child.header {
@@ -701,7 +719,10 @@ const CarbonChartWrapper = styled.div<{
701
719
 
702
720
  g.center text,
703
721
  .pie-label {
704
- fill: ${props => (props.isInverse ? props.theme.colors.neutral100 : '')};
722
+ fill: ${props =>
723
+ props.isInverse
724
+ ? props.theme.colors.neutral100
725
+ : props.theme.colors.brand.navy};
705
726
  }
706
727
 
707
728
  // Zoom responsive tweaks
@@ -765,22 +786,6 @@ const ToolbarWrapper = styled.div<{
765
786
  right: ${props.isFullscreen ? '2em' : '0'};
766
787
  top: ${props.isFullscreen ? '2em' : '0'};
767
788
  `}
768
-
769
- button {
770
- color: ${props =>
771
- props.isInverse
772
- ? props.theme.colors.neutral100
773
- : props.theme.colors.primary500};
774
-
775
- &:focus {
776
- outline: 2px solid
777
- ${props =>
778
- props.isInverse
779
- ? props.theme.colors.focusInverse
780
- : props.theme.colors.focus};
781
- outline-offset: 0;
782
- }
783
- }
784
789
  `;
785
790
 
786
791
  const ChartTitle = styled.h2<{
@@ -796,7 +801,7 @@ const ChartTitle = styled.h2<{
796
801
  color: ${props =>
797
802
  props.isInverse
798
803
  ? props.theme.colors.neutral100
799
- : props.theme.colors.neutral700} !important;
804
+ : props.theme.colors.brand.navy} !important;
800
805
  `;
801
806
 
802
807
  const TitleGroup = styled.div<{ theme: ThemeInterface }>`
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { ButtonVariant, IconButton, Tooltip } from 'react-magma-dom';
3
+ import {
4
+ ButtonColor,
5
+ ButtonVariant,
6
+ IconButton,
7
+ Tooltip,
8
+ } from 'react-magma-dom';
4
9
 
5
10
  import { useChartToolbarI18n } from './chartToolbarI18n';
6
11
 
@@ -48,6 +53,7 @@ export function ChartFullscreenButton({
48
53
  <Tooltip content={resolvedTooltip} isInverse={isInverse}>
49
54
  <IconButton
50
55
  aria-label={ariaLabel}
56
+ color={ButtonColor.subtle}
51
57
  icon={resolvedIcon}
52
58
  isInverse={isInverse}
53
59
  onClick={onClick}
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  import {
4
+ ButtonColor,
4
5
  ButtonVariant,
5
6
  Dropdown,
6
7
  DropdownButton,
@@ -39,6 +40,7 @@ export function ChartMoreOptionsButton({
39
40
  <Dropdown isInverse={isInverse}>
40
41
  <DropdownButton
41
42
  aria-label={resolvedAriaLabel}
43
+ color={ButtonColor.subtle}
42
44
  icon={icon}
43
45
  variant={ButtonVariant.link}
44
46
  testId="chart-more-options-button"
@@ -222,6 +222,7 @@ describe('ChartTableButton', () => {
222
222
  const button = screen.getByRole('button', { name: 'Overall Performance' });
223
223
 
224
224
  expect(button).toHaveAttribute('aria-haspopup', 'dialog');
225
+ expect(button).toHaveAttribute('color', 'subtle');
225
226
  });
226
227
 
227
228
  it('sets aria-expanded to false when modal is closed', () => {
@@ -312,6 +313,7 @@ describe('ChartFullscreenButton', () => {
312
313
  });
313
314
 
314
315
  expect(button).not.toHaveAttribute('aria-haspopup');
316
+ expect(button).toHaveAttribute('color', 'subtle');
315
317
  });
316
318
 
317
319
  it('calls onClick when activated', () => {
@@ -379,7 +381,7 @@ describe('ChartMoreOptionsButton', () => {
379
381
 
380
382
  expect(
381
383
  screen.getByRole('button', { name: 'More options' })
382
- ).toBeInTheDocument();
384
+ ).toHaveAttribute('color', 'subtle');
383
385
  });
384
386
 
385
387
  it('renders with custom aria-label', () => {
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { ButtonVariant, IconButton, Tooltip } from 'react-magma-dom';
3
+ import {
4
+ ButtonColor,
5
+ ButtonVariant,
6
+ IconButton,
7
+ Tooltip,
8
+ } from 'react-magma-dom';
4
9
 
5
10
  import { useChartToolbarI18n } from './chartToolbarI18n';
6
11
 
@@ -45,6 +50,7 @@ export function ChartTableButton({
45
50
  aria-expanded={isTableOpen}
46
51
  aria-haspopup="dialog"
47
52
  aria-label={ariaLabel}
53
+ color={ButtonColor.subtle}
48
54
  icon={icon}
49
55
  isInverse={isInverse}
50
56
  onClick={onClick}
@@ -60,7 +60,7 @@ const HeaderLabel = styled.span<{ isInverse?: boolean; theme: any }>`
60
60
  color: ${props =>
61
61
  props.isInverse
62
62
  ? props.theme.colors.neutral100
63
- : props.theme.colors.neutral500};
63
+ : props.theme.colors.brand.navy};
64
64
  line-height: ${props => props.theme.typeScale.size02.lineHeight};
65
65
  `;
66
66