@semcore/notice 5.48.0-prerelease.0 → 5.48.0-prerelease.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Notice.js +93 -67
- package/lib/cjs/Notice.js.map +1 -1
- package/lib/cjs/NoticeSmart.js +19 -11
- package/lib/cjs/NoticeSmart.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +3 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/notice.shadow.css +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/Notice.js +85 -61
- package/lib/es6/Notice.js.map +1 -1
- package/lib/es6/NoticeSmart.js +15 -9
- package/lib/es6/NoticeSmart.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/notice.shadow.css +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/Notice.mjs +82 -61
- package/lib/esm/NoticeSmart.mjs +18 -12
- package/lib/esm/style/notice.shadow.css +1 -1
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/index.d.ts +25 -15
- package/package.json +9 -9
package/lib/es6/Notice.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
6
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
import { sstyled as _sstyled } from "@semcore/core";
|
|
8
|
+
import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import { assignProps as _assignProps8 } from "@semcore/core";
|
|
8
10
|
import { assignProps as _assignProps7 } from "@semcore/core";
|
|
9
11
|
import { assignProps as _assignProps6 } from "@semcore/core";
|
|
10
12
|
import { assignProps as _assignProps5 } from "@semcore/core";
|
|
@@ -12,53 +14,56 @@ import { assignProps as _assignProps4 } from "@semcore/core";
|
|
|
12
14
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
13
15
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
14
16
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
15
|
-
import
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
19
|
+
import { Box } from '@semcore/flex-box';
|
|
16
20
|
import Button from '@semcore/button';
|
|
17
|
-
import { createComponent, Component, sstyled, Root } from '@semcore/core';
|
|
18
|
-
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
19
|
-
import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
20
|
-
import logger from '@semcore/core/lib/utils/logger';
|
|
21
|
-
import { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';
|
|
22
21
|
import CloseIconM from '@semcore/icon/Close/m';
|
|
22
|
+
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
23
|
+
import { FadeInOut } from '@semcore/animation';
|
|
24
|
+
import logger from '@semcore/utils/lib/logger';
|
|
25
|
+
import NoticeGlobal from '@semcore/notice-global';
|
|
26
|
+
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
27
|
+
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
28
|
+
import { cssVariableEnhance } from '@semcore/utils/lib/useCssVariable';
|
|
23
29
|
import { Text } from '@semcore/typography';
|
|
24
|
-
import React from 'react';
|
|
25
30
|
/*!__reshadow-styles__:"./style/notice.shadow.css"*/
|
|
26
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
31
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SNotice_sf65z_gg_{display:flex;padding:var(--intergalactic-spacing-4x, 16px);font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);box-sizing:border-box;border-style:solid;border-width:1px;border-radius:var(--intergalactic-surface-rounded, calc(6px + 2px));color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SNotice_sf65z_gg_._theme_info_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-info, rgb(239, 241, 252));border-color:var(--intergalactic-border-info, rgba(0, 29, 203, 0.184))}@supports (color:color(display-p3 0 0 0)){.___SNotice_sf65z_gg_._theme_info_sf65z_gg_{border-color:var(--intergalactic-border-info, rgba(0, 29, 203, 0.184))}@media (color-gamut:p3){.___SNotice_sf65z_gg_._theme_info_sf65z_gg_{border-color:var(--intergalactic-border-info, color(display-p3 0.02614 0.10685 0.76924 / 0.184))}}}.___SNotice_sf65z_gg_._theme_info_sf65z_gg_ .___SCloseIcon_sf65z_gg_{color:var(--intergalactic-icon-primary-neutral, rgba(0, 4, 1, 0.526))}@media (hover:hover){.___SNotice_sf65z_gg_._theme_info_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, rgba(0, 3, 0, 0.583))}@supports (color:color(display-p3 0 0 0)){.___SNotice_sf65z_gg_._theme_info_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SNotice_sf65z_gg_._theme_info_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}}.___SNotice_sf65z_gg_._theme_danger_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-critical, rgb(255, 235, 239));border-color:var(--intergalactic-border-critical, rgba(255, 0, 18, 0.243))}@supports (color:color(display-p3 0 0 0)){.___SNotice_sf65z_gg_._theme_danger_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-critical, rgb(255, 235, 238));border-color:var(--intergalactic-border-critical, rgba(255, 0, 18, 0.243))}@media (color-gamut:p3){.___SNotice_sf65z_gg_._theme_danger_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-critical, color(display-p3 1 0.91978 0.9341));border-color:var(--intergalactic-border-critical, color(display-p3 0.91687 0.1993 0.16262 / 0.243))}}}.___SNotice_sf65z_gg_._theme_danger_sf65z_gg_ .___SCloseIcon_sf65z_gg_{color:var(--intergalactic-icon-primary-critical, rgba(215, 0, 7, 0.848))}@media (hover:hover){.___SNotice_sf65z_gg_._theme_danger_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-critical-hover-active, rgba(194, 1, 6, 0.91))}}.___SNotice_sf65z_gg_._theme_warning_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-warning, rgb(255, 248, 229));border-color:var(--intergalactic-border-warning, rgba(255, 152, 0, 0.543))}@supports (color:color(display-p3 0 0 0)){.___SNotice_sf65z_gg_._theme_warning_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-warning, rgb(255, 248, 229))}@media (color-gamut:p3){.___SNotice_sf65z_gg_._theme_warning_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-warning, color(display-p3 0.99986 0.97187 0.89433))}}}.___SNotice_sf65z_gg_._theme_warning_sf65z_gg_ .___SCloseIcon_sf65z_gg_{color:var(--intergalactic-icon-primary-warning, rgb(255, 125, 0))}@supports (color:color(display-p3 0 0 0)){.___SNotice_sf65z_gg_._theme_warning_sf65z_gg_ .___SCloseIcon_sf65z_gg_{color:var(--intergalactic-icon-primary-warning, rgb(255, 125, 0))}@media (color-gamut:p3){.___SNotice_sf65z_gg_._theme_warning_sf65z_gg_ .___SCloseIcon_sf65z_gg_{color:var(--intergalactic-icon-primary-warning, color(display-p3 0.93628 0.51895 0.19525))}}}@media (hover:hover){.___SNotice_sf65z_gg_._theme_warning_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-warning-hover-active, rgb(184, 60, 0))}}.___SNotice_sf65z_gg_._theme_success_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-success, rgb(201, 255, 243));border-color:var(--intergalactic-border-success, rgba(1, 229, 168, 0.531))}@supports (color:color(display-p3 0 0 0)){.___SNotice_sf65z_gg_._theme_success_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-success, rgb(201, 255, 243))}@media (color-gamut:p3){.___SNotice_sf65z_gg_._theme_success_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-success, color(display-p3 0.83144 0.99433 0.95372))}}}.___SNotice_sf65z_gg_._theme_success_sf65z_gg_ .___SCloseIcon_sf65z_gg_{color:var(--intergalactic-icon-primary-success, rgb(2, 149, 109))}@media (hover:hover){.___SNotice_sf65z_gg_._theme_success_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-success-hover-active, rgb(0, 133, 95))}@supports (color:color(display-p3 0 0 0)){.___SNotice_sf65z_gg_._theme_success_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-success-hover-active, rgb(0, 133, 95))}@media (color-gamut:p3){.___SNotice_sf65z_gg_._theme_success_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-success-hover-active, color(display-p3 0.22396 0.5119 0.38245))}}}}.___SNotice_sf65z_gg_._theme_muted_sf65z_gg_{background-color:var(--intergalactic-bg-secondary-neutral, rgb(248, 249, 248));border-color:var(--intergalactic-border-secondary, rgba(0, 21, 16, 0.07))}@supports (color:color(display-p3 0 0 0)){.___SNotice_sf65z_gg_._theme_muted_sf65z_gg_{border-color:var(--intergalactic-border-secondary, rgba(0, 21, 16, 0.07))}@media (color-gamut:p3){.___SNotice_sf65z_gg_._theme_muted_sf65z_gg_{border-color:var(--intergalactic-border-secondary, color(display-p3 0.01753 0.08157 0.06372 / 0.07))}}}.___SLabel_sf65z_gg_._theme_info_sf65z_gg_,.___SNotice_sf65z_gg_._theme_muted_sf65z_gg_ .___SCloseIcon_sf65z_gg_{color:var(--intergalactic-icon-primary-neutral, rgba(0, 4, 1, 0.526))}@media (hover:hover){.___SNotice_sf65z_gg_._theme_muted_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, rgba(0, 3, 0, 0.583))}@supports (color:color(display-p3 0 0 0)){.___SNotice_sf65z_gg_._theme_muted_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SNotice_sf65z_gg_._theme_muted_sf65z_gg_ .___SCloseIcon_sf65z_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}}.___SContent_sf65z_gg_{flex:1 1 auto;width:100%}.___SActions_sf65z_gg_{flex-shrink:0;margin-top:var(--intergalactic-spacing-3x, 12px)}.___SLabel_sf65z_gg_{min-height:var(--intergalactic-form-control-m, 28px);height:-moz-fit-content;height:fit-content;margin-right:var(--intergalactic-spacing-2x, 8px);display:inline-flex;align-items:center}.___SLabel_sf65z_gg_._theme_danger_sf65z_gg_{color:var(--intergalactic-icon-primary-critical, rgba(215, 0, 7, 0.848))}.___SLabel_sf65z_gg_._theme_warning_sf65z_gg_{color:var(--intergalactic-icon-primary-warning, rgb(255, 125, 0))}@supports (color:color(display-p3 0 0 0)){.___SLabel_sf65z_gg_._theme_warning_sf65z_gg_{color:var(--intergalactic-icon-primary-warning, rgb(255, 125, 0))}@media (color-gamut:p3){.___SLabel_sf65z_gg_._theme_warning_sf65z_gg_{color:var(--intergalactic-icon-primary-warning, color(display-p3 0.93628 0.51895 0.19525))}}}.___SLabel_sf65z_gg_._theme_success_sf65z_gg_{color:var(--intergalactic-icon-primary-success, rgb(2, 149, 109))}.___SLabel_sf65z_gg_._theme_muted_sf65z_gg_{color:var(--intergalactic-icon-primary-neutral, rgba(0, 4, 1, 0.526))}.___SLabel_sf65z_gg_._theme_custom_sf65z_gg_{color:var(--color_sf65z)}.___SCloseIcon_sf65z_gg_{flex-shrink:0;margin-left:var(--intergalactic-spacing-4x, 16px)}.___SNotice_sf65z_gg_._theme_custom_sf65z_gg_{background-color:var(--backgroundColor_sf65z);border-color:var(--backgroundColor_sf65z)}.___STitle_sf65z_gg_{margin-top:var(--intergalactic-spacing-05x, 2px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}.___SText_sf65z_gg_{margin-top:var(--intergalactic-spacing-1x, 4px);margin-bottom:var(--intergalactic-spacing-1x, 4px)}", /*__inner_css_end__*/"sf65z_gg_"),
|
|
27
32
|
/*__reshadow_css_end__*/
|
|
28
33
|
{
|
|
29
|
-
"__SNotice": "
|
|
30
|
-
"__SContent": "
|
|
31
|
-
"__SActions": "
|
|
32
|
-
"__SLabel": "
|
|
33
|
-
"_theme_info": "
|
|
34
|
-
"_theme_danger": "
|
|
35
|
-
"_theme_warning": "
|
|
36
|
-
"_theme_success": "
|
|
37
|
-
"_theme_muted": "
|
|
38
|
-
"_theme_custom": "
|
|
39
|
-
"--color": "--
|
|
40
|
-
"__SCloseIcon": "
|
|
41
|
-
"--backgroundColor": "--
|
|
42
|
-
"__STitle": "
|
|
43
|
-
"__SText": "
|
|
34
|
+
"__SNotice": "___SNotice_sf65z_gg_",
|
|
35
|
+
"__SContent": "___SContent_sf65z_gg_",
|
|
36
|
+
"__SActions": "___SActions_sf65z_gg_",
|
|
37
|
+
"__SLabel": "___SLabel_sf65z_gg_",
|
|
38
|
+
"_theme_info": "_theme_info_sf65z_gg_",
|
|
39
|
+
"_theme_danger": "_theme_danger_sf65z_gg_",
|
|
40
|
+
"_theme_warning": "_theme_warning_sf65z_gg_",
|
|
41
|
+
"_theme_success": "_theme_success_sf65z_gg_",
|
|
42
|
+
"_theme_muted": "_theme_muted_sf65z_gg_",
|
|
43
|
+
"_theme_custom": "_theme_custom_sf65z_gg_",
|
|
44
|
+
"--color": "--color_sf65z",
|
|
45
|
+
"__SCloseIcon": "___SCloseIcon_sf65z_gg_",
|
|
46
|
+
"--backgroundColor": "--backgroundColor_sf65z",
|
|
47
|
+
"__STitle": "___STitle_sf65z_gg_",
|
|
48
|
+
"__SText": "___SText_sf65z_gg_"
|
|
44
49
|
});
|
|
45
|
-
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
46
50
|
function isCustomTheme(theme) {
|
|
47
51
|
return !['danger', 'warning', 'success', 'info', 'muted'].includes(theme);
|
|
48
52
|
}
|
|
49
53
|
var RootNotice = /*#__PURE__*/function (_Component) {
|
|
54
|
+
_inherits(RootNotice, _Component);
|
|
55
|
+
var _super = _createSuper(RootNotice);
|
|
50
56
|
function RootNotice() {
|
|
51
57
|
var _this;
|
|
52
58
|
_classCallCheck(this, RootNotice);
|
|
53
59
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
54
60
|
args[_key] = arguments[_key];
|
|
55
61
|
}
|
|
56
|
-
_this =
|
|
57
|
-
_defineProperty(_this, "ref", /*#__PURE__*/React.createRef());
|
|
62
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "ref", /*#__PURE__*/React.createRef());
|
|
58
64
|
return _this;
|
|
59
65
|
}
|
|
60
|
-
|
|
61
|
-
return _createClass(RootNotice, [{
|
|
66
|
+
_createClass(RootNotice, [{
|
|
62
67
|
key: "componentDidMount",
|
|
63
68
|
value: function componentDidMount() {
|
|
64
69
|
if (this.ref.current && process.env.NODE_ENV !== 'production' && !['muted', 'danger'].includes(this.props.theme)) {
|
|
@@ -102,32 +107,38 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
102
107
|
key: "render",
|
|
103
108
|
value: function render() {
|
|
104
109
|
var _ref = this.asProps,
|
|
105
|
-
|
|
110
|
+
_ref9;
|
|
106
111
|
var SNotice = FadeInOut;
|
|
107
112
|
var _this$asProps2 = this.asProps,
|
|
108
113
|
Children = _this$asProps2.Children,
|
|
109
114
|
styles = _this$asProps2.styles,
|
|
110
115
|
hidden = _this$asProps2.hidden,
|
|
111
116
|
theme = _this$asProps2.theme,
|
|
117
|
+
use = _this$asProps2.use,
|
|
112
118
|
resolveColor = _this$asProps2.resolveColor,
|
|
113
119
|
getI18nText = _this$asProps2.getI18nText;
|
|
114
120
|
var color = resolveColor(theme);
|
|
115
121
|
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
122
|
+
if (use === 'primary') {
|
|
123
|
+
logger.warn(true, "Deprecated property-value pair \"use=primary\", use component <NoticeGlobal/> instead", RootNotice.displayName);
|
|
124
|
+
return /*#__PURE__*/React.createElement(NoticeGlobal, this.asProps);
|
|
125
|
+
}
|
|
116
126
|
var ariaLabel = getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification');
|
|
117
127
|
if (theme === 'muted') {
|
|
118
128
|
ariaLabel = undefined;
|
|
119
129
|
}
|
|
120
130
|
var role = theme === 'muted' ? undefined : 'region';
|
|
121
|
-
return
|
|
131
|
+
return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SNotice, _ref9.cn("SNotice", _objectSpread({}, _assignProps({
|
|
122
132
|
"visible": !hidden,
|
|
123
133
|
"use:theme": useTheme,
|
|
124
134
|
"backgroundColor": color,
|
|
125
135
|
"role": role,
|
|
126
136
|
"aria-label": ariaLabel,
|
|
127
137
|
"ref": this.ref
|
|
128
|
-
}, _ref))), /*#__PURE__*/React.createElement(Children,
|
|
138
|
+
}, _ref))), /*#__PURE__*/React.createElement(Children, _ref9.cn("Children", {})));
|
|
129
139
|
}
|
|
130
140
|
}]);
|
|
141
|
+
return RootNotice;
|
|
131
142
|
}(Component);
|
|
132
143
|
_defineProperty(RootNotice, "displayName", 'Notice');
|
|
133
144
|
_defineProperty(RootNotice, "style", style);
|
|
@@ -142,66 +153,78 @@ _defineProperty(RootNotice, "defaultProps", {
|
|
|
142
153
|
i18n: localizedMessages,
|
|
143
154
|
locale: 'en'
|
|
144
155
|
});
|
|
145
|
-
function Label(
|
|
156
|
+
function Label(_ref17) {
|
|
146
157
|
var _ref2 = arguments[0],
|
|
147
|
-
|
|
148
|
-
var styles =
|
|
149
|
-
theme =
|
|
150
|
-
resolveColor =
|
|
158
|
+
_ref10;
|
|
159
|
+
var styles = _ref17.styles,
|
|
160
|
+
theme = _ref17.theme,
|
|
161
|
+
resolveColor = _ref17.resolveColor;
|
|
151
162
|
var SLabel = Box;
|
|
152
163
|
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
153
164
|
var color = resolveColor(theme);
|
|
154
|
-
return
|
|
165
|
+
return _ref10 = sstyled(styles), /*#__PURE__*/React.createElement(SLabel, _ref10.cn("SLabel", _objectSpread({}, _assignProps2({
|
|
155
166
|
"use:theme": useTheme,
|
|
156
167
|
"color": color
|
|
157
168
|
}, _ref2))));
|
|
158
169
|
}
|
|
159
|
-
function Title(
|
|
170
|
+
function Title(_ref18) {
|
|
160
171
|
var _ref3 = arguments[0],
|
|
161
|
-
|
|
162
|
-
var styles =
|
|
172
|
+
_ref11;
|
|
173
|
+
var styles = _ref18.styles;
|
|
163
174
|
var STitle = Text;
|
|
164
|
-
return
|
|
175
|
+
return _ref11 = sstyled(styles), /*#__PURE__*/React.createElement(STitle, _ref11.cn("STitle", _objectSpread({}, _assignProps3({
|
|
165
176
|
"tag": 'div',
|
|
166
177
|
"size": 300,
|
|
167
178
|
"fontWeight": 'bold'
|
|
168
179
|
}, _ref3))));
|
|
169
180
|
}
|
|
170
|
-
function NoticeText(
|
|
181
|
+
function NoticeText(_ref19) {
|
|
171
182
|
var _ref4 = arguments[0],
|
|
172
|
-
|
|
173
|
-
var styles =
|
|
183
|
+
_ref12;
|
|
184
|
+
var styles = _ref19.styles;
|
|
174
185
|
var SText = Text;
|
|
175
|
-
return
|
|
186
|
+
return _ref12 = sstyled(styles), /*#__PURE__*/React.createElement(SText, _ref12.cn("SText", _objectSpread({}, _assignProps4({
|
|
176
187
|
"tag": 'div'
|
|
177
188
|
}, _ref4))));
|
|
178
189
|
}
|
|
179
|
-
function Actions(
|
|
190
|
+
function Actions(_ref20) {
|
|
180
191
|
var _ref5 = arguments[0],
|
|
181
|
-
|
|
182
|
-
var styles =
|
|
192
|
+
_ref13;
|
|
193
|
+
var styles = _ref20.styles;
|
|
183
194
|
var SActions = Box;
|
|
184
|
-
return
|
|
195
|
+
return _ref13 = sstyled(styles), /*#__PURE__*/React.createElement(SActions, _ref13.cn("SActions", _objectSpread({}, _assignProps5({}, _ref5))));
|
|
185
196
|
}
|
|
186
|
-
function Content(
|
|
197
|
+
function Content(_ref21) {
|
|
187
198
|
var _ref6 = arguments[0],
|
|
188
|
-
|
|
189
|
-
var styles =
|
|
199
|
+
_ref14;
|
|
200
|
+
var styles = _ref21.styles;
|
|
190
201
|
var SContent = Box;
|
|
191
|
-
return
|
|
202
|
+
return _ref14 = sstyled(styles), /*#__PURE__*/React.createElement(SContent, _ref14.cn("SContent", _objectSpread({}, _assignProps6({}, _ref6))));
|
|
192
203
|
}
|
|
193
|
-
function
|
|
204
|
+
function CloseIcon(_ref22) {
|
|
194
205
|
var _ref7 = arguments[0],
|
|
195
|
-
|
|
196
|
-
var styles =
|
|
197
|
-
getI18nText =
|
|
206
|
+
_ref15;
|
|
207
|
+
var styles = _ref22.styles,
|
|
208
|
+
getI18nText = _ref22.getI18nText;
|
|
209
|
+
var SCloseIcon = Box;
|
|
210
|
+
return _ref15 = sstyled(styles), /*#__PURE__*/React.createElement(SCloseIcon, _ref15.cn("SCloseIcon", _objectSpread({}, _assignProps7({
|
|
211
|
+
"tag": CloseIconM,
|
|
212
|
+
"interactive": true,
|
|
213
|
+
"aria-label": getI18nText('close')
|
|
214
|
+
}, _ref7))));
|
|
215
|
+
}
|
|
216
|
+
function Close(_ref23) {
|
|
217
|
+
var _ref8 = arguments[0],
|
|
218
|
+
_ref16;
|
|
219
|
+
var styles = _ref23.styles,
|
|
220
|
+
getI18nText = _ref23.getI18nText;
|
|
198
221
|
var SCloseIcon = Button;
|
|
199
|
-
return
|
|
222
|
+
return _ref16 = sstyled(styles), /*#__PURE__*/React.createElement(SCloseIcon, _ref16.cn("SCloseIcon", _objectSpread({}, _assignProps8({
|
|
200
223
|
"addonLeft": CloseIconM,
|
|
201
224
|
"use": 'tertiary',
|
|
202
225
|
"theme": 'muted',
|
|
203
226
|
"aria-label": getI18nText('close')
|
|
204
|
-
},
|
|
227
|
+
}, _ref8))));
|
|
205
228
|
}
|
|
206
229
|
var Notice = createComponent(RootNotice, {
|
|
207
230
|
Label: Label,
|
|
@@ -209,6 +232,7 @@ var Notice = createComponent(RootNotice, {
|
|
|
209
232
|
Text: NoticeText,
|
|
210
233
|
Actions: Actions,
|
|
211
234
|
Content: Content,
|
|
235
|
+
CloseIcon: CloseIcon,
|
|
212
236
|
Close: Close
|
|
213
237
|
});
|
|
214
238
|
export default Notice;
|
package/lib/es6/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notice.js","names":["FadeInOut","Box","Button","createComponent","Component","sstyled","Root","i18nEnhance","resolveColorEnhance","logger","cssVariableEnhance","CloseIconM","Text","React","style","_sstyled","insert","localizedMessages","isCustomTheme","theme","includes","RootNotice","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","createRef","_inherits","_createClass","key","value","componentDidMount","ref","current","process","env","NODE_ENV","props","hasTitle","node","hasAttribute","warn","displayName","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","getCloseProps","render","_ref","_ref8","SNotice","_this$asProps2","Children","styles","hidden","color","useTheme","ariaLabel","undefined","role","createElement","cn","_objectSpread","_assignProps","variable","fallback","map","Number","parseInt","prop","i18n","locale","Label","_ref13","_ref2","arguments[0]","_ref9","SLabel","_assignProps2","Title","_ref14","_ref3","_ref0","STitle","_assignProps3","NoticeText","_ref15","_ref4","_ref1","SText","_assignProps4","Actions","_ref16","_ref5","_ref10","SActions","_assignProps5","Content","_ref17","_ref6","_ref11","SContent","_assignProps6","Close","_ref18","_ref7","_ref12","SCloseIcon","_assignProps7","Notice"],"sources":["../../src/Notice.jsx"],"sourcesContent":["import { FadeInOut, Box } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport CloseIconM from '@semcore/icon/Close/m';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport style from './style/notice.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info', 'muted'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n cssVariableEnhance({\n variable: '--intergalactic-duration-popper',\n fallback: '200',\n map: Number.parseInt,\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ];\n\n static defaultProps = {\n theme: 'info',\n i18n: localizedMessages,\n locale: 'en',\n };\n\n ref = React.createRef();\n\n componentDidMount() {\n if (\n this.ref.current &&\n process.env.NODE_ENV !== 'production' &&\n !['muted', 'danger'].includes(this.props.theme)\n ) {\n const hasTitle = (node) => {\n if (node.hasAttribute('aria-label')) return true;\n if (node.hasAttribute('aria-labelledby')) return true;\n if (node.hasAttribute('title')) return true;\n\n return false;\n };\n\n logger.warn(\n !hasTitle(this.ref.current),\n `Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification`,\n this.props['data-ui-name'] || RootNotice.displayName,\n );\n }\n }\n\n getLabelProps() {\n const { theme, resolveColor } = this.asProps;\n\n return { theme, resolveColor };\n }\n\n getCloseIconProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n getCloseProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme, resolveColor, getI18nText } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n let ariaLabel = getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification');\n\n if (theme === 'muted') {\n ariaLabel = undefined;\n }\n\n const role = theme === 'muted' ? undefined : 'region';\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role={role}\n aria-label={ariaLabel}\n ref={this.ref}\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme, resolveColor }) {\n const SLabel = Root;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);\n}\n\nfunction Title({ styles }) {\n const STitle = Root;\n return sstyled(styles)(<STitle render={Text} tag='div' size={300} fontWeight='bold' />);\n}\n\nfunction NoticeText({ styles }) {\n const SText = Root;\n return sstyled(styles)(<SText render={Text} tag='div' />);\n}\n\nfunction Actions({ styles }) {\n const SActions = Root;\n return sstyled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ styles }) {\n const SContent = Root;\n return sstyled(styles)(<SContent render={Box} />);\n}\n\nfunction Close({ styles, getI18nText }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon\n render={Button}\n addonLeft={CloseIconM}\n use='tertiary'\n theme='muted'\n aria-label={getI18nText('close')}\n />,\n );\n}\n\nconst Notice = createComponent(RootNotice, {\n Label,\n Title: Title,\n Text: NoticeText,\n Actions,\n Content,\n Close,\n});\n\nexport default Notice;\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAASA,SAAS,EAAEC,GAAG,QAAQ,0BAA0B;AACzD,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,OAAOC,WAAW,MAAM,8CAA8C;AACtE,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,MAAM,MAAM,gCAAgC;AACnD,SAASC,kBAAkB,QAAQ,wCAAwC;AAC3E,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,IAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAG1B,SAASC,iBAAiB,QAAQ,gDAAgD;AAElF,SAASC,aAAaA,CAACC,KAAK,EAAE;EAC5B,OAAO,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAACC,QAAQ,CAACD,KAAK,CAAC;AAC3E;AAAC,IAEKE,UAAU,0BAAAC,UAAA;EAAA,SAAAD,WAAA;IAAA,IAAAE,KAAA;IAAAC,eAAA,OAAAH,UAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,G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.js","names":["React","createComponent","Component","sstyled","Root","Box","Button","CloseIconM","resolveColorEnhance","FadeInOut","logger","NoticeGlobal","localizedMessages","i18nEnhance","cssVariableEnhance","Text","style","_sstyled","insert","isCustomTheme","theme","includes","RootNotice","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","createRef","_createClass","key","value","componentDidMount","ref","current","process","env","NODE_ENV","props","hasTitle","node","hasAttribute","warn","displayName","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","getCloseProps","render","_ref","_ref9","SNotice","_this$asProps2","Children","styles","hidden","use","color","useTheme","createElement","ariaLabel","undefined","role","cn","_objectSpread","_assignProps","variable","fallback","map","Number","parseInt","prop","i18n","locale","Label","_ref17","_ref2","arguments[0]","_ref10","SLabel","_assignProps2","Title","_ref18","_ref3","_ref11","STitle","_assignProps3","NoticeText","_ref19","_ref4","_ref12","SText","_assignProps4","Actions","_ref20","_ref5","_ref13","SActions","_assignProps5","Content","_ref21","_ref6","_ref14","SContent","_assignProps6","CloseIcon","_ref22","_ref7","_ref15","SCloseIcon","_assignProps7","Close","_ref23","_ref8","_ref16","_assignProps8","Notice"],"sources":["../../src/Notice.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport CloseIconM from '@semcore/icon/Close/m';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/utils/lib/logger';\nimport NoticeGlobal from '@semcore/notice-global';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { cssVariableEnhance } from '@semcore/utils/lib/useCssVariable';\nimport { Text } from '@semcore/typography';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info', 'muted'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n cssVariableEnhance({\n variable: '--intergalactic-duration-popper',\n fallback: '200',\n map: Number.parseInt,\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ];\n static defaultProps = {\n theme: 'info',\n i18n: localizedMessages,\n locale: 'en',\n };\n\n ref = React.createRef();\n\n componentDidMount() {\n if (\n this.ref.current &&\n process.env.NODE_ENV !== 'production' &&\n !['muted', 'danger'].includes(this.props.theme)\n ) {\n const hasTitle = (node) => {\n if (node.hasAttribute('aria-label')) return true;\n if (node.hasAttribute('aria-labelledby')) return true;\n if (node.hasAttribute('title')) return true;\n\n return false;\n };\n\n logger.warn(\n !hasTitle(this.ref.current),\n `Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification`,\n this.props['data-ui-name'] || RootNotice.displayName,\n );\n }\n }\n\n getLabelProps() {\n const { theme, resolveColor } = this.asProps;\n\n return { theme, resolveColor };\n }\n\n getCloseIconProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n getCloseProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme, use, resolveColor, getI18nText } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n if (use === 'primary') {\n logger.warn(\n true,\n `Deprecated property-value pair \"use=primary\", use component <NoticeGlobal/> instead`,\n RootNotice.displayName,\n );\n return <NoticeGlobal {...this.asProps} />;\n }\n\n let ariaLabel = getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification');\n\n if (theme === 'muted') {\n ariaLabel = undefined;\n }\n\n const role = theme === 'muted' ? undefined : 'region';\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role={role}\n aria-label={ariaLabel}\n ref={this.ref}\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme, resolveColor }) {\n const SLabel = Root;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);\n}\n\nfunction Title({ styles }) {\n const STitle = Root;\n return sstyled(styles)(<STitle render={Text} tag='div' size={300} fontWeight={'bold'} />);\n}\n\nfunction NoticeText({ styles }) {\n const SText = Root;\n return sstyled(styles)(<SText render={Text} tag='div' />);\n}\n\nfunction Actions({ styles }) {\n const SActions = Root;\n return sstyled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ styles }) {\n const SContent = Root;\n return sstyled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon({ styles, getI18nText }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon render={Box} tag={CloseIconM} interactive aria-label={getI18nText('close')} />,\n );\n}\n\nfunction Close({ styles, getI18nText }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon\n render={Button}\n addonLeft={CloseIconM}\n use='tertiary'\n theme='muted'\n aria-label={getI18nText('close')}\n />,\n );\n}\n\nconst Notice = createComponent(RootNotice, {\n Label,\n Title: Title,\n Text: NoticeText,\n Actions,\n Content,\n CloseIcon,\n Close,\n});\n\nexport default Notice;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,MAAM,MAAM,iBAAiB;AACpC,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,mBAAmB,MAAM,iDAAiD;AACjF,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,OAAOC,MAAM,MAAM,2BAA2B;AAC9C,OAAOC,YAAY,MAAM,wBAAwB;A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GlI,eAAe,CAACqB,UAAU,EAAE;EACzCmE,KAAK,EAALA,KAAK;EACLO,KAAK,EAAEA,KAAK;EACZjF,IAAI,EAAEuF,UAAU;EAChBM,OAAO,EAAPA,OAAO;EACPM,OAAO,EAAPA,OAAO;EACPM,SAAS,EAATA,SAAS;EACTM,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAeK,MAAM"}
|
package/lib/es6/NoticeSmart.js
CHANGED
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
4
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
7
|
-
import { createComponent, Component, Root } from '@semcore/core';
|
|
8
|
-
import isNode from '@semcore/core/lib/utils/isNode';
|
|
9
7
|
import React from 'react';
|
|
8
|
+
import createComponent, { Component, Root } from '@semcore/core';
|
|
9
|
+
import isNode from '@semcore/utils/lib/isNode';
|
|
10
10
|
import Notice from './Notice';
|
|
11
11
|
var NoticeSmart = /*#__PURE__*/function (_Component) {
|
|
12
|
+
_inherits(NoticeSmart, _Component);
|
|
13
|
+
var _super = _createSuper(NoticeSmart);
|
|
12
14
|
function NoticeSmart() {
|
|
13
15
|
_classCallCheck(this, NoticeSmart);
|
|
14
|
-
return
|
|
16
|
+
return _super.apply(this, arguments);
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
return _createClass(NoticeSmart, [{
|
|
18
|
+
_createClass(NoticeSmart, [{
|
|
18
19
|
key: "render",
|
|
19
20
|
value: function render() {
|
|
20
21
|
var _ref = this.asProps;
|
|
21
22
|
var SNoticeSmart = Notice;
|
|
22
23
|
var _this$asProps = this.asProps,
|
|
24
|
+
Children = _this$asProps.Children,
|
|
23
25
|
label = _this$asProps.label,
|
|
24
26
|
title = _this$asProps.title,
|
|
25
27
|
actions = _this$asProps.actions,
|
|
26
28
|
closable = _this$asProps.closable,
|
|
27
|
-
onClose = _this$asProps.onClose
|
|
28
|
-
|
|
29
|
+
onClose = _this$asProps.onClose;
|
|
30
|
+
var textContent = /*#__PURE__*/React.createElement(Children, null);
|
|
31
|
+
if (typeof Children.origin === 'string') {
|
|
32
|
+
textContent = isNode(title) || isNode(label) || closable ? /*#__PURE__*/React.createElement(Notice.Text, null, /*#__PURE__*/React.createElement(Children, null)) : /*#__PURE__*/React.createElement(Children, null);
|
|
33
|
+
}
|
|
29
34
|
return /*#__PURE__*/React.createElement(SNoticeSmart, _assignProps({
|
|
30
35
|
"__excludeProps": ['title']
|
|
31
|
-
}, _ref), isNode(label) && /*#__PURE__*/React.createElement(Notice.Label, null, label), /*#__PURE__*/React.createElement(Notice.Content, null, isNode(title) && /*#__PURE__*/React.createElement(Notice.Title, null, title),
|
|
36
|
+
}, _ref), isNode(label) && /*#__PURE__*/React.createElement(Notice.Label, null, label), /*#__PURE__*/React.createElement(Notice.Content, null, isNode(title) && /*#__PURE__*/React.createElement(Notice.Title, null, title), textContent, isNode(actions) && /*#__PURE__*/React.createElement(Notice.Actions, null, actions)), closable && /*#__PURE__*/React.createElement(Notice.Close, {
|
|
32
37
|
onClick: onClose
|
|
33
38
|
}));
|
|
34
39
|
}
|
|
35
40
|
}]);
|
|
41
|
+
return NoticeSmart;
|
|
36
42
|
}(Component);
|
|
37
43
|
_defineProperty(NoticeSmart, "displayName", 'NoticeSmart');
|
|
38
44
|
_defineProperty(NoticeSmart, "defaultProps", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoticeSmart.js","names":["createComponent","Component","Root","isNode","
|
|
1
|
+
{"version":3,"file":"NoticeSmart.js","names":["React","createComponent","Component","Root","isNode","Notice","NoticeSmart","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","render","_ref","asProps","SNoticeSmart","_this$asProps","Children","label","title","actions","closable","onClose","textContent","createElement","origin","Text","_assignProps","Label","Content","Title","Actions","Close","onClick","_defineProperty","theme"],"sources":["../../src/NoticeSmart.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root } from '@semcore/core';\nimport isNode from '@semcore/utils/lib/isNode';\nimport Notice from './Notice';\n\nclass NoticeSmart extends Component {\n static displayName = 'NoticeSmart';\n\n static defaultProps = {\n theme: 'info',\n };\n\n render() {\n const SNoticeSmart = Root;\n const { Children, label, title, actions, closable, onClose } = this.asProps;\n let textContent = <Children />;\n\n if (typeof Children.origin === 'string') {\n textContent =\n isNode(title) || isNode(label) || closable ? (\n <Notice.Text>\n <Children />\n </Notice.Text>\n ) : (\n <Children />\n );\n }\n\n return (\n <SNoticeSmart render={Notice} __excludeProps={['title']}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n {isNode(title) && <Notice.Title>{title}</Notice.Title>}\n {textContent}\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.Close onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n}\n\nexport default createComponent(NoticeSmart);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,IAAI,QAAQ,eAAe;AAChE,OAAOC,MAAM,MAAM,2BAA2B;AAC9C,OAAOC,MAAM,MAAM,UAAU;AAAC,IAExBC,WAAW,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,WAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,WAAA;EAAA,SAAAA,YAAA;IAAAK,eAAA,OAAAL,WAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,WAAA;IAAAS,GAAA;IAAAC,KAA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xB,MAAM,CAAC+B,OAAO,QAAEX,OAAO,CAAkB,CAC/C,EAChBC,QAAQ,iBAAI1B,KAAA,CAAA6B,aAAA,CAACxB,MAAM,CAACgC,KAAK;QAACC,OAAO,EAAEX;MAAQ,EAAG,CAClC;IAEnB;EAAC;EAAA,OAAArB,WAAA;AAAA,EAlCuBJ,SAAS;AAAAqC,eAAA,CAA7BjC,WAAW,iBACM,aAAa;AAAAiC,eAAA,CAD9BjC,WAAW,kBAGO;EACpBkC,KAAK,EAAE;AACT,CAAC;AAgCH,eAAevC,eAAe,CAACK,WAAW,CAAC"}
|
package/lib/es6/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport { IconProps } from '@semcore/icon';\nimport { FadeInOutProps } from '@semcore/animation';\nimport { Text } from '@semcore/typography';\n\nexport type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | 'muted';\nexport type NoticeUse = 'primary' | 'secondary';\n\n/** @deprecated */\nexport interface INoticeProps extends NoticeProps, UnknownProperties {}\nexport type NoticeProps = BoxProps &\n FadeInOutProps & {\n /** Property for managing visibility of Notice */\n hidden?: boolean;\n /** Notice type\n * @deprecated since version ^4.1.0\n */\n use?: NoticeUse;\n /**\n * Notice theme\n * @default info\n */\n theme?: NoticeTheme;\n /** Duration of animation, ms\n * @default 250\n */\n duration?: number;\n locale?: string;\n };\n\n/** @deprecated */\nexport interface INoticeLabelProps extends NoticeLabelProps, UnknownProperties {}\nexport type NoticeLabelProps = BoxProps & {\n theme?: NoticeTheme;\n};\n\n/** @deprecated */\nexport interface INoticeContext extends NoticeContext, UnknownProperties {}\nexport type NoticeContext = {\n getLabelProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface INoticeSmartProps extends NoticeSmartProps, UnknownProperties {}\nexport type NoticeSmartProps = NoticeProps & {\n /**\n * A custom element for additional information\n */\n label?: React.ReactNode;\n\n /**\n * A custom element for title\n */\n title?: React.ReactNode;\n\n /**\n * Custom action element\n */\n actions?: React.ReactNode;\n /**\n * Adds a Close button\n */\n closable?: boolean;\n /**\n * Callback on a click on the close button\n */\n onClose?: (event: React.SyntheticEvent) => void;\n};\n\ndeclare const Notice: Intergalactic.Component<'div', NoticeProps, NoticeContext> & {\n Label: Intergalactic.Component<'div', NoticeLabelProps>;\n Actions: typeof Box;\n Content: typeof Box;\n Title: typeof Text;\n Text: typeof Text;\n /**\n * @deprecated Use Notice.Close instead of Notice.CloseIcon\n */\n CloseIcon: Intergalactic.Component<'div', IconProps>;\n Close: typeof Button;\n};\n\ndeclare const NoticeSmart: Intergalactic.Component<'div', NoticeSmartProps>;\n\nexport { NoticeSmart };\nexport default Notice;\n"],"mappings":""}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","Notice","NoticeSmart"],"sources":["../../src/index.js"],"sourcesContent":["import { default as Notice } from './Notice';\n\nexport default Notice;\nexport { default as NoticeSmart } from './NoticeSmart';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,MAAM,QAAQ,UAAU;AAE5C,eAAeA,MAAM;AACrB,SAASD,OAAO,IAAIE,WAAW,QAAQ,eAAe"
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","Notice","NoticeSmart"],"sources":["../../src/index.js"],"sourcesContent":["import { default as Notice } from './Notice';\n\nexport default Notice;\nexport { default as NoticeSmart } from './NoticeSmart';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,MAAM,QAAQ,UAAU;AAE5C,eAAeA,MAAM;AACrB,SAASD,OAAO,IAAIE,WAAW,QAAQ,eAAe"}
|
|
@@ -6,12 +6,12 @@ import it from './it.json';
|
|
|
6
6
|
import ja from './ja.json';
|
|
7
7
|
import ko from './ko.json';
|
|
8
8
|
import nl from './nl.json';
|
|
9
|
-
import pl from './pl.json';
|
|
10
9
|
import pt from './pt.json';
|
|
11
|
-
import sv from './sv.json';
|
|
12
10
|
import tr from './tr.json';
|
|
13
11
|
import vi from './vi.json';
|
|
14
12
|
import zh from './zh.json';
|
|
13
|
+
import pl from './pl.json';
|
|
14
|
+
import sv from './sv.json';
|
|
15
15
|
export var localizedMessages = {
|
|
16
16
|
de: de,
|
|
17
17
|
en: en,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","
|
|
1
|
+
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","pt","tr","vi","zh","pl","sv","localizedMessages"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pt from './pt.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\nimport pl from './pl.json';\nimport sv from './sv.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAE1B,OAAO,IAAMC,iBAAiB,GAAG;EAC/Bd,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA;AACF,CAAC"}
|