carbon-react 109.1.2 → 109.2.1

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.
Files changed (29) hide show
  1. package/esm/components/pill/index.d.ts +2 -1
  2. package/esm/components/pill/pill.component.d.ts +22 -0
  3. package/esm/components/pill/pill.component.js +219 -42
  4. package/esm/components/pill/pill.style.config.d.ts +18 -0
  5. package/esm/components/pill/pill.style.d.ts +22 -0
  6. package/esm/components/pill/pill.style.js +23 -22
  7. package/esm/components/popover-container/popover-container.component.js +26 -5
  8. package/esm/components/popover-container/popover-container.style.d.ts +0 -2
  9. package/esm/components/popover-container/popover-container.style.js +0 -8
  10. package/esm/components/search/search.style.js +22 -8
  11. package/esm/components/select/multi-select/multi-select.component.js +7 -2
  12. package/esm/components/select/multi-select/multi-select.d.ts +2 -0
  13. package/esm/components/select/multi-select/multi-select.style.js +1 -0
  14. package/lib/components/pill/index.d.ts +2 -1
  15. package/lib/components/pill/pill.component.d.ts +22 -0
  16. package/lib/components/pill/pill.component.js +220 -46
  17. package/lib/components/pill/pill.style.config.d.ts +18 -0
  18. package/lib/components/pill/pill.style.d.ts +22 -0
  19. package/lib/components/pill/pill.style.js +23 -23
  20. package/lib/components/popover-container/popover-container.component.js +27 -5
  21. package/lib/components/popover-container/popover-container.style.d.ts +0 -2
  22. package/lib/components/popover-container/popover-container.style.js +0 -8
  23. package/lib/components/search/search.style.js +22 -8
  24. package/lib/components/select/multi-select/multi-select.component.js +7 -2
  25. package/lib/components/select/multi-select/multi-select.d.ts +2 -0
  26. package/lib/components/select/multi-select/multi-select.style.js +1 -0
  27. package/package.json +4 -4
  28. package/esm/components/pill/pill.d.ts +0 -24
  29. package/lib/components/pill/pill.d.ts +0 -24
@@ -1 +1,2 @@
1
- export { default } from "./pill";
1
+ export { default } from "./pill.component";
2
+ export type { PillProps } from "./pill.component";
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { StyledPillProps } from "./pill.style";
3
+ export interface PillProps extends StyledPillProps {
4
+ /** The content to display inside of the pill. */
5
+ children: string;
6
+ /** Change the color of a status pill. */
7
+ colorVariant?: "neutral" | "negative" | "positive" | "warning";
8
+ /** Identifier used for testing purposes, applied to the root element of the component. */
9
+ "data-element"?: string;
10
+ /** Identifier used for testing purposes, applied to the root element of the component. */
11
+ "data-role"?: string;
12
+ /** Fills the pill background with colour. When fill is false only the border is coloured. */
13
+ fill?: boolean;
14
+ /** Callback function for when the pill is clicked. */
15
+ onClick?: React.MouseEventHandler<HTMLSpanElement>;
16
+ /** Callback function for when the remove icon is clicked. */
17
+ onDelete?: React.MouseEventHandler<HTMLButtonElement>;
18
+ /** Sets the type of pill in use. */
19
+ pillRole?: "tag" | "status";
20
+ }
21
+ export declare const Pill: ({ wrapText, borderColor, colorVariant, children, fill, maxWidth, onClick, onDelete, pillRole, size, ...rest }: PillProps) => JSX.Element;
22
+ export default Pill;
@@ -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
- fill,
23
- onDelete,
24
- colorVariant,
19
+ wrapText,
25
20
  borderColor,
26
- pillRole,
21
+ colorVariant = "neutral",
27
22
  children,
28
- size,
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), rest), children, onDelete && renderCloseIcon(onDelete));
38
+ }, tagComponent("pill", rest), {
39
+ maxWidth: maxWidth,
40
+ wrapText: wrapText
41
+ }, rest), children, onDelete && renderCloseIcon(onDelete));
40
42
 
41
43
  Pill.propTypes = {
42
- /** Filtered styled system margin props */
43
- ...marginPropTypes,
44
-
45
- /** Change the color of a status pill. */
46
- colorVariant: PropTypes.oneOf(["neutral", "negative", "positive", "warning"]),
47
-
48
- /** Override color variant, provide design token, any color from palette or any valid css color value. */
49
- borderColor: PropTypes.string,
50
-
51
- /** The content to display inside of the pill. */
52
- children: PropTypes.string.isRequired,
53
-
54
- /** Fills the pill background with colour. When fill is false only the border is coloured. */
55
- fill: PropTypes.bool,
56
-
57
- /** Sets the type of pill in use. */
58
- pillRole: PropTypes.oneOf(["tag", "status"]),
59
-
60
- /** Callback function for when the pill is clicked. */
61
- onClick: PropTypes.func,
62
-
63
- /** Callback function for when the remove icon is clicked. */
64
- onDelete: PropTypes.func,
65
- size: PropTypes.oneOf(["S", "M", "L", "XL"])
66
- };
67
- Pill.defaultProps = {
68
- colorVariant: "neutral",
69
- fill: false,
70
- onClick: null,
71
- onDelete: null,
72
- pillRole: "tag",
73
- size: "M"
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 PillStyle = styled.span`
22
- ${margin};
20
+ const StyledPill = styled.span`
21
+ ${margin}
23
22
  ${({
24
- colorVariant,
23
+ wrapText,
25
24
  borderColor,
26
- theme,
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
- } = styleConfig(theme)[pillRole][variety];
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
- white-space: nowrap;
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
- PillStyle.defaultProps = {
274
+ StyledPill.defaultProps = {
264
275
  inFill: false,
265
- colorVariant: "default",
266
276
  isDeletable: false,
267
277
  theme: baseTheme
268
278
  };
269
- PillStyle.propTypes = {
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) closeButtonRef.current.focus();
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(PopoverContainerContentStyle, _extends({
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
  }) => {
@@ -97,20 +97,34 @@ const StyledSearch = styled.div`
97
97
  z-index: ${theme.zIndex.smallOverlay};
98
98
  }
99
99
  ${StyledIcon} {
100
- color: ${iconColor ? "var(--colorsUtilityMajor400)" : "var(--colorsUtilityMajor200)"};
100
+ ${darkVariant && css`
101
+ ${iconColor && css`
102
+ color: var(--colorsUtilityMajor400);
103
+
104
+ :hover {
105
+ color: var(--colorsUtilityMajor500);
106
+ }
107
+ `}
108
+ ${!iconColor && css`
109
+ color: var(--colorsUtilityMajor200);
110
+
111
+ :hover {
112
+ color: var(--colorsUtilityMajor100);
113
+ }
114
+ `}
115
+ `}
116
+
101
117
  ${!darkVariant && css`
102
- color: var(--colorsUtilityMajor400);
118
+ color: var(--colorsActionMinor500);
119
+
120
+ :hover {
121
+ color: var(--colorsActionMinor600);
122
+ }
103
123
  `}
104
124
 
105
125
  width: 20px;
106
126
  height: 20px;
107
127
  cursor: pointer;
108
- :hover {
109
- color: ${iconColor ? "var(--colorsUtilityMajor500)" : "var(--colorsUtilityMajor100)"};
110
- ${!darkVariant && css`
111
- color: var(--colorsUtilityMajor500);
112
- `}
113
- }
114
128
  }
115
129
 
116
130
  ${StyledInputIconToggle} {
@@ -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,6 +10,7 @@ const StyledSelectPillContainer = styled.div`
10
10
  flex-direction: column;
11
11
  justify-content: center;
12
12
  margin: 3px 2px 3px 0;
13
+ max-width: 100%;
13
14
 
14
15
  && ${StyledPill} {
15
16
  text-overflow: ellipsis;
@@ -1 +1,2 @@
1
- export { default } from "./pill";
1
+ export { default } from "./pill.component";
2
+ export type { PillProps } from "./pill.component";