@semcore/notice 3.2.5 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/lib/cjs/Notice.js +17 -18
- package/lib/cjs/Notice.js.map +1 -1
- package/lib/cjs/index.d.ts +58 -0
- package/lib/cjs/style/notice.shadow.css +33 -21
- package/lib/es6/Notice.js +17 -18
- package/lib/es6/Notice.js.map +1 -1
- package/lib/es6/index.d.ts +58 -0
- package/lib/es6/style/notice.shadow.css +33 -21
- package/lib/types/index.d.ts +0 -5
- package/package.json +4 -1
- package/src/Notice.jsx +2 -2
- package/src/index.d.ts +0 -5
- package/src/style/notice.shadow.css +33 -21
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [4.0.0] - 2022-05-17
|
|
6
|
+
|
|
7
|
+
### BREAK
|
|
8
|
+
|
|
9
|
+
- Remove property `use`.
|
|
10
|
+
- Move view `Notice use="primary"` to component `NoticeGlobal`.
|
|
11
|
+
- Updated styles according to the library redesign policy.
|
|
12
|
+
|
|
13
|
+
## [3.2.7] - 2022-05-16
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Version patch update due to children dependencies update (`@semcore/icon` [2.21.0 ~> 2.24.0]).
|
|
18
|
+
|
|
19
|
+
## [3.2.6] - 2022-04-28
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Version patch update due to children dependencies update (`@semcore/icon` [2.20.0 ~> 2.21.0]).
|
|
24
|
+
|
|
5
25
|
## [3.2.5] - 2022-04-03
|
|
6
26
|
|
|
7
27
|
### Changed
|
package/lib/cjs/Notice.js
CHANGED
|
@@ -50,25 +50,25 @@ var style = (
|
|
|
50
50
|
/*__reshadow_css_start__*/
|
|
51
51
|
_core.sstyled.insert(
|
|
52
52
|
/*__inner_css_start__*/
|
|
53
|
-
".
|
|
53
|
+
".___SNotice_1fkx3_gg_{display:flex;font-size:14px;line-height:1.42;box-sizing:border-box}.___SNotice_1fkx3_gg_._use_primary_1fkx3_gg_{padding:8px 32px}.___SNotice_1fkx3_gg_._use_secondary_1fkx3_gg_{padding:16px;border-style:solid;border-width:1px;border-radius:6px}.___SNotice_1fkx3_gg_._theme_info_1fkx3_gg_{background-color:#e9f7ff}.___SNotice_1fkx3_gg_._theme_info_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:#8ecdff}.___SNotice_1fkx3_gg_._theme_info_1fkx3_gg_ .___SCloseIcon_1fkx3_gg_{color:#008ff8}.___SNotice_1fkx3_gg_._theme_danger_1fkx3_gg_{background-color:#fff0f7}.___SNotice_1fkx3_gg_._theme_danger_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:#ffaeb5}.___SNotice_1fkx3_gg_._theme_danger_1fkx3_gg_ .___SCloseIcon_1fkx3_gg_{color:#ff4953}.___SNotice_1fkx3_gg_._theme_warning_1fkx3_gg_{background-color:#fff3d9}.___SNotice_1fkx3_gg_._theme_warning_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:#ffb26e}.___SNotice_1fkx3_gg_._theme_warning_1fkx3_gg_ .___SCloseIcon_1fkx3_gg_{color:#ff622d}.___SNotice_1fkx3_gg_._theme_success_1fkx3_gg_{background-color:#dbfee8}.___SNotice_1fkx3_gg_._theme_success_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:#59ddaa}.___SNotice_1fkx3_gg_._theme_success_1fkx3_gg_ .___SCloseIcon_1fkx3_gg_{color:#009f81}.___SContent_1fkx3_gg_{flex:1 1 auto;width:100%}.___SActions_1fkx3_gg_{flex-shrink:0;margin-top:12px}.___SLabel_1fkx3_gg_{margin-top:2px;margin-right:8px;display:inline-flex}.___SLabel_1fkx3_gg_._theme_info_1fkx3_gg_{color:#8a8e9b}.___SLabel_1fkx3_gg_._theme_danger_1fkx3_gg_{color:#ff4953}.___SLabel_1fkx3_gg_._theme_warning_1fkx3_gg_{color:#ff622d}.___SLabel_1fkx3_gg_._theme_success_1fkx3_gg_{color:#009f81}.___SLabel_1fkx3_gg_._theme_custom_1fkx3_gg_{color:var(--color_3l4djo)}.___SCloseIcon_1fkx3_gg_{flex-shrink:0;margin-left:16px}.___SNotice_1fkx3_gg_._theme_custom_1fkx3_gg_{background-color:var(--backgroundColor_3l4djo)}.___SNotice_1fkx3_gg_._theme_custom_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:var(--backgroundColor_3l4djo)}"
|
|
54
54
|
/*__inner_css_end__*/
|
|
55
|
-
, "
|
|
55
|
+
, "3l4djo_gg_")
|
|
56
56
|
/*__reshadow_css_end__*/
|
|
57
57
|
, {
|
|
58
|
-
"__SNotice": "
|
|
59
|
-
"_use_primary": "
|
|
60
|
-
"_use_secondary": "
|
|
61
|
-
"_theme_info": "
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"--backgroundColor": "--
|
|
58
|
+
"__SNotice": "___SNotice_1fkx3_gg_",
|
|
59
|
+
"_use_primary": "_use_primary_1fkx3_gg_",
|
|
60
|
+
"_use_secondary": "_use_secondary_1fkx3_gg_",
|
|
61
|
+
"_theme_info": "_theme_info_1fkx3_gg_",
|
|
62
|
+
"__SCloseIcon": "___SCloseIcon_1fkx3_gg_",
|
|
63
|
+
"_theme_danger": "_theme_danger_1fkx3_gg_",
|
|
64
|
+
"_theme_warning": "_theme_warning_1fkx3_gg_",
|
|
65
|
+
"_theme_success": "_theme_success_1fkx3_gg_",
|
|
66
|
+
"__SContent": "___SContent_1fkx3_gg_",
|
|
67
|
+
"__SActions": "___SActions_1fkx3_gg_",
|
|
68
|
+
"__SLabel": "___SLabel_1fkx3_gg_",
|
|
69
|
+
"_theme_custom": "_theme_custom_1fkx3_gg_",
|
|
70
|
+
"--color": "--color_3l4djo",
|
|
71
|
+
"--backgroundColor": "--backgroundColor_3l4djo"
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
function isCustomTheme(theme) {
|
|
@@ -121,8 +121,8 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
121
121
|
(0, _defineProperty2["default"])(RootNotice, "displayName", 'Notice');
|
|
122
122
|
(0, _defineProperty2["default"])(RootNotice, "style", style);
|
|
123
123
|
(0, _defineProperty2["default"])(RootNotice, "defaultProps", {
|
|
124
|
-
use: 'secondary',
|
|
125
124
|
theme: 'info',
|
|
125
|
+
use: 'secondary',
|
|
126
126
|
duration: 200
|
|
127
127
|
});
|
|
128
128
|
|
|
@@ -167,7 +167,6 @@ function CloseIcon(_ref14) {
|
|
|
167
167
|
var SCloseIcon = _flexBox.Box;
|
|
168
168
|
return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCloseIcon, _ref10.cn("SCloseIcon", _objectSpread({}, (0, _core.assignProps)({
|
|
169
169
|
"tag": _m["default"],
|
|
170
|
-
"color": "stone",
|
|
171
170
|
"interactive": true,
|
|
172
171
|
"aria-label": "Close alert"
|
|
173
172
|
}, _ref5))));
|
package/lib/cjs/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Notice.jsx"],"names":["isCustomTheme","theme","includes","RootNotice","asProps","SNotice","FadeInOut","Children","styles","hidden","color","useTheme","Component","style","use","duration","Label","SLabel","Box","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon","Close"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,aAAT,CAAuBC,KAAvB,EAA8B;AAC5B,SAAO,CAAC,CAAC,QAAD,EAAW,SAAX,EAAsB,SAAtB,EAAiC,MAAjC,EAAyCC,QAAzC,CAAkDD,KAAlD,CAAR;AACD;;IAEKE,U;;;;;;;;;;;;WASJ,yBAAgB;AACd,UAAQF,KAAR,GAAkB,KAAKG,OAAvB,CAAQH,KAAR;AACA,aAAO;AACLA,QAAAA,KAAK,EAALA;AADK,OAAP;AAGD;;;WAED,kBAAS;AAAA;AAAA;;AACP,UAAMI,OAAO,GAODC,oBAPZ;AACA,0BAA4C,KAAKF,OAAjD;AAAA,UAAQG,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,MAAlB,iBAAkBA,MAAlB;AAAA,UAA0BC,MAA1B,iBAA0BA,MAA1B;AAAA,UAAkCR,KAAlC,iBAAkCA,KAAlC;AACA,UAAMS,KAAK,GAAG,uBAAaT,KAAb,CAAd;AACA,UAAMU,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AAEA,qBAAO,mBAAQO,MAAR,CAAP,eACE,gCAAC,OAAD;AAAA,mBAEW,CAACC,MAFZ;AAAA,qBAGaE,QAHb;AAAA,2BAImBD,KAJnB;AAAA,gBAKO;AALP,+BAOE,gCAAC,QAAD,2BAPF,CADF;AAWD;;;EAjCsBE,e;;iCAAnBT,U,iBACiB,Q;iCADjBA,U,WAEWU,K;iCAFXV,U,kBAGkB;
|
|
1
|
+
{"version":3,"sources":["../../src/Notice.jsx"],"names":["isCustomTheme","theme","includes","RootNotice","asProps","SNotice","FadeInOut","Children","styles","hidden","color","useTheme","Component","style","use","duration","Label","SLabel","Box","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon","Close"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,aAAT,CAAuBC,KAAvB,EAA8B;AAC5B,SAAO,CAAC,CAAC,QAAD,EAAW,SAAX,EAAsB,SAAtB,EAAiC,MAAjC,EAAyCC,QAAzC,CAAkDD,KAAlD,CAAR;AACD;;IAEKE,U;;;;;;;;;;;;WASJ,yBAAgB;AACd,UAAQF,KAAR,GAAkB,KAAKG,OAAvB,CAAQH,KAAR;AACA,aAAO;AACLA,QAAAA,KAAK,EAALA;AADK,OAAP;AAGD;;;WAED,kBAAS;AAAA;AAAA;;AACP,UAAMI,OAAO,GAODC,oBAPZ;AACA,0BAA4C,KAAKF,OAAjD;AAAA,UAAQG,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,MAAlB,iBAAkBA,MAAlB;AAAA,UAA0BC,MAA1B,iBAA0BA,MAA1B;AAAA,UAAkCR,KAAlC,iBAAkCA,KAAlC;AACA,UAAMS,KAAK,GAAG,uBAAaT,KAAb,CAAd;AACA,UAAMU,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AAEA,qBAAO,mBAAQO,MAAR,CAAP,eACE,gCAAC,OAAD;AAAA,mBAEW,CAACC,MAFZ;AAAA,qBAGaE,QAHb;AAAA,2BAImBD,KAJnB;AAAA,gBAKO;AALP,+BAOE,gCAAC,QAAD,2BAPF,CADF;AAWD;;;EAjCsBE,e;;iCAAnBT,U,iBACiB,Q;iCADjBA,U,WAEWU,K;iCAFXV,U,kBAGkB;AACpBF,EAAAA,KAAK,EAAE,MADa;AAEpBa,EAAAA,GAAG,EAAE,WAFe;AAGpBC,EAAAA,QAAQ,EAAE;AAHU,C;;AAiCxB,SAASC,KAAT,SAAkC;AAAA;AAAA;;AAAA,MAAjBR,MAAiB,UAAjBA,MAAiB;AAAA,MAATP,KAAS,UAATA,KAAS;AAChC,MAAMgB,MAAM,GAG2BC,YAHvC;AACA,MAAMP,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AACA,MAAMS,KAAK,GAAG,uBAAaT,KAAb,CAAd;AACA,iBAAO,mBAAQO,MAAR,CAAP,eAAuB,gCAAC,MAAD;AAAA,iBAAgCG,QAAhC;AAAA,aAAiDD;AAAjD,cAAvB;AACD;;AAED,SAASS,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVX,MAAU,UAAVA,MAAU;AAC3B,MAAMY,QAAQ,GAC2BF,YADzC;AACA,iBAAO,mBAAQV,MAAR,CAAP,eAAuB,gCAAC,QAAD,6EAAvB;AACD;;AAED,SAASa,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVb,MAAU,UAAVA,MAAU;AAC3B,MAAMc,QAAQ,GAC2BJ,YADzC;AACA,iBAAO,mBAAQV,MAAR,CAAP,eAAuB,gCAAC,QAAD,6EAAvB;AACD;;AAED,SAASe,SAAT,SAA+B;AAAA;AAAA;;AAAA,MAAVf,MAAU,UAAVA,MAAU;AAC7B,MAAMgB,UAAU,GAEMN,YAFtB;AACA,kBAAO,mBAAQV,MAAR,CAAP,eACE,gCAAC,UAAD;AAAA,WAA8BiB,aAA9B;AAAA;AAAA,kBAA4D;AAA5D,cADF;AAGD;;eAEc,sBAAgBtB,UAAhB,EAA4B;AACzCa,EAAAA,KAAK,EAALA,KADyC;AAEzCG,EAAAA,OAAO,EAAPA,OAFyC;AAGzCE,EAAAA,OAAO,EAAPA,OAHyC;AAIzCE,EAAAA,SAAS,EAATA;AAJyC,CAA5B,C","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Close from '@semcore/icon/Close/m';\nimport resolveColor from '@semcore/utils/lib/color';\nimport { FadeInOut } from '@semcore/animation';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static defaultProps = {\n theme: 'info',\n use: 'secondary',\n duration: 200,\n };\n\n getLabelProps() {\n const { theme } = this.asProps;\n return {\n theme,\n };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role=\"alert\"\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme }) {\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 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 }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon render={Box} tag={Close} interactive aria-label=\"Close alert\" />,\n );\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n});\n"],"file":"Notice.js"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
|
|
7
|
+
export interface INoticeProps extends IBoxProps {
|
|
8
|
+
/** Property for managing visibility of Notice */
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Notice theme
|
|
12
|
+
* @default info
|
|
13
|
+
*/
|
|
14
|
+
theme?: NoticeTheme;
|
|
15
|
+
/** Duration of animation, ms
|
|
16
|
+
* @default 200
|
|
17
|
+
*/
|
|
18
|
+
duration?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface INoticeLabelProps extends IBoxProps {
|
|
22
|
+
theme?: NoticeTheme;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface INoticeContext {
|
|
26
|
+
getLabelProps: PropGetterFn;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface INoticeSmartProps extends INoticeProps {
|
|
30
|
+
/**
|
|
31
|
+
* A custom element for additional information
|
|
32
|
+
*/
|
|
33
|
+
label?: React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Custom action element
|
|
36
|
+
*/
|
|
37
|
+
actions?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Adds a Close icon
|
|
40
|
+
*/
|
|
41
|
+
closable?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Callback on a click on the close button
|
|
44
|
+
*/
|
|
45
|
+
onClose?: (event: React.SyntheticEvent) => void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare const Notice: (<T>(props: CProps<INoticeProps & T, INoticeContext>) => ReturnEl) & {
|
|
49
|
+
Label: <T>(props: INoticeLabelProps & T) => ReturnEl;
|
|
50
|
+
Actions: typeof Box;
|
|
51
|
+
Content: typeof Box;
|
|
52
|
+
CloseIcon: <T>(props: IIconProps & T) => ReturnEl;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
declare const NoticeSmart: <T>(props: CProps<INoticeSmartProps & T>) => ReturnEl;
|
|
56
|
+
|
|
57
|
+
export { NoticeSmart };
|
|
58
|
+
export default Notice;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
SNotice {
|
|
4
4
|
display: flex;
|
|
5
|
-
font-size: var(--fs-
|
|
6
|
-
line-height: var(--lh-
|
|
5
|
+
font-size: var(--fs-200);
|
|
6
|
+
line-height: var(--lh-200);
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -12,40 +12,51 @@ SNotice[use='primary'] {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
SNotice[use='secondary'] {
|
|
15
|
-
padding:
|
|
15
|
+
padding: 16px;
|
|
16
16
|
border-style: solid;
|
|
17
17
|
border-width: 1px;
|
|
18
|
-
border-radius:
|
|
18
|
+
border-radius: var(--rounded-m);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
SNotice[theme='info'] {
|
|
22
|
-
background-color:
|
|
23
|
-
|
|
22
|
+
background-color: var(--blue-50);
|
|
24
23
|
&[use='secondary'] {
|
|
25
|
-
border-color:
|
|
24
|
+
border-color: var(--blue-200);
|
|
25
|
+
}
|
|
26
|
+
& SCloseIcon {
|
|
27
|
+
color: var(--blue-400);
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
SNotice[theme='danger'] {
|
|
30
|
-
background-color:
|
|
32
|
+
background-color: var(--red-50);
|
|
31
33
|
|
|
32
34
|
&[use='secondary'] {
|
|
33
|
-
border-color:
|
|
35
|
+
border-color: var(--red-200);
|
|
36
|
+
}
|
|
37
|
+
& SCloseIcon {
|
|
38
|
+
color: var(--red-400);
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
SNotice[theme='warning'] {
|
|
38
|
-
background-color:
|
|
43
|
+
background-color: var(--orange-50);
|
|
39
44
|
|
|
40
45
|
&[use='secondary'] {
|
|
41
|
-
border-color:
|
|
46
|
+
border-color: var(--orange-200);
|
|
47
|
+
}
|
|
48
|
+
& SCloseIcon {
|
|
49
|
+
color: var(--orange-400);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
SNotice[theme='success'] {
|
|
46
|
-
background-color:
|
|
54
|
+
background-color: var(--green-50);
|
|
47
55
|
&[use='secondary'] {
|
|
48
|
-
border-color:
|
|
56
|
+
border-color: var(--green-200);
|
|
57
|
+
}
|
|
58
|
+
& SCloseIcon {
|
|
59
|
+
color: var(--green-400);
|
|
49
60
|
}
|
|
50
61
|
}
|
|
51
62
|
|
|
@@ -60,24 +71,25 @@ SActions {
|
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
SLabel {
|
|
74
|
+
margin-top: 2px;
|
|
63
75
|
margin-right: 8px;
|
|
64
76
|
display: inline-flex;
|
|
65
77
|
}
|
|
66
78
|
|
|
67
|
-
SLabel[theme='danger'] {
|
|
68
|
-
color: var(--red);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
79
|
SLabel[theme='info'] {
|
|
72
|
-
color: var(--
|
|
80
|
+
color: var(--gray-400);
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
SLabel[theme='
|
|
76
|
-
color: var(--
|
|
83
|
+
SLabel[theme='danger'] {
|
|
84
|
+
color: var(--red-400);
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
SLabel[theme='warning'] {
|
|
80
|
-
color: var(--
|
|
88
|
+
color: var(--orange-400);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
SLabel[theme='success'] {
|
|
92
|
+
color: var(--green-400);
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
SLabel[theme='custom'] {
|
package/lib/es6/Notice.js
CHANGED
|
@@ -31,25 +31,25 @@ var style = (
|
|
|
31
31
|
/*__reshadow_css_start__*/
|
|
32
32
|
_sstyled.insert(
|
|
33
33
|
/*__inner_css_start__*/
|
|
34
|
-
".
|
|
34
|
+
".___SNotice_1fkx3_gg_{display:flex;font-size:14px;line-height:1.42;box-sizing:border-box}.___SNotice_1fkx3_gg_._use_primary_1fkx3_gg_{padding:8px 32px}.___SNotice_1fkx3_gg_._use_secondary_1fkx3_gg_{padding:16px;border-style:solid;border-width:1px;border-radius:6px}.___SNotice_1fkx3_gg_._theme_info_1fkx3_gg_{background-color:#e9f7ff}.___SNotice_1fkx3_gg_._theme_info_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:#8ecdff}.___SNotice_1fkx3_gg_._theme_info_1fkx3_gg_ .___SCloseIcon_1fkx3_gg_{color:#008ff8}.___SNotice_1fkx3_gg_._theme_danger_1fkx3_gg_{background-color:#fff0f7}.___SNotice_1fkx3_gg_._theme_danger_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:#ffaeb5}.___SNotice_1fkx3_gg_._theme_danger_1fkx3_gg_ .___SCloseIcon_1fkx3_gg_{color:#ff4953}.___SNotice_1fkx3_gg_._theme_warning_1fkx3_gg_{background-color:#fff3d9}.___SNotice_1fkx3_gg_._theme_warning_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:#ffb26e}.___SNotice_1fkx3_gg_._theme_warning_1fkx3_gg_ .___SCloseIcon_1fkx3_gg_{color:#ff622d}.___SNotice_1fkx3_gg_._theme_success_1fkx3_gg_{background-color:#dbfee8}.___SNotice_1fkx3_gg_._theme_success_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:#59ddaa}.___SNotice_1fkx3_gg_._theme_success_1fkx3_gg_ .___SCloseIcon_1fkx3_gg_{color:#009f81}.___SContent_1fkx3_gg_{flex:1 1 auto;width:100%}.___SActions_1fkx3_gg_{flex-shrink:0;margin-top:12px}.___SLabel_1fkx3_gg_{margin-top:2px;margin-right:8px;display:inline-flex}.___SLabel_1fkx3_gg_._theme_info_1fkx3_gg_{color:#8a8e9b}.___SLabel_1fkx3_gg_._theme_danger_1fkx3_gg_{color:#ff4953}.___SLabel_1fkx3_gg_._theme_warning_1fkx3_gg_{color:#ff622d}.___SLabel_1fkx3_gg_._theme_success_1fkx3_gg_{color:#009f81}.___SLabel_1fkx3_gg_._theme_custom_1fkx3_gg_{color:var(--color_3l4djo)}.___SCloseIcon_1fkx3_gg_{flex-shrink:0;margin-left:16px}.___SNotice_1fkx3_gg_._theme_custom_1fkx3_gg_{background-color:var(--backgroundColor_3l4djo)}.___SNotice_1fkx3_gg_._theme_custom_1fkx3_gg_._use_secondary_1fkx3_gg_{border-color:var(--backgroundColor_3l4djo)}"
|
|
35
35
|
/*__inner_css_end__*/
|
|
36
|
-
, "
|
|
36
|
+
, "3l4djo_gg_")
|
|
37
37
|
/*__reshadow_css_end__*/
|
|
38
38
|
, {
|
|
39
|
-
"__SNotice": "
|
|
40
|
-
"_use_primary": "
|
|
41
|
-
"_use_secondary": "
|
|
42
|
-
"_theme_info": "
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"--backgroundColor": "--
|
|
39
|
+
"__SNotice": "___SNotice_1fkx3_gg_",
|
|
40
|
+
"_use_primary": "_use_primary_1fkx3_gg_",
|
|
41
|
+
"_use_secondary": "_use_secondary_1fkx3_gg_",
|
|
42
|
+
"_theme_info": "_theme_info_1fkx3_gg_",
|
|
43
|
+
"__SCloseIcon": "___SCloseIcon_1fkx3_gg_",
|
|
44
|
+
"_theme_danger": "_theme_danger_1fkx3_gg_",
|
|
45
|
+
"_theme_warning": "_theme_warning_1fkx3_gg_",
|
|
46
|
+
"_theme_success": "_theme_success_1fkx3_gg_",
|
|
47
|
+
"__SContent": "___SContent_1fkx3_gg_",
|
|
48
|
+
"__SActions": "___SActions_1fkx3_gg_",
|
|
49
|
+
"__SLabel": "___SLabel_1fkx3_gg_",
|
|
50
|
+
"_theme_custom": "_theme_custom_1fkx3_gg_",
|
|
51
|
+
"--color": "--color_3l4djo",
|
|
52
|
+
"--backgroundColor": "--backgroundColor_3l4djo"
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
function isCustomTheme(theme) {
|
|
@@ -106,8 +106,8 @@ _defineProperty(RootNotice, "displayName", 'Notice');
|
|
|
106
106
|
_defineProperty(RootNotice, "style", style);
|
|
107
107
|
|
|
108
108
|
_defineProperty(RootNotice, "defaultProps", {
|
|
109
|
-
use: 'secondary',
|
|
110
109
|
theme: 'info',
|
|
110
|
+
use: 'secondary',
|
|
111
111
|
duration: 200
|
|
112
112
|
});
|
|
113
113
|
|
|
@@ -152,7 +152,6 @@ function CloseIcon(_ref14) {
|
|
|
152
152
|
var SCloseIcon = Box;
|
|
153
153
|
return _ref10 = sstyled(styles), /*#__PURE__*/React.createElement(SCloseIcon, _ref10.cn("SCloseIcon", _objectSpread({}, _assignProps5({
|
|
154
154
|
"tag": Close,
|
|
155
|
-
"color": "stone",
|
|
156
155
|
"interactive": true,
|
|
157
156
|
"aria-label": "Close alert"
|
|
158
157
|
}, _ref5))));
|
package/lib/es6/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Notice.jsx"],"names":["React","createComponent","Component","sstyled","Root","Box","Close","resolveColor","FadeInOut","isCustomTheme","theme","includes","RootNotice","asProps","SNotice","Children","styles","hidden","color","useTheme","style","use","duration","Label","SLabel","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,KAAP,MAAkB,uBAAlB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,SAASC,SAAT,QAA0B,oBAA1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASC,aAAT,CAAuBC,KAAvB,EAA8B;AAC5B,SAAO,CAAC,CAAC,QAAD,EAAW,SAAX,EAAsB,SAAtB,EAAiC,MAAjC,EAAyCC,QAAzC,CAAkDD,KAAlD,CAAR;AACD;;IAEKE,U;;;;;;;;;;;;;WASJ,yBAAgB;AACd,UAAQF,KAAR,GAAkB,KAAKG,OAAvB,CAAQH,KAAR;AACA,aAAO;AACLA,QAAAA,KAAK,EAALA;AADK,OAAP;AAGD;;;WAED,kBAAS;AAAA;AAAA;;AACP,UAAMI,OAAO,GAODN,SAPZ;AACA,0BAA4C,KAAKK,OAAjD;AAAA,UAAQE,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,MAAlB,iBAAkBA,MAAlB;AAAA,UAA0BC,MAA1B,iBAA0BA,MAA1B;AAAA,UAAkCP,KAAlC,iBAAkCA,KAAlC;AACA,UAAMQ,KAAK,GAAGX,YAAY,CAACG,KAAD,CAA1B;AACA,UAAMS,QAAQ,GAAGV,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AAEA,qBAAOP,OAAO,CAACa,MAAD,CAAd,eACE,oBAAC,OAAD;AAAA,mBAEW,CAACC,MAFZ;AAAA,qBAGaE,QAHb;AAAA,2BAImBD,KAJnB;AAAA,gBAKO;AALP,+BAOE,oBAAC,QAAD,2BAPF,CADF;AAWD;;;;EAjCsBhB,S;;gBAAnBU,U,iBACiB,Q;;gBADjBA,U,WAEWQ,K;;gBAFXR,U,kBAGkB;
|
|
1
|
+
{"version":3,"sources":["../../src/Notice.jsx"],"names":["React","createComponent","Component","sstyled","Root","Box","Close","resolveColor","FadeInOut","isCustomTheme","theme","includes","RootNotice","asProps","SNotice","Children","styles","hidden","color","useTheme","style","use","duration","Label","SLabel","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon"],"mappings":"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","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Close from '@semcore/icon/Close/m';\nimport resolveColor from '@semcore/utils/lib/color';\nimport { FadeInOut } from '@semcore/animation';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static defaultProps = {\n theme: 'info',\n use: 'secondary',\n duration: 200,\n };\n\n getLabelProps() {\n const { theme } = this.asProps;\n return {\n theme,\n };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role=\"alert\"\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme }) {\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 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 }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon render={Box} tag={Close} interactive aria-label=\"Close alert\" />,\n );\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n});\n"],"file":"Notice.js"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
|
|
7
|
+
export interface INoticeProps extends IBoxProps {
|
|
8
|
+
/** Property for managing visibility of Notice */
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Notice theme
|
|
12
|
+
* @default info
|
|
13
|
+
*/
|
|
14
|
+
theme?: NoticeTheme;
|
|
15
|
+
/** Duration of animation, ms
|
|
16
|
+
* @default 200
|
|
17
|
+
*/
|
|
18
|
+
duration?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface INoticeLabelProps extends IBoxProps {
|
|
22
|
+
theme?: NoticeTheme;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface INoticeContext {
|
|
26
|
+
getLabelProps: PropGetterFn;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface INoticeSmartProps extends INoticeProps {
|
|
30
|
+
/**
|
|
31
|
+
* A custom element for additional information
|
|
32
|
+
*/
|
|
33
|
+
label?: React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Custom action element
|
|
36
|
+
*/
|
|
37
|
+
actions?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Adds a Close icon
|
|
40
|
+
*/
|
|
41
|
+
closable?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Callback on a click on the close button
|
|
44
|
+
*/
|
|
45
|
+
onClose?: (event: React.SyntheticEvent) => void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare const Notice: (<T>(props: CProps<INoticeProps & T, INoticeContext>) => ReturnEl) & {
|
|
49
|
+
Label: <T>(props: INoticeLabelProps & T) => ReturnEl;
|
|
50
|
+
Actions: typeof Box;
|
|
51
|
+
Content: typeof Box;
|
|
52
|
+
CloseIcon: <T>(props: IIconProps & T) => ReturnEl;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
declare const NoticeSmart: <T>(props: CProps<INoticeSmartProps & T>) => ReturnEl;
|
|
56
|
+
|
|
57
|
+
export { NoticeSmart };
|
|
58
|
+
export default Notice;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
SNotice {
|
|
4
4
|
display: flex;
|
|
5
|
-
font-size: var(--fs-
|
|
6
|
-
line-height: var(--lh-
|
|
5
|
+
font-size: var(--fs-200);
|
|
6
|
+
line-height: var(--lh-200);
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -12,40 +12,51 @@ SNotice[use='primary'] {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
SNotice[use='secondary'] {
|
|
15
|
-
padding:
|
|
15
|
+
padding: 16px;
|
|
16
16
|
border-style: solid;
|
|
17
17
|
border-width: 1px;
|
|
18
|
-
border-radius:
|
|
18
|
+
border-radius: var(--rounded-m);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
SNotice[theme='info'] {
|
|
22
|
-
background-color:
|
|
23
|
-
|
|
22
|
+
background-color: var(--blue-50);
|
|
24
23
|
&[use='secondary'] {
|
|
25
|
-
border-color:
|
|
24
|
+
border-color: var(--blue-200);
|
|
25
|
+
}
|
|
26
|
+
& SCloseIcon {
|
|
27
|
+
color: var(--blue-400);
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
SNotice[theme='danger'] {
|
|
30
|
-
background-color:
|
|
32
|
+
background-color: var(--red-50);
|
|
31
33
|
|
|
32
34
|
&[use='secondary'] {
|
|
33
|
-
border-color:
|
|
35
|
+
border-color: var(--red-200);
|
|
36
|
+
}
|
|
37
|
+
& SCloseIcon {
|
|
38
|
+
color: var(--red-400);
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
SNotice[theme='warning'] {
|
|
38
|
-
background-color:
|
|
43
|
+
background-color: var(--orange-50);
|
|
39
44
|
|
|
40
45
|
&[use='secondary'] {
|
|
41
|
-
border-color:
|
|
46
|
+
border-color: var(--orange-200);
|
|
47
|
+
}
|
|
48
|
+
& SCloseIcon {
|
|
49
|
+
color: var(--orange-400);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
SNotice[theme='success'] {
|
|
46
|
-
background-color:
|
|
54
|
+
background-color: var(--green-50);
|
|
47
55
|
&[use='secondary'] {
|
|
48
|
-
border-color:
|
|
56
|
+
border-color: var(--green-200);
|
|
57
|
+
}
|
|
58
|
+
& SCloseIcon {
|
|
59
|
+
color: var(--green-400);
|
|
49
60
|
}
|
|
50
61
|
}
|
|
51
62
|
|
|
@@ -60,24 +71,25 @@ SActions {
|
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
SLabel {
|
|
74
|
+
margin-top: 2px;
|
|
63
75
|
margin-right: 8px;
|
|
64
76
|
display: inline-flex;
|
|
65
77
|
}
|
|
66
78
|
|
|
67
|
-
SLabel[theme='danger'] {
|
|
68
|
-
color: var(--red);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
79
|
SLabel[theme='info'] {
|
|
72
|
-
color: var(--
|
|
80
|
+
color: var(--gray-400);
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
SLabel[theme='
|
|
76
|
-
color: var(--
|
|
83
|
+
SLabel[theme='danger'] {
|
|
84
|
+
color: var(--red-400);
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
SLabel[theme='warning'] {
|
|
80
|
-
color: var(--
|
|
88
|
+
color: var(--orange-400);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
SLabel[theme='success'] {
|
|
92
|
+
color: var(--green-400);
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
SLabel[theme='custom'] {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,15 +3,10 @@ import { Box, IBoxProps } from '@semcore/flex-box';
|
|
|
3
3
|
import { IIconProps } from '@semcore/icon';
|
|
4
4
|
|
|
5
5
|
export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | string;
|
|
6
|
-
export type NoticeUse = 'primary' | 'secondary';
|
|
7
6
|
|
|
8
7
|
export interface INoticeProps extends IBoxProps {
|
|
9
8
|
/** Property for managing visibility of Notice */
|
|
10
9
|
hidden?: boolean;
|
|
11
|
-
/** Notice type
|
|
12
|
-
* @default secondary
|
|
13
|
-
*/
|
|
14
|
-
use?: NoticeUse;
|
|
15
10
|
/**
|
|
16
11
|
* Notice theme
|
|
17
12
|
* @default info
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/notice",
|
|
3
3
|
"description": "SEMRush Notice Component",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
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
|
}
|
package/src/Notice.jsx
CHANGED
|
@@ -15,8 +15,8 @@ class RootNotice extends Component {
|
|
|
15
15
|
static displayName = 'Notice';
|
|
16
16
|
static style = style;
|
|
17
17
|
static defaultProps = {
|
|
18
|
-
use: 'secondary',
|
|
19
18
|
theme: 'info',
|
|
19
|
+
use: 'secondary',
|
|
20
20
|
duration: 200,
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -67,7 +67,7 @@ function Content({ styles }) {
|
|
|
67
67
|
function CloseIcon({ styles }) {
|
|
68
68
|
const SCloseIcon = Root;
|
|
69
69
|
return sstyled(styles)(
|
|
70
|
-
<SCloseIcon render={Box} tag={Close}
|
|
70
|
+
<SCloseIcon render={Box} tag={Close} interactive aria-label="Close alert" />,
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
|
package/src/index.d.ts
CHANGED
|
@@ -3,15 +3,10 @@ import { Box, IBoxProps } from '@semcore/flex-box';
|
|
|
3
3
|
import { IIconProps } from '@semcore/icon';
|
|
4
4
|
|
|
5
5
|
export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | string;
|
|
6
|
-
export type NoticeUse = 'primary' | 'secondary';
|
|
7
6
|
|
|
8
7
|
export interface INoticeProps extends IBoxProps {
|
|
9
8
|
/** Property for managing visibility of Notice */
|
|
10
9
|
hidden?: boolean;
|
|
11
|
-
/** Notice type
|
|
12
|
-
* @default secondary
|
|
13
|
-
*/
|
|
14
|
-
use?: NoticeUse;
|
|
15
10
|
/**
|
|
16
11
|
* Notice theme
|
|
17
12
|
* @default info
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
SNotice {
|
|
4
4
|
display: flex;
|
|
5
|
-
font-size: var(--fs-
|
|
6
|
-
line-height: var(--lh-
|
|
5
|
+
font-size: var(--fs-200);
|
|
6
|
+
line-height: var(--lh-200);
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -12,40 +12,51 @@ SNotice[use='primary'] {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
SNotice[use='secondary'] {
|
|
15
|
-
padding:
|
|
15
|
+
padding: 16px;
|
|
16
16
|
border-style: solid;
|
|
17
17
|
border-width: 1px;
|
|
18
|
-
border-radius:
|
|
18
|
+
border-radius: var(--rounded-m);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
SNotice[theme='info'] {
|
|
22
|
-
background-color:
|
|
23
|
-
|
|
22
|
+
background-color: var(--blue-50);
|
|
24
23
|
&[use='secondary'] {
|
|
25
|
-
border-color:
|
|
24
|
+
border-color: var(--blue-200);
|
|
25
|
+
}
|
|
26
|
+
& SCloseIcon {
|
|
27
|
+
color: var(--blue-400);
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
SNotice[theme='danger'] {
|
|
30
|
-
background-color:
|
|
32
|
+
background-color: var(--red-50);
|
|
31
33
|
|
|
32
34
|
&[use='secondary'] {
|
|
33
|
-
border-color:
|
|
35
|
+
border-color: var(--red-200);
|
|
36
|
+
}
|
|
37
|
+
& SCloseIcon {
|
|
38
|
+
color: var(--red-400);
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
SNotice[theme='warning'] {
|
|
38
|
-
background-color:
|
|
43
|
+
background-color: var(--orange-50);
|
|
39
44
|
|
|
40
45
|
&[use='secondary'] {
|
|
41
|
-
border-color:
|
|
46
|
+
border-color: var(--orange-200);
|
|
47
|
+
}
|
|
48
|
+
& SCloseIcon {
|
|
49
|
+
color: var(--orange-400);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
SNotice[theme='success'] {
|
|
46
|
-
background-color:
|
|
54
|
+
background-color: var(--green-50);
|
|
47
55
|
&[use='secondary'] {
|
|
48
|
-
border-color:
|
|
56
|
+
border-color: var(--green-200);
|
|
57
|
+
}
|
|
58
|
+
& SCloseIcon {
|
|
59
|
+
color: var(--green-400);
|
|
49
60
|
}
|
|
50
61
|
}
|
|
51
62
|
|
|
@@ -60,24 +71,25 @@ SActions {
|
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
SLabel {
|
|
74
|
+
margin-top: 2px;
|
|
63
75
|
margin-right: 8px;
|
|
64
76
|
display: inline-flex;
|
|
65
77
|
}
|
|
66
78
|
|
|
67
|
-
SLabel[theme='danger'] {
|
|
68
|
-
color: var(--red);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
79
|
SLabel[theme='info'] {
|
|
72
|
-
color: var(--
|
|
80
|
+
color: var(--gray-400);
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
SLabel[theme='
|
|
76
|
-
color: var(--
|
|
83
|
+
SLabel[theme='danger'] {
|
|
84
|
+
color: var(--red-400);
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
SLabel[theme='warning'] {
|
|
80
|
-
color: var(--
|
|
88
|
+
color: var(--orange-400);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
SLabel[theme='success'] {
|
|
92
|
+
color: var(--green-400);
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
SLabel[theme='custom'] {
|