carbon-react 111.4.0 → 111.4.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 (49) hide show
  1. package/esm/__internal__/radio-button-mapper/radio-button-mapper.component.js +1 -0
  2. package/esm/__internal__/radio-button-mapper/radio-button-mapper.d.ts +0 -1
  3. package/esm/components/date/__internal__/date-formats/index.d.ts +3 -1
  4. package/esm/components/date/date.d.ts +1 -2
  5. package/esm/components/decimal/decimal.component.d.ts +44 -0
  6. package/esm/components/decimal/decimal.component.js +535 -93
  7. package/esm/components/decimal/index.d.ts +2 -1
  8. package/esm/components/heading/heading.style.d.ts +9 -2
  9. package/esm/components/menu/menu.d.ts +4 -1
  10. package/esm/components/multi-action-button/multi-action-button.style.js +2 -1
  11. package/esm/components/search/search.d.ts +1 -0
  12. package/esm/components/select/filterable-select/filterable-select.d.ts +2 -2
  13. package/esm/components/select/multi-select/multi-select.d.ts +2 -2
  14. package/esm/components/select/select-textbox/select-textbox.d.ts +1 -1
  15. package/esm/components/select/simple-select/simple-select.d.ts +1 -1
  16. package/esm/components/tabs/tabs.d.ts +1 -1
  17. package/esm/components/typography/index.d.ts +4 -2
  18. package/esm/components/typography/list.component.d.ts +11 -0
  19. package/esm/components/typography/list.component.js +915 -4
  20. package/esm/components/typography/typography.component.d.ts +42 -0
  21. package/esm/components/typography/typography.component.js +13 -50
  22. package/lib/__internal__/radio-button-mapper/radio-button-mapper.component.js +1 -0
  23. package/lib/__internal__/radio-button-mapper/radio-button-mapper.d.ts +0 -1
  24. package/lib/components/date/__internal__/date-formats/index.d.ts +3 -1
  25. package/lib/components/date/date.d.ts +1 -2
  26. package/lib/components/decimal/decimal.component.d.ts +44 -0
  27. package/lib/components/decimal/decimal.component.js +536 -97
  28. package/lib/components/decimal/index.d.ts +2 -1
  29. package/lib/components/heading/heading.style.d.ts +9 -2
  30. package/lib/components/menu/menu.d.ts +4 -1
  31. package/lib/components/multi-action-button/multi-action-button.style.js +2 -1
  32. package/lib/components/search/search.d.ts +1 -0
  33. package/lib/components/select/filterable-select/filterable-select.d.ts +2 -2
  34. package/lib/components/select/multi-select/multi-select.d.ts +2 -2
  35. package/lib/components/select/select-textbox/select-textbox.d.ts +1 -1
  36. package/lib/components/select/simple-select/simple-select.d.ts +1 -1
  37. package/lib/components/tabs/tabs.d.ts +1 -1
  38. package/lib/components/typography/index.d.ts +4 -2
  39. package/lib/components/typography/list.component.d.ts +11 -0
  40. package/lib/components/typography/list.component.js +914 -3
  41. package/lib/components/typography/typography.component.d.ts +42 -0
  42. package/lib/components/typography/typography.component.js +14 -52
  43. package/package.json +2 -1
  44. package/esm/components/decimal/decimal.d.ts +0 -37
  45. package/esm/components/typography/list.d.ts +0 -11
  46. package/esm/components/typography/typography.d.ts +0 -60
  47. package/lib/components/decimal/decimal.d.ts +0 -37
  48. package/lib/components/typography/list.d.ts +0 -11
  49. package/lib/components/typography/typography.d.ts +0 -60
@@ -0,0 +1,42 @@
1
+ /// <reference types="react" />
2
+ import { ColorProps, SpaceProps } from "styled-system";
3
+ declare const VARIANT_TYPES: readonly ["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "small", "big", "sup", "sub", "strong", "b", "em", "ul", "ol"];
4
+ declare type VariantTypes = typeof VARIANT_TYPES[number];
5
+ export interface TypographyProps extends SpaceProps, ColorProps {
6
+ /** Override the variant component */
7
+ as?: React.ElementType;
8
+ /** The visual style to apply to the component */
9
+ variant?: VariantTypes;
10
+ /** Override the variant font-size */
11
+ fontSize?: string;
12
+ /** Override the variant font-weight */
13
+ fontWeight?: string;
14
+ /** Override the variant line-height */
15
+ lineHeight?: string;
16
+ /** Override the variant text-transform */
17
+ textTransform?: string;
18
+ /** Override the variant text-decoration */
19
+ textDecoration?: string;
20
+ /** Override the variant display */
21
+ display?: string;
22
+ /** Override the list-style-type */
23
+ listStyleType?: string;
24
+ /** Override the white-space type */
25
+ whiteSpace?: string;
26
+ /** Override the word-wrap type */
27
+ wordWrap?: string;
28
+ /** Override the text-overflow type */
29
+ textOverflow?: string;
30
+ /** Apply truncation */
31
+ truncate?: boolean;
32
+ }
33
+ declare const Typography: import("styled-components").StyledComponent<"span", any, {
34
+ as: import("react").ElementType<any> | undefined;
35
+ size: string;
36
+ weight: string;
37
+ textTransform: string;
38
+ textDecoration: string;
39
+ lineHeight: string;
40
+ defaultMargin: string;
41
+ } & TypographyProps, "as" | "textDecoration" | "size" | "lineHeight" | "textTransform" | "weight" | "defaultMargin">;
42
+ export default Typography;
@@ -5,23 +5,21 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
-
10
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
11
9
 
12
10
  var _styledSystem = require("styled-system");
13
11
 
14
- var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
15
-
16
12
  var _color = _interopRequireDefault(require("../../style/utils/color"));
17
13
 
18
14
  var _base = _interopRequireDefault(require("../../style/themes/base"));
19
15
 
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
20
18
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
21
19
 
22
20
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
21
 
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+ const VARIANT_TYPES = ["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "small", "big", "sup", "sub", "strong", "b", "em", "ul", "ol"];
25
23
 
26
24
  const getAs = variant => {
27
25
  switch (variant) {
@@ -219,59 +217,23 @@ const Typography = _styledComponents.default.span.attrs(({
219
217
  ${listStyleType && `list-style-type: ${listStyleType};`}; ;
220
218
  `}
221
219
  ${_styledSystem.space}
222
- ${_color.default}
220
+ ${({
221
+ color,
222
+ bg,
223
+ backgroundColor,
224
+ ...rest
225
+ }) => (0, _color.default)({
226
+ color,
227
+ bg,
228
+ backgroundColor,
229
+ ...rest
230
+ })}
223
231
  `;
224
232
  Typography.defaultProps = {
225
233
  color: "blackOpacity90",
226
234
  variant: "p",
227
235
  theme: _base.default
228
236
  };
229
- Typography.propTypes = {
230
- /** Styled system spacing props */
231
- ..._propTypes2.default.space,
232
-
233
- /** Styled system color props */
234
- ..._propTypes2.default.color,
235
-
236
- /** The visual style to apply to the component */
237
- variant: _propTypes.default.oneOf(["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "small", "big", "sup", "sub", "strong", "b", "em"]),
238
-
239
- /** Override the variant component */
240
- as: _propTypes.default.string,
241
-
242
- /** Override the variant font-size */
243
- fontSize: _propTypes.default.string,
244
-
245
- /** Override the variant font-weight */
246
- fontWeight: _propTypes.default.string,
247
-
248
- /** Override the variant line-height */
249
- lineHeight: _propTypes.default.string,
250
-
251
- /** Override the variant text-transform */
252
- textTransform: _propTypes.default.string,
253
-
254
- /** Override the variant text-decoration */
255
- textDecoration: _propTypes.default.string,
256
-
257
- /** Override the variant display */
258
- display: _propTypes.default.string,
259
-
260
- /** Override the list-style-type */
261
- listStyleType: _propTypes.default.string,
262
-
263
- /** Override the white-space type */
264
- whiteSpace: _propTypes.default.string,
265
-
266
- /** Override the word-wrap type */
267
- wordWrap: _propTypes.default.string,
268
-
269
- /** Override the text-overflow type */
270
- textOverflow: _propTypes.default.string,
271
-
272
- /** Apply truncation */
273
- truncate: _propTypes.default.bool
274
- };
275
237
  Typography.displayName = "Typography";
276
238
  var _default = Typography;
277
239
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "111.4.0",
3
+ "version": "111.4.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -84,6 +84,7 @@
84
84
  "@testing-library/jest-dom": "^5.16.2",
85
85
  "@testing-library/react": "^12.1.3",
86
86
  "@types/crypto-js": "^4.1.1",
87
+ "@types/draft-js": "^0.11.7",
87
88
  "@types/enzyme": "^3.10.3",
88
89
  "@types/invariant": "^2.2.35",
89
90
  "@types/jest": "^26.0.19",
@@ -1,37 +0,0 @@
1
- import * as React from "react";
2
- import { CommonTextboxProps } from "../textbox";
3
-
4
- export interface DecimalProps extends CommonTextboxProps {
5
- /** Text alignment of the label */
6
- align?: "left" | "right";
7
- /** Allow an empty value instead of defaulting to 0.00 */
8
- allowEmptyValue?: boolean;
9
- /** The default value of the input if it's meant to be used as an uncontrolled component */
10
- defaultValue?: string;
11
- /** The input id */
12
- id?: string;
13
- /** The width of the input as a percentage */
14
- inputWidth?: number;
15
- /** Handler for change event if input is meant to be used as a controlled component */
16
- onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
17
- /** Handler for blur event */
18
- onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
19
- /** Handler for key press event */
20
- onKeyPress?: (ev: React.KeyboardEvent<HTMLInputElement>) => void;
21
- /** The input name */
22
- name?: string;
23
- /** The decimal precision of the value in the input */
24
- precision?: number;
25
- /** If true, the component will be read-only */
26
- readOnly?: boolean;
27
- /** Flag to configure component as mandatory */
28
- required?: boolean;
29
- /** The value of the input if it's used as a controlled component */
30
- value?: string;
31
- /** The locale string - default en */
32
- locale?: string;
33
- }
34
-
35
- declare class Decimal extends React.Component<DecimalProps> {}
36
-
37
- export default Decimal;
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
- import { TypographyProps } from "./typography";
3
-
4
- declare function List(
5
- props: TypographyProps & React.HTMLProps<HTMLElement>
6
- ): JSX.Element;
7
- declare function ListItem(
8
- props: TypographyProps & React.HTMLProps<HTMLElement>
9
- ): JSX.Element;
10
-
11
- export { List, ListItem };
@@ -1,60 +0,0 @@
1
- import { StyledComponentProps } from "styled-components";
2
- import { ColorProps, SpaceProps } from "styled-system";
3
-
4
- export interface TypographyProps extends SpaceProps, ColorProps {
5
- /** Override the variant component */
6
- as?: string;
7
- /** The visual style to apply to the component */
8
- variant?:
9
- | "h1-large"
10
- | "h1"
11
- | "h2"
12
- | "h3"
13
- | "h4"
14
- | "h5"
15
- | "segment-header"
16
- | "segment-header-small"
17
- | "segment-subheader"
18
- | "segment-subheader-alt"
19
- | "p"
20
- | "small"
21
- | "big"
22
- | "sup"
23
- | "sub"
24
- | "strong"
25
- | "b"
26
- | "em";
27
- /** Override the variant font-size */
28
- fontSize?: string;
29
- /** Override the variant font-weight */
30
- fontWeight?: string;
31
- /** Override the variant line-height */
32
- lineHeight?: string;
33
- /** Override the variant text-transform */
34
- textTransform?: string;
35
- /** Override the variant text-decoration */
36
- textDecoration?: string;
37
- /** Override the variant display */
38
- display?: string;
39
- /** Override the list-style-type */
40
- listStyleType?: string;
41
- /** Override the white-space type */
42
- whiteSpace?: string;
43
- /** Override the word-wrap type */
44
- wordWrap?: string;
45
- /** Override the text-overflow type */
46
- textOverflow?: string;
47
- /** Apply truncation */
48
- truncate?: boolean;
49
- }
50
-
51
- declare function Typography(
52
- attrs: StyledComponentProps<
53
- "div",
54
- Record<string, unknown>,
55
- TypographyProps,
56
- ""
57
- >
58
- ): JSX.Element;
59
-
60
- export default Typography;
@@ -1,37 +0,0 @@
1
- import * as React from "react";
2
- import { CommonTextboxProps } from "../textbox";
3
-
4
- export interface DecimalProps extends CommonTextboxProps {
5
- /** Text alignment of the label */
6
- align?: "left" | "right";
7
- /** Allow an empty value instead of defaulting to 0.00 */
8
- allowEmptyValue?: boolean;
9
- /** The default value of the input if it's meant to be used as an uncontrolled component */
10
- defaultValue?: string;
11
- /** The input id */
12
- id?: string;
13
- /** The width of the input as a percentage */
14
- inputWidth?: number;
15
- /** Handler for change event if input is meant to be used as a controlled component */
16
- onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
17
- /** Handler for blur event */
18
- onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
19
- /** Handler for key press event */
20
- onKeyPress?: (ev: React.KeyboardEvent<HTMLInputElement>) => void;
21
- /** The input name */
22
- name?: string;
23
- /** The decimal precision of the value in the input */
24
- precision?: number;
25
- /** If true, the component will be read-only */
26
- readOnly?: boolean;
27
- /** Flag to configure component as mandatory */
28
- required?: boolean;
29
- /** The value of the input if it's used as a controlled component */
30
- value?: string;
31
- /** The locale string - default en */
32
- locale?: string;
33
- }
34
-
35
- declare class Decimal extends React.Component<DecimalProps> {}
36
-
37
- export default Decimal;
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
- import { TypographyProps } from "./typography";
3
-
4
- declare function List(
5
- props: TypographyProps & React.HTMLProps<HTMLElement>
6
- ): JSX.Element;
7
- declare function ListItem(
8
- props: TypographyProps & React.HTMLProps<HTMLElement>
9
- ): JSX.Element;
10
-
11
- export { List, ListItem };
@@ -1,60 +0,0 @@
1
- import { StyledComponentProps } from "styled-components";
2
- import { ColorProps, SpaceProps } from "styled-system";
3
-
4
- export interface TypographyProps extends SpaceProps, ColorProps {
5
- /** Override the variant component */
6
- as?: string;
7
- /** The visual style to apply to the component */
8
- variant?:
9
- | "h1-large"
10
- | "h1"
11
- | "h2"
12
- | "h3"
13
- | "h4"
14
- | "h5"
15
- | "segment-header"
16
- | "segment-header-small"
17
- | "segment-subheader"
18
- | "segment-subheader-alt"
19
- | "p"
20
- | "small"
21
- | "big"
22
- | "sup"
23
- | "sub"
24
- | "strong"
25
- | "b"
26
- | "em";
27
- /** Override the variant font-size */
28
- fontSize?: string;
29
- /** Override the variant font-weight */
30
- fontWeight?: string;
31
- /** Override the variant line-height */
32
- lineHeight?: string;
33
- /** Override the variant text-transform */
34
- textTransform?: string;
35
- /** Override the variant text-decoration */
36
- textDecoration?: string;
37
- /** Override the variant display */
38
- display?: string;
39
- /** Override the list-style-type */
40
- listStyleType?: string;
41
- /** Override the white-space type */
42
- whiteSpace?: string;
43
- /** Override the word-wrap type */
44
- wordWrap?: string;
45
- /** Override the text-overflow type */
46
- textOverflow?: string;
47
- /** Apply truncation */
48
- truncate?: boolean;
49
- }
50
-
51
- declare function Typography(
52
- attrs: StyledComponentProps<
53
- "div",
54
- Record<string, unknown>,
55
- TypographyProps,
56
- ""
57
- >
58
- ): JSX.Element;
59
-
60
- export default Typography;