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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyledContentProps, StyledContentTitleProps, StyledContentBodyProps } from "./content.style";
|
|
3
|
+
export interface ContentProps extends StyledContentProps, StyledContentTitleProps, StyledContentBodyProps {
|
|
4
|
+
/** The body of the content component */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** The title of the content component */
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const Content: {
|
|
10
|
+
({ variant, children, title, inline, align, titleWidth, bodyFullWidth, ...rest }: ContentProps): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export default Content;
|
|
@@ -2,10 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import
|
|
6
|
-
import { StyledContent, StyledContentTitle, StyledContentBody } from "./content.style.js";
|
|
7
|
-
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
8
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
5
|
+
import { StyledContent, StyledContentTitle, StyledContentBody } from "./content.style";
|
|
9
6
|
|
|
10
7
|
const Content = ({
|
|
11
8
|
variant = "primary",
|
|
@@ -16,48 +13,191 @@ const Content = ({
|
|
|
16
13
|
titleWidth,
|
|
17
14
|
bodyFullWidth = false,
|
|
18
15
|
...rest
|
|
19
|
-
}) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/** Applies a theme to the Content Value: primary, secondary */
|
|
42
|
-
variant: PropTypes.oneOf(["primary", "secondary"]),
|
|
43
|
-
|
|
44
|
-
/** The body of the content component */
|
|
45
|
-
children: PropTypes.node,
|
|
46
|
-
|
|
47
|
-
/** The title of the content component */
|
|
48
|
-
title: PropTypes.node,
|
|
49
|
-
|
|
50
|
-
/** Displays the content inline with the title */
|
|
51
|
-
inline: PropTypes.bool,
|
|
52
|
-
|
|
53
|
-
/** Aligns the content (left, center or right) */
|
|
54
|
-
align: PropTypes.oneOf(["left", "center", "right"]),
|
|
55
|
-
|
|
56
|
-
/** Sets a custom width for the title element */
|
|
57
|
-
titleWidth: PropTypes.string,
|
|
16
|
+
}) => {
|
|
17
|
+
return /*#__PURE__*/React.createElement(StyledContent, _extends({
|
|
18
|
+
align: align,
|
|
19
|
+
bodyFullWidth: bodyFullWidth
|
|
20
|
+
}, rest, {
|
|
21
|
+
"data-component": "content"
|
|
22
|
+
}), /*#__PURE__*/React.createElement(StyledContentTitle, {
|
|
23
|
+
variant: variant,
|
|
24
|
+
inline: inline,
|
|
25
|
+
"data-element": "content-title",
|
|
26
|
+
titleWidth: titleWidth,
|
|
27
|
+
align: align
|
|
28
|
+
}, title), /*#__PURE__*/React.createElement(StyledContentBody, {
|
|
29
|
+
variant: variant,
|
|
30
|
+
inline: inline,
|
|
31
|
+
"data-element": "content-body",
|
|
32
|
+
bodyFullWidth: bodyFullWidth,
|
|
33
|
+
titleWidth: titleWidth,
|
|
34
|
+
align: align
|
|
35
|
+
}, children));
|
|
36
|
+
};
|
|
58
37
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
bodyFullWidth: PropTypes.bool
|
|
38
|
+
Content.propTypes = {
|
|
39
|
+
"align": PropTypes.oneOf(["center", "left", "right"]),
|
|
40
|
+
"bodyFullWidth": PropTypes.bool,
|
|
41
|
+
"children": PropTypes.node,
|
|
42
|
+
"inline": PropTypes.bool,
|
|
43
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
44
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
45
|
+
"description": PropTypes.string,
|
|
46
|
+
"toString": PropTypes.func.isRequired,
|
|
47
|
+
"valueOf": PropTypes.func.isRequired
|
|
48
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
49
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
50
|
+
"description": PropTypes.string,
|
|
51
|
+
"toString": PropTypes.func.isRequired,
|
|
52
|
+
"valueOf": PropTypes.func.isRequired
|
|
53
|
+
}), PropTypes.string]),
|
|
54
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
55
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
56
|
+
"description": PropTypes.string,
|
|
57
|
+
"toString": PropTypes.func.isRequired,
|
|
58
|
+
"valueOf": PropTypes.func.isRequired
|
|
59
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
60
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
61
|
+
"description": PropTypes.string,
|
|
62
|
+
"toString": PropTypes.func.isRequired,
|
|
63
|
+
"valueOf": PropTypes.func.isRequired
|
|
64
|
+
}), PropTypes.string]),
|
|
65
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
66
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
67
|
+
"description": PropTypes.string,
|
|
68
|
+
"toString": PropTypes.func.isRequired,
|
|
69
|
+
"valueOf": PropTypes.func.isRequired
|
|
70
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
71
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
72
|
+
"description": PropTypes.string,
|
|
73
|
+
"toString": PropTypes.func.isRequired,
|
|
74
|
+
"valueOf": PropTypes.func.isRequired
|
|
75
|
+
}), PropTypes.string]),
|
|
76
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
77
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
78
|
+
"description": PropTypes.string,
|
|
79
|
+
"toString": PropTypes.func.isRequired,
|
|
80
|
+
"valueOf": PropTypes.func.isRequired
|
|
81
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
82
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
83
|
+
"description": PropTypes.string,
|
|
84
|
+
"toString": PropTypes.func.isRequired,
|
|
85
|
+
"valueOf": PropTypes.func.isRequired
|
|
86
|
+
}), PropTypes.string]),
|
|
87
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
88
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
89
|
+
"description": PropTypes.string,
|
|
90
|
+
"toString": PropTypes.func.isRequired,
|
|
91
|
+
"valueOf": PropTypes.func.isRequired
|
|
92
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
93
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
94
|
+
"description": PropTypes.string,
|
|
95
|
+
"toString": PropTypes.func.isRequired,
|
|
96
|
+
"valueOf": PropTypes.func.isRequired
|
|
97
|
+
}), PropTypes.string]),
|
|
98
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
99
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
100
|
+
"description": PropTypes.string,
|
|
101
|
+
"toString": PropTypes.func.isRequired,
|
|
102
|
+
"valueOf": PropTypes.func.isRequired
|
|
103
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
104
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
105
|
+
"description": PropTypes.string,
|
|
106
|
+
"toString": PropTypes.func.isRequired,
|
|
107
|
+
"valueOf": PropTypes.func.isRequired
|
|
108
|
+
}), PropTypes.string]),
|
|
109
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
110
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
111
|
+
"description": PropTypes.string,
|
|
112
|
+
"toString": PropTypes.func.isRequired,
|
|
113
|
+
"valueOf": PropTypes.func.isRequired
|
|
114
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
115
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
116
|
+
"description": PropTypes.string,
|
|
117
|
+
"toString": PropTypes.func.isRequired,
|
|
118
|
+
"valueOf": PropTypes.func.isRequired
|
|
119
|
+
}), PropTypes.string]),
|
|
120
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
121
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
122
|
+
"description": PropTypes.string,
|
|
123
|
+
"toString": PropTypes.func.isRequired,
|
|
124
|
+
"valueOf": PropTypes.func.isRequired
|
|
125
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
126
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
127
|
+
"description": PropTypes.string,
|
|
128
|
+
"toString": PropTypes.func.isRequired,
|
|
129
|
+
"valueOf": PropTypes.func.isRequired
|
|
130
|
+
}), PropTypes.string]),
|
|
131
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
132
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
133
|
+
"description": PropTypes.string,
|
|
134
|
+
"toString": PropTypes.func.isRequired,
|
|
135
|
+
"valueOf": PropTypes.func.isRequired
|
|
136
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
137
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
138
|
+
"description": PropTypes.string,
|
|
139
|
+
"toString": PropTypes.func.isRequired,
|
|
140
|
+
"valueOf": PropTypes.func.isRequired
|
|
141
|
+
}), PropTypes.string]),
|
|
142
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
143
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
144
|
+
"description": PropTypes.string,
|
|
145
|
+
"toString": PropTypes.func.isRequired,
|
|
146
|
+
"valueOf": PropTypes.func.isRequired
|
|
147
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
148
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
149
|
+
"description": PropTypes.string,
|
|
150
|
+
"toString": PropTypes.func.isRequired,
|
|
151
|
+
"valueOf": PropTypes.func.isRequired
|
|
152
|
+
}), PropTypes.string]),
|
|
153
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
154
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
155
|
+
"description": PropTypes.string,
|
|
156
|
+
"toString": PropTypes.func.isRequired,
|
|
157
|
+
"valueOf": PropTypes.func.isRequired
|
|
158
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
159
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
160
|
+
"description": PropTypes.string,
|
|
161
|
+
"toString": PropTypes.func.isRequired,
|
|
162
|
+
"valueOf": PropTypes.func.isRequired
|
|
163
|
+
}), PropTypes.string]),
|
|
164
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
165
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
166
|
+
"description": PropTypes.string,
|
|
167
|
+
"toString": PropTypes.func.isRequired,
|
|
168
|
+
"valueOf": PropTypes.func.isRequired
|
|
169
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
170
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
171
|
+
"description": PropTypes.string,
|
|
172
|
+
"toString": PropTypes.func.isRequired,
|
|
173
|
+
"valueOf": PropTypes.func.isRequired
|
|
174
|
+
}), PropTypes.string]),
|
|
175
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
176
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
177
|
+
"description": PropTypes.string,
|
|
178
|
+
"toString": PropTypes.func.isRequired,
|
|
179
|
+
"valueOf": PropTypes.func.isRequired
|
|
180
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
181
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
182
|
+
"description": PropTypes.string,
|
|
183
|
+
"toString": PropTypes.func.isRequired,
|
|
184
|
+
"valueOf": PropTypes.func.isRequired
|
|
185
|
+
}), PropTypes.string]),
|
|
186
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
187
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
188
|
+
"description": PropTypes.string,
|
|
189
|
+
"toString": PropTypes.func.isRequired,
|
|
190
|
+
"valueOf": PropTypes.func.isRequired
|
|
191
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
192
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
193
|
+
"description": PropTypes.string,
|
|
194
|
+
"toString": PropTypes.func.isRequired,
|
|
195
|
+
"valueOf": PropTypes.func.isRequired
|
|
196
|
+
}), PropTypes.string]),
|
|
197
|
+
"title": PropTypes.node,
|
|
198
|
+
"titleWidth": PropTypes.string,
|
|
199
|
+
"variant": PropTypes.oneOf(["primary", "secondary"])
|
|
62
200
|
};
|
|
201
|
+
export { Content };
|
|
202
|
+
Content.displayName = "Content";
|
|
63
203
|
export default Content;
|
|
@@ -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";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./content.component
|
|
1
|
+
export { default } from "./content.component";
|
|
@@ -409,7 +409,6 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
409
409
|
|
|
410
410
|
const selectList = /*#__PURE__*/React.createElement(FilterableSelectList, {
|
|
411
411
|
ref: listboxRef,
|
|
412
|
-
"aria-multiselectable": true,
|
|
413
412
|
id: selectListId.current,
|
|
414
413
|
labelId: labelId.current,
|
|
415
414
|
anchorElement: textboxRef && textboxRef.parentElement,
|
|
@@ -20,10 +20,16 @@ const OptionRow = /*#__PURE__*/React.forwardRef(({
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const selectListContext = useContext(SelectListContext);
|
|
23
|
+
let isSelected = selectListContext.currentOptionsListIndex === index;
|
|
24
|
+
|
|
25
|
+
if (selectListContext.multiselectValues) {
|
|
26
|
+
isSelected = selectListContext.multiselectValues.includes(value);
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
return /*#__PURE__*/React.createElement(StyledOptionRow, {
|
|
24
30
|
id: id,
|
|
25
31
|
ref: ref,
|
|
26
|
-
"aria-selected":
|
|
32
|
+
"aria-selected": isSelected,
|
|
27
33
|
"data-component": "option-row",
|
|
28
34
|
onClick: handleClick,
|
|
29
35
|
isHighlighted: selectListContext.currentOptionsListIndex === index,
|
|
@@ -38,6 +38,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
38
38
|
listPlacement = "bottom",
|
|
39
39
|
flipEnabled = true,
|
|
40
40
|
isOpen,
|
|
41
|
+
multiselectValues,
|
|
41
42
|
...listProps
|
|
42
43
|
}, listContainerRef) => {
|
|
43
44
|
const [currentOptionsListIndex, setCurrentOptionsListIndex] = useState(-1);
|
|
@@ -320,7 +321,8 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
320
321
|
ref: listContainerRef
|
|
321
322
|
}, /*#__PURE__*/React.createElement(SelectListContext.Provider, {
|
|
322
323
|
value: {
|
|
323
|
-
currentOptionsListIndex
|
|
324
|
+
currentOptionsListIndex,
|
|
325
|
+
multiselectValues
|
|
324
326
|
}
|
|
325
327
|
}, /*#__PURE__*/React.createElement(StyledSelectListContainer, _extends({
|
|
326
328
|
"data-element": "select-list-wrapper"
|
|
@@ -330,6 +332,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
330
332
|
"aria-labelledby": labelId,
|
|
331
333
|
"data-element": "select-list",
|
|
332
334
|
role: "listbox",
|
|
335
|
+
"aria-multiselectable": multiselectValues ? true : undefined,
|
|
333
336
|
ref: listCallbackRef,
|
|
334
337
|
tabIndex: "-1",
|
|
335
338
|
isLoading: isLoading,
|
|
@@ -402,6 +405,9 @@ SelectList.propTypes = {
|
|
|
402
405
|
/** @private @ignore
|
|
403
406
|
* Hides the list (with CSS display: none) if not set
|
|
404
407
|
*/
|
|
405
|
-
isOpen: PropTypes.bool
|
|
408
|
+
isOpen: PropTypes.bool,
|
|
409
|
+
|
|
410
|
+
/** array of selected values, if rendered as part of a MultiSelect */
|
|
411
|
+
multiselectValues: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.object)])
|
|
406
412
|
};
|
|
407
413
|
export default SelectList;
|
|
@@ -25,6 +25,7 @@ const Toast = /*#__PURE__*/React.forwardRef(({
|
|
|
25
25
|
disableAutoFocus,
|
|
26
26
|
...restProps
|
|
27
27
|
}, ref) => {
|
|
28
|
+
const isNotice = variant === "notice";
|
|
28
29
|
const locale = useLocale();
|
|
29
30
|
const toastRef = useRef();
|
|
30
31
|
const timer = useRef();
|
|
@@ -94,7 +95,7 @@ const Toast = /*#__PURE__*/React.forwardRef(({
|
|
|
94
95
|
};
|
|
95
96
|
return /*#__PURE__*/React.createElement(CSSTransition, {
|
|
96
97
|
enter: true,
|
|
97
|
-
classNames: "toast",
|
|
98
|
+
classNames: isNotice ? "toast-alternative" : "toast",
|
|
98
99
|
timeout: {
|
|
99
100
|
appear: 1600,
|
|
100
101
|
enter: 1500,
|
|
@@ -102,14 +103,16 @@ const Toast = /*#__PURE__*/React.forwardRef(({
|
|
|
102
103
|
},
|
|
103
104
|
nodeRef: toastContentNodeRef
|
|
104
105
|
}, /*#__PURE__*/React.createElement(ToastStyle, _extends({
|
|
106
|
+
isNotice: isNotice,
|
|
105
107
|
className: componentClasses
|
|
106
108
|
}, tagComponent(restProps["data-component"] || "toast", restProps), toastProps, {
|
|
107
109
|
ref: toastContentNodeRef
|
|
108
|
-
}), /*#__PURE__*/React.createElement(TypeIcon, {
|
|
110
|
+
}), !isNotice && /*#__PURE__*/React.createElement(TypeIcon, {
|
|
109
111
|
variant: toastProps.variant
|
|
110
112
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
111
113
|
type: toastProps.variant
|
|
112
114
|
})), /*#__PURE__*/React.createElement(ToastContentStyle, {
|
|
115
|
+
isNotice: isNotice,
|
|
113
116
|
variant: toastProps.variant,
|
|
114
117
|
isDismiss: onDismiss
|
|
115
118
|
}, children), renderCloseIcon()));
|
|
@@ -117,15 +120,17 @@ const Toast = /*#__PURE__*/React.forwardRef(({
|
|
|
117
120
|
|
|
118
121
|
return /*#__PURE__*/React.createElement(StyledPortal, {
|
|
119
122
|
id: targetPortalId,
|
|
120
|
-
isCenter: isCenter
|
|
123
|
+
isCenter: isCenter,
|
|
124
|
+
isNotice: isNotice
|
|
121
125
|
}, /*#__PURE__*/React.createElement(ToastWrapper, {
|
|
122
126
|
isCenter: isCenter,
|
|
123
|
-
ref: refToPass
|
|
127
|
+
ref: refToPass,
|
|
128
|
+
isNotice: isNotice
|
|
124
129
|
}, /*#__PURE__*/React.createElement(TransitionGroup, null, renderToastContent())));
|
|
125
130
|
});
|
|
126
131
|
Toast.propTypes = {
|
|
127
132
|
/** Customizes the appearance in the DLS theme */
|
|
128
|
-
variant: PropTypes.oneOf(["error", "info", "success", "warning"]),
|
|
133
|
+
variant: PropTypes.oneOf(["error", "info", "success", "warning", "notice"]),
|
|
129
134
|
|
|
130
135
|
/** Custom className */
|
|
131
136
|
className: PropTypes.string,
|
|
@@ -5,6 +5,7 @@ import TypeIcon from "../message/type-icon/type-icon.style";
|
|
|
5
5
|
import StyledIconButton from "../icon-button/icon-button.style";
|
|
6
6
|
import Portal from "../portal/portal";
|
|
7
7
|
import baseTheme from "../../style/themes/base";
|
|
8
|
+
import StyledIcon from "../icon/icon.style";
|
|
8
9
|
const StyledPortal = styled(Portal)`
|
|
9
10
|
${({
|
|
10
11
|
theme
|
|
@@ -20,12 +21,21 @@ const StyledPortal = styled(Portal)`
|
|
|
20
21
|
margin-left: 50%;
|
|
21
22
|
transform: translateX(-50%);
|
|
22
23
|
`}
|
|
24
|
+
|
|
25
|
+
${({
|
|
26
|
+
isNotice
|
|
27
|
+
}) => isNotice && css`
|
|
28
|
+
bottom: 0;
|
|
29
|
+
top: auto;
|
|
30
|
+
width: 100%;
|
|
31
|
+
`}
|
|
23
32
|
`}
|
|
24
33
|
`;
|
|
25
34
|
StyledPortal.defaultProps = {
|
|
26
35
|
theme: baseTheme
|
|
27
36
|
};
|
|
28
37
|
const animationName = ".toast";
|
|
38
|
+
const alternativeAnimationName = ".toast-alternative";
|
|
29
39
|
const ToastStyle = styled(MessageStyle)`
|
|
30
40
|
${({
|
|
31
41
|
maxWidth,
|
|
@@ -39,24 +49,23 @@ const ToastStyle = styled(MessageStyle)`
|
|
|
39
49
|
position: relative;
|
|
40
50
|
margin-right: ${isCenter ? "auto" : "30px"};
|
|
41
51
|
`}
|
|
42
|
-
|
|
43
52
|
|
|
44
53
|
&${animationName}-appear,
|
|
45
54
|
&${animationName}-enter {
|
|
46
55
|
opacity: 0;
|
|
47
|
-
transform: scale(0.5)
|
|
56
|
+
transform: scale(0.5);
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
&${animationName}-appear
|
|
51
|
-
|
|
59
|
+
&${animationName}-appear${animationName}-appear-active,
|
|
60
|
+
&${animationName}-enter${animationName}-enter-active {
|
|
52
61
|
opacity: 1;
|
|
53
62
|
transform: ${({
|
|
54
63
|
isCenter
|
|
55
64
|
}) => isCenter ? " scale(1) translateY(0)" : "scale(1)"};
|
|
56
|
-
transition: all 300ms cubic-bezier(0.
|
|
65
|
+
transition: all 300ms cubic-bezier(0.25, 0.25, 0, 1.5);
|
|
57
66
|
}
|
|
58
67
|
|
|
59
|
-
&${animationName}-exit
|
|
68
|
+
&${animationName}-exit${animationName}-exit-active {
|
|
60
69
|
opacity: 0;
|
|
61
70
|
margin-top: -40px;
|
|
62
71
|
transition: all 150ms ease-out;
|
|
@@ -68,14 +77,64 @@ const ToastStyle = styled(MessageStyle)`
|
|
|
68
77
|
top: 50%;
|
|
69
78
|
transform: translateY(-50%);
|
|
70
79
|
}
|
|
80
|
+
|
|
81
|
+
${({
|
|
82
|
+
isNotice
|
|
83
|
+
}) => isNotice && css`
|
|
84
|
+
background-color: var(--colorsUtilityMajor400);
|
|
85
|
+
border: none;
|
|
86
|
+
color: var(--colorsSemanticNeutralYang100);
|
|
87
|
+
margin-right: 0;
|
|
88
|
+
max-width: 100%;
|
|
89
|
+
|
|
90
|
+
${StyledIconButton} {
|
|
91
|
+
right: 55px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
${StyledIconButton} ${StyledIcon} {
|
|
95
|
+
color: var(--colorsSemanticNeutralYang100);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&${alternativeAnimationName}-appear, &${alternativeAnimationName}-enter {
|
|
99
|
+
bottom: -40px;
|
|
100
|
+
opacity: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&${alternativeAnimationName}-exit {
|
|
104
|
+
bottom: 0;
|
|
105
|
+
opacity: 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&${alternativeAnimationName}-appear${alternativeAnimationName}-appear-active,
|
|
109
|
+
&${alternativeAnimationName}-enter${alternativeAnimationName}-enter-active {
|
|
110
|
+
bottom: 0;
|
|
111
|
+
opacity: 1;
|
|
112
|
+
transition: all 400ms ease;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&${alternativeAnimationName}-exit${alternativeAnimationName}-exit-active {
|
|
116
|
+
bottom: -40px;
|
|
117
|
+
opacity: 0;
|
|
118
|
+
transition: all 200ms ease;
|
|
119
|
+
}
|
|
120
|
+
`}
|
|
71
121
|
`;
|
|
72
122
|
const ToastContentStyle = styled(MessageContentStyle)`
|
|
73
123
|
padding: 8px 16px 8px 16px;
|
|
74
124
|
|
|
75
125
|
${({
|
|
76
|
-
|
|
126
|
+
isNotice
|
|
127
|
+
}) => isNotice && css`
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
padding: 11px 40px;
|
|
131
|
+
`}
|
|
132
|
+
|
|
133
|
+
${({
|
|
134
|
+
isDismiss,
|
|
135
|
+
isNotice
|
|
77
136
|
}) => isDismiss && css`
|
|
78
|
-
padding-right: 48px;
|
|
137
|
+
padding-right: ${isNotice ? "88px" : "48px"};
|
|
79
138
|
`}
|
|
80
139
|
`;
|
|
81
140
|
const ToastWrapper = styled.div`
|
|
@@ -88,5 +147,11 @@ const ToastWrapper = styled.div`
|
|
|
88
147
|
justify-content: center;
|
|
89
148
|
display: flex;
|
|
90
149
|
`}
|
|
150
|
+
|
|
151
|
+
${({
|
|
152
|
+
isNotice
|
|
153
|
+
}) => isNotice && css`
|
|
154
|
+
display: block;
|
|
155
|
+
`}
|
|
91
156
|
`;
|
|
92
157
|
export { ToastStyle, TypeIcon, ToastContentStyle, ToastWrapper, StyledPortal };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyledContentProps, StyledContentTitleProps, StyledContentBodyProps } from "./content.style";
|
|
3
|
+
export interface ContentProps extends StyledContentProps, StyledContentTitleProps, StyledContentBodyProps {
|
|
4
|
+
/** The body of the content component */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** The title of the content component */
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const Content: {
|
|
10
|
+
({ variant, children, title, inline, align, titleWidth, bodyFullWidth, ...rest }: ContentProps): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export default Content;
|