@ncds/ui-admin 1.8.26-alpha.7 → 1.8.26-alpha.9
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 +4 -1
- package/dist/cjs/assets/scripts/notification/FullWidthNotification.js +5 -1
- package/dist/cjs/assets/scripts/notification/MessageNotification.js +7 -16
- package/dist/cjs/assets/scripts/notification/const/classNames.js +0 -2
- package/dist/cjs/assets/scripts/notification/const/icons.js +1 -11
- package/dist/cjs/assets/scripts/notification/const/index.js +0 -12
- package/dist/cjs/assets/scripts/notification/const/sizes.js +1 -6
- package/dist/cjs/assets/scripts/notification/messageTemplate.js +4 -2
- package/dist/cjs/assets/scripts/notification/utils.js +13 -5
- package/dist/cjs/src/components/navigation/pagination/Pagination.js +14 -14
- package/dist/cjs/src/components/navigation/pagination/__tests__/Pagination.test.js +17 -0
- package/dist/cjs/src/components/overlays/notification/MessageNotification.js +4 -19
- package/dist/cjs/src/components/overlays/notification/MessageNotificationParts.js +7 -18
- package/dist/cjs/src/components/overlays/notification/Notification.js +6 -5
- package/dist/cjs/src/components/overlays/notification/__tests__/MessageNotification.test.js +7 -7
- package/dist/cjs/src/components/overlays/notification/__tests__/Notification.test.js +8 -0
- package/dist/cjs/src/components/overlays/notification/__tests__/supportTextLink.test.js +1 -7
- package/dist/cjs/src/generated/scoped-css.js +1 -1
- package/dist/cjs/src/utils/url/isSafeUrl.js +1 -1
- package/dist/esm/assets/scripts/notification/FloatingNotification.js +4 -1
- package/dist/esm/assets/scripts/notification/FullWidthNotification.js +5 -1
- package/dist/esm/assets/scripts/notification/MessageNotification.js +9 -18
- package/dist/esm/assets/scripts/notification/const/classNames.js +0 -2
- package/dist/esm/assets/scripts/notification/const/icons.js +0 -10
- package/dist/esm/assets/scripts/notification/const/index.js +2 -2
- package/dist/esm/assets/scripts/notification/const/sizes.js +0 -5
- package/dist/esm/assets/scripts/notification/messageTemplate.js +4 -2
- package/dist/esm/assets/scripts/notification/utils.js +11 -4
- package/dist/esm/src/components/navigation/pagination/Pagination.js +14 -14
- package/dist/esm/src/components/navigation/pagination/__tests__/Pagination.test.js +17 -0
- package/dist/esm/src/components/overlays/notification/MessageNotification.js +5 -20
- package/dist/esm/src/components/overlays/notification/MessageNotificationParts.js +7 -18
- package/dist/esm/src/components/overlays/notification/Notification.js +6 -5
- package/dist/esm/src/components/overlays/notification/__tests__/MessageNotification.test.js +8 -8
- package/dist/esm/src/components/overlays/notification/__tests__/Notification.test.js +8 -0
- package/dist/esm/src/components/overlays/notification/__tests__/supportTextLink.test.js +1 -7
- package/dist/esm/src/generated/scoped-css.js +1 -1
- package/dist/esm/src/utils/url/isSafeUrl.js +1 -1
- package/dist/temp/assets/scripts/notification/FloatingNotification.js +1 -1
- package/dist/temp/assets/scripts/notification/FullWidthNotification.js +1 -1
- package/dist/temp/assets/scripts/notification/MessageNotification.d.ts +1 -1
- package/dist/temp/assets/scripts/notification/MessageNotification.js +9 -15
- package/dist/temp/assets/scripts/notification/const/classNames.d.ts +0 -2
- package/dist/temp/assets/scripts/notification/const/classNames.js +0 -2
- package/dist/temp/assets/scripts/notification/const/icons.d.ts +0 -2
- package/dist/temp/assets/scripts/notification/const/icons.js +0 -10
- package/dist/temp/assets/scripts/notification/const/index.d.ts +3 -3
- package/dist/temp/assets/scripts/notification/const/index.js +2 -2
- package/dist/temp/assets/scripts/notification/const/sizes.d.ts +0 -4
- package/dist/temp/assets/scripts/notification/const/sizes.js +0 -5
- package/dist/temp/assets/scripts/notification/const/types.d.ts +7 -22
- package/dist/temp/assets/scripts/notification/messageTemplate.d.ts +0 -2
- package/dist/temp/assets/scripts/notification/messageTemplate.js +2 -2
- package/dist/temp/assets/scripts/notification/utils.d.ts +10 -1
- package/dist/temp/assets/scripts/notification/utils.js +6 -3
- package/dist/temp/src/components/navigation/pagination/Pagination.js +14 -14
- package/dist/temp/src/components/navigation/pagination/__tests__/Pagination.test.js +7 -0
- package/dist/temp/src/components/overlays/notification/FloatingNotification.d.ts +3 -4
- package/dist/temp/src/components/overlays/notification/FullWidthNotification.d.ts +2 -4
- package/dist/temp/src/components/overlays/notification/MessageNotification.d.ts +2 -18
- package/dist/temp/src/components/overlays/notification/MessageNotification.js +4 -8
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.d.ts +4 -10
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.js +4 -7
- package/dist/temp/src/components/overlays/notification/Notification.d.ts +8 -28
- package/dist/temp/src/components/overlays/notification/Notification.js +4 -2
- package/dist/temp/src/components/overlays/notification/__tests__/MessageNotification.test.js +12 -9
- package/dist/temp/src/components/overlays/notification/__tests__/Notification.test.js +5 -0
- package/dist/temp/src/components/overlays/notification/__tests__/supportTextLink.test.js +0 -11
- package/dist/temp/src/generated/scoped-css.js +1 -1
- package/dist/temp/src/utils/url/isSafeUrl.d.ts +1 -1
- package/dist/temp/src/utils/url/isSafeUrl.js +1 -1
- package/dist/types/assets/scripts/notification/MessageNotification.d.ts +1 -1
- package/dist/types/assets/scripts/notification/const/classNames.d.ts +0 -2
- package/dist/types/assets/scripts/notification/const/icons.d.ts +0 -2
- package/dist/types/assets/scripts/notification/const/index.d.ts +3 -3
- package/dist/types/assets/scripts/notification/const/sizes.d.ts +0 -4
- package/dist/types/assets/scripts/notification/const/types.d.ts +7 -22
- package/dist/types/assets/scripts/notification/messageTemplate.d.ts +0 -2
- package/dist/types/assets/scripts/notification/utils.d.ts +10 -1
- package/dist/types/src/components/overlays/notification/FloatingNotification.d.ts +3 -4
- package/dist/types/src/components/overlays/notification/FullWidthNotification.d.ts +2 -4
- package/dist/types/src/components/overlays/notification/MessageNotification.d.ts +2 -18
- package/dist/types/src/components/overlays/notification/MessageNotificationParts.d.ts +4 -10
- package/dist/types/src/components/overlays/notification/Notification.d.ts +8 -28
- package/dist/types/src/utils/url/isSafeUrl.d.ts +1 -1
- package/dist/ui-admin/assets/styles/style.css +0 -19
- package/package.json +1 -1
|
@@ -6,7 +6,6 @@ import { type CalloutNotificationProps, type CalloutNotificationWidth } from './
|
|
|
6
6
|
type NotificationType = 'floating' | 'full-width' | 'message' | 'callout';
|
|
7
7
|
type NotificationColor = Extract<ColorTone, 'neutral' | 'error' | 'warning' | 'success' | 'info'>;
|
|
8
8
|
type NotificationSize = 'desktop' | 'mobile';
|
|
9
|
-
type NotificationVariant = 'default' | 'block';
|
|
10
9
|
/** 텍스트 링크(`supportTextLink`)를 여는 대상. `'_blank'`이면 새 탭 + `rel="noopener noreferrer"`. */
|
|
11
10
|
type NotificationLinkTarget = '_self' | '_blank';
|
|
12
11
|
interface NotificationAction {
|
|
@@ -39,7 +38,7 @@ interface NotificationProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title
|
|
|
39
38
|
*/
|
|
40
39
|
supportingText?: ReactNode;
|
|
41
40
|
/**
|
|
42
|
-
* 알림 아이콘 컴포넌트 (지정하지 않으면
|
|
41
|
+
* 알림 아이콘 컴포넌트 (지정하지 않으면 color에 따라 기본 아이콘 사용)
|
|
43
42
|
*/
|
|
44
43
|
icon?: SlotIconComponent;
|
|
45
44
|
/**
|
|
@@ -52,14 +51,8 @@ interface NotificationProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title
|
|
|
52
51
|
*/
|
|
53
52
|
onClose?: () => void;
|
|
54
53
|
/**
|
|
55
|
-
* 닫기
|
|
56
|
-
* `true
|
|
57
|
-
* autoClose 만료(및 floating의 모바일 전환) 시 `onClose` 호출은 그대로 유지되므로,
|
|
58
|
-
* "닫기 버튼 없는 자동 닫힘 토스트"(DES-SPEC-027 §5.3)에서 부모가 닫힘 시점을 받을 수 있다.
|
|
59
|
-
*
|
|
60
|
-
* floating(토스트)은 닫을 수단이 사라지지 않도록 `autoClose` 미지정 시 3초 뒤 자동으로 닫힌다
|
|
61
|
-
* (부모가 직접 언마운트해 닫으려면 `autoClose={0}` 명시). full-width · message 는 부모가 언마운트로 닫으므로
|
|
62
|
-
* `autoClose`를 명시했을 때만 자동으로 닫힌다.
|
|
54
|
+
* 닫기 버튼 숨김 여부
|
|
55
|
+
* `true`이면 floating 타입은 autoClose 미지정 시 3초 후 자동으로 닫힘 (onClose 호출, 끄려면 `autoClose={0}`)
|
|
63
56
|
* @default false
|
|
64
57
|
*/
|
|
65
58
|
hideCloseButton?: boolean;
|
|
@@ -74,8 +67,7 @@ interface NotificationProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title
|
|
|
74
67
|
actions?: NotificationAction[];
|
|
75
68
|
/**
|
|
76
69
|
* 자동 닫기 시간 (밀리초 단위, 0이면 자동으로 닫히지 않음)
|
|
77
|
-
* floating, full-width, message 타입에서 동작
|
|
78
|
-
* 미지정 시 0. 단 floating 에서 `hideCloseButton`이면 3초(DES-SPEC-027 §5.3).
|
|
70
|
+
* floating, full-width, message 타입에서 동작 (floating + hideCloseButton은 미지정 시 3초)
|
|
79
71
|
* @default 0
|
|
80
72
|
*/
|
|
81
73
|
autoClose?: number;
|
|
@@ -94,27 +86,15 @@ interface NotificationProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title
|
|
|
94
86
|
hidePermanentlyLabel?: ReactNode;
|
|
95
87
|
/**
|
|
96
88
|
* supportingText 에 연결할 링크 URL (선택사항)
|
|
97
|
-
* full-width
|
|
89
|
+
* full-width 타입에서만 사용 가능. http/https(상대경로 포함) URL만 링크로 렌더하고 그 외는 텍스트로 렌더한다.
|
|
98
90
|
*/
|
|
99
91
|
supportTextLink?: string;
|
|
100
92
|
/**
|
|
101
|
-
* 텍스트 링크를 여는 대상 (선택사항). `
|
|
102
|
-
*
|
|
103
|
-
* full-width 타입, message 타입의 `variant="block"`에서 사용 가능
|
|
93
|
+
* 텍스트 링크를 여는 대상 (선택사항). `'_blank'`이면 새 탭 + `rel="noopener noreferrer"`
|
|
94
|
+
* full-width 타입에서만 사용 가능
|
|
104
95
|
* @default '_self'
|
|
105
96
|
*/
|
|
106
97
|
supportTextLinkTarget?: NotificationLinkTarget;
|
|
107
|
-
/**
|
|
108
|
-
* message 타입의 표시 변형 (선택사항). message 타입에서만 동작한다.
|
|
109
|
-
*
|
|
110
|
-
* - `'default'`: 기존 message (color 별 배경·테두리, 제목 + 본문 2행)
|
|
111
|
-
* - `'block'`: 서브 페이지 공지용. 흰 배경·gray-100 테두리·shadow-sm, FeaturedIcon sm,
|
|
112
|
-
* 제목 + 텍스트 링크 1행(`supportingText` 가 링크 텍스트, `supportTextLink` 가 href).
|
|
113
|
-
* info 아이콘은 InfoCircle.
|
|
114
|
-
*
|
|
115
|
-
* @default 'default'
|
|
116
|
-
*/
|
|
117
|
-
variant?: NotificationVariant;
|
|
118
98
|
/**
|
|
119
99
|
* 너비 동작 (선택사항)
|
|
120
100
|
* callout 타입에서만 사용 가능. 미지정 시 부모 너비를 채운다(100%). 'fit' 은 콘텐츠 너비에 맞춘다
|
|
@@ -135,6 +115,6 @@ interface NotificationProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title
|
|
|
135
115
|
portal?: boolean;
|
|
136
116
|
}
|
|
137
117
|
declare const Notification: import("react").ForwardRefExoticComponent<NotificationProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
138
|
-
export type { NotificationType, NotificationColor, NotificationSize,
|
|
118
|
+
export type { NotificationType, NotificationColor, NotificationSize, NotificationLinkTarget, NotificationAction, NotificationProps, };
|
|
139
119
|
export type { CalloutNotificationProps, CalloutNotificationWidth };
|
|
140
120
|
export { Notification };
|
|
@@ -7,7 +7,9 @@ import { MessageNotification } from './MessageNotification';
|
|
|
7
7
|
const Notification = forwardRef(
|
|
8
8
|
// 단일 type 에만 유효한 prop 은 rest 에서 분리해 해당 분기로만 명시 전달한다.
|
|
9
9
|
// rest 에 남기면 다른 type 의 하위 컴포넌트가 div 로 스프레드해 DOM 속성으로 출력된다.
|
|
10
|
-
({ type = 'floating', color = 'neutral', width, supportTextLink, supportTextLinkTarget,
|
|
10
|
+
({ type = 'floating', color = 'neutral', width, supportTextLink, supportTextLinkTarget, ...props }, ref) => {
|
|
11
|
+
// #580 에서 제거된 message `variant` 가 런타임에 넘어와도 DOM 속성으로 새지 않게 어떤 type 에도 전달하지 않는다.
|
|
12
|
+
const { variant: _variant, ...rest } = props;
|
|
11
13
|
if (type === 'floating') {
|
|
12
14
|
return _jsx(FloatingNotification, { color: color, ...rest, ref: ref });
|
|
13
15
|
}
|
|
@@ -15,7 +17,7 @@ const Notification = forwardRef(
|
|
|
15
17
|
return (_jsx(FullWidthNotification, { color: color, supportTextLink: supportTextLink, supportTextLinkTarget: supportTextLinkTarget, ...rest, ref: ref }));
|
|
16
18
|
}
|
|
17
19
|
if (type === 'message') {
|
|
18
|
-
return
|
|
20
|
+
return _jsx(MessageNotification, { color: color, ...rest, ref: ref });
|
|
19
21
|
}
|
|
20
22
|
if (type === 'callout') {
|
|
21
23
|
// 나머지 3개 type 이 공유하는 prop 은 callout 이 지원하지 않으므로 여기서 제외한다.
|
package/dist/temp/src/components/overlays/notification/__tests__/MessageNotification.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @vitest-environment jsdom
|
|
2
|
-
import {
|
|
2
|
+
import { Pin02 } from '@ncds/ui-admin-icon';
|
|
3
3
|
import { createElement } from 'react';
|
|
4
4
|
import { createRoot } from 'react-dom/client';
|
|
5
5
|
import { act } from 'react-dom/test-utils';
|
|
@@ -127,14 +127,14 @@ describe('MessageNotification (React) — DOM 구조 계약', () => {
|
|
|
127
127
|
});
|
|
128
128
|
describe('MessageNotification (React) — color="info" (#568)', () => {
|
|
129
129
|
it('R-01: color="info" 는 neutral 로 폴백하지 않고 --info 수식자로 렌더한다', () => {
|
|
130
|
-
// Given/When:
|
|
130
|
+
// Given/When: info 색상으로 렌더하면
|
|
131
131
|
const root = renderMessageNotification({ color: 'info' }).querySelector(SELECTOR.ROOT);
|
|
132
132
|
// Then: info 수식자가 있고 neutral 수식자는 없다
|
|
133
133
|
expect(root?.classList.contains('ncua-message-notification--info')).toBe(true);
|
|
134
134
|
expect(root?.classList.contains('ncua-message-notification--neutral')).toBe(false);
|
|
135
135
|
});
|
|
136
136
|
it('R-02: 기본 info 아이콘은 neutral 과 같은 Pin02 다', () => {
|
|
137
|
-
// Given/When:
|
|
137
|
+
// Given/When: info 색상으로 렌더하면
|
|
138
138
|
const container = renderMessageNotification({ color: 'info' });
|
|
139
139
|
// Then: 아이콘 path 가 Pin02 와 같다
|
|
140
140
|
const expected = iconPathD(Pin02);
|
|
@@ -142,17 +142,20 @@ describe('MessageNotification (React) — color="info" (#568)', () => {
|
|
|
142
142
|
expect(renderedIconPathD(container)).toBe(expected);
|
|
143
143
|
});
|
|
144
144
|
it('R-03: info 의 FeaturedIcon 은 neutral·md 로 렌더한다 (violet 톤은 SCSS 가 덮는다)', () => {
|
|
145
|
-
// Given/When:
|
|
145
|
+
// Given/When: info 색상으로 렌더하면
|
|
146
146
|
const icon = renderMessageNotification({ color: 'info' }).querySelector(SELECTOR.ICON);
|
|
147
147
|
// Then: FeaturedIcon 에는 info 색이 없으므로 neutral 수식자와 md 사이즈가 유지된다
|
|
148
148
|
expect(icon?.classList.contains('ncua-featured-icon--neutral')).toBe(true);
|
|
149
149
|
expect(icon?.classList.contains('ncua-featured-icon--md')).toBe(true);
|
|
150
150
|
});
|
|
151
|
-
it('R-04: block
|
|
152
|
-
// Given/When:
|
|
153
|
-
const container = renderMessageNotification({
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
it('R-04: 런타임에 variant="block" 이 넘어와도 info 아이콘은 Pin02 다 (#580 Block 변형 제거)', () => {
|
|
152
|
+
// Given/When: 제거된 variant prop 을 런타임 입력으로 넘겨 info 색상으로 렌더하면
|
|
153
|
+
const container = renderMessageNotification({
|
|
154
|
+
variant: 'block',
|
|
155
|
+
color: 'info',
|
|
156
|
+
});
|
|
157
|
+
// Then: 아이콘 path 가 Pin02 와 같다
|
|
158
|
+
const expected = iconPathD(Pin02);
|
|
156
159
|
expect(expected).not.toBeNull();
|
|
157
160
|
expect(renderedIconPathD(container)).toBe(expected);
|
|
158
161
|
});
|
|
@@ -65,6 +65,11 @@ describe('Notification — type 별 위임', () => {
|
|
|
65
65
|
const element = render({ type, supportingText: '보조', supportTextLink: 'https://example.com' });
|
|
66
66
|
expect(element?.hasAttribute('supporttextlink')).toBe(false);
|
|
67
67
|
});
|
|
68
|
+
it.each(['floating', 'full-width', 'message'])('type=%s 에 제거된 variant="block" 을 주어도 DOM 속성으로 새지 않는다 (#580)', (type) => {
|
|
69
|
+
const element = render({ type, variant: 'block' });
|
|
70
|
+
expect(element).not.toBeNull();
|
|
71
|
+
expect(element?.hasAttribute('variant')).toBe(false);
|
|
72
|
+
});
|
|
68
73
|
it('정의되지 않은 type 은 아무것도 렌더하지 않는다', () => {
|
|
69
74
|
const element = render({ type: 'banner' });
|
|
70
75
|
expect(element).toBeNull();
|
|
@@ -4,7 +4,6 @@ import { createRoot } from 'react-dom/client';
|
|
|
4
4
|
import { act } from 'react-dom/test-utils';
|
|
5
5
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
6
6
|
import { FullWidthNotification } from '../FullWidthNotification';
|
|
7
|
-
import { MessageNotification } from '../MessageNotification';
|
|
8
7
|
/**
|
|
9
8
|
* React 텍스트 링크(`supportTextLink`)의 프로토콜 검사 (#538 리뷰 H2).
|
|
10
9
|
* Vanilla `renderSupportingText` 와 같은 정책 — unsafe URL 이면 링크 없이 텍스트만 렌더한다.
|
|
@@ -29,16 +28,6 @@ function mount(element) {
|
|
|
29
28
|
return container;
|
|
30
29
|
}
|
|
31
30
|
const IMPLEMENTATIONS = [
|
|
32
|
-
[
|
|
33
|
-
'MessageNotification(block)',
|
|
34
|
-
(supportTextLink) => mount(createElement(MessageNotification, {
|
|
35
|
-
title: '공지',
|
|
36
|
-
variant: 'block',
|
|
37
|
-
supportingText: '자세히 보기',
|
|
38
|
-
supportTextLink,
|
|
39
|
-
})),
|
|
40
|
-
'.ncua-message-notification__supporting-text',
|
|
41
|
-
],
|
|
42
31
|
[
|
|
43
32
|
'FullWidthNotification',
|
|
44
33
|
(supportTextLink) => mount(createElement(FullWidthNotification, {
|