carbon-react 114.12.1 → 114.12.3
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.
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import { space, layout, flexbox, position } from "styled-system";
|
|
2
|
+
import { space, layout, flexbox, position as positionFn } from "styled-system";
|
|
3
3
|
import Logger from "../../__internal__/utils/logger";
|
|
4
4
|
import BaseTheme from "../../style/themes/base";
|
|
5
5
|
import styledColor from "../../style/utils/color";
|
|
6
6
|
import boxConfig from "./box.config";
|
|
7
7
|
const GAP_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
8
8
|
let isDeprecationWarningTriggered = false;
|
|
9
|
+
|
|
10
|
+
const calculatePosition = props => {
|
|
11
|
+
const {
|
|
12
|
+
position,
|
|
13
|
+
...rest
|
|
14
|
+
} = positionFn(props);
|
|
15
|
+
return {
|
|
16
|
+
position,
|
|
17
|
+
zIndex: ["sticky", "fixed"].includes(position) ? 1 : undefined,
|
|
18
|
+
...rest
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
9
22
|
export const Box = styled.div`
|
|
10
23
|
${() => {
|
|
11
24
|
if (!isDeprecationWarningTriggered) {
|
|
@@ -19,7 +32,7 @@ export const Box = styled.div`
|
|
|
19
32
|
${space}
|
|
20
33
|
${layout}
|
|
21
34
|
${flexbox}
|
|
22
|
-
${
|
|
35
|
+
${calculatePosition}
|
|
23
36
|
|
|
24
37
|
${({
|
|
25
38
|
color,
|
|
@@ -353,11 +353,6 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
353
353
|
|
|
354
354
|
setTextValue("");
|
|
355
355
|
const isAlreadySelected = actualValue.findIndex(val => isExpectedValue(val, newValue)) !== -1;
|
|
356
|
-
|
|
357
|
-
if (!isAlreadySelected && isControlled.current && onChange) {
|
|
358
|
-
onChange(createCustomEvent([...actualValue, newValue]));
|
|
359
|
-
}
|
|
360
|
-
|
|
361
356
|
textboxRef.focus();
|
|
362
357
|
isMouseDownReported.current = false;
|
|
363
358
|
updateValue(previousValue => {
|
|
@@ -367,7 +362,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
367
362
|
|
|
368
363
|
return [...previousValue, newValue];
|
|
369
364
|
});
|
|
370
|
-
}, [
|
|
365
|
+
}, [textboxRef, actualValue, updateValue]);
|
|
371
366
|
|
|
372
367
|
function onSelectListClose() {
|
|
373
368
|
setOpenState(false);
|
|
@@ -25,6 +25,19 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
25
25
|
|
|
26
26
|
const GAP_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
27
27
|
let isDeprecationWarningTriggered = false;
|
|
28
|
+
|
|
29
|
+
const calculatePosition = props => {
|
|
30
|
+
const {
|
|
31
|
+
position,
|
|
32
|
+
...rest
|
|
33
|
+
} = (0, _styledSystem.position)(props);
|
|
34
|
+
return {
|
|
35
|
+
position,
|
|
36
|
+
zIndex: ["sticky", "fixed"].includes(position) ? 1 : undefined,
|
|
37
|
+
...rest
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
28
41
|
const Box = _styledComponents.default.div`
|
|
29
42
|
${() => {
|
|
30
43
|
if (!isDeprecationWarningTriggered) {
|
|
@@ -39,7 +52,7 @@ const Box = _styledComponents.default.div`
|
|
|
39
52
|
${_styledSystem.space}
|
|
40
53
|
${_styledSystem.layout}
|
|
41
54
|
${_styledSystem.flexbox}
|
|
42
|
-
${
|
|
55
|
+
${calculatePosition}
|
|
43
56
|
|
|
44
57
|
${({
|
|
45
58
|
color,
|
|
@@ -383,11 +383,6 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
383
383
|
|
|
384
384
|
setTextValue("");
|
|
385
385
|
const isAlreadySelected = actualValue.findIndex(val => (0, _isExpectedValue.default)(val, newValue)) !== -1;
|
|
386
|
-
|
|
387
|
-
if (!isAlreadySelected && isControlled.current && onChange) {
|
|
388
|
-
onChange(createCustomEvent([...actualValue, newValue]));
|
|
389
|
-
}
|
|
390
|
-
|
|
391
386
|
textboxRef.focus();
|
|
392
387
|
isMouseDownReported.current = false;
|
|
393
388
|
updateValue(previousValue => {
|
|
@@ -397,7 +392,7 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
397
392
|
|
|
398
393
|
return [...previousValue, newValue];
|
|
399
394
|
});
|
|
400
|
-
}, [
|
|
395
|
+
}, [textboxRef, actualValue, updateValue]);
|
|
401
396
|
|
|
402
397
|
function onSelectListClose() {
|
|
403
398
|
setOpenState(false);
|