@ncds/ui-admin 1.8.26-alpha.6 → 1.8.26-alpha.8
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/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/cjs/vitest.config.js +12 -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/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/esm/vitest.config.js +12 -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/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/temp/vitest.config.js +11 -0
- 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 +2 -2
|
@@ -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, {
|