@ncds/ui-admin 1.8.21-alpha.3 → 1.8.21-alpha.5
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/MessageNotification.js +6 -46
- package/dist/cjs/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/cjs/assets/scripts/notification/const/index.js +1 -1
- package/dist/cjs/assets/scripts/notification/const/sizes.js +4 -2
- package/dist/cjs/assets/scripts/notification/messageTemplate.js +77 -0
- package/dist/cjs/assets/scripts/notification/utils.js +40 -4
- package/dist/cjs/src/components/overlays/notification/MessageNotification.js +12 -54
- package/dist/cjs/src/components/overlays/notification/MessageNotificationParts.js +90 -0
- package/dist/cjs/src/components/overlays/notification/__tests__/MessageNotification.test.js +246 -0
- package/dist/cjs/src/generated/scoped-css.js +1 -1
- package/dist/esm/assets/scripts/notification/MessageNotification.js +8 -48
- package/dist/esm/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/esm/assets/scripts/notification/const/index.js +3 -2
- package/dist/esm/assets/scripts/notification/const/sizes.js +4 -2
- package/dist/esm/assets/scripts/notification/messageTemplate.js +71 -0
- package/dist/esm/assets/scripts/notification/utils.js +39 -4
- package/dist/esm/src/components/overlays/notification/MessageNotification.js +13 -55
- package/dist/esm/src/components/overlays/notification/MessageNotificationParts.js +83 -0
- package/dist/esm/src/components/overlays/notification/__tests__/MessageNotification.test.js +243 -0
- package/dist/esm/src/generated/scoped-css.js +1 -1
- package/dist/temp/assets/scripts/notification/MessageNotification.d.ts +0 -3
- package/dist/temp/assets/scripts/notification/MessageNotification.js +7 -43
- package/dist/temp/assets/scripts/notification/const/classNames.d.ts +1 -0
- package/dist/temp/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/temp/assets/scripts/notification/const/index.d.ts +3 -3
- package/dist/temp/assets/scripts/notification/const/index.js +3 -2
- package/dist/temp/assets/scripts/notification/const/sizes.d.ts +2 -2
- package/dist/temp/assets/scripts/notification/const/sizes.js +4 -2
- package/dist/temp/assets/scripts/notification/const/types.d.ts +20 -2
- package/dist/temp/assets/scripts/notification/messageTemplate.d.ts +14 -0
- package/dist/temp/assets/scripts/notification/messageTemplate.js +69 -0
- package/dist/temp/assets/scripts/notification/utils.d.ts +19 -2
- package/dist/temp/assets/scripts/notification/utils.js +39 -5
- package/dist/temp/src/components/overlays/notification/MessageNotification.js +3 -12
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.d.ts +27 -0
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.js +27 -0
- package/dist/temp/src/components/overlays/notification/Notification.d.ts +3 -2
- package/dist/temp/src/components/overlays/notification/__tests__/MessageNotification.test.d.ts +1 -0
- package/dist/temp/src/components/overlays/notification/__tests__/MessageNotification.test.js +190 -0
- package/dist/temp/src/generated/scoped-css.js +1 -1
- package/dist/types/assets/scripts/notification/MessageNotification.d.ts +0 -3
- package/dist/types/assets/scripts/notification/const/classNames.d.ts +1 -0
- package/dist/types/assets/scripts/notification/const/index.d.ts +3 -3
- package/dist/types/assets/scripts/notification/const/sizes.d.ts +2 -2
- package/dist/types/assets/scripts/notification/const/types.d.ts +20 -2
- package/dist/types/assets/scripts/notification/messageTemplate.d.ts +14 -0
- package/dist/types/assets/scripts/notification/utils.d.ts +19 -2
- package/dist/types/src/components/overlays/notification/MessageNotificationParts.d.ts +27 -0
- package/dist/types/src/components/overlays/notification/Notification.d.ts +3 -2
- package/dist/types/src/components/overlays/notification/__tests__/MessageNotification.test.d.ts +1 -0
- package/dist/ui-admin/assets/styles/style.css +20 -21
- package/dist/ui-admin/assets/styles/style.scoped.css +20 -21
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ exports.MessageNotification = void 0;
|
|
|
7
7
|
var _featuredIcon = require("../featuredIcon");
|
|
8
8
|
var _sanitize = require("../utils/sanitize");
|
|
9
9
|
var _const = require("./const");
|
|
10
|
+
var _messageTemplate = require("./messageTemplate");
|
|
10
11
|
var _utils = require("./utils");
|
|
11
12
|
class MessageNotification {
|
|
12
13
|
constructor(options) {
|
|
@@ -47,11 +48,14 @@ class MessageNotification {
|
|
|
47
48
|
svgString: iconSvg,
|
|
48
49
|
theme: 'light-circle',
|
|
49
50
|
color: actualColor,
|
|
50
|
-
size: _const.MESSAGE_SIZES.FEATURED_ICON
|
|
51
|
+
size: _const.MESSAGE_SIZES.FEATURED_ICON,
|
|
52
|
+
// React 구현과 동일하게 `__icon`(flex-shrink: 0)을 부여한다.
|
|
53
|
+
// 누락 시 긴 타이틀에서 아이콘이 찌그러진다.
|
|
54
|
+
className: _const.CLASS_NAMES.MESSAGE.ICON
|
|
51
55
|
});
|
|
52
56
|
featuredIconElement = this.featuredIcon.getElement();
|
|
53
57
|
}
|
|
54
|
-
wrapper.innerHTML = (0, _sanitize.sanitizeHtml)(
|
|
58
|
+
wrapper.innerHTML = (0, _sanitize.sanitizeHtml)((0, _messageTemplate.buildMessageTemplate)({
|
|
55
59
|
title,
|
|
56
60
|
supportingText,
|
|
57
61
|
actions,
|
|
@@ -67,50 +71,6 @@ class MessageNotification {
|
|
|
67
71
|
}
|
|
68
72
|
return wrapper;
|
|
69
73
|
}
|
|
70
|
-
buildTemplate(params) {
|
|
71
|
-
const {
|
|
72
|
-
title,
|
|
73
|
-
supportingText,
|
|
74
|
-
actions,
|
|
75
|
-
onClose,
|
|
76
|
-
onHidePermanently
|
|
77
|
-
} = params;
|
|
78
|
-
return `
|
|
79
|
-
<div class="${_const.CLASS_NAMES.MESSAGE.CONTAINER}">
|
|
80
|
-
<div class="${_const.CLASS_NAMES.MESSAGE.CONTENT}">
|
|
81
|
-
<div class="${_const.CLASS_NAMES.MESSAGE.CONTENT_WRAPPER}">
|
|
82
|
-
<div class="${_const.CLASS_NAMES.MESSAGE.TEXT_CONTAINER}">
|
|
83
|
-
<span class="${_const.CLASS_NAMES.MESSAGE.TITLE}">${title}</span>
|
|
84
|
-
${(0, _utils.renderSupportingText)(supportingText, _const.CLASS_NAMES.MESSAGE.SUPPORTING_TEXT)}
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
<div class="${_const.CLASS_NAMES.MESSAGE.ACTIONS_CONTAINER}">
|
|
88
|
-
${actions && actions.length > 0 ? (0, _utils.renderActions)(actions, _const.CLASS_NAMES.MESSAGE.ACTIONS) : ''}
|
|
89
|
-
</div>
|
|
90
|
-
<div class="${_const.CLASS_NAMES.MESSAGE.ACTIONS_CONTAINER}">
|
|
91
|
-
${this.renderHidePermanentlyButton(onHidePermanently)}
|
|
92
|
-
${this.renderCloseButton(onClose)}
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
`;
|
|
97
|
-
}
|
|
98
|
-
renderHidePermanentlyButton(onHidePermanently) {
|
|
99
|
-
if (!onHidePermanently) return '';
|
|
100
|
-
return `
|
|
101
|
-
<button type="button" class="${_const.CLASS_NAMES.COMMON.ACTION_BUTTON} ${_const.CLASS_NAMES.COMMON.ACTION_BUTTON}--text ${_const.CLASS_NAMES.MESSAGE.HIDE_LINK}" data-hide-permanently="true">
|
|
102
|
-
다시 보지 않기
|
|
103
|
-
</button>
|
|
104
|
-
`;
|
|
105
|
-
}
|
|
106
|
-
renderCloseButton(onClose) {
|
|
107
|
-
if (!onClose) return '';
|
|
108
|
-
return `
|
|
109
|
-
<button type="button" class="${_const.CLASS_NAMES.MESSAGE.CLOSE_BUTTON}" aria-label="알림 닫기">
|
|
110
|
-
${_const.SVG_ICONS['x-close'](_const.MESSAGE_SIZES.CLOSE_BUTTON).replace('stroke="currentColor"', `stroke="#2F2F30"`)}
|
|
111
|
-
</button>
|
|
112
|
-
`;
|
|
113
|
-
}
|
|
114
74
|
bindEvents() {
|
|
115
75
|
(0, _utils.bindNotificationEvents)(this.element, this.options.actions, this.options.onClose, () => this.remove());
|
|
116
76
|
// 다시보지 않기 버튼 이벤트 바인딩
|
|
@@ -41,6 +41,9 @@ const CLASS_NAMES = exports.CLASS_NAMES = {
|
|
|
41
41
|
SUPPORTING_TEXT: 'ncua-message-notification__supporting-text',
|
|
42
42
|
ACTIONS_CONTAINER: 'ncua-message-notification__actions-container',
|
|
43
43
|
ACTIONS: 'ncua-message-notification__actions',
|
|
44
|
+
// 다시 보지 않기 + 닫기 그룹 전용 래퍼. ACTIONS_CONTAINER를 재사용하면
|
|
45
|
+
// 해당 클래스의 gap(12px)이 그룹 내부에도 적용되어 8px 규격이 깨진다.
|
|
46
|
+
FOOTER_CONTAINER: 'ncua-message-notification__footer-container',
|
|
44
47
|
HIDE_LINK: 'ncua-message-notification__hide-link',
|
|
45
48
|
CLOSE_BUTTON: 'ncua-message-notification__close-button'
|
|
46
49
|
},
|
|
@@ -81,7 +81,7 @@ Object.defineProperty(exports, "getSizes", {
|
|
|
81
81
|
return _sizes.getSizes;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
var _icons = require("./icons");
|
|
85
84
|
var _classNames = require("./classNames");
|
|
85
|
+
var _icons = require("./icons");
|
|
86
86
|
var _sizes = require("./sizes");
|
|
87
87
|
var _types = require("./types");
|
|
@@ -32,9 +32,11 @@ const FULL_WIDTH_SIZES = exports.FULL_WIDTH_SIZES = {
|
|
|
32
32
|
CLOSE_BUTTON: '20'
|
|
33
33
|
};
|
|
34
34
|
// Message 알림 고정 사이즈
|
|
35
|
+
// FEATURED_ICON(원 크기)과 ICON_PIXEL(내부 SVG 크기)은 항상 짝을 맞춰야 한다.
|
|
36
|
+
// 'md' = 40px 원 / 20px 아이콘 (FeaturedIcon iconSizeMap 기준)
|
|
35
37
|
const MESSAGE_SIZES = exports.MESSAGE_SIZES = {
|
|
36
|
-
FEATURED_ICON: '
|
|
37
|
-
ICON_PIXEL: '
|
|
38
|
+
FEATURED_ICON: 'md',
|
|
39
|
+
ICON_PIXEL: '20',
|
|
38
40
|
CLOSE_BUTTON: '20'
|
|
39
41
|
};
|
|
40
42
|
// 사이즈 유틸리티 함수들
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildMessageTemplate = buildMessageTemplate;
|
|
7
|
+
var _const = require("./const");
|
|
8
|
+
var _utils = require("./utils");
|
|
9
|
+
/**
|
|
10
|
+
* message 타입 액션 버튼 사이즈. TO-BE 규격 28px이며 React `<Button size="xs">`와 같다.
|
|
11
|
+
* floating / full-width는 이 값을 쓰지 않고 `renderActions`의 기본값('sm')을 유지한다.
|
|
12
|
+
*/
|
|
13
|
+
const ACTION_BUTTON_SIZE = 'xs';
|
|
14
|
+
/**
|
|
15
|
+
* Message Notification의 마크업을 만든다.
|
|
16
|
+
* React 구현(`src/components/overlays/notification/MessageNotification.tsx`)과
|
|
17
|
+
* 동일한 클래스 트리를 산출해야 한다 — SCSS 한 벌을 두 구현이 공유한다.
|
|
18
|
+
*/
|
|
19
|
+
function buildMessageTemplate(params) {
|
|
20
|
+
const {
|
|
21
|
+
title,
|
|
22
|
+
supportingText,
|
|
23
|
+
actions,
|
|
24
|
+
onClose,
|
|
25
|
+
onHidePermanently
|
|
26
|
+
} = params;
|
|
27
|
+
return `
|
|
28
|
+
<div class="${_const.CLASS_NAMES.MESSAGE.CONTAINER}">
|
|
29
|
+
<div class="${_const.CLASS_NAMES.MESSAGE.CONTENT}">
|
|
30
|
+
<div class="${_const.CLASS_NAMES.MESSAGE.CONTENT_WRAPPER}">
|
|
31
|
+
<div class="${_const.CLASS_NAMES.MESSAGE.TEXT_CONTAINER}">
|
|
32
|
+
<span class="${_const.CLASS_NAMES.MESSAGE.TITLE}">${title}</span>
|
|
33
|
+
${(0, _utils.renderSupportingText)(supportingText, _const.CLASS_NAMES.MESSAGE.SUPPORTING_TEXT)}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
${renderActionsContainer(actions, onClose, onHidePermanently)}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 액션 버튼 그룹과 닫기 그룹을 함께 감싸는 우측 영역.
|
|
43
|
+
* 이 컨테이너의 gap(12px)이 두 그룹 사이 간격을 만든다.
|
|
44
|
+
* 표시할 요소가 하나도 없으면 빈 컨테이너를 남기지 않는다.
|
|
45
|
+
*/
|
|
46
|
+
function renderActionsContainer(actions, onClose, onHidePermanently) {
|
|
47
|
+
const actionsHtml = (0, _utils.renderActions)(actions ?? [], _const.CLASS_NAMES.MESSAGE.ACTIONS, ACTION_BUTTON_SIZE);
|
|
48
|
+
const footerHtml = renderFooterContainer(onClose, onHidePermanently);
|
|
49
|
+
if (!actionsHtml && !footerHtml) return '';
|
|
50
|
+
return `<div class="${_const.CLASS_NAMES.MESSAGE.ACTIONS_CONTAINER}">${actionsHtml}${footerHtml}</div>`;
|
|
51
|
+
}
|
|
52
|
+
/** 다시 보지 않기 + 닫기 그룹. 전용 래퍼를 쓰는 이유는 `CLASS_NAMES.MESSAGE.FOOTER_CONTAINER` 참조. */
|
|
53
|
+
function renderFooterContainer(onClose, onHidePermanently) {
|
|
54
|
+
if (!onHidePermanently && !onClose) return '';
|
|
55
|
+
return `
|
|
56
|
+
<div class="${_const.CLASS_NAMES.MESSAGE.FOOTER_CONTAINER}">
|
|
57
|
+
${renderHidePermanentlyButton(onHidePermanently)}
|
|
58
|
+
${renderCloseButton(onClose)}
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
function renderHidePermanentlyButton(onHidePermanently) {
|
|
63
|
+
if (!onHidePermanently) return '';
|
|
64
|
+
return `
|
|
65
|
+
<button type="button" class="${_const.CLASS_NAMES.COMMON.ACTION_BUTTON} ${_const.CLASS_NAMES.MESSAGE.HIDE_LINK}" data-hide-permanently="true">
|
|
66
|
+
다시 보지 않기
|
|
67
|
+
</button>
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
function renderCloseButton(onClose) {
|
|
71
|
+
if (!onClose) return '';
|
|
72
|
+
return `
|
|
73
|
+
<button type="button" class="${_const.CLASS_NAMES.MESSAGE.CLOSE_BUTTON}" aria-label="알림 닫기">
|
|
74
|
+
${_const.SVG_ICONS['x-close'](_const.MESSAGE_SIZES.CLOSE_BUTTON).replace('stroke="currentColor"', 'stroke="#2F2F30"')}
|
|
75
|
+
</button>
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
@@ -9,6 +9,7 @@ exports.createWrapperElement = createWrapperElement;
|
|
|
9
9
|
exports.isMobile = void 0;
|
|
10
10
|
exports.renderActions = renderActions;
|
|
11
11
|
exports.renderSupportingText = renderSupportingText;
|
|
12
|
+
exports.resolveActionHierarchy = resolveActionHierarchy;
|
|
12
13
|
exports.setupAutoClose = setupAutoClose;
|
|
13
14
|
var _breakpoint = require("../../../src/constant/breakpoint");
|
|
14
15
|
var _const = require("./const");
|
|
@@ -57,16 +58,51 @@ function renderSupportingText(supportingText, className, supportTextLink) {
|
|
|
57
58
|
// unsafe URL이거나 link가 없으면 링크 없이 텍스트만 렌더링
|
|
58
59
|
return `<span class="${className}">${supportingText}</span>`;
|
|
59
60
|
}
|
|
61
|
+
/** 액션 버튼 색상을 지정하지 않았을 때의 기본값. React `MessageNotificationParts`와 같다. */
|
|
62
|
+
const DEFAULT_ACTION_HIERARCHY = 'text';
|
|
63
|
+
/**
|
|
64
|
+
* 액션 버튼의 색상 수식자를 현행 어휘로 정규화한다.
|
|
65
|
+
*
|
|
66
|
+
* 구 어휘(`'link'` / `'link-gray'`)는 Link 컴포넌트의 색상 이름을 빌려 쓴 것이라
|
|
67
|
+
* `ncua-btn--link`에 대응하는 CSS가 존재하지 않았다. 기존 CDN 사용처를 깨지 않기 위해
|
|
68
|
+
* 타입에서 제거하는 대신 이 지점에서 실제 Button 테마로 매핑한다.
|
|
69
|
+
*
|
|
70
|
+
* 렌더(`renderActions`)와 이벤트 바인딩(`bindNotificationEvents`)이 이 함수를 함께 써야
|
|
71
|
+
* `data-action` 키가 어긋나지 않는다.
|
|
72
|
+
*/
|
|
73
|
+
function resolveActionHierarchy(hierarchy) {
|
|
74
|
+
switch (hierarchy) {
|
|
75
|
+
case undefined:
|
|
76
|
+
return DEFAULT_ACTION_HIERARCHY;
|
|
77
|
+
case 'link':
|
|
78
|
+
return 'text';
|
|
79
|
+
case 'link-gray':
|
|
80
|
+
return 'text-gray';
|
|
81
|
+
default:
|
|
82
|
+
return hierarchy;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** 액션 버튼의 클릭 라우팅 키. 렌더와 바인딩이 같은 규칙으로 만들어야 한다. */
|
|
86
|
+
function buildActionKey(action) {
|
|
87
|
+
return `${action.label}-${resolveActionHierarchy(action.hierarchy)}`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 액션 버튼 그룹 HTML을 만든다.
|
|
91
|
+
*
|
|
92
|
+
* `size` 기본값 'sm'은 floating / full-width 타입의 기존 렌더링을 그대로 보존하기 위한 것이다.
|
|
93
|
+
* message 타입만 TO-BE 규격(28px)에 맞춰 'xs'를 넘긴다 — React `<Button size="xs">`와 동일.
|
|
94
|
+
*/
|
|
60
95
|
function renderActions(actions, wrapperClass) {
|
|
96
|
+
let size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'sm';
|
|
61
97
|
// 액션이 없으면 빈 문자열 반환
|
|
62
98
|
if (!actions || actions.length === 0) {
|
|
63
99
|
return '';
|
|
64
100
|
}
|
|
65
101
|
const buttonsHtml = actions.map(action => {
|
|
66
102
|
const buttonHtml = `
|
|
67
|
-
<button
|
|
68
|
-
class="ncua-btn ncua-btn
|
|
69
|
-
data-action="${action
|
|
103
|
+
<button
|
|
104
|
+
class="ncua-btn ncua-btn--${size} ncua-btn--${resolveActionHierarchy(action.hierarchy)}"
|
|
105
|
+
data-action="${buildActionKey(action)}"
|
|
70
106
|
>
|
|
71
107
|
${action.label}
|
|
72
108
|
</button>`;
|
|
@@ -92,7 +128,7 @@ function bindNotificationEvents(element, actions, onClose, onRemove) {
|
|
|
92
128
|
if (actionData) {
|
|
93
129
|
let matchedAction = null;
|
|
94
130
|
for (const action of actions) {
|
|
95
|
-
const expectedDataAction =
|
|
131
|
+
const expectedDataAction = buildActionKey(action);
|
|
96
132
|
if (actionData === expectedDataAction) {
|
|
97
133
|
matchedAction = action;
|
|
98
134
|
break;
|
|
@@ -9,8 +9,7 @@ var _uiAdminIcon = require("@ncds/ui-admin-icon");
|
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _color = require("../../../../constant/color");
|
|
12
|
-
var
|
|
13
|
-
var _FeaturedIcon = require("../../image-and-icons/featured-icon/FeaturedIcon");
|
|
12
|
+
var _MessageNotificationParts = require("./MessageNotificationParts");
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
14
|
const iconMap = {
|
|
16
15
|
neutral: _uiAdminIcon.Pin02,
|
|
@@ -38,14 +37,6 @@ const MessageNotification = exports.MessageNotification = /*#__PURE__*/(0, _reac
|
|
|
38
37
|
} = _ref;
|
|
39
38
|
// message 타입은 neutral, error, warning, success 4가지 색상만 지원
|
|
40
39
|
const validColor = color === 'info' ? 'neutral' : color;
|
|
41
|
-
const iconColor = validColor;
|
|
42
|
-
const featuredIconProps = {
|
|
43
|
-
icon: Icon || iconMap[validColor] || _uiAdminIcon.Pin02,
|
|
44
|
-
size: 'lg',
|
|
45
|
-
color: iconColor,
|
|
46
|
-
theme: 'light-circle'
|
|
47
|
-
};
|
|
48
|
-
const closeIconColor = _color.COLOR[iconColorMap[validColor] || 'gray700'];
|
|
49
40
|
return (0, _jsxRuntime.jsx)("div", {
|
|
50
41
|
ref: ref,
|
|
51
42
|
className: (0, _classnames.default)('ncua-message-notification', `ncua-message-notification--${validColor}`, className),
|
|
@@ -55,50 +46,17 @@ const MessageNotification = exports.MessageNotification = /*#__PURE__*/(0, _reac
|
|
|
55
46
|
className: "ncua-message-notification__container",
|
|
56
47
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
57
48
|
className: "ncua-message-notification__content",
|
|
58
|
-
children: [(0, _jsxRuntime.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
className: "ncua-message-notification__supporting-text",
|
|
70
|
-
children: supportingText
|
|
71
|
-
})]
|
|
72
|
-
})]
|
|
73
|
-
}), (0, _jsxRuntime.jsx)("div", {
|
|
74
|
-
className: "ncua-message-notification__actions-container",
|
|
75
|
-
children: actions && (0, _jsxRuntime.jsx)("div", {
|
|
76
|
-
className: "ncua-message-notification__actions",
|
|
77
|
-
children: actions.map(action => (0, _jsxRuntime.jsx)(_button.Button, {
|
|
78
|
-
size: "xs",
|
|
79
|
-
hierarchy: action.hierarchy || 'text',
|
|
80
|
-
label: action.label,
|
|
81
|
-
onClick: action?.onClick
|
|
82
|
-
}, `${action.label}-${action.hierarchy}`))
|
|
83
|
-
})
|
|
84
|
-
}), (0, _jsxRuntime.jsxs)("div", {
|
|
85
|
-
className: "ncua-message-notification__footer-container",
|
|
86
|
-
children: [onHidePermanently && (0, _jsxRuntime.jsx)("button", {
|
|
87
|
-
type: "button",
|
|
88
|
-
className: (0, _classnames.default)('ncua-notification__action-button', 'ncua-notification__action-button--link', 'ncua-message-notification__hide-link'),
|
|
89
|
-
onClick: onHidePermanently,
|
|
90
|
-
children: "\uB2E4\uC2DC \uBCF4\uC9C0 \uC54A\uAE30"
|
|
91
|
-
}), onClose && (0, _jsxRuntime.jsx)("button", {
|
|
92
|
-
type: "button",
|
|
93
|
-
className: "ncua-message-notification__close-button",
|
|
94
|
-
onClick: onClose,
|
|
95
|
-
"aria-label": "\uC54C\uB9BC \uB2EB\uAE30",
|
|
96
|
-
children: (0, _jsxRuntime.jsx)(_uiAdminIcon.XClose, {
|
|
97
|
-
width: 20,
|
|
98
|
-
height: 20,
|
|
99
|
-
color: closeIconColor
|
|
100
|
-
})
|
|
101
|
-
})]
|
|
49
|
+
children: [(0, _jsxRuntime.jsx)(_MessageNotificationParts.MessageNotificationContent, {
|
|
50
|
+
title: title,
|
|
51
|
+
supportingText: supportingText,
|
|
52
|
+
icon: Icon || iconMap[validColor],
|
|
53
|
+
iconColor: validColor,
|
|
54
|
+
showIcon: Boolean(iconMap[validColor])
|
|
55
|
+
}), (0, _jsxRuntime.jsx)(_MessageNotificationParts.MessageNotificationActions, {
|
|
56
|
+
actions: actions,
|
|
57
|
+
onClose: onClose,
|
|
58
|
+
onHidePermanently: onHidePermanently,
|
|
59
|
+
closeIconColor: _color.COLOR[iconColorMap[validColor] || 'gray700']
|
|
102
60
|
})]
|
|
103
61
|
})
|
|
104
62
|
})
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MessageNotificationContent = exports.MessageNotificationActions = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _uiAdminIcon = require("@ncds/ui-admin-icon");
|
|
9
|
+
var _button = require("../../action/button");
|
|
10
|
+
var _FeaturedIcon = require("../../image-and-icons/featured-icon/FeaturedIcon");
|
|
11
|
+
/** 아이콘 + 제목/서포팅 텍스트 영역. */
|
|
12
|
+
const MessageNotificationContent = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
title,
|
|
15
|
+
supportingText,
|
|
16
|
+
icon,
|
|
17
|
+
iconColor,
|
|
18
|
+
showIcon
|
|
19
|
+
} = _ref;
|
|
20
|
+
const featuredIconProps = {
|
|
21
|
+
icon: icon || _uiAdminIcon.Pin02,
|
|
22
|
+
size: 'md',
|
|
23
|
+
color: iconColor,
|
|
24
|
+
theme: 'light-circle'
|
|
25
|
+
};
|
|
26
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
27
|
+
className: "ncua-message-notification__content-wrapper",
|
|
28
|
+
children: [showIcon && (0, _jsxRuntime.jsx)(_FeaturedIcon.FeaturedIcon, {
|
|
29
|
+
...featuredIconProps,
|
|
30
|
+
className: "ncua-message-notification__icon"
|
|
31
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
32
|
+
className: "ncua-message-notification__text-container",
|
|
33
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
|
34
|
+
className: "ncua-message-notification__title",
|
|
35
|
+
children: title
|
|
36
|
+
}), supportingText && (0, _jsxRuntime.jsx)("span", {
|
|
37
|
+
className: "ncua-message-notification__supporting-text",
|
|
38
|
+
children: supportingText
|
|
39
|
+
})]
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 액션 버튼 그룹 + 닫기 그룹을 감싸는 우측 영역.
|
|
45
|
+
* 이 컨테이너의 gap(12px)이 두 그룹 사이 간격을 만든다.
|
|
46
|
+
* 표시할 요소가 하나도 없으면 빈 컨테이너를 남기지 않는다.
|
|
47
|
+
*/
|
|
48
|
+
exports.MessageNotificationContent = MessageNotificationContent;
|
|
49
|
+
const MessageNotificationActions = _ref2 => {
|
|
50
|
+
let {
|
|
51
|
+
actions,
|
|
52
|
+
onClose,
|
|
53
|
+
onHidePermanently,
|
|
54
|
+
closeIconColor
|
|
55
|
+
} = _ref2;
|
|
56
|
+
const hasActions = Boolean(actions?.length);
|
|
57
|
+
const hasFooter = Boolean(onHidePermanently || onClose);
|
|
58
|
+
if (!hasActions && !hasFooter) return null;
|
|
59
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
60
|
+
className: "ncua-message-notification__actions-container",
|
|
61
|
+
children: [hasActions && (0, _jsxRuntime.jsx)("div", {
|
|
62
|
+
className: "ncua-message-notification__actions",
|
|
63
|
+
children: actions?.map(action => (0, _jsxRuntime.jsx)(_button.Button, {
|
|
64
|
+
size: "xs",
|
|
65
|
+
hierarchy: action.hierarchy || 'text',
|
|
66
|
+
label: action.label,
|
|
67
|
+
onClick: action?.onClick
|
|
68
|
+
}, `${action.label}-${action.hierarchy}`))
|
|
69
|
+
}), hasFooter && (0, _jsxRuntime.jsxs)("div", {
|
|
70
|
+
className: "ncua-message-notification__footer-container",
|
|
71
|
+
children: [onHidePermanently && (0, _jsxRuntime.jsx)("button", {
|
|
72
|
+
type: "button",
|
|
73
|
+
className: "ncua-notification__action-button ncua-message-notification__hide-link",
|
|
74
|
+
onClick: onHidePermanently,
|
|
75
|
+
children: "\uB2E4\uC2DC \uBCF4\uC9C0 \uC54A\uAE30"
|
|
76
|
+
}), onClose && (0, _jsxRuntime.jsx)("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
className: "ncua-message-notification__close-button",
|
|
79
|
+
onClick: onClose,
|
|
80
|
+
"aria-label": "\uC54C\uB9BC \uB2EB\uAE30",
|
|
81
|
+
children: (0, _jsxRuntime.jsx)(_uiAdminIcon.XClose, {
|
|
82
|
+
width: 20,
|
|
83
|
+
height: 20,
|
|
84
|
+
color: closeIconColor
|
|
85
|
+
})
|
|
86
|
+
})]
|
|
87
|
+
})]
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
exports.MessageNotificationActions = MessageNotificationActions;
|