@semcore/notice 16.1.12-prerelease.1 → 17.0.0-prerelease.17
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/README.md +4 -4
- package/lib/cjs/Notice.js +160 -177
- package/lib/cjs/Notice.js.map +1 -1
- package/lib/cjs/NoticeSmart.js +27 -38
- package/lib/cjs/NoticeSmart.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +5 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/Notice.js +152 -170
- package/lib/es6/Notice.js.map +1 -1
- package/lib/es6/NoticeSmart.js +22 -33
- package/lib/es6/NoticeSmart.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/Notice.mjs +150 -153
- package/lib/esm/NoticeSmart.mjs +25 -30
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/types/index.d.ts +2 -21
- package/package.json +9 -9
package/lib/es6/NoticeSmart.js
CHANGED
|
@@ -1,43 +1,32 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
2
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
7
3
|
import { createComponent, Component, Root } from '@semcore/core';
|
|
8
4
|
import isNode from '@semcore/core/lib/utils/isNode';
|
|
9
5
|
import React from 'react';
|
|
10
6
|
import Notice from './Notice';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
actions = _this$asProps.actions,
|
|
27
|
-
closable = _this$asProps.closable,
|
|
28
|
-
onClose = _this$asProps.onClose;
|
|
29
|
-
var textContent = /*#__PURE__*/React.createElement(Children, null);
|
|
30
|
-
if (typeof Children.origin === 'string') {
|
|
31
|
-
textContent = isNode(title) || isNode(label) || closable ? /*#__PURE__*/React.createElement(Notice.Text, null, /*#__PURE__*/React.createElement(Children, null)) : /*#__PURE__*/React.createElement(Children, null);
|
|
32
|
-
}
|
|
33
|
-
return /*#__PURE__*/React.createElement(SNoticeSmart, _assignProps({
|
|
34
|
-
"__excludeProps": ['title']
|
|
35
|
-
}, _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, {
|
|
36
|
-
onClick: onClose
|
|
37
|
-
}));
|
|
7
|
+
class NoticeSmart extends Component {
|
|
8
|
+
render() {
|
|
9
|
+
var _ref = this.asProps;
|
|
10
|
+
const SNoticeSmart = Notice;
|
|
11
|
+
const {
|
|
12
|
+
Children,
|
|
13
|
+
label,
|
|
14
|
+
title,
|
|
15
|
+
actions,
|
|
16
|
+
closable,
|
|
17
|
+
onClose
|
|
18
|
+
} = this.asProps;
|
|
19
|
+
let textContent = /*#__PURE__*/React.createElement(Children, null);
|
|
20
|
+
if (typeof Children.origin === 'string') {
|
|
21
|
+
textContent = isNode(title) || isNode(label) || closable ? /*#__PURE__*/React.createElement(Notice.Text, null, /*#__PURE__*/React.createElement(Children, null)) : /*#__PURE__*/React.createElement(Children, null);
|
|
38
22
|
}
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
return /*#__PURE__*/React.createElement(SNoticeSmart, _assignProps({
|
|
24
|
+
"__excludeProps": ['title']
|
|
25
|
+
}, _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, {
|
|
26
|
+
onClick: onClose
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
41
30
|
_defineProperty(NoticeSmart, "displayName", 'NoticeSmart');
|
|
42
31
|
_defineProperty(NoticeSmart, "defaultProps", {
|
|
43
32
|
theme: 'info'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoticeSmart.js","names":["createComponent","Component","Root","isNode","React","Notice","NoticeSmart","
|
|
1
|
+
{"version":3,"file":"NoticeSmart.js","names":["createComponent","Component","Root","isNode","React","Notice","NoticeSmart","render","_ref","asProps","SNoticeSmart","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 { createComponent, Component, Root } from '@semcore/core';\nimport isNode from '@semcore/core/lib/utils/isNode';\nimport React from 'react';\n\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 ? (\n <Notice.Text>\n <Children />\n </Notice.Text>\n )\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,SAASA,eAAe,EAAEC,SAAS,EAAEC,IAAI,QAAQ,eAAe;AAChE,OAAOC,MAAM,MAAM,gCAAgC;AACnD,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,MAAM,MAAM,UAAU;AAE7B,MAAMC,WAAW,SAASL,SAAS,CAAC;EAOlCM,MAAMA,CAAA,EAAG;IAAA,IAAAC,IAAA,QAAAC,OAAA;IACP,MAAMC,YAAY,GAkBML,MAAM;IAjB9B,MAAM;MAAEM,QAAQ;MAAEC,KAAK;MAAEC,KAAK;MAAEC,OAAO;MAAEC,QAAQ;MAAEC;IAAQ,CAAC,GAAG,IAAI,CAACP,OAAO;IAC3E,IAAIQ,WAAW,gBAAGb,KAAA,CAAAc,aAAA,CAACP,QAAQ,MAAE,CAAC;IAE9B,IAAI,OAAOA,QAAQ,CAACQ,MAAM,KAAK,QAAQ,EAAE;MACvCF,WAAW,GACTd,MAAM,CAACU,KAAK,CAAC,IAAIV,MAAM,CAACS,KAAK,CAAC,IAAIG,QAAQ,gBAEpCX,KAAA,CAAAc,aAAA,CAACb,MAAM,CAACe,IAAI,qBACVhB,KAAA,CAAAc,aAAA,CAACP,QAAQ,MAAE,CACA,CAAC,gBAGdP,KAAA,CAAAc,aAAA,CAACP,QAAQ,MAAE,CACZ;IACT;IAEA,oBACEP,KAAA,CAAAc,aAAA,CAACR,YAAY,EAAAW,YAAA;MAAA,kBAAiC,CAAC,OAAO;IAAC,GAAAb,IAAA,GACpDL,MAAM,CAACS,KAAK,CAAC,iBAAIR,KAAA,CAAAc,aAAA,CAACb,MAAM,CAACiB,KAAK,QAAEV,KAAoB,CAAC,eACtDR,KAAA,CAAAc,aAAA,CAACb,MAAM,CAACkB,OAAO,QACZpB,MAAM,CAACU,KAAK,CAAC,iBAAIT,KAAA,CAAAc,aAAA,CAACb,MAAM,CAACmB,KAAK,QAAEX,KAAoB,CAAC,EACrDI,WAAW,EACXd,MAAM,CAACW,OAAO,CAAC,iBAAIV,KAAA,CAAAc,aAAA,CAACb,MAAM,CAACoB,OAAO,QAAEX,OAAwB,CAC/C,CAAC,EAChBC,QAAQ,iBAAIX,KAAA,CAAAc,aAAA,CAACb,MAAM,CAACqB,KAAK;MAACC,OAAO,EAAEX;IAAQ,CAAE,CAClC,CAAC;EAEnB;AACF;AAACY,eAAA,CArCKtB,WAAW,iBACM,aAAa;AAAAsB,eAAA,CAD9BtB,WAAW,kBAGO;EACpBuB,KAAK,EAAE;AACT,CAAC;AAkCH,eAAe7B,eAAe,CAACM,WAAW,CAAC","ignoreList":[]}
|
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 type { FadeInOutProps } from '@semcore/
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { FadeInOutProps, Box, BoxProps } from '@semcore/base-components';\nimport type Button from '@semcore/button';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text } from '@semcore/typography';\n\nexport type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | 'muted';\n\nexport type NoticeProps = BoxProps &\n FadeInOutProps & {\n /** Property for managing visibility of Notice */\n hidden?: boolean;\n /**\n * Notice theme\n * @default info\n */\n theme?: NoticeTheme;\n /** Duration of animation, ms\n * @default 250\n */\n duration?: number;\n /** Specifies the locale for i18n support */\n locale?: string;\n };\n\nexport type NoticeLabelProps = BoxProps & {\n theme?: NoticeTheme;\n};\n\nexport type NoticeContext = {\n getLabelProps: PropGetterFn;\n};\n\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 Close: typeof Button;\n};\n\ndeclare const NoticeSmart: Intergalactic.Component<'div', NoticeSmartProps>;\n\nexport { NoticeSmart };\nexport default Notice;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -12,20 +12,20 @@ import sv from './sv.json';
|
|
|
12
12
|
import tr from './tr.json';
|
|
13
13
|
import vi from './vi.json';
|
|
14
14
|
import zh from './zh.json';
|
|
15
|
-
export
|
|
16
|
-
de
|
|
17
|
-
en
|
|
18
|
-
es
|
|
19
|
-
fr
|
|
20
|
-
it
|
|
21
|
-
ja
|
|
22
|
-
ko
|
|
23
|
-
nl
|
|
24
|
-
pt
|
|
25
|
-
tr
|
|
26
|
-
vi
|
|
27
|
-
zh
|
|
28
|
-
pl
|
|
29
|
-
sv
|
|
15
|
+
export const localizedMessages = {
|
|
16
|
+
de,
|
|
17
|
+
en,
|
|
18
|
+
es,
|
|
19
|
+
fr,
|
|
20
|
+
it,
|
|
21
|
+
ja,
|
|
22
|
+
ko,
|
|
23
|
+
nl,
|
|
24
|
+
pt,
|
|
25
|
+
tr,
|
|
26
|
+
vi,
|
|
27
|
+
zh,
|
|
28
|
+
pl,
|
|
29
|
+
sv
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=__intergalactic-dynamic-locales.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","pl","pt","sv","tr","vi","zh","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 pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.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,
|
|
1
|
+
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","pl","pt","sv","tr","vi","zh","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 pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.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,MAAMC,iBAAiB,GAAG;EAC/Bd,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFE,EAAE;EACFE,EAAE;EACFC,EAAE;EACFC,EAAE;EACFL,EAAE;EACFE;AACF,CAAC","ignoreList":[]}
|
package/lib/esm/Notice.mjs
CHANGED
|
@@ -1,130 +1,117 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
-
import { createComponent, sstyled,
|
|
8
|
-
import { FadeInOut } from "@semcore/
|
|
2
|
+
import { createComponent, sstyled, Component, assignProps } from "@semcore/core";
|
|
3
|
+
import { FadeInOut, Box } from "@semcore/base-components";
|
|
9
4
|
import Button from "@semcore/button";
|
|
10
5
|
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
11
6
|
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
12
7
|
import logger from "@semcore/core/lib/utils/logger";
|
|
13
8
|
import { cssVariableEnhance } from "@semcore/core/lib/utils/useCssVariable";
|
|
14
|
-
import { Box } from "@semcore/flex-box";
|
|
15
9
|
import CloseIconM from "@semcore/icon/Close/m";
|
|
16
|
-
import NoticeGlobal from "@semcore/notice-global";
|
|
17
10
|
import { Text } from "@semcore/typography";
|
|
18
11
|
import React from "react";
|
|
19
12
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
20
13
|
/*!__reshadow-styles__:"./style/notice.shadow.css"*/
|
|
21
|
-
|
|
14
|
+
const style = (
|
|
22
15
|
/*__reshadow_css_start__*/
|
|
23
16
|
(sstyled.insert(
|
|
24
17
|
/*__inner_css_start__*/
|
|
25
|
-
".
|
|
18
|
+
".___SNotice_1qegg_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, 6px);color:var(--intergalactic-text-primary, #191b23)}.___SNotice_1qegg_gg_._theme_info_1qegg_gg_{background-color:var(--intergalactic-bg-secondary-info, #e9f7ff);border-color:var(--intergalactic-border-info, #8ecdff)}.___SNotice_1qegg_gg_._theme_info_1qegg_gg_ .___SCloseIcon_1qegg_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_1qegg_gg_._theme_info_1qegg_gg_ .___SCloseIcon_1qegg_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SNotice_1qegg_gg_._theme_danger_1qegg_gg_{background-color:var(--intergalactic-bg-secondary-critical, #fff0f7);border-color:var(--intergalactic-border-critical, #ffaeb5)}.___SNotice_1qegg_gg_._theme_danger_1qegg_gg_ .___SCloseIcon_1qegg_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}@media (hover:hover){.___SNotice_1qegg_gg_._theme_danger_1qegg_gg_ .___SCloseIcon_1qegg_gg_:hover{color:var(--intergalactic-icon-primary-critical-hover-active, #CC3A42)}}.___SNotice_1qegg_gg_._theme_warning_1qegg_gg_{background-color:var(--intergalactic-bg-secondary-warning, #fff3d9);border-color:var(--intergalactic-border-warning, #ffb26e)}.___SNotice_1qegg_gg_._theme_warning_1qegg_gg_ .___SCloseIcon_1qegg_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}@media (hover:hover){.___SNotice_1qegg_gg_._theme_warning_1qegg_gg_ .___SCloseIcon_1qegg_gg_:hover{color:var(--intergalactic-icon-primary-warning-hover-active, #CC5024)}}.___SNotice_1qegg_gg_._theme_success_1qegg_gg_{background-color:var(--intergalactic-bg-secondary-success, #dbfee8);border-color:var(--intergalactic-border-success, #59ddaa)}.___SNotice_1qegg_gg_._theme_success_1qegg_gg_ .___SCloseIcon_1qegg_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}@media (hover:hover){.___SNotice_1qegg_gg_._theme_success_1qegg_gg_ .___SCloseIcon_1qegg_gg_:hover{color:var(--intergalactic-icon-primary-success-hover-active, #037E68)}}.___SNotice_1qegg_gg_._theme_muted_1qegg_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);border-color:var(--intergalactic-border-secondary, #e0e1e9)}.___SLabel_1qegg_gg_._theme_info_1qegg_gg_,.___SNotice_1qegg_gg_._theme_muted_1qegg_gg_ .___SCloseIcon_1qegg_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_1qegg_gg_._theme_muted_1qegg_gg_ .___SCloseIcon_1qegg_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SContent_1qegg_gg_{flex:1 1 auto;width:100%}.___SActions_1qegg_gg_{flex-shrink:0;margin-top:var(--intergalactic-spacing-3x, 12px)}.___SLabel_1qegg_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_1qegg_gg_._theme_danger_1qegg_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}.___SLabel_1qegg_gg_._theme_warning_1qegg_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}.___SLabel_1qegg_gg_._theme_success_1qegg_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}.___SLabel_1qegg_gg_._theme_muted_1qegg_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SLabel_1qegg_gg_._theme_custom_1qegg_gg_{color:var(--color_1qegg)}.___SCloseIcon_1qegg_gg_{flex-shrink:0;margin-left:var(--intergalactic-spacing-4x, 16px)}.___SNotice_1qegg_gg_._theme_custom_1qegg_gg_{background-color:var(--backgroundColor_1qegg);border-color:var(--backgroundColor_1qegg)}.___STitle_1qegg_gg_{margin-top:var(--intergalactic-spacing-05x, 2px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}.___SText_1qegg_gg_{margin-top:var(--intergalactic-spacing-1x, 4px);margin-bottom:var(--intergalactic-spacing-1x, 4px)}",
|
|
26
19
|
/*__inner_css_end__*/
|
|
27
|
-
"
|
|
20
|
+
"1qegg_gg_"
|
|
28
21
|
), /*__reshadow_css_end__*/
|
|
29
22
|
{
|
|
30
|
-
"__SNotice": "
|
|
31
|
-
"__SContent": "
|
|
32
|
-
"__SActions": "
|
|
33
|
-
"__SLabel": "
|
|
34
|
-
"_theme_info": "
|
|
35
|
-
"_theme_danger": "
|
|
36
|
-
"_theme_warning": "
|
|
37
|
-
"_theme_success": "
|
|
38
|
-
"_theme_muted": "
|
|
39
|
-
"_theme_custom": "
|
|
40
|
-
"--color": "--
|
|
41
|
-
"__SCloseIcon": "
|
|
42
|
-
"--backgroundColor": "--
|
|
43
|
-
"__STitle": "
|
|
44
|
-
"__SText": "
|
|
23
|
+
"__SNotice": "___SNotice_1qegg_gg_",
|
|
24
|
+
"__SContent": "___SContent_1qegg_gg_",
|
|
25
|
+
"__SActions": "___SActions_1qegg_gg_",
|
|
26
|
+
"__SLabel": "___SLabel_1qegg_gg_",
|
|
27
|
+
"_theme_info": "_theme_info_1qegg_gg_",
|
|
28
|
+
"_theme_danger": "_theme_danger_1qegg_gg_",
|
|
29
|
+
"_theme_warning": "_theme_warning_1qegg_gg_",
|
|
30
|
+
"_theme_success": "_theme_success_1qegg_gg_",
|
|
31
|
+
"_theme_muted": "_theme_muted_1qegg_gg_",
|
|
32
|
+
"_theme_custom": "_theme_custom_1qegg_gg_",
|
|
33
|
+
"--color": "--color_1qegg",
|
|
34
|
+
"__SCloseIcon": "___SCloseIcon_1qegg_gg_",
|
|
35
|
+
"--backgroundColor": "--backgroundColor_1qegg",
|
|
36
|
+
"__STitle": "___STitle_1qegg_gg_",
|
|
37
|
+
"__SText": "___SText_1qegg_gg_"
|
|
45
38
|
})
|
|
46
39
|
);
|
|
47
40
|
function isCustomTheme(theme) {
|
|
48
41
|
return !["danger", "warning", "success", "info", "muted"].includes(theme);
|
|
49
42
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
|
-
args[_key] = arguments[_key];
|
|
56
|
-
}
|
|
57
|
-
_this = _callSuper(this, RootNotice2, [].concat(args));
|
|
58
|
-
_defineProperty(_this, "ref", /* @__PURE__ */ React.createRef());
|
|
59
|
-
return _this;
|
|
43
|
+
class RootNotice extends Component {
|
|
44
|
+
constructor(...args) {
|
|
45
|
+
super(...args);
|
|
46
|
+
_defineProperty(this, "ref", /* @__PURE__ */ React.createRef());
|
|
60
47
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (node.hasAttribute("aria-labelledby")) return true;
|
|
69
|
-
if (node.hasAttribute("title")) return true;
|
|
70
|
-
return false;
|
|
71
|
-
};
|
|
72
|
-
logger.warn(!hasTitle(this.ref.current), "Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification", this.props["data-ui-name"] || RootNotice2.displayName);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
key: "getLabelProps",
|
|
77
|
-
value: function getLabelProps() {
|
|
78
|
-
var _this$asProps = this.asProps, theme = _this$asProps.theme, resolveColor = _this$asProps.resolveColor;
|
|
79
|
-
return {
|
|
80
|
-
theme,
|
|
81
|
-
resolveColor
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
}, {
|
|
85
|
-
key: "getCloseIconProps",
|
|
86
|
-
value: function getCloseIconProps() {
|
|
87
|
-
var getI18nText = this.asProps.getI18nText;
|
|
88
|
-
return {
|
|
89
|
-
getI18nText
|
|
48
|
+
componentDidMount() {
|
|
49
|
+
if (this.ref.current && process.env.NODE_ENV !== "production" && !["muted", "danger"].includes(this.props.theme)) {
|
|
50
|
+
const hasTitle = (node) => {
|
|
51
|
+
if (node.hasAttribute("aria-label")) return true;
|
|
52
|
+
if (node.hasAttribute("aria-labelledby")) return true;
|
|
53
|
+
if (node.hasAttribute("title")) return true;
|
|
54
|
+
return false;
|
|
90
55
|
};
|
|
56
|
+
logger.warn(!hasTitle(this.ref.current), `Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification`, this.props["data-ui-name"] || RootNotice.displayName);
|
|
91
57
|
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
58
|
+
}
|
|
59
|
+
getLabelProps() {
|
|
60
|
+
const {
|
|
61
|
+
theme,
|
|
62
|
+
resolveColor
|
|
63
|
+
} = this.asProps;
|
|
64
|
+
return {
|
|
65
|
+
theme,
|
|
66
|
+
resolveColor
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
getCloseIconProps() {
|
|
70
|
+
const {
|
|
71
|
+
getI18nText
|
|
72
|
+
} = this.asProps;
|
|
73
|
+
return {
|
|
74
|
+
getI18nText
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
getCloseProps() {
|
|
78
|
+
const {
|
|
79
|
+
getI18nText
|
|
80
|
+
} = this.asProps;
|
|
81
|
+
return {
|
|
82
|
+
getI18nText
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
var _ref = this.asProps, _ref8;
|
|
87
|
+
const SNotice = FadeInOut;
|
|
88
|
+
const {
|
|
89
|
+
Children,
|
|
90
|
+
styles,
|
|
91
|
+
hidden,
|
|
92
|
+
theme,
|
|
93
|
+
resolveColor,
|
|
94
|
+
getI18nText
|
|
95
|
+
} = this.asProps;
|
|
96
|
+
const color = resolveColor(theme);
|
|
97
|
+
const useTheme = isCustomTheme(theme) ? "custom" : theme;
|
|
98
|
+
let ariaLabel = getI18nText(theme === "danger" ? "criticalNotification" : "notification");
|
|
99
|
+
if (theme === "muted") {
|
|
100
|
+
ariaLabel = void 0;
|
|
99
101
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var _ref = this.asProps, _ref9;
|
|
104
|
-
var SNotice = FadeInOut;
|
|
105
|
-
var _this$asProps2 = this.asProps, Children = _this$asProps2.Children, styles = _this$asProps2.styles, hidden = _this$asProps2.hidden, theme = _this$asProps2.theme, use = _this$asProps2.use, resolveColor = _this$asProps2.resolveColor, getI18nText = _this$asProps2.getI18nText;
|
|
106
|
-
var color = resolveColor(theme);
|
|
107
|
-
var useTheme = isCustomTheme(theme) ? "custom" : theme;
|
|
108
|
-
if (use === "primary") {
|
|
109
|
-
logger.warn(true, 'Deprecated property-value pair "use=primary", use component <NoticeGlobal/> instead', RootNotice2.displayName);
|
|
110
|
-
return /* @__PURE__ */ React.createElement(NoticeGlobal, this.asProps);
|
|
111
|
-
}
|
|
112
|
-
var ariaLabel = getI18nText(theme === "danger" ? "criticalNotification" : "notification");
|
|
113
|
-
if (theme === "muted") {
|
|
114
|
-
ariaLabel = void 0;
|
|
115
|
-
}
|
|
116
|
-
var role = theme === "muted" ? void 0 : "region";
|
|
117
|
-
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SNotice, _ref9.cn("SNotice", _objectSpread({}, assignProps({
|
|
102
|
+
const role = theme === "muted" ? void 0 : "region";
|
|
103
|
+
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SNotice, _ref8.cn("SNotice", {
|
|
104
|
+
...assignProps({
|
|
118
105
|
"visible": !hidden,
|
|
119
106
|
"use:theme": useTheme,
|
|
120
107
|
"backgroundColor": color,
|
|
121
108
|
"role": role,
|
|
122
109
|
"aria-label": ariaLabel,
|
|
123
110
|
"ref": this.ref
|
|
124
|
-
}, _ref)
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
111
|
+
}, _ref)
|
|
112
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref8.cn("Children", {})));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
128
115
|
_defineProperty(RootNotice, "displayName", "Notice");
|
|
129
116
|
_defineProperty(RootNotice, "style", style);
|
|
130
117
|
_defineProperty(RootNotice, "enhance", [i18nEnhance(localizedMessages), cssVariableEnhance({
|
|
@@ -138,75 +125,85 @@ _defineProperty(RootNotice, "defaultProps", {
|
|
|
138
125
|
i18n: localizedMessages,
|
|
139
126
|
locale: "en"
|
|
140
127
|
});
|
|
141
|
-
function Label(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return _ref1 = sstyled(styles), /* @__PURE__ */ React.createElement(STitle, _ref1.cn("STitle", _objectSpread({}, assignProps({
|
|
157
|
-
"tag": "div",
|
|
158
|
-
"size": 300,
|
|
159
|
-
"fontWeight": "bold"
|
|
160
|
-
}, _ref3))));
|
|
128
|
+
function Label({
|
|
129
|
+
styles,
|
|
130
|
+
theme,
|
|
131
|
+
resolveColor
|
|
132
|
+
}) {
|
|
133
|
+
var _ref2 = arguments[0], _ref9;
|
|
134
|
+
const SLabel = Box;
|
|
135
|
+
const useTheme = isCustomTheme(theme) ? "custom" : theme;
|
|
136
|
+
const color = resolveColor(theme);
|
|
137
|
+
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SLabel, _ref9.cn("SLabel", {
|
|
138
|
+
...assignProps({
|
|
139
|
+
"use:theme": useTheme,
|
|
140
|
+
"color": color
|
|
141
|
+
}, _ref2)
|
|
142
|
+
}));
|
|
161
143
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
var
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
144
|
+
function Title({
|
|
145
|
+
styles
|
|
146
|
+
}) {
|
|
147
|
+
var _ref3 = arguments[0], _ref0;
|
|
148
|
+
const STitle = Text;
|
|
149
|
+
return _ref0 = sstyled(styles), /* @__PURE__ */ React.createElement(STitle, _ref0.cn("STitle", {
|
|
150
|
+
...assignProps({
|
|
151
|
+
"tag": "div",
|
|
152
|
+
"size": 300,
|
|
153
|
+
"fontWeight": "bold"
|
|
154
|
+
}, _ref3)
|
|
155
|
+
}));
|
|
169
156
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
var
|
|
174
|
-
|
|
157
|
+
function NoticeText({
|
|
158
|
+
styles
|
|
159
|
+
}) {
|
|
160
|
+
var _ref4 = arguments[0], _ref1;
|
|
161
|
+
const SText = Text;
|
|
162
|
+
return _ref1 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref1.cn("SText", {
|
|
163
|
+
...assignProps({
|
|
164
|
+
"tag": "div"
|
|
165
|
+
}, _ref4)
|
|
166
|
+
}));
|
|
175
167
|
}
|
|
176
|
-
function
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
var
|
|
180
|
-
|
|
168
|
+
function Actions({
|
|
169
|
+
styles
|
|
170
|
+
}) {
|
|
171
|
+
var _ref5 = arguments[0], _ref10;
|
|
172
|
+
const SActions = Box;
|
|
173
|
+
return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SActions, _ref10.cn("SActions", {
|
|
174
|
+
...assignProps({}, _ref5)
|
|
175
|
+
}));
|
|
181
176
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
var
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}, _ref7))));
|
|
177
|
+
function Content({
|
|
178
|
+
styles
|
|
179
|
+
}) {
|
|
180
|
+
var _ref6 = arguments[0], _ref11;
|
|
181
|
+
const SContent = Box;
|
|
182
|
+
return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(SContent, _ref11.cn("SContent", {
|
|
183
|
+
...assignProps({}, _ref6)
|
|
184
|
+
}));
|
|
191
185
|
}
|
|
192
|
-
function Close(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
186
|
+
function Close({
|
|
187
|
+
styles,
|
|
188
|
+
getI18nText
|
|
189
|
+
}) {
|
|
190
|
+
var _ref7 = arguments[0], _ref12;
|
|
191
|
+
const SCloseIcon = Button;
|
|
192
|
+
return _ref12 = sstyled(styles), /* @__PURE__ */ React.createElement(SCloseIcon, _ref12.cn("SCloseIcon", {
|
|
193
|
+
...assignProps({
|
|
194
|
+
"addonLeft": CloseIconM,
|
|
195
|
+
"use": "tertiary",
|
|
196
|
+
"theme": "muted",
|
|
197
|
+
"aria-label": getI18nText("close")
|
|
198
|
+
}, _ref7)
|
|
199
|
+
}));
|
|
202
200
|
}
|
|
203
|
-
|
|
201
|
+
const Notice = createComponent(RootNotice, {
|
|
204
202
|
Label,
|
|
205
203
|
Title,
|
|
206
204
|
Text: NoticeText,
|
|
207
205
|
Actions,
|
|
208
206
|
Content,
|
|
209
|
-
CloseIcon,
|
|
210
207
|
Close
|
|
211
208
|
});
|
|
212
209
|
export {
|
package/lib/esm/NoticeSmart.mjs
CHANGED
|
@@ -1,41 +1,36 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
import { createComponent,
|
|
2
|
+
import { createComponent, Component, assignProps } from "@semcore/core";
|
|
7
3
|
import isNode from "@semcore/core/lib/utils/isNode";
|
|
8
4
|
import React from "react";
|
|
9
5
|
import Notice from "./Notice.mjs";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
return /* @__PURE__ */ React.createElement(SNoticeSmart, assignProps({
|
|
27
|
-
"__excludeProps": ["title"]
|
|
28
|
-
}, _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, {
|
|
29
|
-
onClick: onClose
|
|
30
|
-
}));
|
|
6
|
+
class NoticeSmart extends Component {
|
|
7
|
+
render() {
|
|
8
|
+
var _ref = this.asProps;
|
|
9
|
+
const SNoticeSmart = Notice;
|
|
10
|
+
const {
|
|
11
|
+
Children,
|
|
12
|
+
label,
|
|
13
|
+
title,
|
|
14
|
+
actions,
|
|
15
|
+
closable,
|
|
16
|
+
onClose
|
|
17
|
+
} = this.asProps;
|
|
18
|
+
let textContent = /* @__PURE__ */ React.createElement(Children, null);
|
|
19
|
+
if (typeof Children.origin === "string") {
|
|
20
|
+
textContent = isNode(title) || isNode(label) || closable ? /* @__PURE__ */ React.createElement(Notice.Text, null, /* @__PURE__ */ React.createElement(Children, null)) : /* @__PURE__ */ React.createElement(Children, null);
|
|
31
21
|
}
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
return /* @__PURE__ */ React.createElement(SNoticeSmart, assignProps({
|
|
23
|
+
"__excludeProps": ["title"]
|
|
24
|
+
}, _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, {
|
|
25
|
+
onClick: onClose
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
34
29
|
_defineProperty(NoticeSmart, "displayName", "NoticeSmart");
|
|
35
30
|
_defineProperty(NoticeSmart, "defaultProps", {
|
|
36
31
|
theme: "info"
|
|
37
32
|
});
|
|
38
|
-
const
|
|
33
|
+
const NoticeSmart_default = createComponent(NoticeSmart);
|
|
39
34
|
export {
|
|
40
|
-
|
|
35
|
+
NoticeSmart_default as default
|
|
41
36
|
};
|