@semcore/notice-bubble 4.0.6 → 4.0.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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [4.0.7] - 2022-07-21
6
+
7
+ ### Changed
8
+
9
+ - Version patch update due to children dependencies update (`@semcore/icon` [2.28.0 ~> 2.29.0]).
10
+
5
11
  ## [4.0.6] - 2022-07-07
6
12
 
7
13
  ### Changed
package/README.md CHANGED
@@ -46,8 +46,6 @@ of the components that is discussed below. There should only be one version of t
46
46
 
47
47
  You can use the package the same way but without `/ui/` in the import path.
48
48
 
49
- </details>
50
-
51
49
  ```jsx
52
50
  import NoticeBubbleManager, {
53
51
  NoticeBubbleContainer,
@@ -56,6 +54,8 @@ import NoticeBubbleManager, {
56
54
  } from '@semcore/notice-bubble';
57
55
  ```
58
56
 
57
+ </details>
58
+
59
59
  ## 👤 Author
60
60
 
61
61
  [UI-kit team](https://github.com/semrush/intergalactic/blob/master/MAINTAINERS) and [others ❤️](https://github.com/semrush/intergalactic/graphs/contributors)
@@ -67,30 +67,30 @@ var style = (
67
67
  /*__reshadow_css_start__*/
68
68
  _core.sstyled.insert(
69
69
  /*__inner_css_start__*/
70
- ".___SInfo_a55f0_gg_,.___SView_a55f0_gg_,.___SWarning_a55f0_gg_{position:relative;margin-bottom:12px;padding:12px 28px 12px 12px;width:100%;min-height:44px;border-radius:6px;overflow:hidden;box-sizing:border-box}.___SInfo_a55f0_gg_{background:#191b23}.___SWarning_a55f0_gg_{background:#ff4953}.___SMessage_a55f0_gg_{font-size:14px;color:#fff;line-height:1.33}.___SDismiss_a55f0_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#ffffff}.___SDismiss_a55f0_gg_:hover{color:#e0e1e9}.___SAction_a55f0_gg_{margin-top:8px}.___SNoticeBubble_a55f0_gg_{width:300px;position:fixed;z-index:1010;right:12px;top:12px}@media (max-width:767px){.___SNoticeBubble_a55f0_gg_{width:calc(100% - 24px)}}"
70
+ ".___SInfo_c5k1n_gg_,.___SView_c5k1n_gg_,.___SWarning_c5k1n_gg_{position:relative;margin-bottom:12px;padding:12px 28px 12px 12px;width:100%;min-height:44px;border-radius:6px;overflow:hidden;box-sizing:border-box}.___SInfo_c5k1n_gg_{background:#191b23}.___SWarning_c5k1n_gg_{background:#ff4953}.___SMessage_c5k1n_gg_{font-size:14px;color:#fff;line-height:1.33}.___SDismiss_c5k1n_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#ffffff}.___SDismiss_c5k1n_gg_:hover{color:#e0e1e9}.___SAction_c5k1n_gg_{margin-top:8px}.___SNoticeBubble_c5k1n_gg_{width:300px;position:fixed;z-index:1010;right:12px;top:12px}@media (max-width:767px){.___SNoticeBubble_c5k1n_gg_{width:calc(100% - 24px)}}"
71
71
  /*__inner_css_end__*/
72
- , "l0oo1x_gg_")
72
+ , "c5k1n_gg_")
73
73
  /*__reshadow_css_end__*/
74
74
  , {
75
- "__SInfo": "___SInfo_a55f0_gg_",
76
- "__SView": "___SView_a55f0_gg_",
77
- "__SWarning": "___SWarning_a55f0_gg_",
78
- "__SMessage": "___SMessage_a55f0_gg_",
79
- "__SDismiss": "___SDismiss_a55f0_gg_",
80
- "__SAction": "___SAction_a55f0_gg_",
81
- "__SNoticeBubble": "___SNoticeBubble_a55f0_gg_"
75
+ "__SInfo": "___SInfo_c5k1n_gg_",
76
+ "__SView": "___SView_c5k1n_gg_",
77
+ "__SWarning": "___SWarning_c5k1n_gg_",
78
+ "__SMessage": "___SMessage_c5k1n_gg_",
79
+ "__SDismiss": "___SDismiss_c5k1n_gg_",
80
+ "__SAction": "___SAction_c5k1n_gg_",
81
+ "__SNoticeBubble": "___SNoticeBubble_c5k1n_gg_"
82
82
  });
83
83
  var animationNotice = (
84
84
  /*__reshadow_css_start__*/
85
85
  _core.sstyled.insert(
86
86
  /*__inner_css_start__*/
87
- "@-webkit-keyframes enter_cjjo94{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes enter_cjjo94{0%{transform:translate(100%)}to{transform:translate(0)}}@-webkit-keyframes exit_cjjo94{0%{opacity:1}to{opacity:0}}@keyframes exit_cjjo94{0%{opacity:1}to{opacity:0}}"
87
+ "@-webkit-keyframes enter_1x332{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes enter_1x332{0%{transform:translate(100%)}to{transform:translate(0)}}@-webkit-keyframes exit_1x332{0%{opacity:1}to{opacity:0}}@keyframes exit_1x332{0%{opacity:1}to{opacity:0}}"
88
88
  /*__inner_css_end__*/
89
- , "cjjo94_gg_")
89
+ , "1x332_gg_")
90
90
  /*__reshadow_css_end__*/
91
91
  , {
92
- "@enter": "enter_cjjo94",
93
- "@exit": "exit_cjjo94"
92
+ "@enter": "enter_1x332",
93
+ "@exit": "exit_1x332"
94
94
  });
95
95
 
96
96
  var Notices = function Notices(props) {
@@ -36,30 +36,30 @@ var style = (
36
36
  /*__reshadow_css_start__*/
37
37
  _sstyled.insert(
38
38
  /*__inner_css_start__*/
39
- ".___SInfo_a55f0_gg_,.___SView_a55f0_gg_,.___SWarning_a55f0_gg_{position:relative;margin-bottom:12px;padding:12px 28px 12px 12px;width:100%;min-height:44px;border-radius:6px;overflow:hidden;box-sizing:border-box}.___SInfo_a55f0_gg_{background:#191b23}.___SWarning_a55f0_gg_{background:#ff4953}.___SMessage_a55f0_gg_{font-size:14px;color:#fff;line-height:1.33}.___SDismiss_a55f0_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#ffffff}.___SDismiss_a55f0_gg_:hover{color:#e0e1e9}.___SAction_a55f0_gg_{margin-top:8px}.___SNoticeBubble_a55f0_gg_{width:300px;position:fixed;z-index:1010;right:12px;top:12px}@media (max-width:767px){.___SNoticeBubble_a55f0_gg_{width:calc(100% - 24px)}}"
39
+ ".___SInfo_c5k1n_gg_,.___SView_c5k1n_gg_,.___SWarning_c5k1n_gg_{position:relative;margin-bottom:12px;padding:12px 28px 12px 12px;width:100%;min-height:44px;border-radius:6px;overflow:hidden;box-sizing:border-box}.___SInfo_c5k1n_gg_{background:#191b23}.___SWarning_c5k1n_gg_{background:#ff4953}.___SMessage_c5k1n_gg_{font-size:14px;color:#fff;line-height:1.33}.___SDismiss_c5k1n_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#ffffff}.___SDismiss_c5k1n_gg_:hover{color:#e0e1e9}.___SAction_c5k1n_gg_{margin-top:8px}.___SNoticeBubble_c5k1n_gg_{width:300px;position:fixed;z-index:1010;right:12px;top:12px}@media (max-width:767px){.___SNoticeBubble_c5k1n_gg_{width:calc(100% - 24px)}}"
40
40
  /*__inner_css_end__*/
41
- , "l0oo1x_gg_")
41
+ , "c5k1n_gg_")
42
42
  /*__reshadow_css_end__*/
43
43
  , {
44
- "__SInfo": "___SInfo_a55f0_gg_",
45
- "__SView": "___SView_a55f0_gg_",
46
- "__SWarning": "___SWarning_a55f0_gg_",
47
- "__SMessage": "___SMessage_a55f0_gg_",
48
- "__SDismiss": "___SDismiss_a55f0_gg_",
49
- "__SAction": "___SAction_a55f0_gg_",
50
- "__SNoticeBubble": "___SNoticeBubble_a55f0_gg_"
44
+ "__SInfo": "___SInfo_c5k1n_gg_",
45
+ "__SView": "___SView_c5k1n_gg_",
46
+ "__SWarning": "___SWarning_c5k1n_gg_",
47
+ "__SMessage": "___SMessage_c5k1n_gg_",
48
+ "__SDismiss": "___SDismiss_c5k1n_gg_",
49
+ "__SAction": "___SAction_c5k1n_gg_",
50
+ "__SNoticeBubble": "___SNoticeBubble_c5k1n_gg_"
51
51
  });
52
52
  var animationNotice = (
53
53
  /*__reshadow_css_start__*/
54
54
  sstyled.insert(
55
55
  /*__inner_css_start__*/
56
- "@-webkit-keyframes enter_cjjo94{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes enter_cjjo94{0%{transform:translate(100%)}to{transform:translate(0)}}@-webkit-keyframes exit_cjjo94{0%{opacity:1}to{opacity:0}}@keyframes exit_cjjo94{0%{opacity:1}to{opacity:0}}"
56
+ "@-webkit-keyframes enter_1x332{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes enter_1x332{0%{transform:translate(100%)}to{transform:translate(0)}}@-webkit-keyframes exit_1x332{0%{opacity:1}to{opacity:0}}@keyframes exit_1x332{0%{opacity:1}to{opacity:0}}"
57
57
  /*__inner_css_end__*/
58
- , "cjjo94_gg_")
58
+ , "1x332_gg_")
59
59
  /*__reshadow_css_end__*/
60
60
  , {
61
- "@enter": "enter_cjjo94",
62
- "@exit": "exit_cjjo94"
61
+ "@enter": "enter_1x332",
62
+ "@exit": "exit_1x332"
63
63
  });
64
64
 
65
65
  var Notices = function Notices(props) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/notice-bubble",
3
3
  "description": "SEMRush NoticeBubble Component",
4
- "version": "4.0.6",
4
+ "version": "4.0.7",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -1,259 +0,0 @@
1
- import React from 'react';
2
- import Portal from '@semcore/portal';
3
- import manager from './NoticeBubbleManager';
4
- import createComponent, { Component, sstyled, Root } from '@semcore/core';
5
- import { Animation } from '@semcore/animation';
6
- import { Box } from '@semcore/flex-box';
7
- import fire from '@semcore/utils/lib/fire';
8
- import isNode from '@semcore/utils/lib/isNode';
9
- import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
10
- import CloseIcon from '@semcore/icon/Close/m';
11
- import { Timer } from './utils';
12
-
13
- import style from './style/notice-bubble.shadow.css';
14
-
15
- const animationNotice = sstyled.css`
16
- @keyframes enter {
17
- from {
18
- transform: translate(100%, 0);
19
- }
20
- to {
21
- transform: translate(0, 0);
22
- }
23
- }
24
-
25
- @keyframes exit {
26
- from {
27
- opacity: 1;
28
- }
29
- to {
30
- opacity: 0;
31
- }
32
- }
33
- `;
34
-
35
- const Notices = (props) => {
36
- const { styles, data = [], tag: SView = ViewInfo } = props;
37
-
38
- return data.map((notice) => {
39
- return sstyled(styles)(
40
- <Animation
41
- key={notice.uid}
42
- visible={notice.visible === undefined ? true : notice.visible}
43
- duration={250}
44
- keyframes={[animationNotice['@enter'], animationNotice['@exit']]}
45
- >
46
- <SView {...notice} styles={notice.styles || styles} />
47
- </Animation>,
48
- );
49
- });
50
- };
51
-
52
- /**
53
- * ```js
54
- * import { NoticeBubble } from "@semcore/notice-bubble"
55
- * ```
56
- *
57
- * Container is a portal (React.Portal) in the body, inserted once into any part of the application
58
- * and subscribes to manager updates(NoticeBubbleManager)
59
- * */
60
-
61
- class NoticeBubbleContainerRoot extends Component {
62
- static displayName = 'NoticeBubbleContainer';
63
- static style = style;
64
- static defaultProps = {
65
- manager,
66
- };
67
-
68
- _unsubscribe = null;
69
-
70
- state = {
71
- notices: [],
72
- warnings: [],
73
- };
74
-
75
- constructor(props) {
76
- super(props);
77
- props.manager.counter = 0;
78
- this._unsubscribe = props.manager.addListener(this.handleChange);
79
- }
80
-
81
- componentWillUnmount = () => {
82
- if (this._unsubscribe) {
83
- this._unsubscribe();
84
- }
85
- };
86
-
87
- handleChange = (notices) => {
88
- const info = notices.filter((notice) => notice.type === 'info');
89
- const warning = notices.filter((notice) => notice.type === 'warning');
90
-
91
- this.setState({ notices: info, warnings: warning });
92
- };
93
-
94
- render() {
95
- const SNoticeBubble = Root;
96
- const { Children, styles, disablePortal } = this.asProps;
97
- const { notices, warnings } = this.state;
98
-
99
- return sstyled(styles)(
100
- <Portal disablePortal={disablePortal}>
101
- <SNoticeBubble render={Box}>
102
- <Children />
103
- <Notices styles={styles} data={warnings} tag={ViewWarning} />
104
- <Notices styles={styles} data={notices} tag={ViewInfo} />
105
- </SNoticeBubble>
106
- </Portal>,
107
- );
108
- }
109
- }
110
- /**
111
- * ```js
112
- * import { NoticeBubble } from "@semcore/notice-bubble"
113
- * <NoticeBubble.Info/>
114
- * ```
115
- *
116
- * View component, the appearance of the notice
117
- * */
118
- class ViewInfo extends Component {
119
- timer = null;
120
-
121
- componentDidMount() {
122
- const { duration } = this.props;
123
- if (duration) {
124
- this.timer = new Timer(this.handlerClose, duration);
125
- }
126
- }
127
-
128
- componentWillUnmount() {
129
- this.clearTimer();
130
- }
131
-
132
- clearTimer() {
133
- if (this.timer) {
134
- this.timer.clear();
135
- this.timer = null;
136
- }
137
- }
138
-
139
- handlerClose = (e) => {
140
- // because call not only click
141
- fire(this, 'onClose', e);
142
- this.clearTimer();
143
- };
144
-
145
- handlerMouseEnter = () => {
146
- if (this.timer) {
147
- this.timer.pause();
148
- }
149
- };
150
-
151
- handlerMouseLeave = () => {
152
- if (this.timer) {
153
- this.timer.resume();
154
- }
155
- };
156
-
157
- render() {
158
- const SInfo = Box;
159
- const SMessage = 'div';
160
- const SAction = 'div';
161
- const SDismiss = 'div';
162
- const {
163
- action: actionNode,
164
- forwardRef,
165
- styles,
166
- onMouseEnter,
167
- onMouseLeave,
168
- children,
169
- ...other
170
- } = this.props;
171
-
172
- return sstyled(styles)(
173
- <SInfo
174
- role="alert"
175
- {...other}
176
- ref={forwardRef}
177
- onMouseEnter={callAllEventHandlers(onMouseEnter, this.handlerMouseEnter)}
178
- onMouseLeave={callAllEventHandlers(onMouseLeave, this.handlerMouseLeave)}
179
- >
180
- <SDismiss title="Close" onClick={this.handlerClose} aria-label="Close alert">
181
- <CloseIcon />
182
- </SDismiss>
183
- <SMessage>{children}</SMessage>
184
- {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}
185
- </SInfo>,
186
- );
187
- }
188
- }
189
-
190
- class ViewWarning extends ViewInfo {
191
- static defaultProps = {
192
- type: 'warning',
193
- duration: 0,
194
- };
195
-
196
- render() {
197
- const SWarning = Box;
198
- const SMessage = 'div';
199
- const SAction = 'div';
200
- const { action: actionNode, children, styles, forwardRef, ...other } = this.props;
201
-
202
- return sstyled(styles)(
203
- <SWarning ref={forwardRef} role="alert" {...other}>
204
- <SMessage>{children}</SMessage>
205
- {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}
206
- </SWarning>,
207
- );
208
- }
209
- }
210
-
211
- class NoticeBubbleView extends Component {
212
- static defaultProps = {
213
- duration: 5000,
214
- type: 'info',
215
- manager,
216
- };
217
-
218
- _notice = null;
219
-
220
- componentDidMount() {
221
- this._notice = this.asProps.manager.add(this.asProps);
222
- }
223
-
224
- componentWillUnmount() {
225
- if (this._notice) {
226
- this._notice.remove();
227
- }
228
- }
229
-
230
- componentDidUpdate() {
231
- if (this._notice) {
232
- this._notice.update(this.asProps);
233
- }
234
- }
235
-
236
- render() {
237
- return null;
238
- }
239
- }
240
-
241
- class NoticeBubbleWarningView extends NoticeBubbleView {
242
- static defaultProps = {
243
- duration: 5000,
244
- type: 'warning',
245
- manager,
246
- };
247
- }
248
-
249
- const NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {
250
- Info: NoticeBubbleView,
251
- Warning: NoticeBubbleWarningView,
252
- });
253
-
254
- const NoticeBubble = NoticeBubbleContainer.Info;
255
- const NoticeBubbleWarning = NoticeBubbleContainer.Warning;
256
-
257
- export { NoticeBubble, NoticeBubbleWarning };
258
-
259
- export default NoticeBubbleContainer;
@@ -1,74 +0,0 @@
1
- import EventEmitter from '@semcore/utils/lib/eventEmitter';
2
- import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
3
-
4
- const EVENT_NAME = 'CHANGE';
5
-
6
- class NoticeBubbleManager {
7
- items = [];
8
- emitter = null;
9
- counter = 0;
10
-
11
- constructor() {
12
- this.emitter = new EventEmitter();
13
- }
14
-
15
- addListener(fn) {
16
- return this.emitter.subscribe(EVENT_NAME, fn);
17
- }
18
-
19
- createItem(props) {
20
- const manager = this;
21
-
22
- return {
23
- type: 'info',
24
- ...props,
25
- onClose: callAllEventHandlers(props.onClose, () => {
26
- if (props.visible === undefined) {
27
- manager.remove(props.uid);
28
- }
29
- }),
30
- };
31
- }
32
-
33
- emit() {
34
- this.emitter.emit(EVENT_NAME, this.items);
35
- }
36
-
37
- add(props) {
38
- const uid = this.counter++;
39
- const item = this.createItem({ uid, ...props });
40
- this.items.push(item);
41
- this.emit();
42
- return {
43
- uid,
44
- update: this.update.bind(this, uid),
45
- remove: this.remove.bind(this, uid),
46
- };
47
- }
48
-
49
- update(uid, props) {
50
- const index = this.items.findIndex((item) => item.uid === uid);
51
- if (index !== -1) {
52
- this.items[index] = this.createItem({
53
- ...this.items[index],
54
- ...props,
55
- });
56
- this.emit();
57
- return true;
58
- }
59
- return false;
60
- }
61
-
62
- remove(uid) {
63
- const index = this.items.findIndex((item) => item.uid === uid);
64
- if (index !== -1) {
65
- this.items.splice(index, 1);
66
- this.emit();
67
- return true;
68
- }
69
- return false;
70
- }
71
- }
72
-
73
- export { NoticeBubbleManager };
74
- export default new NoticeBubbleManager();
package/src/index.d.ts DELETED
@@ -1,83 +0,0 @@
1
- import { IPortalProps } from '@semcore/portal';
2
- import { CProps, ReturnEl } from '@semcore/core';
3
- import { IBoxProps } from '@semcore/flex-box';
4
-
5
- export interface INoticeBubbleContainerProps extends IBoxProps, IPortalProps {
6
- /** Manager copy */
7
- manager?: INoticeBubbleManager;
8
- }
9
-
10
- export interface INoticeBubbleInfoProps extends INoticeBubbleProps {
11
- readonly type?: 'info';
12
- /** Notice display duration
13
- * @default 5000
14
- */
15
- duration?: number;
16
- }
17
-
18
- export interface INoticeBubbleWarningProps extends INoticeBubbleProps {
19
- readonly type?: 'warning';
20
- /**
21
- * Notice display duration
22
- * @default 0
23
- */
24
- duration?: number;
25
- }
26
-
27
- export interface INoticeBubbleProps extends IBoxProps {
28
- /**
29
- * Manager instance
30
- * @default NoticeBubbleManager()
31
- */
32
- manager?: INoticeBubbleManager;
33
- /**
34
- * Notice visibility
35
- */
36
- visible?: boolean;
37
- /** Adds controls (buttons, etc.) */
38
- action?: React.ReactNode;
39
-
40
- /** Triggered when the notice is closed */
41
- onClose?: (e?: React.SyntheticEvent) => void;
42
- }
43
-
44
- export interface INoticeBubbleManager {
45
- /**
46
- * Adding a notice.
47
- * Takes the props properties of NoticeBubble.
48
- * Returns an object with the uid and the update, remove functions.
49
- * */
50
- add: (
51
- props: object,
52
- ) => {
53
- uid: string;
54
- update: (props: object) => boolean;
55
- remove: () => boolean;
56
- };
57
- /**
58
- * Updates the notice by uid.
59
- * Takes the uid-unique identifier and the props-properties of NoticeBubble.
60
- * Returns a successful or unsuccessful update.
61
- * */
62
- update: (uid: string, props: object) => boolean;
63
- /**
64
- * Deletes the notice by uid.
65
- * Takes an uid-unique identifier.
66
- * Returns a successful or unsuccessful deletion.
67
- * */
68
- remove: (uid: string) => boolean;
69
- }
70
-
71
- declare const NoticeBubble: <T>(props: INoticeBubbleInfoProps & T) => ReturnEl;
72
- declare const NoticeBubbleWarning: <T>(props: INoticeBubbleWarningProps & T) => ReturnEl;
73
- declare const NoticeBubbleContainer: (<T>(
74
- props: CProps<INoticeBubbleContainerProps & T>,
75
- ) => ReturnEl) & {
76
- Info: typeof NoticeBubble;
77
- Warning: typeof NoticeBubbleWarning;
78
- };
79
-
80
- declare const manager: INoticeBubbleManager;
81
-
82
- export { NoticeBubbleContainer, NoticeBubble, NoticeBubbleWarning };
83
- export default manager;
package/src/index.js DELETED
@@ -1,9 +0,0 @@
1
- import { default as NoticeBubbleContainer } from './NoticeBubble';
2
- export * from './NoticeBubble';
3
-
4
- import { default as NoticeBubbleManager } from './NoticeBubbleManager';
5
-
6
- export * from './NoticeBubbleManager';
7
-
8
- export default NoticeBubbleManager;
9
- export { NoticeBubbleContainer };
@@ -1,57 +0,0 @@
1
- @import '@semcore/utils/style/var.css';
2
-
3
- SInfo,
4
- SWarning,
5
- SView {
6
- position: relative;
7
- margin-bottom: 12px;
8
- padding: 12px 28px 12px 12px;
9
- width: 100%;
10
- min-height: 44px;
11
- border-radius: var(--rounded-m);
12
- overflow: hidden;
13
- box-sizing: border-box;
14
- }
15
-
16
- SInfo {
17
- background: var(--gray-800);
18
- }
19
-
20
- SWarning {
21
- background: var(--red-400);
22
- }
23
-
24
- SMessage {
25
- font-size: var(--fs-200);
26
- color: #fff;
27
- line-height: var(--lh-100);
28
- }
29
-
30
- SDismiss {
31
- cursor: pointer;
32
- position: absolute;
33
- right: 0;
34
- top: 0;
35
- padding: 8px;
36
- color: var(--white);
37
-
38
- &:hover {
39
- color: var(--gray-100);
40
- }
41
- }
42
-
43
- SAction {
44
- margin-top: 8px;
45
- }
46
-
47
- SNoticeBubble {
48
- width: 300px;
49
- position: fixed;
50
- z-index: 1010;
51
- right: 12px;
52
- top: 12px;
53
-
54
- @media (max-width: 767px) {
55
- width: calc(100% - 24px);
56
- }
57
- }
package/src/utils.js DELETED
@@ -1,30 +0,0 @@
1
- class Timer {
2
- constructor(callback, delay) {
3
- this.callback = callback;
4
- this.delay = delay;
5
- this.remaining = delay;
6
- this.resume();
7
- }
8
-
9
- pause() {
10
- clearTimeout(this.timerId);
11
- this.remaining -= Date.now() - this.start;
12
- }
13
-
14
- resume() {
15
- this.start = Date.now();
16
- clearTimeout(this.timerId);
17
- this.timerId = setTimeout(this.callback, this.remaining);
18
- }
19
-
20
- reset() {
21
- this.remaining = this.delay;
22
- this.resume();
23
- }
24
-
25
- clear() {
26
- clearTimeout(this.timerId);
27
- }
28
- }
29
-
30
- export { Timer };