@croquiscom/pds 3.12.0 → 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 +7 -0
- package/dist/components/message/MessageManager.d.ts +15 -6
- package/dist/components/message/types.d.ts +1 -1
- package/dist/components/notification/Notification.d.ts +2 -4
- package/dist/components/notification/index.d.ts +1 -0
- package/dist/components/notification/styles.d.ts +2 -2
- package/dist/components/notification/types.d.ts +1 -1
- package/dist/components/notification/useNotification.d.ts +3 -0
- package/dist/components/toast/Toast.d.ts +0 -2
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/types.d.ts +1 -1
- package/dist/components/toast/useToast.d.ts +3 -0
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
import { NotificationComponentProps } from '../notification';
|
|
3
3
|
import { ToastComponentProps } from '../toast';
|
|
4
|
-
import { MessageDirection,
|
|
4
|
+
import type { MessageDirection, MessagePositionType } from './types';
|
|
5
5
|
export interface MessageContainerProps {
|
|
6
6
|
/**
|
|
7
7
|
* @desc 메세지 노출 위치
|
|
8
8
|
* @default top-center
|
|
9
9
|
*/
|
|
10
|
-
position:
|
|
10
|
+
position: MessagePositionType;
|
|
11
11
|
/**
|
|
12
12
|
* @desc position 기준으로 커스텀 위치, center일 경우 적용되지 않습니다
|
|
13
13
|
*/
|
|
@@ -30,12 +30,14 @@ export interface MessageContainerProps {
|
|
|
30
30
|
*/
|
|
31
31
|
direction?: MessageDirection;
|
|
32
32
|
}
|
|
33
|
-
type
|
|
33
|
+
type MessageContainerType = 'toast' | 'notification';
|
|
34
|
+
type MessageContainerKey = `${MessagePositionType}_${MessageDirection}_${number}_${number}`;
|
|
34
35
|
type MessageComponentTypes = ToastComponentProps | NotificationComponentProps;
|
|
35
36
|
export type MessageOptions<T extends MessageComponentTypes> = Omit<T, 'destroy' | 'position'> & Partial<MessageContainerProps>;
|
|
36
37
|
export declare class MessageManager<T extends MessageComponentTypes> {
|
|
37
38
|
private root;
|
|
38
39
|
private component;
|
|
40
|
+
private type;
|
|
39
41
|
private z_index;
|
|
40
42
|
private default_max_count;
|
|
41
43
|
private default_offset;
|
|
@@ -43,15 +45,22 @@ export declare class MessageManager<T extends MessageComponentTypes> {
|
|
|
43
45
|
private default_direction;
|
|
44
46
|
private container_keys;
|
|
45
47
|
private messages;
|
|
46
|
-
|
|
48
|
+
private static instance;
|
|
49
|
+
constructor({ component, type, z_index, default_max_count, default_offset, default_position, default_direction, }: {
|
|
47
50
|
component: FunctionComponent<T>;
|
|
48
|
-
|
|
51
|
+
type: MessageContainerType;
|
|
49
52
|
z_index?: number;
|
|
50
53
|
default_max_count?: number;
|
|
51
54
|
default_offset?: number;
|
|
52
|
-
default_position?:
|
|
55
|
+
default_position?: MessagePositionType;
|
|
53
56
|
default_direction?: MessageDirection;
|
|
54
57
|
});
|
|
58
|
+
static getInstance(type: MessageContainerType): MessageManager<MessageComponentTypes>;
|
|
59
|
+
set setInstance({ default_max_count, default_offset, default_position, }: {
|
|
60
|
+
default_max_count: number;
|
|
61
|
+
default_offset: number;
|
|
62
|
+
default_position: MessagePositionType;
|
|
63
|
+
});
|
|
55
64
|
static generateContainerKey({ position, direction, offset_x, offset_y }: MessageContainerProps): MessageContainerKey;
|
|
56
65
|
static getContainerPropsByKey(key: MessageContainerKey): MessageContainerProps;
|
|
57
66
|
private generateMessageId;
|
|
@@ -6,5 +6,5 @@ export declare const MessagePosition: {
|
|
|
6
6
|
readonly BOTTOM_CENTER: "bottom-center";
|
|
7
7
|
readonly CENTER: "center";
|
|
8
8
|
};
|
|
9
|
-
export type
|
|
9
|
+
export type MessagePositionType = typeof MessagePosition[keyof typeof MessagePosition];
|
|
10
10
|
export type MessageDirection = Extract<CSSProperties['flexDirection'], 'column' | 'column-reverse'>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { NotificationKind, NotificationPosition } from './types';
|
|
2
|
+
import type { NotificationKind, NotificationPositionType } from './types';
|
|
4
3
|
export interface NotificationComponentProps {
|
|
5
4
|
/**
|
|
6
5
|
* id값을 지정할 수 있습니다.
|
|
@@ -29,7 +28,6 @@ export interface NotificationComponentProps {
|
|
|
29
28
|
onClose?: () => void;
|
|
30
29
|
onClickLink?: () => void;
|
|
31
30
|
destroy: () => void;
|
|
32
|
-
position:
|
|
31
|
+
position: NotificationPositionType;
|
|
33
32
|
}
|
|
34
33
|
export declare const NotificationComponent: React.FC<NotificationComponentProps>;
|
|
35
|
-
export declare const Notification: MessageManager<NotificationComponentProps>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NotificationKind,
|
|
1
|
+
import type { NotificationKind, NotificationPositionType } from './types';
|
|
2
2
|
export declare const notification_kind_css: Record<NotificationKind, string>;
|
|
3
|
-
export declare const notification_hide_animation: (position:
|
|
3
|
+
export declare const notification_hide_animation: (position: NotificationPositionType) => import("@emotion/serialize").Keyframes;
|
|
@@ -6,4 +6,4 @@ export declare const NotificationPosition: {
|
|
|
6
6
|
readonly BOTTOM_CENTER: "bottom-center";
|
|
7
7
|
readonly CENTER: "center";
|
|
8
8
|
};
|
|
9
|
-
export type
|
|
9
|
+
export type NotificationPositionType = typeof NotificationPosition[keyof typeof NotificationPosition];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { MessageManager } from '../message';
|
|
3
2
|
import { ToastSize, ToastKind } from './types';
|
|
4
3
|
export interface ToastComponentProps {
|
|
5
4
|
/**
|
|
@@ -27,4 +26,3 @@ export interface ToastComponentProps {
|
|
|
27
26
|
destroy: () => void;
|
|
28
27
|
}
|
|
29
28
|
export declare const ToastComponent: React.FC<ToastComponentProps>;
|
|
30
|
-
export declare const Toast: MessageManager<ToastComponentProps>;
|
|
@@ -8,5 +8,5 @@ export declare const ToastPosition: {
|
|
|
8
8
|
readonly BOTTOM_CENTER: "bottom-center";
|
|
9
9
|
readonly CENTER: "center";
|
|
10
10
|
};
|
|
11
|
-
export type
|
|
11
|
+
export type ToastPositionType = typeof ToastPosition[keyof typeof ToastPosition];
|
|
12
12
|
export type ToastDirection = MessageDirection;
|