@semcore/notice-bubble 5.54.2-prerelease.0 → 5.55.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 +6 -0
- package/lib/cjs/NoticeBubble.js +177 -217
- package/lib/cjs/NoticeBubble.js.map +1 -1
- package/lib/cjs/NoticeBubble.type.js +2 -0
- package/lib/cjs/NoticeBubble.type.js.map +1 -0
- package/lib/cjs/NoticeBubbleManager.js +34 -56
- package/lib/cjs/NoticeBubbleManager.js.map +1 -1
- package/lib/cjs/index.js +1 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/notice-bubble.shadow.css +4 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/utils.js +20 -9
- package/lib/cjs/utils.js.map +1 -1
- package/lib/es6/NoticeBubble.js +170 -207
- package/lib/es6/NoticeBubble.js.map +1 -1
- package/lib/es6/NoticeBubble.type.js +2 -0
- package/lib/es6/NoticeBubble.type.js.map +1 -0
- package/lib/es6/NoticeBubbleManager.js +31 -51
- package/lib/es6/NoticeBubbleManager.js.map +1 -1
- package/lib/es6/index.js +1 -2
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/notice-bubble.shadow.css +4 -4
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/utils.js +18 -6
- package/lib/es6/utils.js.map +1 -1
- package/lib/esm/NoticeBubble.mjs +175 -215
- package/lib/esm/NoticeBubbleManager.mjs +33 -53
- package/lib/esm/index.mjs +3 -7
- package/lib/esm/style/notice-bubble.shadow.css +4 -4
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/esm/utils.mjs +20 -8
- package/lib/types/NoticeBubble.d.ts +4 -0
- package/lib/types/NoticeBubble.type.d.ts +91 -0
- package/lib/types/NoticeBubbleManager.d.ts +22 -0
- package/lib/types/index.d.ts +7 -167
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +58 -0
- package/lib/types/utils.d.ts +14 -0
- package/package.json +9 -9
- package/lib/cjs/index.d.js +0 -2
- package/lib/cjs/index.d.js.map +0 -1
- package/lib/es6/index.d.js +0 -2
- package/lib/es6/index.d.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [5.55.0] - 2026-05-06
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version minor update due to children dependencies update (`@semcore/button` [5.43.3 ~> 5.44.0], `@semcore/utils` [4.48.5 ~> 4.49.0], `@semcore/icon` [4.62.1 ~> 4.63.0], `@semcore/flex-box` [5.41.4 ~> 5.42.0], `@semcore/animation` [2.41.4 ~> 2.42.0], `@semcore/core` [2.39.4 ~> 2.40.0]).
|
|
10
|
+
|
|
5
11
|
## [5.54.2] - 2025-05-13
|
|
6
12
|
|
|
7
13
|
### Changed
|
package/lib/cjs/NoticeBubble.js
CHANGED
|
@@ -1,124 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports["default"] =
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var
|
|
14
|
+
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
|
|
14
15
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
17
|
+
var _core = require("@semcore/core");
|
|
18
|
+
var _baseComponents = require("@semcore/base-components");
|
|
19
|
+
var _button = _interopRequireDefault(require("@semcore/button"));
|
|
20
|
+
var _i18nEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/i18nEnhance"));
|
|
21
|
+
var _fire = _interopRequireDefault(require("@semcore/core/lib/utils/fire"));
|
|
22
|
+
var _getFocusableIn = require("@semcore/core/lib/utils/focus-lock/getFocusableIn");
|
|
23
|
+
var _isNode = _interopRequireDefault(require("@semcore/core/lib/utils/isNode"));
|
|
24
|
+
var _ref7 = require("@semcore/core/lib/utils/ref");
|
|
25
|
+
var _ThemeProvider = require("@semcore/core/lib/utils/ThemeProvider");
|
|
26
|
+
var _useFocusLock = require("@semcore/core/lib/utils/use/useFocusLock");
|
|
27
|
+
var _useCssVariable = require("@semcore/core/lib/utils/useCssVariable");
|
|
28
|
+
var _zIndexStacking = require("@semcore/core/lib/utils/zIndexStacking");
|
|
29
|
+
var _m = _interopRequireDefault(require("@semcore/icon/Close/m"));
|
|
20
30
|
var _react = _interopRequireDefault(require("react"));
|
|
21
|
-
var _portal = _interopRequireDefault(require("@semcore/portal"));
|
|
22
31
|
var _NoticeBubbleManager = _interopRequireDefault(require("./NoticeBubbleManager"));
|
|
23
|
-
var _animation = require("@semcore/animation");
|
|
24
|
-
var _flexBox = require("@semcore/flex-box");
|
|
25
|
-
var _fire = _interopRequireDefault(require("@semcore/utils/lib/fire"));
|
|
26
|
-
var _isNode = _interopRequireDefault(require("@semcore/utils/lib/isNode"));
|
|
27
|
-
var _assignProps2 = require("@semcore/utils/lib/assignProps");
|
|
28
|
-
var _m = _interopRequireDefault(require("@semcore/icon/Close/m"));
|
|
29
|
-
var _utils = require("./utils");
|
|
30
32
|
var _intergalacticDynamicLocales = require("./translations/__intergalactic-dynamic-locales");
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var _ThemeProvider = require("@semcore/utils/lib/ThemeProvider");
|
|
34
|
-
var _button = _interopRequireDefault(require("@semcore/button"));
|
|
35
|
-
var _useFocusLock = require("@semcore/utils/lib/use/useFocusLock");
|
|
36
|
-
var _tooltip = require("@semcore/tooltip");
|
|
37
|
-
var _zIndexStacking = require("@semcore/utils/lib/zIndexStacking");
|
|
38
|
-
var _ref5 = require("@semcore/utils/lib/ref");
|
|
39
|
-
var _getFocusableIn = require("@semcore/utils/lib/focus-lock/getFocusableIn");
|
|
40
|
-
var _excluded = ["focusLock"],
|
|
41
|
-
_excluded2 = ["forwardRef", "styles", "onMouseEnter", "onMouseLeave", "getI18nText", "icon", "children", "action", "type"];
|
|
33
|
+
var _utils = require("./utils");
|
|
34
|
+
var _excluded = ["focusLock"];
|
|
42
35
|
/*!__reshadow-styles__:"./style/notice-bubble.shadow.css"*/
|
|
43
|
-
var style = (
|
|
36
|
+
var style = (/*__reshadow_css_start__*/_core.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_"),
|
|
44
37
|
/*__reshadow_css_end__*/
|
|
45
38
|
{
|
|
46
|
-
"__SContent": "
|
|
47
|
-
"__SMessage": "
|
|
48
|
-
"__SDismiss": "
|
|
49
|
-
"_use": "
|
|
50
|
-
"__SIcon": "
|
|
51
|
-
"__SNoticeBubble": "
|
|
52
|
-
"_disablePortal": "
|
|
53
|
-
"__SNoticeAriaLiveWrapper": "
|
|
54
|
-
"@enter": "
|
|
55
|
-
"@exit": "
|
|
56
|
-
"__SBubble": "
|
|
57
|
-
"__SView": "
|
|
58
|
-
"_type_info": "
|
|
59
|
-
"_type_warning": "
|
|
39
|
+
"__SContent": "___SContent_19cf4_gg_",
|
|
40
|
+
"__SMessage": "___SMessage_19cf4_gg_",
|
|
41
|
+
"__SDismiss": "___SDismiss_19cf4_gg_",
|
|
42
|
+
"_use": "__use_19cf4_gg_",
|
|
43
|
+
"__SIcon": "___SIcon_19cf4_gg_",
|
|
44
|
+
"__SNoticeBubble": "___SNoticeBubble_19cf4_gg_",
|
|
45
|
+
"_disablePortal": "__disablePortal_19cf4_gg_",
|
|
46
|
+
"__SNoticeAriaLiveWrapper": "___SNoticeAriaLiveWrapper_19cf4_gg_",
|
|
47
|
+
"@enter": "enter_19cf4",
|
|
48
|
+
"@exit": "exit_19cf4",
|
|
49
|
+
"__SBubble": "___SBubble_19cf4_gg_",
|
|
50
|
+
"__SView": "___SView_19cf4_gg_",
|
|
51
|
+
"_type_info": "_type_info_19cf4_gg_",
|
|
52
|
+
"_type_warning": "_type_warning_19cf4_gg_"
|
|
60
53
|
});
|
|
61
|
-
var Notices = function Notices(props) {
|
|
62
|
-
var styles = props.styles,
|
|
63
|
-
_props$data = props.data,
|
|
64
|
-
data = _props$data === void 0 ? [] : _props$data,
|
|
65
|
-
_props$tag = props.tag,
|
|
66
|
-
SView = _props$tag === void 0 ? ViewInfo : _props$tag;
|
|
67
|
-
var ref = _react["default"].useRef();
|
|
68
|
-
var durationStr = (0, _useCssVariable.useCssVariable)('--intergalactic-duration-popper', '200', ref);
|
|
69
|
-
var duration = _react["default"].useMemo(function () {
|
|
70
|
-
return parseInt(durationStr, 10);
|
|
71
|
-
}, [durationStr]);
|
|
72
|
-
return data.map(function (notice) {
|
|
73
|
-
var _ref2, _notice$visible;
|
|
74
|
-
return _ref2 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_animation.Animation, _ref2.cn("Animation", {
|
|
75
|
-
"key": notice.uid,
|
|
76
|
-
"initialAnimation": notice.initialAnimation,
|
|
77
|
-
"visible": (_notice$visible = notice.visible) !== null && _notice$visible !== void 0 ? _notice$visible : true,
|
|
78
|
-
"duration": duration,
|
|
79
|
-
"keyframes": [styles['@enter'], styles['@exit']],
|
|
80
|
-
"ref": ref
|
|
81
|
-
}), /*#__PURE__*/_react["default"].createElement(SView, _ref2.cn("SView", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, notice), {}, {
|
|
82
|
-
"styles": notice.styles || styles,
|
|
83
|
-
"getI18nText": props.getI18nText
|
|
84
|
-
}))));
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
54
|
var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
|
|
88
|
-
(0, _inherits2["default"])(NoticeBubbleContainerRoot, _Component);
|
|
89
|
-
var _super = (0, _createSuper2["default"])(NoticeBubbleContainerRoot);
|
|
90
55
|
function NoticeBubbleContainerRoot() {
|
|
91
56
|
var _this;
|
|
92
57
|
(0, _classCallCheck2["default"])(this, NoticeBubbleContainerRoot);
|
|
93
58
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
94
59
|
args[_key] = arguments[_key];
|
|
95
60
|
}
|
|
96
|
-
_this =
|
|
97
|
-
(0, _defineProperty2["default"])(
|
|
98
|
-
(0, _defineProperty2["default"])(
|
|
61
|
+
_this = (0, _callSuper2["default"])(this, NoticeBubbleContainerRoot, [].concat(args));
|
|
62
|
+
(0, _defineProperty2["default"])(_this, "_unsubscribe", null);
|
|
63
|
+
(0, _defineProperty2["default"])(_this, "state", {
|
|
99
64
|
notices: [],
|
|
65
|
+
infos: [],
|
|
100
66
|
warnings: []
|
|
101
67
|
});
|
|
102
|
-
(0, _defineProperty2["default"])(
|
|
68
|
+
(0, _defineProperty2["default"])(_this, "componentWillUnmount", function () {
|
|
103
69
|
if (_this._unsubscribe) {
|
|
104
70
|
_this._unsubscribe();
|
|
105
71
|
}
|
|
106
72
|
});
|
|
107
|
-
(0, _defineProperty2["default"])(
|
|
108
|
-
var info = notices.filter(function (notice) {
|
|
109
|
-
return notice.type === 'info';
|
|
110
|
-
});
|
|
111
|
-
var warning = notices.filter(function (notice) {
|
|
112
|
-
return notice.type === 'warning';
|
|
113
|
-
});
|
|
73
|
+
(0, _defineProperty2["default"])(_this, "handleChange", function (notices) {
|
|
114
74
|
_this.setState({
|
|
115
|
-
notices:
|
|
116
|
-
warnings: warning
|
|
75
|
+
notices: notices
|
|
117
76
|
});
|
|
77
|
+
_this.forceUpdate(); // need this, because somehow this component doesn't rerender event if the notices are different
|
|
118
78
|
});
|
|
119
79
|
return _this;
|
|
120
80
|
}
|
|
121
|
-
(0,
|
|
81
|
+
(0, _inherits2["default"])(NoticeBubbleContainerRoot, _Component);
|
|
82
|
+
return (0, _createClass2["default"])(NoticeBubbleContainerRoot, [{
|
|
122
83
|
key: "componentDidMount",
|
|
123
84
|
value: function componentDidMount() {
|
|
124
85
|
this._unsubscribe = this.asProps.manager.addListener(this.handleChange);
|
|
@@ -128,7 +89,7 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
|
|
|
128
89
|
value: function render() {
|
|
129
90
|
var _ref = this.asProps,
|
|
130
91
|
_ref3;
|
|
131
|
-
var SNoticeBubble =
|
|
92
|
+
var SNoticeBubble = _baseComponents.Box;
|
|
132
93
|
var SNoticeAriaLiveWrapper = 'div';
|
|
133
94
|
var _this$asProps = this.asProps,
|
|
134
95
|
Children = _this$asProps.Children,
|
|
@@ -136,13 +97,33 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
|
|
|
136
97
|
disablePortal = _this$asProps.disablePortal,
|
|
137
98
|
getI18nText = _this$asProps.getI18nText,
|
|
138
99
|
ref = _this$asProps.ref,
|
|
139
|
-
parentZIndexStacking = _this$asProps.parentZIndexStacking
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
100
|
+
parentZIndexStacking = _this$asProps.parentZIndexStacking,
|
|
101
|
+
duration = _this$asProps.duration,
|
|
102
|
+
containerNode = _this$asProps.containerNode;
|
|
103
|
+
var notices = this.state.notices;
|
|
104
|
+
if (containerNode) {
|
|
105
|
+
return notices.map(function (notice) {
|
|
106
|
+
var _ref2;
|
|
107
|
+
var SView = notice.type === 'warning' ? ViewWarning : ViewInfo;
|
|
108
|
+
return _ref2 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(PortalForNoticeItem, _ref2.cn("PortalForNoticeItem", (0, _objectSpread2["default"])({
|
|
109
|
+
"key": notice.uid,
|
|
110
|
+
"tag": SView,
|
|
111
|
+
"containerNode": containerNode,
|
|
112
|
+
"animationDuration": duration,
|
|
113
|
+
"styles": styles,
|
|
114
|
+
"getI18nText": getI18nText
|
|
115
|
+
}, notice)));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
var infos = notices.filter(function (notice) {
|
|
119
|
+
return notice.type === 'info';
|
|
120
|
+
});
|
|
121
|
+
var warnings = notices.filter(function (notice) {
|
|
122
|
+
return notice.type === 'warning';
|
|
123
|
+
});
|
|
143
124
|
return _ref3 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_zIndexStacking.ZIndexStackingContextProvider, _ref3.cn("ZIndexStackingContextProvider", {
|
|
144
125
|
"designToken": 'z-index-notice-bubble'
|
|
145
|
-
}), /*#__PURE__*/_react["default"].createElement(
|
|
126
|
+
}), /*#__PURE__*/_react["default"].createElement(_baseComponents.Portal, _ref3.cn("Portal", {
|
|
146
127
|
"disablePortal": disablePortal
|
|
147
128
|
}), /*#__PURE__*/_react["default"].createElement(SNoticeBubble, _ref3.cn("SNoticeBubble", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
148
129
|
"ref": ref,
|
|
@@ -150,26 +131,40 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
|
|
|
150
131
|
"role": 'region',
|
|
151
132
|
"aria-label": getI18nText('notification'),
|
|
152
133
|
"zIndex": parentZIndexStacking
|
|
153
|
-
}, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {})),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"
|
|
157
|
-
|
|
158
|
-
|
|
134
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {})), warnings.map(function (notice) {
|
|
135
|
+
var _ref4;
|
|
136
|
+
var SView = ViewWarning;
|
|
137
|
+
return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SView, _ref4.cn("SView", (0, _objectSpread2["default"])({
|
|
138
|
+
"key": notice.uid,
|
|
139
|
+
"animationDuration": duration,
|
|
140
|
+
"styles": styles,
|
|
141
|
+
"getI18nText": getI18nText
|
|
142
|
+
}, notice)));
|
|
143
|
+
}), /*#__PURE__*/_react["default"].createElement(SNoticeAriaLiveWrapper, _ref3.cn("SNoticeAriaLiveWrapper", {
|
|
159
144
|
"aria-live": 'polite'
|
|
160
|
-
}),
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
"
|
|
164
|
-
|
|
165
|
-
|
|
145
|
+
}), infos.map(function (notice) {
|
|
146
|
+
var _ref5;
|
|
147
|
+
var SView = ViewInfo;
|
|
148
|
+
return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SView, _ref5.cn("SView", (0, _objectSpread2["default"])({
|
|
149
|
+
"key": notice.uid,
|
|
150
|
+
"animationDuration": duration,
|
|
151
|
+
"styles": styles,
|
|
152
|
+
"getI18nText": getI18nText
|
|
153
|
+
}, notice)));
|
|
154
|
+
})))));
|
|
166
155
|
}
|
|
167
156
|
}]);
|
|
168
|
-
return NoticeBubbleContainerRoot;
|
|
169
157
|
}(_core.Component);
|
|
170
158
|
(0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "displayName", 'NoticeBubbleContainer');
|
|
171
159
|
(0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "style", style);
|
|
172
|
-
(0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "enhance", [(0, _i18nEnhance["default"])(_intergalacticDynamicLocales.localizedMessages), (0, _ThemeProvider.contextThemeEnhance)(), (0, _zIndexStacking.zIndexStackingEnhance)('z-index-notice-bubble')
|
|
160
|
+
(0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "enhance", [(0, _i18nEnhance["default"])(_intergalacticDynamicLocales.localizedMessages), (0, _ThemeProvider.contextThemeEnhance)(), (0, _zIndexStacking.zIndexStackingEnhance)('z-index-notice-bubble'), (0, _useCssVariable.cssVariableEnhance)({
|
|
161
|
+
variable: '--intergalactic-duration-popper',
|
|
162
|
+
fallback: 200,
|
|
163
|
+
map: function map(v) {
|
|
164
|
+
return Number.parseInt(v, 10);
|
|
165
|
+
},
|
|
166
|
+
prop: 'duration'
|
|
167
|
+
})]);
|
|
173
168
|
(0, _defineProperty2["default"])(NoticeBubbleContainerRoot, "defaultProps", {
|
|
174
169
|
manager: _NoticeBubbleManager["default"],
|
|
175
170
|
i18n: _intergalacticDynamicLocales.localizedMessages,
|
|
@@ -178,55 +173,84 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
|
|
|
178
173
|
var FocusLock = /*#__PURE__*/_react["default"].forwardRef(function (props, outerRef) {
|
|
179
174
|
var focusLock = props.focusLock,
|
|
180
175
|
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
181
|
-
var innerRef = _react["default"].useRef();
|
|
176
|
+
var innerRef = _react["default"].useRef(null);
|
|
182
177
|
(0, _useFocusLock.useFocusLock)(innerRef, false, 'auto', !focusLock, true);
|
|
183
|
-
var ref = (0,
|
|
184
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
178
|
+
var ref = (0, _ref7.useForkRef)(outerRef, innerRef);
|
|
179
|
+
return /*#__PURE__*/_react["default"].createElement(_baseComponents.Flex, (0, _extends2["default"])({
|
|
185
180
|
ref: ref
|
|
186
181
|
}, other));
|
|
187
182
|
});
|
|
183
|
+
var PortalForNoticeItem = function PortalForNoticeItem(props) {
|
|
184
|
+
var _React$useState = _react["default"].useState(false),
|
|
185
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
186
|
+
showContent = _React$useState2[0],
|
|
187
|
+
setShowContent = _React$useState2[1];
|
|
188
|
+
|
|
189
|
+
// Show content for info notice in previously mounted node with aria-live polite
|
|
190
|
+
_react["default"].useEffect(function () {
|
|
191
|
+
setTimeout(function () {
|
|
192
|
+
setShowContent(true);
|
|
193
|
+
}, 200);
|
|
194
|
+
}, []);
|
|
195
|
+
var SNoticeAriaLiveWrapper = 'div';
|
|
196
|
+
var Tag = props.tag;
|
|
197
|
+
if (props.type === 'info') {
|
|
198
|
+
return /*#__PURE__*/_react["default"].createElement(_zIndexStacking.ZIndexStackingContextProvider, {
|
|
199
|
+
designToken: "z-index-notice-bubble"
|
|
200
|
+
}, /*#__PURE__*/_react["default"].createElement(_baseComponents.Portal, {
|
|
201
|
+
nodeToMount: props.containerNode
|
|
202
|
+
}, /*#__PURE__*/_react["default"].createElement(SNoticeAriaLiveWrapper, {
|
|
203
|
+
"aria-live": "polite"
|
|
204
|
+
}, showContent && /*#__PURE__*/_react["default"].createElement(Tag, props))));
|
|
205
|
+
}
|
|
206
|
+
return /*#__PURE__*/_react["default"].createElement(_zIndexStacking.ZIndexStackingContextProvider, {
|
|
207
|
+
designToken: "z-index-notice-bubble"
|
|
208
|
+
}, /*#__PURE__*/_react["default"].createElement(_baseComponents.Portal, {
|
|
209
|
+
nodeToMount: props.containerNode
|
|
210
|
+
}, /*#__PURE__*/_react["default"].createElement(Tag, props)));
|
|
211
|
+
};
|
|
188
212
|
var ViewInfo = /*#__PURE__*/function (_Component2) {
|
|
189
|
-
(0, _inherits2["default"])(ViewInfo, _Component2);
|
|
190
|
-
var _super2 = (0, _createSuper2["default"])(ViewInfo);
|
|
191
213
|
function ViewInfo() {
|
|
192
214
|
var _this2;
|
|
193
215
|
(0, _classCallCheck2["default"])(this, ViewInfo);
|
|
194
216
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
195
217
|
args[_key2] = arguments[_key2];
|
|
196
218
|
}
|
|
197
|
-
_this2 =
|
|
198
|
-
(0, _defineProperty2["default"])(
|
|
199
|
-
(0, _defineProperty2["default"])(
|
|
200
|
-
(0, _defineProperty2["default"])(
|
|
201
|
-
(0, _defineProperty2["default"])(
|
|
219
|
+
_this2 = (0, _callSuper2["default"])(this, ViewInfo, [].concat(args));
|
|
220
|
+
(0, _defineProperty2["default"])(_this2, "timer", null);
|
|
221
|
+
(0, _defineProperty2["default"])(_this2, "ref", /*#__PURE__*/_react["default"].createRef());
|
|
222
|
+
(0, _defineProperty2["default"])(_this2, "closeButtonRef", /*#__PURE__*/_react["default"].createRef());
|
|
223
|
+
(0, _defineProperty2["default"])(_this2, "handleClose", function (e) {
|
|
202
224
|
// because it might be called not only from the close icon click
|
|
203
|
-
(0, _fire["default"])(
|
|
225
|
+
(0, _fire["default"])(_this2, 'onClose', e);
|
|
204
226
|
_this2.clearTimer();
|
|
205
227
|
});
|
|
206
|
-
(0, _defineProperty2["default"])(
|
|
228
|
+
(0, _defineProperty2["default"])(_this2, "handleKeydown", function (e) {
|
|
207
229
|
if (e.key === 'Escape') {
|
|
208
230
|
_this2.handleClose(e);
|
|
209
231
|
}
|
|
210
232
|
});
|
|
211
|
-
(0, _defineProperty2["default"])(
|
|
233
|
+
(0, _defineProperty2["default"])(_this2, "handleMouseEnter", function () {
|
|
212
234
|
if (!_this2.timer) return;
|
|
213
235
|
_this2.timer.pause();
|
|
214
236
|
});
|
|
215
|
-
(0, _defineProperty2["default"])(
|
|
237
|
+
(0, _defineProperty2["default"])(_this2, "handleMouseLeave", function () {
|
|
216
238
|
if (!_this2.timer) return;
|
|
217
239
|
_this2.timer.resume();
|
|
218
240
|
});
|
|
219
|
-
(0, _defineProperty2["default"])(
|
|
220
|
-
var _this2$timer;
|
|
241
|
+
(0, _defineProperty2["default"])(_this2, "handleBodyMouseMove", function (event) {
|
|
242
|
+
var _this2$timer, _this2$ref$current;
|
|
221
243
|
if (!((_this2$timer = _this2.timer) !== null && _this2$timer !== void 0 && _this2$timer.paused)) return;
|
|
222
|
-
var rect = _this2.ref.current.getBoundingClientRect();
|
|
244
|
+
var rect = (_this2$ref$current = _this2.ref.current) === null || _this2$ref$current === void 0 ? void 0 : _this2$ref$current.getBoundingClientRect();
|
|
245
|
+
if (!rect) return;
|
|
223
246
|
var mouseInRect = event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
224
247
|
if (mouseInRect) return;
|
|
225
248
|
_this2.timer.resume();
|
|
226
249
|
});
|
|
227
250
|
return _this2;
|
|
228
251
|
}
|
|
229
|
-
(0,
|
|
252
|
+
(0, _inherits2["default"])(ViewInfo, _Component2);
|
|
253
|
+
return (0, _createClass2["default"])(ViewInfo, [{
|
|
230
254
|
key: "componentDidMount",
|
|
231
255
|
value: function componentDidMount() {
|
|
232
256
|
var _this3 = this;
|
|
@@ -264,35 +288,39 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
|
|
|
264
288
|
}, {
|
|
265
289
|
key: "render",
|
|
266
290
|
value: function render() {
|
|
267
|
-
var
|
|
291
|
+
var _ref6;
|
|
268
292
|
var SBubble = FocusLock;
|
|
269
|
-
var SDismiss =
|
|
270
|
-
var SContent =
|
|
293
|
+
var SDismiss = _button["default"];
|
|
294
|
+
var SContent = _baseComponents.Flex;
|
|
271
295
|
var SMessage = 'div';
|
|
272
296
|
var SAction = 'div';
|
|
273
|
-
var SIcon =
|
|
297
|
+
var SIcon = _baseComponents.Flex;
|
|
274
298
|
var _this$props = this.props,
|
|
275
|
-
forwardRef = _this$props.forwardRef,
|
|
276
299
|
styles = _this$props.styles,
|
|
277
|
-
onMouseEnter = _this$props.onMouseEnter,
|
|
278
|
-
onMouseLeave = _this$props.onMouseLeave,
|
|
279
300
|
getI18nText = _this$props.getI18nText,
|
|
301
|
+
visible = _this$props.visible,
|
|
302
|
+
type = _this$props.type,
|
|
303
|
+
initialAnimation = _this$props.initialAnimation,
|
|
304
|
+
animationDuration = _this$props.animationDuration,
|
|
280
305
|
icon = _this$props.icon,
|
|
281
306
|
children = _this$props.children,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
"
|
|
287
|
-
"
|
|
288
|
-
"
|
|
307
|
+
action = _this$props.action,
|
|
308
|
+
focusLock = _this$props.focusLock;
|
|
309
|
+
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_baseComponents.Animation, _ref6.cn("Animation", {
|
|
310
|
+
"initialAnimation": initialAnimation,
|
|
311
|
+
"visible": visible !== null && visible !== void 0 ? visible : true,
|
|
312
|
+
"duration": animationDuration,
|
|
313
|
+
"keyframes": [styles['@enter'], styles['@exit']]
|
|
314
|
+
}), /*#__PURE__*/_react["default"].createElement(SBubble, _ref6.cn("SBubble", {
|
|
315
|
+
"type": type,
|
|
316
|
+
"ref": this.ref,
|
|
317
|
+
"onMouseEnter": this.handleMouseEnter,
|
|
318
|
+
"onMouseLeave": this.handleMouseLeave,
|
|
289
319
|
"onKeyDown": this.handleKeydown,
|
|
290
|
-
"role": type === 'warning' ? 'alert' :
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
, _ref4.cn("SDismiss", {
|
|
320
|
+
"role": type === 'warning' ? 'alert' : undefined,
|
|
321
|
+
"focusLock": focusLock
|
|
322
|
+
}), /*#__PURE__*/_react["default"].createElement(SDismiss, _ref6.cn("SDismiss", {
|
|
294
323
|
"aria-haspopup": undefined,
|
|
295
|
-
"tag": _button["default"],
|
|
296
324
|
"type": 'button',
|
|
297
325
|
"use": 'tertiary',
|
|
298
326
|
"size": 'm',
|
|
@@ -301,95 +329,27 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
|
|
|
301
329
|
"aria-label": getI18nText('close'),
|
|
302
330
|
"active": false,
|
|
303
331
|
"title": getI18nText('close'),
|
|
304
|
-
"ref": this.closeButtonRef
|
|
332
|
+
"ref": this.closeButtonRef,
|
|
333
|
+
"data-hide-focus-hover-popper": 'true'
|
|
305
334
|
}), /*#__PURE__*/_react["default"].createElement(_button["default"].Addon, {
|
|
306
335
|
tag: _m["default"],
|
|
307
336
|
color: "icon-primary-invert"
|
|
308
|
-
})), (0, _isNode["default"])(icon) ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(SIcon,
|
|
337
|
+
})), (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)));
|
|
309
338
|
}
|
|
310
339
|
}]);
|
|
311
|
-
return ViewInfo;
|
|
312
340
|
}(_core.Component);
|
|
313
|
-
var ViewWarning = /*#__PURE__*/function (
|
|
314
|
-
(0, _inherits2["default"])(ViewWarning, _ViewInfo);
|
|
315
|
-
var _super3 = (0, _createSuper2["default"])(ViewWarning);
|
|
341
|
+
var ViewWarning = /*#__PURE__*/function (_ViewInfo2) {
|
|
316
342
|
function ViewWarning() {
|
|
317
343
|
(0, _classCallCheck2["default"])(this, ViewWarning);
|
|
318
|
-
return
|
|
344
|
+
return (0, _callSuper2["default"])(this, ViewWarning, arguments);
|
|
319
345
|
}
|
|
346
|
+
(0, _inherits2["default"])(ViewWarning, _ViewInfo2);
|
|
320
347
|
return (0, _createClass2["default"])(ViewWarning);
|
|
321
348
|
}(ViewInfo);
|
|
322
349
|
(0, _defineProperty2["default"])(ViewWarning, "defaultProps", {
|
|
323
350
|
type: 'warning',
|
|
324
351
|
duration: 0
|
|
325
352
|
});
|
|
326
|
-
var
|
|
327
|
-
|
|
328
|
-
var _super4 = (0, _createSuper2["default"])(NoticeBubbleView);
|
|
329
|
-
function NoticeBubbleView() {
|
|
330
|
-
var _this4;
|
|
331
|
-
(0, _classCallCheck2["default"])(this, NoticeBubbleView);
|
|
332
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
333
|
-
args[_key3] = arguments[_key3];
|
|
334
|
-
}
|
|
335
|
-
_this4 = _super4.call.apply(_super4, [this].concat(args));
|
|
336
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this4), "_notice", null);
|
|
337
|
-
return _this4;
|
|
338
|
-
}
|
|
339
|
-
(0, _createClass2["default"])(NoticeBubbleView, [{
|
|
340
|
-
key: "componentDidMount",
|
|
341
|
-
value: function componentDidMount() {
|
|
342
|
-
this._notice = this.asProps.manager.add(this.asProps);
|
|
343
|
-
}
|
|
344
|
-
}, {
|
|
345
|
-
key: "componentWillUnmount",
|
|
346
|
-
value: function componentWillUnmount() {
|
|
347
|
-
if (this._notice) {
|
|
348
|
-
this._notice.remove();
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}, {
|
|
352
|
-
key: "componentDidUpdate",
|
|
353
|
-
value: function componentDidUpdate() {
|
|
354
|
-
if (this._notice) {
|
|
355
|
-
this._notice.update(this.asProps);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}, {
|
|
359
|
-
key: "render",
|
|
360
|
-
value: function render() {
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
363
|
-
}]);
|
|
364
|
-
return NoticeBubbleView;
|
|
365
|
-
}(_core.Component);
|
|
366
|
-
(0, _defineProperty2["default"])(NoticeBubbleView, "defaultProps", {
|
|
367
|
-
duration: 5000,
|
|
368
|
-
type: 'info',
|
|
369
|
-
manager: _NoticeBubbleManager["default"]
|
|
370
|
-
});
|
|
371
|
-
var NoticeBubbleWarningView = /*#__PURE__*/function (_NoticeBubbleView) {
|
|
372
|
-
(0, _inherits2["default"])(NoticeBubbleWarningView, _NoticeBubbleView);
|
|
373
|
-
var _super5 = (0, _createSuper2["default"])(NoticeBubbleWarningView);
|
|
374
|
-
function NoticeBubbleWarningView() {
|
|
375
|
-
(0, _classCallCheck2["default"])(this, NoticeBubbleWarningView);
|
|
376
|
-
return _super5.apply(this, arguments);
|
|
377
|
-
}
|
|
378
|
-
return (0, _createClass2["default"])(NoticeBubbleWarningView);
|
|
379
|
-
}(NoticeBubbleView);
|
|
380
|
-
(0, _defineProperty2["default"])(NoticeBubbleWarningView, "defaultProps", {
|
|
381
|
-
duration: 5000,
|
|
382
|
-
type: 'warning',
|
|
383
|
-
manager: _NoticeBubbleManager["default"]
|
|
384
|
-
});
|
|
385
|
-
var NoticeBubbleContainer = (0, _core["default"])(NoticeBubbleContainerRoot, {
|
|
386
|
-
Info: NoticeBubbleView,
|
|
387
|
-
Warning: NoticeBubbleWarningView
|
|
388
|
-
});
|
|
389
|
-
var NoticeBubble = NoticeBubbleContainer.Info;
|
|
390
|
-
exports.NoticeBubble = NoticeBubble;
|
|
391
|
-
var NoticeBubbleWarning = NoticeBubbleContainer.Warning;
|
|
392
|
-
exports.NoticeBubbleWarning = NoticeBubbleWarning;
|
|
393
|
-
var _default = NoticeBubbleContainer;
|
|
394
|
-
exports["default"] = _default;
|
|
353
|
+
var NoticeBubbleContainer = (0, _core.createComponent)(NoticeBubbleContainerRoot);
|
|
354
|
+
var _default = exports["default"] = NoticeBubbleContainer;
|
|
395
355
|
//# sourceMappingURL=NoticeBubble.js.map
|