carbon-react 104.52.2 → 104.53.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.
Files changed (29) hide show
  1. package/esm/__spec_helper__/test-utils.d.ts +1 -0
  2. package/esm/__spec_helper__/test-utils.js +19 -6
  3. package/esm/components/dialog/dialog.style.js +10 -7
  4. package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +1 -1
  5. package/esm/components/select/multi-select/multi-select.component.js +5 -6
  6. package/esm/style/themes/aegean/aegean-theme.config.d.ts +0 -8
  7. package/esm/style/themes/aegean/aegean-theme.config.js +0 -10
  8. package/esm/style/themes/base/base-theme.config.d.ts +19 -313
  9. package/esm/style/themes/base/base-theme.config.js +4 -330
  10. package/esm/style/themes/base/index.d.ts +2 -304
  11. package/esm/style/themes/mint/mint-theme.config.d.ts +0 -7
  12. package/esm/style/themes/mint/mint-theme.config.js +0 -7
  13. package/esm/style/themes/sage/index.d.ts +1 -242
  14. package/esm/style/themes/sage/index.js +1 -1
  15. package/lib/__spec_helper__/test-utils.d.ts +1 -0
  16. package/lib/__spec_helper__/test-utils.js +23 -6
  17. package/lib/components/dialog/dialog.style.js +10 -7
  18. package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +1 -1
  19. package/lib/components/select/multi-select/multi-select.component.js +5 -6
  20. package/lib/style/themes/aegean/aegean-theme.config.d.ts +0 -8
  21. package/lib/style/themes/aegean/aegean-theme.config.js +0 -13
  22. package/lib/style/themes/base/base-theme.config.d.ts +19 -313
  23. package/lib/style/themes/base/base-theme.config.js +7 -332
  24. package/lib/style/themes/base/index.d.ts +2 -304
  25. package/lib/style/themes/mint/mint-theme.config.d.ts +0 -7
  26. package/lib/style/themes/mint/mint-theme.config.js +0 -7
  27. package/lib/style/themes/sage/index.d.ts +1 -242
  28. package/lib/style/themes/sage/index.js +1 -1
  29. package/package.json +1 -1
@@ -2,18 +2,11 @@ export default (palette => {
2
2
  return {
3
3
  name: "mint",
4
4
  colors: {
5
- base: palette.productGreen,
6
5
  primary: palette.productGreenShade(23.5),
7
6
  secondary: palette.productGreenShade(41),
8
7
  tertiary: palette.productGreenShade(61),
9
- whiteMix: palette.productGreenTint(90),
10
- hoveredTabKeyline: palette.productGreenTint(30),
11
- disabled: palette.productGreenTint(40),
12
8
  loadingBarBackground: palette.productGreenTint(70)
13
9
  },
14
- stepSequence: {
15
- completedText: palette.productGreenShade(23)
16
- },
17
10
 
18
11
  get compatibility() {
19
12
  return {
@@ -374,251 +374,10 @@ declare var _default: {
374
374
  whiteOpacity: (opacity: number) => string;
375
375
  };
376
376
  spacing: number;
377
- space: number[];
377
+ space: string[];
378
378
  colors: import("../base").Colors;
379
- anchorNavigation: {
380
- divider: string;
381
- navItemHoverBackground: string;
382
- };
383
- accordion: {
384
- border: string;
385
- background: string;
386
- };
387
- tileSelect: {
388
- border: string;
389
- disabledBackground: string;
390
- hoverBackground: string;
391
- descriptionColor: string;
392
- disabledText: string;
393
- };
394
- batchSelection: {
395
- lightTheme: string;
396
- };
397
- hr: {
398
- background: string;
399
- };
400
- editor: {
401
- border: string;
402
- counter: string;
403
- placeholder: string;
404
- button: {
405
- hover: string;
406
- };
407
- toolbar: {
408
- background: string;
409
- };
410
- };
411
- menu: {
412
- focus: string;
413
- divider: string;
414
- itemColor: string;
415
- itemColorDisabled: string;
416
- light: {
417
- background: string;
418
- selected: string;
419
- divider: string;
420
- title: string;
421
- };
422
- dark: {
423
- divider: string;
424
- submenuBackground: string;
425
- selected: string;
426
- title: string;
427
- searchIcon: string;
428
- searchIconHover: string;
429
- };
430
- };
431
- form: {
432
- invalid: string;
433
- };
434
- card: {
435
- footerBackground: string;
436
- footerBorder: string;
437
- };
438
- carousel: {
439
- activeSelectorBackground: string;
440
- inactiveSelectorBackground: string;
441
- };
442
- flatTable: {
443
- light: {
444
- headerBackground: string;
445
- border: string;
446
- };
447
- dark: {
448
- headerBackground: string;
449
- border: string;
450
- };
451
- subRow: {
452
- background: string;
453
- shadow: string;
454
- };
455
- transparentWhite: {
456
- headerBackground: string;
457
- border: string;
458
- };
459
- transparentBase: {
460
- headerBackground: string;
461
- border: string;
462
- };
463
- drawerSidebar: {
464
- headerBackground: string;
465
- hover: string;
466
- highlighted: string;
467
- selected: string;
468
- };
469
- hover: string;
470
- headerIconColor: string;
471
- selected: string;
472
- highlighted: string;
473
- };
474
- help: {
475
- color: string;
476
- hover: string;
477
- };
478
- pod: {
479
- border: string;
480
- secondaryBackground: string;
481
- tertiaryBackground: string;
482
- tileBackground: string;
483
- footerBackground: string;
484
- hoverBackground: string;
485
- };
486
- text: {
487
- color: string;
488
- placeholder: string;
489
- size: string;
490
- };
491
- readOnly: {
492
- textboxBackground: string;
493
- textboxBorder: string;
494
- textboxText: string;
495
- };
496
- content: {
497
- secondaryColor: string;
498
- };
499
379
  disabled: {
500
- border: string;
501
- button: string;
502
- disabled: string;
503
- input: string;
504
- text: string;
505
- buttonText: string;
506
- background: string;
507
- switch: string;
508
- };
509
- draggableItem: {
510
- border: string;
511
- };
512
- checkable: {
513
- checked: string;
514
- };
515
- table: {
516
- primary: string;
517
- secondary: string;
518
- tertiary: string;
519
- header: string;
520
- hover: string;
521
- selected: string;
522
- zebra: string;
523
- dragging: string;
524
- };
525
- drawer: {
526
- background: string;
527
- divider: string;
528
- };
529
- pager: {
530
- active: string;
531
- disabled: string;
532
- alternate: string;
533
- };
534
- icon: {
535
- default: string;
536
- defaultHover: string;
537
- onLightBackground: string;
538
- onLightBackgroundHover: string;
539
- disabled: string;
540
- };
541
- popoverContainer: {
542
- iconColor: string;
543
- };
544
- navigationBar: {
545
- light: {
546
- background: string;
547
- borderBottom: string;
548
- };
549
- dark: {
550
- background: string;
551
- borderBottom: string;
552
- };
553
- black: {
554
- background: string;
555
- };
556
- white: {
557
- borderBottom: string;
558
- };
559
- };
560
- numeralDate: {
561
- passive: string;
562
- error: string;
563
- };
564
- portrait: {
565
- border: string;
566
380
  background: string;
567
- initials: string;
568
- };
569
- picklist: {
570
- locked: string;
571
- lockedContent: string;
572
- lockedText: string;
573
- };
574
- pill: {
575
- neutral: string;
576
- warning: string;
577
- neutralBackgroundFocus: string;
578
- warningButtonFocus: string;
579
- errorButtonFocus: string;
580
- };
581
- search: {
582
- active: string;
583
- button: string;
584
- passive: string;
585
- icon: string;
586
- iconHover: string;
587
- searchActive: string;
588
- darkVariantPlaceholder: string;
589
- darkVariantBorder: string;
590
- darkVariantText: string;
591
- iconDarkVariant: string;
592
- iconDarkVariantHover: string;
593
- };
594
- select: {
595
- border: string;
596
- selected: string;
597
- optionHeader: string;
598
- tableHeaderBorder: string;
599
- };
600
- shadows: {
601
- depth1: string;
602
- depth2: string;
603
- depth3: string;
604
- depth4: string;
605
- cards: string;
606
- cardsIE: string;
607
- };
608
- switch: {
609
- off: string;
610
- };
611
- tile: {
612
- border: string;
613
- footerBackground: string;
614
- separator: string;
615
- };
616
- tab: {
617
- background: string;
618
- altHover: string;
619
- };
620
- note: {
621
- timeStamp: string;
622
381
  };
623
382
  zIndex: {
624
383
  smallOverlay: number;
@@ -3,5 +3,5 @@ import mint from "../mint/index";
3
3
  export default { ...mint,
4
4
  compatibility: { ...tokens
5
5
  },
6
- name: "sage (experimental)"
6
+ name: "sage"
7
7
  };
@@ -1,3 +1,4 @@
1
+ export function getDefaultValue(value: any): any;
1
2
  export function assertStyleMatch(styleSpec: any, component: any, opts: any): void;
2
3
  export function toCSSCase(str: any): any;
3
4
  export function hoverList(wrapper: any): (item: any) => void;
@@ -9,12 +9,14 @@ Object.defineProperty(exports, "mockMatchMedia", {
9
9
  return _mockMatchMedia.mockMatchMedia;
10
10
  }
11
11
  });
12
- exports.expectError = exports.testStyledSystemBackground = exports.testStyledSystemFlexBox = exports.testStyledSystemLayout = exports.testStyledSystemWidth = exports.testStyledSystemColor = exports.testStyledSystemPadding = exports.testStyledSystemMargin = exports.testStyledSystemSpacing = exports.carbonThemesJestTable = exports.simulate = exports.click = exports.listFrom = exports.assertHoverTraversal = exports.assertKeyboardTraversal = exports.keyboard = exports.makeArrayKeys = exports.childrenFrom = exports.selectedItemOf = exports.hoverList = exports.toCSSCase = exports.assertStyleMatch = void 0;
12
+ exports.expectError = exports.testStyledSystemBackground = exports.testStyledSystemFlexBox = exports.testStyledSystemLayout = exports.testStyledSystemWidth = exports.testStyledSystemColor = exports.testStyledSystemPadding = exports.testStyledSystemMargin = exports.testStyledSystemSpacing = exports.carbonThemesJestTable = exports.simulate = exports.click = exports.listFrom = exports.assertHoverTraversal = exports.assertKeyboardTraversal = exports.keyboard = exports.makeArrayKeys = exports.childrenFrom = exports.selectedItemOf = exports.hoverList = exports.toCSSCase = exports.assertStyleMatch = exports.getDefaultValue = void 0;
13
13
 
14
14
  var _enzyme = require("enzyme");
15
15
 
16
16
  var _sprintfJs = require("sprintf-js");
17
17
 
18
+ var _baseTheme = require("style/themes/base/base-theme.config");
19
+
18
20
  var _themes = require("../style/themes");
19
21
 
20
22
  var _mockMatchMedia = require("./mock-match-media");
@@ -159,16 +161,30 @@ const flexBoxProps = [["alignItems", "alignItems", "center"], ["alignContent", "
159
161
  const backgroundProps = [["background", "background", "lightblue url('foo.jpg') no-repeat fixed center"], ["backgroundImage", "background-image", "url(foo.jpg)"], ["backgroundSize", "background-size", "center"], ["backgroundRepeat", "background-repeat", "no-repeat"]];
160
162
 
161
163
  const getDefaultValue = value => {
162
- if (typeof value === "number") {
164
+ const spaceArrayLength = _baseTheme.space.length - 1;
165
+ const parsedValue = +value;
166
+
167
+ if (typeof value === "string" && value > spaceArrayLength) {
168
+ return `${value}px`;
169
+ }
170
+
171
+ if (parsedValue <= spaceArrayLength) {
172
+ return _baseTheme.space[value];
173
+ }
174
+
175
+ if (parsedValue > spaceArrayLength) {
163
176
  return `${value * 8}px`;
164
177
  }
165
178
 
166
179
  return value;
167
180
  };
168
181
 
182
+ exports.getDefaultValue = getDefaultValue;
183
+
169
184
  const testStyledSystemMargin = (component, defaults, styleContainer, assertOpts) => {
170
185
  describe("default props", () => {
171
- const wrapper = (0, _enzyme.mount)(component());
186
+ const wrapper = (0, _enzyme.mount)(component({ ...defaults
187
+ }));
172
188
  const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
173
189
  it("should set the correct margins", () => {
174
190
  let margin;
@@ -208,7 +224,7 @@ const testStyledSystemMargin = (component, defaults, styleContainer, assertOpts)
208
224
  wrapper = (0, _enzyme.mount)(component({ ...props
209
225
  }));
210
226
  expect(assertStyleMatch({
211
- [propName]: "16px"
227
+ [propName]: "var(--spacing200)"
212
228
  }, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts));
213
229
  });
214
230
  });
@@ -218,7 +234,8 @@ exports.testStyledSystemMargin = testStyledSystemMargin;
218
234
 
219
235
  const testStyledSystemPadding = (component, defaults, styleContainer, assertOpts) => {
220
236
  describe("default props", () => {
221
- const wrapper = (0, _enzyme.mount)(component());
237
+ const wrapper = (0, _enzyme.mount)(component({ ...defaults
238
+ }));
222
239
  const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
223
240
  it("should set the correct paddings", () => {
224
241
  let padding;
@@ -258,7 +275,7 @@ const testStyledSystemPadding = (component, defaults, styleContainer, assertOpts
258
275
  wrapper = (0, _enzyme.mount)(component({ ...props
259
276
  }));
260
277
  expect(assertStyleMatch({
261
- [propName]: "16px"
278
+ [propName]: "var(--spacing200)"
262
279
  }, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts));
263
280
  });
264
281
  });
@@ -43,7 +43,7 @@ const calculateWidthValue = props => {
43
43
  padding
44
44
  } = (0, _styledSystem.padding)(props);
45
45
  const paddingValue = paddingLeft ?? paddingRight ?? padding;
46
- return paddingValue === undefined ? _dialog.HORIZONTAL_PADDING * 2 : paddingValue * 2;
46
+ return paddingValue === undefined ? _dialog.HORIZONTAL_PADDING : paddingValue;
47
47
  };
48
48
 
49
49
  const calculateFormSpacingValues = (props, isFormContent) => {
@@ -58,19 +58,22 @@ const calculateFormSpacingValues = (props, isFormContent) => {
58
58
  const spacingRightValue = paddingRight ?? padding ?? _dialog.HORIZONTAL_PADDING;
59
59
  const spacingBottomValue = paddingBottom ?? padding ?? _dialog.CONTENT_BOTTOM_PADDING;
60
60
  const spacingLeftValue = paddingLeft ?? padding ?? _dialog.HORIZONTAL_PADDING;
61
+
62
+ const setNegativeValue = value => `calc(-1px * ${value})`;
63
+
61
64
  return {
62
- "margin-left": spacingLeftValue ? `-${spacingLeftValue}px` : spacingLeftValue,
63
- "margin-right": spacingRightValue ? `-${spacingRightValue}px` : spacingRightValue,
65
+ "margin-left": setNegativeValue(spacingLeftValue),
66
+ "margin-right": setNegativeValue(spacingRightValue),
64
67
  ...(isFormContent && {
65
- "margin-top": spacingTopValue ? `-${spacingTopValue}px` : spacingTopValue,
68
+ "margin-top": setNegativeValue(spacingTopValue),
66
69
  "padding-top": spacingTopValue,
67
70
  "padding-bottom": spacingBottomValue,
68
71
  "padding-left": spacingLeftValue,
69
72
  "padding-right": spacingRightValue
70
73
  }),
71
74
  ...(!isFormContent && {
72
- "margin-bottom": spacingBottomValue ? `-${spacingBottomValue}px` : spacingBottomValue,
73
- bottom: spacingBottomValue ? `-${spacingBottomValue}px` : spacingBottomValue
75
+ "margin-bottom": setNegativeValue(spacingBottomValue),
76
+ bottom: setNegativeValue(spacingBottomValue)
74
77
  })
75
78
  };
76
79
  };
@@ -126,7 +129,7 @@ const DialogStyle = _styledComponents.default.div`
126
129
  }
127
130
 
128
131
  ${_form.StyledFormFooter}.sticky {
129
- width: calc(100% + ${calculateWidthValue}px);
132
+ width: calc(100% + (2px * ${calculateWidthValue}));
130
133
  ${props => calculateFormSpacingValues(props, false)}
131
134
  }
132
135
 
@@ -110,7 +110,7 @@ const StyledFlatTableRow = _styledComponents.default.tr`
110
110
  width: auto;
111
111
  outline: 2px solid #0000;
112
112
 
113
- [data-component="icon"] {
113
+ [data-component="icon"]:not([color]) {
114
114
  color: var(--colorsActionMinor500);
115
115
  }
116
116
 
@@ -133,7 +133,7 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
133
133
  const newValue = [...previousValue];
134
134
  newValue.splice(index, 1);
135
135
 
136
- if (isControlled.current && onChange) {
136
+ if (onChange) {
137
137
  onChange(createCustomEvent(newValue));
138
138
  return newValue;
139
139
  }
@@ -255,11 +255,6 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
255
255
  onFilterChange(filterText);
256
256
  }
257
257
  }, [filterText, onFilterChange]);
258
- (0, _react.useEffect)(() => {
259
- if (!isControlled.current && onChange) {
260
- onChange(createCustomEvent(selectedValue));
261
- }
262
- }, [createCustomEvent, onChange, selectedValue]);
263
258
 
264
259
  function handleTextboxClick(event) {
265
260
  isMouseDownReported.current = false;
@@ -378,6 +373,10 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
378
373
  return previousValue;
379
374
  }
380
375
 
376
+ if (onChange) {
377
+ onChange(createCustomEvent([...previousValue, newValue]));
378
+ }
379
+
381
380
  return [...previousValue, newValue];
382
381
  });
383
382
  }, [createCustomEvent, onChange, textboxRef, selectedValue]);
@@ -1,19 +1,11 @@
1
1
  declare function _default(palette: any): {
2
2
  name: string;
3
3
  colors: {
4
- base: any;
5
4
  primary: any;
6
5
  secondary: any;
7
6
  tertiary: any;
8
- whiteMix: any;
9
- withOpacity: string;
10
- hoveredTabKeyline: any;
11
- disabled: any;
12
7
  loadingBarBackground: any;
13
8
  };
14
- stepSequence: {
15
- completedText: any;
16
- };
17
9
  readonly compatibility: {
18
10
  colorsActionMajor500: any;
19
11
  colorsActionMajor600: any;
@@ -5,28 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _atOpacity = _interopRequireDefault(require("../../utils/at-opacity"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
8
  var _default = palette => {
13
- const baseWithOpacity = (0, _atOpacity.default)(palette.productBlue);
14
9
  return {
15
10
  name: "aegean",
16
11
  colors: {
17
- base: palette.productBlue,
18
12
  primary: palette.productBlueShade(3),
19
13
  secondary: palette.productBlueShade(23),
20
14
  tertiary: palette.productBlueShade(43),
21
- whiteMix: palette.productBlueTint(90),
22
- withOpacity: baseWithOpacity(0.55),
23
- hoveredTabKeyline: palette.productBlueTint(30),
24
- disabled: palette.productBlueTint(40),
25
15
  loadingBarBackground: palette.productBlueTint(70)
26
16
  },
27
- stepSequence: {
28
- completedText: palette.productBlueShade(23)
29
- },
30
17
 
31
18
  get compatibility() {
32
19
  return {