@semcore/notice 3.2.4 → 3.2.7
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 +18 -0
- package/lib/cjs/Notice.js +5 -5
- package/lib/cjs/NoticeSmart.js +1 -2
- package/lib/cjs/NoticeSmart.js.map +1 -1
- package/lib/cjs/index.d.ts +63 -0
- package/lib/es6/Notice.js +5 -5
- package/lib/es6/NoticeSmart.js +1 -2
- package/lib/es6/NoticeSmart.js.map +1 -1
- package/lib/es6/index.d.ts +63 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [3.2.7] - 2022-05-16
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version patch update due to children dependencies update (`@semcore/icon` [2.21.0 ~> 2.24.0]).
|
|
10
|
+
|
|
11
|
+
## [3.2.6] - 2022-04-28
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Version patch update due to children dependencies update (`@semcore/icon` [2.20.0 ~> 2.21.0]).
|
|
16
|
+
|
|
17
|
+
## [3.2.5] - 2022-04-03
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Version patch update due to children dependencies update (`@semcore/animation` [1.5.0 ~> 1.5.0]).
|
|
22
|
+
|
|
5
23
|
## [3.2.4] - 2022-03-21
|
|
6
24
|
|
|
7
25
|
### Changed
|
package/lib/cjs/Notice.js
CHANGED
|
@@ -96,7 +96,7 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
96
96
|
}, {
|
|
97
97
|
key: "render",
|
|
98
98
|
value: function render() {
|
|
99
|
-
var _ref = this
|
|
99
|
+
var _ref = this.asProps,
|
|
100
100
|
_ref6;
|
|
101
101
|
|
|
102
102
|
var SNotice = _animation.FadeInOut;
|
|
@@ -127,7 +127,7 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
function Label(_ref11) {
|
|
130
|
-
var _ref2 =
|
|
130
|
+
var _ref2 = arguments[0],
|
|
131
131
|
_ref7;
|
|
132
132
|
|
|
133
133
|
var styles = _ref11.styles,
|
|
@@ -142,7 +142,7 @@ function Label(_ref11) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
function Actions(_ref12) {
|
|
145
|
-
var _ref3 =
|
|
145
|
+
var _ref3 = arguments[0],
|
|
146
146
|
_ref8;
|
|
147
147
|
|
|
148
148
|
var styles = _ref12.styles;
|
|
@@ -151,7 +151,7 @@ function Actions(_ref12) {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
function Content(_ref13) {
|
|
154
|
-
var _ref4 =
|
|
154
|
+
var _ref4 = arguments[0],
|
|
155
155
|
_ref9;
|
|
156
156
|
|
|
157
157
|
var styles = _ref13.styles;
|
|
@@ -160,7 +160,7 @@ function Content(_ref13) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
function CloseIcon(_ref14) {
|
|
163
|
-
var _ref5 =
|
|
163
|
+
var _ref5 = arguments[0],
|
|
164
164
|
_ref10;
|
|
165
165
|
|
|
166
166
|
var styles = _ref14.styles;
|
package/lib/cjs/NoticeSmart.js
CHANGED
|
@@ -50,8 +50,7 @@ var NoticeSmart = /*#__PURE__*/function (_Component) {
|
|
|
50
50
|
(0, _createClass2["default"])(NoticeSmart, [{
|
|
51
51
|
key: "render",
|
|
52
52
|
value: function render() {
|
|
53
|
-
var _ref = this
|
|
54
|
-
|
|
53
|
+
var _ref = this.asProps;
|
|
55
54
|
var SNoticeSmart = _Notice["default"];
|
|
56
55
|
var _this$asProps = this.asProps,
|
|
57
56
|
Children = _this$asProps.Children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/NoticeSmart.jsx"],"names":["NoticeSmart","SNoticeSmart","Notice","asProps","Children","label","actions","closable","onClose","Component","theme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;;;;;;;;;IAEMA,W;;;;;;;;;;;;WAOJ,kBAAS;AAAA
|
|
1
|
+
{"version":3,"sources":["../../src/NoticeSmart.jsx"],"names":["NoticeSmart","SNoticeSmart","Notice","asProps","Children","label","actions","closable","onClose","Component","theme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;;;;;;;;;IAEMA,W;;;;;;;;;;;;WAOJ,kBAAS;AAAA;AACP,UAAMC,YAAY,GAGMC,kBAHxB;AACA,0BAAwD,KAAKC,OAA7D;AAAA,UAAQC,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,KAAlB,iBAAkBA,KAAlB;AAAA,UAAyBC,OAAzB,iBAAyBA,OAAzB;AAAA,UAAkCC,QAAlC,iBAAkCA,QAAlC;AAAA,UAA4CC,OAA5C,iBAA4CA,OAA5C;AACA,0BACE,gCAAC,YAAD,oCACG,wBAAOH,KAAP,kBAAiB,gCAAC,kBAAD,CAAQ,KAAR,QAAeA,KAAf,CADpB,eAEE,gCAAC,kBAAD,CAAQ,OAAR,qBACE,gCAAC,QAAD,OADF,EAEG,wBAAOC,OAAP,kBAAmB,gCAAC,kBAAD,CAAQ,OAAR,QAAiBA,OAAjB,CAFtB,CAFF,EAMGC,QAAQ,iBAAI,gCAAC,kBAAD,CAAQ,SAAR;AAAkB,QAAA,OAAO,EAAEC;AAA3B,QANf,CADF;AAUD;;;EApBuBC,e;;iCAApBT,W,iBACiB,a;iCADjBA,W,kBAGkB;AACpBU,EAAAA,KAAK,EAAE;AADa,C;;eAoBT,sBAAgBV,WAAhB,C","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, actions, closable, onClose } = this.asProps;\n return (\n <SNoticeSmart render={Notice}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n <Children />\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.CloseIcon onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n}\n\nexport default createComponent(NoticeSmart);\n"],"file":"NoticeSmart.js"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { CProps, PropGetterFn, ReturnEl } from '@semcore/core';
|
|
2
|
+
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
3
|
+
import { IIconProps } from '@semcore/icon';
|
|
4
|
+
|
|
5
|
+
export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | string;
|
|
6
|
+
export type NoticeUse = 'primary' | 'secondary';
|
|
7
|
+
|
|
8
|
+
export interface INoticeProps extends IBoxProps {
|
|
9
|
+
/** Property for managing visibility of Notice */
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
/** Notice type
|
|
12
|
+
* @default secondary
|
|
13
|
+
*/
|
|
14
|
+
use?: NoticeUse;
|
|
15
|
+
/**
|
|
16
|
+
* Notice theme
|
|
17
|
+
* @default info
|
|
18
|
+
*/
|
|
19
|
+
theme?: NoticeTheme;
|
|
20
|
+
/** Duration of animation, ms
|
|
21
|
+
* @default 200
|
|
22
|
+
*/
|
|
23
|
+
duration?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface INoticeLabelProps extends IBoxProps {
|
|
27
|
+
theme?: NoticeTheme;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface INoticeContext {
|
|
31
|
+
getLabelProps: PropGetterFn;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface INoticeSmartProps extends INoticeProps {
|
|
35
|
+
/**
|
|
36
|
+
* A custom element for additional information
|
|
37
|
+
*/
|
|
38
|
+
label?: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Custom action element
|
|
41
|
+
*/
|
|
42
|
+
actions?: React.ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Adds a Close icon
|
|
45
|
+
*/
|
|
46
|
+
closable?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Callback on a click on the close button
|
|
49
|
+
*/
|
|
50
|
+
onClose?: (event: React.SyntheticEvent) => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare const Notice: (<T>(props: CProps<INoticeProps & T, INoticeContext>) => ReturnEl) & {
|
|
54
|
+
Label: <T>(props: INoticeLabelProps & T) => ReturnEl;
|
|
55
|
+
Actions: typeof Box;
|
|
56
|
+
Content: typeof Box;
|
|
57
|
+
CloseIcon: <T>(props: IIconProps & T) => ReturnEl;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
declare const NoticeSmart: <T>(props: CProps<INoticeSmartProps & T>) => ReturnEl;
|
|
61
|
+
|
|
62
|
+
export { NoticeSmart };
|
|
63
|
+
export default Notice;
|
package/lib/es6/Notice.js
CHANGED
|
@@ -78,7 +78,7 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
78
78
|
}, {
|
|
79
79
|
key: "render",
|
|
80
80
|
value: function render() {
|
|
81
|
-
var _ref = this
|
|
81
|
+
var _ref = this.asProps,
|
|
82
82
|
_ref6;
|
|
83
83
|
|
|
84
84
|
var SNotice = FadeInOut;
|
|
@@ -112,7 +112,7 @@ _defineProperty(RootNotice, "defaultProps", {
|
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
function Label(_ref11) {
|
|
115
|
-
var _ref2 =
|
|
115
|
+
var _ref2 = arguments[0],
|
|
116
116
|
_ref7;
|
|
117
117
|
|
|
118
118
|
var styles = _ref11.styles,
|
|
@@ -127,7 +127,7 @@ function Label(_ref11) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
function Actions(_ref12) {
|
|
130
|
-
var _ref3 =
|
|
130
|
+
var _ref3 = arguments[0],
|
|
131
131
|
_ref8;
|
|
132
132
|
|
|
133
133
|
var styles = _ref12.styles;
|
|
@@ -136,7 +136,7 @@ function Actions(_ref12) {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
function Content(_ref13) {
|
|
139
|
-
var _ref4 =
|
|
139
|
+
var _ref4 = arguments[0],
|
|
140
140
|
_ref9;
|
|
141
141
|
|
|
142
142
|
var styles = _ref13.styles;
|
|
@@ -145,7 +145,7 @@ function Content(_ref13) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
function CloseIcon(_ref14) {
|
|
148
|
-
var _ref5 =
|
|
148
|
+
var _ref5 = arguments[0],
|
|
149
149
|
_ref10;
|
|
150
150
|
|
|
151
151
|
var styles = _ref14.styles;
|
package/lib/es6/NoticeSmart.js
CHANGED
|
@@ -29,8 +29,7 @@ var NoticeSmart = /*#__PURE__*/function (_Component) {
|
|
|
29
29
|
_createClass(NoticeSmart, [{
|
|
30
30
|
key: "render",
|
|
31
31
|
value: function render() {
|
|
32
|
-
var _ref = this
|
|
33
|
-
|
|
32
|
+
var _ref = this.asProps;
|
|
34
33
|
var SNoticeSmart = Notice;
|
|
35
34
|
var _this$asProps = this.asProps,
|
|
36
35
|
Children = _this$asProps.Children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/NoticeSmart.jsx"],"names":["React","createComponent","Component","Root","isNode","Notice","NoticeSmart","SNoticeSmart","asProps","Children","label","actions","closable","onClose","theme"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,IAArC,QAAiD,eAAjD;AACA,OAAOC,MAAP,MAAmB,2BAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;IAEMC,W;;;;;;;;;;;;;WAOJ,kBAAS;AAAA
|
|
1
|
+
{"version":3,"sources":["../../src/NoticeSmart.jsx"],"names":["React","createComponent","Component","Root","isNode","Notice","NoticeSmart","SNoticeSmart","asProps","Children","label","actions","closable","onClose","theme"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,IAArC,QAAiD,eAAjD;AACA,OAAOC,MAAP,MAAmB,2BAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;IAEMC,W;;;;;;;;;;;;;WAOJ,kBAAS;AAAA;AACP,UAAMC,YAAY,GAGMF,MAHxB;AACA,0BAAwD,KAAKG,OAA7D;AAAA,UAAQC,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,KAAlB,iBAAkBA,KAAlB;AAAA,UAAyBC,OAAzB,iBAAyBA,OAAzB;AAAA,UAAkCC,QAAlC,iBAAkCA,QAAlC;AAAA,UAA4CC,OAA5C,iBAA4CA,OAA5C;AACA,0BACE,oBAAC,YAAD,0BACGT,MAAM,CAACM,KAAD,CAAN,iBAAiB,oBAAC,MAAD,CAAQ,KAAR,QAAeA,KAAf,CADpB,eAEE,oBAAC,MAAD,CAAQ,OAAR,qBACE,oBAAC,QAAD,OADF,EAEGN,MAAM,CAACO,OAAD,CAAN,iBAAmB,oBAAC,MAAD,CAAQ,OAAR,QAAiBA,OAAjB,CAFtB,CAFF,EAMGC,QAAQ,iBAAI,oBAAC,MAAD,CAAQ,SAAR;AAAkB,QAAA,OAAO,EAAEC;AAA3B,QANf,CADF;AAUD;;;;EApBuBX,S;;gBAApBI,W,iBACiB,a;;gBADjBA,W,kBAGkB;AACpBQ,EAAAA,KAAK,EAAE;AADa,C;;AAoBxB,eAAeb,eAAe,CAACK,WAAD,CAA9B","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, actions, closable, onClose } = this.asProps;\n return (\n <SNoticeSmart render={Notice}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n <Children />\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.CloseIcon onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n}\n\nexport default createComponent(NoticeSmart);\n"],"file":"NoticeSmart.js"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { CProps, PropGetterFn, ReturnEl } from '@semcore/core';
|
|
2
|
+
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
3
|
+
import { IIconProps } from '@semcore/icon';
|
|
4
|
+
|
|
5
|
+
export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | string;
|
|
6
|
+
export type NoticeUse = 'primary' | 'secondary';
|
|
7
|
+
|
|
8
|
+
export interface INoticeProps extends IBoxProps {
|
|
9
|
+
/** Property for managing visibility of Notice */
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
/** Notice type
|
|
12
|
+
* @default secondary
|
|
13
|
+
*/
|
|
14
|
+
use?: NoticeUse;
|
|
15
|
+
/**
|
|
16
|
+
* Notice theme
|
|
17
|
+
* @default info
|
|
18
|
+
*/
|
|
19
|
+
theme?: NoticeTheme;
|
|
20
|
+
/** Duration of animation, ms
|
|
21
|
+
* @default 200
|
|
22
|
+
*/
|
|
23
|
+
duration?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface INoticeLabelProps extends IBoxProps {
|
|
27
|
+
theme?: NoticeTheme;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface INoticeContext {
|
|
31
|
+
getLabelProps: PropGetterFn;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface INoticeSmartProps extends INoticeProps {
|
|
35
|
+
/**
|
|
36
|
+
* A custom element for additional information
|
|
37
|
+
*/
|
|
38
|
+
label?: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Custom action element
|
|
41
|
+
*/
|
|
42
|
+
actions?: React.ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Adds a Close icon
|
|
45
|
+
*/
|
|
46
|
+
closable?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Callback on a click on the close button
|
|
49
|
+
*/
|
|
50
|
+
onClose?: (event: React.SyntheticEvent) => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare const Notice: (<T>(props: CProps<INoticeProps & T, INoticeContext>) => ReturnEl) & {
|
|
54
|
+
Label: <T>(props: INoticeLabelProps & T) => ReturnEl;
|
|
55
|
+
Actions: typeof Box;
|
|
56
|
+
Content: typeof Box;
|
|
57
|
+
CloseIcon: <T>(props: IIconProps & T) => ReturnEl;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
declare const NoticeSmart: <T>(props: CProps<INoticeSmartProps & T>) => ReturnEl;
|
|
61
|
+
|
|
62
|
+
export { NoticeSmart };
|
|
63
|
+
export default Notice;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/notice",
|
|
3
3
|
"description": "SEMRush Notice Component",
|
|
4
|
-
"version": "3.2.
|
|
4
|
+
"version": "3.2.7",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"type": "git",
|
|
30
30
|
"url": "https://github.com/semrush/intergalactic.git",
|
|
31
31
|
"directory": "semcore/notice"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@semcore/jest-preset-ui": "1.0.0"
|
|
32
35
|
}
|
|
33
36
|
}
|