@semcore/notice-bubble 16.0.0-prerelease.6 → 16.0.0-prerelease.9
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/lib/esm/NoticeBubble.mjs +293 -224
- package/lib/esm/NoticeBubbleManager.mjs +89 -58
- package/lib/esm/index.mjs +9 -9
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
- package/lib/esm/translations/de.json.mjs +8 -6
- package/lib/esm/translations/en.json.mjs +8 -6
- package/lib/esm/translations/es.json.mjs +8 -6
- package/lib/esm/translations/fr.json.mjs +8 -6
- package/lib/esm/translations/it.json.mjs +8 -6
- package/lib/esm/translations/ja.json.mjs +8 -6
- package/lib/esm/translations/ko.json.mjs +8 -6
- package/lib/esm/translations/nl.json.mjs +8 -6
- package/lib/esm/translations/pl.json.mjs +8 -6
- package/lib/esm/translations/pt.json.mjs +8 -6
- package/lib/esm/translations/sv.json.mjs +8 -6
- package/lib/esm/translations/tr.json.mjs +8 -6
- package/lib/esm/translations/vi.json.mjs +8 -6
- package/lib/esm/translations/zh.json.mjs +8 -6
- package/lib/esm/utils.mjs +27 -15
- package/package.json +7 -7
package/lib/esm/NoticeBubble.mjs
CHANGED
|
@@ -1,295 +1,364 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { sstyled
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { Animation
|
|
15
|
-
import { Box
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { callAllEventHandlers
|
|
19
|
-
import
|
|
20
|
-
import { Timer
|
|
21
|
-
import { localizedMessages
|
|
22
|
-
import
|
|
23
|
-
import { useCssVariable
|
|
24
|
-
import { contextThemeEnhance
|
|
25
|
-
import
|
|
26
|
-
import { setFocus
|
|
27
|
-
import { zIndexStackingEnhance
|
|
28
|
-
import { forkRef
|
|
29
|
-
import { getFocusableIn
|
|
30
|
-
var
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
10
|
+
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
11
|
+
import React from "react";
|
|
12
|
+
import Portal from "@semcore/portal";
|
|
13
|
+
import noticeBubbleDefaultManager from "./NoticeBubbleManager.mjs";
|
|
14
|
+
import { Animation } from "@semcore/animation";
|
|
15
|
+
import { Box, Flex } from "@semcore/flex-box";
|
|
16
|
+
import fire from "@semcore/core/lib/utils/fire";
|
|
17
|
+
import isNode from "@semcore/core/lib/utils/isNode";
|
|
18
|
+
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
19
|
+
import CloseIcon from "@semcore/icon/Close/m";
|
|
20
|
+
import { Timer } from "./utils.mjs";
|
|
21
|
+
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
22
|
+
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
23
|
+
import { useCssVariable } from "@semcore/core/lib/utils/useCssVariable";
|
|
24
|
+
import { contextThemeEnhance } from "@semcore/core/lib/utils/ThemeProvider";
|
|
25
|
+
import Button from "@semcore/button";
|
|
26
|
+
import { setFocus, useFocusLock } from "@semcore/core/lib/utils/use/useFocusLock";
|
|
27
|
+
import { zIndexStackingEnhance, ZIndexStackingContextProvider } from "@semcore/core/lib/utils/zIndexStacking";
|
|
28
|
+
import { forkRef, useForkRef } from "@semcore/core/lib/utils/ref";
|
|
29
|
+
import { getFocusableIn } from "@semcore/core/lib/utils/focus-lock/getFocusableIn";
|
|
30
|
+
var _excluded = ["focusLock"], _excluded2 = ["forwardRef", "styles", "onMouseEnter", "onMouseLeave", "getI18nText", "icon", "children", "action", "type"];
|
|
31
|
+
var style = (
|
|
31
32
|
/*__reshadow_css_start__*/
|
|
32
|
-
(
|
|
33
|
+
(sstyled.insert(
|
|
33
34
|
/*__inner_css_start__*/
|
|
34
35
|
"@keyframes enter_1i85x{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_1i85x{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_1i85x_gg_,.___SView_1i85x_gg_{position:relative;margin-bottom:var(--intergalactic-spacing-3x, 12px);padding:var(--intergalactic-spacing-3x, 12px);padding-right:calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-1x, 4px));width:100%;border-radius:var(--intergalactic-popper-rounded, 6px);overflow:hidden;box-sizing:border-box;color:var(--intergalactic-text-primary-invert, #ffffff);gap:var(--intergalactic-spacing-2x, 8px)}.___SBubble_1i85x_gg_._type_info_1i85x_gg_,.___SView_1i85x_gg_._type_info_1i85x_gg_{background:var(--intergalactic-bg-primary-invert, #191b23)}.___SBubble_1i85x_gg_._type_warning_1i85x_gg_,.___SView_1i85x_gg_._type_warning_1i85x_gg_{background:var(--intergalactic-bg-primary-critical, #ff4953)}.___SContent_1i85x_gg_{flex-direction:column;gap:var(--intergalactic-spacing-2x, 8px);flex:1}.___SMessage_1i85x_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SDismiss_1i85x_gg_{cursor:pointer;position:absolute;right:0;top:0;margin-top:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px);margin-bottom:var(--intergalactic-spacing-2x, 8px);flex-shrink:0;border:0;background:0 0}.___SDismiss_1i85x_gg_.__use_1i85x_gg_{padding:0 1px}.___SIcon_1i85x_gg_{justify-content:center;align-items:center;height:var(--intergalactic-spacing-5x, 20px)}.___SNoticeBubble_1i85x_gg_{width:300px;position:fixed;right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_1i85x_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SNoticeBubble_1i85x_gg_.__disablePortal_1i85x_gg_{position:sticky;margin-left:auto;height:0}.___SMessage_1i85x_gg_ a{color:var(--intergalactic-text-link-invert, #8ecdff)}.___SNoticeAriaLiveWrapper_1i85x_gg_{display:contents}",
|
|
35
36
|
"1i85x_gg_"
|
|
36
37
|
), {
|
|
37
|
-
__SContent: "___SContent_1i85x_gg_",
|
|
38
|
-
__SMessage: "___SMessage_1i85x_gg_",
|
|
39
|
-
__SDismiss: "___SDismiss_1i85x_gg_",
|
|
40
|
-
_use: "__use_1i85x_gg_",
|
|
41
|
-
__SIcon: "___SIcon_1i85x_gg_",
|
|
42
|
-
__SNoticeBubble: "___SNoticeBubble_1i85x_gg_",
|
|
43
|
-
_disablePortal: "__disablePortal_1i85x_gg_",
|
|
44
|
-
__SNoticeAriaLiveWrapper: "___SNoticeAriaLiveWrapper_1i85x_gg_",
|
|
38
|
+
"__SContent": "___SContent_1i85x_gg_",
|
|
39
|
+
"__SMessage": "___SMessage_1i85x_gg_",
|
|
40
|
+
"__SDismiss": "___SDismiss_1i85x_gg_",
|
|
41
|
+
"_use": "__use_1i85x_gg_",
|
|
42
|
+
"__SIcon": "___SIcon_1i85x_gg_",
|
|
43
|
+
"__SNoticeBubble": "___SNoticeBubble_1i85x_gg_",
|
|
44
|
+
"_disablePortal": "__disablePortal_1i85x_gg_",
|
|
45
|
+
"__SNoticeAriaLiveWrapper": "___SNoticeAriaLiveWrapper_1i85x_gg_",
|
|
45
46
|
"@enter": "enter_1i85x",
|
|
46
47
|
"@exit": "exit_1i85x",
|
|
47
|
-
__SBubble: "___SBubble_1i85x_gg_",
|
|
48
|
-
__SView: "___SView_1i85x_gg_",
|
|
49
|
-
_type_info: "_type_info_1i85x_gg_",
|
|
50
|
-
_type_warning: "_type_warning_1i85x_gg_"
|
|
48
|
+
"__SBubble": "___SBubble_1i85x_gg_",
|
|
49
|
+
"__SView": "___SView_1i85x_gg_",
|
|
50
|
+
"_type_info": "_type_info_1i85x_gg_",
|
|
51
|
+
"_type_warning": "_type_warning_1i85x_gg_"
|
|
51
52
|
})
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
);
|
|
54
|
+
var Notices = function Notices2(props) {
|
|
55
|
+
var styles = props.styles, _props$data = props.data, data = _props$data === void 0 ? [] : _props$data, _props$tag = props.tag, SView = _props$tag === void 0 ? ViewInfo : _props$tag;
|
|
56
|
+
var ref = React.useRef();
|
|
57
|
+
var durationStr = useCssVariable("--intergalactic-duration-popper", "200", ref);
|
|
58
|
+
var duration = React.useMemo(function() {
|
|
59
|
+
return parseInt(durationStr, 10);
|
|
60
|
+
}, [durationStr]);
|
|
61
|
+
return data.map(function(notice) {
|
|
62
|
+
var _ref2, _notice$visible;
|
|
63
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(Animation, _ref2.cn("Animation", {
|
|
64
|
+
"key": notice.uid,
|
|
65
|
+
"initialAnimation": notice.initialAnimation,
|
|
66
|
+
"visible": (_notice$visible = notice.visible) !== null && _notice$visible !== void 0 ? _notice$visible : true,
|
|
67
|
+
"duration": duration,
|
|
68
|
+
"keyframes": [styles["@enter"], styles["@exit"]],
|
|
69
|
+
"ref": ref
|
|
70
|
+
}), /* @__PURE__ */ React.createElement(SView, _ref2.cn("SView", _objectSpread(_objectSpread({}, notice), {}, {
|
|
71
|
+
"styles": notice.styles || styles,
|
|
72
|
+
"getI18nText": props.getI18nText
|
|
68
73
|
}))));
|
|
69
74
|
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
};
|
|
76
|
+
var NoticeBubbleContainerRoot = /* @__PURE__ */ function(_Component) {
|
|
77
|
+
_inherits(NoticeBubbleContainerRoot2, _Component);
|
|
78
|
+
var _super = _createSuper(NoticeBubbleContainerRoot2);
|
|
79
|
+
function NoticeBubbleContainerRoot2() {
|
|
80
|
+
var _this;
|
|
81
|
+
_classCallCheck(this, NoticeBubbleContainerRoot2);
|
|
82
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
83
|
+
args[_key] = arguments[_key];
|
|
84
|
+
}
|
|
85
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
86
|
+
_defineProperty(_assertThisInitialized(_this), "_unsubscribe", null);
|
|
87
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
79
88
|
notices: [],
|
|
80
89
|
warnings: []
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
});
|
|
91
|
+
_defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function() {
|
|
92
|
+
if (_this._unsubscribe) {
|
|
93
|
+
_this._unsubscribe();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function(notices) {
|
|
97
|
+
var info = notices.filter(function(notice) {
|
|
98
|
+
return notice.type === "info";
|
|
88
99
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
warnings: p
|
|
100
|
+
var warning = notices.filter(function(notice) {
|
|
101
|
+
return notice.type === "warning";
|
|
92
102
|
});
|
|
93
|
-
|
|
103
|
+
_this.setState({
|
|
104
|
+
notices: info,
|
|
105
|
+
warnings: warning
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
return _this;
|
|
94
109
|
}
|
|
95
|
-
|
|
110
|
+
_createClass(NoticeBubbleContainerRoot2, [{
|
|
96
111
|
key: "componentDidMount",
|
|
97
|
-
value: function() {
|
|
112
|
+
value: function componentDidMount() {
|
|
98
113
|
this._unsubscribe = this.asProps.manager.addListener(this.handleChange);
|
|
99
114
|
}
|
|
100
115
|
}, {
|
|
101
116
|
key: "render",
|
|
102
|
-
value: function() {
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
value: function render() {
|
|
118
|
+
var _ref = this.asProps, _ref3;
|
|
119
|
+
var SNoticeBubble = Box;
|
|
120
|
+
var SNoticeAriaLiveWrapper = "div";
|
|
121
|
+
var _this$asProps = this.asProps, Children = _this$asProps.Children, styles = _this$asProps.styles, disablePortal = _this$asProps.disablePortal, getI18nText = _this$asProps.getI18nText, ref = _this$asProps.ref, parentZIndexStacking = _this$asProps.parentZIndexStacking;
|
|
122
|
+
var _this$state = this.state, notices = _this$state.notices, warnings = _this$state.warnings;
|
|
123
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(ZIndexStackingContextProvider, _ref3.cn("ZIndexStackingContextProvider", {
|
|
124
|
+
"designToken": "z-index-notice-bubble"
|
|
125
|
+
}), /* @__PURE__ */ React.createElement(Portal, _ref3.cn("Portal", {
|
|
126
|
+
"disablePortal": disablePortal
|
|
127
|
+
}), /* @__PURE__ */ React.createElement(SNoticeBubble, _ref3.cn("SNoticeBubble", _objectSpread({}, assignProps({
|
|
128
|
+
"ref": ref,
|
|
129
|
+
"tag": "section",
|
|
130
|
+
"role": "region",
|
|
131
|
+
"aria-label": getI18nText("notification"),
|
|
132
|
+
"zIndex": parentZIndexStacking
|
|
133
|
+
}, _ref))), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {})), /* @__PURE__ */ React.createElement(Notices, _ref3.cn("Notices", {
|
|
134
|
+
"styles": styles,
|
|
135
|
+
"data": warnings,
|
|
136
|
+
"tag": ViewWarning,
|
|
137
|
+
"getI18nText": getI18nText
|
|
138
|
+
})), /* @__PURE__ */ React.createElement(SNoticeAriaLiveWrapper, _ref3.cn("SNoticeAriaLiveWrapper", {
|
|
120
139
|
"aria-live": "polite"
|
|
121
|
-
}), /* @__PURE__ */
|
|
122
|
-
styles:
|
|
123
|
-
data:
|
|
124
|
-
tag:
|
|
125
|
-
getI18nText:
|
|
140
|
+
}), /* @__PURE__ */ React.createElement(Notices, _ref3.cn("Notices", {
|
|
141
|
+
"styles": styles,
|
|
142
|
+
"data": notices,
|
|
143
|
+
"tag": ViewInfo,
|
|
144
|
+
"getI18nText": getI18nText
|
|
126
145
|
}))))));
|
|
127
146
|
}
|
|
128
|
-
}])
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
}]);
|
|
148
|
+
return NoticeBubbleContainerRoot2;
|
|
149
|
+
}(Component);
|
|
150
|
+
_defineProperty(NoticeBubbleContainerRoot, "displayName", "NoticeBubbleContainer");
|
|
151
|
+
_defineProperty(NoticeBubbleContainerRoot, "style", style);
|
|
152
|
+
_defineProperty(NoticeBubbleContainerRoot, "enhance", [i18nEnhance(localizedMessages), contextThemeEnhance(), zIndexStackingEnhance("z-index-notice-bubble")]);
|
|
153
|
+
_defineProperty(NoticeBubbleContainerRoot, "defaultProps", {
|
|
154
|
+
manager: noticeBubbleDefaultManager,
|
|
155
|
+
i18n: localizedMessages,
|
|
136
156
|
locale: "en"
|
|
137
157
|
});
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
158
|
+
var FocusLock = /* @__PURE__ */ React.forwardRef(function(props, outerRef) {
|
|
159
|
+
var focusLock = props.focusLock, other = _objectWithoutProperties(props, _excluded);
|
|
160
|
+
var innerRef = React.useRef();
|
|
161
|
+
useFocusLock(innerRef, false, "auto", !focusLock, true);
|
|
162
|
+
var ref = useForkRef(outerRef, innerRef);
|
|
163
|
+
return /* @__PURE__ */ React.createElement(Flex, _extends({
|
|
164
|
+
ref
|
|
165
|
+
}, other));
|
|
166
|
+
});
|
|
167
|
+
var ViewInfo = /* @__PURE__ */ function(_Component2) {
|
|
168
|
+
_inherits(ViewInfo2, _Component2);
|
|
169
|
+
var _super2 = _createSuper(ViewInfo2);
|
|
170
|
+
function ViewInfo2() {
|
|
171
|
+
var _this2;
|
|
172
|
+
_classCallCheck(this, ViewInfo2);
|
|
173
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
174
|
+
args[_key2] = arguments[_key2];
|
|
175
|
+
}
|
|
176
|
+
_this2 = _super2.call.apply(_super2, [this].concat(args));
|
|
177
|
+
_defineProperty(_assertThisInitialized(_this2), "timer", null);
|
|
178
|
+
_defineProperty(_assertThisInitialized(_this2), "ref", /* @__PURE__ */ React.createRef());
|
|
179
|
+
_defineProperty(_assertThisInitialized(_this2), "closeButtonRef", /* @__PURE__ */ React.createRef());
|
|
180
|
+
_defineProperty(_assertThisInitialized(_this2), "handleClose", function(e) {
|
|
181
|
+
fire(_assertThisInitialized(_this2), "onClose", e);
|
|
182
|
+
_this2.clearTimer();
|
|
183
|
+
});
|
|
184
|
+
_defineProperty(_assertThisInitialized(_this2), "handleKeydown", function(e) {
|
|
185
|
+
if (e.key === "Escape") {
|
|
186
|
+
_this2.handleClose(e);
|
|
166
187
|
}
|
|
167
|
-
})
|
|
188
|
+
});
|
|
189
|
+
_defineProperty(_assertThisInitialized(_this2), "handleMouseEnter", function() {
|
|
190
|
+
if (!_this2.timer) return;
|
|
191
|
+
_this2.timer.pause();
|
|
192
|
+
});
|
|
193
|
+
_defineProperty(_assertThisInitialized(_this2), "handleMouseLeave", function() {
|
|
194
|
+
if (!_this2.timer) return;
|
|
195
|
+
_this2.timer.resume();
|
|
196
|
+
});
|
|
197
|
+
_defineProperty(_assertThisInitialized(_this2), "handleBodyMouseMove", function(event) {
|
|
198
|
+
var _this2$timer;
|
|
199
|
+
if (!((_this2$timer = _this2.timer) !== null && _this2$timer !== void 0 && _this2$timer.paused)) return;
|
|
200
|
+
var rect = _this2.ref.current.getBoundingClientRect();
|
|
201
|
+
var mouseInRect = event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
202
|
+
if (mouseInRect) return;
|
|
203
|
+
_this2.timer.resume();
|
|
204
|
+
});
|
|
205
|
+
return _this2;
|
|
168
206
|
}
|
|
169
|
-
|
|
207
|
+
_createClass(ViewInfo2, [{
|
|
170
208
|
key: "componentDidMount",
|
|
171
|
-
value: function() {
|
|
172
|
-
var
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
209
|
+
value: function componentDidMount() {
|
|
210
|
+
var _this3 = this;
|
|
211
|
+
var duration = this.props.duration;
|
|
212
|
+
if (duration) {
|
|
213
|
+
this.timer = new Timer(this.handleClose, duration);
|
|
214
|
+
document.body.addEventListener("mousemove", this.handleBodyMouseMove);
|
|
215
|
+
}
|
|
216
|
+
var noticeElement = this.ref.current;
|
|
217
|
+
if (noticeElement) {
|
|
218
|
+
var focusableNodes = getFocusableIn(noticeElement).filter(function(node) {
|
|
219
|
+
return node !== _this3.closeButtonRef.current;
|
|
178
220
|
});
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
221
|
+
if (focusableNodes.length > 0) {
|
|
222
|
+
setTimeout(function() {
|
|
223
|
+
return setFocus(noticeElement);
|
|
224
|
+
}, 0);
|
|
225
|
+
}
|
|
182
226
|
}
|
|
183
227
|
}
|
|
184
228
|
}, {
|
|
185
229
|
key: "componentWillUnmount",
|
|
186
|
-
value: function() {
|
|
187
|
-
this.clearTimer()
|
|
230
|
+
value: function componentWillUnmount() {
|
|
231
|
+
this.clearTimer();
|
|
232
|
+
document.body.removeEventListener("mousemove", this.handleBodyMouseMove);
|
|
188
233
|
}
|
|
189
234
|
}, {
|
|
190
235
|
key: "clearTimer",
|
|
191
|
-
value: function() {
|
|
192
|
-
|
|
236
|
+
value: function clearTimer() {
|
|
237
|
+
if (this.timer) {
|
|
238
|
+
this.timer.clear();
|
|
239
|
+
this.timer = null;
|
|
240
|
+
}
|
|
193
241
|
}
|
|
194
242
|
}, {
|
|
195
243
|
key: "render",
|
|
196
|
-
value: function() {
|
|
197
|
-
var
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
244
|
+
value: function render() {
|
|
245
|
+
var _ref4;
|
|
246
|
+
var SBubble = FocusLock;
|
|
247
|
+
var SDismiss = Button;
|
|
248
|
+
var SContent = Flex;
|
|
249
|
+
var SMessage = "div";
|
|
250
|
+
var SAction = "div";
|
|
251
|
+
var SIcon = Flex;
|
|
252
|
+
var _this$props = this.props, forwardRef = _this$props.forwardRef, styles = _this$props.styles, onMouseEnter = _this$props.onMouseEnter, onMouseLeave = _this$props.onMouseLeave, getI18nText = _this$props.getI18nText, icon = _this$props.icon, children = _this$props.children, actionNode = _this$props.action, type = _this$props.type, other = _objectWithoutProperties(_this$props, _excluded2);
|
|
253
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SBubble, _ref4.cn("SBubble", _objectSpread(_objectSpread({}, other), {}, {
|
|
254
|
+
"ref": forkRef(forwardRef, this.ref),
|
|
255
|
+
"onMouseEnter": callAllEventHandlers(onMouseEnter, this.handleMouseEnter),
|
|
256
|
+
"onMouseLeave": callAllEventHandlers(onMouseLeave, this.handleMouseLeave),
|
|
257
|
+
"onKeyDown": this.handleKeydown,
|
|
258
|
+
"role": type === "warning" ? "alert" : this.props.role
|
|
259
|
+
})), /* @__PURE__ */ React.createElement(
|
|
260
|
+
SDismiss,
|
|
261
|
+
_ref4.cn("SDismiss", {
|
|
207
262
|
"aria-haspopup": void 0,
|
|
208
|
-
type: "button",
|
|
209
|
-
use: "tertiary",
|
|
210
|
-
size: "m",
|
|
211
|
-
theme: "invert",
|
|
212
|
-
onClick: this.handleClose,
|
|
213
|
-
"aria-label":
|
|
214
|
-
active:
|
|
215
|
-
title:
|
|
216
|
-
ref: this.closeButtonRef
|
|
263
|
+
"type": "button",
|
|
264
|
+
"use": "tertiary",
|
|
265
|
+
"size": "m",
|
|
266
|
+
"theme": "invert",
|
|
267
|
+
"onClick": this.handleClose,
|
|
268
|
+
"aria-label": getI18nText("close"),
|
|
269
|
+
"active": false,
|
|
270
|
+
"title": getI18nText("close"),
|
|
271
|
+
"ref": this.closeButtonRef
|
|
217
272
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
tag:
|
|
273
|
+
/* @__PURE__ */ React.createElement(Button.Addon, {
|
|
274
|
+
tag: CloseIcon,
|
|
220
275
|
color: "icon-primary-invert"
|
|
221
276
|
})
|
|
222
|
-
),
|
|
277
|
+
), isNode(icon) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SIcon, _ref4.cn("SIcon", {}), icon), /* @__PURE__ */ React.createElement(SContent, _ref4.cn("SContent", {}), /* @__PURE__ */ React.createElement(SMessage, _ref4.cn("SMessage", {}), children), isNode(actionNode) ? /* @__PURE__ */ React.createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null)) : /* @__PURE__ */ React.createElement(SContent, _ref4.cn("SContent", {}), /* @__PURE__ */ React.createElement(SMessage, _ref4.cn("SMessage", {}), children), isNode(actionNode) ? /* @__PURE__ */ React.createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null));
|
|
223
278
|
}
|
|
224
|
-
}])
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
279
|
+
}]);
|
|
280
|
+
return ViewInfo2;
|
|
281
|
+
}(Component);
|
|
282
|
+
var ViewWarning = /* @__PURE__ */ function(_ViewInfo) {
|
|
283
|
+
_inherits(ViewWarning2, _ViewInfo);
|
|
284
|
+
var _super3 = _createSuper(ViewWarning2);
|
|
285
|
+
function ViewWarning2() {
|
|
286
|
+
_classCallCheck(this, ViewWarning2);
|
|
287
|
+
return _super3.apply(this, arguments);
|
|
230
288
|
}
|
|
231
|
-
return
|
|
232
|
-
}(
|
|
233
|
-
|
|
289
|
+
return _createClass(ViewWarning2);
|
|
290
|
+
}(ViewInfo);
|
|
291
|
+
_defineProperty(ViewWarning, "defaultProps", {
|
|
234
292
|
type: "warning",
|
|
235
293
|
duration: 0
|
|
236
294
|
});
|
|
237
|
-
var
|
|
238
|
-
|
|
239
|
-
var
|
|
240
|
-
function
|
|
241
|
-
var
|
|
242
|
-
|
|
243
|
-
for (var
|
|
244
|
-
|
|
245
|
-
|
|
295
|
+
var NoticeBubbleView = /* @__PURE__ */ function(_Component3) {
|
|
296
|
+
_inherits(NoticeBubbleView2, _Component3);
|
|
297
|
+
var _super4 = _createSuper(NoticeBubbleView2);
|
|
298
|
+
function NoticeBubbleView2() {
|
|
299
|
+
var _this4;
|
|
300
|
+
_classCallCheck(this, NoticeBubbleView2);
|
|
301
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
302
|
+
args[_key3] = arguments[_key3];
|
|
303
|
+
}
|
|
304
|
+
_this4 = _super4.call.apply(_super4, [this].concat(args));
|
|
305
|
+
_defineProperty(_assertThisInitialized(_this4), "_notice", null);
|
|
306
|
+
return _this4;
|
|
246
307
|
}
|
|
247
|
-
|
|
308
|
+
_createClass(NoticeBubbleView2, [{
|
|
248
309
|
key: "componentDidMount",
|
|
249
|
-
value: function() {
|
|
310
|
+
value: function componentDidMount() {
|
|
250
311
|
this._notice = this.asProps.manager.add(this.asProps);
|
|
251
312
|
}
|
|
252
313
|
}, {
|
|
253
314
|
key: "componentWillUnmount",
|
|
254
|
-
value: function() {
|
|
255
|
-
|
|
315
|
+
value: function componentWillUnmount() {
|
|
316
|
+
if (this._notice) {
|
|
317
|
+
this._notice.remove();
|
|
318
|
+
}
|
|
256
319
|
}
|
|
257
320
|
}, {
|
|
258
321
|
key: "componentDidUpdate",
|
|
259
|
-
value: function() {
|
|
260
|
-
|
|
322
|
+
value: function componentDidUpdate() {
|
|
323
|
+
if (this._notice) {
|
|
324
|
+
this._notice.update(this.asProps);
|
|
325
|
+
}
|
|
261
326
|
}
|
|
262
327
|
}, {
|
|
263
328
|
key: "render",
|
|
264
|
-
value: function() {
|
|
329
|
+
value: function render() {
|
|
265
330
|
return null;
|
|
266
331
|
}
|
|
267
|
-
}])
|
|
268
|
-
|
|
269
|
-
|
|
332
|
+
}]);
|
|
333
|
+
return NoticeBubbleView2;
|
|
334
|
+
}(Component);
|
|
335
|
+
_defineProperty(NoticeBubbleView, "defaultProps", {
|
|
270
336
|
duration: 5e3,
|
|
271
337
|
type: "info",
|
|
272
|
-
manager:
|
|
338
|
+
manager: noticeBubbleDefaultManager
|
|
273
339
|
});
|
|
274
|
-
var
|
|
275
|
-
|
|
276
|
-
var
|
|
277
|
-
function
|
|
278
|
-
|
|
340
|
+
var NoticeBubbleWarningView = /* @__PURE__ */ function(_NoticeBubbleView) {
|
|
341
|
+
_inherits(NoticeBubbleWarningView2, _NoticeBubbleView);
|
|
342
|
+
var _super5 = _createSuper(NoticeBubbleWarningView2);
|
|
343
|
+
function NoticeBubbleWarningView2() {
|
|
344
|
+
_classCallCheck(this, NoticeBubbleWarningView2);
|
|
345
|
+
return _super5.apply(this, arguments);
|
|
279
346
|
}
|
|
280
|
-
return
|
|
281
|
-
}(
|
|
282
|
-
|
|
347
|
+
return _createClass(NoticeBubbleWarningView2);
|
|
348
|
+
}(NoticeBubbleView);
|
|
349
|
+
_defineProperty(NoticeBubbleWarningView, "defaultProps", {
|
|
283
350
|
duration: 5e3,
|
|
284
351
|
type: "warning",
|
|
285
|
-
manager:
|
|
352
|
+
manager: noticeBubbleDefaultManager
|
|
353
|
+
});
|
|
354
|
+
var NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {
|
|
355
|
+
Info: NoticeBubbleView,
|
|
356
|
+
Warning: NoticeBubbleWarningView
|
|
286
357
|
});
|
|
287
|
-
var
|
|
288
|
-
|
|
289
|
-
Warning: $
|
|
290
|
-
}), je = Z.Info, Ke = Z.Warning;
|
|
358
|
+
var NoticeBubble = NoticeBubbleContainer.Info;
|
|
359
|
+
var NoticeBubbleWarning = NoticeBubbleContainer.Warning;
|
|
291
360
|
export {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
361
|
+
NoticeBubble,
|
|
362
|
+
NoticeBubbleWarning,
|
|
363
|
+
NoticeBubbleContainer as default
|
|
295
364
|
};
|
|
@@ -1,91 +1,122 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { callAllEventHandlers
|
|
7
|
-
import { setFocus
|
|
8
|
-
import
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
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 _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
+
import EventEmitter from "@semcore/core/lib/utils/eventEmitter";
|
|
6
|
+
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
7
|
+
import { setFocus } from "@semcore/core/lib/utils/use/useFocusLock";
|
|
8
|
+
import React from "react";
|
|
9
|
+
var EVENT_NAME = "CHANGE";
|
|
10
|
+
var NoticeBubbleManager = /* @__PURE__ */ function() {
|
|
11
|
+
function NoticeBubbleManager2() {
|
|
12
|
+
_classCallCheck(this, NoticeBubbleManager2);
|
|
13
|
+
_defineProperty(this, "items", []);
|
|
14
|
+
_defineProperty(this, "emitter", null);
|
|
15
|
+
_defineProperty(this, "counter", 0);
|
|
16
|
+
_defineProperty(this, "replaceTimer", 0);
|
|
17
|
+
this.emitter = new EventEmitter();
|
|
12
18
|
}
|
|
13
|
-
|
|
19
|
+
_createClass(NoticeBubbleManager2, [{
|
|
14
20
|
key: "addListener",
|
|
15
|
-
value: function(
|
|
16
|
-
return this.emitter.subscribe(
|
|
21
|
+
value: function addListener(fn) {
|
|
22
|
+
return this.emitter.subscribe(EVENT_NAME, fn);
|
|
17
23
|
}
|
|
18
24
|
}, {
|
|
19
25
|
key: "createItem",
|
|
20
|
-
value: function(
|
|
21
|
-
var
|
|
22
|
-
return
|
|
26
|
+
value: function createItem(props) {
|
|
27
|
+
var manager = this;
|
|
28
|
+
return _objectSpread(_objectSpread({
|
|
23
29
|
type: "info"
|
|
24
|
-
},
|
|
25
|
-
onClose:
|
|
26
|
-
|
|
30
|
+
}, props), {}, {
|
|
31
|
+
onClose: callAllEventHandlers(props.onClose, function() {
|
|
32
|
+
manager.remove(props.uid);
|
|
27
33
|
})
|
|
28
34
|
});
|
|
29
35
|
}
|
|
30
36
|
}, {
|
|
31
37
|
key: "emit",
|
|
32
|
-
value: function() {
|
|
33
|
-
this.emitter.emit(
|
|
38
|
+
value: function emit() {
|
|
39
|
+
this.emitter.emit(EVENT_NAME, this.items);
|
|
34
40
|
}
|
|
35
41
|
}, {
|
|
36
42
|
key: "add",
|
|
37
|
-
value: function(
|
|
38
|
-
var
|
|
43
|
+
value: function add(props) {
|
|
44
|
+
var uid = this.counter++;
|
|
45
|
+
var ref = /* @__PURE__ */ React.createRef();
|
|
46
|
+
var focus = function focus2() {
|
|
39
47
|
return setTimeout(function() {
|
|
40
|
-
return
|
|
48
|
+
return setFocus(ref.current);
|
|
41
49
|
}, 0);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
};
|
|
51
|
+
var item = this.createItem(_objectSpread({
|
|
52
|
+
uid,
|
|
53
|
+
visible: props.initialAnimation ? true : void 0,
|
|
54
|
+
forwardRef: ref
|
|
55
|
+
}, props));
|
|
56
|
+
this.items.push(item);
|
|
57
|
+
this.emit();
|
|
58
|
+
return {
|
|
59
|
+
uid,
|
|
60
|
+
update: this.update.bind(this, uid),
|
|
61
|
+
remove: this.remove.bind(this, uid),
|
|
62
|
+
ref,
|
|
52
63
|
// todo Brauer Ilia: remove this property, because we added logic about autofocus in Notice
|
|
53
|
-
focus
|
|
64
|
+
focus
|
|
54
65
|
};
|
|
55
66
|
}
|
|
56
67
|
}, {
|
|
57
68
|
key: "update",
|
|
58
|
-
value: function(
|
|
59
|
-
var
|
|
60
|
-
return
|
|
69
|
+
value: function update(uid, props) {
|
|
70
|
+
var index = this.items.findIndex(function(item) {
|
|
71
|
+
return item.uid === uid;
|
|
61
72
|
});
|
|
62
|
-
|
|
73
|
+
if (index !== -1) {
|
|
74
|
+
this.items[index] = this.createItem(_objectSpread(_objectSpread({}, this.items[index]), props));
|
|
75
|
+
this.emit();
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
63
79
|
}
|
|
64
80
|
}, {
|
|
65
81
|
key: "replaceLast",
|
|
66
|
-
value: function(
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
value: function replaceLast(props) {
|
|
83
|
+
var _this = this;
|
|
84
|
+
if (this.replaceTimer) {
|
|
85
|
+
clearTimeout(this.replaceTimer);
|
|
86
|
+
}
|
|
87
|
+
var item = this.items[this.items.length - 1];
|
|
88
|
+
if (item !== null && item !== void 0 && item.visible) {
|
|
89
|
+
this.remove(this.counter - 1);
|
|
90
|
+
}
|
|
91
|
+
this.replaceTimer = setTimeout(function() {
|
|
92
|
+
_this.add(props);
|
|
72
93
|
}, 300);
|
|
73
94
|
}
|
|
74
95
|
}, {
|
|
75
96
|
key: "remove",
|
|
76
|
-
value: function(
|
|
77
|
-
var
|
|
78
|
-
|
|
97
|
+
value: function remove(uid) {
|
|
98
|
+
var _this2 = this;
|
|
99
|
+
var item = this.items.find(function(item2) {
|
|
100
|
+
return item2.uid === uid;
|
|
79
101
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
if (item) {
|
|
103
|
+
item.visible = false;
|
|
104
|
+
setTimeout(function() {
|
|
105
|
+
_this2.items = _this2.items.filter(function(item2) {
|
|
106
|
+
return item2.uid !== uid;
|
|
107
|
+
});
|
|
108
|
+
_this2.emit();
|
|
109
|
+
}, 1e3);
|
|
110
|
+
this.emit();
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
85
114
|
}
|
|
86
|
-
}])
|
|
87
|
-
|
|
115
|
+
}]);
|
|
116
|
+
return NoticeBubbleManager2;
|
|
117
|
+
}();
|
|
118
|
+
var noticeBubbleDefaultManager = new NoticeBubbleManager();
|
|
88
119
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
120
|
+
NoticeBubbleManager,
|
|
121
|
+
noticeBubbleDefaultManager as default
|
|
91
122
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { NoticeBubble
|
|
2
|
-
import
|
|
3
|
-
import { NoticeBubbleManager
|
|
1
|
+
import { NoticeBubble, default as default2, NoticeBubbleWarning } from "./NoticeBubble.mjs";
|
|
2
|
+
import noticeBubbleDefaultManager from "./NoticeBubbleManager.mjs";
|
|
3
|
+
import { NoticeBubbleManager } from "./NoticeBubbleManager.mjs";
|
|
4
4
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
NoticeBubble,
|
|
6
|
+
default2 as NoticeBubbleContainer,
|
|
7
|
+
NoticeBubbleManager,
|
|
8
|
+
NoticeBubbleWarning,
|
|
9
|
+
noticeBubbleDefaultManager as default,
|
|
10
|
+
noticeBubbleDefaultManager
|
|
11
11
|
};
|
|
@@ -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
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Schließen";
|
|
2
|
+
const notification = "Benachrichtigungen";
|
|
3
|
+
const de = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
de as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Close";
|
|
2
|
+
const notification = "Notifications";
|
|
3
|
+
const en = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
en as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Cerrar";
|
|
2
|
+
const notification = "Notificaciones";
|
|
3
|
+
const es = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
es as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Fermer";
|
|
2
|
+
const notification = "Notifications";
|
|
3
|
+
const fr = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
fr as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Chiudi";
|
|
2
|
+
const notification = "Notifiche";
|
|
3
|
+
const it = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
it as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "閉じる";
|
|
2
|
+
const notification = "通知";
|
|
3
|
+
const ja = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
ja as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "닫기";
|
|
2
|
+
const notification = "알림";
|
|
3
|
+
const ko = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
ko as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Sluiten";
|
|
2
|
+
const notification = "Meldingen";
|
|
3
|
+
const nl = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
nl as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Zamknij";
|
|
2
|
+
const notification = "Powiadomienia";
|
|
3
|
+
const pl = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
pl as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Fechar";
|
|
2
|
+
const notification = "Notificações";
|
|
3
|
+
const pt = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
pt as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Stäng";
|
|
2
|
+
const notification = "Aviseringar";
|
|
3
|
+
const sv = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
sv as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Kapat";
|
|
2
|
+
const notification = "Bildirimler";
|
|
3
|
+
const tr = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
tr as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "Đóng";
|
|
2
|
+
const notification = "Thông báo";
|
|
3
|
+
const vi = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
vi as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const close = "关闭";
|
|
2
|
+
const notification = "通知";
|
|
3
|
+
const zh = {
|
|
4
|
+
close,
|
|
5
|
+
notification
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
close,
|
|
9
|
+
zh as default,
|
|
10
|
+
notification
|
|
9
11
|
};
|
package/lib/esm/utils.mjs
CHANGED
|
@@ -1,31 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
var Timer = /* @__PURE__ */ function() {
|
|
4
|
+
function Timer2(callback, delay) {
|
|
5
|
+
_classCallCheck(this, Timer2);
|
|
6
|
+
this.callback = callback;
|
|
7
|
+
this.delay = delay;
|
|
8
|
+
this.remaining = delay;
|
|
9
|
+
this.paused = false;
|
|
10
|
+
this.resume();
|
|
6
11
|
}
|
|
7
|
-
|
|
12
|
+
_createClass(Timer2, [{
|
|
8
13
|
key: "pause",
|
|
9
|
-
value: function() {
|
|
10
|
-
clearTimeout(this.timerId)
|
|
14
|
+
value: function pause() {
|
|
15
|
+
clearTimeout(this.timerId);
|
|
16
|
+
this.remaining -= Date.now() - this.start;
|
|
17
|
+
this.paused = true;
|
|
11
18
|
}
|
|
12
19
|
}, {
|
|
13
20
|
key: "resume",
|
|
14
|
-
value: function() {
|
|
15
|
-
this.start = Date.now()
|
|
21
|
+
value: function resume() {
|
|
22
|
+
this.start = Date.now();
|
|
23
|
+
this.paused = false;
|
|
24
|
+
clearTimeout(this.timerId);
|
|
25
|
+
this.timerId = setTimeout(this.callback, this.remaining);
|
|
16
26
|
}
|
|
17
27
|
}, {
|
|
18
28
|
key: "reset",
|
|
19
|
-
value: function() {
|
|
20
|
-
this.remaining = this.delay
|
|
29
|
+
value: function reset() {
|
|
30
|
+
this.remaining = this.delay;
|
|
31
|
+
this.resume();
|
|
21
32
|
}
|
|
22
33
|
}, {
|
|
23
34
|
key: "clear",
|
|
24
|
-
value: function() {
|
|
35
|
+
value: function clear() {
|
|
25
36
|
clearTimeout(this.timerId);
|
|
26
37
|
}
|
|
27
|
-
}])
|
|
38
|
+
}]);
|
|
39
|
+
return Timer2;
|
|
28
40
|
}();
|
|
29
41
|
export {
|
|
30
|
-
|
|
42
|
+
Timer
|
|
31
43
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/notice-bubble",
|
|
3
3
|
"description": "Semrush NoticeBubble Component",
|
|
4
|
-
"version": "16.0.0-prerelease.
|
|
4
|
+
"version": "16.0.0-prerelease.9",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/icon": "16.0.0-prerelease.
|
|
18
|
-
"@semcore/portal": "16.0.0-prerelease.
|
|
19
|
-
"@semcore/flex-box": "16.0.0-prerelease.
|
|
20
|
-
"@semcore/animation": "16.0.0-prerelease.
|
|
21
|
-
"@semcore/button": "16.0.0-prerelease.
|
|
17
|
+
"@semcore/icon": "16.0.0-prerelease.9",
|
|
18
|
+
"@semcore/portal": "16.0.0-prerelease.9",
|
|
19
|
+
"@semcore/flex-box": "16.0.0-prerelease.9",
|
|
20
|
+
"@semcore/animation": "16.0.0-prerelease.9",
|
|
21
|
+
"@semcore/button": "16.0.0-prerelease.9"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@semcore/base-components": "^16.0.0-prerelease.
|
|
24
|
+
"@semcore/base-components": "^16.0.0-prerelease.9"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|