prometeo-design-system 1.6.0 → 1.6.1

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,6 @@
1
+ export * from './exports/SelectFormik'
2
+ export {}
3
+ import PrometeoDesignSystem from './exports/SelectFormik'
4
+ export default PrometeoDesignSystem
5
+ export * from './exports/SelectFormik'
6
+ export {}
@@ -0,0 +1,160 @@
1
+ import { j as t } from "./jsx-runtime-ByW6EXIE.js";
2
+ import { Icons as v } from "./Icons.es.js";
3
+ import { c as u } from "./cn-B6yFEsav.js";
4
+ import { useField as I, ErrorMessage as P } from "formik";
5
+ import { useState as w, useRef as M, useEffect as R } from "react";
6
+ const J = ({
7
+ label: N,
8
+ name: A,
9
+ placeholder: b = "",
10
+ disabled: c,
11
+ containerClassName: k,
12
+ className: C,
13
+ options: o = [],
14
+ multiple: n = !1,
15
+ emptyMessage: D = "No hay opciones disponibles",
16
+ labelVariant: g = "default"
17
+ }) => {
18
+ const [a, y, i] = I(A), [l, f] = w(!1), [m, j] = w(!1), x = M(null), p = y.touched && y.error, d = a.value && (Array.isArray(a.value) ? a.value.length > 0 : a.value.toString().length > 0), O = () => g === "static" || d || l || m ? "-top-3 left-2 scale-90" : "top-1/2 -translate-y-1/2 scale-100", V = () => a.value ? Array.isArray(a.value) ? o.filter((e) => a.value.includes(e.id)) : o.filter((e) => e.id === a.value) : [], E = (e) => {
19
+ if (n) {
20
+ const r = Array.isArray(a.value) ? a.value : [], s = r.includes(e.id) ? r.filter((h) => h !== e.id) : [...r, e.id];
21
+ i.setValue(s);
22
+ } else
23
+ i.setValue(e.id), f(!1);
24
+ }, S = (e) => {
25
+ e.stopPropagation(), i.setValue(n ? [] : "");
26
+ }, z = (e, r) => {
27
+ if (r?.stopPropagation(), n && Array.isArray(a.value)) {
28
+ const s = a.value.filter((h) => h !== e);
29
+ i.setValue(s);
30
+ }
31
+ };
32
+ R(() => {
33
+ const e = (r) => {
34
+ x.current && !x.current.contains(r.target) && f(!1);
35
+ };
36
+ return l && document.addEventListener("mousedown", e), () => {
37
+ document.removeEventListener("mousedown", e);
38
+ };
39
+ }, [l]);
40
+ const F = () => {
41
+ const e = V();
42
+ return e.length === 0 ? b ? /* @__PURE__ */ t.jsx("span", { className: "text-neutral-medium-default opacity-50", children: b }) : null : n ? /* @__PURE__ */ t.jsx("div", { className: "flex items-center gap-1 flex-wrap py-1", children: e.map((r) => /* @__PURE__ */ t.jsxs("div", { className: "inline-flex items-center gap-1 px-2 py-1 bg-primary-default-default text-white text-xs rounded-md", children: [
43
+ /* @__PURE__ */ t.jsx("span", { className: "truncate max-w-20", children: r.label }),
44
+ /* @__PURE__ */ t.jsx(
45
+ "button",
46
+ {
47
+ onMouseDown: (s) => {
48
+ s.preventDefault(), z(r.id, s);
49
+ },
50
+ className: "flex-shrink-0 hover:bg-primary-strong-default rounded-sm p-0.5 transition-colors",
51
+ type: "button",
52
+ tabIndex: -1,
53
+ children: /* @__PURE__ */ t.jsx(v.Close, { size: 12, className: "" })
54
+ }
55
+ )
56
+ ] }, r.id)) }) : /* @__PURE__ */ t.jsx("span", { children: e[0]?.label });
57
+ };
58
+ return /* @__PURE__ */ t.jsxs("div", { className: u("relative w-full bg-inherit", k), ref: x, children: [
59
+ /* @__PURE__ */ t.jsxs("div", { className: "relative bg-inherit", children: [
60
+ /* @__PURE__ */ t.jsxs(
61
+ "button",
62
+ {
63
+ type: "button",
64
+ disabled: c,
65
+ onClick: () => !c && f(!l),
66
+ onFocus: () => j(!0),
67
+ onBlur: () => j(!1),
68
+ className: u(
69
+ "w-full px-3 h-12 text-left border-1 rounded-lg transition-all duration-200 ease-in-out text-neutral-default-default",
70
+ "flex items-center justify-between bg-transparent focus:outline-none",
71
+ d || l || m ? "border-primary-default-default border-2" : p ? "border-error-default-default" : "border-neutral-default-default hover:border-neutral-strong-default",
72
+ c && "opacity-50 cursor-not-allowed",
73
+ C
74
+ ),
75
+ children: [
76
+ /* @__PURE__ */ t.jsx(
77
+ "label",
78
+ {
79
+ className: u(
80
+ "absolute pointer-events-none bg-inherit px-1 z-10",
81
+ g === "default" && "transition-all duration-200 ease-in-out",
82
+ "text-md",
83
+ O(),
84
+ d || l || m ? "text-primary-default-default" : p ? "text-red-500" : "text-neutral-medium-default",
85
+ "left-3"
86
+ ),
87
+ children: N
88
+ }
89
+ ),
90
+ /* @__PURE__ */ t.jsx("div", { className: "flex-1 min-w-0", children: F() }),
91
+ /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2 ml-2", children: [
92
+ d && /* @__PURE__ */ t.jsx(
93
+ "button",
94
+ {
95
+ onMouseDown: (e) => {
96
+ e.preventDefault(), e.stopPropagation(), S(e);
97
+ },
98
+ className: "text-neutral-medium-default hover:text-neutral-default-default transition-colors",
99
+ type: "button",
100
+ tabIndex: -1,
101
+ children: /* @__PURE__ */ t.jsx(v.Close, { size: 16, className: "" })
102
+ }
103
+ ),
104
+ /* @__PURE__ */ t.jsx(
105
+ v.ChevronDown,
106
+ {
107
+ size: 20,
108
+ className: u(
109
+ "transition-transform text-neutral-default-default",
110
+ l ? "rotate-180" : ""
111
+ )
112
+ }
113
+ )
114
+ ] })
115
+ ]
116
+ }
117
+ ),
118
+ l && /* @__PURE__ */ t.jsx("div", { className: "absolute z-50 w-full mt-1 bg-neutral-default-default border border-neutral-default-default rounded-md shadow-lg max-h-60 overflow-auto", children: o.length === 0 ? /* @__PURE__ */ t.jsx("div", { className: "px-3 py-2 text-neutral-medium-default", children: D }) : o.map((e) => {
119
+ const r = n ? Array.isArray(a.value) && a.value.includes(e.id) : a.value === e.id;
120
+ return /* @__PURE__ */ t.jsxs(
121
+ "div",
122
+ {
123
+ onMouseDown: (s) => {
124
+ s.preventDefault(), E(e), s.stopPropagation();
125
+ },
126
+ className: u(
127
+ "px-3 py-2 cursor-pointer flex items-center transition-colors",
128
+ r ? "bg-primary-default-default text-white" : "hover:bg-neutral-medium-selected text-neutral-default-default"
129
+ ),
130
+ children: [
131
+ n && /* @__PURE__ */ t.jsx(
132
+ "input",
133
+ {
134
+ type: "checkbox",
135
+ checked: r,
136
+ onChange: () => {
137
+ },
138
+ className: "mr-2 pointer-events-none"
139
+ }
140
+ ),
141
+ /* @__PURE__ */ t.jsx("span", { children: e.label })
142
+ ]
143
+ },
144
+ e.id
145
+ );
146
+ }) })
147
+ ] }),
148
+ p && /* @__PURE__ */ t.jsx(
149
+ P,
150
+ {
151
+ name: a.name,
152
+ component: "span",
153
+ className: "block text-error-default-default text-xs mt-1"
154
+ }
155
+ )
156
+ ] });
157
+ };
158
+ export {
159
+ J as default
160
+ };
@@ -0,0 +1,18 @@
1
+ export interface ISelectFormikOption {
2
+ id: number | string;
3
+ label: string;
4
+ }
5
+ export interface ISelectFormik {
6
+ label: string;
7
+ name: string;
8
+ placeholder?: string;
9
+ disabled: boolean;
10
+ containerClassName: string;
11
+ className: string;
12
+ labelVariant?: 'default' | 'static';
13
+ options: ISelectFormikOption[];
14
+ multiple?: boolean;
15
+ emptyMessage?: string;
16
+ }
17
+ declare const SelectFormik: ({ label, name, placeholder, disabled, containerClassName, className, options, multiple, emptyMessage, labelVariant, }: ISelectFormik) => import("react/jsx-runtime").JSX.Element;
18
+ export default SelectFormik;
@@ -0,0 +1,2 @@
1
+ export { default } from '../components/SelectFormik/SelectFormik';
2
+ export type { ISelectFormik, ISelectFormikOption, } from '../components/SelectFormik/SelectFormik';
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export { Menu } from './components/Menu/MenuComposable';
14
14
  export { default as Pagination } from './components/Pagination/Pagination';
15
15
  export { default as ProgressBar } from './components/ProgressBar/ProgressBar';
16
16
  export { default as Select } from './components/Select/Select';
17
+ export { default as SelectFormik } from './components/SelectFormik/SelectFormik';
17
18
  export { default as ChangueAccount } from './components/Sidebar/components/changue-account';
18
19
  export { default as Spinner } from './components/Spinner/Spinner';
19
20
  export { default as SwipeContainer } from './components/SwipeContainer/SwipeContainer';
@@ -56,6 +57,7 @@ export type { SidebarContextValue } from './components/Sidebar/hooks/useSidebarH
56
57
  export type { SpinnerProps, SpinnerSize, SpinnerVariant, } from './components/Spinner/Spinner';
57
58
  export type { PaginationProps } from './components/Pagination/Pagination';
58
59
  export type { SelectOptionRendererProps, SelectProps, SelectionDisplayProps, } from './components/Select/Select';
60
+ export type { ISelectFormik, ISelectFormikOption, } from './components/SelectFormik/SelectFormik';
59
61
  export type { DialogHandle } from './components/Dialog/Dialog';
60
62
  export { DropZone } from './components/DropZone/DropZone';
61
63
  export type { ToasterPrometeo } from './components/Toaster/Toaster';
@@ -6,7 +6,7 @@ import { default as Be } from "./CheckboxFormik.es.js";
6
6
  import { default as Re, useDialogControl as qe } from "./DialogModal.es.js";
7
7
  import { default as Ae, useDrawerDesktop as Te } from "./DrawerDesktop.es.js";
8
8
  import { default as Ee, useDrawerMobile as Oe } from "./DrawerMobile.es.js";
9
- import { default as He } from "./Header.es.js";
9
+ import { default as Fe } from "./Header.es.js";
10
10
  import { default as We } from "./Input.es.js";
11
11
  import { default as Me } from "./InputFormik.es.js";
12
12
  import { default as Ve } from "./Logo.es.js";
@@ -14,14 +14,15 @@ import { Menu as Xe } from "./Menu.es.js";
14
14
  import { default as Je } from "./Pagination.es.js";
15
15
  import { default as Qe } from "./ProgressBar.es.js";
16
16
  import { default as _e } from "./Select.es.js";
17
- import { default as tt } from "./Spinner.es.js";
18
- import { default as rt } from "./SwipeContainer.es.js";
19
- import { default as nt } from "./TabLinks.es.js";
20
- import { Table as st, TableBody as lt, TableCaption as ct, TableCell as ut, TableFooter as dt, TableHead as ft, TableHeader as pt, TableRow as mt } from "./Table.es.js";
21
- import { default as bt } from "./TextArea.es.js";
22
- import { default as gt } from "./Tooltip.es.js";
17
+ import { default as tt } from "./SelectFormik.es.js";
18
+ import { default as rt } from "./Spinner.es.js";
19
+ import { default as nt } from "./SwipeContainer.es.js";
20
+ import { default as st } from "./TabLinks.es.js";
21
+ import { Table as ct, TableBody as ut, TableCaption as dt, TableCell as ft, TableFooter as pt, TableHead as mt, TableHeader as xt, TableRow as bt } from "./Table.es.js";
22
+ import { default as gt } from "./TextArea.es.js";
23
+ import { default as ht } from "./Tooltip.es.js";
23
24
  import { u as j } from "./LayoutGeneric-jDE96L2N.js";
24
- import { L as ht, S as wt } from "./LayoutGeneric-jDE96L2N.js";
25
+ import { L as jt, S as Nt } from "./LayoutGeneric-jDE96L2N.js";
25
26
  import { j as a } from "./jsx-runtime-ByW6EXIE.js";
26
27
  import { c as s } from "./cn-B6yFEsav.js";
27
28
  import { useRef as p, useState as v, useLayoutEffect as q, createContext as P, useContext as A, forwardRef as N, useCallback as T, useEffect as C } from "react";
@@ -29,8 +30,8 @@ import { useGSAP as S } from "@gsap/react";
29
30
  import c from "gsap";
30
31
  import { Icons as b } from "./Icons.es.js";
31
32
  import { motion as d, AnimatePresence as k } from "framer-motion";
32
- import { default as Nt } from "./OtpInput.es.js";
33
- import { DropZone as St } from "./DropZone.es.js";
33
+ import { default as St } from "./OtpInput.es.js";
34
+ import { DropZone as It } from "./DropZone.es.js";
34
35
  const D = (t, e) => {
35
36
  S(
36
37
  () => {
@@ -131,12 +132,12 @@ const D = (t, e) => {
131
132
  }
132
133
  )
133
134
  ] }) });
134
- }, E = ({ children: t, className: e }) => /* @__PURE__ */ a.jsx("div", { className: s("h-16 ", e), children: t }), O = ({ children: t, className: e }) => /* @__PURE__ */ a.jsx("div", { className: s("flex-1 overflow-y-auto p-4", e), children: t }), z = ({ children: t, className: e }) => /* @__PURE__ */ a.jsx("div", { className: s("p-4 border-t border-neutral-strong-default", e), children: t }), H = ({ className: t }) => /* @__PURE__ */ a.jsx("div", { className: s("flex-1", t) }), ie = Object.assign(w, {
135
+ }, E = ({ children: t, className: e }) => /* @__PURE__ */ a.jsx("div", { className: s("h-16 ", e), children: t }), O = ({ children: t, className: e }) => /* @__PURE__ */ a.jsx("div", { className: s("flex-1 overflow-y-auto p-4", e), children: t }), z = ({ children: t, className: e }) => /* @__PURE__ */ a.jsx("div", { className: s("p-4 border-t border-neutral-strong-default", e), children: t }), F = ({ className: t }) => /* @__PURE__ */ a.jsx("div", { className: s("flex-1", t) }), ie = Object.assign(w, {
135
136
  Root: w,
136
137
  Header: E,
137
138
  Content: O,
138
139
  Footer: z,
139
- Spacer: H
140
+ Spacer: F
140
141
  }), I = P(
141
142
  void 0
142
143
  ), se = () => {
@@ -144,7 +145,7 @@ const D = (t, e) => {
144
145
  if (!t)
145
146
  throw new Error("useSidebar must be used within a Sidebar.Root");
146
147
  return t;
147
- }, F = ({
148
+ }, H = ({
148
149
  children: t
149
150
  }) => {
150
151
  const [e, o] = v(!1), [r, n] = v(!1), i = p(null), l = () => {
@@ -508,7 +509,7 @@ const D = (t, e) => {
508
509
  );
509
510
  }
510
511
  ), h = N(
511
- (t, e) => /* @__PURE__ */ a.jsx(F, { children: /* @__PURE__ */ a.jsx(V, { ...t, ref: e }) })
512
+ (t, e) => /* @__PURE__ */ a.jsx(H, { children: /* @__PURE__ */ a.jsx(V, { ...t, ref: e }) })
512
513
  );
513
514
  h.displayName = "SidebarRoot";
514
515
  const G = ({ isCollapsed: t, onToggleCollapse: e }) => /* @__PURE__ */ a.jsx("div", { className: s("flex mt-5 mb-4 justify-end mr-5 container-icon-collapsade", t && ""), children: /* @__PURE__ */ a.jsx(
@@ -840,39 +841,40 @@ export {
840
841
  Re as DialogModal,
841
842
  Ae as DrawerDesktop,
842
843
  Ee as DrawerMobile,
843
- St as DropZone,
844
- He as Header,
844
+ It as DropZone,
845
+ Fe as Header,
845
846
  b as Icons,
846
847
  We as Input,
847
848
  Me as InputFormik,
848
- ht as LayoutGeneric,
849
+ jt as LayoutGeneric,
849
850
  Ve as Logo,
850
851
  Xe as Menu,
851
852
  ue as NavBarActions,
852
853
  me as NavbarCollapseButton,
853
854
  de as NavbarLinks,
854
855
  ce as NavigationLink,
855
- Nt as OtpInput,
856
+ St as OtpInput,
856
857
  Je as Pagination,
857
858
  Qe as ProgressBar,
858
859
  ie as SecondaryBar,
859
860
  _e as Select,
861
+ tt as SelectFormik,
860
862
  le as Sidebar,
861
- F as SidebarProvider,
862
- wt as SidebarRefProvider,
863
- tt as Spinner,
864
- rt as SwipeContainer,
865
- nt as TabLinks,
866
- st as Table,
867
- lt as TableBody,
868
- ct as TableCaption,
869
- ut as TableCell,
870
- dt as TableFooter,
871
- ft as TableHead,
872
- pt as TableHeader,
873
- mt as TableRow,
874
- bt as TextArea,
875
- gt as Tooltip,
863
+ H as SidebarProvider,
864
+ Nt as SidebarRefProvider,
865
+ rt as Spinner,
866
+ nt as SwipeContainer,
867
+ st as TabLinks,
868
+ ct as Table,
869
+ ut as TableBody,
870
+ dt as TableCaption,
871
+ ft as TableCell,
872
+ pt as TableFooter,
873
+ mt as TableHead,
874
+ xt as TableHeader,
875
+ bt as TableRow,
876
+ gt as TextArea,
877
+ ht as Tooltip,
876
878
  fe as useActionsNavbar,
877
879
  be as useClickOutside,
878
880
  qe as useDialogControl,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prometeo-design-system",
3
3
  "private": false,
4
- "version": "1.6.0",
4
+ "version": "1.6.1",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",
@@ -81,6 +81,10 @@
81
81
  "types": "./dist/Select.d.ts",
82
82
  "import": "./dist/Select.es.js"
83
83
  },
84
+ "./SelectFormik": {
85
+ "types": "./dist/SelectFormik.d.ts",
86
+ "import": "./dist/SelectFormik.es.js"
87
+ },
84
88
  "./Spinner": {
85
89
  "types": "./dist/Spinner.d.ts",
86
90
  "import": "./dist/Spinner.es.js"