lawgic-dev-kit 0.19.2 → 0.19.8

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.
@@ -0,0 +1,158 @@
1
+ import { j as a } from "../../../_virtual/jsx-runtime.js";
2
+ import { FontAwesomeIcon as D } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
3
+ import { faFilter as C, faX as I } from "../../../node_modules/@fortawesome/pro-regular-svg-icons/index.js";
4
+ import { useState as O } from "react";
5
+ import "../../../contexts/themeContext.js";
6
+ import "../../../_virtual/lodash.js";
7
+ import "react-hook-form";
8
+ import "../../../constants/countries.js";
9
+ import "../ImageProfileInput/ImageProfileInput.validators.js";
10
+ import $ from "../UncontrolledSelector/UncontrolledSelector.js";
11
+ import L from "../UncontrolledTextInput/UncontrolledTextInput.js";
12
+ import M from "../../molecules/FloatingMenu/FloatingMenu.js";
13
+ import "../../molecules/InformationContainer/InformationContainer.js";
14
+ import h from "../../molecules/UncontrolledDateInput/UncontrolledDateInput.js";
15
+ const G = ({
16
+ filter: e,
17
+ filterControl: g,
18
+ translations: j = {}
19
+ }) => {
20
+ var c, p, u, d, r, m, x, v, y, b;
21
+ const [k, l] = O(!0), { updateFilter: o, removeFilter: w } = g, S = !!(e != null && e.value), n = (t, s) => j[t] || s, N = (t, s = []) => {
22
+ const i = s.find((F) => F.value === t);
23
+ return i ? i.label : String(t);
24
+ };
25
+ return /* @__PURE__ */ a.jsx(
26
+ M,
27
+ {
28
+ open: k,
29
+ onClose: () => l(!1),
30
+ placement: "bottom",
31
+ className: "min-w-[400px]",
32
+ component: /* @__PURE__ */ a.jsxs("div", { children: [
33
+ /* @__PURE__ */ a.jsx("p", { children: n(e.key, e.label) }),
34
+ e.type === "date" ? /* @__PURE__ */ a.jsxs("div", { className: "flex flex-col gap-2", children: [
35
+ /* @__PURE__ */ a.jsx("div", { className: "scale-[0.8] origin-left -mr-[10%] w-[125%]! relative z-99", children: /* @__PURE__ */ a.jsx(
36
+ h,
37
+ {
38
+ currentDate: (c = e.value) != null && c.startDate ? new Date(e.value.startDate) : null,
39
+ maxDate: (p = e.value) != null && p.endDate ? new Date(e.value.endDate) : void 0,
40
+ futureDates: !0,
41
+ onDateChange: (t) => o({
42
+ key: e.key,
43
+ value: {
44
+ ...e.value || {},
45
+ startDate: (t == null ? void 0 : t.toISOString()) || ""
46
+ },
47
+ label: e.label,
48
+ type: e.type
49
+ }),
50
+ label: "Fecha de inicio",
51
+ translatedKey: "start_date"
52
+ }
53
+ ) }),
54
+ /* @__PURE__ */ a.jsx("div", { className: "scale-[0.8] origin-left -mr-[10%] w-[125%]! ", children: /* @__PURE__ */ a.jsx(
55
+ h,
56
+ {
57
+ currentDate: (u = e.value) != null && u.endDate ? new Date(e.value.endDate) : null,
58
+ minDate: (d = e.value) != null && d.startDate ? new Date(e.value.startDate) : void 0,
59
+ onDateChange: (t) => o({
60
+ key: e.key,
61
+ value: {
62
+ ...e.value || {},
63
+ endDate: (t == null ? void 0 : t.toISOString()) || ""
64
+ },
65
+ label: e.label,
66
+ type: e.type
67
+ }),
68
+ label: "Fecha de fin",
69
+ futureDates: !0,
70
+ translatedKey: "end_date"
71
+ }
72
+ ) })
73
+ ] }) : e.type === "select" ? /* @__PURE__ */ a.jsx(
74
+ $,
75
+ {
76
+ className: "scale-[0.8] origin-left -mr-[10%] w-[125%]! p-0! m-0!",
77
+ value: e.value || "",
78
+ options: e.options || [],
79
+ label: "",
80
+ allowSearch: !0,
81
+ onChange: (t) => o({
82
+ key: e.key,
83
+ value: t,
84
+ label: e.label,
85
+ type: e.type
86
+ }),
87
+ placeholder: n(e.key, e.label)
88
+ }
89
+ ) : /* @__PURE__ */ a.jsx(
90
+ L,
91
+ {
92
+ size: "sm",
93
+ name: e.key,
94
+ value: e.value,
95
+ onChange: (t) => o({
96
+ key: e.key,
97
+ value: t,
98
+ label: e.label,
99
+ type: e.type
100
+ }),
101
+ placeholder: n(e.key, e.label)
102
+ }
103
+ )
104
+ ] }),
105
+ children: /* @__PURE__ */ a.jsxs(
106
+ "div",
107
+ {
108
+ className: `flex gap-[8px] items-center px-[12px] py-[8px] bg-blue-100 max-w-[400px] ${S && "border-1! border-blue-500!"} cursor-pointer transition ease-in-out rounded-full border border-transparent hover:border-blue-500`,
109
+ onClick: () => l(!0),
110
+ children: [
111
+ /* @__PURE__ */ a.jsxs("div", { className: "flex justify-between items-center gap-[6px] min-w-0", children: [
112
+ /* @__PURE__ */ a.jsx(
113
+ D,
114
+ {
115
+ icon: e.icon || C,
116
+ className: "text-[14px] text-blue-500"
117
+ }
118
+ ),
119
+ /* @__PURE__ */ a.jsx(
120
+ "p",
121
+ {
122
+ className: "flex-1 min-w-0 text-[12px] font-semibold text-gray-800 truncate overflow-hidden whitespace-nowrap",
123
+ title: e.type === "date" ? `${((r = e.value) == null ? void 0 : r.startDate) || "..."} - ${((m = e.value) == null ? void 0 : m.endDate) || "..."}` : String(
124
+ e.value || n(e.key, e.label)
125
+ ),
126
+ children: e.value && (e.type === "date" ? (x = e.value) != null && x.startDate || (v = e.value) != null && v.endDate : e.value) ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
127
+ n(e.key, e.label),
128
+ ":",
129
+ " ",
130
+ /* @__PURE__ */ a.jsx("span", { className: "text-gray-600 truncate overflow-hidden whitespace-nowrap", children: e.type === "date" ? `${(y = e.value) != null && y.startDate ? new Date(
131
+ e.value.startDate
132
+ ).toLocaleDateString() : "..."} - ${(b = e.value) != null && b.endDate ? new Date(
133
+ e.value.endDate
134
+ ).toLocaleDateString() : "..."}` : e.type === "select" ? N(
135
+ e.value,
136
+ e.options
137
+ ) : String(e.value) })
138
+ ] }) : n(e.key, e.label)
139
+ }
140
+ )
141
+ ] }),
142
+ /* @__PURE__ */ a.jsx(
143
+ "div",
144
+ {
145
+ className: "flex justify-center items-center",
146
+ onClick: () => w({ key: e.key }),
147
+ children: /* @__PURE__ */ a.jsx(D, { icon: I, className: "text-[10px] text-gray-400" })
148
+ }
149
+ )
150
+ ]
151
+ }
152
+ )
153
+ }
154
+ );
155
+ };
156
+ export {
157
+ G as default
158
+ };
@@ -38,3 +38,4 @@ export * from './ThresholdProgressBar/index';
38
38
  export * from './CircleProgress/index';
39
39
  export * from './Switch/index';
40
40
  export * from './Pill/index';
41
+ export * from './FilterPill/index';
@@ -0,0 +1,49 @@
1
+ import { j as e } from "../../../_virtual/jsx-runtime.js";
2
+ import { faBarsFilter as x } from "../../../node_modules/@fortawesome/pro-regular-svg-icons/index.js";
3
+ import { FontAwesomeIcon as o } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
4
+ import { useState as p } from "react";
5
+ import c from "../FloatingMenu/FloatingMenu.js";
6
+ const g = ({ filters: r }) => {
7
+ const [l, s] = p(!1), a = () => s(!1), n = () => s(!0);
8
+ return /* @__PURE__ */ e.jsx(
9
+ c,
10
+ {
11
+ open: l,
12
+ onClose: a,
13
+ placement: "bottom-start",
14
+ className: "w-[326px] shadow-md px-0! text-base! py-12!",
15
+ component: /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col gap-[10px]", children: [
16
+ /* @__PURE__ */ e.jsx("h4", { className: "px-24 text-lg font-semibold text-blue-900", children: "Filtros" }),
17
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col", children: r.map((t, i) => /* @__PURE__ */ e.jsxs(
18
+ "div",
19
+ {
20
+ className: "group flex gap-[8px] items-center px-[24px] py-[8px] hover:bg-blue-100 cursor-pointer transition ease-in-out",
21
+ onClick: t.onClick,
22
+ children: [
23
+ /* @__PURE__ */ e.jsx(
24
+ o,
25
+ {
26
+ icon: t.icon,
27
+ className: "text-[14px] text-gray-600 group-hover:text-blue-500"
28
+ }
29
+ ),
30
+ /* @__PURE__ */ e.jsx("p", { className: "text-[12px] text-gray-500 font-semibold group-hover:text-gray-800", children: t.label })
31
+ ]
32
+ },
33
+ i
34
+ )) })
35
+ ] }),
36
+ children: /* @__PURE__ */ e.jsx(
37
+ o,
38
+ {
39
+ icon: x,
40
+ onClick: n,
41
+ className: "transition text-[16px] ease-in-out duration-150 hover:text-gray-600 cursor-pointer"
42
+ }
43
+ )
44
+ }
45
+ );
46
+ };
47
+ export {
48
+ g as default
49
+ };
@@ -1,47 +1,54 @@
1
1
  import { j as t } from "../../../_virtual/jsx-runtime.js";
2
- import { useFloating as M, useClick as N, useDismiss as O, useInteractions as S, useTransitionStyles as b } from "../../../node_modules/@floating-ui/react/dist/floating-ui.react.js";
3
- import k, { useState as w, useEffect as P } from "react";
2
+ import { useFloating as M, useClick as N, useDismiss as O, useInteractions as S, useTransitionStyles as k } from "../../../node_modules/@floating-ui/react/dist/floating-ui.react.js";
3
+ import w, { useState as P, useEffect as _ } from "react";
4
4
  import "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
5
5
  import "../../../_virtual/lodash.js";
6
6
  import "../../../contexts/themeContext.js";
7
7
  import "react-hook-form";
8
8
  import "../InformationContainer/InformationContainer.js";
9
- import _ from "../../atoms/BoxContainer/BoxContainer.js";
9
+ import z from "../../atoms/BoxContainer/BoxContainer.js";
10
10
  import "../../../constants/countries.js";
11
11
  import "../../atoms/ImageProfileInput/ImageProfileInput.validators.js";
12
12
  import "fuse.js";
13
- import { autoUpdate as z } from "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
14
- import { offset as B, flip as D, shift as T } from "../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
15
- const Z = ({
13
+ import { autoUpdate as B } from "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
14
+ import { offset as D, flip as T, shift as U } from "../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
15
+ const $ = ({
16
16
  open: e,
17
17
  onClose: s,
18
18
  component: i,
19
- children: a,
19
+ children: n,
20
20
  placement: l = "bottom",
21
- className: m = "",
22
- strategy: f = "absolute",
21
+ className: f = "",
22
+ strategy: m = "absolute",
23
+ styles: c = {},
23
24
  offset: p = 8,
24
- padding: c = 8
25
+ padding: d = 8
25
26
  }) => {
26
- const [d, r] = w(e);
27
- P(() => {
28
- r(e);
27
+ const [u, o] = P(e);
28
+ _(() => {
29
+ o(e);
29
30
  }, [e]);
30
- const u = () => {
31
- r(!1), s == null || s();
32
- }, { x: g, y: x, strategy: y, refs: n, context: o } = M({
33
- strategy: f,
34
- open: d,
31
+ const g = () => {
32
+ o(!1), s == null || s();
33
+ }, { x, y, strategy: h, refs: a, context: r } = M({
34
+ strategy: m,
35
+ open: u,
35
36
  onOpenChange: (I) => {
36
- I || u();
37
+ !I && !e && g();
37
38
  },
38
- middleware: [B(p), D(), T({ padding: c })],
39
- whileElementsMounted: z,
39
+ middleware: [D(p), T(), U({ padding: d })],
40
+ whileElementsMounted: B,
40
41
  placement: l
41
- }), h = N(o), j = O(o), { getReferenceProps: v, getFloatingProps: E } = S([
42
- h,
43
- j
44
- ]), { isMounted: F, styles: R } = b(o, {
42
+ }), j = N(r, {
43
+ enabled: !1
44
+ // Deshabilitamos el click interno ya que está controlado externamente
45
+ }), b = O(r, {
46
+ enabled: !1
47
+ // Deshabilitamos dismiss cuando está controlado externamente por props
48
+ }), { getReferenceProps: v, getFloatingProps: E } = S([
49
+ j,
50
+ b
51
+ ]), { isMounted: F, styles: R } = k(r, {
45
52
  duration: {
46
53
  open: 200,
47
54
  close: 150
@@ -55,30 +62,31 @@ const Z = ({
55
62
  /* @__PURE__ */ t.jsx(
56
63
  "div",
57
64
  {
58
- ref: n.setReference,
65
+ ref: a.setReference,
59
66
  ...v(),
60
67
  className: "reference-element",
61
- children: a
68
+ children: n
62
69
  }
63
70
  ),
64
71
  F && /* @__PURE__ */ t.jsx(
65
72
  "div",
66
73
  {
67
- ref: n.setFloating,
74
+ ref: a.setFloating,
68
75
  style: {
69
- position: y,
70
- top: x ?? 0,
71
- left: g ?? 0,
76
+ position: h,
77
+ top: y ?? 0,
78
+ left: x ?? 0,
72
79
  ...R,
73
- zIndex: 9999
80
+ zIndex: 999,
81
+ ...c
74
82
  },
75
83
  ...E(),
76
84
  className: "floating-element",
77
- children: /* @__PURE__ */ t.jsx(_, { className: m, children: typeof i == "function" ? k.createElement(i) : i })
85
+ children: /* @__PURE__ */ t.jsx(z, { className: f, children: typeof i == "function" ? w.createElement(i) : i })
78
86
  }
79
87
  )
80
88
  ] });
81
89
  };
82
90
  export {
83
- Z as default
91
+ $ as default
84
92
  };
@@ -6,6 +6,7 @@ export interface FloatingMenuProps {
6
6
  placement?: "top" | "bottom" | "left" | "right";
7
7
  className?: string;
8
8
  strategy?: "fixed" | "absolute";
9
+ styles?: React.CSSProperties;
9
10
  offset?: number;
10
11
  padding?: number;
11
12
  }
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { SideModalProps } from './SideModal.types';
3
+ declare const SideModal: React.FC<SideModalProps>;
4
+ export default SideModal;
@@ -0,0 +1,97 @@
1
+ import { j as i } from "../../../_virtual/jsx-runtime.js";
2
+ import { useEffect as x } from "react";
3
+ import { AnimatePresence as u } from "../../../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.js";
4
+ import { motion as r } from "../../../node_modules/motion/dist/es/framer-motion/dist/es/render/components/motion/proxy.js";
5
+ const b = ({
6
+ open: e,
7
+ onClose: a,
8
+ children: s,
9
+ side: n = "right",
10
+ className: l = "",
11
+ backdropClassName: d = "",
12
+ width: o = "650px",
13
+ zIndex: m = 9999
14
+ }) => {
15
+ x(() => {
16
+ const t = (p) => {
17
+ p.key === "Escape" && e && a();
18
+ };
19
+ return e && (document.addEventListener("keydown", t), document.body.style.overflow = "hidden"), () => {
20
+ document.removeEventListener("keydown", t), document.body.style.overflow = "unset";
21
+ };
22
+ }, [e, a]);
23
+ const c = {
24
+ initial: {
25
+ x: n === "right" ? "100%" : "-100%"
26
+ // opacity: 0,
27
+ },
28
+ animate: {
29
+ x: 0,
30
+ // opacity: 1,
31
+ transition: {
32
+ type: "spring",
33
+ stiffness: 300,
34
+ damping: 30,
35
+ opacity: { duration: 0.2 }
36
+ }
37
+ },
38
+ exit: {
39
+ x: n === "right" ? "100%" : "-100%",
40
+ // opacity: 0,
41
+ transition: {
42
+ type: "spring",
43
+ stiffness: 300,
44
+ damping: 30,
45
+ opacity: { duration: 0.15 }
46
+ }
47
+ }
48
+ }, f = {
49
+ initial: { opacity: 0 },
50
+ animate: { opacity: 1, transition: { duration: 0.2 } },
51
+ exit: { opacity: 0, transition: { duration: 0.15 } }
52
+ };
53
+ return /* @__PURE__ */ i.jsx(u, { children: e && /* @__PURE__ */ i.jsxs("div", { className: `fixed inset-0 z-[${m}] flex`, children: [
54
+ /* @__PURE__ */ i.jsx(
55
+ r.div,
56
+ {
57
+ variants: f,
58
+ initial: "initial",
59
+ animate: "animate",
60
+ exit: "exit",
61
+ className: `absolute inset-0 bg-black/50 backdrop-blur-[0.60px] ${d}`,
62
+ onClick: (t) => {
63
+ t.preventDefault(), t.stopPropagation(), a();
64
+ }
65
+ }
66
+ ),
67
+ /* @__PURE__ */ i.jsx(
68
+ "div",
69
+ {
70
+ className: `relative flex w-full pointer-events-none ${n === "left" ? "justify-start" : "justify-end"}`,
71
+ children: /* @__PURE__ */ i.jsx(
72
+ r.div,
73
+ {
74
+ variants: c,
75
+ initial: "initial",
76
+ animate: "animate",
77
+ exit: "exit",
78
+ className: `
79
+ relative bg-white shadow-2xl h-full overflow-hidden flex flex-col pointer-events-auto
80
+ ${l}
81
+ `,
82
+ style: {
83
+ width: typeof o == "number" ? `${o}px` : o
84
+ },
85
+ onClick: (t) => {
86
+ t.preventDefault(), t.stopPropagation();
87
+ },
88
+ children: s
89
+ }
90
+ )
91
+ }
92
+ )
93
+ ] }) });
94
+ };
95
+ export {
96
+ b as default
97
+ };
@@ -0,0 +1,10 @@
1
+ export interface SideModalProps {
2
+ open: boolean;
3
+ onClose: () => void;
4
+ children?: React.ReactNode;
5
+ side?: 'left' | 'right';
6
+ className?: string;
7
+ backdropClassName?: string;
8
+ width?: string | number;
9
+ zIndex?: number;
10
+ }
@@ -0,0 +1 @@
1
+ export { default as SideModal } from './SideModal';
@@ -15,3 +15,5 @@ export * from './Tabs';
15
15
  export * from './UncontrolledDateInput';
16
16
  export * from './AutocompleteInput';
17
17
  export * from './PillsContainer';
18
+ export * from './SideModal';
19
+ export * from './FiltersMenu';