lizaui 9.0.24 → 9.0.26

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.
@@ -14,7 +14,6 @@ import { twMerge } from "tailwind-merge";
14
14
  import { v4 } from "uuid";
15
15
  import { L as LabelError } from "../chunks/label-error-BTCuInp7.js";
16
16
  import { c as cn } from "../chunks/utils-H80jjgLf.js";
17
- import { B as Button } from "../chunks/button-B0fpJrMg.js";
18
17
  function FaArrowLeft(props) {
19
18
  return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z" }, "child": [] }] })(props);
20
19
  }
@@ -275,7 +274,7 @@ const CalendarStyle = dt.div`
275
274
 
276
275
  .react-date-picker__wrapper,
277
276
  .react-daterange-picker__wrapper {
278
- min-height: var(--input-default);
277
+ min-height: var(--input-default);
279
278
  padding-right: 8px;
280
279
  padding-left: 8px;
281
280
  border: 1px solid var(--input);
@@ -391,31 +390,50 @@ const CalendarStyle = dt.div`
391
390
 
392
391
  /* =========================== estilos para react-calendar ================== */
393
392
  .react-calendar {
394
- ${({ showdoubleview, widthcalendar }) => {
393
+ ${({ showdoubleview }) => {
395
394
  if (showdoubleview === "true") {
396
395
  return lt``;
397
396
  } else {
398
397
  return lt`
399
- width: ${`${widthcalendar}px`};
400
- `;
398
+ /* Forzamos un layout compacto de 256px para vista simple */
399
+ width: 256px;
400
+ min-width: 256px;
401
+ `;
401
402
  }
402
403
  }}
403
404
  border: none;
404
- padding: 12px;
405
+ padding: 8px; /* Compactar padding sin cambiar colores ni fuentes */
405
406
  font-family: var(--font-family-base);
406
- min-width: 300px;
407
407
  border-radius: calc(var(--radius) - 2px);
408
408
  background-color: var(--color-content1-default);
409
+ /* Variable para tamaño de celda compacto */
410
+ --cal-cell-size: 32px;
409
411
  }
410
412
 
411
413
  /* .react-calendar--doubleView {
412
414
  width: ${({ widthcalendar }) => `${widthcalendar}px`};
413
415
  } */
414
416
 
417
+ .react-calendar--doubleView {
418
+ --cal-cell-size: 34px !important;
419
+ width: 512px !important;
420
+ }
421
+
422
+ .react-calendar--doubleView .react-calendar__month-view__weekdays {
423
+ gap: 0px;
424
+ }
425
+
426
+ .react-calendar--doubleView .react-calendar__month-view__days {
427
+ gap: 0px;
428
+ }
429
+
415
430
  .react-calendar__navigation {
416
- height: 44px;
417
- margin-bottom: 6px;
418
- gap: 2px;
431
+ height: 40px; /* Más compacto */
432
+ margin-bottom: 4px;
433
+ gap: 4px;
434
+ /* Alinear y centrar */
435
+ display: flex;
436
+ align-items: center;
419
437
  }
420
438
  .react-calendar__navigation__prev2-button,
421
439
  .react-calendar__navigation__next2-button {
@@ -424,18 +442,34 @@ const CalendarStyle = dt.div`
424
442
 
425
443
  .react-calendar__navigation__next-button,
426
444
  .react-calendar__navigation__prev-button {
427
- font-size: 22px;
445
+ font-size: 22px; /* Conserva tamaño del icono */
428
446
  color: var(--color-default-900);
447
+ width: var(--cal-cell-size);
448
+ height: var(--cal-cell-size);
449
+ padding: 0;
450
+ display: flex;
451
+ align-items: center;
452
+ justify-content: center;
453
+ border-radius: 8px;
429
454
  }
430
455
 
431
456
  .react-calendar__navigation__label {
432
- border-radius: 22px;
457
+ border-radius: 8px;
458
+ flex: 1;
459
+ height: var(--cal-cell-size);
460
+ display: flex;
461
+ align-items: center;
462
+ justify-content: center;
463
+ padding: 0 4px;
464
+ font-size: 14px;
465
+ font-weight: 600;
466
+ color: var(--color-default-900);
433
467
  }
434
468
 
435
469
  .react-calendar__navigation__label span {
436
470
  text-transform: capitalize;
437
- color: var(--color-default-900);
438
- font-weight: bold;
471
+ color: var(--color-default-500);
472
+ font-weight: 500;
439
473
  font-size: 14px;
440
474
  }
441
475
 
@@ -451,7 +485,12 @@ const CalendarStyle = dt.div`
451
485
  .react-calendar__month-view__weekdays__weekday {
452
486
  text-transform: capitalize;
453
487
  font-weight: 500;
454
- color: var(--color-gray-500);
488
+ color: var(--color-default-400);
489
+ display: flex;
490
+ align-items: center;
491
+ justify-content: center;
492
+ height: var(--cal-cell-size);
493
+ width: var(--cal-cell-size);
455
494
  }
456
495
  .react-calendar__month-view__weekdays__weekday abbr {
457
496
  text-decoration: none;
@@ -465,7 +504,7 @@ const CalendarStyle = dt.div`
465
504
  font-weight: bold;
466
505
  }
467
506
  .react-calendar__month-view__days__day--weekend {
468
- color: var(--color-red-500);
507
+ color: var(--color-danger-default);
469
508
  }
470
509
  .react-calendar__month-view__days__day--neighboringMonth {
471
510
  color: var(--color-gray-300);
@@ -476,11 +515,57 @@ const CalendarStyle = dt.div`
476
515
  padding: 2em 0.5em;
477
516
  }
478
517
  .react-calendar__tile {
479
- font-size: 14px;
480
- line-height: 16px;
518
+ font-size: 14px; /* No cambiamos tipografía */
519
+ line-height: 1; /* Permite centrar vertical con flex */
481
520
  font-weight: 500;
521
+ width: var(--cal-cell-size);
522
+ height: var(--cal-cell-size);
523
+ padding: 0;
524
+ display: flex;
525
+ align-items: center;
526
+ justify-content: center;
527
+ border-radius: 6px; /* Moderno sin afectar colores */
528
+ flex: 0 0 auto; /* Evitar stretching */
529
+ /* Transición suave para cambios de fondo, color y radio */
530
+ transition: background-color 0.18s ease, color 0.18s ease, border-radius 0.25s ease, transform 0.18s ease;
531
+ }
532
+
533
+ .react-calendar__tile--hasActive {
534
+ background: var(--color-primary-300);
535
+ border-radius: 50% !important;
536
+ }
537
+
538
+ /* Suavizar botones navegación (heredan selector button) */
539
+ .react-calendar__navigation button {
540
+ transition: background-color 0.18s ease, color 0.18s ease, border-radius 0.25s ease;
482
541
  }
483
542
 
543
+ /* Hover general (sin tocar colores definidos en variantes) añadimos ligera elevación */
544
+ .react-calendar__tile:enabled:hover,
545
+ .react-calendar__tile:enabled:focus {
546
+ transform: translateY(-2px);
547
+ }
548
+
549
+ /* Evitar salto al active manteniendo animación */
550
+ .react-calendar__tile--active {
551
+ transition: background-color 0.18s ease, color 0.18s ease, border-radius 0.25s ease;
552
+ }
553
+
554
+ /* Grid compacto SOLO cuando no es doble vista */
555
+ ${({ showdoubleview }) => showdoubleview === "false" && lt`
556
+ .react-calendar__month-view__weekdays,
557
+ .react-calendar__month-view__days {
558
+ display: grid !important;
559
+ grid-template-columns: repeat(7, var(--cal-cell-size));
560
+ justify-content: center;
561
+ gap: 2px; /* Sin gaps para exactitud */
562
+ }
563
+
564
+ .react-calendar__month-view__days {
565
+ margin-top: 0;
566
+ }
567
+ `}
568
+
484
569
  .react-calendar__tile:disabled {
485
570
  text-decoration: line-through;
486
571
  color: var(--color-gray-300);
@@ -499,6 +584,17 @@ const CalendarStyle = dt.div`
499
584
  align-items: center;
500
585
  justify-content: center;
501
586
  border-radius: 50%;
587
+ width: var(--cal-cell-size);
588
+ height: var(--cal-cell-size);
589
+ min-width: var(--cal-cell-size);
590
+ max-width: var(--cal-cell-size);
591
+ min-height: var(--cal-cell-size);
592
+ max-height: var(--cal-cell-size);
593
+ color: hsl(var(--color-default-400) / 1);
594
+ }
595
+
596
+ .react-calendar__year-view__months__month {
597
+ border-radius: 8px !important;
502
598
  }
503
599
 
504
600
  ${({ color }) => {
@@ -510,19 +606,19 @@ const CalendarStyle = dt.div`
510
606
  background-color: var(--color-primary-100);
511
607
 
512
608
  color: var(--color-primary-500);
513
- border-radius: 8px;
609
+ border-radius: 50%;
514
610
  }
515
611
 
516
612
  .react-calendar .react-calendar__tile--now {
517
- border-radius: 8px;
613
+ border-radius: 50%;
518
614
  background-color: var(--color-primary-100);
519
615
  color: var(--color-primary-500);
520
616
  }
521
617
 
522
618
  .react-calendar__tile.react-calendar__tile--active.react-calendar__tile--range.react-calendar__tile--rangeStart.react-calendar__tile--rangeEnd {
523
- background-color: var(--color-primary-400);
619
+ background-color: var(--color-primary);
524
620
  color: white;
525
- border-radius: 8px;
621
+ border-radius: 50%;
526
622
  }
527
623
 
528
624
  /* .react-calendar__tile--hasActive.react-calendar__year-view__months__month, */
@@ -538,7 +634,7 @@ const CalendarStyle = dt.div`
538
634
  .react-calendar .react-calendar__tile--hasActive.react-calendar__tile--rangeStart.react-calendar__year-view__months__month,
539
635
  .react-calendar__tile--hasActive.react-calendar__tile--rangeStart.react-calendar__decade-view__years__year,
540
636
  .react-calendar__tile--hasActive.react-calendar__tile--rangeStart.react-calendar__century-view__decades__decade {
541
- background-color: var(--color-primary-400);
637
+ background-color: var(--color-primary);
542
638
  color: white;
543
639
 
544
640
  border-radius: 8px 0 0 8px;
@@ -554,7 +650,7 @@ const CalendarStyle = dt.div`
554
650
  .react-calendar__tile.react-calendar__tile--hasActive.react-calendar__tile--range.react-calendar__tile--rangeEnd.react-calendar__year-view__months__month,
555
651
  .react-calendar__tile--hasActive.react-calendar__tile--rangeEnd.react-calendar__decade-view__years__year,
556
652
  .react-calendar__tile--hasActive.react-calendar__tile--rangeEnd.react-calendar__century-view__decades__decade {
557
- background-color: var(--color-primary-400);
653
+ background-color: var(--color-primary);
558
654
  color: white;
559
655
 
560
656
  border-radius: 0 8px 8px 0;
@@ -623,15 +719,21 @@ const CalendarStyle = dt.div`
623
719
  }}
624
720
 
625
721
  .react-calendar--doubleView .react-calendar__tile--active {
626
- background-color: var(--color-default-100);
627
- color: var(--color-default-900);
722
+ background-color: var(--color-primary-50);
723
+ color: var(--color-primary);
628
724
  border-radius: 0px;
725
+ position: relative;
629
726
  }
630
727
 
728
+
631
729
  .react-calendar--selectRange .react-calendar__tile--hover {
632
730
  background-color: var(--color-default-100);
633
731
  }
634
732
 
733
+ .react-calendar--selectRange .react-calendar__tile--hover.react-calendar__month-view__days__day{
734
+ /* border-radius: 0px !important; */
735
+ }
736
+
635
737
  .react-calendar__tile--active.react-calendar__month-view__days__day.react-calendar__month-view__days__day--neighboringMonth {
636
738
  background-color: var(--color-content1-default);
637
739
  color: var(--color-default-300);
@@ -701,6 +803,81 @@ const CalendarPicker = ({
701
803
  handleChange(date);
702
804
  }
703
805
  };
806
+ const startOfDay = useCallback((d) => new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0), []);
807
+ const addDays = useCallback((d, n) => startOfDay(new Date(d.getFullYear(), d.getMonth(), d.getDate() + n)), [startOfDay]);
808
+ const startOfMonth = useCallback((d) => new Date(d.getFullYear(), d.getMonth(), 1, 0, 0, 0, 0), []);
809
+ const endOfMonth = useCallback((d) => new Date(d.getFullYear(), d.getMonth() + 1, 0, 23, 59, 59, 999), []);
810
+ const isSameDay = (a, b) => {
811
+ if (!a || !b) return false;
812
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
813
+ };
814
+ const isSameRange = (range, target) => {
815
+ if (!Array.isArray(range) || !Array.isArray(target)) return false;
816
+ const [r0, r1] = range;
817
+ const [t0, t1] = target;
818
+ return isSameDay(r0, t0) && isSameDay(r1, t1);
819
+ };
820
+ const presets = useMemo(() => {
821
+ const today = startOfDay(/* @__PURE__ */ new Date());
822
+ if (type === "date-picker") {
823
+ return [
824
+ { key: "today", label: "Hoy", getValue: () => today },
825
+ { key: "tomorrow", label: "Mañana", getValue: () => addDays(today, 1) },
826
+ { key: "in7", label: "+7 días", getValue: () => addDays(today, 7) },
827
+ { key: "in30", label: "+30 días", getValue: () => addDays(today, 30) },
828
+ { key: "clear", label: "Limpiar", action: () => onChange(null), separator: true }
829
+ ];
830
+ } else {
831
+ const last7Start = addDays(today, -6);
832
+ const next7End = addDays(today, 6);
833
+ const thisMonthStart = startOfMonth(today);
834
+ const thisMonthEnd = endOfMonth(today);
835
+ const lastMonthRef = addDays(thisMonthStart, -1);
836
+ const lastMonthStart = startOfMonth(lastMonthRef);
837
+ const lastMonthEnd = endOfMonth(lastMonthRef);
838
+ return [
839
+ { key: "today", label: "Hoy", getValue: () => [today, today] },
840
+ { key: "last7", label: "Últimos 7 días", getValue: () => [last7Start, today] },
841
+ { key: "next7", label: "Próx. 7 días", getValue: () => [today, next7End] },
842
+ { key: "thisMonth", label: "Este mes", getValue: () => [thisMonthStart, thisMonthEnd] },
843
+ {
844
+ key: "nextMonth",
845
+ label: "Próximo mes",
846
+ getValue: () => {
847
+ const nextMonthRef = addDays(thisMonthEnd, 1);
848
+ const nextMonthStart = startOfMonth(nextMonthRef);
849
+ const nextMonthEnd = endOfMonth(nextMonthRef);
850
+ return [nextMonthStart, nextMonthEnd];
851
+ }
852
+ },
853
+ { key: "lastMonth", label: "Mes pasado", getValue: () => [lastMonthStart, lastMonthEnd] }
854
+ // { key: "clear", label: "Limpiar", action: () => onChange(null), separator: true },
855
+ ];
856
+ }
857
+ }, [type, onChange, addDays, startOfDay, startOfMonth, endOfMonth]);
858
+ const isPresetActive = (preset) => {
859
+ if (preset.getValue) {
860
+ const pv = preset.getValue();
861
+ if (type === "date-picker") {
862
+ return !Array.isArray(value) && !Array.isArray(pv) && isSameDay(value, pv);
863
+ } else {
864
+ return Array.isArray(value) && Array.isArray(pv) && isSameRange(value, pv);
865
+ }
866
+ }
867
+ return false;
868
+ };
869
+ const handlePresetClick = (preset) => {
870
+ if (preset.action) {
871
+ preset.action();
872
+ setShow(false);
873
+ return;
874
+ }
875
+ if (preset.getValue) {
876
+ const v = preset.getValue();
877
+ onChange(v);
878
+ setShow(false);
879
+ }
880
+ };
704
881
  const handleCloseCalendar = () => {
705
882
  if (disabled) return;
706
883
  setShow(false);
@@ -728,6 +905,7 @@ const CalendarPicker = ({
728
905
  containerStyle: {
729
906
  zIndex: "100"
730
907
  },
908
+ align: "start",
731
909
  content: /* @__PURE__ */ jsxs(
732
910
  CalendarStyle,
733
911
  {
@@ -741,7 +919,36 @@ const CalendarPicker = ({
741
919
  /* <Loading size="sm" color="secondary" /> */
742
920
  /* @__PURE__ */ jsx("p", { children: "loading" })
743
921
  ) : null,
744
- /* @__PURE__ */ jsxs("div", { className: "w-full relative flex flex-col gap-2", children: [
922
+ /* @__PURE__ */ jsxs("div", { className: "w-full relative flex gap-2", children: [
923
+ showActionButtons && /* @__PURE__ */ jsxs("div", { className: "w-[150px] border-r border-default-200 px-3 py-3 flex flex-col gap-1 overflow-y-auto max-h-[340px]", children: [
924
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-default-400 mb-1 select-none uppercase tracking-wide", children: "Atajos" }),
925
+ presets.map((p) => {
926
+ const active = isPresetActive(p);
927
+ return /* @__PURE__ */ jsx(
928
+ "button",
929
+ {
930
+ type: "button",
931
+ onClick: () => handlePresetClick(p),
932
+ className: twMerge(
933
+ "text-left rounded-md px-2 py-1.5 text-sm w-full cursor-pointer transition-colors",
934
+ active ? "bg-default-200/70 dark:bg-default-100 font-medium" : "bg-content1 hover:bg-default-100"
935
+ ),
936
+ "data-active": active || void 0,
937
+ children: p.label
938
+ },
939
+ p.key
940
+ );
941
+ }),
942
+ /* @__PURE__ */ jsx("div", { className: "mt-2 pt-2 border-t border-default-200 flex flex-col gap-1", children: /* @__PURE__ */ jsx(
943
+ "button",
944
+ {
945
+ type: "button",
946
+ onClick: handleChangeToDay,
947
+ className: "text-left rounded-md px-2 py-1.5 text-sm w-full cursor-pointer bg-content1 hover:bg-default-100",
948
+ children: "Ir a hoy (Cerrar)"
949
+ }
950
+ ) })
951
+ ] }),
745
952
  /* @__PURE__ */ jsx(
746
953
  Calendar,
747
954
  {
@@ -755,15 +962,11 @@ const CalendarPicker = ({
755
962
  tileDisabled,
756
963
  selectRange: type === "date-range-picker",
757
964
  returnValue: type === "date-range-picker" ? "range" : "start",
758
- prevLabel: /* @__PURE__ */ jsx(FaArrowLeft, { className: "w-4 h-5" }),
759
- nextLabel: /* @__PURE__ */ jsx(FaArrowRight, { className: "w-4 h-5" }),
965
+ prevLabel: /* @__PURE__ */ jsx(FaArrowLeft, { className: "w-4 h-4 text-default-400" }),
966
+ nextLabel: /* @__PURE__ */ jsx(FaArrowRight, { className: "w-4 h-4 text-default-400" }),
760
967
  tileContent
761
968
  }
762
- ),
763
- showActionButtons && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-x-4 p-3 w-full", children: [
764
- /* @__PURE__ */ jsx(Button, { onClick: handleChangeToDay, color, className: "flex-1", children: "Hoy" }),
765
- /* @__PURE__ */ jsx(Button, { color: "default", variant: "bordered", className: "flex-1", onClick: () => setShow(false), children: "Cerrar" })
766
- ] })
969
+ )
767
970
  ] })
768
971
  ]
769
972
  }