carbon-react 111.0.2 → 111.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/content/content.component.d.ts +13 -0
- package/esm/components/content/content.component.js +186 -46
- package/esm/components/content/content.style.d.ts +41 -0
- package/esm/components/content/index.d.ts +2 -2
- package/esm/components/content/index.js +1 -1
- package/esm/components/select/multi-select/multi-select.component.js +0 -1
- package/esm/components/select/option-row/option-row.component.js +7 -1
- package/esm/components/select/select-list/select-list.component.js +8 -2
- package/esm/components/toast/toast.component.js +10 -5
- package/esm/components/toast/toast.d.ts +1 -1
- package/esm/components/toast/toast.style.js +73 -8
- package/esm/components/typography/typography.component.js +1 -0
- package/lib/components/content/content.component.d.ts +13 -0
- package/lib/components/content/content.component.js +187 -50
- package/lib/components/content/content.style.d.ts +41 -0
- package/lib/components/content/index.d.ts +2 -2
- package/lib/components/content/index.js +2 -2
- package/lib/components/select/multi-select/multi-select.component.js +0 -1
- package/lib/components/select/option-row/option-row.component.js +7 -1
- package/lib/components/select/select-list/select-list.component.js +8 -2
- package/lib/components/toast/toast.component.js +10 -5
- package/lib/components/toast/toast.d.ts +1 -1
- package/lib/components/toast/toast.style.js +74 -8
- package/lib/components/typography/typography.component.js +1 -0
- package/package.json +2 -3
- package/scripts/check_carbon_version/check_carbon_version.js +2 -1
- package/scripts/check_rfcs/check_rfcs.js +2 -1
- package/esm/components/content/content.d.ts +0 -26
- package/lib/components/content/content.d.ts +0 -26
|
@@ -3,24 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.Content = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _contentStyle = require("./content.style.js");
|
|
15
|
-
|
|
16
|
-
var _utils = require("../../style/utils");
|
|
12
|
+
var _content = require("./content.style");
|
|
17
13
|
|
|
18
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
15
|
|
|
20
16
|
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); }
|
|
21
17
|
|
|
22
|
-
const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
|
|
23
|
-
|
|
24
18
|
const Content = ({
|
|
25
19
|
variant = "primary",
|
|
26
20
|
children,
|
|
@@ -30,49 +24,192 @@ const Content = ({
|
|
|
30
24
|
titleWidth,
|
|
31
25
|
bodyFullWidth = false,
|
|
32
26
|
...rest
|
|
33
|
-
}) =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/** Applies a theme to the Content Value: primary, secondary */
|
|
56
|
-
variant: _propTypes.default.oneOf(["primary", "secondary"]),
|
|
57
|
-
|
|
58
|
-
/** The body of the content component */
|
|
59
|
-
children: _propTypes.default.node,
|
|
60
|
-
|
|
61
|
-
/** The title of the content component */
|
|
62
|
-
title: _propTypes.default.node,
|
|
63
|
-
|
|
64
|
-
/** Displays the content inline with the title */
|
|
65
|
-
inline: _propTypes.default.bool,
|
|
66
|
-
|
|
67
|
-
/** Aligns the content (left, center or right) */
|
|
68
|
-
align: _propTypes.default.oneOf(["left", "center", "right"]),
|
|
69
|
-
|
|
70
|
-
/** Sets a custom width for the title element */
|
|
71
|
-
titleWidth: _propTypes.default.string,
|
|
27
|
+
}) => {
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_content.StyledContent, _extends({
|
|
29
|
+
align: align,
|
|
30
|
+
bodyFullWidth: bodyFullWidth
|
|
31
|
+
}, rest, {
|
|
32
|
+
"data-component": "content"
|
|
33
|
+
}), /*#__PURE__*/_react.default.createElement(_content.StyledContentTitle, {
|
|
34
|
+
variant: variant,
|
|
35
|
+
inline: inline,
|
|
36
|
+
"data-element": "content-title",
|
|
37
|
+
titleWidth: titleWidth,
|
|
38
|
+
align: align
|
|
39
|
+
}, title), /*#__PURE__*/_react.default.createElement(_content.StyledContentBody, {
|
|
40
|
+
variant: variant,
|
|
41
|
+
inline: inline,
|
|
42
|
+
"data-element": "content-body",
|
|
43
|
+
bodyFullWidth: bodyFullWidth,
|
|
44
|
+
titleWidth: titleWidth,
|
|
45
|
+
align: align
|
|
46
|
+
}, children));
|
|
47
|
+
};
|
|
72
48
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
49
|
+
exports.Content = Content;
|
|
50
|
+
Content.propTypes = {
|
|
51
|
+
"align": _propTypes.default.oneOf(["center", "left", "right"]),
|
|
52
|
+
"bodyFullWidth": _propTypes.default.bool,
|
|
53
|
+
"children": _propTypes.default.node,
|
|
54
|
+
"inline": _propTypes.default.bool,
|
|
55
|
+
"m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
56
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
57
|
+
"description": _propTypes.default.string,
|
|
58
|
+
"toString": _propTypes.default.func.isRequired,
|
|
59
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
60
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
61
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
62
|
+
"description": _propTypes.default.string,
|
|
63
|
+
"toString": _propTypes.default.func.isRequired,
|
|
64
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
65
|
+
}), _propTypes.default.string]),
|
|
66
|
+
"margin": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
67
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
68
|
+
"description": _propTypes.default.string,
|
|
69
|
+
"toString": _propTypes.default.func.isRequired,
|
|
70
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
71
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
72
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
73
|
+
"description": _propTypes.default.string,
|
|
74
|
+
"toString": _propTypes.default.func.isRequired,
|
|
75
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
76
|
+
}), _propTypes.default.string]),
|
|
77
|
+
"marginBottom": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
78
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
79
|
+
"description": _propTypes.default.string,
|
|
80
|
+
"toString": _propTypes.default.func.isRequired,
|
|
81
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
82
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
83
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
84
|
+
"description": _propTypes.default.string,
|
|
85
|
+
"toString": _propTypes.default.func.isRequired,
|
|
86
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
87
|
+
}), _propTypes.default.string]),
|
|
88
|
+
"marginLeft": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
89
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
90
|
+
"description": _propTypes.default.string,
|
|
91
|
+
"toString": _propTypes.default.func.isRequired,
|
|
92
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
93
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
94
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
95
|
+
"description": _propTypes.default.string,
|
|
96
|
+
"toString": _propTypes.default.func.isRequired,
|
|
97
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
98
|
+
}), _propTypes.default.string]),
|
|
99
|
+
"marginRight": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
100
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
101
|
+
"description": _propTypes.default.string,
|
|
102
|
+
"toString": _propTypes.default.func.isRequired,
|
|
103
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
104
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
105
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
106
|
+
"description": _propTypes.default.string,
|
|
107
|
+
"toString": _propTypes.default.func.isRequired,
|
|
108
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
109
|
+
}), _propTypes.default.string]),
|
|
110
|
+
"marginTop": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
111
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
112
|
+
"description": _propTypes.default.string,
|
|
113
|
+
"toString": _propTypes.default.func.isRequired,
|
|
114
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
115
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
116
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
117
|
+
"description": _propTypes.default.string,
|
|
118
|
+
"toString": _propTypes.default.func.isRequired,
|
|
119
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
120
|
+
}), _propTypes.default.string]),
|
|
121
|
+
"marginX": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
122
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
123
|
+
"description": _propTypes.default.string,
|
|
124
|
+
"toString": _propTypes.default.func.isRequired,
|
|
125
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
126
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
127
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
128
|
+
"description": _propTypes.default.string,
|
|
129
|
+
"toString": _propTypes.default.func.isRequired,
|
|
130
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
131
|
+
}), _propTypes.default.string]),
|
|
132
|
+
"marginY": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
133
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
134
|
+
"description": _propTypes.default.string,
|
|
135
|
+
"toString": _propTypes.default.func.isRequired,
|
|
136
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
137
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
138
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
139
|
+
"description": _propTypes.default.string,
|
|
140
|
+
"toString": _propTypes.default.func.isRequired,
|
|
141
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
142
|
+
}), _propTypes.default.string]),
|
|
143
|
+
"mb": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
144
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
145
|
+
"description": _propTypes.default.string,
|
|
146
|
+
"toString": _propTypes.default.func.isRequired,
|
|
147
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
148
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
149
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
150
|
+
"description": _propTypes.default.string,
|
|
151
|
+
"toString": _propTypes.default.func.isRequired,
|
|
152
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
153
|
+
}), _propTypes.default.string]),
|
|
154
|
+
"ml": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
155
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
156
|
+
"description": _propTypes.default.string,
|
|
157
|
+
"toString": _propTypes.default.func.isRequired,
|
|
158
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
159
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
160
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
161
|
+
"description": _propTypes.default.string,
|
|
162
|
+
"toString": _propTypes.default.func.isRequired,
|
|
163
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
164
|
+
}), _propTypes.default.string]),
|
|
165
|
+
"mr": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
166
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
167
|
+
"description": _propTypes.default.string,
|
|
168
|
+
"toString": _propTypes.default.func.isRequired,
|
|
169
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
170
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
171
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
172
|
+
"description": _propTypes.default.string,
|
|
173
|
+
"toString": _propTypes.default.func.isRequired,
|
|
174
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
175
|
+
}), _propTypes.default.string]),
|
|
176
|
+
"mt": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
177
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
178
|
+
"description": _propTypes.default.string,
|
|
179
|
+
"toString": _propTypes.default.func.isRequired,
|
|
180
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
181
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
182
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
183
|
+
"description": _propTypes.default.string,
|
|
184
|
+
"toString": _propTypes.default.func.isRequired,
|
|
185
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
186
|
+
}), _propTypes.default.string]),
|
|
187
|
+
"mx": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
188
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
189
|
+
"description": _propTypes.default.string,
|
|
190
|
+
"toString": _propTypes.default.func.isRequired,
|
|
191
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
192
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
193
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
194
|
+
"description": _propTypes.default.string,
|
|
195
|
+
"toString": _propTypes.default.func.isRequired,
|
|
196
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
197
|
+
}), _propTypes.default.string]),
|
|
198
|
+
"my": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
199
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
200
|
+
"description": _propTypes.default.string,
|
|
201
|
+
"toString": _propTypes.default.func.isRequired,
|
|
202
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
203
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
204
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
205
|
+
"description": _propTypes.default.string,
|
|
206
|
+
"toString": _propTypes.default.func.isRequired,
|
|
207
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
208
|
+
}), _propTypes.default.string]),
|
|
209
|
+
"title": _propTypes.default.node,
|
|
210
|
+
"titleWidth": _propTypes.default.string,
|
|
211
|
+
"variant": _propTypes.default.oneOf(["primary", "secondary"])
|
|
76
212
|
};
|
|
213
|
+
Content.displayName = "Content";
|
|
77
214
|
var _default = Content;
|
|
78
215
|
exports.default = _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MarginProps } from "styled-system";
|
|
2
|
+
export declare type AlignOptions = "left" | "center" | "right";
|
|
3
|
+
export declare type VariantOptions = "primary" | "secondary";
|
|
4
|
+
export interface StyledContentProps extends MarginProps {
|
|
5
|
+
/** Aligns the content (left, center or right) */
|
|
6
|
+
align?: AlignOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Over-rides the calculation of body width based on titleWidth.
|
|
9
|
+
* Sometimes we need the body to be full width while keeping a title width similar to other widths
|
|
10
|
+
*/
|
|
11
|
+
bodyFullWidth?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const StyledContent: import("styled-components").StyledComponent<"div", any, StyledContentProps, never>;
|
|
14
|
+
export interface StyledContentTitleProps {
|
|
15
|
+
/** Aligns the content (left, center or right) */
|
|
16
|
+
align?: AlignOptions;
|
|
17
|
+
/** Displays the content inline with the title */
|
|
18
|
+
inline?: boolean;
|
|
19
|
+
/** Sets a custom width for the title element */
|
|
20
|
+
titleWidth?: string;
|
|
21
|
+
/** Applies a theme to the Content Value: primary, secondary */
|
|
22
|
+
variant?: VariantOptions;
|
|
23
|
+
}
|
|
24
|
+
declare const StyledContentTitle: import("styled-components").StyledComponent<"div", any, StyledContentTitleProps, never>;
|
|
25
|
+
export interface StyledContentBodyProps {
|
|
26
|
+
/** Aligns the content (left, center or right) */
|
|
27
|
+
align?: AlignOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Over-rides the calculation of body width based on titleWidth.
|
|
30
|
+
* Sometimes we need the body to be full width while keeping a title width similar to other widths
|
|
31
|
+
*/
|
|
32
|
+
bodyFullWidth?: boolean;
|
|
33
|
+
/** Displays the content inline with the title */
|
|
34
|
+
inline?: boolean;
|
|
35
|
+
/** Sets a custom width for the title element */
|
|
36
|
+
titleWidth?: string;
|
|
37
|
+
/** Applies a theme to the Content Value: primary, secondary */
|
|
38
|
+
variant?: VariantOptions;
|
|
39
|
+
}
|
|
40
|
+
declare const StyledContentBody: import("styled-components").StyledComponent<"div", any, StyledContentBodyProps, never>;
|
|
41
|
+
export { StyledContent, StyledContentTitle, StyledContentBody };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./content";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./content.component";
|
|
2
|
+
export type { ContentProps } from "./content.component";
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "default", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _content.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _content = _interopRequireDefault(require("./content.component"));
|
|
14
14
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -437,7 +437,6 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
437
437
|
|
|
438
438
|
const selectList = /*#__PURE__*/_react.default.createElement(FilterableSelectList, {
|
|
439
439
|
ref: listboxRef,
|
|
440
|
-
"aria-multiselectable": true,
|
|
441
440
|
id: selectListId.current,
|
|
442
441
|
labelId: labelId.current,
|
|
443
442
|
anchorElement: textboxRef && textboxRef.parentElement,
|
|
@@ -37,10 +37,16 @@ const OptionRow = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
const selectListContext = (0, _react.useContext)(_selectListContext.default);
|
|
40
|
+
let isSelected = selectListContext.currentOptionsListIndex === index;
|
|
41
|
+
|
|
42
|
+
if (selectListContext.multiselectValues) {
|
|
43
|
+
isSelected = selectListContext.multiselectValues.includes(value);
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
return /*#__PURE__*/_react.default.createElement(_optionRow.default, {
|
|
41
47
|
id: id,
|
|
42
48
|
ref: ref,
|
|
43
|
-
"aria-selected":
|
|
49
|
+
"aria-selected": isSelected,
|
|
44
50
|
"data-component": "option-row",
|
|
45
51
|
onClick: handleClick,
|
|
46
52
|
isHighlighted: selectListContext.currentOptionsListIndex === index,
|
|
@@ -68,6 +68,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
68
68
|
listPlacement = "bottom",
|
|
69
69
|
flipEnabled = true,
|
|
70
70
|
isOpen,
|
|
71
|
+
multiselectValues,
|
|
71
72
|
...listProps
|
|
72
73
|
}, listContainerRef) => {
|
|
73
74
|
const [currentOptionsListIndex, setCurrentOptionsListIndex] = (0, _react.useState)(-1);
|
|
@@ -350,7 +351,8 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
350
351
|
ref: listContainerRef
|
|
351
352
|
}, /*#__PURE__*/_react.default.createElement(_selectListContext.default.Provider, {
|
|
352
353
|
value: {
|
|
353
|
-
currentOptionsListIndex
|
|
354
|
+
currentOptionsListIndex,
|
|
355
|
+
multiselectValues
|
|
354
356
|
}
|
|
355
357
|
}, /*#__PURE__*/_react.default.createElement(_selectListContainer.default, _extends({
|
|
356
358
|
"data-element": "select-list-wrapper"
|
|
@@ -360,6 +362,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
360
362
|
"aria-labelledby": labelId,
|
|
361
363
|
"data-element": "select-list",
|
|
362
364
|
role: "listbox",
|
|
365
|
+
"aria-multiselectable": multiselectValues ? true : undefined,
|
|
363
366
|
ref: listCallbackRef,
|
|
364
367
|
tabIndex: "-1",
|
|
365
368
|
isLoading: isLoading,
|
|
@@ -433,7 +436,10 @@ SelectList.propTypes = {
|
|
|
433
436
|
/** @private @ignore
|
|
434
437
|
* Hides the list (with CSS display: none) if not set
|
|
435
438
|
*/
|
|
436
|
-
isOpen: _propTypes.default.bool
|
|
439
|
+
isOpen: _propTypes.default.bool,
|
|
440
|
+
|
|
441
|
+
/** array of selected values, if rendered as part of a MultiSelect */
|
|
442
|
+
multiselectValues: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.arrayOf(_propTypes.default.object)])
|
|
437
443
|
};
|
|
438
444
|
var _default = SelectList;
|
|
439
445
|
exports.default = _default;
|
|
@@ -49,6 +49,7 @@ const Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
49
49
|
disableAutoFocus,
|
|
50
50
|
...restProps
|
|
51
51
|
}, ref) => {
|
|
52
|
+
const isNotice = variant === "notice";
|
|
52
53
|
const locale = (0, _useLocale.default)();
|
|
53
54
|
const toastRef = (0, _react.useRef)();
|
|
54
55
|
const timer = (0, _react.useRef)();
|
|
@@ -118,7 +119,7 @@ const Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
118
119
|
};
|
|
119
120
|
return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
|
|
120
121
|
enter: true,
|
|
121
|
-
classNames: "toast",
|
|
122
|
+
classNames: isNotice ? "toast-alternative" : "toast",
|
|
122
123
|
timeout: {
|
|
123
124
|
appear: 1600,
|
|
124
125
|
enter: 1500,
|
|
@@ -126,14 +127,16 @@ const Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
126
127
|
},
|
|
127
128
|
nodeRef: toastContentNodeRef
|
|
128
129
|
}, /*#__PURE__*/_react.default.createElement(_toast.ToastStyle, _extends({
|
|
130
|
+
isNotice: isNotice,
|
|
129
131
|
className: componentClasses
|
|
130
132
|
}, (0, _tags.default)(restProps["data-component"] || "toast", restProps), toastProps, {
|
|
131
133
|
ref: toastContentNodeRef
|
|
132
|
-
}), /*#__PURE__*/_react.default.createElement(_toast.TypeIcon, {
|
|
134
|
+
}), !isNotice && /*#__PURE__*/_react.default.createElement(_toast.TypeIcon, {
|
|
133
135
|
variant: toastProps.variant
|
|
134
136
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
135
137
|
type: toastProps.variant
|
|
136
138
|
})), /*#__PURE__*/_react.default.createElement(_toast.ToastContentStyle, {
|
|
139
|
+
isNotice: isNotice,
|
|
137
140
|
variant: toastProps.variant,
|
|
138
141
|
isDismiss: onDismiss
|
|
139
142
|
}, children), renderCloseIcon()));
|
|
@@ -141,16 +144,18 @@ const Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
141
144
|
|
|
142
145
|
return /*#__PURE__*/_react.default.createElement(_toast.StyledPortal, {
|
|
143
146
|
id: targetPortalId,
|
|
144
|
-
isCenter: isCenter
|
|
147
|
+
isCenter: isCenter,
|
|
148
|
+
isNotice: isNotice
|
|
145
149
|
}, /*#__PURE__*/_react.default.createElement(_toast.ToastWrapper, {
|
|
146
150
|
isCenter: isCenter,
|
|
147
|
-
ref: refToPass
|
|
151
|
+
ref: refToPass,
|
|
152
|
+
isNotice: isNotice
|
|
148
153
|
}, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, null, renderToastContent())));
|
|
149
154
|
});
|
|
150
155
|
|
|
151
156
|
Toast.propTypes = {
|
|
152
157
|
/** Customizes the appearance in the DLS theme */
|
|
153
|
-
variant: _propTypes.default.oneOf(["error", "info", "success", "warning"]),
|
|
158
|
+
variant: _propTypes.default.oneOf(["error", "info", "success", "warning", "notice"]),
|
|
154
159
|
|
|
155
160
|
/** Custom className */
|
|
156
161
|
className: _propTypes.default.string,
|
|
@@ -25,6 +25,8 @@ var _portal = _interopRequireDefault(require("../portal/portal"));
|
|
|
25
25
|
|
|
26
26
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
27
27
|
|
|
28
|
+
var _icon = _interopRequireDefault(require("../icon/icon.style"));
|
|
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; }
|
|
@@ -46,6 +48,14 @@ const StyledPortal = (0, _styledComponents.default)(_portal.default)`
|
|
|
46
48
|
margin-left: 50%;
|
|
47
49
|
transform: translateX(-50%);
|
|
48
50
|
`}
|
|
51
|
+
|
|
52
|
+
${({
|
|
53
|
+
isNotice
|
|
54
|
+
}) => isNotice && (0, _styledComponents.css)`
|
|
55
|
+
bottom: 0;
|
|
56
|
+
top: auto;
|
|
57
|
+
width: 100%;
|
|
58
|
+
`}
|
|
49
59
|
`}
|
|
50
60
|
`;
|
|
51
61
|
exports.StyledPortal = StyledPortal;
|
|
@@ -53,6 +63,7 @@ StyledPortal.defaultProps = {
|
|
|
53
63
|
theme: _base.default
|
|
54
64
|
};
|
|
55
65
|
const animationName = ".toast";
|
|
66
|
+
const alternativeAnimationName = ".toast-alternative";
|
|
56
67
|
const ToastStyle = (0, _styledComponents.default)(_message.default)`
|
|
57
68
|
${({
|
|
58
69
|
maxWidth,
|
|
@@ -66,24 +77,23 @@ const ToastStyle = (0, _styledComponents.default)(_message.default)`
|
|
|
66
77
|
position: relative;
|
|
67
78
|
margin-right: ${isCenter ? "auto" : "30px"};
|
|
68
79
|
`}
|
|
69
|
-
|
|
70
80
|
|
|
71
81
|
&${animationName}-appear,
|
|
72
82
|
&${animationName}-enter {
|
|
73
83
|
opacity: 0;
|
|
74
|
-
transform: scale(0.5)
|
|
84
|
+
transform: scale(0.5);
|
|
75
85
|
}
|
|
76
86
|
|
|
77
|
-
&${animationName}-appear
|
|
78
|
-
|
|
87
|
+
&${animationName}-appear${animationName}-appear-active,
|
|
88
|
+
&${animationName}-enter${animationName}-enter-active {
|
|
79
89
|
opacity: 1;
|
|
80
90
|
transform: ${({
|
|
81
91
|
isCenter
|
|
82
92
|
}) => isCenter ? " scale(1) translateY(0)" : "scale(1)"};
|
|
83
|
-
transition: all 300ms cubic-bezier(0.
|
|
93
|
+
transition: all 300ms cubic-bezier(0.25, 0.25, 0, 1.5);
|
|
84
94
|
}
|
|
85
95
|
|
|
86
|
-
&${animationName}-exit
|
|
96
|
+
&${animationName}-exit${animationName}-exit-active {
|
|
87
97
|
opacity: 0;
|
|
88
98
|
margin-top: -40px;
|
|
89
99
|
transition: all 150ms ease-out;
|
|
@@ -95,15 +105,65 @@ const ToastStyle = (0, _styledComponents.default)(_message.default)`
|
|
|
95
105
|
top: 50%;
|
|
96
106
|
transform: translateY(-50%);
|
|
97
107
|
}
|
|
108
|
+
|
|
109
|
+
${({
|
|
110
|
+
isNotice
|
|
111
|
+
}) => isNotice && (0, _styledComponents.css)`
|
|
112
|
+
background-color: var(--colorsUtilityMajor400);
|
|
113
|
+
border: none;
|
|
114
|
+
color: var(--colorsSemanticNeutralYang100);
|
|
115
|
+
margin-right: 0;
|
|
116
|
+
max-width: 100%;
|
|
117
|
+
|
|
118
|
+
${_iconButton.default} {
|
|
119
|
+
right: 55px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
${_iconButton.default} ${_icon.default} {
|
|
123
|
+
color: var(--colorsSemanticNeutralYang100);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&${alternativeAnimationName}-appear, &${alternativeAnimationName}-enter {
|
|
127
|
+
bottom: -40px;
|
|
128
|
+
opacity: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&${alternativeAnimationName}-exit {
|
|
132
|
+
bottom: 0;
|
|
133
|
+
opacity: 1;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&${alternativeAnimationName}-appear${alternativeAnimationName}-appear-active,
|
|
137
|
+
&${alternativeAnimationName}-enter${alternativeAnimationName}-enter-active {
|
|
138
|
+
bottom: 0;
|
|
139
|
+
opacity: 1;
|
|
140
|
+
transition: all 400ms ease;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&${alternativeAnimationName}-exit${alternativeAnimationName}-exit-active {
|
|
144
|
+
bottom: -40px;
|
|
145
|
+
opacity: 0;
|
|
146
|
+
transition: all 200ms ease;
|
|
147
|
+
}
|
|
148
|
+
`}
|
|
98
149
|
`;
|
|
99
150
|
exports.ToastStyle = ToastStyle;
|
|
100
151
|
const ToastContentStyle = (0, _styledComponents.default)(_messageContent.default)`
|
|
101
152
|
padding: 8px 16px 8px 16px;
|
|
102
153
|
|
|
103
154
|
${({
|
|
104
|
-
|
|
155
|
+
isNotice
|
|
156
|
+
}) => isNotice && (0, _styledComponents.css)`
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
padding: 11px 40px;
|
|
160
|
+
`}
|
|
161
|
+
|
|
162
|
+
${({
|
|
163
|
+
isDismiss,
|
|
164
|
+
isNotice
|
|
105
165
|
}) => isDismiss && (0, _styledComponents.css)`
|
|
106
|
-
padding-right: 48px;
|
|
166
|
+
padding-right: ${isNotice ? "88px" : "48px"};
|
|
107
167
|
`}
|
|
108
168
|
`;
|
|
109
169
|
exports.ToastContentStyle = ToastContentStyle;
|
|
@@ -117,5 +177,11 @@ const ToastWrapper = _styledComponents.default.div`
|
|
|
117
177
|
justify-content: center;
|
|
118
178
|
display: flex;
|
|
119
179
|
`}
|
|
180
|
+
|
|
181
|
+
${({
|
|
182
|
+
isNotice
|
|
183
|
+
}) => isNotice && (0, _styledComponents.css)`
|
|
184
|
+
display: block;
|
|
185
|
+
`}
|
|
120
186
|
`;
|
|
121
187
|
exports.ToastWrapper = ToastWrapper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "111.0
|
|
3
|
+
"version": "111.1.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"clean-lib": "rimraf ./lib && rimraf ./esm",
|
|
31
31
|
"commit": "git-cz",
|
|
32
32
|
"generate-metadata": "node ./scripts/generate_metadata/index.mjs",
|
|
33
|
-
"generate-proptypes": "ts-node ./scripts/generate_proptypes/index.ts",
|
|
34
33
|
"type-check": "tsc --noEmit",
|
|
35
34
|
"type-check:watch": "npm run type-check -- --watch",
|
|
36
35
|
"build:types": "tsc -p tsconfig-build.json --emitDeclarationOnly --outDir ./lib && tsc -p tsconfig-build.json --emitDeclarationOnly --outDir ./esm"
|
|
@@ -110,7 +109,7 @@
|
|
|
110
109
|
"core-js": "^3.20.3",
|
|
111
110
|
"cross-env": "^5.2.0",
|
|
112
111
|
"css-loader": "4.0.0",
|
|
113
|
-
"cypress": "10.
|
|
112
|
+
"cypress": "10.9.0",
|
|
114
113
|
"cypress-axe": "^1.0.0",
|
|
115
114
|
"cypress-each": "^1.11.0",
|
|
116
115
|
"cypress-plugin-tab": "^1.0.5",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
/* istanbul ignore file */
|
|
2
3
|
const fetch = require("node-fetch");
|
|
3
4
|
const dotenv = require("dotenv");
|
|
4
5
|
const chalk = require("chalk");
|
|
@@ -9,7 +10,7 @@ dotenv.config();
|
|
|
9
10
|
const majorVersion = version.split(".")[0];
|
|
10
11
|
|
|
11
12
|
const checkCarbonVersion = () => {
|
|
12
|
-
if (ci.
|
|
13
|
+
if (ci.isCI && process.env.NODE_ENV !== "test") {
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
/* istanbul ignore file */
|
|
2
3
|
const { Octokit } = require("@octokit/rest");
|
|
3
4
|
const dotenv = require("dotenv");
|
|
4
5
|
const chalk = require("chalk");
|
|
@@ -34,7 +35,7 @@ const getOpenRfcs = async () => {
|
|
|
34
35
|
const getRfcTitle = (rfc) => rfc.title.split(": ")[1];
|
|
35
36
|
|
|
36
37
|
const checkRfcs = async () => {
|
|
37
|
-
if (ci.
|
|
38
|
+
if (ci.isCI && process.env.NODE_ENV !== "test") {
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
41
|
|