@ncds/ui-admin 0.0.33 → 0.0.35

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.
@@ -0,0 +1,248 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DatePicker = void 0;
7
+ var __assign = void 0 && (void 0).__assign || function () {
8
+ __assign = Object.assign || function (t) {
9
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
10
+ s = arguments[i];
11
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
12
+ }
13
+ return t;
14
+ };
15
+ return __assign.apply(this, arguments);
16
+ };
17
+ // Constants
18
+ var CONSTANTS = {
19
+ ICON_SIZES: {
20
+ sm: '14',
21
+ md: '16'
22
+ },
23
+ CLASS_NAMES: {
24
+ RANGE_WRAPPER: 'ncua-range-date-picker',
25
+ RANGE_WITH_BUTTONS: 'ncua-range-date-picker-with-buttons',
26
+ DATE_PICKER: 'ncua-date-picker',
27
+ DATE_PICKER_INPUT: 'ncua-date-picker__input',
28
+ DATE_PICKER_ICO: 'ncua-date-picker__ico',
29
+ BUTTON_GROUP: 'ncua-button-group',
30
+ BUTTON_GROUP_HAS_BORDER: 'has-border',
31
+ BUTTON: 'ncua-button-group__item'
32
+ },
33
+ FORMATS: {
34
+ DATE: 'YYYY-MM-DD'
35
+ },
36
+ ERROR_MESSAGES: {
37
+ FLATPICKR_NOT_LOADED: 'flatpickr 라이브러리가 로드되지 않았습니다.',
38
+ MOMENT_NOT_LOADED: 'moment 라이브러리가 로드되지 않았습니다.'
39
+ }
40
+ };
41
+ var DatePicker = exports.DatePicker = /** @class */function () {
42
+ function DatePicker(wrapper, options) {
43
+ this.flatpickrInstances = [];
44
+ this.currentButton = null;
45
+ var _a = options.buttons,
46
+ buttons = _a === void 0 ? [] : _a,
47
+ size = options.size,
48
+ datePickerOptions = options.datePickerOptions;
49
+ this.validationDependencies((buttons === null || buttons === void 0 ? void 0 : buttons.length) > 0);
50
+ this.element = wrapper;
51
+ this.datePickerOptions = datePickerOptions;
52
+ this.buttons = buttons;
53
+ this.size = size;
54
+ this.init();
55
+ }
56
+ DatePicker.prototype.init = function () {
57
+ this.element.innerHTML = '';
58
+ this.initializeWrapper();
59
+ this.initButtonGroup();
60
+ this.initDatePicker();
61
+ };
62
+ DatePicker.prototype.validationDependencies = function (hasButtons) {
63
+ if (typeof flatpickr === 'undefined') {
64
+ throw new Error(CONSTANTS.ERROR_MESSAGES.FLATPICKR_NOT_LOADED);
65
+ }
66
+ if (hasButtons && typeof moment === 'undefined') {
67
+ throw new Error(CONSTANTS.ERROR_MESSAGES.MOMENT_NOT_LOADED);
68
+ }
69
+ };
70
+ DatePicker.prototype.initializeWrapper = function () {
71
+ if (this.datePickerOptions.length < 2) return;
72
+ this.element.classList.add(CONSTANTS.CLASS_NAMES.RANGE_WRAPPER);
73
+ };
74
+ DatePicker.prototype.initButtonGroup = function () {
75
+ var _this = this;
76
+ if (this.buttons.length === 0) return;
77
+ this.element.classList.add(CONSTANTS.CLASS_NAMES.RANGE_WITH_BUTTONS);
78
+ var createButtonWrapperElement = function () {
79
+ var wrapper = document.createElement('div');
80
+ wrapper.className = "".concat(CONSTANTS.CLASS_NAMES.BUTTON_GROUP, " ").concat(CONSTANTS.CLASS_NAMES.BUTTON_GROUP_HAS_BORDER, " ").concat(CONSTANTS.CLASS_NAMES.BUTTON_GROUP, "--").concat(_this.size);
81
+ return wrapper;
82
+ };
83
+ var appendButtons = function (wrapper) {
84
+ _this.buttons.forEach(function (button) {
85
+ var buttonElement = _this.createButtonElement(button);
86
+ wrapper.appendChild(buttonElement);
87
+ });
88
+ };
89
+ var wrapper = createButtonWrapperElement();
90
+ appendButtons(wrapper);
91
+ wrapper.addEventListener('click', this.updateDateWithButton.bind(this));
92
+ this.element.appendChild(wrapper);
93
+ };
94
+ DatePicker.prototype.createButtonElement = function (button) {
95
+ if (button.isCurrent) {
96
+ this.currentButton = button;
97
+ }
98
+ var buttonElement = document.createElement('button');
99
+ buttonElement.className = "".concat(CONSTANTS.CLASS_NAMES.BUTTON, " ").concat(button.isCurrent ? 'is-current' : '');
100
+ buttonElement.textContent = button.text;
101
+ buttonElement.type = 'button';
102
+ return buttonElement;
103
+ };
104
+ DatePicker.prototype.reRenderButtonGroup = function (buttons) {
105
+ var _this = this;
106
+ var buttonGroup = this.element.querySelector(".".concat(CONSTANTS.CLASS_NAMES.BUTTON_GROUP));
107
+ if (!buttonGroup) return;
108
+ buttonGroup.innerHTML = '';
109
+ buttons.forEach(function (button) {
110
+ if (button.isCurrent) {
111
+ _this.currentButton = button;
112
+ }
113
+ buttonGroup.appendChild(_this.createButtonElement(button));
114
+ });
115
+ this.buttons = buttons;
116
+ };
117
+ DatePicker.prototype.initDatePicker = function () {
118
+ var _this = this;
119
+ var datePickerOptions = this.datePickerOptions;
120
+ var createWrapperElement = function (size) {
121
+ var wrapper = document.createElement('div');
122
+ wrapper.className = "".concat(CONSTANTS.CLASS_NAMES.DATE_PICKER, " ").concat(CONSTANTS.CLASS_NAMES.DATE_PICKER, "--").concat(size);
123
+ return wrapper;
124
+ };
125
+ var createInput = function (elementId) {
126
+ var input = document.createElement('input');
127
+ input.type = 'text';
128
+ input.id = elementId;
129
+ input.className = CONSTANTS.CLASS_NAMES.DATE_PICKER_INPUT;
130
+ return input;
131
+ };
132
+ var createIcon = function (size) {
133
+ var getCalendarIconSvg = function (size) {
134
+ return "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(size, "\" height=\"").concat(size, "\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M14 6.66671H2M10.6667 1.33337V4.00004M5.33333 1.33337V4.00004M5.2 14.6667H10.8C11.9201 14.6667 12.4802 14.6667 12.908 14.4487C13.2843 14.257 13.5903 13.951 13.782 13.5747C14 13.1469 14 12.5868 14 11.4667V5.86671C14 4.7466 14 4.18655 13.782 3.75873C13.5903 3.3824 13.2843 3.07644 12.908 2.88469C12.4802 2.66671 11.9201 2.66671 10.8 2.66671H5.2C4.0799 2.66671 3.51984 2.66671 3.09202 2.88469C2.71569 3.07644 2.40973 3.3824 2.21799 3.75873C2 4.18655 2 4.7466 2 5.86671V11.4667C2 12.5868 2 13.1469 2.21799 13.5747C2.40973 13.951 2.71569 14.257 3.09202 14.4487C3.51984 14.6667 4.0799 14.6667 5.2 14.6667Z\"\n stroke=\"black\"\n stroke-width=\"1.33333\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n ></path>\n </svg>");
135
+ };
136
+ var ico = document.createElement('span');
137
+ ico.className = CONSTANTS.CLASS_NAMES.DATE_PICKER_ICO;
138
+ ico.innerHTML = getCalendarIconSvg(CONSTANTS.ICON_SIZES[size]);
139
+ return ico;
140
+ };
141
+ var insertSeparator = function () {
142
+ var span = document.createElement('span');
143
+ span.textContent = '-';
144
+ _this.element.insertBefore(span, _this.element.querySelectorAll(".".concat(CONSTANTS.CLASS_NAMES.DATE_PICKER))[1]);
145
+ };
146
+ var createDatePickerElement = function (datePickerOption, index) {
147
+ var wrapper = createWrapperElement(_this.size);
148
+ var input = createInput(datePickerOption.element);
149
+ wrapper.appendChild(input);
150
+ wrapper.appendChild(createIcon(_this.size));
151
+ wrapper.addEventListener('click', function () {
152
+ _this.buttons.forEach(function (button) {
153
+ return button.isCurrent = false;
154
+ });
155
+ _this.currentButton = null;
156
+ _this.reRenderButtonGroup(_this.buttons);
157
+ });
158
+ _this.element.appendChild(wrapper);
159
+ if (index > 0) {
160
+ insertSeparator();
161
+ }
162
+ return _this.initializeFlatpickr(input, datePickerOption.options, wrapper);
163
+ };
164
+ var createFlatpickrInstances = function (datePickerOptions) {
165
+ return datePickerOptions.map(function (datePickerOption, index) {
166
+ return createDatePickerElement(datePickerOption, index);
167
+ });
168
+ };
169
+ var calcInitDates = function (datePickerOptions) {
170
+ var _a;
171
+ if (_this.buttons.length > 0) {
172
+ var _b = (_a = _this.buttons.find(function (button) {
173
+ return button.isCurrent;
174
+ })) !== null && _a !== void 0 ? _a : {
175
+ period: 0,
176
+ unit: 'days'
177
+ },
178
+ period = _b.period,
179
+ unit = _b.unit;
180
+ return [moment().subtract(period, unit).format(CONSTANTS.FORMATS.DATE), moment().format(CONSTANTS.FORMATS.DATE)];
181
+ }
182
+ return datePickerOptions.map(function (datePickerOption) {
183
+ var _a;
184
+ if ((_a = datePickerOption.options) === null || _a === void 0 ? void 0 : _a.defaultDate) {
185
+ return moment(datePickerOption.options.defaultDate.toString()).format(CONSTANTS.FORMATS.DATE);
186
+ }
187
+ return moment().format(CONSTANTS.FORMATS.DATE);
188
+ });
189
+ };
190
+ this.flatpickrInstances = createFlatpickrInstances(datePickerOptions);
191
+ var dates = calcInitDates(datePickerOptions);
192
+ this.setMultipleDates(dates);
193
+ };
194
+ DatePicker.prototype.initializeFlatpickr = function (input, options, wrapper) {
195
+ return flatpickr(input, __assign(__assign({}, options), {
196
+ appendTo: wrapper
197
+ }));
198
+ };
199
+ DatePicker.prototype.updateDateWithButton = function (e) {
200
+ var _this = this;
201
+ var target = e.target;
202
+ if (!target.classList.contains(CONSTANTS.CLASS_NAMES.BUTTON)) return;
203
+ var clickedButton = this.buttons.find(function (button) {
204
+ return button.text === target.textContent;
205
+ });
206
+ if (!clickedButton || clickedButton === this.currentButton) return;
207
+ // 날짜 계산
208
+ var calculateDates = function () {
209
+ var period = clickedButton.period,
210
+ unit = clickedButton.unit;
211
+ var dates = [];
212
+ var startDate = period ? moment().subtract(period, unit).format(CONSTANTS.FORMATS.DATE) : moment().format(CONSTANTS.FORMATS.DATE);
213
+ dates.push(startDate);
214
+ if (_this.datePickerOptions.length > 1) {
215
+ var endDate = moment().format(CONSTANTS.FORMATS.DATE);
216
+ dates.push(endDate);
217
+ }
218
+ return dates;
219
+ };
220
+ var updateButtonState = function () {
221
+ return _this.buttons.map(function (button) {
222
+ return __assign(__assign({}, button), {
223
+ isCurrent: button.text === (clickedButton === null || clickedButton === void 0 ? void 0 : clickedButton.text)
224
+ });
225
+ });
226
+ };
227
+ this.currentButton = clickedButton;
228
+ this.reRenderButtonGroup(updateButtonState());
229
+ this.setMultipleDates(calculateDates());
230
+ };
231
+ DatePicker.prototype.setMultipleDates = function (dates) {
232
+ var _this = this;
233
+ dates.forEach(function (date, index) {
234
+ _this.flatpickrInstances[index].setDate(date, true);
235
+ _this.flatpickrInstances[index].redraw();
236
+ });
237
+ };
238
+ DatePicker.prototype.setDate = function (dates) {
239
+ this.setMultipleDates(dates);
240
+ };
241
+ DatePicker.prototype.getDates = function () {
242
+ return this.flatpickrInstances.flatMap(function (instance) {
243
+ return instance.selectedDates;
244
+ });
245
+ };
246
+ return DatePicker;
247
+ }();
248
+ window.DatePicker = DatePicker;
@@ -1,27 +1,10 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _test = require("./test");
7
- Object.keys(_test).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _test[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _test[key];
14
- }
15
- });
16
- });
3
+ var _datePicker = require("./datePicker");
17
4
  var _slider = require("./slider");
18
- Object.keys(_slider).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _slider[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _slider[key];
25
- }
26
- });
27
- });
5
+ var _tab = require("./tab");
6
+ window.ncua = {
7
+ Slider: _slider.Slider,
8
+ Tab: _tab.Tab,
9
+ DatePicker: _datePicker.DatePicker
10
+ };
@@ -17,9 +17,6 @@ var Slider = exports.Slider = /** @class */function () {
17
17
  e.preventDefault();
18
18
  _this.handleInteractionStart(e.clientX, targetElement);
19
19
  if (_this.isDragging) {
20
- // 드래그 이벤트 추가
21
- document.addEventListener('mousemove', _this.handleMouseMove);
22
- document.addEventListener('mouseup', _this.handleMouseUp);
23
20
  // 텍스트 선택 방지
24
21
  document.body.style.userSelect = 'none';
25
22
  }
@@ -29,13 +26,6 @@ var Slider = exports.Slider = /** @class */function () {
29
26
  var targetElement = e.target;
30
27
  e.preventDefault();
31
28
  _this.handleInteractionStart(e.touches[0].clientX, targetElement);
32
- if (_this.isDragging) {
33
- // 드래그 이벤트 추가
34
- document.addEventListener('touchmove', _this.handleTouchMove, {
35
- passive: false
36
- });
37
- document.addEventListener('touchend', _this.handleTouchEnd);
38
- }
39
29
  }
40
30
  };
41
31
  this.handleMouseMove = function (e) {
@@ -52,13 +42,9 @@ var Slider = exports.Slider = /** @class */function () {
52
42
  this.handleMouseUp = function () {
53
43
  _this.isDragging = false;
54
44
  document.body.style.userSelect = '';
55
- document.removeEventListener('mousemove', _this.handleMouseMove);
56
- document.removeEventListener('mouseup', _this.handleMouseUp);
57
45
  };
58
46
  this.handleTouchEnd = function () {
59
47
  _this.isDragging = false;
60
- document.removeEventListener('touchmove', _this.handleTouchMove);
61
- document.removeEventListener('touchend', _this.handleTouchEnd);
62
48
  };
63
49
  this.element = element;
64
50
  this.options = Object.assign({
@@ -102,10 +88,7 @@ var Slider = exports.Slider = /** @class */function () {
102
88
  }
103
89
  // 이벤트 리스너 추가
104
90
  if (!this.options.disabled) {
105
- this.element.addEventListener('mousedown', this.handleMouseDown);
106
- this.element.addEventListener('touchstart', this.handleTouchStart, {
107
- passive: false
108
- });
91
+ this.enable();
109
92
  }
110
93
  // 초기 위치 설정
111
94
  this.updateHandlePositions();
@@ -309,6 +292,10 @@ var Slider = exports.Slider = /** @class */function () {
309
292
  });
310
293
  this.element.removeEventListener('mousedown', this.handleMouseDown);
311
294
  this.element.removeEventListener('touchstart', this.handleTouchStart);
295
+ document.removeEventListener('mousemove', this.handleMouseMove);
296
+ document.removeEventListener('mouseup', this.handleMouseUp);
297
+ document.removeEventListener('touchmove', this.handleTouchMove);
298
+ document.removeEventListener('touchend', this.handleTouchEnd);
312
299
  };
313
300
  Slider.prototype.enable = function () {
314
301
  this.options.disabled = false;
@@ -321,6 +308,10 @@ var Slider = exports.Slider = /** @class */function () {
321
308
  this.element.addEventListener('touchstart', this.handleTouchStart, {
322
309
  passive: false
323
310
  });
311
+ document.addEventListener('mousemove', this.handleMouseMove);
312
+ document.addEventListener('mouseup', this.handleMouseUp);
313
+ document.addEventListener('touchmove', this.handleTouchMove);
314
+ document.addEventListener('touchend', this.handleTouchEnd);
324
315
  };
325
316
  Slider.prototype.destroy = function () {
326
317
  // 모든 이벤트 리스너 제거
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Tab = void 0;
7
+ var _types = require("swiper/types");
8
+ var Tab = exports.Tab = /** @class */function () {
9
+ function Tab(element) {
10
+ this.swiper = null;
11
+ if (!element) {
12
+ throw new Error('Tab element is required');
13
+ }
14
+ if (!(element instanceof HTMLElement)) {
15
+ throw new Error('Invalid element type provided to Tab');
16
+ }
17
+ this.element = element;
18
+ this.init();
19
+ }
20
+ Tab.prototype.init = function () {
21
+ this.swiper = new _types.Swiper(this.element, {
22
+ slidesPerView: 'auto',
23
+ spaceBetween: 8,
24
+ grabCursor: true,
25
+ loop: false,
26
+ freeMode: {
27
+ enabled: true,
28
+ sticky: false
29
+ },
30
+ mousewheel: true
31
+ });
32
+ };
33
+ Tab.prototype.destroy = function () {
34
+ if (this.swiper) {
35
+ this.swiper.destroy();
36
+ this.swiper = null;
37
+ }
38
+ };
39
+ return Tab;
40
+ }();
@@ -35,7 +35,7 @@ var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardR
35
35
  endDateOptions.onChangeDate(newDate);
36
36
  }
37
37
  onDateValidation === null || onDateValidation === void 0 ? void 0 : onDateValidation({
38
- type: 'end',
38
+ type: type,
39
39
  errorType: 'reset',
40
40
  newDate: newDate,
41
41
  currentDate: type === 'start' ? startDateOptions.currentDate : endDateOptions.currentDate
@@ -45,15 +45,25 @@ var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardR
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
+ if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
49
+ var newDate_1 = type === 'start' ? startDateOptions.currentDate : endDateOptions.currentDate;
50
+ var currentDate = type === 'start' ? endDateOptions.currentDate : startDateOptions.currentDate;
51
+ onDateValidation === null || onDateValidation === void 0 ? void 0 : onDateValidation({
52
+ type: type,
53
+ errorType: 'overlap',
54
+ newDate: newDate_1,
55
+ currentDate: currentDate
56
+ });
57
+ return;
58
+ }
49
59
  var _a = validationOption.setting,
50
60
  unit = _a.unit,
51
61
  period = _a.period;
52
62
  var newDate = '';
53
63
  if (type === 'start') {
54
- newDate = (0, _utils.getDateFormat)((0, _moment.default)(startDateOptions.currentDate).add(period, unit).toDate());
55
- } else {
56
64
  newDate = (0, _utils.getDateFormat)((0, _moment.default)(endDateOptions.currentDate).subtract(period, unit).toDate());
65
+ } else {
66
+ newDate = (0, _utils.getDateFormat)((0, _moment.default)(startDateOptions.currentDate).add(period, unit).toDate());
57
67
  }
58
68
  onDateValidation === null || onDateValidation === void 0 ? void 0 : onDateValidation({
59
69
  type: type,
@@ -63,7 +73,7 @@ var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardR
63
73
  });
64
74
  }, [startDateOptions, endDateOptions, validationOption, onDateValidation]);
65
75
  var validateDateType = function (date) {
66
- return !isNaN(Date.parse(date));
76
+ return (0, _moment.default)(date).isValid();
67
77
  };
68
78
  (0, _react.useEffect)(function () {
69
79
  var _a;
@@ -72,17 +82,17 @@ var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardR
72
82
  resetDateAndAlert('start');
73
83
  return;
74
84
  }
85
+ var isOverDate = (0, _moment.default)(startDateOptions.currentDate).isAfter(endDateOptions.currentDate);
86
+ if (isOverDate) {
87
+ changeSettingDateAndAlert('start');
88
+ }
75
89
  if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
76
90
  return;
77
91
  }
78
- var isOverDate = (0, _moment.default)(startDateOptions.currentDate).isAfter(endDateOptions.currentDate);
79
92
  var _b = validationOption.setting,
80
93
  unit = _b.unit,
81
94
  period = _b.period;
82
95
  var isValidPeriod = (0, _moment.default)(startDateOptions.currentDate).isSameOrAfter((0, _moment.default)(endDateOptions.currentDate).subtract(period, unit));
83
- if (isOverDate) {
84
- changeSettingDateAndAlert('start');
85
- }
86
96
  if (!isValidPeriod) {
87
97
  changeSettingDateAndAlert('start', !isValidPeriod);
88
98
  }
@@ -94,18 +104,21 @@ var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardR
94
104
  resetDateAndAlert('end');
95
105
  return;
96
106
  }
97
- var isNotTodayEndDate = endDateOptions.currentDate !== (0, _utils.getDateFormat)();
98
- if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting) || !isNotTodayEndDate) {
107
+ var isNotTodayEndDate = !(0, _moment.default)(endDateOptions.currentDate).isSame((0, _moment.default)(), 'day');
108
+ if (!isNotTodayEndDate) {
109
+ return;
110
+ }
111
+ var isOverDate = (0, _moment.default)(endDateOptions.currentDate).isBefore(startDateOptions.currentDate);
112
+ if (isOverDate) {
113
+ changeSettingDateAndAlert('end');
114
+ }
115
+ if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
99
116
  return;
100
117
  }
101
- var isOverDate = (0, _moment.default)(startDateOptions.currentDate).isAfter(endDateOptions.currentDate);
102
118
  var _b = validationOption.setting,
103
119
  unit = _b.unit,
104
120
  period = _b.period;
105
121
  var isValidPeriod = (0, _moment.default)(endDateOptions.currentDate).isSameOrBefore((0, _moment.default)(startDateOptions.currentDate).add(period, unit));
106
- if (isOverDate) {
107
- changeSettingDateAndAlert('end');
108
- }
109
122
  if (!isValidPeriod) {
110
123
  changeSettingDateAndAlert('end', !isValidPeriod);
111
124
  }
@@ -39,7 +39,6 @@ var Toggle = function (_a) {
39
39
  props = __rest(_a, ["size", "text", "supportText", "disabled", "onChange", "className"]);
40
40
  return (0, _jsxRuntime.jsxs)("label", __assign({
41
41
  className: (0, _classnames.default)('ncua-toggle', "ncua-toggle--".concat(size), {
42
- 'ncua-toggle--checked': props === null || props === void 0 ? void 0 : props.checked,
43
42
  'ncua-toggle--disabled': disabled
44
43
  }, className)
45
44
  }, {
@@ -0,0 +1,243 @@
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
+ // Constants
12
+ var CONSTANTS = {
13
+ ICON_SIZES: {
14
+ sm: '14',
15
+ md: '16'
16
+ },
17
+ CLASS_NAMES: {
18
+ RANGE_WRAPPER: 'ncua-range-date-picker',
19
+ RANGE_WITH_BUTTONS: 'ncua-range-date-picker-with-buttons',
20
+ DATE_PICKER: 'ncua-date-picker',
21
+ DATE_PICKER_INPUT: 'ncua-date-picker__input',
22
+ DATE_PICKER_ICO: 'ncua-date-picker__ico',
23
+ BUTTON_GROUP: 'ncua-button-group',
24
+ BUTTON_GROUP_HAS_BORDER: 'has-border',
25
+ BUTTON: 'ncua-button-group__item'
26
+ },
27
+ FORMATS: {
28
+ DATE: 'YYYY-MM-DD'
29
+ },
30
+ ERROR_MESSAGES: {
31
+ FLATPICKR_NOT_LOADED: 'flatpickr 라이브러리가 로드되지 않았습니다.',
32
+ MOMENT_NOT_LOADED: 'moment 라이브러리가 로드되지 않았습니다.'
33
+ }
34
+ };
35
+ var DatePicker = /** @class */function () {
36
+ function DatePicker(wrapper, options) {
37
+ this.flatpickrInstances = [];
38
+ this.currentButton = null;
39
+ var _a = options.buttons,
40
+ buttons = _a === void 0 ? [] : _a,
41
+ size = options.size,
42
+ datePickerOptions = options.datePickerOptions;
43
+ this.validationDependencies((buttons === null || buttons === void 0 ? void 0 : buttons.length) > 0);
44
+ this.element = wrapper;
45
+ this.datePickerOptions = datePickerOptions;
46
+ this.buttons = buttons;
47
+ this.size = size;
48
+ this.init();
49
+ }
50
+ DatePicker.prototype.init = function () {
51
+ this.element.innerHTML = '';
52
+ this.initializeWrapper();
53
+ this.initButtonGroup();
54
+ this.initDatePicker();
55
+ };
56
+ DatePicker.prototype.validationDependencies = function (hasButtons) {
57
+ if (typeof flatpickr === 'undefined') {
58
+ throw new Error(CONSTANTS.ERROR_MESSAGES.FLATPICKR_NOT_LOADED);
59
+ }
60
+ if (hasButtons && typeof moment === 'undefined') {
61
+ throw new Error(CONSTANTS.ERROR_MESSAGES.MOMENT_NOT_LOADED);
62
+ }
63
+ };
64
+ DatePicker.prototype.initializeWrapper = function () {
65
+ if (this.datePickerOptions.length < 2) return;
66
+ this.element.classList.add(CONSTANTS.CLASS_NAMES.RANGE_WRAPPER);
67
+ };
68
+ DatePicker.prototype.initButtonGroup = function () {
69
+ var _this = this;
70
+ if (this.buttons.length === 0) return;
71
+ this.element.classList.add(CONSTANTS.CLASS_NAMES.RANGE_WITH_BUTTONS);
72
+ var createButtonWrapperElement = function () {
73
+ var wrapper = document.createElement('div');
74
+ wrapper.className = "".concat(CONSTANTS.CLASS_NAMES.BUTTON_GROUP, " ").concat(CONSTANTS.CLASS_NAMES.BUTTON_GROUP_HAS_BORDER, " ").concat(CONSTANTS.CLASS_NAMES.BUTTON_GROUP, "--").concat(_this.size);
75
+ return wrapper;
76
+ };
77
+ var appendButtons = function (wrapper) {
78
+ _this.buttons.forEach(function (button) {
79
+ var buttonElement = _this.createButtonElement(button);
80
+ wrapper.appendChild(buttonElement);
81
+ });
82
+ };
83
+ var wrapper = createButtonWrapperElement();
84
+ appendButtons(wrapper);
85
+ wrapper.addEventListener('click', this.updateDateWithButton.bind(this));
86
+ this.element.appendChild(wrapper);
87
+ };
88
+ DatePicker.prototype.createButtonElement = function (button) {
89
+ if (button.isCurrent) {
90
+ this.currentButton = button;
91
+ }
92
+ var buttonElement = document.createElement('button');
93
+ buttonElement.className = "".concat(CONSTANTS.CLASS_NAMES.BUTTON, " ").concat(button.isCurrent ? 'is-current' : '');
94
+ buttonElement.textContent = button.text;
95
+ buttonElement.type = 'button';
96
+ return buttonElement;
97
+ };
98
+ DatePicker.prototype.reRenderButtonGroup = function (buttons) {
99
+ var _this = this;
100
+ var buttonGroup = this.element.querySelector(".".concat(CONSTANTS.CLASS_NAMES.BUTTON_GROUP));
101
+ if (!buttonGroup) return;
102
+ buttonGroup.innerHTML = '';
103
+ buttons.forEach(function (button) {
104
+ if (button.isCurrent) {
105
+ _this.currentButton = button;
106
+ }
107
+ buttonGroup.appendChild(_this.createButtonElement(button));
108
+ });
109
+ this.buttons = buttons;
110
+ };
111
+ DatePicker.prototype.initDatePicker = function () {
112
+ var _this = this;
113
+ var datePickerOptions = this.datePickerOptions;
114
+ var createWrapperElement = function (size) {
115
+ var wrapper = document.createElement('div');
116
+ wrapper.className = "".concat(CONSTANTS.CLASS_NAMES.DATE_PICKER, " ").concat(CONSTANTS.CLASS_NAMES.DATE_PICKER, "--").concat(size);
117
+ return wrapper;
118
+ };
119
+ var createInput = function (elementId) {
120
+ var input = document.createElement('input');
121
+ input.type = 'text';
122
+ input.id = elementId;
123
+ input.className = CONSTANTS.CLASS_NAMES.DATE_PICKER_INPUT;
124
+ return input;
125
+ };
126
+ var createIcon = function (size) {
127
+ var getCalendarIconSvg = function (size) {
128
+ return "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(size, "\" height=\"").concat(size, "\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M14 6.66671H2M10.6667 1.33337V4.00004M5.33333 1.33337V4.00004M5.2 14.6667H10.8C11.9201 14.6667 12.4802 14.6667 12.908 14.4487C13.2843 14.257 13.5903 13.951 13.782 13.5747C14 13.1469 14 12.5868 14 11.4667V5.86671C14 4.7466 14 4.18655 13.782 3.75873C13.5903 3.3824 13.2843 3.07644 12.908 2.88469C12.4802 2.66671 11.9201 2.66671 10.8 2.66671H5.2C4.0799 2.66671 3.51984 2.66671 3.09202 2.88469C2.71569 3.07644 2.40973 3.3824 2.21799 3.75873C2 4.18655 2 4.7466 2 5.86671V11.4667C2 12.5868 2 13.1469 2.21799 13.5747C2.40973 13.951 2.71569 14.257 3.09202 14.4487C3.51984 14.6667 4.0799 14.6667 5.2 14.6667Z\"\n stroke=\"black\"\n stroke-width=\"1.33333\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n ></path>\n </svg>");
129
+ };
130
+ var ico = document.createElement('span');
131
+ ico.className = CONSTANTS.CLASS_NAMES.DATE_PICKER_ICO;
132
+ ico.innerHTML = getCalendarIconSvg(CONSTANTS.ICON_SIZES[size]);
133
+ return ico;
134
+ };
135
+ var insertSeparator = function () {
136
+ var span = document.createElement('span');
137
+ span.textContent = '-';
138
+ _this.element.insertBefore(span, _this.element.querySelectorAll(".".concat(CONSTANTS.CLASS_NAMES.DATE_PICKER))[1]);
139
+ };
140
+ var createDatePickerElement = function (datePickerOption, index) {
141
+ var wrapper = createWrapperElement(_this.size);
142
+ var input = createInput(datePickerOption.element);
143
+ wrapper.appendChild(input);
144
+ wrapper.appendChild(createIcon(_this.size));
145
+ wrapper.addEventListener('click', function () {
146
+ _this.buttons.forEach(function (button) {
147
+ return button.isCurrent = false;
148
+ });
149
+ _this.currentButton = null;
150
+ _this.reRenderButtonGroup(_this.buttons);
151
+ });
152
+ _this.element.appendChild(wrapper);
153
+ if (index > 0) {
154
+ insertSeparator();
155
+ }
156
+ return _this.initializeFlatpickr(input, datePickerOption.options, wrapper);
157
+ };
158
+ var createFlatpickrInstances = function (datePickerOptions) {
159
+ return datePickerOptions.map(function (datePickerOption, index) {
160
+ return createDatePickerElement(datePickerOption, index);
161
+ });
162
+ };
163
+ var calcInitDates = function (datePickerOptions) {
164
+ var _a;
165
+ if (_this.buttons.length > 0) {
166
+ var _b = (_a = _this.buttons.find(function (button) {
167
+ return button.isCurrent;
168
+ })) !== null && _a !== void 0 ? _a : {
169
+ period: 0,
170
+ unit: 'days'
171
+ },
172
+ period = _b.period,
173
+ unit = _b.unit;
174
+ return [moment().subtract(period, unit).format(CONSTANTS.FORMATS.DATE), moment().format(CONSTANTS.FORMATS.DATE)];
175
+ }
176
+ return datePickerOptions.map(function (datePickerOption) {
177
+ var _a;
178
+ if ((_a = datePickerOption.options) === null || _a === void 0 ? void 0 : _a.defaultDate) {
179
+ return moment(datePickerOption.options.defaultDate.toString()).format(CONSTANTS.FORMATS.DATE);
180
+ }
181
+ return moment().format(CONSTANTS.FORMATS.DATE);
182
+ });
183
+ };
184
+ this.flatpickrInstances = createFlatpickrInstances(datePickerOptions);
185
+ var dates = calcInitDates(datePickerOptions);
186
+ this.setMultipleDates(dates);
187
+ };
188
+ DatePicker.prototype.initializeFlatpickr = function (input, options, wrapper) {
189
+ return flatpickr(input, __assign(__assign({}, options), {
190
+ appendTo: wrapper
191
+ }));
192
+ };
193
+ DatePicker.prototype.updateDateWithButton = function (e) {
194
+ var _this = this;
195
+ var target = e.target;
196
+ if (!target.classList.contains(CONSTANTS.CLASS_NAMES.BUTTON)) return;
197
+ var clickedButton = this.buttons.find(function (button) {
198
+ return button.text === target.textContent;
199
+ });
200
+ if (!clickedButton || clickedButton === this.currentButton) return;
201
+ // 날짜 계산
202
+ var calculateDates = function () {
203
+ var period = clickedButton.period,
204
+ unit = clickedButton.unit;
205
+ var dates = [];
206
+ var startDate = period ? moment().subtract(period, unit).format(CONSTANTS.FORMATS.DATE) : moment().format(CONSTANTS.FORMATS.DATE);
207
+ dates.push(startDate);
208
+ if (_this.datePickerOptions.length > 1) {
209
+ var endDate = moment().format(CONSTANTS.FORMATS.DATE);
210
+ dates.push(endDate);
211
+ }
212
+ return dates;
213
+ };
214
+ var updateButtonState = function () {
215
+ return _this.buttons.map(function (button) {
216
+ return __assign(__assign({}, button), {
217
+ isCurrent: button.text === (clickedButton === null || clickedButton === void 0 ? void 0 : clickedButton.text)
218
+ });
219
+ });
220
+ };
221
+ this.currentButton = clickedButton;
222
+ this.reRenderButtonGroup(updateButtonState());
223
+ this.setMultipleDates(calculateDates());
224
+ };
225
+ DatePicker.prototype.setMultipleDates = function (dates) {
226
+ var _this = this;
227
+ dates.forEach(function (date, index) {
228
+ _this.flatpickrInstances[index].setDate(date, true);
229
+ _this.flatpickrInstances[index].redraw();
230
+ });
231
+ };
232
+ DatePicker.prototype.setDate = function (dates) {
233
+ this.setMultipleDates(dates);
234
+ };
235
+ DatePicker.prototype.getDates = function () {
236
+ return this.flatpickrInstances.flatMap(function (instance) {
237
+ return instance.selectedDates;
238
+ });
239
+ };
240
+ return DatePicker;
241
+ }();
242
+ export { DatePicker };
243
+ window.DatePicker = DatePicker;
@@ -1,2 +1,8 @@
1
- export * from './test';
2
- export * from './slider';
1
+ import { DatePicker } from './datePicker';
2
+ import { Slider } from './slider';
3
+ import { Tab } from './tab';
4
+ window.ncua = {
5
+ Slider: Slider,
6
+ Tab: Tab,
7
+ DatePicker: DatePicker
8
+ };
@@ -11,9 +11,6 @@ var Slider = /** @class */function () {
11
11
  e.preventDefault();
12
12
  _this.handleInteractionStart(e.clientX, targetElement);
13
13
  if (_this.isDragging) {
14
- // 드래그 이벤트 추가
15
- document.addEventListener('mousemove', _this.handleMouseMove);
16
- document.addEventListener('mouseup', _this.handleMouseUp);
17
14
  // 텍스트 선택 방지
18
15
  document.body.style.userSelect = 'none';
19
16
  }
@@ -23,13 +20,6 @@ var Slider = /** @class */function () {
23
20
  var targetElement = e.target;
24
21
  e.preventDefault();
25
22
  _this.handleInteractionStart(e.touches[0].clientX, targetElement);
26
- if (_this.isDragging) {
27
- // 드래그 이벤트 추가
28
- document.addEventListener('touchmove', _this.handleTouchMove, {
29
- passive: false
30
- });
31
- document.addEventListener('touchend', _this.handleTouchEnd);
32
- }
33
23
  }
34
24
  };
35
25
  this.handleMouseMove = function (e) {
@@ -46,13 +36,9 @@ var Slider = /** @class */function () {
46
36
  this.handleMouseUp = function () {
47
37
  _this.isDragging = false;
48
38
  document.body.style.userSelect = '';
49
- document.removeEventListener('mousemove', _this.handleMouseMove);
50
- document.removeEventListener('mouseup', _this.handleMouseUp);
51
39
  };
52
40
  this.handleTouchEnd = function () {
53
41
  _this.isDragging = false;
54
- document.removeEventListener('touchmove', _this.handleTouchMove);
55
- document.removeEventListener('touchend', _this.handleTouchEnd);
56
42
  };
57
43
  this.element = element;
58
44
  this.options = Object.assign({
@@ -96,10 +82,7 @@ var Slider = /** @class */function () {
96
82
  }
97
83
  // 이벤트 리스너 추가
98
84
  if (!this.options.disabled) {
99
- this.element.addEventListener('mousedown', this.handleMouseDown);
100
- this.element.addEventListener('touchstart', this.handleTouchStart, {
101
- passive: false
102
- });
85
+ this.enable();
103
86
  }
104
87
  // 초기 위치 설정
105
88
  this.updateHandlePositions();
@@ -303,6 +286,10 @@ var Slider = /** @class */function () {
303
286
  });
304
287
  this.element.removeEventListener('mousedown', this.handleMouseDown);
305
288
  this.element.removeEventListener('touchstart', this.handleTouchStart);
289
+ document.removeEventListener('mousemove', this.handleMouseMove);
290
+ document.removeEventListener('mouseup', this.handleMouseUp);
291
+ document.removeEventListener('touchmove', this.handleTouchMove);
292
+ document.removeEventListener('touchend', this.handleTouchEnd);
306
293
  };
307
294
  Slider.prototype.enable = function () {
308
295
  this.options.disabled = false;
@@ -315,6 +302,10 @@ var Slider = /** @class */function () {
315
302
  this.element.addEventListener('touchstart', this.handleTouchStart, {
316
303
  passive: false
317
304
  });
305
+ document.addEventListener('mousemove', this.handleMouseMove);
306
+ document.addEventListener('mouseup', this.handleMouseUp);
307
+ document.addEventListener('touchmove', this.handleTouchMove);
308
+ document.addEventListener('touchend', this.handleTouchEnd);
318
309
  };
319
310
  Slider.prototype.destroy = function () {
320
311
  // 모든 이벤트 리스너 제거
@@ -0,0 +1,35 @@
1
+ import { Swiper } from 'swiper/types';
2
+ var Tab = /** @class */function () {
3
+ function Tab(element) {
4
+ this.swiper = null;
5
+ if (!element) {
6
+ throw new Error('Tab element is required');
7
+ }
8
+ if (!(element instanceof HTMLElement)) {
9
+ throw new Error('Invalid element type provided to Tab');
10
+ }
11
+ this.element = element;
12
+ this.init();
13
+ }
14
+ Tab.prototype.init = function () {
15
+ this.swiper = new Swiper(this.element, {
16
+ slidesPerView: 'auto',
17
+ spaceBetween: 8,
18
+ grabCursor: true,
19
+ loop: false,
20
+ freeMode: {
21
+ enabled: true,
22
+ sticky: false
23
+ },
24
+ mousewheel: true
25
+ });
26
+ };
27
+ Tab.prototype.destroy = function () {
28
+ if (this.swiper) {
29
+ this.swiper.destroy();
30
+ this.swiper = null;
31
+ }
32
+ };
33
+ return Tab;
34
+ }();
35
+ export { Tab };
@@ -28,7 +28,7 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
28
28
  endDateOptions.onChangeDate(newDate);
29
29
  }
30
30
  onDateValidation === null || onDateValidation === void 0 ? void 0 : onDateValidation({
31
- type: 'end',
31
+ type: type,
32
32
  errorType: 'reset',
33
33
  newDate: newDate,
34
34
  currentDate: type === 'start' ? startDateOptions.currentDate : endDateOptions.currentDate
@@ -38,15 +38,25 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
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
+ if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
42
+ var newDate_1 = type === 'start' ? startDateOptions.currentDate : endDateOptions.currentDate;
43
+ var currentDate = type === 'start' ? endDateOptions.currentDate : startDateOptions.currentDate;
44
+ onDateValidation === null || onDateValidation === void 0 ? void 0 : onDateValidation({
45
+ type: type,
46
+ errorType: 'overlap',
47
+ newDate: newDate_1,
48
+ currentDate: currentDate
49
+ });
50
+ return;
51
+ }
42
52
  var _a = validationOption.setting,
43
53
  unit = _a.unit,
44
54
  period = _a.period;
45
55
  var newDate = '';
46
56
  if (type === 'start') {
47
- newDate = getDateFormat(moment(startDateOptions.currentDate).add(period, unit).toDate());
48
- } else {
49
57
  newDate = getDateFormat(moment(endDateOptions.currentDate).subtract(period, unit).toDate());
58
+ } else {
59
+ newDate = getDateFormat(moment(startDateOptions.currentDate).add(period, unit).toDate());
50
60
  }
51
61
  onDateValidation === null || onDateValidation === void 0 ? void 0 : onDateValidation({
52
62
  type: type,
@@ -56,7 +66,7 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
56
66
  });
57
67
  }, [startDateOptions, endDateOptions, validationOption, onDateValidation]);
58
68
  var validateDateType = function (date) {
59
- return !isNaN(Date.parse(date));
69
+ return moment(date).isValid();
60
70
  };
61
71
  useEffect(function () {
62
72
  var _a;
@@ -65,17 +75,17 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
65
75
  resetDateAndAlert('start');
66
76
  return;
67
77
  }
78
+ var isOverDate = moment(startDateOptions.currentDate).isAfter(endDateOptions.currentDate);
79
+ if (isOverDate) {
80
+ changeSettingDateAndAlert('start');
81
+ }
68
82
  if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
69
83
  return;
70
84
  }
71
- var isOverDate = moment(startDateOptions.currentDate).isAfter(endDateOptions.currentDate);
72
85
  var _b = validationOption.setting,
73
86
  unit = _b.unit,
74
87
  period = _b.period;
75
88
  var isValidPeriod = moment(startDateOptions.currentDate).isSameOrAfter(moment(endDateOptions.currentDate).subtract(period, unit));
76
- if (isOverDate) {
77
- changeSettingDateAndAlert('start');
78
- }
79
89
  if (!isValidPeriod) {
80
90
  changeSettingDateAndAlert('start', !isValidPeriod);
81
91
  }
@@ -87,18 +97,21 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
87
97
  resetDateAndAlert('end');
88
98
  return;
89
99
  }
90
- var isNotTodayEndDate = endDateOptions.currentDate !== getDateFormat();
91
- if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting) || !isNotTodayEndDate) {
100
+ var isNotTodayEndDate = !moment(endDateOptions.currentDate).isSame(moment(), 'day');
101
+ if (!isNotTodayEndDate) {
102
+ return;
103
+ }
104
+ var isOverDate = moment(endDateOptions.currentDate).isBefore(startDateOptions.currentDate);
105
+ if (isOverDate) {
106
+ changeSettingDateAndAlert('end');
107
+ }
108
+ if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
92
109
  return;
93
110
  }
94
- var isOverDate = moment(startDateOptions.currentDate).isAfter(endDateOptions.currentDate);
95
111
  var _b = validationOption.setting,
96
112
  unit = _b.unit,
97
113
  period = _b.period;
98
114
  var isValidPeriod = moment(endDateOptions.currentDate).isSameOrBefore(moment(startDateOptions.currentDate).add(period, unit));
99
- if (isOverDate) {
100
- changeSettingDateAndAlert('end');
101
- }
102
115
  if (!isValidPeriod) {
103
116
  changeSettingDateAndAlert('end', !isValidPeriod);
104
117
  }
@@ -32,7 +32,6 @@ export var Toggle = function (_a) {
32
32
  props = __rest(_a, ["size", "text", "supportText", "disabled", "onChange", "className"]);
33
33
  return _jsxs("label", __assign({
34
34
  className: classNames('ncua-toggle', "ncua-toggle--".concat(size), {
35
- 'ncua-toggle--checked': props === null || props === void 0 ? void 0 : props.checked,
36
35
  'ncua-toggle--disabled': disabled
37
36
  }, className)
38
37
  }, {
@@ -0,0 +1,49 @@
1
+ export type DatePickerSize = 'sm' | 'md';
2
+ interface Options {
3
+ buttons?: DatePickerButton[];
4
+ size: DatePickerSize;
5
+ datePickerOptions: DatePickerOptionWrapper[];
6
+ }
7
+ interface DatePickerOptionWrapper {
8
+ element: string;
9
+ options: DatePickerOption;
10
+ }
11
+ interface DatePickerOption {
12
+ defaultDate?: string | Date | Date[];
13
+ enableTime?: boolean;
14
+ dateFormat?: string;
15
+ locale?: string;
16
+ mode?: 'single' | 'range' | 'multiple';
17
+ maxDate?: string | Date;
18
+ minDate?: string | Date;
19
+ onChange?: (selectedDates: Date[], dateStr: string, instance: any) => void;
20
+ }
21
+ interface DatePickerButton {
22
+ text: string;
23
+ period: number;
24
+ unit: 'days' | 'weeks' | 'months' | 'years';
25
+ isCurrent: boolean;
26
+ }
27
+ export declare class DatePicker {
28
+ private readonly element;
29
+ private readonly datePickerOptions;
30
+ private readonly size;
31
+ private buttons;
32
+ private flatpickrInstances;
33
+ private currentButton;
34
+ constructor(wrapper: HTMLElement, options: Options);
35
+ private init;
36
+ private validationDependencies;
37
+ private initializeWrapper;
38
+ private initButtonGroup;
39
+ private createButtonElement;
40
+ private reRenderButtonGroup;
41
+ private initDatePicker;
42
+ private initializeFlatpickr;
43
+ private updateDateWithButton;
44
+ private setMultipleDates;
45
+ setDate(dates: string[]): void;
46
+ getDates(): Date[];
47
+ }
48
+ export {};
49
+ //# sourceMappingURL=datePicker.d.ts.map
@@ -1,3 +1,7 @@
1
- export * from './test';
2
- export * from './slider';
1
+ declare global {
2
+ interface Window {
3
+ ncua: Object;
4
+ }
5
+ }
6
+ export {};
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ export declare class Tab {
2
+ private element;
3
+ private swiper;
4
+ constructor(element: HTMLElement | null);
5
+ private init;
6
+ destroy(): void;
7
+ }
8
+ //# sourceMappingURL=tab.d.ts.map
@@ -1,4 +1,4 @@
1
- import { ColorTone } from 'ui-admin/constant/color';
1
+ import { ColorTone } from '@ncds/ui-admin/constant/color';
2
2
  import { BadgeProps } from '.';
3
3
  import { Size } from '../../../constant/size';
4
4
  import { SideSlotType } from '../../types/side-slot';
@@ -1209,7 +1209,7 @@ button {
1209
1209
  border: 1px solid var(--gray-200);
1210
1210
  }
1211
1211
  .ncua-input__field--xs {
1212
- padding: 5px 10px;
1212
+ padding: 4px 10px;
1213
1213
  }
1214
1214
  .ncua-input__field--md {
1215
1215
  padding: 6px 12px;
@@ -1363,7 +1363,7 @@ button {
1363
1363
  border: 1px solid var(--gray-200);
1364
1364
  }
1365
1365
  .ncua-input__leading-text-wrap .ncua-input__leading-text--xs {
1366
- padding: 5px 10px;
1366
+ padding: 4px 10px;
1367
1367
  }
1368
1368
  .ncua-input__leading-text-wrap .ncua-input__leading-text--md {
1369
1369
  padding: 6px 12px;
@@ -1387,7 +1387,7 @@ button {
1387
1387
  border: 1px solid var(--gray-200);
1388
1388
  }
1389
1389
  .ncua-input__trailing-button .ncua-input__button--xs {
1390
- padding: 5px 10px;
1390
+ padding: 4px 10px;
1391
1391
  }
1392
1392
  .ncua-input__trailing-button .ncua-input__button--md {
1393
1393
  padding: 6px 12px;
@@ -1402,7 +1402,7 @@ button {
1402
1402
  cursor: pointer;
1403
1403
  }
1404
1404
  .ncua-input__trailing-button .ncua-input__button--xs {
1405
- padding: 4px 10px;
1405
+ padding: 5px 10px;
1406
1406
  font-size: var(--font-size-xs);
1407
1407
  line-height: var(--line-heights-xs);
1408
1408
  font-weight: var(--font-weights-commerce-sans-1);
@@ -2709,7 +2709,7 @@ button {
2709
2709
  font-size: var(--toggle-sm-font-size);
2710
2710
  line-height: var(--toggle-sm-line-height);
2711
2711
  }
2712
- .ncua-toggle--sm.ncua-toggle--checked .ncua-toggle__slider {
2712
+ .ncua-toggle--sm .ncua-toggle__input:checked + .ncua-toggle__switch .ncua-toggle__slider {
2713
2713
  transform: translateX(var(--toggle-sm-translate));
2714
2714
  }
2715
2715
  .ncua-toggle--md .ncua-toggle__switch {
@@ -2727,19 +2727,19 @@ button {
2727
2727
  font-size: var(--toggle-md-font-size);
2728
2728
  line-height: var(--toggle-md-line-height);
2729
2729
  }
2730
- .ncua-toggle--md.ncua-toggle--checked .ncua-toggle__slider {
2730
+ .ncua-toggle--md .ncua-toggle__input:checked + .ncua-toggle__switch .ncua-toggle__slider {
2731
2731
  transform: translateX(var(--toggle-md-translate));
2732
2732
  }
2733
2733
  .ncua-toggle:not(.ncua-toggle--disabled):hover .ncua-toggle__switch {
2734
2734
  background-color: var(--gray-300);
2735
2735
  }
2736
- .ncua-toggle--checked .ncua-toggle__switch {
2737
- background-color: var(--green-500);
2738
- }
2739
- .ncua-toggle--checked:not(.ncua-toggle--disabled):hover .ncua-toggle__switch {
2736
+ .ncua-toggle:not(.ncua-toggle--disabled):hover .ncua-toggle__input:checked + .ncua-toggle__switch {
2740
2737
  background-color: var(--green-600);
2741
2738
  }
2742
- .ncua-toggle--checked__input:focus + .ncua-toggle__switch {
2739
+ .ncua-toggle__input:checked + .ncua-toggle__switch {
2740
+ background-color: var(--green-500);
2741
+ }
2742
+ .ncua-toggle__input:checked:focus + .ncua-toggle__switch {
2743
2743
  box-shadow: var(--toggle-checked-focus-shadow);
2744
2744
  }
2745
2745
  .ncua-toggle__input:focus + .ncua-toggle__switch {
@@ -3053,7 +3053,6 @@ button {
3053
3053
  display: flex;
3054
3054
  align-items: center;
3055
3055
  height: 28px;
3056
- padding: 4px 6px;
3057
3056
  color: var(--gray-400);
3058
3057
  font-weight: var(--font-weights-commerce-sans-1);
3059
3058
  cursor: pointer;
@@ -3065,7 +3064,7 @@ button {
3065
3064
  .ncua-breadcrumb__list-item--active {
3066
3065
  color: var(--gray-600);
3067
3066
  }
3068
- .ncua-breadcrumb__list-item:hover {
3067
+ .ncua-breadcrumb__list-item:hover > .ncua-breadcrumb__item {
3069
3068
  background-color: var(--gray-100);
3070
3069
  border-radius: 4px;
3071
3070
  }
@@ -3081,9 +3080,11 @@ button {
3081
3080
  background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none"%3E%3Cpath d="M6 12L10 8L6 4" stroke="%23D3D4D8" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
3082
3081
  background-repeat: no-repeat;
3083
3082
  background-position: center;
3083
+ pointer-events: none;
3084
3084
  }
3085
3085
  .ncua-breadcrumb__item {
3086
3086
  display: flex;
3087
+ padding: 4px 6px;
3087
3088
  align-items: center;
3088
3089
  color: inherit;
3089
3090
  text-decoration: none;
@@ -3191,6 +3192,9 @@ button {
3191
3192
  border-radius: 16px;
3192
3193
  cursor: pointer;
3193
3194
  }
3195
+ .ncua-badge-group:hover {
3196
+ text-decoration: none;
3197
+ }
3194
3198
  .ncua-badge-group__label {
3195
3199
  margin-left: 8px;
3196
3200
  font-weight: var(--font-weights-commerce-sans-1);
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@ncds/ui-admin",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "nhn-commerce의 어드민 디자인 시스템입니다.",
5
5
  "scripts": {
6
6
  "barrel": "node barrel.js",
7
7
  "build": "webpack --node-env production",
8
8
  "build:npm": "node build-npm.js",
9
9
  "dev": "webpack serve --node-env development --open --hot",
10
+ "dev:html": "webpack serve --node-env development --open --config webpack.html.config.js",
10
11
  "eject": "react-scripts eject",
11
12
  "lint": "eslint \"**/*.ts*\"",
12
13
  "major": "yarn version --major",
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.test = void 0;
7
- var test = function () {
8
- console.log('test');
9
- };
10
- exports.test = test;
@@ -1,3 +0,0 @@
1
- export var test = function () {
2
- console.log('test');
3
- };
@@ -1,2 +0,0 @@
1
- export declare const test: () => void;
2
- //# sourceMappingURL=test.d.ts.map