@ncds/ui-admin 1.8.26-alpha.4 → 1.8.26-alpha.6
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/dist/cjs/assets/scripts/notification/FloatingNotification.js +23 -7
- package/dist/cjs/assets/scripts/notification/FullWidthNotification.js +14 -3
- package/dist/cjs/assets/scripts/notification/MessageNotification.js +9 -9
- package/dist/cjs/assets/scripts/notification/Notification.js +8 -2
- package/dist/cjs/assets/scripts/notification/const/icons.js +17 -8
- package/dist/cjs/assets/scripts/notification/const/index.js +6 -0
- package/dist/cjs/assets/scripts/notification/messageTemplate.js +21 -5
- package/dist/cjs/constant/notification.js +8 -3
- package/dist/cjs/src/components/overlays/notification/FloatingNotification.js +11 -29
- package/dist/cjs/src/components/overlays/notification/FullWidthNotification.js +9 -24
- package/dist/cjs/src/components/overlays/notification/MessageNotification.js +25 -9
- package/dist/cjs/src/components/overlays/notification/MessageNotificationParts.js +5 -2
- package/dist/cjs/src/components/overlays/notification/Notification.js +1 -0
- package/dist/cjs/src/components/overlays/notification/__tests__/CalloutNotification.test.js +8 -2
- package/dist/cjs/src/components/overlays/notification/__tests__/MessageNotification.test.js +55 -13
- package/dist/cjs/src/components/overlays/notification/__tests__/Notification.test.js +176 -0
- package/dist/cjs/src/components/overlays/notification/useAutoClose.js +39 -0
- package/dist/cjs/src/generated/scoped-css.js +1 -1
- package/dist/cjs/src/utils/notification/__tests__/resolveAutoClose.test.js +44 -0
- package/dist/cjs/src/utils/notification/index.js +12 -0
- package/dist/cjs/src/utils/notification/resolveAutoClose.js +22 -0
- package/dist/esm/assets/scripts/notification/FloatingNotification.js +23 -7
- package/dist/esm/assets/scripts/notification/FullWidthNotification.js +14 -3
- package/dist/esm/assets/scripts/notification/MessageNotification.js +10 -10
- package/dist/esm/assets/scripts/notification/Notification.js +8 -2
- package/dist/esm/assets/scripts/notification/const/icons.js +16 -7
- package/dist/esm/assets/scripts/notification/const/index.js +1 -1
- package/dist/esm/assets/scripts/notification/messageTemplate.js +21 -5
- package/dist/esm/constant/notification.js +7 -2
- package/dist/esm/src/components/overlays/notification/FloatingNotification.js +12 -30
- package/dist/esm/src/components/overlays/notification/FullWidthNotification.js +10 -25
- package/dist/esm/src/components/overlays/notification/MessageNotification.js +25 -9
- package/dist/esm/src/components/overlays/notification/MessageNotificationParts.js +5 -2
- package/dist/esm/src/components/overlays/notification/Notification.js +1 -0
- package/dist/esm/src/components/overlays/notification/__tests__/CalloutNotification.test.js +9 -3
- package/dist/esm/src/components/overlays/notification/__tests__/MessageNotification.test.js +55 -13
- package/dist/esm/src/components/overlays/notification/__tests__/Notification.test.js +177 -1
- package/dist/esm/src/components/overlays/notification/useAutoClose.js +32 -0
- package/dist/esm/src/generated/scoped-css.js +1 -1
- package/dist/esm/src/utils/notification/__tests__/resolveAutoClose.test.js +42 -0
- package/dist/esm/src/utils/notification/index.js +1 -0
- package/dist/esm/src/utils/notification/resolveAutoClose.js +15 -0
- package/dist/temp/assets/scripts/notification/FloatingNotification.js +10 -6
- package/dist/temp/assets/scripts/notification/FullWidthNotification.js +8 -5
- package/dist/temp/assets/scripts/notification/MessageNotification.d.ts +1 -1
- package/dist/temp/assets/scripts/notification/MessageNotification.js +10 -12
- package/dist/temp/assets/scripts/notification/Notification.js +7 -1
- package/dist/temp/assets/scripts/notification/const/icons.d.ts +6 -6
- package/dist/temp/assets/scripts/notification/const/icons.js +16 -7
- package/dist/temp/assets/scripts/notification/const/index.d.ts +1 -1
- package/dist/temp/assets/scripts/notification/const/index.js +1 -1
- package/dist/temp/assets/scripts/notification/const/types.d.ts +8 -1
- package/dist/temp/assets/scripts/notification/messageTemplate.d.ts +1 -0
- package/dist/temp/assets/scripts/notification/messageTemplate.js +19 -9
- package/dist/temp/constant/notification.d.ts +6 -1
- package/dist/temp/constant/notification.js +6 -1
- package/dist/temp/src/components/overlays/notification/FloatingNotification.d.ts +8 -0
- package/dist/temp/src/components/overlays/notification/FloatingNotification.js +7 -30
- package/dist/temp/src/components/overlays/notification/FullWidthNotification.d.ts +7 -0
- package/dist/temp/src/components/overlays/notification/FullWidthNotification.js +6 -25
- package/dist/temp/src/components/overlays/notification/MessageNotification.d.ts +13 -1
- package/dist/temp/src/components/overlays/notification/MessageNotification.js +16 -9
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.d.ts +2 -1
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.js +5 -3
- package/dist/temp/src/components/overlays/notification/Notification.d.ts +16 -3
- package/dist/temp/src/components/overlays/notification/Notification.js +1 -1
- package/dist/temp/src/components/overlays/notification/__tests__/CalloutNotification.test.js +8 -1
- package/dist/temp/src/components/overlays/notification/__tests__/MessageNotification.test.js +44 -9
- package/dist/temp/src/components/overlays/notification/__tests__/Notification.test.js +128 -1
- package/dist/temp/src/components/overlays/notification/useAutoClose.d.ts +15 -0
- package/dist/temp/src/components/overlays/notification/useAutoClose.js +25 -0
- package/dist/temp/src/generated/scoped-css.js +1 -1
- package/dist/temp/src/utils/notification/__tests__/resolveAutoClose.test.d.ts +1 -0
- package/dist/temp/src/utils/notification/__tests__/resolveAutoClose.test.js +22 -0
- package/dist/temp/src/utils/notification/index.d.ts +1 -0
- package/dist/temp/src/utils/notification/index.js +1 -0
- package/dist/temp/src/utils/notification/resolveAutoClose.d.ts +14 -0
- package/dist/temp/src/utils/notification/resolveAutoClose.js +12 -0
- package/dist/types/assets/scripts/notification/MessageNotification.d.ts +1 -1
- package/dist/types/assets/scripts/notification/const/icons.d.ts +6 -6
- package/dist/types/assets/scripts/notification/const/index.d.ts +1 -1
- package/dist/types/assets/scripts/notification/const/types.d.ts +8 -1
- package/dist/types/assets/scripts/notification/messageTemplate.d.ts +1 -0
- package/dist/types/constant/notification.d.ts +6 -1
- package/dist/types/src/components/overlays/notification/FloatingNotification.d.ts +8 -0
- package/dist/types/src/components/overlays/notification/FullWidthNotification.d.ts +7 -0
- package/dist/types/src/components/overlays/notification/MessageNotification.d.ts +13 -1
- package/dist/types/src/components/overlays/notification/MessageNotificationParts.d.ts +2 -1
- package/dist/types/src/components/overlays/notification/Notification.d.ts +16 -3
- package/dist/types/src/components/overlays/notification/useAutoClose.d.ts +15 -0
- package/dist/types/src/utils/notification/__tests__/resolveAutoClose.test.d.ts +1 -0
- package/dist/types/src/utils/notification/index.d.ts +1 -0
- package/dist/types/src/utils/notification/resolveAutoClose.d.ts +14 -0
- package/dist/ui-admin/assets/styles/style.css +17 -11
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { HIDE_CLOSE_BUTTON_AUTO_CLOSE_MS } from '../../../../constant/notification';
|
|
3
|
+
import { resolveAutoClose } from '../resolveAutoClose';
|
|
4
|
+
const EXPLICIT_MS = 5000;
|
|
5
|
+
const FALLBACK_MS = 4000;
|
|
6
|
+
const NO_AUTO_CLOSE = 0;
|
|
7
|
+
describe('resolveAutoClose', () => {
|
|
8
|
+
it('autoClose 를 명시하면 hideCloseButton·fallback 과 무관하게 그대로 쓴다 (0 포함)', () => {
|
|
9
|
+
expect(resolveAutoClose({ autoClose: EXPLICIT_MS, hideCloseButton: true, fallback: FALLBACK_MS })).toBe(EXPLICIT_MS);
|
|
10
|
+
expect(resolveAutoClose({ autoClose: NO_AUTO_CLOSE, hideCloseButton: true, fallback: FALLBACK_MS })).toBe(NO_AUTO_CLOSE);
|
|
11
|
+
});
|
|
12
|
+
it('autoClose 미지정이면 fallback 이 양수일 때 fallback 을 쓴다', () => {
|
|
13
|
+
expect(resolveAutoClose({ fallback: FALLBACK_MS })).toBe(FALLBACK_MS);
|
|
14
|
+
expect(resolveAutoClose({ hideCloseButton: true, fallback: FALLBACK_MS })).toBe(FALLBACK_MS);
|
|
15
|
+
});
|
|
16
|
+
it('autoClose·fallback 모두 없으면 hideCloseButton 일 때만 기본 3초를 준다', () => {
|
|
17
|
+
expect(resolveAutoClose({ hideCloseButton: true })).toBe(HIDE_CLOSE_BUTTON_AUTO_CLOSE_MS);
|
|
18
|
+
expect(resolveAutoClose({ hideCloseButton: true, fallback: NO_AUTO_CLOSE })).toBe(HIDE_CLOSE_BUTTON_AUTO_CLOSE_MS);
|
|
19
|
+
expect(resolveAutoClose({ hideCloseButton: false })).toBe(NO_AUTO_CLOSE);
|
|
20
|
+
expect(resolveAutoClose({})).toBe(NO_AUTO_CLOSE);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveAutoClose } from './resolveAutoClose';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveAutoClose } from './resolveAutoClose';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ResolveAutoCloseParams {
|
|
2
|
+
/** 사용처가 명시한 autoClose(ms). `0`이면 자동 닫힘 없음 — 부모가 직접 닫는 용도. */
|
|
3
|
+
autoClose?: number;
|
|
4
|
+
/** floating(토스트)만 넘긴다 — 닫기 버튼이 없는 토스트가 영구히 남지 않게 기본 3초를 준다. */
|
|
5
|
+
hideCloseButton?: boolean;
|
|
6
|
+
/** 색상별 기본값 등 2순위 기본값. */
|
|
7
|
+
fallback?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 실제 적용할 autoClose(ms)를 정한다. React·Vanilla 두 구현이 공유한다.
|
|
11
|
+
* 우선순위: 명시 `autoClose` > `fallback`(양수) > `hideCloseButton`이면 3초 > 0.
|
|
12
|
+
*/
|
|
13
|
+
export declare const resolveAutoClose: ({ autoClose, hideCloseButton, fallback, }: ResolveAutoCloseParams) => number;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HIDE_CLOSE_BUTTON_AUTO_CLOSE_MS } from '../../../constant/notification';
|
|
2
|
+
/**
|
|
3
|
+
* 실제 적용할 autoClose(ms)를 정한다. React·Vanilla 두 구현이 공유한다.
|
|
4
|
+
* 우선순위: 명시 `autoClose` > `fallback`(양수) > `hideCloseButton`이면 3초 > 0.
|
|
5
|
+
*/
|
|
6
|
+
export const resolveAutoClose = ({ autoClose, hideCloseButton = false, fallback = 0, }) => {
|
|
7
|
+
if (autoClose !== undefined)
|
|
8
|
+
return autoClose;
|
|
9
|
+
if (fallback > 0)
|
|
10
|
+
return fallback;
|
|
11
|
+
return hideCloseButton ? HIDE_CLOSE_BUTTON_AUTO_CLOSE_MS : 0;
|
|
12
|
+
};
|
|
@@ -9,7 +9,7 @@ export declare class MessageNotification {
|
|
|
9
9
|
private featuredIcon?;
|
|
10
10
|
constructor(options: MessageNotificationOptions);
|
|
11
11
|
private createElement;
|
|
12
|
-
/** 색상별 FeaturedIcon. default 는 md(40/20), block 은 sm(32/16). */
|
|
12
|
+
/** 색상별 FeaturedIcon. default 는 md(40/20), block 은 sm(32/16). info 아이콘만 variant 별로 다르다. */
|
|
13
13
|
private createFeaturedIcon;
|
|
14
14
|
private bindEvents;
|
|
15
15
|
private setupAutoClose;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NotificationColor } from './types';
|
|
2
|
+
type IconFunction = (size: string) => string;
|
|
2
3
|
export declare const SVG_ICONS: {
|
|
3
4
|
readonly 'pin-02': (size: string) => string;
|
|
4
5
|
readonly 'alert-triangle': (size: string) => string;
|
|
@@ -23,9 +24,8 @@ export declare const ICON_MAP: {
|
|
|
23
24
|
readonly success: (size: string) => string;
|
|
24
25
|
readonly info: (size: string) => string;
|
|
25
26
|
};
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export declare const MESSAGE_ICON_MAP: Partial<Record<NotificationColor, (size: string) => string>>;
|
|
27
|
+
/** message 기본 타입 아이콘. floating 과 같은 4색에 info(neutral 과 같은 핀)를 더한다. */
|
|
28
|
+
export declare const MESSAGE_ICON_MAP: Record<NotificationColor, IconFunction>;
|
|
29
|
+
/** block 변형 아이콘. info 만 InfoCircle 로 다르다 (#536 유지). */
|
|
30
|
+
export declare const MESSAGE_BLOCK_ICON_MAP: Record<NotificationColor, IconFunction>;
|
|
31
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { CLASS_NAMES } from './classNames';
|
|
2
|
-
export { FLOATING_ICON_MAP, FULL_WIDTH_ICON_MAP, ICON_MAP, MESSAGE_ICON_MAP, SVG_ICONS } from './icons';
|
|
2
|
+
export { FLOATING_ICON_MAP, FULL_WIDTH_ICON_MAP, ICON_MAP, MESSAGE_BLOCK_ICON_MAP, MESSAGE_ICON_MAP, SVG_ICONS, } from './icons';
|
|
3
3
|
export { CLOSE_BUTTON_SIZES, CLOSE_BUTTON_SVG_SIZES, FEATURED_ICON_SIZES, FULL_WIDTH_SIZES, getSizes, ICON_PIXEL_SIZES, MESSAGE_BLOCK_SIZES, MESSAGE_SIZES, } from './sizes';
|
|
4
4
|
export type { BaseNotificationOptions, LegacyNotificationHierarchy, NotificationAction, NotificationActionButtonSize, NotificationColor, NotificationHierarchy, NotificationLinkTarget, NotificationVariant, } from './types';
|
|
@@ -2,7 +2,7 @@ export type NotificationColor = 'neutral' | 'error' | 'warning' | 'success' | 'i
|
|
|
2
2
|
/**
|
|
3
3
|
* message 타입의 표시 변형. React `NotificationVariant`와 같은 어휘다.
|
|
4
4
|
* - `'default'`: 기존 message
|
|
5
|
-
* - `'block'`: 서브 페이지 공지용 (흰 배경, FeaturedIcon sm, 제목 + 텍스트 링크 1행, info
|
|
5
|
+
* - `'block'`: 서브 페이지 공지용 (흰 배경, FeaturedIcon sm, 제목 + 텍스트 링크 1행, info 아이콘 InfoCircle)
|
|
6
6
|
*/
|
|
7
7
|
export type NotificationVariant = 'default' | 'block';
|
|
8
8
|
/**
|
|
@@ -40,6 +40,13 @@ export interface BaseNotificationOptions {
|
|
|
40
40
|
supportingText?: string;
|
|
41
41
|
color?: NotificationColor;
|
|
42
42
|
onClose?: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* 닫기(X) 버튼 숨김 여부. `true`면 `onClose`가 있어도 X 버튼을 렌더하지 않는다.
|
|
45
|
+
* autoClose 만료 시 `onClose` 호출은 그대로 유지된다. 기본값 `false`.
|
|
46
|
+
* floating 은 `autoClose` 미지정 시 3초 뒤 자동으로 닫힌다(직접 `remove()` 로 닫으려면 `autoClose: 0` 명시).
|
|
47
|
+
* full-width · message 는 `autoClose` 를 명시했을 때만 자동으로 닫힌다.
|
|
48
|
+
*/
|
|
49
|
+
hideCloseButton?: boolean;
|
|
43
50
|
className?: string;
|
|
44
51
|
actions?: NotificationAction[];
|
|
45
52
|
autoClose?: number;
|
|
@@ -17,7 +17,6 @@ export declare const HIDE_PERMANENTLY_LABEL: {
|
|
|
17
17
|
* message 타입 닫기(X) 아이콘의 color 별 색.
|
|
18
18
|
*
|
|
19
19
|
* React(`MessageNotification.tsx`)와 Vanilla(`messageTemplate.ts`)가 함께 참조하는 단일 출처다.
|
|
20
|
-
* `info`는 `variant: 'block'`에서만 렌더된다(default 는 neutral 로 폴백).
|
|
21
20
|
*/
|
|
22
21
|
export declare const MESSAGE_CLOSE_ICON_COLOR: {
|
|
23
22
|
readonly neutral: string;
|
|
@@ -26,3 +25,9 @@ export declare const MESSAGE_CLOSE_ICON_COLOR: {
|
|
|
26
25
|
readonly success: string;
|
|
27
26
|
readonly info: string;
|
|
28
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* floating(토스트)에서 `hideCloseButton`인데 `autoClose`를 지정하지 않았을 때 적용되는 자동 닫힘 시간(ms).
|
|
30
|
+
* 닫기 버튼이 없는 토스트가 영구히 남지 않게 한다 — DES-SPEC-027 §5.3 Toast Alert 3초.
|
|
31
|
+
* full-width · message 는 부모가 언마운트로 닫으므로 적용하지 않는다.
|
|
32
|
+
*/
|
|
33
|
+
export declare const HIDE_CLOSE_BUTTON_AUTO_CLOSE_MS = 3000;
|
|
@@ -18,6 +18,13 @@ interface FloatingNotificationProps extends Omit<ComponentPropsWithoutRef<'div'>
|
|
|
18
18
|
* 닫기 버튼 클릭 이벤트 핸들러
|
|
19
19
|
*/
|
|
20
20
|
onClose?: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* 닫기(X) 버튼 숨김 여부. `true`면 `onClose`가 있어도 X 버튼을 렌더하지 않는다.
|
|
23
|
+
* autoClose 만료·모바일 전환 시 `onClose` 호출은 그대로 유지된다.
|
|
24
|
+
* `autoClose` 미지정이면 3초 뒤 자동으로 닫힌다. 부모가 직접 언마운트하려면 `autoClose={0}`을 명시한다.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
hideCloseButton?: boolean;
|
|
21
28
|
/**
|
|
22
29
|
* 추가 CSS 클래스
|
|
23
30
|
*/
|
|
@@ -28,6 +35,7 @@ interface FloatingNotificationProps extends Omit<ComponentPropsWithoutRef<'div'>
|
|
|
28
35
|
actions?: NotificationAction[];
|
|
29
36
|
/**
|
|
30
37
|
* 자동 닫기 시간 (밀리초 단위, 0이면 자동으로 닫히지 않음)
|
|
38
|
+
* 미지정 시 0. 단 `hideCloseButton`이면 3초.
|
|
31
39
|
* @default 0
|
|
32
40
|
*/
|
|
33
41
|
autoClose?: number;
|
|
@@ -18,6 +18,13 @@ interface FullWidthNotificationProps extends Omit<ComponentPropsWithoutRef<'div'
|
|
|
18
18
|
* 닫기 버튼 클릭 이벤트 핸들러
|
|
19
19
|
*/
|
|
20
20
|
onClose?: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* 닫기(X) 버튼 숨김 여부. `true`면 `onClose`가 있어도 X 버튼을 렌더하지 않는다.
|
|
23
|
+
* autoClose 만료 시 `onClose` 호출은 그대로 유지된다.
|
|
24
|
+
* 기본 자동 닫힘은 없다 — 부모가 언마운트로 닫거나 `autoClose`를 명시한다.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
hideCloseButton?: boolean;
|
|
21
28
|
/**
|
|
22
29
|
* 추가 CSS 클래스
|
|
23
30
|
*/
|
|
@@ -23,6 +23,18 @@ interface MessageNotificationProps extends Omit<ComponentPropsWithoutRef<'div'>,
|
|
|
23
23
|
* 닫기 버튼 클릭 이벤트 핸들러
|
|
24
24
|
*/
|
|
25
25
|
onClose?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* 닫기(X) 버튼 숨김 여부. `true`면 `onClose`가 있어도 X 버튼을 렌더하지 않는다.
|
|
28
|
+
* autoClose 만료 시 `onClose` 호출은 그대로 유지된다.
|
|
29
|
+
* 기본 자동 닫힘은 없다 — 부모가 언마운트로 닫거나 `autoClose`를 명시한다.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
hideCloseButton?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 자동 닫기 시간 (밀리초 단위, 0이면 자동으로 닫히지 않음)
|
|
35
|
+
* @default 0
|
|
36
|
+
*/
|
|
37
|
+
autoClose?: number;
|
|
26
38
|
/**
|
|
27
39
|
* 추가 CSS 클래스
|
|
28
40
|
*/
|
|
@@ -42,7 +54,7 @@ interface MessageNotificationProps extends Omit<ComponentPropsWithoutRef<'div'>,
|
|
|
42
54
|
*/
|
|
43
55
|
hidePermanentlyLabel?: ReactNode;
|
|
44
56
|
/**
|
|
45
|
-
* 표시 변형. `'block'`은 서브 페이지 공지용(흰 배경, FeaturedIcon sm, 제목 + 텍스트 링크 1
|
|
57
|
+
* 표시 변형. `'block'`은 서브 페이지 공지용(흰 배경, FeaturedIcon sm, 제목 + 텍스트 링크 1행)
|
|
46
58
|
* @default 'default'
|
|
47
59
|
*/
|
|
48
60
|
variant?: NotificationVariant;
|
|
@@ -19,6 +19,7 @@ declare const MessageNotificationContent: ({ title, supportingText, supportTextL
|
|
|
19
19
|
interface MessageNotificationActionsProps {
|
|
20
20
|
actions?: NotificationAction[];
|
|
21
21
|
onClose?: () => void;
|
|
22
|
+
hideCloseButton?: boolean;
|
|
22
23
|
onHidePermanently?: () => void;
|
|
23
24
|
hidePermanentlyLabel?: ReactNode;
|
|
24
25
|
closeIconColor: string;
|
|
@@ -28,6 +29,6 @@ interface MessageNotificationActionsProps {
|
|
|
28
29
|
* 이 컨테이너의 gap(12px)이 두 그룹 사이 간격을 만든다.
|
|
29
30
|
* 표시할 요소가 하나도 없으면 빈 컨테이너를 남기지 않는다.
|
|
30
31
|
*/
|
|
31
|
-
declare const MessageNotificationActions: ({ actions, onClose, onHidePermanently, hidePermanentlyLabel, closeIconColor, }: MessageNotificationActionsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
32
|
+
declare const MessageNotificationActions: ({ actions, onClose, hideCloseButton, onHidePermanently, hidePermanentlyLabel, closeIconColor, }: MessageNotificationActionsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
32
33
|
export type { MessageNotificationActionsProps, MessageNotificationContentProps };
|
|
33
34
|
export { MessageNotificationActions, MessageNotificationContent };
|
|
@@ -51,6 +51,18 @@ interface NotificationProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title
|
|
|
51
51
|
* 닫기 버튼 클릭 이벤트 핸들러
|
|
52
52
|
*/
|
|
53
53
|
onClose?: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* 닫기(X) 버튼 숨김 여부. floating · full-width · message 타입에서 동작한다.
|
|
56
|
+
* `true`면 `onClose`가 있어도 X 버튼을 렌더하지 않는다.
|
|
57
|
+
* autoClose 만료(및 floating의 모바일 전환) 시 `onClose` 호출은 그대로 유지되므로,
|
|
58
|
+
* "닫기 버튼 없는 자동 닫힘 토스트"(DES-SPEC-027 §5.3)에서 부모가 닫힘 시점을 받을 수 있다.
|
|
59
|
+
*
|
|
60
|
+
* floating(토스트)은 닫을 수단이 사라지지 않도록 `autoClose` 미지정 시 3초 뒤 자동으로 닫힌다
|
|
61
|
+
* (부모가 직접 언마운트해 닫으려면 `autoClose={0}` 명시). full-width · message 는 부모가 언마운트로 닫으므로
|
|
62
|
+
* `autoClose`를 명시했을 때만 자동으로 닫힌다.
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
hideCloseButton?: boolean;
|
|
54
66
|
/**
|
|
55
67
|
* 추가 CSS 클래스
|
|
56
68
|
*/
|
|
@@ -62,7 +74,8 @@ interface NotificationProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title
|
|
|
62
74
|
actions?: NotificationAction[];
|
|
63
75
|
/**
|
|
64
76
|
* 자동 닫기 시간 (밀리초 단위, 0이면 자동으로 닫히지 않음)
|
|
65
|
-
* floating
|
|
77
|
+
* floating, full-width, message 타입에서 동작
|
|
78
|
+
* 미지정 시 0. 단 floating 에서 `hideCloseButton`이면 3초(DES-SPEC-027 §5.3).
|
|
66
79
|
* @default 0
|
|
67
80
|
*/
|
|
68
81
|
autoClose?: number;
|
|
@@ -94,10 +107,10 @@ interface NotificationProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title
|
|
|
94
107
|
/**
|
|
95
108
|
* message 타입의 표시 변형 (선택사항). message 타입에서만 동작한다.
|
|
96
109
|
*
|
|
97
|
-
* - `'default'`: 기존 message (color 별 배경·테두리, 제목 + 본문 2
|
|
110
|
+
* - `'default'`: 기존 message (color 별 배경·테두리, 제목 + 본문 2행)
|
|
98
111
|
* - `'block'`: 서브 페이지 공지용. 흰 배경·gray-100 테두리·shadow-sm, FeaturedIcon sm,
|
|
99
112
|
* 제목 + 텍스트 링크 1행(`supportingText` 가 링크 텍스트, `supportTextLink` 가 href).
|
|
100
|
-
*
|
|
113
|
+
* info 아이콘은 InfoCircle.
|
|
101
114
|
*
|
|
102
115
|
* @default 'default'
|
|
103
116
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface UseAutoCloseParams {
|
|
2
|
+
autoClose?: number;
|
|
3
|
+
/** floating 만 넘긴다 — 닫기 버튼 없는 토스트의 기본 3초 자동 닫힘. */
|
|
4
|
+
hideCloseButton?: boolean;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* autoClose 타이머. 만료 시 `onClose`를 호출하고 `true`(제거됨)를 반환한다.
|
|
9
|
+
* floating · full-width · message 가 공유한다.
|
|
10
|
+
*
|
|
11
|
+
* `onClose`는 매 렌더 새 함수일 수 있어 ref 로 latest 만 보관하고 deps 에서 뺀다 —
|
|
12
|
+
* 인라인 핸들러를 넘겨도 부모 리렌더마다 타이머가 리셋되지 않는다.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useAutoClose: ({ autoClose, hideCloseButton, onClose }: UseAutoCloseParams) => boolean;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveAutoClose } from './resolveAutoClose';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ResolveAutoCloseParams {
|
|
2
|
+
/** 사용처가 명시한 autoClose(ms). `0`이면 자동 닫힘 없음 — 부모가 직접 닫는 용도. */
|
|
3
|
+
autoClose?: number;
|
|
4
|
+
/** floating(토스트)만 넘긴다 — 닫기 버튼이 없는 토스트가 영구히 남지 않게 기본 3초를 준다. */
|
|
5
|
+
hideCloseButton?: boolean;
|
|
6
|
+
/** 색상별 기본값 등 2순위 기본값. */
|
|
7
|
+
fallback?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 실제 적용할 autoClose(ms)를 정한다. React·Vanilla 두 구현이 공유한다.
|
|
11
|
+
* 우선순위: 명시 `autoClose` > `fallback`(양수) > `hideCloseButton`이면 3초 > 0.
|
|
12
|
+
*/
|
|
13
|
+
export declare const resolveAutoClose: ({ autoClose, hideCloseButton, fallback, }: ResolveAutoCloseParams) => number;
|
|
14
|
+
export {};
|
|
@@ -3060,6 +3060,22 @@ button {
|
|
|
3060
3060
|
.ncua-message-notification--success .ncua-notification__action-button {
|
|
3061
3061
|
color: var(--green-500);
|
|
3062
3062
|
}
|
|
3063
|
+
.ncua-message-notification--info {
|
|
3064
|
+
color: var(--violet-600);
|
|
3065
|
+
background-color: var(--violet-50);
|
|
3066
|
+
border-radius: 12px;
|
|
3067
|
+
border: 1px solid var(--violet-300);
|
|
3068
|
+
box-shadow: var(--shadow-md);
|
|
3069
|
+
}
|
|
3070
|
+
.ncua-message-notification--info .ncua-message-notification__title {
|
|
3071
|
+
color: var(--violet-600);
|
|
3072
|
+
}
|
|
3073
|
+
.ncua-message-notification--info .ncua-message-notification__supporting-text {
|
|
3074
|
+
color: var(--gray-500);
|
|
3075
|
+
}
|
|
3076
|
+
.ncua-message-notification--info .ncua-notification__action-button {
|
|
3077
|
+
color: var(--violet-500);
|
|
3078
|
+
}
|
|
3063
3079
|
.ncua-message-notification .ncua-notification__action-button {
|
|
3064
3080
|
background: transparent;
|
|
3065
3081
|
border: none;
|
|
@@ -3072,12 +3088,8 @@ button {
|
|
|
3072
3088
|
.ncua-message-notification.ncua-message-notification--block {
|
|
3073
3089
|
background-color: var(--base-white);
|
|
3074
3090
|
border: 1px solid var(--gray-100);
|
|
3075
|
-
border-radius: 12px;
|
|
3076
3091
|
box-shadow: var(--shadow-sm);
|
|
3077
3092
|
}
|
|
3078
|
-
.ncua-message-notification.ncua-message-notification--block .ncua-message-notification__supporting-text {
|
|
3079
|
-
color: var(--gray-500);
|
|
3080
|
-
}
|
|
3081
3093
|
.ncua-message-notification.ncua-message-notification--block .ncua-message-notification__text-container {
|
|
3082
3094
|
flex-direction: row;
|
|
3083
3095
|
flex-wrap: wrap;
|
|
@@ -3087,13 +3099,7 @@ button {
|
|
|
3087
3099
|
.ncua-message-notification.ncua-message-notification--block .ncua-message-notification__link .ncua-message-notification__supporting-text {
|
|
3088
3100
|
color: inherit;
|
|
3089
3101
|
}
|
|
3090
|
-
.ncua-message-notification.ncua-message-notification--
|
|
3091
|
-
color: var(--violet-600);
|
|
3092
|
-
}
|
|
3093
|
-
.ncua-message-notification.ncua-message-notification--block.ncua-message-notification--info .ncua-message-notification__title {
|
|
3094
|
-
color: var(--violet-600);
|
|
3095
|
-
}
|
|
3096
|
-
.ncua-message-notification.ncua-message-notification--block.ncua-message-notification--info .ncua-message-notification__icon {
|
|
3102
|
+
.ncua-message-notification.ncua-message-notification--info .ncua-message-notification__icon {
|
|
3097
3103
|
color: var(--violet-600);
|
|
3098
3104
|
background-color: var(--violet-100);
|
|
3099
3105
|
}
|