@ncds/ui-admin 0.0.22 → 0.0.23
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/index.js +11 -0
- package/dist/cjs/assets/scripts/slider.js +341 -0
- package/dist/cjs/index.js +0 -33
- package/dist/cjs/src/components/button/Button.js +15 -7
- package/dist/cjs/src/components/button/ButtonGroup.js +1 -1
- package/dist/cjs/src/components/date-picker/index.js +0 -11
- package/dist/cjs/src/components/divider/Divider.js +43 -0
- package/dist/cjs/src/components/divider/index.js +16 -0
- package/dist/cjs/src/components/empty-state/EmptyState.js +58 -0
- package/dist/cjs/src/components/empty-state/index.js +16 -0
- package/dist/cjs/src/components/featured-icon/FeaturedIcon.js +79 -0
- package/dist/cjs/src/components/featured-icon/index.js +16 -0
- package/dist/cjs/src/components/index.js +81 -4
- package/dist/cjs/src/components/modal/Modal.js +193 -0
- package/dist/cjs/src/components/modal/index.js +12 -0
- package/dist/cjs/src/components/notification/FloatingNotification.js +104 -0
- package/dist/cjs/src/components/notification/FullWidthNotification.js +112 -0
- package/dist/cjs/src/components/notification/Notification.js +66 -0
- package/dist/cjs/src/components/notification/index.js +38 -0
- package/dist/cjs/src/components/pagination/NavButton.js +6 -4
- package/dist/cjs/src/components/pagination/Pagination.js +4 -19
- package/dist/cjs/src/components/progress-bar/ProgressBar.js +57 -0
- package/dist/cjs/src/components/progress-bar/index.js +16 -0
- package/dist/cjs/src/components/progress-circle/ProgressCircle.js +121 -0
- package/dist/cjs/src/components/progress-circle/index.js +16 -0
- package/dist/cjs/src/components/slider/Slider.js +64 -0
- package/dist/cjs/src/components/slider/index.js +16 -0
- package/dist/cjs/src/components/tab/HorizontalTab.js +77 -0
- package/dist/cjs/src/components/tab/TabButton.js +76 -0
- package/dist/cjs/src/components/tab/VerticalTab.js +75 -0
- package/dist/cjs/src/components/tab/index.js +38 -0
- package/dist/esm/assets/scripts/index.js +2 -1
- package/dist/esm/assets/scripts/slider.js +336 -0
- package/dist/esm/index.js +0 -3
- package/dist/esm/src/components/button/Button.js +14 -6
- package/dist/esm/src/components/button/ButtonGroup.js +1 -1
- package/dist/esm/src/components/date-picker/index.js +1 -2
- package/dist/esm/src/components/divider/Divider.js +36 -0
- package/dist/esm/src/components/divider/index.js +1 -0
- package/dist/esm/src/components/empty-state/EmptyState.js +51 -0
- package/dist/esm/src/components/empty-state/index.js +1 -0
- package/dist/esm/src/components/featured-icon/FeaturedIcon.js +72 -0
- package/dist/esm/src/components/featured-icon/index.js +1 -0
- package/dist/esm/src/components/index.js +8 -1
- package/dist/esm/src/components/modal/Modal.js +185 -0
- package/dist/esm/src/components/modal/index.js +1 -0
- package/dist/esm/src/components/notification/FloatingNotification.js +97 -0
- package/dist/esm/src/components/notification/FullWidthNotification.js +105 -0
- package/dist/esm/src/components/notification/Notification.js +59 -0
- package/dist/esm/src/components/notification/index.js +3 -0
- package/dist/esm/src/components/pagination/NavButton.js +6 -4
- package/dist/esm/src/components/pagination/Pagination.js +4 -19
- package/dist/esm/src/components/progress-bar/ProgressBar.js +50 -0
- package/dist/esm/src/components/progress-bar/index.js +1 -0
- package/dist/esm/src/components/progress-circle/ProgressCircle.js +114 -0
- package/dist/esm/src/components/progress-circle/index.js +1 -0
- package/dist/esm/src/components/slider/Slider.js +57 -0
- package/dist/esm/src/components/slider/index.js +1 -0
- package/dist/esm/src/components/tab/HorizontalTab.js +69 -0
- package/dist/esm/src/components/tab/TabButton.js +68 -0
- package/dist/esm/src/components/tab/VerticalTab.js +67 -0
- package/dist/esm/src/components/tab/index.js +3 -0
- package/dist/types/assets/scripts/index.d.ts +1 -0
- package/dist/types/assets/scripts/slider.d.ts +42 -0
- package/dist/types/index.d.ts +0 -3
- package/dist/types/src/components/button/Button.d.ts +2 -1
- package/dist/types/src/components/button/ButtonGroup.d.ts +6 -5
- package/dist/types/src/components/date-picker/index.d.ts +0 -1
- package/dist/types/src/components/divider/Divider.d.ts +11 -0
- package/dist/types/src/components/divider/index.d.ts +2 -0
- package/dist/types/src/components/empty-state/EmptyState.d.ts +14 -0
- package/dist/types/src/components/empty-state/index.d.ts +2 -0
- package/dist/types/src/components/featured-icon/FeaturedIcon.d.ts +14 -0
- package/dist/types/src/components/featured-icon/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts +8 -1
- package/dist/types/src/components/modal/Modal.d.ts +75 -0
- package/dist/types/src/components/modal/index.d.ts +3 -0
- package/dist/types/src/components/notification/FloatingNotification.d.ts +32 -0
- package/dist/types/src/components/notification/FullWidthNotification.d.ts +32 -0
- package/dist/types/src/components/notification/Notification.d.ts +59 -0
- package/dist/types/src/components/notification/index.d.ts +4 -0
- package/dist/types/src/components/pagination/NavButton.d.ts +2 -2
- package/dist/types/src/components/progress-bar/ProgressBar.d.ts +7 -0
- package/dist/types/src/components/progress-bar/index.d.ts +2 -0
- package/dist/types/src/components/progress-circle/ProgressCircle.d.ts +8 -0
- package/dist/types/src/components/progress-circle/index.d.ts +2 -0
- package/dist/types/src/components/slider/Slider.d.ts +15 -0
- package/dist/types/src/components/slider/index.d.ts +2 -0
- package/dist/types/src/components/tab/HorizontalTab.d.ts +12 -0
- package/dist/types/src/components/tab/TabButton.d.ts +26 -0
- package/dist/types/src/components/tab/VerticalTab.d.ts +10 -0
- package/dist/types/src/components/tab/index.d.ts +4 -0
- package/dist/ui-admin/assets/styles/style.css +1249 -97
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import Icon from '@ncds/ui-admin-icon';
|
|
21
|
+
import classNames from 'classnames';
|
|
22
|
+
import { forwardRef } from 'react';
|
|
23
|
+
import { COLOR } from '../../../constant/color';
|
|
24
|
+
var iconSizeMap = {
|
|
25
|
+
sm: 16,
|
|
26
|
+
md: 20,
|
|
27
|
+
lg: 24,
|
|
28
|
+
xl: 28
|
|
29
|
+
};
|
|
30
|
+
var iconStrokeColorMap = {
|
|
31
|
+
neutral: 'gray700',
|
|
32
|
+
error: 'red500',
|
|
33
|
+
warning: 'orange500',
|
|
34
|
+
success: 'green600'
|
|
35
|
+
};
|
|
36
|
+
export var FeaturedIcon = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
37
|
+
var name = _a.name,
|
|
38
|
+
_b = _a.theme,
|
|
39
|
+
theme = _b === void 0 ? 'light-circle' : _b,
|
|
40
|
+
_c = _a.color,
|
|
41
|
+
color = _c === void 0 ? 'neutral' : _c,
|
|
42
|
+
_d = _a.size,
|
|
43
|
+
size = _d === void 0 ? 'md' : _d,
|
|
44
|
+
className = _a.className,
|
|
45
|
+
rest = __rest(_a, ["name", "theme", "color", "size", "className"]);
|
|
46
|
+
var getIconColor = function () {
|
|
47
|
+
if (theme === 'dark-circle') {
|
|
48
|
+
return 'white';
|
|
49
|
+
}
|
|
50
|
+
if (theme === 'square-outline') {
|
|
51
|
+
return 'gray700';
|
|
52
|
+
}
|
|
53
|
+
return iconStrokeColorMap[color];
|
|
54
|
+
};
|
|
55
|
+
return _jsxs("div", __assign({
|
|
56
|
+
ref: ref,
|
|
57
|
+
className: classNames('ncua-featured-icon', "ncua-featured-icon--".concat(theme), "ncua-featured-icon--".concat(color), "ncua-featured-icon--".concat(size), className)
|
|
58
|
+
}, rest, {
|
|
59
|
+
children: [theme === 'outline-circle' && _jsxs(_Fragment, {
|
|
60
|
+
children: [_jsx("div", {
|
|
61
|
+
className: "ncua-featured-icon__outline ncua-featured-icon__outline--inner"
|
|
62
|
+
}), _jsx("div", {
|
|
63
|
+
className: "ncua-featured-icon__outline ncua-featured-icon__outline--outer"
|
|
64
|
+
})]
|
|
65
|
+
}), _jsx(Icon, {
|
|
66
|
+
name: name,
|
|
67
|
+
width: iconSizeMap[size],
|
|
68
|
+
height: iconSizeMap[size],
|
|
69
|
+
color: COLOR[getIconColor()]
|
|
70
|
+
})]
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FeaturedIcon';
|
|
@@ -4,13 +4,20 @@ export * from './button';
|
|
|
4
4
|
export * from './carousel';
|
|
5
5
|
export * from './checkbox';
|
|
6
6
|
export * from './date-picker';
|
|
7
|
-
export * from './
|
|
7
|
+
export * from './featured-icon';
|
|
8
|
+
export * from './divider';
|
|
9
|
+
export * from './empty-state';
|
|
8
10
|
export * from './input';
|
|
11
|
+
export * from './modal';
|
|
12
|
+
export * from './notification';
|
|
9
13
|
export * from './pagination';
|
|
14
|
+
export * from './progress-bar';
|
|
15
|
+
export * from './progress-circle';
|
|
10
16
|
export * from './radio';
|
|
11
17
|
export * from './select';
|
|
12
18
|
export * from './shared';
|
|
13
19
|
export * from './spinner';
|
|
20
|
+
export * from './tab';
|
|
14
21
|
export * from './tag';
|
|
15
22
|
export * from './toggle';
|
|
16
23
|
export * from './tooltip';
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
+
import classnames from 'classnames';
|
|
21
|
+
import { useEffect, useRef } from 'react';
|
|
22
|
+
import ReactDOM from 'react-dom';
|
|
23
|
+
import { FeaturedIcon } from '../featured-icon';
|
|
24
|
+
import Icon from '@ncds/ui-admin-icon';
|
|
25
|
+
export var Modal = function (_a) {
|
|
26
|
+
var isOpen = _a.isOpen,
|
|
27
|
+
onClose = _a.onClose,
|
|
28
|
+
children = _a.children,
|
|
29
|
+
_b = _a.size,
|
|
30
|
+
size = _b === void 0 ? 'md' : _b,
|
|
31
|
+
_c = _a.closeOnBackdropClick,
|
|
32
|
+
closeOnBackdropClick = _c === void 0 ? true : _c,
|
|
33
|
+
_d = _a.closeOnEsc,
|
|
34
|
+
closeOnEsc = _d === void 0 ? true : _d,
|
|
35
|
+
className = _a.className,
|
|
36
|
+
restProps = __rest(_a, ["isOpen", "onClose", "children", "size", "closeOnBackdropClick", "closeOnEsc", "className"]);
|
|
37
|
+
var modalRef = useRef(null);
|
|
38
|
+
var handleBackdropClick = function (e) {
|
|
39
|
+
if (closeOnBackdropClick && e.target === e.currentTarget) {
|
|
40
|
+
onClose();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
var handleKeyDown = function (e) {
|
|
45
|
+
if (isOpen && closeOnEsc && e.key === 'Escape') {
|
|
46
|
+
onClose();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
if (isOpen) {
|
|
50
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
51
|
+
document.body.style.overflow = 'hidden';
|
|
52
|
+
}
|
|
53
|
+
return function () {
|
|
54
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
55
|
+
document.body.style.overflow = '';
|
|
56
|
+
};
|
|
57
|
+
}, [isOpen, closeOnEsc, onClose]);
|
|
58
|
+
if (!isOpen) return null;
|
|
59
|
+
var modalContent = _jsx("div", __assign({
|
|
60
|
+
className: classnames('ncua-modal-backdrop', className),
|
|
61
|
+
onClick: handleBackdropClick,
|
|
62
|
+
ref: modalRef
|
|
63
|
+
}, restProps, {
|
|
64
|
+
children: _jsx("div", __assign({
|
|
65
|
+
className: classnames('ncua-modal', "ncua-modal--".concat(size))
|
|
66
|
+
}, {
|
|
67
|
+
children: children
|
|
68
|
+
}))
|
|
69
|
+
}));
|
|
70
|
+
return /*#__PURE__*/ReactDOM.createPortal(modalContent, document.body);
|
|
71
|
+
};
|
|
72
|
+
Modal.Header = function (_a) {
|
|
73
|
+
var children = _a.children,
|
|
74
|
+
onClose = _a.onClose,
|
|
75
|
+
featuredIcon = _a.featuredIcon,
|
|
76
|
+
title = _a.title,
|
|
77
|
+
subtitle = _a.subtitle,
|
|
78
|
+
_b = _a.align,
|
|
79
|
+
align = _b === void 0 ? 'left' : _b,
|
|
80
|
+
_c = _a.showDivider,
|
|
81
|
+
showDivider = _c === void 0 ? false : _c,
|
|
82
|
+
_d = _a.hideCloseButton,
|
|
83
|
+
hideCloseButton = _d === void 0 ? false : _d;
|
|
84
|
+
return _jsxs(_Fragment, {
|
|
85
|
+
children: [_jsxs("header", __assign({
|
|
86
|
+
className: classnames('ncua-modal__header', "ncua-modal__header--".concat(align))
|
|
87
|
+
}, {
|
|
88
|
+
children: [featuredIcon && _jsx(FeaturedIcon, {
|
|
89
|
+
name: featuredIcon.name,
|
|
90
|
+
color: featuredIcon.color,
|
|
91
|
+
theme: featuredIcon.theme
|
|
92
|
+
}), _jsxs("div", __assign({
|
|
93
|
+
className: "ncua-modal__title"
|
|
94
|
+
}, {
|
|
95
|
+
children: [_jsx("div", __assign({
|
|
96
|
+
className: "ncua-modal__title-text"
|
|
97
|
+
}, {
|
|
98
|
+
children: title
|
|
99
|
+
})), subtitle && _jsx("div", __assign({
|
|
100
|
+
className: "ncua-modal__title-subtitle"
|
|
101
|
+
}, {
|
|
102
|
+
children: subtitle
|
|
103
|
+
}))]
|
|
104
|
+
})), children, !hideCloseButton && _jsx("button", __assign({
|
|
105
|
+
className: "ncua-modal__close-button",
|
|
106
|
+
onClick: onClose
|
|
107
|
+
}, {
|
|
108
|
+
children: _jsx(Icon, {
|
|
109
|
+
name: "x"
|
|
110
|
+
})
|
|
111
|
+
}))]
|
|
112
|
+
})), showDivider && _jsx("div", {
|
|
113
|
+
className: "ncua-modal__header-divider"
|
|
114
|
+
})]
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
Modal.Content = function (_a) {
|
|
118
|
+
var children = _a.children;
|
|
119
|
+
return _jsx("div", __assign({
|
|
120
|
+
className: "ncua-modal__content"
|
|
121
|
+
}, {
|
|
122
|
+
children: children
|
|
123
|
+
}));
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Modal.Actions - The actions area of the modal
|
|
127
|
+
*
|
|
128
|
+
* Examples:
|
|
129
|
+
*
|
|
130
|
+
* 1. Vertical layout (buttons stacked):
|
|
131
|
+
* <Modal.Actions layout="vertical" align="stretch">
|
|
132
|
+
* <Button label="Confirm" onClick={handleConfirm} hierarchy="primary" />
|
|
133
|
+
* <Button label="Cancel" onClick={handleCancel} hierarchy="secondary-gray" />
|
|
134
|
+
* </Modal.Actions>
|
|
135
|
+
*
|
|
136
|
+
* 2. Horizontal layout (buttons side by side):
|
|
137
|
+
* <Modal.Actions layout="horizontal" align="stretch">
|
|
138
|
+
* <Button label="Confirm" onClick={handleConfirm} hierarchy="primary" />
|
|
139
|
+
* <Button label="Cancel" onClick={handleCancel} hierarchy="secondary-gray" />
|
|
140
|
+
* </Modal.Actions>
|
|
141
|
+
*
|
|
142
|
+
* 3. Checkbox layout (checkbox on left, buttons on right):
|
|
143
|
+
* <Modal.Actions layout="checkbox" align="stretch" checkboxContent={
|
|
144
|
+
* <>
|
|
145
|
+
* <Checkbox text="Never show again" />
|
|
146
|
+
* <a href="#">Settings</a>
|
|
147
|
+
* </>
|
|
148
|
+
* }>
|
|
149
|
+
* <Button label="Cancel" onClick={handleCancel} hierarchy="secondary-gray" />
|
|
150
|
+
* <Button label="Confirm" onClick={handleConfirm} hierarchy="primary" />
|
|
151
|
+
* </Modal.Actions>
|
|
152
|
+
*/
|
|
153
|
+
Modal.Actions = function (_a) {
|
|
154
|
+
var children = _a.children,
|
|
155
|
+
_b = _a.layout,
|
|
156
|
+
layout = _b === void 0 ? 'vertical' : _b,
|
|
157
|
+
_c = _a.showDivider,
|
|
158
|
+
showDivider = _c === void 0 ? false : _c,
|
|
159
|
+
_d = _a.align,
|
|
160
|
+
align = _d === void 0 ? 'stretch' : _d,
|
|
161
|
+
checkboxContent = _a.checkboxContent;
|
|
162
|
+
return _jsxs(_Fragment, {
|
|
163
|
+
children: [showDivider && _jsx("div", {
|
|
164
|
+
className: "ncua-modal__actions-divider"
|
|
165
|
+
}), _jsxs("div", __assign({
|
|
166
|
+
className: classnames('ncua-modal__actions-wrapper', {
|
|
167
|
+
'ncua-modal__actions-wrapper--checkbox': layout === 'checkbox'
|
|
168
|
+
})
|
|
169
|
+
}, {
|
|
170
|
+
children: [layout === 'checkbox' && _jsx("div", __assign({
|
|
171
|
+
className: "ncua-modal__actions-checkbox"
|
|
172
|
+
}, {
|
|
173
|
+
children: _jsx("div", __assign({
|
|
174
|
+
className: "ncua-modal__actions-checkbox-content"
|
|
175
|
+
}, {
|
|
176
|
+
children: checkboxContent
|
|
177
|
+
}))
|
|
178
|
+
})), _jsx("div", __assign({
|
|
179
|
+
className: classnames('ncua-modal__actions', "ncua-modal__actions--".concat(layout), "ncua-modal__actions--".concat(align))
|
|
180
|
+
}, {
|
|
181
|
+
children: children
|
|
182
|
+
}))]
|
|
183
|
+
}))]
|
|
184
|
+
});
|
|
185
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Modal } from './Modal';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { FeaturedIcon } from '../featured-icon/FeaturedIcon';
|
|
21
|
+
import Icon from '@ncds/ui-admin-icon';
|
|
22
|
+
import classNames from 'classnames';
|
|
23
|
+
import { forwardRef } from 'react';
|
|
24
|
+
var iconNameMap = {
|
|
25
|
+
neutral: 'pin-02',
|
|
26
|
+
error: 'alert-triangle',
|
|
27
|
+
warning: 'alert-circle',
|
|
28
|
+
success: 'check-circle'
|
|
29
|
+
};
|
|
30
|
+
export var FloatingNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
31
|
+
var title = _a.title,
|
|
32
|
+
supportingText = _a.supportingText,
|
|
33
|
+
_b = _a.variant,
|
|
34
|
+
variant = _b === void 0 ? 'neutral' : _b,
|
|
35
|
+
onClose = _a.onClose,
|
|
36
|
+
className = _a.className,
|
|
37
|
+
actions = _a.actions,
|
|
38
|
+
rest = __rest(_a, ["title", "supportingText", "variant", "onClose", "className", "actions"]);
|
|
39
|
+
var iconColor = variant;
|
|
40
|
+
var featuredIconProps = {
|
|
41
|
+
name: iconNameMap[variant],
|
|
42
|
+
size: 'sm',
|
|
43
|
+
color: iconColor,
|
|
44
|
+
theme: 'dark-circle'
|
|
45
|
+
};
|
|
46
|
+
return _jsxs("div", __assign({
|
|
47
|
+
ref: ref,
|
|
48
|
+
className: classNames('ncua-floating-notification', "ncua-floating-notification--".concat(variant), className),
|
|
49
|
+
role: "alert"
|
|
50
|
+
}, rest, {
|
|
51
|
+
children: [_jsx("div", __assign({
|
|
52
|
+
className: "ncua-floating-notification__content"
|
|
53
|
+
}, {
|
|
54
|
+
children: _jsxs("div", __assign({
|
|
55
|
+
className: "ncua-floating-notification__container"
|
|
56
|
+
}, {
|
|
57
|
+
children: [iconNameMap[variant] && _jsxs(_Fragment, {
|
|
58
|
+
children: [_jsx(FeaturedIcon, __assign({}, featuredIconProps, {
|
|
59
|
+
className: "ncua-floating-notification__pc-icon"
|
|
60
|
+
})), _jsx(FeaturedIcon, __assign({}, featuredIconProps, {
|
|
61
|
+
size: "md",
|
|
62
|
+
className: "ncua-floating-notification__mobile-icon"
|
|
63
|
+
}))]
|
|
64
|
+
}), _jsxs("div", __assign({
|
|
65
|
+
className: "ncua-floating-notification__text-container"
|
|
66
|
+
}, {
|
|
67
|
+
children: [_jsx("div", __assign({
|
|
68
|
+
className: "ncua-floating-notification__title-wrapper"
|
|
69
|
+
}, {
|
|
70
|
+
children: _jsx("span", __assign({
|
|
71
|
+
className: "ncua-floating-notification__title"
|
|
72
|
+
}, {
|
|
73
|
+
children: title
|
|
74
|
+
}))
|
|
75
|
+
})), supportingText && _jsx("span", __assign({
|
|
76
|
+
className: "ncua-floating-notification__supporting-text"
|
|
77
|
+
}, {
|
|
78
|
+
children: supportingText
|
|
79
|
+
})), actions && _jsx("div", __assign({
|
|
80
|
+
className: "ncua-floating-notification__actions"
|
|
81
|
+
}, {
|
|
82
|
+
children: actions
|
|
83
|
+
}))]
|
|
84
|
+
}))]
|
|
85
|
+
}))
|
|
86
|
+
})), onClose && _jsx("button", __assign({
|
|
87
|
+
type: "button",
|
|
88
|
+
className: "ncua-floating-notification__close-button",
|
|
89
|
+
onClick: onClose,
|
|
90
|
+
"aria-label": "\uC54C\uB9BC \uB2EB\uAE30"
|
|
91
|
+
}, {
|
|
92
|
+
children: _jsx(Icon, {
|
|
93
|
+
name: "x"
|
|
94
|
+
})
|
|
95
|
+
}))]
|
|
96
|
+
}));
|
|
97
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import Icon from '@ncds/ui-admin-icon';
|
|
21
|
+
import classNames from 'classnames';
|
|
22
|
+
import { forwardRef } from 'react';
|
|
23
|
+
import { COLOR } from '../../../constant/color';
|
|
24
|
+
var iconNameMap = {
|
|
25
|
+
neutral: 'message-chat-square',
|
|
26
|
+
error: 'alert-triangle',
|
|
27
|
+
warning: 'alert-triangle',
|
|
28
|
+
success: 'check-circle'
|
|
29
|
+
};
|
|
30
|
+
var iconColorMap = {
|
|
31
|
+
neutral: 'gray700',
|
|
32
|
+
error: 'red500',
|
|
33
|
+
warning: 'orange500',
|
|
34
|
+
success: 'green600'
|
|
35
|
+
};
|
|
36
|
+
export var FullWidthNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
37
|
+
var title = _a.title,
|
|
38
|
+
supportingText = _a.supportingText,
|
|
39
|
+
_b = _a.variant,
|
|
40
|
+
variant = _b === void 0 ? 'neutral' : _b,
|
|
41
|
+
onClose = _a.onClose,
|
|
42
|
+
className = _a.className,
|
|
43
|
+
actions = _a.actions,
|
|
44
|
+
rest = __rest(_a, ["title", "supportingText", "variant", "onClose", "className", "actions"]);
|
|
45
|
+
var closeIconSize = {
|
|
46
|
+
width: 20,
|
|
47
|
+
height: 20
|
|
48
|
+
};
|
|
49
|
+
return _jsx("div", __assign({
|
|
50
|
+
ref: ref,
|
|
51
|
+
className: classNames('ncua-full-width-notification', "ncua-full-width-notification--".concat(variant), className),
|
|
52
|
+
role: "alert"
|
|
53
|
+
}, rest, {
|
|
54
|
+
children: _jsx("div", __assign({
|
|
55
|
+
className: "ncua-full-width-notification__container"
|
|
56
|
+
}, {
|
|
57
|
+
children: _jsxs("div", __assign({
|
|
58
|
+
className: "ncua-full-width-notification__content"
|
|
59
|
+
}, {
|
|
60
|
+
children: [_jsxs("div", __assign({
|
|
61
|
+
className: "ncua-full-width-notification__content-wrapper"
|
|
62
|
+
}, {
|
|
63
|
+
children: [_jsx(Icon, {
|
|
64
|
+
name: iconNameMap[variant],
|
|
65
|
+
width: 16,
|
|
66
|
+
height: 16,
|
|
67
|
+
color: COLOR[iconColorMap[variant]],
|
|
68
|
+
className: "ncua-full-width-notification__icon"
|
|
69
|
+
}), _jsxs("div", __assign({
|
|
70
|
+
className: "ncua-full-width-notification__text-container"
|
|
71
|
+
}, {
|
|
72
|
+
children: [_jsx("span", __assign({
|
|
73
|
+
className: "ncua-full-width-notification__title"
|
|
74
|
+
}, {
|
|
75
|
+
children: title
|
|
76
|
+
})), supportingText && _jsx("span", __assign({
|
|
77
|
+
className: "ncua-full-width-notification__supporting-text"
|
|
78
|
+
}, {
|
|
79
|
+
children: supportingText
|
|
80
|
+
}))]
|
|
81
|
+
}))]
|
|
82
|
+
})), _jsxs("div", __assign({
|
|
83
|
+
className: "ncua-full-width-notification__actions-container"
|
|
84
|
+
}, {
|
|
85
|
+
children: [actions && _jsx("div", __assign({
|
|
86
|
+
className: "ncua-full-width-notification__actions"
|
|
87
|
+
}, {
|
|
88
|
+
children: actions
|
|
89
|
+
})), onClose && _jsx("button", __assign({
|
|
90
|
+
type: "button",
|
|
91
|
+
className: "ncua-full-width-notification__close-button",
|
|
92
|
+
onClick: onClose,
|
|
93
|
+
"aria-label": "\uC54C\uB9BC \uB2EB\uAE30"
|
|
94
|
+
}, {
|
|
95
|
+
children: _jsx(Icon, __assign({
|
|
96
|
+
name: "x-close"
|
|
97
|
+
}, closeIconSize, {
|
|
98
|
+
color: COLOR[iconColorMap[variant]]
|
|
99
|
+
}))
|
|
100
|
+
}))]
|
|
101
|
+
}))]
|
|
102
|
+
}))
|
|
103
|
+
}))
|
|
104
|
+
}));
|
|
105
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
+
import { forwardRef } from 'react';
|
|
21
|
+
import classNames from 'classnames';
|
|
22
|
+
import { FloatingNotification } from './FloatingNotification';
|
|
23
|
+
import { FullWidthNotification } from './FullWidthNotification';
|
|
24
|
+
export var Notification = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
25
|
+
var _b = _a.type,
|
|
26
|
+
type = _b === void 0 ? 'floating' : _b,
|
|
27
|
+
title = _a.title,
|
|
28
|
+
supportingText = _a.supportingText,
|
|
29
|
+
_c = _a.variant,
|
|
30
|
+
variant = _c === void 0 ? 'neutral' : _c,
|
|
31
|
+
onClose = _a.onClose,
|
|
32
|
+
className = _a.className,
|
|
33
|
+
actions = _a.actions,
|
|
34
|
+
rest = __rest(_a, ["type", "title", "supportingText", "variant", "onClose", "className", "actions"]);
|
|
35
|
+
var actionsContent = actions && actions.length > 0 ? _jsx(_Fragment, {
|
|
36
|
+
children: actions.map(function (action, index) {
|
|
37
|
+
return _jsx("button", __assign({
|
|
38
|
+
onClick: action.onClick,
|
|
39
|
+
className: classNames('ncua-notification__action-button', "ncua-notification__action-button--".concat(action.hierarchy || 'link-gray'))
|
|
40
|
+
}, {
|
|
41
|
+
children: action.label
|
|
42
|
+
}), index);
|
|
43
|
+
})
|
|
44
|
+
}) : null;
|
|
45
|
+
var sharedProps = __assign({
|
|
46
|
+
title: title,
|
|
47
|
+
supportingText: supportingText,
|
|
48
|
+
variant: variant,
|
|
49
|
+
onClose: onClose,
|
|
50
|
+
className: className,
|
|
51
|
+
actions: actionsContent
|
|
52
|
+
}, rest);
|
|
53
|
+
return type === 'floating' ? _jsx(FloatingNotification, __assign({}, sharedProps, {
|
|
54
|
+
ref: ref
|
|
55
|
+
})) : _jsx(FullWidthNotification, __assign({}, sharedProps, {
|
|
56
|
+
ref: ref
|
|
57
|
+
}));
|
|
58
|
+
});
|
|
59
|
+
Notification.displayName = 'Notification';
|
|
@@ -43,7 +43,7 @@ var NAV_BUTTON_CONFIG = {
|
|
|
43
43
|
export var NavButton = function (_a) {
|
|
44
44
|
var type = _a.type,
|
|
45
45
|
as = _a.as,
|
|
46
|
-
|
|
46
|
+
breakPoint = _a.breakPoint,
|
|
47
47
|
noPrev = _a.noPrev,
|
|
48
48
|
noNext = _a.noNext,
|
|
49
49
|
href = _a.href,
|
|
@@ -54,6 +54,7 @@ export var NavButton = function (_a) {
|
|
|
54
54
|
var isFirstOrPrev = type === 'first' || type === 'prev';
|
|
55
55
|
var isNextOrLast = type === 'next' || type === 'last';
|
|
56
56
|
var disabled = isFirstOrPrev ? noPrev : isNextOrLast ? noNext : false;
|
|
57
|
+
var isPC = breakPoint === 'pc';
|
|
57
58
|
// key를 제외한 공통 props
|
|
58
59
|
var buttonProps = {
|
|
59
60
|
label: config.label,
|
|
@@ -62,15 +63,16 @@ export var NavButton = function (_a) {
|
|
|
62
63
|
leadingIcon: {
|
|
63
64
|
type: 'icon',
|
|
64
65
|
icon: config.getIcon(isPC),
|
|
65
|
-
color: disabled ? 'gray200' : 'gray700'
|
|
66
|
+
color: disabled ? 'gray200' : 'gray700',
|
|
67
|
+
size: isPC ? 16 : 20
|
|
66
68
|
},
|
|
67
69
|
hierarchy: 'secondary-gray',
|
|
68
|
-
size: 'xs',
|
|
70
|
+
size: isPC ? 'xs' : 'sm',
|
|
69
71
|
disabled: disabled,
|
|
70
72
|
onClick: onClick
|
|
71
73
|
};
|
|
72
74
|
// key 값 별도 계산
|
|
73
|
-
var buttonKey = isNavigationButton ? "".concat(
|
|
75
|
+
var buttonKey = isNavigationButton ? "".concat(breakPoint, "-").concat(type) : undefined;
|
|
74
76
|
if (as === 'a') {
|
|
75
77
|
return _jsx(Button, __assign({
|
|
76
78
|
as: "a",
|
|
@@ -20,7 +20,6 @@ import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-run
|
|
|
20
20
|
import classNames from 'classnames';
|
|
21
21
|
import { isFunction, range, uniqueId } from 'lodash-es';
|
|
22
22
|
import { useEffect, useState } from 'react';
|
|
23
|
-
import { MINIMUM_PC_SIZE } from '../../constant';
|
|
24
23
|
import { NavButton } from './NavButton';
|
|
25
24
|
// 네비게이션 버튼 설정
|
|
26
25
|
export var Pagination = function (_a) {
|
|
@@ -42,9 +41,6 @@ export var Pagination = function (_a) {
|
|
|
42
41
|
var _g = useState(1),
|
|
43
42
|
start = _g[0],
|
|
44
43
|
setStart = _g[1];
|
|
45
|
-
var _h = useState(globalThis.innerWidth > MINIMUM_PC_SIZE),
|
|
46
|
-
isPC = _h[0],
|
|
47
|
-
setIsPC = _h[1];
|
|
48
44
|
var noPrev = start === 1;
|
|
49
45
|
var noNext = start + pageCount - 1 >= totalPage;
|
|
50
46
|
var showJumpPageButton = totalPage > pageCount;
|
|
@@ -72,17 +68,6 @@ export var Pagination = function (_a) {
|
|
|
72
68
|
setStart(lastGroupStart);
|
|
73
69
|
}
|
|
74
70
|
}, [currentPage]);
|
|
75
|
-
useEffect(function () {
|
|
76
|
-
var mql = globalThis.matchMedia("(min-width: ".concat(MINIMUM_PC_SIZE, "px)"));
|
|
77
|
-
setIsPC(mql.matches);
|
|
78
|
-
var handleResize = function (e) {
|
|
79
|
-
setIsPC(e.matches);
|
|
80
|
-
};
|
|
81
|
-
mql.addEventListener('change', handleResize);
|
|
82
|
-
return function () {
|
|
83
|
-
return mql.removeEventListener('change', handleResize);
|
|
84
|
-
};
|
|
85
|
-
}, []);
|
|
86
71
|
return _jsx(_Fragment, {
|
|
87
72
|
children: _jsxs("div", __assign({
|
|
88
73
|
className: classNames('ncua-pagination', "ncua-pagination--".concat(breakPoint), className)
|
|
@@ -91,7 +76,7 @@ export var Pagination = function (_a) {
|
|
|
91
76
|
children: [NavButton({
|
|
92
77
|
type: 'first',
|
|
93
78
|
as: as,
|
|
94
|
-
|
|
79
|
+
breakPoint: breakPoint,
|
|
95
80
|
noPrev: noPrev,
|
|
96
81
|
noNext: noNext,
|
|
97
82
|
href: restProps.href || '',
|
|
@@ -102,7 +87,7 @@ export var Pagination = function (_a) {
|
|
|
102
87
|
}), NavButton({
|
|
103
88
|
type: 'prev',
|
|
104
89
|
as: as,
|
|
105
|
-
|
|
90
|
+
breakPoint: breakPoint,
|
|
106
91
|
noPrev: noPrev,
|
|
107
92
|
noNext: noNext,
|
|
108
93
|
href: restProps.href || '',
|
|
@@ -142,7 +127,7 @@ export var Pagination = function (_a) {
|
|
|
142
127
|
children: [NavButton({
|
|
143
128
|
type: 'next',
|
|
144
129
|
as: as,
|
|
145
|
-
|
|
130
|
+
breakPoint: breakPoint,
|
|
146
131
|
noPrev: noPrev,
|
|
147
132
|
noNext: noNext,
|
|
148
133
|
href: restProps.href || '',
|
|
@@ -153,7 +138,7 @@ export var Pagination = function (_a) {
|
|
|
153
138
|
}), NavButton({
|
|
154
139
|
type: 'last',
|
|
155
140
|
as: as,
|
|
156
|
-
|
|
141
|
+
breakPoint: breakPoint,
|
|
157
142
|
noPrev: noPrev,
|
|
158
143
|
noNext: noNext,
|
|
159
144
|
href: restProps.href || '',
|