@deepnoid/ui 0.1.123 → 0.1.126

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.
Files changed (162) hide show
  1. package/.turbo/turbo-build.log +469 -461
  2. package/dist/{chunk-4DESGO3D.mjs → chunk-2TDHQLVV.mjs} +1 -1
  3. package/dist/{chunk-H6JGLPPF.mjs → chunk-3U5NJTRH.mjs} +1 -1
  4. package/dist/{chunk-2IOTRPCS.mjs → chunk-4WHX4RXX.mjs} +3 -3
  5. package/dist/{chunk-E2LGBO2H.mjs → chunk-4X67BUPA.mjs} +3 -3
  6. package/dist/{chunk-DLNGJVFS.mjs → chunk-5R3ARH2N.mjs} +2 -2
  7. package/dist/{chunk-S7Y7XUBL.mjs → chunk-5XV45JBV.mjs} +1 -1
  8. package/dist/{chunk-VB5NKWJG.mjs → chunk-5XW5QDIW.mjs} +1 -1
  9. package/dist/{chunk-CDXBML6O.mjs → chunk-76QIZILI.mjs} +6 -3
  10. package/dist/{chunk-27K5BTEL.mjs → chunk-ANILRUAS.mjs} +5 -4
  11. package/dist/{chunk-VOKDAIUY.mjs → chunk-BBEOPH6B.mjs} +2 -2
  12. package/dist/{chunk-NBJHZ4X2.mjs → chunk-BBRPAQON.mjs} +1 -1
  13. package/dist/{chunk-RVFSQFWS.mjs → chunk-BD4M2FZM.mjs} +4 -4
  14. package/dist/{chunk-I3ADJOUT.mjs → chunk-CVXLLXLE.mjs} +1 -1
  15. package/dist/{chunk-VEBJS4SC.mjs → chunk-DDK4NEDX.mjs} +4 -4
  16. package/dist/{chunk-BG4DIGKH.mjs → chunk-GQFNYXJZ.mjs} +30 -0
  17. package/dist/{chunk-ITWKPTSD.mjs → chunk-GUTGDPXH.mjs} +1 -1
  18. package/dist/{chunk-HX64P3XQ.mjs → chunk-IBYQBC6D.mjs} +115 -34
  19. package/dist/chunk-IHLCZM5T.mjs +198 -0
  20. package/dist/{chunk-AT6GNVOQ.mjs → chunk-IT6RD6KS.mjs} +2 -2
  21. package/dist/{chunk-AF4I7ZQS.mjs → chunk-IW2MDZBW.mjs} +1 -1
  22. package/dist/{chunk-FF56E2UQ.mjs → chunk-J7IIHQNA.mjs} +1 -1
  23. package/dist/{chunk-5MINOKNM.mjs → chunk-JC6635TJ.mjs} +2 -2
  24. package/dist/{chunk-DD6HAIW3.mjs → chunk-KP2KOY5Z.mjs} +1 -1
  25. package/dist/{chunk-2CLPU5LR.mjs → chunk-MCBAEW2Q.mjs} +1 -1
  26. package/dist/{chunk-ITDBI3X2.mjs → chunk-MPUZ5T7X.mjs} +9 -9
  27. package/dist/{chunk-JGQ5MLQ7.mjs → chunk-OEFILEL3.mjs} +1 -1
  28. package/dist/{chunk-6JLHCQH7.mjs → chunk-OLQJXFHU.mjs} +2 -2
  29. package/dist/{chunk-LOYDOCOR.mjs → chunk-ORZW6F6E.mjs} +3 -3
  30. package/dist/{chunk-3IILPVRA.mjs → chunk-P3PXIJTU.mjs} +1 -1
  31. package/dist/{chunk-Q364C3FI.mjs → chunk-SDUDU3CU.mjs} +1 -1
  32. package/dist/{chunk-D6MHTE5L.mjs → chunk-SJNXRXV5.mjs} +1 -1
  33. package/dist/{chunk-XOUAUSP4.mjs → chunk-TRLIC34S.mjs} +2 -2
  34. package/dist/{chunk-OGJONB7G.mjs → chunk-WNNOVISA.mjs} +1 -1
  35. package/dist/{chunk-EKLA6ZR4.mjs → chunk-XL3K55LE.mjs} +1 -1
  36. package/dist/{chunk-YZ57UYAS.mjs → chunk-XX2PHROM.mjs} +1 -1
  37. package/dist/{chunk-YBVJFHH6.mjs → chunk-YGOX6FBU.mjs} +1 -1
  38. package/dist/{chunk-GZEAMYAO.mjs → chunk-YWLC7KRK.mjs} +2 -3
  39. package/dist/{chunk-3F6OF2QS.mjs → chunk-ZI3MLO7X.mjs} +2 -2
  40. package/dist/components/accordion/accordion.mjs +2 -2
  41. package/dist/components/accordion/accordionItem.mjs +2 -2
  42. package/dist/components/accordion/index.mjs +3 -3
  43. package/dist/components/avatar/avatar.js +30 -0
  44. package/dist/components/avatar/avatar.mjs +3 -3
  45. package/dist/components/avatar/index.js +30 -0
  46. package/dist/components/avatar/index.mjs +3 -3
  47. package/dist/components/backdrop/backdrop.mjs +2 -2
  48. package/dist/components/backdrop/index.mjs +2 -2
  49. package/dist/components/breadcrumb/breadcrumb.js +30 -0
  50. package/dist/components/breadcrumb/breadcrumb.mjs +8 -8
  51. package/dist/components/breadcrumb/index.js +30 -0
  52. package/dist/components/breadcrumb/index.mjs +8 -8
  53. package/dist/components/button/button-group.mjs +2 -2
  54. package/dist/components/button/button.js +30 -0
  55. package/dist/components/button/button.mjs +4 -4
  56. package/dist/components/button/icon-button.js +30 -0
  57. package/dist/components/button/icon-button.mjs +4 -4
  58. package/dist/components/button/index.js +30 -0
  59. package/dist/components/button/index.mjs +7 -7
  60. package/dist/components/button/text-button.mjs +2 -2
  61. package/dist/components/charts/areaChart.d.mts +5 -0
  62. package/dist/components/charts/areaChart.d.ts +5 -0
  63. package/dist/components/charts/areaChart.js +191 -73
  64. package/dist/components/charts/areaChart.mjs +5 -2
  65. package/dist/components/charts/barChart.mjs +2 -2
  66. package/dist/components/charts/circularProgress.mjs +2 -2
  67. package/dist/components/charts/index.js +225 -105
  68. package/dist/components/charts/index.mjs +8 -5
  69. package/dist/components/charts/radarChart.mjs +2 -2
  70. package/dist/components/checkbox/checkbox.mjs +2 -2
  71. package/dist/components/checkbox/index.mjs +2 -2
  72. package/dist/components/chip/chip.js +30 -0
  73. package/dist/components/chip/chip.mjs +4 -4
  74. package/dist/components/chip/index.js +30 -0
  75. package/dist/components/chip/index.mjs +4 -4
  76. package/dist/components/drawer/drawer.mjs +2 -2
  77. package/dist/components/drawer/index.mjs +2 -2
  78. package/dist/components/fileUpload/fileUpload.js +30 -0
  79. package/dist/components/fileUpload/fileUpload.mjs +10 -10
  80. package/dist/components/fileUpload/index.js +30 -0
  81. package/dist/components/fileUpload/index.mjs +10 -10
  82. package/dist/components/icon/Icon.d.mts +4 -0
  83. package/dist/components/icon/Icon.d.ts +4 -0
  84. package/dist/components/icon/Icon.js +30 -0
  85. package/dist/components/icon/Icon.mjs +2 -2
  86. package/dist/components/icon/index.js +30 -0
  87. package/dist/components/icon/index.mjs +2 -2
  88. package/dist/components/icon/template.d.mts +1 -0
  89. package/dist/components/icon/template.d.ts +1 -0
  90. package/dist/components/icon/template.js +30 -0
  91. package/dist/components/icon/template.mjs +1 -1
  92. package/dist/components/input/index.js +30 -0
  93. package/dist/components/input/index.mjs +4 -4
  94. package/dist/components/input/input.js +30 -0
  95. package/dist/components/input/input.mjs +4 -4
  96. package/dist/components/list/index.js +30 -0
  97. package/dist/components/list/index.mjs +6 -6
  98. package/dist/components/list/list.mjs +2 -2
  99. package/dist/components/list/listItem.js +30 -0
  100. package/dist/components/list/listItem.mjs +5 -5
  101. package/dist/components/modal/index.js +30 -0
  102. package/dist/components/modal/index.mjs +9 -9
  103. package/dist/components/modal/modal.js +30 -0
  104. package/dist/components/modal/modal.mjs +9 -9
  105. package/dist/components/pagination/index.js +141 -29
  106. package/dist/components/pagination/index.mjs +5 -5
  107. package/dist/components/pagination/pagination.d.mts +1 -1
  108. package/dist/components/pagination/pagination.d.ts +1 -1
  109. package/dist/components/pagination/pagination.js +142 -35
  110. package/dist/components/pagination/pagination.mjs +6 -8
  111. package/dist/components/picker/datePicker.js +30 -0
  112. package/dist/components/picker/datePicker.mjs +10 -10
  113. package/dist/components/picker/day.mjs +2 -2
  114. package/dist/components/picker/index.js +30 -1
  115. package/dist/components/picker/index.mjs +16 -16
  116. package/dist/components/picker/timePicker.js +30 -1
  117. package/dist/components/picker/timePicker.mjs +5 -5
  118. package/dist/components/progress/index.mjs +2 -2
  119. package/dist/components/progress/progress.mjs +2 -2
  120. package/dist/components/radio/index.mjs +2 -2
  121. package/dist/components/radio/radio.mjs +2 -2
  122. package/dist/components/select/index.js +30 -1
  123. package/dist/components/select/index.mjs +4 -4
  124. package/dist/components/select/select.js +30 -1
  125. package/dist/components/select/select.mjs +4 -4
  126. package/dist/components/table/definition-table.mjs +2 -2
  127. package/dist/components/table/form-table.mjs +1 -1
  128. package/dist/components/table/index.js +142 -29
  129. package/dist/components/table/index.mjs +10 -10
  130. package/dist/components/table/table-body.js +142 -29
  131. package/dist/components/table/table-body.mjs +9 -9
  132. package/dist/components/table/table-head.js +142 -29
  133. package/dist/components/table/table-head.mjs +9 -9
  134. package/dist/components/table/table.js +142 -29
  135. package/dist/components/table/table.mjs +9 -9
  136. package/dist/components/tabs/index.mjs +2 -2
  137. package/dist/components/tabs/tabs.mjs +2 -2
  138. package/dist/components/timePicker/calendar.d.mts +72 -0
  139. package/dist/components/timePicker/calendar.d.ts +72 -0
  140. package/dist/components/timePicker/calendar.js +5360 -0
  141. package/dist/components/timePicker/calendar.mjs +300 -0
  142. package/dist/components/timePicker/useDateTimePicker.d.mts +38 -0
  143. package/dist/components/timePicker/useDateTimePicker.d.ts +38 -0
  144. package/dist/components/timePicker/useDateTimePicker.js +126 -0
  145. package/dist/components/timePicker/useDateTimePicker.mjs +96 -0
  146. package/dist/components/toast/index.js +30 -0
  147. package/dist/components/toast/index.mjs +5 -5
  148. package/dist/components/toast/toast.js +30 -0
  149. package/dist/components/toast/toast.mjs +4 -4
  150. package/dist/components/toast/use-toast.js +30 -0
  151. package/dist/components/toast/use-toast.mjs +5 -5
  152. package/dist/components/tooltip/index.mjs +2 -2
  153. package/dist/components/tooltip/tooltip.mjs +2 -2
  154. package/dist/components/tree/index.js +30 -0
  155. package/dist/components/tree/index.mjs +4 -4
  156. package/dist/components/tree/tree.js +30 -0
  157. package/dist/components/tree/tree.mjs +4 -4
  158. package/dist/index.js +254 -99
  159. package/dist/index.mjs +55 -55
  160. package/dist/utils/tailwind-variants.mjs +1 -1
  161. package/package.json +1 -1
  162. package/dist/chunk-QKRCC26D.mjs +0 -155
@@ -0,0 +1,300 @@
1
+ "use client";
2
+ import {
3
+ formatDateToString,
4
+ formatStringToDate
5
+ } from "../../chunk-FWFEKWWD.mjs";
6
+ import "../../chunk-ZYIIXWVY.mjs";
7
+ import {
8
+ Icon_default
9
+ } from "../../chunk-XX2PHROM.mjs";
10
+ import {
11
+ mapPropsVariants
12
+ } from "../../chunk-E3G5QXSH.mjs";
13
+ import "../../chunk-GQFNYXJZ.mjs";
14
+ import {
15
+ tv
16
+ } from "../../chunk-76QIZILI.mjs";
17
+ import "../../chunk-AC6TWLRT.mjs";
18
+
19
+ // src/components/timePicker/calendar.tsx
20
+ import React, {
21
+ forwardRef,
22
+ useCallback,
23
+ useMemo,
24
+ useState,
25
+ useImperativeHandle,
26
+ useEffect
27
+ } from "react";
28
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
29
+ var Calendar = forwardRef((originalProps, ref) => {
30
+ const [props, variantProps] = mapPropsVariants(originalProps, calendarStyle.variantKeys);
31
+ const {
32
+ selectedDate,
33
+ startDate,
34
+ endDate,
35
+ range = false,
36
+ classNames,
37
+ highlightWeekend = true,
38
+ onChangeDate,
39
+ onChangeDateRange,
40
+ ...inputProps
41
+ } = props;
42
+ const [currentDate, setCurrentDate] = useState(selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date());
43
+ const [tempStartDate, setTempStartDate] = useState(startDate);
44
+ const [tempEndDate, setTempEndDate] = useState(endDate);
45
+ const [isSelectingRange, setIsSelectingRange] = useState(false);
46
+ const daysOfWeek = ["S", "M", "T", "W", "T", "F", "S"];
47
+ useEffect(() => {
48
+ if (selectedDate) {
49
+ setCurrentDate(new Date(selectedDate));
50
+ }
51
+ }, [selectedDate]);
52
+ useEffect(() => {
53
+ if (range) {
54
+ setTempStartDate(startDate);
55
+ setTempEndDate(endDate);
56
+ }
57
+ }, [startDate, endDate, range]);
58
+ const getCalendarDates = useCallback(() => {
59
+ const year = currentDate.getFullYear();
60
+ const month = currentDate.getMonth();
61
+ const firstDayOfMonth = new Date(year, month, 1).getDay();
62
+ const lastDateOfMonth = new Date(year, month + 1, 0).getDate();
63
+ const lastDateOfPrevMonth = new Date(year, month, 0).getDate();
64
+ let dates = [];
65
+ for (let i = firstDayOfMonth - 1; i >= 0; i--) {
66
+ dates.push({
67
+ date: lastDateOfPrevMonth - i,
68
+ currentMonth: false
69
+ });
70
+ }
71
+ for (let date = 1; date <= lastDateOfMonth; date++) {
72
+ dates.push({
73
+ date,
74
+ currentMonth: true
75
+ });
76
+ }
77
+ const remainingDays = 42 - dates.length;
78
+ for (let i = 1; i <= remainingDays; i++) {
79
+ dates.push({
80
+ date: i,
81
+ currentMonth: false
82
+ });
83
+ }
84
+ const weeks = [];
85
+ for (let i = 0; i < dates.length; i += 7) {
86
+ weeks.push(dates.slice(i, i + 7));
87
+ }
88
+ return weeks;
89
+ }, [currentDate]);
90
+ const handlePrevMonth = () => {
91
+ setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1));
92
+ };
93
+ const handleNextMonth = () => {
94
+ setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1));
95
+ };
96
+ const handleDateSelect = (date, isCurrentMonth) => {
97
+ if (!isCurrentMonth) return;
98
+ const selected = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
99
+ const formatted = formatDateToString(selected);
100
+ if (range) {
101
+ if (!tempStartDate || tempStartDate && tempEndDate) {
102
+ setTempStartDate(formatted);
103
+ setTempEndDate(void 0);
104
+ setIsSelectingRange(true);
105
+ } else if (tempStartDate && !tempEndDate) {
106
+ const startDateObj = new Date(tempStartDate);
107
+ const endDateObj = selected;
108
+ if (endDateObj >= startDateObj) {
109
+ setTempEndDate(formatted);
110
+ onChangeDateRange == null ? void 0 : onChangeDateRange(tempStartDate, formatted);
111
+ } else {
112
+ setTempStartDate(formatted);
113
+ setTempEndDate(tempStartDate);
114
+ onChangeDateRange == null ? void 0 : onChangeDateRange(formatted, tempStartDate);
115
+ }
116
+ setIsSelectingRange(false);
117
+ }
118
+ } else {
119
+ onChangeDate == null ? void 0 : onChangeDate(formatted);
120
+ }
121
+ };
122
+ const isDateInRange = (date, isCurrentMonth) => {
123
+ if (!range || !tempStartDate || !isCurrentMonth) return false;
124
+ const currentDateObj = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
125
+ const startDateObj = new Date(tempStartDate);
126
+ const endDateObj = tempEndDate ? new Date(tempEndDate) : null;
127
+ if (endDateObj) {
128
+ return currentDateObj >= startDateObj && currentDateObj <= endDateObj;
129
+ }
130
+ return false;
131
+ };
132
+ const isDateRangeStart = (date, isCurrentMonth) => {
133
+ if (!range || !tempStartDate || !isCurrentMonth) return false;
134
+ const currentDateObj = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
135
+ const startDateObj = new Date(tempStartDate);
136
+ return currentDateObj.getTime() === startDateObj.getTime();
137
+ };
138
+ const isDateRangeEnd = (date, isCurrentMonth) => {
139
+ if (!range || !tempEndDate || !isCurrentMonth) return false;
140
+ const currentDateObj = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
141
+ const endDateObj = new Date(tempEndDate);
142
+ return currentDateObj.getTime() === endDateObj.getTime();
143
+ };
144
+ useImperativeHandle(ref, () => ({
145
+ getSelectedDate: () => selectedDate,
146
+ getStartDate: () => tempStartDate,
147
+ getEndDate: () => tempEndDate
148
+ }));
149
+ const slots = useMemo(() => calendarStyle({ ...variantProps }), [variantProps]);
150
+ const getBaseProps = useCallback(
151
+ () => ({
152
+ className: `${slots.base({ class: classNames == null ? void 0 : classNames.base })}`
153
+ }),
154
+ [slots, classNames]
155
+ );
156
+ const getDateTitleProps = useCallback(
157
+ (index) => {
158
+ return {
159
+ className: `${slots.dateTitle({
160
+ class: classNames == null ? void 0 : classNames.dateTitle
161
+ })}`,
162
+ "data-saturday": highlightWeekend && index === 6,
163
+ "data-sunday": highlightWeekend && index === 0
164
+ };
165
+ },
166
+ [slots, classNames, highlightWeekend]
167
+ );
168
+ const getDateProps = useCallback(
169
+ (dateObj) => {
170
+ const today = /* @__PURE__ */ new Date();
171
+ const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
172
+ const formatted = selectedDate ? formatStringToDate(selectedDate) : "";
173
+ const isSelected = !range && formatted ? formatted.getDate() === dateObj.date && formatted.getMonth() === currentDate.getMonth() && formatted.getFullYear() === currentDate.getFullYear() : false;
174
+ const inRange = isDateInRange(dateObj.date, dateObj.currentMonth);
175
+ const rangeStart = isDateRangeStart(dateObj.date, dateObj.currentMonth);
176
+ const rangeEnd = isDateRangeEnd(dateObj.date, dateObj.currentMonth);
177
+ const dayOfWeek = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date).getDay();
178
+ return {
179
+ className: `${slots.date({
180
+ class: classNames == null ? void 0 : classNames.date
181
+ })}`,
182
+ "data-today": dateObj.currentMonth && isToday,
183
+ "data-selected": dateObj.currentMonth && isSelected,
184
+ "data-range-start": dateObj.currentMonth && rangeStart,
185
+ "data-range-end": dateObj.currentMonth && rangeEnd,
186
+ "data-in-range": dateObj.currentMonth && inRange,
187
+ "data-disabled": !dateObj.currentMonth,
188
+ "data-saturday": highlightWeekend && dayOfWeek === 6,
189
+ "data-sunday": highlightWeekend && dayOfWeek === 0,
190
+ onClick: () => handleDateSelect(dateObj.date, dateObj.currentMonth)
191
+ };
192
+ },
193
+ [slots, classNames, selectedDate, currentDate, highlightWeekend, range, tempStartDate, tempEndDate]
194
+ );
195
+ const calendarDates = getCalendarDates();
196
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { ...getBaseProps(), children: [
197
+ /* @__PURE__ */ jsxs("div", { className: "calendar-header mb-4 flex items-center justify-between", children: [
198
+ /* @__PURE__ */ jsx(Icon_default, { name: "brace-left", size: "md", className: "cursor-pointer", onClick: handlePrevMonth }),
199
+ /* @__PURE__ */ jsx("span", { className: "text-h6 font-semibold", children: currentDate.toLocaleString("default", { year: "numeric", month: "2-digit" }) }),
200
+ /* @__PURE__ */ jsx(Icon_default, { name: "brace-right", size: "md", className: "cursor-pointer", onClick: handleNextMonth })
201
+ ] }),
202
+ /* @__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}`)) }),
203
+ /* @__PURE__ */ jsx("div", { className: "mt-2 grid grid-cols-7 gap-[5px] text-center", children: calendarDates.map((week, weekIndex) => {
204
+ const hasCurrentMonthDates = week.some((dateObj) => dateObj.currentMonth);
205
+ if (!hasCurrentMonthDates) return null;
206
+ return /* @__PURE__ */ jsx(React.Fragment, { children: week.map((dateObj, index) => {
207
+ return /* @__PURE__ */ jsx("div", { ...getDateProps(dateObj), children: dateObj.date }, index);
208
+ }) }, weekIndex);
209
+ }) })
210
+ ] }) });
211
+ });
212
+ Calendar.displayName = "Calendar";
213
+ var calendar_default = Calendar;
214
+ var calendarStyle = tv({
215
+ slots: {
216
+ base: [
217
+ "flex",
218
+ "flex-col",
219
+ "w-[240px]",
220
+ "border",
221
+ "border-neutral-main",
222
+ "bg-background",
223
+ "rounded-md",
224
+ "p-4",
225
+ "shadow-lg",
226
+ "select-none"
227
+ ],
228
+ dateTitle: ["text-sm", "font-[500]", "data-[saturday=true]:text-[#1E7EEE]", "data-[sunday=true]:text-[#FF4684]"],
229
+ date: [
230
+ "flex",
231
+ "justify-center",
232
+ "items-center",
233
+ "h-[25px]",
234
+ "text-sm",
235
+ "rounded-full",
236
+ "cursor-pointer",
237
+ "hover:bg-neutral-soft",
238
+ "data-[today=true]:border",
239
+ "data-[today=true]:border-foreground",
240
+ "data-[saturday=true]:text-[#1E7EEE]",
241
+ "data-[saturday=true]:!border-[#1E7EEE]",
242
+ "data-[sunday=true]:text-[#FF4684]",
243
+ "data-[sunday=true]:!border-[#FF4684]",
244
+ "data-[selected=true]:!text-white",
245
+ "data-[selected=true]:border-none",
246
+ "data-[range-start=true]:!text-white",
247
+ "data-[range-start=true]:border-none",
248
+ "data-[range-end=true]:!text-white",
249
+ "data-[range-end=true]:border-none",
250
+ "data-[in-range=true]:!bg-opacity-20",
251
+ "data-[disabled=true]:!text-neutral-main",
252
+ "data-[disabled=true]:cursor-default",
253
+ "data-[disabled=true]:hover:bg-transparent"
254
+ ]
255
+ },
256
+ variants: {
257
+ variant: {
258
+ solid: {}
259
+ },
260
+ color: {
261
+ primary: {
262
+ date: [
263
+ "data-[selected=true]:!border-primary-main",
264
+ "data-[selected=true]:bg-primary-main",
265
+ "data-[range-start=true]:!border-primary-main",
266
+ "data-[range-start=true]:bg-primary-main",
267
+ "data-[range-end=true]:!border-primary-main",
268
+ "data-[range-end=true]:bg-primary-main",
269
+ "data-[in-range=true]:!bg-primary-main"
270
+ ]
271
+ },
272
+ secondary: {
273
+ date: [
274
+ "data-[selected=true]:!border-secondary-main",
275
+ "data-[selected=true]:bg-secondary-main",
276
+ "data-[range-start=true]:!border-secondary-main",
277
+ "data-[range-start=true]:bg-secondary-main",
278
+ "data-[range-end=true]:!border-secondary-main",
279
+ "data-[range-end=true]:bg-secondary-main",
280
+ "data-[in-range=true]:!bg-secondary-main"
281
+ ]
282
+ }
283
+ }
284
+ },
285
+ defaultVariants: {
286
+ variant: "solid",
287
+ color: "primary"
288
+ },
289
+ compoundVariants: [
290
+ {
291
+ disabled: true,
292
+ isRequired: true,
293
+ class: {}
294
+ }
295
+ ]
296
+ });
297
+ export {
298
+ calendarStyle,
299
+ calendar_default as default
300
+ };
@@ -0,0 +1,38 @@
1
+ import * as react from 'react';
2
+
3
+ interface DatePickerHookProps {
4
+ initialDate?: Date;
5
+ initialTime?: string;
6
+ range?: boolean;
7
+ onChange?: (date: Date) => void;
8
+ }
9
+ type TargetRect = {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ };
15
+ declare const useDatePicker: ({ initialDate, initialTime, range }: DatePickerHookProps) => {
16
+ selectedDate: string | undefined;
17
+ selectedTime: string | undefined;
18
+ startDate: string | undefined;
19
+ endDate: string | undefined;
20
+ targetRect: TargetRect | null;
21
+ popupHeight: number;
22
+ isFocusInput: boolean;
23
+ dateInputRef: react.RefObject<HTMLInputElement | null>;
24
+ datePickerWrapperRef: react.RefObject<HTMLDivElement | null>;
25
+ datePickerRef: react.RefObject<HTMLDivElement | null>;
26
+ handleToggleDatePicker: () => void;
27
+ handleChangeDate: (date: string) => void;
28
+ handleChangeTime: (time: string) => void;
29
+ handleChangeDateRange: (start: string, end: string) => void;
30
+ handleFocusInput: () => void;
31
+ handleBlurInput: () => void;
32
+ calculatePositionWithScroll: (targetRect: TargetRect) => {
33
+ top: number;
34
+ left: number;
35
+ } | undefined;
36
+ };
37
+
38
+ export { useDatePicker };
@@ -0,0 +1,38 @@
1
+ import * as react from 'react';
2
+
3
+ interface DatePickerHookProps {
4
+ initialDate?: Date;
5
+ initialTime?: string;
6
+ range?: boolean;
7
+ onChange?: (date: Date) => void;
8
+ }
9
+ type TargetRect = {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ };
15
+ declare const useDatePicker: ({ initialDate, initialTime, range }: DatePickerHookProps) => {
16
+ selectedDate: string | undefined;
17
+ selectedTime: string | undefined;
18
+ startDate: string | undefined;
19
+ endDate: string | undefined;
20
+ targetRect: TargetRect | null;
21
+ popupHeight: number;
22
+ isFocusInput: boolean;
23
+ dateInputRef: react.RefObject<HTMLInputElement | null>;
24
+ datePickerWrapperRef: react.RefObject<HTMLDivElement | null>;
25
+ datePickerRef: react.RefObject<HTMLDivElement | null>;
26
+ handleToggleDatePicker: () => void;
27
+ handleChangeDate: (date: string) => void;
28
+ handleChangeTime: (time: string) => void;
29
+ handleChangeDateRange: (start: string, end: string) => void;
30
+ handleFocusInput: () => void;
31
+ handleBlurInput: () => void;
32
+ calculatePositionWithScroll: (targetRect: TargetRect) => {
33
+ top: number;
34
+ left: number;
35
+ } | undefined;
36
+ };
37
+
38
+ export { useDatePicker };
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/timePicker/useDateTimePicker.tsx
22
+ var useDateTimePicker_exports = {};
23
+ __export(useDateTimePicker_exports, {
24
+ useDatePicker: () => useDatePicker
25
+ });
26
+ module.exports = __toCommonJS(useDateTimePicker_exports);
27
+ var import_react = require("react");
28
+
29
+ // src/components/picker/utils.ts
30
+ var formatDateToString = (date) => {
31
+ const year = date.getFullYear();
32
+ const month = String(date.getMonth() + 1).padStart(2, "0");
33
+ const day = String(date.getDate()).padStart(2, "0");
34
+ return `${year}-${month}-${day}`;
35
+ };
36
+
37
+ // src/components/timePicker/useDateTimePicker.tsx
38
+ var useDatePicker = ({ initialDate, initialTime, range = false }) => {
39
+ const [selectedDate, setSelectedDate] = (0, import_react.useState)(
40
+ initialDate ? formatDateToString(initialDate) : ""
41
+ );
42
+ const [selectedTime, setSelectedTime] = (0, import_react.useState)(initialTime ? initialTime : "");
43
+ const [startDate, setStartDate] = (0, import_react.useState)("");
44
+ const [endDate, setEndDate] = (0, import_react.useState)("");
45
+ const [targetRect, setTargetRect] = (0, import_react.useState)(null);
46
+ const [popupWidth, setPopupWidth] = (0, import_react.useState)(0);
47
+ const [popupHeight, setPopupHeight] = (0, import_react.useState)(0);
48
+ const [isFocusInput, setIsFocusInput] = (0, import_react.useState)(false);
49
+ const dateInputRef = (0, import_react.useRef)(null);
50
+ const datePickerWrapperRef = (0, import_react.useRef)(null);
51
+ const datePickerRef = (0, import_react.useRef)(null);
52
+ const DATE_PICKER_GAP = 4;
53
+ const calculatePositionWithScroll = (targetRect2) => {
54
+ if (targetRect2 && popupWidth && popupHeight) {
55
+ const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
56
+ const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
57
+ const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + DATE_PICKER_GAP);
58
+ const spaceAbove = targetRect2.y - DATE_PICKER_GAP;
59
+ const top = spaceBelow < popupHeight && spaceAbove > popupHeight ? targetRect2.y - popupHeight - DATE_PICKER_GAP : targetRect2.y + targetRect2.height + DATE_PICKER_GAP;
60
+ return {
61
+ top: top + scrollTop,
62
+ left: targetRect2.x + targetRect2.width - popupWidth + scrollLeft
63
+ };
64
+ }
65
+ };
66
+ const handleToggleDatePicker = () => {
67
+ if (datePickerRef.current) {
68
+ const rect = datePickerRef.current.getBoundingClientRect();
69
+ setTargetRect((prevRect) => prevRect ? null : { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
70
+ }
71
+ };
72
+ const handleChangeDate = (date) => {
73
+ setSelectedDate(date);
74
+ };
75
+ const handleChangeTime = (time) => {
76
+ setSelectedTime(time);
77
+ };
78
+ const handleChangeDateRange = (start, end) => {
79
+ setStartDate(start);
80
+ setEndDate(end);
81
+ };
82
+ const handleFocusInput = () => {
83
+ setIsFocusInput(true);
84
+ };
85
+ const handleBlurInput = () => {
86
+ setIsFocusInput(false);
87
+ };
88
+ (0, import_react.useEffect)(() => {
89
+ const onClickOutside = (e) => {
90
+ if (datePickerRef.current && !datePickerRef.current.contains(e.target) && datePickerWrapperRef.current && !datePickerWrapperRef.current.contains(e.target)) {
91
+ setTargetRect(null);
92
+ }
93
+ };
94
+ window.addEventListener("mousedown", onClickOutside);
95
+ return () => window.removeEventListener("mousedown", onClickOutside);
96
+ }, []);
97
+ (0, import_react.useEffect)(() => {
98
+ if (datePickerWrapperRef.current) {
99
+ setPopupHeight(datePickerWrapperRef.current.getBoundingClientRect().height);
100
+ setPopupWidth(datePickerWrapperRef.current.getBoundingClientRect().width);
101
+ }
102
+ }, [targetRect]);
103
+ return {
104
+ selectedDate,
105
+ selectedTime,
106
+ startDate,
107
+ endDate,
108
+ targetRect,
109
+ popupHeight,
110
+ isFocusInput,
111
+ dateInputRef,
112
+ datePickerWrapperRef,
113
+ datePickerRef,
114
+ handleToggleDatePicker,
115
+ handleChangeDate,
116
+ handleChangeTime,
117
+ handleChangeDateRange,
118
+ handleFocusInput,
119
+ handleBlurInput,
120
+ calculatePositionWithScroll
121
+ };
122
+ };
123
+ // Annotate the CommonJS export names for ESM import in node:
124
+ 0 && (module.exports = {
125
+ useDatePicker
126
+ });
@@ -0,0 +1,96 @@
1
+ "use client";
2
+ import {
3
+ formatDateToString
4
+ } from "../../chunk-FWFEKWWD.mjs";
5
+ import "../../chunk-AC6TWLRT.mjs";
6
+
7
+ // src/components/timePicker/useDateTimePicker.tsx
8
+ import { useState, useEffect, useRef } from "react";
9
+ var useDatePicker = ({ initialDate, initialTime, range = false }) => {
10
+ const [selectedDate, setSelectedDate] = useState(
11
+ initialDate ? formatDateToString(initialDate) : ""
12
+ );
13
+ const [selectedTime, setSelectedTime] = useState(initialTime ? initialTime : "");
14
+ const [startDate, setStartDate] = useState("");
15
+ const [endDate, setEndDate] = useState("");
16
+ const [targetRect, setTargetRect] = useState(null);
17
+ const [popupWidth, setPopupWidth] = useState(0);
18
+ const [popupHeight, setPopupHeight] = useState(0);
19
+ const [isFocusInput, setIsFocusInput] = useState(false);
20
+ const dateInputRef = useRef(null);
21
+ const datePickerWrapperRef = useRef(null);
22
+ const datePickerRef = useRef(null);
23
+ const DATE_PICKER_GAP = 4;
24
+ const calculatePositionWithScroll = (targetRect2) => {
25
+ if (targetRect2 && popupWidth && popupHeight) {
26
+ const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
27
+ const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
28
+ const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + DATE_PICKER_GAP);
29
+ const spaceAbove = targetRect2.y - DATE_PICKER_GAP;
30
+ const top = spaceBelow < popupHeight && spaceAbove > popupHeight ? targetRect2.y - popupHeight - DATE_PICKER_GAP : targetRect2.y + targetRect2.height + DATE_PICKER_GAP;
31
+ return {
32
+ top: top + scrollTop,
33
+ left: targetRect2.x + targetRect2.width - popupWidth + scrollLeft
34
+ };
35
+ }
36
+ };
37
+ const handleToggleDatePicker = () => {
38
+ if (datePickerRef.current) {
39
+ const rect = datePickerRef.current.getBoundingClientRect();
40
+ setTargetRect((prevRect) => prevRect ? null : { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
41
+ }
42
+ };
43
+ const handleChangeDate = (date) => {
44
+ setSelectedDate(date);
45
+ };
46
+ const handleChangeTime = (time) => {
47
+ setSelectedTime(time);
48
+ };
49
+ const handleChangeDateRange = (start, end) => {
50
+ setStartDate(start);
51
+ setEndDate(end);
52
+ };
53
+ const handleFocusInput = () => {
54
+ setIsFocusInput(true);
55
+ };
56
+ const handleBlurInput = () => {
57
+ setIsFocusInput(false);
58
+ };
59
+ useEffect(() => {
60
+ const onClickOutside = (e) => {
61
+ if (datePickerRef.current && !datePickerRef.current.contains(e.target) && datePickerWrapperRef.current && !datePickerWrapperRef.current.contains(e.target)) {
62
+ setTargetRect(null);
63
+ }
64
+ };
65
+ window.addEventListener("mousedown", onClickOutside);
66
+ return () => window.removeEventListener("mousedown", onClickOutside);
67
+ }, []);
68
+ useEffect(() => {
69
+ if (datePickerWrapperRef.current) {
70
+ setPopupHeight(datePickerWrapperRef.current.getBoundingClientRect().height);
71
+ setPopupWidth(datePickerWrapperRef.current.getBoundingClientRect().width);
72
+ }
73
+ }, [targetRect]);
74
+ return {
75
+ selectedDate,
76
+ selectedTime,
77
+ startDate,
78
+ endDate,
79
+ targetRect,
80
+ popupHeight,
81
+ isFocusInput,
82
+ dateInputRef,
83
+ datePickerWrapperRef,
84
+ datePickerRef,
85
+ handleToggleDatePicker,
86
+ handleChangeDate,
87
+ handleChangeTime,
88
+ handleChangeDateRange,
89
+ handleFocusInput,
90
+ handleBlurInput,
91
+ calculatePositionWithScroll
92
+ };
93
+ };
94
+ export {
95
+ useDatePicker
96
+ };