carbon-react 111.22.1 → 111.22.3

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 (102) hide show
  1. package/esm/__internal__/fieldset/fieldset.component.d.ts +2 -0
  2. package/esm/__internal__/fieldset/fieldset.component.js +1 -0
  3. package/esm/components/accordion/accordion-group/accordion-group.component.d.ts +5 -1
  4. package/esm/components/accordion/accordion-group/accordion-group.component.js +1 -0
  5. package/esm/components/accordion/accordion.component.d.ts +1 -0
  6. package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.d.ts +18 -7
  7. package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.js +2 -0
  8. package/esm/components/advanced-color-picker/advanced-color-picker.style.js +2 -2
  9. package/esm/components/button-bar/button-bar.component.d.ts +5 -1
  10. package/esm/components/button-bar/button-bar.component.js +2 -0
  11. package/esm/components/button-bar/button-bar.config.d.ts +2 -2
  12. package/esm/components/carousel/slide/slide.component.d.ts +6 -1
  13. package/esm/components/carousel/slide/slide.component.js +2 -0
  14. package/esm/components/duelling-picklist/duelling-picklist.component.js +5 -0
  15. package/esm/components/duelling-picklist/duelling-picklist.d.ts +4 -0
  16. package/esm/components/fieldset/fieldset.component.d.ts +4 -1
  17. package/esm/components/fieldset/fieldset.component.js +2 -0
  18. package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.js +2 -0
  19. package/esm/components/flat-table/flat-table-cell/flat-table-cell.d.ts +1 -0
  20. package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +2 -0
  21. package/esm/components/flat-table/flat-table-header/flat-table-header.d.ts +1 -0
  22. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +2 -0
  23. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +1 -0
  24. package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +4 -3
  25. package/esm/components/navigation-bar/navigation-bar.component.d.ts +2 -0
  26. package/esm/components/number/index.d.ts +2 -1
  27. package/esm/components/number/index.js +1 -2
  28. package/esm/components/number/number.component.d.ts +8 -0
  29. package/esm/components/number/number.component.js +547 -14
  30. package/esm/components/simple-color-picker/index.d.ts +4 -2
  31. package/esm/components/simple-color-picker/{color-sample-box → simple-color}/checker-board.svg +0 -0
  32. package/esm/components/simple-color-picker/simple-color/index.d.ts +2 -0
  33. package/esm/components/simple-color-picker/simple-color/simple-color.component.d.ts +25 -0
  34. package/esm/components/simple-color-picker/simple-color/simple-color.component.js +28 -35
  35. package/esm/components/simple-color-picker/simple-color/simple-color.style.d.ts +9 -0
  36. package/esm/components/simple-color-picker/simple-color/simple-color.style.js +77 -3
  37. package/esm/components/simple-color-picker/simple-color-picker.component.d.ts +31 -0
  38. package/esm/components/simple-color-picker/simple-color-picker.component.js +201 -86
  39. package/esm/components/simple-color-picker/simple-color-picker.style.d.ts +9 -0
  40. package/esm/components/simple-color-picker/simple-color-picker.style.js +1 -1
  41. package/esm/components/vertical-divider/vertical-divider.component.d.ts +11 -2
  42. package/esm/components/vertical-divider/vertical-divider.component.js +2 -0
  43. package/lib/__internal__/fieldset/fieldset.component.d.ts +2 -0
  44. package/lib/__internal__/fieldset/fieldset.component.js +1 -0
  45. package/lib/components/accordion/accordion-group/accordion-group.component.d.ts +5 -1
  46. package/lib/components/accordion/accordion-group/accordion-group.component.js +1 -0
  47. package/lib/components/accordion/accordion.component.d.ts +1 -0
  48. package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.d.ts +18 -7
  49. package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.js +3 -1
  50. package/lib/components/advanced-color-picker/advanced-color-picker.style.js +3 -3
  51. package/lib/components/button-bar/button-bar.component.d.ts +5 -1
  52. package/lib/components/button-bar/button-bar.component.js +3 -1
  53. package/lib/components/button-bar/button-bar.config.d.ts +2 -2
  54. package/lib/components/carousel/slide/slide.component.d.ts +6 -1
  55. package/lib/components/carousel/slide/slide.component.js +3 -1
  56. package/lib/components/duelling-picklist/duelling-picklist.component.js +5 -0
  57. package/lib/components/duelling-picklist/duelling-picklist.d.ts +4 -0
  58. package/lib/components/fieldset/fieldset.component.d.ts +4 -1
  59. package/lib/components/fieldset/fieldset.component.js +3 -1
  60. package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.js +2 -0
  61. package/lib/components/flat-table/flat-table-cell/flat-table-cell.d.ts +1 -0
  62. package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +2 -0
  63. package/lib/components/flat-table/flat-table-header/flat-table-header.d.ts +1 -0
  64. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +2 -0
  65. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +1 -0
  66. package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +4 -3
  67. package/lib/components/navigation-bar/navigation-bar.component.d.ts +2 -0
  68. package/lib/components/number/index.d.ts +2 -1
  69. package/lib/components/number/index.js +7 -5
  70. package/lib/components/number/number.component.d.ts +8 -0
  71. package/lib/components/number/number.component.js +549 -15
  72. package/lib/components/simple-color-picker/index.d.ts +4 -2
  73. package/lib/components/simple-color-picker/{color-sample-box → simple-color}/checker-board.svg +0 -0
  74. package/lib/components/simple-color-picker/simple-color/index.d.ts +2 -0
  75. package/lib/components/simple-color-picker/simple-color/simple-color.component.d.ts +25 -0
  76. package/lib/components/simple-color-picker/simple-color/simple-color.component.js +35 -39
  77. package/lib/components/simple-color-picker/simple-color/simple-color.style.d.ts +9 -0
  78. package/lib/components/simple-color-picker/simple-color/simple-color.style.js +89 -4
  79. package/lib/components/simple-color-picker/simple-color-picker.component.d.ts +31 -0
  80. package/lib/components/simple-color-picker/simple-color-picker.component.js +204 -90
  81. package/lib/components/simple-color-picker/simple-color-picker.style.d.ts +9 -0
  82. package/lib/components/simple-color-picker/simple-color-picker.style.js +1 -1
  83. package/lib/components/vertical-divider/vertical-divider.component.d.ts +11 -2
  84. package/lib/components/vertical-divider/vertical-divider.component.js +3 -1
  85. package/package.json +2 -2
  86. package/esm/components/number/number.d.ts +0 -6
  87. package/esm/components/simple-color-picker/color-sample-box/color-sample-box.component.js +0 -33
  88. package/esm/components/simple-color-picker/color-sample-box/color-sample-box.style.js +0 -31
  89. package/esm/components/simple-color-picker/color-sample-box/index.js +0 -1
  90. package/esm/components/simple-color-picker/simple-color/simple-color.d.ts +0 -24
  91. package/esm/components/simple-color-picker/simple-color-input/simple-color-input.style.js +0 -25
  92. package/esm/components/simple-color-picker/simple-color-picker.d.ts +0 -41
  93. package/esm/components/simple-color-picker/tick-icon/tick-icon.style.js +0 -38
  94. package/lib/components/number/number.d.ts +0 -6
  95. package/lib/components/simple-color-picker/color-sample-box/color-sample-box.component.js +0 -48
  96. package/lib/components/simple-color-picker/color-sample-box/color-sample-box.style.js +0 -48
  97. package/lib/components/simple-color-picker/color-sample-box/index.js +0 -15
  98. package/lib/components/simple-color-picker/color-sample-box/package.json +0 -6
  99. package/lib/components/simple-color-picker/simple-color/simple-color.d.ts +0 -24
  100. package/lib/components/simple-color-picker/simple-color-input/simple-color-input.style.js +0 -38
  101. package/lib/components/simple-color-picker/simple-color-picker.d.ts +0 -41
  102. package/lib/components/simple-color-picker/tick-icon/tick-icon.style.js +0 -54
@@ -1,11 +1,10 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
+ import React, { useRef } from "react";
3
4
  import PropTypes from "prop-types";
4
- import React from "react";
5
+ import guid from "../../../__internal__/utils/helpers/guid";
5
6
  import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
6
- import StyledSimpleColor from "./simple-color.style";
7
- import ColorSampleBox from "../color-sample-box";
8
- import StyledSimpleColorInput from "../simple-color-input/simple-color-input.style";
7
+ import { StyledSimpleColor, StyledColorSampleBox, StyledTickIcon, StyledSimpleColorInput } from "./simple-color.style";
9
8
  const SimpleColor = /*#__PURE__*/React.forwardRef((props, ref) => {
10
9
  const {
11
10
  onChange,
@@ -13,13 +12,16 @@ const SimpleColor = /*#__PURE__*/React.forwardRef((props, ref) => {
13
12
  onMouseDown,
14
13
  value,
15
14
  name,
16
- checked,
15
+ checked = false,
17
16
  className,
17
+ id,
18
+ defaultChecked,
18
19
  ...rest
19
20
  } = props;
21
+ const {
22
+ current: inputId
23
+ } = useRef(id || guid());
20
24
  return /*#__PURE__*/React.createElement(StyledSimpleColor, _extends({
21
- color: value,
22
- checked: checked,
23
25
  className: className
24
26
  }, tagComponent("simple-color", props)), /*#__PURE__*/React.createElement(StyledSimpleColorInput, _extends({
25
27
  onChange: onChange,
@@ -31,37 +33,28 @@ const SimpleColor = /*#__PURE__*/React.forwardRef((props, ref) => {
31
33
  role: "radio",
32
34
  value: value,
33
35
  "aria-checked": checked,
34
- ref: ref
35
- }, rest)), /*#__PURE__*/React.createElement(ColorSampleBox, {
36
+ ref: ref,
37
+ id: inputId,
38
+ defaultChecked: defaultChecked
39
+ }, rest)), /*#__PURE__*/React.createElement(StyledColorSampleBox, {
40
+ color: value
41
+ }, checked && /*#__PURE__*/React.createElement(StyledTickIcon, {
36
42
  color: value,
37
- checked: checked
38
- }));
43
+ type: "tick"
44
+ })));
39
45
  });
40
- SimpleColor.defaultProps = {
41
- checked: false,
42
- onChange: null
43
- };
44
46
  SimpleColor.propTypes = {
45
- /** the value of the color that is represented by this SimpleColor */
46
- value: PropTypes.string,
47
-
48
- /** the input name */
49
- name: PropTypes.string,
50
-
51
- /** called when the user selects or deselects this color option */
52
- onChange: PropTypes.func,
53
-
54
- /** A callback triggered when a color is selected. */
55
- onBlur: PropTypes.func,
56
-
57
- /** A callback triggered when a color is selected. */
58
- onMouseDown: PropTypes.func,
59
-
60
- /** determines if this color option is selected or unselected */
61
- checked: PropTypes.bool,
62
-
63
- /** [Legacy] Custom classname */
64
- className: PropTypes.string
47
+ "checked": PropTypes.bool,
48
+ "className": PropTypes.string,
49
+ "defaultChecked": PropTypes.bool,
50
+ "disabled": PropTypes.bool,
51
+ "id": PropTypes.string,
52
+ "name": PropTypes.string,
53
+ "onBlur": PropTypes.func,
54
+ "onChange": PropTypes.func,
55
+ "onMouseDown": PropTypes.func,
56
+ "value": PropTypes.string.isRequired
65
57
  };
58
+ export { SimpleColor };
66
59
  SimpleColor.displayName = "SimpleColor";
67
60
  export default SimpleColor;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledSimpleColor: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const StyledColorSampleBox: import("styled-components").StyledComponent<"div", any, {
4
+ color: string;
5
+ }, never>;
6
+ export declare const StyledSimpleColorInput: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../__internal__/input").InputProps & import("react").RefAttributes<HTMLInputElement>>, any, {}, never>;
7
+ export declare const StyledTickIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {
8
+ color: string;
9
+ }, never>;
@@ -1,5 +1,9 @@
1
- import styled from "styled-components";
2
- const StyledSimpleColor = styled.div`
1
+ import styled, { css } from "styled-components";
2
+ import { Input } from "../../../__internal__/input";
3
+ import checkerBoardSvg from "./checker-board.svg";
4
+ import Icon from "../../icon";
5
+ import getRgbValues from "../../../style/utils/get-rgb-values";
6
+ export const StyledSimpleColor = styled.div`
3
7
  width: var(--sizing700);
4
8
  height: var(--sizing700);
5
9
  margin-right: 2px;
@@ -9,4 +13,74 @@ const StyledSimpleColor = styled.div`
9
13
  cursor: pointer;
10
14
  }
11
15
  `;
12
- export default StyledSimpleColor;
16
+ export const StyledColorSampleBox = styled.div`
17
+ height: 100%;
18
+ width: 100%;
19
+ box-sizing: border-box;
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ border: 2px solid transparent;
24
+
25
+ ${({
26
+ color
27
+ }) => color !== "transparent" && css`
28
+ background-color: ${color};
29
+ `}
30
+
31
+ ${({
32
+ color
33
+ }) => color === "transparent" && css`
34
+ background-color: #eeeeee;
35
+ background-image: url(${checkerBoardSvg});
36
+ background-size: 14px 14px;
37
+ background-position: -2px -2px;
38
+ `}
39
+ `;
40
+ export const StyledSimpleColorInput = styled(Input)`
41
+ position: absolute;
42
+ opacity: 0;
43
+ height: var(--sizing700);
44
+ width: var(--sizing700);
45
+ margin: 0;
46
+
47
+ &:hover {
48
+ cursor: pointer;
49
+ }
50
+
51
+ &:disabled:hover {
52
+ cursor: not-allowed;
53
+ }
54
+
55
+ &:focus + ${StyledColorSampleBox} {
56
+ box-shadow: inset 0px 0px 0px var(--borderWidth200)
57
+ var(--colorsUtilityYang100);
58
+ border: 2px solid var(--colorsSemanticFocus500);
59
+ }
60
+ `;
61
+
62
+ const getIconColor = color => {
63
+ const rgbValues = getRgbValues(color);
64
+ const [r, g, b] = rgbValues; // color contrast calculating formula as per W3 suggestions
65
+
66
+ const redMultiplier = 299,
67
+ greenMultiplier = 587,
68
+ blueMultiplier = 114;
69
+ const contrast = (Math.round(r * redMultiplier) + Math.round(g * greenMultiplier) + Math.round(b * blueMultiplier)) / 1000;
70
+ if (contrast < 128) return "var(--colorsUtilityYang100)";
71
+ return "var(--colorsUtilityYin090)";
72
+ };
73
+
74
+ export const StyledTickIcon = styled(Icon)`
75
+ height: 22px;
76
+ width: 22px;
77
+ pointer-events: none;
78
+ display: block;
79
+
80
+ &::before {
81
+ font-size: 22px;
82
+ color: ${({
83
+ color
84
+ }) => getIconColor(color)};
85
+ }
86
+ `;
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ import { ValidationProps } from "../../__internal__/validations";
4
+ export interface SimpleColorPickerProps extends ValidationProps, MarginProps {
5
+ /** The SimpleColor components to be rendered in the group */
6
+ children?: React.ReactNode;
7
+ /** prop that represents childWidth */
8
+ childWidth?: string | number;
9
+ /** Should the onBlur callback prop be initially blocked? */
10
+ isBlurBlocked?: boolean;
11
+ /** The content for the Legend */
12
+ legend: string;
13
+ /** prop that sets max-width in css */
14
+ maxWidth?: string | number;
15
+ /** The name to apply to the input. */
16
+ name: string;
17
+ /** Prop for `onChange` events */
18
+ onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
19
+ /** Prop for `onKeyDown` events */
20
+ onKeyDown?: (ev: React.KeyboardEvent<HTMLInputElement>) => void;
21
+ /** Prop for `onBlur` events */
22
+ onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
23
+ /** Flag to configure component as mandatory */
24
+ required?: boolean;
25
+ /** When true, validation icon will be placed on legend instead of being placed by the input */
26
+ validationOnLegend?: boolean;
27
+ /** The currently selected color. */
28
+ value?: string;
29
+ }
30
+ export declare const SimpleColorPicker: (props: SimpleColorPickerProps) => JSX.Element;
31
+ export default SimpleColorPicker;
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import React, { useCallback, useState, useRef, useMemo, useEffect } from "react";
4
4
  import PropTypes from "prop-types";
5
- import styledSystemPropTypes from "@styled-system/prop-types";
5
+ import invariant from "invariant";
6
6
  import Events from "../../__internal__/utils/helpers/events";
7
7
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
8
8
  import Fieldset from "../../__internal__/fieldset";
@@ -12,7 +12,6 @@ import { StyledContent, StyledColorOptions } from "./simple-color-picker.style";
12
12
  import ValidationIcon from "../../__internal__/validations/validation-icon.component";
13
13
  import { InputGroupContext } from "../../__internal__/input-behaviour";
14
14
  import { filterStyledSystemMarginProps } from "../../style/utils";
15
- const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
16
15
 
17
16
  const SimpleColorPicker = props => {
18
17
  const {
@@ -33,11 +32,21 @@ const SimpleColorPicker = props => {
33
32
  required,
34
33
  ...rest
35
34
  } = props;
36
- const filteredChildren = useMemo(() => React.Children.toArray(children), [children]);
37
- const myRef = useRef(null);
35
+ const hasProperChildren = useMemo(() => {
36
+ let hasSimpleColorChildren = true;
37
+ React.Children.toArray(children).forEach(child => {
38
+ if (typeof child === "string" || /*#__PURE__*/React.isValidElement(child) && child.type.displayName !== "SimpleColor") {
39
+ hasSimpleColorChildren = false;
40
+ }
41
+ });
42
+ return hasSimpleColorChildren;
43
+ }, [children]);
44
+ !hasProperChildren ? process.env.NODE_ENV !== "production" ? invariant(false, `SimpleColorPicker accepts only children of type \`${SimpleColor.displayName}\`.`) : invariant(false) : void 0;
45
+ const filteredChildren = useMemo(() => React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child)), [children]);
46
+ const internalRef = useRef(null);
38
47
  const [blurBlocked, setIsBlurBlocked] = useState(isBlurBlocked);
39
48
  const [focusedElement, setFocusedElement] = useState(null);
40
- const itemsPerRow = Math.floor(maxWidth / childWidth);
49
+ const itemsPerRow = Math.floor(+maxWidth / +childWidth);
41
50
  const rowCount = Math.ceil((filteredChildren === null || filteredChildren === void 0 ? void 0 : filteredChildren.length) / itemsPerRow);
42
51
  let blankSlots = itemsPerRow * rowCount - (filteredChildren === null || filteredChildren === void 0 ? void 0 : filteredChildren.length);
43
52
  let currentRow = 1;
@@ -90,19 +99,20 @@ const SimpleColorPicker = props => {
90
99
  const arrowKeys = [Events.isLeftKey(e), Events.isUpKey(e), Events.isRightKey(e), Events.isDownKey(e)];
91
100
  if (!arrowKeys.includes(true)) return;
92
101
  e.preventDefault();
93
- let itemIndex;
102
+ let itemIndex = null;
103
+ const target = e.target;
94
104
 
95
105
  if (Events.isUpKey(e)) {
96
- if (e.target.getAttribute("data-up") !== "true") return;
97
- itemIndex = e.target.getAttribute("data-item-up");
106
+ if (target.getAttribute("data-up") !== "true") return;
107
+ itemIndex = +target.getAttribute("data-item-up");
98
108
  } else if (Events.isDownKey(e)) {
99
- if (e.target.getAttribute("data-down") !== "true") return;
100
- itemIndex = e.target.getAttribute("data-item-down");
109
+ if (target.getAttribute("data-down") !== "true") return;
110
+ itemIndex = +target.getAttribute("data-item-down");
101
111
  }
102
112
 
103
113
  if (Events.isLeftKey(e) || Events.isRightKey(e)) {
104
114
  const position = element => {
105
- return e.target.getAttribute("value") === element.props.value;
115
+ return target.getAttribute("value") === element.props.value;
106
116
  };
107
117
 
108
118
  if (Events.isLeftKey(e)) {
@@ -117,14 +127,18 @@ const SimpleColorPicker = props => {
117
127
  itemIndex = 0;
118
128
  }
119
129
  }
130
+ /* istanbul ignore else */
131
+
120
132
 
121
- const item = navigationGrid[itemIndex].ref.current;
122
- item.focus();
123
- item.click();
124
- }, [onKeyDown, navigationGrid]);
133
+ if (itemIndex !== null) {
134
+ const item = gridItemRefs[itemIndex].current;
135
+ item === null || item === void 0 ? void 0 : item.focus();
136
+ item === null || item === void 0 ? void 0 : item.click();
137
+ }
138
+ }, [onKeyDown, navigationGrid, gridItemRefs]);
125
139
 
126
140
  const handleClickOutside = ev => {
127
- if (myRef.current && ev.target && !myRef.current.contains(ev.target)) {
141
+ if (internalRef.current && ev.target && !internalRef.current.contains(ev.target)) {
128
142
  setIsBlurBlocked(false);
129
143
  }
130
144
  };
@@ -176,10 +190,7 @@ const SimpleColorPicker = props => {
176
190
  }) => /*#__PURE__*/React.createElement(StyledColorOptions, _extends({
177
191
  maxWidth: maxWidth,
178
192
  childWidth: childWidth,
179
- error: error,
180
- warning: warning,
181
- info: info,
182
- ref: myRef,
193
+ ref: internalRef,
183
194
  onMouseEnter: onMouseEnter,
184
195
  onMouseLeave: onMouseLeave
185
196
  }, validationProps), /*#__PURE__*/React.createElement(RadioButtonMapper, {
@@ -195,71 +206,175 @@ const SimpleColorPicker = props => {
195
206
  };
196
207
 
197
208
  SimpleColorPicker.propTypes = {
198
- /** Filtered styled system margin props */
199
- ...marginPropTypes,
200
-
201
- /** The SimpleColor components to be rendered in the group */
202
- children: (props, propName, componentName) => {
203
- let error;
204
- const prop = props[propName];
205
- React.Children.forEach(prop, child => {
206
- if (child === null) {
207
- return;
208
- }
209
-
210
- if (SimpleColor.displayName !== child.type.displayName) {
211
- error = new Error(`\`${componentName}\` only accepts children of type \`${SimpleColor.displayName}\`.`);
212
- }
213
- });
214
- return error;
215
- },
216
-
217
- /** Should the onBlur callback prop be initially blocked? */
218
- isBlurBlocked: PropTypes.bool,
219
-
220
- /** Indicate that error has occurred
221
- Pass string to display icon, tooltip and red border
222
- Pass true boolean to only display red border */
223
- error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
224
-
225
- /** Indicate that warning has occurred
226
- Pass string to display icon, tooltip and orange border
227
- Pass true boolean to only display orange border */
228
- warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
229
-
230
- /** Indicate additional information
231
- Pass string to display icon, tooltip and blue border
232
- Pass true boolean to only display blue border */
233
- info: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
234
-
235
- /** When true, validation icon will be placed on legend instead of being placed by the input */
236
- validationOnLegend: PropTypes.bool,
237
-
238
- /** The content for the RadioGroup Legend */
239
- legend: PropTypes.string.isRequired,
240
-
241
- /** The currently selected color. */
242
- value: PropTypes.string,
243
-
244
- /** The name to apply to the input. */
245
- name: PropTypes.string,
246
-
247
- /** A callback triggered when a color is selected. */
248
- onChange: PropTypes.func,
249
-
250
- /** A callback triggered when a color is selected. */
251
- onBlur: PropTypes.func,
252
-
253
- /** A callback triggered on key down. */
254
- onKeyDown: PropTypes.func,
255
-
256
- /** prop that sets max-width in css */
257
- maxWidth: PropTypes.string,
258
-
259
- /** prop that represents childWidth */
260
- childWidth: PropTypes.string,
261
-
262
- /** Flag to configure component as mandatory */
263
- required: PropTypes.bool
209
+ "children": PropTypes.node,
210
+ "childWidth": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
211
+ "error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
212
+ "info": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
213
+ "isBlurBlocked": PropTypes.bool,
214
+ "legend": PropTypes.string.isRequired,
215
+ "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
216
+ "__@toStringTag": PropTypes.string.isRequired,
217
+ "description": PropTypes.string,
218
+ "toString": PropTypes.func.isRequired,
219
+ "valueOf": PropTypes.func.isRequired
220
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
221
+ "__@toStringTag": PropTypes.string.isRequired,
222
+ "description": PropTypes.string,
223
+ "toString": PropTypes.func.isRequired,
224
+ "valueOf": PropTypes.func.isRequired
225
+ }), PropTypes.string]),
226
+ "margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
227
+ "__@toStringTag": PropTypes.string.isRequired,
228
+ "description": PropTypes.string,
229
+ "toString": PropTypes.func.isRequired,
230
+ "valueOf": PropTypes.func.isRequired
231
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
232
+ "__@toStringTag": PropTypes.string.isRequired,
233
+ "description": PropTypes.string,
234
+ "toString": PropTypes.func.isRequired,
235
+ "valueOf": PropTypes.func.isRequired
236
+ }), PropTypes.string]),
237
+ "marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
238
+ "__@toStringTag": PropTypes.string.isRequired,
239
+ "description": PropTypes.string,
240
+ "toString": PropTypes.func.isRequired,
241
+ "valueOf": PropTypes.func.isRequired
242
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
243
+ "__@toStringTag": PropTypes.string.isRequired,
244
+ "description": PropTypes.string,
245
+ "toString": PropTypes.func.isRequired,
246
+ "valueOf": PropTypes.func.isRequired
247
+ }), PropTypes.string]),
248
+ "marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
249
+ "__@toStringTag": PropTypes.string.isRequired,
250
+ "description": PropTypes.string,
251
+ "toString": PropTypes.func.isRequired,
252
+ "valueOf": PropTypes.func.isRequired
253
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
254
+ "__@toStringTag": PropTypes.string.isRequired,
255
+ "description": PropTypes.string,
256
+ "toString": PropTypes.func.isRequired,
257
+ "valueOf": PropTypes.func.isRequired
258
+ }), PropTypes.string]),
259
+ "marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
260
+ "__@toStringTag": PropTypes.string.isRequired,
261
+ "description": PropTypes.string,
262
+ "toString": PropTypes.func.isRequired,
263
+ "valueOf": PropTypes.func.isRequired
264
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
265
+ "__@toStringTag": PropTypes.string.isRequired,
266
+ "description": PropTypes.string,
267
+ "toString": PropTypes.func.isRequired,
268
+ "valueOf": PropTypes.func.isRequired
269
+ }), PropTypes.string]),
270
+ "marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
271
+ "__@toStringTag": PropTypes.string.isRequired,
272
+ "description": PropTypes.string,
273
+ "toString": PropTypes.func.isRequired,
274
+ "valueOf": PropTypes.func.isRequired
275
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
276
+ "__@toStringTag": PropTypes.string.isRequired,
277
+ "description": PropTypes.string,
278
+ "toString": PropTypes.func.isRequired,
279
+ "valueOf": PropTypes.func.isRequired
280
+ }), PropTypes.string]),
281
+ "marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
282
+ "__@toStringTag": PropTypes.string.isRequired,
283
+ "description": PropTypes.string,
284
+ "toString": PropTypes.func.isRequired,
285
+ "valueOf": PropTypes.func.isRequired
286
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
287
+ "__@toStringTag": PropTypes.string.isRequired,
288
+ "description": PropTypes.string,
289
+ "toString": PropTypes.func.isRequired,
290
+ "valueOf": PropTypes.func.isRequired
291
+ }), PropTypes.string]),
292
+ "marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
293
+ "__@toStringTag": PropTypes.string.isRequired,
294
+ "description": PropTypes.string,
295
+ "toString": PropTypes.func.isRequired,
296
+ "valueOf": PropTypes.func.isRequired
297
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
298
+ "__@toStringTag": PropTypes.string.isRequired,
299
+ "description": PropTypes.string,
300
+ "toString": PropTypes.func.isRequired,
301
+ "valueOf": PropTypes.func.isRequired
302
+ }), PropTypes.string]),
303
+ "maxWidth": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
304
+ "mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
305
+ "__@toStringTag": PropTypes.string.isRequired,
306
+ "description": PropTypes.string,
307
+ "toString": PropTypes.func.isRequired,
308
+ "valueOf": PropTypes.func.isRequired
309
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
310
+ "__@toStringTag": PropTypes.string.isRequired,
311
+ "description": PropTypes.string,
312
+ "toString": PropTypes.func.isRequired,
313
+ "valueOf": PropTypes.func.isRequired
314
+ }), PropTypes.string]),
315
+ "ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
316
+ "__@toStringTag": PropTypes.string.isRequired,
317
+ "description": PropTypes.string,
318
+ "toString": PropTypes.func.isRequired,
319
+ "valueOf": PropTypes.func.isRequired
320
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
321
+ "__@toStringTag": PropTypes.string.isRequired,
322
+ "description": PropTypes.string,
323
+ "toString": PropTypes.func.isRequired,
324
+ "valueOf": PropTypes.func.isRequired
325
+ }), PropTypes.string]),
326
+ "mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
327
+ "__@toStringTag": PropTypes.string.isRequired,
328
+ "description": PropTypes.string,
329
+ "toString": PropTypes.func.isRequired,
330
+ "valueOf": PropTypes.func.isRequired
331
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
332
+ "__@toStringTag": PropTypes.string.isRequired,
333
+ "description": PropTypes.string,
334
+ "toString": PropTypes.func.isRequired,
335
+ "valueOf": PropTypes.func.isRequired
336
+ }), PropTypes.string]),
337
+ "mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
338
+ "__@toStringTag": PropTypes.string.isRequired,
339
+ "description": PropTypes.string,
340
+ "toString": PropTypes.func.isRequired,
341
+ "valueOf": PropTypes.func.isRequired
342
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
343
+ "__@toStringTag": PropTypes.string.isRequired,
344
+ "description": PropTypes.string,
345
+ "toString": PropTypes.func.isRequired,
346
+ "valueOf": PropTypes.func.isRequired
347
+ }), PropTypes.string]),
348
+ "mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
349
+ "__@toStringTag": PropTypes.string.isRequired,
350
+ "description": PropTypes.string,
351
+ "toString": PropTypes.func.isRequired,
352
+ "valueOf": PropTypes.func.isRequired
353
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
354
+ "__@toStringTag": PropTypes.string.isRequired,
355
+ "description": PropTypes.string,
356
+ "toString": PropTypes.func.isRequired,
357
+ "valueOf": PropTypes.func.isRequired
358
+ }), PropTypes.string]),
359
+ "my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
360
+ "__@toStringTag": PropTypes.string.isRequired,
361
+ "description": PropTypes.string,
362
+ "toString": PropTypes.func.isRequired,
363
+ "valueOf": PropTypes.func.isRequired
364
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
365
+ "__@toStringTag": PropTypes.string.isRequired,
366
+ "description": PropTypes.string,
367
+ "toString": PropTypes.func.isRequired,
368
+ "valueOf": PropTypes.func.isRequired
369
+ }), PropTypes.string]),
370
+ "name": PropTypes.string.isRequired,
371
+ "onBlur": PropTypes.func,
372
+ "onChange": PropTypes.func,
373
+ "onKeyDown": PropTypes.func,
374
+ "required": PropTypes.bool,
375
+ "validationOnLegend": PropTypes.bool,
376
+ "value": PropTypes.string,
377
+ "warning": PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
264
378
  };
379
+ export { SimpleColorPicker };
265
380
  export default SimpleColorPicker;
@@ -0,0 +1,9 @@
1
+ import { ValidationProps } from "../../__internal__/validations";
2
+ declare type Width = string | number;
3
+ declare const StyledContent: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ interface StyledColorOptionsProps extends ValidationProps {
5
+ maxWidth: Width;
6
+ childWidth: Width;
7
+ }
8
+ declare const StyledColorOptions: import("styled-components").StyledComponent<"div", any, StyledColorOptionsProps, never>;
9
+ export { StyledContent, StyledColorOptions };
@@ -2,7 +2,7 @@ import styled, { css } from "styled-components";
2
2
  import StyledValidationIcon from "../../__internal__/validations/validation-icon.style";
3
3
  const BORDER_WIDTH = 2;
4
4
 
5
- const getRoundedMaxWidth = (maxWidth, childWidth) => Math.floor(maxWidth / childWidth) * childWidth;
5
+ const getRoundedMaxWidth = (maxWidth, childWidth) => Math.floor(+maxWidth / +childWidth) * +childWidth;
6
6
 
7
7
  const StyledContent = styled.div`
8
8
  display: flex;
@@ -2,11 +2,20 @@
2
2
  import { SpaceProps } from "styled-system";
3
3
  declare type TintRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100;
4
4
  export interface VerticalDividerProps extends SpaceProps {
5
+ /** Shorthand for the height attribute */
5
6
  h?: number | string;
7
+ /** Height attribute of the component */
6
8
  height?: number | string;
9
+ /**
10
+ * Sets the display: inline css attribute on the component
11
+ * To be used in non-flex containers.
12
+ */
7
13
  displayInline?: boolean;
8
- /** the supported rage is 1-100 */
14
+ /** Custom tint of the divider, the supported rage is 1-100 */
9
15
  tint?: TintRange;
10
16
  }
11
- declare const VerticalDivider: ({ h, height, displayInline, tint, ...props }: VerticalDividerProps) => JSX.Element;
17
+ export declare const VerticalDivider: {
18
+ ({ h, height, displayInline, tint, ...props }: VerticalDividerProps): JSX.Element;
19
+ displayName: string;
20
+ };
12
21
  export default VerticalDivider;
@@ -342,4 +342,6 @@ VerticalDivider.propTypes = {
342
342
  }), PropTypes.string]),
343
343
  "tint": PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100])
344
344
  };
345
+ export { VerticalDivider };
346
+ VerticalDivider.displayName = "VerticalDivider";
345
347
  export default VerticalDivider;
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  export interface FieldsetProps extends MarginProps {
4
+ /** Role */
5
+ role?: string;
4
6
  /** Fieldset content */
5
7
  children: React.ReactNode;
6
8
  /** The content for the Fieldset Legend */
@@ -221,6 +221,7 @@ Fieldset.propTypes = {
221
221
  "toString": _propTypes.default.func.isRequired,
222
222
  "valueOf": _propTypes.default.func.isRequired
223
223
  }), _propTypes.default.string]),
224
+ "role": _propTypes.default.string,
224
225
  "warning": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool])
225
226
  };
226
227
  var _default = Fieldset;
@@ -4,7 +4,11 @@ declare type AccordionGroupChild = React.ReactElement | boolean | null | undefin
4
4
  interface AccordionGroupChildArray extends Array<AccordionGroupChild> {
5
5
  }
6
6
  export interface AccordionGroupProps extends MarginProps {
7
+ /** An Accordion or list of Accordion components to be rendered inside the AccordionGroup */
7
8
  children?: AccordionGroupChild;
8
9
  }
9
- export declare const AccordionGroup: ({ children, ...rest }: AccordionGroupProps) => JSX.Element;
10
+ export declare const AccordionGroup: {
11
+ ({ children, ...rest }: AccordionGroupProps): JSX.Element;
12
+ displayName: string;
13
+ };
10
14
  export default AccordionGroup;