@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,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, { forwardRef } from "react";
|
|
13
|
-
import { Button as JoyButton } from "@mui/joy";
|
|
14
|
-
import { motion } from "framer-motion";
|
|
15
|
-
var MotionButton = motion(JoyButton);
|
|
16
|
-
var Button = forwardRef(function (props, ref) {
|
|
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(MotionButton, __assign({ ref: ref }, props)));
|
|
26
|
-
});
|
|
27
|
-
export { Button };
|
|
28
|
-
Button.displayName = "Button";
|
|
@@ -1,383 +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, { Fragment, forwardRef, useMemo } from "react";
|
|
24
|
-
import { styled } from "@mui/joy";
|
|
25
|
-
// @ts-ignore: ESM import 해야만 프레이머에서 정상적으로 동작한다. https://github.com/mui/material-ui/issues/35233
|
|
26
|
-
import ChevronLeftIcon from "@mui/icons-material/esm/ChevronLeft.js";
|
|
27
|
-
// @ts-ignore: ESM import 해야만 프레이머에서 정상적으로 동작한다. https://github.com/mui/material-ui/issues/35233
|
|
28
|
-
import ChevronRightIcon from "@mui/icons-material/esm/ChevronRight.js";
|
|
29
|
-
import { AnimatePresence, motion } from "framer-motion";
|
|
30
|
-
import Button from "../Button";
|
|
31
|
-
import Typography from "../Typography";
|
|
32
|
-
import { getCalendarDates, getMonthNameFromIndex, getWeekdayNames, } from "./utils";
|
|
33
|
-
import IconButton from "../IconButton";
|
|
34
|
-
import { useCalendarProps } from "./hooks/use-calendar-props";
|
|
35
|
-
import { useCalendar } from "./hooks/use-calendar";
|
|
36
|
-
var CalendarRoot = styled("div", {
|
|
37
|
-
name: "Calendar",
|
|
38
|
-
slot: "root",
|
|
39
|
-
})({
|
|
40
|
-
maxWidth: "264px",
|
|
41
|
-
});
|
|
42
|
-
var CalendarHeader = styled("div", {
|
|
43
|
-
name: "Calendar",
|
|
44
|
-
slot: "calendarHeader",
|
|
45
|
-
})(function (_a) {
|
|
46
|
-
var theme = _a.theme;
|
|
47
|
-
return ({
|
|
48
|
-
display: "flex",
|
|
49
|
-
justifyContent: "space-between",
|
|
50
|
-
alignItems: "center",
|
|
51
|
-
padding: theme.spacing(1),
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
var CalendarViewContainer = styled("div", {
|
|
55
|
-
name: "Calendar",
|
|
56
|
-
slot: "viewContainer",
|
|
57
|
-
})(function (_a) {
|
|
58
|
-
var theme = _a.theme, calendarType = _a.calendarType;
|
|
59
|
-
return ({
|
|
60
|
-
paddingLeft: theme.spacing(1),
|
|
61
|
-
paddingRight: theme.spacing(1),
|
|
62
|
-
position: "relative",
|
|
63
|
-
overflow: "hidden",
|
|
64
|
-
minHeight: calendarType === 'datePicker' ? "250px" : "unset",
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
var CalendarViewTable = styled(motion.table, {
|
|
68
|
-
name: "Calendar",
|
|
69
|
-
slot: "viewTable",
|
|
70
|
-
})(function (_a) {
|
|
71
|
-
var theme = _a.theme;
|
|
72
|
-
return ({
|
|
73
|
-
borderSpacing: 0,
|
|
74
|
-
"& td, & th": {
|
|
75
|
-
padding: 0,
|
|
76
|
-
},
|
|
77
|
-
"& th": {
|
|
78
|
-
paddingTop: theme.spacing(1),
|
|
79
|
-
paddingBottom: theme.spacing(1),
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
var CalendarWeekHeaderContainer = styled("thead", {
|
|
84
|
-
name: "Calendar",
|
|
85
|
-
slot: "weekHeaderContainer",
|
|
86
|
-
})({});
|
|
87
|
-
var CalendarDayPickerContainer = styled("tbody", {
|
|
88
|
-
name: "Calendar",
|
|
89
|
-
slot: "dayPickerContainer",
|
|
90
|
-
})({});
|
|
91
|
-
var CalendarSwitchViewButton = styled(Button, {
|
|
92
|
-
name: "Calendar",
|
|
93
|
-
slot: "switchViewButton",
|
|
94
|
-
})(function (_a) {
|
|
95
|
-
var ownerState = _a.ownerState;
|
|
96
|
-
return [
|
|
97
|
-
ownerState.view === "month" && {
|
|
98
|
-
pointerEvents: "none",
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
});
|
|
102
|
-
var CalendarDayCell = styled("td", {
|
|
103
|
-
name: "Calendar",
|
|
104
|
-
slot: "dayCell",
|
|
105
|
-
})(function (_a) {
|
|
106
|
-
var theme = _a.theme;
|
|
107
|
-
return ({
|
|
108
|
-
// aria-current=date === range에 포함된 버튼
|
|
109
|
-
"&[aria-current=date]": {
|
|
110
|
-
position: "relative",
|
|
111
|
-
"& button[aria-current=date]:not([aria-selected=true]):not(:hover):not(:active)": {
|
|
112
|
-
backgroundColor: "rgb(".concat(theme.palette.primary.lightChannel, ")"),
|
|
113
|
-
},
|
|
114
|
-
'& + td[aria-hidden] + td[aria-current="date"]::before': {
|
|
115
|
-
content: '""',
|
|
116
|
-
position: "absolute",
|
|
117
|
-
top: 0,
|
|
118
|
-
left: "-10px",
|
|
119
|
-
bottom: 0,
|
|
120
|
-
width: "16px",
|
|
121
|
-
backgroundColor: "rgb(".concat(theme.palette.primary.lightChannel, ")"),
|
|
122
|
-
zIndex: -1,
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
var CalendarMonthCell = styled("td", {
|
|
128
|
-
name: "Calendar",
|
|
129
|
-
slot: "monthCell",
|
|
130
|
-
})(function (_a) {
|
|
131
|
-
var theme = _a.theme;
|
|
132
|
-
return ({
|
|
133
|
-
// aria-current=date === range에 포함된 버튼
|
|
134
|
-
"&[aria-current=date]": {
|
|
135
|
-
position: "relative",
|
|
136
|
-
"& button[aria-current=date]:not([aria-selected=true]):not(:hover):not(:active)": {
|
|
137
|
-
backgroundColor: "rgb(".concat(theme.palette.primary.lightChannel, ")"),
|
|
138
|
-
},
|
|
139
|
-
'& + td[aria-hidden] + td[aria-current="date"]::before': {
|
|
140
|
-
content: '""',
|
|
141
|
-
position: "absolute",
|
|
142
|
-
top: 0,
|
|
143
|
-
left: "-10px",
|
|
144
|
-
bottom: 0,
|
|
145
|
-
width: "16px",
|
|
146
|
-
backgroundColor: "rgb(".concat(theme.palette.primary.lightChannel, ")"),
|
|
147
|
-
zIndex: -1,
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
var CalendarMonth = styled(Button, {
|
|
153
|
-
name: "Calendar",
|
|
154
|
-
slot: "month",
|
|
155
|
-
})(function (_a) {
|
|
156
|
-
var theme = _a.theme, isSelected = _a.isSelected, disabled = _a.disabled;
|
|
157
|
-
return [
|
|
158
|
-
{
|
|
159
|
-
width: "59px",
|
|
160
|
-
// height: "32px",
|
|
161
|
-
textAlign: "center",
|
|
162
|
-
"&:hover": {
|
|
163
|
-
color: theme.palette.primary.softColor,
|
|
164
|
-
backgroundColor: theme.palette.primary.softHoverBg,
|
|
165
|
-
},
|
|
166
|
-
"&:active": {
|
|
167
|
-
color: theme.palette.primary.softColor,
|
|
168
|
-
backgroundColor: theme.palette.primary.softActiveBg,
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
isSelected && {
|
|
172
|
-
backgroundColor: theme.palette.primary.solidBg,
|
|
173
|
-
color: theme.palette.primary.solidColor,
|
|
174
|
-
"&:hover": {
|
|
175
|
-
color: theme.palette.primary.solidColor,
|
|
176
|
-
backgroundColor: theme.palette.primary.solidHoverBg,
|
|
177
|
-
},
|
|
178
|
-
"&:active": {
|
|
179
|
-
color: theme.palette.primary.solidColor,
|
|
180
|
-
backgroundColor: theme.palette.primary.solidActiveBg,
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
disabled && {
|
|
184
|
-
color: theme.palette.neutral.solidDisabledColor,
|
|
185
|
-
backgroundColor: theme.palette.neutral.solidDisabledBg,
|
|
186
|
-
},
|
|
187
|
-
];
|
|
188
|
-
});
|
|
189
|
-
var CalendarDay = styled(Button, {
|
|
190
|
-
name: "Calendar",
|
|
191
|
-
slot: "day",
|
|
192
|
-
})(function (_a) {
|
|
193
|
-
var theme = _a.theme, isToday = _a.isToday, isSelected = _a.isSelected, disabled = _a.disabled;
|
|
194
|
-
return [
|
|
195
|
-
{
|
|
196
|
-
width: "32px",
|
|
197
|
-
height: "32px",
|
|
198
|
-
textAlign: "center",
|
|
199
|
-
"&:hover": {
|
|
200
|
-
color: theme.palette.primary.softColor,
|
|
201
|
-
backgroundColor: theme.palette.primary.softHoverBg,
|
|
202
|
-
},
|
|
203
|
-
"&:active": {
|
|
204
|
-
color: theme.palette.primary.softColor,
|
|
205
|
-
backgroundColor: theme.palette.primary.softActiveBg,
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
// NOTE: enabled, disabled 일때만 border 적용
|
|
209
|
-
isToday &&
|
|
210
|
-
!isSelected && {
|
|
211
|
-
"&:not([aria-current=date]):not(:hover)": {
|
|
212
|
-
border: "1px solid ".concat(theme.palette.neutral.outlinedBorder),
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
isSelected && {
|
|
216
|
-
backgroundColor: theme.palette.primary.solidBg,
|
|
217
|
-
color: theme.palette.primary.solidColor,
|
|
218
|
-
"&:hover": {
|
|
219
|
-
color: theme.palette.primary.solidColor,
|
|
220
|
-
backgroundColor: theme.palette.primary.solidHoverBg,
|
|
221
|
-
},
|
|
222
|
-
"&:active": {
|
|
223
|
-
color: theme.palette.primary.solidColor,
|
|
224
|
-
backgroundColor: theme.palette.primary.solidActiveBg,
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
disabled && {
|
|
228
|
-
color: theme.palette.neutral.solidDisabledColor,
|
|
229
|
-
backgroundColor: theme.palette.neutral.solidDisabledBg,
|
|
230
|
-
},
|
|
231
|
-
];
|
|
232
|
-
});
|
|
233
|
-
var variants = {
|
|
234
|
-
enter: function (direction) {
|
|
235
|
-
return {
|
|
236
|
-
x: direction > 0 ? 300 : -300,
|
|
237
|
-
opacity: 0,
|
|
238
|
-
};
|
|
239
|
-
},
|
|
240
|
-
center: {
|
|
241
|
-
position: 'relative',
|
|
242
|
-
zIndex: 1,
|
|
243
|
-
x: 0,
|
|
244
|
-
opacity: 1,
|
|
245
|
-
},
|
|
246
|
-
exit: function (direction) {
|
|
247
|
-
return {
|
|
248
|
-
position: 'absolute',
|
|
249
|
-
zIndex: 0,
|
|
250
|
-
x: direction < 0 ? 300 : -300,
|
|
251
|
-
opacity: 0,
|
|
252
|
-
};
|
|
253
|
-
},
|
|
254
|
-
};
|
|
255
|
-
var swipeConfidenceThreshold = 10000;
|
|
256
|
-
var swipePower = function (offset, velocity) {
|
|
257
|
-
return Math.abs(offset) * velocity;
|
|
258
|
-
};
|
|
259
|
-
var PickerDays = function (props) {
|
|
260
|
-
// prop destruction
|
|
261
|
-
var ownerState = props.ownerState;
|
|
262
|
-
// lib hooks
|
|
263
|
-
var _a = useCalendar(ownerState), getPickerDayProps = _a.getPickerDayProps, getDayCellProps = _a.getDayCellProps;
|
|
264
|
-
// state, ref, querystring hooks
|
|
265
|
-
// form hooks
|
|
266
|
-
// query hooks
|
|
267
|
-
// calculated values
|
|
268
|
-
var calendarDates = useMemo(function () { return getCalendarDates(ownerState.viewMonth); }, [ownerState.viewMonth]);
|
|
269
|
-
var weekdayNames = useMemo(function () { return getWeekdayNames(ownerState.locale || "default"); }, [ownerState.locale]);
|
|
270
|
-
// effects
|
|
271
|
-
// handlers
|
|
272
|
-
return (React.createElement(CalendarViewContainer, { calendarType: "datePicker" },
|
|
273
|
-
React.createElement(AnimatePresence, { initial: false, custom: ownerState.direction },
|
|
274
|
-
React.createElement(CalendarViewTable
|
|
275
|
-
// #region framer-motion
|
|
276
|
-
, {
|
|
277
|
-
// #region framer-motion
|
|
278
|
-
key: "".concat(ownerState.viewMonth.toString(), "_").concat(ownerState.direction), custom: ownerState.direction, variants: variants, initial: "enter", animate: "center", exit: "exit", transition: {
|
|
279
|
-
x: { type: "spring", stiffness: 300, damping: 30 },
|
|
280
|
-
opacity: { duration: 0.2 },
|
|
281
|
-
}, drag: "x", dragConstraints: { left: 0, right: 0 }, dragElastic: 1, onDragEnd: function (e, _a) {
|
|
282
|
-
var _b, _c;
|
|
283
|
-
var offset = _a.offset, velocity = _a.velocity;
|
|
284
|
-
var swipe = swipePower(offset.x, velocity.x);
|
|
285
|
-
if (swipe < -swipeConfidenceThreshold) {
|
|
286
|
-
var date = new Date(ownerState.viewMonth || new Date());
|
|
287
|
-
date.setMonth(date.getMonth() + 1);
|
|
288
|
-
(_b = ownerState.onMonthChange) === null || _b === void 0 ? void 0 : _b.call(ownerState, date);
|
|
289
|
-
}
|
|
290
|
-
else if (swipe > swipeConfidenceThreshold) {
|
|
291
|
-
var date = new Date(ownerState.viewMonth || new Date());
|
|
292
|
-
date.setMonth(date.getMonth() - 1);
|
|
293
|
-
(_c = ownerState.onMonthChange) === null || _c === void 0 ? void 0 : _c.call(ownerState, date);
|
|
294
|
-
}
|
|
295
|
-
} },
|
|
296
|
-
React.createElement(CalendarWeekHeaderContainer, null,
|
|
297
|
-
React.createElement("tr", null, weekdayNames.map(function (name, i) { return (React.createElement(React.Fragment, null,
|
|
298
|
-
React.createElement("th", null,
|
|
299
|
-
React.createElement(Typography, { level: "body-xs", textAlign: "center" }, name)),
|
|
300
|
-
i < 6 && (React.createElement("th", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" })))); }))),
|
|
301
|
-
React.createElement(CalendarDayPickerContainer, null, calendarDates.map(function (weekDates, rowIndex) { return (React.createElement(Fragment, { key: "".concat(ownerState.viewMonth, "_").concat(rowIndex) },
|
|
302
|
-
React.createElement("tr", null, weekDates.map(function (date, i) {
|
|
303
|
-
return date ? (React.createElement(Fragment, { key: i },
|
|
304
|
-
React.createElement(CalendarDayCell, __assign({}, getDayCellProps(date)),
|
|
305
|
-
React.createElement(CalendarDay, __assign({ size: "sm", variant: "plain", color: "neutral" }, getPickerDayProps(date)), date)),
|
|
306
|
-
i < 6 && (React.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" })))) : (React.createElement(Fragment, { key: i },
|
|
307
|
-
React.createElement("td", null),
|
|
308
|
-
i < 6 && (React.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" }))));
|
|
309
|
-
})),
|
|
310
|
-
rowIndex < calendarDates.length - 1 && (React.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" },
|
|
311
|
-
React.createElement("td", { colSpan: 13, style: { height: 4 } }))))); }))))));
|
|
312
|
-
};
|
|
313
|
-
var PickerMonths = function (props) {
|
|
314
|
-
var _a;
|
|
315
|
-
var ownerState = props.ownerState;
|
|
316
|
-
var _b = useCalendar(ownerState), getPickerMonthProps = _b.getPickerMonthProps, getMonthCellProps = _b.getMonthCellProps;
|
|
317
|
-
var chunkedMonths = Array.from({ length: 12 }, function (_, i) { return i; }).reduce(function (acc, month) {
|
|
318
|
-
if (acc[acc.length - 1].length === 4) {
|
|
319
|
-
acc.push([]);
|
|
320
|
-
}
|
|
321
|
-
acc[acc.length - 1].push(month);
|
|
322
|
-
return acc;
|
|
323
|
-
}, [[]]);
|
|
324
|
-
var isMonthRangeSelection = !((_a = ownerState.views) === null || _a === void 0 ? void 0 : _a.find(function (view) { return view === 'day'; })) && ownerState.rangeSelection;
|
|
325
|
-
return (React.createElement(CalendarViewContainer, { calendarType: isMonthRangeSelection ? 'monthPicker' : 'datePicker' },
|
|
326
|
-
React.createElement(AnimatePresence, { initial: false, custom: ownerState.direction },
|
|
327
|
-
React.createElement(CalendarViewTable
|
|
328
|
-
// #region framer-motion
|
|
329
|
-
, {
|
|
330
|
-
// #region framer-motion
|
|
331
|
-
key: "".concat(ownerState.viewMonth.getFullYear(), "_").concat(ownerState.direction), custom: ownerState.direction, variants: variants, initial: "enter", animate: "center", exit: "exit", transition: {
|
|
332
|
-
x: { type: "spring", stiffness: 300, damping: 30 },
|
|
333
|
-
opacity: { duration: 0.2 },
|
|
334
|
-
}, drag: "x", dragConstraints: { left: 0, right: 0 }, dragElastic: 1, onDragEnd: function (e, _a) {
|
|
335
|
-
var _b, _c;
|
|
336
|
-
var offset = _a.offset, velocity = _a.velocity;
|
|
337
|
-
var swipe = swipePower(offset.x, velocity.x);
|
|
338
|
-
if (swipe < -swipeConfidenceThreshold) {
|
|
339
|
-
var date = new Date(ownerState.viewMonth || new Date());
|
|
340
|
-
date.setMonth(date.getMonth() + 1);
|
|
341
|
-
(_b = ownerState.onMonthChange) === null || _b === void 0 ? void 0 : _b.call(ownerState, date);
|
|
342
|
-
}
|
|
343
|
-
else if (swipe > swipeConfidenceThreshold) {
|
|
344
|
-
var date = new Date(ownerState.viewMonth || new Date());
|
|
345
|
-
date.setMonth(date.getMonth() - 1);
|
|
346
|
-
(_c = ownerState.onMonthChange) === null || _c === void 0 ? void 0 : _c.call(ownerState, date);
|
|
347
|
-
}
|
|
348
|
-
} },
|
|
349
|
-
React.createElement("tbody", null, chunkedMonths.map(function (months, i) { return (React.createElement(Fragment, { key: i },
|
|
350
|
-
React.createElement("tr", null, months.map(function (monthIndex, j) { return (React.createElement(Fragment, { key: monthIndex },
|
|
351
|
-
React.createElement(CalendarMonthCell, __assign({}, getMonthCellProps(monthIndex)),
|
|
352
|
-
React.createElement(CalendarMonth, __assign({ size: "sm", variant: "plain", color: "neutral" }, getPickerMonthProps(monthIndex)), getMonthNameFromIndex(monthIndex, ownerState.locale))),
|
|
353
|
-
j < 3 && (React.createElement("td", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" })))); })),
|
|
354
|
-
i < chunkedMonths.length - 1 && (React.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" },
|
|
355
|
-
React.createElement("td", { colSpan: 7, style: { height: 4 } }))))); }))))));
|
|
356
|
-
};
|
|
357
|
-
/**
|
|
358
|
-
* @see https://mui.com/x/api/date-pickers/date-calendar/ 인터페이스 참고
|
|
359
|
-
*/
|
|
360
|
-
var Calendar = forwardRef(function (inProps, ref) {
|
|
361
|
-
// prop destruction
|
|
362
|
-
var _a = useCalendarProps(inProps), props = _a[0], ownerState = _a[1];
|
|
363
|
-
var value = props.value, defaultValue = props.defaultValue, onChange = props.onChange, locale = props.locale, onViewChange = props.onViewChange, onMonthChange = props.onMonthChange, view = props.view, views = props.views, rangeSelection = props.rangeSelection, others = __rest(props, ["value", "defaultValue", "onChange", "locale", "onViewChange", "onMonthChange", "view", "views", "rangeSelection"]);
|
|
364
|
-
// lib hooks
|
|
365
|
-
var _b = useCalendar(ownerState), calendarTitle = _b.calendarTitle, onPrev = _b.onPrev, onNext = _b.onNext;
|
|
366
|
-
// state, ref, querystring hooks
|
|
367
|
-
// form hooks
|
|
368
|
-
// query hooks
|
|
369
|
-
// calculated values
|
|
370
|
-
// effects
|
|
371
|
-
// handlers
|
|
372
|
-
return (React.createElement(CalendarRoot, __assign({ ref: ref }, others),
|
|
373
|
-
React.createElement(CalendarHeader, null,
|
|
374
|
-
React.createElement(IconButton, { size: "sm", onClick: onPrev },
|
|
375
|
-
React.createElement(ChevronLeftIcon, null)),
|
|
376
|
-
React.createElement(CalendarSwitchViewButton, { ownerState: ownerState, variant: "plain", color: "neutral", onClick: onViewChange }, calendarTitle),
|
|
377
|
-
React.createElement(IconButton, { size: "sm", onClick: onNext },
|
|
378
|
-
React.createElement(ChevronRightIcon, null))),
|
|
379
|
-
view === "day" && React.createElement(PickerDays, { ownerState: ownerState }),
|
|
380
|
-
view === "month" && React.createElement(PickerMonths, { ownerState: ownerState })));
|
|
381
|
-
});
|
|
382
|
-
export { Calendar };
|
|
383
|
-
Calendar.displayName = "Calendar";
|
|
@@ -1,80 +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 { useCallback, useMemo, useState } from "react";
|
|
13
|
-
import { useThemeProps } from "@mui/joy";
|
|
14
|
-
var resolveView = function (view, views) {
|
|
15
|
-
return views.includes(view) ? view : views[0];
|
|
16
|
-
};
|
|
17
|
-
export var useCalendarProps = function (inProps) {
|
|
18
|
-
var _a, _b;
|
|
19
|
-
var _c = useState(function () {
|
|
20
|
-
return resolveView(inProps.view || "day", inProps.views || ["day", "month"]);
|
|
21
|
-
}), uncontrolledView = _c[0], setUncontrolledView = _c[1];
|
|
22
|
-
var _d = useState(inProps.defaultValue), uncontrolledValue = _d[0], setUncontrolledValue = _d[1];
|
|
23
|
-
var _e = useState(function () {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
var today = new Date();
|
|
26
|
-
today.setDate(1);
|
|
27
|
-
today.setHours(0, 0, 0, 0);
|
|
28
|
-
return ((_a = inProps.value) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = inProps.defaultValue) === null || _b === void 0 ? void 0 : _b[0]) || today;
|
|
29
|
-
}), viewMonth = _e[0], setViewMonth = _e[1];
|
|
30
|
-
var _f = useState([0, 0]), _g = _f[0], page = _g[0], direction = _g[1], setPage = _f[1];
|
|
31
|
-
var resolvedView = (_a = inProps.view) !== null && _a !== void 0 ? _a : uncontrolledView;
|
|
32
|
-
var paginate = function (newDirection) {
|
|
33
|
-
setPage([page + newDirection, newDirection]);
|
|
34
|
-
};
|
|
35
|
-
var handleViewMonthChange = useCallback(function (newMonth) {
|
|
36
|
-
var _a;
|
|
37
|
-
setViewMonth(newMonth);
|
|
38
|
-
if (resolvedView === "month") {
|
|
39
|
-
if (viewMonth.getFullYear() !== newMonth.getFullYear()) {
|
|
40
|
-
paginate(newMonth > viewMonth ? 1 : -1);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
paginate(newMonth > viewMonth ? 1 : -1);
|
|
45
|
-
}
|
|
46
|
-
(_a = inProps.onMonthChange) === null || _a === void 0 ? void 0 : _a.call(inProps, newMonth);
|
|
47
|
-
}, [inProps.onMonthChange, viewMonth, resolvedView]);
|
|
48
|
-
var props = useThemeProps({
|
|
49
|
-
props: __assign(__assign({ locale: "default", views: ["day", "month"], view: resolvedView, value: (_b = inProps.value) !== null && _b !== void 0 ? _b : uncontrolledValue }, inProps), {
|
|
50
|
-
// overrides
|
|
51
|
-
onChange: inProps.value
|
|
52
|
-
? // Controlled
|
|
53
|
-
inProps.onChange
|
|
54
|
-
: // Uncontrolled
|
|
55
|
-
function (value) {
|
|
56
|
-
var _a;
|
|
57
|
-
setUncontrolledValue(value);
|
|
58
|
-
(_a = inProps.onChange) === null || _a === void 0 ? void 0 : _a.call(inProps, value);
|
|
59
|
-
}, onMonthChange: handleViewMonthChange, onViewChange: function () {
|
|
60
|
-
var newView = resolvedView === "month" ? "day" : "month";
|
|
61
|
-
var isAllowedView = !inProps.views
|
|
62
|
-
? true
|
|
63
|
-
: inProps.views.includes(newView);
|
|
64
|
-
if (!isAllowedView || inProps.view === newView)
|
|
65
|
-
return;
|
|
66
|
-
if (inProps.onViewChange) {
|
|
67
|
-
inProps.onViewChange(newView);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
setUncontrolledView(newView);
|
|
71
|
-
}
|
|
72
|
-
} }),
|
|
73
|
-
name: "Calendar",
|
|
74
|
-
});
|
|
75
|
-
/**
|
|
76
|
-
* For ownerState
|
|
77
|
-
*/
|
|
78
|
-
var ownerState = useMemo(function () { return (__assign(__assign({}, props), { viewMonth: viewMonth, direction: direction })); }, [props, viewMonth, direction]);
|
|
79
|
-
return [props, ownerState];
|
|
80
|
-
};
|