carbon-react 104.58.2 → 104.58.5
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/hidden-checkable-input.component.js +5 -2
- package/esm/__internal__/input/input.component.js +1 -0
- package/esm/__internal__/input-behaviour/input-behaviour.component.js +8 -2
- package/esm/components/alert/alert.component.d.ts +3 -49
- package/esm/components/alert/alert.component.js +244 -46
- package/esm/components/alert/index.d.ts +1 -1
- package/esm/components/carousel/carousel.component.js +1 -13
- package/esm/components/carousel/carousel.style.js +11 -2
- package/esm/components/carousel/slide/slide.component.js +1 -3
- package/esm/components/carousel/slide/slide.style.js +7 -14
- package/esm/components/checkbox/checkbox-group.component.d.ts +2 -0
- package/esm/components/checkbox/checkbox-group.component.js +9 -7
- package/esm/components/checkbox/checkbox.component.js +15 -7
- package/esm/components/dialog/dialog.component.js +1 -10
- package/esm/components/form/form.component.d.ts +1 -2
- package/esm/components/form/form.component.js +0 -10
- package/esm/components/inline-inputs/inline-inputs.component.d.ts +2 -0
- package/esm/components/inline-inputs/inline-inputs.component.js +11 -23
- package/esm/components/menu/menu-item/menu-item.component.js +4 -2
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.component.js +7 -1
- package/esm/components/step-sequence/step-sequence.component.d.ts +2 -0
- package/esm/components/step-sequence/step-sequence.component.js +7 -4
- package/esm/components/typography/typography.component.d.ts +1 -1
- package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +2 -0
- package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.js +18 -2
- package/esm/hooks/__internal__/useScrollBlock/useScrollBlock.js +30 -5
- package/esm/style/themes/aegean/aegean-theme.config.d.ts +2 -1
- package/esm/style/themes/aegean/aegean-theme.config.js +2 -1
- package/esm/style/themes/mint/mint-theme.config.d.ts +2 -1
- package/esm/style/themes/mint/mint-theme.config.js +2 -1
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +5 -2
- package/lib/__internal__/input/input.component.js +1 -0
- package/lib/__internal__/input-behaviour/input-behaviour.component.js +13 -2
- package/lib/components/alert/alert.component.d.ts +3 -49
- package/lib/components/alert/alert.component.js +139 -54
- package/lib/components/alert/index.d.ts +1 -1
- package/lib/components/carousel/carousel.component.js +1 -14
- package/lib/components/carousel/carousel.style.js +12 -2
- package/lib/components/carousel/slide/slide.component.js +1 -3
- package/lib/components/carousel/slide/slide.style.js +7 -14
- package/lib/components/checkbox/checkbox-group.component.d.ts +2 -0
- package/lib/components/checkbox/checkbox-group.component.js +13 -8
- package/lib/components/checkbox/checkbox.component.js +20 -7
- package/lib/components/dialog/dialog.component.js +1 -11
- package/lib/components/form/form.component.d.ts +1 -2
- package/lib/components/form/form.component.js +0 -10
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +2 -0
- package/lib/components/inline-inputs/inline-inputs.component.js +12 -21
- package/lib/components/menu/menu-item/menu-item.component.js +4 -2
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.component.js +13 -2
- package/lib/components/step-sequence/step-sequence.component.d.ts +2 -0
- package/lib/components/step-sequence/step-sequence.component.js +11 -6
- package/lib/components/typography/typography.component.d.ts +1 -1
- package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +2 -0
- package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.js +18 -2
- package/lib/hooks/__internal__/useScrollBlock/useScrollBlock.js +29 -4
- package/lib/style/themes/aegean/aegean-theme.config.d.ts +2 -1
- package/lib/style/themes/aegean/aegean-theme.config.js +2 -1
- package/lib/style/themes/mint/mint-theme.config.d.ts +2 -1
- package/lib/style/themes/mint/mint-theme.config.js +2 -1
- package/package.json +1 -1
- package/esm/components/alert/alert.d.ts +0 -5
- package/lib/components/alert/alert.d.ts +0 -5
|
@@ -17,7 +17,6 @@ const Form = ({
|
|
|
17
17
|
onSubmit,
|
|
18
18
|
buttonAlignment = "right",
|
|
19
19
|
stickyFooter,
|
|
20
|
-
dialogRef,
|
|
21
20
|
fieldSpacing = 3,
|
|
22
21
|
noValidate = true,
|
|
23
22
|
height,
|
|
@@ -92,15 +91,6 @@ Form.propTypes = { ...styledSystemPropTypes.space,
|
|
|
92
91
|
/** Disable HTML5 validation */
|
|
93
92
|
noValidate: PropTypes.bool,
|
|
94
93
|
|
|
95
|
-
/**
|
|
96
|
-
* @private
|
|
97
|
-
* @ignore
|
|
98
|
-
* Used to detect if FormFooter should be sticky when used in Dialog component
|
|
99
|
-
*/
|
|
100
|
-
dialogRef: PropTypes.shape({
|
|
101
|
-
current: PropTypes.any
|
|
102
|
-
}),
|
|
103
|
-
|
|
104
94
|
/** Height of the form (any valid CSS value) */
|
|
105
95
|
height: PropTypes.string
|
|
106
96
|
};
|
|
@@ -3,23 +3,18 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import Label from "../../__internal__/label";
|
|
4
4
|
import StyledInlineInputs, { StyledContentContainer, StyledInlineInput } from "./inline-inputs.style";
|
|
5
5
|
import createGuid from "../../__internal__/utils/helpers/guid";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// Input is never going to be re-ordered so we don't require a defined key
|
|
16
|
-
|
|
17
|
-
/* eslint-disable react/no-array-index-key */
|
|
18
|
-
return /*#__PURE__*/React.createElement(StyledInlineInput, {
|
|
19
|
-
key: index,
|
|
6
|
+
export const InlineInputsContext = /*#__PURE__*/React.createContext({});
|
|
7
|
+
|
|
8
|
+
const columnWrapper = (children, gutter, labelId) => {
|
|
9
|
+
return React.Children.map(children, input => {
|
|
10
|
+
return /*#__PURE__*/React.createElement(InlineInputsContext.Provider, {
|
|
11
|
+
value: {
|
|
12
|
+
ariaLabelledBy: labelId
|
|
13
|
+
}
|
|
14
|
+
}, /*#__PURE__*/React.createElement(StyledInlineInput, {
|
|
20
15
|
gutter: gutter,
|
|
21
16
|
"data-element": "inline-input"
|
|
22
|
-
}, input);
|
|
17
|
+
}, input));
|
|
23
18
|
});
|
|
24
19
|
};
|
|
25
20
|
|
|
@@ -44,13 +39,6 @@ const InlineInputs = props => {
|
|
|
44
39
|
}, label);
|
|
45
40
|
}
|
|
46
41
|
|
|
47
|
-
function renderChildren() {
|
|
48
|
-
if (!label) return children;
|
|
49
|
-
return React.Children.map(children, child => /*#__PURE__*/React.cloneElement(child, {
|
|
50
|
-
"aria-labelledby": labelId.current
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
42
|
return /*#__PURE__*/React.createElement(StyledInlineInputs, {
|
|
55
43
|
gutter: gutter,
|
|
56
44
|
"data-component": "inline-inputs",
|
|
@@ -60,7 +48,7 @@ const InlineInputs = props => {
|
|
|
60
48
|
gutter: gutter,
|
|
61
49
|
"data-element": "inline-inputs-container",
|
|
62
50
|
inputWidth: inputWidth
|
|
63
|
-
}, columnWrapper(
|
|
51
|
+
}, columnWrapper(children, gutter, label ? labelId.current : undefined)));
|
|
64
52
|
}; // Assign props over for demo site
|
|
65
53
|
|
|
66
54
|
|
|
@@ -109,6 +109,8 @@ const MenuItem = ({
|
|
|
109
109
|
|
|
110
110
|
const getTitle = title => maxWidth && typeof title === "string" ? title : "";
|
|
111
111
|
|
|
112
|
+
const itemMaxWidth = !inFullscreenView ? maxWidth : undefined;
|
|
113
|
+
|
|
112
114
|
if (submenu) {
|
|
113
115
|
const asPassiveItem = !(onClick || href);
|
|
114
116
|
return /*#__PURE__*/React.createElement(StyledMenuItem, _extends({
|
|
@@ -116,7 +118,7 @@ const MenuItem = ({
|
|
|
116
118
|
menuType: menuContext.menuType,
|
|
117
119
|
display: "inline-block",
|
|
118
120
|
title: getTitle(submenu),
|
|
119
|
-
maxWidth:
|
|
121
|
+
maxWidth: itemMaxWidth,
|
|
120
122
|
onClick: updateFocusOnClick
|
|
121
123
|
}, rest, {
|
|
122
124
|
inFullscreenView: inFullscreenView
|
|
@@ -140,7 +142,7 @@ const MenuItem = ({
|
|
|
140
142
|
inSubmenu: submenuContext.handleKeyDown !== undefined,
|
|
141
143
|
display: "inline-block",
|
|
142
144
|
title: getTitle(children),
|
|
143
|
-
maxWidth:
|
|
145
|
+
maxWidth: itemMaxWidth
|
|
144
146
|
}, rest, {
|
|
145
147
|
inFullscreenView: inFullscreenView && !Object.keys(submenuContext).length,
|
|
146
148
|
menuOpen: menuOpen
|
|
@@ -1,14 +1,19 @@
|
|
|
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, { useContext } from "react";
|
|
3
4
|
import PropTypes from "prop-types";
|
|
4
|
-
import React from "react";
|
|
5
5
|
import StepSequenceItemStyle from "./step-sequence-item.style";
|
|
6
6
|
import StepSequenceItemContentStyle from "./step-sequence-item-content.style";
|
|
7
7
|
import StepSequenceItemIndicatorStyle from "./step-sequence-item-indicator.style";
|
|
8
8
|
import StepSequenceItemHiddenLabelStyle from "./step-sequence-item-hidden-label.style";
|
|
9
9
|
import Icon from "../../icon";
|
|
10
|
+
import { StepSequenceContext } from "../step-sequence.component";
|
|
10
11
|
|
|
11
12
|
const StepSequenceItem = props => {
|
|
13
|
+
const {
|
|
14
|
+
orientation
|
|
15
|
+
} = useContext(StepSequenceContext);
|
|
16
|
+
|
|
12
17
|
const indicatorText = () => {
|
|
13
18
|
return !props.hideIndicator ? /*#__PURE__*/React.createElement(StepSequenceItemIndicatorStyle, null, props.indicator) : null;
|
|
14
19
|
};
|
|
@@ -38,6 +43,7 @@ const StepSequenceItem = props => {
|
|
|
38
43
|
return /*#__PURE__*/React.createElement(StepSequenceItemStyle, _extends({
|
|
39
44
|
"data-component": "step-sequence-item"
|
|
40
45
|
}, props, {
|
|
46
|
+
orientation: orientation,
|
|
41
47
|
key: `step-seq-item-${props.indicator}`
|
|
42
48
|
}), hiddenLabel(), /*#__PURE__*/React.createElement(StepSequenceItemContentStyle, null, icon(), /*#__PURE__*/React.createElement("span", null, props.children)));
|
|
43
49
|
};
|
|
@@ -1,18 +1,21 @@
|
|
|
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 PropTypes from "prop-types";
|
|
4
3
|
import React from "react";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
5
|
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
6
|
import StepSequenceStyle from "./step-sequence.style";
|
|
7
7
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
8
|
+
export const StepSequenceContext = /*#__PURE__*/React.createContext({});
|
|
8
9
|
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
9
10
|
|
|
10
11
|
const StepSequence = props => {
|
|
11
12
|
return /*#__PURE__*/React.createElement(StepSequenceStyle, _extends({
|
|
12
13
|
"data-component": "step-sequence"
|
|
13
|
-
}, props),
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
}, props), /*#__PURE__*/React.createElement(StepSequenceContext.Provider, {
|
|
15
|
+
value: {
|
|
16
|
+
orientation: props.orientation
|
|
17
|
+
}
|
|
18
|
+
}, props.children));
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
StepSequence.propTypes = { ...marginPropTypes,
|
|
@@ -12,4 +12,4 @@ declare const Typography: import("styled-components").StyledComponent<"span", an
|
|
|
12
12
|
color: any;
|
|
13
13
|
bg: any;
|
|
14
14
|
backgroundColor: any;
|
|
15
|
-
}, "as" | "
|
|
15
|
+
}, "as" | "size" | "textDecoration" | "lineHeight" | "textTransform" | "weight" | "defaultMargin">;
|
|
@@ -5,6 +5,8 @@ declare class ScrollBlockManager {
|
|
|
5
5
|
registerComponent(id: any): void;
|
|
6
6
|
unregisterComponent(id: any): void;
|
|
7
7
|
saveOriginalValues(values: any): void;
|
|
8
|
+
saveRestoreValuesCallback(callback: any): void;
|
|
9
|
+
getRestoreValuesCallback(): any;
|
|
8
10
|
getOriginalValues(): any;
|
|
9
11
|
isBlocked(): boolean;
|
|
10
12
|
}
|
|
@@ -4,6 +4,8 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
4
4
|
|
|
5
5
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
6
6
|
|
|
7
|
+
// TODO: This component can be refactored to remove redundant code after
|
|
8
|
+
// we can confirm that all Sage products use version 105.0.0^
|
|
7
9
|
let ScrollBlockManager = /*#__PURE__*/function () {
|
|
8
10
|
function ScrollBlockManager() {
|
|
9
11
|
_classCallCheck(this, ScrollBlockManager);
|
|
@@ -13,11 +15,13 @@ let ScrollBlockManager = /*#__PURE__*/function () {
|
|
|
13
15
|
if (!window.__CARBON_INTERNALS_SCROLL_BLOCKERS) {
|
|
14
16
|
window.__CARBON_INTERNALS_SCROLL_BLOCKERS = {
|
|
15
17
|
components: {},
|
|
18
|
+
// originalValues can be removed
|
|
16
19
|
originalValues: []
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
this.components = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.components;
|
|
23
|
+
this.components = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.components; // TODO: originalValues can be removed
|
|
24
|
+
|
|
21
25
|
this.originalValues = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.originalValues;
|
|
22
26
|
}
|
|
23
27
|
|
|
@@ -30,13 +34,25 @@ let ScrollBlockManager = /*#__PURE__*/function () {
|
|
|
30
34
|
key: "unregisterComponent",
|
|
31
35
|
value: function unregisterComponent(id) {
|
|
32
36
|
delete this.components[id];
|
|
33
|
-
}
|
|
37
|
+
} // TODO: saveOriginalValues can be removed
|
|
38
|
+
|
|
34
39
|
}, {
|
|
35
40
|
key: "saveOriginalValues",
|
|
36
41
|
value: function saveOriginalValues(values) {
|
|
37
42
|
this.originalValues.length = 0;
|
|
38
43
|
this.originalValues.push(...values);
|
|
39
44
|
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "saveRestoreValuesCallback",
|
|
47
|
+
value: function saveRestoreValuesCallback(callback) {
|
|
48
|
+
window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues = callback;
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "getRestoreValuesCallback",
|
|
52
|
+
value: function getRestoreValuesCallback() {
|
|
53
|
+
return window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues;
|
|
54
|
+
} // TODO: getOriginalValues can be removed
|
|
55
|
+
|
|
40
56
|
}, {
|
|
41
57
|
key: "getOriginalValues",
|
|
42
58
|
value: function getOriginalValues() {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useRef, useCallback, useMemo } from "react";
|
|
2
2
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
3
|
-
import ScrollBlockManager from "./scroll-block-manager";
|
|
3
|
+
import ScrollBlockManager from "./scroll-block-manager"; // TODO: This component can be refactored to remove redundant code after
|
|
4
|
+
// we can confirm that all Sage products use version 105.0.0^
|
|
5
|
+
|
|
4
6
|
const scrollBlockManager = new ScrollBlockManager();
|
|
5
7
|
/* istanbul ignore next */
|
|
6
8
|
|
|
@@ -10,6 +12,7 @@ const useScrollBlock = () => {
|
|
|
10
12
|
const {
|
|
11
13
|
current: containerGuid
|
|
12
14
|
} = useRef(guid());
|
|
15
|
+
const originalValuesRef = useRef();
|
|
13
16
|
const rules = useMemo(() => {
|
|
14
17
|
const {
|
|
15
18
|
documentElement,
|
|
@@ -17,7 +20,8 @@ const useScrollBlock = () => {
|
|
|
17
20
|
} = safeDocument;
|
|
18
21
|
const scrollBarWidth = window.innerWidth - documentElement.clientWidth;
|
|
19
22
|
const bodyPaddingRight = parseInt(window.getComputedStyle(body).getPropertyValue("padding-right")) || 0;
|
|
20
|
-
return [
|
|
23
|
+
return [// TODO: First two entries of this array with the documentElement can be removed
|
|
24
|
+
{
|
|
21
25
|
element: documentElement,
|
|
22
26
|
property: "position",
|
|
23
27
|
blockingValue: "relative"
|
|
@@ -39,6 +43,14 @@ const useScrollBlock = () => {
|
|
|
39
43
|
blockingValue: `${bodyPaddingRight + scrollBarWidth}px`
|
|
40
44
|
}];
|
|
41
45
|
}, []);
|
|
46
|
+
const restoreValues = useCallback(() => {
|
|
47
|
+
rules.forEach(({
|
|
48
|
+
element,
|
|
49
|
+
property
|
|
50
|
+
}, index) => {
|
|
51
|
+
element.style[property] = originalValuesRef.current[index];
|
|
52
|
+
});
|
|
53
|
+
}, [rules]);
|
|
42
54
|
const blockScroll = useCallback(() => {
|
|
43
55
|
const isBlocked = scrollBlockManager.isBlocked();
|
|
44
56
|
scrollBlockManager.registerComponent(containerGuid);
|
|
@@ -51,19 +63,32 @@ const useScrollBlock = () => {
|
|
|
51
63
|
element,
|
|
52
64
|
property
|
|
53
65
|
}) => element.style[property]);
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
originalValuesRef.current = originalValues;
|
|
67
|
+
scrollBlockManager.saveRestoreValuesCallback(restoreValues); // TODO: saveOriginalValues can be removed
|
|
68
|
+
|
|
69
|
+
scrollBlockManager.saveOriginalValues(originalValues); // TODO: slice san be removed
|
|
70
|
+
|
|
71
|
+
rules.slice(-3).forEach(({
|
|
56
72
|
element,
|
|
57
73
|
property,
|
|
58
74
|
blockingValue
|
|
59
75
|
}) => {
|
|
60
76
|
element.style[property] = blockingValue;
|
|
61
77
|
});
|
|
62
|
-
}, [containerGuid, rules]);
|
|
78
|
+
}, [restoreValues, containerGuid, rules]);
|
|
63
79
|
const allowScroll = useCallback(() => {
|
|
64
80
|
scrollBlockManager.unregisterComponent(containerGuid);
|
|
65
81
|
const isBlocked = scrollBlockManager.isBlocked();
|
|
66
82
|
if (isBlocked) return;
|
|
83
|
+
const restoreValuesCallback = scrollBlockManager.getRestoreValuesCallback();
|
|
84
|
+
|
|
85
|
+
if (restoreValuesCallback) {
|
|
86
|
+
restoreValuesCallback();
|
|
87
|
+
scrollBlockManager.saveRestoreValuesCallback(null);
|
|
88
|
+
return;
|
|
89
|
+
} // TODO: all of the code below can be removed from this block
|
|
90
|
+
|
|
91
|
+
|
|
67
92
|
const originalValues = scrollBlockManager.getOriginalValues();
|
|
68
93
|
rules.forEach(({
|
|
69
94
|
element,
|
|
@@ -7,9 +7,10 @@ declare function _default(palette: any): {
|
|
|
7
7
|
loadingBarBackground: any;
|
|
8
8
|
};
|
|
9
9
|
readonly compatibility: {
|
|
10
|
+
colorsActionMajor150: any;
|
|
10
11
|
colorsActionMajor500: any;
|
|
11
12
|
colorsActionMajor600: any;
|
|
12
|
-
|
|
13
|
+
colorsActionMajor700: any;
|
|
13
14
|
colorsComponentsMenuAutumnStandard600: any;
|
|
14
15
|
colorsComponentsMenuSpringChild600: any;
|
|
15
16
|
colorsComponentsMenuAutumnChild600: any;
|
|
@@ -10,9 +10,10 @@ export default (palette => {
|
|
|
10
10
|
|
|
11
11
|
get compatibility() {
|
|
12
12
|
return {
|
|
13
|
+
colorsActionMajor150: this.colors.loadingBarBackground,
|
|
13
14
|
colorsActionMajor500: this.colors.primary,
|
|
14
15
|
colorsActionMajor600: this.colors.secondary,
|
|
15
|
-
|
|
16
|
+
colorsActionMajor700: this.colors.tertiary,
|
|
16
17
|
colorsComponentsMenuAutumnStandard600: this.colors.primary,
|
|
17
18
|
colorsComponentsMenuSpringChild600: this.colors.primary,
|
|
18
19
|
colorsComponentsMenuAutumnChild600: this.colors.primary,
|
|
@@ -7,9 +7,10 @@ declare function _default(palette: any): {
|
|
|
7
7
|
loadingBarBackground: any;
|
|
8
8
|
};
|
|
9
9
|
readonly compatibility: {
|
|
10
|
+
colorsActionMajor150: any;
|
|
10
11
|
colorsActionMajor500: any;
|
|
11
12
|
colorsActionMajor600: any;
|
|
12
|
-
|
|
13
|
+
colorsActionMajor700: any;
|
|
13
14
|
colorsComponentsMenuAutumnStandard600: any;
|
|
14
15
|
colorsComponentsMenuSpringChild600: any;
|
|
15
16
|
colorsComponentsMenuAutumnChild600: any;
|
|
@@ -10,9 +10,10 @@ export default (palette => {
|
|
|
10
10
|
|
|
11
11
|
get compatibility() {
|
|
12
12
|
return {
|
|
13
|
+
colorsActionMajor150: this.colors.loadingBarBackground,
|
|
13
14
|
colorsActionMajor500: this.colors.primary,
|
|
14
15
|
colorsActionMajor600: this.colors.secondary,
|
|
15
|
-
|
|
16
|
+
colorsActionMajor700: this.colors.tertiary,
|
|
16
17
|
colorsComponentsMenuAutumnStandard600: this.colors.primary,
|
|
17
18
|
colorsComponentsMenuSpringChild600: this.colors.primary,
|
|
18
19
|
colorsComponentsMenuAutumnChild600: this.colors.primary,
|
|
@@ -36,7 +36,8 @@ const HiddenCheckableInput = ({
|
|
|
36
36
|
onBlur,
|
|
37
37
|
onFocus,
|
|
38
38
|
onMouseEnter,
|
|
39
|
-
onMouseLeave
|
|
39
|
+
onMouseLeave,
|
|
40
|
+
ariaLabelledBy
|
|
40
41
|
} = (0, _react.useContext)(_inputBehaviour.InputContext);
|
|
41
42
|
const {
|
|
42
43
|
onBlur: onBlurGroup,
|
|
@@ -77,7 +78,9 @@ const HiddenCheckableInput = ({
|
|
|
77
78
|
role: role || type,
|
|
78
79
|
type: type,
|
|
79
80
|
value: value
|
|
80
|
-
}, props, {
|
|
81
|
+
}, props, ariaLabelledBy && {
|
|
82
|
+
"aria-labelledby": ariaLabelledBy
|
|
83
|
+
}, {
|
|
81
84
|
onFocus: handleFocus,
|
|
82
85
|
onBlur: handleBlur,
|
|
83
86
|
onMouseEnter: handleMouseEnter,
|
|
@@ -96,6 +96,7 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
return /*#__PURE__*/_react.default.createElement(_input.default, _extends({}, rest, {
|
|
99
|
+
"aria-labelledby": context.ariaLabelledBy,
|
|
99
100
|
align: align,
|
|
100
101
|
placeholder: placeholder,
|
|
101
102
|
disabled: disabled,
|
|
@@ -5,14 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.InputBehaviour = exports.InputContext = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
+
var _inlineInputs = require("../../components/inline-inputs/inline-inputs.component");
|
|
13
|
+
|
|
12
14
|
var _useInputBehaviour = _interopRequireDefault(require("./useInputBehaviour"));
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
18
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
16
22
|
const defaultValue = {};
|
|
17
23
|
|
|
18
24
|
const InputContext = /*#__PURE__*/_react.default.createContext(defaultValue);
|
|
@@ -23,8 +29,13 @@ const InputBehaviour = ({
|
|
|
23
29
|
children
|
|
24
30
|
}) => {
|
|
25
31
|
const contextValue = (0, _useInputBehaviour.default)();
|
|
32
|
+
const {
|
|
33
|
+
ariaLabelledBy
|
|
34
|
+
} = (0, _react.useContext)(_inlineInputs.InlineInputsContext);
|
|
26
35
|
return /*#__PURE__*/_react.default.createElement(InputContext.Provider, {
|
|
27
|
-
value: contextValue
|
|
36
|
+
value: { ...contextValue,
|
|
37
|
+
ariaLabelledBy
|
|
38
|
+
}
|
|
28
39
|
}, children);
|
|
29
40
|
};
|
|
30
41
|
|
|
@@ -1,50 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DialogProps } from "../dialog/dialog";
|
|
3
|
+
export declare const Alert: ({ children, size, ...rest }: DialogProps) => JSX.Element;
|
|
1
4
|
export default Alert;
|
|
2
|
-
declare function Alert({ children, ...rest }: {
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
children: any;
|
|
5
|
-
}): JSX.Element;
|
|
6
|
-
declare namespace Alert {
|
|
7
|
-
const propTypes: {
|
|
8
|
-
/** Prop to specify the aria-describedby property of the component */
|
|
9
|
-
"aria-describedby": PropTypes.Requireable<string>;
|
|
10
|
-
/**
|
|
11
|
-
* Prop to specify the aria-label of the component.
|
|
12
|
-
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
13
|
-
*/
|
|
14
|
-
"aria-label": PropTypes.Requireable<string>;
|
|
15
|
-
/**
|
|
16
|
-
* Prop to specify the aria-labeledby property of the component
|
|
17
|
-
* To be used when the title prop is a custom React Node,
|
|
18
|
-
* or the component is labelled by an internal element other than the title.
|
|
19
|
-
*/
|
|
20
|
-
"aria-labelledby": PropTypes.Requireable<string>;
|
|
21
|
-
/** Alert content */
|
|
22
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
23
|
-
/** Controls the open state of the component */
|
|
24
|
-
open: PropTypes.Validator<boolean>;
|
|
25
|
-
/** A custom close event handler */
|
|
26
|
-
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
|
-
/** Determines if the Esc Key closes the Alert */
|
|
28
|
-
disableEscKey: PropTypes.Requireable<boolean>;
|
|
29
|
-
/** Allows developers to specify a specific height for the dialog. */
|
|
30
|
-
height: PropTypes.Requireable<string>;
|
|
31
|
-
/** Title displayed at top of Alert */
|
|
32
|
-
title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
33
|
-
/** Subtitle displayed at top of Alert */
|
|
34
|
-
subtitle: PropTypes.Requireable<string>;
|
|
35
|
-
/** Size of Alert */
|
|
36
|
-
size: PropTypes.Requireable<string>;
|
|
37
|
-
/** Determines if the close icon is shown */
|
|
38
|
-
showCloseIcon: PropTypes.Requireable<boolean>;
|
|
39
|
-
/** Optional reference to an element meant to be focused on open */
|
|
40
|
-
focusFirstElement: PropTypes.Requireable<PropTypes.InferProps<{
|
|
41
|
-
current: PropTypes.Requireable<any>;
|
|
42
|
-
}>>;
|
|
43
|
-
/** Disables auto focus functionality on child elements */
|
|
44
|
-
disableAutoFocus: PropTypes.Requireable<boolean>;
|
|
45
|
-
};
|
|
46
|
-
namespace defaultProps {
|
|
47
|
-
const size: string;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
import PropTypes from "prop-types";
|