@deepnoid/ui 0.1.115 → 0.1.117
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 +180 -175
- package/dist/{chunk-UNYKQTEP.mjs → chunk-3ZH6PWFC.mjs} +2 -2
- package/dist/chunk-4DESGO3D.mjs +54 -0
- package/dist/{chunk-BKYNB52Z.mjs → chunk-676Y7NKV.mjs} +1 -1
- package/dist/{chunk-AHBBUMPX.mjs → chunk-6VNOOJDQ.mjs} +2 -2
- package/dist/{chunk-NEBMBSKV.mjs → chunk-CUCLHYCE.mjs} +3 -3
- package/dist/{chunk-L3WKBOWY.mjs → chunk-ER3SUAE2.mjs} +1 -1
- package/dist/{chunk-AX3FVJMY.mjs → chunk-F7PC2JAF.mjs} +1 -1
- package/dist/{chunk-CEMBGO4V.mjs → chunk-HD2PTCE6.mjs} +2 -2
- package/dist/{chunk-FU4CDBVG.mjs → chunk-HLYTCS7L.mjs} +1 -1
- package/dist/{chunk-DDJ2EU3P.mjs → chunk-LCWEO4U6.mjs} +40 -14
- package/dist/chunk-LIHZG4KM.mjs +315 -0
- package/dist/{chunk-WKMBRUGX.mjs → chunk-LZRBMVT7.mjs} +1 -1
- package/dist/{chunk-MTQGHQ7Z.mjs → chunk-MG5E5YZ7.mjs} +1 -1
- package/dist/{chunk-BFZ6OTVA.mjs → chunk-PHWTRXOL.mjs} +2 -2
- package/dist/{chunk-5AEN7QTL.mjs → chunk-PMSUPDDW.mjs} +1 -1
- package/dist/{chunk-QREBEXKF.mjs → chunk-RSD67ORA.mjs} +1 -1
- package/dist/{chunk-TMHYS2DC.mjs → chunk-TO6OPRBH.mjs} +1 -1
- package/dist/{chunk-EDAREIAN.mjs → chunk-TRNL3IXF.mjs} +1 -1
- package/dist/{chunk-MLD6EZAE.mjs → chunk-UPPNTDNG.mjs} +1 -1
- package/dist/{chunk-7YCUFFKZ.mjs → chunk-VPGJ4HZ7.mjs} +1 -1
- package/dist/components/avatar/avatar.js +40 -14
- package/dist/components/avatar/avatar.mjs +2 -2
- package/dist/components/avatar/index.js +40 -14
- package/dist/components/avatar/index.mjs +2 -2
- package/dist/components/breadcrumb/breadcrumb.js +40 -14
- package/dist/components/breadcrumb/breadcrumb.mjs +5 -5
- package/dist/components/breadcrumb/index.js +40 -14
- package/dist/components/breadcrumb/index.mjs +5 -5
- package/dist/components/button/button.js +40 -14
- package/dist/components/button/button.mjs +3 -3
- package/dist/components/button/icon-button.js +40 -14
- package/dist/components/button/icon-button.mjs +3 -3
- package/dist/components/button/index.js +40 -14
- package/dist/components/button/index.mjs +4 -4
- package/dist/components/chip/chip.js +40 -14
- package/dist/components/chip/chip.mjs +3 -3
- package/dist/components/chip/index.js +40 -14
- package/dist/components/chip/index.mjs +3 -3
- package/dist/components/fileUpload/fileUpload.js +40 -14
- package/dist/components/fileUpload/fileUpload.mjs +6 -6
- package/dist/components/fileUpload/index.js +40 -14
- package/dist/components/fileUpload/index.mjs +6 -6
- package/dist/components/icon/Icon.d.mts +8 -4
- package/dist/components/icon/Icon.d.ts +8 -4
- package/dist/components/icon/Icon.js +40 -14
- package/dist/components/icon/Icon.mjs +2 -2
- package/dist/components/icon/index.js +40 -14
- package/dist/components/icon/index.mjs +2 -2
- package/dist/components/icon/template.d.mts +2 -1
- package/dist/components/icon/template.d.ts +2 -1
- package/dist/components/icon/template.js +40 -14
- package/dist/components/icon/template.mjs +1 -1
- package/dist/components/input/index.js +40 -14
- package/dist/components/input/index.mjs +3 -3
- package/dist/components/input/input.js +40 -14
- package/dist/components/input/input.mjs +3 -3
- package/dist/components/list/index.js +40 -14
- package/dist/components/list/index.mjs +4 -4
- package/dist/components/list/listItem.js +40 -14
- package/dist/components/list/listItem.mjs +4 -4
- package/dist/components/modal/index.js +40 -14
- package/dist/components/modal/index.mjs +5 -5
- package/dist/components/modal/modal.js +40 -14
- package/dist/components/modal/modal.mjs +5 -5
- package/dist/components/pagination/index.js +40 -14
- package/dist/components/pagination/index.mjs +4 -4
- package/dist/components/pagination/pagination.js +40 -14
- package/dist/components/pagination/pagination.mjs +4 -4
- package/dist/components/picker/datePicker.d.mts +53 -172
- package/dist/components/picker/datePicker.d.ts +53 -172
- package/dist/components/picker/datePicker.js +1752 -399
- package/dist/components/picker/datePicker.mjs +14 -3
- package/dist/components/picker/day.d.mts +94 -0
- package/dist/components/picker/day.d.ts +94 -0
- package/dist/components/picker/day.js +414 -0
- package/dist/components/picker/day.mjs +12 -0
- package/dist/components/picker/index.d.mts +1 -0
- package/dist/components/picker/index.d.ts +1 -0
- package/dist/components/picker/index.js +2341 -984
- package/dist/components/picker/index.mjs +20 -6
- package/dist/components/picker/timePicker.js +40 -14
- package/dist/components/picker/timePicker.mjs +4 -4
- package/dist/components/select/index.js +40 -14
- package/dist/components/select/index.mjs +3 -3
- package/dist/components/select/select.js +40 -14
- package/dist/components/select/select.mjs +3 -3
- package/dist/components/table/index.js +40 -14
- package/dist/components/table/index.mjs +5 -5
- package/dist/components/table/table-body.js +40 -14
- package/dist/components/table/table-body.mjs +5 -5
- package/dist/components/table/table-head.js +40 -14
- package/dist/components/table/table-head.mjs +5 -5
- package/dist/components/table/table.js +40 -14
- package/dist/components/table/table.mjs +5 -5
- package/dist/components/toast/index.js +40 -14
- package/dist/components/toast/index.mjs +4 -4
- package/dist/components/toast/toast.js +40 -14
- package/dist/components/toast/toast.mjs +3 -3
- package/dist/components/toast/use-toast.js +40 -14
- package/dist/components/toast/use-toast.mjs +4 -4
- package/dist/components/tree/index.js +40 -14
- package/dist/components/tree/index.mjs +3 -3
- package/dist/components/tree/tree.js +40 -14
- package/dist/components/tree/tree.mjs +3 -3
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +413 -456
- package/dist/index.mjs +28 -24
- package/package.json +1 -1
- package/dist/chunk-2VQM2ZBF.mjs +0 -408
- /package/dist/{chunk-ZG4WRZOU.mjs → chunk-4VWG4726.mjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import "./chunk-MBLZYQCN.mjs";
|
|
3
3
|
import {
|
|
4
4
|
tree_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PMSUPDDW.mjs";
|
|
6
6
|
import "./chunk-LUWGOKLG.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ToastProvider,
|
|
9
9
|
useToast
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MG5E5YZ7.mjs";
|
|
11
11
|
import "./chunk-ZOTHPHXA.mjs";
|
|
12
12
|
import {
|
|
13
13
|
toast_default
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TRNL3IXF.mjs";
|
|
15
15
|
import "./chunk-HIE2YRGA.mjs";
|
|
16
16
|
import {
|
|
17
17
|
tooltip_default
|
|
@@ -21,7 +21,7 @@ import "./chunk-WSIADHVC.mjs";
|
|
|
21
21
|
import "./chunk-DX3KXNP6.mjs";
|
|
22
22
|
import {
|
|
23
23
|
table_default
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-TO6OPRBH.mjs";
|
|
25
25
|
import "./chunk-3MY6LO7N.mjs";
|
|
26
26
|
import {
|
|
27
27
|
tabs_default
|
|
@@ -52,19 +52,22 @@ import {
|
|
|
52
52
|
import "./chunk-7B7LRG5J.mjs";
|
|
53
53
|
import {
|
|
54
54
|
pagination_default
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-3ZH6PWFC.mjs";
|
|
56
56
|
import "./chunk-F3HENRVM.mjs";
|
|
57
|
-
import "./chunk-
|
|
57
|
+
import "./chunk-4VWG4726.mjs";
|
|
58
58
|
import {
|
|
59
59
|
datePicker_default
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-LIHZG4KM.mjs";
|
|
61
|
+
import {
|
|
62
|
+
day_default
|
|
63
|
+
} from "./chunk-4DESGO3D.mjs";
|
|
61
64
|
import {
|
|
62
65
|
timePicker_default
|
|
63
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-6VNOOJDQ.mjs";
|
|
64
67
|
import "./chunk-QCEKPS7U.mjs";
|
|
65
68
|
import {
|
|
66
69
|
select_default
|
|
67
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-RSD67ORA.mjs";
|
|
68
71
|
import "./chunk-FWFEKWWD.mjs";
|
|
69
72
|
import "./chunk-7MVEAQ7Z.mjs";
|
|
70
73
|
import {
|
|
@@ -72,15 +75,15 @@ import {
|
|
|
72
75
|
} from "./chunk-3IILPVRA.mjs";
|
|
73
76
|
import {
|
|
74
77
|
listItem_default
|
|
75
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-PHWTRXOL.mjs";
|
|
76
79
|
import "./chunk-DJOG6Z35.mjs";
|
|
77
80
|
import {
|
|
78
81
|
modal_default
|
|
79
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-HD2PTCE6.mjs";
|
|
80
83
|
import "./chunk-MGEWSREV.mjs";
|
|
81
84
|
import {
|
|
82
85
|
chip_default
|
|
83
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-676Y7NKV.mjs";
|
|
84
87
|
import "./chunk-32GA3YW4.mjs";
|
|
85
88
|
import {
|
|
86
89
|
drawer_default
|
|
@@ -88,7 +91,7 @@ import {
|
|
|
88
91
|
import "./chunk-RLXOHILK.mjs";
|
|
89
92
|
import {
|
|
90
93
|
fileUpload_default
|
|
91
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-CUCLHYCE.mjs";
|
|
92
95
|
import "./chunk-7VOQKIIK.mjs";
|
|
93
96
|
import {
|
|
94
97
|
progress_default
|
|
@@ -96,7 +99,11 @@ import {
|
|
|
96
99
|
import "./chunk-2GCSFWHD.mjs";
|
|
97
100
|
import {
|
|
98
101
|
input_default
|
|
99
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-ER3SUAE2.mjs";
|
|
103
|
+
import "./chunk-QZ3LVYJW.mjs";
|
|
104
|
+
import {
|
|
105
|
+
checkbox_default
|
|
106
|
+
} from "./chunk-H6JGLPPF.mjs";
|
|
100
107
|
import "./chunk-VYNBJBXD.mjs";
|
|
101
108
|
import {
|
|
102
109
|
areaChart_default
|
|
@@ -110,10 +117,6 @@ import {
|
|
|
110
117
|
import {
|
|
111
118
|
radarChart_default
|
|
112
119
|
} from "./chunk-63KZGR73.mjs";
|
|
113
|
-
import "./chunk-QZ3LVYJW.mjs";
|
|
114
|
-
import {
|
|
115
|
-
checkbox_default
|
|
116
|
-
} from "./chunk-H6JGLPPF.mjs";
|
|
117
120
|
import "./chunk-SE5TU755.mjs";
|
|
118
121
|
import {
|
|
119
122
|
backdrop_default
|
|
@@ -121,7 +124,7 @@ import {
|
|
|
121
124
|
import "./chunk-KYIODWXL.mjs";
|
|
122
125
|
import {
|
|
123
126
|
breadcrumb_default
|
|
124
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-VPGJ4HZ7.mjs";
|
|
125
128
|
import "./chunk-MY5U63QO.mjs";
|
|
126
129
|
import {
|
|
127
130
|
text_button_default
|
|
@@ -131,10 +134,10 @@ import {
|
|
|
131
134
|
} from "./chunk-ITWKPTSD.mjs";
|
|
132
135
|
import {
|
|
133
136
|
button_default
|
|
134
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-F7PC2JAF.mjs";
|
|
135
138
|
import {
|
|
136
139
|
icon_button_default
|
|
137
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-LZRBMVT7.mjs";
|
|
138
141
|
import "./chunk-6WSACUIB.mjs";
|
|
139
142
|
import "./chunk-LXHUO6VM.mjs";
|
|
140
143
|
import "./chunk-SZL743JC.mjs";
|
|
@@ -142,7 +145,7 @@ import "./chunk-ZYIIXWVY.mjs";
|
|
|
142
145
|
import {
|
|
143
146
|
Icon_default,
|
|
144
147
|
iconTemplate
|
|
145
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-HLYTCS7L.mjs";
|
|
146
149
|
import "./chunk-NMSDSEBD.mjs";
|
|
147
150
|
import {
|
|
148
151
|
accordion_default
|
|
@@ -154,8 +157,8 @@ import "./chunk-E3G5QXSH.mjs";
|
|
|
154
157
|
import "./chunk-7DLOYKVC.mjs";
|
|
155
158
|
import {
|
|
156
159
|
avatar_default
|
|
157
|
-
} from "./chunk-
|
|
158
|
-
import "./chunk-
|
|
160
|
+
} from "./chunk-UPPNTDNG.mjs";
|
|
161
|
+
import "./chunk-LCWEO4U6.mjs";
|
|
159
162
|
import {
|
|
160
163
|
deepnoidUi,
|
|
161
164
|
tv
|
|
@@ -177,6 +180,7 @@ export {
|
|
|
177
180
|
chip_default as Chip,
|
|
178
181
|
circularProgress_default as CircularProgress,
|
|
179
182
|
datePicker_default as DatePicker,
|
|
183
|
+
day_default as Day,
|
|
180
184
|
definition_table_default as DefinitionTable,
|
|
181
185
|
drawer_default as Drawer,
|
|
182
186
|
fileUpload_default as FileUpload,
|
package/package.json
CHANGED
package/dist/chunk-2VQM2ZBF.mjs
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
formatDateToString,
|
|
4
|
-
formatStringToDate
|
|
5
|
-
} from "./chunk-FWFEKWWD.mjs";
|
|
6
|
-
import {
|
|
7
|
-
Icon_default
|
|
8
|
-
} from "./chunk-FU4CDBVG.mjs";
|
|
9
|
-
import {
|
|
10
|
-
mapPropsVariants
|
|
11
|
-
} from "./chunk-E3G5QXSH.mjs";
|
|
12
|
-
import {
|
|
13
|
-
tv
|
|
14
|
-
} from "./chunk-CDXBML6O.mjs";
|
|
15
|
-
import {
|
|
16
|
-
clsx
|
|
17
|
-
} from "./chunk-27Y6K5NK.mjs";
|
|
18
|
-
|
|
19
|
-
// src/components/picker/datePicker.tsx
|
|
20
|
-
import React, { forwardRef, useCallback, useMemo, useState, useRef, useEffect } from "react";
|
|
21
|
-
import { createPortal } from "react-dom";
|
|
22
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
var DatePicker = forwardRef((originalProps, ref) => {
|
|
24
|
-
const [props, variantProps] = mapPropsVariants(originalProps, datePickerStyle.variantKeys);
|
|
25
|
-
const {
|
|
26
|
-
classNames,
|
|
27
|
-
label,
|
|
28
|
-
errorMessage,
|
|
29
|
-
value,
|
|
30
|
-
onChange,
|
|
31
|
-
size,
|
|
32
|
-
placeholder = "",
|
|
33
|
-
format = "YYYY-MM-DD",
|
|
34
|
-
highlightWeekend = true,
|
|
35
|
-
calendarColor = "primary",
|
|
36
|
-
locale = "default",
|
|
37
|
-
daysOfWeek = ["S", "M", "T", "W", "T", "F", "S"],
|
|
38
|
-
monthYearFormat = (year, month) => new Date(year, month).toLocaleString(locale, { year: "numeric", month: "2-digit" }),
|
|
39
|
-
...inputProps
|
|
40
|
-
} = props;
|
|
41
|
-
const [selectedDate, setSelectedDate] = useState(value || "");
|
|
42
|
-
const [isPanelOpen, setIsPanelOpen] = useState(false);
|
|
43
|
-
const [currentDate, setCurrentDate] = useState(selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date());
|
|
44
|
-
const inputWrapperRef = useRef(null);
|
|
45
|
-
const panelWrapperRef = useRef(null);
|
|
46
|
-
const [panelPos, setPanelPos] = useState({ top: -9999, left: -9999 });
|
|
47
|
-
const formatDate = (dateString) => {
|
|
48
|
-
if (!dateString) return "";
|
|
49
|
-
const [year, month, day] = dateString.split("-");
|
|
50
|
-
switch (format) {
|
|
51
|
-
case "MM/DD/YYYY":
|
|
52
|
-
return `${month}/${day}/${year}`;
|
|
53
|
-
case "DD/MM/YYYY":
|
|
54
|
-
return `${day}/${month}/${year}`;
|
|
55
|
-
default:
|
|
56
|
-
return dateString;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const displayValue = useMemo(() => {
|
|
60
|
-
return formatDate(selectedDate);
|
|
61
|
-
}, [selectedDate, format]);
|
|
62
|
-
const calculatePosition = useCallback(() => {
|
|
63
|
-
if (inputWrapperRef.current) {
|
|
64
|
-
const rect = inputWrapperRef.current.getBoundingClientRect();
|
|
65
|
-
setPanelPos({ top: rect.bottom + window.scrollY + 6, left: rect.left + window.scrollX });
|
|
66
|
-
}
|
|
67
|
-
}, []);
|
|
68
|
-
const handleFocusInput = () => {
|
|
69
|
-
calculatePosition();
|
|
70
|
-
setIsPanelOpen(true);
|
|
71
|
-
};
|
|
72
|
-
const handleInputBlur = () => {
|
|
73
|
-
setTimeout(() => setIsPanelOpen(false), 150);
|
|
74
|
-
};
|
|
75
|
-
const handleInputKeyDown = (e) => {
|
|
76
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
77
|
-
e.preventDefault();
|
|
78
|
-
calculatePosition();
|
|
79
|
-
setIsPanelOpen((prev) => !prev);
|
|
80
|
-
} else if (e.key === "Escape") {
|
|
81
|
-
setIsPanelOpen(false);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const getCalendarDates = useCallback(() => {
|
|
85
|
-
const year = currentDate.getFullYear();
|
|
86
|
-
const month = currentDate.getMonth();
|
|
87
|
-
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
88
|
-
const lastDateOfMonth = new Date(year, month + 1, 0).getDate();
|
|
89
|
-
const lastDateOfPrevMonth = new Date(year, month, 0).getDate();
|
|
90
|
-
let dates = [];
|
|
91
|
-
for (let i = firstDayOfMonth - 1; i >= 0; i--) {
|
|
92
|
-
dates.push({
|
|
93
|
-
date: lastDateOfPrevMonth - i,
|
|
94
|
-
currentMonth: false
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
for (let date = 1; date <= lastDateOfMonth; date++) {
|
|
98
|
-
dates.push({
|
|
99
|
-
date,
|
|
100
|
-
currentMonth: true
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
const remainingDays = 42 - dates.length;
|
|
104
|
-
for (let i = 1; i <= remainingDays; i++) {
|
|
105
|
-
dates.push({
|
|
106
|
-
date: i,
|
|
107
|
-
currentMonth: false
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
const weeks = [];
|
|
111
|
-
for (let i = 0; i < dates.length; i += 7) {
|
|
112
|
-
weeks.push(dates.slice(i, i + 7));
|
|
113
|
-
}
|
|
114
|
-
return weeks;
|
|
115
|
-
}, [currentDate]);
|
|
116
|
-
const handlePrevMonth = () => {
|
|
117
|
-
setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1));
|
|
118
|
-
};
|
|
119
|
-
const handleNextMonth = () => {
|
|
120
|
-
setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1));
|
|
121
|
-
};
|
|
122
|
-
const handleDateSelect = (date, isCurrentMonth) => {
|
|
123
|
-
if (!isCurrentMonth) return;
|
|
124
|
-
const selected = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
|
|
125
|
-
const formatted = formatDateToString(selected);
|
|
126
|
-
setSelectedDate(formatted);
|
|
127
|
-
onChange == null ? void 0 : onChange(formatted);
|
|
128
|
-
setIsPanelOpen(false);
|
|
129
|
-
};
|
|
130
|
-
const handleClearDate = () => {
|
|
131
|
-
setSelectedDate("");
|
|
132
|
-
onChange == null ? void 0 : onChange("");
|
|
133
|
-
};
|
|
134
|
-
const slots = useMemo(() => datePickerStyle({ ...variantProps }), [variantProps]);
|
|
135
|
-
const getDateTitleProps = useCallback(
|
|
136
|
-
(index) => {
|
|
137
|
-
return {
|
|
138
|
-
className: clsx(
|
|
139
|
-
"text-sm font-[500]",
|
|
140
|
-
highlightWeekend && index === 6 && "text-[#1E7EEE]",
|
|
141
|
-
highlightWeekend && index === 0 && "text-[#FF4684]"
|
|
142
|
-
)
|
|
143
|
-
};
|
|
144
|
-
},
|
|
145
|
-
[highlightWeekend]
|
|
146
|
-
);
|
|
147
|
-
const getDateProps = useCallback(
|
|
148
|
-
(dateObj) => {
|
|
149
|
-
const today = /* @__PURE__ */ new Date();
|
|
150
|
-
const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
|
|
151
|
-
const formatted = selectedDate ? formatStringToDate(selectedDate) : null;
|
|
152
|
-
const isSelected = formatted ? formatted.getDate() === dateObj.date && formatted.getMonth() === currentDate.getMonth() && formatted.getFullYear() === currentDate.getFullYear() : false;
|
|
153
|
-
const dayOfWeek = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date).getDay();
|
|
154
|
-
return {
|
|
155
|
-
className: clsx(
|
|
156
|
-
"flex justify-center items-center h-[25px] text-sm rounded-full cursor-pointer hover:bg-neutral-light",
|
|
157
|
-
dateObj.currentMonth && isToday && "border border-foreground",
|
|
158
|
-
dateObj.currentMonth && isSelected && "!text-white border-none",
|
|
159
|
-
calendarColor === "primary" && dateObj.currentMonth && isSelected && "!border-primary-main bg-primary-main",
|
|
160
|
-
calendarColor === "secondary" && dateObj.currentMonth && isSelected && "!border-secondary-main bg-secondary-main",
|
|
161
|
-
highlightWeekend && dayOfWeek === 6 && "text-neutral-main",
|
|
162
|
-
highlightWeekend && dayOfWeek === 6 && isToday && "!border-neutral-light",
|
|
163
|
-
highlightWeekend && dayOfWeek === 0 && "text-danger-main",
|
|
164
|
-
highlightWeekend && dayOfWeek === 0 && isToday && "!border-danger-light",
|
|
165
|
-
!dateObj.currentMonth && "!text-neutral-main cursor-default hover:bg-transparent"
|
|
166
|
-
),
|
|
167
|
-
onClick: () => handleDateSelect(dateObj.date, dateObj.currentMonth)
|
|
168
|
-
};
|
|
169
|
-
},
|
|
170
|
-
[selectedDate, currentDate, highlightWeekend, calendarColor]
|
|
171
|
-
);
|
|
172
|
-
const calendarDates = getCalendarDates();
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
if (value !== void 0) {
|
|
175
|
-
setSelectedDate(value);
|
|
176
|
-
if (value) {
|
|
177
|
-
setCurrentDate(new Date(value));
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}, [value]);
|
|
181
|
-
useEffect(() => {
|
|
182
|
-
if (selectedDate) {
|
|
183
|
-
setCurrentDate(new Date(selectedDate));
|
|
184
|
-
}
|
|
185
|
-
}, [selectedDate]);
|
|
186
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
187
|
-
/* @__PURE__ */ jsxs("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
188
|
-
label && /* @__PURE__ */ jsx("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
|
|
189
|
-
/* @__PURE__ */ jsxs("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
190
|
-
/* @__PURE__ */ jsxs("div", { ref: inputWrapperRef, className: slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }), children: [
|
|
191
|
-
/* @__PURE__ */ jsx(
|
|
192
|
-
"input",
|
|
193
|
-
{
|
|
194
|
-
...inputProps,
|
|
195
|
-
ref,
|
|
196
|
-
className: slots.input({ class: classNames == null ? void 0 : classNames.input }),
|
|
197
|
-
type: "text",
|
|
198
|
-
value: displayValue,
|
|
199
|
-
placeholder,
|
|
200
|
-
readOnly: true,
|
|
201
|
-
onFocus: handleFocusInput,
|
|
202
|
-
onBlur: handleInputBlur,
|
|
203
|
-
onKeyDown: handleInputKeyDown
|
|
204
|
-
}
|
|
205
|
-
),
|
|
206
|
-
/* @__PURE__ */ jsxs("div", { className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }), children: [
|
|
207
|
-
displayValue && /* @__PURE__ */ jsx(
|
|
208
|
-
Icon_default,
|
|
209
|
-
{
|
|
210
|
-
name: "close",
|
|
211
|
-
className: "text-neutral-light hover:text-neutral-main mr-[5px] cursor-pointer",
|
|
212
|
-
onClick: (e) => {
|
|
213
|
-
e.stopPropagation();
|
|
214
|
-
handleClearDate();
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
),
|
|
218
|
-
/* @__PURE__ */ jsx(
|
|
219
|
-
Icon_default,
|
|
220
|
-
{
|
|
221
|
-
name: "calendar",
|
|
222
|
-
className: "cursor-pointer",
|
|
223
|
-
fill: true,
|
|
224
|
-
onClick: () => {
|
|
225
|
-
calculatePosition();
|
|
226
|
-
setIsPanelOpen((v) => !v);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
)
|
|
230
|
-
] })
|
|
231
|
-
] }),
|
|
232
|
-
errorMessage && /* @__PURE__ */ jsx("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
|
|
233
|
-
] })
|
|
234
|
-
] }),
|
|
235
|
-
isPanelOpen && createPortal(
|
|
236
|
-
/* @__PURE__ */ jsxs(
|
|
237
|
-
"div",
|
|
238
|
-
{
|
|
239
|
-
ref: panelWrapperRef,
|
|
240
|
-
className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
|
|
241
|
-
style: {
|
|
242
|
-
position: "absolute",
|
|
243
|
-
top: panelPos.top,
|
|
244
|
-
left: panelPos.left,
|
|
245
|
-
zIndex: 1e3
|
|
246
|
-
},
|
|
247
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ jsxs("div", { className: "calendar-header mb-4 flex items-center justify-between", children: [
|
|
250
|
-
/* @__PURE__ */ jsx(Icon_default, { name: "brace-left", size: "md", className: "cursor-pointer", onClick: handlePrevMonth }),
|
|
251
|
-
/* @__PURE__ */ jsx("span", { className: "text-h6 font-semibold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
|
|
252
|
-
/* @__PURE__ */ jsx(Icon_default, { name: "brace-right", size: "md", className: "cursor-pointer", onClick: handleNextMonth })
|
|
253
|
-
] }),
|
|
254
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-2 text-center", children: daysOfWeek.map((day, index) => /* @__PURE__ */ jsx("div", { ...getDateTitleProps(index), children: day }, `${day}-${index}`)) }),
|
|
255
|
-
/* @__PURE__ */ jsx("div", { className: "mt-2 grid grid-cols-7 gap-[5px] text-center", children: calendarDates.map((week, weekIndex) => {
|
|
256
|
-
const hasCurrentMonthDates = week.some((dateObj) => dateObj.currentMonth);
|
|
257
|
-
if (!hasCurrentMonthDates) return null;
|
|
258
|
-
return /* @__PURE__ */ jsx(React.Fragment, { children: week.map((dateObj, index) => {
|
|
259
|
-
return /* @__PURE__ */ jsx("div", { ...getDateProps(dateObj), children: dateObj.date }, index);
|
|
260
|
-
}) }, weekIndex);
|
|
261
|
-
}) })
|
|
262
|
-
]
|
|
263
|
-
}
|
|
264
|
-
),
|
|
265
|
-
document.body
|
|
266
|
-
)
|
|
267
|
-
] });
|
|
268
|
-
});
|
|
269
|
-
DatePicker.displayName = "DatePicker";
|
|
270
|
-
var datePicker_default = DatePicker;
|
|
271
|
-
var datePickerStyle = tv({
|
|
272
|
-
slots: {
|
|
273
|
-
base: ["group/datepicker", "flex", "flex-col"],
|
|
274
|
-
label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
|
|
275
|
-
wrapper: ["flex", "flex-col"],
|
|
276
|
-
inputWrapper: [
|
|
277
|
-
"flex",
|
|
278
|
-
"items-center",
|
|
279
|
-
"justify-between",
|
|
280
|
-
"border",
|
|
281
|
-
"cursor-pointer",
|
|
282
|
-
"text-neutral-main",
|
|
283
|
-
"group-has-[p.error]/datepicker:border-danger-main",
|
|
284
|
-
"group-has-[p.error]/datepicker:bg-danger-soft",
|
|
285
|
-
"group-has-[p.error]/datepicker:text-danger-main",
|
|
286
|
-
"group-has-[p.error]/datepicker:hover:bg-danger-soft"
|
|
287
|
-
],
|
|
288
|
-
input: [
|
|
289
|
-
"bg-transparent",
|
|
290
|
-
"w-full",
|
|
291
|
-
"outline-none",
|
|
292
|
-
"placeholder:text-neutral-main",
|
|
293
|
-
"text-body-foreground",
|
|
294
|
-
"group-has-[p.error]/datepicker:text-danger-main",
|
|
295
|
-
"group-has-[p.error]/datepicker:placeholder:text-danger-main",
|
|
296
|
-
"cursor-pointer"
|
|
297
|
-
],
|
|
298
|
-
icon: [
|
|
299
|
-
"flex",
|
|
300
|
-
"items-center",
|
|
301
|
-
"select-none",
|
|
302
|
-
"text-body-foreground",
|
|
303
|
-
"group-has-[p.error]/datepicker:text-danger-main"
|
|
304
|
-
],
|
|
305
|
-
optionsWrapper: [
|
|
306
|
-
"flex",
|
|
307
|
-
"flex-col",
|
|
308
|
-
"border",
|
|
309
|
-
"rounded-md",
|
|
310
|
-
"bg-body-background",
|
|
311
|
-
"shadow-lg",
|
|
312
|
-
"overflow-auto",
|
|
313
|
-
"w-[240px]",
|
|
314
|
-
"select-none",
|
|
315
|
-
"p-[10px]"
|
|
316
|
-
],
|
|
317
|
-
errorMessage: ["text-danger-main", "text-sm"]
|
|
318
|
-
},
|
|
319
|
-
variants: {
|
|
320
|
-
color: {
|
|
321
|
-
primary: {
|
|
322
|
-
icon: ["text-primary-main"]
|
|
323
|
-
},
|
|
324
|
-
secondary: {
|
|
325
|
-
icon: ["text-secondary-main"]
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
size: {
|
|
329
|
-
sm: {
|
|
330
|
-
base: ["text-sm", "gap-[4px]"],
|
|
331
|
-
label: ["text-sm"],
|
|
332
|
-
wrapper: ["gap-[4px]"],
|
|
333
|
-
inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]"],
|
|
334
|
-
input: ["text-sm"],
|
|
335
|
-
icon: ["text-sm"],
|
|
336
|
-
errorMessage: ["text-sm"]
|
|
337
|
-
},
|
|
338
|
-
md: {
|
|
339
|
-
base: ["text-md", "gap-[6px]"],
|
|
340
|
-
label: ["text-md"],
|
|
341
|
-
wrapper: ["gap-[6px]"],
|
|
342
|
-
inputWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]"],
|
|
343
|
-
input: ["text-md"],
|
|
344
|
-
icon: ["text-md"],
|
|
345
|
-
errorMessage: ["text-sm"]
|
|
346
|
-
},
|
|
347
|
-
lg: {
|
|
348
|
-
base: ["text-lg", "gap-[8px]"],
|
|
349
|
-
label: ["text-lg"],
|
|
350
|
-
wrapper: ["gap-[8px]"],
|
|
351
|
-
inputWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]"],
|
|
352
|
-
input: ["text-lg"],
|
|
353
|
-
icon: ["text-lg"],
|
|
354
|
-
errorMessage: ["text-md"]
|
|
355
|
-
},
|
|
356
|
-
xl: {
|
|
357
|
-
base: ["text-xl", "gap-[10px]"],
|
|
358
|
-
label: ["text-xl"],
|
|
359
|
-
wrapper: ["gap-[10px]"],
|
|
360
|
-
inputWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]"],
|
|
361
|
-
input: ["text-xl"],
|
|
362
|
-
icon: ["text-xl"],
|
|
363
|
-
errorMessage: ["text-md"]
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
full: {
|
|
367
|
-
true: {
|
|
368
|
-
base: ["w-full"],
|
|
369
|
-
wrapper: ["w-full"],
|
|
370
|
-
inputWrapper: ["w-full"]
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
disabled: {
|
|
374
|
-
true: {
|
|
375
|
-
base: ["pointer-events-none"],
|
|
376
|
-
label: ["text-neutral-light"],
|
|
377
|
-
inputWrapper: [
|
|
378
|
-
"bg-neutral-soft",
|
|
379
|
-
"border-neutral-light",
|
|
380
|
-
"group-has-[p.error]/datepicker:text-danger-light",
|
|
381
|
-
"group-has-[p.error]/datepicker:bg-danger-soft",
|
|
382
|
-
"group-has-[p.error]/datepicker:border-danger-light",
|
|
383
|
-
"cursor-not-allowed"
|
|
384
|
-
],
|
|
385
|
-
input: [
|
|
386
|
-
"text-neutral-light",
|
|
387
|
-
"placeholder:text-neutral-light",
|
|
388
|
-
"group-has-[p.error]/datepicker:text-danger-light",
|
|
389
|
-
"group-has-[p.error]/datepicker:placeholder:text-danger-light",
|
|
390
|
-
"cursor-not-allowed"
|
|
391
|
-
],
|
|
392
|
-
icon: ["text-neutral-light"],
|
|
393
|
-
errorMessage: ["text-danger-light"]
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
defaultVariants: {
|
|
398
|
-
color: "primary",
|
|
399
|
-
size: "md",
|
|
400
|
-
full: false,
|
|
401
|
-
disabled: false
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
export {
|
|
406
|
-
datePicker_default,
|
|
407
|
-
datePickerStyle
|
|
408
|
-
};
|
|
File without changes
|