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
@@ -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;
@@ -1,5 +1,6 @@
1
1
  import { mount } from "enzyme";
2
2
  import { sprintf } from "sprintf-js";
3
+ import { space } from "style/themes/base/base-theme.config";
3
4
  import { carbonThemeList } from "../style/themes";
4
5
  import { mockMatchMedia } from "./mock-match-media";
5
6
 
@@ -119,9 +120,19 @@ const widthProps = ["width", "width", "200px"];
119
120
  const layoutProps = [widthProps, ["height", "height", "200px"], ["minWidth", "min-width", "120px"], ["maxWidth", "max-width", "120px"], ["minHeight", "min-height", "120px"], ["maxHeight", "max-height", "120px"], ["size", "width", "120px"], ["size", "height", "120px"], ["display", "display", "inline-block"], ["verticalAlign", "vertical-align", "baseline"], ["overflow", "overflow", "hidden"], ["overflowX", "overflow-x", "hidden"], ["overflowY", "overflow-y", "hidden"]];
120
121
  const flexBoxProps = [["alignItems", "alignItems", "center"], ["alignContent", "alignContent", "center"], ["justifyItems", "justifyItems", "center"], ["justifyContent", "justifyContent", "center"], ["flexWrap", "flexWrap", "wrap"], ["flexDirection", "flexDirection", "row-reverse"], ["flex", "flex", "1"], ["flexGrow", "flexGrow", "1"], ["flexShrink", "flexShrink", "1"], ["flexBasis", "flexBasis", "100px"], ["justifySelf", "justifySelf", "center"], ["alignSelf", "alignSelf", "center"], ["order", "order", "1"]];
121
122
  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"]];
123
+ export const getDefaultValue = value => {
124
+ const spaceArrayLength = space.length - 1;
125
+ const parsedValue = +value;
122
126
 
123
- const getDefaultValue = value => {
124
- if (typeof value === "number") {
127
+ if (typeof value === "string" && value > spaceArrayLength) {
128
+ return `${value}px`;
129
+ }
130
+
131
+ if (parsedValue <= spaceArrayLength) {
132
+ return space[value];
133
+ }
134
+
135
+ if (parsedValue > spaceArrayLength) {
125
136
  return `${value * 8}px`;
126
137
  }
127
138
 
@@ -130,7 +141,8 @@ const getDefaultValue = value => {
130
141
 
131
142
  const testStyledSystemMargin = (component, defaults, styleContainer, assertOpts) => {
132
143
  describe("default props", () => {
133
- const wrapper = mount(component());
144
+ const wrapper = mount(component({ ...defaults
145
+ }));
134
146
  const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
135
147
  it("should set the correct margins", () => {
136
148
  let margin;
@@ -170,7 +182,7 @@ const testStyledSystemMargin = (component, defaults, styleContainer, assertOpts)
170
182
  wrapper = mount(component({ ...props
171
183
  }));
172
184
  expect(assertStyleMatch({
173
- [propName]: "16px"
185
+ [propName]: "var(--spacing200)"
174
186
  }, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts));
175
187
  });
176
188
  });
@@ -178,7 +190,8 @@ const testStyledSystemMargin = (component, defaults, styleContainer, assertOpts)
178
190
 
179
191
  const testStyledSystemPadding = (component, defaults, styleContainer, assertOpts) => {
180
192
  describe("default props", () => {
181
- const wrapper = mount(component());
193
+ const wrapper = mount(component({ ...defaults
194
+ }));
182
195
  const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
183
196
  it("should set the correct paddings", () => {
184
197
  let padding;
@@ -218,7 +231,7 @@ const testStyledSystemPadding = (component, defaults, styleContainer, assertOpts
218
231
  wrapper = mount(component({ ...props
219
232
  }));
220
233
  expect(assertStyleMatch({
221
- [propName]: "16px"
234
+ [propName]: "var(--spacing200)"
222
235
  }, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts));
223
236
  });
224
237
  });
@@ -23,7 +23,7 @@ const calculateWidthValue = props => {
23
23
  padding
24
24
  } = paddingFn(props);
25
25
  const paddingValue = paddingLeft ?? paddingRight ?? padding;
26
- return paddingValue === undefined ? HORIZONTAL_PADDING * 2 : paddingValue * 2;
26
+ return paddingValue === undefined ? HORIZONTAL_PADDING : paddingValue;
27
27
  };
28
28
 
29
29
  const calculateFormSpacingValues = (props, isFormContent) => {
@@ -38,19 +38,22 @@ const calculateFormSpacingValues = (props, isFormContent) => {
38
38
  const spacingRightValue = paddingRight ?? padding ?? HORIZONTAL_PADDING;
39
39
  const spacingBottomValue = paddingBottom ?? padding ?? CONTENT_BOTTOM_PADDING;
40
40
  const spacingLeftValue = paddingLeft ?? padding ?? HORIZONTAL_PADDING;
41
+
42
+ const setNegativeValue = value => `calc(-1px * ${value})`;
43
+
41
44
  return {
42
- "margin-left": spacingLeftValue ? `-${spacingLeftValue}px` : spacingLeftValue,
43
- "margin-right": spacingRightValue ? `-${spacingRightValue}px` : spacingRightValue,
45
+ "margin-left": setNegativeValue(spacingLeftValue),
46
+ "margin-right": setNegativeValue(spacingRightValue),
44
47
  ...(isFormContent && {
45
- "margin-top": spacingTopValue ? `-${spacingTopValue}px` : spacingTopValue,
48
+ "margin-top": setNegativeValue(spacingTopValue),
46
49
  "padding-top": spacingTopValue,
47
50
  "padding-bottom": spacingBottomValue,
48
51
  "padding-left": spacingLeftValue,
49
52
  "padding-right": spacingRightValue
50
53
  }),
51
54
  ...(!isFormContent && {
52
- "margin-bottom": spacingBottomValue ? `-${spacingBottomValue}px` : spacingBottomValue,
53
- bottom: spacingBottomValue ? `-${spacingBottomValue}px` : spacingBottomValue
55
+ "margin-bottom": setNegativeValue(spacingBottomValue),
56
+ bottom: setNegativeValue(spacingBottomValue)
54
57
  })
55
58
  };
56
59
  };
@@ -106,7 +109,7 @@ const DialogStyle = styled.div`
106
109
  }
107
110
 
108
111
  ${StyledFormFooter}.sticky {
109
- width: calc(100% + ${calculateWidthValue}px);
112
+ width: calc(100% + (2px * ${calculateWidthValue}));
110
113
  ${props => calculateFormSpacingValues(props, false)}
111
114
  }
112
115
 
@@ -89,7 +89,7 @@ const StyledFlatTableRow = styled.tr`
89
89
  width: auto;
90
90
  outline: 2px solid #0000;
91
91
 
92
- [data-component="icon"] {
92
+ [data-component="icon"]:not([color]) {
93
93
  color: var(--colorsActionMinor500);
94
94
  }
95
95
 
@@ -107,7 +107,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
107
107
  const newValue = [...previousValue];
108
108
  newValue.splice(index, 1);
109
109
 
110
- if (isControlled.current && onChange) {
110
+ if (onChange) {
111
111
  onChange(createCustomEvent(newValue));
112
112
  return newValue;
113
113
  }
@@ -228,11 +228,6 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
228
228
  onFilterChange(filterText);
229
229
  }
230
230
  }, [filterText, onFilterChange]);
231
- useEffect(() => {
232
- if (!isControlled.current && onChange) {
233
- onChange(createCustomEvent(selectedValue));
234
- }
235
- }, [createCustomEvent, onChange, selectedValue]);
236
231
 
237
232
  function handleTextboxClick(event) {
238
233
  isMouseDownReported.current = false;
@@ -351,6 +346,10 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
351
346
  return previousValue;
352
347
  }
353
348
 
349
+ if (onChange) {
350
+ onChange(createCustomEvent([...previousValue, newValue]));
351
+ }
352
+
354
353
  return [...previousValue, newValue];
355
354
  });
356
355
  }, [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;
@@ -1,22 +1,12 @@
1
- import atOpacity from "../../utils/at-opacity";
2
1
  export default (palette => {
3
- const baseWithOpacity = atOpacity(palette.productBlue);
4
2
  return {
5
3
  name: "aegean",
6
4
  colors: {
7
- base: palette.productBlue,
8
5
  primary: palette.productBlueShade(3),
9
6
  secondary: palette.productBlueShade(23),
10
7
  tertiary: palette.productBlueShade(43),
11
- whiteMix: palette.productBlueTint(90),
12
- withOpacity: baseWithOpacity(0.55),
13
- hoveredTabKeyline: palette.productBlueTint(30),
14
- disabled: palette.productBlueTint(40),
15
8
  loadingBarBackground: palette.productBlueTint(70)
16
9
  },
17
- stepSequence: {
18
- completedText: palette.productBlueShade(23)
19
- },
20
10
 
21
11
  get compatibility() {
22
12
  return {
@@ -1,319 +1,25 @@
1
+ export const space: string[];
1
2
  declare function _default(palette: any): {
2
3
  name: string;
3
4
  palette: any;
4
5
  spacing: number;
5
- space: number[];
6
+ space: string[];
6
7
  colors: {
7
- base: any;
8
8
  primary: any;
9
9
  secondary: any;
10
10
  tertiary: any;
11
- brand: any;
12
- disabled: any;
13
- whiteMix: any;
14
- withOpacity: string;
15
11
  loadingBarBackground: any;
16
- black: string;
17
- slate: string;
18
12
  white: string;
19
- border: any;
20
- dashedBorder: string;
21
- dashedButtonText: string;
22
- dashedHoverBackground: string;
23
- focusedIcon: any;
24
- focusedLinkBackground: any;
25
- previewBackground: any;
26
- hoveredTabKeyline: any;
27
13
  error: any;
28
14
  focus: any;
29
15
  info: any;
30
- success: any;
31
16
  warning: any;
32
17
  destructive: {
33
18
  hover: any;
34
19
  };
35
- asterisk: any;
36
- };
37
- progressTracker: {
38
- background: any;
39
- innerBackground: any;
40
- trafficNeutral: any;
41
- };
42
- anchorNavigation: {
43
- divider: any;
44
- navItemHoverBackground: any;
45
- };
46
- accordion: {
47
- border: any;
48
- background: any;
49
- };
50
- tileSelect: {
51
- border: any;
52
- disabledBackground: any;
53
- hoverBackground: any;
54
- descriptionColor: any;
55
- disabledText: any;
56
- };
57
- batchSelection: {
58
- lightTheme: any;
59
- };
60
- hr: {
61
- background: any;
62
- };
63
- editor: {
64
- border: any;
65
- counter: string;
66
- placeholder: string;
67
- button: {
68
- hover: any;
69
- };
70
- toolbar: {
71
- background: any;
72
- };
73
- };
74
- menu: {
75
- focus: any;
76
- divider: any;
77
- itemColor: any;
78
- itemColorDisabled: any;
79
- light: {
80
- text: string;
81
- background: any;
82
- selected: any;
83
- divider: any;
84
- alternate: any;
85
- title: any;
86
- submenuBackground: string;
87
- searchIcon: any;
88
- searchIconHover: any;
89
- };
90
- dark: {
91
- text: string;
92
- background: any;
93
- divider: any;
94
- submenuBackground: any;
95
- selected: any;
96
- alternate: any;
97
- title: any;
98
- searchIcon: any;
99
- searchIconHover: any;
100
- };
101
- black: {
102
- text: string;
103
- background: any;
104
- submenuBackground: any;
105
- selected: any;
106
- divider: any;
107
- alternate: any;
108
- title: any;
109
- searchIcon: any;
110
- searchIconHover: any;
111
- };
112
- white: {
113
- text: string;
114
- background: string;
115
- selected: any;
116
- divider: any;
117
- alternate: any;
118
- submenuBackground: any;
119
- title: any;
120
- searchIcon: any;
121
- searchIconHover: any;
122
- };
123
- };
124
- card: {
125
- footerBackground: any;
126
- footerBorder: any;
127
- };
128
- carousel: {
129
- activeSelectorBackground: any;
130
- inactiveSelectorBackground: any;
131
- };
132
- flatTable: {
133
- light: {
134
- headerBackground: any;
135
- border: any;
136
- };
137
- dark: {
138
- headerBackground: any;
139
- border: any;
140
- };
141
- subRow: {
142
- background: any;
143
- shadow: string;
144
- };
145
- transparentWhite: {
146
- headerBackground: string;
147
- border: string;
148
- };
149
- transparentBase: {
150
- headerBackground: any;
151
- border: any;
152
- };
153
- drawerSidebar: {
154
- headerBackground: any;
155
- hover: any;
156
- highlighted: any;
157
- selected: any;
158
- };
159
- hover: any;
160
- headerIconColor: any;
161
- headerAlternativeBackground: any;
162
- selected: any;
163
- highlighted: any;
164
- };
165
- help: {
166
- color: any;
167
- hover: any;
168
- };
169
- text: {
170
- color: any;
171
- placeholder: any;
172
- size: string;
173
- };
174
- readOnly: {
175
- textboxBackground: any;
176
- textboxBorder: any;
177
- textboxText: any;
178
- };
179
- content: {
180
- secondaryColor: any;
181
20
  };
182
21
  disabled: {
183
- border: any;
184
- button: any;
185
- disabled: any;
186
- input: any;
187
- text: any;
188
- buttonText: string;
189
22
  background: any;
190
- switch: any;
191
- };
192
- draggableItem: {
193
- border: any;
194
- };
195
- checkable: {
196
- checked: string;
197
- };
198
- table: {
199
- primary: any;
200
- secondary: any;
201
- tertiary: any;
202
- header: any;
203
- hover: any;
204
- selected: any;
205
- zebra: any;
206
- dragging: any;
207
- };
208
- drawer: {
209
- background: any;
210
- divider: any;
211
- };
212
- pager: {
213
- active: string;
214
- disabled: string;
215
- alternate: any;
216
- };
217
- icon: {
218
- default: string;
219
- defaultHover: string;
220
- onLightBackground: any;
221
- onLightBackgroundHover: any;
222
- disabled: string;
223
- };
224
- popoverContainer: {
225
- iconColor: string;
226
- };
227
- navigationBar: {
228
- light: {
229
- background: any;
230
- borderBottom: any;
231
- };
232
- dark: {
233
- background: string;
234
- borderBottom: string;
235
- };
236
- black: {
237
- background: any;
238
- };
239
- white: {
240
- borderBottom: any;
241
- };
242
- };
243
- numeralDate: {
244
- passive: string;
245
- error: string;
246
- };
247
- portrait: {
248
- border: any;
249
- background: any;
250
- initials: string;
251
- };
252
- picklist: {
253
- locked: any;
254
- lockedContent: any;
255
- lockedText: any;
256
- };
257
- pill: {
258
- neutral: any;
259
- warning: any;
260
- neutralBackgroundFocus: any;
261
- warningButtonFocus: any;
262
- errorButtonFocus: any;
263
- };
264
- search: {
265
- active: any;
266
- button: string;
267
- passive: any;
268
- icon: any;
269
- iconHover: any;
270
- searchActive: string;
271
- darkVariantPlaceholder: any;
272
- darkVariantBorder: any;
273
- darkVariantText: string;
274
- iconDarkVariant: any;
275
- iconDarkVariantHover: any;
276
- };
277
- select: {
278
- border: string;
279
- selected: any;
280
- optionHeader: any;
281
- tableHeaderBorder: any;
282
- };
283
- shadows: {
284
- depth1: string;
285
- depth2: string;
286
- depth3: string;
287
- depth4: string;
288
- cards: string;
289
- cardsIE: string;
290
- };
291
- stepSequence: {
292
- completedText: any;
293
- };
294
- switch: {
295
- off: any;
296
- offDisabled: any;
297
- offHover: any;
298
- on: any;
299
- onDisabled: any;
300
- onHover: any;
301
- disabledFontColor: string;
302
- };
303
- tile: {
304
- border: any;
305
- footerBackground: any;
306
- separator: any;
307
- };
308
- tab: {
309
- background: any;
310
- altHover: any;
311
- };
312
- editorLinkPreview: {
313
- background: any;
314
- hoverBackground: any;
315
- border: any;
316
- url: any;
317
23
  };
318
24
  zIndex: {
319
25
  smallOverlay: number;
@@ -336,23 +42,6 @@ declare function _default(palette: any): {
336
42
  colorsSemanticNegative600: any;
337
43
  colorsSemanticCaution500: any;
338
44
  colorsSemanticInfo500: any;
339
- spacing000: string;
340
- spacing025: string;
341
- spacing050: string;
342
- spacing075: string;
343
- spacing100: string;
344
- spacing125: string;
345
- spacing150: string;
346
- spacing200: string;
347
- spacing250: string;
348
- spacing300: string;
349
- spacing400: string;
350
- spacing500: string;
351
- spacing600: string;
352
- spacing700: string;
353
- spacing800: string;
354
- spacing900: string;
355
- fontSizes100: string;
356
45
  metaName: string;
357
46
  metaPublic: string;
358
47
  colorsLogo: string;
@@ -546,12 +235,29 @@ declare function _default(palette: any): {
546
235
  sizing075: string;
547
236
  sizingLogowidth: string;
548
237
  sizing010: string;
238
+ spacing100: string;
239
+ spacing125: string;
240
+ spacing150: string;
241
+ spacing200: string;
242
+ spacing250: string;
243
+ spacing300: string;
244
+ spacing400: string;
245
+ spacing500: string;
246
+ spacing600: string;
247
+ spacing700: string;
248
+ spacing800: string;
249
+ spacing900: string;
549
250
  spacing1000: string;
251
+ spacing000: string;
252
+ spacing025: string;
253
+ spacing050: string;
254
+ spacing075: string;
550
255
  borderWidth100: string;
551
256
  borderWidth200: string;
552
257
  borderWidth300: string;
553
258
  borderWidth400: string;
554
259
  borderWidth000: string;
260
+ fontSizes100: string;
555
261
  fontSizes200: string;
556
262
  fontSizes300: string;
557
263
  fontSizes400: string;