tccd-ui 0.0.75 → 0.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/index.ts
@@ -188,8 +178,8 @@ function Checkbox({
188
178
  }
189
179
 
190
180
  // src/components/DatePicker.tsx
191
- var import_react_datepicker = __toESM(require("react-datepicker"));
192
- var import_react_datepicker2 = require("react-datepicker/dist/react-datepicker.css");
181
+ var import_react = require("react");
182
+ var import_react_dom = require("react-dom");
193
183
  var import_jsx_runtime3 = require("react/jsx-runtime");
194
184
  function DatePicker({
195
185
  label,
@@ -201,23 +191,13 @@ function DatePicker({
201
191
  minDate,
202
192
  maxDate
203
193
  }) {
204
- var _a, _b;
205
- const parseDate = (dateStr) => {
206
- if (!dateStr) return null;
207
- return new Date(dateStr);
208
- };
209
- const formatDate = (date) => {
210
- if (!date) return "";
211
- const year = date.getFullYear();
212
- const month = String(date.getMonth() + 1).padStart(2, "0");
213
- const day = String(date.getDate()).padStart(2, "0");
214
- return `${year}-${month}-${day}`;
215
- };
216
- const handleDateChange = (date) => {
217
- onChange(formatDate(date));
218
- };
219
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
220
- const years = Array.from({ length: 111 }, (_, i) => currentYear - 100 + i);
194
+ const [isOpen, setIsOpen] = (0, import_react.useState)(false);
195
+ const [currentMonth, setCurrentMonth] = (0, import_react.useState)((/* @__PURE__ */ new Date()).getMonth());
196
+ const [currentYear, setCurrentYear] = (0, import_react.useState)((/* @__PURE__ */ new Date()).getFullYear());
197
+ const [dropdownPosition, setDropdownPosition] = (0, import_react.useState)({ top: 0, left: 0, width: 0 });
198
+ const wrapperRef = (0, import_react.useRef)(null);
199
+ const buttonRef = (0, import_react.useRef)(null);
200
+ const dropdownRef = (0, import_react.useRef)(null);
221
201
  const months = [
222
202
  "January",
223
203
  "February",
@@ -232,118 +212,210 @@ function DatePicker({
232
212
  "November",
233
213
  "December"
234
214
  ];
235
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-col w-full datepicker-wrapper", children: [
236
- label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: "text-label dark:text-gray-200 text-[14px] md:text-[15px] lg:text-[16px] mb-2 font-semibold", children: label }),
237
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative", children: [
238
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
239
- import_react_datepicker.default,
240
- {
241
- id,
242
- selected: parseDate(value),
243
- onChange: handleDateChange,
244
- disabled,
245
- minDate: minDate ? (_a = parseDate(minDate)) != null ? _a : void 0 : void 0,
246
- maxDate: maxDate ? (_b = parseDate(maxDate)) != null ? _b : void 0 : void 0,
247
- dateFormat: "yyyy-MM-dd",
248
- placeholderText: "Select a date",
249
- showYearDropdown: true,
250
- showMonthDropdown: true,
251
- dropdownMode: "select",
252
- yearDropdownItemNumber: 111,
253
- scrollableYearDropdown: true,
254
- renderCustomHeader: ({
255
- date,
256
- changeYear,
257
- changeMonth,
258
- decreaseMonth,
259
- increaseMonth,
260
- prevMonthButtonDisabled,
261
- nextMonthButtonDisabled
262
- }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "datepicker-header", children: [
215
+ const years = Array.from({ length: 111 }, (_, i) => (/* @__PURE__ */ new Date()).getFullYear() - 100 + i);
216
+ const updateDropdownPosition = (0, import_react.useCallback)(() => {
217
+ if (buttonRef.current) {
218
+ const rect = buttonRef.current.getBoundingClientRect();
219
+ const spaceBelow = window.innerHeight - rect.bottom;
220
+ const dropdownHeight = 380;
221
+ const top = spaceBelow < dropdownHeight && rect.top > dropdownHeight ? rect.top - dropdownHeight + window.scrollY : rect.bottom + window.scrollY + 8;
222
+ setDropdownPosition({
223
+ top,
224
+ left: rect.left + window.scrollX,
225
+ width: Math.max(rect.width, 300)
226
+ });
227
+ }
228
+ }, []);
229
+ (0, import_react.useEffect)(() => {
230
+ if (isOpen) {
231
+ if (value) {
232
+ const date = new Date(value);
233
+ setCurrentMonth(date.getMonth());
234
+ setCurrentYear(date.getFullYear());
235
+ }
236
+ updateDropdownPosition();
237
+ }
238
+ }, [isOpen, value, updateDropdownPosition]);
239
+ (0, import_react.useEffect)(() => {
240
+ if (!isOpen) return;
241
+ const handlePositionUpdate = () => updateDropdownPosition();
242
+ window.addEventListener("scroll", handlePositionUpdate, true);
243
+ window.addEventListener("resize", handlePositionUpdate);
244
+ return () => {
245
+ window.removeEventListener("scroll", handlePositionUpdate, true);
246
+ window.removeEventListener("resize", handlePositionUpdate);
247
+ };
248
+ }, [isOpen, updateDropdownPosition]);
249
+ (0, import_react.useEffect)(() => {
250
+ const handleClickOutside = (event) => {
251
+ if (wrapperRef.current && !wrapperRef.current.contains(event.target) && dropdownRef.current && !dropdownRef.current.contains(event.target)) {
252
+ setIsOpen(false);
253
+ }
254
+ };
255
+ document.addEventListener("mousedown", handleClickOutside);
256
+ return () => document.removeEventListener("mousedown", handleClickOutside);
257
+ }, []);
258
+ const parseDate = (dateStr) => {
259
+ if (!dateStr) return null;
260
+ return new Date(dateStr);
261
+ };
262
+ const formatDate = (date) => {
263
+ const year = date.getFullYear();
264
+ const month = String(date.getMonth() + 1).padStart(2, "0");
265
+ const day = String(date.getDate()).padStart(2, "0");
266
+ return `${year}-${month}-${day}`;
267
+ };
268
+ const getDisplayValue = () => {
269
+ if (!value) return "Select a date";
270
+ return value;
271
+ };
272
+ const handleDateSelect = (day) => {
273
+ const selectedDate = new Date(currentYear, currentMonth, day);
274
+ if (minDate && selectedDate < new Date(minDate)) return;
275
+ if (maxDate && selectedDate > new Date(maxDate)) return;
276
+ onChange(formatDate(selectedDate));
277
+ setIsOpen(false);
278
+ };
279
+ const getDaysInMonth = (month, year) => {
280
+ return new Date(year, month + 1, 0).getDate();
281
+ };
282
+ const getFirstDayOfMonth = (month, year) => {
283
+ return new Date(year, month, 1).getDay();
284
+ };
285
+ const isDateDisabled = (day) => {
286
+ const date = new Date(currentYear, currentMonth, day);
287
+ if (minDate && date < new Date(minDate)) return true;
288
+ if (maxDate && date > new Date(maxDate)) return true;
289
+ return false;
290
+ };
291
+ const isDateSelected = (day) => {
292
+ if (!value) return false;
293
+ const selectedDate = parseDate(value);
294
+ if (!selectedDate) return false;
295
+ return selectedDate.getDate() === day && selectedDate.getMonth() === currentMonth && selectedDate.getFullYear() === currentYear;
296
+ };
297
+ const isToday = (day) => {
298
+ const today = /* @__PURE__ */ new Date();
299
+ return today.getDate() === day && today.getMonth() === currentMonth && today.getFullYear() === currentYear;
300
+ };
301
+ const prevMonth = () => {
302
+ if (currentMonth === 0) {
303
+ setCurrentMonth(11);
304
+ setCurrentYear(currentYear - 1);
305
+ } else {
306
+ setCurrentMonth(currentMonth - 1);
307
+ }
308
+ };
309
+ const nextMonth = () => {
310
+ if (currentMonth === 11) {
311
+ setCurrentMonth(0);
312
+ setCurrentYear(currentYear + 1);
313
+ } else {
314
+ setCurrentMonth(currentMonth + 1);
315
+ }
316
+ };
317
+ const renderCalendarDays = () => {
318
+ const daysInMonth = getDaysInMonth(currentMonth, currentYear);
319
+ const firstDay = getFirstDayOfMonth(currentMonth, currentYear);
320
+ const days = [];
321
+ for (let i = 0; i < firstDay; i++) {
322
+ days.push(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "calendar-day empty" }, `empty-${i}`));
323
+ }
324
+ for (let day = 1; day <= daysInMonth; day++) {
325
+ const isDisabled = isDateDisabled(day);
326
+ const isSelected = isDateSelected(day);
327
+ const isTodayDate = isToday(day);
328
+ days.push(
329
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
330
+ "button",
331
+ {
332
+ type: "button",
333
+ onClick: () => !isDisabled && handleDateSelect(day),
334
+ disabled: isDisabled,
335
+ className: `calendar-day ${isSelected ? "selected" : ""} ${isTodayDate ? "today" : ""} ${isDisabled ? "disabled" : ""}`,
336
+ children: day
337
+ },
338
+ day
339
+ )
340
+ );
341
+ }
342
+ return days;
343
+ };
344
+ const dropdownContent = isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
345
+ "div",
346
+ {
347
+ ref: dropdownRef,
348
+ className: "datepicker-dropdown-portal",
349
+ style: {
350
+ position: "absolute",
351
+ top: dropdownPosition.top,
352
+ left: dropdownPosition.left,
353
+ width: dropdownPosition.width,
354
+ zIndex: 99999
355
+ },
356
+ children: [
357
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "datepicker-header", children: [
358
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: prevMonth, className: "nav-button", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { className: "w-4 h-4 sm:w-5 sm:h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M15 19l-7-7 7-7" }) }) }),
359
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "selects-container", children: [
263
360
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
264
- "button",
361
+ "select",
265
362
  {
266
- type: "button",
267
- onClick: decreaseMonth,
268
- disabled: prevMonthButtonDisabled,
269
- className: "nav-button",
270
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
271
- "svg",
272
- {
273
- className: "w-5 h-5",
274
- fill: "none",
275
- stroke: "currentColor",
276
- viewBox: "0 0 24 24",
277
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
278
- "path",
279
- {
280
- strokeLinecap: "round",
281
- strokeLinejoin: "round",
282
- strokeWidth: "2",
283
- d: "M15 19l-7-7 7-7"
284
- }
285
- )
286
- }
287
- )
363
+ value: currentMonth,
364
+ onChange: (e) => setCurrentMonth(Number(e.target.value)),
365
+ className: "month-select",
366
+ children: months.map((month, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: index, children: month }, month))
288
367
  }
289
368
  ),
290
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "selects-container", children: [
291
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
292
- "select",
293
- {
294
- value: months[date.getMonth()],
295
- onChange: ({ target: { value: value2 } }) => changeMonth(months.indexOf(value2)),
296
- className: "month-select",
297
- children: months.map((month) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: month, children: month }, month))
298
- }
299
- ),
300
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
301
- "select",
302
- {
303
- value: date.getFullYear(),
304
- onChange: ({ target: { value: value2 } }) => changeYear(Number(value2)),
305
- className: "year-select",
306
- children: years.map((year) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: year, children: year }, year))
307
- }
308
- )
309
- ] }),
310
369
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
311
- "button",
370
+ "select",
312
371
  {
313
- type: "button",
314
- onClick: increaseMonth,
315
- disabled: nextMonthButtonDisabled,
316
- className: "nav-button",
317
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
318
- "svg",
319
- {
320
- className: "w-5 h-5",
321
- fill: "none",
322
- stroke: "currentColor",
323
- viewBox: "0 0 24 24",
324
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
325
- "path",
326
- {
327
- strokeLinecap: "round",
328
- strokeLinejoin: "round",
329
- strokeWidth: "2",
330
- d: "M9 5l7 7-7 7"
331
- }
332
- )
333
- }
334
- )
372
+ value: currentYear,
373
+ onChange: (e) => setCurrentYear(Number(e.target.value)),
374
+ className: "year-select",
375
+ children: years.map((year) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: year, children: year }, year))
335
376
  }
336
377
  )
337
378
  ] }),
338
- className: `w-full border-contrast rounded-full px-4 md:px-5 py-2 border outline-none ${error ? "border-red-300 focus:border-red-500 focus:ring-red-500/30 dark:border-red-700 dark:focus:border-red-600" : "focus:border-primary dark:focus:border-primary"} ${disabled ? "bg-gray-100 dark:bg-gray-700 cursor-not-allowed opacity-60" : "bg-white dark:bg-gray-900"} transition-all duration-300 ease-in-out text-sm pr-10 dark:text-white dark:border-gray-700`,
339
- wrapperClassName: "w-full",
340
- popperClassName: "datepicker-popper"
379
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: nextMonth, className: "nav-button", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { className: "w-4 h-4 sm:w-5 sm:h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M9 5l7 7-7 7" }) }) })
380
+ ] }),
381
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "day-names", children: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"].map((day) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "day-name", children: day }, day)) }),
382
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "calendar-grid", children: renderCalendarDays() }),
383
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
384
+ "button",
385
+ {
386
+ type: "button",
387
+ onClick: () => {
388
+ const today = /* @__PURE__ */ new Date();
389
+ setCurrentMonth(today.getMonth());
390
+ setCurrentYear(today.getFullYear());
391
+ handleDateSelect(today.getDate());
392
+ },
393
+ className: "today-button",
394
+ children: "Today"
395
+ }
396
+ )
397
+ ]
398
+ }
399
+ );
400
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-col w-full datepicker-wrapper", ref: wrapperRef, children: [
401
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: "text-label dark:text-gray-200 text-[12px] sm:text-[13px] md:text-[14px] lg:text-[15px] xl:text-[16px] mb-1 sm:mb-2 font-semibold", children: label }),
402
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative", children: [
403
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
404
+ "button",
405
+ {
406
+ ref: buttonRef,
407
+ id,
408
+ type: "button",
409
+ onClick: () => !disabled && setIsOpen(!isOpen),
410
+ disabled,
411
+ className: `w-full border-contrast rounded-full px-3 sm:px-4 md:px-5 py-1.5 sm:py-2 border outline-none text-left text-xs sm:text-sm ${error ? "border-red-300 focus:border-red-500 focus:ring-red-500/30 dark:border-red-700 dark:focus:border-red-600" : "focus:border-primary dark:focus:border-primary"} ${disabled ? "bg-gray-100 dark:bg-gray-700 cursor-not-allowed opacity-60" : "bg-white dark:bg-gray-900 cursor-pointer"} transition-all duration-300 ease-in-out pr-8 sm:pr-10 dark:text-white dark:border-gray-700`,
412
+ children: getDisplayValue()
341
413
  }
342
414
  ),
343
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
415
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "absolute right-2 sm:right-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
344
416
  "svg",
345
417
  {
346
- className: `w-5 h-5 ${disabled ? "text-gray-400 dark:text-gray-600" : "text-secondary dark:text-blue-400"}`,
418
+ className: `w-4 h-4 sm:w-5 sm:h-5 ${disabled ? "text-gray-400 dark:text-gray-600" : "text-secondary dark:text-blue-400"}`,
347
419
  "aria-hidden": "true",
348
420
  xmlns: "http://www.w3.org/2000/svg",
349
421
  fill: "none",
@@ -359,286 +431,278 @@ function DatePicker({
359
431
  }
360
432
  )
361
433
  }
362
- ) })
434
+ ) }),
435
+ isOpen && (0, import_react_dom.createPortal)(dropdownContent, document.body)
363
436
  ] }),
364
- error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-red-500 dark:text-red-400 text-sm font-medium mt-1", children: error }),
437
+ error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-red-500 dark:text-red-400 text-xs sm:text-sm font-medium mt-1", children: error }),
365
438
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: `
366
- /* Modern Professional DatePicker - Blue Theme (#295e7e) */
367
- .datepicker-wrapper .react-datepicker-wrapper {
368
- width: 100%;
369
- }
370
-
371
- .datepicker-wrapper .react-datepicker-popper {
372
- z-index: 50;
439
+ /* Modern Professional DatePicker - Blue Theme */
440
+ .datepicker-wrapper {
441
+ position: relative;
373
442
  }
374
443
 
375
- .datepicker-wrapper .react-datepicker {
376
- font-family: inherit;
377
- border: none;
378
- border-radius: 1.25rem;
444
+ .datepicker-dropdown-portal {
445
+ min-width: 280px;
446
+ max-width: 340px;
447
+ background: white;
448
+ border-radius: 1rem;
449
+ border: 1px solid #e5e7eb;
379
450
  box-shadow:
380
- 0 25px 50px -12px rgba(0, 0, 0, 0.25),
381
- 0 0 0 1px rgba(0, 0, 0, 0.05);
451
+ 0 25px 50px -12px rgba(0, 0, 0, 0.15),
452
+ 0 10px 20px -5px rgba(0, 0, 0, 0.1);
382
453
  overflow: hidden;
383
- background: white;
384
- }
385
-
386
- .datepicker-wrapper .react-datepicker__month-container {
387
- background: white;
454
+ animation: slideDown 0.2s ease-out;
388
455
  }
389
456
 
390
- /* Custom Header */
391
- .datepicker-wrapper .react-datepicker__header {
392
- background: transparent;
393
- border: none;
394
- padding: 0;
457
+ @media (min-width: 640px) {
458
+ .datepicker-dropdown-portal {
459
+ min-width: 320px;
460
+ max-width: 380px;
461
+ border-radius: 1.25rem;
462
+ }
395
463
  }
396
464
 
397
- .datepicker-wrapper .react-datepicker__header--custom {
398
- padding: 0;
465
+ @keyframes slideDown {
466
+ from {
467
+ opacity: 0;
468
+ transform: translateY(-10px);
469
+ }
470
+ to {
471
+ opacity: 1;
472
+ transform: translateY(0);
473
+ }
399
474
  }
400
475
 
401
- .datepicker-wrapper .datepicker-header {
476
+ .datepicker-dropdown-portal .datepicker-header {
402
477
  display: flex;
403
478
  align-items: center;
404
479
  justify-content: space-between;
405
- padding: 1rem 0.75rem;
480
+ padding: 0.5rem;
406
481
  background: linear-gradient(135deg, #295e7e 0%, #1e4a63 100%);
407
- gap: 0.5rem;
482
+ gap: 0.25rem;
408
483
  }
409
484
 
410
- .datepicker-wrapper .nav-button {
485
+ @media (min-width: 640px) {
486
+ .datepicker-dropdown-portal .datepicker-header {
487
+ padding: 0.75rem;
488
+ gap: 0.5rem;
489
+ }
490
+ }
491
+
492
+ .datepicker-dropdown-portal .nav-button {
411
493
  display: flex;
412
494
  align-items: center;
413
495
  justify-content: center;
414
- width: 2.25rem;
415
- height: 2.25rem;
416
- border-radius: 0.75rem;
496
+ width: 1.75rem;
497
+ height: 1.75rem;
498
+ border-radius: 0.5rem;
417
499
  background: rgba(255, 255, 255, 0.15);
418
- backdrop-filter: blur(4px);
419
500
  border: 1px solid rgba(255, 255, 255, 0.2);
420
501
  color: white;
421
502
  cursor: pointer;
422
503
  transition: all 0.2s ease;
423
504
  }
424
505
 
425
- .datepicker-wrapper .nav-button:hover:not(:disabled) {
426
- background: rgba(255, 255, 255, 0.25);
427
- transform: scale(1.05);
506
+ @media (min-width: 640px) {
507
+ .datepicker-dropdown-portal .nav-button {
508
+ width: 2rem;
509
+ height: 2rem;
510
+ }
428
511
  }
429
512
 
430
- .datepicker-wrapper .nav-button:disabled {
431
- opacity: 0.4;
432
- cursor: not-allowed;
513
+ .datepicker-dropdown-portal .nav-button:hover {
514
+ background: rgba(255, 255, 255, 0.25);
433
515
  }
434
516
 
435
- .datepicker-wrapper .selects-container {
517
+ .datepicker-dropdown-portal .selects-container {
436
518
  display: flex;
437
- gap: 0.5rem;
519
+ gap: 0.25rem;
438
520
  flex: 1;
439
521
  justify-content: center;
440
522
  }
441
523
 
442
- .datepicker-wrapper .month-select,
443
- .datepicker-wrapper .year-select {
444
- padding: 0.5rem 0.75rem;
445
- border-radius: 0.625rem;
524
+ @media (min-width: 640px) {
525
+ .datepicker-dropdown-portal .selects-container {
526
+ gap: 0.5rem;
527
+ }
528
+ }
529
+
530
+ .datepicker-dropdown-portal .month-select,
531
+ .datepicker-dropdown-portal .year-select {
532
+ padding: 0.25rem 0.375rem;
533
+ border-radius: 0.375rem;
446
534
  background: rgba(255, 255, 255, 0.95);
447
535
  border: none;
448
- font-size: 0.875rem;
536
+ font-size: 0.7rem;
449
537
  font-weight: 600;
450
538
  color: #295e7e;
451
539
  cursor: pointer;
452
540
  outline: none;
453
- transition: all 0.2s ease;
454
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
455
541
  }
456
542
 
457
- .datepicker-wrapper .month-select:hover,
458
- .datepicker-wrapper .year-select:hover {
459
- background: white;
460
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
543
+ @media (min-width: 640px) {
544
+ .datepicker-dropdown-portal .month-select,
545
+ .datepicker-dropdown-portal .year-select {
546
+ padding: 0.375rem 0.5rem;
547
+ border-radius: 0.5rem;
548
+ font-size: 0.8rem;
549
+ }
461
550
  }
462
551
 
463
- .datepicker-wrapper .month-select:focus,
464
- .datepicker-wrapper .year-select:focus {
465
- box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
552
+ .datepicker-dropdown-portal .day-names {
553
+ display: grid;
554
+ grid-template-columns: repeat(7, 1fr);
555
+ background: linear-gradient(135deg, #3a7ca5 0%, #295e7e 100%);
556
+ padding: 0.375rem;
466
557
  }
467
558
 
468
- /* Day Names Row */
469
- .datepicker-wrapper .react-datepicker__day-names {
470
- background: linear-gradient(135deg, #3a7ca5 0%, #295e7e 100%);
471
- margin: 0;
472
- padding: 0.75rem 0.5rem;
473
- display: flex;
474
- justify-content: space-around;
559
+ @media (min-width: 640px) {
560
+ .datepicker-dropdown-portal .day-names {
561
+ padding: 0.5rem;
562
+ }
475
563
  }
476
564
 
477
- .datepicker-wrapper .react-datepicker__day-name {
478
- color: rgba(255, 255, 255, 0.9);
565
+ .datepicker-dropdown-portal .day-name {
566
+ text-align: center;
567
+ font-size: 0.6rem;
479
568
  font-weight: 600;
480
- font-size: 0.75rem;
569
+ color: rgba(255, 255, 255, 0.9);
481
570
  text-transform: uppercase;
482
571
  letter-spacing: 0.05em;
483
- width: 2.75rem;
484
- margin: 0;
485
572
  }
486
573
 
487
- /* Month Area */
488
- .datepicker-wrapper .react-datepicker__month {
489
- margin: 0;
490
- padding: 0.75rem;
574
+ @media (min-width: 640px) {
575
+ .datepicker-dropdown-portal .day-name {
576
+ font-size: 0.7rem;
577
+ }
491
578
  }
492
579
 
493
- .datepicker-wrapper .react-datepicker__week {
494
- display: flex;
495
- justify-content: space-around;
580
+ .datepicker-dropdown-portal .calendar-grid {
581
+ display: grid;
582
+ grid-template-columns: repeat(7, 1fr);
583
+ padding: 0.375rem;
584
+ gap: 0.125rem;
496
585
  }
497
586
 
498
- /* Day Cells */
499
- .datepicker-wrapper .react-datepicker__day {
500
- color: #374151;
587
+ @media (min-width: 640px) {
588
+ .datepicker-dropdown-portal .calendar-grid {
589
+ padding: 0.5rem;
590
+ }
591
+ }
592
+
593
+ .datepicker-dropdown-portal .calendar-day {
594
+ display: flex;
595
+ align-items: center;
596
+ justify-content: center;
597
+ width: 100%;
598
+ aspect-ratio: 1;
599
+ font-size: 0.85rem;
501
600
  font-weight: 500;
502
- font-size: 0.875rem;
503
- width: 2.75rem;
504
- height: 2.75rem;
505
- line-height: 2.75rem;
506
- margin: 0.125rem;
507
- border-radius: 0.75rem;
508
- transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
601
+ color: #374151;
602
+ background: transparent;
603
+ border: none;
604
+ border-radius: 0.5rem;
605
+ cursor: pointer;
606
+ transition: all 0.15s ease;
607
+ }
608
+
609
+ .datepicker-dropdown-portal .calendar-day.empty {
610
+ cursor: default;
509
611
  }
510
612
 
511
- .datepicker-wrapper .react-datepicker__day:hover {
613
+ .datepicker-dropdown-portal .calendar-day:not(.empty):not(.disabled):hover {
512
614
  background: #b8d4e8;
513
615
  color: #1e4a63;
514
- transform: scale(1.1);
515
- font-weight: 600;
516
616
  }
517
617
 
518
- .datepicker-wrapper .react-datepicker__day--selected,
519
- .datepicker-wrapper .react-datepicker__day--keyboard-selected {
618
+ .datepicker-dropdown-portal .calendar-day.selected {
520
619
  background: linear-gradient(135deg, #295e7e 0%, #1e4a63 100%) !important;
521
620
  color: white !important;
522
621
  font-weight: 700;
523
- box-shadow: 0 4px 14px rgba(41, 94, 126, 0.4);
524
- transform: scale(1.05);
525
- }
526
-
527
- .datepicker-wrapper .react-datepicker__day--selected:hover,
528
- .datepicker-wrapper .react-datepicker__day--keyboard-selected:hover {
529
- background: linear-gradient(135deg, #1e4a63 0%, #163a4f 100%) !important;
530
- transform: scale(1.15);
622
+ box-shadow: 0 2px 8px rgba(41, 94, 126, 0.3);
531
623
  }
532
624
 
533
- .datepicker-wrapper .react-datepicker__day--today {
534
- font-weight: 700;
625
+ .datepicker-dropdown-portal .calendar-day.today:not(.selected) {
535
626
  background: linear-gradient(135deg, #3a7ca5 0%, #4a8cb5 100%);
536
627
  color: white;
628
+ font-weight: 600;
537
629
  }
538
630
 
539
- .datepicker-wrapper .react-datepicker__day--today:hover {
540
- background: linear-gradient(135deg, #295e7e 0%, #3a7ca5 100%);
541
- color: white;
542
- }
543
-
544
- .datepicker-wrapper .react-datepicker__day--disabled {
631
+ .datepicker-dropdown-portal .calendar-day.disabled {
545
632
  color: #d1d5db;
546
633
  cursor: not-allowed;
547
- opacity: 0.5;
548
634
  }
549
635
 
550
- .datepicker-wrapper .react-datepicker__day--disabled:hover {
551
- background: transparent;
552
- transform: none;
553
- }
554
-
555
- .datepicker-wrapper .react-datepicker__day--outside-month {
556
- color: #d1d5db;
557
- }
558
-
559
- .datepicker-wrapper .react-datepicker__day--outside-month:hover {
560
- color: #9ca3af;
561
- }
562
-
563
- .datepicker-wrapper .react-datepicker__triangle {
564
- display: none;
636
+ .datepicker-dropdown-portal .today-button {
637
+ display: block;
638
+ width: calc(100% - 1rem);
639
+ margin: 0 0.5rem 0.5rem;
640
+ padding: 0.5rem;
641
+ background: linear-gradient(135deg, #295e7e 0%, #1e4a63 100%);
642
+ color: white;
643
+ font-weight: 600;
644
+ font-size: 0.85rem;
645
+ border: none;
646
+ border-radius: 0.5rem;
647
+ cursor: pointer;
648
+ transition: all 0.2s ease;
565
649
  }
566
650
 
567
- .datepicker-wrapper .react-datepicker__navigation {
568
- display: none;
651
+ .datepicker-dropdown-portal .today-button:hover {
652
+ transform: translateY(-1px);
653
+ box-shadow: 0 4px 12px rgba(41, 94, 126, 0.4);
569
654
  }
570
655
 
571
656
  /* ==================== DARK MODE ==================== */
572
- .dark .datepicker-wrapper .react-datepicker {
657
+ .dark .datepicker-dropdown-portal {
573
658
  background: #1f2937;
659
+ border-color: #374151;
574
660
  box-shadow:
575
661
  0 25px 50px -12px rgba(0, 0, 0, 0.5),
576
- 0 0 0 1px rgba(255, 255, 255, 0.1);
577
- }
578
-
579
- .dark .datepicker-wrapper .react-datepicker__month-container {
580
- background: #1f2937;
662
+ 0 10px 20px -5px rgba(0, 0, 0, 0.3);
581
663
  }
582
664
 
583
- .dark .datepicker-wrapper .datepicker-header {
665
+ .dark .datepicker-dropdown-portal .datepicker-header {
584
666
  background: linear-gradient(135deg, #295e7e 0%, #1e4a63 100%);
585
667
  }
586
668
 
587
- .dark .datepicker-wrapper .nav-button {
669
+ .dark .datepicker-dropdown-portal .nav-button {
588
670
  background: rgba(0, 0, 0, 0.2);
589
671
  border-color: rgba(255, 255, 255, 0.1);
590
672
  }
591
673
 
592
- .dark .datepicker-wrapper .nav-button:hover:not(:disabled) {
674
+ .dark .datepicker-dropdown-portal .nav-button:hover {
593
675
  background: rgba(0, 0, 0, 0.3);
594
676
  }
595
677
 
596
- .dark .datepicker-wrapper .month-select,
597
- .dark .datepicker-wrapper .year-select {
678
+ .dark .datepicker-dropdown-portal .month-select,
679
+ .dark .datepicker-dropdown-portal .year-select {
598
680
  background: #374151;
599
681
  color: #f9fafb;
600
682
  }
601
683
 
602
- .dark .datepicker-wrapper .month-select:hover,
603
- .dark .datepicker-wrapper .year-select:hover {
604
- background: #4b5563;
605
- }
606
-
607
- .dark .datepicker-wrapper .react-datepicker__day-names {
684
+ .dark .datepicker-dropdown-portal .day-names {
608
685
  background: linear-gradient(135deg, #3a7ca5 0%, #295e7e 100%);
609
686
  }
610
687
 
611
- .dark .datepicker-wrapper .react-datepicker__day {
688
+ .dark .datepicker-dropdown-portal .calendar-day {
612
689
  color: #e5e7eb;
613
690
  }
614
691
 
615
- .dark .datepicker-wrapper .react-datepicker__day:hover {
692
+ .dark .datepicker-dropdown-portal .calendar-day:not(.empty):not(.disabled):hover {
616
693
  background: #374151;
617
694
  color: white;
618
695
  }
619
696
 
620
- .dark .datepicker-wrapper .react-datepicker__day--today {
621
- background: linear-gradient(135deg, #3a7ca5 0%, #4a8cb5 100%);
622
- color: white;
623
- }
624
-
625
- .dark .datepicker-wrapper .react-datepicker__day--disabled {
697
+ .dark .datepicker-dropdown-portal .calendar-day.disabled {
626
698
  color: #6b7280;
627
699
  }
628
-
629
- .dark .datepicker-wrapper .react-datepicker__day--outside-month {
630
- color: #6b7280;
631
- }
632
-
633
- .dark .datepicker-wrapper .react-datepicker__day--outside-month:hover {
634
- color: #9ca3af;
635
- }
636
700
  ` })
637
701
  ] });
638
702
  }
639
703
 
640
704
  // src/components/DropdownMenu.tsx
641
- var import_react = require("react");
705
+ var import_react2 = require("react");
642
706
  var import_io5 = require("react-icons/io5");
643
707
  var import_jsx_runtime4 = require("react/jsx-runtime");
644
708
  function DropdownMenu({
@@ -652,10 +716,10 @@ function DropdownMenu({
652
716
  className = "",
653
717
  id
654
718
  }) {
655
- const [isOpen, setIsOpen] = (0, import_react.useState)(false);
656
- const dropdownRef = (0, import_react.useRef)(null);
719
+ const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
720
+ const dropdownRef = (0, import_react2.useRef)(null);
657
721
  const selectedOption = options.find((option) => option.value === value);
658
- (0, import_react.useEffect)(() => {
722
+ (0, import_react2.useEffect)(() => {
659
723
  const handleClickOutside = (event) => {
660
724
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
661
725
  setIsOpen(false);
@@ -720,7 +784,7 @@ function DropdownMenu({
720
784
  }
721
785
 
722
786
  // src/components/DropdownPopup.tsx
723
- var import_react2 = require("react");
787
+ var import_react3 = require("react");
724
788
  var import_jsx_runtime5 = require("react/jsx-runtime");
725
789
  var DropdownPopup = ({
726
790
  isOpen,
@@ -731,9 +795,9 @@ var DropdownPopup = ({
731
795
  triggerRef,
732
796
  alignToTrigger = false
733
797
  }) => {
734
- const menuRef = (0, import_react2.useRef)(null);
735
- const [menuOffset, setMenuOffset] = (0, import_react2.useState)({});
736
- (0, import_react2.useEffect)(() => {
798
+ const menuRef = (0, import_react3.useRef)(null);
799
+ const [menuOffset, setMenuOffset] = (0, import_react3.useState)({});
800
+ (0, import_react3.useEffect)(() => {
737
801
  if (!isOpen) return;
738
802
  const handleClickOutside = (event) => {
739
803
  if (menuRef.current && !menuRef.current.contains(event.target)) {
@@ -751,7 +815,7 @@ var DropdownPopup = ({
751
815
  document.removeEventListener("mousedown", handleClickOutside);
752
816
  };
753
817
  }, [isOpen, onClose, triggerRef]);
754
- (0, import_react2.useEffect)(() => {
818
+ (0, import_react3.useEffect)(() => {
755
819
  var _a;
756
820
  if (!isOpen || !alignToTrigger || !(triggerRef == null ? void 0 : triggerRef.current) || !menuRef.current) {
757
821
  setMenuOffset({});
@@ -876,17 +940,17 @@ function ErrorScreen({
876
940
  }
877
941
 
878
942
  // src/components/FullScreenDisplayer.tsx
879
- var import_react3 = require("react");
943
+ var import_react4 = require("react");
880
944
  var import_fa6 = require("react-icons/fa6");
881
945
  var import_fi = require("react-icons/fi");
882
946
  var import_jsx_runtime7 = require("react/jsx-runtime");
883
947
  function FullScreenViewer({ isOpen, items, index, setIndex, onClose }) {
884
- const startX = (0, import_react3.useRef)(null);
885
- const videoRef = (0, import_react3.useRef)(null);
886
- const containerRef = (0, import_react3.useRef)(null);
887
- const contentRef = (0, import_react3.useRef)(null);
888
- const [zoom, setZoom] = (0, import_react3.useState)(1);
889
- (0, import_react3.useEffect)(() => {
948
+ const startX = (0, import_react4.useRef)(null);
949
+ const videoRef = (0, import_react4.useRef)(null);
950
+ const containerRef = (0, import_react4.useRef)(null);
951
+ const contentRef = (0, import_react4.useRef)(null);
952
+ const [zoom, setZoom] = (0, import_react4.useState)(1);
953
+ (0, import_react4.useEffect)(() => {
890
954
  function onKey(e) {
891
955
  if (!open) return;
892
956
  e.preventDefault();
@@ -1069,7 +1133,7 @@ function InfoScreen({
1069
1133
  }
1070
1134
 
1071
1135
  // src/components/LazyImageLoader.tsx
1072
- var import_react4 = require("react");
1136
+ var import_react5 = require("react");
1073
1137
  var import_hi = require("react-icons/hi");
1074
1138
  var import_jsx_runtime10 = require("react/jsx-runtime");
1075
1139
  var LazyImageLoader = ({
@@ -1079,8 +1143,8 @@ var LazyImageLoader = ({
1079
1143
  width = "100%",
1080
1144
  height = "200px"
1081
1145
  }) => {
1082
- const [imageLoaded, setImageLoaded] = (0, import_react4.useState)(false);
1083
- const [imageError, setImageError] = (0, import_react4.useState)(false);
1146
+ const [imageLoaded, setImageLoaded] = (0, import_react5.useState)(false);
1147
+ const [imageError, setImageError] = (0, import_react5.useState)(false);
1084
1148
  const isVideo = (src == null ? void 0 : src.endsWith(".mp4")) || (src == null ? void 0 : src.endsWith(".webm")) || (src == null ? void 0 : src.endsWith(".mov")) || (src == null ? void 0 : src.endsWith(".avi")) || false;
1085
1149
  const handleImageLoad = () => {
1086
1150
  setImageLoaded(true);
@@ -1317,7 +1381,7 @@ var LoadingPage = () => {
1317
1381
  var LoadingPage_default = LoadingPage;
1318
1382
 
1319
1383
  // src/components/Modal.tsx
1320
- var import_react5 = require("react");
1384
+ var import_react6 = require("react");
1321
1385
  var import_lu = require("react-icons/lu");
1322
1386
  var import_jsx_runtime13 = require("react/jsx-runtime");
1323
1387
  var Modal = ({
@@ -1327,9 +1391,9 @@ var Modal = ({
1327
1391
  children,
1328
1392
  className
1329
1393
  }) => {
1330
- const modalRef = (0, import_react5.useRef)(null);
1331
- const previousFocusRef = (0, import_react5.useRef)(null);
1332
- (0, import_react5.useEffect)(() => {
1394
+ const modalRef = (0, import_react6.useRef)(null);
1395
+ const previousFocusRef = (0, import_react6.useRef)(null);
1396
+ (0, import_react6.useEffect)(() => {
1333
1397
  var _a, _b;
1334
1398
  if (isOpen) {
1335
1399
  previousFocusRef.current = document.activeElement;
@@ -1343,7 +1407,7 @@ var Modal = ({
1343
1407
  document.body.style.overflow = "unset";
1344
1408
  };
1345
1409
  }, [isOpen]);
1346
- (0, import_react5.useEffect)(() => {
1410
+ (0, import_react6.useEffect)(() => {
1347
1411
  const handleEscape = (e) => {
1348
1412
  if (e.key === "Escape" && isOpen) {
1349
1413
  onClose();
@@ -1398,7 +1462,7 @@ var Modal = ({
1398
1462
  var Modal_default = Modal;
1399
1463
 
1400
1464
  // src/components/NumberField.tsx
1401
- var import_react6 = require("react");
1465
+ var import_react7 = require("react");
1402
1466
  var import_jsx_runtime14 = require("react/jsx-runtime");
1403
1467
  function NumberField({
1404
1468
  label,
@@ -1409,7 +1473,7 @@ function NumberField({
1409
1473
  maxLength,
1410
1474
  id
1411
1475
  }) {
1412
- const [lengthError, setLengthError] = (0, import_react6.useState)(null);
1476
+ const [lengthError, setLengthError] = (0, import_react7.useState)(null);
1413
1477
  function handleChange(e) {
1414
1478
  const inputValue = e.target.value;
1415
1479
  if (maxLength && inputValue.length > maxLength) {
@@ -1436,7 +1500,7 @@ function NumberField({
1436
1500
  }
1437
1501
 
1438
1502
  // src/components/PasswordField.tsx
1439
- var import_react7 = require("react");
1503
+ var import_react8 = require("react");
1440
1504
  var import_lu2 = require("react-icons/lu");
1441
1505
  var import_jsx_runtime15 = require("react/jsx-runtime");
1442
1506
  function PasswordField({
@@ -1446,7 +1510,7 @@ function PasswordField({
1446
1510
  onChange,
1447
1511
  error
1448
1512
  }) {
1449
- const [show, setShow] = (0, import_react7.useState)(false);
1513
+ const [show, setShow] = (0, import_react8.useState)(false);
1450
1514
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col w-full", children: [
1451
1515
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: "text-label dark:text-gray-200 text-[14px] md:text-[15px] lg:text-[16px] mb-2 font-semibold", children: label }),
1452
1516
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative", children: [
@@ -1547,7 +1611,7 @@ function SuccessScreen({
1547
1611
  }
1548
1612
 
1549
1613
  // src/components/TextAreaField.tsx
1550
- var import_react8 = require("react");
1614
+ var import_react9 = require("react");
1551
1615
  var import_jsx_runtime19 = require("react/jsx-runtime");
1552
1616
  function TextAreaField({
1553
1617
  label,
@@ -1558,8 +1622,8 @@ function TextAreaField({
1558
1622
  maxLength,
1559
1623
  id
1560
1624
  }) {
1561
- const [lengthError, setLengthError] = (0, import_react8.useState)(null);
1562
- const textareaRef = (0, import_react8.useRef)(null);
1625
+ const [lengthError, setLengthError] = (0, import_react9.useState)(null);
1626
+ const textareaRef = (0, import_react9.useRef)(null);
1563
1627
  function handleChange(e) {
1564
1628
  const inputValue = e.target.value;
1565
1629
  if (maxLength && inputValue.length > maxLength) {
@@ -1613,7 +1677,8 @@ function TextDisplayEdit({ label, value, onChange, disabled = false, icon, place
1613
1677
  }
1614
1678
 
1615
1679
  // src/components/TimePicker.tsx
1616
- var import_react9 = require("react");
1680
+ var import_react10 = require("react");
1681
+ var import_react_dom2 = require("react-dom");
1617
1682
  var import_jsx_runtime21 = require("react/jsx-runtime");
1618
1683
  function TimePicker({
1619
1684
  label,
@@ -1624,12 +1689,32 @@ function TimePicker({
1624
1689
  disabled = false,
1625
1690
  use24Hour = false
1626
1691
  }) {
1627
- const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
1628
- const [tempHours, setTempHours] = (0, import_react9.useState)(12);
1629
- const [tempMinutes, setTempMinutes] = (0, import_react9.useState)(0);
1630
- const [tempPeriod, setTempPeriod] = (0, import_react9.useState)("AM");
1631
- const wrapperRef = (0, import_react9.useRef)(null);
1632
- (0, import_react9.useEffect)(() => {
1692
+ const [isOpen, setIsOpen] = (0, import_react10.useState)(false);
1693
+ const [tempHours, setTempHours] = (0, import_react10.useState)(12);
1694
+ const [tempMinutes, setTempMinutes] = (0, import_react10.useState)(0);
1695
+ const [tempPeriod, setTempPeriod] = (0, import_react10.useState)("AM");
1696
+ const [dropdownPosition, setDropdownPosition] = (0, import_react10.useState)({
1697
+ top: 0,
1698
+ left: 0,
1699
+ width: 0
1700
+ });
1701
+ const wrapperRef = (0, import_react10.useRef)(null);
1702
+ const buttonRef = (0, import_react10.useRef)(null);
1703
+ const dropdownRef = (0, import_react10.useRef)(null);
1704
+ const updateDropdownPosition = (0, import_react10.useCallback)(() => {
1705
+ if (buttonRef.current) {
1706
+ const rect = buttonRef.current.getBoundingClientRect();
1707
+ const spaceBelow = window.innerHeight - rect.bottom;
1708
+ const dropdownHeight = 400;
1709
+ const top = spaceBelow < dropdownHeight && rect.top > dropdownHeight ? rect.top - dropdownHeight + window.scrollY : rect.bottom + window.scrollY + 8;
1710
+ setDropdownPosition({
1711
+ top,
1712
+ left: rect.left + window.scrollX,
1713
+ width: Math.max(rect.width, 280)
1714
+ });
1715
+ }
1716
+ }, []);
1717
+ (0, import_react10.useEffect)(() => {
1633
1718
  if (isOpen && value) {
1634
1719
  const [h, m] = value.split(":").map(Number);
1635
1720
  if (use24Hour) {
@@ -1641,7 +1726,20 @@ function TimePicker({
1641
1726
  setTempMinutes(m);
1642
1727
  }
1643
1728
  }
1644
- }, [isOpen, value, use24Hour]);
1729
+ if (isOpen) {
1730
+ updateDropdownPosition();
1731
+ }
1732
+ }, [isOpen, value, use24Hour, updateDropdownPosition]);
1733
+ (0, import_react10.useEffect)(() => {
1734
+ if (!isOpen) return;
1735
+ const handlePositionUpdate = () => updateDropdownPosition();
1736
+ window.addEventListener("scroll", handlePositionUpdate, true);
1737
+ window.addEventListener("resize", handlePositionUpdate);
1738
+ return () => {
1739
+ window.removeEventListener("scroll", handlePositionUpdate, true);
1740
+ window.removeEventListener("resize", handlePositionUpdate);
1741
+ };
1742
+ }, [isOpen, updateDropdownPosition]);
1645
1743
  const formatTime = (h, m, p) => {
1646
1744
  let hour24 = h;
1647
1745
  if (!use24Hour) {
@@ -1657,9 +1755,9 @@ function TimePicker({
1657
1755
  onChange(formatTime(tempHours, tempMinutes, tempPeriod));
1658
1756
  setIsOpen(false);
1659
1757
  };
1660
- (0, import_react9.useEffect)(() => {
1758
+ (0, import_react10.useEffect)(() => {
1661
1759
  const handleClickOutside = (event) => {
1662
- if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
1760
+ if (wrapperRef.current && !wrapperRef.current.contains(event.target) && dropdownRef.current && !dropdownRef.current.contains(event.target)) {
1663
1761
  setIsOpen(false);
1664
1762
  }
1665
1763
  };
@@ -1676,46 +1774,24 @@ function TimePicker({
1676
1774
  };
1677
1775
  const hourOptions = use24Hour ? Array.from({ length: 24 }, (_, i) => i) : Array.from({ length: 12 }, (_, i) => i + 1);
1678
1776
  const minuteOptions = Array.from({ length: 60 }, (_, i) => i);
1679
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col w-full timepicker-wrapper", ref: wrapperRef, children: [
1680
- label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-label dark:text-gray-200 text-[14px] md:text-[15px] lg:text-[16px] mb-2 font-semibold", children: label }),
1681
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
1682
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1683
- "button",
1684
- {
1685
- id,
1686
- type: "button",
1687
- onClick: () => !disabled && setIsOpen(!isOpen),
1688
- disabled,
1689
- className: `w-full border-contrast rounded-full px-4 md:px-5 py-2 border outline-none text-left ${error ? "border-red-300 focus:border-red-500 focus:ring-red-500/30 dark:border-red-700 dark:focus:border-red-600" : "focus:border-primary dark:focus:border-primary"} ${disabled ? "bg-gray-100 dark:bg-gray-700 cursor-not-allowed opacity-60" : "bg-white dark:bg-gray-900 cursor-pointer"} transition-all duration-300 ease-in-out text-sm pr-10 dark:text-white dark:border-gray-700`,
1690
- children: getDisplayTime()
1691
- }
1692
- ),
1693
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1694
- "svg",
1695
- {
1696
- className: `w-5 h-5 ${disabled ? "text-gray-400 dark:text-gray-600" : "text-secondary dark:text-blue-400"}`,
1697
- "aria-hidden": "true",
1698
- xmlns: "http://www.w3.org/2000/svg",
1699
- fill: "none",
1700
- viewBox: "0 0 24 24",
1701
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1702
- "path",
1703
- {
1704
- stroke: "currentColor",
1705
- strokeLinecap: "round",
1706
- strokeLinejoin: "round",
1707
- strokeWidth: "2",
1708
- d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
1709
- }
1710
- )
1711
- }
1712
- ) }),
1713
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "timepicker-dropdown", children: [
1777
+ const dropdownContent = isOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1778
+ "div",
1779
+ {
1780
+ ref: dropdownRef,
1781
+ className: "timepicker-dropdown-portal",
1782
+ style: {
1783
+ position: "absolute",
1784
+ top: dropdownPosition.top,
1785
+ left: dropdownPosition.left,
1786
+ width: dropdownPosition.width,
1787
+ zIndex: 99999
1788
+ },
1789
+ children: [
1714
1790
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "timepicker-header", children: [
1715
1791
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1716
1792
  "svg",
1717
1793
  {
1718
- className: "w-5 h-5",
1794
+ className: "w-4 h-4 sm:w-5 sm:h-5",
1719
1795
  fill: "none",
1720
1796
  stroke: "currentColor",
1721
1797
  viewBox: "0 0 24 24",
@@ -1730,7 +1806,7 @@ function TimePicker({
1730
1806
  )
1731
1807
  }
1732
1808
  ),
1733
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Select Time" })
1809
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-sm sm:text-base", children: "Select Time" })
1734
1810
  ] }),
1735
1811
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "timepicker-display", children: [
1736
1812
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "time-value", children: String(tempHours).padStart(2, "0") }),
@@ -1790,20 +1866,55 @@ function TimePicker({
1790
1866
  ] })
1791
1867
  ] }),
1792
1868
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", onClick: handleDone, className: "done-button", children: "Done" })
1793
- ] })
1869
+ ]
1870
+ }
1871
+ );
1872
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col w-full timepicker-wrapper", ref: wrapperRef, children: [
1873
+ label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-label dark:text-gray-200 text-[12px] sm:text-[13px] md:text-[14px] lg:text-[15px] xl:text-[16px] mb-1 sm:mb-2 font-semibold", children: label }),
1874
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
1875
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1876
+ "button",
1877
+ {
1878
+ ref: buttonRef,
1879
+ id,
1880
+ type: "button",
1881
+ onClick: () => !disabled && setIsOpen(!isOpen),
1882
+ disabled,
1883
+ className: `w-full border-contrast rounded-full px-3 sm:px-4 md:px-5 py-1.5 sm:py-2 border outline-none text-left text-xs sm:text-sm ${error ? "border-red-300 focus:border-red-500 focus:ring-red-500/30 dark:border-red-700 dark:focus:border-red-600" : "focus:border-primary dark:focus:border-primary"} ${disabled ? "bg-gray-100 dark:bg-gray-700 cursor-not-allowed opacity-60" : "bg-white dark:bg-gray-900 cursor-pointer"} transition-all duration-300 ease-in-out pr-8 sm:pr-10 dark:text-white dark:border-gray-700`,
1884
+ children: getDisplayTime()
1885
+ }
1886
+ ),
1887
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "absolute right-2 sm:right-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1888
+ "svg",
1889
+ {
1890
+ className: `w-4 h-4 sm:w-5 sm:h-5 ${disabled ? "text-gray-400 dark:text-gray-600" : "text-secondary dark:text-blue-400"}`,
1891
+ "aria-hidden": "true",
1892
+ xmlns: "http://www.w3.org/2000/svg",
1893
+ fill: "none",
1894
+ viewBox: "0 0 24 24",
1895
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1896
+ "path",
1897
+ {
1898
+ stroke: "currentColor",
1899
+ strokeLinecap: "round",
1900
+ strokeLinejoin: "round",
1901
+ strokeWidth: "2",
1902
+ d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
1903
+ }
1904
+ )
1905
+ }
1906
+ ) }),
1907
+ isOpen && (0, import_react_dom2.createPortal)(dropdownContent, document.body)
1794
1908
  ] }),
1795
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-red-500 dark:text-red-400 text-sm font-medium mt-1", children: error }),
1909
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-red-500 dark:text-red-400 text-xs sm:text-sm font-medium mt-1", children: error }),
1796
1910
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("style", { children: `
1797
1911
  /* Modern Professional TimePicker - Blue Theme */
1798
1912
  .timepicker-wrapper {
1799
1913
  position: relative;
1800
1914
  }
1801
1915
 
1802
- .timepicker-dropdown {
1803
- position: absolute;
1804
- top: calc(100% + 8px);
1805
- left: 0;
1806
- right: 0;
1916
+ .timepicker-dropdown,
1917
+ .timepicker-dropdown-portal {
1807
1918
  min-width: 280px;
1808
1919
  background: white;
1809
1920
  border-radius: 1.25rem;
@@ -1812,10 +1923,17 @@ function TimePicker({
1812
1923
  0 25px 50px -12px rgba(0, 0, 0, 0.15),
1813
1924
  0 10px 20px -5px rgba(0, 0, 0, 0.1);
1814
1925
  overflow: hidden;
1815
- z-index: 50;
1816
1926
  animation: slideDown 0.2s ease-out;
1817
1927
  }
1818
1928
 
1929
+ .timepicker-dropdown {
1930
+ position: absolute;
1931
+ top: calc(100% + 8px);
1932
+ left: 0;
1933
+ right: 0;
1934
+ z-index: 50;
1935
+ }
1936
+
1819
1937
  @keyframes slideDown {
1820
1938
  from {
1821
1939
  opacity: 0;
@@ -1827,7 +1945,8 @@ function TimePicker({
1827
1945
  }
1828
1946
  }
1829
1947
 
1830
- .timepicker-header {
1948
+ .timepicker-dropdown .timepicker-header,
1949
+ .timepicker-dropdown-portal .timepicker-header {
1831
1950
  display: flex;
1832
1951
  align-items: center;
1833
1952
  justify-content: center;
@@ -1987,7 +2106,8 @@ function TimePicker({
1987
2106
  }
1988
2107
 
1989
2108
  /* ==================== DARK MODE ==================== */
1990
- .dark .timepicker-dropdown {
2109
+ .dark .timepicker-dropdown,
2110
+ .dark .timepicker-dropdown-portal {
1991
2111
  background: #1f2937;
1992
2112
  border-color: #374151;
1993
2113
  box-shadow:
@@ -1995,38 +2115,46 @@ function TimePicker({
1995
2115
  0 10px 20px -5px rgba(0, 0, 0, 0.3);
1996
2116
  }
1997
2117
 
1998
- .dark .timepicker-header {
2118
+ .dark .timepicker-dropdown .timepicker-header,
2119
+ .dark .timepicker-dropdown-portal .timepicker-header {
1999
2120
  background: #111827;
2000
2121
  border-bottom-color: #374151;
2001
2122
  color: #60a5fa;
2002
2123
  }
2003
2124
 
2004
- .dark .timepicker-display {
2125
+ .dark .timepicker-dropdown .timepicker-display,
2126
+ .dark .timepicker-dropdown-portal .timepicker-display {
2005
2127
  background: linear-gradient(135deg, #3a7ca5 0%, #295e7e 100%);
2006
2128
  }
2007
2129
 
2008
- .dark .column-label {
2130
+ .dark .timepicker-dropdown .column-label,
2131
+ .dark .timepicker-dropdown-portal .column-label {
2009
2132
  color: #9ca3af;
2010
2133
  }
2011
2134
 
2012
- .dark .column-scroll {
2135
+ .dark .timepicker-dropdown .column-scroll,
2136
+ .dark .timepicker-dropdown-portal .column-scroll {
2013
2137
  background: #374151;
2014
2138
  }
2015
2139
 
2016
- .dark .column-scroll::-webkit-scrollbar-thumb {
2140
+ .dark .timepicker-dropdown .column-scroll::-webkit-scrollbar-thumb,
2141
+ .dark .timepicker-dropdown-portal .column-scroll::-webkit-scrollbar-thumb {
2017
2142
  background: #6b7280;
2018
2143
  }
2019
2144
 
2020
- .dark .time-option {
2145
+ .dark .timepicker-dropdown .time-option,
2146
+ .dark .timepicker-dropdown-portal .time-option {
2021
2147
  color: #e5e7eb;
2022
2148
  }
2023
2149
 
2024
- .dark .time-option:hover {
2150
+ .dark .timepicker-dropdown .time-option:hover,
2151
+ .dark .timepicker-dropdown-portal .time-option:hover {
2025
2152
  background: #4b5563;
2026
2153
  color: white;
2027
2154
  }
2028
2155
 
2029
- .dark .time-option.selected {
2156
+ .dark .timepicker-dropdown .time-option.selected,
2157
+ .dark .timepicker-dropdown-portal .time-option.selected {
2030
2158
  background: linear-gradient(135deg, #3a7ca5 0%, #295e7e 100%);
2031
2159
  }
2032
2160
  ` })