@deepnoid/ui 0.1.156 → 0.1.158
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/.turbo/turbo-build.log +198 -188
- package/dist/{chunk-6YTT5ACI.mjs → chunk-3QE57PU3.mjs} +1 -1
- package/dist/{chunk-KKHOCWXJ.mjs → chunk-3X376ACN.mjs} +1 -1
- package/dist/{chunk-URJA4W4R.mjs → chunk-46EIW6MN.mjs} +2 -2
- package/dist/chunk-7YMXOYES.mjs +449 -0
- package/dist/{chunk-2DAIOZ7N.mjs → chunk-CSG6FDBX.mjs} +2 -2
- package/dist/{chunk-WHU5VP5G.mjs → chunk-DDFJMHBC.mjs} +57 -2
- package/dist/{chunk-ZY3HNPPG.mjs → chunk-HKHVSCER.mjs} +1 -1
- package/dist/{chunk-ZNQML73F.mjs → chunk-IRJP6BF3.mjs} +2 -2
- package/dist/{chunk-HP4ARKW3.mjs → chunk-ITFEV25U.mjs} +1 -1
- package/dist/{chunk-7RG7CQQM.mjs → chunk-JKYLYL3A.mjs} +1 -1
- package/dist/{chunk-KX6WG4VG.mjs → chunk-KLBA5J2H.mjs} +1 -1
- package/dist/chunk-L5FRTUM6.mjs +100 -0
- package/dist/chunk-OLQOLLKG.mjs +1 -0
- package/dist/{chunk-LFALITPU.mjs → chunk-PXAJEOZS.mjs} +1 -1
- package/dist/{chunk-5VVNAW4E.mjs → chunk-QHETCLHO.mjs} +2 -2
- package/dist/{chunk-Q2YLULZH.mjs → chunk-R7KUEH3N.mjs} +1 -1
- package/dist/{chunk-47MQPUEY.mjs → chunk-SFGFRMWL.mjs} +1 -1
- package/dist/{chunk-4YVZ3XKA.mjs → chunk-V64PCWVW.mjs} +3 -3
- package/dist/{chunk-R2USZD77.mjs → chunk-XHCPYYMC.mjs} +1 -1
- package/dist/{chunk-UIRHCS6B.mjs → chunk-YQYO5RLZ.mjs} +1 -1
- package/dist/{chunk-ZGUTKE5H.mjs → chunk-Z7CLJYRF.mjs} +1 -1
- package/dist/components/avatar/avatar.js +57 -2
- package/dist/components/avatar/avatar.mjs +2 -2
- package/dist/components/avatar/index.js +57 -2
- package/dist/components/avatar/index.mjs +2 -2
- package/dist/components/breadcrumb/breadcrumb.js +57 -2
- package/dist/components/breadcrumb/breadcrumb.mjs +5 -5
- package/dist/components/breadcrumb/index.js +57 -2
- package/dist/components/breadcrumb/index.mjs +5 -5
- package/dist/components/button/button.js +57 -2
- package/dist/components/button/button.mjs +3 -3
- package/dist/components/button/icon-button.js +57 -2
- package/dist/components/button/icon-button.mjs +3 -3
- package/dist/components/button/index.js +57 -2
- package/dist/components/button/index.mjs +4 -4
- package/dist/components/chip/chip.js +57 -2
- package/dist/components/chip/chip.mjs +3 -3
- package/dist/components/chip/index.js +57 -2
- package/dist/components/chip/index.mjs +3 -3
- package/dist/components/fileUpload/fileUpload.js +57 -2
- package/dist/components/fileUpload/fileUpload.mjs +6 -6
- package/dist/components/fileUpload/index.js +57 -2
- package/dist/components/fileUpload/index.mjs +6 -6
- package/dist/components/icon/Icon.d.mts +8 -0
- package/dist/components/icon/Icon.d.ts +8 -0
- package/dist/components/icon/Icon.js +57 -2
- package/dist/components/icon/Icon.mjs +2 -2
- package/dist/components/icon/index.js +57 -2
- package/dist/components/icon/index.mjs +2 -2
- package/dist/components/icon/template.d.mts +2 -0
- package/dist/components/icon/template.d.ts +2 -0
- package/dist/components/icon/template.js +57 -2
- package/dist/components/icon/template.mjs +1 -1
- package/dist/components/input/index.js +57 -2
- package/dist/components/input/index.mjs +3 -3
- package/dist/components/input/input.js +57 -2
- package/dist/components/input/input.mjs +3 -3
- package/dist/components/list/index.js +57 -2
- package/dist/components/list/index.mjs +4 -4
- package/dist/components/list/listItem.js +57 -2
- package/dist/components/list/listItem.mjs +4 -4
- package/dist/components/modal/index.js +57 -2
- package/dist/components/modal/index.mjs +5 -5
- package/dist/components/modal/modal.js +57 -2
- package/dist/components/modal/modal.mjs +5 -5
- package/dist/components/pagination/index.js +57 -2
- package/dist/components/pagination/index.mjs +4 -4
- package/dist/components/pagination/pagination.js +57 -2
- package/dist/components/pagination/pagination.mjs +4 -4
- package/dist/components/picker/datePicker.d.mts +35 -4
- package/dist/components/picker/datePicker.d.ts +35 -4
- package/dist/components/picker/datePicker.js +238 -49
- package/dist/components/picker/datePicker.mjs +6 -6
- package/dist/components/picker/day.d.mts +2 -2
- package/dist/components/picker/day.d.ts +2 -2
- package/dist/components/picker/index.d.mts +1 -1
- package/dist/components/picker/index.d.ts +1 -1
- package/dist/components/picker/index.js +238 -49
- package/dist/components/picker/index.mjs +8 -8
- package/dist/components/picker/timePicker.js +57 -2
- package/dist/components/picker/timePicker.mjs +4 -4
- package/dist/components/radio/index.d.mts +1 -1
- package/dist/components/radio/index.d.ts +1 -1
- package/dist/components/select/index.js +57 -2
- package/dist/components/select/index.mjs +3 -3
- package/dist/components/select/select.js +57 -2
- package/dist/components/select/select.mjs +3 -3
- package/dist/components/starRating/index.d.mts +4 -0
- package/dist/components/starRating/index.d.ts +4 -0
- package/dist/components/starRating/index.js +5279 -0
- package/dist/components/starRating/index.mjs +14 -0
- package/dist/components/starRating/starRating.d.mts +60 -0
- package/dist/components/starRating/starRating.d.ts +60 -0
- package/dist/components/starRating/starRating.js +5278 -0
- package/dist/components/starRating/starRating.mjs +15 -0
- package/dist/components/table/index.js +57 -2
- package/dist/components/table/index.mjs +7 -7
- package/dist/components/table/table-body.js +57 -2
- package/dist/components/table/table-body.mjs +5 -5
- package/dist/components/table/table-head.js +57 -2
- package/dist/components/table/table-head.mjs +5 -5
- package/dist/components/table/table.js +57 -2
- package/dist/components/table/table.mjs +5 -5
- package/dist/components/timePicker/calendar.js +57 -2
- package/dist/components/timePicker/calendar.mjs +2 -2
- package/dist/components/toast/index.js +57 -2
- package/dist/components/toast/index.mjs +4 -4
- package/dist/components/toast/toast.js +57 -2
- package/dist/components/toast/toast.mjs +3 -3
- package/dist/components/toast/use-toast.js +57 -2
- package/dist/components/toast/use-toast.mjs +4 -4
- package/dist/components/tree/index.js +57 -2
- package/dist/components/tree/index.mjs +3 -3
- package/dist/components/tree/tree.js +57 -2
- package/dist/components/tree/tree.mjs +3 -3
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +325 -49
- package/dist/index.mjs +37 -32
- package/package.json +1 -1
- package/dist/chunk-TCURFCQ2.mjs +0 -315
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-AF4I7ZQS.mjs";
|
|
5
5
|
import {
|
|
6
6
|
button_default
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YQYO5RLZ.mjs";
|
|
8
8
|
import {
|
|
9
9
|
Icon_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-R7KUEH3N.mjs";
|
|
11
11
|
import {
|
|
12
12
|
mapPropsVariants
|
|
13
13
|
} from "./chunk-E3G5QXSH.mjs";
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
day_default
|
|
4
|
+
} from "./chunk-4DESGO3D.mjs";
|
|
5
|
+
import {
|
|
6
|
+
formatDateToString,
|
|
7
|
+
formatStringToDate
|
|
8
|
+
} from "./chunk-FWFEKWWD.mjs";
|
|
9
|
+
import {
|
|
10
|
+
input_default
|
|
11
|
+
} from "./chunk-SFGFRMWL.mjs";
|
|
12
|
+
import {
|
|
13
|
+
text_button_default
|
|
14
|
+
} from "./chunk-Q364C3FI.mjs";
|
|
15
|
+
import {
|
|
16
|
+
button_default
|
|
17
|
+
} from "./chunk-YQYO5RLZ.mjs";
|
|
18
|
+
import {
|
|
19
|
+
icon_button_default
|
|
20
|
+
} from "./chunk-JKYLYL3A.mjs";
|
|
21
|
+
import {
|
|
22
|
+
Icon_default
|
|
23
|
+
} from "./chunk-R7KUEH3N.mjs";
|
|
24
|
+
import {
|
|
25
|
+
mapPropsVariants
|
|
26
|
+
} from "./chunk-E3G5QXSH.mjs";
|
|
27
|
+
import {
|
|
28
|
+
tv
|
|
29
|
+
} from "./chunk-CDXBML6O.mjs";
|
|
30
|
+
|
|
31
|
+
// src/components/picker/datePicker.tsx
|
|
32
|
+
import {
|
|
33
|
+
forwardRef,
|
|
34
|
+
useCallback,
|
|
35
|
+
useMemo,
|
|
36
|
+
useState,
|
|
37
|
+
useRef,
|
|
38
|
+
useEffect,
|
|
39
|
+
Fragment
|
|
40
|
+
} from "react";
|
|
41
|
+
import { createPortal } from "react-dom";
|
|
42
|
+
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
43
|
+
var DatePicker = forwardRef((originalProps, ref) => {
|
|
44
|
+
const [props, variantProps] = mapPropsVariants(originalProps, datePickerStyle.variantKeys);
|
|
45
|
+
const {
|
|
46
|
+
classNames,
|
|
47
|
+
label,
|
|
48
|
+
errorMessage,
|
|
49
|
+
helperMessage,
|
|
50
|
+
value,
|
|
51
|
+
onChange,
|
|
52
|
+
size = "md",
|
|
53
|
+
variant = "solid",
|
|
54
|
+
color = "primary",
|
|
55
|
+
full = false,
|
|
56
|
+
disabled = false,
|
|
57
|
+
placeholder = "",
|
|
58
|
+
format = "YYYY-MM-DD",
|
|
59
|
+
locale = "default",
|
|
60
|
+
daysOfWeek = ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"],
|
|
61
|
+
monthYearFormat = (year, month) => locale === "default" ? `${year}. ${(month + 1).toString().padStart(2, "0")}` : new Date(year, month).toLocaleString(locale, { year: "numeric", month: "2-digit" }),
|
|
62
|
+
resetTitle,
|
|
63
|
+
todayTitle,
|
|
64
|
+
cancelTitle,
|
|
65
|
+
confirmTitle,
|
|
66
|
+
range = false,
|
|
67
|
+
dualCalendar = false,
|
|
68
|
+
...inputProps
|
|
69
|
+
} = { ...props, ...variantProps };
|
|
70
|
+
const [selectedDate, setSelectedDate] = useState(range ? "" : typeof value === "string" ? value || "" : "");
|
|
71
|
+
const [selectedRange, setSelectedRange] = useState({
|
|
72
|
+
startDate: range && typeof value === "object" ? (value == null ? void 0 : value.startDate) || "" : "",
|
|
73
|
+
endDate: range && typeof value === "object" ? (value == null ? void 0 : value.endDate) || "" : ""
|
|
74
|
+
});
|
|
75
|
+
const [tempSelectedDate, setTempSelectedDate] = useState(selectedDate);
|
|
76
|
+
const [tempSelectedRange, setTempSelectedRange] = useState(selectedRange);
|
|
77
|
+
const [rangeSelection, setRangeSelection] = useState("start");
|
|
78
|
+
const [isPanelOpen, setIsPanelOpen] = useState(false);
|
|
79
|
+
const [leftCurrentDate, setLeftCurrentDate] = useState(
|
|
80
|
+
range && tempSelectedRange.startDate ? new Date(tempSelectedRange.startDate) : tempSelectedDate ? new Date(tempSelectedDate) : /* @__PURE__ */ new Date()
|
|
81
|
+
);
|
|
82
|
+
const [rightCurrentDate, setRightCurrentDate] = useState(
|
|
83
|
+
dualCalendar ? new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1) : /* @__PURE__ */ new Date()
|
|
84
|
+
);
|
|
85
|
+
const inputWrapperRef = useRef(null);
|
|
86
|
+
const calendarWrapperRef = useRef(null);
|
|
87
|
+
const [panelPos, setPanelPos] = useState({ top: -9999, left: -9999 });
|
|
88
|
+
const blurTimeoutRef = useRef(null);
|
|
89
|
+
const formatDate = (dateString) => {
|
|
90
|
+
if (!dateString) return "";
|
|
91
|
+
const [year, month, day] = dateString.split("-");
|
|
92
|
+
switch (format) {
|
|
93
|
+
case "MM/DD/YYYY":
|
|
94
|
+
return `${month}/${day}/${year}`;
|
|
95
|
+
case "DD/MM/YYYY":
|
|
96
|
+
return `${day}/${month}/${year}`;
|
|
97
|
+
default:
|
|
98
|
+
return dateString;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const displayValue = useMemo(() => {
|
|
102
|
+
if (range) {
|
|
103
|
+
const start = formatDate(selectedRange.startDate);
|
|
104
|
+
const end = formatDate(selectedRange.endDate);
|
|
105
|
+
if (start && end) return `${start} ~ ${end}`;
|
|
106
|
+
if (start) return start;
|
|
107
|
+
return "";
|
|
108
|
+
}
|
|
109
|
+
return formatDate(selectedDate);
|
|
110
|
+
}, [selectedDate, selectedRange, format, range]);
|
|
111
|
+
const calculatePosition = useCallback(() => {
|
|
112
|
+
if (inputWrapperRef.current) {
|
|
113
|
+
const rect = inputWrapperRef.current.getBoundingClientRect();
|
|
114
|
+
setPanelPos({ top: rect.bottom + window.scrollY + 6, left: rect.left + window.scrollX });
|
|
115
|
+
}
|
|
116
|
+
}, []);
|
|
117
|
+
const handleFocusInput = () => {
|
|
118
|
+
if (disabled) return;
|
|
119
|
+
if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
|
|
120
|
+
calculatePosition();
|
|
121
|
+
setIsPanelOpen(true);
|
|
122
|
+
};
|
|
123
|
+
const handleClose = () => {
|
|
124
|
+
blurTimeoutRef.current = setTimeout(() => setIsPanelOpen(false), 100);
|
|
125
|
+
};
|
|
126
|
+
const handleInputKeyDown = (e) => {
|
|
127
|
+
if (disabled) return;
|
|
128
|
+
if (["Enter", " "].includes(e.key)) {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
calculatePosition();
|
|
131
|
+
setIsPanelOpen((prev) => !prev);
|
|
132
|
+
} else if (e.key === "Escape") setIsPanelOpen(false);
|
|
133
|
+
};
|
|
134
|
+
const handleCalendarIconClick = (e) => {
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
if (disabled) return;
|
|
137
|
+
if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
|
|
138
|
+
calculatePosition();
|
|
139
|
+
setIsPanelOpen((prev) => !prev);
|
|
140
|
+
};
|
|
141
|
+
const handleClearDate = (e) => {
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
if (range) {
|
|
144
|
+
setTempSelectedRange({ startDate: "", endDate: "" });
|
|
145
|
+
setRangeSelection("start");
|
|
146
|
+
} else {
|
|
147
|
+
setTempSelectedDate("");
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const handleCalendarMouseDown = (e) => {
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
|
|
153
|
+
};
|
|
154
|
+
const getCalendarDates = useCallback((currentDate) => {
|
|
155
|
+
const year = currentDate.getFullYear();
|
|
156
|
+
const month = currentDate.getMonth();
|
|
157
|
+
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
158
|
+
const lastDateOfMonth = new Date(year, month + 1, 0).getDate();
|
|
159
|
+
const lastDateOfPrevMonth = new Date(year, month, 0).getDate();
|
|
160
|
+
let dates = [];
|
|
161
|
+
for (let i = firstDayOfMonth - 1; i >= 0; i--) dates.push({ date: lastDateOfPrevMonth - i, currentMonth: false });
|
|
162
|
+
for (let date = 1; date <= lastDateOfMonth; date++) dates.push({ date, currentMonth: true });
|
|
163
|
+
const remainingDays = 42 - dates.length;
|
|
164
|
+
for (let i = 1; i <= remainingDays; i++) dates.push({ date: i, currentMonth: false });
|
|
165
|
+
const weeks = [];
|
|
166
|
+
for (let i = 0; i < dates.length; i += 7) weeks.push(dates.slice(i, i + 7));
|
|
167
|
+
return weeks;
|
|
168
|
+
}, []);
|
|
169
|
+
const handleLeftPrevMonth = () => {
|
|
170
|
+
const newLeftDate = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
|
|
171
|
+
setLeftCurrentDate(newLeftDate);
|
|
172
|
+
if (dualCalendar) {
|
|
173
|
+
setRightCurrentDate(new Date(newLeftDate.getFullYear(), newLeftDate.getMonth() + 1));
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const handleLeftNextMonth = () => {
|
|
177
|
+
const newLeftDate = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1);
|
|
178
|
+
setLeftCurrentDate(newLeftDate);
|
|
179
|
+
if (dualCalendar) {
|
|
180
|
+
setRightCurrentDate(new Date(newLeftDate.getFullYear(), newLeftDate.getMonth() + 1));
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const handleRightNextMonth = () => {
|
|
184
|
+
if (!dualCalendar) return;
|
|
185
|
+
const newRightDate = new Date(rightCurrentDate.getFullYear(), rightCurrentDate.getMonth() + 1);
|
|
186
|
+
setRightCurrentDate(newRightDate);
|
|
187
|
+
setLeftCurrentDate(new Date(newRightDate.getFullYear(), newRightDate.getMonth() - 1));
|
|
188
|
+
};
|
|
189
|
+
const handleDateSelect = (date, isCurrentMonth, currentDate) => {
|
|
190
|
+
if (!isCurrentMonth) return;
|
|
191
|
+
const selected = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
|
|
192
|
+
const formatted = formatDateToString(selected);
|
|
193
|
+
if (range) {
|
|
194
|
+
if (rangeSelection === "start") {
|
|
195
|
+
setTempSelectedRange({ startDate: formatted, endDate: "" });
|
|
196
|
+
setRangeSelection("end");
|
|
197
|
+
} else {
|
|
198
|
+
const startDate = new Date(tempSelectedRange.startDate);
|
|
199
|
+
if (selected >= startDate) {
|
|
200
|
+
setTempSelectedRange({ ...tempSelectedRange, endDate: formatted });
|
|
201
|
+
} else {
|
|
202
|
+
setTempSelectedRange({ startDate: formatted, endDate: tempSelectedRange.startDate });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
setTempSelectedDate(formatted);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const handleSetToday = () => {
|
|
210
|
+
const today = /* @__PURE__ */ new Date();
|
|
211
|
+
const formatted = formatDateToString(today);
|
|
212
|
+
if (range) {
|
|
213
|
+
if (rangeSelection === "start") {
|
|
214
|
+
setTempSelectedRange({ startDate: formatted, endDate: "" });
|
|
215
|
+
setRangeSelection("end");
|
|
216
|
+
} else {
|
|
217
|
+
const startDate = new Date(tempSelectedRange.startDate);
|
|
218
|
+
if (today >= startDate) {
|
|
219
|
+
setTempSelectedRange({ ...tempSelectedRange, endDate: formatted });
|
|
220
|
+
} else {
|
|
221
|
+
setTempSelectedRange({ startDate: formatted, endDate: tempSelectedRange.startDate });
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
setLeftCurrentDate(today);
|
|
226
|
+
if (dualCalendar) setRightCurrentDate(new Date(today.getFullYear(), today.getMonth() + 1));
|
|
227
|
+
setTempSelectedDate(formatted);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
const handleConfirmDate = () => {
|
|
231
|
+
if (range) {
|
|
232
|
+
setSelectedRange(tempSelectedRange);
|
|
233
|
+
onChange == null ? void 0 : onChange(tempSelectedRange);
|
|
234
|
+
} else {
|
|
235
|
+
setSelectedDate(tempSelectedDate);
|
|
236
|
+
onChange == null ? void 0 : onChange(tempSelectedDate);
|
|
237
|
+
}
|
|
238
|
+
setIsPanelOpen(false);
|
|
239
|
+
};
|
|
240
|
+
const handleResetDate = () => {
|
|
241
|
+
if (range) {
|
|
242
|
+
setTempSelectedRange(selectedRange);
|
|
243
|
+
setRangeSelection("start");
|
|
244
|
+
} else {
|
|
245
|
+
setTempSelectedDate(selectedDate);
|
|
246
|
+
}
|
|
247
|
+
setIsPanelOpen(false);
|
|
248
|
+
};
|
|
249
|
+
const getDayProps = useCallback(
|
|
250
|
+
(dateObj, currentDate) => {
|
|
251
|
+
const today = /* @__PURE__ */ new Date();
|
|
252
|
+
const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
|
|
253
|
+
if (range) {
|
|
254
|
+
const startFormatted = tempSelectedRange.startDate ? formatStringToDate(tempSelectedRange.startDate) : null;
|
|
255
|
+
const endFormatted = tempSelectedRange.endDate ? formatStringToDate(tempSelectedRange.endDate) : null;
|
|
256
|
+
const currentFormatted = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date);
|
|
257
|
+
const isStartSelected = startFormatted && startFormatted.getDate() === dateObj.date && startFormatted.getMonth() === currentDate.getMonth() && startFormatted.getFullYear() === currentDate.getFullYear();
|
|
258
|
+
const isEndSelected = endFormatted && endFormatted.getDate() === dateObj.date && endFormatted.getMonth() === currentDate.getMonth() && endFormatted.getFullYear() === currentDate.getFullYear();
|
|
259
|
+
const isInRange = startFormatted && endFormatted && currentFormatted > startFormatted && currentFormatted < endFormatted;
|
|
260
|
+
if (dateObj.currentMonth && (isStartSelected || isEndSelected)) return "selected";
|
|
261
|
+
if (dateObj.currentMonth && isInRange) return "period";
|
|
262
|
+
if (dateObj.currentMonth && isToday) return "today";
|
|
263
|
+
if (!dateObj.currentMonth) return "disabled";
|
|
264
|
+
return "default";
|
|
265
|
+
} else {
|
|
266
|
+
const formatted = tempSelectedDate ? formatStringToDate(tempSelectedDate) : null;
|
|
267
|
+
const isSelected = (formatted == null ? void 0 : formatted.getDate()) === dateObj.date && formatted.getMonth() === currentDate.getMonth() && formatted.getFullYear() === currentDate.getFullYear();
|
|
268
|
+
return dateObj.currentMonth && isSelected ? "selected" : dateObj.currentMonth && isToday ? "today" : !dateObj.currentMonth ? "disabled" : "default";
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
[tempSelectedDate, tempSelectedRange, range]
|
|
272
|
+
);
|
|
273
|
+
const getPlaceholderText = () => {
|
|
274
|
+
return placeholder;
|
|
275
|
+
};
|
|
276
|
+
useEffect(() => {
|
|
277
|
+
if (range && typeof value === "object") {
|
|
278
|
+
setSelectedRange(value || { startDate: "", endDate: "" });
|
|
279
|
+
setTempSelectedRange(value || { startDate: "", endDate: "" });
|
|
280
|
+
if (value == null ? void 0 : value.startDate) setLeftCurrentDate(new Date(value.startDate));
|
|
281
|
+
} else if (!range && typeof value === "string") {
|
|
282
|
+
setSelectedDate(value || "");
|
|
283
|
+
setTempSelectedDate(value || "");
|
|
284
|
+
if (value) setLeftCurrentDate(new Date(value));
|
|
285
|
+
}
|
|
286
|
+
}, [value, range]);
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
if (dualCalendar) {
|
|
289
|
+
setRightCurrentDate(new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1));
|
|
290
|
+
}
|
|
291
|
+
}, [leftCurrentDate, dualCalendar]);
|
|
292
|
+
const slots = useMemo(() => datePickerStyle({ ...variantProps, dualCalendar }), [variantProps, dualCalendar]);
|
|
293
|
+
const endContent = /* @__PURE__ */ jsx(Icon_default, { name: "calendar", size, className: "cursor-pointer", fill: true, onClick: handleCalendarIconClick });
|
|
294
|
+
const renderCalendar = (currentDate, isLeft) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[5px]", children: [
|
|
295
|
+
/* @__PURE__ */ jsx("div", { className: slots.calendarHead({ class: classNames == null ? void 0 : classNames.calendarHead }), children: dualCalendar ? isLeft ? /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
296
|
+
/* @__PURE__ */ jsx(icon_button_default, { name: "left", variant: "soft", color: "neutral", onClick: handleLeftPrevMonth }),
|
|
297
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
|
|
298
|
+
/* @__PURE__ */ jsx("div", { className: "w-8" })
|
|
299
|
+
] }) : /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
300
|
+
/* @__PURE__ */ jsx("div", { className: "w-8" }),
|
|
301
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
|
|
302
|
+
/* @__PURE__ */ jsx(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleRightNextMonth })
|
|
303
|
+
] }) : /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
304
|
+
/* @__PURE__ */ jsx(icon_button_default, { name: "left", variant: "soft", color: "neutral", onClick: handleLeftPrevMonth }),
|
|
305
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
|
|
306
|
+
/* @__PURE__ */ jsx(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleLeftNextMonth })
|
|
307
|
+
] }) }),
|
|
308
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7", children: daysOfWeek.map((day, index) => /* @__PURE__ */ jsx(day_default, { variant: "text", children: day }, `${day}-${index}`)) }),
|
|
309
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-y-[5px] text-center", children: getCalendarDates(currentDate).map((week, weekIndex) => /* @__PURE__ */ jsx(Fragment, { children: week.map((dateObj, index) => {
|
|
310
|
+
const dayVariant = getDayProps(dateObj, currentDate);
|
|
311
|
+
return /* @__PURE__ */ jsx(
|
|
312
|
+
day_default,
|
|
313
|
+
{
|
|
314
|
+
variant: dayVariant,
|
|
315
|
+
onClick: () => handleDateSelect(dateObj.date, dateObj.currentMonth, currentDate),
|
|
316
|
+
children: dateObj.date
|
|
317
|
+
},
|
|
318
|
+
index
|
|
319
|
+
);
|
|
320
|
+
}) }, weekIndex)) })
|
|
321
|
+
] });
|
|
322
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
323
|
+
/* @__PURE__ */ jsx("div", { ref: inputWrapperRef, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onClick: handleFocusInput, children: /* @__PURE__ */ jsx(
|
|
324
|
+
input_default,
|
|
325
|
+
{
|
|
326
|
+
...inputProps,
|
|
327
|
+
ref,
|
|
328
|
+
label,
|
|
329
|
+
value: displayValue,
|
|
330
|
+
placeholder: getPlaceholderText(),
|
|
331
|
+
errorMessage,
|
|
332
|
+
helperMessage,
|
|
333
|
+
size,
|
|
334
|
+
variant,
|
|
335
|
+
color,
|
|
336
|
+
full,
|
|
337
|
+
disabled,
|
|
338
|
+
endContent,
|
|
339
|
+
onFocus: handleFocusInput,
|
|
340
|
+
onBlur: handleClose,
|
|
341
|
+
onKeyDown: handleInputKeyDown,
|
|
342
|
+
onChange: () => {
|
|
343
|
+
},
|
|
344
|
+
classNames: {
|
|
345
|
+
base: classNames == null ? void 0 : classNames.inputBase,
|
|
346
|
+
inputWrapper: classNames == null ? void 0 : classNames.inputWrapper,
|
|
347
|
+
input: classNames == null ? void 0 : classNames.input,
|
|
348
|
+
label: classNames == null ? void 0 : classNames.label,
|
|
349
|
+
errorMessage: classNames == null ? void 0 : classNames.errorMessage,
|
|
350
|
+
helperMessage: classNames == null ? void 0 : classNames.helperMessage
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
) }),
|
|
354
|
+
isPanelOpen && createPortal(
|
|
355
|
+
/* @__PURE__ */ jsxs(
|
|
356
|
+
"div",
|
|
357
|
+
{
|
|
358
|
+
ref: calendarWrapperRef,
|
|
359
|
+
className: slots.calendarWrapper({ class: classNames == null ? void 0 : classNames.calendarWrapper }),
|
|
360
|
+
style: { position: "absolute", top: panelPos.top, left: panelPos.left, zIndex: 1e3 },
|
|
361
|
+
onMouseDown: handleCalendarMouseDown,
|
|
362
|
+
children: [
|
|
363
|
+
/* @__PURE__ */ jsxs("div", { className: dualCalendar ? "flex gap-[10px]" : "flex", children: [
|
|
364
|
+
renderCalendar(leftCurrentDate, true),
|
|
365
|
+
dualCalendar && range && /* @__PURE__ */ jsx("div", { className: "bg-neutral-soft w-px self-stretch" }),
|
|
366
|
+
dualCalendar && renderCalendar(rightCurrentDate, false)
|
|
367
|
+
] }),
|
|
368
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-[30px] justify-between px-[10px]", children: [
|
|
369
|
+
/* @__PURE__ */ jsx(
|
|
370
|
+
text_button_default,
|
|
371
|
+
{
|
|
372
|
+
variant: "underline",
|
|
373
|
+
color: "neutral",
|
|
374
|
+
size: "sm",
|
|
375
|
+
classNames: { base: "font-bold" },
|
|
376
|
+
onClick: handleClearDate,
|
|
377
|
+
children: resetTitle
|
|
378
|
+
}
|
|
379
|
+
),
|
|
380
|
+
/* @__PURE__ */ jsx(text_button_default, { variant: "underline", size: "sm", classNames: { base: "font-bold" }, onClick: handleSetToday, children: todayTitle })
|
|
381
|
+
] }),
|
|
382
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-[10px]", children: [
|
|
383
|
+
/* @__PURE__ */ jsx(
|
|
384
|
+
button_default,
|
|
385
|
+
{
|
|
386
|
+
variant: "soft",
|
|
387
|
+
color: "neutral",
|
|
388
|
+
size: "sm",
|
|
389
|
+
classNames: { base: "flex flex-1" },
|
|
390
|
+
onClick: handleResetDate,
|
|
391
|
+
children: cancelTitle
|
|
392
|
+
}
|
|
393
|
+
),
|
|
394
|
+
/* @__PURE__ */ jsx(button_default, { size: "sm", classNames: { base: "flex flex-1" }, onClick: handleConfirmDate, children: confirmTitle })
|
|
395
|
+
] })
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
document.body
|
|
400
|
+
)
|
|
401
|
+
] });
|
|
402
|
+
});
|
|
403
|
+
DatePicker.displayName = "DatePicker";
|
|
404
|
+
var datePicker_default = DatePicker;
|
|
405
|
+
var datePickerStyle = tv({
|
|
406
|
+
slots: {
|
|
407
|
+
base: ["group/datepicker", "flex", "flex-col", "cursor-pointer"],
|
|
408
|
+
calendarWrapper: [
|
|
409
|
+
"flex",
|
|
410
|
+
"flex-col",
|
|
411
|
+
"rounded-xl",
|
|
412
|
+
"bg-body-background",
|
|
413
|
+
"shadow-drop-xl",
|
|
414
|
+
"overflow-auto",
|
|
415
|
+
"select-none",
|
|
416
|
+
"p-[10px]"
|
|
417
|
+
],
|
|
418
|
+
calendarHead: ["calendar-header", "flex", "items-center", "justify-between", "h-[40px]", "w-[280px]"],
|
|
419
|
+
inputBase: [],
|
|
420
|
+
inputWrapper: [],
|
|
421
|
+
input: [],
|
|
422
|
+
label: [],
|
|
423
|
+
errorMessage: [],
|
|
424
|
+
helperMessage: []
|
|
425
|
+
},
|
|
426
|
+
variants: {
|
|
427
|
+
color: { primary: {}, secondary: {} },
|
|
428
|
+
size: { sm: {}, md: {}, lg: {}, xl: {} },
|
|
429
|
+
full: { true: { base: ["w-full"] } },
|
|
430
|
+
disabled: { true: { base: ["pointer-events-none"] } },
|
|
431
|
+
dualCalendar: {
|
|
432
|
+
true: { calendarWrapper: ["w-fit", "gap-[10px]"] },
|
|
433
|
+
false: { calendarWrapper: ["w-[300px]", "gap-[5px]"] }
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
defaultVariants: {
|
|
437
|
+
color: "primary",
|
|
438
|
+
size: "md",
|
|
439
|
+
full: false,
|
|
440
|
+
disabled: false,
|
|
441
|
+
range: false,
|
|
442
|
+
dualCalendar: false
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
export {
|
|
447
|
+
datePicker_default,
|
|
448
|
+
datePickerStyle
|
|
449
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Icon_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-R7KUEH3N.mjs";
|
|
5
5
|
import {
|
|
6
6
|
mapPropsVariants
|
|
7
7
|
} from "./chunk-E3G5QXSH.mjs";
|
|
8
8
|
import {
|
|
9
9
|
avatar_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ITFEV25U.mjs";
|
|
11
11
|
import {
|
|
12
12
|
tv
|
|
13
13
|
} from "./chunk-CDXBML6O.mjs";
|
|
@@ -90,8 +90,8 @@ var template = {
|
|
|
90
90
|
{
|
|
91
91
|
fillRule: "evenodd",
|
|
92
92
|
clipRule: "evenodd",
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
d: "M8.26603 3.51086C8.53733 2.82971 9.46267 2.82971 9.73397 3.51086L10.9948 6.67687L14.2674 6.95135C14.9723 7.01017 15.2582 7.92848 14.721 8.40913L12.2278 10.6398L12.989 13.9746C13.1531 14.6931 12.4052 15.2604 11.8021 14.8759L9 13.0886L6.19794 14.8759C5.59478 15.2604 4.84687 14.6925 5.01099 13.9746L5.77221 10.6398L3.27901 8.40913C2.74185 7.92848 3.02769 7.01017 3.73259 6.95135L7.00519 6.67687L8.26603 3.51086Z",
|
|
94
|
+
fill: "currentColor"
|
|
95
95
|
}
|
|
96
96
|
) : /* @__PURE__ */ jsx(
|
|
97
97
|
"path",
|
|
@@ -105,6 +105,41 @@ var template = {
|
|
|
105
105
|
}
|
|
106
106
|
);
|
|
107
107
|
},
|
|
108
|
+
halfStar: ({ className }) => {
|
|
109
|
+
return /* @__PURE__ */ jsxs(
|
|
110
|
+
"svg",
|
|
111
|
+
{
|
|
112
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
113
|
+
width: "18",
|
|
114
|
+
height: "18",
|
|
115
|
+
viewBox: "0 0 18 18",
|
|
116
|
+
fill: "none",
|
|
117
|
+
className,
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "half-clip", children: /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "9", height: "18" }) }) }),
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
"path",
|
|
122
|
+
{
|
|
123
|
+
fillRule: "evenodd",
|
|
124
|
+
clipRule: "evenodd",
|
|
125
|
+
fill: "currentColor",
|
|
126
|
+
d: "M8.26603 3.51086C8.53733 2.82971 9.46267 2.82971 9.73397 3.51086L10.9948 6.67687L14.2674 6.95135C14.9723 7.01017 15.2582 7.92848 14.721 8.40913L12.2278 10.6398L12.989 13.9746C13.1531 14.6931 12.4052 15.2604 11.8021 14.8759L9 13.0886L6.19794 14.8759C5.59478 15.2604 4.84687 14.6925 5.01099 13.9746L5.77221 10.6398L3.27901 8.40913C2.74185 7.92848 3.02769 7.01017 3.73259 6.95135L7.00519 6.67687L8.26603 3.51086Z",
|
|
127
|
+
clipPath: "url(#half-clip)"
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ jsx(
|
|
131
|
+
"path",
|
|
132
|
+
{
|
|
133
|
+
d: "M8.65925 3.23957C8.68697 3.16871 8.73417 3.1081 8.79484 3.06544C8.85552 3.02278 8.92693 3 9 3C9.07306 3 9.14448 3.02278 9.20515 3.06544C9.26583 3.1081 9.31303 3.16871 9.34074 3.23957L10.7332 6.74977C10.7593 6.81546 10.8021 6.87233 10.857 6.91413C10.912 6.95594 10.9768 6.98105 11.0445 6.98672L14.6603 7.29028C14.9873 7.31775 15.1196 7.74563 14.8706 7.96883L12.1158 10.4427C12.0644 10.4888 12.026 10.5489 12.005 10.6164C11.984 10.6839 11.981 10.7561 11.9966 10.8252L12.8386 14.5236C12.8555 14.5978 12.8511 14.6756 12.8259 14.7471C12.8006 14.8187 12.7557 14.8808 12.6968 14.9257C12.6379 14.9705 12.5677 14.996 12.495 14.999C12.4222 15.002 12.3503 14.9824 12.2882 14.9425L9.19199 12.9611C9.13418 12.9241 9.06775 12.9045 9 12.9045C8.93225 12.9045 8.86581 12.9241 8.808 12.9611L5.71181 14.9432C5.64973 14.9831 5.57778 15.0027 5.50504 14.9997C5.43231 14.9967 5.36206 14.9712 5.30316 14.9263C5.24426 14.8815 5.19936 14.8194 5.17412 14.7478C5.14889 14.6763 5.14445 14.5985 5.16138 14.5243L6.00341 10.8252C6.01903 10.7561 6.01616 10.6838 5.99511 10.6164C5.97407 10.5489 5.93568 10.4888 5.88415 10.4427L3.12936 7.96883C3.07389 7.91927 3.03369 7.85357 3.01387 7.78005C2.99405 7.70652 2.9955 7.62849 3.01802 7.55583C3.04055 7.48317 3.08314 7.41915 3.1404 7.37188C3.19767 7.3246 3.26703 7.29621 3.33971 7.29028L6.95553 6.98672C7.02319 6.98105 7.08804 6.95594 7.14296 6.91413C7.19787 6.87233 7.24072 6.81546 7.26679 6.74977L8.65925 3.23957Z",
|
|
134
|
+
stroke: "currentColor",
|
|
135
|
+
strokeLinecap: "round",
|
|
136
|
+
strokeLinejoin: "round"
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
},
|
|
108
143
|
avatar: ({ className }) => {
|
|
109
144
|
return /* @__PURE__ */ jsxs(
|
|
110
145
|
"svg",
|
|
@@ -1530,6 +1565,26 @@ var template = {
|
|
|
1530
1565
|
}
|
|
1531
1566
|
);
|
|
1532
1567
|
},
|
|
1568
|
+
question: ({ className = "text-white" }) => {
|
|
1569
|
+
return /* @__PURE__ */ jsx(
|
|
1570
|
+
"svg",
|
|
1571
|
+
{
|
|
1572
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1573
|
+
width: "24",
|
|
1574
|
+
height: "24",
|
|
1575
|
+
viewBox: "0 0 24 24",
|
|
1576
|
+
fill: "none",
|
|
1577
|
+
className,
|
|
1578
|
+
children: /* @__PURE__ */ jsx(
|
|
1579
|
+
"path",
|
|
1580
|
+
{
|
|
1581
|
+
d: "M17 2.42969H7C4 2.42969 2 4.42969 2 7.42969V13.4297C2 16.4297 4 18.4297 7 18.4297V20.5597C7 21.3597 7.89 21.8397 8.55 21.3897L13 18.4297H17C20 18.4297 22 16.4297 22 13.4297V7.42969C22 4.42969 20 2.42969 17 2.42969ZM12 14.5997C11.58 14.5997 11.25 14.2597 11.25 13.8497C11.25 13.4397 11.58 13.0997 12 13.0997C12.42 13.0997 12.75 13.4397 12.75 13.8497C12.75 14.2597 12.42 14.5997 12 14.5997ZM13.26 10.4497C12.87 10.7097 12.75 10.8797 12.75 11.1597V11.3697C12.75 11.7797 12.41 12.1197 12 12.1197C11.59 12.1197 11.25 11.7797 11.25 11.3697V11.1597C11.25 9.99969 12.1 9.42969 12.42 9.20969C12.79 8.95969 12.91 8.78969 12.91 8.52969C12.91 8.02969 12.5 7.61969 12 7.61969C11.5 7.61969 11.09 8.02969 11.09 8.52969C11.09 8.93969 10.75 9.27969 10.34 9.27969C9.93 9.27969 9.59 8.93969 9.59 8.52969C9.59 7.19969 10.67 6.11969 12 6.11969C13.33 6.11969 14.41 7.19969 14.41 8.52969C14.41 9.66969 13.57 10.2397 13.26 10.4497Z",
|
|
1582
|
+
fill: "currentColor"
|
|
1583
|
+
}
|
|
1584
|
+
)
|
|
1585
|
+
}
|
|
1586
|
+
);
|
|
1587
|
+
},
|
|
1533
1588
|
// ----------------------------------- old ---------------------------------
|
|
1534
1589
|
// ** Status **
|
|
1535
1590
|
"plus-circle": ({ className, fill }) => {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-F3HENRVM.mjs";
|
|
5
5
|
import {
|
|
6
6
|
input_default
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SFGFRMWL.mjs";
|
|
8
8
|
import {
|
|
9
9
|
Icon_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-R7KUEH3N.mjs";
|
|
11
11
|
import {
|
|
12
12
|
mapPropsVariants
|
|
13
13
|
} from "./chunk-E3G5QXSH.mjs";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-ZOTHPHXA.mjs";
|
|
5
5
|
import {
|
|
6
6
|
toast_default
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3QE57PU3.mjs";
|
|
8
8
|
|
|
9
9
|
// src/components/toast/use-toast.tsx
|
|
10
10
|
import { createContext, useContext, useState, useCallback, useEffect, useRef } from "react";
|