@prokodo/ui 0.0.14 → 0.0.15

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,115 +1,106 @@
1
- import { j as n } from "../../_virtual/jsx-runtime.js";
2
- import { useState as C, useCallback as j } from "react";
3
- import { create as E } from "../../helpers/bem.js";
4
- import { isNull as N } from "../../helpers/validations.js";
5
- import w from "./Accordion.module.scss.js";
6
- import { Headline as S } from "../headline/Headline.js";
7
- import { Animated as z } from "../animated/Animated.js";
8
- import { Button as B } from "../button/Button.js";
9
- import { Icon as H } from "../icon/Icon.js";
10
- const a = E(w, "Accordion"), D = ({
11
- id: f,
12
- expanded: y,
13
- className: I,
14
- variant: $ = "primary",
1
+ import { j as s } from "../../_virtual/jsx-runtime.js";
2
+ import { useState as E, useCallback as u } from "react";
3
+ import S from "../../vendor/hugeicons/minus_sign_icon.js";
4
+ import g from "../../vendor/hugeicons/plus_sign_icon.js";
5
+ import { create as w } from "../../helpers/bem.js";
6
+ import { isNull as f } from "../../helpers/validations.js";
7
+ import B from "./Accordion.module.scss.js";
8
+ import { Headline as H } from "../headline/Headline.js";
9
+ import { Animated as D } from "../animated/Animated.js";
10
+ import { Button as K } from "../button/Button.js";
11
+ const a = w(B, "Accordion"), R = ({
12
+ id: j,
13
+ expanded: N,
14
+ className: $,
15
+ variant: y = "primary",
15
16
  titleOptions: b,
16
- iconProps: l,
17
- items: v,
17
+ items: z,
18
18
  onChange: m,
19
- ...g
19
+ iconOverride: t,
20
+ ...I
20
21
  }) => {
21
- const [d, k] = C(y), p = j(
22
- (e, r) => {
23
- const t = d === e ? null : e;
24
- k(t), m(e, r, t !== null);
22
+ const [c, k] = E(N), p = u(
23
+ (e, l) => {
24
+ const d = c === e ? null : e;
25
+ k(d), m(e, l, d !== null);
25
26
  },
26
- [d, m]
27
- ), x = j(
28
- (e, r, t) => /* @__PURE__ */ n.jsx(
29
- H,
30
- {
31
- className: a("icon", { "is-hidden": !!t }),
32
- color: r,
33
- name: e,
34
- size: "sm",
35
- ...l
36
- }
37
- ),
38
- [l]
27
+ [c, m]
28
+ ), A = u(
29
+ (e) => e ? (t == null ? void 0 : t.expanded) ?? /* @__PURE__ */ s.jsx(S, { className: a("icon"), size: 20 }) : (t == null ? void 0 : t.collapsed) ?? /* @__PURE__ */ s.jsx(g, { className: a("icon"), size: 20 }),
30
+ [t]
39
31
  );
40
- return /* @__PURE__ */ n.jsx("div", { className: a(void 0, { [$]: !0 }, I), ...g, children: v.map((e, r) => {
32
+ return /* @__PURE__ */ s.jsx("div", { className: a(void 0, { [y]: !0 }, $), ...I, children: z.map((e, l) => {
41
33
  const {
42
- className: t,
43
- title: A,
44
- renderHeader: h,
45
- renderContent: u,
46
- actions: c
47
- } = e, i = `${f}-${e.title}`, s = d === r;
48
- return /* @__PURE__ */ n.jsxs(
34
+ className: d,
35
+ title: C,
36
+ renderHeader: x,
37
+ renderContent: h,
38
+ actions: i
39
+ } = e, r = `${j}-${e.title}`, o = c === l;
40
+ return /* @__PURE__ */ s.jsxs(
49
41
  "div",
50
42
  {
51
43
  className: a(
52
44
  "item",
53
- { "is-expanded": s },
54
- t
45
+ { "is-expanded": o },
46
+ d
55
47
  ),
56
48
  children: [
57
- /* @__PURE__ */ n.jsxs(
49
+ /* @__PURE__ */ s.jsxs(
58
50
  "div",
59
51
  {
60
- "aria-controls": `${i}-content`,
61
- "aria-expanded": s,
62
- className: a("header", { "is-expanded": s }),
63
- id: `${i}-header`,
52
+ "aria-controls": `${r}-content`,
53
+ "aria-expanded": o,
54
+ className: a("header", { "is-expanded": o }),
55
+ id: `${r}-header`,
64
56
  role: "button",
65
57
  tabIndex: 0,
66
- onClick: (o) => p(r, o),
67
- onKeyDown: (o) => {
68
- (o.key === "Enter" || o.key === " ") && p(r, o);
58
+ onClick: (n) => p(l, n),
59
+ onKeyDown: (n) => {
60
+ (n.key === "Enter" || n.key === " ") && p(l, n);
69
61
  },
70
62
  children: [
71
- N(h) ? /* @__PURE__ */ n.jsx(
72
- S,
63
+ f(x) ? /* @__PURE__ */ s.jsx(
64
+ H,
73
65
  {
74
- className: a("title", { "is-expanded": s }),
66
+ className: a("title", { "is-expanded": o }),
75
67
  size: "sm",
76
68
  type: "h3",
77
69
  ...(e == null ? void 0 : e.titleOptions) ?? b,
78
- children: A
70
+ children: C
79
71
  }
80
- ) : h,
81
- x("PlusSignIcon", "primary", s),
82
- x("MinusSignIcon", "white", !s)
72
+ ) : x,
73
+ A(o)
83
74
  ]
84
75
  }
85
76
  ),
86
- /* @__PURE__ */ n.jsxs(
77
+ /* @__PURE__ */ s.jsxs(
87
78
  "div",
88
79
  {
89
- "aria-labelledby": `${i}-header`,
90
- className: a("content", { "is-expanded": s }),
91
- hidden: !s,
92
- id: `${i}-content`,
80
+ "aria-labelledby": `${r}-header`,
81
+ className: a("content", { "is-expanded": o }),
82
+ hidden: !o,
83
+ id: `${r}-content`,
93
84
  role: "region",
94
85
  children: [
95
- !N(u) && /* @__PURE__ */ n.jsx(z, { children: u }),
96
- c && c.length > 0 && /* @__PURE__ */ n.jsx("div", { className: a("actions"), children: c.map((o) => /* @__PURE__ */ n.jsx(
97
- B,
86
+ !f(h) && /* @__PURE__ */ s.jsx(D, { children: h }),
87
+ i && i.length > 0 && /* @__PURE__ */ s.jsx("div", { className: a("actions"), children: i.map((n) => /* @__PURE__ */ s.jsx(
88
+ K,
98
89
  {
99
- ...o
90
+ ...n
100
91
  },
101
- `${i}-action-${o.id}`
92
+ `${r}-action-${n.id}`
102
93
  )) })
103
94
  ]
104
95
  }
105
96
  )
106
97
  ]
107
98
  },
108
- i
99
+ r
109
100
  );
110
101
  }) });
111
102
  };
112
- D.displayName = "Accordion";
103
+ R.displayName = "Accordion";
113
104
  export {
114
- D as Accordion
105
+ R as Accordion
115
106
  };
@@ -8,7 +8,6 @@ const o = "backgroundFill", d = "gradientMove", c = "fadeInKeyframe", r = {
8
8
  "prokodo-Accordion__title": "prokodo-Accordion__title",
9
9
  "prokodo-Accordion__title--is-expanded": "prokodo-Accordion__title--is-expanded",
10
10
  "prokodo-Accordion__icon": "prokodo-Accordion__icon",
11
- "prokodo-Accordion__icon--is-hidden": "prokodo-Accordion__icon--is-hidden",
12
11
  "prokodo-Accordion__content": "prokodo-Accordion__content",
13
12
  "prokodo-Accordion__content--is-expanded": "prokodo-Accordion__content--is-expanded",
14
13
  "prokodo-Accordion__actions": "prokodo-Accordion__actions",
@@ -1,78 +1,80 @@
1
- import { j as m } from "../../_virtual/jsx-runtime.js";
2
- import { useMemo as d, useCallback as f } from "react";
3
- import { create as x } from "../../helpers/bem.js";
4
- import p from "./Avatar.module.scss.js";
5
- import { Image as h } from "../image/Image.js";
6
- import { Icon as j, getIconSize as u } from "../icon/Icon.js";
7
- import { Link as I } from "../link/Link.js";
8
- const t = x(p, "Avatar"), y = ({
9
- className: a,
1
+ import { j as e } from "../../_virtual/jsx-runtime.js";
2
+ import { useMemo as d, useCallback as p } from "react";
3
+ import x from "../../vendor/hugeicons/user_icon.js";
4
+ import { create as h } from "../../helpers/bem.js";
5
+ import j from "./Avatar.module.scss.js";
6
+ import { Image as u } from "../image/Image.js";
7
+ import { getIconSize as I } from "../icon/Icon.js";
8
+ import { Link as N } from "../link/Link.js";
9
+ const t = h(j, "Avatar"), E = ({
10
+ className: n,
10
11
  variant: o = "primary",
11
12
  size: s = "sm",
12
13
  image: r,
13
14
  redirect: i,
14
- ...c
15
+ iconOverride: c,
16
+ ...l
15
17
  }) => {
16
- const e = d(
18
+ const m = d(
17
19
  () => ({
18
20
  [o]: !!o
19
21
  }),
20
22
  [o]
21
- ), n = d(
23
+ ), a = d(
22
24
  () => ({
23
25
  [`has-size-${s}`]: !!s
24
26
  }),
25
27
  [s]
26
- ), l = f(
27
- () => /* @__PURE__ */ m.jsx(
28
+ ), f = p(
29
+ () => /* @__PURE__ */ e.jsx(
28
30
  "div",
29
31
  {
30
- ...c,
32
+ ...l,
31
33
  tabIndex: -1,
32
34
  className: t(
33
35
  void 0,
34
36
  {
35
- ...e,
36
- ...n
37
+ ...m,
38
+ ...a
37
39
  },
38
- a
40
+ n
39
41
  ),
40
- children: r ? /* @__PURE__ */ m.jsx(
41
- h,
42
+ children: r ? /* @__PURE__ */ e.jsx(
43
+ u,
42
44
  {
43
45
  ...r,
44
46
  className: t("image", void 0, r.className),
45
47
  tabIndex: 0
46
48
  }
47
- ) : /* @__PURE__ */ m.jsx(
48
- j,
49
+ ) : c ?? /* @__PURE__ */ e.jsx(
50
+ x,
49
51
  {
50
- className: t("icon", e),
52
+ className: t("icon", m),
51
53
  name: "UserIcon",
52
- size: u(s) * 2,
54
+ size: I(s) * 2,
53
55
  color: ["inherit", "white"].includes(o) ? void 0 : "white"
54
56
  }
55
57
  )
56
58
  }
57
59
  ),
58
- [n, e, a, r, o, s, c]
60
+ [a, m, n, r, o, s, c, l]
59
61
  );
60
- return i ? /* @__PURE__ */ m.jsx(
61
- I,
62
+ return i ? /* @__PURE__ */ e.jsx(
63
+ N,
62
64
  {
63
65
  ...i,
64
66
  className: t(
65
67
  "link",
66
68
  {
67
- ...e,
68
- ...n
69
+ ...m,
70
+ ...a
69
71
  },
70
72
  i.className
71
73
  ),
72
- children: l()
74
+ children: f()
73
75
  }
74
- ) : l();
76
+ ) : f();
75
77
  };
76
78
  export {
77
- y as Avatar
79
+ E as Avatar
78
80
  };
@@ -1,81 +1,86 @@
1
- import { j as t } from "../../_virtual/jsx-runtime.js";
2
- import { useId as C, useRef as g, useMemo as v } from "react";
3
- import { create as w } from "../../helpers/bem.js";
1
+ import { j as o } from "../../_virtual/jsx-runtime.js";
2
+ import { useId as E, useRef as N, useMemo as C, isValidElement as g, cloneElement as w } from "react";
3
+ import { create as z } from "../../helpers/bem.js";
4
4
  import { isString as D } from "../../helpers/validations.js";
5
- import E from "./Button.module.scss.js";
6
- import { Link as K } from "../link/Link.js";
7
- import { Loading as L } from "../loading/Loading.js";
8
- import { Icon as R } from "../icon/Icon.js";
9
- const l = w(E, "Button"), M = {}, O = {}, H = ({
10
- id: d,
11
- fullWidth: f,
12
- color: i = "primary",
13
- iconProps: m = {},
14
- loading: x,
15
- variant: e = "contained",
5
+ import K from "./Button.module.scss.js";
6
+ import { Link as L } from "../link/Link.js";
7
+ import { Loading as R } from "../loading/Loading.js";
8
+ const m = z(K, "Button"), M = {}, O = {}, H = ({
9
+ id: u,
10
+ fullWidth: c,
11
+ color: l = "primary",
12
+ icon: t,
13
+ loading: f,
14
+ variant: a = "contained",
16
15
  className: h,
17
16
  contentClassName: y,
18
- disabled: a,
19
- redirect: u,
20
- ...n
17
+ disabled: i,
18
+ redirect: s,
19
+ ...e
21
20
  }) => {
22
- const I = C(), k = g(null), s = `Button-${I}`, N = e === "outlined", B = m == null ? void 0 : m.name, $ = B && !(n != null && n.title), c = v(
21
+ const j = E(), I = N(null), x = `Button-${j}`, k = a === "outlined", B = t !== void 0 && !(e != null && e.title), d = C(
23
22
  () => ({
24
- "icon-only": !!$
23
+ "icon-only": !!B
25
24
  }),
26
- [$]
27
- ), r = () => /* @__PURE__ */ t.jsxs("span", { ref: k, "aria-labelledby": s, className: l("title"), children: [
28
- B && /* @__PURE__ */ t.jsx(R, { className: l("icon", c), ...m }),
29
- n == null ? void 0 : n.title
30
- ] }), b = () => x ? /* @__PURE__ */ t.jsx(L, { size: "xs" }) : r(), j = () => N ? /* @__PURE__ */ t.jsx("div", { className: l("content", c, y), children: b() }) : b();
31
- return u ? /* @__PURE__ */ t.jsx(
32
- K,
25
+ [B]
26
+ ), v = () => {
27
+ var n, r;
28
+ return /* @__PURE__ */ o.jsxs("span", { ref: I, "aria-labelledby": x, className: m("title"), children: [
29
+ t !== void 0 && g(t) && w(t, {
30
+ className: m("icon", d, (n = t == null ? void 0 : t.props) == null ? void 0 : n.className),
31
+ size: ((r = t == null ? void 0 : t.props) == null ? void 0 : r.size) ?? 20
32
+ }),
33
+ e == null ? void 0 : e.title
34
+ ] });
35
+ }, $ = () => f ? /* @__PURE__ */ o.jsx(R, { size: "xs" }) : v(), b = () => k ? /* @__PURE__ */ o.jsx("div", { className: m("content", d, y), children: $() }) : $();
36
+ return s ? /* @__PURE__ */ o.jsx(
37
+ L,
33
38
  {
34
- disabled: a,
35
- href: u.href,
36
- className: l(
39
+ disabled: i,
40
+ href: s.href,
41
+ className: m(
37
42
  void 0,
38
43
  {
39
- "has-fullWidth": !!f,
40
- [`has-variant-${e}`]: !0,
41
- [`has-bg-${i}`]: e === "contained",
42
- [`has-text-${i}`]: e === "text",
43
- "is-disabled": !!a,
44
- ...c
44
+ "has-fullWidth": !!c,
45
+ [`has-variant-${a}`]: !0,
46
+ [`has-bg-${l}`]: a === "contained",
47
+ [`has-text-${l}`]: a === "text",
48
+ "is-disabled": !!i,
49
+ ...d
45
50
  },
46
51
  h
47
52
  ),
48
53
  onClick: () => {
49
- var o;
50
- return (o = n == null ? void 0 : n.onClick) == null ? void 0 : o.call(n, M);
54
+ var n;
55
+ return (n = e == null ? void 0 : e.onClick) == null ? void 0 : n.call(e, M);
51
56
  },
52
57
  onKeyDown: () => {
53
- var o;
54
- return (o = n == null ? void 0 : n.onKeyDown) == null ? void 0 : o.call(n, O);
58
+ var n;
59
+ return (n = e == null ? void 0 : e.onKeyDown) == null ? void 0 : n.call(e, O);
55
60
  },
56
- children: j()
61
+ children: b()
57
62
  }
58
- ) : /* @__PURE__ */ t.jsx(
63
+ ) : /* @__PURE__ */ o.jsx(
59
64
  "button",
60
65
  {
61
- ...n,
62
- color: i,
63
- disabled: !!a || !!x,
64
- id: `${s}${D(d) ? ` ${d}` : ""}`,
65
- className: l(
66
+ ...e,
67
+ color: l,
68
+ disabled: !!i || !!f,
69
+ id: `${x}${D(u) ? ` ${u}` : ""}`,
70
+ className: m(
66
71
  void 0,
67
72
  {
68
- "has-fullWidth": !!f,
69
- [`has-variant-${e}`]: !0,
70
- [`has-bg-${i}`]: e === "contained",
71
- [`has-text-${i}`]: e === "text",
72
- "is-disabled": !!a,
73
- ...c
73
+ "has-fullWidth": !!c,
74
+ [`has-variant-${a}`]: !0,
75
+ [`has-bg-${l}`]: a === "contained",
76
+ [`has-text-${l}`]: a === "text",
77
+ "is-disabled": !!i,
78
+ ...d
74
79
  },
75
80
  h
76
81
  ),
77
- tabIndex: u !== void 0 || a ? -1 : (n == null ? void 0 : n.tabIndex) ?? void 0,
78
- children: j()
82
+ tabIndex: s !== void 0 || i ? -1 : (e == null ? void 0 : e.tabIndex) ?? void 0,
83
+ children: b()
79
84
  }
80
85
  );
81
86
  };