@ceed/cds 0.0.126 → 0.0.128
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/index.js +1 -6
- package/package.json +2 -3
- package/dist/components/Accordions/Accordions.js +0 -66
- package/dist/components/Accordions/index.js +0 -3
- package/dist/components/Autocomplete/Autocomplete.js +0 -251
- package/dist/components/Autocomplete/index.js +0 -3
- package/dist/components/Box/Box.js +0 -6
- package/dist/components/Box/index.js +0 -3
- package/dist/components/Breadcrumbs/Breadcrumbs.js +0 -67
- package/dist/components/Breadcrumbs/index.js +0 -3
- package/dist/components/Button/Button.js +0 -28
- package/dist/components/Button/index.js +0 -3
- package/dist/components/Calendar/Calendar.js +0 -383
- package/dist/components/Calendar/hooks/use-calendar-props.js +0 -80
- package/dist/components/Calendar/hooks/use-calendar.js +0 -244
- package/dist/components/Calendar/index.js +0 -3
- package/dist/components/Calendar/types.js +0 -1
- package/dist/components/Calendar/utils/index.js +0 -72
- package/dist/components/Card/Card.js +0 -22
- package/dist/components/Card/index.js +0 -3
- package/dist/components/Checkbox/Checkbox.js +0 -28
- package/dist/components/Checkbox/index.js +0 -3
- package/dist/components/Chip/Chip.js +0 -6
- package/dist/components/Chip/index.js +0 -3
- package/dist/components/Container/Container.js +0 -65
- package/dist/components/Container/index.js +0 -3
- package/dist/components/CurrencyInput/CurrencyInput.js +0 -108
- package/dist/components/CurrencyInput/hooks/use-currency-setting.js +0 -165
- package/dist/components/CurrencyInput/index.js +0 -3
- package/dist/components/DataTable/DataTable.js +0 -437
- package/dist/components/DataTable/index.js +0 -3
- package/dist/components/DataTable/types.js +0 -1
- package/dist/components/DatePicker/DatePicker.js +0 -207
- package/dist/components/DatePicker/index.js +0 -3
- package/dist/components/DateRangePicker/DateRangePicker.js +0 -209
- package/dist/components/DateRangePicker/index.js +0 -3
- package/dist/components/DialogActions/DialogActions.js +0 -15
- package/dist/components/DialogActions/index.js +0 -3
- package/dist/components/DialogContent/DialogContent.js +0 -12
- package/dist/components/DialogContent/index.js +0 -3
- package/dist/components/DialogFrame/DialogFrame.js +0 -51
- package/dist/components/DialogFrame/index.js +0 -3
- package/dist/components/DialogTitle/DialogTitle.js +0 -12
- package/dist/components/DialogTitle/index.js +0 -3
- package/dist/components/Divider/Divider.js +0 -28
- package/dist/components/Divider/index.js +0 -3
- package/dist/components/Dropdown/Dropdown.js +0 -6
- package/dist/components/Dropdown/index.js +0 -3
- package/dist/components/FormControl/FormControl.js +0 -17
- package/dist/components/FormControl/index.js +0 -3
- package/dist/components/FormHelperText/FormHelperText.js +0 -6
- package/dist/components/FormHelperText/index.js +0 -3
- package/dist/components/FormLabel/FormLabel.js +0 -6
- package/dist/components/FormLabel/index.js +0 -3
- package/dist/components/Grid/Grid.js +0 -6
- package/dist/components/Grid/index.js +0 -3
- package/dist/components/IconButton/IconButton.js +0 -28
- package/dist/components/IconButton/index.js +0 -3
- package/dist/components/Input/Input.js +0 -51
- package/dist/components/Input/index.js +0 -3
- package/dist/components/InsetDrawer/InsetDrawer.js +0 -45
- package/dist/components/InsetDrawer/index.js +0 -3
- package/dist/components/Markdown/Markdown.js +0 -59
- package/dist/components/Markdown/index.js +0 -3
- package/dist/components/Menu/Menu.js +0 -56
- package/dist/components/Menu/index.js +0 -3
- package/dist/components/Modal/Modal.js +0 -63
- package/dist/components/Modal/index.js +0 -3
- package/dist/components/MonthPicker/MonthPicker.js +0 -203
- package/dist/components/MonthPicker/index.js +0 -3
- package/dist/components/MonthRangePicker/MonthRangePicker.js +0 -207
- package/dist/components/MonthRangePicker/index.js +0 -3
- package/dist/components/Radio/Radio.js +0 -10
- package/dist/components/Radio/index.js +0 -3
- package/dist/components/RadioList/RadioList.js +0 -38
- package/dist/components/RadioList/index.js +0 -3
- package/dist/components/Select/Select.js +0 -76
- package/dist/components/Select/index.js +0 -3
- package/dist/components/Sheet/Sheet.js +0 -6
- package/dist/components/Sheet/index.js +0 -3
- package/dist/components/Stack/Stack.js +0 -6
- package/dist/components/Stack/index.js +0 -3
- package/dist/components/Switch/Switch.js +0 -54
- package/dist/components/Switch/index.js +0 -3
- package/dist/components/Table/Table.js +0 -89
- package/dist/components/Table/index.js +0 -3
- package/dist/components/Tabs/Tabs.js +0 -18
- package/dist/components/Tabs/index.js +0 -3
- package/dist/components/Textarea/Textarea.js +0 -50
- package/dist/components/Textarea/index.js +0 -3
- package/dist/components/ThemeProvider/ThemeProvider.js +0 -159
- package/dist/components/ThemeProvider/index.js +0 -3
- package/dist/components/Tooltip/Tooltip.js +0 -28
- package/dist/components/Tooltip/index.js +0 -3
- package/dist/components/Typography/Typography.js +0 -28
- package/dist/components/Typography/index.js +0 -3
- package/dist/components/Uploader/Uploader.js +0 -353
- package/dist/components/Uploader/index.js +0 -3
- package/dist/components/index.js +0 -44
- package/dist/index.mjs +0 -1
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from "react";
|
|
2
|
-
import { isToday, isSameDay, isWithinRange, getMonthName, getYearName, isSameMonth, } from "../utils";
|
|
3
|
-
export var useCalendar = function (ownerState) {
|
|
4
|
-
var _a = useState(null), hoverDay = _a[0], setHoverDay = _a[1];
|
|
5
|
-
var _b = useState(null), hoverMonth = _b[0], setHoverMonth = _b[1];
|
|
6
|
-
return {
|
|
7
|
-
calendarTitle: ownerState.view === "month"
|
|
8
|
-
? getYearName(ownerState.viewMonth, ownerState.locale || "default")
|
|
9
|
-
: getMonthName(ownerState.viewMonth, ownerState.locale || "default"),
|
|
10
|
-
onPrev: useCallback(function () {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
if (ownerState.view === "day") {
|
|
13
|
-
var prevMonth = new Date(ownerState.viewMonth || new Date());
|
|
14
|
-
prevMonth.setMonth(prevMonth.getMonth() - 1);
|
|
15
|
-
(_a = ownerState.onMonthChange) === null || _a === void 0 ? void 0 : _a.call(ownerState, prevMonth);
|
|
16
|
-
}
|
|
17
|
-
else if (ownerState.view === "month") {
|
|
18
|
-
var prevYear = new Date(ownerState.viewMonth || new Date());
|
|
19
|
-
prevYear.setFullYear(prevYear.getFullYear() - 1);
|
|
20
|
-
(_b = ownerState.onMonthChange) === null || _b === void 0 ? void 0 : _b.call(ownerState, prevYear);
|
|
21
|
-
}
|
|
22
|
-
}, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
|
|
23
|
-
onNext: useCallback(function () {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
if (ownerState.view === "day") {
|
|
26
|
-
var nextMonth = new Date(ownerState.viewMonth || new Date());
|
|
27
|
-
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
|
28
|
-
(_a = ownerState.onMonthChange) === null || _a === void 0 ? void 0 : _a.call(ownerState, nextMonth);
|
|
29
|
-
}
|
|
30
|
-
else if (ownerState.view === "month") {
|
|
31
|
-
var nextYear = new Date(ownerState.viewMonth || new Date());
|
|
32
|
-
nextYear.setFullYear(nextYear.getFullYear() + 1);
|
|
33
|
-
(_b = ownerState.onMonthChange) === null || _b === void 0 ? void 0 : _b.call(ownerState, nextYear);
|
|
34
|
-
}
|
|
35
|
-
}, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
|
|
36
|
-
getDayCellProps: useCallback(function (day) {
|
|
37
|
-
var thisDay = new Date(ownerState.viewMonth || new Date());
|
|
38
|
-
thisDay.setHours(0, 0, 0, 0);
|
|
39
|
-
thisDay.setDate(day);
|
|
40
|
-
var inRange = ownerState.rangeSelection &&
|
|
41
|
-
ownerState.value &&
|
|
42
|
-
ownerState.value[0] &&
|
|
43
|
-
// NOTE: hover day is not included in the range
|
|
44
|
-
((hoverDay &&
|
|
45
|
-
isWithinRange(ownerState.value[0], hoverDay, thisDay)) ||
|
|
46
|
-
// NOTE: Selected range is included in the range
|
|
47
|
-
(ownerState.value[1] &&
|
|
48
|
-
isWithinRange(ownerState.value[0], ownerState.value[1], thisDay)));
|
|
49
|
-
return {
|
|
50
|
-
"aria-label": thisDay.toLocaleDateString(),
|
|
51
|
-
"aria-current": inRange ? "date" : undefined,
|
|
52
|
-
};
|
|
53
|
-
}, [
|
|
54
|
-
ownerState.rangeSelection,
|
|
55
|
-
ownerState.value,
|
|
56
|
-
ownerState.viewMonth,
|
|
57
|
-
hoverDay,
|
|
58
|
-
]),
|
|
59
|
-
getMonthCellProps: useCallback(function (monthIndex) {
|
|
60
|
-
var _a;
|
|
61
|
-
var thisMonth = new Date(ownerState.viewMonth || new Date());
|
|
62
|
-
thisMonth.setDate(1);
|
|
63
|
-
thisMonth.setHours(0, 0, 0, 0);
|
|
64
|
-
thisMonth.setMonth(monthIndex);
|
|
65
|
-
var isMonthRangeSelection = !((_a = ownerState.views) === null || _a === void 0 ? void 0 : _a.find(function (view) { return view === 'day'; })) && ownerState.rangeSelection;
|
|
66
|
-
var inRange = isMonthRangeSelection &&
|
|
67
|
-
ownerState.value &&
|
|
68
|
-
ownerState.value[0] &&
|
|
69
|
-
// NOTE: hover day is not included in the range
|
|
70
|
-
((hoverMonth &&
|
|
71
|
-
isWithinRange(ownerState.value[0], hoverMonth, thisMonth)) ||
|
|
72
|
-
// NOTE: Selected range is included in the range
|
|
73
|
-
(ownerState.value[1] &&
|
|
74
|
-
isWithinRange(ownerState.value[0], ownerState.value[1], thisMonth)));
|
|
75
|
-
return {
|
|
76
|
-
"aria-label": thisMonth.toLocaleDateString(),
|
|
77
|
-
"aria-current": inRange ? "date" : undefined,
|
|
78
|
-
};
|
|
79
|
-
}, [
|
|
80
|
-
ownerState.rangeSelection,
|
|
81
|
-
ownerState.value,
|
|
82
|
-
ownerState.viewMonth,
|
|
83
|
-
hoverMonth,
|
|
84
|
-
]),
|
|
85
|
-
getPickerDayProps: useCallback(function (day) {
|
|
86
|
-
var _a, _b;
|
|
87
|
-
var thisDay = new Date(ownerState.viewMonth || new Date());
|
|
88
|
-
thisDay.setHours(0, 0, 0, 0);
|
|
89
|
-
thisDay.setDate(day);
|
|
90
|
-
var isSelected = !!ownerState.value &&
|
|
91
|
-
(isSameDay(thisDay, ownerState.value[0]) ||
|
|
92
|
-
(ownerState.value[1] && isSameDay(thisDay, ownerState.value[1])));
|
|
93
|
-
var inRange = ownerState.rangeSelection &&
|
|
94
|
-
ownerState.value &&
|
|
95
|
-
ownerState.value[0] &&
|
|
96
|
-
// NOTE: hover day is not included in the range
|
|
97
|
-
((hoverDay &&
|
|
98
|
-
isWithinRange(ownerState.value[0], hoverDay, thisDay)) ||
|
|
99
|
-
// NOTE: Selected range is included in the range
|
|
100
|
-
(ownerState.value[1] &&
|
|
101
|
-
isWithinRange(ownerState.value[0], ownerState.value[1], thisDay)));
|
|
102
|
-
var handleDayClick = function () {
|
|
103
|
-
var _a, _b, _c, _d;
|
|
104
|
-
if (ownerState.rangeSelection) {
|
|
105
|
-
if (!ownerState.value) {
|
|
106
|
-
(_a = ownerState.onChange) === null || _a === void 0 ? void 0 : _a.call(ownerState, [thisDay, undefined]);
|
|
107
|
-
}
|
|
108
|
-
else if (ownerState.value[0] && !ownerState.value[1]) {
|
|
109
|
-
(_b = ownerState.onChange) === null || _b === void 0 ? void 0 : _b.call(ownerState, [
|
|
110
|
-
new Date(Math.min(ownerState.value[0].getTime(), thisDay.getTime())),
|
|
111
|
-
new Date(Math.max(ownerState.value[0].getTime(), thisDay.getTime())),
|
|
112
|
-
]);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
(_c = ownerState.onChange) === null || _c === void 0 ? void 0 : _c.call(ownerState, [thisDay, undefined]);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
(_d = ownerState.onChange) === null || _d === void 0 ? void 0 : _d.call(ownerState, [thisDay, undefined]);
|
|
120
|
-
}
|
|
121
|
-
setHoverDay(null);
|
|
122
|
-
};
|
|
123
|
-
return {
|
|
124
|
-
isToday: isToday(thisDay),
|
|
125
|
-
isSelected: isSelected,
|
|
126
|
-
onClick: handleDayClick,
|
|
127
|
-
onMouseEnter: ownerState.rangeSelection &&
|
|
128
|
-
((_a = ownerState.value) === null || _a === void 0 ? void 0 : _a[0]) &&
|
|
129
|
-
!((_b = ownerState.value) === null || _b === void 0 ? void 0 : _b[1])
|
|
130
|
-
? function () { return setHoverDay(thisDay); }
|
|
131
|
-
: undefined,
|
|
132
|
-
disabled: (ownerState.minDate && thisDay < ownerState.minDate) ||
|
|
133
|
-
(ownerState.maxDate && thisDay > ownerState.maxDate) ||
|
|
134
|
-
(ownerState.disableFuture && thisDay > new Date()) ||
|
|
135
|
-
(ownerState.disablePast &&
|
|
136
|
-
thisDay <
|
|
137
|
-
(function () {
|
|
138
|
-
var today = new Date();
|
|
139
|
-
today.setHours(0, 0, 0, 0);
|
|
140
|
-
return today;
|
|
141
|
-
})()),
|
|
142
|
-
tabIndex: -1,
|
|
143
|
-
"aria-label": thisDay.toLocaleDateString(),
|
|
144
|
-
"aria-selected": isSelected ? "true" : undefined,
|
|
145
|
-
"aria-current": inRange ? "date" : undefined,
|
|
146
|
-
};
|
|
147
|
-
}, [
|
|
148
|
-
ownerState.onChange,
|
|
149
|
-
ownerState.value,
|
|
150
|
-
ownerState.viewMonth,
|
|
151
|
-
ownerState.rangeSelection,
|
|
152
|
-
ownerState.minDate,
|
|
153
|
-
ownerState.maxDate,
|
|
154
|
-
ownerState.disableFuture,
|
|
155
|
-
ownerState.disablePast,
|
|
156
|
-
hoverDay,
|
|
157
|
-
]),
|
|
158
|
-
getPickerMonthProps: useCallback(function (monthIndex) {
|
|
159
|
-
var _a, _b, _c;
|
|
160
|
-
var thisMonth = new Date(ownerState.viewMonth || new Date());
|
|
161
|
-
thisMonth.setDate(1);
|
|
162
|
-
thisMonth.setHours(0, 0, 0, 0);
|
|
163
|
-
thisMonth.setMonth(monthIndex);
|
|
164
|
-
var isMonthRangeSelection = !((_a = ownerState.views) === null || _a === void 0 ? void 0 : _a.find(function (view) { return view === 'day'; })) && ownerState.rangeSelection;
|
|
165
|
-
var isSelected = !!ownerState.value &&
|
|
166
|
-
(isSameMonth(thisMonth, ownerState.value[0]) ||
|
|
167
|
-
(ownerState.value[1] &&
|
|
168
|
-
isSameMonth(thisMonth, ownerState.value[1])));
|
|
169
|
-
var inRange = isMonthRangeSelection &&
|
|
170
|
-
ownerState.value &&
|
|
171
|
-
ownerState.value[0] &&
|
|
172
|
-
// NOTE: hover day is not included in the range
|
|
173
|
-
((hoverMonth &&
|
|
174
|
-
isWithinRange(ownerState.value[0], hoverMonth, thisMonth)) ||
|
|
175
|
-
// NOTE: Selected range is included in the range
|
|
176
|
-
(ownerState.value[1] &&
|
|
177
|
-
isWithinRange(ownerState.value[0], ownerState.value[1], thisMonth)));
|
|
178
|
-
var handleMonthClick = function () {
|
|
179
|
-
var _a, _b, _c, _d, _e;
|
|
180
|
-
if (isMonthRangeSelection) {
|
|
181
|
-
if (!ownerState.value) {
|
|
182
|
-
(_a = ownerState.onChange) === null || _a === void 0 ? void 0 : _a.call(ownerState, [thisMonth, undefined]);
|
|
183
|
-
}
|
|
184
|
-
else if (ownerState.value[0] && !ownerState.value[1]) {
|
|
185
|
-
(_b = ownerState.onChange) === null || _b === void 0 ? void 0 : _b.call(ownerState, [
|
|
186
|
-
new Date(Math.min(ownerState.value[0].getTime(), thisMonth.getTime())),
|
|
187
|
-
new Date(Math.max(ownerState.value[0].getTime(), thisMonth.getTime())),
|
|
188
|
-
]);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
(_c = ownerState.onChange) === null || _c === void 0 ? void 0 : _c.call(ownerState, [thisMonth, undefined]);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
(_d = ownerState.onViewChange) === null || _d === void 0 ? void 0 : _d.call(ownerState, "day");
|
|
196
|
-
(_e = ownerState.onMonthChange) === null || _e === void 0 ? void 0 : _e.call(ownerState, thisMonth);
|
|
197
|
-
}
|
|
198
|
-
setHoverMonth(null);
|
|
199
|
-
};
|
|
200
|
-
return {
|
|
201
|
-
isSelected: isSelected,
|
|
202
|
-
onMouseEnter: isMonthRangeSelection &&
|
|
203
|
-
((_b = ownerState.value) === null || _b === void 0 ? void 0 : _b[0]) &&
|
|
204
|
-
!((_c = ownerState.value) === null || _c === void 0 ? void 0 : _c[1])
|
|
205
|
-
? function () { return setHoverMonth(thisMonth); }
|
|
206
|
-
: undefined,
|
|
207
|
-
disabled: (ownerState.minDate &&
|
|
208
|
-
(function () {
|
|
209
|
-
// check all days disabled in this month
|
|
210
|
-
var lastDay = new Date(thisMonth);
|
|
211
|
-
lastDay.setMonth(lastDay.getMonth() + 1);
|
|
212
|
-
lastDay.setDate(0);
|
|
213
|
-
return lastDay < ownerState.minDate;
|
|
214
|
-
})()) ||
|
|
215
|
-
(ownerState.maxDate &&
|
|
216
|
-
(function () {
|
|
217
|
-
// check all days disabled in this month
|
|
218
|
-
var lastDay = new Date(thisMonth);
|
|
219
|
-
lastDay.setDate(0);
|
|
220
|
-
return lastDay > ownerState.maxDate;
|
|
221
|
-
})()) ||
|
|
222
|
-
(ownerState.disableFuture && thisMonth > new Date()) ||
|
|
223
|
-
(ownerState.disablePast && thisMonth < new Date() && !isSameMonth(thisMonth, new Date())),
|
|
224
|
-
onClick: handleMonthClick,
|
|
225
|
-
tabIndex: -1,
|
|
226
|
-
"aria-label": getMonthName(thisMonth, ownerState.locale || "default"),
|
|
227
|
-
"aria-selected": isSelected ? "true" : undefined,
|
|
228
|
-
"aria-current": inRange ? "date" : undefined,
|
|
229
|
-
};
|
|
230
|
-
}, [
|
|
231
|
-
ownerState.onMonthChange,
|
|
232
|
-
ownerState.onViewChange,
|
|
233
|
-
ownerState.onChange,
|
|
234
|
-
ownerState.viewMonth,
|
|
235
|
-
ownerState.locale,
|
|
236
|
-
ownerState.value,
|
|
237
|
-
ownerState.minDate,
|
|
238
|
-
ownerState.maxDate,
|
|
239
|
-
ownerState.disableFuture,
|
|
240
|
-
ownerState.disablePast,
|
|
241
|
-
hoverMonth,
|
|
242
|
-
]),
|
|
243
|
-
};
|
|
244
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
export var getCalendarDates = function (date) {
|
|
2
|
-
var dates = [];
|
|
3
|
-
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
4
|
-
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
5
|
-
var firstWeekInThisMonth = Math.ceil((firstDay.getDay() + 1) / 7);
|
|
6
|
-
var lastWeekInThisMonth = Math.ceil((lastDay.getDate() + firstDay.getDay()) / 7);
|
|
7
|
-
var day = 1;
|
|
8
|
-
for (var i = 1; i <= lastWeekInThisMonth; i++) {
|
|
9
|
-
var week = [];
|
|
10
|
-
for (var j = 1; j <= 7; j++) {
|
|
11
|
-
if (i === firstWeekInThisMonth && j < firstDay.getDay() + 1) {
|
|
12
|
-
week.push(undefined);
|
|
13
|
-
}
|
|
14
|
-
else if (day > lastDay.getDate()) {
|
|
15
|
-
week.push(undefined);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
week.push(day);
|
|
19
|
-
day++;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
dates.push(week);
|
|
23
|
-
}
|
|
24
|
-
return dates;
|
|
25
|
-
};
|
|
26
|
-
export var getYearName = function (date, locale) {
|
|
27
|
-
return date.toLocaleString(locale, { year: "numeric" });
|
|
28
|
-
};
|
|
29
|
-
export var getMonthName = function (date, locale) {
|
|
30
|
-
return date.toLocaleString(locale, { year: "numeric", month: "long" });
|
|
31
|
-
};
|
|
32
|
-
export var getMonthNameFromIndex = function (index, locale) {
|
|
33
|
-
return new Date(0, index).toLocaleString(locale, { month: "short" });
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* 일~토 / Sun ~ Sat 같은 요일 이름을 가져옵니다.
|
|
37
|
-
*/
|
|
38
|
-
export var getWeekdayNames = function (locale) {
|
|
39
|
-
var currentDay = new Date().getDay();
|
|
40
|
-
var date = new Date();
|
|
41
|
-
date.setDate(date.getDate() - currentDay);
|
|
42
|
-
return Array.from({ length: 7 }).map(function () {
|
|
43
|
-
var day = date.toLocaleString(locale, { weekday: "short" });
|
|
44
|
-
date.setDate(date.getDate() + 1);
|
|
45
|
-
return day;
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
export var isToday = function (date) {
|
|
49
|
-
var today = new Date();
|
|
50
|
-
var d = new Date(date);
|
|
51
|
-
d.setHours(0, 0, 0, 0);
|
|
52
|
-
today.setHours(0, 0, 0, 0);
|
|
53
|
-
return d.getTime() === today.getTime();
|
|
54
|
-
};
|
|
55
|
-
export var isSameDay = function (date1, date2) {
|
|
56
|
-
var d1 = new Date(date1);
|
|
57
|
-
var d2 = new Date(date2);
|
|
58
|
-
d1.setHours(0, 0, 0, 0);
|
|
59
|
-
d2.setHours(0, 0, 0, 0);
|
|
60
|
-
return d1.getTime() === d2.getTime();
|
|
61
|
-
};
|
|
62
|
-
export var isWithinRange = function (d1, d2, date) {
|
|
63
|
-
var dateToCheck = new Date(date);
|
|
64
|
-
dateToCheck.setHours(0, 0, 0, 0);
|
|
65
|
-
var minDate = new Date(Math.min(d1.getTime(), d2.getTime()));
|
|
66
|
-
var maxDate = new Date(Math.max(d1.getTime(), d2.getTime()));
|
|
67
|
-
return dateToCheck >= minDate && dateToCheck <= maxDate;
|
|
68
|
-
};
|
|
69
|
-
export var isSameMonth = function (date1, date2) {
|
|
70
|
-
return (date1.getFullYear() === date2.getFullYear() &&
|
|
71
|
-
date1.getMonth() === date2.getMonth());
|
|
72
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Card as JoyCard, CardContent as JoyCardContent, CardCover as JoyCardCover, CardActions as JoyCardActions, CardOverflow as JoyCardOverflow, } from "@mui/joy";
|
|
2
|
-
import { motion } from "framer-motion";
|
|
3
|
-
var MotionCard = motion(JoyCard);
|
|
4
|
-
var Card = MotionCard;
|
|
5
|
-
export { Card };
|
|
6
|
-
Card.displayName = "Card";
|
|
7
|
-
var MotionCardContent = motion(JoyCardContent);
|
|
8
|
-
var CardContent = MotionCardContent;
|
|
9
|
-
export { CardContent };
|
|
10
|
-
CardContent.displayName = "CardContent";
|
|
11
|
-
var MotionCardCover = motion(JoyCardCover);
|
|
12
|
-
var CardCover = MotionCardCover;
|
|
13
|
-
export { CardCover };
|
|
14
|
-
CardCover.displayName = "CardCover";
|
|
15
|
-
var MotionCardActions = motion(JoyCardActions);
|
|
16
|
-
var CardActions = MotionCardActions;
|
|
17
|
-
export { CardActions };
|
|
18
|
-
CardActions.displayName = "CardActions";
|
|
19
|
-
var MotionCardOverflow = motion(JoyCardOverflow);
|
|
20
|
-
var CardOverflow = MotionCardOverflow;
|
|
21
|
-
export { CardOverflow };
|
|
22
|
-
CardOverflow.displayName = "CardOverflow";
|
|
@@ -1,28 +0,0 @@
|
|
|
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))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import React from "react";
|
|
13
|
-
import { Checkbox as JoyCheckbox } from "@mui/joy";
|
|
14
|
-
import { motion } from "framer-motion";
|
|
15
|
-
var MotionCheckbox = motion(JoyCheckbox);
|
|
16
|
-
var Checkbox = function (props) {
|
|
17
|
-
// prop destruction
|
|
18
|
-
// lib hooks
|
|
19
|
-
// state, ref, querystring hooks
|
|
20
|
-
// form hooks
|
|
21
|
-
// query hooks
|
|
22
|
-
// calculated values
|
|
23
|
-
// effects
|
|
24
|
-
// handlers
|
|
25
|
-
return React.createElement(MotionCheckbox, __assign({}, props));
|
|
26
|
-
};
|
|
27
|
-
export { Checkbox };
|
|
28
|
-
Checkbox.displayName = "Checkbox";
|
|
@@ -1,65 +0,0 @@
|
|
|
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))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { styled } from "@mui/joy";
|
|
13
|
-
import React, { forwardRef } from "react";
|
|
14
|
-
var ContainerRoot = styled("div", {
|
|
15
|
-
name: "Container",
|
|
16
|
-
slot: "root",
|
|
17
|
-
shouldForwardProp: function (prop) {
|
|
18
|
-
return prop !== "maxWidth" && prop !== "overrideBreakpoint";
|
|
19
|
-
},
|
|
20
|
-
})(function (_a) {
|
|
21
|
-
var _b;
|
|
22
|
-
var theme = _a.theme, _c = _a.maxWidth, maxWidth = _c === void 0 ? "lg" : _c, overrideBreakpoint = _a.overrideBreakpoint;
|
|
23
|
-
return [
|
|
24
|
-
(_b = {
|
|
25
|
-
width: "100%",
|
|
26
|
-
marginLeft: "auto",
|
|
27
|
-
boxSizing: "border-box",
|
|
28
|
-
marginRight: "auto",
|
|
29
|
-
display: "block", // Fix IE11 layout when used with main.
|
|
30
|
-
paddingLeft: theme.spacing(4),
|
|
31
|
-
paddingRight: theme.spacing(4)
|
|
32
|
-
},
|
|
33
|
-
_b[theme.breakpoints.up("lg")] = {
|
|
34
|
-
paddingLeft: theme.spacing(8),
|
|
35
|
-
paddingRight: theme.spacing(8),
|
|
36
|
-
},
|
|
37
|
-
_b.maxWidth = theme.breakpoints.values[maxWidth],
|
|
38
|
-
_b),
|
|
39
|
-
overrideBreakpoint
|
|
40
|
-
? {
|
|
41
|
-
paddingLeft: theme.breakpoints.values[overrideBreakpoint] >=
|
|
42
|
-
theme.breakpoints.values.lg
|
|
43
|
-
? theme.spacing(8)
|
|
44
|
-
: theme.spacing(4),
|
|
45
|
-
paddingRight: theme.breakpoints.values[overrideBreakpoint] >=
|
|
46
|
-
theme.breakpoints.values.lg
|
|
47
|
-
? theme.spacing(8)
|
|
48
|
-
: theme.spacing(4),
|
|
49
|
-
}
|
|
50
|
-
: null,
|
|
51
|
-
];
|
|
52
|
-
});
|
|
53
|
-
var Container = forwardRef(function Container(props, ref) {
|
|
54
|
-
// prop destruction
|
|
55
|
-
// lib hooks
|
|
56
|
-
// state, ref, querystring hooks
|
|
57
|
-
// form hooks
|
|
58
|
-
// query hooks
|
|
59
|
-
// calculated values
|
|
60
|
-
// effects
|
|
61
|
-
// handlers
|
|
62
|
-
return React.createElement(ContainerRoot, __assign({ ref: ref }, props));
|
|
63
|
-
});
|
|
64
|
-
export { Container };
|
|
65
|
-
Container.displayName = "Container";
|
|
@@ -1,108 +0,0 @@
|
|
|
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))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import React, { useCallback, useMemo, useState } from "react";
|
|
24
|
-
import { IntlMessageFormat } from "intl-messageformat";
|
|
25
|
-
import { NumericFormat } from "react-number-format";
|
|
26
|
-
import Input from "../Input";
|
|
27
|
-
import FormControl from "../FormControl";
|
|
28
|
-
import FormLabel from "../FormLabel";
|
|
29
|
-
import FormHelperText from "../FormHelperText";
|
|
30
|
-
import { useCurrencySetting } from "./hooks/use-currency-setting";
|
|
31
|
-
var TextMaskAdapter = React.forwardRef(function TextMaskAdapter(props, ref) {
|
|
32
|
-
// prop destruction
|
|
33
|
-
var onChange = props.onChange, innerProps = __rest(props, ["onChange"]);
|
|
34
|
-
// lib hooks
|
|
35
|
-
// state, ref, querystring hooks
|
|
36
|
-
// form hooks
|
|
37
|
-
// query hooks
|
|
38
|
-
// calculated values
|
|
39
|
-
// effects
|
|
40
|
-
// handlers
|
|
41
|
-
return (React.createElement(NumericFormat, __assign({}, innerProps, { onValueChange: function (_a) {
|
|
42
|
-
var value = _a.value;
|
|
43
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
44
|
-
target: { name: props.name, value: value },
|
|
45
|
-
});
|
|
46
|
-
}, valueIsNumericString: true, getInputRef: ref, allowNegative: false })));
|
|
47
|
-
});
|
|
48
|
-
var CurrencyInput = React.forwardRef(function CurrencyInput(props, ref) {
|
|
49
|
-
// prop destruction
|
|
50
|
-
var _a = props.currency, currency = _a === void 0 ? "USD" : _a, name = props.name, onChange = props.onChange, label = props.label, error = props.error, helperText = props.helperText, required = props.required, disabled = props.disabled, useMinorUnit = props.useMinorUnit, innerProps = __rest(props, ["currency", "name", "onChange", "label", "error", "helperText", "required", "disabled", "useMinorUnit"]);
|
|
51
|
-
// lib hooks
|
|
52
|
-
var _b = useCurrencySetting(currency), symbol = _b.symbol, thousandSeparator = _b.thousandSeparator, decimalSeparator = _b.decimalSeparator, placeholder = _b.placeholder, fixedDecimalScale = _b.fixedDecimalScale, decimalScale = _b.decimalScale;
|
|
53
|
-
// state, ref, querystring hooks
|
|
54
|
-
var _c = useState(props.value), _value = _c[0], setValue = _c[1];
|
|
55
|
-
var value = useMemo(function () {
|
|
56
|
-
if (_value && useMinorUnit) {
|
|
57
|
-
return _value / Math.pow(10, decimalScale);
|
|
58
|
-
}
|
|
59
|
-
return _value;
|
|
60
|
-
}, [_value, useMinorUnit, decimalScale]);
|
|
61
|
-
var max = useMemo(function () {
|
|
62
|
-
if (props.max && useMinorUnit) {
|
|
63
|
-
return props.max / Math.pow(10, decimalScale);
|
|
64
|
-
}
|
|
65
|
-
return props.max;
|
|
66
|
-
}, [props.max, useMinorUnit, decimalScale]);
|
|
67
|
-
var _d = useState(!!max && !!value && value > max), isOverLimit = _d[0], setIsOverLimit = _d[1];
|
|
68
|
-
// form hooks
|
|
69
|
-
// query hooks
|
|
70
|
-
// calculated values
|
|
71
|
-
// effects
|
|
72
|
-
// handlers
|
|
73
|
-
var handleChange = useCallback(function (event) {
|
|
74
|
-
var _a;
|
|
75
|
-
var amount = useMinorUnit
|
|
76
|
-
? Number((_a = event.target.value) === null || _a === void 0 ? void 0 : _a.replace(decimalSeparator, ""))
|
|
77
|
-
: Number(event.target.value);
|
|
78
|
-
if (!!max && Number(event.target.value) > max) {
|
|
79
|
-
setIsOverLimit(true);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
setIsOverLimit(false);
|
|
83
|
-
}
|
|
84
|
-
setValue(amount);
|
|
85
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(__assign(__assign({}, event), { target: { name: name, value: amount } }));
|
|
86
|
-
}, [decimalSeparator, max, name, onChange, useMinorUnit]);
|
|
87
|
-
var currencyFormatter = (React.createElement(Input, __assign({}, innerProps, { size: "sm", ref: ref, value: value, placeholder: placeholder, onChange: handleChange, disabled: disabled, required: required, color: error || isOverLimit ? "danger" : props.color, slotProps: {
|
|
88
|
-
input: {
|
|
89
|
-
component: TextMaskAdapter,
|
|
90
|
-
decimalSeparator: decimalSeparator,
|
|
91
|
-
thousandSeparator: thousandSeparator,
|
|
92
|
-
prefix: symbol,
|
|
93
|
-
fixedDecimalScale: fixedDecimalScale,
|
|
94
|
-
decimalScale: decimalScale,
|
|
95
|
-
"aria-label": innerProps["aria-label"],
|
|
96
|
-
},
|
|
97
|
-
}, sx: {
|
|
98
|
-
fontFamily: "monospace",
|
|
99
|
-
} })));
|
|
100
|
-
if (label) {
|
|
101
|
-
return (React.createElement(FormControl, { size: "sm", disabled: disabled, required: required, error: error || isOverLimit },
|
|
102
|
-
React.createElement(FormLabel, null, label),
|
|
103
|
-
currencyFormatter,
|
|
104
|
-
isOverLimit ? (React.createElement(FormHelperText, null, new IntlMessageFormat("limit: {amount, number, ::currency/".concat(currency, " unit-width-narrow}")).format({ amount: max }))) : (helperText && React.createElement(FormHelperText, null, helperText))));
|
|
105
|
-
}
|
|
106
|
-
return currencyFormatter;
|
|
107
|
-
});
|
|
108
|
-
export { CurrencyInput };
|