@semcore/notice-bubble 16.1.12-prerelease.1 → 16.2.0-prerelease.0

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 CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [16.2.0] - 2025-11-28
6
+
7
+ ### Added
8
+
9
+ - `containerNode` property to set one common container for all notices
10
+ on the page from different applications.
11
+
5
12
  ## [16.1.12] - 2025-11-17
6
13
 
7
14
  ### Changed
@@ -5,23 +5,23 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = exports.NoticeBubbleWarning = exports.NoticeBubble = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
14
  var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
13
15
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
17
  var _core = require("@semcore/core");
17
- var _animation = require("@semcore/animation");
18
+ var _baseComponents = require("@semcore/base-components");
18
19
  var _button = _interopRequireDefault(require("@semcore/button"));
19
- var _assignProps2 = require("@semcore/core/lib/utils/assignProps");
20
20
  var _i18nEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/i18nEnhance"));
21
21
  var _fire = _interopRequireDefault(require("@semcore/core/lib/utils/fire"));
22
22
  var _getFocusableIn = require("@semcore/core/lib/utils/focus-lock/getFocusableIn");
23
23
  var _isNode = _interopRequireDefault(require("@semcore/core/lib/utils/isNode"));
24
- var _ref5 = require("@semcore/core/lib/utils/ref");
24
+ var _ref7 = require("@semcore/core/lib/utils/ref");
25
25
  var _ThemeProvider = require("@semcore/core/lib/utils/ThemeProvider");
26
26
  var _useFocusLock = require("@semcore/core/lib/utils/use/useFocusLock");
27
27
  var _useCssVariable = require("@semcore/core/lib/utils/useCssVariable");
@@ -33,53 +33,26 @@ var _react = _interopRequireDefault(require("react"));
33
33
  var _NoticeBubbleManager = _interopRequireDefault(require("./NoticeBubbleManager"));
34
34
  var _intergalacticDynamicLocales = require("./translations/__intergalactic-dynamic-locales");
35
35
  var _utils = require("./utils");
36
- var _excluded = ["focusLock"],
37
- _excluded2 = ["forwardRef", "styles", "onMouseEnter", "onMouseLeave", "getI18nText", "icon", "children", "action", "type"];
36
+ var _excluded = ["focusLock"];
38
37
  /*!__reshadow-styles__:"./style/notice-bubble.shadow.css"*/
39
- var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/"@keyframes enter_och9o{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_och9o{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_och9o_gg_,.___SView_och9o_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_och9o_gg_._type_info_och9o_gg_,.___SView_och9o_gg_._type_info_och9o_gg_{background:var(--intergalactic-bg-primary-invert, #191b23)}.___SBubble_och9o_gg_._type_warning_och9o_gg_,.___SView_och9o_gg_._type_warning_och9o_gg_{background:var(--intergalactic-bg-primary-critical, #ff4953)}.___SContent_och9o_gg_{flex-direction:column;gap:var(--intergalactic-spacing-2x, 8px);flex:1}.___SMessage_och9o_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SDismiss_och9o_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_och9o_gg_.__use_och9o_gg_{padding:0 1px}.___SIcon_och9o_gg_{justify-content:center;align-items:center;height:var(--intergalactic-spacing-5x, 20px)}.___SNoticeBubble_och9o_gg_{width:300px;position:fixed;right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_och9o_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SNoticeBubble_och9o_gg_.__disablePortal_och9o_gg_{position:sticky;margin-left:auto;height:0}.___SMessage_och9o_gg_ a{color:var(--intergalactic-text-link-invert, #8ecdff)}.___SNoticeAriaLiveWrapper_och9o_gg_{display:contents}", /*__inner_css_end__*/"och9o_gg_"),
38
+ var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/"@keyframes enter_fiqqt{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_fiqqt{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_fiqqt_gg_,.___SView_fiqqt_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_fiqqt_gg_._type_info_fiqqt_gg_,.___SView_fiqqt_gg_._type_info_fiqqt_gg_{background:var(--intergalactic-bg-primary-invert, #191b23)}.___SBubble_fiqqt_gg_._type_warning_fiqqt_gg_,.___SView_fiqqt_gg_._type_warning_fiqqt_gg_{background:var(--intergalactic-bg-primary-critical, #ff4953)}.___SContent_fiqqt_gg_{flex-direction:column;gap:var(--intergalactic-spacing-2x, 8px);flex:1}.___SMessage_fiqqt_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SDismiss_fiqqt_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_fiqqt_gg_.__use_fiqqt_gg_{padding:0 1px}.___SIcon_fiqqt_gg_{justify-content:center;align-items:center;height:var(--intergalactic-spacing-5x, 20px)}.___SNoticeBubble_fiqqt_gg_{width:300px;position:fixed;right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_fiqqt_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SNoticeBubble_fiqqt_gg_.__disablePortal_fiqqt_gg_{position:sticky;margin-left:auto;height:0}.___SMessage_fiqqt_gg_ a{color:var(--intergalactic-text-link-invert, #8ecdff)}.___SNoticeAriaLiveWrapper_fiqqt_gg_{display:contents}", /*__inner_css_end__*/"fiqqt_gg_"),
40
39
  /*__reshadow_css_end__*/
41
40
  {
42
- "__SContent": "___SContent_och9o_gg_",
43
- "__SMessage": "___SMessage_och9o_gg_",
44
- "__SDismiss": "___SDismiss_och9o_gg_",
45
- "_use": "__use_och9o_gg_",
46
- "__SIcon": "___SIcon_och9o_gg_",
47
- "__SNoticeBubble": "___SNoticeBubble_och9o_gg_",
48
- "_disablePortal": "__disablePortal_och9o_gg_",
49
- "__SNoticeAriaLiveWrapper": "___SNoticeAriaLiveWrapper_och9o_gg_",
50
- "@enter": "enter_och9o",
51
- "@exit": "exit_och9o",
52
- "__SBubble": "___SBubble_och9o_gg_",
53
- "__SView": "___SView_och9o_gg_",
54
- "_type_info": "_type_info_och9o_gg_",
55
- "_type_warning": "_type_warning_och9o_gg_"
41
+ "__SContent": "___SContent_fiqqt_gg_",
42
+ "__SMessage": "___SMessage_fiqqt_gg_",
43
+ "__SDismiss": "___SDismiss_fiqqt_gg_",
44
+ "_use": "__use_fiqqt_gg_",
45
+ "__SIcon": "___SIcon_fiqqt_gg_",
46
+ "__SNoticeBubble": "___SNoticeBubble_fiqqt_gg_",
47
+ "_disablePortal": "__disablePortal_fiqqt_gg_",
48
+ "__SNoticeAriaLiveWrapper": "___SNoticeAriaLiveWrapper_fiqqt_gg_",
49
+ "@enter": "enter_fiqqt",
50
+ "@exit": "exit_fiqqt",
51
+ "__SBubble": "___SBubble_fiqqt_gg_",
52
+ "__SView": "___SView_fiqqt_gg_",
53
+ "_type_info": "_type_info_fiqqt_gg_",
54
+ "_type_warning": "_type_warning_fiqqt_gg_"
56
55
  });
57
- var Notices = function Notices(props) {
58
- var styles = props.styles,
59
- _props$data = props.data,
60
- data = _props$data === void 0 ? [] : _props$data,
61
- _props$tag = props.tag,
62
- SView = _props$tag === void 0 ? ViewInfo : _props$tag;
63
- var ref = _react["default"].useRef();
64
- var durationStr = (0, _useCssVariable.useCssVariable)('--intergalactic-duration-popper', '200', ref);
65
- var duration = _react["default"].useMemo(function () {
66
- return Number.parseInt(durationStr, 10);
67
- }, [durationStr]);
68
- return data.map(function (notice) {
69
- var _ref2, _notice$visible;
70
- return _ref2 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_animation.Animation, _ref2.cn("Animation", {
71
- "key": notice.uid,
72
- "initialAnimation": notice.initialAnimation,
73
- "visible": (_notice$visible = notice.visible) !== null && _notice$visible !== void 0 ? _notice$visible : true,
74
- "duration": duration,
75
- "keyframes": [styles['@enter'], styles['@exit']],
76
- "ref": ref
77
- }), /*#__PURE__*/_react["default"].createElement(SView, _ref2.cn("SView", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, notice), {}, {
78
- "styles": notice.styles || styles,
79
- "getI18nText": props.getI18nText
80
- }))));
81
- });
82
- };
83
56
  var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
84
57
  function NoticeBubbleContainerRoot() {
85
58
  var _this;
@@ -91,6 +64,7 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
91
64
  (0, _defineProperty2["default"])(_this, "_unsubscribe", null);
92
65
  (0, _defineProperty2["default"])(_this, "state", {
93
66
  notices: [],
67
+ infos: [],
94
68
  warnings: []
95
69
  });
96
70
  (0, _defineProperty2["default"])(_this, "componentWillUnmount", function () {
@@ -99,16 +73,10 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
99
73
  }
100
74
  });
101
75
  (0, _defineProperty2["default"])(_this, "handleChange", function (notices) {
102
- var info = notices.filter(function (notice) {
103
- return notice.type === 'info';
104
- });
105
- var warning = notices.filter(function (notice) {
106
- return notice.type === 'warning';
107
- });
108
76
  _this.setState({
109
- notices: info,
110
- warnings: warning
77
+ notices: notices
111
78
  });
79
+ _this.forceUpdate(); // need this, because somehow this component doesn't rerender event if the notices are different
112
80
  });
113
81
  return _this;
114
82
  }
@@ -123,7 +91,7 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
123
91
  value: function render() {
124
92
  var _ref = this.asProps,
125
93
  _ref3;
126
- var SNoticeBubble = _flexBox.Box;
94
+ var SNoticeBubble = _baseComponents.Box;
127
95
  var SNoticeAriaLiveWrapper = 'div';
128
96
  var _this$asProps = this.asProps,
129
97
  Children = _this$asProps.Children,
@@ -131,10 +99,30 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
131
99
  disablePortal = _this$asProps.disablePortal,
132
100
  getI18nText = _this$asProps.getI18nText,
133
101
  ref = _this$asProps.ref,
134
- parentZIndexStacking = _this$asProps.parentZIndexStacking;
135
- var _this$state = this.state,
136
- notices = _this$state.notices,
137
- warnings = _this$state.warnings;
102
+ parentZIndexStacking = _this$asProps.parentZIndexStacking,
103
+ duration = _this$asProps.duration,
104
+ containerNode = _this$asProps.containerNode;
105
+ var notices = this.state.notices;
106
+ if (containerNode) {
107
+ return notices.map(function (notice) {
108
+ var _ref2;
109
+ var SView = notice.type === 'warning' ? ViewWarning : ViewInfo;
110
+ return _ref2 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(PortalForNoticeItem, _ref2.cn("PortalForNoticeItem", (0, _objectSpread2["default"])({
111
+ "key": notice.uid,
112
+ "tag": SView,
113
+ "containerNode": containerNode,
114
+ "animationDuration": duration,
115
+ "styles": styles,
116
+ "getI18nText": getI18nText
117
+ }, notice)));
118
+ });
119
+ }
120
+ var infos = notices.filter(function (notice) {
121
+ return notice.type === 'info';
122
+ });
123
+ var warnings = notices.filter(function (notice) {
124
+ return notice.type === 'warning';
125
+ });
138
126
  return _ref3 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_zIndexStacking.ZIndexStackingContextProvider, _ref3.cn("ZIndexStackingContextProvider", {
139
127
  "designToken": 'z-index-notice-bubble'
140
128
  }), /*#__PURE__*/_react["default"].createElement(_portal["default"], _ref3.cn("Portal", {
@@ -145,25 +133,40 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
145
133
  "role": 'region',
146
134
  "aria-label": getI18nText('notification'),
147
135
  "zIndex": parentZIndexStacking
148
- }, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {})), /*#__PURE__*/_react["default"].createElement(Notices, _ref3.cn("Notices", {
149
- "styles": styles,
150
- "data": warnings,
151
- "tag": ViewWarning,
152
- "getI18nText": getI18nText
153
- })), /*#__PURE__*/_react["default"].createElement(SNoticeAriaLiveWrapper, _ref3.cn("SNoticeAriaLiveWrapper", {
136
+ }, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {})), warnings.map(function (notice) {
137
+ var _ref4;
138
+ var SView = ViewWarning;
139
+ return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SView, _ref4.cn("SView", (0, _objectSpread2["default"])({
140
+ "key": notice.uid,
141
+ "animationDuration": duration,
142
+ "styles": styles,
143
+ "getI18nText": getI18nText
144
+ }, notice)));
145
+ }), /*#__PURE__*/_react["default"].createElement(SNoticeAriaLiveWrapper, _ref3.cn("SNoticeAriaLiveWrapper", {
154
146
  "aria-live": 'polite'
155
- }), /*#__PURE__*/_react["default"].createElement(Notices, _ref3.cn("Notices", {
156
- "styles": styles,
157
- "data": notices,
158
- "tag": ViewInfo,
159
- "getI18nText": getI18nText
160
- }))))));
147
+ }), infos.map(function (notice) {
148
+ var _ref5;
149
+ var SView = ViewInfo;
150
+ return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SView, _ref5.cn("SView", (0, _objectSpread2["default"])({
151
+ "key": notice.uid,
152
+ "animationDuration": duration,
153
+ "styles": styles,
154
+ "getI18nText": getI18nText
155
+ }, notice)));
156
+ })))));
161
157
  }
162
158
  }]);
163
159
  }(_core.Component);
164
160
  (0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "displayName", 'NoticeBubbleContainer');
165
161
  (0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "style", style);
166
- (0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "enhance", [(0, _i18nEnhance["default"])(_intergalacticDynamicLocales.localizedMessages), (0, _ThemeProvider.contextThemeEnhance)(), (0, _zIndexStacking.zIndexStackingEnhance)('z-index-notice-bubble')]);
162
+ (0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "enhance", [(0, _i18nEnhance["default"])(_intergalacticDynamicLocales.localizedMessages), (0, _ThemeProvider.contextThemeEnhance)(), (0, _zIndexStacking.zIndexStackingEnhance)('z-index-notice-bubble'), (0, _useCssVariable.cssVariableEnhance)({
163
+ variable: '--intergalactic-duration-popper',
164
+ fallback: 200,
165
+ map: function map(v) {
166
+ return Number.parseInt(v, 10);
167
+ },
168
+ prop: 'duration'
169
+ })]);
167
170
  (0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "defaultProps", {
168
171
  manager: _NoticeBubbleManager["default"],
169
172
  i18n: _intergalacticDynamicLocales.localizedMessages,
@@ -172,13 +175,42 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
172
175
  var FocusLock = /*#__PURE__*/_react["default"].forwardRef(function (props, outerRef) {
173
176
  var focusLock = props.focusLock,
174
177
  other = (0, _objectWithoutProperties2["default"])(props, _excluded);
175
- var innerRef = _react["default"].useRef();
178
+ var innerRef = _react["default"].useRef(null);
176
179
  (0, _useFocusLock.useFocusLock)(innerRef, false, 'auto', !focusLock, true);
177
- var ref = (0, _ref5.useForkRef)(outerRef, innerRef);
180
+ var ref = (0, _ref7.useForkRef)(outerRef, innerRef);
178
181
  return /*#__PURE__*/_react["default"].createElement(_flexBox.Flex, (0, _extends2["default"])({
179
182
  ref: ref
180
183
  }, other));
181
184
  });
185
+ var PortalForNoticeItem = function PortalForNoticeItem(props) {
186
+ var _React$useState = _react["default"].useState(false),
187
+ _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
188
+ showContent = _React$useState2[0],
189
+ setShowContent = _React$useState2[1];
190
+
191
+ // Show content for info notice in previously mounted node with aria-live polite
192
+ _react["default"].useEffect(function () {
193
+ setTimeout(function () {
194
+ setShowContent(true);
195
+ }, 200);
196
+ }, []);
197
+ var SNoticeAriaLiveWrapper = 'div';
198
+ var Tag = props.tag;
199
+ if (props.type === 'info') {
200
+ return /*#__PURE__*/_react["default"].createElement(_zIndexStacking.ZIndexStackingContextProvider, {
201
+ designToken: "z-index-notice-bubble"
202
+ }, /*#__PURE__*/_react["default"].createElement(_portal["default"], {
203
+ nodeToMount: props.containerNode
204
+ }, /*#__PURE__*/_react["default"].createElement(SNoticeAriaLiveWrapper, {
205
+ "aria-live": "polite"
206
+ }, showContent && /*#__PURE__*/_react["default"].createElement(Tag, props))));
207
+ }
208
+ return /*#__PURE__*/_react["default"].createElement(_zIndexStacking.ZIndexStackingContextProvider, {
209
+ designToken: "z-index-notice-bubble"
210
+ }, /*#__PURE__*/_react["default"].createElement(_portal["default"], {
211
+ nodeToMount: props.containerNode
212
+ }, /*#__PURE__*/_react["default"].createElement(Tag, props)));
213
+ };
182
214
  var ViewInfo = /*#__PURE__*/function (_Component2) {
183
215
  function ViewInfo() {
184
216
  var _this2;
@@ -209,9 +241,10 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
209
241
  _this2.timer.resume();
210
242
  });
211
243
  (0, _defineProperty2["default"])(_this2, "handleBodyMouseMove", function (event) {
212
- var _this2$timer;
244
+ var _this2$timer, _this2$ref$current;
213
245
  if (!((_this2$timer = _this2.timer) !== null && _this2$timer !== void 0 && _this2$timer.paused)) return;
214
- var rect = _this2.ref.current.getBoundingClientRect();
246
+ var rect = (_this2$ref$current = _this2.ref.current) === null || _this2$ref$current === void 0 ? void 0 : _this2$ref$current.getBoundingClientRect();
247
+ if (!rect) return;
215
248
  var mouseInRect = event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
216
249
  if (mouseInRect) return;
217
250
  _this2.timer.resume();
@@ -257,7 +290,7 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
257
290
  }, {
258
291
  key: "render",
259
292
  value: function render() {
260
- var _ref4;
293
+ var _ref6;
261
294
  var SBubble = FocusLock;
262
295
  var SDismiss = _button["default"];
263
296
  var SContent = _flexBox.Flex;
@@ -265,23 +298,30 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
265
298
  var SAction = 'div';
266
299
  var SIcon = _flexBox.Flex;
267
300
  var _this$props = this.props,
268
- forwardRef = _this$props.forwardRef,
269
301
  styles = _this$props.styles,
270
- onMouseEnter = _this$props.onMouseEnter,
271
- onMouseLeave = _this$props.onMouseLeave,
272
302
  getI18nText = _this$props.getI18nText,
303
+ visible = _this$props.visible,
304
+ type = _this$props.type,
305
+ initialAnimation = _this$props.initialAnimation,
306
+ animationDuration = _this$props.animationDuration,
273
307
  icon = _this$props.icon,
274
308
  children = _this$props.children,
275
- actionNode = _this$props.action,
276
- type = _this$props.type,
277
- other = (0, _objectWithoutProperties2["default"])(_this$props, _excluded2);
278
- return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SBubble, _ref4.cn("SBubble", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, other), {}, {
279
- "ref": (0, _ref5.forkRef)(forwardRef, this.ref),
280
- "onMouseEnter": (0, _assignProps2.callAllEventHandlers)(onMouseEnter, this.handleMouseEnter),
281
- "onMouseLeave": (0, _assignProps2.callAllEventHandlers)(onMouseLeave, this.handleMouseLeave),
309
+ action = _this$props.action,
310
+ focusLock = _this$props.focusLock;
311
+ return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_baseComponents.Animation, _ref6.cn("Animation", {
312
+ "initialAnimation": initialAnimation,
313
+ "visible": visible !== null && visible !== void 0 ? visible : true,
314
+ "duration": animationDuration,
315
+ "keyframes": [styles['@enter'], styles['@exit']]
316
+ }), /*#__PURE__*/_react["default"].createElement(SBubble, _ref6.cn("SBubble", {
317
+ "type": type,
318
+ "ref": this.ref,
319
+ "onMouseEnter": this.handleMouseEnter,
320
+ "onMouseLeave": this.handleMouseLeave,
282
321
  "onKeyDown": this.handleKeydown,
283
- "role": type === 'warning' ? 'alert' : this.props.role
284
- })), /*#__PURE__*/_react["default"].createElement(SDismiss, _ref4.cn("SDismiss", {
322
+ "role": type === 'warning' ? 'alert' : undefined,
323
+ "focusLock": focusLock
324
+ }), /*#__PURE__*/_react["default"].createElement(SDismiss, _ref6.cn("SDismiss", {
285
325
  "aria-haspopup": undefined,
286
326
  "type": 'button',
287
327
  "use": 'tertiary',
@@ -296,7 +336,7 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
296
336
  }), /*#__PURE__*/_react["default"].createElement(_button["default"].Addon, {
297
337
  tag: _m["default"],
298
338
  color: "icon-primary-invert"
299
- })), (0, _isNode["default"])(icon) ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(SIcon, _ref4.cn("SIcon", {}), icon), /*#__PURE__*/_react["default"].createElement(SContent, _ref4.cn("SContent", {}), /*#__PURE__*/_react["default"].createElement(SMessage, _ref4.cn("SMessage", {}), children), (0, _isNode["default"])(actionNode) ? /*#__PURE__*/_react["default"].createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null)) : /*#__PURE__*/_react["default"].createElement(SContent, _ref4.cn("SContent", {}), /*#__PURE__*/_react["default"].createElement(SMessage, _ref4.cn("SMessage", {}), children), (0, _isNode["default"])(actionNode) ? /*#__PURE__*/_react["default"].createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null));
339
+ })), (0, _isNode["default"])(icon) ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(SIcon, _ref6.cn("SIcon", {}), icon), /*#__PURE__*/_react["default"].createElement(SContent, _ref6.cn("SContent", {}), /*#__PURE__*/_react["default"].createElement(SMessage, _ref6.cn("SMessage", {}), children), (0, _isNode["default"])(action) ? /*#__PURE__*/_react["default"].createElement(SAction, _ref6.cn("SAction", {}), action) : null)) : /*#__PURE__*/_react["default"].createElement(SContent, _ref6.cn("SContent", {}), /*#__PURE__*/_react["default"].createElement(SMessage, _ref6.cn("SMessage", {}), children), (0, _isNode["default"])(action) ? /*#__PURE__*/_react["default"].createElement(SAction, _ref6.cn("SAction", {}), action) : null)));
300
340
  }
301
341
  }]);
302
342
  }(_core.Component);
@@ -1 +1 @@
1
- {"version":3,"file":"NoticeBubble.js","names":["_core","require","_animation","_button","_interopRequireDefault","_assignProps2","_i18nEnhance","_fire","_getFocusableIn","_isNode","_ref5","_ThemeProvider","_useFocusLock","_useCssVariable","_zIndexStacking","_flexBox","_m","_portal","_react","_NoticeBubbleManager","_intergalacticDynamicLocales","_utils","_excluded","_excluded2","style","sstyled","insert","Notices","props","styles","_props$data","data","_props$tag","tag","SView","ViewInfo","ref","React","useRef","durationStr","useCssVariable","duration","useMemo","Number","parseInt","map","notice","_ref2","_notice$visible","createElement","Animation","cn","uid","initialAnimation","visible","_objectSpread2","getI18nText","NoticeBubbleContainerRoot","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","notices","warnings","_unsubscribe","info","filter","type","warning","setState","_inherits2","_createClass2","key","value","componentDidMount","asProps","manager","addListener","handleChange","render","_ref","_ref3","SNoticeBubble","Box","SNoticeAriaLiveWrapper","_this$asProps","Children","disablePortal","parentZIndexStacking","_this$state","state","ZIndexStackingContextProvider","assignProps","ViewWarning","Component","i18nEnhance","localizedMessages","contextThemeEnhance","zIndexStackingEnhance","i18n","locale","FocusLock","forwardRef","outerRef","focusLock","other","_objectWithoutProperties2","innerRef","useFocusLock","useForkRef","Flex","_extends2","_Component2","_this2","_len2","_key2","createRef","e","fire","clearTimer","handleClose","timer","pause","resume","event","_this2$timer","paused","rect","current","getBoundingClientRect","mouseInRect","clientX","left","right","clientY","top","bottom","_this3","Timer","document","body","addEventListener","handleBodyMouseMove","noticeElement","focusableNodes","getFocusableIn","node","closeButtonRef","setTimeout","setFocus","componentWillUnmount","removeEventListener","clear","_ref4","SBubble","SDismiss","Button","SContent","SMessage","SAction","SIcon","_this$props","onMouseEnter","onMouseLeave","icon","children","actionNode","action","forkRef","callAllEventHandlers","handleMouseEnter","handleMouseLeave","handleKeydown","role","undefined","Addon","CloseIcon","color","isNode","Fragment","_ViewInfo2","NoticeBubbleView","_Component3","_this4","_len3","_key3","_notice","add","remove","componentDidUpdate","update","NoticeBubbleWarningView","_NoticeBubbleView2","NoticeBubbleContainer","createComponent","Info","Warning","NoticeBubble","exports","NoticeBubbleWarning","_default"],"sources":["../../src/NoticeBubble.jsx"],"sourcesContent":["import { Animation } from '@semcore/animation';\nimport Button from '@semcore/button';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport fire from '@semcore/core/lib/utils/fire';\nimport { getFocusableIn } from '@semcore/core/lib/utils/focus-lock/getFocusableIn';\nimport isNode from '@semcore/core/lib/utils/isNode';\nimport { forkRef, useForkRef } from '@semcore/core/lib/utils/ref';\nimport { contextThemeEnhance } from '@semcore/core/lib/utils/ThemeProvider';\nimport { useFocusLock, setFocus } from '@semcore/core/lib/utils/use/useFocusLock';\nimport { useCssVariable } from '@semcore/core/lib/utils/useCssVariable';\nimport {\n ZIndexStackingContextProvider,\n zIndexStackingEnhance,\n} from '@semcore/core/lib/utils/zIndexStacking';\nimport { Flex, Box } from '@semcore/flex-box';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport Portal from '@semcore/portal';\nimport React from 'react';\n\nimport manager from './NoticeBubbleManager';\nimport style from './style/notice-bubble.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport { Timer } from './utils';\n\nconst Notices = (props) => {\n const { styles, data = [], tag: SView = ViewInfo } = props;\n const ref = React.useRef();\n const durationStr = useCssVariable('--intergalactic-duration-popper', '200', ref);\n const duration = React.useMemo(() => Number.parseInt(durationStr, 10), [durationStr]);\n\n return data.map((notice) => {\n return sstyled(styles)(\n <Animation\n key={notice.uid}\n initialAnimation={notice.initialAnimation}\n visible={notice.visible ?? true}\n duration={duration}\n keyframes={[styles['@enter'], styles['@exit']]}\n ref={ref}\n >\n <SView {...notice} styles={notice.styles || styles} getI18nText={props.getI18nText} />\n </Animation>,\n );\n });\n};\n\nclass NoticeBubbleContainerRoot extends Component {\n static displayName = 'NoticeBubbleContainer';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n contextThemeEnhance(),\n zIndexStackingEnhance('z-index-notice-bubble'),\n ];\n\n static defaultProps = {\n manager,\n i18n: localizedMessages,\n locale: 'en',\n };\n\n _unsubscribe = null;\n\n state = {\n notices: [],\n warnings: [],\n };\n\n componentDidMount() {\n this._unsubscribe = this.asProps.manager.addListener(this.handleChange);\n }\n\n componentWillUnmount = () => {\n if (this._unsubscribe) {\n this._unsubscribe();\n }\n };\n\n handleChange = (notices) => {\n const info = notices.filter((notice) => notice.type === 'info');\n const warning = notices.filter((notice) => notice.type === 'warning');\n\n this.setState({ notices: info, warnings: warning });\n };\n\n render() {\n const SNoticeBubble = Root;\n const SNoticeAriaLiveWrapper = 'div';\n const { Children, styles, disablePortal, getI18nText, ref, parentZIndexStacking } =\n this.asProps;\n const { notices, warnings } = this.state;\n\n return sstyled(styles)(\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal disablePortal={disablePortal}>\n <SNoticeBubble\n render={Box}\n ref={ref}\n tag='section'\n role='region'\n aria-label={getI18nText('notification')}\n zIndex={parentZIndexStacking}\n >\n <Children />\n <Notices styles={styles} data={warnings} tag={ViewWarning} getI18nText={getI18nText} />\n <SNoticeAriaLiveWrapper aria-live='polite'>\n <Notices styles={styles} data={notices} tag={ViewInfo} getI18nText={getI18nText} />\n </SNoticeAriaLiveWrapper>\n </SNoticeBubble>\n </Portal>\n </ZIndexStackingContextProvider>,\n );\n }\n}\n\nconst FocusLock = React.forwardRef((props, outerRef) => {\n const { focusLock, ...other } = props;\n const innerRef = React.useRef();\n useFocusLock(innerRef, false, 'auto', !focusLock, true);\n const ref = useForkRef(outerRef, innerRef);\n\n return <Flex ref={ref} {...other} />;\n});\n\nclass ViewInfo extends Component {\n timer = null;\n ref = React.createRef();\n closeButtonRef = React.createRef();\n\n componentDidMount() {\n const { duration } = this.props;\n if (duration) {\n this.timer = new Timer(this.handleClose, duration);\n document.body.addEventListener('mousemove', this.handleBodyMouseMove);\n }\n\n const noticeElement = this.ref.current;\n\n if (noticeElement) {\n const focusableNodes = getFocusableIn(noticeElement).filter(\n (node) => node !== this.closeButtonRef.current,\n );\n\n if (focusableNodes.length > 0) {\n setTimeout(() => setFocus(noticeElement), 0);\n }\n }\n }\n\n componentWillUnmount() {\n this.clearTimer();\n document.body.removeEventListener('mousemove', this.handleBodyMouseMove);\n }\n\n clearTimer() {\n if (this.timer) {\n this.timer.clear();\n this.timer = null;\n }\n }\n\n handleClose = (e) => {\n // because it might be called not only from the close icon click\n fire(this, 'onClose', e);\n this.clearTimer();\n };\n\n handleKeydown = (e) => {\n if (e.key === 'Escape') {\n this.handleClose(e);\n }\n };\n\n handleMouseEnter = () => {\n if (!this.timer) return;\n this.timer.pause();\n };\n\n handleMouseLeave = () => {\n if (!this.timer) return;\n this.timer.resume();\n };\n\n handleBodyMouseMove = (event) => {\n if (!this.timer?.paused) return;\n const rect = this.ref.current.getBoundingClientRect();\n const mouseInRect =\n event.clientX >= rect.left &&\n event.clientX <= rect.right &&\n event.clientY >= rect.top &&\n event.clientY <= rect.bottom;\n if (mouseInRect) return;\n this.timer.resume();\n };\n\n render() {\n const SBubble = FocusLock;\n const SDismiss = Button;\n const SContent = Flex;\n const SMessage = 'div';\n const SAction = 'div';\n const SIcon = Flex;\n const {\n forwardRef,\n styles,\n onMouseEnter,\n onMouseLeave,\n getI18nText,\n icon,\n children,\n action: actionNode,\n type,\n ...other\n } = this.props;\n\n return sstyled(styles)(\n <SBubble\n {...other}\n ref={forkRef(forwardRef, this.ref)}\n onMouseEnter={callAllEventHandlers(onMouseEnter, this.handleMouseEnter)}\n onMouseLeave={callAllEventHandlers(onMouseLeave, this.handleMouseLeave)}\n onKeyDown={this.handleKeydown}\n role={type === 'warning' ? 'alert' : this.props.role}\n >\n <SDismiss\n aria-haspopup={undefined}\n type='button'\n use='tertiary'\n size='m'\n theme='invert'\n onClick={this.handleClose}\n aria-label={getI18nText('close')}\n active={false}\n title={getI18nText('close')}\n ref={this.closeButtonRef}\n data-hide-focus-hover-popper='true'\n >\n <Button.Addon tag={CloseIcon} color='icon-primary-invert' />\n </SDismiss>\n\n {isNode(icon)\n ? (\n <>\n <SIcon>{icon}</SIcon>\n <SContent>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SContent>\n </>\n )\n : (\n <SContent>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SContent>\n )}\n </SBubble>,\n );\n }\n}\n\nclass ViewWarning extends ViewInfo {\n static defaultProps = {\n type: 'warning',\n duration: 0,\n };\n}\n\nclass NoticeBubbleView extends Component {\n static defaultProps = {\n duration: 5000,\n type: 'info',\n manager,\n };\n\n _notice = null;\n\n componentDidMount() {\n this._notice = this.asProps.manager.add(this.asProps);\n }\n\n componentWillUnmount() {\n if (this._notice) {\n this._notice.remove();\n }\n }\n\n componentDidUpdate() {\n if (this._notice) {\n this._notice.update(this.asProps);\n }\n }\n\n render() {\n return null;\n }\n}\n\nclass NoticeBubbleWarningView extends NoticeBubbleView {\n static defaultProps = {\n duration: 5000,\n type: 'warning',\n manager,\n };\n}\n\nconst NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {\n Info: NoticeBubbleView,\n Warning: NoticeBubbleWarningView,\n});\n\nconst NoticeBubble = NoticeBubbleContainer.Info;\nconst NoticeBubbleWarning = NoticeBubbleContainer.Warning;\n\nexport { NoticeBubble, NoticeBubbleWarning };\n\nexport default NoticeBubbleContainer;\n"],"mappings":";;;;;;;;;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,a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H,gBAAgB,kBACE;EACpBpJ,QAAQ,EAAE,IAAI;EACdkC,IAAI,EAAE,MAAM;EACZS,OAAO,EAAPA;AACF,CAAC;AAAA,IAyBGmH,uBAAuB,0BAAAC,kBAAA;EAAA,SAAAD,wBAAA;IAAA,IAAA3I,gBAAA,mBAAA2I,uBAAA;IAAA,WAAApI,WAAA,mBAAAoI,uBAAA,EAAAzI,SAAA;EAAA;EAAA,IAAAgB,UAAA,aAAAyH,uBAAA,EAAAC,kBAAA;EAAA,WAAAzH,aAAA,aAAAwH,uBAAA;AAAA,EAASV,gBAAgB;AAAA,IAAAxH,gBAAA,aAAhDkI,uBAAuB,kBACL;EACpB9J,QAAQ,EAAE,IAAI;EACdkC,IAAI,EAAE,SAAS;EACfS,OAAO,EAAPA;AACF,CAAC;AAGH,IAAMqH,qBAAqB,GAAG,IAAAC,qBAAe,EAACjJ,yBAAyB,EAAE;EACvEkJ,IAAI,EAAEd,gBAAgB;EACtBe,OAAO,EAAEL;AACX,CAAC,CAAC;AAEF,IAAMM,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAGJ,qBAAqB,CAACE,IAAI;AAC/C,IAAMI,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAGN,qBAAqB,CAACG,OAAO;AAAC,IAAAI,QAAA,GAAAF,OAAA,cAI3CL,qBAAqB","ignoreList":[]}
1
+ {"version":3,"file":"NoticeBubble.js","names":["_core","require","_baseComponents","_button","_interopRequireDefault","_i18nEnhance","_fire","_getFocusableIn","_isNode","_ref7","_ThemeProvider","_useFocusLock","_useCssVariable","_zIndexStacking","_flexBox","_m","_portal","_react","_NoticeBubbleManager","_intergalacticDynamicLocales","_utils","_excluded","style","sstyled","insert","NoticeBubbleContainerRoot","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","notices","infos","warnings","_unsubscribe","setState","forceUpdate","_inherits2","_createClass2","key","value","componentDidMount","asProps","manager","addListener","handleChange","render","_ref","_ref3","SNoticeBubble","Box","SNoticeAriaLiveWrapper","_this$asProps","Children","styles","disablePortal","getI18nText","ref","parentZIndexStacking","duration","containerNode","state","map","notice","_ref2","SView","type","ViewWarning","ViewInfo","createElement","PortalForNoticeItem","cn","_objectSpread2","uid","filter","ZIndexStackingContextProvider","assignProps","_ref4","_ref5","Component","i18nEnhance","localizedMessages","contextThemeEnhance","zIndexStackingEnhance","cssVariableEnhance","variable","fallback","v","Number","parseInt","prop","i18n","locale","FocusLock","React","forwardRef","props","outerRef","focusLock","other","_objectWithoutProperties2","innerRef","useRef","useFocusLock","useForkRef","Flex","_extends2","_React$useState","useState","_React$useState2","_slicedToArray2","showContent","setShowContent","useEffect","setTimeout","Tag","tag","designToken","nodeToMount","_Component2","_this2","_len2","_key2","createRef","e","fire","clearTimer","handleClose","timer","pause","resume","event","_this2$timer","_this2$ref$current","paused","rect","current","getBoundingClientRect","mouseInRect","clientX","left","right","clientY","top","bottom","_this3","Timer","document","body","addEventListener","handleBodyMouseMove","noticeElement","focusableNodes","getFocusableIn","node","closeButtonRef","setFocus","componentWillUnmount","removeEventListener","clear","_ref6","SBubble","SDismiss","Button","SContent","SMessage","SAction","SIcon","_this$props","visible","initialAnimation","animationDuration","icon","children","action","Animation","handleMouseEnter","handleMouseLeave","handleKeydown","undefined","Addon","CloseIcon","color","isNode","Fragment","_ViewInfo2","NoticeBubbleView","_Component3","_this4","_len3","_key3","_notice","add","remove","componentDidUpdate","update","NoticeBubbleWarningView","_NoticeBubbleView2","NoticeBubbleContainer","createComponent","Info","Warning","NoticeBubble","exports","NoticeBubbleWarning","_default"],"sources":["../../src/NoticeBubble.tsx"],"sourcesContent":["import { Animation, Box } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport type { Intergalactic } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport fire from '@semcore/core/lib/utils/fire';\nimport { getFocusableIn } from '@semcore/core/lib/utils/focus-lock/getFocusableIn';\nimport isNode from '@semcore/core/lib/utils/isNode';\nimport type { NodeByRef } from '@semcore/core/lib/utils/ref';\nimport { useForkRef } from '@semcore/core/lib/utils/ref';\nimport { contextThemeEnhance } from '@semcore/core/lib/utils/ThemeProvider';\nimport { useFocusLock, setFocus } from '@semcore/core/lib/utils/use/useFocusLock';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport {\n ZIndexStackingContextProvider,\n zIndexStackingEnhance,\n} from '@semcore/core/lib/utils/zIndexStacking';\nimport { Flex } from '@semcore/flex-box';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport Portal from '@semcore/portal';\nimport React from 'react';\n\nimport type {\n AddedNoticeMeta,\n NoticeBubbleContainerProps,\n NoticeBubbleProps,\n NoticeBubbleViewItemProps, NoticeBubbleWarningProps,\n} from './NoticeBubble.type';\nimport type { NoticeBubbleManager, NoticeItem } from './NoticeBubbleManager';\nimport manager from './NoticeBubbleManager';\nimport style from './style/notice-bubble.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport { Timer } from './utils';\n\ntype State = {\n notices: NoticeItem[];\n infos: NoticeItem[];\n warnings: NoticeItem[];\n};\n\nclass NoticeBubbleContainerRoot extends Component<NoticeBubbleContainerProps, {}, State, typeof NoticeBubbleContainerRoot.enhance, typeof NoticeBubbleContainerRoot.defaultProps> {\n static displayName = 'NoticeBubbleContainer';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n contextThemeEnhance(),\n zIndexStackingEnhance('z-index-notice-bubble'),\n cssVariableEnhance<'duration', number, number>({\n variable: '--intergalactic-duration-popper',\n fallback: 200,\n map: (v: string) => Number.parseInt(v, 10),\n prop: 'duration',\n }),\n ] as const;\n\n static defaultProps = {\n manager,\n i18n: localizedMessages,\n locale: 'en',\n } as const;\n\n _unsubscribe: (() => void) | null = null;\n\n state: State = {\n notices: [],\n infos: [],\n warnings: [],\n };\n\n componentDidMount() {\n this._unsubscribe = this.asProps.manager.addListener(this.handleChange);\n }\n\n componentWillUnmount = () => {\n if (this._unsubscribe) {\n this._unsubscribe();\n }\n };\n\n handleChange = (notices: NoticeItem[]) => {\n this.setState({ notices });\n this.forceUpdate(); // need this, because somehow this component doesn't rerender event if the notices are different\n };\n\n render() {\n const SNoticeBubble = Root;\n const SNoticeAriaLiveWrapper = 'div';\n const { Children, styles, disablePortal, getI18nText, ref, parentZIndexStacking, duration, containerNode } =\n this.asProps;\n const { notices } = this.state;\n\n if (containerNode) {\n return notices.map((notice) => {\n const SView = notice.type === 'warning' ? ViewWarning : ViewInfo;\n\n return sstyled(styles)(\n <PortalForNoticeItem\n key={notice.uid}\n tag={SView}\n containerNode={containerNode}\n animationDuration={duration}\n styles={styles}\n getI18nText={getI18nText}\n {...notice}\n />,\n );\n });\n }\n\n const infos = notices.filter((notice) => notice.type === 'info');\n const warnings = notices.filter((notice) => notice.type === 'warning');\n\n return sstyled(styles)(\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal disablePortal={disablePortal}>\n <SNoticeBubble\n render={Box}\n ref={ref}\n tag='section'\n role='region'\n aria-label={getI18nText('notification')}\n zIndex={parentZIndexStacking}\n >\n <Children />\n {warnings.map((notice) => {\n const SView = ViewWarning;\n return sstyled(styles)(\n <SView\n key={notice.uid}\n animationDuration={duration}\n styles={styles}\n getI18nText={getI18nText}\n {...notice}\n />,\n );\n })}\n <SNoticeAriaLiveWrapper aria-live='polite'>\n {infos.map((notice) => {\n const SView = ViewInfo;\n return sstyled(styles)(\n <SView\n key={notice.uid}\n animationDuration={duration}\n styles={styles}\n getI18nText={getI18nText}\n {...notice}\n />,\n );\n })}\n </SNoticeAriaLiveWrapper>\n </SNoticeBubble>\n </Portal>\n </ZIndexStackingContextProvider>,\n );\n }\n}\n\nconst FocusLock = React.forwardRef((props: any, outerRef: React.ForwardedRef<HTMLDivElement>) => {\n const { focusLock, ...other } = props;\n const innerRef = React.useRef<HTMLDivElement | null>(null);\n useFocusLock(innerRef, false, 'auto', !focusLock, true);\n const ref = useForkRef(outerRef, innerRef);\n\n return <Flex ref={ref} {...other} />;\n});\n\nconst PortalForNoticeItem = (props: NoticeBubbleViewItemProps & { containerNode: NodeByRef; tag: typeof ViewInfo }) => {\n const [showContent, setShowContent] = React.useState(false);\n\n // Show content for info notice in previously mounted node with aria-live polite\n React.useEffect(() => {\n setTimeout(() => {\n setShowContent(true);\n }, 200);\n }, []);\n\n const SNoticeAriaLiveWrapper = 'div';\n const Tag = props.tag;\n\n if (props.type === 'info') {\n return (\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal nodeToMount={props.containerNode}>\n <SNoticeAriaLiveWrapper aria-live='polite'>\n {showContent && <Tag {...props} />}\n </SNoticeAriaLiveWrapper>\n </Portal>\n </ZIndexStackingContextProvider>\n );\n }\n\n return (\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal nodeToMount={props.containerNode}>\n <Tag {...props} />\n </Portal>\n </ZIndexStackingContextProvider>\n );\n};\n\nclass ViewInfo extends Component<NoticeBubbleViewItemProps> {\n timer: Timer | null = null;\n ref = React.createRef<HTMLDivElement>();\n closeButtonRef = React.createRef<HTMLButtonElement>();\n\n componentDidMount() {\n const { duration } = this.props;\n if (duration) {\n this.timer = new Timer(this.handleClose, duration);\n document.body.addEventListener('mousemove', this.handleBodyMouseMove);\n }\n\n const noticeElement = this.ref.current;\n\n if (noticeElement) {\n const focusableNodes = getFocusableIn(noticeElement).filter(\n (node) => node !== this.closeButtonRef.current,\n );\n\n if (focusableNodes.length > 0) {\n setTimeout(() => setFocus(noticeElement), 0);\n }\n }\n }\n\n componentWillUnmount() {\n this.clearTimer();\n document.body.removeEventListener('mousemove', this.handleBodyMouseMove);\n }\n\n clearTimer() {\n if (this.timer) {\n this.timer.clear();\n this.timer = null;\n }\n }\n\n handleClose = (e: React.SyntheticEvent) => {\n // because it might be called not only from the close icon click\n fire(this, 'onClose', e);\n this.clearTimer();\n };\n\n handleKeydown = (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n this.handleClose(e);\n }\n };\n\n handleMouseEnter = () => {\n if (!this.timer) return;\n this.timer.pause();\n };\n\n handleMouseLeave = () => {\n if (!this.timer) return;\n this.timer.resume();\n };\n\n handleBodyMouseMove = (event: MouseEvent) => {\n if (!this.timer?.paused) return;\n const rect = this.ref.current?.getBoundingClientRect();\n if (!rect) return;\n const mouseInRect =\n event.clientX >= rect.left &&\n event.clientX <= rect.right &&\n event.clientY >= rect.top &&\n event.clientY <= rect.bottom;\n if (mouseInRect) return;\n this.timer.resume();\n };\n\n render() {\n const SBubble = FocusLock;\n const SDismiss = Button;\n const SContent = Flex;\n const SMessage = 'div';\n const SAction = 'div';\n const SIcon = Flex;\n const {\n styles,\n getI18nText,\n visible,\n type,\n initialAnimation,\n animationDuration,\n icon,\n children,\n action,\n focusLock,\n } = this.props;\n\n return sstyled(styles)(\n <Animation\n initialAnimation={initialAnimation}\n visible={visible ?? true}\n duration={animationDuration}\n // @ts-ignore\n keyframes={[styles['@enter'], styles['@exit']]}\n >\n <SBubble\n type={type}\n ref={this.ref}\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n onKeyDown={this.handleKeydown}\n role={type === 'warning' ? 'alert' : undefined}\n focusLock={focusLock}\n >\n <SDismiss\n aria-haspopup={undefined}\n type='button'\n use='tertiary'\n size='m'\n theme='invert'\n onClick={this.handleClose}\n aria-label={getI18nText('close')}\n active={false}\n title={getI18nText('close')}\n ref={this.closeButtonRef}\n data-hide-focus-hover-popper='true'\n >\n <Button.Addon tag={CloseIcon} color='icon-primary-invert' />\n </SDismiss>\n\n {isNode(icon)\n ? (\n <>\n <SIcon>{icon}</SIcon>\n <SContent>\n <SMessage>{children}</SMessage>\n {isNode(action) ? <SAction>{action}</SAction> : null}\n </SContent>\n </>\n )\n : (\n <SContent>\n <SMessage>{children}</SMessage>\n {isNode(action) ? <SAction>{action}</SAction> : null}\n </SContent>\n )}\n </SBubble>\n </Animation>,\n );\n }\n}\n\nclass ViewWarning extends ViewInfo {\n static defaultProps = {\n type: 'warning',\n duration: 0,\n };\n}\n\nclass NoticeBubbleView extends Component<{ manager: NoticeBubbleManager } & (NoticeBubbleProps | NoticeBubbleWarningProps)> {\n static defaultProps = {\n duration: 5000,\n type: 'info',\n manager,\n };\n\n _notice: null | AddedNoticeMeta = null;\n\n componentDidMount() {\n this._notice = this.asProps.manager.add(this.asProps);\n }\n\n componentWillUnmount() {\n if (this._notice) {\n this._notice.remove();\n }\n }\n\n componentDidUpdate() {\n if (this._notice) {\n this._notice.update(this.asProps);\n }\n }\n\n render() {\n return null;\n }\n}\n\nclass NoticeBubbleWarningView extends NoticeBubbleView {\n static defaultProps = {\n duration: 5000,\n type: 'warning',\n manager,\n };\n}\n\nconst NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {\n Info: NoticeBubbleView,\n Warning: NoticeBubbleWarningView,\n}) as Intergalactic.Component<'div', NoticeBubbleContainerProps> & {\n Info: typeof NoticeBubbleView;\n Warning: typeof NoticeBubbleWarningView;\n};\n\nconst NoticeBubble = NoticeBubbleContainer.Info;\nconst NoticeBubbleWarning = NoticeBubbleContainer.Warning;\n\nexport { NoticeBubble, NoticeBubbleWarning };\n\nexport default NoticeBubbleContainer;\n"],"mappings":";;;;;;;;;;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAGA,IAAAI,YAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAEA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,eAAA,GAA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c,UAAA,aAAA+J,uBAAA,EAAAC,kBAAA;EAAA,WAAA/J,aAAA,aAAA8J,uBAAA;AAAA,EAASV,gBAAgB;AAAA,IAAA5J,gBAAA,aAAhDsK,uBAAuB,kBACL;EACpBzI,QAAQ,EAAE,IAAI;EACdO,IAAI,EAAE,SAAS;EACfvB,OAAO,EAAPA;AACF,CAAC;AAGH,IAAM2J,qBAAqB,GAAG,IAAAC,qBAAe,EAACrL,yBAAyB,EAAE;EACvEsL,IAAI,EAAEd,gBAAgB;EACtBe,OAAO,EAAEL;AACX,CAAC,CAGA;AAED,IAAMM,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAGJ,qBAAqB,CAACE,IAAI;AAC/C,IAAMI,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAGN,qBAAqB,CAACG,OAAO;AAAC,IAAAI,QAAA,GAAAF,OAAA,cAI3CL,qBAAqB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=NoticeBubble.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoticeBubble.type.js","names":[],"sources":["../../src/NoticeBubble.type.ts"],"sourcesContent":["import type { PortalProps, BoxProps } from '@semcore/base-components';\nimport type { UnknownProperties, Intergalactic } from '@semcore/core';\nimport type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';\nimport type { NodeByRef } from '@semcore/core/lib/utils/ref';\nimport type { RefObject } from 'react';\n\n/** @deprecated */\nexport interface INoticeBubbleContainerProps\n extends NoticeBubbleContainerProps,\n UnknownProperties {}\n\n/**\n * @deprecated. Pass noticeBubbleContainer property from window.sm2.getNoticeBubbleContainer()\n */\nexport type NoticeBubbleContainerPortalProps = PortalProps;\n\nexport type NoticeBubbleContainerProps = BoxProps &\n NoticeBubbleContainerPortalProps & {\n /** Ref or element to mount bubbles in. You should use element form window.sm2.getNoticeBubbleContainer() */\n containerNode?: NodeByRef;\n /** Manager copy */\n manager?: NoticeBubbleManagerClass;\n /** Specifies the locale for i18n support */\n locale?: string;\n };\n\nexport type NoticeBubbleViewItemProps = NoticeBubbleProps & {\n containerNode?: NodeByRef;\n animationDuration: number;\n getI18nText: ReturnType<typeof useI18n>;\n styles: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement> | undefined;\n};\n\n/** @deprecated */\nexport interface INoticeBubbleProps extends NoticeBubbleProps, UnknownProperties {}\nexport type NoticeBubbleProps = BoxProps & {\n /** Notice type */\n type?: 'info' | 'warning';\n /**\n * Notice display duration. Set to 0 to disable auto-close.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n /**\n * Use it for complex notices with important controls.\n * If enabled, browser focus will be locked in the notice\n * until it's closed. After close focus should return to the element\n * where it was placed before notice appear.\n */\n focusLock?: boolean;\n /**\n * Notice visibility.\n */\n visible?: boolean;\n /**\n * Control under the notice children.\n * */\n action?: React.ReactNode;\n /**\n * Callback triggered by \"Close\" icon click.\n * */\n onClose?: (e?: React.SyntheticEvent) => void;\n /**\n * Notice content.\n * */\n children?: React.ReactNode;\n manager?: NoticeBubbleManagerClass;\n icon?: React.ReactElement;\n};\n/** @deprecated */\nexport interface INoticeBubbleInfoProps extends NoticeBubbleInfoProps, UnknownProperties {}\nexport type NoticeBubbleInfoProps = NoticeBubbleProps & {\n readonly type?: 'info';\n};\n\n/** @deprecated */\nexport interface INoticeBubbleWarningProps extends NoticeBubbleWarningProps, UnknownProperties {}\nexport type NoticeBubbleWarningProps = NoticeBubbleProps & {\n readonly type?: 'warning';\n};\n\nexport type AddedNoticeMeta = {\n uid: number;\n update: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => boolean;\n remove: () => boolean;\n ref: RefObject<HTMLElement>;\n focus: () => void;\n};\n\n/** @deprecated */\nexport interface INoticeBubbleManager extends NoticeBubbleManagerClass, UnknownProperties {}\nexport type NoticeBubbleManagerClass = {\n /**\n * Creates and shows a notice.\n * */\n add: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => AddedNoticeMeta;\n /**\n * Updates notice by uid.\n * @deprecated use replace instead.\n */\n update: (uid: number, props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>) => boolean;\n /**\n * Removes notice by uid.\n * */\n remove: (uid: number) => boolean;\n /**\n * Replace notice by uid.\n */\n replace: (uid: number, props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;\n /**\n * Replace last notice (if it is existing)\n */\n replaceLast: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;\n};\n\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\nexport declare const NoticeBubble: Intergalactic.Component<'div', NoticeBubbleInfoProps>;\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\nexport declare const NoticeBubbleWarning: Intergalactic.Component<'div', NoticeBubbleWarningProps>;\nexport declare const NoticeBubbleContainer: Intergalactic.Component<\n 'div',\n NoticeBubbleContainerProps\n> & {\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Info: typeof NoticeBubble;\n\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Warning: typeof NoticeBubbleWarning;\n};\n"],"mappings":"","ignoreList":[]}