carbon-react 102.8.1 → 102.10.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/components/advanced-color-picker/advanced-color-picker.component.js +29 -2
- package/lib/components/advanced-color-picker/advanced-color-picker.d.ts +8 -0
- package/lib/components/alert/alert.component.js +17 -1
- package/lib/components/confirm/confirm.component.js +18 -1
- package/lib/components/dialog/dialog.component.js +31 -12
- package/lib/components/dialog/dialog.d.ts +30 -3
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +30 -2
- package/lib/components/dialog-full-screen/dialog-full-screen.d.ts +26 -1
- package/lib/components/icon/icon.style.js +7 -7
- package/lib/components/pager/pager.style.js +0 -2
- package/lib/components/sidebar/sidebar.component.js +23 -3
- package/lib/components/sidebar/sidebar.d.ts +15 -0
- package/lib/components/tooltip/tooltip-pointer.style.js +7 -6
- package/lib/components/tooltip/tooltip.component.js +6 -0
- package/lib/components/tooltip/tooltip.style.js +10 -4
- package/package.json +2 -2
|
@@ -30,6 +30,9 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
30
30
|
const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
|
|
31
31
|
|
|
32
32
|
const AdvancedColorPicker = ({
|
|
33
|
+
"aria-describedby": ariaDescribedBy,
|
|
34
|
+
"aria-label": ariaLabel,
|
|
35
|
+
"aria-labelledby": ariaLabelledBy,
|
|
33
36
|
name,
|
|
34
37
|
open,
|
|
35
38
|
onOpen,
|
|
@@ -39,6 +42,7 @@ const AdvancedColorPicker = ({
|
|
|
39
42
|
availableColors,
|
|
40
43
|
defaultColor,
|
|
41
44
|
selectedColor,
|
|
45
|
+
role,
|
|
42
46
|
...props
|
|
43
47
|
}) => {
|
|
44
48
|
const isOpen = open || false;
|
|
@@ -127,11 +131,15 @@ const AdvancedColorPicker = ({
|
|
|
127
131
|
color: currentColor,
|
|
128
132
|
tabIndex: "0"
|
|
129
133
|
}), /*#__PURE__*/_react.default.createElement(_advancedColorPicker.DialogStyle, {
|
|
134
|
+
"aria-describedby": ariaDescribedBy,
|
|
135
|
+
"aria-label": ariaLabel,
|
|
136
|
+
"aria-labelledby": ariaLabelledBy,
|
|
130
137
|
open: dialogOpen || isOpen,
|
|
131
138
|
size: "auto",
|
|
132
139
|
onCancel: handleOnClose,
|
|
133
140
|
bespokeFocusTrap: handleFocus,
|
|
134
|
-
focusFirstElement: selectedColorRef
|
|
141
|
+
focusFirstElement: selectedColorRef,
|
|
142
|
+
role: role
|
|
135
143
|
}, /*#__PURE__*/_react.default.createElement(_advancedColorPicker.StyledAdvancedColorPickerPreview, {
|
|
136
144
|
"data-element": "color-picker-preview",
|
|
137
145
|
color: currentColor
|
|
@@ -161,6 +169,22 @@ AdvancedColorPicker.propTypes = {
|
|
|
161
169
|
/** Filtered styled system margin props */
|
|
162
170
|
...marginPropTypes,
|
|
163
171
|
|
|
172
|
+
/** Prop to specify the aria-describedby property of the component */
|
|
173
|
+
"aria-describedby": _propTypes.default.string,
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Prop to specify the aria-label of the component.
|
|
177
|
+
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
178
|
+
*/
|
|
179
|
+
"aria-label": _propTypes.default.string,
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Prop to specify the aria-labeledby property of the component
|
|
183
|
+
* To be used when the title prop is a custom React Node,
|
|
184
|
+
* or the component is labelled by an internal element other than the title.
|
|
185
|
+
*/
|
|
186
|
+
"aria-labelledby": _propTypes.default.string,
|
|
187
|
+
|
|
164
188
|
/** Specifies the name prop to be applied to each color in the group */
|
|
165
189
|
name: _propTypes.default.string.isRequired,
|
|
166
190
|
|
|
@@ -186,7 +210,10 @@ AdvancedColorPicker.propTypes = {
|
|
|
186
210
|
open: _propTypes.default.bool,
|
|
187
211
|
|
|
188
212
|
/** Prop for `onBlur` event */
|
|
189
|
-
onBlur: _propTypes.default.func
|
|
213
|
+
onBlur: _propTypes.default.func,
|
|
214
|
+
|
|
215
|
+
/** The ARIA role to be applied to the container */
|
|
216
|
+
role: _propTypes.default.string
|
|
190
217
|
};
|
|
191
218
|
var _default = AdvancedColorPicker;
|
|
192
219
|
exports.default = _default;
|
|
@@ -7,6 +7,12 @@ export interface AdvancedColor {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export interface AdvancedColorPickerPropTypes extends MarginProps {
|
|
10
|
+
/** Prop to specify the aria-describedby property of the component */
|
|
11
|
+
"aria-describedby"?: string;
|
|
12
|
+
/** Prop to specify the aria-label of the component */
|
|
13
|
+
"aria-label"?: string;
|
|
14
|
+
/** Prop to specify the aria-labeledby property of the component */
|
|
15
|
+
"aria-labelledby"?: string;
|
|
10
16
|
/** Prop for `availableColors` containing array of objects of colors */
|
|
11
17
|
availableColors: AdvancedColor[];
|
|
12
18
|
/** Prop for `defaultColor` containing the default color for `uncontrolled` use */
|
|
@@ -23,6 +29,8 @@ export interface AdvancedColorPickerPropTypes extends MarginProps {
|
|
|
23
29
|
onOpen?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
24
30
|
/** Prop for `open` status */
|
|
25
31
|
open?: boolean;
|
|
32
|
+
/** The ARIA role to be applied to the component container */
|
|
33
|
+
role?: string;
|
|
26
34
|
/** Prop for `selectedColor` containing pre-selected color for `controlled` use */
|
|
27
35
|
selectedColor?: string;
|
|
28
36
|
}
|
|
@@ -20,10 +20,26 @@ const Alert = ({
|
|
|
20
20
|
...rest
|
|
21
21
|
}) => /*#__PURE__*/_react.default.createElement(_dialog.default, _extends({
|
|
22
22
|
"data-component": "alert",
|
|
23
|
-
|
|
23
|
+
role: "alertdialog"
|
|
24
24
|
}, rest), children);
|
|
25
25
|
|
|
26
26
|
Alert.propTypes = {
|
|
27
|
+
/** Prop to specify the aria-describedby property of the component */
|
|
28
|
+
"aria-describedby": _propTypes.default.string,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Prop to specify the aria-label of the component.
|
|
32
|
+
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
33
|
+
*/
|
|
34
|
+
"aria-label": _propTypes.default.string,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Prop to specify the aria-labeledby property of the component
|
|
38
|
+
* To be used when the title prop is a custom React Node,
|
|
39
|
+
* or the component is labelled by an internal element other than the title.
|
|
40
|
+
*/
|
|
41
|
+
"aria-labelledby": _propTypes.default.string,
|
|
42
|
+
|
|
27
43
|
/** Alert content */
|
|
28
44
|
children: _propTypes.default.node,
|
|
29
45
|
|
|
@@ -116,7 +116,8 @@ const Confirm = ({
|
|
|
116
116
|
disableClose: disableCancel,
|
|
117
117
|
subtitle: subtitle,
|
|
118
118
|
title: getTitle(),
|
|
119
|
-
"data-component": "confirm"
|
|
119
|
+
"data-component": "confirm",
|
|
120
|
+
role: "alertdialog"
|
|
120
121
|
}, rest), children, /*#__PURE__*/_react.default.createElement(_confirm.StyledConfirmButtons, null, renderCancelButton(), renderConfirmButton()));
|
|
121
122
|
};
|
|
122
123
|
|
|
@@ -131,6 +132,22 @@ Confirm.defaultProps = {
|
|
|
131
132
|
confirmButtonType: "primary"
|
|
132
133
|
};
|
|
133
134
|
Confirm.propTypes = {
|
|
135
|
+
/** Prop to specify the aria-describedby property of the component */
|
|
136
|
+
"aria-describedby": _propTypes.default.string,
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Prop to specify the aria-label of the component.
|
|
140
|
+
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
141
|
+
*/
|
|
142
|
+
"aria-label": _propTypes.default.string,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Prop to specify the aria-labeledby property of the component
|
|
146
|
+
* To be used when the title prop is a custom React Node,
|
|
147
|
+
* or the component is labelled by an internal element other than the title.
|
|
148
|
+
*/
|
|
149
|
+
"aria-labelledby": _propTypes.default.string,
|
|
150
|
+
|
|
134
151
|
/** Confirm content */
|
|
135
152
|
children: _propTypes.default.node,
|
|
136
153
|
|
|
@@ -41,7 +41,6 @@ const Dialog = ({
|
|
|
41
41
|
open,
|
|
42
42
|
height,
|
|
43
43
|
size,
|
|
44
|
-
ariaRole,
|
|
45
44
|
title,
|
|
46
45
|
disableEscKey,
|
|
47
46
|
subtitle,
|
|
@@ -52,6 +51,7 @@ const Dialog = ({
|
|
|
52
51
|
bespokeFocusTrap,
|
|
53
52
|
disableClose,
|
|
54
53
|
help,
|
|
54
|
+
role = "dialog",
|
|
55
55
|
...rest
|
|
56
56
|
}) => {
|
|
57
57
|
const dialogRef = (0, _react.useRef)();
|
|
@@ -131,6 +131,7 @@ const Dialog = ({
|
|
|
131
131
|
hasSubtitle: !!subtitle,
|
|
132
132
|
ref: titleRef
|
|
133
133
|
}, typeof title === "string" ? /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
134
|
+
"data-element": "dialog-title",
|
|
134
135
|
title: title,
|
|
135
136
|
titleId: "carbon-dialog-title",
|
|
136
137
|
subheader: subtitle,
|
|
@@ -148,11 +149,16 @@ const Dialog = ({
|
|
|
148
149
|
|
|
149
150
|
const dialogProps = {
|
|
150
151
|
size,
|
|
151
|
-
dialogHeight
|
|
152
|
+
dialogHeight,
|
|
153
|
+
"aria-labelledby": rest["aria-labelledby"],
|
|
154
|
+
"aria-describedby": subtitle ? "carbon-dialog-subtitle" : rest["aria-describedby"],
|
|
155
|
+
"aria-label": rest["aria-label"]
|
|
152
156
|
};
|
|
153
|
-
|
|
154
|
-
if (title
|
|
155
|
-
|
|
157
|
+
|
|
158
|
+
if (title && typeof title === "string") {
|
|
159
|
+
dialogProps["aria-labelledby"] = "carbon-dialog-title";
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
const componentTags = {
|
|
157
163
|
"data-component": rest["data-component"] || "dialog",
|
|
158
164
|
"data-element": rest["data-element"],
|
|
@@ -170,12 +176,14 @@ const Dialog = ({
|
|
|
170
176
|
bespokeTrap: bespokeFocusTrap,
|
|
171
177
|
wrapperRef: dialogRef
|
|
172
178
|
}, /*#__PURE__*/_react.default.createElement(_dialog.DialogStyle, _extends({
|
|
179
|
+
"aria-modal": true,
|
|
173
180
|
ref: dialogRef,
|
|
174
181
|
topMargin: _dialog2.TOP_MARGIN
|
|
175
182
|
}, dialogProps, {
|
|
176
183
|
"data-component": "dialog",
|
|
177
184
|
"data-element": "dialog",
|
|
178
|
-
"data-role": rest["data-role"]
|
|
185
|
+
"data-role": rest["data-role"],
|
|
186
|
+
role: role
|
|
179
187
|
}), dialogTitle(), /*#__PURE__*/_react.default.createElement(_dialog.DialogContentStyle, null, /*#__PURE__*/_react.default.createElement(_dialog.DialogInnerContentStyle, {
|
|
180
188
|
ref: innerContentRef
|
|
181
189
|
}, _react.default.Children.map(children, child => {
|
|
@@ -190,12 +198,21 @@ const Dialog = ({
|
|
|
190
198
|
};
|
|
191
199
|
|
|
192
200
|
Dialog.propTypes = {
|
|
201
|
+
/** Prop to specify the aria-describedby property of the Dialog component */
|
|
202
|
+
"aria-describedby": _propTypes.default.string,
|
|
203
|
+
|
|
193
204
|
/**
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* @private
|
|
205
|
+
* Prop to specify the aria-label of the Dialog component.
|
|
206
|
+
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
197
207
|
*/
|
|
198
|
-
|
|
208
|
+
"aria-label": _propTypes.default.string,
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Prop to specify the aria-labeledby property of the Dialog component
|
|
212
|
+
* To be used when the title prop is a custom React Node,
|
|
213
|
+
* or the component is labelled by an internal element other than the title.
|
|
214
|
+
*/
|
|
215
|
+
"aria-labelledby": _propTypes.default.string,
|
|
199
216
|
|
|
200
217
|
/** Dialog content */
|
|
201
218
|
children: _propTypes.default.node,
|
|
@@ -246,12 +263,14 @@ Dialog.propTypes = {
|
|
|
246
263
|
* @ignore
|
|
247
264
|
* @private
|
|
248
265
|
*/
|
|
249
|
-
bespokeFocusTrap: _propTypes.default.func
|
|
266
|
+
bespokeFocusTrap: _propTypes.default.func,
|
|
267
|
+
|
|
268
|
+
/** The ARIA role to be applied to the Dialog container */
|
|
269
|
+
role: _propTypes.default.string
|
|
250
270
|
};
|
|
251
271
|
Dialog.defaultProps = {
|
|
252
272
|
size: "medium",
|
|
253
273
|
showCloseIcon: true,
|
|
254
|
-
ariaRole: "dialog",
|
|
255
274
|
disableAutoFocus: false
|
|
256
275
|
};
|
|
257
276
|
var _default = Dialog;
|
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { ModalProps } from "../modal/modal";
|
|
3
3
|
|
|
4
|
+
export type DialogSizes =
|
|
5
|
+
| "auto"
|
|
6
|
+
| "extra-small"
|
|
7
|
+
| "small"
|
|
8
|
+
| "medium-small"
|
|
9
|
+
| "medium"
|
|
10
|
+
| "medium-large"
|
|
11
|
+
| "large"
|
|
12
|
+
| "extra-large";
|
|
13
|
+
|
|
4
14
|
export interface DialogProps extends ModalProps {
|
|
15
|
+
/** Prop to specify the aria-describedby property of the Dialog component */
|
|
16
|
+
"aria-describedby"?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Prop to specify the aria-label of the Dialog component.
|
|
19
|
+
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
20
|
+
*/
|
|
21
|
+
"aria-label"?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Prop to specify the aria-labeledby property of the Dialog component
|
|
24
|
+
* To be used when the title prop is a custom React Node,
|
|
25
|
+
* or the component is labelled by an internal element other than the title.
|
|
26
|
+
*/
|
|
27
|
+
"aria-labelledby"?: string;
|
|
5
28
|
/* Disables auto focus functionality on child elements */
|
|
6
29
|
disableAutoFocus?: boolean;
|
|
7
30
|
/* Disables the focus trap when the dialog is open */
|
|
8
31
|
disableFocusTrap?: boolean;
|
|
9
|
-
|
|
10
|
-
focusFirstElement?:
|
|
32
|
+
/** Optional reference to an element meant to be focused on open */
|
|
33
|
+
focusFirstElement?: React.MutableRefObject<HTMLElement>;
|
|
11
34
|
/** Allows developers to specify a specific height for the dialog. */
|
|
12
35
|
height?: string;
|
|
36
|
+
/** Adds Help tooltip to Header */
|
|
37
|
+
help?: string;
|
|
13
38
|
/** A custom close event handler */
|
|
14
39
|
onCancel?: (
|
|
15
40
|
ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLButtonElement>
|
|
@@ -17,11 +42,13 @@ export interface DialogProps extends ModalProps {
|
|
|
17
42
|
/** Determines if the close icon is shown */
|
|
18
43
|
showCloseIcon?: boolean;
|
|
19
44
|
/** Size of dialog, default size is 750px */
|
|
20
|
-
size?:
|
|
45
|
+
size?: DialogSizes;
|
|
21
46
|
/** Subtitle displayed at top of dialog */
|
|
22
47
|
subtitle?: string;
|
|
23
48
|
/** Title displayed at top of dialog */
|
|
24
49
|
title?: React.ReactNode;
|
|
50
|
+
/** The ARIA role to be applied to the Dialog container */
|
|
51
|
+
role?: string;
|
|
25
52
|
}
|
|
26
53
|
|
|
27
54
|
declare function Dialog(props: DialogProps): JSX.Element;
|
|
@@ -34,6 +34,9 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
34
34
|
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); }
|
|
35
35
|
|
|
36
36
|
const DialogFullScreen = ({
|
|
37
|
+
"aria-describedby": ariaDescribedBy,
|
|
38
|
+
"aria-label": ariaLabel,
|
|
39
|
+
"aria-labelledby": ariaLabelledBy,
|
|
37
40
|
disableAutoFocus,
|
|
38
41
|
focusFirstElement,
|
|
39
42
|
open,
|
|
@@ -48,6 +51,7 @@ const DialogFullScreen = ({
|
|
|
48
51
|
onCancel,
|
|
49
52
|
contentRef,
|
|
50
53
|
help,
|
|
54
|
+
role = "region",
|
|
51
55
|
...rest
|
|
52
56
|
}) => {
|
|
53
57
|
const dialogRef = (0, _react.useRef)();
|
|
@@ -68,6 +72,7 @@ const DialogFullScreen = ({
|
|
|
68
72
|
hasContent: title,
|
|
69
73
|
ref: headingRef
|
|
70
74
|
}, typeof title === "string" ? /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
75
|
+
"data-element": "dialog-title",
|
|
71
76
|
title: title,
|
|
72
77
|
titleId: "carbon-dialog-title",
|
|
73
78
|
subheader: subtitle,
|
|
@@ -90,9 +95,13 @@ const DialogFullScreen = ({
|
|
|
90
95
|
focusFirstElement: focusFirstElement,
|
|
91
96
|
wrapperRef: dialogRef
|
|
92
97
|
}, /*#__PURE__*/_react.default.createElement(_dialogFullScreen.default, {
|
|
98
|
+
"aria-describedby": ariaDescribedBy,
|
|
99
|
+
"aria-label": ariaLabel,
|
|
100
|
+
"aria-labelledby": ariaLabelledBy || "carbon-dialog-title",
|
|
93
101
|
ref: dialogRef,
|
|
94
102
|
"data-element": "dialog-full-screen",
|
|
95
|
-
pagesStyling: pagesStyling
|
|
103
|
+
pagesStyling: pagesStyling,
|
|
104
|
+
role: role
|
|
96
105
|
}, dialogTitle(), /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
97
106
|
hasHeader: title !== undefined,
|
|
98
107
|
"data-element": "content",
|
|
@@ -106,6 +115,22 @@ DialogFullScreen.defaultProps = {
|
|
|
106
115
|
disableAutoFocus: false
|
|
107
116
|
};
|
|
108
117
|
DialogFullScreen.propTypes = {
|
|
118
|
+
/** Prop to specify the aria-describedby property of the DialogFullscreen component */
|
|
119
|
+
"aria-describedby": _propTypes.default.string,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Prop to specify the aria-label of the DialogFullscreen component.
|
|
123
|
+
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
124
|
+
*/
|
|
125
|
+
"aria-label": _propTypes.default.string,
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Prop to specify the aria-labeledby property of the DialogFullscreen component
|
|
129
|
+
* To be used when the title prop is a custom React Node,
|
|
130
|
+
* or the component is labelled by an internal element other than the title.
|
|
131
|
+
*/
|
|
132
|
+
"aria-labelledby": _propTypes.default.string,
|
|
133
|
+
|
|
109
134
|
/** Controls the open state of the component */
|
|
110
135
|
open: _propTypes.default.bool.isRequired,
|
|
111
136
|
|
|
@@ -150,7 +175,10 @@ DialogFullScreen.propTypes = {
|
|
|
150
175
|
/** Reference to the scrollable content element */
|
|
151
176
|
contentRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
152
177
|
current: _propTypes.default.instanceOf(Element)
|
|
153
|
-
})])
|
|
178
|
+
})]),
|
|
179
|
+
|
|
180
|
+
/** The ARIA role to be applied to the DialogFulscreen container */
|
|
181
|
+
role: _propTypes.default.string
|
|
154
182
|
};
|
|
155
183
|
var _default = DialogFullScreen;
|
|
156
184
|
exports.default = _default;
|
|
@@ -2,12 +2,35 @@ import * as React from "react";
|
|
|
2
2
|
import Modal, { ModalProps } from "../modal/modal";
|
|
3
3
|
|
|
4
4
|
export interface DialogFullScreenProps extends ModalProps {
|
|
5
|
+
/** Prop to specify the aria-describedby property of the DialogFullscreen component */
|
|
6
|
+
"aria-describedby"?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Prop to specify the aria-label of the DialogFullscreen component.
|
|
9
|
+
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
10
|
+
*/
|
|
11
|
+
"aria-label"?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Prop to specify the aria-labeledby property of the DialogFullscreen component
|
|
14
|
+
* To be used when the title prop is a custom React Node,
|
|
15
|
+
* or the component is labelled by an internal element other than the title.
|
|
16
|
+
*/
|
|
17
|
+
"aria-labelledby"?: string;
|
|
5
18
|
/** Child elements */
|
|
6
19
|
children?: React.ReactNode;
|
|
20
|
+
/** Reference to the scrollable content element */
|
|
21
|
+
contentRef:
|
|
22
|
+
| React.MutableRefObject<HTMLElement>
|
|
23
|
+
| (() => React.MutableRefObject<HTMLElement>);
|
|
24
|
+
/** Disables auto focus functionality on child elements */
|
|
25
|
+
disableAutoFocus?: boolean;
|
|
7
26
|
/** remove padding from content */
|
|
8
27
|
disableContentPadding?: boolean;
|
|
28
|
+
/** Optional reference to an element meant to be focused on open */
|
|
29
|
+
focusFirstElement?: React.MutableRefObject<HTMLElement>;
|
|
9
30
|
/** Container for components to be displayed in the header */
|
|
10
31
|
headerChildren?: React.ReactNode;
|
|
32
|
+
/** Adds Help tooltip to Header */
|
|
33
|
+
help?: string;
|
|
11
34
|
/** For legacy styling when used with Pages component. Do not use this unless using Pages within a DialogFullScreen */
|
|
12
35
|
pagesStyling?: boolean;
|
|
13
36
|
/** Determines if the close icon is shown */
|
|
@@ -16,8 +39,10 @@ export interface DialogFullScreenProps extends ModalProps {
|
|
|
16
39
|
subtitle?: string;
|
|
17
40
|
/** Title displayed at top of dialog */
|
|
18
41
|
title?: React.ReactNode;
|
|
42
|
+
/** The ARIA role to be applied to the DialogFulscreen container */
|
|
43
|
+
role?: string;
|
|
19
44
|
}
|
|
20
45
|
|
|
21
|
-
declare
|
|
46
|
+
declare function DialogFullScreen(props: DialogFullScreenProps): JSX.Element;
|
|
22
47
|
|
|
23
48
|
export default DialogFullScreen;
|
|
@@ -75,8 +75,8 @@ const StyledIcon = _styledComponents.default.span`
|
|
|
75
75
|
|
|
76
76
|
try {
|
|
77
77
|
if (disabled) {
|
|
78
|
-
finalColor =
|
|
79
|
-
finalHoverColor =
|
|
78
|
+
finalColor = "var(--colorsYin030)";
|
|
79
|
+
finalHoverColor = "var(--colorsYin030)";
|
|
80
80
|
} else if (typeof color === "string" && color.startsWith("var")) {
|
|
81
81
|
finalColor = color;
|
|
82
82
|
finalHoverColor = (0, _polished.shade)(0.2, theme.compatibility[color.replace("var(--", "").replace(")", "")]);
|
|
@@ -90,8 +90,8 @@ const StyledIcon = _styledComponents.default.span`
|
|
|
90
90
|
finalColor = renderedColor;
|
|
91
91
|
finalHoverColor = (0, _polished.shade)(0.2, renderedColor);
|
|
92
92
|
} else {
|
|
93
|
-
finalColor =
|
|
94
|
-
finalHoverColor =
|
|
93
|
+
finalColor = "var(--colorsYin065)";
|
|
94
|
+
finalHoverColor = "var(--colorsYin090)";
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
if (bg) {
|
|
@@ -104,8 +104,8 @@ const StyledIcon = _styledComponents.default.span`
|
|
|
104
104
|
bgColor = backgroundColor;
|
|
105
105
|
bgHoverColor = (0, _polished.shade)(0.2, backgroundColor);
|
|
106
106
|
} else if (disabled) {
|
|
107
|
-
bgColor =
|
|
108
|
-
bgHoverColor =
|
|
107
|
+
bgColor = "var(--colorsYin030)";
|
|
108
|
+
bgHoverColor = "var(--colorsYin030)";
|
|
109
109
|
} else {
|
|
110
110
|
bgColor = "transparent";
|
|
111
111
|
bgHoverColor = "transparent";
|
|
@@ -159,7 +159,7 @@ const StyledIcon = _styledComponents.default.span`
|
|
|
159
159
|
|
|
160
160
|
${hasTooltip && `
|
|
161
161
|
:focus {
|
|
162
|
-
outline: 2px solid
|
|
162
|
+
outline: 2px solid var(--colorsSemanticFocus500);
|
|
163
163
|
}
|
|
164
164
|
`}
|
|
165
165
|
|
|
@@ -38,6 +38,9 @@ const SidebarContext = /*#__PURE__*/_react.default.createContext({});
|
|
|
38
38
|
exports.SidebarContext = SidebarContext;
|
|
39
39
|
|
|
40
40
|
const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
41
|
+
"aria-describedby": ariaDescribedBy,
|
|
42
|
+
"aria-label": ariaLabel,
|
|
43
|
+
"aria-labelledby": ariaLabelledBy,
|
|
41
44
|
open,
|
|
42
45
|
disableEscKey,
|
|
43
46
|
enableBackgroundUI,
|
|
@@ -46,6 +49,7 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
46
49
|
size,
|
|
47
50
|
children,
|
|
48
51
|
onCancel,
|
|
52
|
+
role = "dialog",
|
|
49
53
|
...rest
|
|
50
54
|
}, ref) => {
|
|
51
55
|
let sidebarRef = (0, _react.useRef)();
|
|
@@ -69,12 +73,16 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
69
73
|
};
|
|
70
74
|
|
|
71
75
|
const sidebar = /*#__PURE__*/_react.default.createElement(_sidebar.default, {
|
|
76
|
+
"aria-modal": !enableBackgroundUI,
|
|
77
|
+
"aria-describedby": ariaDescribedBy,
|
|
78
|
+
"aria-label": ariaLabel,
|
|
79
|
+
"aria-labelledby": ariaLabelledBy,
|
|
72
80
|
ref: sidebarRef,
|
|
73
81
|
position: position,
|
|
74
82
|
size: size,
|
|
75
83
|
"data-element": "sidebar",
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
onCancel: onCancel,
|
|
85
|
+
role: role
|
|
78
86
|
}, closeIcon(), header && /*#__PURE__*/_react.default.createElement(_sidebarHeader.default, null, header), /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
79
87
|
"data-element": "sidebar-content",
|
|
80
88
|
p: 4,
|
|
@@ -100,6 +108,15 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
100
108
|
});
|
|
101
109
|
|
|
102
110
|
Sidebar.propTypes = {
|
|
111
|
+
/** Prop to specify the aria-describedby property of the component */
|
|
112
|
+
"aria-describedby": _propTypes.default.string,
|
|
113
|
+
|
|
114
|
+
/** Prop to specify the aria-label of the component */
|
|
115
|
+
"aria-label": _propTypes.default.string,
|
|
116
|
+
|
|
117
|
+
/** Prop to specify the aria-labeledby property of the component */
|
|
118
|
+
"aria-labelledby": _propTypes.default.string,
|
|
119
|
+
|
|
103
120
|
/** Modal content */
|
|
104
121
|
children: _propTypes.default.node,
|
|
105
122
|
|
|
@@ -122,7 +139,10 @@ Sidebar.propTypes = {
|
|
|
122
139
|
size: _propTypes.default.oneOf(_sidebar2.SIDEBAR_SIZES),
|
|
123
140
|
|
|
124
141
|
/** Node that will be used as sidebar header. */
|
|
125
|
-
header: _propTypes.default.node
|
|
142
|
+
header: _propTypes.default.node,
|
|
143
|
+
|
|
144
|
+
/** The ARIA role to be applied to the container */
|
|
145
|
+
role: _propTypes.default.string
|
|
126
146
|
};
|
|
127
147
|
Sidebar.defaultProps = {
|
|
128
148
|
position: "right",
|
|
@@ -4,6 +4,19 @@ export interface SidebarContextProps {
|
|
|
4
4
|
isInSidebar: boolean;
|
|
5
5
|
}
|
|
6
6
|
export interface SidebarProps {
|
|
7
|
+
/** Prop to specify the aria-describedby property of the component */
|
|
8
|
+
"aria-describedby"?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Prop to specify the aria-label of the component.
|
|
11
|
+
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
12
|
+
*/
|
|
13
|
+
"aria-label"?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Prop to specify the aria-labeledby property of the component
|
|
16
|
+
* To be used when the title prop is a custom React Node,
|
|
17
|
+
* or the component is labelled by an internal element other than the title.
|
|
18
|
+
*/
|
|
19
|
+
"aria-labelledby"?: string;
|
|
7
20
|
/** Modal content */
|
|
8
21
|
children?: React.ReactNode;
|
|
9
22
|
/** Determines if the Esc Key closes the modal */
|
|
@@ -18,6 +31,8 @@ export interface SidebarProps {
|
|
|
18
31
|
open: boolean;
|
|
19
32
|
/** Sets the position of sidebar, either left or right. */
|
|
20
33
|
position?: "left" | "right";
|
|
34
|
+
/** The ARIA role to be applied to the component container */
|
|
35
|
+
role?: string;
|
|
21
36
|
/** Sets the size of the sidebar when open. */
|
|
22
37
|
size?:
|
|
23
38
|
| "extra-small"
|
|
@@ -21,7 +21,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
21
21
|
|
|
22
22
|
const pointerColor = (type, theme, bgColor) => {
|
|
23
23
|
if (bgColor) return (0, _color.toColor)(theme, bgColor);
|
|
24
|
-
return type === "error" ?
|
|
24
|
+
return type === "error" ? "var(--colorsSemanticNegative500)" : "var(--colorsSemanticNeutral500)";
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const StyledTooltipPointer = _styledComponents.default.div`
|
|
@@ -39,7 +39,7 @@ const StyledTooltipPointer = _styledComponents.default.div`
|
|
|
39
39
|
border-left: 8px solid transparent;
|
|
40
40
|
border-right: 8px solid transparent;
|
|
41
41
|
border-top: 8px solid ${pointerColor(type, theme, bgColor)};
|
|
42
|
-
bottom:
|
|
42
|
+
bottom: calc(-1 * var(--spacing100));
|
|
43
43
|
@-moz-document url-prefix() {
|
|
44
44
|
bottom: -7px;
|
|
45
45
|
}
|
|
@@ -49,7 +49,7 @@ const StyledTooltipPointer = _styledComponents.default.div`
|
|
|
49
49
|
border-left: 8px solid transparent;
|
|
50
50
|
border-right: 8px solid transparent;
|
|
51
51
|
border-bottom: 8px solid ${pointerColor(type, theme, bgColor)};
|
|
52
|
-
top:
|
|
52
|
+
top: calc(-1 * var(--spacing100));
|
|
53
53
|
@-moz-document url-prefix() {
|
|
54
54
|
top: -7px;
|
|
55
55
|
}
|
|
@@ -59,7 +59,7 @@ const StyledTooltipPointer = _styledComponents.default.div`
|
|
|
59
59
|
border-top: 8px solid transparent;
|
|
60
60
|
border-bottom: 8px solid transparent;
|
|
61
61
|
border-right: 8px solid ${pointerColor(type, theme, bgColor)};
|
|
62
|
-
left:
|
|
62
|
+
left: calc(-1 * var(--spacing100));
|
|
63
63
|
@-moz-document url-prefix() {
|
|
64
64
|
left: -7px;
|
|
65
65
|
}
|
|
@@ -69,7 +69,7 @@ const StyledTooltipPointer = _styledComponents.default.div`
|
|
|
69
69
|
border-top: 8px solid transparent;
|
|
70
70
|
border-bottom: 8px solid transparent;
|
|
71
71
|
border-left: 8px solid ${pointerColor(type, theme, bgColor)};
|
|
72
|
-
right:
|
|
72
|
+
right: calc(-1 * var(--spacing100));
|
|
73
73
|
@-moz-document url-prefix() {
|
|
74
74
|
right: -7px;
|
|
75
75
|
}
|
|
@@ -83,7 +83,8 @@ StyledTooltipPointer.defaultProps = {
|
|
|
83
83
|
StyledTooltipPointer.propTypes = {
|
|
84
84
|
position: _propTypes.default.oneOf(["bottom", "left", "right", "top"]),
|
|
85
85
|
theme: _propTypes.default.object,
|
|
86
|
-
type: _propTypes.default.string
|
|
86
|
+
type: _propTypes.default.string,
|
|
87
|
+
bgColor: _propTypes.default.string
|
|
87
88
|
};
|
|
88
89
|
var _default = StyledTooltipPointer;
|
|
89
90
|
exports.default = _default;
|
|
@@ -11,12 +11,16 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _headless = _interopRequireDefault(require("@tippyjs/react/headless"));
|
|
13
13
|
|
|
14
|
+
var _styledComponents = require("styled-components");
|
|
15
|
+
|
|
14
16
|
var _tooltip = _interopRequireDefault(require("./tooltip.style"));
|
|
15
17
|
|
|
16
18
|
var _tooltipPointer = _interopRequireDefault(require("./tooltip-pointer.style"));
|
|
17
19
|
|
|
18
20
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
19
21
|
|
|
22
|
+
var _carbonScopedTokensProvider = require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component");
|
|
23
|
+
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
25
|
|
|
22
26
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -43,10 +47,12 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
43
47
|
...rest
|
|
44
48
|
}, ref) => {
|
|
45
49
|
const tooltipRef = (0, _react.useRef)(ref || null);
|
|
50
|
+
const theme = (0, _react.useContext)(_styledComponents.ThemeContext);
|
|
46
51
|
|
|
47
52
|
const tooltip = (attrs, content) => {
|
|
48
53
|
const currentPosition = attrs["data-placement"] || position;
|
|
49
54
|
return /*#__PURE__*/_react.default.createElement(_tooltip.default, _extends({
|
|
55
|
+
className: (0, _carbonScopedTokensProvider.tokensClassName)(theme === null || theme === void 0 ? void 0 : theme.name),
|
|
50
56
|
"data-element": "tooltip",
|
|
51
57
|
role: "tooltip",
|
|
52
58
|
tabIndex: "-1",
|
|
@@ -31,7 +31,7 @@ const fadeIn = (0, _styledComponents.keyframes)`
|
|
|
31
31
|
|
|
32
32
|
const tooltipColor = (type, theme, bgColor) => {
|
|
33
33
|
if (bgColor) return (0, _color.toColor)(theme, bgColor);
|
|
34
|
-
return type === "error" ?
|
|
34
|
+
return type === "error" ? "var(--colorsSemanticNegative500)" : "var(--colorsSemanticNeutral500)";
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const tooltipOffset = (position, inputSize, isPartOfInput) => {
|
|
@@ -84,9 +84,9 @@ const StyledTooltipWrapper = _styledComponents.default.div`
|
|
|
84
84
|
max-width: 300px;
|
|
85
85
|
position: relative;
|
|
86
86
|
animation: ${fadeIn} 0.2s linear;
|
|
87
|
-
z-index: ${theme.zIndex.popover};
|
|
87
|
+
z-index: ${theme.zIndex.popover}; // TODO (tokens): implement elevation tokens - FE-4437
|
|
88
88
|
text-align: left;
|
|
89
|
-
color: ${fontColor ? (0, _color.toColor)(theme, fontColor) :
|
|
89
|
+
color: ${fontColor ? (0, _color.toColor)(theme, fontColor) : "var(--colorsSemanticNeutralYang100)"};
|
|
90
90
|
display: inline-block;
|
|
91
91
|
padding: 8px 12px;
|
|
92
92
|
word-break: break-word;
|
|
@@ -99,8 +99,14 @@ const StyledTooltipWrapper = _styledComponents.default.div`
|
|
|
99
99
|
`}
|
|
100
100
|
`;
|
|
101
101
|
StyledTooltipWrapper.propTypes = {
|
|
102
|
+
position: _propTypes.default.oneOf(["top", "bottom", "left", "right"]),
|
|
103
|
+
size: _propTypes.default.oneOf(["medium", "large"]),
|
|
104
|
+
theme: _propTypes.default.object,
|
|
102
105
|
type: _propTypes.default.string,
|
|
103
|
-
|
|
106
|
+
isPartOfInput: _propTypes.default.bool,
|
|
107
|
+
inputSize: _propTypes.default.oneOf(["small", "medium", "large"]),
|
|
108
|
+
bgColor: _propTypes.default.string,
|
|
109
|
+
fontColor: _propTypes.default.string
|
|
104
110
|
};
|
|
105
111
|
StyledTooltipWrapper.defaultProps = {
|
|
106
112
|
theme: _base.default,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "102.
|
|
3
|
+
"version": "102.10.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"engineStrict": true,
|
|
6
6
|
"engines": {
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"dependencies": {
|
|
146
146
|
"@octokit/rest": "^18.12.0",
|
|
147
147
|
"@popperjs/core": "^2.9.0",
|
|
148
|
-
"@sage/design-tokens": "^1.
|
|
148
|
+
"@sage/design-tokens": "^1.87.1",
|
|
149
149
|
"@styled-system/prop-types": "^5.1.5",
|
|
150
150
|
"@tippyjs/react": "^4.2.5",
|
|
151
151
|
"classnames": "~2.2.6",
|