@semcore/notice-bubble 16.3.0 → 16.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/lib/cjs/NoticeBubble.js +78 -17
- package/lib/cjs/NoticeBubble.js.map +1 -1
- package/lib/cjs/NoticeBubble.type.js.map +1 -1
- package/lib/cjs/NoticeBubbleManager.js +38 -12
- package/lib/cjs/NoticeBubbleManager.js.map +1 -1
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/NoticeBubble.js +78 -16
- package/lib/es6/NoticeBubble.js.map +1 -1
- package/lib/es6/NoticeBubble.type.js.map +1 -1
- package/lib/es6/NoticeBubbleManager.js +38 -12
- package/lib/es6/NoticeBubbleManager.js.map +1 -1
- package/lib/es6/index.js +1 -0
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/NoticeBubble.mjs +83 -20
- package/lib/esm/NoticeBubbleManager.mjs +38 -12
- package/lib/esm/index.mjs +7 -3
- package/lib/types/NoticeBubble.d.ts +31 -2
- package/lib/types/NoticeBubble.type.d.ts +45 -6
- package/lib/types/NoticeBubbleManager.d.ts +4 -2
- package/lib/types/index.d.ts +1 -0
- package/package.json +6 -6
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import type { PortalProps, BoxProps } from '@semcore/base-components';
|
|
2
|
-
import type { Intergalactic } from '@semcore/core';
|
|
2
|
+
import type { UnknownProperties, Intergalactic } from '@semcore/core';
|
|
3
3
|
import type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';
|
|
4
|
+
import type { NodeByRef } from '@semcore/core/lib/utils/ref';
|
|
4
5
|
import type { RefObject } from 'react';
|
|
6
|
+
/** @deprecated */
|
|
7
|
+
export interface INoticeBubbleContainerProps extends NoticeBubbleContainerProps, UnknownProperties {
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* @deprecated. Pass noticeBubbleContainer property from window.sm2.getNoticeBubbleContainer()
|
|
7
11
|
*/
|
|
8
12
|
export type NoticeBubbleContainerPortalProps = PortalProps;
|
|
9
13
|
export type NoticeBubbleContainerProps = BoxProps & NoticeBubbleContainerPortalProps & {
|
|
10
|
-
/** Ref to mount bubbles in. You should use element form window.sm2.getNoticeBubbleContainer() */
|
|
11
|
-
containerNode?:
|
|
14
|
+
/** Ref or element to mount bubbles in. You should use element form window.sm2.getNoticeBubbleContainer() */
|
|
15
|
+
containerNode?: NodeByRef | null;
|
|
12
16
|
/** Manager copy */
|
|
13
17
|
manager?: NoticeBubbleManagerClass;
|
|
14
18
|
/** Specifies the locale for i18n support */
|
|
15
19
|
locale?: string;
|
|
16
20
|
};
|
|
17
21
|
export type NoticeBubbleViewItemProps = NoticeBubbleProps & {
|
|
18
|
-
containerNode?:
|
|
22
|
+
containerNode?: NodeByRef;
|
|
19
23
|
animationDuration: number;
|
|
20
24
|
getI18nText: ReturnType<typeof useI18n>;
|
|
21
25
|
styles: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement> | undefined;
|
|
22
26
|
};
|
|
27
|
+
/** @deprecated */
|
|
28
|
+
export interface INoticeBubbleProps extends NoticeBubbleProps, UnknownProperties {
|
|
29
|
+
}
|
|
23
30
|
export type NoticeBubbleProps = BoxProps & {
|
|
24
31
|
/** Notice type */
|
|
25
32
|
type?: 'info' | 'warning';
|
|
@@ -58,23 +65,38 @@ export type NoticeBubbleProps = BoxProps & {
|
|
|
58
65
|
manager?: NoticeBubbleManagerClass;
|
|
59
66
|
icon?: React.ReactElement;
|
|
60
67
|
};
|
|
68
|
+
/** @deprecated */
|
|
69
|
+
export interface INoticeBubbleInfoProps extends NoticeBubbleInfoProps, UnknownProperties {
|
|
70
|
+
}
|
|
61
71
|
export type NoticeBubbleInfoProps = NoticeBubbleProps & {
|
|
62
72
|
readonly type?: 'info';
|
|
63
73
|
};
|
|
74
|
+
/** @deprecated */
|
|
75
|
+
export interface INoticeBubbleWarningProps extends NoticeBubbleWarningProps, UnknownProperties {
|
|
76
|
+
}
|
|
64
77
|
export type NoticeBubbleWarningProps = NoticeBubbleProps & {
|
|
65
78
|
readonly type?: 'warning';
|
|
66
79
|
};
|
|
67
80
|
export type AddedNoticeMeta = {
|
|
68
81
|
uid: number;
|
|
69
|
-
update: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) =>
|
|
82
|
+
update: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => boolean;
|
|
70
83
|
remove: () => boolean;
|
|
71
84
|
ref: RefObject<HTMLElement>;
|
|
85
|
+
focus: () => void;
|
|
72
86
|
};
|
|
87
|
+
/** @deprecated */
|
|
88
|
+
export interface INoticeBubbleManager extends NoticeBubbleManagerClass, UnknownProperties {
|
|
89
|
+
}
|
|
73
90
|
export type NoticeBubbleManagerClass = {
|
|
74
91
|
/**
|
|
75
92
|
* Creates and shows a notice.
|
|
76
93
|
* */
|
|
77
94
|
add: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => AddedNoticeMeta;
|
|
95
|
+
/**
|
|
96
|
+
* Updates notice by uid.
|
|
97
|
+
* @deprecated use replace instead.
|
|
98
|
+
*/
|
|
99
|
+
update: (uid: number, props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>) => boolean;
|
|
78
100
|
/**
|
|
79
101
|
* Removes notice by uid.
|
|
80
102
|
* */
|
|
@@ -88,4 +110,21 @@ export type NoticeBubbleManagerClass = {
|
|
|
88
110
|
*/
|
|
89
111
|
replaceLast: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;
|
|
90
112
|
};
|
|
91
|
-
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated use `NoticeBubbleManager` instead.
|
|
115
|
+
* */
|
|
116
|
+
export declare const NoticeBubble: Intergalactic.Component<'div', NoticeBubbleInfoProps>;
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated use `NoticeBubbleManager` instead.
|
|
119
|
+
* */
|
|
120
|
+
export declare const NoticeBubbleWarning: Intergalactic.Component<'div', NoticeBubbleWarningProps>;
|
|
121
|
+
export declare const NoticeBubbleContainer: Intergalactic.Component<'div', NoticeBubbleContainerProps> & {
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated use `NoticeBubbleManager` instead.
|
|
124
|
+
* */
|
|
125
|
+
Info: typeof NoticeBubble;
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated use `NoticeBubbleManager` instead.
|
|
128
|
+
* */
|
|
129
|
+
Warning: typeof NoticeBubbleWarning;
|
|
130
|
+
};
|
|
@@ -10,11 +10,13 @@ declare class NoticeBubbleManager implements NoticeBubbleManagerClass {
|
|
|
10
10
|
private items;
|
|
11
11
|
private emitter;
|
|
12
12
|
private counter;
|
|
13
|
+
private replaceTimer;
|
|
13
14
|
addListener(fn: (items: NoticeItem[]) => void): () => void;
|
|
14
15
|
private emit;
|
|
15
16
|
add(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): AddedNoticeMeta;
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
update(uid: number, props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): boolean;
|
|
18
|
+
replace(uid: number, props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): void;
|
|
19
|
+
replaceLast(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): void;
|
|
18
20
|
remove(uid: number): boolean;
|
|
19
21
|
}
|
|
20
22
|
declare const noticeBubbleDefaultManager: NoticeBubbleManager;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import type { NoticeBubbleContainerProps, NoticeBubbleInfoProps, NoticeBubbleWar
|
|
|
3
3
|
import { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';
|
|
4
4
|
export * from './NoticeBubble';
|
|
5
5
|
export * from './NoticeBubbleManager';
|
|
6
|
+
export default noticeBubbleDefaultManager;
|
|
6
7
|
export { NoticeBubbleContainer, noticeBubbleDefaultManager };
|
|
7
8
|
export type { NoticeBubbleContainerProps, NoticeBubbleInfoProps, NoticeBubbleWarningProps, AddedNoticeMeta, };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/notice-bubble",
|
|
3
3
|
"description": "Semrush NoticeBubble Component",
|
|
4
|
-
"version": "16.3.
|
|
4
|
+
"version": "16.3.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/icon": "16.8.
|
|
18
|
-
"@semcore/portal": "16.1.
|
|
19
|
-
"@semcore/flex-box": "16.1.
|
|
20
|
-
"@semcore/animation": "16.1.
|
|
21
|
-
"@semcore/button": "16.1.
|
|
17
|
+
"@semcore/icon": "16.8.1",
|
|
18
|
+
"@semcore/portal": "16.1.1",
|
|
19
|
+
"@semcore/flex-box": "16.1.1",
|
|
20
|
+
"@semcore/animation": "16.1.1",
|
|
21
|
+
"@semcore/button": "16.1.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@semcore/base-components": "^16.6.0"
|