@gearbox-protocol/ui-kit 4.6.0 → 4.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.
@@ -2,7 +2,8 @@ const t = {
2
2
  root: "review-button-root",
3
3
  error: "review-button-error",
4
4
  tip: "review-button-tip",
5
- solution: "review-button-solution"
5
+ solution: "review-button-solution",
6
+ solutionLink: "review-button-solution-link"
6
7
  };
7
8
  export {
8
9
  t as ReviewButtonTest
@@ -1,6 +1,8 @@
1
- import { ReviewButton as o } from "./review-button.js";
2
- import { ReviewButtonTest as f } from "./constants.js";
1
+ import { ReviewButton as t } from "./review-button.js";
2
+ import { ReviewSolution as i } from "./review-solution.js";
3
+ import { ReviewButtonTest as m } from "./constants.js";
3
4
  export {
4
- o as ReviewButton,
5
- f as ReviewButtonTest
5
+ t as ReviewButton,
6
+ m as ReviewButtonTest,
7
+ i as ReviewSolution
6
8
  };
@@ -1,52 +1,48 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import { Stack as s } from "../stack/stack.js";
3
- import { Button as m } from "../../buttons/button/button.js";
4
- import { TipCard as p } from "../../tip-card/tip-card.js";
1
+ import { jsxs as o, jsx as t, Fragment as c } from "react/jsx-runtime";
2
+ import { Stack as d } from "../stack/stack.js";
3
+ import { Button as f } from "../../buttons/button/button.js";
4
+ import { TipCard as g } from "../../tip-card/tip-card.js";
5
5
  import { FormattedMessageTyped as e } from "../../typed-intl/index.js";
6
- import { ReviewButtonTest as r } from "./constants.js";
7
- function w({
8
- disabled: d,
9
- error: o,
10
- tip: a,
6
+ import { ReviewButtonTest as a } from "./constants.js";
7
+ import { ReviewSolution as n } from "./review-solution.js";
8
+ function C({
9
+ disabled: l,
10
+ error: m,
11
+ tip: r,
11
12
  solution: i,
12
- onClick: n,
13
- label: c = "dialogs.common.review"
13
+ onClick: s,
14
+ label: p = "dialogs.common.review"
14
15
  }) {
15
- return /* @__PURE__ */ l(s, { gap: "sm", children: [
16
- a ? /* @__PURE__ */ t(
17
- p,
16
+ return /* @__PURE__ */ o(d, { gap: "sm", children: [
17
+ r ? /* @__PURE__ */ t(
18
+ g,
18
19
  {
19
20
  textColor: "light",
20
21
  attributeColor: "alert",
21
22
  className: "w-full",
22
- "data-testid": r.tip,
23
- children: /* @__PURE__ */ l(s, { gap: "sm", align: "start", children: [
24
- /* @__PURE__ */ t(e, { ...a }),
25
- i ? /* @__PURE__ */ t(
26
- m,
27
- {
28
- variant: "outline",
29
- size: "sm",
30
- onClick: i.onClick,
31
- "data-testid": r.solution,
32
- children: /* @__PURE__ */ t(e, { ...i.label })
33
- }
34
- ) : null
35
- ] })
23
+ "data-testid": a.tip,
24
+ children: /* @__PURE__ */ t(d, { gap: "sm", align: "start", children: i?.kind === "link" ? /* @__PURE__ */ o("div", { children: [
25
+ /* @__PURE__ */ t(e, { ...r }),
26
+ " ",
27
+ /* @__PURE__ */ t(n, { solution: i })
28
+ ] }) : /* @__PURE__ */ o(c, { children: [
29
+ /* @__PURE__ */ t(e, { ...r }),
30
+ /* @__PURE__ */ t(n, { solution: i })
31
+ ] }) })
36
32
  }
37
33
  ) : null,
38
34
  /* @__PURE__ */ t(
39
- m,
35
+ f,
40
36
  {
41
- disabled: d,
42
- onClick: n,
43
- "data-testid": r.root,
44
- children: o ? /* @__PURE__ */ t("span", { "data-testid": r.error, children: /* @__PURE__ */ t(e, { messageId: o }) }) : /* @__PURE__ */ t(e, { messageId: c })
37
+ disabled: l,
38
+ onClick: s,
39
+ "data-testid": a.root,
40
+ children: m ? /* @__PURE__ */ t("span", { "data-testid": a.error, children: /* @__PURE__ */ t(e, { messageId: m }) }) : /* @__PURE__ */ t(e, { messageId: p })
45
41
  }
46
42
  )
47
43
  ] });
48
44
  }
49
45
  export {
50
- w as ReviewButton,
51
- r as ReviewButtonTest
46
+ C as ReviewButton,
47
+ a as ReviewButtonTest
52
48
  };
@@ -0,0 +1,56 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { Button as s } from "../../buttons/button/button.js";
3
+ import { Link as c } from "../../link/link.js";
4
+ import { FormattedMessageTyped as n } from "../../typed-intl/index.js";
5
+ import { ReviewButtonTest as a } from "./constants.js";
6
+ function b({
7
+ solution: e,
8
+ testId: l = a.solution
9
+ }) {
10
+ switch (e?.kind) {
11
+ case "button":
12
+ return /* @__PURE__ */ r(
13
+ s,
14
+ {
15
+ type: "button",
16
+ variant: "outline",
17
+ size: "sm",
18
+ "data-testid": l,
19
+ onClick: e.onClick,
20
+ children: /* @__PURE__ */ r(n, { ...e.label })
21
+ }
22
+ );
23
+ case "link": {
24
+ const i = e.links.map((t) => /* @__PURE__ */ r(
25
+ c,
26
+ {
27
+ href: t.href,
28
+ variant: "underlined",
29
+ size: "unset",
30
+ color: "secondary",
31
+ "data-testid": a.solutionLink,
32
+ onClick: t.onClick,
33
+ children: /* @__PURE__ */ r(n, { ...t.label })
34
+ },
35
+ t.href
36
+ ));
37
+ return /* @__PURE__ */ r("span", { children: e.label ? /* @__PURE__ */ r(
38
+ n,
39
+ {
40
+ ...e.label,
41
+ values: {
42
+ ...e.label.values,
43
+ ...Object.fromEntries(
44
+ i.map((t, o) => [`link${o}`, t])
45
+ )
46
+ }
47
+ }
48
+ ) : i });
49
+ }
50
+ case void 0:
51
+ return null;
52
+ }
53
+ }
54
+ export {
55
+ b as ReviewSolution
56
+ };