bmi-next 1.0.13 → 1.0.14

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.
@@ -1 +1 @@
1
- ._selectDrawer_81kt0_1{position:relative;width:100%}._selected_81kt0_6{border-radius:16px;display:flex;gap:5px;border:1px solid var(--negro-20);padding-inline:16px;height:52px;box-sizing:border-box;background-color:#fff;cursor:pointer;align-items:center;font-family:Poppins Regular;font-size:16px;line-height:19.2px}._selected_81kt0_6>span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:100%;line-height:52px}
1
+ ._selectDrawer_1o9yc_1{position:relative;width:100%;display:flex;flex-direction:column;gap:5px}._label_1o9yc_9{margin-left:9px;font-family:Poppins Medium;font-size:14px;line-height:16.8px}._selected_1o9yc_16{border-radius:16px;display:flex;gap:5px;border:1px solid var(--negro-20);padding-inline:16px;height:52px;box-sizing:border-box;background-color:#fff;cursor:pointer;align-items:center;font-family:Poppins Regular;font-size:16px;line-height:19.2px}._selected_1o9yc_16>span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:100%;line-height:52px}
@@ -35,6 +35,7 @@ export interface Option {
35
35
  * @property {boolean} [countries] - Flag opcional para mostrar las opciones de países (ejemplo de uso específico).
36
36
  * @property {Function} [onChange] - Función callback que se ejecuta cuando cambia la opción seleccionada.
37
37
  * @property {number} [zIndex] - Valor opcional para establecer el `z-index` del cajón.
38
+ * @property {string} [label] - Título del select opcional para mostrar encima del cajón.
38
39
  */
39
40
  export interface SelectProps {
40
41
  /** La opción actualmente seleccionada */
@@ -50,6 +51,7 @@ export interface SelectProps {
50
51
  countries?: boolean;
51
52
  onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
52
53
  zIndex?: number;
54
+ label?: string;
53
55
  }
54
56
  /**
55
57
  * Componente Select que permite al usuario seleccionar una opción de un conjunto de opciones.
@@ -75,4 +77,4 @@ export interface SelectProps {
75
77
  * @param {SelectProps} props - Props del componente Select
76
78
  * @returns {JSX.Element} El componente Select.
77
79
  */
78
- export declare function Select({ options, selected, setSelected, title, countries, onChange, zIndex, ...selectProps }: SelectProps): import("react/jsx-runtime").JSX.Element;
80
+ export declare function Select({ options, selected, setSelected, title, countries, onChange, zIndex, label, ...selectProps }: SelectProps): import("react/jsx-runtime").JSX.Element;
@@ -1,75 +1,80 @@
1
- import { jsxs as v, Fragment as x, jsx as t } from "react/jsx-runtime";
2
- import { Icon as E } from "../../icons/icons.js";
3
- import { useState as a, useRef as h, useEffect as O } from "react";
4
- import { Image as P } from "../images/index.js";
5
- import { DrawerPortal as R } from "./DrawerPortal/index.js";
6
- import '../../assets/index2.css';const j = "_selectDrawer_81kt0_1", N = "_selected_81kt0_6", w = {
7
- selectDrawer: j,
8
- selected: N
1
+ import { jsxs as o, Fragment as N, jsx as l } from "react/jsx-runtime";
2
+ import { Icon as O } from "../../icons/icons.js";
3
+ import { useState as c, useRef as y, useEffect as P } from "react";
4
+ import { Image as R } from "../images/index.js";
5
+ import { DrawerPortal as j } from "./DrawerPortal/index.js";
6
+ import '../../assets/index2.css';const k = "_selectDrawer_1o9yc_1", A = "_label_1o9yc_9", F = "_selected_1o9yc_16", i = {
7
+ selectDrawer: k,
8
+ label: A,
9
+ selected: F
9
10
  };
10
- function q({
11
- options: o,
12
- selected: l,
13
- setSelected: c,
14
- title: g,
15
- countries: p,
16
- onChange: i,
17
- zIndex: y,
18
- ...b
11
+ function B({
12
+ options: a,
13
+ selected: t,
14
+ setSelected: u,
15
+ title: b,
16
+ countries: g,
17
+ onChange: d,
18
+ zIndex: p,
19
+ label: f,
20
+ ..._
19
21
  }) {
20
- const [r, u] = a(!1), [D, d] = a(!1), _ = h(null), [C, f] = a(0), s = h(null);
21
- O(() => (r ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
22
+ const [s, m] = c(!1), [D, v] = c(!1), C = y(null), [I, h] = c(0), r = y(null);
23
+ P(() => (s ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
22
24
  document.body.style.overflow = "";
23
- }), [r]);
24
- const m = () => {
25
- d(!0), setTimeout(() => {
26
- u(!1), d(!1), f(0);
25
+ }), [s]);
26
+ const w = () => {
27
+ v(!0), setTimeout(() => {
28
+ m(!1), v(!1), h(0);
27
29
  }, 350);
28
- }, k = (e) => {
29
- if (c(e), s.current) {
30
- s.current.value = e.value;
30
+ }, x = (e) => {
31
+ if (u(e), r.current) {
32
+ r.current.value = e.value;
31
33
  const n = new Event("change", { bubbles: !0 });
32
- s.current.dispatchEvent(n);
34
+ r.current.dispatchEvent(n);
33
35
  }
34
- m();
36
+ w();
35
37
  };
36
- return /* @__PURE__ */ v(x, { children: [
37
- /* @__PURE__ */ t(
38
+ return /* @__PURE__ */ o(N, { children: [
39
+ /* @__PURE__ */ l(
38
40
  "select",
39
41
  {
40
- ref: s,
41
- value: l.value,
42
+ ref: r,
43
+ value: t.value,
42
44
  onChange: (e) => {
43
- const n = o.find((I) => I.value === e.target.value);
44
- n && c(n), i && i(e);
45
+ const n = a.find((E) => E.value === e.target.value);
46
+ n && u(n), d && d(e);
45
47
  },
46
48
  style: { display: "none" },
47
- ...b,
48
- children: o.map((e) => /* @__PURE__ */ t("option", { value: e.value, children: e.label }, e.value))
49
+ ..._,
50
+ children: a.map((e) => /* @__PURE__ */ l("option", { value: e.value, children: e.label }, e.value))
49
51
  }
50
52
  ),
51
- /* @__PURE__ */ t("div", { ref: _, className: w.selectDrawer, children: /* @__PURE__ */ v("div", { className: w.selected, onClick: () => u(!r), children: [
52
- l.image && /* @__PURE__ */ t(P, { src: l.image.src, width: 30, height: 30 }),
53
- /* @__PURE__ */ t("span", { children: l.label }),
54
- /* @__PURE__ */ t("div", { style: { marginLeft: "auto" }, children: /* @__PURE__ */ t(E, { name: "ArrowDown" }) })
55
- ] }) }),
56
- /* @__PURE__ */ t(
57
- R,
53
+ /* @__PURE__ */ o("div", { ref: C, className: i.selectDrawer, children: [
54
+ f && /* @__PURE__ */ l("label", { className: i.label, children: f }),
55
+ /* @__PURE__ */ o("div", { className: i.selected, onClick: () => m(!s), children: [
56
+ t.image && /* @__PURE__ */ l(R, { src: t.image.src, width: 30, height: 30 }),
57
+ /* @__PURE__ */ l("span", { children: t.label }),
58
+ /* @__PURE__ */ l("div", { style: { marginLeft: "auto" }, children: /* @__PURE__ */ l(O, { name: "ArrowDown" }) })
59
+ ] })
60
+ ] }),
61
+ /* @__PURE__ */ l(
62
+ j,
58
63
  {
59
- isOpen: r,
60
- handleClose: m,
61
- dragPosition: C,
62
- setDragPosition: f,
64
+ isOpen: s,
65
+ handleClose: w,
66
+ dragPosition: I,
67
+ setDragPosition: h,
63
68
  isClosing: D,
64
- title: g,
65
- options: o,
66
- handleOptionClick: k,
67
- countries: p,
68
- zIndex: y
69
+ title: b,
70
+ options: a,
71
+ handleOptionClick: x,
72
+ countries: g,
73
+ zIndex: p
69
74
  }
70
75
  )
71
76
  ] });
72
77
  }
73
78
  export {
74
- q as Select
79
+ B as Select
75
80
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bmi-next",
3
3
  "description": "Componentes de UI para proyecto BMI Next",
4
- "version": "1.0.13",
4
+ "version": "1.0.14",
5
5
  "author": "David Fernández Bolaños <david@bmiahorro.com>",
6
6
  "contributors": [
7
7
  "Jorge Martín <jorge@bmiahorro.com>",