@flodesk/grain 11.77.0 → 11.78.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/es/components/index.js
CHANGED
|
@@ -32,4 +32,5 @@ export { Badge } from './badge';
|
|
|
32
32
|
export { Toast } from './toast';
|
|
33
33
|
export { Radio } from './radio';
|
|
34
34
|
export { Card } from './card';
|
|
35
|
-
export { GhostInput } from './ghost-input';
|
|
35
|
+
export { GhostInput } from './ghost-input';
|
|
36
|
+
export { MessageBox } from './message-box';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import _styled from "@emotion/styled/base";
|
|
2
|
+
const _excluded = ["variant", "action", "description", "padding", "radius"];
|
|
3
|
+
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); }
|
|
4
|
+
import "core-js/modules/es.symbol.description.js";
|
|
5
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
6
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
7
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import { Text } from './text';
|
|
11
|
+
import { Box } from './box';
|
|
12
|
+
import { getColor } from '../utilities';
|
|
13
|
+
import { types } from '../types';
|
|
14
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
|
+
const variantStyles = {
|
|
16
|
+
info: {
|
|
17
|
+
background: 'backgroundInfoSubtleLarge',
|
|
18
|
+
color: 'onBackgroundInfoSubtle'
|
|
19
|
+
},
|
|
20
|
+
danger: {
|
|
21
|
+
background: 'backgroundDangerSubtleLarge',
|
|
22
|
+
color: 'onBackgroundDangerSubtle'
|
|
23
|
+
},
|
|
24
|
+
warning: {
|
|
25
|
+
background: 'backgroundWarningSubtleLarge',
|
|
26
|
+
color: 'onBackgroundWarningSubtle'
|
|
27
|
+
},
|
|
28
|
+
success: {
|
|
29
|
+
background: 'backgroundSuccessSubtleLarge',
|
|
30
|
+
color: 'onBackgroundSuccessSubtle'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const ActionSection = /*#__PURE__*/_styled(Box, process.env.NODE_ENV === "production" ? {
|
|
34
|
+
target: "e5z9c0h0"
|
|
35
|
+
} : {
|
|
36
|
+
target: "e5z9c0h0",
|
|
37
|
+
label: "ActionSection"
|
|
38
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
39
|
+
name: "dd1uhd",
|
|
40
|
+
styles: "mix-blend-mode:luminosity"
|
|
41
|
+
} : {
|
|
42
|
+
name: "dd1uhd",
|
|
43
|
+
styles: "mix-blend-mode:luminosity",
|
|
44
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21wb25lbnRzL21lc3NhZ2UtYm94LmpzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEyQmlDIiwiZmlsZSI6Ii4uLy4uL3NyYy9jb21wb25lbnRzL21lc3NhZ2UtYm94LmpzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5pbXBvcnQgUHJv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ED_CSS_ERROR__
|
|
46
|
+
});
|
|
47
|
+
export const MessageBox = _ref => {
|
|
48
|
+
let {
|
|
49
|
+
variant = 'info',
|
|
50
|
+
action,
|
|
51
|
+
description,
|
|
52
|
+
padding = 'l',
|
|
53
|
+
radius = 'l'
|
|
54
|
+
} = _ref,
|
|
55
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
56
|
+
return ___EmotionJSX(Box, _extends({
|
|
57
|
+
color: getColor(variantStyles[variant].color),
|
|
58
|
+
backgroundColor: getColor(variantStyles[variant].background),
|
|
59
|
+
padding: padding,
|
|
60
|
+
radius: radius,
|
|
61
|
+
variant: variant
|
|
62
|
+
}, props), description && ___EmotionJSX(Text, {
|
|
63
|
+
trimTop: true,
|
|
64
|
+
trimBottom: !Boolean(action)
|
|
65
|
+
}, description), action && ___EmotionJSX(ActionSection, {
|
|
66
|
+
marginTop: "m"
|
|
67
|
+
}, action));
|
|
68
|
+
};
|
|
69
|
+
MessageBox.propTypes = {
|
|
70
|
+
variant: PropTypes.oneOf(Object.keys(variantStyles)),
|
|
71
|
+
action: PropTypes.node,
|
|
72
|
+
description: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
|
|
73
|
+
radius: types.radius,
|
|
74
|
+
padding: types.responsiveSpace
|
|
75
|
+
};
|