carbon-react 109.1.1 → 109.2.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/__internal__/label/label.component.d.ts +1 -1
- package/esm/__internal__/label/label.component.js +2 -2
- package/esm/components/checkbox/checkbox-group.component.js +0 -5
- package/esm/components/checkbox/checkbox-group.d.ts +0 -2
- package/esm/components/checkbox/checkbox.component.js +1 -3
- package/esm/components/flat-table/sort/sort.component.js +2 -1
- package/esm/components/flat-table/sort/sort.style.js +0 -1
- package/esm/components/help/help.component.d.ts +43 -0
- package/esm/components/help/help.component.js +194 -84
- package/esm/components/help/help.config.d.ts +1 -0
- package/esm/components/help/help.style.d.ts +4 -1
- package/esm/components/help/index.d.ts +2 -1
- package/esm/components/pill/index.d.ts +2 -1
- package/esm/components/pill/pill.component.d.ts +22 -0
- package/esm/components/pill/pill.component.js +219 -42
- package/esm/components/pill/pill.style.config.d.ts +18 -0
- package/esm/components/pill/pill.style.d.ts +22 -0
- package/esm/components/pill/pill.style.js +23 -22
- package/esm/components/popover-container/popover-container.component.js +26 -5
- package/esm/components/popover-container/popover-container.style.d.ts +0 -2
- package/esm/components/popover-container/popover-container.style.js +0 -8
- package/esm/components/select/multi-select/multi-select.component.js +7 -2
- package/esm/components/select/multi-select/multi-select.d.ts +2 -0
- package/esm/components/select/multi-select/multi-select.style.js +1 -0
- package/lib/__internal__/label/label.component.d.ts +1 -1
- package/lib/__internal__/label/label.component.js +2 -2
- package/lib/components/checkbox/checkbox-group.component.js +0 -5
- package/lib/components/checkbox/checkbox-group.d.ts +0 -2
- package/lib/components/checkbox/checkbox.component.js +1 -3
- package/lib/components/flat-table/sort/sort.component.js +2 -1
- package/lib/components/flat-table/sort/sort.style.js +0 -1
- package/lib/components/help/help.component.d.ts +43 -0
- package/lib/components/help/help.component.js +194 -87
- package/lib/components/help/help.config.d.ts +1 -0
- package/lib/components/help/help.style.d.ts +4 -1
- package/lib/components/help/index.d.ts +2 -1
- package/lib/components/pill/index.d.ts +2 -1
- package/lib/components/pill/pill.component.d.ts +22 -0
- package/lib/components/pill/pill.component.js +220 -46
- package/lib/components/pill/pill.style.config.d.ts +18 -0
- package/lib/components/pill/pill.style.d.ts +22 -0
- package/lib/components/pill/pill.style.js +23 -23
- package/lib/components/popover-container/popover-container.component.js +27 -5
- package/lib/components/popover-container/popover-container.style.d.ts +0 -2
- package/lib/components/popover-container/popover-container.style.js +0 -8
- package/lib/components/select/multi-select/multi-select.component.js +7 -2
- package/lib/components/select/multi-select/multi-select.d.ts +2 -0
- package/lib/components/select/multi-select/multi-select.style.js +1 -0
- package/package.json +4 -4
- package/esm/components/help/help.d.ts +0 -41
- package/esm/components/pill/pill.d.ts +0 -24
- package/lib/components/help/help.d.ts +0 -41
- package/lib/components/pill/pill.d.ts +0 -24
|
@@ -2,13 +2,10 @@ 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 styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
5
|
import StyledPill from "./pill.style";
|
|
7
6
|
import Icon from "../icon";
|
|
8
7
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
9
8
|
import IconButton from "../icon-button";
|
|
10
|
-
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
11
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
12
9
|
|
|
13
10
|
const renderCloseIcon = onDelete => /*#__PURE__*/React.createElement(IconButton, {
|
|
14
11
|
onAction: onDelete,
|
|
@@ -19,57 +16,237 @@ const renderCloseIcon = onDelete => /*#__PURE__*/React.createElement(IconButton,
|
|
|
19
16
|
}));
|
|
20
17
|
|
|
21
18
|
const Pill = ({
|
|
22
|
-
|
|
23
|
-
onDelete,
|
|
24
|
-
colorVariant,
|
|
19
|
+
wrapText,
|
|
25
20
|
borderColor,
|
|
26
|
-
|
|
21
|
+
colorVariant = "neutral",
|
|
27
22
|
children,
|
|
28
|
-
|
|
23
|
+
fill = false,
|
|
24
|
+
maxWidth,
|
|
29
25
|
onClick,
|
|
26
|
+
onDelete,
|
|
27
|
+
pillRole = "tag",
|
|
28
|
+
size = "M",
|
|
30
29
|
...rest
|
|
31
30
|
}) => /*#__PURE__*/React.createElement(StyledPill, _extends({
|
|
32
31
|
inFill: fill,
|
|
33
32
|
colorVariant: colorVariant,
|
|
34
|
-
isDeletable: onDelete,
|
|
33
|
+
isDeletable: !!onDelete,
|
|
35
34
|
pillRole: pillRole,
|
|
36
35
|
size: size,
|
|
37
36
|
borderColor: borderColor,
|
|
38
37
|
onClick: onClick
|
|
39
|
-
}, tagComponent("pill", rest),
|
|
38
|
+
}, tagComponent("pill", rest), {
|
|
39
|
+
maxWidth: maxWidth,
|
|
40
|
+
wrapText: wrapText
|
|
41
|
+
}, rest), children, onDelete && renderCloseIcon(onDelete));
|
|
40
42
|
|
|
41
43
|
Pill.propTypes = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
44
|
+
"borderColor": PropTypes.string,
|
|
45
|
+
"children": PropTypes.string.isRequired,
|
|
46
|
+
"colorVariant": PropTypes.oneOf(["negative", "neutral", "positive", "warning"]),
|
|
47
|
+
"data-element": PropTypes.string,
|
|
48
|
+
"data-role": PropTypes.string,
|
|
49
|
+
"fill": PropTypes.bool,
|
|
50
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
51
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
52
|
+
"description": PropTypes.string,
|
|
53
|
+
"toString": PropTypes.func.isRequired,
|
|
54
|
+
"valueOf": PropTypes.func.isRequired
|
|
55
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
56
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
57
|
+
"description": PropTypes.string,
|
|
58
|
+
"toString": PropTypes.func.isRequired,
|
|
59
|
+
"valueOf": PropTypes.func.isRequired
|
|
60
|
+
}), PropTypes.string]),
|
|
61
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
62
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
63
|
+
"description": PropTypes.string,
|
|
64
|
+
"toString": PropTypes.func.isRequired,
|
|
65
|
+
"valueOf": PropTypes.func.isRequired
|
|
66
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
67
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
68
|
+
"description": PropTypes.string,
|
|
69
|
+
"toString": PropTypes.func.isRequired,
|
|
70
|
+
"valueOf": PropTypes.func.isRequired
|
|
71
|
+
}), PropTypes.string]),
|
|
72
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
73
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
74
|
+
"description": PropTypes.string,
|
|
75
|
+
"toString": PropTypes.func.isRequired,
|
|
76
|
+
"valueOf": PropTypes.func.isRequired
|
|
77
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
78
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
79
|
+
"description": PropTypes.string,
|
|
80
|
+
"toString": PropTypes.func.isRequired,
|
|
81
|
+
"valueOf": PropTypes.func.isRequired
|
|
82
|
+
}), PropTypes.string]),
|
|
83
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
84
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
85
|
+
"description": PropTypes.string,
|
|
86
|
+
"toString": PropTypes.func.isRequired,
|
|
87
|
+
"valueOf": PropTypes.func.isRequired
|
|
88
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
89
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
90
|
+
"description": PropTypes.string,
|
|
91
|
+
"toString": PropTypes.func.isRequired,
|
|
92
|
+
"valueOf": PropTypes.func.isRequired
|
|
93
|
+
}), PropTypes.string]),
|
|
94
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
95
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
96
|
+
"description": PropTypes.string,
|
|
97
|
+
"toString": PropTypes.func.isRequired,
|
|
98
|
+
"valueOf": PropTypes.func.isRequired
|
|
99
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
100
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
101
|
+
"description": PropTypes.string,
|
|
102
|
+
"toString": PropTypes.func.isRequired,
|
|
103
|
+
"valueOf": PropTypes.func.isRequired
|
|
104
|
+
}), PropTypes.string]),
|
|
105
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
106
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
107
|
+
"description": PropTypes.string,
|
|
108
|
+
"toString": PropTypes.func.isRequired,
|
|
109
|
+
"valueOf": PropTypes.func.isRequired
|
|
110
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
111
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
112
|
+
"description": PropTypes.string,
|
|
113
|
+
"toString": PropTypes.func.isRequired,
|
|
114
|
+
"valueOf": PropTypes.func.isRequired
|
|
115
|
+
}), PropTypes.string]),
|
|
116
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
117
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
118
|
+
"description": PropTypes.string,
|
|
119
|
+
"toString": PropTypes.func.isRequired,
|
|
120
|
+
"valueOf": PropTypes.func.isRequired
|
|
121
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
122
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
123
|
+
"description": PropTypes.string,
|
|
124
|
+
"toString": PropTypes.func.isRequired,
|
|
125
|
+
"valueOf": PropTypes.func.isRequired
|
|
126
|
+
}), PropTypes.string]),
|
|
127
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
128
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
129
|
+
"description": PropTypes.string,
|
|
130
|
+
"toString": PropTypes.func.isRequired,
|
|
131
|
+
"valueOf": PropTypes.func.isRequired
|
|
132
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
133
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
134
|
+
"description": PropTypes.string,
|
|
135
|
+
"toString": PropTypes.func.isRequired,
|
|
136
|
+
"valueOf": PropTypes.func.isRequired
|
|
137
|
+
}), PropTypes.string]),
|
|
138
|
+
"maxWidth": PropTypes.string,
|
|
139
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
140
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
141
|
+
"description": PropTypes.string,
|
|
142
|
+
"toString": PropTypes.func.isRequired,
|
|
143
|
+
"valueOf": PropTypes.func.isRequired
|
|
144
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
145
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
146
|
+
"description": PropTypes.string,
|
|
147
|
+
"toString": PropTypes.func.isRequired,
|
|
148
|
+
"valueOf": PropTypes.func.isRequired
|
|
149
|
+
}), PropTypes.string]),
|
|
150
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
151
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
152
|
+
"description": PropTypes.string,
|
|
153
|
+
"toString": PropTypes.func.isRequired,
|
|
154
|
+
"valueOf": PropTypes.func.isRequired
|
|
155
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
156
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
157
|
+
"description": PropTypes.string,
|
|
158
|
+
"toString": PropTypes.func.isRequired,
|
|
159
|
+
"valueOf": PropTypes.func.isRequired
|
|
160
|
+
}), PropTypes.string]),
|
|
161
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
162
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
163
|
+
"description": PropTypes.string,
|
|
164
|
+
"toString": PropTypes.func.isRequired,
|
|
165
|
+
"valueOf": PropTypes.func.isRequired
|
|
166
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
167
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
168
|
+
"description": PropTypes.string,
|
|
169
|
+
"toString": PropTypes.func.isRequired,
|
|
170
|
+
"valueOf": PropTypes.func.isRequired
|
|
171
|
+
}), PropTypes.string]),
|
|
172
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
173
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
174
|
+
"description": PropTypes.string,
|
|
175
|
+
"toString": PropTypes.func.isRequired,
|
|
176
|
+
"valueOf": PropTypes.func.isRequired
|
|
177
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
178
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
179
|
+
"description": PropTypes.string,
|
|
180
|
+
"toString": PropTypes.func.isRequired,
|
|
181
|
+
"valueOf": PropTypes.func.isRequired
|
|
182
|
+
}), PropTypes.string]),
|
|
183
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
184
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
185
|
+
"description": PropTypes.string,
|
|
186
|
+
"toString": PropTypes.func.isRequired,
|
|
187
|
+
"valueOf": PropTypes.func.isRequired
|
|
188
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
189
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
190
|
+
"description": PropTypes.string,
|
|
191
|
+
"toString": PropTypes.func.isRequired,
|
|
192
|
+
"valueOf": PropTypes.func.isRequired
|
|
193
|
+
}), PropTypes.string]),
|
|
194
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
195
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
196
|
+
"description": PropTypes.string,
|
|
197
|
+
"toString": PropTypes.func.isRequired,
|
|
198
|
+
"valueOf": PropTypes.func.isRequired
|
|
199
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
200
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
201
|
+
"description": PropTypes.string,
|
|
202
|
+
"toString": PropTypes.func.isRequired,
|
|
203
|
+
"valueOf": PropTypes.func.isRequired
|
|
204
|
+
}), PropTypes.string]),
|
|
205
|
+
"onClick": PropTypes.func,
|
|
206
|
+
"onDelete": PropTypes.func,
|
|
207
|
+
"pillRole": PropTypes.oneOf(["status", "tag"]),
|
|
208
|
+
"size": PropTypes.oneOf(["L", "M", "S", "XL"]),
|
|
209
|
+
"theme": PropTypes.shape({
|
|
210
|
+
"colors": PropTypes.shape({
|
|
211
|
+
"destructive": PropTypes.shape({
|
|
212
|
+
"hover": PropTypes.string.isRequired
|
|
213
|
+
}),
|
|
214
|
+
"error": PropTypes.string,
|
|
215
|
+
"focus": PropTypes.string,
|
|
216
|
+
"info": PropTypes.string,
|
|
217
|
+
"loadingBarBackground": PropTypes.string,
|
|
218
|
+
"placeholder": PropTypes.string,
|
|
219
|
+
"primary": PropTypes.string,
|
|
220
|
+
"secondary": PropTypes.string,
|
|
221
|
+
"tertiary": PropTypes.string,
|
|
222
|
+
"warning": PropTypes.string,
|
|
223
|
+
"warningText": PropTypes.string,
|
|
224
|
+
"white": PropTypes.oneOf(["#FFFFFF"])
|
|
225
|
+
}),
|
|
226
|
+
"compatibility": PropTypes.object,
|
|
227
|
+
"disabled": PropTypes.shape({
|
|
228
|
+
"background": PropTypes.string.isRequired
|
|
229
|
+
}),
|
|
230
|
+
"name": PropTypes.string,
|
|
231
|
+
"palette": PropTypes.shape({
|
|
232
|
+
"blackOpacity": PropTypes.func.isRequired,
|
|
233
|
+
"whiteOpacity": PropTypes.func.isRequired
|
|
234
|
+
}),
|
|
235
|
+
"space": PropTypes.arrayOf(PropTypes.string),
|
|
236
|
+
"spacing": PropTypes.number,
|
|
237
|
+
"zIndex": PropTypes.shape({
|
|
238
|
+
"aboveAll": PropTypes.number.isRequired,
|
|
239
|
+
"fullScreenModal": PropTypes.number.isRequired,
|
|
240
|
+
"header": PropTypes.number.isRequired,
|
|
241
|
+
"modal": PropTypes.number.isRequired,
|
|
242
|
+
"nav": PropTypes.number.isRequired,
|
|
243
|
+
"notification": PropTypes.number.isRequired,
|
|
244
|
+
"overlay": PropTypes.number.isRequired,
|
|
245
|
+
"popover": PropTypes.number.isRequired,
|
|
246
|
+
"smallOverlay": PropTypes.number.isRequired
|
|
247
|
+
})
|
|
248
|
+
}),
|
|
249
|
+
"wrapText": PropTypes.bool
|
|
74
250
|
};
|
|
251
|
+
export { Pill };
|
|
75
252
|
export default Pill;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface StyledPillInnerConfigProps {
|
|
2
|
+
varietyColor: string;
|
|
3
|
+
buttonFocus: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
interface StyledPillConfig {
|
|
7
|
+
status: {
|
|
8
|
+
neutral: StyledPillInnerConfigProps;
|
|
9
|
+
negative: StyledPillInnerConfigProps;
|
|
10
|
+
warning: StyledPillInnerConfigProps;
|
|
11
|
+
positive: StyledPillInnerConfigProps;
|
|
12
|
+
};
|
|
13
|
+
tag: {
|
|
14
|
+
primary: StyledPillInnerConfigProps;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare const _default: () => StyledPillConfig;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MarginProps } from "styled-system";
|
|
2
|
+
import { ThemeObject } from "../../style/themes/base/base-theme.config";
|
|
3
|
+
export interface StyledPillProps extends MarginProps {
|
|
4
|
+
/** Override color variant, provide any color from palette or any valid css color value. */
|
|
5
|
+
borderColor?: string;
|
|
6
|
+
/** Sets the max-width of the pill. */
|
|
7
|
+
maxWidth?: string;
|
|
8
|
+
/** Sets the size of the pill. */
|
|
9
|
+
size?: "S" | "M" | "L" | "XL";
|
|
10
|
+
/** @private @ignore */
|
|
11
|
+
theme?: Partial<ThemeObject>;
|
|
12
|
+
/** Allow the text within pill to wrap. */
|
|
13
|
+
wrapText?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface AllStyledPillProps extends StyledPillProps {
|
|
16
|
+
inFill?: boolean;
|
|
17
|
+
isDeletable: boolean;
|
|
18
|
+
colorVariant: "neutral" | "negative" | "positive" | "warning";
|
|
19
|
+
pillRole: "tag" | "status";
|
|
20
|
+
}
|
|
21
|
+
declare const StyledPill: import("styled-components").StyledComponent<"span", any, AllStyledPillProps, never>;
|
|
22
|
+
export default StyledPill;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { shade, meetsContrastGuidelines } from "polished";
|
|
4
3
|
import { margin } from "styled-system";
|
|
5
4
|
import styleConfig from "./pill.style.config";
|
|
@@ -18,19 +17,20 @@ function addStyleToPillIcon(fontSize) {
|
|
|
18
17
|
`;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
const
|
|
22
|
-
${margin}
|
|
20
|
+
const StyledPill = styled.span`
|
|
21
|
+
${margin}
|
|
23
22
|
${({
|
|
24
|
-
|
|
23
|
+
wrapText,
|
|
25
24
|
borderColor,
|
|
26
|
-
|
|
27
|
-
inFill,
|
|
25
|
+
colorVariant,
|
|
28
26
|
isDeletable,
|
|
27
|
+
inFill,
|
|
28
|
+
maxWidth,
|
|
29
29
|
pillRole,
|
|
30
|
-
size
|
|
30
|
+
size,
|
|
31
|
+
theme
|
|
31
32
|
}) => {
|
|
32
33
|
const isStatus = pillRole === "status";
|
|
33
|
-
const variety = isStatus ? colorVariant : "primary";
|
|
34
34
|
let pillColor;
|
|
35
35
|
let buttonFocusColor;
|
|
36
36
|
let contentColor;
|
|
@@ -41,11 +41,15 @@ const PillStyle = styled.span`
|
|
|
41
41
|
buttonFocusColor = shade(0.2, getColorValue(pillColor));
|
|
42
42
|
contentColor = meetsContrastGuidelines(getColorValue(pillColor), theme.compatibility.colorsUtilityYin090).AAA ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)";
|
|
43
43
|
} else {
|
|
44
|
+
const {
|
|
45
|
+
status,
|
|
46
|
+
tag
|
|
47
|
+
} = styleConfig();
|
|
44
48
|
const {
|
|
45
49
|
varietyColor,
|
|
46
50
|
buttonFocus,
|
|
47
51
|
content
|
|
48
|
-
} =
|
|
52
|
+
} = isStatus ? status[colorVariant] : tag.primary;
|
|
49
53
|
pillColor = varietyColor;
|
|
50
54
|
buttonFocusColor = buttonFocus;
|
|
51
55
|
contentColor = content;
|
|
@@ -67,7 +71,13 @@ const PillStyle = styled.span`
|
|
|
67
71
|
justify-content: center;
|
|
68
72
|
border: 2px solid ${pillColor};
|
|
69
73
|
height: auto;
|
|
70
|
-
|
|
74
|
+
${!wrapText && css`
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
`}
|
|
77
|
+
${wrapText && css`
|
|
78
|
+
white-space: break-spaces;
|
|
79
|
+
hyphens: auto;
|
|
80
|
+
`}
|
|
71
81
|
color: ${contentColor};
|
|
72
82
|
|
|
73
83
|
${inFill && css`
|
|
@@ -257,22 +267,13 @@ const PillStyle = styled.span`
|
|
|
257
267
|
}
|
|
258
268
|
`}
|
|
259
269
|
`}
|
|
270
|
+
${maxWidth && `max-width: ${maxWidth}`}
|
|
260
271
|
`;
|
|
261
272
|
}}
|
|
262
273
|
`;
|
|
263
|
-
|
|
274
|
+
StyledPill.defaultProps = {
|
|
264
275
|
inFill: false,
|
|
265
|
-
colorVariant: "default",
|
|
266
276
|
isDeletable: false,
|
|
267
277
|
theme: baseTheme
|
|
268
278
|
};
|
|
269
|
-
|
|
270
|
-
inFill: PropTypes.bool,
|
|
271
|
-
colorVariant: PropTypes.oneOf(["neutral", "negative", "positive", "warning"]),
|
|
272
|
-
isDeletable: PropTypes.func,
|
|
273
|
-
size: PropTypes.oneOf(["S", "M", "L", "XL"]),
|
|
274
|
-
pillRole: PropTypes.oneOf(["tag", "status"]),
|
|
275
|
-
borderColor: PropTypes.string,
|
|
276
|
-
theme: PropTypes.object
|
|
277
|
-
};
|
|
278
|
-
export default PillStyle;
|
|
279
|
+
export default StyledPill;
|
|
@@ -5,6 +5,7 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import { Transition } from "react-transition-group";
|
|
6
6
|
import { PopoverContainerWrapperStyle, PopoverContainerHeaderStyle, PopoverContainerContentStyle, PopoverContainerCloseIcon, PopoverContainerTitleStyle, PopoverContainerOpenIcon } from "./popover-container.style";
|
|
7
7
|
import Icon from "../icon";
|
|
8
|
+
import Popover from "../../__internal__/popover";
|
|
8
9
|
import createGuid from "../../__internal__/utils/helpers/guid";
|
|
9
10
|
import { filterStyledSystemPaddingProps } from "../../style/utils";
|
|
10
11
|
import useClickAwayListener from "../../hooks/__internal__/useClickAwayListener";
|
|
@@ -60,6 +61,19 @@ renderClose.propTypes = {
|
|
|
60
61
|
"tabIndex": PropTypes.number.isRequired
|
|
61
62
|
};
|
|
62
63
|
|
|
64
|
+
const offset = ({
|
|
65
|
+
reference
|
|
66
|
+
}) => {
|
|
67
|
+
return [0, -reference.height];
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const popperModifiers = [{
|
|
71
|
+
name: "offset",
|
|
72
|
+
options: {
|
|
73
|
+
offset
|
|
74
|
+
}
|
|
75
|
+
}];
|
|
76
|
+
|
|
63
77
|
const PopoverContainer = ({
|
|
64
78
|
children,
|
|
65
79
|
title,
|
|
@@ -86,7 +100,11 @@ const PopoverContainer = ({
|
|
|
86
100
|
const popoverContainerId = title ? `PopoverContainer_${guid.current}` : undefined;
|
|
87
101
|
const isOpen = isControlled ? open : isOpenInternal;
|
|
88
102
|
useEffect(() => {
|
|
89
|
-
if (isOpen && closeButtonRef.current)
|
|
103
|
+
if (isOpen && closeButtonRef.current) setTimeout(() => {
|
|
104
|
+
var _closeButtonRef$curre;
|
|
105
|
+
|
|
106
|
+
return (_closeButtonRef$curre = closeButtonRef.current) === null || _closeButtonRef$curre === void 0 ? void 0 : _closeButtonRef$curre.focus();
|
|
107
|
+
}, 0);
|
|
90
108
|
}, [isOpen]);
|
|
91
109
|
|
|
92
110
|
const handleOpenButtonClick = e => {
|
|
@@ -140,12 +158,15 @@ const PopoverContainer = ({
|
|
|
140
158
|
mountOnEnter: true,
|
|
141
159
|
unmountOnExit: true,
|
|
142
160
|
nodeRef: popoverContentNodeRef
|
|
143
|
-
}, state => /*#__PURE__*/React.createElement(
|
|
161
|
+
}, state => isOpen && /*#__PURE__*/React.createElement(Popover, _extends({
|
|
162
|
+
reference: openButtonRef,
|
|
163
|
+
placement: position === "right" ? "bottom-start" : "bottom-end"
|
|
164
|
+
}, shouldCoverButton && {
|
|
165
|
+
modifiers: popperModifiers
|
|
166
|
+
}), /*#__PURE__*/React.createElement(PopoverContainerContentStyle, _extends({
|
|
144
167
|
"data-element": "popover-container-content",
|
|
145
168
|
role: "dialog",
|
|
146
169
|
animationState: state,
|
|
147
|
-
position: position,
|
|
148
|
-
shouldCoverButton: shouldCoverButton,
|
|
149
170
|
"aria-labelledby": popoverContainerId,
|
|
150
171
|
"aria-label": containerAriaLabel,
|
|
151
172
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -154,7 +175,7 @@ const PopoverContainer = ({
|
|
|
154
175
|
}, filterStyledSystemPaddingProps(rest)), /*#__PURE__*/React.createElement(PopoverContainerHeaderStyle, null, /*#__PURE__*/React.createElement(PopoverContainerTitleStyle, {
|
|
155
176
|
id: popoverContainerId,
|
|
156
177
|
"data-element": "popover-container-title"
|
|
157
|
-
}, title), renderCloseComponent(renderCloseComponentProps)), children)));
|
|
178
|
+
}, title), renderCloseComponent(renderCloseComponentProps)), children))));
|
|
158
179
|
};
|
|
159
180
|
|
|
160
181
|
PopoverContainer.propTypes = {
|
|
@@ -3,8 +3,6 @@ import IconButton from "../icon-button";
|
|
|
3
3
|
declare const PopoverContainerWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
declare const PopoverContainerHeaderStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
5
|
declare type PopoverContainerContentStyleProps = {
|
|
6
|
-
shouldCoverButton?: boolean;
|
|
7
|
-
position?: "left" | "right";
|
|
8
6
|
animationState?: TransitionStatus;
|
|
9
7
|
};
|
|
10
8
|
declare const PopoverContainerContentStyle: import("styled-components").StyledComponent<"div", any, PopoverContainerContentStyleProps, never>;
|
|
@@ -24,14 +24,6 @@ const PopoverContainerContentStyle = styled.div`
|
|
|
24
24
|
theme
|
|
25
25
|
}) => theme.zIndex.popover};
|
|
26
26
|
|
|
27
|
-
${({
|
|
28
|
-
shouldCoverButton
|
|
29
|
-
}) => shouldCoverButton && "top: 0"}
|
|
30
|
-
|
|
31
|
-
${({
|
|
32
|
-
position
|
|
33
|
-
}) => position === "left" ? "right: 0" : "left: 0"};
|
|
34
|
-
|
|
35
27
|
${({
|
|
36
28
|
animationState
|
|
37
29
|
}) => {
|
|
@@ -43,6 +43,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
43
43
|
"data-role": dataRole,
|
|
44
44
|
listPlacement = "bottom-start",
|
|
45
45
|
flipEnabled = true,
|
|
46
|
+
wrapPillText = true,
|
|
46
47
|
...textboxProps
|
|
47
48
|
}, inputRef) => {
|
|
48
49
|
const [activeDescendantId, setActiveDescendantId] = useState();
|
|
@@ -192,7 +193,8 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
192
193
|
return /*#__PURE__*/React.createElement(StyledSelectPillContainer, {
|
|
193
194
|
key: key
|
|
194
195
|
}, /*#__PURE__*/React.createElement(Pill, _extends({
|
|
195
|
-
onDelete: canDelete ? () => removeSelectedValue(index) : undefined
|
|
196
|
+
onDelete: canDelete ? () => removeSelectedValue(index) : undefined,
|
|
197
|
+
wrapText: wrapPillText
|
|
196
198
|
}, pillProps), title));
|
|
197
199
|
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
198
200
|
}, [children, disabled, readOnly, selectedValue]);
|
|
@@ -500,7 +502,10 @@ MultiSelect.propTypes = { ...formInputPropTypes,
|
|
|
500
502
|
listPlacement: PropTypes.oneOf(["auto", "auto-start", "auto-end", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"]),
|
|
501
503
|
|
|
502
504
|
/** Use the opposite list placement if the set placement does not fit */
|
|
503
|
-
flipEnabled: PropTypes.bool
|
|
505
|
+
flipEnabled: PropTypes.bool,
|
|
506
|
+
|
|
507
|
+
/** Wraps the pill text when it would overflow the input width */
|
|
508
|
+
wrapPillText: PropTypes.bool
|
|
504
509
|
};
|
|
505
510
|
MultiSelect.defaultProps = {
|
|
506
511
|
"data-component": "multiselect"
|
|
@@ -58,6 +58,8 @@ export interface MultiSelectProps
|
|
|
58
58
|
| "left-end";
|
|
59
59
|
/** Use the opposite list placement if the set placement does not fit */
|
|
60
60
|
flipEnabled?: bool;
|
|
61
|
+
/** Wraps the pill text when it would overflow the input width */
|
|
62
|
+
wrapPillText?: boolean;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
declare function MultiSelect(
|
|
@@ -10,7 +10,7 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
|
|
|
10
10
|
/** Icon type */
|
|
11
11
|
helpIcon?: IconType;
|
|
12
12
|
/** Overrides the default tabindex of the Help component */
|
|
13
|
-
helpTabIndex?: string;
|
|
13
|
+
helpTabIndex?: number | string;
|
|
14
14
|
/** A string that represents the ID of another form element */
|
|
15
15
|
htmlFor?: string;
|
|
16
16
|
/** The unique id of the label element */
|
|
@@ -117,7 +117,7 @@ const Label = ({
|
|
|
117
117
|
|
|
118
118
|
return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default, wrapperProps, /*#__PURE__*/_react.default.createElement(_help.default, {
|
|
119
119
|
tooltipId: tooltipId,
|
|
120
|
-
tabIndex: helpTabIndex,
|
|
120
|
+
tabIndex: Number(helpTabIndex),
|
|
121
121
|
type: helpIcon,
|
|
122
122
|
isFocused: isFocused
|
|
123
123
|
}, help));
|
|
@@ -149,7 +149,7 @@ Label.propTypes = {
|
|
|
149
149
|
"error": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
150
150
|
"help": _propTypes.default.node,
|
|
151
151
|
"helpIcon": _propTypes.default.oneOf(["add", "admin", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick", "true_tick", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
|
|
152
|
-
"helpTabIndex": _propTypes.default.string,
|
|
152
|
+
"helpTabIndex": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
153
153
|
"htmlFor": _propTypes.default.string,
|
|
154
154
|
"info": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
155
155
|
"inline": _propTypes.default.bool,
|
|
@@ -34,7 +34,6 @@ exports.CheckboxGroupContext = CheckboxGroupContext;
|
|
|
34
34
|
const CheckboxGroup = props => {
|
|
35
35
|
const {
|
|
36
36
|
children,
|
|
37
|
-
groupName,
|
|
38
37
|
legend,
|
|
39
38
|
error,
|
|
40
39
|
warning,
|
|
@@ -65,7 +64,6 @@ const CheckboxGroup = props => {
|
|
|
65
64
|
legendInline: legendInline
|
|
66
65
|
}, /*#__PURE__*/_react.default.createElement(CheckboxGroupContext.Provider, {
|
|
67
66
|
value: {
|
|
68
|
-
inputName: groupName,
|
|
69
67
|
error: !!error,
|
|
70
68
|
warning: !!warning,
|
|
71
69
|
info: !!info
|
|
@@ -95,9 +93,6 @@ CheckboxGroup.propTypes = {
|
|
|
95
93
|
/** The Checkboxes to be rendered in the group */
|
|
96
94
|
children: _propTypes.default.node.isRequired,
|
|
97
95
|
|
|
98
|
-
/** Specifies the name prop to be applied to each button in the group */
|
|
99
|
-
groupName: _propTypes.default.string.isRequired,
|
|
100
|
-
|
|
101
96
|
/** Indicate that error has occurred
|
|
102
97
|
Pass string to display icon, tooltip and red border
|
|
103
98
|
Pass true boolean to only display red border */
|
|
@@ -15,8 +15,6 @@ interface CheckboxGroupProps extends ValidationProps, MarginProps {
|
|
|
15
15
|
legendSpacing?: 1 | 2;
|
|
16
16
|
/** The Checkboxes to be rendered in the group */
|
|
17
17
|
children: React.ReactNode;
|
|
18
|
-
/** Specifies the name prop to be applied to each button in the group */
|
|
19
|
-
groupName: string;
|
|
20
18
|
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
|
|
21
19
|
labelSpacing?: 1 | 2;
|
|
22
20
|
/** Flag to configure component as mandatory */
|
|
@@ -74,8 +74,7 @@ const Checkbox = ({
|
|
|
74
74
|
const {
|
|
75
75
|
error: contextError,
|
|
76
76
|
warning: contextWarning,
|
|
77
|
-
info: contextInfo
|
|
78
|
-
inputName
|
|
77
|
+
info: contextInfo
|
|
79
78
|
} = (0, _react.useContext)(_checkboxGroup.CheckboxGroupContext);
|
|
80
79
|
const inputProps = {
|
|
81
80
|
onClick,
|
|
@@ -103,7 +102,6 @@ const Checkbox = ({
|
|
|
103
102
|
inputWidth,
|
|
104
103
|
labelWidth,
|
|
105
104
|
tooltipPosition,
|
|
106
|
-
inputName,
|
|
107
105
|
...props
|
|
108
106
|
};
|
|
109
107
|
return /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
|