@semcore/notice-bubble 5.55.0-prerelease.0 → 5.55.0-prerelease.4

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.
Files changed (43) hide show
  1. package/lib/cjs/NoticeBubble.js +217 -177
  2. package/lib/cjs/NoticeBubble.js.map +1 -1
  3. package/lib/cjs/NoticeBubbleManager.js +56 -34
  4. package/lib/cjs/NoticeBubbleManager.js.map +1 -1
  5. package/lib/cjs/index.d.js +2 -0
  6. package/lib/cjs/index.d.js.map +1 -0
  7. package/lib/cjs/index.js +4 -1
  8. package/lib/cjs/index.js.map +1 -1
  9. package/lib/cjs/style/notice-bubble.shadow.css +1 -1
  10. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
  11. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
  12. package/lib/cjs/utils.js +9 -20
  13. package/lib/cjs/utils.js.map +1 -1
  14. package/lib/es6/NoticeBubble.js +207 -170
  15. package/lib/es6/NoticeBubble.js.map +1 -1
  16. package/lib/es6/NoticeBubbleManager.js +51 -31
  17. package/lib/es6/NoticeBubbleManager.js.map +1 -1
  18. package/lib/es6/index.d.js +2 -0
  19. package/lib/es6/index.d.js.map +1 -0
  20. package/lib/es6/index.js +2 -1
  21. package/lib/es6/index.js.map +1 -1
  22. package/lib/es6/style/notice-bubble.shadow.css +1 -1
  23. package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
  24. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
  25. package/lib/es6/utils.js +6 -18
  26. package/lib/es6/utils.js.map +1 -1
  27. package/lib/esm/NoticeBubble.mjs +215 -175
  28. package/lib/esm/NoticeBubbleManager.mjs +53 -33
  29. package/lib/esm/index.mjs +7 -3
  30. package/lib/esm/style/notice-bubble.shadow.css +1 -1
  31. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
  32. package/lib/esm/utils.mjs +8 -20
  33. package/lib/types/index.d.ts +167 -7
  34. package/package.json +9 -9
  35. package/lib/cjs/NoticeBubble.type.js +0 -2
  36. package/lib/cjs/NoticeBubble.type.js.map +0 -1
  37. package/lib/es6/NoticeBubble.type.js +0 -2
  38. package/lib/es6/NoticeBubble.type.js.map +0 -1
  39. package/lib/types/NoticeBubble.d.ts +0 -4
  40. package/lib/types/NoticeBubble.type.d.ts +0 -91
  41. package/lib/types/NoticeBubbleManager.d.ts +0 -22
  42. package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +0 -58
  43. package/lib/types/utils.d.ts +0 -14
@@ -1,80 +1,118 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
5
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
6
4
  import _createClass from "@babel/runtime/helpers/createClass";
7
- import _callSuper from "@babel/runtime/helpers/callSuper";
5
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
8
6
  import _inherits from "@babel/runtime/helpers/inherits";
7
+ import _createSuper from "@babel/runtime/helpers/createSuper";
9
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
- import { sstyled as _sstyled } from "@semcore/core";
9
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
10
+ import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
11
11
  import { assignProps as _assignProps } from "@semcore/core";
12
- var _excluded = ["focusLock"];
13
- import { Animation, Box, Flex, Portal } from '@semcore/base-components';
14
- import Button from '@semcore/button';
15
- import { createComponent, Component, sstyled, Root } from '@semcore/core';
16
- import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
17
- import fire from '@semcore/core/lib/utils/fire';
18
- import { getFocusableIn } from '@semcore/core/lib/utils/focus-lock/getFocusableIn';
19
- import isNode from '@semcore/core/lib/utils/isNode';
20
- import { useForkRef } from '@semcore/core/lib/utils/ref';
21
- import { contextThemeEnhance } from '@semcore/core/lib/utils/ThemeProvider';
22
- import { useFocusLock, setFocus } from '@semcore/core/lib/utils/use/useFocusLock';
23
- import { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';
24
- import { ZIndexStackingContextProvider, zIndexStackingEnhance } from '@semcore/core/lib/utils/zIndexStacking';
25
- import CloseIcon from '@semcore/icon/Close/m';
12
+ var _excluded = ["focusLock"],
13
+ _excluded2 = ["forwardRef", "styles", "onMouseEnter", "onMouseLeave", "getI18nText", "icon", "children", "action", "type"];
26
14
  import React from 'react';
15
+ import Portal from '@semcore/portal';
27
16
  import manager from './NoticeBubbleManager';
17
+ import createComponent, { Component, sstyled, Root } from '@semcore/core';
18
+ import { Animation } from '@semcore/animation';
19
+ import { Flex, Box } from '@semcore/flex-box';
20
+ import fire from '@semcore/utils/lib/fire';
21
+ import isNode from '@semcore/utils/lib/isNode';
22
+ import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
23
+ import CloseIcon from '@semcore/icon/Close/m';
24
+ import { Timer } from './utils';
25
+ import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
26
+ import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
27
+ import { useCssVariable } from '@semcore/utils/lib/useCssVariable';
28
+ import { contextThemeEnhance } from '@semcore/utils/lib/ThemeProvider';
29
+ import Button from '@semcore/button';
30
+ import { useFocusLock } from '@semcore/utils/lib/use/useFocusLock';
31
+ import { Hint } from '@semcore/tooltip';
32
+ import { ZIndexStackingContextProvider, zIndexStackingEnhance } from '@semcore/utils/lib/zIndexStacking';
28
33
  /*!__reshadow-styles__:"./style/notice-bubble.shadow.css"*/
29
- var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes enter_19cf4{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_19cf4{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_19cf4_gg_,.___SView_19cf4_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, rgba(254, 255, 255, 0.949));gap:var(--intergalactic-spacing-2x, 8px)}.___SBubble_19cf4_gg_._type_info_19cf4_gg_,.___SView_19cf4_gg_._type_info_19cf4_gg_{background:var(--intergalactic-bg-primary-invert, rgb(26, 30, 26))}.___SBubble_19cf4_gg_._type_warning_19cf4_gg_,.___SView_19cf4_gg_._type_warning_19cf4_gg_{background:var(--intergalactic-bg-primary-critical, rgb(247, 55, 64))}.___SContent_19cf4_gg_{flex-direction:column;gap:var(--intergalactic-spacing-2x, 8px);flex:1}.___SMessage_19cf4_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SDismiss_19cf4_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_19cf4_gg_.__use_19cf4_gg_{padding:0 1px}.___SIcon_19cf4_gg_{justify-content:center;align-items:center;height:var(--intergalactic-spacing-5x, 20px)}.___SNoticeBubble_19cf4_gg_{width:300px;position:fixed;right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_19cf4_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SNoticeBubble_19cf4_gg_.__disablePortal_19cf4_gg_{position:sticky;margin-left:auto;height:0}.___SMessage_19cf4_gg_ a{color:var(--intergalactic-text-link-invert, rgb(135, 171, 255))}@supports (color:color(display-p3 0 0 0%)){.___SMessage_19cf4_gg_ a{color:var(--intergalactic-text-link-invert, rgb(135, 171, 255))}@media (color-gamut:p3){.___SMessage_19cf4_gg_ a{color:var(--intergalactic-text-link-invert, color(display-p3 0.55796 0.66814 0.97583))}}}.___SNoticeAriaLiveWrapper_19cf4_gg_{display:contents}", /*__inner_css_end__*/"19cf4_gg_"),
34
+ var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes enter_7ow1n{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_7ow1n{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_7ow1n_gg_,.___SView_7ow1n_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, rgba(254, 255, 255, 0.949));gap:var(--intergalactic-spacing-2x, 8px)}.___SBubble_7ow1n_gg_._type_info_7ow1n_gg_,.___SView_7ow1n_gg_._type_info_7ow1n_gg_{background:var(--intergalactic-bg-primary-invert, rgb(26, 30, 26))}.___SBubble_7ow1n_gg_._type_warning_7ow1n_gg_,.___SView_7ow1n_gg_._type_warning_7ow1n_gg_{background:var(--intergalactic-bg-primary-critical, rgb(247, 55, 64))}.___SContent_7ow1n_gg_{flex-direction:column;gap:var(--intergalactic-spacing-2x, 8px);flex:1}.___SMessage_7ow1n_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SDismiss_7ow1n_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_7ow1n_gg_.__use_7ow1n_gg_{padding:0 1px}.___SIcon_7ow1n_gg_{justify-content:center;align-items:center;height:var(--intergalactic-spacing-5x, 20px)}.___SNoticeBubble_7ow1n_gg_{width:300px;position:fixed;right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_7ow1n_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SNoticeBubble_7ow1n_gg_.__disablePortal_7ow1n_gg_{position:sticky;margin-left:auto;height:0}.___SMessage_7ow1n_gg_ a{color:var(--intergalactic-text-link-invert, rgb(136, 172, 253))}.___SNoticeAriaLiveWrapper_7ow1n_gg_{display:contents}", /*__inner_css_end__*/"7ow1n_gg_"),
30
35
  /*__reshadow_css_end__*/
31
36
  {
32
- "__SContent": "___SContent_19cf4_gg_",
33
- "__SMessage": "___SMessage_19cf4_gg_",
34
- "__SDismiss": "___SDismiss_19cf4_gg_",
35
- "_use": "__use_19cf4_gg_",
36
- "__SIcon": "___SIcon_19cf4_gg_",
37
- "__SNoticeBubble": "___SNoticeBubble_19cf4_gg_",
38
- "_disablePortal": "__disablePortal_19cf4_gg_",
39
- "__SNoticeAriaLiveWrapper": "___SNoticeAriaLiveWrapper_19cf4_gg_",
40
- "@enter": "enter_19cf4",
41
- "@exit": "exit_19cf4",
42
- "__SBubble": "___SBubble_19cf4_gg_",
43
- "__SView": "___SView_19cf4_gg_",
44
- "_type_info": "_type_info_19cf4_gg_",
45
- "_type_warning": "_type_warning_19cf4_gg_"
37
+ "__SContent": "___SContent_7ow1n_gg_",
38
+ "__SMessage": "___SMessage_7ow1n_gg_",
39
+ "__SDismiss": "___SDismiss_7ow1n_gg_",
40
+ "_use": "__use_7ow1n_gg_",
41
+ "__SIcon": "___SIcon_7ow1n_gg_",
42
+ "__SNoticeBubble": "___SNoticeBubble_7ow1n_gg_",
43
+ "_disablePortal": "__disablePortal_7ow1n_gg_",
44
+ "__SNoticeAriaLiveWrapper": "___SNoticeAriaLiveWrapper_7ow1n_gg_",
45
+ "@enter": "enter_7ow1n",
46
+ "@exit": "exit_7ow1n",
47
+ "__SBubble": "___SBubble_7ow1n_gg_",
48
+ "__SView": "___SView_7ow1n_gg_",
49
+ "_type_info": "_type_info_7ow1n_gg_",
50
+ "_type_warning": "_type_warning_7ow1n_gg_"
46
51
  });
47
- import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
48
- import { Timer } from './utils';
52
+ import { forkRef, useForkRef } from '@semcore/utils/lib/ref';
53
+ import { getFocusableIn } from '@semcore/utils/lib/focus-lock/getFocusableIn';
54
+ import { setFocus } from '@semcore/utils/lib/use/useFocusLock';
55
+ var Notices = function Notices(props) {
56
+ var styles = props.styles,
57
+ _props$data = props.data,
58
+ data = _props$data === void 0 ? [] : _props$data,
59
+ _props$tag = props.tag,
60
+ SView = _props$tag === void 0 ? ViewInfo : _props$tag;
61
+ var ref = React.useRef();
62
+ var durationStr = useCssVariable('--intergalactic-duration-popper', '200', ref);
63
+ var duration = React.useMemo(function () {
64
+ return parseInt(durationStr, 10);
65
+ }, [durationStr]);
66
+ return data.map(function (notice) {
67
+ var _ref2, _notice$visible;
68
+ return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(Animation, _ref2.cn("Animation", {
69
+ "key": notice.uid,
70
+ "initialAnimation": notice.initialAnimation,
71
+ "visible": (_notice$visible = notice.visible) !== null && _notice$visible !== void 0 ? _notice$visible : true,
72
+ "duration": duration,
73
+ "keyframes": [styles['@enter'], styles['@exit']],
74
+ "ref": ref
75
+ }), /*#__PURE__*/React.createElement(SView, _ref2.cn("SView", _objectSpread(_objectSpread({}, notice), {}, {
76
+ "styles": notice.styles || styles,
77
+ "getI18nText": props.getI18nText
78
+ }))));
79
+ });
80
+ };
49
81
  var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
82
+ _inherits(NoticeBubbleContainerRoot, _Component);
83
+ var _super = _createSuper(NoticeBubbleContainerRoot);
50
84
  function NoticeBubbleContainerRoot() {
51
85
  var _this;
52
86
  _classCallCheck(this, NoticeBubbleContainerRoot);
53
87
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
54
88
  args[_key] = arguments[_key];
55
89
  }
56
- _this = _callSuper(this, NoticeBubbleContainerRoot, [].concat(args));
57
- _defineProperty(_this, "_unsubscribe", null);
58
- _defineProperty(_this, "state", {
90
+ _this = _super.call.apply(_super, [this].concat(args));
91
+ _defineProperty(_assertThisInitialized(_this), "_unsubscribe", null);
92
+ _defineProperty(_assertThisInitialized(_this), "state", {
59
93
  notices: [],
60
- infos: [],
61
94
  warnings: []
62
95
  });
63
- _defineProperty(_this, "componentWillUnmount", function () {
96
+ _defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
64
97
  if (_this._unsubscribe) {
65
98
  _this._unsubscribe();
66
99
  }
67
100
  });
68
- _defineProperty(_this, "handleChange", function (notices) {
101
+ _defineProperty(_assertThisInitialized(_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
+ });
69
108
  _this.setState({
70
- notices: notices
109
+ notices: info,
110
+ warnings: warning
71
111
  });
72
- _this.forceUpdate(); // need this, because somehow this component doesn't rerender event if the notices are different
73
112
  });
74
113
  return _this;
75
114
  }
76
- _inherits(NoticeBubbleContainerRoot, _Component);
77
- return _createClass(NoticeBubbleContainerRoot, [{
115
+ _createClass(NoticeBubbleContainerRoot, [{
78
116
  key: "componentDidMount",
79
117
  value: function componentDidMount() {
80
118
  this._unsubscribe = this.asProps.manager.addListener(this.handleChange);
@@ -92,30 +130,10 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
92
130
  disablePortal = _this$asProps.disablePortal,
93
131
  getI18nText = _this$asProps.getI18nText,
94
132
  ref = _this$asProps.ref,
95
- parentZIndexStacking = _this$asProps.parentZIndexStacking,
96
- duration = _this$asProps.duration,
97
- containerNode = _this$asProps.containerNode;
98
- var notices = this.state.notices;
99
- if (containerNode) {
100
- return notices.map(function (notice) {
101
- var _ref2;
102
- var SView = notice.type === 'warning' ? ViewWarning : ViewInfo;
103
- return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(PortalForNoticeItem, _ref2.cn("PortalForNoticeItem", _objectSpread({
104
- "key": notice.uid,
105
- "tag": SView,
106
- "containerNode": containerNode,
107
- "animationDuration": duration,
108
- "styles": styles,
109
- "getI18nText": getI18nText
110
- }, notice)));
111
- });
112
- }
113
- var infos = notices.filter(function (notice) {
114
- return notice.type === 'info';
115
- });
116
- var warnings = notices.filter(function (notice) {
117
- return notice.type === 'warning';
118
- });
133
+ parentZIndexStacking = _this$asProps.parentZIndexStacking;
134
+ var _this$state = this.state,
135
+ notices = _this$state.notices,
136
+ warnings = _this$state.warnings;
119
137
  return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(ZIndexStackingContextProvider, _ref3.cn("ZIndexStackingContextProvider", {
120
138
  "designToken": 'z-index-notice-bubble'
121
139
  }), /*#__PURE__*/React.createElement(Portal, _ref3.cn("Portal", {
@@ -126,40 +144,26 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
126
144
  "role": 'region',
127
145
  "aria-label": getI18nText('notification'),
128
146
  "zIndex": parentZIndexStacking
129
- }, _ref))), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})), warnings.map(function (notice) {
130
- var _ref4;
131
- var SView = ViewWarning;
132
- return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SView, _ref4.cn("SView", _objectSpread({
133
- "key": notice.uid,
134
- "animationDuration": duration,
135
- "styles": styles,
136
- "getI18nText": getI18nText
137
- }, notice)));
138
- }), /*#__PURE__*/React.createElement(SNoticeAriaLiveWrapper, _ref3.cn("SNoticeAriaLiveWrapper", {
147
+ }, _ref))), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})), /*#__PURE__*/React.createElement(Notices, _ref3.cn("Notices", {
148
+ "styles": styles,
149
+ "data": warnings,
150
+ "tag": ViewWarning,
151
+ "getI18nText": getI18nText
152
+ })), /*#__PURE__*/React.createElement(SNoticeAriaLiveWrapper, _ref3.cn("SNoticeAriaLiveWrapper", {
139
153
  "aria-live": 'polite'
140
- }), infos.map(function (notice) {
141
- var _ref5;
142
- var SView = ViewInfo;
143
- return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SView, _ref5.cn("SView", _objectSpread({
144
- "key": notice.uid,
145
- "animationDuration": duration,
146
- "styles": styles,
147
- "getI18nText": getI18nText
148
- }, notice)));
149
- })))));
154
+ }), /*#__PURE__*/React.createElement(Notices, _ref3.cn("Notices", {
155
+ "styles": styles,
156
+ "data": notices,
157
+ "tag": ViewInfo,
158
+ "getI18nText": getI18nText
159
+ }))))));
150
160
  }
151
161
  }]);
162
+ return NoticeBubbleContainerRoot;
152
163
  }(Component);
153
164
  _defineProperty(NoticeBubbleContainerRoot, "displayName", 'NoticeBubbleContainer');
154
165
  _defineProperty(NoticeBubbleContainerRoot, "style", style);
155
- _defineProperty(NoticeBubbleContainerRoot, "enhance", [i18nEnhance(localizedMessages), contextThemeEnhance(), zIndexStackingEnhance('z-index-notice-bubble'), cssVariableEnhance({
156
- variable: '--intergalactic-duration-popper',
157
- fallback: 200,
158
- map: function map(v) {
159
- return Number.parseInt(v, 10);
160
- },
161
- prop: 'duration'
162
- })]);
166
+ _defineProperty(NoticeBubbleContainerRoot, "enhance", [i18nEnhance(localizedMessages), contextThemeEnhance(), zIndexStackingEnhance('z-index-notice-bubble')]);
163
167
  _defineProperty(NoticeBubbleContainerRoot, "defaultProps", {
164
168
  manager: manager,
165
169
  i18n: localizedMessages,
@@ -168,84 +172,55 @@ _defineProperty(NoticeBubbleContainerRoot, "defaultProps", {
168
172
  var FocusLock = /*#__PURE__*/React.forwardRef(function (props, outerRef) {
169
173
  var focusLock = props.focusLock,
170
174
  other = _objectWithoutProperties(props, _excluded);
171
- var innerRef = React.useRef(null);
175
+ var innerRef = React.useRef();
172
176
  useFocusLock(innerRef, false, 'auto', !focusLock, true);
173
177
  var ref = useForkRef(outerRef, innerRef);
174
178
  return /*#__PURE__*/React.createElement(Flex, _extends({
175
179
  ref: ref
176
180
  }, other));
177
181
  });
178
- var PortalForNoticeItem = function PortalForNoticeItem(props) {
179
- var _React$useState = React.useState(false),
180
- _React$useState2 = _slicedToArray(_React$useState, 2),
181
- showContent = _React$useState2[0],
182
- setShowContent = _React$useState2[1];
183
-
184
- // Show content for info notice in previously mounted node with aria-live polite
185
- React.useEffect(function () {
186
- setTimeout(function () {
187
- setShowContent(true);
188
- }, 200);
189
- }, []);
190
- var SNoticeAriaLiveWrapper = 'div';
191
- var Tag = props.tag;
192
- if (props.type === 'info') {
193
- return /*#__PURE__*/React.createElement(ZIndexStackingContextProvider, {
194
- designToken: "z-index-notice-bubble"
195
- }, /*#__PURE__*/React.createElement(Portal, {
196
- nodeToMount: props.containerNode
197
- }, /*#__PURE__*/React.createElement(SNoticeAriaLiveWrapper, {
198
- "aria-live": "polite"
199
- }, showContent && /*#__PURE__*/React.createElement(Tag, props))));
200
- }
201
- return /*#__PURE__*/React.createElement(ZIndexStackingContextProvider, {
202
- designToken: "z-index-notice-bubble"
203
- }, /*#__PURE__*/React.createElement(Portal, {
204
- nodeToMount: props.containerNode
205
- }, /*#__PURE__*/React.createElement(Tag, props)));
206
- };
207
182
  var ViewInfo = /*#__PURE__*/function (_Component2) {
183
+ _inherits(ViewInfo, _Component2);
184
+ var _super2 = _createSuper(ViewInfo);
208
185
  function ViewInfo() {
209
186
  var _this2;
210
187
  _classCallCheck(this, ViewInfo);
211
188
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
212
189
  args[_key2] = arguments[_key2];
213
190
  }
214
- _this2 = _callSuper(this, ViewInfo, [].concat(args));
215
- _defineProperty(_this2, "timer", null);
216
- _defineProperty(_this2, "ref", /*#__PURE__*/React.createRef());
217
- _defineProperty(_this2, "closeButtonRef", /*#__PURE__*/React.createRef());
218
- _defineProperty(_this2, "handleClose", function (e) {
191
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
192
+ _defineProperty(_assertThisInitialized(_this2), "timer", null);
193
+ _defineProperty(_assertThisInitialized(_this2), "ref", /*#__PURE__*/React.createRef());
194
+ _defineProperty(_assertThisInitialized(_this2), "closeButtonRef", /*#__PURE__*/React.createRef());
195
+ _defineProperty(_assertThisInitialized(_this2), "handleClose", function (e) {
219
196
  // because it might be called not only from the close icon click
220
- fire(_this2, 'onClose', e);
197
+ fire(_assertThisInitialized(_this2), 'onClose', e);
221
198
  _this2.clearTimer();
222
199
  });
223
- _defineProperty(_this2, "handleKeydown", function (e) {
200
+ _defineProperty(_assertThisInitialized(_this2), "handleKeydown", function (e) {
224
201
  if (e.key === 'Escape') {
225
202
  _this2.handleClose(e);
226
203
  }
227
204
  });
228
- _defineProperty(_this2, "handleMouseEnter", function () {
205
+ _defineProperty(_assertThisInitialized(_this2), "handleMouseEnter", function () {
229
206
  if (!_this2.timer) return;
230
207
  _this2.timer.pause();
231
208
  });
232
- _defineProperty(_this2, "handleMouseLeave", function () {
209
+ _defineProperty(_assertThisInitialized(_this2), "handleMouseLeave", function () {
233
210
  if (!_this2.timer) return;
234
211
  _this2.timer.resume();
235
212
  });
236
- _defineProperty(_this2, "handleBodyMouseMove", function (event) {
237
- var _this2$timer, _this2$ref$current;
213
+ _defineProperty(_assertThisInitialized(_this2), "handleBodyMouseMove", function (event) {
214
+ var _this2$timer;
238
215
  if (!((_this2$timer = _this2.timer) !== null && _this2$timer !== void 0 && _this2$timer.paused)) return;
239
- var rect = (_this2$ref$current = _this2.ref.current) === null || _this2$ref$current === void 0 ? void 0 : _this2$ref$current.getBoundingClientRect();
240
- if (!rect) return;
216
+ var rect = _this2.ref.current.getBoundingClientRect();
241
217
  var mouseInRect = event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
242
218
  if (mouseInRect) return;
243
219
  _this2.timer.resume();
244
220
  });
245
221
  return _this2;
246
222
  }
247
- _inherits(ViewInfo, _Component2);
248
- return _createClass(ViewInfo, [{
223
+ _createClass(ViewInfo, [{
249
224
  key: "componentDidMount",
250
225
  value: function componentDidMount() {
251
226
  var _this3 = this;
@@ -283,39 +258,35 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
283
258
  }, {
284
259
  key: "render",
285
260
  value: function render() {
286
- var _ref6;
261
+ var _ref4;
287
262
  var SBubble = FocusLock;
288
- var SDismiss = Button;
263
+ var SDismiss = Hint.Trigger;
289
264
  var SContent = Flex;
290
265
  var SMessage = 'div';
291
266
  var SAction = 'div';
292
267
  var SIcon = Flex;
293
268
  var _this$props = this.props,
269
+ forwardRef = _this$props.forwardRef,
294
270
  styles = _this$props.styles,
271
+ onMouseEnter = _this$props.onMouseEnter,
272
+ onMouseLeave = _this$props.onMouseLeave,
295
273
  getI18nText = _this$props.getI18nText,
296
- visible = _this$props.visible,
297
- type = _this$props.type,
298
- initialAnimation = _this$props.initialAnimation,
299
- animationDuration = _this$props.animationDuration,
300
274
  icon = _this$props.icon,
301
275
  children = _this$props.children,
302
- action = _this$props.action,
303
- focusLock = _this$props.focusLock;
304
- return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(Animation, _ref6.cn("Animation", {
305
- "initialAnimation": initialAnimation,
306
- "visible": visible !== null && visible !== void 0 ? visible : true,
307
- "duration": animationDuration,
308
- "keyframes": [styles['@enter'], styles['@exit']]
309
- }), /*#__PURE__*/React.createElement(SBubble, _ref6.cn("SBubble", {
310
- "type": type,
311
- "ref": this.ref,
312
- "onMouseEnter": this.handleMouseEnter,
313
- "onMouseLeave": this.handleMouseLeave,
276
+ actionNode = _this$props.action,
277
+ type = _this$props.type,
278
+ other = _objectWithoutProperties(_this$props, _excluded2);
279
+ return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SBubble, _ref4.cn("SBubble", _objectSpread(_objectSpread({}, other), {}, {
280
+ "ref": forkRef(forwardRef, this.ref),
281
+ "onMouseEnter": callAllEventHandlers(onMouseEnter, this.handleMouseEnter),
282
+ "onMouseLeave": callAllEventHandlers(onMouseLeave, this.handleMouseLeave),
314
283
  "onKeyDown": this.handleKeydown,
315
- "role": type === 'warning' ? 'alert' : undefined,
316
- "focusLock": focusLock
317
- }), /*#__PURE__*/React.createElement(SDismiss, _ref6.cn("SDismiss", {
284
+ "role": type === 'warning' ? 'alert' : this.props.role
285
+ })), /*#__PURE__*/React.createElement(SDismiss
286
+ // biome-ignore lint/a11y/useValidAriaValues:
287
+ , _ref4.cn("SDismiss", {
318
288
  "aria-haspopup": undefined,
289
+ "tag": Button,
319
290
  "type": 'button',
320
291
  "use": 'tertiary',
321
292
  "size": 'm',
@@ -324,27 +295,93 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
324
295
  "aria-label": getI18nText('close'),
325
296
  "active": false,
326
297
  "title": getI18nText('close'),
327
- "ref": this.closeButtonRef,
328
- "data-hide-focus-hover-popper": 'true'
298
+ "ref": this.closeButtonRef
329
299
  }), /*#__PURE__*/React.createElement(Button.Addon, {
330
300
  tag: CloseIcon,
331
301
  color: "icon-primary-invert"
332
- })), isNode(icon) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SIcon, _ref6.cn("SIcon", {}), icon), /*#__PURE__*/React.createElement(SContent, _ref6.cn("SContent", {}), /*#__PURE__*/React.createElement(SMessage, _ref6.cn("SMessage", {}), children), isNode(action) ? /*#__PURE__*/React.createElement(SAction, _ref6.cn("SAction", {}), action) : null)) : /*#__PURE__*/React.createElement(SContent, _ref6.cn("SContent", {}), /*#__PURE__*/React.createElement(SMessage, _ref6.cn("SMessage", {}), children), isNode(action) ? /*#__PURE__*/React.createElement(SAction, _ref6.cn("SAction", {}), action) : null)));
302
+ })), 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));
333
303
  }
334
304
  }]);
305
+ return ViewInfo;
335
306
  }(Component);
336
- var ViewWarning = /*#__PURE__*/function (_ViewInfo2) {
307
+ var ViewWarning = /*#__PURE__*/function (_ViewInfo) {
308
+ _inherits(ViewWarning, _ViewInfo);
309
+ var _super3 = _createSuper(ViewWarning);
337
310
  function ViewWarning() {
338
311
  _classCallCheck(this, ViewWarning);
339
- return _callSuper(this, ViewWarning, arguments);
312
+ return _super3.apply(this, arguments);
340
313
  }
341
- _inherits(ViewWarning, _ViewInfo2);
342
314
  return _createClass(ViewWarning);
343
315
  }(ViewInfo);
344
316
  _defineProperty(ViewWarning, "defaultProps", {
345
317
  type: 'warning',
346
318
  duration: 0
347
319
  });
348
- var NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot);
320
+ var NoticeBubbleView = /*#__PURE__*/function (_Component3) {
321
+ _inherits(NoticeBubbleView, _Component3);
322
+ var _super4 = _createSuper(NoticeBubbleView);
323
+ function NoticeBubbleView() {
324
+ var _this4;
325
+ _classCallCheck(this, NoticeBubbleView);
326
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
327
+ args[_key3] = arguments[_key3];
328
+ }
329
+ _this4 = _super4.call.apply(_super4, [this].concat(args));
330
+ _defineProperty(_assertThisInitialized(_this4), "_notice", null);
331
+ return _this4;
332
+ }
333
+ _createClass(NoticeBubbleView, [{
334
+ key: "componentDidMount",
335
+ value: function componentDidMount() {
336
+ this._notice = this.asProps.manager.add(this.asProps);
337
+ }
338
+ }, {
339
+ key: "componentWillUnmount",
340
+ value: function componentWillUnmount() {
341
+ if (this._notice) {
342
+ this._notice.remove();
343
+ }
344
+ }
345
+ }, {
346
+ key: "componentDidUpdate",
347
+ value: function componentDidUpdate() {
348
+ if (this._notice) {
349
+ this._notice.update(this.asProps);
350
+ }
351
+ }
352
+ }, {
353
+ key: "render",
354
+ value: function render() {
355
+ return null;
356
+ }
357
+ }]);
358
+ return NoticeBubbleView;
359
+ }(Component);
360
+ _defineProperty(NoticeBubbleView, "defaultProps", {
361
+ duration: 5000,
362
+ type: 'info',
363
+ manager: manager
364
+ });
365
+ var NoticeBubbleWarningView = /*#__PURE__*/function (_NoticeBubbleView) {
366
+ _inherits(NoticeBubbleWarningView, _NoticeBubbleView);
367
+ var _super5 = _createSuper(NoticeBubbleWarningView);
368
+ function NoticeBubbleWarningView() {
369
+ _classCallCheck(this, NoticeBubbleWarningView);
370
+ return _super5.apply(this, arguments);
371
+ }
372
+ return _createClass(NoticeBubbleWarningView);
373
+ }(NoticeBubbleView);
374
+ _defineProperty(NoticeBubbleWarningView, "defaultProps", {
375
+ duration: 5000,
376
+ type: 'warning',
377
+ manager: manager
378
+ });
379
+ var NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {
380
+ Info: NoticeBubbleView,
381
+ Warning: NoticeBubbleWarningView
382
+ });
383
+ var NoticeBubble = NoticeBubbleContainer.Info;
384
+ var NoticeBubbleWarning = NoticeBubbleContainer.Warning;
385
+ export { NoticeBubble, NoticeBubbleWarning };
349
386
  export default NoticeBubbleContainer;
350
387
  //# sourceMappingURL=NoticeBubble.js.map