@semcore/notice 2.1.0 → 3.1.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.
- package/CHANGELOG.md +33 -0
- package/lib/cjs/Notice.js +84 -113
- package/lib/cjs/Notice.js.map +1 -1
- package/lib/cjs/{NoticeSmart/index.js → NoticeSmart.js} +9 -9
- package/lib/cjs/NoticeSmart.js.map +1 -0
- package/lib/cjs/index.js +3 -27
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/notice.shadow.css +39 -25
- package/lib/es6/Notice.js +88 -110
- package/lib/es6/Notice.js.map +1 -1
- package/lib/es6/{NoticeSmart/index.js → NoticeSmart.js} +9 -8
- package/lib/es6/NoticeSmart.js.map +1 -0
- package/lib/es6/index.js +1 -4
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/notice.shadow.css +39 -25
- package/lib/types/index.d.ts +62 -5
- package/package.json +6 -8
- package/src/Notice.js +79 -0
- package/src/NoticeSmart.js +29 -0
- package/src/index.d.ts +63 -0
- package/src/index.js +4 -0
- package/src/style/notice.shadow.css +39 -25
- package/lib/cjs/NoticeSmart/index.js.map +0 -1
- package/lib/es6/NoticeSmart/index.js.map +0 -1
- package/lib/types/Notice.d.ts +0 -50
- package/lib/types/NoticeSmart/index.d.ts +0 -25
- package/src/Notice.tsx +0 -129
- package/src/NoticeSmart/index.tsx +0 -50
- package/src/index.tsx +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [3.1.2] - 2021-12-08
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Moved SLabel colors to style
|
|
10
|
+
|
|
11
|
+
## [3.1.1] - 2021-8-26
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Add 'sideEffect=false' for more optimal build via webpack
|
|
16
|
+
|
|
17
|
+
## [3.1.0] - 2021-07-05
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Version of dependence `@semcore/core` has been changed to `1.11`.
|
|
22
|
+
- Improved performance. Removed one component wrapper.
|
|
23
|
+
- The style processing system has been changed.
|
|
24
|
+
- Removed the ability to apply media styles via a plugin `babel-plugin-react-semcore`.
|
|
25
|
+
- [A11y] added role for `Alert` and aria-label for `Close`.
|
|
26
|
+
|
|
27
|
+
## [3.0.0] - 2021-03-15
|
|
28
|
+
|
|
29
|
+
### BREAK
|
|
30
|
+
|
|
31
|
+
- Removed global styles
|
|
32
|
+
- Removed styles for media queries.
|
|
33
|
+
- Replace animation package from `react-transition-group` to `@semcore/animation`
|
|
34
|
+
- Update property `theme`, now this property can get any themes
|
|
35
|
+
- Added property [`use`](/components/notice/notice-api/)
|
|
36
|
+
- Update icon for `Notice.IconClose`
|
|
37
|
+
|
|
5
38
|
## [2.1.0] - 2020-12-17
|
|
6
39
|
|
|
7
40
|
### Added
|
package/lib/cjs/Notice.js
CHANGED
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
13
|
|
|
16
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -23,74 +21,55 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
23
21
|
|
|
24
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
23
|
|
|
26
|
-
var
|
|
24
|
+
var _core = _interopRequireWildcard(require("@semcore/core"));
|
|
27
25
|
|
|
28
26
|
var _react = _interopRequireDefault(require("react"));
|
|
29
27
|
|
|
30
|
-
var
|
|
28
|
+
var _flexBox = require("@semcore/flex-box");
|
|
31
29
|
|
|
32
|
-
var
|
|
30
|
+
var _xs = _interopRequireDefault(require("@semcore/icon/lib/Close/xs"));
|
|
33
31
|
|
|
34
|
-
var
|
|
32
|
+
var _color = _interopRequireDefault(require("@semcore/utils/lib/color"));
|
|
35
33
|
|
|
36
|
-
var
|
|
34
|
+
var _animation = require("@semcore/animation");
|
|
37
35
|
|
|
38
|
-
var
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
+
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
39
39
|
|
|
40
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
41
|
|
|
42
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
43
|
|
|
44
44
|
/*__reshadow-styles__:"./style/notice.shadow.css"*/
|
|
45
|
-
var
|
|
45
|
+
var style = (
|
|
46
46
|
/*__reshadow_css_start__*/
|
|
47
|
-
|
|
47
|
+
_core.sstyled.insert(
|
|
48
48
|
/*__inner_css_start__*/
|
|
49
|
-
".
|
|
49
|
+
".___SNotice_1cprg_gg_{display:flex;font-size:12px;line-height:1.5;box-sizing:border-box}.___SNotice_1cprg_gg_._use_primary_1cprg_gg_{padding:8px 32px}.___SNotice_1cprg_gg_._use_secondary_1cprg_gg_{padding:15px;border-style:solid;border-width:1px;border-radius:2px}.___SNotice_1cprg_gg_._theme_info_1cprg_gg_{background-color:rgba(43,148,225,.15)}.___SNotice_1cprg_gg_._theme_info_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(43,148,225,.25)}.___SNotice_1cprg_gg_._theme_danger_1cprg_gg_{background-color:rgba(237,45,45,.1)}.___SNotice_1cprg_gg_._theme_danger_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(237,45,45,.2)}.___SNotice_1cprg_gg_._theme_warning_1cprg_gg_{background-color:rgba(249,177,89,.15)}.___SNotice_1cprg_gg_._theme_warning_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(249,177,89,.4)}.___SNotice_1cprg_gg_._theme_success_1cprg_gg_{background-color:rgba(79,174,51,.15)}.___SNotice_1cprg_gg_._theme_success_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(79,174,51,.3)}.___SContent_1cprg_gg_{flex:1 1 auto;width:100%}.___SActions_1cprg_gg_{flex-shrink:0;margin-top:12px}.___SLabel_1cprg_gg_{margin-right:8px;display:inline-flex}.___SLabel_1cprg_gg_._theme_danger_1cprg_gg_{color:#ed2d2d}.___SLabel_1cprg_gg_._theme_info_1cprg_gg_{color:#a6b0b3}.___SLabel_1cprg_gg_._theme_success_1cprg_gg_{color:#4fae33}.___SLabel_1cprg_gg_._theme_warning_1cprg_gg_{color:#f9b159}.___SLabel_1cprg_gg_._theme_custom_1cprg_gg_{color:var(--color_1du3pp1)}.___SCloseIcon_1cprg_gg_{flex-shrink:0;margin-left:16px}.___SNotice_1cprg_gg_._theme_custom_1cprg_gg_{background-color:var(--backgroundColor_1du3pp1)}.___SNotice_1cprg_gg_._theme_custom_1cprg_gg_._use_secondary_1cprg_gg_{border-color:var(--backgroundColor_1du3pp1)}"
|
|
50
50
|
/*__inner_css_end__*/
|
|
51
|
-
, "
|
|
51
|
+
, "1du3pp1_gg_")
|
|
52
52
|
/*__reshadow_css_end__*/
|
|
53
53
|
, {
|
|
54
|
-
"__SNotice": "
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
})
|
|
69
|
-
style = (0, _extends2["default"])({}, _ref);
|
|
70
|
-
|
|
71
|
-
if (false) {
|
|
72
|
-
/*__reshadow_css_start__*/
|
|
73
|
-
(0, _core.__css__)(
|
|
74
|
-
/*__inner_css_start__*/
|
|
75
|
-
"@media (max-width: 768px) {.___SNotice_65f22_gg_ {\n padding: 19.5px;\n font-size: 15.6px;\n}\n\n.___SActions_65f22_gg_ {\n margin-top: 15.6px\n}\n\n.___SActions_65f22_gg_ > * + * {\n margin-left: 10.4px;\n }\n\n.___SLabel_65f22_gg_ {\n margin-right: 10.4px;\n}\n\n.___SCloseIcon_65f22_gg_ {\n margin-left: 20.8px;\n}}"
|
|
76
|
-
/*__inner_css_end__*/
|
|
77
|
-
, "5yj58v_gg_")
|
|
78
|
-
/*__reshadow_css_end__*/
|
|
79
|
-
;
|
|
80
|
-
}
|
|
54
|
+
"__SNotice": "___SNotice_1cprg_gg_",
|
|
55
|
+
"_use_primary": "_use_primary_1cprg_gg_",
|
|
56
|
+
"_use_secondary": "_use_secondary_1cprg_gg_",
|
|
57
|
+
"_theme_info": "_theme_info_1cprg_gg_",
|
|
58
|
+
"_theme_danger": "_theme_danger_1cprg_gg_",
|
|
59
|
+
"_theme_warning": "_theme_warning_1cprg_gg_",
|
|
60
|
+
"_theme_success": "_theme_success_1cprg_gg_",
|
|
61
|
+
"__SContent": "___SContent_1cprg_gg_",
|
|
62
|
+
"__SActions": "___SActions_1cprg_gg_",
|
|
63
|
+
"__SLabel": "___SLabel_1cprg_gg_",
|
|
64
|
+
"_theme_custom": "_theme_custom_1cprg_gg_",
|
|
65
|
+
"--color": "--color_1du3pp1",
|
|
66
|
+
"__SCloseIcon": "___SCloseIcon_1cprg_gg_",
|
|
67
|
+
"--backgroundColor": "--backgroundColor_1du3pp1"
|
|
68
|
+
});
|
|
81
69
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/*__inner_css_start__*/
|
|
86
|
-
"._animate--enter-active_6p638_gg_,._animate--exit-active_tr6oy_gg_{transition:opacity var(--13urk6b_0) ease-out}"
|
|
87
|
-
/*__inner_css_end__*/
|
|
88
|
-
, "d6h9sm_gg_")
|
|
89
|
-
/*__reshadow_css_end__*/
|
|
90
|
-
, {
|
|
91
|
-
"animate--exit-active": "_animate--exit-active_tr6oy_gg_",
|
|
92
|
-
"animate--enter-active": "_animate--enter-active_6p638_gg_"
|
|
93
|
-
})]);
|
|
70
|
+
function isCustomTheme(theme) {
|
|
71
|
+
return !['danger', 'warning', 'success', 'info'].includes(theme);
|
|
72
|
+
}
|
|
94
73
|
|
|
95
74
|
var RootNotice = /*#__PURE__*/function (_Component) {
|
|
96
75
|
(0, _inherits2["default"])(RootNotice, _Component);
|
|
@@ -113,35 +92,23 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
113
92
|
}, {
|
|
114
93
|
key: "render",
|
|
115
94
|
value: function render() {
|
|
116
|
-
var
|
|
95
|
+
var _ref = this ? this.asProps : arguments[0],
|
|
96
|
+
_ref6;
|
|
97
|
+
|
|
98
|
+
var SNotice = _animation.FadeInOut;
|
|
117
99
|
var _this$asProps = this.asProps,
|
|
100
|
+
Children = _this$asProps.Children,
|
|
118
101
|
styles = _this$asProps.styles,
|
|
119
102
|
hidden = _this$asProps.hidden,
|
|
120
|
-
theme = _this$asProps.theme
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"--13urk6b_0": transitionDuration
|
|
130
|
-
}), /*#__PURE__*/_react["default"].createElement(_reactTransitionGroup.CSSTransition, (0, _core.map)("CSSTransition", {
|
|
131
|
-
"in": invisible !== undefined ? !invisible : !hidden,
|
|
132
|
-
timeout: duration,
|
|
133
|
-
classNames: {
|
|
134
|
-
enterActive: _core.styled.styles['animate--enter-active'],
|
|
135
|
-
exitActive: _core.styled.styles['animate--exit-active'],
|
|
136
|
-
enter: _core.styled.styles['animate--enter'],
|
|
137
|
-
exit: _core.styled.styles['animate--exit']
|
|
138
|
-
},
|
|
139
|
-
unmountOnExit: true,
|
|
140
|
-
$$style: _core.styled.$$style
|
|
141
|
-
}), /*#__PURE__*/_react["default"].createElement(SNotice, (0, _core.map)("SNotice", {
|
|
142
|
-
render: _flexBox.Box,
|
|
143
|
-
theme: theme
|
|
144
|
-
})))));
|
|
103
|
+
theme = _this$asProps.theme;
|
|
104
|
+
var color = (0, _color["default"])(theme);
|
|
105
|
+
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
106
|
+
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SNotice, _ref6.cn("SNotice", _objectSpread({}, (0, _core.assignProps)({
|
|
107
|
+
"visible": !hidden,
|
|
108
|
+
"use:theme": useTheme,
|
|
109
|
+
"backgroundColor": color,
|
|
110
|
+
"role": "alert"
|
|
111
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref6.cn("Children", {})));
|
|
145
112
|
}
|
|
146
113
|
}]);
|
|
147
114
|
return RootNotice;
|
|
@@ -150,52 +117,56 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
150
117
|
(0, _defineProperty2["default"])(RootNotice, "displayName", 'Notice');
|
|
151
118
|
(0, _defineProperty2["default"])(RootNotice, "style", style);
|
|
152
119
|
(0, _defineProperty2["default"])(RootNotice, "defaultProps", {
|
|
120
|
+
use: 'secondary',
|
|
153
121
|
theme: 'info',
|
|
154
122
|
duration: 200
|
|
155
123
|
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
124
|
+
|
|
125
|
+
function Label(_ref11) {
|
|
126
|
+
var _ref2 = this ? this.asProps : arguments[0],
|
|
127
|
+
_ref7;
|
|
128
|
+
|
|
129
|
+
var styles = _ref11.styles,
|
|
130
|
+
theme = _ref11.theme;
|
|
131
|
+
var SLabel = _flexBox.Box;
|
|
132
|
+
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
133
|
+
var color = (0, _color["default"])(theme);
|
|
134
|
+
return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLabel, _ref7.cn("SLabel", _objectSpread({}, (0, _core.assignProps)({
|
|
135
|
+
"use:theme": useTheme,
|
|
136
|
+
"color": color
|
|
137
|
+
}, _ref2))));
|
|
166
138
|
}
|
|
167
139
|
|
|
168
|
-
|
|
140
|
+
function Actions(_ref12) {
|
|
141
|
+
var _ref3 = this ? this.asProps : arguments[0],
|
|
142
|
+
_ref8;
|
|
169
143
|
|
|
170
|
-
|
|
171
|
-
var SActions =
|
|
172
|
-
|
|
173
|
-
return (0, _core.styled)(((0, _core.set)([styled_190, styles]), /*#__PURE__*/_react["default"].createElement(SActions, (0, _core.map)("SActions", {
|
|
174
|
-
render: _flexBox.Box
|
|
175
|
-
}))));
|
|
144
|
+
var styles = _ref12.styles;
|
|
145
|
+
var SActions = _flexBox.Box;
|
|
146
|
+
return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SActions, _ref8.cn("SActions", _objectSpread({}, (0, _core.assignProps)({}, _ref3))));
|
|
176
147
|
}
|
|
177
148
|
|
|
178
|
-
|
|
149
|
+
function Content(_ref13) {
|
|
150
|
+
var _ref4 = this ? this.asProps : arguments[0],
|
|
151
|
+
_ref9;
|
|
179
152
|
|
|
180
|
-
|
|
181
|
-
var SContent =
|
|
182
|
-
|
|
183
|
-
return (0, _core.styled)(((0, _core.set)([styled_1f4, styles]), /*#__PURE__*/_react["default"].createElement(SContent, (0, _core.map)("SContent", {
|
|
184
|
-
render: _flexBox.Box
|
|
185
|
-
}))));
|
|
153
|
+
var styles = _ref13.styles;
|
|
154
|
+
var SContent = _flexBox.Box;
|
|
155
|
+
return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SContent, _ref9.cn("SContent", _objectSpread({}, (0, _core.assignProps)({}, _ref4))));
|
|
186
156
|
}
|
|
187
157
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
tag:
|
|
196
|
-
color: "stone",
|
|
197
|
-
interactive: true
|
|
198
|
-
|
|
158
|
+
function CloseIcon(_ref14) {
|
|
159
|
+
var _ref5 = this ? this.asProps : arguments[0],
|
|
160
|
+
_ref10;
|
|
161
|
+
|
|
162
|
+
var styles = _ref14.styles;
|
|
163
|
+
var SCloseIcon = _flexBox.Box;
|
|
164
|
+
return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCloseIcon, _ref10.cn("SCloseIcon", _objectSpread({}, (0, _core.assignProps)({
|
|
165
|
+
"tag": _xs["default"],
|
|
166
|
+
"color": "stone",
|
|
167
|
+
"interactive": true,
|
|
168
|
+
"aria-label": "Close alert"
|
|
169
|
+
}, _ref5))));
|
|
199
170
|
}
|
|
200
171
|
|
|
201
172
|
var _default = (0, _core["default"])(RootNotice, {
|
package/lib/cjs/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Notice.
|
|
1
|
+
{"version":3,"sources":["../../src/Notice.js"],"names":["isCustomTheme","theme","includes","RootNotice","asProps","SNotice","FadeInOut","Children","styles","hidden","color","useTheme","Component","style","use","duration","Label","SLabel","Box","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon","CloseXS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,aAAT,CAAuBC,KAAvB,EAA8B;AAC5B,SAAO,CAAC,CAAC,QAAD,EAAW,SAAX,EAAsB,SAAtB,EAAiC,MAAjC,EAAyCC,QAAzC,CAAkDD,KAAlD,CAAR;AACD;;IAEKE,U;;;;;;;;;;;;WASJ,yBAAgB;AAAA,UACNF,KADM,GACI,KAAKG,OADT,CACNH,KADM;AAEd,aAAO;AACLA,QAAAA,KAAK,EAALA;AADK,OAAP;AAGD;;;WAED,kBAAS;AAAA;AAAA;;AACP,UAAMI,OAAO,GAODC,oBAPZ;AADO,0BAEqC,KAAKF,OAF1C;AAAA,UAECG,QAFD,iBAECA,QAFD;AAAA,UAEWC,MAFX,iBAEWA,MAFX;AAAA,UAEmBC,MAFnB,iBAEmBA,MAFnB;AAAA,UAE2BR,KAF3B,iBAE2BA,KAF3B;AAGP,UAAMS,KAAK,GAAG,uBAAaT,KAAb,CAAd;AACA,UAAMU,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AAEA,qBAAO,mBAAQO,MAAR,CAAP,eACE,gCAAC,OAAD;AAAA,mBAEW,CAACC,MAFZ;AAAA,qBAGaE,QAHb;AAAA,2BAImBD,KAJnB;AAAA,gBAKO;AALP,+BAOE,gCAAC,QAAD,2BAPF,CADF;AAWD;;;EAjCsBE,e;;iCAAnBT,U,iBACiB,Q;iCADjBA,U,WAEWU,K;iCAFXV,U,kBAGkB;AACpBW,EAAAA,GAAG,EAAE,WADe;AAEpBb,EAAAA,KAAK,EAAE,MAFa;AAGpBc,EAAAA,QAAQ,EAAE;AAHU,C;;AAiCxB,SAASC,KAAT,SAAkC;AAAA;AAAA;;AAAA,MAAjBR,MAAiB,UAAjBA,MAAiB;AAAA,MAATP,KAAS,UAATA,KAAS;AAChC,MAAMgB,MAAM,GAG2BC,YAHvC;AACA,MAAMP,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AACA,MAAMS,KAAK,GAAG,uBAAaT,KAAb,CAAd;AACA,iBAAO,mBAAQO,MAAR,CAAP,eAAuB,gCAAC,MAAD;AAAA,iBAAgCG,QAAhC;AAAA,aAAiDD;AAAjD,cAAvB;AACD;;AAED,SAASS,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVX,MAAU,UAAVA,MAAU;AAC3B,MAAMY,QAAQ,GAC2BF,YADzC;AACA,iBAAO,mBAAQV,MAAR,CAAP,eAAuB,gCAAC,QAAD,6EAAvB;AACD;;AAED,SAASa,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVb,MAAU,UAAVA,MAAU;AAC3B,MAAMc,QAAQ,GAC2BJ,YADzC;AACA,iBAAO,mBAAQV,MAAR,CAAP,eAAuB,gCAAC,QAAD,6EAAvB;AACD;;AAED,SAASe,SAAT,SAA+B;AAAA;AAAA;;AAAA,MAAVf,MAAU,UAAVA,MAAU;AAC7B,MAAMgB,UAAU,GAEMN,YAFtB;AACA,kBAAO,mBAAQV,MAAR,CAAP,eACE,gCAAC,UAAD;AAAA,WAA8BiB,cAA9B;AAAA,aAA6C,OAA7C;AAAA;AAAA,kBAA4E;AAA5E,cADF;AAGD;;eAEc,sBAAgBtB,UAAhB,EAA4B;AACzCa,EAAAA,KAAK,EAALA,KADyC;AAEzCG,EAAAA,OAAO,EAAPA,OAFyC;AAGzCE,EAAAA,OAAO,EAAPA,OAHyC;AAIzCE,EAAAA,SAAS,EAATA;AAJyC,CAA5B,C","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport CloseXS from '@semcore/icon/lib/Close/xs';\nimport resolveColor from '@semcore/utils/lib/color';\nimport { FadeInOut } from '@semcore/animation';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static defaultProps = {\n use: 'secondary',\n theme: 'info',\n duration: 200,\n };\n\n getLabelProps() {\n const { theme } = this.asProps;\n return {\n theme,\n };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role=\"alert\"\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme }) {\n const SLabel = Root;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);\n}\n\nfunction Actions({ styles }) {\n const SActions = Root;\n return sstyled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ styles }) {\n const SContent = Root;\n return sstyled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon({ styles }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon render={Box} tag={CloseXS} color=\"stone\" interactive aria-label=\"Close alert\" />,\n );\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n});\n"],"file":"Notice.js"}
|
|
@@ -21,17 +21,17 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
21
21
|
|
|
22
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
23
|
|
|
24
|
-
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
24
|
var _core = _interopRequireWildcard(require("@semcore/core"));
|
|
27
25
|
|
|
26
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
|
+
|
|
28
28
|
var _isNode = _interopRequireDefault(require("@semcore/utils/lib/isNode"));
|
|
29
29
|
|
|
30
|
-
var _Notice = _interopRequireDefault(require("
|
|
30
|
+
var _Notice = _interopRequireDefault(require("./Notice"));
|
|
31
31
|
|
|
32
32
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
33
33
|
|
|
34
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
34
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
35
|
|
|
36
36
|
var NoticeSmart = /*#__PURE__*/function (_Component) {
|
|
37
37
|
(0, _inherits2["default"])(NoticeSmart, _Component);
|
|
@@ -46,16 +46,16 @@ var NoticeSmart = /*#__PURE__*/function (_Component) {
|
|
|
46
46
|
(0, _createClass2["default"])(NoticeSmart, [{
|
|
47
47
|
key: "render",
|
|
48
48
|
value: function render() {
|
|
49
|
-
var
|
|
49
|
+
var _ref = this ? this.asProps : arguments[0];
|
|
50
|
+
|
|
51
|
+
var SNoticeSmart = _Notice["default"];
|
|
50
52
|
var _this$asProps = this.asProps,
|
|
51
53
|
Children = _this$asProps.Children,
|
|
52
54
|
label = _this$asProps.label,
|
|
53
55
|
actions = _this$asProps.actions,
|
|
54
56
|
closable = _this$asProps.closable,
|
|
55
57
|
onClose = _this$asProps.onClose;
|
|
56
|
-
return /*#__PURE__*/_react["default"].createElement(SNoticeSmart, {
|
|
57
|
-
render: _Notice["default"]
|
|
58
|
-
}, (0, _isNode["default"])(label) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Label, null, label), /*#__PURE__*/_react["default"].createElement(_Notice["default"].Content, null, /*#__PURE__*/_react["default"].createElement(Children, null), (0, _isNode["default"])(actions) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Actions, null, actions)), closable && /*#__PURE__*/_react["default"].createElement(_Notice["default"].CloseIcon, {
|
|
58
|
+
return /*#__PURE__*/_react["default"].createElement(SNoticeSmart, (0, _core.assignProps)({}, _ref), (0, _isNode["default"])(label) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Label, null, label), /*#__PURE__*/_react["default"].createElement(_Notice["default"].Content, null, /*#__PURE__*/_react["default"].createElement(Children, null), (0, _isNode["default"])(actions) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Actions, null, actions)), closable && /*#__PURE__*/_react["default"].createElement(_Notice["default"].CloseIcon, {
|
|
59
59
|
onClick: onClose
|
|
60
60
|
}));
|
|
61
61
|
}
|
|
@@ -71,4 +71,4 @@ var NoticeSmart = /*#__PURE__*/function (_Component) {
|
|
|
71
71
|
var _default = (0, _core["default"])(NoticeSmart);
|
|
72
72
|
|
|
73
73
|
exports["default"] = _default;
|
|
74
|
-
//# sourceMappingURL=
|
|
74
|
+
//# sourceMappingURL=NoticeSmart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/NoticeSmart.js"],"names":["NoticeSmart","SNoticeSmart","Notice","asProps","Children","label","actions","closable","onClose","Component","theme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;;;;;IAEMA,W;;;;;;;;;;;;WAOJ,kBAAS;AAAA;;AACP,UAAMC,YAAY,GAGMC,kBAHxB;AADO,0BAEiD,KAAKC,OAFtD;AAAA,UAECC,QAFD,iBAECA,QAFD;AAAA,UAEWC,KAFX,iBAEWA,KAFX;AAAA,UAEkBC,OAFlB,iBAEkBA,OAFlB;AAAA,UAE2BC,QAF3B,iBAE2BA,QAF3B;AAAA,UAEqCC,OAFrC,iBAEqCA,OAFrC;AAGP,0BACE,gCAAC,YAAD,oCACG,wBAAOH,KAAP,kBAAiB,gCAAC,kBAAD,CAAQ,KAAR,QAAeA,KAAf,CADpB,eAEE,gCAAC,kBAAD,CAAQ,OAAR,qBACE,gCAAC,QAAD,OADF,EAEG,wBAAOC,OAAP,kBAAmB,gCAAC,kBAAD,CAAQ,OAAR,QAAiBA,OAAjB,CAFtB,CAFF,EAMGC,QAAQ,iBAAI,gCAAC,kBAAD,CAAQ,SAAR;AAAkB,QAAA,OAAO,EAAEC;AAA3B,QANf,CADF;AAUD;;;EApBuBC,e;;iCAApBT,W,iBACiB,a;iCADjBA,W,kBAGkB;AACpBU,EAAAA,KAAK,EAAE;AADa,C;;eAoBT,sBAAgBV,WAAhB,C","sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root } from '@semcore/core';\nimport isNode from '@semcore/utils/lib/isNode';\nimport Notice from './Notice';\n\nclass NoticeSmart extends Component {\n static displayName = 'NoticeSmart';\n\n static defaultProps = {\n theme: 'info',\n };\n\n render() {\n const SNoticeSmart = Root;\n const { Children, label, actions, closable, onClose } = this.asProps;\n return (\n <SNoticeSmart render={Notice}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n <Children />\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.CloseIcon onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n}\n\nexport default createComponent(NoticeSmart);\n"],"file":"NoticeSmart.js"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
var _exportNames = {
|
|
9
|
-
NoticeSmart: true
|
|
10
|
-
};
|
|
11
8
|
Object.defineProperty(exports, "NoticeSmart", {
|
|
12
9
|
enumerable: true,
|
|
13
10
|
get: function get() {
|
|
@@ -16,31 +13,10 @@ Object.defineProperty(exports, "NoticeSmart", {
|
|
|
16
13
|
});
|
|
17
14
|
exports["default"] = void 0;
|
|
18
15
|
|
|
19
|
-
var
|
|
16
|
+
var _Notice = _interopRequireDefault(require("./Notice"));
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
if (key === "default" || key === "__esModule") return;
|
|
23
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
24
|
-
Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _NoticeSmart[key];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
var _Notice = _interopRequireWildcard(require("./Notice"));
|
|
18
|
+
var _NoticeSmart = _interopRequireDefault(require("./NoticeSmart"));
|
|
33
19
|
|
|
34
|
-
Object.keys(_Notice).forEach(function (key) {
|
|
35
|
-
if (key === "default" || key === "__esModule") return;
|
|
36
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
37
|
-
Object.defineProperty(exports, key, {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function get() {
|
|
40
|
-
return _Notice[key];
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
20
|
var _default = _Notice["default"];
|
|
45
21
|
exports["default"] = _default;
|
|
46
22
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.
|
|
1
|
+
{"version":3,"sources":["../../src/index.js"],"names":["Notice"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAGA;;eADeA,kB","sourcesContent":["import { default as Notice } from './Notice';\n\nexport default Notice;\nexport { default as NoticeSmart } from './NoticeSmart';\n"],"file":"index.js"}
|
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
SNotice {
|
|
4
4
|
display: flex;
|
|
5
|
-
padding: media(15px);
|
|
6
5
|
font-size: var(--fs-100);
|
|
7
6
|
line-height: var(--lh-100);
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
SNotice[use='primary'] {
|
|
11
|
+
padding: 8px 32px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
SNotice[use='secondary'] {
|
|
15
|
+
padding: 15px;
|
|
8
16
|
border-style: solid;
|
|
9
17
|
border-width: 1px;
|
|
10
18
|
border-radius: 2px;
|
|
@@ -12,22 +20,33 @@ SNotice {
|
|
|
12
20
|
|
|
13
21
|
SNotice[theme='info'] {
|
|
14
22
|
background-color: color-mod(var(--light-blue) alpha(15%));
|
|
15
|
-
|
|
23
|
+
|
|
24
|
+
&[use='secondary'] {
|
|
25
|
+
border-color: color-mod(var(--light-blue) alpha(25%));
|
|
26
|
+
}
|
|
16
27
|
}
|
|
17
28
|
|
|
18
29
|
SNotice[theme='danger'] {
|
|
19
30
|
background-color: color-mod(var(--red) alpha(10%));
|
|
20
|
-
|
|
31
|
+
|
|
32
|
+
&[use='secondary'] {
|
|
33
|
+
border-color: color-mod(var(--red) alpha(20%));
|
|
34
|
+
}
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
SNotice[theme='warning'] {
|
|
24
38
|
background-color: color-mod(var(--light-orange) alpha(15%));
|
|
25
|
-
|
|
39
|
+
|
|
40
|
+
&[use='secondary'] {
|
|
41
|
+
border-color: color-mod(var(--light-orange) alpha(40%));
|
|
42
|
+
}
|
|
26
43
|
}
|
|
27
44
|
|
|
28
45
|
SNotice[theme='success'] {
|
|
29
46
|
background-color: color-mod(var(--green) alpha(15%));
|
|
30
|
-
|
|
47
|
+
&[use='secondary'] {
|
|
48
|
+
border-color: color-mod(var(--green) alpha(30%));
|
|
49
|
+
}
|
|
31
50
|
}
|
|
32
51
|
|
|
33
52
|
SContent {
|
|
@@ -37,18 +56,18 @@ SContent {
|
|
|
37
56
|
|
|
38
57
|
SActions {
|
|
39
58
|
flex-shrink: 0;
|
|
40
|
-
margin-top:
|
|
41
|
-
|
|
42
|
-
& > * + * {
|
|
43
|
-
margin-left: media(8px);
|
|
44
|
-
}
|
|
59
|
+
margin-top: 12px;
|
|
45
60
|
}
|
|
46
61
|
|
|
47
62
|
SLabel {
|
|
48
|
-
margin-right:
|
|
63
|
+
margin-right: 8px;
|
|
49
64
|
display: inline-flex;
|
|
50
65
|
}
|
|
51
66
|
|
|
67
|
+
SLabel[theme='danger'] {
|
|
68
|
+
color: var(--red);
|
|
69
|
+
}
|
|
70
|
+
|
|
52
71
|
SLabel[theme='info'] {
|
|
53
72
|
color: var(--stone);
|
|
54
73
|
}
|
|
@@ -58,27 +77,22 @@ SLabel[theme='success'] {
|
|
|
58
77
|
}
|
|
59
78
|
|
|
60
79
|
SLabel[theme='warning'] {
|
|
61
|
-
color: var(--orange);
|
|
80
|
+
color: var(--light-orange);
|
|
62
81
|
}
|
|
63
82
|
|
|
64
|
-
SLabel[theme='
|
|
65
|
-
color: var(--
|
|
83
|
+
SLabel[theme='custom'] {
|
|
84
|
+
color: var(--color);
|
|
66
85
|
}
|
|
67
86
|
|
|
68
87
|
SCloseIcon {
|
|
69
88
|
flex-shrink: 0;
|
|
70
|
-
margin-left:
|
|
89
|
+
margin-left: 16px;
|
|
71
90
|
}
|
|
72
91
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
92
|
+
SNotice[theme='custom'] {
|
|
93
|
+
background-color: var(--backgroundColor);
|
|
76
94
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.animate--exit-active {
|
|
83
|
-
opacity: 0.01;
|
|
95
|
+
&[use='secondary'] {
|
|
96
|
+
border-color: var(--backgroundColor);
|
|
97
|
+
}
|
|
84
98
|
}
|