carbon-react 114.18.2 → 115.0.0
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__/checkable-input/checkable-input.component.d.ts +1 -1
- package/esm/__internal__/checkable-input/checkable-input.component.js +3 -4
- package/esm/__internal__/checkable-input/hidden-checkable-input.component.d.ts +2 -0
- package/esm/__internal__/checkable-input/hidden-checkable-input.component.js +5 -5
- package/esm/__internal__/input/input.component.js +2 -1
- package/esm/__internal__/input-behaviour/input-behaviour.component.js +2 -7
- package/esm/__internal__/input-behaviour/useInputBehaviour.d.ts +0 -1
- package/esm/components/checkbox/checkbox.component.d.ts +2 -0
- package/esm/components/checkbox/checkbox.component.js +2 -0
- package/esm/components/draggable/draggable-container.component.d.ts +17 -0
- package/esm/components/draggable/draggable-container.component.js +174 -61
- package/esm/components/draggable/draggable-item.component.d.ts +30 -0
- package/esm/components/draggable/draggable-item.component.js +180 -36
- package/esm/components/draggable/draggable-item.style.d.ts +9 -0
- package/esm/components/draggable/index.d.ts +4 -2
- package/esm/components/draggable/internal/drop-target.component.d.ts +8 -0
- package/esm/components/draggable/internal/drop-target.component.js +187 -0
- package/esm/components/grouped-character/grouped-character.component.js +0 -1
- package/esm/components/inline-inputs/index.d.ts +1 -1
- package/esm/components/inline-inputs/index.js +1 -1
- package/esm/components/inline-inputs/inline-inputs.component.d.ts +6 -5
- package/esm/components/inline-inputs/inline-inputs.component.js +8 -13
- package/esm/components/number/number.component.js +0 -1
- package/esm/components/select/filterable-select/filterable-select.component.js +11 -4
- package/esm/components/select/multi-select/multi-select.component.js +13 -4
- package/esm/components/select/select-textbox/select-textbox.component.js +2 -0
- package/esm/components/select/simple-select/simple-select.component.js +13 -4
- package/esm/components/settings-row/index.d.ts +2 -1
- package/esm/components/settings-row/settings-row.component.d.ts +22 -0
- package/esm/components/settings-row/settings-row.component.js +165 -23
- package/esm/components/settings-row/settings-row.style.d.ts +7 -0
- package/esm/components/textarea/textarea.component.d.ts +2 -0
- package/esm/components/textarea/textarea.component.js +2 -2
- package/esm/components/textbox/textbox.component.d.ts +7 -3
- package/esm/components/textbox/textbox.component.js +3 -5
- package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +0 -1
- package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +1 -3
- package/lib/__internal__/checkable-input/checkable-input.component.d.ts +1 -1
- package/lib/__internal__/checkable-input/checkable-input.component.js +3 -4
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.d.ts +2 -0
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +5 -5
- package/lib/__internal__/input/input.component.js +2 -1
- package/lib/__internal__/input-behaviour/input-behaviour.component.js +2 -12
- package/lib/__internal__/input-behaviour/useInputBehaviour.d.ts +0 -1
- package/lib/components/checkbox/checkbox.component.d.ts +2 -0
- package/lib/components/checkbox/checkbox.component.js +2 -0
- package/lib/components/draggable/draggable-container.component.d.ts +17 -0
- package/lib/components/draggable/draggable-container.component.js +174 -64
- package/lib/components/draggable/draggable-item.component.d.ts +30 -0
- package/lib/components/draggable/draggable-item.component.js +179 -37
- package/lib/components/draggable/draggable-item.style.d.ts +9 -0
- package/lib/components/draggable/index.d.ts +4 -2
- package/lib/components/draggable/internal/drop-target.component.d.ts +8 -0
- package/lib/components/draggable/internal/drop-target.component.js +200 -0
- package/lib/components/grouped-character/grouped-character.component.js +0 -1
- package/lib/components/inline-inputs/index.d.ts +1 -1
- package/lib/components/inline-inputs/index.js +2 -10
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +6 -5
- package/lib/components/inline-inputs/inline-inputs.component.js +11 -20
- package/lib/components/number/number.component.js +0 -1
- package/lib/components/select/filterable-select/filterable-select.component.js +12 -4
- package/lib/components/select/multi-select/multi-select.component.js +14 -4
- package/lib/components/select/select-textbox/select-textbox.component.js +2 -0
- package/lib/components/select/simple-select/simple-select.component.js +14 -4
- package/lib/components/settings-row/index.d.ts +2 -1
- package/lib/components/settings-row/settings-row.component.d.ts +22 -0
- package/lib/components/settings-row/settings-row.component.js +166 -26
- package/lib/components/settings-row/settings-row.style.d.ts +7 -0
- package/lib/components/textarea/textarea.component.d.ts +2 -0
- package/lib/components/textarea/textarea.component.js +2 -2
- package/lib/components/textbox/textbox.component.d.ts +7 -3
- package/lib/components/textbox/textbox.component.js +3 -5
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +0 -1
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +1 -3
- package/package.json +1 -1
- package/esm/components/draggable/draggable-container.d.ts +0 -28
- package/esm/components/draggable/draggable-item.d.ts +0 -18
- package/esm/components/settings-row/settings-row.d.ts +0 -21
- package/lib/components/draggable/draggable-container.d.ts +0 -28
- package/lib/components/draggable/draggable-item.d.ts +0 -18
- package/lib/components/settings-row/settings-row.d.ts +0 -21
|
@@ -16,12 +16,14 @@ import isNavigationKey from "../utils/is-navigation-key";
|
|
|
16
16
|
import Logger from "../../../__internal__/utils/logger";
|
|
17
17
|
import useStableCallback from "../../../hooks/__internal__/useStableCallback";
|
|
18
18
|
import useFormSpacing from "../../../hooks/__internal__/useFormSpacing";
|
|
19
|
+
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
19
20
|
let deprecateInputRefWarnTriggered = false;
|
|
20
21
|
const FilterableSelectList = withFilter(SelectList);
|
|
21
22
|
const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
22
23
|
value,
|
|
23
24
|
defaultValue,
|
|
24
25
|
id,
|
|
26
|
+
label,
|
|
25
27
|
name,
|
|
26
28
|
disabled,
|
|
27
29
|
readOnly,
|
|
@@ -57,7 +59,6 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
57
59
|
const [activeDescendantId, setActiveDescendantId] = useState();
|
|
58
60
|
const selectListId = useRef(guid());
|
|
59
61
|
const accessibilityLabelId = useRef(guid());
|
|
60
|
-
const labelId = useRef(guid());
|
|
61
62
|
const containerRef = useRef();
|
|
62
63
|
const listboxRef = useRef();
|
|
63
64
|
const isInputFocused = useRef(false);
|
|
@@ -72,6 +73,13 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
72
73
|
const [highlightedValue, setHighlightedValue] = useState("");
|
|
73
74
|
const [filterText, setFilterText] = useState("");
|
|
74
75
|
const [placeholderOverride, setPlaceholderOverride] = useState();
|
|
76
|
+
const inputId = useRef(id || guid());
|
|
77
|
+
const {
|
|
78
|
+
labelId
|
|
79
|
+
} = useInputAccessibility({
|
|
80
|
+
id: inputId.current,
|
|
81
|
+
label
|
|
82
|
+
});
|
|
75
83
|
const actualValue = isControlled.current ? value : selectedValue;
|
|
76
84
|
|
|
77
85
|
if (!deprecateInputRefWarnTriggered && inputRef) {
|
|
@@ -402,9 +410,10 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
402
410
|
|
|
403
411
|
function getTextboxProps() {
|
|
404
412
|
return {
|
|
405
|
-
id,
|
|
413
|
+
id: inputId.current,
|
|
406
414
|
name,
|
|
407
415
|
disabled,
|
|
416
|
+
label,
|
|
408
417
|
readOnly,
|
|
409
418
|
placeholder: placeholderOverride,
|
|
410
419
|
leftChildren: mapValuesToPills,
|
|
@@ -429,7 +438,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
429
438
|
const selectList = /*#__PURE__*/React.createElement(FilterableSelectList, {
|
|
430
439
|
ref: listboxRef,
|
|
431
440
|
id: selectListId.current,
|
|
432
|
-
labelId: labelId
|
|
441
|
+
labelId: labelId,
|
|
433
442
|
anchorElement: textboxRef && textboxRef.parentElement,
|
|
434
443
|
onSelect: onSelectOption,
|
|
435
444
|
onSelectListClose: onSelectListClose,
|
|
@@ -471,7 +480,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
471
480
|
"aria-controls": selectListId.current,
|
|
472
481
|
hasTextCursor: true,
|
|
473
482
|
isOpen: isOpen,
|
|
474
|
-
labelId: labelId
|
|
483
|
+
labelId: labelId,
|
|
475
484
|
textboxRef: textboxRef
|
|
476
485
|
}, getTextboxProps()))), selectList);
|
|
477
486
|
});
|
|
@@ -29,6 +29,7 @@ const SelectTextbox = /*#__PURE__*/React.forwardRef(({
|
|
|
29
29
|
value,
|
|
30
30
|
disabled,
|
|
31
31
|
isOpen,
|
|
32
|
+
id,
|
|
32
33
|
readOnly,
|
|
33
34
|
placeholder,
|
|
34
35
|
size = "medium",
|
|
@@ -88,6 +89,7 @@ const SelectTextbox = /*#__PURE__*/React.forwardRef(({
|
|
|
88
89
|
function getTextboxProps() {
|
|
89
90
|
return {
|
|
90
91
|
disabled,
|
|
92
|
+
id,
|
|
91
93
|
readOnly,
|
|
92
94
|
required,
|
|
93
95
|
onClick: handleTextboxClick,
|
|
@@ -14,11 +14,13 @@ import isExpectedOption from "../utils/is-expected-option";
|
|
|
14
14
|
import isNavigationKey from "../utils/is-navigation-key";
|
|
15
15
|
import Logger from "../../../__internal__/utils/logger";
|
|
16
16
|
import useFormSpacing from "../../../hooks/__internal__/useFormSpacing";
|
|
17
|
+
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
17
18
|
let deprecateInputRefWarnTriggered = false;
|
|
18
19
|
const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
19
20
|
value,
|
|
20
21
|
defaultValue,
|
|
21
22
|
id,
|
|
23
|
+
label,
|
|
22
24
|
name,
|
|
23
25
|
disabled,
|
|
24
26
|
readOnly,
|
|
@@ -49,7 +51,6 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
49
51
|
...props
|
|
50
52
|
}, ref) => {
|
|
51
53
|
const selectListId = useRef(guid());
|
|
52
|
-
const labelId = useRef(guid());
|
|
53
54
|
const containerRef = useRef();
|
|
54
55
|
const listboxRef = useRef();
|
|
55
56
|
const filterTimer = useRef();
|
|
@@ -63,6 +64,13 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
63
64
|
const [activeDescendantId, setActiveDescendantId] = useState();
|
|
64
65
|
const [textValue, setTextValue] = useState("");
|
|
65
66
|
const [selectedValue, setSelectedValue] = useState(value || defaultValue || "");
|
|
67
|
+
const inputId = useRef(id || guid());
|
|
68
|
+
const {
|
|
69
|
+
labelId
|
|
70
|
+
} = useInputAccessibility({
|
|
71
|
+
id: inputId.current,
|
|
72
|
+
label
|
|
73
|
+
});
|
|
66
74
|
|
|
67
75
|
if (!deprecateInputRefWarnTriggered && inputRef) {
|
|
68
76
|
deprecateInputRefWarnTriggered = true;
|
|
@@ -314,7 +322,7 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
314
322
|
|
|
315
323
|
function getTextboxProps() {
|
|
316
324
|
return {
|
|
317
|
-
id,
|
|
325
|
+
id: inputId.current,
|
|
318
326
|
name,
|
|
319
327
|
disabled,
|
|
320
328
|
readOnly,
|
|
@@ -323,6 +331,8 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
323
331
|
formattedValue: textValue,
|
|
324
332
|
onClick: handleTextboxClick,
|
|
325
333
|
iconOnClick: handleDropdownIconClick,
|
|
334
|
+
label,
|
|
335
|
+
labelId,
|
|
326
336
|
onMouseDown: handleTextboxMouseDown,
|
|
327
337
|
onFocus: handleTextboxFocus,
|
|
328
338
|
onKeyDown: handleTextboxKeydown,
|
|
@@ -337,7 +347,7 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
337
347
|
const selectList = /*#__PURE__*/React.createElement(SelectList, {
|
|
338
348
|
ref: listboxRef,
|
|
339
349
|
id: selectListId.current,
|
|
340
|
-
labelId: labelId
|
|
350
|
+
labelId: labelId,
|
|
341
351
|
anchorElement: textboxRef && textboxRef.parentElement,
|
|
342
352
|
onSelect: onSelectOption,
|
|
343
353
|
onMouseDown: handleListMouseDown,
|
|
@@ -370,7 +380,6 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
370
380
|
}, /*#__PURE__*/React.createElement(SelectTextbox, _extends({
|
|
371
381
|
"aria-controls": selectListId.current,
|
|
372
382
|
activeDescendantId: activeDescendantId,
|
|
373
|
-
labelId: labelId.current,
|
|
374
383
|
isOpen: isOpen,
|
|
375
384
|
textboxRef: textboxRef
|
|
376
385
|
}, getTextboxProps()))), selectList);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./settings-row";
|
|
1
|
+
export { default } from "./settings-row.component";
|
|
2
|
+
export type { SettingsRowProps } from "./settings-row.component";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { HeadingType } from "../heading";
|
|
4
|
+
export interface SettingsRowProps extends MarginProps {
|
|
5
|
+
/** A title for this group of settings. */
|
|
6
|
+
title?: string;
|
|
7
|
+
/** Defines the HTML heading element of the `title` within the component. */
|
|
8
|
+
headingType?: HeadingType;
|
|
9
|
+
/** Content to be rendered inside the component. */
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
/** A string or JSX object that provides a short description about the group of settings. */
|
|
12
|
+
description?: React.ReactNode;
|
|
13
|
+
/** Shows a divider below the component. */
|
|
14
|
+
divider?: boolean;
|
|
15
|
+
/** The CSS classes to apply to the component. */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const SettingsRow: {
|
|
19
|
+
({ title, headingType, children, description, divider, className, ...rest }: SettingsRowProps): JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
export default SettingsRow;
|
|
@@ -2,20 +2,18 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
5
|
import Heading from "../heading";
|
|
7
6
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
8
7
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
9
8
|
import { StyledSettingsRow, StyledSettingsRowHeader, StyledSettingsRowInput } from "./settings-row.style";
|
|
10
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
11
9
|
|
|
12
10
|
const SettingsRow = ({
|
|
13
11
|
title,
|
|
14
12
|
headingType = "h3",
|
|
15
|
-
description,
|
|
16
13
|
children,
|
|
17
|
-
|
|
14
|
+
description,
|
|
18
15
|
divider = true,
|
|
16
|
+
className,
|
|
19
17
|
...rest
|
|
20
18
|
}) => {
|
|
21
19
|
const heading = () => {
|
|
@@ -37,24 +35,168 @@ const SettingsRow = ({
|
|
|
37
35
|
}, filterStyledSystemMarginProps(rest)), /*#__PURE__*/React.createElement(StyledSettingsRowHeader, null, heading()), /*#__PURE__*/React.createElement(StyledSettingsRowInput, null, children));
|
|
38
36
|
};
|
|
39
37
|
|
|
40
|
-
SettingsRow.propTypes = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
38
|
+
SettingsRow.propTypes = {
|
|
39
|
+
"children": PropTypes.node,
|
|
40
|
+
"className": PropTypes.string,
|
|
41
|
+
"description": PropTypes.node,
|
|
42
|
+
"divider": PropTypes.bool,
|
|
43
|
+
"headingType": PropTypes.oneOf(["h1", "h2", "h3", "h4", "h5"]),
|
|
44
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
45
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
46
|
+
"description": PropTypes.string,
|
|
47
|
+
"toString": PropTypes.func.isRequired,
|
|
48
|
+
"valueOf": PropTypes.func.isRequired
|
|
49
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
50
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
51
|
+
"description": PropTypes.string,
|
|
52
|
+
"toString": PropTypes.func.isRequired,
|
|
53
|
+
"valueOf": PropTypes.func.isRequired
|
|
54
|
+
}), PropTypes.string]),
|
|
55
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
56
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
57
|
+
"description": PropTypes.string,
|
|
58
|
+
"toString": PropTypes.func.isRequired,
|
|
59
|
+
"valueOf": PropTypes.func.isRequired
|
|
60
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
61
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
62
|
+
"description": PropTypes.string,
|
|
63
|
+
"toString": PropTypes.func.isRequired,
|
|
64
|
+
"valueOf": PropTypes.func.isRequired
|
|
65
|
+
}), PropTypes.string]),
|
|
66
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
67
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
68
|
+
"description": PropTypes.string,
|
|
69
|
+
"toString": PropTypes.func.isRequired,
|
|
70
|
+
"valueOf": PropTypes.func.isRequired
|
|
71
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
72
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
73
|
+
"description": PropTypes.string,
|
|
74
|
+
"toString": PropTypes.func.isRequired,
|
|
75
|
+
"valueOf": PropTypes.func.isRequired
|
|
76
|
+
}), PropTypes.string]),
|
|
77
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
78
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
79
|
+
"description": PropTypes.string,
|
|
80
|
+
"toString": PropTypes.func.isRequired,
|
|
81
|
+
"valueOf": PropTypes.func.isRequired
|
|
82
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
83
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
84
|
+
"description": PropTypes.string,
|
|
85
|
+
"toString": PropTypes.func.isRequired,
|
|
86
|
+
"valueOf": PropTypes.func.isRequired
|
|
87
|
+
}), PropTypes.string]),
|
|
88
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
89
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
90
|
+
"description": PropTypes.string,
|
|
91
|
+
"toString": PropTypes.func.isRequired,
|
|
92
|
+
"valueOf": PropTypes.func.isRequired
|
|
93
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
94
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
95
|
+
"description": PropTypes.string,
|
|
96
|
+
"toString": PropTypes.func.isRequired,
|
|
97
|
+
"valueOf": PropTypes.func.isRequired
|
|
98
|
+
}), PropTypes.string]),
|
|
99
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
100
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
101
|
+
"description": PropTypes.string,
|
|
102
|
+
"toString": PropTypes.func.isRequired,
|
|
103
|
+
"valueOf": PropTypes.func.isRequired
|
|
104
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
105
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
106
|
+
"description": PropTypes.string,
|
|
107
|
+
"toString": PropTypes.func.isRequired,
|
|
108
|
+
"valueOf": PropTypes.func.isRequired
|
|
109
|
+
}), PropTypes.string]),
|
|
110
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
111
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
112
|
+
"description": PropTypes.string,
|
|
113
|
+
"toString": PropTypes.func.isRequired,
|
|
114
|
+
"valueOf": PropTypes.func.isRequired
|
|
115
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
116
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
117
|
+
"description": PropTypes.string,
|
|
118
|
+
"toString": PropTypes.func.isRequired,
|
|
119
|
+
"valueOf": PropTypes.func.isRequired
|
|
120
|
+
}), PropTypes.string]),
|
|
121
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
122
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
123
|
+
"description": PropTypes.string,
|
|
124
|
+
"toString": PropTypes.func.isRequired,
|
|
125
|
+
"valueOf": PropTypes.func.isRequired
|
|
126
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
127
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
128
|
+
"description": PropTypes.string,
|
|
129
|
+
"toString": PropTypes.func.isRequired,
|
|
130
|
+
"valueOf": PropTypes.func.isRequired
|
|
131
|
+
}), PropTypes.string]),
|
|
132
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
133
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
134
|
+
"description": PropTypes.string,
|
|
135
|
+
"toString": PropTypes.func.isRequired,
|
|
136
|
+
"valueOf": PropTypes.func.isRequired
|
|
137
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
138
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
139
|
+
"description": PropTypes.string,
|
|
140
|
+
"toString": PropTypes.func.isRequired,
|
|
141
|
+
"valueOf": PropTypes.func.isRequired
|
|
142
|
+
}), PropTypes.string]),
|
|
143
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
144
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
145
|
+
"description": PropTypes.string,
|
|
146
|
+
"toString": PropTypes.func.isRequired,
|
|
147
|
+
"valueOf": PropTypes.func.isRequired
|
|
148
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
149
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
150
|
+
"description": PropTypes.string,
|
|
151
|
+
"toString": PropTypes.func.isRequired,
|
|
152
|
+
"valueOf": PropTypes.func.isRequired
|
|
153
|
+
}), PropTypes.string]),
|
|
154
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
155
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
156
|
+
"description": PropTypes.string,
|
|
157
|
+
"toString": PropTypes.func.isRequired,
|
|
158
|
+
"valueOf": PropTypes.func.isRequired
|
|
159
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
160
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
161
|
+
"description": PropTypes.string,
|
|
162
|
+
"toString": PropTypes.func.isRequired,
|
|
163
|
+
"valueOf": PropTypes.func.isRequired
|
|
164
|
+
}), PropTypes.string]),
|
|
165
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
166
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
167
|
+
"description": PropTypes.string,
|
|
168
|
+
"toString": PropTypes.func.isRequired,
|
|
169
|
+
"valueOf": PropTypes.func.isRequired
|
|
170
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
171
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
172
|
+
"description": PropTypes.string,
|
|
173
|
+
"toString": PropTypes.func.isRequired,
|
|
174
|
+
"valueOf": PropTypes.func.isRequired
|
|
175
|
+
}), PropTypes.string]),
|
|
176
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
177
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
178
|
+
"description": PropTypes.string,
|
|
179
|
+
"toString": PropTypes.func.isRequired,
|
|
180
|
+
"valueOf": PropTypes.func.isRequired
|
|
181
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
182
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
183
|
+
"description": PropTypes.string,
|
|
184
|
+
"toString": PropTypes.func.isRequired,
|
|
185
|
+
"valueOf": PropTypes.func.isRequired
|
|
186
|
+
}), PropTypes.string]),
|
|
187
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
188
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
189
|
+
"description": PropTypes.string,
|
|
190
|
+
"toString": PropTypes.func.isRequired,
|
|
191
|
+
"valueOf": PropTypes.func.isRequired
|
|
192
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
193
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
194
|
+
"description": PropTypes.string,
|
|
195
|
+
"toString": PropTypes.func.isRequired,
|
|
196
|
+
"valueOf": PropTypes.func.isRequired
|
|
197
|
+
}), PropTypes.string]),
|
|
198
|
+
"title": PropTypes.string
|
|
59
199
|
};
|
|
200
|
+
export { SettingsRow };
|
|
201
|
+
SettingsRow.displayName = "SettingsRow";
|
|
60
202
|
export default SettingsRow;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface DividerProps {
|
|
2
|
+
hasDivider: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare const StyledSettingsRow: import("styled-components").StyledComponent<"div", any, DividerProps, never>;
|
|
5
|
+
export declare const StyledSettingsRowHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const StyledSettingsRowInput: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export {};
|
|
@@ -4,6 +4,8 @@ import { IconType } from "../icon";
|
|
|
4
4
|
import { ValidationProps } from "../../__internal__/validations";
|
|
5
5
|
import { CommonInputProps } from "../../__internal__/input";
|
|
6
6
|
export interface TextareaProps extends ValidationProps, MarginProps, Omit<CommonInputProps, "size"> {
|
|
7
|
+
/** Prop to specify the aria-labelledby property of the component */
|
|
8
|
+
"aria-labelledby"?: string;
|
|
7
9
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
8
10
|
"data-component"?: string;
|
|
9
11
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
@@ -21,6 +21,7 @@ import useFormSpacing from "../../hooks/__internal__/useFormSpacing"; // TODO: C
|
|
|
21
21
|
|
|
22
22
|
let deprecateInputRefWarnTriggered = false;
|
|
23
23
|
const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
24
|
+
"aria-labelledby": ariaLabelledBy,
|
|
24
25
|
autoFocus,
|
|
25
26
|
fieldHelp,
|
|
26
27
|
label,
|
|
@@ -105,8 +106,7 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
|
105
106
|
labelId,
|
|
106
107
|
validationIconId,
|
|
107
108
|
fieldHelpId,
|
|
108
|
-
ariaDescribedBy
|
|
109
|
-
ariaLabelledBy
|
|
109
|
+
ariaDescribedBy
|
|
110
110
|
} = useInputAccessibility({
|
|
111
111
|
id,
|
|
112
112
|
error,
|
|
@@ -4,6 +4,8 @@ import { CommonInputProps } from "../../__internal__/input";
|
|
|
4
4
|
import { ValidationProps } from "../../__internal__/validations";
|
|
5
5
|
import { IconType } from "../icon";
|
|
6
6
|
export interface CommonTextboxProps extends ValidationProps, MarginProps, Omit<CommonInputProps, "size"> {
|
|
7
|
+
/** Prop to specify the aria-labelledby property of the component */
|
|
8
|
+
"aria-labelledby"?: string;
|
|
7
9
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
8
10
|
"data-component"?: string;
|
|
9
11
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
@@ -21,7 +23,11 @@ export interface CommonTextboxProps extends ValidationProps, MarginProps, Omit<C
|
|
|
21
23
|
* real value is an ID but you want to show a human-readable version.
|
|
22
24
|
*/
|
|
23
25
|
formattedValue?: string;
|
|
24
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Unique identifier for the input.
|
|
28
|
+
* Label id will be based on it, using following pattern: <id>-label.
|
|
29
|
+
* Will use a randomly generated GUID if none is provided.
|
|
30
|
+
*/
|
|
25
31
|
id?: string;
|
|
26
32
|
/** Type of the icon that will be rendered next to the input */
|
|
27
33
|
inputIcon?: IconType;
|
|
@@ -84,8 +90,6 @@ export interface TextboxProps extends CommonTextboxProps {
|
|
|
84
90
|
isOptional?: boolean;
|
|
85
91
|
/** Container for DatePicker or SelectList components */
|
|
86
92
|
positionedChildren?: React.ReactNode;
|
|
87
|
-
/** Label id passed from Select component */
|
|
88
|
-
labelId?: string;
|
|
89
93
|
/** Character limit of the textarea */
|
|
90
94
|
characterLimit?: string | number;
|
|
91
95
|
/** Stop the user typing over the characterLimit */
|
|
@@ -20,13 +20,13 @@ import Box from "../box";
|
|
|
20
20
|
import Logger from "../../__internal__/utils/logger";
|
|
21
21
|
let deprecateInputRefWarnTriggered = false;
|
|
22
22
|
const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
23
|
+
"aria-labelledby": ariaLabelledBy,
|
|
23
24
|
align = "left",
|
|
24
25
|
autoFocus,
|
|
25
26
|
children,
|
|
26
27
|
disabled,
|
|
27
28
|
inputIcon,
|
|
28
29
|
leftChildren,
|
|
29
|
-
labelId: externalLabelId,
|
|
30
30
|
label,
|
|
31
31
|
labelAlign,
|
|
32
32
|
labelHelp,
|
|
@@ -94,7 +94,7 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
const {
|
|
97
|
-
labelId
|
|
97
|
+
labelId,
|
|
98
98
|
validationIconId,
|
|
99
99
|
fieldHelpId,
|
|
100
100
|
ariaDescribedBy
|
|
@@ -106,7 +106,6 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
|
106
106
|
label,
|
|
107
107
|
fieldHelp
|
|
108
108
|
});
|
|
109
|
-
const labelId = label ? externalLabelId || internalLabelId : "";
|
|
110
109
|
const hasIconInside = !!(inputIcon || validationIconId && !validationOnLabel);
|
|
111
110
|
const input = /*#__PURE__*/React.createElement(InputPresentation, {
|
|
112
111
|
align: align,
|
|
@@ -128,7 +127,7 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
|
128
127
|
}, {
|
|
129
128
|
align: align,
|
|
130
129
|
"aria-invalid": !!error,
|
|
131
|
-
"aria-labelledby":
|
|
130
|
+
"aria-labelledby": ariaLabelledBy,
|
|
132
131
|
"aria-describedby": validationRedesignOptIn ? undefined : ariaDescribedBy,
|
|
133
132
|
autoFocus: autoFocus,
|
|
134
133
|
deferTimeout: deferTimeout,
|
|
@@ -319,7 +318,6 @@ Textbox.propTypes = {
|
|
|
319
318
|
"label": PropTypes.string,
|
|
320
319
|
"labelAlign": PropTypes.oneOf(["left", "right"]),
|
|
321
320
|
"labelHelp": PropTypes.node,
|
|
322
|
-
"labelId": PropTypes.string,
|
|
323
321
|
"labelInline": PropTypes.bool,
|
|
324
322
|
"labelSpacing": PropTypes.oneOf([1, 2]),
|
|
325
323
|
"labelWidth": PropTypes.number,
|
|
@@ -10,12 +10,10 @@ export default function useInputAccessibility({
|
|
|
10
10
|
const validationIconId = [error, warning, info].filter(validation => validation && typeof validation === "string").length ? `${id}-validation-icon` : undefined;
|
|
11
11
|
const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
|
|
12
12
|
const ariaDescribedBy = [fieldHelpId, validationIconId].filter(Boolean).join(" ");
|
|
13
|
-
const ariaLabelledBy = labelId;
|
|
14
13
|
return {
|
|
15
14
|
labelId,
|
|
16
15
|
validationIconId,
|
|
17
16
|
fieldHelpId,
|
|
18
|
-
ariaDescribedBy
|
|
19
|
-
ariaLabelledBy
|
|
17
|
+
ariaDescribedBy
|
|
20
18
|
};
|
|
21
19
|
}
|
|
@@ -29,7 +29,7 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
|
|
|
29
29
|
reverse?: boolean;
|
|
30
30
|
/** Size of the component */
|
|
31
31
|
size?: "small" | "large";
|
|
32
|
-
/**
|
|
32
|
+
/** Prop to specify the aria-labelledby attribute of the input */
|
|
33
33
|
ariaLabelledBy?: string;
|
|
34
34
|
/** When true, displays validation icon on label */
|
|
35
35
|
validationOnLabel?: boolean;
|
|
@@ -30,7 +30,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
30
30
|
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); }
|
|
31
31
|
|
|
32
32
|
const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
33
|
-
ariaLabelledBy
|
|
33
|
+
ariaLabelledBy,
|
|
34
34
|
autoFocus,
|
|
35
35
|
checked,
|
|
36
36
|
children,
|
|
@@ -66,8 +66,7 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
66
66
|
labelId,
|
|
67
67
|
fieldHelpId,
|
|
68
68
|
validationIconId,
|
|
69
|
-
ariaDescribedBy
|
|
70
|
-
ariaLabelledBy
|
|
69
|
+
ariaDescribedBy
|
|
71
70
|
} = (0, _useInputAccessibility.default)({
|
|
72
71
|
id,
|
|
73
72
|
error,
|
|
@@ -103,7 +102,7 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
103
102
|
};
|
|
104
103
|
const inputProps = {
|
|
105
104
|
"aria-describedby": ariaDescribedBy,
|
|
106
|
-
"aria-labelledby":
|
|
105
|
+
"aria-labelledby": ariaLabelledBy,
|
|
107
106
|
"aria-invalid": !!error,
|
|
108
107
|
autoFocus,
|
|
109
108
|
checked,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface CommonHiddenCheckableInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "size" | "type"> {
|
|
3
|
+
/** Prop to specify the aria-labelledby attribute of the input */
|
|
4
|
+
ariaLabelledBy?: string;
|
|
3
5
|
/** If true the Component will be focused when page load */
|
|
4
6
|
autoFocus?: boolean;
|
|
5
7
|
/** Checked state of the input */
|
|
@@ -22,6 +22,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
22
22
|
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); }
|
|
23
23
|
|
|
24
24
|
const HiddenCheckableInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
25
|
+
ariaLabelledBy,
|
|
25
26
|
name,
|
|
26
27
|
checked,
|
|
27
28
|
type,
|
|
@@ -35,8 +36,7 @@ const HiddenCheckableInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
35
36
|
onBlur,
|
|
36
37
|
onFocus,
|
|
37
38
|
onMouseEnter,
|
|
38
|
-
onMouseLeave
|
|
39
|
-
ariaLabelledBy
|
|
39
|
+
onMouseLeave
|
|
40
40
|
} = (0, _react.useContext)(_inputBehaviour.InputContext);
|
|
41
41
|
const {
|
|
42
42
|
onBlur: onBlurGroup,
|
|
@@ -70,6 +70,7 @@ const HiddenCheckableInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
return /*#__PURE__*/_react.default.createElement(_hiddenCheckableInput.default, _extends({
|
|
73
|
+
"aria-labelledby": ariaLabelledBy,
|
|
73
74
|
autoFocus: autoFocus,
|
|
74
75
|
"aria-checked": checked,
|
|
75
76
|
checked: checked,
|
|
@@ -77,9 +78,7 @@ const HiddenCheckableInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
77
78
|
role: role || type,
|
|
78
79
|
type: type,
|
|
79
80
|
value: value
|
|
80
|
-
}, props,
|
|
81
|
-
"aria-labelledby": ariaLabelledBy
|
|
82
|
-
}, {
|
|
81
|
+
}, props, {
|
|
83
82
|
onFocus: handleFocus,
|
|
84
83
|
onBlur: handleBlur,
|
|
85
84
|
onMouseEnter: handleMouseEnter,
|
|
@@ -142,6 +141,7 @@ HiddenCheckableInput.propTypes = {
|
|
|
142
141
|
"aria-valuemin": _propTypes.default.number,
|
|
143
142
|
"aria-valuenow": _propTypes.default.number,
|
|
144
143
|
"aria-valuetext": _propTypes.default.string,
|
|
144
|
+
"ariaLabelledBy": _propTypes.default.string,
|
|
145
145
|
"autoCapitalize": _propTypes.default.string,
|
|
146
146
|
"autoComplete": _propTypes.default.string,
|
|
147
147
|
"autoCorrect": _propTypes.default.string,
|
|
@@ -45,6 +45,7 @@ function selectTextOnFocus(input) {
|
|
|
45
45
|
|
|
46
46
|
const Input = /*#__PURE__*/_react.default.forwardRef(({
|
|
47
47
|
align,
|
|
48
|
+
"aria-labelledby": ariaLabelledBy,
|
|
48
49
|
placeholder,
|
|
49
50
|
disabled,
|
|
50
51
|
readOnly,
|
|
@@ -161,7 +162,7 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
161
162
|
};
|
|
162
163
|
|
|
163
164
|
return /*#__PURE__*/_react.default.createElement(_input2.default, _extends({}, rest, {
|
|
164
|
-
"aria-labelledby":
|
|
165
|
+
"aria-labelledby": ariaLabelledBy,
|
|
165
166
|
align: align,
|
|
166
167
|
placeholder: placeholder,
|
|
167
168
|
disabled: disabled,
|