@croquiscom/pds 0.26.0 → 0.28.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.
@@ -1,7 +1,7 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { NotificationComponentProps } from '../notification';
3
3
  import { ToastComponentProps } from '../toast';
4
- import { MessagePosition } from './types';
4
+ import { MessageDirection, MessagePosition } from './types';
5
5
  export interface MessageContainerProps {
6
6
  /**
7
7
  * @desc 메세지 노출 위치
@@ -25,8 +25,12 @@ export interface MessageContainerProps {
25
25
  * @default 'toast'일 경우 1050, 'notification'일 경우 1040
26
26
  */
27
27
  z_index?: number;
28
+ /**
29
+ * @default 'column'
30
+ */
31
+ direction?: MessageDirection;
28
32
  }
29
- declare type MessageContainerKey = `${MessagePosition}_${number}_${number}`;
33
+ declare type MessageContainerKey = `${MessagePosition}_${MessageDirection}_${number}_${number}`;
30
34
  declare type MessageComponentTypes = ToastComponentProps | NotificationComponentProps;
31
35
  export declare type MessageOptions<T extends MessageComponentTypes> = Omit<T, 'destroy' | 'position'> & Partial<MessageContainerProps>;
32
36
  export declare class MessageManager<T extends MessageComponentTypes> {
@@ -36,17 +40,19 @@ export declare class MessageManager<T extends MessageComponentTypes> {
36
40
  private default_max_count;
37
41
  private default_offset;
38
42
  private default_position;
43
+ private default_direction;
39
44
  private container_keys;
40
45
  private messages;
41
- constructor({ component, container_id, z_index, default_max_count, default_offset, default_position, }: {
46
+ constructor({ component, container_id, z_index, default_max_count, default_offset, default_position, default_direction, }: {
42
47
  component: FunctionComponent<T>;
43
48
  container_id: 'notification' | 'toast';
44
49
  z_index?: number;
45
50
  default_max_count?: number;
46
51
  default_offset?: number;
47
52
  default_position?: MessagePosition;
53
+ default_direction?: MessageDirection;
48
54
  });
49
- static generateContainerKey({ position, offset_x, offset_y }: MessageContainerProps): MessageContainerKey;
55
+ static generateContainerKey({ position, direction, offset_x, offset_y }: MessageContainerProps): MessageContainerKey;
50
56
  static getContainerPropsByKey(key: MessageContainerKey): MessageContainerProps;
51
57
  private generateMessageId;
52
58
  private findContainerKeyById;
@@ -54,7 +60,7 @@ export declare class MessageManager<T extends MessageComponentTypes> {
54
60
  private removeContainerKey;
55
61
  private getOffset;
56
62
  private render;
57
- show({ id, position, offset_x, offset_y, max_count, ...options }: MessageOptions<T>): void;
63
+ show({ id, position, offset_x, offset_y, max_count, direction, ...options }: MessageOptions<T>): void;
58
64
  destroy(id: string, key?: MessageContainerKey): void;
59
65
  }
60
66
  export {};
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from 'react';
1
2
  export declare const MessagePosition: {
2
3
  readonly TOP_RIGHT: "top-right";
3
4
  readonly TOP_CENTER: "top-center";
@@ -6,3 +7,4 @@ export declare const MessagePosition: {
6
7
  readonly CENTER: "center";
7
8
  };
8
9
  export declare type MessagePosition = typeof MessagePosition[keyof typeof MessagePosition];
10
+ export declare type MessageDirection = Extract<CSSProperties['flexDirection'], 'column' | 'column-reverse'>;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { ConfirmModalProps } from './ConfirmModal';
3
+ import { NotificationKind } from '../notification';
4
+ export interface AlertModalProps extends Omit<ConfirmModalProps, 'cancelText' | 'onCancel'> {
5
+ /**
6
+ * @default info
7
+ */
8
+ kind?: NotificationKind;
9
+ }
10
+ export declare const AlertModal: ({ opened: openProp, kind, dense, fill, title, confirmText, text, subtext, onConfirm, onExited, ...props }: AlertModalProps) => JSX.Element;
11
+ export declare const Alert: (properties: AlertModalProps) => Promise<void>;
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { ModalProps } from './Modal';
3
+ export interface ConfirmModalProps extends Omit<ModalProps, 'closeButton' | 'onConfirm' | 'onCancel' | 'onClose' | 'width' | 'footerAddon'> {
4
+ onConfirm?: () => void | Promise<void>;
5
+ onCancel?: () => void | Promise<void>;
6
+ text: ReactNode;
7
+ subtext?: ReactNode;
8
+ }
9
+ export declare const ConfirmModal: ({ opened: openProp, title, dense, fill, text, subtext, confirmText, cancelText, onConfirm, onCancel, onExited, ...props }: ConfirmModalProps) => JSX.Element;
10
+ export declare const Confirm: (properties: ConfirmModalProps) => Promise<boolean>;
@@ -0,0 +1,26 @@
1
+ import React, { PropsWithChildren, ReactNode } from 'react';
2
+ import { ModalOverlayBaseProps } from './ModalOverlay';
3
+ export interface ModalProps extends ModalOverlayBaseProps {
4
+ title?: ReactNode;
5
+ confirmText?: string;
6
+ cancelText?: string;
7
+ /**
8
+ * @default true
9
+ */
10
+ closeButton?: boolean;
11
+ /**
12
+ * @default false
13
+ */
14
+ dense?: boolean;
15
+ /**
16
+ * @desc Footer 영역 좌측 영역에 렌더링될 요소
17
+ */
18
+ footerAddon?: ReactNode;
19
+ onConfirm?: () => void;
20
+ onCancel?: () => void;
21
+ }
22
+ export declare const MIN_WIDTH = 480;
23
+ export declare const Modal: ({ opened: openProp, children, title, width, confirmText, cancelText, closeButton, dense, fill, footerAddon, onConfirm, onCancel, onClose, onExited, ...props }: PropsWithChildren<ModalProps>) => JSX.Element;
24
+ export declare const ModalTitle: import("@emotion/styled").StyledComponent<React.PropsWithChildren<import("../text").BaseTextProps & (React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> | React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement> | React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> | React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement> | React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>)> & {
25
+ theme?: import("@emotion/react").Theme;
26
+ }, {}, {}>;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { AlertModal as AlertModalComponent } from './AlertModal';
4
+ import { ConfirmModal as ConfirmModalComponent } from './ConfirmModal';
5
+ declare const _default: ComponentMeta<({ opened: openProp, children, title, width, confirmText, cancelText, closeButton, dense, fill, footerAddon, onConfirm, onCancel, onClose, onExited, ...props }: React.PropsWithChildren<import("./Modal").ModalProps>) => JSX.Element>;
6
+ export default _default;
7
+ export declare const BasicModal: any;
8
+ export declare const BasicModalDense: any;
9
+ export declare const canClickOutside: any;
10
+ export declare const Custom: any;
11
+ export declare const ConfirmModal: ComponentStory<typeof ConfirmModalComponent>;
12
+ export declare const ConfirmModalDenseWithFill: ComponentStory<typeof ConfirmModalComponent>;
13
+ export declare const AlertModal: ComponentStory<typeof AlertModalComponent>;
14
+ export declare const AlertModalDenseWithFill: ComponentStory<typeof AlertModalComponent>;
15
+ export declare const AlertModalKind: ComponentStory<typeof AlertModalComponent>;
16
+ export declare const NoticeModal: any;
@@ -0,0 +1,32 @@
1
+ import { PropsWithChildren, Dispatch, SetStateAction } from 'react';
2
+ import { CSSValueWithLength } from '../styles';
3
+ import { CornerRadiusSize } from '../foundation';
4
+ export interface ModalOverlayBaseProps {
5
+ /**
6
+ * @desc 100% 너비 사용, Alert 또는 Confirm Modal의 경우 최소너비(480) 범위내에서 적용됩니다.
7
+ * @default false
8
+ */
9
+ fill?: boolean;
10
+ width?: CSSValueWithLength;
11
+ className?: string;
12
+ opened?: boolean;
13
+ /**
14
+ * @default 1020
15
+ */
16
+ zIndex?: number;
17
+ /**
18
+ * @default false
19
+ */
20
+ canClickOutside?: boolean;
21
+ onExited?: () => void;
22
+ onClose?: () => void;
23
+ }
24
+ export interface ModalOverlayProps extends ModalOverlayBaseProps {
25
+ maxWidth?: CSSValueWithLength;
26
+ /**
27
+ * @default large
28
+ */
29
+ borderRadiusSize?: CornerRadiusSize;
30
+ setOpened: Dispatch<SetStateAction<boolean>>;
31
+ }
32
+ export declare const ModalOverlay: ({ width, maxWidth, borderRadiusSize, fill, className, children, opened: openProp, zIndex, canClickOutside, onExited, onClose, setOpened, }: PropsWithChildren<ModalOverlayProps>) => JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React, { PropsWithChildren, ReactNode } from 'react';
2
+ import { ModalOverlayBaseProps } from './ModalOverlay';
3
+ export interface NoticeModalProps extends Omit<ModalOverlayBaseProps, 'fill'> {
4
+ label?: string;
5
+ title?: ReactNode;
6
+ text?: ReactNode;
7
+ /**
8
+ * @default false
9
+ */
10
+ checkReplay?: boolean;
11
+ /**
12
+ * @default '오늘 하루동안 이 창을 열지 않음'
13
+ */
14
+ checkReplayText?: string;
15
+ onChangeCheckReplay?: (e: React.ChangeEvent<HTMLInputElement>) => void;
16
+ }
17
+ export declare const NoticeModal: ({ opened: openProp, children, width, label, title, text, checkReplay, checkReplayText, onClose, onExited, onChangeCheckReplay, ...props }: PropsWithChildren<NoticeModalProps>) => JSX.Element;
@@ -0,0 +1,4 @@
1
+ export * from './Modal';
2
+ export * from './AlertModal';
3
+ export * from './ConfirmModal';
4
+ export * from './NoticeModal';
@@ -0,0 +1,2 @@
1
+ export declare function getFloatingModalPortal(): HTMLElement;
2
+ export declare function removeFloatingModalPortal(target: HTMLElement, unmountDelay?: number): void;
@@ -18,6 +18,7 @@ export interface ToastComponentProps {
18
18
  * @default info
19
19
  */
20
20
  kind?: ToastKind;
21
+ fill?: boolean;
21
22
  destroy: () => void;
22
23
  }
23
24
  export declare const ToastComponent: React.FC<ToastComponentProps>;
@@ -6,4 +6,6 @@ export default _default;
6
6
  export declare const Base: any;
7
7
  export declare const Kind: any;
8
8
  export declare const Position: any;
9
+ export declare const Direction: any;
10
+ export declare const FullWidth: any;
9
11
  export declare const HandleDestroy: ComponentStory<typeof ToastComponent>;
@@ -1,3 +1,4 @@
1
+ import { MessageDirection } from '../message';
1
2
  export declare type ToastSize = 'large' | 'medium';
2
3
  export declare type ToastKind = 'info' | 'success' | 'error';
3
4
  export declare const ToastPosition: {
@@ -8,3 +9,4 @@ export declare const ToastPosition: {
8
9
  readonly CENTER: "center";
9
10
  };
10
11
  export declare type ToastPosition = typeof ToastPosition[keyof typeof ToastPosition];
12
+ export declare type ToastDirection = MessageDirection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@croquiscom/pds",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
4
4
  "description": "Design system for Zigzag's Partner Center",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.es.js",