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