@itilite/lumina-ui 1.1.12 → 1.1.14

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 (238) hide show
  1. package/dist/Avatar-DX2JwvAs.d.mts +17 -0
  2. package/dist/Avatar-DX2JwvAs.d.ts +17 -0
  3. package/dist/Tag-l7I5oeyk.d.mts +13 -0
  4. package/dist/Tag-l7I5oeyk.d.ts +13 -0
  5. package/dist/atom/Avatar/Avatar.d.mts +1 -9
  6. package/dist/atom/Avatar/Avatar.d.ts +1 -9
  7. package/dist/atom/Button/Button.js +1 -1
  8. package/dist/atom/Button/Button.mjs +1 -1
  9. package/dist/atom/Modal/Modal.js +1 -1
  10. package/dist/atom/Modal/Modal.mjs +2 -2
  11. package/dist/atom/RangePicker/RangePicker.mjs +2 -2
  12. package/dist/atom/Tag/Tag.d.mts +3 -10
  13. package/dist/atom/Tag/Tag.d.ts +3 -10
  14. package/dist/chunk-3S4X3YO2.mjs +64 -0
  15. package/dist/chunk-3XUHGVYA.mjs +77 -0
  16. package/dist/chunk-DLLT6V65.mjs +141 -0
  17. package/dist/chunk-I5VHKSQR.mjs +64 -0
  18. package/dist/chunk-N2WTNCQU.mjs +66 -0
  19. package/dist/chunk-N3YFQDW7.mjs +77 -0
  20. package/dist/chunk-QWK3MYDM.mjs +64 -0
  21. package/dist/chunk-SWRFCTJW.mjs +77 -0
  22. package/dist/chunk-UTMZY37A.mjs +141 -0
  23. package/dist/chunk-UUEPD2FH.mjs +141 -0
  24. package/dist/index.d.mts +3 -0
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.js +57 -3
  27. package/dist/index.mjs +23 -19
  28. package/dist/molecules/UserProfile/UserProfile.d.mts +23 -0
  29. package/dist/molecules/UserProfile/UserProfile.d.ts +23 -0
  30. package/dist/molecules/UserProfile/UserProfile.js +243 -0
  31. package/dist/molecules/UserProfile/UserProfile.mjs +11 -0
  32. package/dist/styles.css +251 -243
  33. package/dist/types-D4MD2w3_.d.mts +9 -0
  34. package/dist/types-D4MD2w3_.d.ts +9 -0
  35. package/dist/types-mhQmqhsR.d.mts +10 -0
  36. package/dist/types-mhQmqhsR.d.ts +10 -0
  37. package/package.json +1 -1
  38. package/dist/chunk-22VF7AVT.mjs +0 -618
  39. package/dist/chunk-2BNAAOBU.mjs +0 -670
  40. package/dist/chunk-2IMRLK6M.mjs +0 -44
  41. package/dist/chunk-2JIINZEK.mjs +0 -618
  42. package/dist/chunk-2LBFKQDZ.mjs +0 -660
  43. package/dist/chunk-2QQU6BYR.mjs +0 -678
  44. package/dist/chunk-2ZJBF5C4.mjs +0 -618
  45. package/dist/chunk-33JITG5Y.mjs +0 -621
  46. package/dist/chunk-3AWYHB3A.mjs +0 -618
  47. package/dist/chunk-3IMCN4K3.mjs +0 -670
  48. package/dist/chunk-3K2RTVMH.mjs +0 -584
  49. package/dist/chunk-3KBQQCET.mjs +0 -674
  50. package/dist/chunk-3KUHXNFH.mjs +0 -678
  51. package/dist/chunk-3PPNOIXN.mjs +0 -618
  52. package/dist/chunk-3WWAOBS6.mjs +0 -633
  53. package/dist/chunk-3XFY3TXJ.mjs +0 -611
  54. package/dist/chunk-3XW7HS5W.mjs +0 -618
  55. package/dist/chunk-3YDCRJYV.mjs +0 -618
  56. package/dist/chunk-447HZYZ4.mjs +0 -612
  57. package/dist/chunk-46F3B4U6.mjs +0 -618
  58. package/dist/chunk-4K5RZHL4.mjs +0 -618
  59. package/dist/chunk-4QHFP4YD.mjs +0 -666
  60. package/dist/chunk-4TFX4DHY.mjs +0 -702
  61. package/dist/chunk-4TWO6JES.mjs +0 -666
  62. package/dist/chunk-4UQVJ3ZU.mjs +0 -666
  63. package/dist/chunk-5247J65D.mjs +0 -670
  64. package/dist/chunk-57YKBWEI.mjs +0 -673
  65. package/dist/chunk-5BBLW4MR.mjs +0 -670
  66. package/dist/chunk-5PFI6XBL.mjs +0 -618
  67. package/dist/chunk-66H5WSEJ.mjs +0 -618
  68. package/dist/chunk-6NZEDJ2M.mjs +0 -582
  69. package/dist/chunk-6OC6URNL.mjs +0 -73
  70. package/dist/chunk-6OGEXG5U.mjs +0 -618
  71. package/dist/chunk-6ROQXYVN.mjs +0 -672
  72. package/dist/chunk-6WNI6X5Q.mjs +0 -618
  73. package/dist/chunk-6XGVIU52.mjs +0 -679
  74. package/dist/chunk-72PPCN6D.mjs +0 -675
  75. package/dist/chunk-74EGXFNN.mjs +0 -618
  76. package/dist/chunk-77NCDGJA.mjs +0 -707
  77. package/dist/chunk-7L3WTWF3.mjs +0 -677
  78. package/dist/chunk-7NGBIPZT.mjs +0 -618
  79. package/dist/chunk-7NM4FNMQ.mjs +0 -666
  80. package/dist/chunk-7YBBSVUA.mjs +0 -672
  81. package/dist/chunk-7Z52UP7P.mjs +0 -618
  82. package/dist/chunk-AC6WC7OO.mjs +0 -618
  83. package/dist/chunk-B3LDL3KD.mjs +0 -670
  84. package/dist/chunk-B63IXC6M.mjs +0 -618
  85. package/dist/chunk-B65LGQ47.mjs +0 -666
  86. package/dist/chunk-B6MTRO54.mjs +0 -618
  87. package/dist/chunk-BJBP5XYB.mjs +0 -618
  88. package/dist/chunk-BKPTZNXK.mjs +0 -618
  89. package/dist/chunk-BLLSWPCC.mjs +0 -618
  90. package/dist/chunk-BOYB7REJ.mjs +0 -670
  91. package/dist/chunk-BP2D64XI.mjs +0 -618
  92. package/dist/chunk-BP4XS2GF.mjs +0 -585
  93. package/dist/chunk-BRT5IPGQ.mjs +0 -618
  94. package/dist/chunk-BTIIO2CP.mjs +0 -582
  95. package/dist/chunk-C2J3VBFZ.mjs +0 -670
  96. package/dist/chunk-CDOR7GQP.mjs +0 -618
  97. package/dist/chunk-CI2RMA4V.mjs +0 -612
  98. package/dist/chunk-CNN74G3M.mjs +0 -666
  99. package/dist/chunk-CNUIZOQJ.mjs +0 -669
  100. package/dist/chunk-CPBXPEST.mjs +0 -672
  101. package/dist/chunk-CPOZJCLV.mjs +0 -681
  102. package/dist/chunk-CVOLXLMU.mjs +0 -618
  103. package/dist/chunk-CWUCNC36.mjs +0 -666
  104. package/dist/chunk-CZBGN6GS.mjs +0 -612
  105. package/dist/chunk-D3APB62N.mjs +0 -618
  106. package/dist/chunk-D5B2TUSL.mjs +0 -591
  107. package/dist/chunk-D7TWXVL2.mjs +0 -674
  108. package/dist/chunk-DAZ53AD7.mjs +0 -671
  109. package/dist/chunk-DBY5U6IU.mjs +0 -618
  110. package/dist/chunk-DRNY4L7J.mjs +0 -618
  111. package/dist/chunk-DXTVU4M5.mjs +0 -618
  112. package/dist/chunk-DZBTD6QK.mjs +0 -666
  113. package/dist/chunk-E6UPDTDY.mjs +0 -611
  114. package/dist/chunk-EAK2IMM4.mjs +0 -37
  115. package/dist/chunk-EQT2Q2LW.mjs +0 -610
  116. package/dist/chunk-EWMCELQV.mjs +0 -670
  117. package/dist/chunk-EYKWBEHX.mjs +0 -612
  118. package/dist/chunk-FHLCFUP6.mjs +0 -666
  119. package/dist/chunk-FMPFLQZV.mjs +0 -670
  120. package/dist/chunk-G25YXZ74.mjs +0 -618
  121. package/dist/chunk-G6P5MKL3.mjs +0 -582
  122. package/dist/chunk-G7I4NT42.mjs +0 -720
  123. package/dist/chunk-GSG6ZC3R.mjs +0 -37
  124. package/dist/chunk-H3MQUFTJ.mjs +0 -618
  125. package/dist/chunk-HKZRLVBX.mjs +0 -618
  126. package/dist/chunk-HPDJYQXM.mjs +0 -663
  127. package/dist/chunk-HQALJGVT.mjs +0 -618
  128. package/dist/chunk-HTYOI6JT.mjs +0 -618
  129. package/dist/chunk-I5GBZ3UX.mjs +0 -676
  130. package/dist/chunk-IQHBVGA4.mjs +0 -677
  131. package/dist/chunk-IUTUCRDD.mjs +0 -611
  132. package/dist/chunk-IV4V55OA.mjs +0 -672
  133. package/dist/chunk-J2RAFKAD.mjs +0 -618
  134. package/dist/chunk-J327EMX2.mjs +0 -663
  135. package/dist/chunk-J3ZBXBJ2.mjs +0 -689
  136. package/dist/chunk-JCMSG75Q.mjs +0 -51
  137. package/dist/chunk-JEAZCSST.mjs +0 -676
  138. package/dist/chunk-JL34UFI7.mjs +0 -670
  139. package/dist/chunk-JTKSGGQM.mjs +0 -611
  140. package/dist/chunk-JZC2RRDH.mjs +0 -618
  141. package/dist/chunk-JZCHXA6R.mjs +0 -585
  142. package/dist/chunk-K3Y7VKT6.mjs +0 -670
  143. package/dist/chunk-KDR6M52K.mjs +0 -723
  144. package/dist/chunk-KEVXNUFG.mjs +0 -672
  145. package/dist/chunk-KH7D4ESJ.mjs +0 -584
  146. package/dist/chunk-KQBCWIIM.mjs +0 -618
  147. package/dist/chunk-KRYAP7NG.mjs +0 -670
  148. package/dist/chunk-KU655POK.mjs +0 -657
  149. package/dist/chunk-L55SLVNX.mjs +0 -618
  150. package/dist/chunk-LCRYOZEV.mjs +0 -618
  151. package/dist/chunk-LEPDKBT2.mjs +0 -709
  152. package/dist/chunk-LH55S6HJ.mjs +0 -618
  153. package/dist/chunk-LH7PP6V2.mjs +0 -618
  154. package/dist/chunk-LJMMYKE2.mjs +0 -618
  155. package/dist/chunk-LK5TROLL.mjs +0 -666
  156. package/dist/chunk-MDR7DAKM.mjs +0 -618
  157. package/dist/chunk-MJZLCWZ5.mjs +0 -666
  158. package/dist/chunk-MKZTEJLS.mjs +0 -612
  159. package/dist/chunk-MO7JTKPH.mjs +0 -618
  160. package/dist/chunk-MOD7MLCD.mjs +0 -64
  161. package/dist/chunk-MQCOQHHP.mjs +0 -618
  162. package/dist/chunk-MSM4KUBM.mjs +0 -618
  163. package/dist/chunk-MTIUER63.mjs +0 -676
  164. package/dist/chunk-MWC57EU6.mjs +0 -666
  165. package/dist/chunk-NBLV3UX5.mjs +0 -618
  166. package/dist/chunk-NLADSOJS.mjs +0 -618
  167. package/dist/chunk-NPMTWR3Y.mjs +0 -618
  168. package/dist/chunk-NQ6GKEO7.mjs +0 -670
  169. package/dist/chunk-NZSFYNUK.mjs +0 -618
  170. package/dist/chunk-OANBDTKG.mjs +0 -73
  171. package/dist/chunk-OCNF4O5U.mjs +0 -612
  172. package/dist/chunk-OCW5QSWA.mjs +0 -618
  173. package/dist/chunk-OMXQ6VML.mjs +0 -618
  174. package/dist/chunk-OQF7JZFS.mjs +0 -670
  175. package/dist/chunk-OT675HGC.mjs +0 -670
  176. package/dist/chunk-P47TCYKN.mjs +0 -618
  177. package/dist/chunk-P7TOGXPI.mjs +0 -672
  178. package/dist/chunk-PCAXXEEQ.mjs +0 -618
  179. package/dist/chunk-PDHMG7OZ.mjs +0 -672
  180. package/dist/chunk-PFGVOZGM.mjs +0 -618
  181. package/dist/chunk-PGAAFJOG.mjs +0 -576
  182. package/dist/chunk-PQSSDK3E.mjs +0 -618
  183. package/dist/chunk-PSESRID3.mjs +0 -681
  184. package/dist/chunk-PST7W3NG.mjs +0 -618
  185. package/dist/chunk-QGPBZ2YV.mjs +0 -664
  186. package/dist/chunk-QOPCJITC.mjs +0 -618
  187. package/dist/chunk-QSE52CRC.mjs +0 -618
  188. package/dist/chunk-QTP2QMPL.mjs +0 -669
  189. package/dist/chunk-QUZAACW5.mjs +0 -585
  190. package/dist/chunk-R47XX6IW.mjs +0 -611
  191. package/dist/chunk-RAWVG2MM.mjs +0 -618
  192. package/dist/chunk-RL6AEU6E.mjs +0 -612
  193. package/dist/chunk-RZ7V2KQZ.mjs +0 -621
  194. package/dist/chunk-S3CUYIE3.mjs +0 -585
  195. package/dist/chunk-T2Y6AXM5.mjs +0 -618
  196. package/dist/chunk-T7T4HCHH.mjs +0 -618
  197. package/dist/chunk-TED2WCDG.mjs +0 -618
  198. package/dist/chunk-TENXL4LK.mjs +0 -107
  199. package/dist/chunk-THT4ALWQ.mjs +0 -618
  200. package/dist/chunk-TJLIMMMB.mjs +0 -612
  201. package/dist/chunk-TNOJDLON.mjs +0 -611
  202. package/dist/chunk-TOR67IHH.mjs +0 -672
  203. package/dist/chunk-TOV7NVKM.mjs +0 -618
  204. package/dist/chunk-TSYMIRRN.mjs +0 -618
  205. package/dist/chunk-TTSRI4V7.mjs +0 -708
  206. package/dist/chunk-TWV2Z27S.mjs +0 -618
  207. package/dist/chunk-UBS3DTE5.mjs +0 -672
  208. package/dist/chunk-UBW6RYVF.mjs +0 -670
  209. package/dist/chunk-UFAFA6RV.mjs +0 -585
  210. package/dist/chunk-UJNUFKR5.mjs +0 -43
  211. package/dist/chunk-UPUD2FQL.mjs +0 -618
  212. package/dist/chunk-UUTSL2NM.mjs +0 -618
  213. package/dist/chunk-VAZZJOSJ.mjs +0 -618
  214. package/dist/chunk-VCWXOX2B.mjs +0 -618
  215. package/dist/chunk-VHCLEOHZ.mjs +0 -618
  216. package/dist/chunk-VTZSCGME.mjs +0 -666
  217. package/dist/chunk-W33KZ2XR.mjs +0 -618
  218. package/dist/chunk-W7J4GMPI.mjs +0 -618
  219. package/dist/chunk-WCYB5OTY.mjs +0 -618
  220. package/dist/chunk-WOVMTYDV.mjs +0 -612
  221. package/dist/chunk-WR3USBWK.mjs +0 -672
  222. package/dist/chunk-WXYQARQ6.mjs +0 -618
  223. package/dist/chunk-XE4LPYOW.mjs +0 -581
  224. package/dist/chunk-XSDANHCE.mjs +0 -618
  225. package/dist/chunk-Y6XKW4NG.mjs +0 -618
  226. package/dist/chunk-YCAOWGDP.mjs +0 -618
  227. package/dist/chunk-YO5EDEA6.mjs +0 -618
  228. package/dist/chunk-YQSNJFZE.mjs +0 -618
  229. package/dist/chunk-Z6VG6AG7.mjs +0 -678
  230. package/dist/chunk-ZAPKQ4C3.mjs +0 -678
  231. package/dist/chunk-ZCWDQNHL.mjs +0 -618
  232. package/dist/chunk-ZF5JBNCI.mjs +0 -618
  233. package/dist/chunk-ZN7BHWOF.mjs +0 -672
  234. package/dist/chunk-ZUMHWVMV.mjs +0 -585
  235. package/dist/chunk-ZUQJKA5J.mjs +0 -666
  236. package/dist/chunk-ZUUAXTPM.mjs +0 -618
  237. package/dist/chunk-ZWHWIGYQ.mjs +0 -618
  238. package/dist/{chunk-IIJUGDEJ.mjs → chunk-PSBEYGD4.mjs} +3 -3
@@ -1,618 +0,0 @@
1
- import {
2
- Chevron
3
- } from "./chunk-ZTRM4HZJ.mjs";
4
- import {
5
- Select_default
6
- } from "./chunk-VTZSCGME.mjs";
7
-
8
- // src/atom/RangePicker/RangePicker.tsx
9
- import { memo, useEffect, useRef, useState } from "react";
10
- import clsx from "clsx";
11
- import dayjs from "dayjs";
12
-
13
- // src/atom/RangePicker/RangePicker.module.scss
14
- var RangePicker_module_default = { "range_start": "RangePicker-module__range_start___hGQp-", "range_end": "RangePicker-module__range_end___JJNib" };
15
-
16
- // src/atom/RangePicker/RangePicker.tsx
17
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
18
- function CustomRangePicker(props) {
19
- var _a, _b;
20
- const {
21
- id = "",
22
- footer,
23
- onChange = () => {
24
- },
25
- dateRange = ["", ""],
26
- showNightCount = false,
27
- isRange = true,
28
- showYearDropdown = false,
29
- showSingleCalendar = false,
30
- disablePastDates = false,
31
- // New prop to control past date restriction
32
- minDate = null,
33
- // New prop for minimum allowed date
34
- maxDate = null,
35
- // New prop for maximum allowed date
36
- minYear = 1900,
37
- // Minimum year for dropdown
38
- maxYear = (/* @__PURE__ */ new Date()).getFullYear() + 10,
39
- // Maximum year for dropdown
40
- experience = "business",
41
- showToastError = () => {
42
- }
43
- } = props;
44
- const onChangeRef = useRef(onChange);
45
- useEffect(() => {
46
- onChangeRef.current = onChange;
47
- }, [onChange]);
48
- const getInitialDate = () => {
49
- if (dateRange[0]) {
50
- return new Date(dateRange[0]);
51
- }
52
- if (!minDate && !maxDate && !minYear && !maxYear) {
53
- return /* @__PURE__ */ new Date();
54
- }
55
- if (maxYear && maxYear !== (/* @__PURE__ */ new Date()).getFullYear()) {
56
- let targetDate = new Date(maxYear, 7, 1);
57
- if (maxDate) {
58
- const maxDateTime = new Date(maxDate);
59
- if (targetDate > maxDateTime) {
60
- targetDate = new Date(
61
- maxDateTime.getFullYear(),
62
- maxDateTime.getMonth(),
63
- 1
64
- );
65
- }
66
- }
67
- return targetDate;
68
- }
69
- if (minDate) {
70
- const minDateTime = new Date(minDate);
71
- minDateTime.setHours(0, 0, 0, 0);
72
- return minDateTime;
73
- }
74
- return /* @__PURE__ */ new Date();
75
- };
76
- const [currentDate, setCurrentDate] = useState(() => getInitialDate());
77
- const [startDate, setStartDate] = useState(
78
- dateRange[0] ? new Date(dateRange[0]) : null
79
- );
80
- const [endDate, setEndDate] = useState(
81
- dateRange[0] && dateRange[1] ? new Date(dateRange[1]) : null
82
- );
83
- const [hoverDate, setHoverDate] = useState(null);
84
- const [isSelectingEnd, setIsSelectingEnd] = useState(
85
- dateRange[0] && !dateRange[1] ? true : false
86
- );
87
- const [selectedDate, setSelectedDate] = useState(
88
- !isRange && dateRange[0] ? new Date(dateRange[0]) : null
89
- );
90
- const getDaysBetween = (start, end) => {
91
- if (!start || !end) return 0;
92
- const startDay = dayjs(start).startOf("day");
93
- const endDay = dayjs(end).startOf("day");
94
- return endDay.diff(startDay, "day");
95
- };
96
- const nightCount = Math.abs(getDaysBetween(startDate || endDate, hoverDate));
97
- const nightCountText = nightCount > 1 ? `${nightCount} nights` : "1 night";
98
- const today = /* @__PURE__ */ new Date();
99
- today.setHours(0, 0, 0, 0);
100
- const firstMonth = new Date(
101
- currentDate.getFullYear(),
102
- currentDate.getMonth(),
103
- 1
104
- );
105
- const secondMonth = new Date(
106
- currentDate.getFullYear(),
107
- currentDate.getMonth() + 1,
108
- 1
109
- );
110
- const monthNames = [
111
- "January",
112
- "February",
113
- "March",
114
- "April",
115
- "May",
116
- "June",
117
- "July",
118
- "August",
119
- "September",
120
- "October",
121
- "November",
122
- "December"
123
- ];
124
- const dayNames = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
125
- const generateYearOptions = () => {
126
- const years = [];
127
- for (let i = minYear; i <= maxYear; i++) {
128
- const isYearDisabled = isYearCompletelyDisabled(i);
129
- years.push({
130
- label: i.toString(),
131
- value: i,
132
- disabled: isYearDisabled
133
- });
134
- }
135
- return years;
136
- };
137
- const isYearCompletelyDisabled = (year) => {
138
- const firstDayOfYear = new Date(year, 0, 1);
139
- const lastDayOfYear = new Date(year, 11, 31);
140
- if (minDate) {
141
- const minDateTime = new Date(minDate);
142
- minDateTime.setHours(0, 0, 0, 0);
143
- if (minDateTime > lastDayOfYear) {
144
- return true;
145
- }
146
- }
147
- if (maxDate) {
148
- const maxDateTime = new Date(maxDate);
149
- maxDateTime.setHours(0, 0, 0, 0);
150
- if (maxDateTime < firstDayOfYear) {
151
- return true;
152
- }
153
- }
154
- if (disablePastDates) {
155
- const today2 = /* @__PURE__ */ new Date();
156
- today2.setHours(0, 0, 0, 0);
157
- if (lastDayOfYear < today2) {
158
- return true;
159
- }
160
- }
161
- return false;
162
- };
163
- const yearOptions = generateYearOptions();
164
- const generateCalendarDays = (monthDate) => {
165
- const year = monthDate.getFullYear();
166
- const month = monthDate.getMonth();
167
- const firstDay = new Date(year, month, 1);
168
- const lastDay = new Date(year, month + 1, 0);
169
- const daysInMonth = lastDay.getDate();
170
- const startingDayOfWeek = firstDay.getDay();
171
- const days = [];
172
- for (let i = 0; i < startingDayOfWeek; i++) {
173
- days.push(null);
174
- }
175
- for (let day = 1; day <= daysInMonth; day++) {
176
- days.push(new Date(year, month, day));
177
- }
178
- return days;
179
- };
180
- const formatDateKey = (date) => {
181
- if (!date) return "";
182
- return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
183
- };
184
- const isSameDate = (date1, date2) => {
185
- if (!date1 || !date2) return false;
186
- return formatDateKey(date1) === formatDateKey(date2);
187
- };
188
- const isDateDisabled = (date) => {
189
- if (!date) return false;
190
- const checkDate = new Date(date);
191
- checkDate.setHours(0, 0, 0, 0);
192
- if (disablePastDates && checkDate < today) {
193
- return true;
194
- }
195
- if (minDate) {
196
- const minDateTime = new Date(minDate);
197
- minDateTime.setHours(0, 0, 0, 0);
198
- if (checkDate < minDateTime) {
199
- return true;
200
- }
201
- }
202
- if (maxDate) {
203
- const maxDateTime = new Date(maxDate);
204
- maxDateTime.setHours(0, 0, 0, 0);
205
- if (checkDate > maxDateTime) {
206
- return true;
207
- }
208
- }
209
- return false;
210
- };
211
- const isDateInRange = (date) => {
212
- if (!isRange || !startDate || !date) return false;
213
- const compareDate = endDate || hoverDate;
214
- if (!compareDate) return false;
215
- const start = startDate < compareDate ? startDate : compareDate;
216
- const end = startDate < compareDate ? compareDate : startDate;
217
- return date >= start && date <= end;
218
- };
219
- const isDateBetweenRange = (date) => {
220
- if (!isRange || !startDate || !date) return false;
221
- const compareDate = endDate || hoverDate;
222
- if (!compareDate) return false;
223
- const start = startDate < compareDate ? startDate : compareDate;
224
- const end = startDate < compareDate ? compareDate : startDate;
225
- return date > start && date < end;
226
- };
227
- const handleDateClick = (date) => {
228
- if (isDateDisabled(date)) return;
229
- if (!isRange) {
230
- setSelectedDate(date);
231
- return;
232
- }
233
- const isCheckinCheckoutSame = dayjs(date).format("D MMM, YYYY") === dayjs(startDate).format("D MMM, YYYY");
234
- if (showNightCount && isCheckinCheckoutSame) {
235
- setStartDate(null);
236
- setEndDate(null);
237
- setIsSelectingEnd(false);
238
- setHoverDate(null);
239
- showToastError("Check-in and check-out dates cannot be the same.");
240
- return;
241
- }
242
- if (!startDate || startDate && endDate) {
243
- setStartDate(date);
244
- setEndDate(null);
245
- setIsSelectingEnd(true);
246
- setHoverDate(null);
247
- } else if (startDate && !endDate) {
248
- if (date < startDate) {
249
- setEndDate(startDate);
250
- setStartDate(date);
251
- } else {
252
- setEndDate(date);
253
- }
254
- setIsSelectingEnd(false);
255
- setHoverDate(null);
256
- }
257
- };
258
- useEffect(() => {
259
- if (isRange) {
260
- sessionStorage.removeItem("rangePickerStartDate");
261
- onChangeRef.current(null, [
262
- startDate ? dayjs(startDate).format("D MMM, YYYY") : "",
263
- endDate ? dayjs(endDate).format("D MMM, YYYY") : ""
264
- ]);
265
- }
266
- if (isRange && startDate && !endDate) {
267
- sessionStorage.setItem(
268
- "rangePickerStartDate",
269
- dayjs(startDate).format("D MMM, YYYY")
270
- );
271
- }
272
- }, [startDate, endDate, isRange]);
273
- useEffect(() => {
274
- if (!isRange && selectedDate) {
275
- onChangeRef.current(null, dayjs(selectedDate).format("D MMM, YYYY"));
276
- }
277
- }, [selectedDate, isRange]);
278
- const handleDateHover = (date) => {
279
- if (isDateDisabled(date) || !isRange) return;
280
- if (isSelectingEnd && startDate && !endDate) {
281
- setHoverDate(date);
282
- }
283
- };
284
- const navigateMonth = (direction) => {
285
- const newDate = new Date(currentDate);
286
- newDate.setMonth(currentDate.getMonth() + direction);
287
- setCurrentDate(newDate);
288
- };
289
- const isPreviousMonthDisabled = () => {
290
- const previousMonth = new Date(currentDate);
291
- previousMonth.setMonth(currentDate.getMonth() - 1);
292
- const lastDayOfPreviousMonth = new Date(
293
- previousMonth.getFullYear(),
294
- previousMonth.getMonth() + 1,
295
- 0
296
- );
297
- return isDateDisabled(lastDayOfPreviousMonth);
298
- };
299
- const isNextMonthDisabled = () => {
300
- const nextMonth = new Date(currentDate);
301
- nextMonth.setMonth(currentDate.getMonth() + 1);
302
- const firstDayOfNextMonth = new Date(
303
- nextMonth.getFullYear(),
304
- nextMonth.getMonth(),
305
- 1
306
- );
307
- return isDateDisabled(firstDayOfNextMonth);
308
- };
309
- const handleYearChange = (selectedYear) => {
310
- const newDate = new Date(currentDate);
311
- newDate.setFullYear(selectedYear);
312
- const targetMonth = newDate.getMonth();
313
- if (!isMonthDisabled(selectedYear, targetMonth)) {
314
- setCurrentDate(newDate);
315
- } else {
316
- const firstAvailableMonth = findFirstAvailableMonth(selectedYear);
317
- if (firstAvailableMonth !== -1) {
318
- newDate.setMonth(firstAvailableMonth);
319
- setCurrentDate(newDate);
320
- }
321
- }
322
- };
323
- const isMonthDisabled = (year, month) => {
324
- const lastDayOfMonth = new Date(year, month + 1, 0);
325
- const firstDayOfMonth = new Date(year, month, 1);
326
- return isDateDisabled(lastDayOfMonth) && isDateDisabled(firstDayOfMonth);
327
- };
328
- const findFirstAvailableMonth = (year) => {
329
- for (let month = 0; month < 12; month++) {
330
- if (!isMonthDisabled(year, month)) {
331
- return month;
332
- }
333
- }
334
- return -1;
335
- };
336
- const isSameDay = ((_a = dayjs(startDate)) == null ? void 0 : _a.format("D MMM, YYYY")) === ((_b = dayjs(endDate)) == null ? void 0 : _b.format("D MMM, YYYY"));
337
- const NightCountTooltip = () => {
338
- const TooltipArrow = memo(() => {
339
- return /* @__PURE__ */ jsx("div", { className: "tw-w-3 tw-h-3 tw-flex tw-items-center tw-justify-center tw-rounded tw-bg-transparent tw-rotate-90", children: /* @__PURE__ */ jsx(
340
- "div",
341
- {
342
- style: {
343
- borderTop: "5px solid transparent",
344
- borderBottom: "5px solid transparent",
345
- borderLeft: "8px solid black"
346
- }
347
- }
348
- ) });
349
- });
350
- return /* @__PURE__ */ jsxs("div", { className: "tw-absolute tw-bottom-11 tw-py-2 tw-bg-black tw-text-white tw-px-2 tw-rounded-lg tw-z-50 tw-text-xs tw-whitespace-nowrap tw-opacity-0 tw-pointer-events-none group-hover:tw-opacity-100 tw-transition-opacity tw-duration-200", children: [
351
- nightCountText,
352
- /* @__PURE__ */ jsx("div", { className: "tw-absolute tw-right-[42%] tw-bottom-[-7px]", children: /* @__PURE__ */ jsx(TooltipArrow, {}) })
353
- ] });
354
- };
355
- const renderCalendar = (monthDate, isSecondCalendar = false) => {
356
- const days = generateCalendarDays(monthDate);
357
- const monthName = monthNames[monthDate.getMonth()];
358
- const year = monthDate.getFullYear();
359
- return /* @__PURE__ */ jsxs(
360
- "div",
361
- {
362
- className: clsx("tw-flex-1 tw-max-w-[83vw] tw-mb-2", {
363
- "tw-h-[320px]": showYearDropdown || days.length > 35,
364
- "tw-h-[290px]": !showYearDropdown || days.length <= 35
365
- }),
366
- children: [
367
- /* @__PURE__ */ jsx("div", { className: "tw-text-center tw-mb-4 sm:tw-mt-0", children: /* @__PURE__ */ jsxs("div", { className: " tw-flex tw-justify-center tw-items-center tw-gap-4 ", children: [
368
- /* @__PURE__ */ jsxs("h3", { className: "tw-typography-footNoteBold tw-text-color-text-default tw-m-0", children: [
369
- monthName,
370
- " ",
371
- !showYearDropdown && ` ${year}`
372
- ] }),
373
- showYearDropdown && /* @__PURE__ */ jsx(
374
- Select_default,
375
- {
376
- options: yearOptions,
377
- value: currentDate.getFullYear(),
378
- valueSelected: currentDate.getFullYear(),
379
- onChange: (selectedYear) => {
380
- if (typeof selectedYear === "number") {
381
- handleYearChange(selectedYear);
382
- }
383
- },
384
- className: "tw-min-w-fit tw-bg-transparent tw-typography-footNoteBold tw-text-color-text-default",
385
- size: "small",
386
- variant: "filled",
387
- style: { width: "80px" },
388
- id: `${id}-year-select`,
389
- allowClear: false,
390
- enableSearch: false,
391
- experience
392
- }
393
- )
394
- ] }) }),
395
- /* @__PURE__ */ jsx("div", { className: "tw-grid tw-grid-cols-7 tw-mb-2", children: dayNames.map((day) => /* @__PURE__ */ jsx(
396
- "div",
397
- {
398
- className: "tw-py-2 tw-px-0 tw-text-center tw-typography-caption2 tw-text-[#6B7280]",
399
- children: day
400
- },
401
- day
402
- )) }),
403
- /* @__PURE__ */ jsx("div", { className: "tw-grid tw-grid-cols-7", children: days.map((date, index) => {
404
- if (!date) {
405
- return /* @__PURE__ */ jsx("div", { className: "tw-h-10" }, index);
406
- }
407
- const isStart = isRange ? isSameDate(date, startDate) : false;
408
- const isEnd = isRange ? isSameDate(date, endDate) : false;
409
- const isSelected = !isRange ? isSameDate(date, selectedDate) : false;
410
- const isInRange = isRange ? isDateBetweenRange(date) : false;
411
- const isHovering = isRange && isSelectingEnd && hoverDate && isDateInRange(date) && !isStart && !isEnd;
412
- const isDisabled = isDateDisabled(date);
413
- let className = "tw-relative tw-z-20 tw-h-10 tw-w-10 tw-flex tw-items-center tw-justify-center tw-typography-caption1Bold ";
414
- const isFirstInRow = index % 7 === 0;
415
- const isLastInRow = index % 7 === 6;
416
- let pseudoClass = "";
417
- if (isDisabled) {
418
- className += "tw-text-gray-300 tw-cursor-not-allowed ";
419
- } else {
420
- className += "tw-cursor-pointer ";
421
- if (isStart || isEnd || isSelected) {
422
- className += "tw-bg-black tw-z-[21] tw-text-white tw-font-medium tw-rounded-full ";
423
- } else if (isInRange) {
424
- className += "tw-text-gray-900";
425
- if (window.innerWidth < 640) {
426
- className = className.replace(
427
- "tw-w-10",
428
- "tw-pr-2 tw-w-[50px] sm:tw-w-10 sm:tw-pr-0"
429
- );
430
- }
431
- pseudoClass = clsx(RangePicker_module_default.range_start, RangePicker_module_default.range_end);
432
- } else {
433
- className += "tw-text-gray-700 hover:tw-border-2 hover:tw-border-black tw-rounded-full hover:tw-border-solid ";
434
- }
435
- if (isHovering) {
436
- className += "tw-border-2 tw-border-gray-400 tw-bg-white tw-z-[22]";
437
- }
438
- }
439
- const titleDate = dayjs(date).format("YYYY-MM-DD");
440
- const hoverDateFormatted = dayjs(hoverDate || null).format(
441
- "YYYY-MM-DD"
442
- );
443
- const isHoveringDate = dayjs(hoverDateFormatted).isSame(
444
- dayjs(date),
445
- "day"
446
- );
447
- const isHoverDateGreater = dayjs(hoverDate).isAfter(
448
- dayjs(startDate),
449
- "day"
450
- );
451
- const isHoverDateLess = dayjs(hoverDate).isBefore(
452
- dayjs(startDate),
453
- "day"
454
- );
455
- return /* @__PURE__ */ jsxs("div", { className: "tw-relative", children: [
456
- (isStart || isEnd) && startDate && endDate && !isSameDay && isRange && /* @__PURE__ */ jsx(
457
- "div",
458
- {
459
- className: clsx(
460
- "tw-w-9 tw-h-8 tw-bg-[#F2EFEC] tw-rotate-90 tw-absolute tw-z-10 tw-top-1",
461
- {
462
- "tw-left-5": isStart,
463
- "tw-right-5": isEnd,
464
- "tw-invisible": isFirstInRow && isEnd || isLastInRow && isStart
465
- }
466
- )
467
- }
468
- ),
469
- isHoveringDate && isHovering && /* @__PURE__ */ jsxs(Fragment, { children: [
470
- /* @__PURE__ */ jsx(
471
- "div",
472
- {
473
- className: clsx(
474
- "tw-w-9 tw-h-8 tw-bg-[#F2EFEC] tw-rotate-90 tw-absolute tw-z-10 tw-top-1",
475
- {
476
- "tw-right-5": isHoverDateGreater,
477
- "tw-left-5": isHoverDateLess,
478
- "tw-invisible": isFirstInRow && isHoverDateGreater || isLastInRow && isHoverDateLess
479
- }
480
- )
481
- }
482
- ),
483
- /* @__PURE__ */ jsx(
484
- "div",
485
- {
486
- className: clsx(
487
- "tw-w-[18px] tw-h-[40px] tw-bg-white tw-rounded-r-full tw-absolute tw-z-20",
488
- {
489
- "tw-left-5": isHoverDateLess,
490
- "tw-right-5 tw-rotate-180": isHoverDateGreater
491
- }
492
- )
493
- }
494
- )
495
- ] }),
496
- isStart && /* @__PURE__ */ jsxs(Fragment, { children: [
497
- /* @__PURE__ */ jsx(
498
- "div",
499
- {
500
- className: clsx(
501
- "tw-w-9 tw-h-8 tw-bg-[#F2EFEC] tw-rotate-90 tw-absolute tw-z-10 tw-top-1",
502
- {
503
- "tw-right-5": isHoverDateLess,
504
- "tw-left-5": isHoverDateGreater,
505
- "tw-invisible": isLastInRow
506
- }
507
- )
508
- }
509
- ),
510
- /* @__PURE__ */ jsx(
511
- "div",
512
- {
513
- className: clsx(
514
- "tw-w-[18px] tw-h-[40px] tw-bg-white tw-rounded-r-full tw-absolute tw-z-20",
515
- {
516
- "tw-left-5": isHoverDateGreater,
517
- "tw-right-5 tw-rotate-180": isHoverDateLess
518
- }
519
- )
520
- }
521
- )
522
- ] }),
523
- /* @__PURE__ */ jsxs(
524
- "div",
525
- {
526
- className: clsx(className, pseudoClass, "tw-group", {
527
- "tw-border-2 !tw-border-black tw-rounded-full tw-border-solid": dayjs(date).isSame(dayjs(hoverDate), "day")
528
- }),
529
- onClick: () => handleDateClick(date),
530
- onMouseEnter: () => handleDateHover(date),
531
- "data-date": titleDate,
532
- children: [
533
- showNightCount && isRange && isHovering && /* @__PURE__ */ jsx(NightCountTooltip, {}),
534
- date.getDate()
535
- ]
536
- }
537
- )
538
- ] }, formatDateKey(date));
539
- }) })
540
- ]
541
- }
542
- );
543
- };
544
- const arrowClasses = "tw-relative tw-top-3 sm:tw-top-0 tw-cursor-pointer tw-rounded-full tw-w-10 tw-h-10 tw-flex tw-justify-center hover:tw-bg-gray-100 tw-items-center";
545
- return /* @__PURE__ */ jsxs(
546
- "div",
547
- {
548
- className: clsx(
549
- "custom-range-picker tw-relative tw-bg-white tw-rounded-xl tw-pt-1 tw-px-0 tw-max-w-4xl tw-mx-auto tw-border tw-border-gray-200 tw-border-solid tw-w-full tw-max-h-[90vh] tw-overflow-y-auto",
550
- {
551
- "sm:tw-w-[640px]": !showSingleCalendar,
552
- "sm:tw-w-[330px]": showSingleCalendar
553
- }
554
- ),
555
- children: [
556
- /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-items-center tw-px-4 tw-justify-between tw-mb-4 tw-absolute tw-right-0 tw-left-0 tw-top-0.5 sm:tw-top-4 tw-w-auto", children: [
557
- !isPreviousMonthDisabled() && /* @__PURE__ */ jsx(
558
- "div",
559
- {
560
- className: clsx(arrowClasses, "tw-left-1"),
561
- onClick: () => navigateMonth(-1),
562
- id: "calendar-previous-month-button",
563
- children: /* @__PURE__ */ jsx(
564
- Chevron,
565
- {
566
- size: "medium",
567
- className: "tw-relative -tw-top-0.5 tw-right-0.5"
568
- }
569
- )
570
- }
571
- ),
572
- isPreviousMonthDisabled() && /* @__PURE__ */ jsx("div", { className: "tw-w-10 tw-h-10" }),
573
- !isNextMonthDisabled() && /* @__PURE__ */ jsx(
574
- "div",
575
- {
576
- className: clsx(arrowClasses, "tw-mt-[1px] tw-right-1"),
577
- onClick: () => navigateMonth(1),
578
- id: "calendar-next-month-button",
579
- children: /* @__PURE__ */ jsx(
580
- Chevron,
581
- {
582
- size: "medium",
583
- onClick: () => navigateMonth(1),
584
- className: "tw-rotate-180 tw-relative tw-top-0.5 tw-left-0.5"
585
- }
586
- )
587
- }
588
- ),
589
- isNextMonthDisabled() && /* @__PURE__ */ jsx("div", { className: "tw-w-10 tw-h-10" })
590
- ] }),
591
- /* @__PURE__ */ jsx("div", { className: "tw-flex tw-items-center tw-justify-between tw-px-6 tw-border-solid tw-border-color-gray-100 tw-border-b tw-border-t-0 tw-border-l-0 tw-border-r-0 tw-w-auto", children: /* @__PURE__ */ jsxs(
592
- "div",
593
- {
594
- className: clsx("tw-flex tw-w-full", {
595
- "tw-flex-col sm:tw-space-x-8 sm:tw-flex-row": isRange || !showSingleCalendar,
596
- "tw-justify-center": !isRange || showSingleCalendar,
597
- "tw-pt-4": showYearDropdown,
598
- // More space when year dropdown is visible
599
- "tw-pt-6": !showYearDropdown
600
- }),
601
- children: [
602
- renderCalendar(firstMonth),
603
- !showSingleCalendar && renderCalendar(secondMonth, true)
604
- ]
605
- }
606
- ) }),
607
- footer
608
- ]
609
- }
610
- );
611
- }
612
- CustomRangePicker.displayName = "RangePicker";
613
- var RangePicker_default = CustomRangePicker;
614
-
615
- export {
616
- CustomRangePicker,
617
- RangePicker_default
618
- };