@croquiscom/pds 5.2.0 → 5.3.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @croquiscom/pds
2
2
 
3
+ ## 5.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1a7267e: Confirm, Alert, Basic Modal 컴포넌트 autoFocusButton, returnFocus props 추가
8
+
3
9
  ## 5.2.0
4
10
 
5
11
  ### Minor Changes
@@ -1,11 +1,17 @@
1
1
  /// <reference types="react" />
2
2
  import { ConfirmModalProps } from './ConfirmModal';
3
3
  import { NotificationKind } from '../notification';
4
- export interface AlertModalProps extends Omit<ConfirmModalProps, 'cancelText' | 'onCancel'> {
4
+ import { ModalActionButtonType } from './ModalActionButton';
5
+ export interface AlertModalProps extends Omit<ConfirmModalProps, 'cancelText' | 'onCancel' | 'autoFocusButton'> {
5
6
  /**
6
7
  * @default info
7
8
  */
8
9
  kind?: NotificationKind;
10
+ /**
11
+ * autofocus 지정할 기본 버튼 요소
12
+ * @default confirm
13
+ */
14
+ autoFocusButton?: Extract<ModalActionButtonType, 'confirm'> | null;
9
15
  }
10
- export declare const AlertModal: ({ width, kind, dense, fill, title, confirmText, text, subtext, zIndex, onConfirm, onClose, onExited, ...props }: AlertModalProps) => JSX.Element;
16
+ export declare const AlertModal: ({ width, kind, dense, fill, title, confirmText, autoFocusButton, text, subtext, zIndex, onConfirm, onClose, onExited, ...props }: AlertModalProps) => JSX.Element;
11
17
  export declare const Alert: (properties: AlertModalProps) => Promise<boolean>;
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { ComponentStory, ComponentMeta } from '@storybook/react';
3
3
  import { AlertModal, AlertModalProps } from './AlertModal';
4
- declare const _default: ComponentMeta<({ width, kind, dense, fill, title, confirmText, text, subtext, zIndex, onConfirm, onClose, onExited, ...props }: AlertModalProps) => JSX.Element>;
4
+ declare const _default: ComponentMeta<({ width, kind, dense, fill, title, confirmText, autoFocusButton, text, subtext, zIndex, onConfirm, onClose, onExited, ...props }: AlertModalProps) => JSX.Element>;
5
5
  export default _default;
6
6
  export declare const Base: ComponentStory<typeof AlertModal>;
7
7
  export declare const Dense: ComponentStory<typeof AlertModal>;
8
8
  export declare const Kind: ComponentStory<typeof AlertModal>;
9
+ export declare const DisabledAutoFocusButton: ComponentStory<typeof AlertModal>;
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { ModalOverlayBaseProps } from './ModalOverlay';
3
+ import { ModalActionButtonType } from './ModalActionButton';
3
4
  export interface ConfirmModalProps extends Omit<ModalOverlayBaseProps, 'onClose'> {
4
5
  title: ReactNode;
5
6
  text?: ReactNode;
@@ -10,6 +11,11 @@ export interface ConfirmModalProps extends Omit<ModalOverlayBaseProps, 'onClose'
10
11
  dense?: boolean;
11
12
  confirmText?: string;
12
13
  cancelText?: string;
14
+ /**
15
+ * autofocus 지정할 기본 버튼 요소
16
+ * @default confirm
17
+ */
18
+ autoFocusButton?: ModalActionButtonType | null;
13
19
  /**
14
20
  * confirmButton 클릭 이벤트
15
21
  */
@@ -23,7 +29,7 @@ export interface ConfirmModalProps extends Omit<ModalOverlayBaseProps, 'onClose'
23
29
  */
24
30
  onClose?: () => void | Promise<void>;
25
31
  }
26
- export declare const ConfirmModal: ({ title, width, zIndex, dense, fill, text, subtext, confirmText, cancelText, onConfirm, onCancel, onClose, onExited, ...props }: ConfirmModalProps) => JSX.Element;
32
+ export declare const ConfirmModal: ({ title, width, zIndex, dense, fill, text, subtext, confirmText, cancelText, autoFocusButton, onConfirm, onCancel, onClose, onExited, ...props }: ConfirmModalProps) => JSX.Element;
27
33
  export declare const StyledText: import("@emotion/styled").StyledComponent<(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>)) & {
28
34
  theme?: import("@emotion/react").Theme;
29
35
  }, {}, {}>;
@@ -1,8 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { ComponentStory, ComponentMeta } from '@storybook/react';
3
3
  import { ConfirmModal } from './ConfirmModal';
4
- declare const _default: ComponentMeta<({ title, width, zIndex, dense, fill, text, subtext, confirmText, cancelText, onConfirm, onCancel, onClose, onExited, ...props }: import("./ConfirmModal").ConfirmModalProps) => JSX.Element>;
4
+ declare const _default: ComponentMeta<({ title, width, zIndex, dense, fill, text, subtext, confirmText, cancelText, autoFocusButton, onConfirm, onCancel, onClose, onExited, ...props }: import("./ConfirmModal").ConfirmModalProps) => JSX.Element>;
5
5
  export default _default;
6
6
  export declare const Base: ComponentStory<typeof ConfirmModal>;
7
7
  export declare const Dense: ComponentStory<typeof ConfirmModal>;
8
8
  export declare const ContinuosOpen: ComponentStory<typeof ConfirmModal>;
9
+ export declare const AutoFocusButtonCustom: ComponentStory<typeof ConfirmModal>;
10
+ export declare const DisabledAutoFocusButton: ComponentStory<typeof ConfirmModal>;
@@ -2,6 +2,7 @@ import React, { ReactNode } from 'react';
2
2
  import { ButtonProps } from '../button';
3
3
  import { CSSValueWithLength, SpaceProps } from '../../styles';
4
4
  import { ModalOverlayBaseProps, ModalBaseCancelReason } from './ModalOverlay';
5
+ import { ModalActionButtonType } from './ModalActionButton';
5
6
  export type ModalButtonProps = Omit<ButtonProps, 'onClick'>;
6
7
  export type ModalCancelReason = ModalBaseCancelReason;
7
8
  export interface ModalContentProps extends SpaceProps {
@@ -24,6 +25,11 @@ export interface ModalProps extends Omit<ModalOverlayBaseProps, 'onClose'> {
24
25
  * [ButtonProps](https://storybook.kakaostyle.in/master/pds/?path=/docs/component-button--primary)를 cancelButton에 적용할 수 있습니다.
25
26
  */
26
27
  cancelButtonProps?: ModalButtonProps;
28
+ /**
29
+ * autofocus 지정할 기본 버튼 요소
30
+ * @default null
31
+ */
32
+ autoFocusButton?: ModalActionButtonType | null;
27
33
  /**
28
34
  * 헤더 영역 타이틀 좌측 backButton 사용 유무
29
35
  * @default false
@@ -19,3 +19,4 @@ export declare const CustomFooterFullScreen: ComponentStory<typeof Modal>;
19
19
  export declare const AutoMaxHeight: ComponentStory<typeof Modal>;
20
20
  export declare const CustomMaxHeight: ComponentStory<typeof Modal>;
21
21
  export declare const Scrollable: ComponentStory<typeof Modal>;
22
+ export declare const AutoFocusButton: any;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from '../button/Button';
3
+ export type ModalActionButtonType = 'confirm' | 'cancel';
4
+ export declare const ModalActionButton: React.FC<ButtonProps>;
@@ -33,6 +33,11 @@ export interface ModalOverlayBaseProps {
33
33
  * @default true
34
34
  */
35
35
  canCloseEscapeKey?: boolean;
36
+ /**
37
+ * reference 요소로 포커스 반환 여부
38
+ * @default true
39
+ */
40
+ returnFocus?: boolean;
36
41
  /**
37
42
  * Modal destroy시 전달합니다.
38
43
  */
@@ -61,5 +66,10 @@ export interface ModalOverlayProps extends ModalOverlayBaseProps {
61
66
  * @default false
62
67
  */
63
68
  controlledOpen?: boolean;
69
+ /**
70
+ * autofocus 지정 콘텐츠 요소 여부, true일 경우 FloatingFocusManager initialFocus는 자체 포커스 관리 충돌 방지를 위해 -1, false일 경우 기본값 0으로 처리됩니다.
71
+ * @default false
72
+ */
73
+ autoFocus?: boolean;
64
74
  }
65
- export declare const ModalOverlay: ({ floatingPortalId, width, borderRadiusSize, fill, fullScreen, className, children, opened: openProp, zIndex, canClickOutside, canCloseEscapeKey, controlledOpen, onExited, onClose, onCancelEventCallback, setOpened, }: PropsWithChildren<ModalOverlayProps>) => JSX.Element;
75
+ export declare const ModalOverlay: ({ floatingPortalId, width, borderRadiusSize, fill, fullScreen, className, children, opened: openProp, zIndex, canClickOutside, canCloseEscapeKey, controlledOpen, autoFocus, returnFocus, onExited, onClose, onCancelEventCallback, setOpened, }: PropsWithChildren<ModalOverlayProps>) => JSX.Element;
@@ -231,4 +231,30 @@ export declare const ModalStoryArgTypes: {
231
231
  };
232
232
  };
233
233
  };
234
+ autoFocusButton: {
235
+ description: string;
236
+ table: {
237
+ type: {
238
+ summary: string;
239
+ detail: string;
240
+ };
241
+ defaultValue: {
242
+ summary: string;
243
+ };
244
+ };
245
+ };
246
+ returnFocus: {
247
+ description: string;
248
+ table: {
249
+ type: {
250
+ summary: string;
251
+ };
252
+ defaultValue: {
253
+ summary: string;
254
+ };
255
+ };
256
+ control: {
257
+ type: string;
258
+ };
259
+ };
234
260
  };