carbon-react 142.0.3 → 142.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/__internal__/validations/validation-icon.component.js +2 -1
- package/esm/components/link/link.style.js +15 -6
- package/esm/components/select/filterable-select/filterable-select.component.js +1 -0
- package/esm/components/select/multi-select/multi-select.component.js +16 -0
- package/lib/__internal__/validations/validation-icon.component.js +2 -1
- package/lib/components/link/link.style.js +15 -6
- package/lib/components/select/filterable-select/filterable-select.component.js +1 -0
- package/lib/components/select/multi-select/multi-select.component.js +16 -0
- package/package.json +2 -4
|
@@ -69,7 +69,8 @@ export const ValidationIcon = ({
|
|
|
69
69
|
setTriggeredByIcon(false);
|
|
70
70
|
if (onBlur) onBlur(e);
|
|
71
71
|
},
|
|
72
|
-
isPartOfInput: isPartOfInput
|
|
72
|
+
isPartOfInput: isPartOfInput,
|
|
73
|
+
"data-role": `validation-icon-${validationType}`
|
|
73
74
|
}, filterStyledSystemMarginProps(rest)), /*#__PURE__*/React.createElement(Icon, {
|
|
74
75
|
"aria-describedby": validationTooltipId.current,
|
|
75
76
|
key: `${validationType}-icon`,
|
|
@@ -58,12 +58,14 @@ const StyledLink = styled.span`
|
|
|
58
58
|
position: absolute;
|
|
59
59
|
padding-left: var(--spacing300);
|
|
60
60
|
padding-right: var(--spacing300);
|
|
61
|
-
line-height:
|
|
61
|
+
line-height: var(--sizing600);
|
|
62
62
|
left: -999em;
|
|
63
63
|
z-index: ${theme.zIndex.aboveAll};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
border: 3px solid var(--colorsUtilityYin100);
|
|
65
|
+
box-shadow: var(--boxShadow300);
|
|
66
|
+
border-radius: var(--spacing000) var(--spacing100) var(--spacing100)
|
|
67
|
+
var(--spacing000);
|
|
68
|
+
font-size: var(--fontSizes100);
|
|
67
69
|
color: var(--colorsUtilityYin090);
|
|
68
70
|
|
|
69
71
|
&:hover {
|
|
@@ -76,13 +78,20 @@ const StyledLink = styled.span`
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
&:focus {
|
|
79
|
-
background-color: var(--
|
|
81
|
+
background-color: var(--colorsSemanticFocus500);
|
|
82
|
+
text-decoration: underline var(--colorsUtilityYin100);
|
|
83
|
+
text-decoration-thickness: 4px;
|
|
84
|
+
text-underline-offset: 3px;
|
|
85
|
+
|
|
86
|
+
-webkit-text-decoration: underline var(--colorsUtilityYin100);
|
|
87
|
+
-webkit-text-decoration-thickness: 4px;
|
|
88
|
+
-webkit-text-underline-offset: 3px;
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
a:focus {
|
|
84
93
|
top: var(--spacing100);
|
|
85
|
-
left:
|
|
94
|
+
left: 0;
|
|
86
95
|
}
|
|
87
96
|
`}
|
|
88
97
|
|
|
@@ -66,6 +66,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
66
66
|
const isClickTriggeredBySelect = useRef(false);
|
|
67
67
|
const isMouseDownReported = useRef(false);
|
|
68
68
|
const isMouseDownOnInput = useRef(false);
|
|
69
|
+
const isOpenedByFocus = useRef(false);
|
|
69
70
|
const isControlled = useRef(value !== undefined);
|
|
70
71
|
const [textboxRef, setTextboxRef] = useState();
|
|
71
72
|
const [isOpen, setOpenState] = useState(false);
|
|
@@ -271,6 +272,17 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
271
272
|
if (onClick) {
|
|
272
273
|
onClick(event);
|
|
273
274
|
}
|
|
275
|
+
if (!openOnFocus || openOnFocus && !isOpenedByFocus.current) {
|
|
276
|
+
if (isOpen) {
|
|
277
|
+
setFilterText("");
|
|
278
|
+
setOpenState(false);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
onOpen?.();
|
|
282
|
+
setOpenState(true);
|
|
283
|
+
} else {
|
|
284
|
+
isOpenedByFocus.current = false;
|
|
285
|
+
}
|
|
274
286
|
}
|
|
275
287
|
function handleDropdownIconClick(event) {
|
|
276
288
|
isMouseDownReported.current = false;
|
|
@@ -329,8 +341,12 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
329
341
|
isInputFocused.current = true;
|
|
330
342
|
}
|
|
331
343
|
if (isMouseDownReported.current && !isMouseDownOnInput.current) {
|
|
344
|
+
isOpenedByFocus.current = false;
|
|
332
345
|
return false;
|
|
333
346
|
}
|
|
347
|
+
if (isMouseDownOnInput.current) {
|
|
348
|
+
isOpenedByFocus.current = true;
|
|
349
|
+
}
|
|
334
350
|
return true;
|
|
335
351
|
});
|
|
336
352
|
});
|
|
@@ -78,7 +78,8 @@ const ValidationIcon = ({
|
|
|
78
78
|
setTriggeredByIcon(false);
|
|
79
79
|
if (onBlur) onBlur(e);
|
|
80
80
|
},
|
|
81
|
-
isPartOfInput: isPartOfInput
|
|
81
|
+
isPartOfInput: isPartOfInput,
|
|
82
|
+
"data-role": `validation-icon-${validationType}`
|
|
82
83
|
}, (0, _utils.filterStyledSystemMarginProps)(rest)), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
83
84
|
"aria-describedby": validationTooltipId.current,
|
|
84
85
|
key: `${validationType}-icon`,
|
|
@@ -67,12 +67,14 @@ const StyledLink = exports.StyledLink = _styledComponents.default.span`
|
|
|
67
67
|
position: absolute;
|
|
68
68
|
padding-left: var(--spacing300);
|
|
69
69
|
padding-right: var(--spacing300);
|
|
70
|
-
line-height:
|
|
70
|
+
line-height: var(--sizing600);
|
|
71
71
|
left: -999em;
|
|
72
72
|
z-index: ${theme.zIndex.aboveAll};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
border: 3px solid var(--colorsUtilityYin100);
|
|
74
|
+
box-shadow: var(--boxShadow300);
|
|
75
|
+
border-radius: var(--spacing000) var(--spacing100) var(--spacing100)
|
|
76
|
+
var(--spacing000);
|
|
77
|
+
font-size: var(--fontSizes100);
|
|
76
78
|
color: var(--colorsUtilityYin090);
|
|
77
79
|
|
|
78
80
|
&:hover {
|
|
@@ -85,13 +87,20 @@ const StyledLink = exports.StyledLink = _styledComponents.default.span`
|
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
&:focus {
|
|
88
|
-
background-color: var(--
|
|
90
|
+
background-color: var(--colorsSemanticFocus500);
|
|
91
|
+
text-decoration: underline var(--colorsUtilityYin100);
|
|
92
|
+
text-decoration-thickness: 4px;
|
|
93
|
+
text-underline-offset: 3px;
|
|
94
|
+
|
|
95
|
+
-webkit-text-decoration: underline var(--colorsUtilityYin100);
|
|
96
|
+
-webkit-text-decoration-thickness: 4px;
|
|
97
|
+
-webkit-text-underline-offset: 3px;
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
100
|
|
|
92
101
|
a:focus {
|
|
93
102
|
top: var(--spacing100);
|
|
94
|
-
left:
|
|
103
|
+
left: 0;
|
|
95
104
|
}
|
|
96
105
|
`}
|
|
97
106
|
|
|
@@ -75,6 +75,7 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
|
|
|
75
75
|
const isClickTriggeredBySelect = (0, _react.useRef)(false);
|
|
76
76
|
const isMouseDownReported = (0, _react.useRef)(false);
|
|
77
77
|
const isMouseDownOnInput = (0, _react.useRef)(false);
|
|
78
|
+
const isOpenedByFocus = (0, _react.useRef)(false);
|
|
78
79
|
const isControlled = (0, _react.useRef)(value !== undefined);
|
|
79
80
|
const [textboxRef, setTextboxRef] = (0, _react.useState)();
|
|
80
81
|
const [isOpen, setOpenState] = (0, _react.useState)(false);
|
|
@@ -280,6 +281,17 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
|
|
|
280
281
|
if (onClick) {
|
|
281
282
|
onClick(event);
|
|
282
283
|
}
|
|
284
|
+
if (!openOnFocus || openOnFocus && !isOpenedByFocus.current) {
|
|
285
|
+
if (isOpen) {
|
|
286
|
+
setFilterText("");
|
|
287
|
+
setOpenState(false);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
onOpen?.();
|
|
291
|
+
setOpenState(true);
|
|
292
|
+
} else {
|
|
293
|
+
isOpenedByFocus.current = false;
|
|
294
|
+
}
|
|
283
295
|
}
|
|
284
296
|
function handleDropdownIconClick(event) {
|
|
285
297
|
isMouseDownReported.current = false;
|
|
@@ -338,8 +350,12 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
|
|
|
338
350
|
isInputFocused.current = true;
|
|
339
351
|
}
|
|
340
352
|
if (isMouseDownReported.current && !isMouseDownOnInput.current) {
|
|
353
|
+
isOpenedByFocus.current = false;
|
|
341
354
|
return false;
|
|
342
355
|
}
|
|
356
|
+
if (isMouseDownOnInput.current) {
|
|
357
|
+
isOpenedByFocus.current = true;
|
|
358
|
+
}
|
|
343
359
|
return true;
|
|
344
360
|
});
|
|
345
361
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "142.0
|
|
3
|
+
"version": "142.1.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -158,12 +158,12 @@
|
|
|
158
158
|
"lint-staged": "^11.2.6",
|
|
159
159
|
"mockdate": "^2.0.5",
|
|
160
160
|
"nock": "^13.3.8",
|
|
161
|
+
"node-fetch": "^3.3.2",
|
|
161
162
|
"prettier": "~2.2.0",
|
|
162
163
|
"raf": "^3.4.1",
|
|
163
164
|
"react": "^17.0.2",
|
|
164
165
|
"react-dom": "^17.0.2",
|
|
165
166
|
"react-markdown": "^8.0.7",
|
|
166
|
-
"react-router-dom": "^6.20.0",
|
|
167
167
|
"react-test-renderer": "^17.0.2",
|
|
168
168
|
"remark-gfm": "^4.0.0",
|
|
169
169
|
"rimraf": "^3.0.2",
|
|
@@ -194,7 +194,6 @@
|
|
|
194
194
|
"immutable": "~3.8.2",
|
|
195
195
|
"invariant": "^2.2.4",
|
|
196
196
|
"lodash": "^4.17.21",
|
|
197
|
-
"node-fetch": "^3.3.2",
|
|
198
197
|
"polished": "^4.2.2",
|
|
199
198
|
"prop-types": "^15.8.1",
|
|
200
199
|
"react-day-picker": "~7.4.10",
|
|
@@ -202,7 +201,6 @@
|
|
|
202
201
|
"react-dnd-html5-backend": "^15.1.3",
|
|
203
202
|
"react-is": "^17.0.2",
|
|
204
203
|
"react-transition-group": "^4.4.5",
|
|
205
|
-
"sinon": "^17.0.1",
|
|
206
204
|
"styled-system": "^5.1.5"
|
|
207
205
|
},
|
|
208
206
|
"overrides": {
|