@ncds/ui-admin 1.8.25 → 1.8.26-alpha.1
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/FullWidthNotification.js +2 -0
- package/dist/cjs/assets/scripts/notification/MessageNotification.js +30 -23
- package/dist/cjs/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/cjs/assets/scripts/notification/const/icons.js +11 -2
- package/dist/cjs/assets/scripts/notification/const/index.js +9 -4
- package/dist/cjs/assets/scripts/notification/const/sizes.js +6 -1
- package/dist/cjs/assets/scripts/notification/const/types.js +1 -10
- package/dist/cjs/assets/scripts/notification/messageTemplate.js +20 -8
- package/dist/cjs/assets/scripts/notification/utils.js +21 -17
- package/dist/cjs/constant/notification.js +15 -1
- package/dist/cjs/src/components/feedback-and-status/badge/Badge.js +1 -1
- package/dist/cjs/src/components/overlays/notification/FloatingNotification.js +4 -7
- package/dist/cjs/src/components/overlays/notification/FullWidthNotification.js +13 -8
- package/dist/cjs/src/components/overlays/notification/MessageNotification.js +20 -14
- package/dist/cjs/src/components/overlays/notification/MessageNotificationParts.js +22 -15
- package/dist/cjs/src/components/overlays/notification/Notification.js +6 -0
- package/dist/cjs/src/components/overlays/notification/NotificationActionButtons.js +27 -0
- package/dist/cjs/src/components/overlays/notification/__tests__/supportTextLink.test.js +58 -0
- package/dist/cjs/src/components/overlays/notification/linkTarget.js +18 -0
- package/dist/cjs/src/generated/scoped-css.js +1 -1
- package/dist/cjs/src/utils/index.js +11 -0
- package/dist/cjs/src/utils/url/__tests__/isSafeUrl.test.js +49 -0
- package/dist/cjs/src/utils/url/index.js +16 -0
- package/dist/cjs/src/utils/url/isSafeUrl.js +32 -0
- package/dist/esm/assets/scripts/notification/FullWidthNotification.js +3 -1
- package/dist/esm/assets/scripts/notification/MessageNotification.js +32 -25
- package/dist/esm/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/esm/assets/scripts/notification/const/icons.js +10 -1
- package/dist/esm/assets/scripts/notification/const/index.js +2 -3
- package/dist/esm/assets/scripts/notification/const/sizes.js +5 -0
- package/dist/esm/assets/scripts/notification/const/types.js +1 -8
- package/dist/esm/assets/scripts/notification/messageTemplate.js +21 -9
- package/dist/esm/assets/scripts/notification/utils.js +19 -16
- package/dist/esm/constant/notification.js +14 -0
- package/dist/esm/src/components/feedback-and-status/badge/Badge.js +1 -1
- package/dist/esm/src/components/overlays/notification/FloatingNotification.js +4 -7
- package/dist/esm/src/components/overlays/notification/FullWidthNotification.js +13 -8
- package/dist/esm/src/components/overlays/notification/MessageNotification.js +21 -15
- package/dist/esm/src/components/overlays/notification/MessageNotificationParts.js +22 -15
- package/dist/esm/src/components/overlays/notification/Notification.js +6 -0
- package/dist/esm/src/components/overlays/notification/NotificationActionButtons.js +21 -0
- package/dist/esm/src/components/overlays/notification/__tests__/supportTextLink.test.js +55 -0
- package/dist/esm/src/components/overlays/notification/linkTarget.js +12 -0
- package/dist/esm/src/generated/scoped-css.js +1 -1
- package/dist/esm/src/utils/index.js +3 -1
- package/dist/esm/src/utils/url/__tests__/isSafeUrl.test.js +47 -0
- package/dist/esm/src/utils/url/index.js +1 -0
- package/dist/esm/src/utils/url/isSafeUrl.js +26 -0
- package/dist/temp/assets/scripts/notification/FullWidthNotification.js +3 -2
- package/dist/temp/assets/scripts/notification/MessageNotification.d.ts +2 -0
- package/dist/temp/assets/scripts/notification/MessageNotification.js +30 -25
- package/dist/temp/assets/scripts/notification/const/classNames.d.ts +3 -0
- package/dist/temp/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/temp/assets/scripts/notification/const/icons.d.ts +6 -0
- package/dist/temp/assets/scripts/notification/const/icons.js +9 -0
- package/dist/temp/assets/scripts/notification/const/index.d.ts +3 -4
- package/dist/temp/assets/scripts/notification/const/index.js +2 -3
- package/dist/temp/assets/scripts/notification/const/sizes.d.ts +4 -0
- package/dist/temp/assets/scripts/notification/const/sizes.js +5 -0
- package/dist/temp/assets/scripts/notification/const/types.d.ts +28 -1
- package/dist/temp/assets/scripts/notification/const/types.js +1 -8
- package/dist/temp/assets/scripts/notification/messageTemplate.d.ts +5 -1
- package/dist/temp/assets/scripts/notification/messageTemplate.js +16 -11
- package/dist/temp/assets/scripts/notification/utils.d.ts +10 -3
- package/dist/temp/assets/scripts/notification/utils.js +21 -18
- package/dist/temp/constant/notification.d.ts +13 -0
- package/dist/temp/constant/notification.js +14 -0
- package/dist/temp/src/components/feedback-and-status/badge/Badge.d.ts +1 -1
- package/dist/temp/src/components/feedback-and-status/badge/Badge.js +1 -1
- package/dist/temp/src/components/overlays/notification/FloatingNotification.js +2 -2
- package/dist/temp/src/components/overlays/notification/FullWidthNotification.d.ts +6 -1
- package/dist/temp/src/components/overlays/notification/FullWidthNotification.js +7 -2
- package/dist/temp/src/components/overlays/notification/MessageNotification.d.ts +15 -1
- package/dist/temp/src/components/overlays/notification/MessageNotification.js +11 -12
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.d.ts +10 -5
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.js +9 -6
- package/dist/temp/src/components/overlays/notification/Notification.d.ts +23 -2
- package/dist/temp/src/components/overlays/notification/Notification.js +3 -3
- package/dist/temp/src/components/overlays/notification/NotificationActionButtons.d.ts +12 -0
- package/dist/temp/src/components/overlays/notification/NotificationActionButtons.js +9 -0
- package/dist/temp/src/components/overlays/notification/__tests__/supportTextLink.test.d.ts +1 -0
- package/dist/temp/src/components/overlays/notification/__tests__/supportTextLink.test.js +73 -0
- package/dist/temp/src/components/overlays/notification/linkTarget.d.ts +11 -0
- package/dist/temp/src/components/overlays/notification/linkTarget.js +9 -0
- package/dist/temp/src/generated/scoped-css.js +1 -1
- package/dist/temp/src/utils/index.d.ts +1 -0
- package/dist/temp/src/utils/index.js +2 -0
- package/dist/temp/src/utils/url/__tests__/isSafeUrl.test.d.ts +1 -0
- package/dist/temp/src/utils/url/__tests__/isSafeUrl.test.js +61 -0
- package/dist/temp/src/utils/url/index.d.ts +1 -0
- package/dist/temp/src/utils/url/index.js +1 -0
- package/dist/temp/src/utils/url/isSafeUrl.d.ts +8 -0
- package/dist/temp/src/utils/url/isSafeUrl.js +29 -0
- package/dist/types/assets/scripts/notification/MessageNotification.d.ts +2 -0
- package/dist/types/assets/scripts/notification/const/classNames.d.ts +3 -0
- package/dist/types/assets/scripts/notification/const/icons.d.ts +6 -0
- package/dist/types/assets/scripts/notification/const/index.d.ts +3 -4
- package/dist/types/assets/scripts/notification/const/sizes.d.ts +4 -0
- package/dist/types/assets/scripts/notification/const/types.d.ts +28 -1
- package/dist/types/assets/scripts/notification/messageTemplate.d.ts +5 -1
- package/dist/types/assets/scripts/notification/utils.d.ts +10 -3
- package/dist/types/constant/notification.d.ts +13 -0
- package/dist/types/src/components/feedback-and-status/badge/Badge.d.ts +1 -1
- package/dist/types/src/components/overlays/notification/FullWidthNotification.d.ts +6 -1
- package/dist/types/src/components/overlays/notification/MessageNotification.d.ts +15 -1
- package/dist/types/src/components/overlays/notification/MessageNotificationParts.d.ts +10 -5
- package/dist/types/src/components/overlays/notification/Notification.d.ts +23 -2
- package/dist/types/src/components/overlays/notification/NotificationActionButtons.d.ts +12 -0
- package/dist/types/src/components/overlays/notification/__tests__/supportTextLink.test.d.ts +1 -0
- package/dist/types/src/components/overlays/notification/linkTarget.d.ts +11 -0
- package/dist/types/src/utils/index.d.ts +1 -0
- package/dist/types/src/utils/url/__tests__/isSafeUrl.test.d.ts +1 -0
- package/dist/types/src/utils/url/index.d.ts +1 -0
- package/dist/types/src/utils/url/isSafeUrl.d.ts +8 -0
- package/dist/ui-admin/assets/styles/style.css +54 -34
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ class FullWidthNotification {
|
|
|
31
31
|
actions,
|
|
32
32
|
onClose,
|
|
33
33
|
supportTextLink,
|
|
34
|
+
supportTextLinkTarget,
|
|
34
35
|
onHidePermanently,
|
|
35
36
|
hidePermanentlyLabel
|
|
36
37
|
} = this.options;
|
|
@@ -46,6 +47,7 @@ class FullWidthNotification {
|
|
|
46
47
|
onHidePermanently,
|
|
47
48
|
hidePermanentlyLabel
|
|
48
49
|
}));
|
|
50
|
+
(0, _utils.applySupportTextLinkTarget)(wrapper, _const.CLASS_NAMES.FULL_WIDTH.TEXT_CONTAINER, _const.CLASS_NAMES.FULL_WIDTH.LINK, supportTextLinkTarget);
|
|
49
51
|
return wrapper;
|
|
50
52
|
}
|
|
51
53
|
buildTemplate(params) {
|
|
@@ -32,38 +32,28 @@ class MessageNotification {
|
|
|
32
32
|
actions,
|
|
33
33
|
onClose,
|
|
34
34
|
onHidePermanently,
|
|
35
|
-
hidePermanentlyLabel
|
|
35
|
+
hidePermanentlyLabel,
|
|
36
|
+
variant,
|
|
37
|
+
supportTextLink,
|
|
38
|
+
supportTextLinkTarget
|
|
36
39
|
} = this.options;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const iconFunction = _const.FLOATING_ICON_MAP[actualColor];
|
|
44
|
-
// FeaturedIcon 생성
|
|
45
|
-
let featuredIconElement = null;
|
|
46
|
-
if (iconFunction) {
|
|
47
|
-
const iconSvg = iconFunction(_const.MESSAGE_SIZES.ICON_PIXEL);
|
|
48
|
-
this.featuredIcon = _featuredIcon.FeaturedIcon.create({
|
|
49
|
-
svgString: iconSvg,
|
|
50
|
-
theme: 'light-circle',
|
|
51
|
-
color: actualColor,
|
|
52
|
-
size: _const.MESSAGE_SIZES.FEATURED_ICON,
|
|
53
|
-
// React 구현과 동일하게 `__icon`(flex-shrink: 0)을 부여한다.
|
|
54
|
-
// 누락 시 긴 타이틀에서 아이콘이 찌그러진다.
|
|
55
|
-
className: _const.CLASS_NAMES.MESSAGE.ICON
|
|
56
|
-
});
|
|
57
|
-
featuredIconElement = this.featuredIcon.getElement();
|
|
58
|
-
}
|
|
40
|
+
const isBlock = variant === 'block';
|
|
41
|
+
// default 는 neutral, error, warning, success 4가지 색상만 지원 — info 는 block 에서만 유지한다.
|
|
42
|
+
const actualColor = !isBlock && color === 'info' ? 'neutral' : color;
|
|
43
|
+
const wrapperClassName = [isBlock ? _const.CLASS_NAMES.MESSAGE.BLOCK : '', className].filter(Boolean).join(' ');
|
|
44
|
+
const wrapper = (0, _utils.createWrapperElement)(_const.CLASS_NAMES.MESSAGE.BASE, actualColor, wrapperClassName);
|
|
45
|
+
const featuredIconElement = this.createFeaturedIcon(actualColor, isBlock);
|
|
59
46
|
wrapper.innerHTML = (0, _sanitize.sanitizeHtml)((0, _messageTemplate.buildMessageTemplate)({
|
|
60
47
|
title,
|
|
61
48
|
supportingText,
|
|
49
|
+
supportTextLink: isBlock ? supportTextLink : undefined,
|
|
50
|
+
color: actualColor,
|
|
62
51
|
actions,
|
|
63
52
|
onClose,
|
|
64
53
|
onHidePermanently,
|
|
65
54
|
hidePermanentlyLabel
|
|
66
55
|
}));
|
|
56
|
+
(0, _utils.applySupportTextLinkTarget)(wrapper, _const.CLASS_NAMES.MESSAGE.TEXT_CONTAINER, _const.CLASS_NAMES.MESSAGE.LINK, supportTextLinkTarget);
|
|
67
57
|
// FeaturedIcon을 content-wrapper에 추가
|
|
68
58
|
if (featuredIconElement) {
|
|
69
59
|
const contentWrapper = wrapper.querySelector(`.${_const.CLASS_NAMES.MESSAGE.CONTENT_WRAPPER}`);
|
|
@@ -73,6 +63,23 @@ class MessageNotification {
|
|
|
73
63
|
}
|
|
74
64
|
return wrapper;
|
|
75
65
|
}
|
|
66
|
+
/** 색상별 FeaturedIcon. default 는 md(40/20), block 은 sm(32/16). */
|
|
67
|
+
createFeaturedIcon(color, isBlock) {
|
|
68
|
+
const iconFunction = _const.MESSAGE_ICON_MAP[color];
|
|
69
|
+
if (!iconFunction) return null;
|
|
70
|
+
const sizes = isBlock ? _const.MESSAGE_BLOCK_SIZES : _const.MESSAGE_SIZES;
|
|
71
|
+
this.featuredIcon = _featuredIcon.FeaturedIcon.create({
|
|
72
|
+
svgString: iconFunction(sizes.ICON_PIXEL),
|
|
73
|
+
theme: 'light-circle',
|
|
74
|
+
// FeaturedIcon 에는 info 색이 없다. block+info 의 violet 톤은 message SCSS 가 덮어쓴다.
|
|
75
|
+
color: color === 'info' ? 'neutral' : color,
|
|
76
|
+
size: sizes.FEATURED_ICON,
|
|
77
|
+
// React 구현과 동일하게 `__icon`(flex-shrink: 0)을 부여한다.
|
|
78
|
+
// 누락 시 긴 타이틀에서 아이콘이 찌그러진다.
|
|
79
|
+
className: _const.CLASS_NAMES.MESSAGE.ICON
|
|
80
|
+
});
|
|
81
|
+
return this.featuredIcon.getElement();
|
|
82
|
+
}
|
|
76
83
|
bindEvents() {
|
|
77
84
|
(0, _utils.bindNotificationEvents)(this.element, this.options.actions, this.options.onClose, () => this.remove());
|
|
78
85
|
// 다시보지 않기 버튼 이벤트 바인딩
|
|
@@ -15,6 +15,7 @@ const CLASS_NAMES = exports.CLASS_NAMES = {
|
|
|
15
15
|
TEXT_CONTAINER: 'ncua-full-width-notification__text-container',
|
|
16
16
|
TITLE: 'ncua-full-width-notification__title',
|
|
17
17
|
SUPPORTING_TEXT: 'ncua-full-width-notification__supporting-text',
|
|
18
|
+
LINK: 'ncua-full-width-notification__link',
|
|
18
19
|
ACTIONS_CONTAINER: 'ncua-full-width-notification__actions-container',
|
|
19
20
|
ACTIONS: 'ncua-full-width-notification__actions',
|
|
20
21
|
CLOSE_BUTTON: 'ncua-full-width-notification__close-button'
|
|
@@ -32,6 +33,7 @@ const CLASS_NAMES = exports.CLASS_NAMES = {
|
|
|
32
33
|
},
|
|
33
34
|
MESSAGE: {
|
|
34
35
|
BASE: 'ncua-message-notification',
|
|
36
|
+
BLOCK: 'ncua-message-notification--block',
|
|
35
37
|
CONTAINER: 'ncua-message-notification__container',
|
|
36
38
|
CONTENT: 'ncua-message-notification__content',
|
|
37
39
|
CONTENT_WRAPPER: 'ncua-message-notification__content-wrapper',
|
|
@@ -39,6 +41,7 @@ const CLASS_NAMES = exports.CLASS_NAMES = {
|
|
|
39
41
|
TEXT_CONTAINER: 'ncua-message-notification__text-container',
|
|
40
42
|
TITLE: 'ncua-message-notification__title',
|
|
41
43
|
SUPPORTING_TEXT: 'ncua-message-notification__supporting-text',
|
|
44
|
+
LINK: 'ncua-message-notification__link',
|
|
42
45
|
ACTIONS_CONTAINER: 'ncua-message-notification__actions-container',
|
|
43
46
|
ACTIONS: 'ncua-message-notification__actions',
|
|
44
47
|
// 다시 보지 않기 + 닫기 그룹 전용 래퍼. ACTIONS_CONTAINER를 재사용하면
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SVG_ICONS = exports.ICON_MAP = exports.FULL_WIDTH_ICON_MAP = exports.FLOATING_ICON_MAP = void 0;
|
|
6
|
+
exports.SVG_ICONS = exports.MESSAGE_ICON_MAP = exports.ICON_MAP = exports.FULL_WIDTH_ICON_MAP = exports.FLOATING_ICON_MAP = void 0;
|
|
7
7
|
// SVG 아이콘들 (크기는 동적으로 설정)
|
|
8
8
|
const SVG_ICONS = exports.SVG_ICONS = {
|
|
9
9
|
'pin-02': size => `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" fill="none" viewBox="0 0 24 24" stroke="none"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.377 15.616 2.72 21.273m8.974-14.631-1.56 1.56a2 2 0 0 1-.264.242 1 1 0 0 1-.207.111c-.082.032-.17.05-.347.085l-3.665.733c-.952.19-1.428.286-1.65.537a1 1 0 0 0-.243.8c.046.333.39.677 1.076 1.363l7.086 7.086c.686.687 1.03 1.03 1.362 1.076a1 1 0 0 0 .801-.242c.251-.223.346-.7.537-1.651l.733-3.665c.035-.176.053-.265.085-.347a1 1 0 0 1 .11-.207c.051-.072.115-.136.242-.263l1.561-1.561c.082-.082.122-.122.167-.158q.06-.047.126-.085c.05-.029.103-.051.208-.097l2.495-1.069c.727-.312 1.091-.467 1.256-.72a1 1 0 0 0 .144-.747c-.06-.295-.34-.575-.9-1.135l-5.142-5.143c-.56-.56-.84-.84-1.135-.9a1 1 0 0 0-.748.145c-.252.165-.407.529-.72 1.256l-1.068 2.495a2 2 0 0 1-.097.208 1 1 0 0 1-.085.126 2 2 0 0 1-.158.167"></path></svg>`,
|
|
@@ -28,4 +28,13 @@ const FULL_WIDTH_ICON_MAP = exports.FULL_WIDTH_ICON_MAP = {
|
|
|
28
28
|
success: SVG_ICONS['check-circle'],
|
|
29
29
|
info: SVG_ICONS['info-circle']
|
|
30
30
|
};
|
|
31
|
-
const ICON_MAP = exports.ICON_MAP = FULL_WIDTH_ICON_MAP;
|
|
31
|
+
const ICON_MAP = exports.ICON_MAP = FULL_WIDTH_ICON_MAP;
|
|
32
|
+
/**
|
|
33
|
+
* message 타입 아이콘. floating 과 같은 4색에 block 변형 전용 info 를 더한다.
|
|
34
|
+
* `SVG_ICONS['info-circle']`은 full-width 전용 class·color 가 박혀 있어 쓰지 않는다
|
|
35
|
+
* (`.ncua-full-width-notification__icon`은 모바일에서 숨겨진다).
|
|
36
|
+
*/
|
|
37
|
+
const MESSAGE_ICON_MAP = exports.MESSAGE_ICON_MAP = {
|
|
38
|
+
...FLOATING_ICON_MAP,
|
|
39
|
+
info: size => `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" fill="none" viewBox="0 0 24 24" stroke="none"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 16v-4m0-4h.01M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10"></path></svg>`
|
|
40
|
+
};
|
|
@@ -57,10 +57,16 @@ Object.defineProperty(exports, "ICON_PIXEL_SIZES", {
|
|
|
57
57
|
return _sizes.ICON_PIXEL_SIZES;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
Object.defineProperty(exports, "
|
|
60
|
+
Object.defineProperty(exports, "MESSAGE_BLOCK_SIZES", {
|
|
61
61
|
enumerable: true,
|
|
62
62
|
get: function () {
|
|
63
|
-
return
|
|
63
|
+
return _sizes.MESSAGE_BLOCK_SIZES;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "MESSAGE_ICON_MAP", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _icons.MESSAGE_ICON_MAP;
|
|
64
70
|
}
|
|
65
71
|
});
|
|
66
72
|
Object.defineProperty(exports, "MESSAGE_SIZES", {
|
|
@@ -83,5 +89,4 @@ Object.defineProperty(exports, "getSizes", {
|
|
|
83
89
|
});
|
|
84
90
|
var _classNames = require("./classNames");
|
|
85
91
|
var _icons = require("./icons");
|
|
86
|
-
var _sizes = require("./sizes");
|
|
87
|
-
var _types = require("./types");
|
|
92
|
+
var _sizes = require("./sizes");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getSizes = exports.MESSAGE_SIZES = exports.ICON_PIXEL_SIZES = exports.FULL_WIDTH_SIZES = exports.FEATURED_ICON_SIZES = exports.CLOSE_BUTTON_SVG_SIZES = exports.CLOSE_BUTTON_SIZES = void 0;
|
|
6
|
+
exports.getSizes = exports.MESSAGE_SIZES = exports.MESSAGE_BLOCK_SIZES = exports.ICON_PIXEL_SIZES = exports.FULL_WIDTH_SIZES = exports.FEATURED_ICON_SIZES = exports.CLOSE_BUTTON_SVG_SIZES = exports.CLOSE_BUTTON_SIZES = void 0;
|
|
7
7
|
// 알림 컴포넌트 사이즈 관련 상수들
|
|
8
8
|
// FeaturedIcon 사이즈
|
|
9
9
|
const FEATURED_ICON_SIZES = exports.FEATURED_ICON_SIZES = {
|
|
@@ -39,6 +39,11 @@ const MESSAGE_SIZES = exports.MESSAGE_SIZES = {
|
|
|
39
39
|
ICON_PIXEL: '20',
|
|
40
40
|
CLOSE_BUTTON: '20'
|
|
41
41
|
};
|
|
42
|
+
// Message 알림 Block 변형 사이즈. 'sm' = 32px 원 / 16px 아이콘. 닫기 버튼은 default 와 같다.
|
|
43
|
+
const MESSAGE_BLOCK_SIZES = exports.MESSAGE_BLOCK_SIZES = {
|
|
44
|
+
FEATURED_ICON: 'sm',
|
|
45
|
+
ICON_PIXEL: '16'
|
|
46
|
+
};
|
|
42
47
|
// 사이즈 유틸리티 함수들
|
|
43
48
|
const getSizes = exports.getSizes = {
|
|
44
49
|
featuredIcon: isMobile => isMobile ? FEATURED_ICON_SIZES.MOBILE : FEATURED_ICON_SIZES.DESKTOP,
|
|
@@ -2,13 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MESSAGE_CLOSE_ICON_COLORS = void 0;
|
|
7
|
-
// Message Notification 닫기 버튼 아이콘 색상 맵
|
|
8
|
-
const MESSAGE_CLOSE_ICON_COLORS = exports.MESSAGE_CLOSE_ICON_COLORS = {
|
|
9
|
-
neutral: '#6B7280',
|
|
10
|
-
error: '#EF4444',
|
|
11
|
-
warning: '#F97316',
|
|
12
|
-
success: '#16A34A',
|
|
13
|
-
info: '#6B7280' // info는 message 타입에서 지원하지 않지만 fallback용
|
|
14
|
-
};
|
|
5
|
+
});
|
|
@@ -9,7 +9,7 @@ var _const = require("./const");
|
|
|
9
9
|
var _utils = require("./utils");
|
|
10
10
|
/**
|
|
11
11
|
* message 타입 액션 버튼 사이즈. TO-BE 규격 28px이며 React `<Button size="xs">`와 같다.
|
|
12
|
-
*
|
|
12
|
+
* `renderActions` 기본값도 'xs'(#535)지만 message 규격을 명시적으로 고정해 둔다.
|
|
13
13
|
*/
|
|
14
14
|
const ACTION_BUTTON_SIZE = 'xs';
|
|
15
15
|
/**
|
|
@@ -21,6 +21,8 @@ function buildMessageTemplate(params) {
|
|
|
21
21
|
const {
|
|
22
22
|
title,
|
|
23
23
|
supportingText,
|
|
24
|
+
supportTextLink,
|
|
25
|
+
color,
|
|
24
26
|
actions,
|
|
25
27
|
onClose,
|
|
26
28
|
onHidePermanently,
|
|
@@ -32,14 +34,15 @@ function buildMessageTemplate(params) {
|
|
|
32
34
|
<div class="${_const.CLASS_NAMES.MESSAGE.CONTENT_WRAPPER}">
|
|
33
35
|
<div class="${_const.CLASS_NAMES.MESSAGE.TEXT_CONTAINER}">
|
|
34
36
|
<span class="${_const.CLASS_NAMES.MESSAGE.TITLE}">${title}</span>
|
|
35
|
-
${(0, _utils.renderSupportingText)(supportingText, _const.CLASS_NAMES.MESSAGE.SUPPORTING_TEXT)}
|
|
37
|
+
${(0, _utils.renderSupportingText)(supportingText, _const.CLASS_NAMES.MESSAGE.SUPPORTING_TEXT, supportTextLink, _const.CLASS_NAMES.MESSAGE.LINK)}
|
|
36
38
|
</div>
|
|
37
39
|
</div>
|
|
38
40
|
${renderActionsContainer({
|
|
39
41
|
actions,
|
|
40
42
|
onClose,
|
|
41
43
|
onHidePermanently,
|
|
42
|
-
hidePermanentlyLabel
|
|
44
|
+
hidePermanentlyLabel,
|
|
45
|
+
color
|
|
43
46
|
})}
|
|
44
47
|
</div>
|
|
45
48
|
</div>
|
|
@@ -55,13 +58,15 @@ function renderActionsContainer(params) {
|
|
|
55
58
|
actions,
|
|
56
59
|
onClose,
|
|
57
60
|
onHidePermanently,
|
|
58
|
-
hidePermanentlyLabel
|
|
61
|
+
hidePermanentlyLabel,
|
|
62
|
+
color
|
|
59
63
|
} = params;
|
|
60
64
|
const actionsHtml = (0, _utils.renderActions)(actions ?? [], _const.CLASS_NAMES.MESSAGE.ACTIONS, ACTION_BUTTON_SIZE);
|
|
61
65
|
const footerHtml = renderFooterContainer({
|
|
62
66
|
onClose,
|
|
63
67
|
onHidePermanently,
|
|
64
|
-
hidePermanentlyLabel
|
|
68
|
+
hidePermanentlyLabel,
|
|
69
|
+
color
|
|
65
70
|
});
|
|
66
71
|
if (!actionsHtml && !footerHtml) return '';
|
|
67
72
|
return `<div class="${_const.CLASS_NAMES.MESSAGE.ACTIONS_CONTAINER}">${actionsHtml}${footerHtml}</div>`;
|
|
@@ -71,13 +76,14 @@ function renderFooterContainer(params) {
|
|
|
71
76
|
const {
|
|
72
77
|
onClose,
|
|
73
78
|
onHidePermanently,
|
|
74
|
-
hidePermanentlyLabel
|
|
79
|
+
hidePermanentlyLabel,
|
|
80
|
+
color
|
|
75
81
|
} = params;
|
|
76
82
|
if (!onHidePermanently && !onClose) return '';
|
|
77
83
|
return `
|
|
78
84
|
<div class="${_const.CLASS_NAMES.MESSAGE.FOOTER_CONTAINER}">
|
|
79
85
|
${renderHidePermanentlyButton(onHidePermanently, hidePermanentlyLabel)}
|
|
80
|
-
${renderCloseButton(onClose)}
|
|
86
|
+
${renderCloseButton(onClose, color)}
|
|
81
87
|
</div>
|
|
82
88
|
`;
|
|
83
89
|
}
|
|
@@ -96,11 +102,17 @@ function renderHidePermanentlyButton(onHidePermanently, hidePermanentlyLabel) {
|
|
|
96
102
|
</button>
|
|
97
103
|
`;
|
|
98
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* 닫기(X) 버튼. 아이콘 색은 React `<XClose color>`와 같이 svg 의 `color` 속성으로 주고
|
|
107
|
+
* path 는 `stroke="currentColor"`로 상속받는다 — 두 구현이 같은 마크업을 낸다.
|
|
108
|
+
*/
|
|
99
109
|
function renderCloseButton(onClose) {
|
|
110
|
+
let color = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'neutral';
|
|
100
111
|
if (!onClose) return '';
|
|
112
|
+
const iconColor = _notification.MESSAGE_CLOSE_ICON_COLOR[color];
|
|
101
113
|
return `
|
|
102
114
|
<button type="button" class="${_const.CLASS_NAMES.MESSAGE.CLOSE_BUTTON}" aria-label="알림 닫기">
|
|
103
|
-
${_const.SVG_ICONS['x-close'](_const.MESSAGE_SIZES.CLOSE_BUTTON).replace('
|
|
115
|
+
${_const.SVG_ICONS['x-close'](_const.MESSAGE_SIZES.CLOSE_BUTTON).replace('<svg ', `<svg color="${iconColor}" `)}
|
|
104
116
|
</button>
|
|
105
117
|
`;
|
|
106
118
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.applySupportTextLinkTarget = applySupportTextLinkTarget;
|
|
6
7
|
exports.bindNotificationEvents = bindNotificationEvents;
|
|
7
8
|
exports.buildClassName = buildClassName;
|
|
8
9
|
exports.createWrapperElement = createWrapperElement;
|
|
@@ -12,6 +13,7 @@ exports.renderSupportingText = renderSupportingText;
|
|
|
12
13
|
exports.resolveActionHierarchy = resolveActionHierarchy;
|
|
13
14
|
exports.setupAutoClose = setupAutoClose;
|
|
14
15
|
var _breakpoint = require("../../../src/constant/breakpoint");
|
|
16
|
+
var _url = require("../../../src/utils/url");
|
|
15
17
|
var _const = require("./const");
|
|
16
18
|
// 공통 유틸리티 함수들
|
|
17
19
|
function createWrapperElement(baseClass, color, className) {
|
|
@@ -27,18 +29,6 @@ function buildClassName(baseClass, color, className) {
|
|
|
27
29
|
}
|
|
28
30
|
return classes.join(' ');
|
|
29
31
|
}
|
|
30
|
-
/**
|
|
31
|
-
* http/https 프로토콜만 허용한다.
|
|
32
|
-
* javascript:, data:, file: 등 위험 프로토콜로 인한 XSS / 외부 페이로드 로딩을 차단.
|
|
33
|
-
*/
|
|
34
|
-
function isSafeUrl(url) {
|
|
35
|
-
try {
|
|
36
|
-
const parsed = new URL(url, window.location.origin);
|
|
37
|
-
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
|
|
38
|
-
} catch {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
32
|
/**
|
|
43
33
|
* HTML 속성 값에 안전하게 삽입하기 위한 최소 이스케이프.
|
|
44
34
|
* 본문(body)이 아닌 속성 컨텍스트에서의 따옴표 탈출(`" onclick="..."`)을 방지.
|
|
@@ -47,17 +37,32 @@ function escapeHtmlAttr(str) {
|
|
|
47
37
|
return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''');
|
|
48
38
|
}
|
|
49
39
|
function renderSupportingText(supportingText, className, supportTextLink) {
|
|
40
|
+
let linkClassName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _const.CLASS_NAMES.FULL_WIDTH.LINK;
|
|
50
41
|
if (!supportingText) return '';
|
|
51
42
|
// 본문(supportingText) 자체는 이 함수의 호출 결과가 wrapper.innerHTML에
|
|
52
43
|
// 들어가기 전에 DOMPurify로 sanitize되므로 별도 이스케이프하지 않는다.
|
|
53
44
|
// 이렇게 해야 <br>, <strong> 등 서식용 태그가 그대로 동작한다.
|
|
54
|
-
if (supportTextLink && isSafeUrl(supportTextLink)) {
|
|
45
|
+
if (supportTextLink && (0, _url.isSafeUrl)(supportTextLink)) {
|
|
55
46
|
const safeLink = escapeHtmlAttr(supportTextLink);
|
|
56
|
-
return `<a href="${safeLink}" class="
|
|
47
|
+
return `<a href="${safeLink}" class="${linkClassName}"><span class="${className}">${supportingText}</span></a>`;
|
|
57
48
|
}
|
|
58
49
|
// unsafe URL이거나 link가 없으면 링크 없이 텍스트만 렌더링
|
|
59
50
|
return `<span class="${className}">${supportingText}</span>`;
|
|
60
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* `supportTextLinkTarget`이 `'_blank'`이면 `renderSupportingText`가 만든 링크를 새 탭으로 연다.
|
|
54
|
+
*
|
|
55
|
+
* target 은 sanitize **이후** 우리가 만든 링크(텍스트 컨테이너의 직계 `<a>`)에만 지정한다.
|
|
56
|
+
* DOMPurify 에 target 을 전역 허용하면 사용자 입력 HTML 의 `<a target>`까지 rel 없이 통과하기 때문이다.
|
|
57
|
+
* 런타임 입력이므로 `'_blank'`가 아닌 값은 전부 `'_self'`(속성 미부여)로 취급한다.
|
|
58
|
+
*/
|
|
59
|
+
function applySupportTextLinkTarget(root, textContainerClassName, linkClassName, target) {
|
|
60
|
+
if (target !== '_blank') return;
|
|
61
|
+
const link = root.querySelector(`.${textContainerClassName} > a.${linkClassName}`);
|
|
62
|
+
if (!link) return;
|
|
63
|
+
link.setAttribute('target', '_blank');
|
|
64
|
+
link.setAttribute('rel', 'noopener noreferrer');
|
|
65
|
+
}
|
|
61
66
|
/** 액션 버튼 색상을 지정하지 않았을 때의 기본값. React `MessageNotificationParts`와 같다. */
|
|
62
67
|
const DEFAULT_ACTION_HIERARCHY = 'text';
|
|
63
68
|
/**
|
|
@@ -89,11 +94,10 @@ function buildActionKey(action) {
|
|
|
89
94
|
/**
|
|
90
95
|
* 액션 버튼 그룹 HTML을 만든다.
|
|
91
96
|
*
|
|
92
|
-
* `size` 기본값 '
|
|
93
|
-
* message 타입만 TO-BE 규격(28px)에 맞춰 'xs'를 넘긴다 — React `<Button size="xs">`와 동일.
|
|
97
|
+
* `size` 기본값 'xs'는 디자인 기준(#535 — 모든 type 액션 버튼 xs)이며 React `<Button size="xs">`와 같다.
|
|
94
98
|
*/
|
|
95
99
|
function renderActions(actions, wrapperClass) {
|
|
96
|
-
let size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '
|
|
100
|
+
let size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'xs';
|
|
97
101
|
// 액션이 없으면 빈 문자열 반환
|
|
98
102
|
if (!actions || actions.length === 0) {
|
|
99
103
|
return '';
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.HIDE_PERMANENTLY_LABEL = void 0;
|
|
6
|
+
exports.MESSAGE_CLOSE_ICON_COLOR = exports.HIDE_PERMANENTLY_LABEL = void 0;
|
|
7
|
+
var _color = require("./color");
|
|
7
8
|
/**
|
|
8
9
|
* 다시보지 않기 버튼의 타입별 기본 문구.
|
|
9
10
|
*
|
|
@@ -18,4 +19,17 @@ exports.HIDE_PERMANENTLY_LABEL = void 0;
|
|
|
18
19
|
const HIDE_PERMANENTLY_LABEL = exports.HIDE_PERMANENTLY_LABEL = {
|
|
19
20
|
message: '다시 보지 않기',
|
|
20
21
|
fullWidth: '다시보지 않기'
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* message 타입 닫기(X) 아이콘의 color 별 색.
|
|
25
|
+
*
|
|
26
|
+
* React(`MessageNotification.tsx`)와 Vanilla(`messageTemplate.ts`)가 함께 참조하는 단일 출처다.
|
|
27
|
+
* `info`는 `variant: 'block'`에서만 렌더된다(default 는 neutral 로 폴백).
|
|
28
|
+
*/
|
|
29
|
+
const MESSAGE_CLOSE_ICON_COLOR = exports.MESSAGE_CLOSE_ICON_COLOR = {
|
|
30
|
+
neutral: _color.COLOR.gray700,
|
|
31
|
+
error: _color.COLOR.red500,
|
|
32
|
+
warning: _color.COLOR.orange500,
|
|
33
|
+
success: _color.COLOR.green600,
|
|
34
|
+
info: _color.COLOR.violet600
|
|
21
35
|
};
|
|
@@ -11,10 +11,10 @@ var _react = require("react");
|
|
|
11
11
|
var _reactDom = require("react-dom");
|
|
12
12
|
var _breakpoint = require("../../../constant/breakpoint");
|
|
13
13
|
var _useMediaQuery = require("../../../hooks/useMediaQuery");
|
|
14
|
-
var _button = require("../../action/button");
|
|
15
14
|
var _ButtonCloseX = require("../../action/button/ButtonCloseX");
|
|
16
15
|
var _FeaturedIcon = require("../../image-and-icons/featured-icon/FeaturedIcon");
|
|
17
16
|
var _host = require("./host");
|
|
17
|
+
var _NotificationActionButtons = require("./NotificationActionButtons");
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
// 호스트 싱글톤은 vanilla/React 양쪽이 동일한 함수를 공유한다 — host.ts 가 가까운 진입점 역할을
|
|
20
20
|
// 하므로 React 컴포넌트는 deep relative path 로 vanilla internals 를 직접 import 하지 않는다.
|
|
@@ -157,12 +157,9 @@ const FloatingNotification = exports.FloatingNotification = /*#__PURE__*/(0, _re
|
|
|
157
157
|
children: supportingText
|
|
158
158
|
}), actions && (0, _jsxRuntime.jsx)("div", {
|
|
159
159
|
className: "ncua-floating-notification__actions",
|
|
160
|
-
children:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
label: action.label,
|
|
164
|
-
onClick: action?.onClick
|
|
165
|
-
}, `${action.label}-${action.hierarchy}`))
|
|
160
|
+
children: (0, _jsxRuntime.jsx)(_NotificationActionButtons.NotificationActionButtons, {
|
|
161
|
+
actions: actions
|
|
162
|
+
})
|
|
166
163
|
})]
|
|
167
164
|
})]
|
|
168
165
|
})
|
|
@@ -10,6 +10,9 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _color = require("../../../../constant/color");
|
|
12
12
|
var _notification = require("../../../../constant/notification");
|
|
13
|
+
var _url = require("../../../utils/url");
|
|
14
|
+
var _linkTarget = require("./linkTarget");
|
|
15
|
+
var _NotificationActionButtons = require("./NotificationActionButtons");
|
|
13
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
17
|
const iconMap = {
|
|
15
18
|
neutral: _uiAdminIcon.MessageChatSquare,
|
|
@@ -35,11 +38,14 @@ const FullWidthNotification = exports.FullWidthNotification = /*#__PURE__*/(0, _
|
|
|
35
38
|
actions,
|
|
36
39
|
autoClose = 0,
|
|
37
40
|
supportTextLink,
|
|
41
|
+
supportTextLinkTarget,
|
|
38
42
|
onHidePermanently,
|
|
39
43
|
hidePermanentlyLabel = _notification.HIDE_PERMANENTLY_LABEL.fullWidth,
|
|
40
44
|
...rest
|
|
41
45
|
} = _ref;
|
|
42
46
|
const [shouldRemove, setShouldRemove] = (0, _react.useState)(false);
|
|
47
|
+
// unsafe URL(javascript: 등)이면 링크 없이 텍스트만 렌더한다 — Vanilla `renderSupportingText` 와 같은 정책.
|
|
48
|
+
const safeSupportTextLink = supportTextLink && (0, _url.isSafeUrl)(supportTextLink) ? supportTextLink : undefined;
|
|
43
49
|
const closeIconSize = {
|
|
44
50
|
width: 20,
|
|
45
51
|
height: 20
|
|
@@ -93,12 +99,13 @@ const FullWidthNotification = exports.FullWidthNotification = /*#__PURE__*/(0, _
|
|
|
93
99
|
children: [(0, _jsxRuntime.jsx)("span", {
|
|
94
100
|
className: "ncua-full-width-notification__title",
|
|
95
101
|
children: title
|
|
96
|
-
}), !
|
|
102
|
+
}), !safeSupportTextLink && supportingText && (0, _jsxRuntime.jsx)("span", {
|
|
97
103
|
className: "ncua-full-width-notification__supporting-text",
|
|
98
104
|
children: supportingText
|
|
99
|
-
}),
|
|
100
|
-
href:
|
|
105
|
+
}), safeSupportTextLink && supportingText && (0, _jsxRuntime.jsx)("a", {
|
|
106
|
+
href: safeSupportTextLink,
|
|
101
107
|
className: "ncua-full-width-notification__link",
|
|
108
|
+
...(0, _linkTarget.getLinkTargetAttributes)(supportTextLinkTarget),
|
|
102
109
|
children: (0, _jsxRuntime.jsx)("span", {
|
|
103
110
|
className: "ncua-full-width-notification__supporting-text",
|
|
104
111
|
children: supportingText
|
|
@@ -109,11 +116,9 @@ const FullWidthNotification = exports.FullWidthNotification = /*#__PURE__*/(0, _
|
|
|
109
116
|
className: "ncua-full-width-notification__actions-container",
|
|
110
117
|
children: [actions && (0, _jsxRuntime.jsx)("div", {
|
|
111
118
|
className: "ncua-full-width-notification__actions",
|
|
112
|
-
children:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
children: action.label
|
|
116
|
-
}, `${action.label}-${action.hierarchy}`))
|
|
119
|
+
children: (0, _jsxRuntime.jsx)(_NotificationActionButtons.NotificationActionButtons, {
|
|
120
|
+
actions: actions
|
|
121
|
+
})
|
|
117
122
|
}), onHidePermanently && (0, _jsxRuntime.jsx)("button", {
|
|
118
123
|
type: "button",
|
|
119
124
|
className: (0, _classnames.default)('ncua-notification__action-button', 'ncua-notification__action-button--text', 'ncua-full-width-notification__link'),
|
|
@@ -8,20 +8,16 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
8
8
|
var _uiAdminIcon = require("@ncds/ui-admin-icon");
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _react = require("react");
|
|
11
|
-
var
|
|
11
|
+
var _notification = require("../../../../constant/notification");
|
|
12
12
|
var _MessageNotificationParts = require("./MessageNotificationParts");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
const iconMap = {
|
|
15
15
|
neutral: _uiAdminIcon.Pin02,
|
|
16
16
|
error: _uiAdminIcon.AlertTriangle,
|
|
17
17
|
warning: _uiAdminIcon.AlertCircle,
|
|
18
|
-
success: _uiAdminIcon.CheckCircle
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
neutral: 'gray700',
|
|
22
|
-
error: 'red500',
|
|
23
|
-
warning: 'orange500',
|
|
24
|
-
success: 'green600'
|
|
18
|
+
success: _uiAdminIcon.CheckCircle,
|
|
19
|
+
// info 는 variant="block" 에서만 도달한다 (default 는 neutral 로 폴백).
|
|
20
|
+
info: _uiAdminIcon.InfoCircle
|
|
25
21
|
};
|
|
26
22
|
const MessageNotification = exports.MessageNotification = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
27
23
|
let {
|
|
@@ -34,13 +30,21 @@ const MessageNotification = exports.MessageNotification = /*#__PURE__*/(0, _reac
|
|
|
34
30
|
actions,
|
|
35
31
|
onHidePermanently,
|
|
36
32
|
hidePermanentlyLabel,
|
|
33
|
+
variant = 'default',
|
|
34
|
+
supportTextLink,
|
|
35
|
+
supportTextLinkTarget,
|
|
37
36
|
...rest
|
|
38
37
|
} = _ref;
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const isBlock = variant === 'block';
|
|
39
|
+
// default 는 neutral, error, warning, success 4가지 색상만 지원 — info 는 block 에서만 유지한다.
|
|
40
|
+
const validColor = !isBlock && color === 'info' ? 'neutral' : color;
|
|
41
|
+
// FeaturedIcon 에는 info 색이 없다. block+info 의 violet 톤은 message SCSS 가 덮어쓴다.
|
|
42
|
+
const featuredIconColor = validColor === 'info' ? 'neutral' : validColor;
|
|
41
43
|
return (0, _jsxRuntime.jsx)("div", {
|
|
42
44
|
ref: ref,
|
|
43
|
-
className: (0, _classnames.default)('ncua-message-notification', `ncua-message-notification--${validColor}`,
|
|
45
|
+
className: (0, _classnames.default)('ncua-message-notification', `ncua-message-notification--${validColor}`, {
|
|
46
|
+
'ncua-message-notification--block': isBlock
|
|
47
|
+
}, className),
|
|
44
48
|
role: "alert",
|
|
45
49
|
...rest,
|
|
46
50
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
@@ -50,15 +54,17 @@ const MessageNotification = exports.MessageNotification = /*#__PURE__*/(0, _reac
|
|
|
50
54
|
children: [(0, _jsxRuntime.jsx)(_MessageNotificationParts.MessageNotificationContent, {
|
|
51
55
|
title: title,
|
|
52
56
|
supportingText: supportingText,
|
|
57
|
+
supportTextLink: isBlock ? supportTextLink : undefined,
|
|
58
|
+
supportTextLinkTarget: supportTextLinkTarget,
|
|
53
59
|
icon: Icon || iconMap[validColor],
|
|
54
|
-
iconColor:
|
|
55
|
-
|
|
60
|
+
iconColor: featuredIconColor,
|
|
61
|
+
iconSize: isBlock ? 'sm' : 'md'
|
|
56
62
|
}), (0, _jsxRuntime.jsx)(_MessageNotificationParts.MessageNotificationActions, {
|
|
57
63
|
actions: actions,
|
|
58
64
|
onClose: onClose,
|
|
59
65
|
onHidePermanently: onHidePermanently,
|
|
60
66
|
hidePermanentlyLabel: hidePermanentlyLabel,
|
|
61
|
-
closeIconColor:
|
|
67
|
+
closeIconColor: _notification.MESSAGE_CLOSE_ICON_COLOR[validColor]
|
|
62
68
|
})]
|
|
63
69
|
})
|
|
64
70
|
})
|
|
@@ -7,26 +7,34 @@ exports.MessageNotificationContent = exports.MessageNotificationActions = void 0
|
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
var _uiAdminIcon = require("@ncds/ui-admin-icon");
|
|
9
9
|
var _notification = require("../../../../constant/notification");
|
|
10
|
-
var
|
|
10
|
+
var _url = require("../../../utils/url");
|
|
11
11
|
var _FeaturedIcon = require("../../image-and-icons/featured-icon/FeaturedIcon");
|
|
12
|
-
|
|
12
|
+
var _linkTarget = require("./linkTarget");
|
|
13
|
+
var _NotificationActionButtons = require("./NotificationActionButtons");
|
|
14
|
+
/** 아이콘 + 제목/서포팅 텍스트(또는 텍스트 링크) 영역. */
|
|
13
15
|
const MessageNotificationContent = _ref => {
|
|
14
16
|
let {
|
|
15
17
|
title,
|
|
16
18
|
supportingText,
|
|
19
|
+
supportTextLink,
|
|
20
|
+
supportTextLinkTarget,
|
|
17
21
|
icon,
|
|
18
22
|
iconColor,
|
|
19
|
-
|
|
23
|
+
iconSize
|
|
20
24
|
} = _ref;
|
|
21
25
|
const featuredIconProps = {
|
|
22
26
|
icon: icon || _uiAdminIcon.Pin02,
|
|
23
|
-
size:
|
|
27
|
+
size: iconSize,
|
|
24
28
|
color: iconColor,
|
|
25
29
|
theme: 'light-circle'
|
|
26
30
|
};
|
|
31
|
+
const supportingTextNode = supportingText && (0, _jsxRuntime.jsx)("span", {
|
|
32
|
+
className: "ncua-message-notification__supporting-text",
|
|
33
|
+
children: supportingText
|
|
34
|
+
});
|
|
27
35
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
28
36
|
className: "ncua-message-notification__content-wrapper",
|
|
29
|
-
children: [
|
|
37
|
+
children: [(0, _jsxRuntime.jsx)(_FeaturedIcon.FeaturedIcon, {
|
|
30
38
|
...featuredIconProps,
|
|
31
39
|
className: "ncua-message-notification__icon"
|
|
32
40
|
}), (0, _jsxRuntime.jsxs)("div", {
|
|
@@ -34,10 +42,12 @@ const MessageNotificationContent = _ref => {
|
|
|
34
42
|
children: [(0, _jsxRuntime.jsx)("span", {
|
|
35
43
|
className: "ncua-message-notification__title",
|
|
36
44
|
children: title
|
|
37
|
-
}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
}), supportTextLink && (0, _url.isSafeUrl)(supportTextLink) && supportingTextNode ? (0, _jsxRuntime.jsx)("a", {
|
|
46
|
+
href: supportTextLink,
|
|
47
|
+
className: "ncua-message-notification__link",
|
|
48
|
+
...(0, _linkTarget.getLinkTargetAttributes)(supportTextLinkTarget),
|
|
49
|
+
children: supportingTextNode
|
|
50
|
+
}) : supportingTextNode]
|
|
41
51
|
})]
|
|
42
52
|
});
|
|
43
53
|
};
|
|
@@ -62,12 +72,9 @@ const MessageNotificationActions = _ref2 => {
|
|
|
62
72
|
className: "ncua-message-notification__actions-container",
|
|
63
73
|
children: [hasActions && (0, _jsxRuntime.jsx)("div", {
|
|
64
74
|
className: "ncua-message-notification__actions",
|
|
65
|
-
children:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
label: action.label,
|
|
69
|
-
onClick: action?.onClick
|
|
70
|
-
}, `${action.label}-${action.hierarchy}`))
|
|
75
|
+
children: (0, _jsxRuntime.jsx)(_NotificationActionButtons.NotificationActionButtons, {
|
|
76
|
+
actions: actions ?? []
|
|
77
|
+
})
|
|
71
78
|
}), hasFooter && (0, _jsxRuntime.jsxs)("div", {
|
|
72
79
|
className: "ncua-message-notification__footer-container",
|
|
73
80
|
children: [onHidePermanently && (0, _jsxRuntime.jsx)("button", {
|