@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.
Files changed (84) hide show
  1. package/dist/cjs/assets/scripts/notification/FloatingNotification.js +4 -1
  2. package/dist/cjs/assets/scripts/notification/FullWidthNotification.js +5 -1
  3. package/dist/cjs/assets/scripts/notification/MessageNotification.js +7 -16
  4. package/dist/cjs/assets/scripts/notification/const/classNames.js +0 -2
  5. package/dist/cjs/assets/scripts/notification/const/icons.js +1 -11
  6. package/dist/cjs/assets/scripts/notification/const/index.js +0 -12
  7. package/dist/cjs/assets/scripts/notification/const/sizes.js +1 -6
  8. package/dist/cjs/assets/scripts/notification/messageTemplate.js +4 -2
  9. package/dist/cjs/assets/scripts/notification/utils.js +13 -5
  10. package/dist/cjs/src/components/overlays/notification/MessageNotification.js +4 -19
  11. package/dist/cjs/src/components/overlays/notification/MessageNotificationParts.js +7 -18
  12. package/dist/cjs/src/components/overlays/notification/Notification.js +6 -5
  13. package/dist/cjs/src/components/overlays/notification/__tests__/MessageNotification.test.js +7 -7
  14. package/dist/cjs/src/components/overlays/notification/__tests__/Notification.test.js +8 -0
  15. package/dist/cjs/src/components/overlays/notification/__tests__/supportTextLink.test.js +1 -7
  16. package/dist/cjs/src/generated/scoped-css.js +1 -1
  17. package/dist/cjs/src/utils/url/isSafeUrl.js +1 -1
  18. package/dist/cjs/vitest.config.js +12 -1
  19. package/dist/esm/assets/scripts/notification/FloatingNotification.js +4 -1
  20. package/dist/esm/assets/scripts/notification/FullWidthNotification.js +5 -1
  21. package/dist/esm/assets/scripts/notification/MessageNotification.js +9 -18
  22. package/dist/esm/assets/scripts/notification/const/classNames.js +0 -2
  23. package/dist/esm/assets/scripts/notification/const/icons.js +0 -10
  24. package/dist/esm/assets/scripts/notification/const/index.js +2 -2
  25. package/dist/esm/assets/scripts/notification/const/sizes.js +0 -5
  26. package/dist/esm/assets/scripts/notification/messageTemplate.js +4 -2
  27. package/dist/esm/assets/scripts/notification/utils.js +11 -4
  28. package/dist/esm/src/components/overlays/notification/MessageNotification.js +5 -20
  29. package/dist/esm/src/components/overlays/notification/MessageNotificationParts.js +7 -18
  30. package/dist/esm/src/components/overlays/notification/Notification.js +6 -5
  31. package/dist/esm/src/components/overlays/notification/__tests__/MessageNotification.test.js +8 -8
  32. package/dist/esm/src/components/overlays/notification/__tests__/Notification.test.js +8 -0
  33. package/dist/esm/src/components/overlays/notification/__tests__/supportTextLink.test.js +1 -7
  34. package/dist/esm/src/generated/scoped-css.js +1 -1
  35. package/dist/esm/src/utils/url/isSafeUrl.js +1 -1
  36. package/dist/esm/vitest.config.js +12 -1
  37. package/dist/temp/assets/scripts/notification/FloatingNotification.js +1 -1
  38. package/dist/temp/assets/scripts/notification/FullWidthNotification.js +1 -1
  39. package/dist/temp/assets/scripts/notification/MessageNotification.d.ts +1 -1
  40. package/dist/temp/assets/scripts/notification/MessageNotification.js +9 -15
  41. package/dist/temp/assets/scripts/notification/const/classNames.d.ts +0 -2
  42. package/dist/temp/assets/scripts/notification/const/classNames.js +0 -2
  43. package/dist/temp/assets/scripts/notification/const/icons.d.ts +0 -2
  44. package/dist/temp/assets/scripts/notification/const/icons.js +0 -10
  45. package/dist/temp/assets/scripts/notification/const/index.d.ts +3 -3
  46. package/dist/temp/assets/scripts/notification/const/index.js +2 -2
  47. package/dist/temp/assets/scripts/notification/const/sizes.d.ts +0 -4
  48. package/dist/temp/assets/scripts/notification/const/sizes.js +0 -5
  49. package/dist/temp/assets/scripts/notification/const/types.d.ts +7 -22
  50. package/dist/temp/assets/scripts/notification/messageTemplate.d.ts +0 -2
  51. package/dist/temp/assets/scripts/notification/messageTemplate.js +2 -2
  52. package/dist/temp/assets/scripts/notification/utils.d.ts +10 -1
  53. package/dist/temp/assets/scripts/notification/utils.js +6 -3
  54. package/dist/temp/src/components/overlays/notification/FloatingNotification.d.ts +3 -4
  55. package/dist/temp/src/components/overlays/notification/FullWidthNotification.d.ts +2 -4
  56. package/dist/temp/src/components/overlays/notification/MessageNotification.d.ts +2 -18
  57. package/dist/temp/src/components/overlays/notification/MessageNotification.js +4 -8
  58. package/dist/temp/src/components/overlays/notification/MessageNotificationParts.d.ts +4 -10
  59. package/dist/temp/src/components/overlays/notification/MessageNotificationParts.js +4 -7
  60. package/dist/temp/src/components/overlays/notification/Notification.d.ts +8 -28
  61. package/dist/temp/src/components/overlays/notification/Notification.js +4 -2
  62. package/dist/temp/src/components/overlays/notification/__tests__/MessageNotification.test.js +12 -9
  63. package/dist/temp/src/components/overlays/notification/__tests__/Notification.test.js +5 -0
  64. package/dist/temp/src/components/overlays/notification/__tests__/supportTextLink.test.js +0 -11
  65. package/dist/temp/src/generated/scoped-css.js +1 -1
  66. package/dist/temp/src/utils/url/isSafeUrl.d.ts +1 -1
  67. package/dist/temp/src/utils/url/isSafeUrl.js +1 -1
  68. package/dist/temp/vitest.config.js +11 -0
  69. package/dist/types/assets/scripts/notification/MessageNotification.d.ts +1 -1
  70. package/dist/types/assets/scripts/notification/const/classNames.d.ts +0 -2
  71. package/dist/types/assets/scripts/notification/const/icons.d.ts +0 -2
  72. package/dist/types/assets/scripts/notification/const/index.d.ts +3 -3
  73. package/dist/types/assets/scripts/notification/const/sizes.d.ts +0 -4
  74. package/dist/types/assets/scripts/notification/const/types.d.ts +7 -22
  75. package/dist/types/assets/scripts/notification/messageTemplate.d.ts +0 -2
  76. package/dist/types/assets/scripts/notification/utils.d.ts +10 -1
  77. package/dist/types/src/components/overlays/notification/FloatingNotification.d.ts +3 -4
  78. package/dist/types/src/components/overlays/notification/FullWidthNotification.d.ts +2 -4
  79. package/dist/types/src/components/overlays/notification/MessageNotification.d.ts +2 -18
  80. package/dist/types/src/components/overlays/notification/MessageNotificationParts.d.ts +4 -10
  81. package/dist/types/src/components/overlays/notification/Notification.d.ts +8 -28
  82. package/dist/types/src/utils/url/isSafeUrl.d.ts +1 -1
  83. package/dist/ui-admin/assets/styles/style.css +0 -19
  84. 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, variant, ...rest }, ref) => {
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 (_jsx(MessageNotification, { color: color, variant: variant, supportTextLink: supportTextLink, supportTextLinkTarget: supportTextLinkTarget, ...rest, ref: ref }));
20
+ return _jsx(MessageNotification, { color: color, ...rest, ref: ref });
19
21
  }
20
22
  if (type === 'callout') {
21
23
  // 나머지 3개 type 이 공유하는 prop 은 callout 이 지원하지 않으므로 여기서 제외한다.
@@ -1,5 +1,5 @@
1
1
  // @vitest-environment jsdom
2
- import { InfoCircle, Pin02 } from '@ncds/ui-admin-icon';
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: variant 미지정, info 색상으로 렌더하면
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: variant 미지정, info 색상으로 렌더하면
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: variant 미지정, info 색상으로 렌더하면
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 의 info 아이콘은 InfoCircle 을 유지한다', () => {
152
- // Given/When: block 변형에 info 색상으로 렌더하면
153
- const container = renderMessageNotification({ variant: 'block', color: 'info' });
154
- // Then: 아이콘 path 가 InfoCircle 과 같다 (#536 회귀)
155
- const expected = iconPathD(InfoCircle);
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, {