carbon-react 126.6.0 → 126.7.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.
- package/esm/components/dismissible-box/dismissible-box.component.d.ts +5 -2
- package/esm/components/dismissible-box/dismissible-box.component.js +23 -14
- package/esm/components/tile/tile.config.d.ts +1 -0
- package/esm/components/tile/tile.config.js +2 -1
- package/esm/components/tile/tile.style.js +11 -5
- package/esm/locales/__internal__/pl-pl.js +5 -0
- package/esm/locales/en-gb.js +5 -0
- package/esm/locales/locale.d.ts +5 -0
- package/lib/components/dismissible-box/dismissible-box.component.d.ts +5 -2
- package/lib/components/dismissible-box/dismissible-box.component.js +23 -14
- package/lib/components/tile/tile.config.d.ts +1 -0
- package/lib/components/tile/tile.config.js +3 -2
- package/lib/components/tile/tile.style.js +11 -5
- package/lib/locales/__internal__/pl-pl.js +5 -0
- package/lib/locales/en-gb.js +5 -0
- package/lib/locales/locale.d.ts +5 -0
- package/package.json +1 -1
|
@@ -2,9 +2,12 @@ import React from "react";
|
|
|
2
2
|
import { SpaceProps } from "styled-system";
|
|
3
3
|
import { StyledDismissibleBoxProps } from "./dismissible-box.style";
|
|
4
4
|
import { BoxProps } from "../box";
|
|
5
|
-
|
|
5
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
6
|
+
export interface DismissibleBoxProps extends SpaceProps, StyledDismissibleBoxProps, Omit<BoxProps, "display" | "justifyContent">, Omit<TagProps, "data-component"> {
|
|
6
7
|
/** The content to render in the component */
|
|
7
8
|
children?: React.ReactNode;
|
|
9
|
+
/** Data tag prop bag for close Button */
|
|
10
|
+
closeButtonDataProps?: TagProps;
|
|
8
11
|
/** Callback to be called when the close icon button is clicked */
|
|
9
12
|
onClose: (e: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
13
|
/** Use this prop to override the default width. Numbers from 0-1 are converted to percentage widths. Numbers greater
|
|
@@ -13,5 +16,5 @@ export interface DismissibleBoxProps extends SpaceProps, StyledDismissibleBoxPro
|
|
|
13
16
|
* Please note this component has a minWidth of 600px */
|
|
14
17
|
width?: number | string;
|
|
15
18
|
}
|
|
16
|
-
export declare const DismissibleBox: ({ children, onClose, borderRadius, ...rest }: DismissibleBoxProps) => React.JSX.Element;
|
|
19
|
+
export declare const DismissibleBox: ({ children, closeButtonDataProps, onClose, borderRadius, ...rest }: DismissibleBoxProps) => React.JSX.Element;
|
|
17
20
|
export default DismissibleBox;
|
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
+
import useLocale from "../../hooks/__internal__/useLocale";
|
|
4
5
|
import { StyledDismissibleBox } from "./dismissible-box.style";
|
|
5
6
|
import IconButton from "../icon-button";
|
|
6
7
|
import Icon from "../icon";
|
|
8
|
+
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
7
9
|
export const DismissibleBox = ({
|
|
8
10
|
children,
|
|
11
|
+
closeButtonDataProps,
|
|
9
12
|
onClose,
|
|
10
13
|
borderRadius = "borderRadius100",
|
|
11
14
|
...rest
|
|
12
|
-
}) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, /*#__PURE__*/React.createElement(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
}) => {
|
|
16
|
+
const locale = useLocale();
|
|
17
|
+
return /*#__PURE__*/React.createElement(StyledDismissibleBox, _extends({
|
|
18
|
+
p: "20px 24px 20px 20px",
|
|
19
|
+
"data-component": "dismissible-box",
|
|
20
|
+
borderRadius: borderRadius
|
|
21
|
+
}, rest), children, /*#__PURE__*/React.createElement("span", {
|
|
22
|
+
"data-element": "close-button-wrapper"
|
|
23
|
+
}, /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
24
|
+
onClick: onClose,
|
|
25
|
+
"aria-label": locale.dismissibleBox.ariaLabels.close(),
|
|
26
|
+
ml: 3
|
|
27
|
+
}, tagComponent("close-button", {
|
|
28
|
+
"data-element": "close-button",
|
|
29
|
+
...closeButtonDataProps
|
|
30
|
+
})), /*#__PURE__*/React.createElement(Icon, {
|
|
31
|
+
type: "close",
|
|
32
|
+
color: "--colorsActionMinor500"
|
|
33
|
+
}))));
|
|
34
|
+
};
|
|
26
35
|
export default DismissibleBox;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export const TILE_ORIENTATIONS = ["horizontal", "vertical"];
|
|
2
|
-
export const TILE_THEMES = ["tile", "transparent", "active"];
|
|
2
|
+
export const TILE_THEMES = ["tile", "transparent", "active", "grey"];
|
|
3
|
+
export const TILE_BORDER_VARIANTS = ["default", "info", "selected", "negative", "positive", "caution"];
|
|
@@ -2,7 +2,7 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { space } from "styled-system";
|
|
3
3
|
import baseTheme from "../../style/themes/base";
|
|
4
4
|
import computeSizing from "../../style/utils/element-sizing";
|
|
5
|
-
const getBorderColor = borderVariant => {
|
|
5
|
+
const getBorderColor = (borderVariant, variant) => {
|
|
6
6
|
switch (borderVariant) {
|
|
7
7
|
case "selected":
|
|
8
8
|
return "var(--colorsUtilityYin100)";
|
|
@@ -15,7 +15,14 @@ const getBorderColor = borderVariant => {
|
|
|
15
15
|
case "info":
|
|
16
16
|
return "var(--colorsSemanticInfo500)";
|
|
17
17
|
default:
|
|
18
|
-
|
|
18
|
+
switch (variant) {
|
|
19
|
+
case "active":
|
|
20
|
+
return "var(--colorsActionMajor500)";
|
|
21
|
+
case "grey":
|
|
22
|
+
return "var(--colorsUtilityMajor200)";
|
|
23
|
+
default:
|
|
24
|
+
return "var(--colorsUtilityMajor100)";
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
};
|
|
21
28
|
const getBorderRadius = roundness => {
|
|
@@ -41,7 +48,8 @@ const StyledTile = styled.div`
|
|
|
41
48
|
${space}
|
|
42
49
|
|
|
43
50
|
box-sizing: border-box;
|
|
44
|
-
border: var(--${borderWidth}) solid
|
|
51
|
+
border: var(--${borderWidth}) solid
|
|
52
|
+
${getBorderColor(borderVariant, variant)};
|
|
45
53
|
border-radius: ${getBorderRadius(roundness)};
|
|
46
54
|
--tileBorderRadius: ${getBorderRadius(roundness)};
|
|
47
55
|
|
|
@@ -65,12 +73,10 @@ const StyledTile = styled.div`
|
|
|
65
73
|
|
|
66
74
|
${variant === "active" && css`
|
|
67
75
|
background-color: var(--colorsActionMajor025);
|
|
68
|
-
border-color: var(--colorsActionMajor500);
|
|
69
76
|
`}
|
|
70
77
|
|
|
71
78
|
${variant === "grey" && css`
|
|
72
79
|
background-color: var(--colorsUtilityMajor025);
|
|
73
|
-
border-color: var(--colorsUtilityMajor200);
|
|
74
80
|
`}
|
|
75
81
|
|
|
76
82
|
display: flex;
|
package/esm/locales/en-gb.js
CHANGED
package/esm/locales/locale.d.ts
CHANGED
|
@@ -2,9 +2,12 @@ import React from "react";
|
|
|
2
2
|
import { SpaceProps } from "styled-system";
|
|
3
3
|
import { StyledDismissibleBoxProps } from "./dismissible-box.style";
|
|
4
4
|
import { BoxProps } from "../box";
|
|
5
|
-
|
|
5
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
6
|
+
export interface DismissibleBoxProps extends SpaceProps, StyledDismissibleBoxProps, Omit<BoxProps, "display" | "justifyContent">, Omit<TagProps, "data-component"> {
|
|
6
7
|
/** The content to render in the component */
|
|
7
8
|
children?: React.ReactNode;
|
|
9
|
+
/** Data tag prop bag for close Button */
|
|
10
|
+
closeButtonDataProps?: TagProps;
|
|
8
11
|
/** Callback to be called when the close icon button is clicked */
|
|
9
12
|
onClose: (e: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
13
|
/** Use this prop to override the default width. Numbers from 0-1 are converted to percentage widths. Numbers greater
|
|
@@ -13,5 +16,5 @@ export interface DismissibleBoxProps extends SpaceProps, StyledDismissibleBoxPro
|
|
|
13
16
|
* Please note this component has a minWidth of 600px */
|
|
14
17
|
width?: number | string;
|
|
15
18
|
}
|
|
16
|
-
export declare const DismissibleBox: ({ children, onClose, borderRadius, ...rest }: DismissibleBoxProps) => React.JSX.Element;
|
|
19
|
+
export declare const DismissibleBox: ({ children, closeButtonDataProps, onClose, borderRadius, ...rest }: DismissibleBoxProps) => React.JSX.Element;
|
|
17
20
|
export default DismissibleBox;
|
|
@@ -6,29 +6,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.DismissibleBox = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
9
10
|
var _dismissibleBox = require("./dismissible-box.style");
|
|
10
11
|
var _iconButton = _interopRequireDefault(require("../icon-button"));
|
|
11
12
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
13
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
16
|
const DismissibleBox = ({
|
|
15
17
|
children,
|
|
18
|
+
closeButtonDataProps,
|
|
16
19
|
onClose,
|
|
17
20
|
borderRadius = "borderRadius100",
|
|
18
21
|
...rest
|
|
19
|
-
}) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
}) => {
|
|
23
|
+
const locale = (0, _useLocale.default)();
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_dismissibleBox.StyledDismissibleBox, _extends({
|
|
25
|
+
p: "20px 24px 20px 20px",
|
|
26
|
+
"data-component": "dismissible-box",
|
|
27
|
+
borderRadius: borderRadius
|
|
28
|
+
}, rest), children, /*#__PURE__*/_react.default.createElement("span", {
|
|
29
|
+
"data-element": "close-button-wrapper"
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_iconButton.default, _extends({
|
|
31
|
+
onClick: onClose,
|
|
32
|
+
"aria-label": locale.dismissibleBox.ariaLabels.close(),
|
|
33
|
+
ml: 3
|
|
34
|
+
}, (0, _tags.default)("close-button", {
|
|
35
|
+
"data-element": "close-button",
|
|
36
|
+
...closeButtonDataProps
|
|
37
|
+
})), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
38
|
+
type: "close",
|
|
39
|
+
color: "--colorsActionMinor500"
|
|
40
|
+
}))));
|
|
41
|
+
};
|
|
33
42
|
exports.DismissibleBox = DismissibleBox;
|
|
34
43
|
var _default = exports.default = DismissibleBox;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TILE_THEMES = exports.TILE_ORIENTATIONS = void 0;
|
|
6
|
+
exports.TILE_THEMES = exports.TILE_ORIENTATIONS = exports.TILE_BORDER_VARIANTS = void 0;
|
|
7
7
|
const TILE_ORIENTATIONS = exports.TILE_ORIENTATIONS = ["horizontal", "vertical"];
|
|
8
|
-
const TILE_THEMES = exports.TILE_THEMES = ["tile", "transparent", "active"];
|
|
8
|
+
const TILE_THEMES = exports.TILE_THEMES = ["tile", "transparent", "active", "grey"];
|
|
9
|
+
const TILE_BORDER_VARIANTS = exports.TILE_BORDER_VARIANTS = ["default", "info", "selected", "negative", "positive", "caution"];
|
|
@@ -11,7 +11,7 @@ var _elementSizing = _interopRequireDefault(require("../../style/utils/element-s
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
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); }
|
|
13
13
|
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 && Object.prototype.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; }
|
|
14
|
-
const getBorderColor = borderVariant => {
|
|
14
|
+
const getBorderColor = (borderVariant, variant) => {
|
|
15
15
|
switch (borderVariant) {
|
|
16
16
|
case "selected":
|
|
17
17
|
return "var(--colorsUtilityYin100)";
|
|
@@ -24,7 +24,14 @@ const getBorderColor = borderVariant => {
|
|
|
24
24
|
case "info":
|
|
25
25
|
return "var(--colorsSemanticInfo500)";
|
|
26
26
|
default:
|
|
27
|
-
|
|
27
|
+
switch (variant) {
|
|
28
|
+
case "active":
|
|
29
|
+
return "var(--colorsActionMajor500)";
|
|
30
|
+
case "grey":
|
|
31
|
+
return "var(--colorsUtilityMajor200)";
|
|
32
|
+
default:
|
|
33
|
+
return "var(--colorsUtilityMajor100)";
|
|
34
|
+
}
|
|
28
35
|
}
|
|
29
36
|
};
|
|
30
37
|
const getBorderRadius = roundness => {
|
|
@@ -50,7 +57,8 @@ const StyledTile = _styledComponents.default.div`
|
|
|
50
57
|
${_styledSystem.space}
|
|
51
58
|
|
|
52
59
|
box-sizing: border-box;
|
|
53
|
-
border: var(--${borderWidth}) solid
|
|
60
|
+
border: var(--${borderWidth}) solid
|
|
61
|
+
${getBorderColor(borderVariant, variant)};
|
|
54
62
|
border-radius: ${getBorderRadius(roundness)};
|
|
55
63
|
--tileBorderRadius: ${getBorderRadius(roundness)};
|
|
56
64
|
|
|
@@ -74,12 +82,10 @@ const StyledTile = _styledComponents.default.div`
|
|
|
74
82
|
|
|
75
83
|
${variant === "active" && (0, _styledComponents.css)`
|
|
76
84
|
background-color: var(--colorsActionMajor025);
|
|
77
|
-
border-color: var(--colorsActionMajor500);
|
|
78
85
|
`}
|
|
79
86
|
|
|
80
87
|
${variant === "grey" && (0, _styledComponents.css)`
|
|
81
88
|
background-color: var(--colorsUtilityMajor025);
|
|
82
|
-
border-color: var(--colorsUtilityMajor200);
|
|
83
89
|
`}
|
|
84
90
|
|
|
85
91
|
display: flex;
|
package/lib/locales/en-gb.js
CHANGED
package/lib/locales/locale.d.ts
CHANGED