carbon-react 114.12.1 → 114.12.2
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,
|
|
@@ -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,
|