@semcore/notice 16.0.0-prerelease.2 → 16.0.0-prerelease.20
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 +35 -1
- package/lib/cjs/Notice.js +6 -3
- package/lib/cjs/Notice.js.map +1 -1
- package/lib/es6/Notice.js +6 -3
- package/lib/es6/Notice.js.map +1 -1
- package/lib/esm/Notice.mjs +167 -131
- package/lib/esm/NoticeSmart.mjs +35 -27
- package/lib/esm/index.mjs +4 -4
- package/lib/esm/style/notice.shadow.css +138 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
- package/lib/esm/translations/de.json.mjs +11 -8
- package/lib/esm/translations/en.json.mjs +11 -8
- package/lib/esm/translations/es.json.mjs +11 -8
- package/lib/esm/translations/fr.json.mjs +11 -8
- package/lib/esm/translations/it.json.mjs +11 -8
- package/lib/esm/translations/ja.json.mjs +11 -8
- package/lib/esm/translations/ko.json.mjs +11 -8
- package/lib/esm/translations/nl.json.mjs +11 -8
- package/lib/esm/translations/pl.json.mjs +11 -8
- package/lib/esm/translations/pt.json.mjs +11 -8
- package/lib/esm/translations/sv.json.mjs +11 -8
- package/lib/esm/translations/tr.json.mjs +11 -8
- package/lib/esm/translations/vi.json.mjs +11 -8
- package/lib/esm/translations/zh.json.mjs +11 -8
- package/package.json +8 -8
package/lib/esm/Notice.mjs
CHANGED
|
@@ -1,181 +1,217 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { sstyled
|
|
9
|
-
import
|
|
10
|
-
import { Box
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { FadeInOut
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { localizedMessages
|
|
18
|
-
import
|
|
19
|
-
import { cssVariableEnhance
|
|
20
|
-
import { Text
|
|
21
|
-
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { Box } from "@semcore/flex-box";
|
|
11
|
+
import Button from "@semcore/button";
|
|
12
|
+
import CloseIconM from "@semcore/icon/Close/m";
|
|
13
|
+
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
14
|
+
import { FadeInOut } from "@semcore/animation";
|
|
15
|
+
import logger from "@semcore/core/lib/utils/logger";
|
|
16
|
+
import NoticeGlobal from "@semcore/notice-global";
|
|
17
|
+
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
18
|
+
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
19
|
+
import { cssVariableEnhance } from "@semcore/core/lib/utils/useCssVariable";
|
|
20
|
+
import { Text } from "@semcore/typography";
|
|
21
|
+
/*!__reshadow-styles__:"./style/notice.shadow.css"*/
|
|
22
|
+
var style = (
|
|
22
23
|
/*__reshadow_css_start__*/
|
|
23
|
-
(
|
|
24
|
+
(sstyled.insert(
|
|
24
25
|
/*__inner_css_start__*/
|
|
25
26
|
".___SNotice_un6cc_gg_{display:flex;padding:var(--intergalactic-spacing-4x, 16px);font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);box-sizing:border-box;border-style:solid;border-width:1px;border-radius:var(--intergalactic-surface-rounded, 6px);color:var(--intergalactic-text-primary, #191b23)}.___SNotice_un6cc_gg_._theme_info_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-info, #e9f7ff);border-color:var(--intergalactic-border-info, #8ecdff)}.___SNotice_un6cc_gg_._theme_info_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_info_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SNotice_un6cc_gg_._theme_danger_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-critical, #fff0f7);border-color:var(--intergalactic-border-critical, #ffaeb5)}.___SNotice_un6cc_gg_._theme_danger_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_danger_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-critical-hover-active, #CC3A42)}}.___SNotice_un6cc_gg_._theme_warning_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-warning, #fff3d9);border-color:var(--intergalactic-border-warning, #ffb26e)}.___SNotice_un6cc_gg_._theme_warning_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_warning_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-warning-hover-active, #CC5024)}}.___SNotice_un6cc_gg_._theme_success_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-success, #dbfee8);border-color:var(--intergalactic-border-success, #59ddaa)}.___SNotice_un6cc_gg_._theme_success_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_success_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-success-hover-active, #037E68)}}.___SNotice_un6cc_gg_._theme_muted_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);border-color:var(--intergalactic-border-secondary, #e0e1e9)}.___SLabel_un6cc_gg_._theme_info_un6cc_gg_,.___SNotice_un6cc_gg_._theme_muted_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_muted_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SContent_un6cc_gg_{flex:1 1 auto;width:100%}.___SActions_un6cc_gg_{flex-shrink:0;margin-top:var(--intergalactic-spacing-3x, 12px)}.___SLabel_un6cc_gg_{min-height:var(--intergalactic-form-control-m, 28px);height:-moz-fit-content;height:fit-content;margin-right:var(--intergalactic-spacing-2x, 8px);display:inline-flex;align-items:center}.___SLabel_un6cc_gg_._theme_danger_un6cc_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}.___SLabel_un6cc_gg_._theme_warning_un6cc_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}.___SLabel_un6cc_gg_._theme_success_un6cc_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}.___SLabel_un6cc_gg_._theme_muted_un6cc_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SLabel_un6cc_gg_._theme_custom_un6cc_gg_{color:var(--color_un6cc)}.___SCloseIcon_un6cc_gg_{flex-shrink:0;margin-left:var(--intergalactic-spacing-4x, 16px)}.___SNotice_un6cc_gg_._theme_custom_un6cc_gg_{background-color:var(--backgroundColor_un6cc);border-color:var(--backgroundColor_un6cc)}.___STitle_un6cc_gg_{margin-top:var(--intergalactic-spacing-05x, 2px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}.___SText_un6cc_gg_{margin-top:var(--intergalactic-spacing-1x, 4px);margin-bottom:var(--intergalactic-spacing-1x, 4px)}",
|
|
27
|
+
/*__inner_css_end__*/
|
|
26
28
|
"un6cc_gg_"
|
|
27
|
-
),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
), /*__reshadow_css_end__*/
|
|
30
|
+
{
|
|
31
|
+
"__SNotice": "___SNotice_un6cc_gg_",
|
|
32
|
+
"__SContent": "___SContent_un6cc_gg_",
|
|
33
|
+
"__SActions": "___SActions_un6cc_gg_",
|
|
34
|
+
"__SLabel": "___SLabel_un6cc_gg_",
|
|
35
|
+
"_theme_info": "_theme_info_un6cc_gg_",
|
|
36
|
+
"_theme_danger": "_theme_danger_un6cc_gg_",
|
|
37
|
+
"_theme_warning": "_theme_warning_un6cc_gg_",
|
|
38
|
+
"_theme_success": "_theme_success_un6cc_gg_",
|
|
39
|
+
"_theme_muted": "_theme_muted_un6cc_gg_",
|
|
40
|
+
"_theme_custom": "_theme_custom_un6cc_gg_",
|
|
38
41
|
"--color": "--color_un6cc",
|
|
39
|
-
__SCloseIcon: "___SCloseIcon_un6cc_gg_",
|
|
42
|
+
"__SCloseIcon": "___SCloseIcon_un6cc_gg_",
|
|
40
43
|
"--backgroundColor": "--backgroundColor_un6cc",
|
|
41
|
-
__STitle: "___STitle_un6cc_gg_",
|
|
42
|
-
__SText: "___SText_un6cc_gg_"
|
|
44
|
+
"__STitle": "___STitle_un6cc_gg_",
|
|
45
|
+
"__SText": "___SText_un6cc_gg_"
|
|
43
46
|
})
|
|
44
47
|
);
|
|
45
|
-
function
|
|
46
|
-
return !["danger", "warning", "success", "info", "muted"].includes(
|
|
48
|
+
function isCustomTheme(theme) {
|
|
49
|
+
return !["danger", "warning", "success", "info", "muted"].includes(theme);
|
|
47
50
|
}
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
function
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
for (var
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
var RootNotice = /* @__PURE__ */ function(_Component) {
|
|
52
|
+
_inherits(RootNotice2, _Component);
|
|
53
|
+
var _super = _createSuper(RootNotice2);
|
|
54
|
+
function RootNotice2() {
|
|
55
|
+
var _this;
|
|
56
|
+
_classCallCheck(this, RootNotice2);
|
|
57
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
58
|
+
args[_key] = arguments[_key];
|
|
59
|
+
}
|
|
60
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "ref", /* @__PURE__ */ React.createRef());
|
|
62
|
+
return _this;
|
|
57
63
|
}
|
|
58
|
-
|
|
64
|
+
_createClass(RootNotice2, [{
|
|
59
65
|
key: "componentDidMount",
|
|
60
|
-
value: function() {
|
|
66
|
+
value: function componentDidMount() {
|
|
61
67
|
if (this.ref.current && process.env.NODE_ENV !== "production" && !["muted", "danger"].includes(this.props.theme)) {
|
|
62
|
-
var
|
|
63
|
-
|
|
68
|
+
var hasTitle = function hasTitle2(node) {
|
|
69
|
+
if (node.hasAttribute("aria-label")) return true;
|
|
70
|
+
if (node.hasAttribute("aria-labelledby")) return true;
|
|
71
|
+
if (node.hasAttribute("title")) return true;
|
|
72
|
+
return false;
|
|
64
73
|
};
|
|
65
|
-
|
|
74
|
+
logger.warn(!hasTitle(this.ref.current), "Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification", this.props["data-ui-name"] || RootNotice2.displayName);
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
}, {
|
|
69
78
|
key: "getLabelProps",
|
|
70
|
-
value: function() {
|
|
71
|
-
var
|
|
79
|
+
value: function getLabelProps() {
|
|
80
|
+
var _this$asProps = this.asProps, theme = _this$asProps.theme, resolveColor = _this$asProps.resolveColor;
|
|
72
81
|
return {
|
|
73
|
-
theme
|
|
74
|
-
resolveColor
|
|
82
|
+
theme,
|
|
83
|
+
resolveColor
|
|
75
84
|
};
|
|
76
85
|
}
|
|
77
86
|
}, {
|
|
78
87
|
key: "getCloseIconProps",
|
|
79
|
-
value: function() {
|
|
80
|
-
var
|
|
88
|
+
value: function getCloseIconProps() {
|
|
89
|
+
var getI18nText = this.asProps.getI18nText;
|
|
81
90
|
return {
|
|
82
|
-
getI18nText
|
|
91
|
+
getI18nText
|
|
83
92
|
};
|
|
84
93
|
}
|
|
85
94
|
}, {
|
|
86
95
|
key: "getCloseProps",
|
|
87
|
-
value: function() {
|
|
88
|
-
var
|
|
96
|
+
value: function getCloseProps() {
|
|
97
|
+
var getI18nText = this.asProps.getI18nText;
|
|
89
98
|
return {
|
|
90
|
-
getI18nText
|
|
99
|
+
getI18nText
|
|
91
100
|
};
|
|
92
101
|
}
|
|
93
102
|
}, {
|
|
94
103
|
key: "render",
|
|
95
|
-
value: function() {
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"use
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
value: function render() {
|
|
105
|
+
var _ref = this.asProps, _ref9;
|
|
106
|
+
var SNotice = FadeInOut;
|
|
107
|
+
var _this$asProps2 = this.asProps, Children = _this$asProps2.Children, styles = _this$asProps2.styles, hidden = _this$asProps2.hidden, theme = _this$asProps2.theme, use = _this$asProps2.use, resolveColor = _this$asProps2.resolveColor, getI18nText = _this$asProps2.getI18nText;
|
|
108
|
+
var color = resolveColor(theme);
|
|
109
|
+
var useTheme = isCustomTheme(theme) ? "custom" : theme;
|
|
110
|
+
if (use === "primary") {
|
|
111
|
+
logger.warn(true, 'Deprecated property-value pair "use=primary", use component <NoticeGlobal/> instead', RootNotice2.displayName);
|
|
112
|
+
return /* @__PURE__ */ React.createElement(NoticeGlobal, this.asProps);
|
|
113
|
+
}
|
|
114
|
+
var ariaLabel = getI18nText(theme === "danger" ? "criticalNotification" : "notification");
|
|
115
|
+
if (theme === "muted") {
|
|
116
|
+
ariaLabel = void 0;
|
|
117
|
+
}
|
|
118
|
+
var role = theme === "muted" ? void 0 : "region";
|
|
119
|
+
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SNotice, _ref9.cn("SNotice", _objectSpread({}, assignProps({
|
|
120
|
+
"visible": !hidden,
|
|
121
|
+
"use:theme": useTheme,
|
|
122
|
+
"backgroundColor": color,
|
|
123
|
+
"role": role,
|
|
124
|
+
"aria-label": ariaLabel,
|
|
125
|
+
"ref": this.ref
|
|
126
|
+
}, _ref))), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {})));
|
|
108
127
|
}
|
|
109
|
-
}])
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
128
|
+
}]);
|
|
129
|
+
return RootNotice2;
|
|
130
|
+
}(Component);
|
|
131
|
+
_defineProperty(RootNotice, "displayName", "Notice");
|
|
132
|
+
_defineProperty(RootNotice, "style", style);
|
|
133
|
+
_defineProperty(RootNotice, "enhance", [i18nEnhance(localizedMessages), cssVariableEnhance({
|
|
114
134
|
variable: "--intergalactic-duration-popper",
|
|
115
135
|
fallback: "200",
|
|
116
136
|
map: Number.parseInt,
|
|
117
137
|
prop: "duration"
|
|
118
|
-
}),
|
|
119
|
-
|
|
138
|
+
}), resolveColorEnhance()]);
|
|
139
|
+
_defineProperty(RootNotice, "defaultProps", {
|
|
120
140
|
theme: "info",
|
|
121
|
-
i18n:
|
|
141
|
+
i18n: localizedMessages,
|
|
122
142
|
locale: "en"
|
|
123
143
|
});
|
|
124
|
-
function
|
|
125
|
-
var
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
144
|
+
function Label(_ref17) {
|
|
145
|
+
var _ref2 = arguments[0], _ref10;
|
|
146
|
+
var styles = _ref17.styles, theme = _ref17.theme, resolveColor = _ref17.resolveColor;
|
|
147
|
+
var SLabel = Box;
|
|
148
|
+
var useTheme = isCustomTheme(theme) ? "custom" : theme;
|
|
149
|
+
var color = resolveColor(theme);
|
|
150
|
+
return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SLabel, _ref10.cn("SLabel", _objectSpread({}, assignProps({
|
|
151
|
+
"use:theme": useTheme,
|
|
152
|
+
"color": color
|
|
153
|
+
}, _ref2))));
|
|
130
154
|
}
|
|
131
|
-
function
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
155
|
+
function Title(_ref18) {
|
|
156
|
+
var _ref3 = arguments[0], _ref11;
|
|
157
|
+
var styles = _ref18.styles;
|
|
158
|
+
var STitle = Text;
|
|
159
|
+
return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(STitle, _ref11.cn("STitle", _objectSpread({}, assignProps({
|
|
160
|
+
"tag": "div",
|
|
161
|
+
"size": 300,
|
|
162
|
+
"fontWeight": "bold"
|
|
163
|
+
}, _ref3))));
|
|
138
164
|
}
|
|
139
|
-
function
|
|
140
|
-
var
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
165
|
+
function NoticeText(_ref19) {
|
|
166
|
+
var _ref4 = arguments[0], _ref12;
|
|
167
|
+
var styles = _ref19.styles;
|
|
168
|
+
var SText = Text;
|
|
169
|
+
return _ref12 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref12.cn("SText", _objectSpread({}, assignProps({
|
|
170
|
+
"tag": "div"
|
|
171
|
+
}, _ref4))));
|
|
144
172
|
}
|
|
145
|
-
function
|
|
146
|
-
var
|
|
147
|
-
|
|
173
|
+
function Actions(_ref20) {
|
|
174
|
+
var _ref5 = arguments[0], _ref13;
|
|
175
|
+
var styles = _ref20.styles;
|
|
176
|
+
var SActions = Box;
|
|
177
|
+
return _ref13 = sstyled(styles), /* @__PURE__ */ React.createElement(SActions, _ref13.cn("SActions", _objectSpread({}, assignProps({}, _ref5))));
|
|
148
178
|
}
|
|
149
|
-
function
|
|
150
|
-
var
|
|
151
|
-
|
|
179
|
+
function Content(_ref21) {
|
|
180
|
+
var _ref6 = arguments[0], _ref14;
|
|
181
|
+
var styles = _ref21.styles;
|
|
182
|
+
var SContent = Box;
|
|
183
|
+
return _ref14 = sstyled(styles), /* @__PURE__ */ React.createElement(SContent, _ref14.cn("SContent", _objectSpread({}, assignProps({}, _ref6))));
|
|
152
184
|
}
|
|
153
|
-
function
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
"
|
|
159
|
-
|
|
185
|
+
function CloseIcon(_ref22) {
|
|
186
|
+
var _ref7 = arguments[0], _ref15;
|
|
187
|
+
var styles = _ref22.styles, getI18nText = _ref22.getI18nText;
|
|
188
|
+
var SCloseIcon = Box;
|
|
189
|
+
return _ref15 = sstyled(styles), /* @__PURE__ */ React.createElement(SCloseIcon, _ref15.cn("SCloseIcon", _objectSpread({}, assignProps({
|
|
190
|
+
"tag": CloseIconM,
|
|
191
|
+
"interactive": true,
|
|
192
|
+
"aria-label": getI18nText("close")
|
|
193
|
+
}, _ref7))));
|
|
160
194
|
}
|
|
161
|
-
function
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"
|
|
168
|
-
|
|
195
|
+
function Close(_ref23) {
|
|
196
|
+
var _ref8 = arguments[0], _ref16;
|
|
197
|
+
var styles = _ref23.styles, getI18nText = _ref23.getI18nText;
|
|
198
|
+
var SCloseIcon = Button;
|
|
199
|
+
return _ref16 = sstyled(styles), /* @__PURE__ */ React.createElement(SCloseIcon, _ref16.cn("SCloseIcon", _objectSpread({}, assignProps({
|
|
200
|
+
"addonLeft": CloseIconM,
|
|
201
|
+
"use": "tertiary",
|
|
202
|
+
"theme": "muted",
|
|
203
|
+
"aria-label": getI18nText("close")
|
|
204
|
+
}, _ref8))));
|
|
169
205
|
}
|
|
170
|
-
var
|
|
171
|
-
Label
|
|
172
|
-
Title
|
|
173
|
-
Text:
|
|
174
|
-
Actions
|
|
175
|
-
Content
|
|
176
|
-
CloseIcon
|
|
177
|
-
Close
|
|
206
|
+
var Notice = createComponent(RootNotice, {
|
|
207
|
+
Label,
|
|
208
|
+
Title,
|
|
209
|
+
Text: NoticeText,
|
|
210
|
+
Actions,
|
|
211
|
+
Content,
|
|
212
|
+
CloseIcon,
|
|
213
|
+
Close
|
|
178
214
|
});
|
|
179
215
|
export {
|
|
180
|
-
|
|
216
|
+
Notice as default
|
|
181
217
|
};
|
package/lib/esm/NoticeSmart.mjs
CHANGED
|
@@ -1,35 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { createComponent
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
+
import { createComponent, assignProps, Component } from "@semcore/core";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import isNode from "@semcore/core/lib/utils/isNode";
|
|
9
|
+
import Notice from "./Notice.mjs";
|
|
10
|
+
var NoticeSmart = /* @__PURE__ */ function(_Component) {
|
|
11
|
+
_inherits(NoticeSmart2, _Component);
|
|
12
|
+
var _super = _createSuper(NoticeSmart2);
|
|
13
|
+
function NoticeSmart2() {
|
|
14
|
+
_classCallCheck(this, NoticeSmart2);
|
|
15
|
+
return _super.apply(this, arguments);
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
_createClass(NoticeSmart2, [{
|
|
17
18
|
key: "render",
|
|
18
|
-
value: function() {
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
value: function render() {
|
|
20
|
+
var _ref = this.asProps;
|
|
21
|
+
var SNoticeSmart = Notice;
|
|
22
|
+
var _this$asProps = this.asProps, Children = _this$asProps.Children, label = _this$asProps.label, title = _this$asProps.title, actions = _this$asProps.actions, closable = _this$asProps.closable, onClose = _this$asProps.onClose;
|
|
23
|
+
var textContent = /* @__PURE__ */ React.createElement(Children, null);
|
|
24
|
+
if (typeof Children.origin === "string") {
|
|
25
|
+
textContent = isNode(title) || isNode(label) || closable ? /* @__PURE__ */ React.createElement(Notice.Text, null, /* @__PURE__ */ React.createElement(Children, null)) : /* @__PURE__ */ React.createElement(Children, null);
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ React.createElement(SNoticeSmart, assignProps({
|
|
28
|
+
"__excludeProps": ["title"]
|
|
29
|
+
}, _ref), isNode(label) && /* @__PURE__ */ React.createElement(Notice.Label, null, label), /* @__PURE__ */ React.createElement(Notice.Content, null, isNode(title) && /* @__PURE__ */ React.createElement(Notice.Title, null, title), textContent, isNode(actions) && /* @__PURE__ */ React.createElement(Notice.Actions, null, actions)), closable && /* @__PURE__ */ React.createElement(Notice.Close, {
|
|
30
|
+
onClick: onClose
|
|
24
31
|
}));
|
|
25
32
|
}
|
|
26
|
-
}])
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
}]);
|
|
34
|
+
return NoticeSmart2;
|
|
35
|
+
}(Component);
|
|
36
|
+
_defineProperty(NoticeSmart, "displayName", "NoticeSmart");
|
|
37
|
+
_defineProperty(NoticeSmart, "defaultProps", {
|
|
30
38
|
theme: "info"
|
|
31
39
|
});
|
|
32
|
-
const
|
|
40
|
+
const NoticeSmart$1 = createComponent(NoticeSmart);
|
|
33
41
|
export {
|
|
34
|
-
|
|
42
|
+
NoticeSmart$1 as default
|
|
35
43
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { default as
|
|
1
|
+
import Notice from "./Notice.mjs";
|
|
2
|
+
import { default as default2 } from "./NoticeSmart.mjs";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
default2 as NoticeSmart,
|
|
5
|
+
Notice as default
|
|
6
6
|
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
SNotice {
|
|
2
|
+
display: flex;
|
|
3
|
+
padding: var(--intergalactic-spacing-4x, 16px);
|
|
4
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
5
|
+
line-height: var(--intergalactic-lh-200, 142%);
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
border-style: solid;
|
|
8
|
+
border-width: 1px;
|
|
9
|
+
border-radius: var(--intergalactic-surface-rounded, 6px);
|
|
10
|
+
color: var(--intergalactic-text-primary, #191b23);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
SNotice[theme='info'] {
|
|
14
|
+
background-color: var(--intergalactic-bg-secondary-info, #e9f7ff);
|
|
15
|
+
border-color: var(--intergalactic-border-info, #8ecdff);
|
|
16
|
+
|
|
17
|
+
& SCloseIcon {
|
|
18
|
+
color: var(--intergalactic-icon-primary-neutral, #6c6e79);
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
color: var(--intergalactic-icon-primary-neutral-hover-active, #565861);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
SNotice[theme='danger'] {
|
|
27
|
+
background-color: var(--intergalactic-bg-secondary-critical, #fff0f7);
|
|
28
|
+
border-color: var(--intergalactic-border-critical, #ffaeb5);
|
|
29
|
+
|
|
30
|
+
& SCloseIcon {
|
|
31
|
+
color: var(--intergalactic-icon-primary-critical, #ff4953);
|
|
32
|
+
|
|
33
|
+
&:hover {
|
|
34
|
+
color: var(--intergalactic-icon-primary-critical-hover-active, #CC3A42);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
SNotice[theme='warning'] {
|
|
40
|
+
background-color: var(--intergalactic-bg-secondary-warning, #fff3d9);
|
|
41
|
+
border-color: var(--intergalactic-border-warning, #ffb26e);
|
|
42
|
+
|
|
43
|
+
& SCloseIcon {
|
|
44
|
+
color: var(--intergalactic-icon-primary-warning, #ff642d);
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
color: var(--intergalactic-icon-primary-warning-hover-active, #CC5024);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
SNotice[theme='success'] {
|
|
53
|
+
background-color: var(--intergalactic-bg-secondary-success, #dbfee8);
|
|
54
|
+
border-color: var(--intergalactic-border-success, #59ddaa);
|
|
55
|
+
|
|
56
|
+
& SCloseIcon {
|
|
57
|
+
color: var(--intergalactic-icon-primary-success, #009f81);
|
|
58
|
+
|
|
59
|
+
&:hover {
|
|
60
|
+
color: var(--intergalactic-icon-primary-success-hover-active, #037E68);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
SNotice[theme='muted'] {
|
|
66
|
+
background-color: var(--intergalactic-bg-secondary-neutral, #f4f5f9);
|
|
67
|
+
border-color: var(--intergalactic-border-secondary, #e0e1e9);
|
|
68
|
+
|
|
69
|
+
& SCloseIcon {
|
|
70
|
+
color: var(--intergalactic-icon-primary-neutral, #6c6e79);
|
|
71
|
+
|
|
72
|
+
&:hover {
|
|
73
|
+
color: var(--intergalactic-icon-primary-neutral-hover-active, #565861);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
SContent {
|
|
79
|
+
flex: 1 1 auto;
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
SActions {
|
|
84
|
+
flex-shrink: 0;
|
|
85
|
+
margin-top: var(--intergalactic-spacing-3x, 12px);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
SLabel {
|
|
89
|
+
min-height: var(--intergalactic-form-control-m, 28px);
|
|
90
|
+
height: fit-content;
|
|
91
|
+
margin-right: var(--intergalactic-spacing-2x, 8px);
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
SLabel[theme='info'] {
|
|
97
|
+
color: var(--intergalactic-icon-primary-neutral, #6c6e79);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
SLabel[theme='danger'] {
|
|
101
|
+
color: var(--intergalactic-icon-primary-critical, #ff4953);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
SLabel[theme='warning'] {
|
|
105
|
+
color: var(--intergalactic-icon-primary-warning, #ff642d);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
SLabel[theme='success'] {
|
|
109
|
+
color: var(--intergalactic-icon-primary-success, #009f81);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
SLabel[theme='muted'] {
|
|
113
|
+
color: var(--intergalactic-icon-primary-neutral, #6c6e79);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
SLabel[theme='custom'] {
|
|
117
|
+
color: var(--color);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
SCloseIcon {
|
|
121
|
+
flex-shrink: 0;
|
|
122
|
+
margin-left: var(--intergalactic-spacing-4x, 16px);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
SNotice[theme='custom'] {
|
|
126
|
+
background-color: var(--backgroundColor);
|
|
127
|
+
border-color: var(--backgroundColor);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
STitle {
|
|
131
|
+
margin-top: var(--intergalactic-spacing-05x, 2px);
|
|
132
|
+
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
SText {
|
|
136
|
+
margin-top: var(--intergalactic-spacing-1x, 4px);
|
|
137
|
+
margin-bottom: var(--intergalactic-spacing-1x, 4px);
|
|
138
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
var
|
|
16
|
-
de
|
|
17
|
-
en
|
|
18
|
-
es
|
|
19
|
-
fr
|
|
20
|
-
it
|
|
21
|
-
ja
|
|
22
|
-
ko
|
|
23
|
-
nl
|
|
24
|
-
pt
|
|
25
|
-
tr
|
|
26
|
-
vi
|
|
27
|
-
zh
|
|
28
|
-
pl
|
|
29
|
-
sv
|
|
1
|
+
import de from "./de.json.mjs";
|
|
2
|
+
import en from "./en.json.mjs";
|
|
3
|
+
import es from "./es.json.mjs";
|
|
4
|
+
import fr from "./fr.json.mjs";
|
|
5
|
+
import it from "./it.json.mjs";
|
|
6
|
+
import ja from "./ja.json.mjs";
|
|
7
|
+
import ko from "./ko.json.mjs";
|
|
8
|
+
import nl from "./nl.json.mjs";
|
|
9
|
+
import pt from "./pt.json.mjs";
|
|
10
|
+
import tr from "./tr.json.mjs";
|
|
11
|
+
import vi from "./vi.json.mjs";
|
|
12
|
+
import zh from "./zh.json.mjs";
|
|
13
|
+
import pl from "./pl.json.mjs";
|
|
14
|
+
import sv from "./sv.json.mjs";
|
|
15
|
+
var localizedMessages = {
|
|
16
|
+
de,
|
|
17
|
+
en,
|
|
18
|
+
es,
|
|
19
|
+
fr,
|
|
20
|
+
it,
|
|
21
|
+
ja,
|
|
22
|
+
ko,
|
|
23
|
+
nl,
|
|
24
|
+
pt,
|
|
25
|
+
tr,
|
|
26
|
+
vi,
|
|
27
|
+
zh,
|
|
28
|
+
pl,
|
|
29
|
+
sv
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
localizedMessages
|
|
33
33
|
};
|