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.
- package/esm/__internal__/fieldset/fieldset.component.d.ts +2 -0
- package/esm/__internal__/fieldset/fieldset.component.js +1 -0
- package/esm/components/accordion/accordion-group/accordion-group.component.d.ts +5 -1
- package/esm/components/accordion/accordion-group/accordion-group.component.js +1 -0
- package/esm/components/accordion/accordion.component.d.ts +1 -0
- package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.d.ts +18 -7
- package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.js +2 -0
- package/esm/components/advanced-color-picker/advanced-color-picker.style.js +2 -2
- package/esm/components/button-bar/button-bar.component.d.ts +5 -1
- package/esm/components/button-bar/button-bar.component.js +2 -0
- package/esm/components/button-bar/button-bar.config.d.ts +2 -2
- package/esm/components/carousel/slide/slide.component.d.ts +6 -1
- package/esm/components/carousel/slide/slide.component.js +2 -0
- package/esm/components/duelling-picklist/duelling-picklist.component.js +5 -0
- package/esm/components/duelling-picklist/duelling-picklist.d.ts +4 -0
- package/esm/components/fieldset/fieldset.component.d.ts +4 -1
- package/esm/components/fieldset/fieldset.component.js +2 -0
- package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.js +2 -0
- package/esm/components/flat-table/flat-table-cell/flat-table-cell.d.ts +1 -0
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +2 -0
- package/esm/components/flat-table/flat-table-header/flat-table-header.d.ts +1 -0
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +2 -0
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +1 -0
- package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +4 -3
- package/esm/components/navigation-bar/navigation-bar.component.d.ts +2 -0
- package/esm/components/number/index.d.ts +2 -1
- package/esm/components/number/index.js +1 -2
- package/esm/components/number/number.component.d.ts +8 -0
- package/esm/components/number/number.component.js +547 -14
- package/esm/components/simple-color-picker/index.d.ts +4 -2
- package/esm/components/simple-color-picker/{color-sample-box → simple-color}/checker-board.svg +0 -0
- package/esm/components/simple-color-picker/simple-color/index.d.ts +2 -0
- package/esm/components/simple-color-picker/simple-color/simple-color.component.d.ts +25 -0
- package/esm/components/simple-color-picker/simple-color/simple-color.component.js +28 -35
- package/esm/components/simple-color-picker/simple-color/simple-color.style.d.ts +9 -0
- package/esm/components/simple-color-picker/simple-color/simple-color.style.js +77 -3
- package/esm/components/simple-color-picker/simple-color-picker.component.d.ts +31 -0
- package/esm/components/simple-color-picker/simple-color-picker.component.js +201 -86
- package/esm/components/simple-color-picker/simple-color-picker.style.d.ts +9 -0
- package/esm/components/simple-color-picker/simple-color-picker.style.js +1 -1
- package/esm/components/vertical-divider/vertical-divider.component.d.ts +11 -2
- package/esm/components/vertical-divider/vertical-divider.component.js +2 -0
- package/lib/__internal__/fieldset/fieldset.component.d.ts +2 -0
- package/lib/__internal__/fieldset/fieldset.component.js +1 -0
- package/lib/components/accordion/accordion-group/accordion-group.component.d.ts +5 -1
- package/lib/components/accordion/accordion-group/accordion-group.component.js +1 -0
- package/lib/components/accordion/accordion.component.d.ts +1 -0
- package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.d.ts +18 -7
- package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.js +3 -1
- package/lib/components/advanced-color-picker/advanced-color-picker.style.js +3 -3
- package/lib/components/button-bar/button-bar.component.d.ts +5 -1
- package/lib/components/button-bar/button-bar.component.js +3 -1
- package/lib/components/button-bar/button-bar.config.d.ts +2 -2
- package/lib/components/carousel/slide/slide.component.d.ts +6 -1
- package/lib/components/carousel/slide/slide.component.js +3 -1
- package/lib/components/duelling-picklist/duelling-picklist.component.js +5 -0
- package/lib/components/duelling-picklist/duelling-picklist.d.ts +4 -0
- package/lib/components/fieldset/fieldset.component.d.ts +4 -1
- package/lib/components/fieldset/fieldset.component.js +3 -1
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.js +2 -0
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.d.ts +1 -0
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +2 -0
- package/lib/components/flat-table/flat-table-header/flat-table-header.d.ts +1 -0
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +2 -0
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +1 -0
- package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +4 -3
- package/lib/components/navigation-bar/navigation-bar.component.d.ts +2 -0
- package/lib/components/number/index.d.ts +2 -1
- package/lib/components/number/index.js +7 -5
- package/lib/components/number/number.component.d.ts +8 -0
- package/lib/components/number/number.component.js +549 -15
- package/lib/components/simple-color-picker/index.d.ts +4 -2
- package/lib/components/simple-color-picker/{color-sample-box → simple-color}/checker-board.svg +0 -0
- package/lib/components/simple-color-picker/simple-color/index.d.ts +2 -0
- package/lib/components/simple-color-picker/simple-color/simple-color.component.d.ts +25 -0
- package/lib/components/simple-color-picker/simple-color/simple-color.component.js +35 -39
- package/lib/components/simple-color-picker/simple-color/simple-color.style.d.ts +9 -0
- package/lib/components/simple-color-picker/simple-color/simple-color.style.js +89 -4
- package/lib/components/simple-color-picker/simple-color-picker.component.d.ts +31 -0
- package/lib/components/simple-color-picker/simple-color-picker.component.js +204 -90
- package/lib/components/simple-color-picker/simple-color-picker.style.d.ts +9 -0
- package/lib/components/simple-color-picker/simple-color-picker.style.js +1 -1
- package/lib/components/vertical-divider/vertical-divider.component.d.ts +11 -2
- package/lib/components/vertical-divider/vertical-divider.component.js +3 -1
- package/package.json +2 -2
- package/esm/components/number/number.d.ts +0 -6
- package/esm/components/simple-color-picker/color-sample-box/color-sample-box.component.js +0 -33
- package/esm/components/simple-color-picker/color-sample-box/color-sample-box.style.js +0 -31
- package/esm/components/simple-color-picker/color-sample-box/index.js +0 -1
- package/esm/components/simple-color-picker/simple-color/simple-color.d.ts +0 -24
- package/esm/components/simple-color-picker/simple-color-input/simple-color-input.style.js +0 -25
- package/esm/components/simple-color-picker/simple-color-picker.d.ts +0 -41
- package/esm/components/simple-color-picker/tick-icon/tick-icon.style.js +0 -38
- package/lib/components/number/number.d.ts +0 -6
- package/lib/components/simple-color-picker/color-sample-box/color-sample-box.component.js +0 -48
- package/lib/components/simple-color-picker/color-sample-box/color-sample-box.style.js +0 -48
- package/lib/components/simple-color-picker/color-sample-box/index.js +0 -15
- package/lib/components/simple-color-picker/color-sample-box/package.json +0 -6
- package/lib/components/simple-color-picker/simple-color/simple-color.d.ts +0 -24
- package/lib/components/simple-color-picker/simple-color-input/simple-color-input.style.js +0 -38
- package/lib/components/simple-color-picker/simple-color-picker.d.ts +0 -41
- 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
|
|
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
|
-
|
|
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
|
-
|
|
38
|
-
}));
|
|
43
|
+
type: "tick"
|
|
44
|
+
})));
|
|
39
45
|
});
|
|
40
|
-
SimpleColor.defaultProps = {
|
|
41
|
-
checked: false,
|
|
42
|
-
onChange: null
|
|
43
|
-
};
|
|
44
46
|
SimpleColor.propTypes = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
onChange: PropTypes.func,
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
37
|
-
|
|
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 (
|
|
97
|
-
itemIndex =
|
|
106
|
+
if (target.getAttribute("data-up") !== "true") return;
|
|
107
|
+
itemIndex = +target.getAttribute("data-item-up");
|
|
98
108
|
} else if (Events.isDownKey(e)) {
|
|
99
|
-
if (
|
|
100
|
-
itemIndex =
|
|
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
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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:
|
|
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;
|
|
@@ -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:
|
|
10
|
+
export declare const AccordionGroup: {
|
|
11
|
+
({ children, ...rest }: AccordionGroupProps): JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
10
14
|
export default AccordionGroup;
|