carbon-react 152.1.0 → 152.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/components/tile/tile.component.js +3 -11
- package/esm/components/tile/tile.config.js +1 -1
- package/esm/components/tile/tile.style.d.ts +0 -4
- package/esm/components/tile/tile.style.js +18 -17
- package/lib/components/tile/tile.component.js +3 -13
- package/lib/components/tile/tile.config.js +1 -1
- package/lib/components/tile/tile.style.d.ts +0 -4
- package/lib/components/tile/tile.style.js +19 -18
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React from "react";
|
|
3
|
-
import StyledTile
|
|
3
|
+
import StyledTile from "./tile.style";
|
|
4
4
|
import TileContext from "./__internal__/tile.context";
|
|
5
5
|
import filterStyledSystemPaddingProps from "../../style/utils/filter-styled-system-padding-props";
|
|
6
6
|
import filterStyledSystemMarginProps from "../../style/utils/filter-styled-system-margin-props";
|
|
@@ -26,13 +26,14 @@ export const Tile = ({
|
|
|
26
26
|
});
|
|
27
27
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
28
28
|
const contentPaddingProps = computeContentPadding(paddingProps, isHorizontal);
|
|
29
|
-
|
|
29
|
+
return /*#__PURE__*/React.createElement(StyledTile, _extends({
|
|
30
30
|
variant: variant,
|
|
31
31
|
width: width,
|
|
32
32
|
height: height,
|
|
33
33
|
isHorizontal: isHorizontal,
|
|
34
34
|
p: p,
|
|
35
35
|
roundness: roundness,
|
|
36
|
+
highlightVariant: highlightVariant,
|
|
36
37
|
borderWidth: borderWidth,
|
|
37
38
|
borderVariant: borderVariant
|
|
38
39
|
}, paddingProps, marginProps, tagComponent("tile", rest)), /*#__PURE__*/React.createElement(TileContext.Provider, {
|
|
@@ -41,14 +42,5 @@ export const Tile = ({
|
|
|
41
42
|
paddingPropsFromTile: contentPaddingProps
|
|
42
43
|
}
|
|
43
44
|
}, children));
|
|
44
|
-
if (highlightVariant) {
|
|
45
|
-
return /*#__PURE__*/React.createElement(StyledHighlight, {
|
|
46
|
-
variant: highlightVariant,
|
|
47
|
-
roundness: roundness,
|
|
48
|
-
"aria-hidden": true,
|
|
49
|
-
"data-role": `tile-${highlightVariant}-highlight`
|
|
50
|
-
}, tile);
|
|
51
|
-
}
|
|
52
|
-
return tile;
|
|
53
45
|
};
|
|
54
46
|
export default Tile;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export const TILE_ORIENTATIONS = ["horizontal", "vertical"];
|
|
2
2
|
export const TILE_THEMES = ["tile", "transparent", "active", "grey"];
|
|
3
3
|
export const TILE_BORDER_VARIANTS = ["default", "info", "selected", "negative", "positive", "caution"];
|
|
4
|
-
export const TILE_HIGHLIGHT_VARIANTS = ["gradient", "success", "neutral", "error", "warning", "info"];
|
|
4
|
+
export const TILE_HIGHLIGHT_VARIANTS = ["gradient", "success", "neutral", "error", "warning", "info", "important"];
|
|
@@ -3,8 +3,4 @@ import { TileProps } from "./tile.component";
|
|
|
3
3
|
declare const StyledTile: import("styled-components").StyledComponent<"div", any, Pick<TileProps, "width" | "height" | "variant" | "roundness" | "borderWidth" | "borderVariant" | "highlightVariant"> & {
|
|
4
4
|
isHorizontal?: boolean | undefined;
|
|
5
5
|
} & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
|
|
6
|
-
export declare const StyledHighlight: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
-
variant: Required<TileProps["highlightVariant"]>;
|
|
8
|
-
roundness: TileProps["roundness"];
|
|
9
|
-
}, never>;
|
|
10
6
|
export default StyledTile;
|
|
@@ -48,6 +48,9 @@ const getHighlightVariant = variant => {
|
|
|
48
48
|
return "var(--colorsSemanticCaution500)";
|
|
49
49
|
case "info":
|
|
50
50
|
return "var(--colorsSemanticInfo500)";
|
|
51
|
+
// FE-6368 has been raised for the below, change hex values for design tokens (when added)
|
|
52
|
+
case "important":
|
|
53
|
+
return " #8F4CD7";
|
|
51
54
|
default:
|
|
52
55
|
// gradient is default
|
|
53
56
|
return "linear-gradient(0deg, rgb(143, 73, 254) 5%, rgb(0, 146, 219) 50%, rgb(19, 160, 56) 95%)";
|
|
@@ -61,10 +64,25 @@ const StyledTile = styled.div`
|
|
|
61
64
|
variant,
|
|
62
65
|
width,
|
|
63
66
|
roundness,
|
|
67
|
+
highlightVariant,
|
|
64
68
|
height
|
|
65
69
|
}) => css`
|
|
66
70
|
${space}
|
|
67
71
|
|
|
72
|
+
${highlightVariant && css`
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
&::before {
|
|
75
|
+
display: block;
|
|
76
|
+
content: "";
|
|
77
|
+
height: 100%;
|
|
78
|
+
width: 8px;
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
background: ${getHighlightVariant(highlightVariant)};
|
|
83
|
+
}
|
|
84
|
+
`}
|
|
85
|
+
|
|
68
86
|
box-sizing: border-box;
|
|
69
87
|
border: var(--${borderWidth}) solid
|
|
70
88
|
${getBorderColor(borderVariant, variant)};
|
|
@@ -109,21 +127,4 @@ const StyledTile = styled.div`
|
|
|
109
127
|
StyledTile.defaultProps = {
|
|
110
128
|
theme: baseTheme
|
|
111
129
|
};
|
|
112
|
-
export const StyledHighlight = styled.div`
|
|
113
|
-
height: 100%;
|
|
114
|
-
width: 100%;
|
|
115
|
-
position: relative;
|
|
116
|
-
background: ${({
|
|
117
|
-
variant
|
|
118
|
-
}) => getHighlightVariant(variant)};
|
|
119
|
-
border-radius: ${({
|
|
120
|
-
roundness
|
|
121
|
-
}) => getBorderRadius(roundness)};
|
|
122
|
-
|
|
123
|
-
${StyledTile} {
|
|
124
|
-
border-left: 0;
|
|
125
|
-
left: 4px;
|
|
126
|
-
width: calc(100% - 4px);
|
|
127
|
-
}
|
|
128
|
-
`;
|
|
129
130
|
export default StyledTile;
|
|
@@ -5,14 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.Tile = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _tile =
|
|
8
|
+
var _tile = _interopRequireDefault(require("./tile.style"));
|
|
9
9
|
var _tile2 = _interopRequireDefault(require("./__internal__/tile.context"));
|
|
10
10
|
var _filterStyledSystemPaddingProps = _interopRequireDefault(require("../../style/utils/filter-styled-system-padding-props"));
|
|
11
11
|
var _filterStyledSystemMarginProps = _interopRequireDefault(require("../../style/utils/filter-styled-system-margin-props"));
|
|
12
12
|
var _computeContentPadding = _interopRequireDefault(require("./__internal__/compute-content-padding"));
|
|
13
13
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
|
|
14
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
15
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
16
|
const Tile = ({
|
|
@@ -35,13 +33,14 @@ const Tile = ({
|
|
|
35
33
|
});
|
|
36
34
|
const marginProps = (0, _filterStyledSystemMarginProps.default)(rest);
|
|
37
35
|
const contentPaddingProps = (0, _computeContentPadding.default)(paddingProps, isHorizontal);
|
|
38
|
-
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_tile.default, _extends({
|
|
39
37
|
variant: variant,
|
|
40
38
|
width: width,
|
|
41
39
|
height: height,
|
|
42
40
|
isHorizontal: isHorizontal,
|
|
43
41
|
p: p,
|
|
44
42
|
roundness: roundness,
|
|
43
|
+
highlightVariant: highlightVariant,
|
|
45
44
|
borderWidth: borderWidth,
|
|
46
45
|
borderVariant: borderVariant
|
|
47
46
|
}, paddingProps, marginProps, (0, _tags.default)("tile", rest)), /*#__PURE__*/_react.default.createElement(_tile2.default.Provider, {
|
|
@@ -50,15 +49,6 @@ const Tile = ({
|
|
|
50
49
|
paddingPropsFromTile: contentPaddingProps
|
|
51
50
|
}
|
|
52
51
|
}, children));
|
|
53
|
-
if (highlightVariant) {
|
|
54
|
-
return /*#__PURE__*/_react.default.createElement(_tile.StyledHighlight, {
|
|
55
|
-
variant: highlightVariant,
|
|
56
|
-
roundness: roundness,
|
|
57
|
-
"aria-hidden": true,
|
|
58
|
-
"data-role": `tile-${highlightVariant}-highlight`
|
|
59
|
-
}, tile);
|
|
60
|
-
}
|
|
61
|
-
return tile;
|
|
62
52
|
};
|
|
63
53
|
exports.Tile = Tile;
|
|
64
54
|
var _default = exports.default = Tile;
|
|
@@ -7,4 +7,4 @@ exports.TILE_THEMES = exports.TILE_ORIENTATIONS = exports.TILE_HIGHLIGHT_VARIANT
|
|
|
7
7
|
const TILE_ORIENTATIONS = exports.TILE_ORIENTATIONS = ["horizontal", "vertical"];
|
|
8
8
|
const TILE_THEMES = exports.TILE_THEMES = ["tile", "transparent", "active", "grey"];
|
|
9
9
|
const TILE_BORDER_VARIANTS = exports.TILE_BORDER_VARIANTS = ["default", "info", "selected", "negative", "positive", "caution"];
|
|
10
|
-
const TILE_HIGHLIGHT_VARIANTS = exports.TILE_HIGHLIGHT_VARIANTS = ["gradient", "success", "neutral", "error", "warning", "info"];
|
|
10
|
+
const TILE_HIGHLIGHT_VARIANTS = exports.TILE_HIGHLIGHT_VARIANTS = ["gradient", "success", "neutral", "error", "warning", "info", "important"];
|
|
@@ -3,8 +3,4 @@ import { TileProps } from "./tile.component";
|
|
|
3
3
|
declare const StyledTile: import("styled-components").StyledComponent<"div", any, Pick<TileProps, "width" | "height" | "variant" | "roundness" | "borderWidth" | "borderVariant" | "highlightVariant"> & {
|
|
4
4
|
isHorizontal?: boolean | undefined;
|
|
5
5
|
} & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
|
|
6
|
-
export declare const StyledHighlight: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
-
variant: Required<TileProps["highlightVariant"]>;
|
|
8
|
-
roundness: TileProps["roundness"];
|
|
9
|
-
}, never>;
|
|
10
6
|
export default StyledTile;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _styledSystem = require("styled-system");
|
|
9
9
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
@@ -57,6 +57,9 @@ const getHighlightVariant = variant => {
|
|
|
57
57
|
return "var(--colorsSemanticCaution500)";
|
|
58
58
|
case "info":
|
|
59
59
|
return "var(--colorsSemanticInfo500)";
|
|
60
|
+
// FE-6368 has been raised for the below, change hex values for design tokens (when added)
|
|
61
|
+
case "important":
|
|
62
|
+
return " #8F4CD7";
|
|
60
63
|
default:
|
|
61
64
|
// gradient is default
|
|
62
65
|
return "linear-gradient(0deg, rgb(143, 73, 254) 5%, rgb(0, 146, 219) 50%, rgb(19, 160, 56) 95%)";
|
|
@@ -70,10 +73,25 @@ const StyledTile = _styledComponents.default.div`
|
|
|
70
73
|
variant,
|
|
71
74
|
width,
|
|
72
75
|
roundness,
|
|
76
|
+
highlightVariant,
|
|
73
77
|
height
|
|
74
78
|
}) => (0, _styledComponents.css)`
|
|
75
79
|
${_styledSystem.space}
|
|
76
80
|
|
|
81
|
+
${highlightVariant && (0, _styledComponents.css)`
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
&::before {
|
|
84
|
+
display: block;
|
|
85
|
+
content: "";
|
|
86
|
+
height: 100%;
|
|
87
|
+
width: 8px;
|
|
88
|
+
position: absolute;
|
|
89
|
+
top: 0;
|
|
90
|
+
left: 0;
|
|
91
|
+
background: ${getHighlightVariant(highlightVariant)};
|
|
92
|
+
}
|
|
93
|
+
`}
|
|
94
|
+
|
|
77
95
|
box-sizing: border-box;
|
|
78
96
|
border: var(--${borderWidth}) solid
|
|
79
97
|
${getBorderColor(borderVariant, variant)};
|
|
@@ -118,21 +136,4 @@ const StyledTile = _styledComponents.default.div`
|
|
|
118
136
|
StyledTile.defaultProps = {
|
|
119
137
|
theme: _base.default
|
|
120
138
|
};
|
|
121
|
-
const StyledHighlight = exports.StyledHighlight = _styledComponents.default.div`
|
|
122
|
-
height: 100%;
|
|
123
|
-
width: 100%;
|
|
124
|
-
position: relative;
|
|
125
|
-
background: ${({
|
|
126
|
-
variant
|
|
127
|
-
}) => getHighlightVariant(variant)};
|
|
128
|
-
border-radius: ${({
|
|
129
|
-
roundness
|
|
130
|
-
}) => getBorderRadius(roundness)};
|
|
131
|
-
|
|
132
|
-
${StyledTile} {
|
|
133
|
-
border-left: 0;
|
|
134
|
-
left: 4px;
|
|
135
|
-
width: calc(100% - 4px);
|
|
136
|
-
}
|
|
137
|
-
`;
|
|
138
139
|
var _default = exports.default = StyledTile;
|