@smart-react-components/ui 2.0.0-alpha-27 → 2.0.0-alpha-28
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/Alert/index.js
CHANGED
|
@@ -68,13 +68,14 @@ const Alert = props => {
|
|
|
68
68
|
iconRight && iconRight)),
|
|
69
69
|
hasIconLeft: !!iconLeft,
|
|
70
70
|
hasIconRight: !!iconRight,
|
|
71
|
+
hasThickBorder: !(iconLeft && (iconLeft.props.hasBackground || (iconLeft.props.palette && iconLeft.props.palette !== props.palette))),
|
|
71
72
|
};
|
|
72
73
|
};
|
|
73
|
-
const [{ children, hasIconLeft, hasIconRight }, setContent] = react_1.default.useState(() => getContent());
|
|
74
|
+
const [{ children, hasIconLeft, hasIconRight, hasThickBorder }, setContent] = react_1.default.useState(() => getContent());
|
|
74
75
|
(0, useChangeEffect_1.default)(() => {
|
|
75
76
|
setContent(getContent());
|
|
76
77
|
}, [props.children]);
|
|
77
|
-
return (react_1.default.createElement(AlertElement_1.default, Object.assign({ alertSize: props.size, alertSizeSm: props.sizeSm, alertSizeMd: props.sizeMd, alertSizeLg: props.sizeLg, alertSizeXl: props.sizeXl, hasIconLeft: hasIconLeft, hasIconRight: hasIconRight, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, shape: props.shape }, (0, element_props_1.default)(props, [click_events_1.default, intrinsic_styled_props_1.default])), children));
|
|
78
|
+
return (react_1.default.createElement(AlertElement_1.default, Object.assign({ alertSize: props.size, alertSizeSm: props.sizeSm, alertSizeMd: props.sizeMd, alertSizeLg: props.sizeLg, alertSizeXl: props.sizeXl, hasIconLeft: hasIconLeft, hasIconRight: hasIconRight, hasThickBorder: hasThickBorder, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, shape: props.shape }, (0, element_props_1.default)(props, [click_events_1.default, intrinsic_styled_props_1.default])), children));
|
|
78
79
|
};
|
|
79
80
|
Alert.defaultProps = {
|
|
80
81
|
palette: 'primary',
|
|
@@ -4,6 +4,7 @@ export declare const Content: import("styled-components").StyledComponent<"div",
|
|
|
4
4
|
interface Props extends StyledProps, ResponsiveProp<'alertSize', SizeProp> {
|
|
5
5
|
hasIconLeft: boolean;
|
|
6
6
|
hasIconRight: boolean;
|
|
7
|
+
hasThickBorder: boolean;
|
|
7
8
|
isOutline: boolean;
|
|
8
9
|
isSoft: boolean;
|
|
9
10
|
palette: PaletteProp;
|
|
@@ -6,20 +6,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Content = void 0;
|
|
7
7
|
const Div_1 = __importDefault(require("@smart-react-components/core/Element/Div"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const css_1 = require("../../util/css");
|
|
9
10
|
exports.Content = styled_components_1.default.div `
|
|
10
11
|
flex: 1 1 auto;
|
|
11
12
|
`;
|
|
12
|
-
exports.default = (0, styled_components_1.default)(Div_1.default).attrs({
|
|
13
|
+
exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ hasIconLeft, hasIconRight }) => ({
|
|
13
14
|
getAlertSize: (v, t) => `
|
|
14
15
|
font-size: ${t.$.size.alert[v].fontSize};
|
|
15
16
|
|
|
16
17
|
${exports.Content} {
|
|
17
18
|
padding: ${t.$.size.alert[v].padding.y} ${t.$.size.alert[v].padding.x};
|
|
19
|
+
|
|
20
|
+
${hasIconLeft
|
|
21
|
+
? `
|
|
22
|
+
padding-left: ${(0, css_1.toCSSValue)(t.$.size.alert[v].padding.x)(v => v / 2)};
|
|
23
|
+
`
|
|
24
|
+
: ''}
|
|
25
|
+
|
|
26
|
+
${hasIconRight
|
|
27
|
+
? `
|
|
28
|
+
padding-right: ${(0, css_1.toCSSValue)(t.$.size.alert[v].padding.x)(v => v / 2)};
|
|
29
|
+
`
|
|
30
|
+
: ''}
|
|
31
|
+
|
|
18
32
|
}
|
|
19
33
|
`,
|
|
20
|
-
})(({ theme,
|
|
34
|
+
}))(({ theme, hasThickBorder, isOutline, isSoft, palette, shape }) => `
|
|
21
35
|
border: solid 1px;
|
|
22
|
-
border-left-width: 10px;
|
|
23
36
|
border-radius: ${theme.$.radius.alert[shape]};
|
|
24
37
|
box-sizing: border-box;
|
|
25
38
|
display: flex;
|
|
@@ -54,21 +67,9 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs({
|
|
|
54
67
|
`}
|
|
55
68
|
`}
|
|
56
69
|
|
|
57
|
-
${
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
padding-left: 0;
|
|
61
|
-
}
|
|
62
|
-
`
|
|
63
|
-
: ''}
|
|
64
|
-
|
|
65
|
-
${hasIconRight
|
|
66
|
-
? `
|
|
67
|
-
> ${exports.Content} {
|
|
68
|
-
padding-right: 0;
|
|
69
|
-
}
|
|
70
|
-
`
|
|
71
|
-
: ''}
|
|
70
|
+
${hasThickBorder && `
|
|
71
|
+
border-left-width: 10px;
|
|
72
|
+
`}
|
|
72
73
|
|
|
73
74
|
${exports.Content} > {
|
|
74
75
|
header, h1, h2, h3, h4, h5, h6, p, hr {
|
|
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Div_1 = __importDefault(require("@smart-react-components/core/Element/Div"));
|
|
7
7
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const css_1 = require("../../util/css");
|
|
8
9
|
exports.default = (0, styled_components_1.default)(Div_1.default).attrs({
|
|
9
10
|
getAlertIconSize: (v, t) => `
|
|
10
|
-
padding: 0 ${t.$.size.alert[v].padding.x};
|
|
11
|
+
padding: 0 ${(0, css_1.toCSSValue)(t.$.size.alert[v].padding.x)(v => v / 2)};
|
|
11
12
|
|
|
12
13
|
> svg {
|
|
13
14
|
height: ${t.$.size.alert[v].iconSize};
|
|
@@ -34,7 +35,9 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs({
|
|
|
34
35
|
? `
|
|
35
36
|
background: ${!isSoft ? theme.$.palette[palette].main : theme.$.palette[palette].soft};
|
|
36
37
|
`
|
|
37
|
-
:
|
|
38
|
+
: `
|
|
39
|
+
background: ${!isSoft ? theme.$.palette[palette].darkest : theme.$.palette[palette].softDarkest};
|
|
40
|
+
`}
|
|
38
41
|
`
|
|
39
42
|
: `
|
|
40
43
|
color: ${!isSoft ? theme.$.palette[palette].main : theme.$.palette[palette].soft};
|