carbon-react 104.7.1 → 104.9.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/lib/__internal__/checkable-input/checkable-input.component.js +2 -3
- package/lib/__internal__/form-field/form-field.component.d.ts +4 -1
- package/lib/__internal__/form-field/form-field.component.js +7 -2
- package/lib/__internal__/form-field/form-field.d.ts +2 -0
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.component.d.ts +3 -3
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.component.js +6 -5
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.d.ts +2 -0
- package/lib/__internal__/label/label.component.d.ts +4 -1
- package/lib/__internal__/label/label.component.js +15 -6
- package/lib/__internal__/label/label.d.ts +2 -0
- package/lib/__internal__/tooltip-provider/index.js +22 -12
- package/lib/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.style.js +14 -32
- package/lib/components/anchor-navigation/anchor-navigation.style.js +1 -15
- package/lib/components/anchor-navigation/anchor-section-divider/anchor-section-divider.style.js +1 -8
- package/lib/components/app-wrapper/app-wrapper.component.js +11 -0
- package/lib/components/dialog/dialog.component.js +4 -1
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +4 -1
- package/lib/components/help/help.component.js +1 -1
- package/lib/components/help/help.d.ts +1 -1
- package/lib/components/menu/__internal__/submenu/submenu.style.js +11 -7
- package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +3 -3
- package/lib/components/menu/menu-full-screen/menu-full-screen.style.js +48 -1
- package/lib/components/menu/menu-item/menu-item.style.js +0 -9
- package/lib/components/menu/menu-test.stories.js +132 -0
- package/lib/components/menu/menu.style.js +13 -6
- package/lib/components/sidebar/sidebar.component.js +4 -1
- package/lib/components/textarea/textarea.component.js +2 -3
- package/lib/components/textbox/textbox.component.js +4 -4
- package/lib/components/toast/toast.component.js +4 -0
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +2 -3
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +3 -4
- package/lib/locales/en-gb.js +20 -0
- package/lib/locales/locale.d.ts +23 -0
- package/lib/locales/pl-pl.js +20 -0
- package/package.json +1 -1
|
@@ -63,8 +63,8 @@ const CheckableInput = ({
|
|
|
63
63
|
} = (0, _react.useRef)(inputId || (0, _guid.default)());
|
|
64
64
|
const {
|
|
65
65
|
labelId,
|
|
66
|
-
tooltipId,
|
|
67
66
|
fieldHelpId,
|
|
67
|
+
validationIconId,
|
|
68
68
|
ariaDescribedBy,
|
|
69
69
|
ariaLabelledBy
|
|
70
70
|
} = (0, _useInputAccessibility.default)({
|
|
@@ -73,7 +73,6 @@ const CheckableInput = ({
|
|
|
73
73
|
warning,
|
|
74
74
|
info,
|
|
75
75
|
label,
|
|
76
|
-
labelHelp,
|
|
77
76
|
fieldHelp
|
|
78
77
|
});
|
|
79
78
|
const isRadio = type === "radio";
|
|
@@ -82,7 +81,6 @@ const CheckableInput = ({
|
|
|
82
81
|
error,
|
|
83
82
|
fieldHelp,
|
|
84
83
|
fieldHelpInline,
|
|
85
|
-
tooltipId,
|
|
86
84
|
fieldHelpId,
|
|
87
85
|
id,
|
|
88
86
|
info,
|
|
@@ -96,6 +94,7 @@ const CheckableInput = ({
|
|
|
96
94
|
name: id,
|
|
97
95
|
reverse,
|
|
98
96
|
warning,
|
|
97
|
+
validationIconId,
|
|
99
98
|
// We don't want an asterisk on each radio control, only the legend
|
|
100
99
|
// However, we still want the input element to receive the required prop
|
|
101
100
|
isRequired: isRadio ? undefined : required,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default FormField;
|
|
2
|
-
declare function FormField({ children, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, helpTabIndex, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, ...rest }: {
|
|
2
|
+
declare function FormField({ children, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, helpTabIndex, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, ...rest }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
children: any;
|
|
5
5
|
disabled: any;
|
|
@@ -25,6 +25,7 @@ declare function FormField({ children, disabled, fieldHelp: fieldHelpContent, fi
|
|
|
25
25
|
useValidationIcon: any;
|
|
26
26
|
adaptiveLabelBreakpoint: any;
|
|
27
27
|
isRequired: any;
|
|
28
|
+
validationIconId: any;
|
|
28
29
|
}): JSX.Element;
|
|
29
30
|
declare namespace FormField {
|
|
30
31
|
const propTypes: {
|
|
@@ -58,6 +59,8 @@ declare namespace FormField {
|
|
|
58
59
|
adaptiveLabelBreakpoint: PropTypes.Requireable<number>;
|
|
59
60
|
/** Flag to configure component as mandatory */
|
|
60
61
|
isRequired: PropTypes.Requireable<boolean>;
|
|
62
|
+
/** Id of the validation icon */
|
|
63
|
+
validationIconId: PropTypes.Requireable<string>;
|
|
61
64
|
};
|
|
62
65
|
}
|
|
63
66
|
import PropTypes from "prop-types";
|
|
@@ -60,6 +60,7 @@ const FormField = ({
|
|
|
60
60
|
useValidationIcon,
|
|
61
61
|
adaptiveLabelBreakpoint,
|
|
62
62
|
isRequired,
|
|
63
|
+
validationIconId,
|
|
63
64
|
...rest
|
|
64
65
|
}) => {
|
|
65
66
|
const context = (0, _react.useContext)(_tab.TabContext);
|
|
@@ -103,7 +104,8 @@ const FormField = ({
|
|
|
103
104
|
useValidationIcon: useValidationIcon,
|
|
104
105
|
pr: !reverse ? labelSpacing : undefined,
|
|
105
106
|
pl: reverse ? labelSpacing : undefined,
|
|
106
|
-
isRequired: isRequired
|
|
107
|
+
isRequired: isRequired,
|
|
108
|
+
validationIconId: validationIconId
|
|
107
109
|
}, label), fieldHelpInline && fieldHelp, !reverse && children), !fieldHelpInline && fieldHelp);
|
|
108
110
|
};
|
|
109
111
|
|
|
@@ -150,7 +152,10 @@ FormField.propTypes = {
|
|
|
150
152
|
adaptiveLabelBreakpoint: _propTypes.default.number,
|
|
151
153
|
|
|
152
154
|
/** Flag to configure component as mandatory */
|
|
153
|
-
isRequired: _propTypes.default.bool
|
|
155
|
+
isRequired: _propTypes.default.bool,
|
|
156
|
+
|
|
157
|
+
/** Id of the validation icon */
|
|
158
|
+
validationIconId: _propTypes.default.string
|
|
154
159
|
};
|
|
155
160
|
var _default = FormField;
|
|
156
161
|
exports.default = _default;
|
|
@@ -33,6 +33,8 @@ export interface CommonFormFieldPropTypes
|
|
|
33
33
|
labelWidth?: number;
|
|
34
34
|
/** If true the label switches position with the input */
|
|
35
35
|
reverse?: boolean;
|
|
36
|
+
/** Id of the validation icon */
|
|
37
|
+
validationIconId?: string;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export interface FormFieldPropTypes extends CommonFormFieldPropTypes {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default InputIconToggle;
|
|
2
|
-
declare function InputIconToggle({ disabled, readOnly, size, inputIcon: type, onClick, onFocus, onBlur, onMouseDown, error, warning, info, useValidationIcon, align, iconTabIndex,
|
|
2
|
+
declare function InputIconToggle({ disabled, readOnly, size, inputIcon: type, onClick, onFocus, onBlur, onMouseDown, error, warning, info, useValidationIcon, align, iconTabIndex, validationIconId, }: {
|
|
3
3
|
disabled: any;
|
|
4
4
|
readOnly: any;
|
|
5
5
|
size: any;
|
|
@@ -14,7 +14,7 @@ declare function InputIconToggle({ disabled, readOnly, size, inputIcon: type, on
|
|
|
14
14
|
useValidationIcon: any;
|
|
15
15
|
align: any;
|
|
16
16
|
iconTabIndex: any;
|
|
17
|
-
|
|
17
|
+
validationIconId: any;
|
|
18
18
|
}): JSX.Element | null;
|
|
19
19
|
declare namespace InputIconToggle {
|
|
20
20
|
namespace propTypes {
|
|
@@ -32,7 +32,7 @@ declare namespace InputIconToggle {
|
|
|
32
32
|
const align: PropTypes.Requireable<string>;
|
|
33
33
|
const useValidationIcon: PropTypes.Requireable<boolean>;
|
|
34
34
|
const iconTabIndex: PropTypes.Requireable<number>;
|
|
35
|
-
const
|
|
35
|
+
const validationIconId: PropTypes.Requireable<string>;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
import PropTypes from "prop-types";
|
|
@@ -41,7 +41,7 @@ const InputIconToggle = ({
|
|
|
41
41
|
useValidationIcon,
|
|
42
42
|
align,
|
|
43
43
|
iconTabIndex,
|
|
44
|
-
|
|
44
|
+
validationIconId
|
|
45
45
|
}) => {
|
|
46
46
|
if (useValidationIcon && !disabled && shouldDisplayValidationIcon({
|
|
47
47
|
error,
|
|
@@ -60,7 +60,7 @@ const InputIconToggle = ({
|
|
|
60
60
|
onBlur: onBlur,
|
|
61
61
|
isPartOfInput: true,
|
|
62
62
|
tabIndex: iconTabIndex,
|
|
63
|
-
|
|
63
|
+
iconId: validationIconId,
|
|
64
64
|
tooltipPosition: align === "right" ? "left" : "right"
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
@@ -74,8 +74,7 @@ const InputIconToggle = ({
|
|
|
74
74
|
onMouseDown: onMouseDown,
|
|
75
75
|
tabIndex: iconTabIndex
|
|
76
76
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
77
|
-
type: type
|
|
78
|
-
tooltipId: tooltipId
|
|
77
|
+
type: type
|
|
79
78
|
}));
|
|
80
79
|
}
|
|
81
80
|
|
|
@@ -97,7 +96,9 @@ InputIconToggle.propTypes = {
|
|
|
97
96
|
align: _propTypes.default.oneOf(["left", "right"]),
|
|
98
97
|
useValidationIcon: _propTypes.default.bool,
|
|
99
98
|
iconTabIndex: _propTypes.default.number,
|
|
100
|
-
|
|
99
|
+
|
|
100
|
+
/** Id of the validation icon */
|
|
101
|
+
validationIconId: _propTypes.default.string
|
|
101
102
|
};
|
|
102
103
|
var _default = InputIconToggle;
|
|
103
104
|
exports.default = _default;
|
|
@@ -16,6 +16,8 @@ export interface InputIconToggleProps {
|
|
|
16
16
|
useValidationIcon?: boolean;
|
|
17
17
|
iconTabIndex?: number;
|
|
18
18
|
tooltipId?: string;
|
|
19
|
+
/** Id of the validation icon */
|
|
20
|
+
validationIconId?: string;
|
|
19
21
|
}
|
|
20
22
|
declare function InputIconToggle(props: InputIconToggleProps): JSX.Element;
|
|
21
23
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare var _default: React.MemoExoticComponent<{
|
|
2
|
-
({ disabled, inline, align, width, optional, labelId, tooltipId, children, error, warning, info, help, helpIcon, helpTabIndex, useValidationIcon, htmlFor, pr, pl, isRequired, }: {
|
|
2
|
+
({ disabled, inline, align, width, optional, labelId, tooltipId, children, error, warning, info, help, helpIcon, helpTabIndex, useValidationIcon, htmlFor, pr, pl, isRequired, validationIconId, }: {
|
|
3
3
|
disabled: any;
|
|
4
4
|
inline: any;
|
|
5
5
|
align?: string | undefined;
|
|
@@ -19,6 +19,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
19
19
|
pr: any;
|
|
20
20
|
pl: any;
|
|
21
21
|
isRequired: any;
|
|
22
|
+
validationIconId: any;
|
|
22
23
|
}): JSX.Element;
|
|
23
24
|
propTypes: {
|
|
24
25
|
/** Label width */
|
|
@@ -59,6 +60,8 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
59
60
|
pl: PropTypes.Requireable<number>;
|
|
60
61
|
/** Flag to configure component as mandatory */
|
|
61
62
|
isRequired: PropTypes.Requireable<boolean>;
|
|
63
|
+
/** Id of the validation icon */
|
|
64
|
+
validationIconId: PropTypes.Requireable<string>;
|
|
62
65
|
};
|
|
63
66
|
}>;
|
|
64
67
|
export default _default;
|
|
@@ -63,11 +63,11 @@ const Label = ({
|
|
|
63
63
|
htmlFor,
|
|
64
64
|
pr,
|
|
65
65
|
pl,
|
|
66
|
-
isRequired
|
|
66
|
+
isRequired,
|
|
67
|
+
validationIconId
|
|
67
68
|
}) => {
|
|
69
|
+
const [isFocused, setFocus] = (0, _react.useState)(false);
|
|
68
70
|
const {
|
|
69
|
-
hasFocus,
|
|
70
|
-
hasMouseOver,
|
|
71
71
|
onMouseEnter,
|
|
72
72
|
onMouseLeave
|
|
73
73
|
} = (0, _react.useContext)(_inputBehaviour.InputContext);
|
|
@@ -87,6 +87,11 @@ const Label = ({
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
const icon = () => {
|
|
90
|
+
const wrapperProps = {
|
|
91
|
+
onFocus: () => setFocus(true),
|
|
92
|
+
onBlur: () => setFocus(false)
|
|
93
|
+
};
|
|
94
|
+
|
|
90
95
|
if (useValidationIcon && shouldDisplayValidationIcon({
|
|
91
96
|
error,
|
|
92
97
|
warning,
|
|
@@ -100,6 +105,7 @@ const Label = ({
|
|
|
100
105
|
inline
|
|
101
106
|
});
|
|
102
107
|
return /*#__PURE__*/_react.default.createElement(_iconWrapper.default, null, /*#__PURE__*/_react.default.createElement(_validationIcon.default, {
|
|
108
|
+
iconId: validationIconId,
|
|
103
109
|
tooltipId: tooltipId,
|
|
104
110
|
error: error,
|
|
105
111
|
warning: warning,
|
|
@@ -109,11 +115,11 @@ const Label = ({
|
|
|
109
115
|
}));
|
|
110
116
|
}
|
|
111
117
|
|
|
112
|
-
return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default,
|
|
118
|
+
return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default, wrapperProps, /*#__PURE__*/_react.default.createElement(_help.default, {
|
|
113
119
|
tooltipId: tooltipId,
|
|
114
120
|
tabIndex: helpTabIndex,
|
|
115
121
|
type: helpIcon,
|
|
116
|
-
isFocused:
|
|
122
|
+
isFocused: isFocused
|
|
117
123
|
}, help));
|
|
118
124
|
};
|
|
119
125
|
|
|
@@ -191,7 +197,10 @@ Label.propTypes = {
|
|
|
191
197
|
pl: _propTypes.default.oneOf([1, 2]),
|
|
192
198
|
|
|
193
199
|
/** Flag to configure component as mandatory */
|
|
194
|
-
isRequired: _propTypes.default.bool
|
|
200
|
+
isRequired: _propTypes.default.bool,
|
|
201
|
+
|
|
202
|
+
/** Id of the validation icon */
|
|
203
|
+
validationIconId: _propTypes.default.string
|
|
195
204
|
};
|
|
196
205
|
|
|
197
206
|
var _default = /*#__PURE__*/_react.default.memo(Label);
|
|
@@ -34,6 +34,8 @@ export interface LabelPropTypes extends ValidationPropTypes {
|
|
|
34
34
|
pr?: 1 | 2;
|
|
35
35
|
/** Padding left, integer multiplied by base spacing constant (8) */
|
|
36
36
|
pl?: 1 | 2;
|
|
37
|
+
/** Id of the validation icon */
|
|
38
|
+
validationIconId?: string;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
declare function Label(props: LabelPropTypes): JSX.Element;
|
|
@@ -5,12 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TooltipProvider = exports.TooltipContext = 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 _guid = _interopRequireDefault(require("../utils/helpers/guid/guid"));
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
16
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
14
20
|
const TooltipContext = /*#__PURE__*/_react.default.createContext({});
|
|
15
21
|
|
|
16
22
|
exports.TooltipContext = TooltipContext;
|
|
@@ -21,18 +27,22 @@ const TooltipProvider = ({
|
|
|
21
27
|
helpAriaLabel,
|
|
22
28
|
focusable = true,
|
|
23
29
|
tooltipVisible,
|
|
24
|
-
disabled
|
|
30
|
+
disabled,
|
|
25
31
|
target
|
|
26
|
-
}) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
}) => {
|
|
33
|
+
const tooltipId = (0, _react.useRef)((0, _guid.default)());
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(TooltipContext.Provider, {
|
|
35
|
+
value: {
|
|
36
|
+
tooltipPosition,
|
|
37
|
+
helpAriaLabel,
|
|
38
|
+
focusable,
|
|
39
|
+
tooltipVisible,
|
|
40
|
+
disabled,
|
|
41
|
+
tooltipId,
|
|
42
|
+
target
|
|
43
|
+
}
|
|
44
|
+
}, children);
|
|
45
|
+
};
|
|
36
46
|
|
|
37
47
|
exports.TooltipProvider = TooltipProvider;
|
|
38
48
|
TooltipProvider.propTypes = {
|
package/lib/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.style.js
CHANGED
|
@@ -5,14 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
11
|
|
|
12
12
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
13
13
|
|
|
14
14
|
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; }
|
|
15
15
|
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
16
18
|
const StyledNavigationItem = _styledComponents.default.li`
|
|
17
19
|
width: 100%;
|
|
18
20
|
|
|
@@ -20,52 +22,32 @@ const StyledNavigationItem = _styledComponents.default.li`
|
|
|
20
22
|
cursor: pointer;
|
|
21
23
|
display: block;
|
|
22
24
|
text-decoration: none;
|
|
23
|
-
color:
|
|
24
|
-
theme
|
|
25
|
-
}) => theme.text.color};
|
|
25
|
+
color: var(--colorsUtilityYin090);
|
|
26
26
|
background-color: transparent;
|
|
27
|
-
border-left:
|
|
28
|
-
theme
|
|
29
|
-
}) => theme.disabled.background};
|
|
27
|
+
border-left: var(--sizing050) solid var(--colorsActionMinor100);
|
|
30
28
|
font-weight: 700;
|
|
31
29
|
padding: 12px 24px;
|
|
32
30
|
|
|
33
31
|
&:focus {
|
|
34
|
-
outline:
|
|
35
|
-
position: relative;
|
|
36
|
-
|
|
37
|
-
&:before {
|
|
38
|
-
content: "";
|
|
39
|
-
position: absolute;
|
|
40
|
-
top: 0;
|
|
41
|
-
bottom: 0;
|
|
42
|
-
left: -3px;
|
|
43
|
-
right: 0;
|
|
44
|
-
z-index: 1;
|
|
45
|
-
box-shadow: 0 0 6px ${({
|
|
46
|
-
theme
|
|
47
|
-
}) => theme.colors.focus};
|
|
48
|
-
}
|
|
32
|
+
outline: var(--borderWidth300) solid var(--colorsSemanticFocus500);
|
|
49
33
|
}
|
|
50
34
|
|
|
51
35
|
&:hover {
|
|
52
36
|
background-color: ${({
|
|
53
|
-
isSelected
|
|
54
|
-
|
|
55
|
-
}) => !isSelected && theme.anchorNavigation.navItemHoverBackground};
|
|
37
|
+
isSelected
|
|
38
|
+
}) => !isSelected && "var(--colorsActionMinor100)"};
|
|
56
39
|
}
|
|
57
40
|
|
|
58
41
|
${({
|
|
59
|
-
isSelected
|
|
60
|
-
theme
|
|
42
|
+
isSelected
|
|
61
43
|
}) => isSelected && (0, _styledComponents.css)`
|
|
62
|
-
background-color:
|
|
63
|
-
border-left-color:
|
|
44
|
+
background-color: var(--colorsActionMinorYang100);
|
|
45
|
+
border-left-color: var(--colorsActionMajor500);
|
|
64
46
|
`}
|
|
65
47
|
}
|
|
66
48
|
`;
|
|
67
|
-
StyledNavigationItem.
|
|
68
|
-
|
|
49
|
+
StyledNavigationItem.propTypes = {
|
|
50
|
+
isSelected: _propTypes.default.bool
|
|
69
51
|
};
|
|
70
52
|
var _default = StyledNavigationItem;
|
|
71
53
|
exports.default = _default;
|
|
@@ -7,8 +7,6 @@ exports.StyledContent = exports.StyledNavigation = exports.StyledAnchorNavigatio
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
|
|
10
|
-
var _themes = require("../../style/themes");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
11
|
|
|
14
12
|
const StyledAnchorNavigation = _styledComponents.default.div`
|
|
@@ -20,9 +18,6 @@ exports.StyledAnchorNavigation = StyledAnchorNavigation;
|
|
|
20
18
|
const StyledNavigation = _styledComponents.default.ul`
|
|
21
19
|
position: sticky;
|
|
22
20
|
top: 32px;
|
|
23
|
-
box-shadow: inset 3px 0px 0px 0px ${({
|
|
24
|
-
theme
|
|
25
|
-
}) => theme.disabled.background};
|
|
26
21
|
list-style: none;
|
|
27
22
|
margin: 0;
|
|
28
23
|
padding: 0;
|
|
@@ -33,13 +28,4 @@ const StyledContent = _styledComponents.default.div`
|
|
|
33
28
|
flex: 1;
|
|
34
29
|
margin-left: 32px;
|
|
35
30
|
`;
|
|
36
|
-
exports.StyledContent = StyledContent;
|
|
37
|
-
StyledAnchorNavigation.defaultProps = {
|
|
38
|
-
theme: _themes.baseTheme
|
|
39
|
-
};
|
|
40
|
-
StyledNavigation.defaultProps = {
|
|
41
|
-
theme: _themes.baseTheme
|
|
42
|
-
};
|
|
43
|
-
StyledContent.defaultProps = {
|
|
44
|
-
theme: _themes.baseTheme
|
|
45
|
-
};
|
|
31
|
+
exports.StyledContent = StyledContent;
|
package/lib/components/anchor-navigation/anchor-section-divider/anchor-section-divider.style.js
CHANGED
|
@@ -7,20 +7,13 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
|
|
10
|
-
var _themes = require("../../../style/themes");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
11
|
|
|
14
12
|
const StyledAnchorDivider = _styledComponents.default.div.attrs({
|
|
15
13
|
"data-element": "anchor-navigation-divider"
|
|
16
14
|
})`
|
|
17
|
-
background-color:
|
|
18
|
-
theme
|
|
19
|
-
}) => theme.anchorNavigation.divider};
|
|
15
|
+
background-color: var(--colorsActionMinor200);
|
|
20
16
|
height: 1px;
|
|
21
17
|
`;
|
|
22
|
-
StyledAnchorDivider.defaultProps = {
|
|
23
|
-
theme: _themes.baseTheme
|
|
24
|
-
};
|
|
25
18
|
var _default = StyledAnchorDivider;
|
|
26
19
|
exports.default = _default;
|
|
@@ -17,6 +17,8 @@ var _ether = require("../../__internal__/utils/ether");
|
|
|
17
17
|
|
|
18
18
|
var _appWrapper = _interopRequireDefault(require("./app-wrapper.style"));
|
|
19
19
|
|
|
20
|
+
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
24
|
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); }
|
|
@@ -41,9 +43,11 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
41
43
|
|
|
42
44
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
45
|
|
|
46
|
+
let deprecatedWarnTriggered = false;
|
|
44
47
|
/**
|
|
45
48
|
* Manages the width and containment of your application.
|
|
46
49
|
*/
|
|
50
|
+
|
|
47
51
|
let AppWrapper = /*#__PURE__*/function (_React$Component) {
|
|
48
52
|
_inherits(AppWrapper, _React$Component);
|
|
49
53
|
|
|
@@ -56,6 +60,13 @@ let AppWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
56
60
|
|
|
57
61
|
_this = _super.call(this, ...args);
|
|
58
62
|
_this.classes = _this.classes.bind(_assertThisInitialized(_this));
|
|
63
|
+
|
|
64
|
+
if (!deprecatedWarnTriggered) {
|
|
65
|
+
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
66
|
+
|
|
67
|
+
_logger.default.deprecate("`AppWrapper` component is now deprecated and will soon be removed. Please use the `Box` component instead.");
|
|
68
|
+
}
|
|
69
|
+
|
|
59
70
|
return _this;
|
|
60
71
|
}
|
|
61
72
|
/**
|
|
@@ -29,6 +29,8 @@ var _form = _interopRequireDefault(require("../form"));
|
|
|
29
29
|
|
|
30
30
|
var _dialog2 = require("./dialog.config");
|
|
31
31
|
|
|
32
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
33
|
+
|
|
32
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
35
|
|
|
34
36
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -56,6 +58,7 @@ const Dialog = ({
|
|
|
56
58
|
role = "dialog",
|
|
57
59
|
...rest
|
|
58
60
|
}) => {
|
|
61
|
+
const locale = (0, _useLocale.default)();
|
|
59
62
|
const dialogRef = (0, _react.useRef)();
|
|
60
63
|
const innerContentRef = (0, _react.useRef)();
|
|
61
64
|
const titleRef = (0, _react.useRef)();
|
|
@@ -124,7 +127,7 @@ const Dialog = ({
|
|
|
124
127
|
if (!showCloseIcon || !onCancel) return null;
|
|
125
128
|
return /*#__PURE__*/_react.default.createElement(_iconButton.default, {
|
|
126
129
|
"data-element": "close",
|
|
127
|
-
"aria-label":
|
|
130
|
+
"aria-label": locale.dialog.ariaLabels.close(),
|
|
128
131
|
onAction: onCancel,
|
|
129
132
|
disabled: disableClose
|
|
130
133
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
@@ -27,6 +27,8 @@ var _iconButton = _interopRequireDefault(require("../icon-button"));
|
|
|
27
27
|
|
|
28
28
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
29
29
|
|
|
30
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
31
|
+
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
|
|
32
34
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -56,6 +58,7 @@ const DialogFullScreen = ({
|
|
|
56
58
|
role = "dialog",
|
|
57
59
|
...rest
|
|
58
60
|
}) => {
|
|
61
|
+
const locale = (0, _useLocale.default)();
|
|
59
62
|
const dialogRef = (0, _react.useRef)();
|
|
60
63
|
const headingRef = (0, _react.useRef)();
|
|
61
64
|
const {
|
|
@@ -69,7 +72,7 @@ const DialogFullScreen = ({
|
|
|
69
72
|
if (!showCloseIcon || !onCancel) return null;
|
|
70
73
|
return /*#__PURE__*/_react.default.createElement(_iconButton.default, {
|
|
71
74
|
"data-element": "close",
|
|
72
|
-
"aria-label":
|
|
75
|
+
"aria-label": locale.dialogFullScreen.ariaLabels.close(),
|
|
73
76
|
onAction: onCancel
|
|
74
77
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
75
78
|
type: "close"
|
|
@@ -139,7 +139,7 @@ Help.propTypes = { ...marginPropTypes,
|
|
|
139
139
|
/** A path for the anchor */
|
|
140
140
|
href: _propTypes.default.string,
|
|
141
141
|
|
|
142
|
-
/**
|
|
142
|
+
/** A boolean received from IconWrapper */
|
|
143
143
|
isFocused: _propTypes.default.bool,
|
|
144
144
|
|
|
145
145
|
/** <a href="https://brand.sage.com/d/NdbrveWvNheA/foundations#/icons/icons" target="_blank">List of supported icons</a>
|
|
@@ -13,7 +13,7 @@ export interface HelpProps extends MarginProps {
|
|
|
13
13
|
helpId?: string;
|
|
14
14
|
/** A path for the anchor */
|
|
15
15
|
href?: string;
|
|
16
|
-
/**
|
|
16
|
+
/** A boolean received from IconWrapper */
|
|
17
17
|
isFocused?: boolean;
|
|
18
18
|
/** Overrides the default tabindex of the component */
|
|
19
19
|
tabIndex?: number | string;
|
|
@@ -44,11 +44,15 @@ const StyledSubmenuWrapper = _styledComponents.default.div`
|
|
|
44
44
|
menuType,
|
|
45
45
|
asPassiveItem,
|
|
46
46
|
theme
|
|
47
|
-
}) => inFullscreenView &&
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
}) => inFullscreenView && (0, _styledComponents.css)`
|
|
48
|
+
width: 100%;
|
|
49
|
+
|
|
50
|
+
${asPassiveItem && (0, _styledComponents.css)`
|
|
51
|
+
${_menuItem.default} {
|
|
52
|
+
outline: none;
|
|
53
|
+
color: ${theme.menu[menuType].title};
|
|
54
|
+
}
|
|
55
|
+
`}
|
|
52
56
|
`}
|
|
53
57
|
`;
|
|
54
58
|
exports.StyledSubmenuWrapper = StyledSubmenuWrapper;
|
|
@@ -75,7 +79,7 @@ const StyledSubmenu = _styledComponents.default.ul`
|
|
|
75
79
|
|
|
76
80
|
${inFullscreenView && (0, _styledComponents.css)`
|
|
77
81
|
${_menu.StyledMenuItem} {
|
|
78
|
-
width:
|
|
82
|
+
width: 100%;
|
|
79
83
|
}
|
|
80
84
|
`}
|
|
81
85
|
|
|
@@ -126,7 +130,7 @@ const StyledSubmenu = _styledComponents.default.ul`
|
|
|
126
130
|
margin-right: 5px;
|
|
127
131
|
}
|
|
128
132
|
|
|
129
|
-
${_search.default} [data-component="icon"] {
|
|
133
|
+
${_search.default} span > [data-component="icon"] {
|
|
130
134
|
color: ${theme.menu[menuType].searchIcon};
|
|
131
135
|
|
|
132
136
|
&:hover {
|
|
@@ -106,10 +106,10 @@ const MenuFullscreen = ({
|
|
|
106
106
|
type: "close",
|
|
107
107
|
color: iconColors[menuType]
|
|
108
108
|
}))), /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
109
|
-
|
|
109
|
+
overflowY: "auto",
|
|
110
110
|
scrollVariant: scrollVariants[menuType],
|
|
111
|
-
width: "
|
|
112
|
-
height: "
|
|
111
|
+
width: "100%",
|
|
112
|
+
height: "calc(100% - 40px)"
|
|
113
113
|
}, /*#__PURE__*/_react.default.createElement(_menu.StyledMenuWrapper, {
|
|
114
114
|
"data-component": "menu",
|
|
115
115
|
menuType: menuType,
|
|
@@ -13,6 +13,12 @@ var _iconButton = _interopRequireDefault(require("../../icon-button/icon-button.
|
|
|
13
13
|
|
|
14
14
|
var _box = _interopRequireDefault(require("../../box"));
|
|
15
15
|
|
|
16
|
+
var _search = _interopRequireDefault(require("../../search/search.style"));
|
|
17
|
+
|
|
18
|
+
var _icon = _interopRequireDefault(require("../../icon/icon.style"));
|
|
19
|
+
|
|
20
|
+
var _button = _interopRequireDefault(require("../../button/button.style"));
|
|
21
|
+
|
|
16
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
23
|
|
|
18
24
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -23,6 +29,8 @@ const StyledMenuFullscreen = _styledComponents.default.div`
|
|
|
23
29
|
position: fixed;
|
|
24
30
|
top: 0;
|
|
25
31
|
bottom: 0;
|
|
32
|
+
height: 100vh;
|
|
33
|
+
width: 100%;
|
|
26
34
|
|
|
27
35
|
a,
|
|
28
36
|
button,
|
|
@@ -39,6 +47,45 @@ const StyledMenuFullscreen = _styledComponents.default.div`
|
|
|
39
47
|
background-color: ${theme.menu[menuType].background};
|
|
40
48
|
z-index: ${theme.zIndex.fullScreenModal};
|
|
41
49
|
|
|
50
|
+
${menuType === "dark" && (0, _styledComponents.css)`
|
|
51
|
+
${_search.default} span > [data-component="icon"] {
|
|
52
|
+
color: ${theme.menu.dark.searchIcon};
|
|
53
|
+
|
|
54
|
+
&:hover {
|
|
55
|
+
color: ${theme.menu.dark.searchIconHover};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`}
|
|
59
|
+
|
|
60
|
+
${menuType === "light" && (0, _styledComponents.css)`
|
|
61
|
+
${_search.default} span > [data-component="icon"] {
|
|
62
|
+
color: ${theme.search.icon};
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
color: ${theme.search.iconHover};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`}
|
|
69
|
+
|
|
70
|
+
${_search.default} {
|
|
71
|
+
${_icon.default} {
|
|
72
|
+
display: inline-flex;
|
|
73
|
+
margin-right: 0;
|
|
74
|
+
bottom: auto;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
${_button.default} {
|
|
78
|
+
display: flex;
|
|
79
|
+
line-height: normal;
|
|
80
|
+
padding-bottom: 0;
|
|
81
|
+
|
|
82
|
+
&:focus {
|
|
83
|
+
outline: solid 3px var(--colorsSemanticFocus500);
|
|
84
|
+
box-shadow: none;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
42
89
|
${isOpen && (0, _styledComponents.css)`
|
|
43
90
|
visibility: visible;
|
|
44
91
|
${startPosition}: 0;
|
|
@@ -47,7 +94,7 @@ const StyledMenuFullscreen = _styledComponents.default.div`
|
|
|
47
94
|
|
|
48
95
|
${!isOpen && (0, _styledComponents.css)`
|
|
49
96
|
visibility: hidden;
|
|
50
|
-
${startPosition}: -
|
|
97
|
+
${startPosition}: -100%;
|
|
51
98
|
transition: all 0.3s ease;
|
|
52
99
|
`}
|
|
53
100
|
`}
|
|
@@ -218,7 +218,6 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
|
|
|
218
218
|
|
|
219
219
|
${inFullscreenView && (0, _styledComponents.css)`
|
|
220
220
|
${as === "div" && (0, _styledComponents.css)`
|
|
221
|
-
width: 100vw;
|
|
222
221
|
cursor: default;
|
|
223
222
|
padding: 0 16px;
|
|
224
223
|
|
|
@@ -226,14 +225,6 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
|
|
|
226
225
|
background: transparent;
|
|
227
226
|
}
|
|
228
227
|
`}
|
|
229
|
-
|
|
230
|
-
a,
|
|
231
|
-
${_link.StyledLink} a,
|
|
232
|
-
button,
|
|
233
|
-
${_link.StyledLink} button {
|
|
234
|
-
width: 100vw;
|
|
235
|
-
box-sizing: border-box;
|
|
236
|
-
}
|
|
237
228
|
`}
|
|
238
229
|
`}
|
|
239
230
|
`;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MenuFullScreenStory = exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _addonActions = require("@storybook/addon-actions");
|
|
11
|
+
|
|
12
|
+
var _ = require(".");
|
|
13
|
+
|
|
14
|
+
var _menuItem = _interopRequireDefault(require("./menu-item"));
|
|
15
|
+
|
|
16
|
+
var _menuFullScreen = _interopRequireDefault(require("./menu-full-screen"));
|
|
17
|
+
|
|
18
|
+
var _search = _interopRequireDefault(require("../search"));
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
/* eslint-disable react/prop-types */
|
|
27
|
+
var _default = {
|
|
28
|
+
title: "Menu/Test",
|
|
29
|
+
parameters: {
|
|
30
|
+
info: {
|
|
31
|
+
disable: true
|
|
32
|
+
},
|
|
33
|
+
chromatic: {
|
|
34
|
+
disable: false
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
argTypes: {
|
|
38
|
+
menuType: {
|
|
39
|
+
options: ["light", "dark"],
|
|
40
|
+
control: {
|
|
41
|
+
type: "select"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
startPosition: {
|
|
45
|
+
options: ["left", "right"],
|
|
46
|
+
control: {
|
|
47
|
+
type: "select"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
searchVariant: {
|
|
51
|
+
options: ["default", "dark"],
|
|
52
|
+
control: {
|
|
53
|
+
type: "select"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
searchButton: {
|
|
57
|
+
options: [true, false],
|
|
58
|
+
control: {
|
|
59
|
+
type: "boolean"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.default = _default;
|
|
65
|
+
|
|
66
|
+
const MenuFullScreenStory = ({
|
|
67
|
+
menuType,
|
|
68
|
+
startPosition,
|
|
69
|
+
searchVariant,
|
|
70
|
+
searchButton
|
|
71
|
+
}) => {
|
|
72
|
+
const [isOpen, setIsOpen] = (0, _react.useState)(true);
|
|
73
|
+
|
|
74
|
+
const onClose = evt => {
|
|
75
|
+
setIsOpen(false);
|
|
76
|
+
(0, _addonActions.action)("close icon clicked")(evt);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const handleOpen = () => {
|
|
80
|
+
setIsOpen(true);
|
|
81
|
+
(0, _addonActions.action)("open")();
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(_.Menu, {
|
|
85
|
+
menuType: menuType
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
87
|
+
onClick: handleOpen
|
|
88
|
+
}, "Menu"), /*#__PURE__*/_react.default.createElement(_menuFullScreen.default, {
|
|
89
|
+
startPosition: startPosition,
|
|
90
|
+
isOpen: isOpen,
|
|
91
|
+
onClose: onClose
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
93
|
+
href: "#"
|
|
94
|
+
}, "Menu Item One"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
95
|
+
onClick: evt => (0, _addonActions.action)("submenu item clicked")(evt),
|
|
96
|
+
submenu: "Menu Item Two"
|
|
97
|
+
}, /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
98
|
+
href: "#"
|
|
99
|
+
}, "Submenu Item One"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
100
|
+
href: "#"
|
|
101
|
+
}, "Submenu Item Two")), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
102
|
+
variant: "alternate"
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement(_search.default, {
|
|
104
|
+
placeholder: "Search...",
|
|
105
|
+
variant: searchVariant,
|
|
106
|
+
defaultValue: "",
|
|
107
|
+
searchButton: searchButton
|
|
108
|
+
})), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
109
|
+
href: "#"
|
|
110
|
+
}, "Menu Item Three"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
111
|
+
href: "#"
|
|
112
|
+
}, "Menu Item Four"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
113
|
+
submenu: "Menu Item Five"
|
|
114
|
+
}, /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
115
|
+
href: "#"
|
|
116
|
+
}, "Submenu Item One"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
117
|
+
href: "#"
|
|
118
|
+
}, "Submenu Item Two")), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
119
|
+
href: "#"
|
|
120
|
+
}, "Menu Item Six")));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
exports.MenuFullScreenStory = MenuFullScreenStory;
|
|
124
|
+
MenuFullScreenStory.story = {
|
|
125
|
+
name: "fullscreen menu",
|
|
126
|
+
args: {
|
|
127
|
+
menuType: "light",
|
|
128
|
+
startPosition: "left",
|
|
129
|
+
searchVariant: "default",
|
|
130
|
+
searchButton: true
|
|
131
|
+
}
|
|
132
|
+
};
|
|
@@ -13,6 +13,8 @@ var _verticalDivider = require("../vertical-divider/vertical-divider.style");
|
|
|
13
13
|
|
|
14
14
|
var _themes = require("../../style/themes");
|
|
15
15
|
|
|
16
|
+
var _link = require("../link/link.style");
|
|
17
|
+
|
|
16
18
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
17
19
|
|
|
18
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; }
|
|
@@ -46,12 +48,6 @@ const StyledMenuWrapper = _styledComponents.default.ul`
|
|
|
46
48
|
top: -1px;
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
|
-
|
|
50
|
-
${({
|
|
51
|
-
inFullscreenView
|
|
52
|
-
}) => inFullscreenView && (0, _styledComponents.css)`
|
|
53
|
-
padding-bottom: 24px;
|
|
54
|
-
`}
|
|
55
51
|
`;
|
|
56
52
|
exports.StyledMenuWrapper = StyledMenuWrapper;
|
|
57
53
|
const StyledMenuItem = _styledComponents.default.li`
|
|
@@ -71,6 +67,17 @@ const StyledMenuItem = _styledComponents.default.li`
|
|
|
71
67
|
}) => inFullscreenView && (0, _styledComponents.css)`
|
|
72
68
|
padding-top: 16px;
|
|
73
69
|
padding-bottom: 16px;
|
|
70
|
+
|
|
71
|
+
a,
|
|
72
|
+
${_link.StyledLink} a,
|
|
73
|
+
button,
|
|
74
|
+
${_link.StyledLink} button,
|
|
75
|
+
> span,
|
|
76
|
+
> div,
|
|
77
|
+
[data-component="submenu-wrapper"] > ${_link.StyledLink} {
|
|
78
|
+
width: 100%;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
}
|
|
74
81
|
`}
|
|
75
82
|
`;
|
|
76
83
|
exports.StyledMenuItem = StyledMenuItem;
|
|
@@ -25,6 +25,8 @@ var _box = _interopRequireDefault(require("../box"));
|
|
|
25
25
|
|
|
26
26
|
var _sidebar2 = require("./sidebar.config");
|
|
27
27
|
|
|
28
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
29
|
+
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
30
32
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -52,13 +54,14 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
52
54
|
role = "dialog",
|
|
53
55
|
...rest
|
|
54
56
|
}, ref) => {
|
|
57
|
+
const locale = (0, _useLocale.default)();
|
|
55
58
|
let sidebarRef = (0, _react.useRef)();
|
|
56
59
|
if (ref) sidebarRef = ref;
|
|
57
60
|
|
|
58
61
|
const closeIcon = () => {
|
|
59
62
|
if (!onCancel) return null;
|
|
60
63
|
return /*#__PURE__*/_react.default.createElement(_iconButton.default, {
|
|
61
|
-
"aria-label":
|
|
64
|
+
"aria-label": locale.sidebar.ariaLabels.close(),
|
|
62
65
|
onAction: onCancel,
|
|
63
66
|
"data-element": "close"
|
|
64
67
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
@@ -105,7 +105,7 @@ const Textarea = ({
|
|
|
105
105
|
|
|
106
106
|
const {
|
|
107
107
|
labelId,
|
|
108
|
-
|
|
108
|
+
validationIconId,
|
|
109
109
|
fieldHelpId,
|
|
110
110
|
ariaDescribedBy,
|
|
111
111
|
ariaLabelledBy
|
|
@@ -115,7 +115,6 @@ const Textarea = ({
|
|
|
115
115
|
warning,
|
|
116
116
|
info,
|
|
117
117
|
label,
|
|
118
|
-
labelHelp,
|
|
119
118
|
fieldHelp
|
|
120
119
|
});
|
|
121
120
|
(0, _react.useEffect)(() => {
|
|
@@ -176,7 +175,6 @@ const Textarea = ({
|
|
|
176
175
|
labelWidth: labelWidth,
|
|
177
176
|
labelHelp: labelHelp,
|
|
178
177
|
labelSpacing: labelSpacing,
|
|
179
|
-
tooltipId: tooltipId,
|
|
180
178
|
isRequired: props.required,
|
|
181
179
|
useValidationIcon: validationOnLabel,
|
|
182
180
|
adaptiveLabelBreakpoint: adaptiveLabelBreakpoint
|
|
@@ -214,6 +212,7 @@ const Textarea = ({
|
|
|
214
212
|
error: error,
|
|
215
213
|
warning: warning,
|
|
216
214
|
info: info,
|
|
215
|
+
validationIconId: validationIconId,
|
|
217
216
|
useValidationIcon: !validationOnLabel
|
|
218
217
|
}))), characterCount())));
|
|
219
218
|
};
|
|
@@ -94,7 +94,7 @@ const Textbox = ({
|
|
|
94
94
|
const [maxLength, characterCount] = (0, _useCharacterCount.default)(value, characterLimit, warnOverLimit, enforceCharacterLimit);
|
|
95
95
|
const {
|
|
96
96
|
labelId: internalLabelId,
|
|
97
|
-
|
|
97
|
+
validationIconId,
|
|
98
98
|
fieldHelpId,
|
|
99
99
|
ariaDescribedBy
|
|
100
100
|
} = (0, _useInputAccessibility.default)({
|
|
@@ -111,7 +111,6 @@ const Textbox = ({
|
|
|
111
111
|
helpAriaLabel: helpAriaLabel,
|
|
112
112
|
tooltipPosition: tooltipPosition
|
|
113
113
|
}, /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputBehaviour, null, /*#__PURE__*/_react.default.createElement(_formField.default, _extends({
|
|
114
|
-
tooltipId: tooltipId,
|
|
115
114
|
disabled: disabled,
|
|
116
115
|
fieldHelp: fieldHelp,
|
|
117
116
|
fieldHelpId: fieldHelpId,
|
|
@@ -133,7 +132,8 @@ const Textbox = ({
|
|
|
133
132
|
isRequired: required,
|
|
134
133
|
"data-component": dataComponent,
|
|
135
134
|
"data-role": dataRole,
|
|
136
|
-
"data-element": dataElement
|
|
135
|
+
"data-element": dataElement,
|
|
136
|
+
validationIconId: validationIconId
|
|
137
137
|
}, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(_input.InputPresentation, {
|
|
138
138
|
align: align,
|
|
139
139
|
disabled: disabled,
|
|
@@ -182,7 +182,7 @@ const Textbox = ({
|
|
|
182
182
|
size: size,
|
|
183
183
|
useValidationIcon: !validationOnLabel,
|
|
184
184
|
warning: warning,
|
|
185
|
-
|
|
185
|
+
validationIconId: validationIconId
|
|
186
186
|
}))), characterCount));
|
|
187
187
|
};
|
|
188
188
|
|
|
@@ -25,6 +25,8 @@ var _modalManager = _interopRequireDefault(require("../modal/__internal__/modal-
|
|
|
25
25
|
|
|
26
26
|
var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/events"));
|
|
27
27
|
|
|
28
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
29
|
+
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
30
32
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -47,6 +49,7 @@ const Toast = ({
|
|
|
47
49
|
variant,
|
|
48
50
|
...restProps
|
|
49
51
|
}) => {
|
|
52
|
+
const locale = (0, _useLocale.default)();
|
|
50
53
|
const toastRef = (0, _react.useRef)();
|
|
51
54
|
const timer = (0, _react.useRef)();
|
|
52
55
|
const componentClasses = (0, _react.useMemo)(() => {
|
|
@@ -85,6 +88,7 @@ const Toast = ({
|
|
|
85
88
|
function renderCloseIcon() {
|
|
86
89
|
if (!onDismiss) return null;
|
|
87
90
|
return /*#__PURE__*/_react.default.createElement(_iconButton.default, {
|
|
91
|
+
"aria-label": locale.toast.ariaLabels.close(),
|
|
88
92
|
"data-element": "close",
|
|
89
93
|
onAction: onDismiss
|
|
90
94
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export default function useInputAccessibility({ id, error, warning, info, label,
|
|
1
|
+
export default function useInputAccessibility({ id, error, warning, info, label, fieldHelp, }: {
|
|
2
2
|
id: any;
|
|
3
3
|
error: any;
|
|
4
4
|
warning: any;
|
|
5
5
|
info: any;
|
|
6
6
|
label: any;
|
|
7
|
-
labelHelp: any;
|
|
8
7
|
fieldHelp: any;
|
|
9
8
|
}): {
|
|
10
9
|
labelId: string | undefined;
|
|
11
|
-
|
|
10
|
+
validationIconId: string | undefined;
|
|
12
11
|
fieldHelpId: string | undefined;
|
|
13
12
|
ariaDescribedBy: string;
|
|
14
13
|
ariaLabelledBy: string | undefined;
|
|
@@ -11,17 +11,16 @@ function useInputAccessibility({
|
|
|
11
11
|
warning,
|
|
12
12
|
info,
|
|
13
13
|
label,
|
|
14
|
-
labelHelp,
|
|
15
14
|
fieldHelp
|
|
16
15
|
}) {
|
|
17
16
|
const labelId = label ? `${id}-label` : undefined;
|
|
18
|
-
const
|
|
17
|
+
const validationIconId = [error, warning, info].filter(validation => typeof validation === "string").length ? `${id}-validation-icon` : undefined;
|
|
19
18
|
const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
|
|
20
|
-
const ariaDescribedBy = [fieldHelpId,
|
|
19
|
+
const ariaDescribedBy = [fieldHelpId, validationIconId].filter(Boolean).join(" ");
|
|
21
20
|
const ariaLabelledBy = labelId;
|
|
22
21
|
return {
|
|
23
22
|
labelId,
|
|
24
|
-
|
|
23
|
+
validationIconId,
|
|
25
24
|
fieldHelpId,
|
|
26
25
|
ariaDescribedBy,
|
|
27
26
|
ariaLabelledBy
|
package/lib/locales/en-gb.js
CHANGED
|
@@ -28,6 +28,16 @@ var _default = {
|
|
|
28
28
|
date: {
|
|
29
29
|
dateFnsLocale: () => _dateFnsLocales.enGB
|
|
30
30
|
},
|
|
31
|
+
dialog: {
|
|
32
|
+
ariaLabels: {
|
|
33
|
+
close: () => "Close"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
dialogFullScreen: {
|
|
37
|
+
ariaLabels: {
|
|
38
|
+
close: () => "Close"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
31
41
|
errors: {
|
|
32
42
|
messages: {
|
|
33
43
|
formSummary:
|
|
@@ -85,6 +95,11 @@ var _default = {
|
|
|
85
95
|
link: {
|
|
86
96
|
skipLinkLabel: () => "Skip to main content"
|
|
87
97
|
},
|
|
98
|
+
sidebar: {
|
|
99
|
+
ariaLabels: {
|
|
100
|
+
close: () => "Close"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
88
103
|
switch: {
|
|
89
104
|
on: () => "ON",
|
|
90
105
|
off: () => "OFF"
|
|
@@ -106,6 +121,11 @@ var _default = {
|
|
|
106
121
|
tileSelect: {
|
|
107
122
|
deselect: () => "Deselect"
|
|
108
123
|
},
|
|
124
|
+
toast: {
|
|
125
|
+
ariaLabels: {
|
|
126
|
+
close: () => "Close"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
109
129
|
wizards: {
|
|
110
130
|
multiStep: {
|
|
111
131
|
buttons: {
|
package/lib/locales/locale.d.ts
CHANGED
|
@@ -19,6 +19,16 @@ interface Locale {
|
|
|
19
19
|
date: {
|
|
20
20
|
dateFnsLocale: () => DateFnsLocale;
|
|
21
21
|
};
|
|
22
|
+
dialog: {
|
|
23
|
+
ariaLabels: {
|
|
24
|
+
close: () => string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
dialogFullScreen: {
|
|
28
|
+
ariaLabels: {
|
|
29
|
+
close: () => string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
22
32
|
errors: {
|
|
23
33
|
messages: {
|
|
24
34
|
formSummary: (
|
|
@@ -53,6 +63,14 @@ interface Locale {
|
|
|
53
63
|
placeholder: () => string;
|
|
54
64
|
noResultsForTerm: (term: string) => string;
|
|
55
65
|
};
|
|
66
|
+
link: {
|
|
67
|
+
skipLinkLabel: () => string;
|
|
68
|
+
};
|
|
69
|
+
sidebar: {
|
|
70
|
+
ariaLabels: {
|
|
71
|
+
close: () => string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
56
74
|
switch: {
|
|
57
75
|
on: () => string;
|
|
58
76
|
off: () => string;
|
|
@@ -74,6 +92,11 @@ interface Locale {
|
|
|
74
92
|
tileSelect: {
|
|
75
93
|
deselect: () => string;
|
|
76
94
|
};
|
|
95
|
+
toast: {
|
|
96
|
+
ariaLabels: {
|
|
97
|
+
close: () => string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
77
100
|
wizards: {
|
|
78
101
|
multiStep: {
|
|
79
102
|
buttons: {
|
package/lib/locales/pl-pl.js
CHANGED
|
@@ -28,6 +28,16 @@ var _default = {
|
|
|
28
28
|
date: {
|
|
29
29
|
dateFnsLocale: () => _dateFnsLocales.pl
|
|
30
30
|
},
|
|
31
|
+
dialog: {
|
|
32
|
+
ariaLabels: {
|
|
33
|
+
close: () => "Zamknij"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
dialogFullScreen: {
|
|
37
|
+
ariaLabels: {
|
|
38
|
+
close: () => "Zamknij"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
31
41
|
errors: {
|
|
32
42
|
messages: {
|
|
33
43
|
formSummary:
|
|
@@ -83,6 +93,11 @@ var _default = {
|
|
|
83
93
|
link: {
|
|
84
94
|
skipLinkLabel: () => "Przejdź do treści"
|
|
85
95
|
},
|
|
96
|
+
sidebar: {
|
|
97
|
+
ariaLabels: {
|
|
98
|
+
close: () => "Zamknij"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
86
101
|
switch: {
|
|
87
102
|
on: () => "WŁ",
|
|
88
103
|
off: () => "WYŁ"
|
|
@@ -104,6 +119,11 @@ var _default = {
|
|
|
104
119
|
tileSelect: {
|
|
105
120
|
deselect: () => "Odznacz"
|
|
106
121
|
},
|
|
122
|
+
toast: {
|
|
123
|
+
ariaLabels: {
|
|
124
|
+
close: () => "Zamknij"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
107
127
|
wizards: {
|
|
108
128
|
multiStep: {
|
|
109
129
|
buttons: {
|