@ncds/ui-admin 1.4.1 → 1.5.0
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/comboBox.js +18 -0
- package/dist/cjs/assets/scripts/datePicker.js +60 -7
- package/dist/cjs/assets/scripts/imageFileInput/ImageFileInputModel.js +6 -19
- package/dist/cjs/assets/scripts/notification/MessageNotification.js +146 -0
- package/dist/cjs/assets/scripts/notification/Notification.js +6 -3
- package/dist/cjs/assets/scripts/notification/const/classNames.js +14 -0
- package/dist/cjs/assets/scripts/notification/const/index.js +14 -1
- package/dist/cjs/assets/scripts/notification/const/sizes.js +7 -1
- package/dist/cjs/assets/scripts/notification/const/types.js +10 -1
- package/dist/cjs/assets/scripts/notification/index.js +8 -0
- package/dist/cjs/assets/scripts/notification/utils.js +3 -3
- package/dist/cjs/assets/scripts/utils/selectbox/DropdownModel.js +7 -0
- package/dist/cjs/assets/scripts/utils/selectbox/UnifiedSelectBox.js +77 -43
- package/dist/cjs/src/components/button/ButtonStepper.js +22 -0
- package/dist/cjs/src/components/button/index.js +22 -0
- package/dist/cjs/src/components/date-picker/DatePicker.js +45 -6
- package/dist/cjs/src/components/date-picker/RangeDatePicker.js +3 -1
- package/dist/cjs/src/components/date-picker/RangeDatePickerWithButtons.js +7 -3
- package/dist/cjs/src/components/input/InputBase.js +1 -1
- package/dist/cjs/src/components/input/NumberInput.js +130 -0
- package/dist/cjs/src/components/input/index.js +11 -0
- package/dist/cjs/src/components/notification/MessageNotification.js +137 -0
- package/dist/cjs/src/components/notification/Notification.js +23 -9
- package/dist/cjs/src/components/notification/index.js +11 -0
- package/dist/cjs/src/components/tooltip/Tooltip.js +32 -21
- package/dist/esm/assets/scripts/comboBox.js +18 -0
- package/dist/esm/assets/scripts/datePicker.js +60 -7
- package/dist/esm/assets/scripts/imageFileInput/ImageFileInputModel.js +6 -19
- package/dist/esm/assets/scripts/notification/MessageNotification.js +141 -0
- package/dist/esm/assets/scripts/notification/Notification.js +6 -3
- package/dist/esm/assets/scripts/notification/const/classNames.js +14 -0
- package/dist/esm/assets/scripts/notification/const/index.js +2 -1
- package/dist/esm/assets/scripts/notification/const/sizes.js +6 -0
- package/dist/esm/assets/scripts/notification/const/types.js +8 -1
- package/dist/esm/assets/scripts/notification/index.js +1 -0
- package/dist/esm/assets/scripts/notification/utils.js +3 -3
- package/dist/esm/assets/scripts/utils/selectbox/DropdownModel.js +7 -0
- package/dist/esm/assets/scripts/utils/selectbox/UnifiedSelectBox.js +77 -43
- package/dist/esm/src/components/button/ButtonStepper.js +14 -0
- package/dist/esm/src/components/button/index.js +3 -1
- package/dist/esm/src/components/date-picker/DatePicker.js +46 -7
- package/dist/esm/src/components/date-picker/RangeDatePicker.js +3 -1
- package/dist/esm/src/components/date-picker/RangeDatePickerWithButtons.js +7 -3
- package/dist/esm/src/components/input/InputBase.js +1 -1
- package/dist/esm/src/components/input/NumberInput.js +124 -0
- package/dist/esm/src/components/input/index.js +1 -0
- package/dist/esm/src/components/notification/MessageNotification.js +130 -0
- package/dist/esm/src/components/notification/Notification.js +23 -9
- package/dist/esm/src/components/notification/index.js +2 -1
- package/dist/esm/src/components/tooltip/Tooltip.js +33 -22
- package/dist/types/assets/scripts/comboBox.d.ts +12 -0
- package/dist/types/assets/scripts/datePicker.d.ts +1 -0
- package/dist/types/assets/scripts/notification/MessageNotification.d.ts +23 -0
- package/dist/types/assets/scripts/notification/Notification.d.ts +1 -1
- package/dist/types/assets/scripts/notification/const/classNames.d.ts +14 -0
- package/dist/types/assets/scripts/notification/const/index.d.ts +2 -1
- package/dist/types/assets/scripts/notification/const/sizes.d.ts +5 -0
- package/dist/types/assets/scripts/notification/const/types.d.ts +1 -0
- package/dist/types/assets/scripts/notification/index.d.ts +1 -0
- package/dist/types/assets/scripts/utils/selectbox/DropdownModel.d.ts +4 -0
- package/dist/types/assets/scripts/utils/selectbox/UnifiedSelectBox.d.ts +20 -1
- package/dist/types/src/components/button/ButtonStepper.d.ts +10 -0
- package/dist/types/src/components/button/index.d.ts +2 -0
- package/dist/types/src/components/date-picker/DatePicker.d.ts +1 -0
- package/dist/types/src/components/date-picker/RangeDatePickerWithButtons.d.ts +4 -4
- package/dist/types/src/components/input/NumberInput.d.ts +10 -0
- package/dist/types/src/components/input/index.d.ts +1 -0
- package/dist/types/src/components/notification/MessageNotification.d.ts +40 -0
- package/dist/types/src/components/notification/Notification.d.ts +6 -1
- package/dist/types/src/components/notification/index.d.ts +1 -0
- package/dist/types/src/components/selectbox/SelectBox.d.ts +1 -1
- package/dist/types/src/components/tooltip/Tooltip.d.ts +4 -2
- package/dist/ui-admin/assets/styles/style.css +292 -10
- package/package.json +1 -1
|
@@ -19,10 +19,11 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
import classNames from 'classnames';
|
|
21
21
|
import { Korean } from 'flatpickr/dist/l10n/ko';
|
|
22
|
-
import
|
|
22
|
+
import moment from 'moment';
|
|
23
|
+
import { forwardRef, useId, useMemo } from 'react';
|
|
23
24
|
import Flatpickr from 'react-flatpickr';
|
|
24
|
-
import { CustomInput } from './CustomInput';
|
|
25
25
|
import { formatDateInput, formatHourInput, formatMinuteInput } from '../../utils/date-picker';
|
|
26
|
+
import { CustomInput } from './CustomInput';
|
|
26
27
|
var isValidDate = function (dateString) {
|
|
27
28
|
var date = new Date(dateString);
|
|
28
29
|
return date instanceof Date && !isNaN(date.getTime());
|
|
@@ -35,7 +36,9 @@ export var DatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
35
36
|
size = _c === void 0 ? 'xs' : _c,
|
|
36
37
|
onChangeDate = _a.onChangeDate,
|
|
37
38
|
datePickerOptions = _a.datePickerOptions,
|
|
38
|
-
|
|
39
|
+
_d = _a.isEndDate,
|
|
40
|
+
isEndDate = _d === void 0 ? false : _d,
|
|
41
|
+
attrs = __rest(_a, ["shouldFocus", "currentDate", "size", "onChangeDate", "datePickerOptions", "isEndDate"]);
|
|
39
42
|
var onChangeDateHandler = function (dateTimeStamp, dateStr) {
|
|
40
43
|
var formattedDate = formatDateInput(dateStr);
|
|
41
44
|
isValidDate(formattedDate) ? onChangeDate(formattedDate) : onChangeDate(dateStr);
|
|
@@ -83,27 +86,63 @@ export var DatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
83
86
|
if (!hourInput || !minuteInput) return;
|
|
84
87
|
hourInput.addEventListener('input', onHourInputHandler);
|
|
85
88
|
minuteInput.addEventListener('input', onMinuteInputHandler);
|
|
89
|
+
var handleMouseDown = function (e) {
|
|
90
|
+
var _a;
|
|
91
|
+
var flatpickrCalendar = (_a = input.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector('.flatpickr-calendar.open');
|
|
92
|
+
if (flatpickrCalendar && !flatpickrCalendar.contains(e.target)) {
|
|
93
|
+
var timeInputs = flatpickrCalendar.querySelectorAll('.flatpickr-time input');
|
|
94
|
+
timeInputs.forEach(function (timeInput) {
|
|
95
|
+
if (document.activeElement === timeInput) {
|
|
96
|
+
timeInput.blur();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
document.addEventListener('mousedown', handleMouseDown, true);
|
|
102
|
+
instance._handleMouseDown = handleMouseDown;
|
|
86
103
|
},
|
|
87
104
|
onDestroy: function (selectedDates, dateStr, instance) {
|
|
88
|
-
var _a
|
|
105
|
+
var _a;
|
|
89
106
|
var input = instance.input;
|
|
90
107
|
if (!input) return;
|
|
91
108
|
// 메인 input 이벤트 리스너 제거
|
|
92
109
|
input.removeEventListener('input', onInputHandler);
|
|
110
|
+
var timeInputWrapper = (_a = input.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector('.flatpickr-time');
|
|
111
|
+
if (!timeInputWrapper) return;
|
|
93
112
|
// 시간 input 이벤트 리스너 제거
|
|
94
|
-
var hourInput =
|
|
113
|
+
var hourInput = timeInputWrapper.querySelector('.flatpickr-hour');
|
|
95
114
|
if (hourInput) {
|
|
96
115
|
hourInput.removeEventListener('input', onHourInputHandler);
|
|
97
116
|
}
|
|
98
117
|
// 분 input 이벤트 리스너 제거
|
|
99
|
-
var minuteInput =
|
|
118
|
+
var minuteInput = timeInputWrapper.querySelector('.flatpickr-minute');
|
|
100
119
|
if (minuteInput) {
|
|
101
120
|
minuteInput.removeEventListener('input', onMinuteInputHandler);
|
|
102
121
|
}
|
|
122
|
+
var handleMouseDown = instance._handleMouseDown;
|
|
123
|
+
if (handleMouseDown) {
|
|
124
|
+
document.removeEventListener('mousedown', handleMouseDown, true);
|
|
125
|
+
}
|
|
103
126
|
}
|
|
104
127
|
}, datePickerOptions);
|
|
105
128
|
var hasTimeOption = datePickerOptions === null || datePickerOptions === void 0 ? void 0 : datePickerOptions.hasOwnProperty('enableTime');
|
|
106
129
|
var iconName = hasTimeOption && (datePickerOptions === null || datePickerOptions === void 0 ? void 0 : datePickerOptions.hasOwnProperty('noCalendar')) ? 'clock' : 'calendar';
|
|
130
|
+
var processedCurrentDate = useMemo(function () {
|
|
131
|
+
var hasTime = options.enableTime;
|
|
132
|
+
var isTimeOnly = options.noCalendar;
|
|
133
|
+
var hasSeconds = options.enableSeconds;
|
|
134
|
+
if (!hasTime && !isTimeOnly) return currentDate;
|
|
135
|
+
if (currentDate === null || currentDate === void 0 ? void 0 : currentDate.includes(':')) return currentDate;
|
|
136
|
+
if (isTimeOnly) {
|
|
137
|
+
var endTime = hasSeconds ? '23:59:59' : '23:59';
|
|
138
|
+
var startTime = hasSeconds ? '00:00:00' : '00:00';
|
|
139
|
+
return isEndDate ? endTime : startTime;
|
|
140
|
+
}
|
|
141
|
+
if (!currentDate) return '';
|
|
142
|
+
var format = hasSeconds ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm';
|
|
143
|
+
var momentDate = moment(currentDate);
|
|
144
|
+
return isEndDate ? momentDate.endOf('day').format(format) : momentDate.startOf('day').format(format);
|
|
145
|
+
}, [currentDate, isEndDate, options.enableSeconds, options.enableTime, options.noCalendar]);
|
|
107
146
|
return _jsxs("div", __assign({
|
|
108
147
|
className: classNames('ncua-date-picker', "ncua-date-picker--".concat(size), {
|
|
109
148
|
'ncua-date-picker--disabled': attrs.disabled,
|
|
@@ -115,7 +154,7 @@ export var DatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
115
154
|
ref: ref || undefined,
|
|
116
155
|
className: classNames('ncua-date-picker__input'),
|
|
117
156
|
options: options,
|
|
118
|
-
value:
|
|
157
|
+
value: processedCurrentDate,
|
|
119
158
|
render: function (_a, ref) {
|
|
120
159
|
var defaultValue = _a.defaultValue,
|
|
121
160
|
value = _a.value,
|
|
@@ -127,7 +127,9 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
127
127
|
children: [_jsx(DatePicker, __assign({}, startDateOptions, {
|
|
128
128
|
ref: undefined,
|
|
129
129
|
size: size
|
|
130
|
-
})), "~", _jsx(DatePicker, __assign({
|
|
130
|
+
})), "~", _jsx(DatePicker, __assign({
|
|
131
|
+
isEndDate: true
|
|
132
|
+
}, endDateOptions, {
|
|
131
133
|
ref: undefined,
|
|
132
134
|
size: size
|
|
133
135
|
}))]
|
|
@@ -15,8 +15,8 @@ import { getDateFormat, getSubtractDate } from '../../utils/date-picker';
|
|
|
15
15
|
import { ButtonGroup } from '../button';
|
|
16
16
|
import { RangeDatePicker } from './RangeDatePicker';
|
|
17
17
|
export var RangeDatePickerWithButtons = function (_a) {
|
|
18
|
-
var _b = _a.
|
|
19
|
-
|
|
18
|
+
var _b = _a.useYesterdayAsEndDate,
|
|
19
|
+
useYesterdayAsEndDate = _b === void 0 ? false : _b,
|
|
20
20
|
_c = _a.size,
|
|
21
21
|
size = _c === void 0 ? 'xs' : _c,
|
|
22
22
|
currentButtonId = _a.currentButtonId,
|
|
@@ -41,7 +41,11 @@ export var RangeDatePickerWithButtons = function (_a) {
|
|
|
41
41
|
unit: currentPeriodItem.unit
|
|
42
42
|
}));
|
|
43
43
|
startDateOptions.onChangeDate(startDate);
|
|
44
|
-
|
|
44
|
+
var endDate = useYesterdayAsEndDate ? getDateFormat(getSubtractDate({
|
|
45
|
+
period: 1,
|
|
46
|
+
unit: 'days'
|
|
47
|
+
})) : getDateFormat();
|
|
48
|
+
endDateOptions.onChangeDate(endDate);
|
|
45
49
|
};
|
|
46
50
|
var handleOnChangeDate = function (date, type) {
|
|
47
51
|
type === 'START' ? startDateOptions.onChangeDate(date) : endDateOptions.onChangeDate(date);
|
|
@@ -198,7 +198,7 @@ export var InputBase = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
198
198
|
type: "text",
|
|
199
199
|
disabled: disabled,
|
|
200
200
|
maxLength: maxLength
|
|
201
|
-
}, props)), renderClearButton(), trailingElement && renderInsideSlot(trailingElement, 'right')
|
|
201
|
+
}, props)), renderClearButton(), renderStatusIcon(), trailingElement && renderInsideSlot(trailingElement, 'right')]
|
|
202
202
|
})), trailingElement && renderOutsideSlot(trailingElement)]
|
|
203
203
|
})), showTextCount && maxLength && _jsxs("div", __assign({
|
|
204
204
|
className: "ncua-input__field-text-count"
|
|
@@ -0,0 +1,124 @@
|
|
|
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 { forwardRef, useCallback, useRef } from 'react';
|
|
21
|
+
import { useMergeRefs } from '../../hooks';
|
|
22
|
+
import { ButtonStepper } from '../button';
|
|
23
|
+
import { InputBase } from './InputBase';
|
|
24
|
+
export var NumberInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
25
|
+
var _b = _a.size,
|
|
26
|
+
size = _b === void 0 ? 'xs' : _b,
|
|
27
|
+
minValue = _a.minValue,
|
|
28
|
+
maxValue = _a.maxValue,
|
|
29
|
+
_c = _a.step,
|
|
30
|
+
step = _c === void 0 ? 1 : _c,
|
|
31
|
+
stepperPosition = _a.stepperPosition,
|
|
32
|
+
disabled = _a.disabled,
|
|
33
|
+
props = __rest(_a, ["size", "minValue", "maxValue", "step", "stepperPosition", "disabled"]);
|
|
34
|
+
var inputRef = useRef(null);
|
|
35
|
+
var mergedRef = useMergeRefs([ref, inputRef]);
|
|
36
|
+
var getCurrentValue = useCallback(function () {
|
|
37
|
+
var _a;
|
|
38
|
+
var value = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value;
|
|
39
|
+
return value ? parseFloat(value) : 0;
|
|
40
|
+
}, []);
|
|
41
|
+
var updateValue = useCallback(function (newValue) {
|
|
42
|
+
if (!inputRef.current) return;
|
|
43
|
+
// min/max 범위 체크
|
|
44
|
+
var clampedValue = newValue;
|
|
45
|
+
if (minValue !== undefined && clampedValue < minValue) {
|
|
46
|
+
clampedValue = minValue;
|
|
47
|
+
}
|
|
48
|
+
if (maxValue !== undefined && clampedValue > maxValue) {
|
|
49
|
+
clampedValue = maxValue;
|
|
50
|
+
}
|
|
51
|
+
inputRef.current.value = clampedValue.toString();
|
|
52
|
+
// onChange 이벤트 트리거
|
|
53
|
+
var event = new Event('input', {
|
|
54
|
+
bubbles: true
|
|
55
|
+
});
|
|
56
|
+
inputRef.current.dispatchEvent(event);
|
|
57
|
+
}, [minValue, maxValue]);
|
|
58
|
+
var handleIncrement = useCallback(function () {
|
|
59
|
+
var currentValue = getCurrentValue();
|
|
60
|
+
var newValue = currentValue + step;
|
|
61
|
+
if (maxValue === undefined || newValue <= maxValue) {
|
|
62
|
+
updateValue(newValue);
|
|
63
|
+
}
|
|
64
|
+
}, [getCurrentValue, step, maxValue, updateValue]);
|
|
65
|
+
var handleDecrement = useCallback(function () {
|
|
66
|
+
var currentValue = getCurrentValue();
|
|
67
|
+
var newValue = currentValue - step;
|
|
68
|
+
if (minValue === undefined || newValue >= minValue) {
|
|
69
|
+
updateValue(newValue);
|
|
70
|
+
}
|
|
71
|
+
}, [getCurrentValue, step, minValue, updateValue]);
|
|
72
|
+
var handleKeyDown = useCallback(function (event) {
|
|
73
|
+
var _a;
|
|
74
|
+
if (disabled) return;
|
|
75
|
+
if (event.key === 'ArrowUp') {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
handleIncrement();
|
|
78
|
+
} else if (event.key === 'ArrowDown') {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
handleDecrement();
|
|
81
|
+
}
|
|
82
|
+
// 기존 onKeyDown prop이 있으면 호출
|
|
83
|
+
(_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
84
|
+
}, [disabled, handleIncrement, handleDecrement, props]);
|
|
85
|
+
var renderStepperButtonGroup = function (position) {
|
|
86
|
+
if (position !== stepperPosition) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
return _jsxs("div", __assign({
|
|
90
|
+
className: "ncua-input__stepper-button-group"
|
|
91
|
+
}, {
|
|
92
|
+
children: [_jsx(ButtonStepper, {
|
|
93
|
+
size: size,
|
|
94
|
+
direction: "up",
|
|
95
|
+
onClick: handleIncrement,
|
|
96
|
+
disabled: disabled
|
|
97
|
+
}), _jsx(ButtonStepper, {
|
|
98
|
+
size: size,
|
|
99
|
+
direction: "down",
|
|
100
|
+
onClick: handleDecrement,
|
|
101
|
+
disabled: disabled
|
|
102
|
+
})]
|
|
103
|
+
}));
|
|
104
|
+
};
|
|
105
|
+
return _jsx(InputBase, __assign({
|
|
106
|
+
type: "number",
|
|
107
|
+
leadingElement: renderStepperButtonGroup('leading') ? {
|
|
108
|
+
type: 'custom',
|
|
109
|
+
children: renderStepperButtonGroup('leading')
|
|
110
|
+
} : props.leadingElement,
|
|
111
|
+
trailingElement: renderStepperButtonGroup('trailing') ? {
|
|
112
|
+
type: 'custom',
|
|
113
|
+
children: renderStepperButtonGroup('trailing')
|
|
114
|
+
} : props.trailingElement,
|
|
115
|
+
ref: mergedRef,
|
|
116
|
+
size: size,
|
|
117
|
+
disabled: disabled,
|
|
118
|
+
min: minValue,
|
|
119
|
+
max: maxValue,
|
|
120
|
+
step: step,
|
|
121
|
+
onKeyDown: handleKeyDown,
|
|
122
|
+
className: "ncua-input__number"
|
|
123
|
+
}, props));
|
|
124
|
+
});
|
|
@@ -0,0 +1,130 @@
|
|
|
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/dynamic';
|
|
21
|
+
import classNames from 'classnames';
|
|
22
|
+
import { forwardRef } from 'react';
|
|
23
|
+
import { COLOR } from '../../../constant/color';
|
|
24
|
+
import { Button } from '../button';
|
|
25
|
+
import { FeaturedIcon } from '../featured-icon/FeaturedIcon';
|
|
26
|
+
var iconNameMap = {
|
|
27
|
+
neutral: 'pin-02',
|
|
28
|
+
error: 'alert-triangle',
|
|
29
|
+
warning: 'alert-circle',
|
|
30
|
+
success: 'check-circle'
|
|
31
|
+
};
|
|
32
|
+
var iconColorMap = {
|
|
33
|
+
neutral: 'gray700',
|
|
34
|
+
error: 'red500',
|
|
35
|
+
warning: 'orange500',
|
|
36
|
+
success: 'green600'
|
|
37
|
+
};
|
|
38
|
+
export var MessageNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
39
|
+
var title = _a.title,
|
|
40
|
+
supportingText = _a.supportingText,
|
|
41
|
+
icon = _a.icon,
|
|
42
|
+
_b = _a.color,
|
|
43
|
+
color = _b === void 0 ? 'neutral' : _b,
|
|
44
|
+
onClose = _a.onClose,
|
|
45
|
+
className = _a.className,
|
|
46
|
+
actions = _a.actions,
|
|
47
|
+
onHidePermanently = _a.onHidePermanently,
|
|
48
|
+
rest = __rest(_a, ["title", "supportingText", "icon", "color", "onClose", "className", "actions", "onHidePermanently"]);
|
|
49
|
+
// message 타입은 neutral, error, warning, success 4가지 색상만 지원
|
|
50
|
+
var validColor = color === 'info' ? 'neutral' : color;
|
|
51
|
+
var iconColor = validColor;
|
|
52
|
+
var featuredIconProps = {
|
|
53
|
+
name: icon || iconNameMap[validColor] || 'pin-02',
|
|
54
|
+
size: 'lg',
|
|
55
|
+
color: iconColor,
|
|
56
|
+
theme: 'light-circle'
|
|
57
|
+
};
|
|
58
|
+
var closeIconColor = COLOR[iconColorMap[validColor] || 'gray700'];
|
|
59
|
+
return _jsx("div", __assign({
|
|
60
|
+
ref: ref,
|
|
61
|
+
className: classNames('ncua-message-notification', "ncua-message-notification--".concat(validColor), className),
|
|
62
|
+
role: "alert"
|
|
63
|
+
}, rest, {
|
|
64
|
+
children: _jsx("div", __assign({
|
|
65
|
+
className: "ncua-message-notification__container"
|
|
66
|
+
}, {
|
|
67
|
+
children: _jsxs("div", __assign({
|
|
68
|
+
className: "ncua-message-notification__content"
|
|
69
|
+
}, {
|
|
70
|
+
children: [_jsxs("div", __assign({
|
|
71
|
+
className: "ncua-message-notification__content-wrapper"
|
|
72
|
+
}, {
|
|
73
|
+
children: [iconNameMap[validColor] && _jsx(FeaturedIcon, __assign({}, featuredIconProps, {
|
|
74
|
+
className: "ncua-message-notification__icon"
|
|
75
|
+
})), _jsxs("div", __assign({
|
|
76
|
+
className: "ncua-message-notification__text-container"
|
|
77
|
+
}, {
|
|
78
|
+
children: [_jsx("span", __assign({
|
|
79
|
+
className: "ncua-message-notification__title"
|
|
80
|
+
}, {
|
|
81
|
+
children: title
|
|
82
|
+
})), supportingText && _jsx("span", __assign({
|
|
83
|
+
className: "ncua-message-notification__supporting-text"
|
|
84
|
+
}, {
|
|
85
|
+
children: supportingText
|
|
86
|
+
}))]
|
|
87
|
+
}))]
|
|
88
|
+
})), _jsx("div", __assign({
|
|
89
|
+
className: "ncua-message-notification__actions-container"
|
|
90
|
+
}, {
|
|
91
|
+
children: actions && _jsx("div", __assign({
|
|
92
|
+
className: "ncua-message-notification__actions"
|
|
93
|
+
}, {
|
|
94
|
+
children: actions.map(function (action) {
|
|
95
|
+
return _jsx(Button, {
|
|
96
|
+
size: "xs",
|
|
97
|
+
hierarchy: action.hierarchy || 'text',
|
|
98
|
+
label: action.label,
|
|
99
|
+
onClick: action === null || action === void 0 ? void 0 : action.onClick
|
|
100
|
+
}, "".concat(action.label, "-").concat(action.hierarchy));
|
|
101
|
+
})
|
|
102
|
+
}))
|
|
103
|
+
})), _jsxs("div", __assign({
|
|
104
|
+
className: "ncua-message-notification__footer-container"
|
|
105
|
+
}, {
|
|
106
|
+
children: [onHidePermanently && _jsx("button", __assign({
|
|
107
|
+
type: "button",
|
|
108
|
+
className: classNames('ncua-notification__action-button', 'ncua-notification__action-button--text', 'ncua-message-notification__hide-link'),
|
|
109
|
+
onClick: onHidePermanently
|
|
110
|
+
}, {
|
|
111
|
+
children: "\uB2E4\uC2DC \uBCF4\uC9C0 \uC54A\uAE30"
|
|
112
|
+
})), onClose && _jsx("button", __assign({
|
|
113
|
+
type: "button",
|
|
114
|
+
className: "ncua-message-notification__close-button",
|
|
115
|
+
onClick: onClose,
|
|
116
|
+
"aria-label": "\uC54C\uB9BC \uB2EB\uAE30"
|
|
117
|
+
}, {
|
|
118
|
+
children: _jsx(Icon, {
|
|
119
|
+
name: "x-close",
|
|
120
|
+
width: 20,
|
|
121
|
+
height: 20,
|
|
122
|
+
color: closeIconColor
|
|
123
|
+
})
|
|
124
|
+
}))]
|
|
125
|
+
}))]
|
|
126
|
+
}))
|
|
127
|
+
}))
|
|
128
|
+
}));
|
|
129
|
+
});
|
|
130
|
+
MessageNotification.displayName = 'MessageNotification';
|
|
@@ -20,20 +20,34 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
20
20
|
import { forwardRef } from 'react';
|
|
21
21
|
import { FloatingNotification } from './FloatingNotification';
|
|
22
22
|
import { FullWidthNotification } from './FullWidthNotification';
|
|
23
|
+
import { MessageNotification } from './MessageNotification';
|
|
23
24
|
export var Notification = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
24
25
|
var _b = _a.type,
|
|
25
26
|
type = _b === void 0 ? 'floating' : _b,
|
|
26
27
|
_c = _a.color,
|
|
27
28
|
color = _c === void 0 ? 'neutral' : _c,
|
|
28
29
|
rest = __rest(_a, ["type", "color"]);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
if (type === 'floating') {
|
|
31
|
+
return _jsx(FloatingNotification, __assign({
|
|
32
|
+
color: color
|
|
33
|
+
}, rest, {
|
|
34
|
+
ref: ref
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
if (type === 'full-width') {
|
|
38
|
+
return _jsx(FullWidthNotification, __assign({
|
|
39
|
+
color: color
|
|
40
|
+
}, rest, {
|
|
41
|
+
ref: ref
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
if (type === 'message') {
|
|
45
|
+
return _jsx(MessageNotification, __assign({
|
|
46
|
+
color: color
|
|
47
|
+
}, rest, {
|
|
48
|
+
ref: ref
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
38
52
|
});
|
|
39
53
|
Notification.displayName = 'Notification';
|
|
@@ -9,7 +9,7 @@ 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 { HelpCircle, HelpCircleFill } from '@ncds/ui-admin-icon';
|
|
12
|
+
import { AlertCircle, AlertCircleFill, HelpCircle, HelpCircleFill } from '@ncds/ui-admin-icon';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { useRef, useState, useCallback, useMemo } from 'react';
|
|
15
15
|
import { ButtonCloseX } from '../button/ButtonCloseX';
|
|
@@ -67,22 +67,26 @@ export var Tooltip = function (_a) {
|
|
|
67
67
|
hideArrow = _f === void 0 ? false : _f,
|
|
68
68
|
_g = _a.type,
|
|
69
69
|
type = _g === void 0 ? 'short' : _g,
|
|
70
|
+
_h = _a.iconColor,
|
|
71
|
+
iconColor = _h === void 0 ? 'var(--gray-300)' : _h,
|
|
72
|
+
_j = _a.iconStyle,
|
|
73
|
+
iconStyle = _j === void 0 ? 'help-circle' : _j,
|
|
70
74
|
className = _a.className;
|
|
71
75
|
var iconSize = size === 'sm' ? 14 : 16;
|
|
72
76
|
var tooltipRef = useRef(null);
|
|
73
77
|
var tooltipBgRef = useRef(null);
|
|
74
|
-
var
|
|
75
|
-
calculatedPosition =
|
|
76
|
-
setCalculatedPosition =
|
|
77
|
-
var _j = useState(false),
|
|
78
|
-
isVisible = _j[0],
|
|
79
|
-
setIsVisible = _j[1];
|
|
80
|
-
var _k = useState(false),
|
|
81
|
-
isManuallyClose = _k[0],
|
|
82
|
-
setIsManuallyClose = _k[1];
|
|
78
|
+
var _k = useState(position === 'auto' ? 'bottom' : position),
|
|
79
|
+
calculatedPosition = _k[0],
|
|
80
|
+
setCalculatedPosition = _k[1];
|
|
83
81
|
var _l = useState(false),
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
isVisible = _l[0],
|
|
83
|
+
setIsVisible = _l[1];
|
|
84
|
+
var _m = useState(false),
|
|
85
|
+
isManuallyClose = _m[0],
|
|
86
|
+
setIsManuallyClose = _m[1];
|
|
87
|
+
var _o = useState(false),
|
|
88
|
+
isMeasuring = _o[0],
|
|
89
|
+
setIsMeasuring = _o[1];
|
|
86
90
|
var handleMouseEnter = useCallback(function () {
|
|
87
91
|
if (isManuallyClose) return;
|
|
88
92
|
setIsVisible(true);
|
|
@@ -130,15 +134,23 @@ export var Tooltip = function (_a) {
|
|
|
130
134
|
onMouseEnter: handleMouseEnter,
|
|
131
135
|
onMouseLeave: handleMouseLeave
|
|
132
136
|
}, {
|
|
133
|
-
children: [iconType === 'stroke' ? _jsx(HelpCircle, {
|
|
137
|
+
children: [iconStyle === 'help-circle' && (iconType === 'stroke' ? _jsx(HelpCircle, {
|
|
134
138
|
width: iconSize,
|
|
135
139
|
height: iconSize,
|
|
136
|
-
color:
|
|
140
|
+
color: iconColor
|
|
137
141
|
}) : _jsx(HelpCircleFill, {
|
|
138
142
|
width: iconSize,
|
|
139
143
|
height: iconSize,
|
|
140
|
-
color:
|
|
141
|
-
}),
|
|
144
|
+
color: iconColor
|
|
145
|
+
})), iconStyle === 'alert-circle' && (iconType === 'stroke' ? _jsx(AlertCircle, {
|
|
146
|
+
width: iconSize,
|
|
147
|
+
height: iconSize,
|
|
148
|
+
color: iconColor
|
|
149
|
+
}) : _jsx(AlertCircleFill, {
|
|
150
|
+
width: iconSize,
|
|
151
|
+
height: iconSize,
|
|
152
|
+
color: iconColor
|
|
153
|
+
})), _jsxs("span", __assign({
|
|
142
154
|
ref: tooltipBgRef,
|
|
143
155
|
className: tooltipBgClassName
|
|
144
156
|
}, {
|
|
@@ -146,12 +158,11 @@ export var Tooltip = function (_a) {
|
|
|
146
158
|
className: "ncua-tooltip__title"
|
|
147
159
|
}, {
|
|
148
160
|
children: title
|
|
149
|
-
})), content && _jsx("span", {
|
|
150
|
-
className: "ncua-tooltip__content"
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}), type === 'long' && _jsx(ButtonCloseX, {
|
|
161
|
+
})), content && _jsx("span", __assign({
|
|
162
|
+
className: "ncua-tooltip__content"
|
|
163
|
+
}, {
|
|
164
|
+
children: content
|
|
165
|
+
})), type === 'long' && _jsx(ButtonCloseX, {
|
|
155
166
|
className: "ncua-tooltip__close-button",
|
|
156
167
|
size: "xs",
|
|
157
168
|
theme: tooltipType === 'white' ? 'dark' : 'light',
|
|
@@ -75,5 +75,17 @@ export declare class ComboBox {
|
|
|
75
75
|
getSelectedCount(): number;
|
|
76
76
|
isMultiple(): boolean;
|
|
77
77
|
toggleSelectAll(): void;
|
|
78
|
+
/**
|
|
79
|
+
* 드롭다운을 스크롤의 바닥으로 이동
|
|
80
|
+
*/
|
|
81
|
+
scrollToBottom(): void;
|
|
82
|
+
/**
|
|
83
|
+
* 전체 선택 버튼의 텍스트를 외부에서 변경
|
|
84
|
+
*/
|
|
85
|
+
setSelectAllButtonText(text: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* 특정 인덱스의 옵션으로 포커스 이동
|
|
88
|
+
*/
|
|
89
|
+
setFocusIndex(index: number): void;
|
|
78
90
|
}
|
|
79
91
|
//# sourceMappingURL=comboBox.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseNotificationOptions } from './const';
|
|
2
|
+
export interface MessageNotificationOptions extends BaseNotificationOptions {
|
|
3
|
+
type?: 'message';
|
|
4
|
+
}
|
|
5
|
+
export declare class MessageNotification {
|
|
6
|
+
private element;
|
|
7
|
+
private options;
|
|
8
|
+
private autoCloseTimer?;
|
|
9
|
+
private featuredIcon?;
|
|
10
|
+
constructor(options: MessageNotificationOptions);
|
|
11
|
+
private createElement;
|
|
12
|
+
private buildTemplate;
|
|
13
|
+
private renderHidePermanentlyButton;
|
|
14
|
+
private renderCloseButton;
|
|
15
|
+
private bindEvents;
|
|
16
|
+
private setupAutoClose;
|
|
17
|
+
getElement(): HTMLElement;
|
|
18
|
+
appendTo(parent: HTMLElement): void;
|
|
19
|
+
remove(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
static create(options: MessageNotificationOptions): MessageNotification;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=MessageNotification.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NotificationColor, BaseNotificationOptions } from './const';
|
|
2
2
|
export interface NotificationOptions extends BaseNotificationOptions {
|
|
3
|
-
type?: 'full-width' | 'floating';
|
|
3
|
+
type?: 'full-width' | 'floating' | 'message';
|
|
4
4
|
}
|
|
5
5
|
export declare class Notification {
|
|
6
6
|
private instance;
|
|
@@ -23,6 +23,20 @@ export declare const CLASS_NAMES: {
|
|
|
23
23
|
readonly ACTIONS: "ncua-floating-notification__actions";
|
|
24
24
|
readonly CLOSE_BUTTON: "ncua-floating-notification__close-button";
|
|
25
25
|
};
|
|
26
|
+
readonly MESSAGE: {
|
|
27
|
+
readonly BASE: "ncua-message-notification";
|
|
28
|
+
readonly CONTAINER: "ncua-message-notification__container";
|
|
29
|
+
readonly CONTENT: "ncua-message-notification__content";
|
|
30
|
+
readonly CONTENT_WRAPPER: "ncua-message-notification__content-wrapper";
|
|
31
|
+
readonly ICON: "ncua-message-notification__icon";
|
|
32
|
+
readonly TEXT_CONTAINER: "ncua-message-notification__text-container";
|
|
33
|
+
readonly TITLE: "ncua-message-notification__title";
|
|
34
|
+
readonly SUPPORTING_TEXT: "ncua-message-notification__supporting-text";
|
|
35
|
+
readonly ACTIONS_CONTAINER: "ncua-message-notification__actions-container";
|
|
36
|
+
readonly ACTIONS: "ncua-message-notification__actions";
|
|
37
|
+
readonly HIDE_LINK: "ncua-message-notification__hide-link";
|
|
38
|
+
readonly CLOSE_BUTTON: "ncua-message-notification__close-button";
|
|
39
|
+
};
|
|
26
40
|
readonly COMMON: {
|
|
27
41
|
readonly ACTION_BUTTON: "ncua-notification__action-button";
|
|
28
42
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { NotificationColor, NotificationHierarchy, NotificationAction, BaseNotificationOptions } from './types';
|
|
2
2
|
export { SVG_ICONS, FLOATING_ICON_MAP, FULL_WIDTH_ICON_MAP, ICON_MAP } from './icons';
|
|
3
3
|
export { CLASS_NAMES } from './classNames';
|
|
4
|
-
export { FEATURED_ICON_SIZES, ICON_PIXEL_SIZES, CLOSE_BUTTON_SIZES, CLOSE_BUTTON_SVG_SIZES, FULL_WIDTH_SIZES, getSizes, } from './sizes';
|
|
4
|
+
export { FEATURED_ICON_SIZES, ICON_PIXEL_SIZES, CLOSE_BUTTON_SIZES, CLOSE_BUTTON_SVG_SIZES, FULL_WIDTH_SIZES, MESSAGE_SIZES, getSizes, } from './sizes';
|
|
5
|
+
export { MESSAGE_CLOSE_ICON_COLORS } from './types';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -19,6 +19,11 @@ export declare const FULL_WIDTH_SIZES: {
|
|
|
19
19
|
readonly ICON: "16";
|
|
20
20
|
readonly CLOSE_BUTTON: "20";
|
|
21
21
|
};
|
|
22
|
+
export declare const MESSAGE_SIZES: {
|
|
23
|
+
readonly FEATURED_ICON: "lg";
|
|
24
|
+
readonly ICON_PIXEL: "24";
|
|
25
|
+
readonly CLOSE_BUTTON: "20";
|
|
26
|
+
};
|
|
22
27
|
export declare const getSizes: {
|
|
23
28
|
readonly featuredIcon: (isMobile: boolean) => "sm" | "md";
|
|
24
29
|
readonly iconPixel: (isMobile: boolean) => "16" | "20";
|