@ncds/ui-admin 0.0.32 → 0.0.33
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/constant/color.js +1 -0
- package/dist/cjs/src/components/badge/BadgeGroup.js +8 -3
- package/dist/cjs/src/components/button/ButtonCloseX.js +44 -0
- package/dist/cjs/src/components/date-picker/DatePicker.js +4 -5
- package/dist/cjs/src/components/date-picker/RangeDatePicker.js +13 -7
- package/dist/cjs/src/components/modal/Modal.js +5 -7
- package/dist/cjs/src/components/notification/FloatingNotification.js +30 -26
- package/dist/cjs/src/components/notification/FullWidthNotification.js +15 -8
- package/dist/cjs/src/components/notification/Notification.js +9 -30
- package/dist/cjs/src/components/notification/index.js +11 -11
- package/dist/cjs/src/constant/breakpoint.js +12 -0
- package/dist/cjs/src/hooks/useMediaQuery.js +29 -0
- package/dist/esm/constant/color.js +1 -0
- package/dist/esm/src/components/badge/BadgeGroup.js +8 -3
- package/dist/esm/src/components/button/ButtonCloseX.js +36 -0
- package/dist/esm/src/components/date-picker/DatePicker.js +5 -5
- package/dist/esm/src/components/date-picker/RangeDatePicker.js +14 -7
- package/dist/esm/src/components/modal/Modal.js +5 -7
- package/dist/esm/src/components/notification/FloatingNotification.js +31 -27
- package/dist/esm/src/components/notification/FullWidthNotification.js +15 -8
- package/dist/esm/src/components/notification/Notification.js +10 -30
- package/dist/esm/src/components/notification/index.js +2 -2
- package/dist/esm/src/constant/breakpoint.js +6 -0
- package/dist/esm/src/hooks/useMediaQuery.js +22 -0
- package/dist/types/constant/color.d.ts +1 -0
- package/dist/types/src/components/badge/BadgeGroup.d.ts +3 -1
- package/dist/types/src/components/button/Button.d.ts +1 -1
- package/dist/types/src/components/button/ButtonCloseX.d.ts +9 -0
- package/dist/types/src/components/date-picker/DatePicker.d.ts +2 -2
- package/dist/types/src/components/date-picker/RangeDatePicker.d.ts +1 -1
- package/dist/types/src/components/modal/Modal.d.ts +1 -1
- package/dist/types/src/components/notification/FloatingNotification.d.ts +3 -4
- package/dist/types/src/components/notification/FullWidthNotification.d.ts +3 -4
- package/dist/types/src/components/notification/Notification.d.ts +5 -4
- package/dist/types/src/components/notification/index.d.ts +1 -1
- package/dist/types/src/constant/breakpoint.d.ts +7 -0
- package/dist/types/src/hooks/useMediaQuery.d.ts +6 -0
- package/dist/ui-admin/assets/styles/style.css +20 -59
- package/package.json +2 -2
|
@@ -36,9 +36,14 @@ var BadgeGroup = function (_a) {
|
|
|
36
36
|
color = _b === void 0 ? 'neutral' : _b,
|
|
37
37
|
_c = _a.size,
|
|
38
38
|
size = _c === void 0 ? 'sm' : _c,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
href = _a.href,
|
|
40
|
+
_d = _a.target,
|
|
41
|
+
target = _d === void 0 ? '_blank' : _d,
|
|
42
|
+
props = __rest(_a, ["groupLabel", "groupIcon", "groupClassName", "color", "size", "href", "target"]);
|
|
43
|
+
return (0, _jsxRuntime.jsxs)("a", __assign({
|
|
44
|
+
className: (0, _classnames.default)('ncua-badge-group', "ncua-badge-group--".concat(color), "ncua-badge-group--".concat(size), groupClassName),
|
|
45
|
+
href: href,
|
|
46
|
+
target: target
|
|
42
47
|
}, {
|
|
43
48
|
children: [(0, _jsxRuntime.jsx)(_.Badge, __assign({
|
|
44
49
|
type: "pill-dark-color",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ButtonCloseX = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _uiAdminIcon = _interopRequireDefault(require("@ncds/ui-admin-icon"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
12
|
+
__assign = Object.assign || function (t) {
|
|
13
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
14
|
+
s = arguments[i];
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
return __assign.apply(this, arguments);
|
|
20
|
+
};
|
|
21
|
+
var svgSize = {
|
|
22
|
+
xs: 16,
|
|
23
|
+
sm: 20,
|
|
24
|
+
md: 20,
|
|
25
|
+
lg: 24
|
|
26
|
+
};
|
|
27
|
+
var ButtonCloseX = function (_a) {
|
|
28
|
+
var size = _a.size,
|
|
29
|
+
_b = _a.theme,
|
|
30
|
+
theme = _b === void 0 ? 'light' : _b,
|
|
31
|
+
className = _a.className,
|
|
32
|
+
onClick = _a.onClick;
|
|
33
|
+
return (0, _jsxRuntime.jsx)("button", __assign({
|
|
34
|
+
className: (0, _classnames.default)('ncua-button-close-x', "ncua-button-close-x--".concat(size), "ncua-button-close-x--".concat(theme), className),
|
|
35
|
+
onClick: onClick
|
|
36
|
+
}, {
|
|
37
|
+
children: (0, _jsxRuntime.jsx)(_uiAdminIcon.default, {
|
|
38
|
+
name: "x-close",
|
|
39
|
+
width: svgSize[size],
|
|
40
|
+
height: svgSize[size]
|
|
41
|
+
})
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
exports.ButtonCloseX = ButtonCloseX;
|
|
@@ -30,7 +30,7 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
30
30
|
}
|
|
31
31
|
return t;
|
|
32
32
|
};
|
|
33
|
-
var DatePicker = function (_a) {
|
|
33
|
+
var DatePicker = exports.DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_a, ref) {
|
|
34
34
|
var _b = _a.shouldFocus,
|
|
35
35
|
shouldFocus = _b === void 0 ? true : _b,
|
|
36
36
|
currentDate = _a.currentDate,
|
|
@@ -39,7 +39,6 @@ var DatePicker = function (_a) {
|
|
|
39
39
|
onChangeDate = _a.onChangeDate,
|
|
40
40
|
datePickerOptions = _a.datePickerOptions,
|
|
41
41
|
attrs = __rest(_a, ["shouldFocus", "currentDate", "size", "onChangeDate", "datePickerOptions"]);
|
|
42
|
-
var ref = (0, _react.useRef)(null);
|
|
43
42
|
var onChangeDateHandler = function (dateTimeStamp, dateStr) {
|
|
44
43
|
return onChangeDate(dateStr);
|
|
45
44
|
};
|
|
@@ -59,7 +58,7 @@ var DatePicker = function (_a) {
|
|
|
59
58
|
})
|
|
60
59
|
}, {
|
|
61
60
|
children: [(0, _jsxRuntime.jsx)(_reactFlatpickr.default, __assign({}, attrs, {
|
|
62
|
-
ref: ref,
|
|
61
|
+
ref: ref || undefined,
|
|
63
62
|
className: (0, _classnames.default)('ncua-date-picker__input'),
|
|
64
63
|
options: options,
|
|
65
64
|
value: currentDate
|
|
@@ -83,5 +82,5 @@ var DatePicker = function (_a) {
|
|
|
83
82
|
}))
|
|
84
83
|
}))]
|
|
85
84
|
}));
|
|
86
|
-
};
|
|
87
|
-
|
|
85
|
+
});
|
|
86
|
+
DatePicker.displayName = 'DatePicker';
|
|
@@ -21,7 +21,7 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
21
21
|
};
|
|
22
22
|
return __assign.apply(this, arguments);
|
|
23
23
|
};
|
|
24
|
-
var RangeDatePicker = function (_a) {
|
|
24
|
+
var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_a, ref) {
|
|
25
25
|
var startDateOptions = _a.startDateOptions,
|
|
26
26
|
endDateOptions = _a.endDateOptions,
|
|
27
27
|
validationOption = _a.validationOption,
|
|
@@ -45,6 +45,7 @@ var RangeDatePicker = function (_a) {
|
|
|
45
45
|
if (isOverPeriod === void 0) {
|
|
46
46
|
isOverPeriod = false;
|
|
47
47
|
}
|
|
48
|
+
if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) return;
|
|
48
49
|
var _a = validationOption.setting,
|
|
49
50
|
unit = _a.unit,
|
|
50
51
|
period = _a.period;
|
|
@@ -85,7 +86,7 @@ var RangeDatePicker = function (_a) {
|
|
|
85
86
|
if (!isValidPeriod) {
|
|
86
87
|
changeSettingDateAndAlert('start', !isValidPeriod);
|
|
87
88
|
}
|
|
88
|
-
}, [startDateOptions.currentDate]);
|
|
89
|
+
}, [startDateOptions.currentDate, endDateOptions.currentDate, validationOption, resetDateAndAlert, changeSettingDateAndAlert]);
|
|
89
90
|
(0, _react.useEffect)(function () {
|
|
90
91
|
var _a;
|
|
91
92
|
var needResetDate = validateDateType(endDateOptions.currentDate) && !(0, _lodash.isNil)((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.endDate) && (0, _moment.default)(endDateOptions.currentDate).isBefore(startDateOptions.currentDate);
|
|
@@ -108,11 +109,16 @@ var RangeDatePicker = function (_a) {
|
|
|
108
109
|
if (!isValidPeriod) {
|
|
109
110
|
changeSettingDateAndAlert('end', !isValidPeriod);
|
|
110
111
|
}
|
|
111
|
-
}, [endDateOptions.currentDate]);
|
|
112
|
+
}, [endDateOptions.currentDate, startDateOptions.currentDate, validationOption, resetDateAndAlert, changeSettingDateAndAlert]);
|
|
112
113
|
return (0, _jsxRuntime.jsxs)("div", __assign({
|
|
113
|
-
className: "ncua-range-date-picker"
|
|
114
|
+
className: "ncua-range-date-picker",
|
|
115
|
+
ref: ref || undefined
|
|
114
116
|
}, {
|
|
115
|
-
children: [(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, __assign({}, startDateOptions
|
|
117
|
+
children: [(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, __assign({}, startDateOptions, {
|
|
118
|
+
ref: undefined
|
|
119
|
+
})), "-", (0, _jsxRuntime.jsx)(_DatePicker.DatePicker, __assign({}, endDateOptions, {
|
|
120
|
+
ref: undefined
|
|
121
|
+
}))]
|
|
116
122
|
}));
|
|
117
|
-
};
|
|
118
|
-
|
|
123
|
+
});
|
|
124
|
+
RangeDatePicker.displayName = 'RangeDatePicker';
|
|
@@ -8,8 +8,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
11
|
+
var _ButtonCloseX = require("../button/ButtonCloseX");
|
|
11
12
|
var _featuredIcon = require("../featured-icon");
|
|
12
|
-
var _uiAdminIcon = _interopRequireDefault(require("@ncds/ui-admin-icon"));
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
15
15
|
__assign = Object.assign || function (t) {
|
|
@@ -112,14 +112,12 @@ Modal.Header = function (_a) {
|
|
|
112
112
|
}, {
|
|
113
113
|
children: subtitle
|
|
114
114
|
}))]
|
|
115
|
-
})), children, !hideCloseButton && (0, _jsxRuntime.jsx)(
|
|
115
|
+
})), children, !hideCloseButton && (0, _jsxRuntime.jsx)(_ButtonCloseX.ButtonCloseX, {
|
|
116
116
|
className: "ncua-modal__close-button",
|
|
117
|
+
size: "sm",
|
|
118
|
+
theme: "light",
|
|
117
119
|
onClick: onClose
|
|
118
|
-
}
|
|
119
|
-
children: (0, _jsxRuntime.jsx)(_uiAdminIcon.default, {
|
|
120
|
-
name: "x-close"
|
|
121
|
-
})
|
|
122
|
-
}))]
|
|
120
|
+
})]
|
|
123
121
|
})), showDivider && (0, _jsxRuntime.jsx)("div", {
|
|
124
122
|
className: "ncua-modal__header-divider"
|
|
125
123
|
})]
|
|
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.FloatingNotification = void 0;
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
var _FeaturedIcon = require("../featured-icon/FeaturedIcon");
|
|
9
|
-
var _uiAdminIcon = _interopRequireDefault(require("@ncds/ui-admin-icon"));
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
9
|
var _react = require("react");
|
|
10
|
+
var _breakpoint = require("../../constant/breakpoint");
|
|
11
|
+
var _useMediaQuery = require("../../hooks/useMediaQuery");
|
|
12
|
+
var _button = require("../button");
|
|
13
|
+
var _ButtonCloseX = require("../button/ButtonCloseX");
|
|
14
|
+
var _FeaturedIcon = require("../featured-icon/FeaturedIcon");
|
|
12
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
16
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
14
17
|
__assign = Object.assign || function (t) {
|
|
@@ -37,22 +40,25 @@ var iconNameMap = {
|
|
|
37
40
|
var FloatingNotification = exports.FloatingNotification = /*#__PURE__*/(0, _react.forwardRef)(function (_a, ref) {
|
|
38
41
|
var title = _a.title,
|
|
39
42
|
supportingText = _a.supportingText,
|
|
40
|
-
_b = _a.
|
|
41
|
-
|
|
43
|
+
_b = _a.color,
|
|
44
|
+
color = _b === void 0 ? 'neutral' : _b,
|
|
42
45
|
onClose = _a.onClose,
|
|
43
46
|
className = _a.className,
|
|
44
47
|
actions = _a.actions,
|
|
45
|
-
rest = __rest(_a, ["title", "supportingText", "
|
|
46
|
-
var iconColor =
|
|
48
|
+
rest = __rest(_a, ["title", "supportingText", "color", "onClose", "className", "actions"]);
|
|
49
|
+
var iconColor = color;
|
|
47
50
|
var featuredIconProps = {
|
|
48
|
-
name: iconNameMap[
|
|
51
|
+
name: iconNameMap[color],
|
|
49
52
|
size: 'sm',
|
|
50
53
|
color: iconColor,
|
|
51
54
|
theme: 'dark-circle'
|
|
52
55
|
};
|
|
56
|
+
var isMobile = (0, _useMediaQuery.useMediaQuery)(_breakpoint.MEDIA_QUERY.mobile, {
|
|
57
|
+
onMatched: onClose
|
|
58
|
+
});
|
|
53
59
|
return (0, _jsxRuntime.jsxs)("div", __assign({
|
|
54
60
|
ref: ref,
|
|
55
|
-
className: (0, _classnames.default)('ncua-floating-notification', "ncua-floating-notification--".concat(
|
|
61
|
+
className: (0, _classnames.default)('ncua-floating-notification', "ncua-floating-notification--".concat(color), className),
|
|
56
62
|
role: "alert"
|
|
57
63
|
}, rest, {
|
|
58
64
|
children: [(0, _jsxRuntime.jsx)("div", __assign({
|
|
@@ -61,14 +67,9 @@ var FloatingNotification = exports.FloatingNotification = /*#__PURE__*/(0, _reac
|
|
|
61
67
|
children: (0, _jsxRuntime.jsxs)("div", __assign({
|
|
62
68
|
className: "ncua-floating-notification__container"
|
|
63
69
|
}, {
|
|
64
|
-
children: [iconNameMap[
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})), (0, _jsxRuntime.jsx)(_FeaturedIcon.FeaturedIcon, __assign({}, featuredIconProps, {
|
|
68
|
-
size: "md",
|
|
69
|
-
className: "ncua-floating-notification__mobile-icon"
|
|
70
|
-
}))]
|
|
71
|
-
}), (0, _jsxRuntime.jsxs)("div", __assign({
|
|
70
|
+
children: [iconNameMap[color] && (0, _jsxRuntime.jsx)(_FeaturedIcon.FeaturedIcon, __assign({}, featuredIconProps, {
|
|
71
|
+
size: isMobile ? 'md' : 'sm'
|
|
72
|
+
})), (0, _jsxRuntime.jsxs)("div", __assign({
|
|
72
73
|
className: "ncua-floating-notification__text-container"
|
|
73
74
|
}, {
|
|
74
75
|
children: [(0, _jsxRuntime.jsx)("div", __assign({
|
|
@@ -86,19 +87,22 @@ var FloatingNotification = exports.FloatingNotification = /*#__PURE__*/(0, _reac
|
|
|
86
87
|
})), actions && (0, _jsxRuntime.jsx)("div", __assign({
|
|
87
88
|
className: "ncua-floating-notification__actions"
|
|
88
89
|
}, {
|
|
89
|
-
children: actions
|
|
90
|
+
children: actions.map(function (action) {
|
|
91
|
+
return (0, _jsxRuntime.jsx)(_button.Button, {
|
|
92
|
+
size: "xs",
|
|
93
|
+
hierarchy: action.hierarchy || 'link',
|
|
94
|
+
label: action.label,
|
|
95
|
+
onClick: action === null || action === void 0 ? void 0 : action.onClick
|
|
96
|
+
}, "".concat(action.label, "-").concat(action.hierarchy));
|
|
97
|
+
})
|
|
90
98
|
}))]
|
|
91
99
|
}))]
|
|
92
100
|
}))
|
|
93
|
-
})), onClose && (0, _jsxRuntime.jsx)(
|
|
94
|
-
|
|
101
|
+
})), onClose && (0, _jsxRuntime.jsx)(_ButtonCloseX.ButtonCloseX, {
|
|
102
|
+
theme: "light",
|
|
95
103
|
className: "ncua-floating-notification__close-button",
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
children: (0, _jsxRuntime.jsx)(_uiAdminIcon.default, {
|
|
100
|
-
name: "x"
|
|
101
|
-
})
|
|
102
|
-
}))]
|
|
104
|
+
size: isMobile ? 'sm' : 'xs',
|
|
105
|
+
onClick: onClose
|
|
106
|
+
})]
|
|
103
107
|
}));
|
|
104
108
|
});
|
|
@@ -43,19 +43,19 @@ var iconColorMap = {
|
|
|
43
43
|
var FullWidthNotification = exports.FullWidthNotification = /*#__PURE__*/(0, _react.forwardRef)(function (_a, ref) {
|
|
44
44
|
var title = _a.title,
|
|
45
45
|
supportingText = _a.supportingText,
|
|
46
|
-
_b = _a.
|
|
47
|
-
|
|
46
|
+
_b = _a.color,
|
|
47
|
+
color = _b === void 0 ? 'neutral' : _b,
|
|
48
48
|
onClose = _a.onClose,
|
|
49
49
|
className = _a.className,
|
|
50
50
|
actions = _a.actions,
|
|
51
|
-
rest = __rest(_a, ["title", "supportingText", "
|
|
51
|
+
rest = __rest(_a, ["title", "supportingText", "color", "onClose", "className", "actions"]);
|
|
52
52
|
var closeIconSize = {
|
|
53
53
|
width: 20,
|
|
54
54
|
height: 20
|
|
55
55
|
};
|
|
56
56
|
return (0, _jsxRuntime.jsx)("div", __assign({
|
|
57
57
|
ref: ref,
|
|
58
|
-
className: (0, _classnames.default)('ncua-full-width-notification', "ncua-full-width-notification--".concat(
|
|
58
|
+
className: (0, _classnames.default)('ncua-full-width-notification', "ncua-full-width-notification--".concat(color), className),
|
|
59
59
|
role: "alert"
|
|
60
60
|
}, rest, {
|
|
61
61
|
children: (0, _jsxRuntime.jsx)("div", __assign({
|
|
@@ -68,10 +68,10 @@ var FullWidthNotification = exports.FullWidthNotification = /*#__PURE__*/(0, _re
|
|
|
68
68
|
className: "ncua-full-width-notification__content-wrapper"
|
|
69
69
|
}, {
|
|
70
70
|
children: [(0, _jsxRuntime.jsx)(_uiAdminIcon.default, {
|
|
71
|
-
name: iconNameMap[
|
|
71
|
+
name: iconNameMap[color],
|
|
72
72
|
width: 16,
|
|
73
73
|
height: 16,
|
|
74
|
-
color: _color.COLOR[iconColorMap[
|
|
74
|
+
color: _color.COLOR[iconColorMap[color]],
|
|
75
75
|
className: "ncua-full-width-notification__icon"
|
|
76
76
|
}), (0, _jsxRuntime.jsxs)("div", __assign({
|
|
77
77
|
className: "ncua-full-width-notification__text-container"
|
|
@@ -92,7 +92,14 @@ var FullWidthNotification = exports.FullWidthNotification = /*#__PURE__*/(0, _re
|
|
|
92
92
|
children: [actions && (0, _jsxRuntime.jsx)("div", __assign({
|
|
93
93
|
className: "ncua-full-width-notification__actions"
|
|
94
94
|
}, {
|
|
95
|
-
children: actions
|
|
95
|
+
children: actions.map(function (action) {
|
|
96
|
+
return (0, _jsxRuntime.jsx)("button", __assign({
|
|
97
|
+
onClick: action.onClick,
|
|
98
|
+
className: (0, _classnames.default)('ncua-notification__action-button', "ncua-notification__action-button--".concat(action.hierarchy || 'link'))
|
|
99
|
+
}, {
|
|
100
|
+
children: action.label
|
|
101
|
+
}), "".concat(action.label, "-").concat(action.hierarchy));
|
|
102
|
+
})
|
|
96
103
|
})), onClose && (0, _jsxRuntime.jsx)("button", __assign({
|
|
97
104
|
type: "button",
|
|
98
105
|
className: "ncua-full-width-notification__close-button",
|
|
@@ -102,7 +109,7 @@ var FullWidthNotification = exports.FullWidthNotification = /*#__PURE__*/(0, _re
|
|
|
102
109
|
children: (0, _jsxRuntime.jsx)(_uiAdminIcon.default, __assign({
|
|
103
110
|
name: "x-close"
|
|
104
111
|
}, closeIconSize, {
|
|
105
|
-
color: _color.COLOR[iconColorMap[
|
|
112
|
+
color: _color.COLOR[iconColorMap[color]]
|
|
106
113
|
}))
|
|
107
114
|
}))]
|
|
108
115
|
}))]
|
|
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Notification = void 0;
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
9
|
var _FloatingNotification = require("./FloatingNotification");
|
|
11
10
|
var _FullWidthNotification = require("./FullWidthNotification");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
11
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
14
12
|
__assign = Object.assign || function (t) {
|
|
15
13
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -31,35 +29,16 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
31
29
|
var Notification = exports.Notification = /*#__PURE__*/(0, _react.forwardRef)(function (_a, ref) {
|
|
32
30
|
var _b = _a.type,
|
|
33
31
|
type = _b === void 0 ? 'floating' : _b,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
actions = _a.actions,
|
|
41
|
-
rest = __rest(_a, ["type", "title", "supportingText", "variant", "onClose", "className", "actions"]);
|
|
42
|
-
var actionsContent = actions && actions.length > 0 ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
43
|
-
children: actions.map(function (action, index) {
|
|
44
|
-
return (0, _jsxRuntime.jsx)("button", __assign({
|
|
45
|
-
onClick: action.onClick,
|
|
46
|
-
className: (0, _classnames.default)('ncua-notification__action-button', "ncua-notification__action-button--".concat(action.hierarchy || 'link-gray'))
|
|
47
|
-
}, {
|
|
48
|
-
children: action.label
|
|
49
|
-
}), index);
|
|
50
|
-
})
|
|
51
|
-
}) : null;
|
|
52
|
-
var sharedProps = __assign({
|
|
53
|
-
title: title,
|
|
54
|
-
supportingText: supportingText,
|
|
55
|
-
variant: variant,
|
|
56
|
-
onClose: onClose,
|
|
57
|
-
className: className,
|
|
58
|
-
actions: actionsContent
|
|
59
|
-
}, rest);
|
|
60
|
-
return type === 'floating' ? (0, _jsxRuntime.jsx)(_FloatingNotification.FloatingNotification, __assign({}, sharedProps, {
|
|
32
|
+
_c = _a.color,
|
|
33
|
+
color = _c === void 0 ? 'neutral' : _c,
|
|
34
|
+
rest = __rest(_a, ["type", "color"]);
|
|
35
|
+
return type === 'floating' ? (0, _jsxRuntime.jsx)(_FloatingNotification.FloatingNotification, __assign({
|
|
36
|
+
color: color
|
|
37
|
+
}, rest, {
|
|
61
38
|
ref: ref
|
|
62
|
-
})) : (0, _jsxRuntime.jsx)(_FullWidthNotification.FullWidthNotification, __assign({
|
|
39
|
+
})) : (0, _jsxRuntime.jsx)(_FullWidthNotification.FullWidthNotification, __assign({
|
|
40
|
+
color: color
|
|
41
|
+
}, rest, {
|
|
63
42
|
ref: ref
|
|
64
43
|
}));
|
|
65
44
|
});
|
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _Notification = require("./Notification");
|
|
7
|
+
Object.keys(_Notification).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Notification[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Notification[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
6
17
|
var _FloatingNotification = require("./FloatingNotification");
|
|
7
18
|
Object.keys(_FloatingNotification).forEach(function (key) {
|
|
8
19
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -24,15 +35,4 @@ Object.keys(_FullWidthNotification).forEach(function (key) {
|
|
|
24
35
|
return _FullWidthNotification[key];
|
|
25
36
|
}
|
|
26
37
|
});
|
|
27
|
-
});
|
|
28
|
-
var _Notification = require("./Notification");
|
|
29
|
-
Object.keys(_Notification).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _Notification[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _Notification[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
38
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MEDIA_QUERY = exports.BREAKPOINT = void 0;
|
|
7
|
+
var BREAKPOINT = exports.BREAKPOINT = {
|
|
8
|
+
mobile: '768px'
|
|
9
|
+
};
|
|
10
|
+
var MEDIA_QUERY = exports.MEDIA_QUERY = {
|
|
11
|
+
mobile: "(max-width: ".concat(BREAKPOINT.mobile, ")")
|
|
12
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useMediaQuery = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var useMediaQuery = function (query, options) {
|
|
9
|
+
var _a = (0, _react.useState)(false),
|
|
10
|
+
matches = _a[0],
|
|
11
|
+
setMatches = _a[1];
|
|
12
|
+
(0, _react.useEffect)(function () {
|
|
13
|
+
var mediaQuery = window.matchMedia(query);
|
|
14
|
+
setMatches(mediaQuery.matches);
|
|
15
|
+
var handleChange = function (e) {
|
|
16
|
+
var _a;
|
|
17
|
+
setMatches(e.matches);
|
|
18
|
+
if (e.matches) {
|
|
19
|
+
(_a = options === null || options === void 0 ? void 0 : options.onMatched) === null || _a === void 0 ? void 0 : _a.call(options);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
mediaQuery.addEventListener('change', handleChange);
|
|
23
|
+
return function () {
|
|
24
|
+
mediaQuery.removeEventListener('change', handleChange);
|
|
25
|
+
};
|
|
26
|
+
}, [query, options === null || options === void 0 ? void 0 : options.onMatched]);
|
|
27
|
+
return matches;
|
|
28
|
+
};
|
|
29
|
+
exports.useMediaQuery = useMediaQuery;
|
|
@@ -29,9 +29,14 @@ export var BadgeGroup = function (_a) {
|
|
|
29
29
|
color = _b === void 0 ? 'neutral' : _b,
|
|
30
30
|
_c = _a.size,
|
|
31
31
|
size = _c === void 0 ? 'sm' : _c,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
href = _a.href,
|
|
33
|
+
_d = _a.target,
|
|
34
|
+
target = _d === void 0 ? '_blank' : _d,
|
|
35
|
+
props = __rest(_a, ["groupLabel", "groupIcon", "groupClassName", "color", "size", "href", "target"]);
|
|
36
|
+
return _jsxs("a", __assign({
|
|
37
|
+
className: classNames('ncua-badge-group', "ncua-badge-group--".concat(color), "ncua-badge-group--".concat(size), groupClassName),
|
|
38
|
+
href: href,
|
|
39
|
+
target: target
|
|
35
40
|
}, {
|
|
36
41
|
children: [_jsx(Badge, __assign({
|
|
37
42
|
type: "pill-dark-color",
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import Icon from '@ncds/ui-admin-icon';
|
|
13
|
+
import classnames from 'classnames';
|
|
14
|
+
var svgSize = {
|
|
15
|
+
xs: 16,
|
|
16
|
+
sm: 20,
|
|
17
|
+
md: 20,
|
|
18
|
+
lg: 24
|
|
19
|
+
};
|
|
20
|
+
export var ButtonCloseX = function (_a) {
|
|
21
|
+
var size = _a.size,
|
|
22
|
+
_b = _a.theme,
|
|
23
|
+
theme = _b === void 0 ? 'light' : _b,
|
|
24
|
+
className = _a.className,
|
|
25
|
+
onClick = _a.onClick;
|
|
26
|
+
return _jsx("button", __assign({
|
|
27
|
+
className: classnames('ncua-button-close-x', "ncua-button-close-x--".concat(size), "ncua-button-close-x--".concat(theme), className),
|
|
28
|
+
onClick: onClick
|
|
29
|
+
}, {
|
|
30
|
+
children: _jsx(Icon, {
|
|
31
|
+
name: "x-close",
|
|
32
|
+
width: svgSize[size],
|
|
33
|
+
height: svgSize[size]
|
|
34
|
+
})
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
@@ -20,10 +20,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
20
20
|
import classNames from 'classnames';
|
|
21
21
|
import 'flatpickr/dist/flatpickr.css';
|
|
22
22
|
import { Korean } from 'flatpickr/dist/l10n/ko';
|
|
23
|
-
import {
|
|
23
|
+
import { forwardRef } from 'react';
|
|
24
24
|
import Flatpickr from 'react-flatpickr';
|
|
25
25
|
import { COLOR } from '../../../constant/color';
|
|
26
|
-
export var DatePicker = function (_a) {
|
|
26
|
+
export var DatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
27
27
|
var _b = _a.shouldFocus,
|
|
28
28
|
shouldFocus = _b === void 0 ? true : _b,
|
|
29
29
|
currentDate = _a.currentDate,
|
|
@@ -32,7 +32,6 @@ export var DatePicker = function (_a) {
|
|
|
32
32
|
onChangeDate = _a.onChangeDate,
|
|
33
33
|
datePickerOptions = _a.datePickerOptions,
|
|
34
34
|
attrs = __rest(_a, ["shouldFocus", "currentDate", "size", "onChangeDate", "datePickerOptions"]);
|
|
35
|
-
var ref = useRef(null);
|
|
36
35
|
var onChangeDateHandler = function (dateTimeStamp, dateStr) {
|
|
37
36
|
return onChangeDate(dateStr);
|
|
38
37
|
};
|
|
@@ -52,7 +51,7 @@ export var DatePicker = function (_a) {
|
|
|
52
51
|
})
|
|
53
52
|
}, {
|
|
54
53
|
children: [_jsx(Flatpickr, __assign({}, attrs, {
|
|
55
|
-
ref: ref,
|
|
54
|
+
ref: ref || undefined,
|
|
56
55
|
className: classNames('ncua-date-picker__input'),
|
|
57
56
|
options: options,
|
|
58
57
|
value: currentDate
|
|
@@ -76,4 +75,5 @@ export var DatePicker = function (_a) {
|
|
|
76
75
|
}))
|
|
77
76
|
}))]
|
|
78
77
|
}));
|
|
79
|
-
};
|
|
78
|
+
});
|
|
79
|
+
DatePicker.displayName = 'DatePicker';
|
|
@@ -9,12 +9,12 @@ var __assign = this && this.__assign || function () {
|
|
|
9
9
|
return __assign.apply(this, arguments);
|
|
10
10
|
};
|
|
11
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { useCallback, useEffect } from 'react';
|
|
12
|
+
import { useCallback, useEffect, forwardRef } from 'react';
|
|
13
13
|
import { isNil } from 'lodash';
|
|
14
14
|
import moment from 'moment';
|
|
15
15
|
import { DatePicker } from './DatePicker';
|
|
16
16
|
import { getDateFormat } from './utils';
|
|
17
|
-
export var RangeDatePicker = function (_a) {
|
|
17
|
+
export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
18
18
|
var startDateOptions = _a.startDateOptions,
|
|
19
19
|
endDateOptions = _a.endDateOptions,
|
|
20
20
|
validationOption = _a.validationOption,
|
|
@@ -38,6 +38,7 @@ export var RangeDatePicker = function (_a) {
|
|
|
38
38
|
if (isOverPeriod === void 0) {
|
|
39
39
|
isOverPeriod = false;
|
|
40
40
|
}
|
|
41
|
+
if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) return;
|
|
41
42
|
var _a = validationOption.setting,
|
|
42
43
|
unit = _a.unit,
|
|
43
44
|
period = _a.period;
|
|
@@ -78,7 +79,7 @@ export var RangeDatePicker = function (_a) {
|
|
|
78
79
|
if (!isValidPeriod) {
|
|
79
80
|
changeSettingDateAndAlert('start', !isValidPeriod);
|
|
80
81
|
}
|
|
81
|
-
}, [startDateOptions.currentDate]);
|
|
82
|
+
}, [startDateOptions.currentDate, endDateOptions.currentDate, validationOption, resetDateAndAlert, changeSettingDateAndAlert]);
|
|
82
83
|
useEffect(function () {
|
|
83
84
|
var _a;
|
|
84
85
|
var needResetDate = validateDateType(endDateOptions.currentDate) && !isNil((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.endDate) && moment(endDateOptions.currentDate).isBefore(startDateOptions.currentDate);
|
|
@@ -101,10 +102,16 @@ export var RangeDatePicker = function (_a) {
|
|
|
101
102
|
if (!isValidPeriod) {
|
|
102
103
|
changeSettingDateAndAlert('end', !isValidPeriod);
|
|
103
104
|
}
|
|
104
|
-
}, [endDateOptions.currentDate]);
|
|
105
|
+
}, [endDateOptions.currentDate, startDateOptions.currentDate, validationOption, resetDateAndAlert, changeSettingDateAndAlert]);
|
|
105
106
|
return _jsxs("div", __assign({
|
|
106
|
-
className: "ncua-range-date-picker"
|
|
107
|
+
className: "ncua-range-date-picker",
|
|
108
|
+
ref: ref || undefined
|
|
107
109
|
}, {
|
|
108
|
-
children: [_jsx(DatePicker, __assign({}, startDateOptions
|
|
110
|
+
children: [_jsx(DatePicker, __assign({}, startDateOptions, {
|
|
111
|
+
ref: undefined
|
|
112
|
+
})), "-", _jsx(DatePicker, __assign({}, endDateOptions, {
|
|
113
|
+
ref: undefined
|
|
114
|
+
}))]
|
|
109
115
|
}));
|
|
110
|
-
};
|
|
116
|
+
});
|
|
117
|
+
RangeDatePicker.displayName = 'RangeDatePicker';
|