@eyesee/ui-components 0.5.0 → 0.7.0

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,97 +1,101 @@
1
- import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
- import { useState as W, useRef as j } from "react";
3
- import c from "clsx";
4
- import { ChevronDownIcon as B } from "../icons-v2/ChevronDownIcon.js";
5
- import { ChevronUpIcon as L } from "../icons-v2/ChevronUpIcon.js";
6
- import R from "../../hooks/useClickOutside.js";
1
+ import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
+ import { useState as L, useRef as R } from "react";
3
+ import m from "clsx";
4
+ import { ChevronDownIcon as S } from "../icons-v2/ChevronDownIcon.js";
5
+ import { ChevronUpIcon as A } from "../icons-v2/ChevronUpIcon.js";
6
+ import E from "../../hooks/useClickOutside.js";
7
+ import { ListItem as U } from "../ListItem/ListItem.js";
8
+ import { DropdownList as q } from "../DropdownList/DropdownList.js";
9
+ import { Tooltip as z } from "../Tooltip/Tooltip.js";
7
10
  import e from "./Button.module.scss.js";
8
- import { ListItem as S } from "../ListItem/ListItem.js";
9
- import { DropdownList as A } from "../DropdownList/DropdownList.js";
10
- import { Tooltip as E } from "../Tooltip/Tooltip.js";
11
- const Q = ({
11
+ const Y = ({
12
12
  text: l,
13
- options: r = [],
14
- onClick: i = () => {
13
+ options: p = [],
14
+ onClick: u = () => {
15
15
  },
16
- className: d,
17
- iconSize: p = "m",
18
- size: b = "md",
19
- variant: g = "primary",
20
- type: w = "fill",
16
+ className: w,
17
+ iconSize: f = "m",
18
+ size: v = "md",
19
+ variant: N = "primary",
20
+ type: O = "fill",
21
+ pressed: h = !1,
21
22
  icon: a = null,
22
- tooltipContent: u = null,
23
- tooltipTitle: I,
24
- disabled: v = !1,
25
- fullWidth: C = !1,
26
- dropdownAlign: N = "start",
27
- tooltipProps: O = { position: "bottom", variant: "light" },
28
- ...y
23
+ tooltipContent: d = null,
24
+ tooltipTitle: g,
25
+ disabled: y = !1,
26
+ fullWidth: D = !1,
27
+ dropdownAlign: x = "start",
28
+ tooltipProps: k = { position: "bottom", variant: "light" },
29
+ dropdownCustomContent: s = null,
30
+ ...B
29
31
  }) => {
30
- const [s, o] = W(!1), h = j(null);
31
- R(h, () => o(!1));
32
- const x = (t) => {
33
- i(t), o(!1);
34
- }, D = a && !l && r.length === 0, k = a && !l, T = !!u, f = /* @__PURE__ */ m(
32
+ const [o, i] = L(!1), b = R(null);
33
+ E(b, () => i(!1));
34
+ const T = (n) => {
35
+ u(n), i(!1);
36
+ }, t = p.length > 0 || !!s, W = a && !l && !t, j = a && !l, C = !!d, I = /* @__PURE__ */ c(
35
37
  "div",
36
38
  {
37
- ref: h,
39
+ ref: b,
38
40
  "data-button-wrapper": !0,
39
- className: c(e.wrapper, d, C && e.fullWidth),
40
- ...y,
41
+ className: m(e.wrapper, w, D && e.fullWidth),
42
+ ...B,
41
43
  children: [
42
- /* @__PURE__ */ m(
44
+ /* @__PURE__ */ c(
43
45
  "button",
44
46
  {
45
47
  type: "button",
46
- className: c(
48
+ className: m(
47
49
  e.button,
48
- e[b],
49
- e[g],
50
- e[w],
51
- r.length > 0 && e.hasDropdown,
52
- D && e.iconOnly,
53
- k && e.isIcon
50
+ e[v],
51
+ e[N],
52
+ e[O],
53
+ t && e.hasDropdown,
54
+ W && e.iconOnly,
55
+ j && e.isIcon,
56
+ h && e.pressed
54
57
  ),
55
- onClick: () => r.length > 0 ? o((t) => !t) : i(),
56
- "aria-expanded": s,
58
+ onClick: () => t ? i((n) => !n) : u(),
59
+ "aria-expanded": o,
60
+ "aria-pressed": h,
57
61
  "aria-haspopup": "menu",
58
- disabled: v,
62
+ disabled: y,
59
63
  children: [
60
- /* @__PURE__ */ m(
64
+ /* @__PURE__ */ c(
61
65
  "span",
62
66
  {
63
- className: c(
67
+ className: m(
64
68
  e.buttonContent,
65
- r.length > 0 && e.buttonContentDropdown
69
+ t && e.buttonContentDropdown
66
70
  ),
67
71
  children: [
68
- a && /* @__PURE__ */ n("span", { className: e.icon, children: a }),
69
- l && /* @__PURE__ */ n("span", { className: e.buttonText, children: l })
72
+ a && /* @__PURE__ */ r("span", { className: e.icon, children: a }),
73
+ l && /* @__PURE__ */ r("span", { className: e.buttonText, children: l })
70
74
  ]
71
75
  }
72
76
  ),
73
- r.length > 0 && /* @__PURE__ */ n("span", { className: e.buttonArrow, children: s ? /* @__PURE__ */ n(L, { iconSize: p }) : /* @__PURE__ */ n(B, { iconSize: p }) })
77
+ t && /* @__PURE__ */ r("span", { className: e.buttonArrow, children: o ? /* @__PURE__ */ r(A, { iconSize: f }) : /* @__PURE__ */ r(S, { iconSize: f }) })
74
78
  ]
75
79
  }
76
80
  ),
77
- s && r.length > 0 && /* @__PURE__ */ n(A, { align: N, children: r.map((t) => /* @__PURE__ */ n(
78
- S,
81
+ o && t && /* @__PURE__ */ r(q, { align: x, children: s || p.map((n) => /* @__PURE__ */ r(
82
+ U,
79
83
  {
80
84
  role: "menuitem",
81
- title: t.label,
82
- controlItem: t == null ? void 0 : t.icon,
85
+ title: n.label,
86
+ controlItem: n == null ? void 0 : n.icon,
83
87
  horizontalSpacing: "xs",
84
88
  verticalSpacing: "none",
85
- ...t,
86
- onClick: () => x(t)
89
+ ...n,
90
+ onClick: () => T(n)
87
91
  },
88
- t.value
92
+ n.value
89
93
  )) })
90
94
  ]
91
95
  }
92
96
  );
93
- return T ? /* @__PURE__ */ n(E, { title: I, content: u, ...O, children: f }) : f;
97
+ return C ? /* @__PURE__ */ r(z, { title: g, content: d, ...k, children: I }) : I;
94
98
  };
95
99
  export {
96
- Q as Button
100
+ Y as Button
97
101
  };
@@ -1,53 +1,55 @@
1
- const t = "_fullWidth_167fk_3", n = "_button_167fk_6", o = "_wrapper_167fk_10", _ = "_buttonContent_167fk_27", s = "_icon_167fk_27", c = "_buttonArrow_167fk_28", r = "_buttonText_167fk_36", f = "_iconOnly_167fk_53", e = "_buttonContentDropdown_167fk_56", l = "_hasDropdown_167fk_62", u = "_lg_167fk_78", k = "_isIcon_167fk_81", i = "_md_167fk_85", x = "_sm_167fk_92", a = "_xs_167fk_99", d = "_xxs_167fk_106", b = "_xxxs_167fk_113", p = "_primary_167fk_123", w = "_fill_167fk_123", y = "_outline_167fk_154", m = "_blank_167fk_167", h = "_secondary_167fk_214", C = "_destructive_167fk_305", D = "_neutral_167fk_396", g = {
1
+ const t = "_fullWidth_16rg3_3", n = "_button_16rg3_6", o = "_wrapper_16rg3_10", _ = "_buttonContent_16rg3_27", r = "_icon_16rg3_27", s = "_buttonArrow_16rg3_28", c = "_buttonText_16rg3_36", e = "_iconOnly_16rg3_53", l = "_buttonContentDropdown_16rg3_56", g = "_hasDropdown_16rg3_62", u = "_lg_16rg3_78", i = "_isIcon_16rg3_81", d = "_md_16rg3_85", x = "_sm_16rg3_92", a = "_xs_16rg3_99", p = "_xxs_16rg3_106", b = "_xxxs_16rg3_113", w = "_primary_16rg3_123", y = "_fill_16rg3_123", m = "_pressed_16rg3_127", f = "_outline_16rg3_154", h = "_blank_16rg3_167", C = "_secondary_16rg3_214", D = "_destructive_16rg3_305", k = "_neutral_16rg3_396", v = {
2
2
  fullWidth: t,
3
3
  button: n,
4
4
  wrapper: o,
5
5
  buttonContent: _,
6
- icon: s,
7
- buttonArrow: c,
8
- buttonText: r,
9
- iconOnly: f,
10
- buttonContentDropdown: e,
11
- hasDropdown: l,
6
+ icon: r,
7
+ buttonArrow: s,
8
+ buttonText: c,
9
+ iconOnly: e,
10
+ buttonContentDropdown: l,
11
+ hasDropdown: g,
12
12
  lg: u,
13
- isIcon: k,
14
- md: i,
13
+ isIcon: i,
14
+ md: d,
15
15
  sm: x,
16
16
  xs: a,
17
- xxs: d,
17
+ xxs: p,
18
18
  xxxs: b,
19
- primary: p,
20
- fill: w,
21
- outline: y,
22
- blank: m,
23
- secondary: h,
24
- destructive: C,
25
- neutral: D
19
+ primary: w,
20
+ fill: y,
21
+ pressed: m,
22
+ outline: f,
23
+ blank: h,
24
+ secondary: C,
25
+ destructive: D,
26
+ neutral: k
26
27
  };
27
28
  export {
28
- m as blank,
29
+ h as blank,
29
30
  n as button,
30
- c as buttonArrow,
31
+ s as buttonArrow,
31
32
  _ as buttonContent,
32
- e as buttonContentDropdown,
33
- r as buttonText,
34
- g as default,
35
- C as destructive,
36
- w as fill,
33
+ l as buttonContentDropdown,
34
+ c as buttonText,
35
+ v as default,
36
+ D as destructive,
37
+ y as fill,
37
38
  t as fullWidth,
38
- l as hasDropdown,
39
- s as icon,
40
- f as iconOnly,
41
- k as isIcon,
39
+ g as hasDropdown,
40
+ r as icon,
41
+ e as iconOnly,
42
+ i as isIcon,
42
43
  u as lg,
43
- i as md,
44
- D as neutral,
45
- y as outline,
46
- p as primary,
47
- h as secondary,
44
+ d as md,
45
+ k as neutral,
46
+ f as outline,
47
+ m as pressed,
48
+ w as primary,
49
+ C as secondary,
48
50
  x as sm,
49
51
  o as wrapper,
50
52
  a as xs,
51
- d as xxs,
53
+ p as xxs,
52
54
  b as xxxs
53
55
  };
@@ -1,10 +1,10 @@
1
1
  import { jsxs as z, jsx as r } from "react/jsx-runtime";
2
2
  import { useId as C } from "react";
3
3
  import n from "clsx";
4
- import o from "./Checkbox.module.scss.js";
5
4
  import { CheckmarkLargeIcon as I } from "../icons-v2/CheckmarkLargeIcon.js";
6
5
  import { MinusIcon as y } from "../icons-v2/MinusIcon.js";
7
6
  import { iconSizes as a } from "../icons-v2/constants.js";
7
+ import o from "./Checkbox.module.scss.js";
8
8
  const N = (e) => e === "lg" ? "m" : "s", W = ({
9
9
  label: e,
10
10
  checked: c = !1,
@@ -1,17 +1,17 @@
1
- const c = "_checkboxWrapper_apc3k_3", e = "_disabled_apc3k_13", _ = "_input_apc3k_18", a = "_checkbox_apc3k_3", l = "_filled_apc3k_42", p = "_labelText_apc3k_46", t = {
2
- checkboxWrapper: c,
3
- disabled: e,
1
+ const e = "_checkboxWrapper_1u1h6_3", c = "_disabled_1u1h6_13", _ = "_input_1u1h6_18", l = "_checkbox_1u1h6_3", t = "_filled_1u1h6_42", o = "_labelText_1u1h6_46", b = {
2
+ checkboxWrapper: e,
3
+ disabled: c,
4
4
  input: _,
5
- checkbox: a,
6
- filled: l,
7
- labelText: p
5
+ checkbox: l,
6
+ filled: t,
7
+ labelText: o
8
8
  };
9
9
  export {
10
- a as checkbox,
11
- c as checkboxWrapper,
12
- t as default,
13
- e as disabled,
14
- l as filled,
10
+ l as checkbox,
11
+ e as checkboxWrapper,
12
+ b as default,
13
+ c as disabled,
14
+ t as filled,
15
15
  _ as input,
16
- p as labelText
16
+ o as labelText
17
17
  };
@@ -1,4 +1,4 @@
1
- import { jsx as g } from "react/jsx-runtime";
1
+ import { jsx as u } from "react/jsx-runtime";
2
2
  import w from "clsx";
3
3
  import r from "./DropdownList.module.scss.js";
4
4
  const a = ({
@@ -13,12 +13,12 @@ const a = ({
13
13
  onLoadMore: t,
14
14
  style: d
15
15
  }) => {
16
- const f = (u) => {
17
- const l = u.currentTarget;
16
+ const f = (g) => {
17
+ const l = g.currentTarget;
18
18
  l.scrollHeight - l.scrollTop - l.clientHeight < 48 && (t == null || t());
19
19
  };
20
- return /* @__PURE__ */ g(
21
- "ul",
20
+ return /* @__PURE__ */ u(
21
+ "div",
22
22
  {
23
23
  ref: p,
24
24
  id: c,
@@ -0,0 +1,64 @@
1
+ import { jsxs as f, Fragment as p, jsx as m } from "react/jsx-runtime";
2
+ import { useRef as I, useState as E } from "react";
3
+ import { createPortal as M } from "react-dom";
4
+ import P from "../ImagePlaceholder.js";
5
+ import d from "./ImageHoverPreview.module.scss.js";
6
+ const w = 200, r = 8, u = 8, x = () => document.getElementById("modal") ?? document.body, g = (t, e, a) => Math.min(Math.max(t, e), a), j = ({ previewSize: t = w, ...e }) => {
7
+ const a = I(null), [s, c] = E(null);
8
+ return /* @__PURE__ */ f(p, { children: [
9
+ /* @__PURE__ */ m(
10
+ P,
11
+ {
12
+ ...e,
13
+ imageAreaRef: a,
14
+ onImageAreaMouseEnter: (l) => {
15
+ var i;
16
+ l.stopPropagation();
17
+ const o = (i = a.current) == null ? void 0 : i.getBoundingClientRect();
18
+ if (!o) return;
19
+ let n = o.right + u;
20
+ n + t > window.innerWidth - r && (n = o.left - t - u), n = g(
21
+ n,
22
+ r,
23
+ window.innerWidth - t - r
24
+ );
25
+ const h = g(
26
+ o.top + o.height / 2 - t / 2,
27
+ r,
28
+ window.innerHeight - t - r
29
+ );
30
+ c({ top: h, left: n });
31
+ },
32
+ onImageAreaMouseLeave: (l) => {
33
+ l.stopPropagation(), c(null);
34
+ }
35
+ }
36
+ ),
37
+ s && M(
38
+ /* @__PURE__ */ m(
39
+ "div",
40
+ {
41
+ className: d.preview,
42
+ style: {
43
+ top: s.top,
44
+ left: s.left,
45
+ width: t,
46
+ height: t
47
+ },
48
+ children: /* @__PURE__ */ m(
49
+ "img",
50
+ {
51
+ src: e.url,
52
+ alt: e.text ?? "",
53
+ className: d.previewImage
54
+ }
55
+ )
56
+ }
57
+ ),
58
+ x()
59
+ )
60
+ ] });
61
+ };
62
+ export {
63
+ j as ImageHoverPreview
64
+ };
@@ -0,0 +1,9 @@
1
+ const e = "_preview_18mb5_3", p = "_previewImage_18mb5_12", r = {
2
+ preview: e,
3
+ previewImage: p
4
+ };
5
+ export {
6
+ r as default,
7
+ e as preview,
8
+ p as previewImage
9
+ };