@gearbox-protocol/permissionless-ui 1.22.0-next.41 → 1.22.0-next.43

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.
Files changed (49) hide show
  1. package/dist/cjs/components/block-sync/block-sync.cjs +1 -1
  2. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  3. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  4. package/dist/cjs/components/complex-input/complex-input.cjs +1 -1
  5. package/dist/cjs/components/complex-input/index.cjs +1 -1
  6. package/dist/cjs/components/currency-button/currency-button.cjs +1 -1
  7. package/dist/cjs/components/help-tip/help-tip.cjs +1 -1
  8. package/dist/cjs/components/index.cjs +1 -1
  9. package/dist/cjs/components/smart-number-input/balance-indicator.cjs +1 -0
  10. package/dist/cjs/components/smart-number-input/index.cjs +1 -1
  11. package/dist/cjs/components/smart-number-input/smart-number-input.cjs +1 -1
  12. package/dist/cjs/hooks/index.cjs +1 -1
  13. package/dist/cjs/hooks/use-debounce-call.cjs +1 -1
  14. package/dist/cjs/hooks/use-hf.cjs +1 -1
  15. package/dist/cjs/hooks/use-media-query.cjs +1 -1
  16. package/dist/cjs/hooks/use-smart-number-input.cjs +1 -0
  17. package/dist/cjs/index.cjs +1 -1
  18. package/dist/cjs/utils/format-money.cjs +1 -1
  19. package/dist/esm/components/block-sync/block-sync.js +7 -5
  20. package/dist/esm/components/checkbox/checkbox-labeled.js +5 -3
  21. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +5 -3
  22. package/dist/esm/components/complex-input/complex-input.js +57 -102
  23. package/dist/esm/components/complex-input/index.js +2 -3
  24. package/dist/esm/components/currency-button/currency-button.js +96 -74
  25. package/dist/esm/components/help-tip/help-tip.js +19 -19
  26. package/dist/esm/components/index.js +456 -455
  27. package/dist/esm/components/smart-number-input/balance-indicator.js +60 -0
  28. package/dist/esm/components/smart-number-input/index.js +4 -2
  29. package/dist/esm/components/smart-number-input/smart-number-input.js +139 -146
  30. package/dist/esm/hooks/index.js +38 -35
  31. package/dist/esm/hooks/use-debounce-call.js +7 -14
  32. package/dist/esm/hooks/use-hf.js +33 -25
  33. package/dist/esm/hooks/use-media-query.js +12 -11
  34. package/dist/esm/hooks/use-smart-number-input.js +10 -0
  35. package/dist/esm/index.js +590 -586
  36. package/dist/esm/utils/format-money.js +3 -5
  37. package/dist/globals.css +1 -1
  38. package/dist/types/components/complex-input/complex-input.d.ts +1 -33
  39. package/dist/types/components/currency-button/currency-button.d.ts +26 -61
  40. package/dist/types/components/smart-number-input/balance-indicator.d.ts +41 -0
  41. package/dist/types/components/smart-number-input/index.d.ts +1 -0
  42. package/dist/types/components/smart-number-input/smart-number-input.d.ts +29 -102
  43. package/dist/types/components/token-template/token-template.d.ts +2 -5
  44. package/dist/types/hooks/index.d.ts +1 -0
  45. package/dist/types/hooks/use-debounce-call.d.ts +1 -19
  46. package/dist/types/hooks/use-hf.d.ts +2 -1
  47. package/dist/types/hooks/use-media-query.d.ts +4 -0
  48. package/dist/types/hooks/use-smart-number-input.d.ts +1 -0
  49. package/package.json +1 -1
@@ -1,84 +1,106 @@
1
- import { jsxs as x, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as b, jsx as r } from "react/jsx-runtime";
2
2
  import { IconExpand as g } from "@gearbox-protocol/static";
3
- import { TokenSymbol as b } from "../token-symbol/token-symbol.js";
3
+ import { cva as u } from "class-variance-authority";
4
+ import { TokenSymbol as k } from "../token-symbol/token-symbol.js";
4
5
  import "react";
5
6
  import "@gearbox-protocol/sdk";
6
- import { cn as i } from "../../utils/cn.js";
7
+ import { cn as x } from "../../utils/cn.js";
7
8
  import "sonner";
8
- const w = {
9
- old: { symbol: 16, arrow: 8 },
9
+ const w = 13, N = u(
10
+ "flex flex-row items-center text-foreground cursor-[unset]",
11
+ {
12
+ variants: {
13
+ size: {
14
+ xs: "text-sm leading-[17px]",
15
+ sm: "text-[16px] leading-[21px]",
16
+ md: "text-[21px] leading-[33px]"
17
+ }
18
+ },
19
+ defaultVariants: { size: "md" }
20
+ }
21
+ ), V = {
10
22
  sm: { symbol: 16, arrow: 8 },
11
- md: { symbol: 28, arrow: 12 },
12
- lg: { symbol: 32, arrow: 14 },
13
- default: { symbol: 28, arrow: 12 }
14
- }, z = {
15
- old: "px-2 py-1 gap-1",
16
- sm: "px-2 py-1 gap-1",
17
- md: "px-3 py-1.5 gap-2",
18
- lg: "px-4 py-2 gap-2",
19
- default: "px-3 py-1.5 gap-2"
20
- };
21
- function B({
22
- title: a,
23
- maxLength: c = 12,
24
- token: t,
25
- disabled: r,
26
- showSelectDialog: o,
27
- size: s = "md",
28
- active: e = !1,
29
- chainId: l,
30
- network: u,
31
- className: y,
32
- children: f
23
+ md: { symbol: 28, arrow: 12 }
24
+ }, B = u(
25
+ "ml-0.5 leading-none text-gray-100 transition-transform duration-100 ease-[ease]",
26
+ {
27
+ variants: {
28
+ size: {
29
+ sm: "px-1",
30
+ md: "px-1.5"
31
+ },
32
+ active: {
33
+ true: "rotate-180",
34
+ false: ""
35
+ }
36
+ },
37
+ defaultVariants: { size: "md", active: !1 }
38
+ }
39
+ );
40
+ function M({
41
+ title: n,
42
+ maxLength: l = w,
43
+ token: m,
44
+ disabled: d,
45
+ showSelectDialog: t,
46
+ size: o,
47
+ active: f = !1,
48
+ chainId: v,
49
+ network: y,
50
+ className: z,
51
+ children: c
33
52
  }) {
34
- const d = !r && o ? o : void 0, m = w[s], p = o && !r;
35
- return /* @__PURE__ */ x(
36
- "button",
37
- {
38
- type: "button",
39
- onClick: d,
40
- disabled: r,
41
- className: i(
42
- "inline-flex items-center rounded-full bg-secondary font-medium transition-colors",
43
- z[s],
44
- p && "cursor-pointer hover:bg-secondary/80",
45
- !p && "cursor-default",
46
- e && "ring-2 ring-primary ring-offset-1",
47
- r && "opacity-50 cursor-not-allowed",
48
- y
49
- ),
50
- children: [
51
- t ? /* @__PURE__ */ n(
52
- b,
53
- {
54
- token: t,
55
- size: m.symbol,
56
- showSymbol: !0,
57
- maxLength: c,
58
- chainId: l,
59
- network: u
60
- }
61
- ) : /* @__PURE__ */ n("span", { className: "text-muted-foreground", children: f || a || "Select token" }),
62
- o && !r && /* @__PURE__ */ n(
63
- "span",
64
- {
65
- className: i(
66
- "flex items-center justify-center rounded transition-colors",
67
- e && "bg-primary/10"
68
- ),
69
- children: /* @__PURE__ */ n(
70
- g,
71
- {
72
- size: m.arrow,
73
- className: "text-muted-foreground"
74
- }
75
- )
76
- }
77
- )
78
- ]
79
- }
53
+ const s = !d && t ? t : void 0, e = !!(t && !d), a = o === "xs" ? "sm" : o ?? "md", p = V[a];
54
+ return (
55
+ // biome-ignore lint/a11y/noStaticElementInteractions: A uses div (CurrencyBlock); role + keyboard for a11y
56
+ /* @__PURE__ */ b(
57
+ "div",
58
+ {
59
+ role: e ? "button" : void 0,
60
+ tabIndex: e ? 0 : void 0,
61
+ onKeyDown: e && s ? (i) => {
62
+ (i.key === "Enter" || i.key === " ") && (i.preventDefault(), s());
63
+ } : void 0,
64
+ "data-active": e,
65
+ "data-testid": "currency-button",
66
+ onClick: s,
67
+ className: x(
68
+ "group",
69
+ N({ size: o }),
70
+ e && "cursor-pointer",
71
+ e && "hover:[&_.expand-wrap]:text-foreground",
72
+ z
73
+ ),
74
+ children: [
75
+ /* @__PURE__ */ r(
76
+ k,
77
+ {
78
+ title: n,
79
+ size: p.symbol,
80
+ token: m,
81
+ showSymbol: !0,
82
+ maxLength: l,
83
+ marginSize: a,
84
+ chainId: v,
85
+ network: y
86
+ }
87
+ ),
88
+ !m && (c ?? n) ? /* @__PURE__ */ r("span", { className: "text-muted-foreground truncate", children: c ?? n }) : null,
89
+ t && /* @__PURE__ */ r(
90
+ "span",
91
+ {
92
+ className: x(
93
+ "expand-wrap",
94
+ B({ size: a, active: f })
95
+ ),
96
+ children: /* @__PURE__ */ r(g, { size: p.arrow })
97
+ }
98
+ )
99
+ ]
100
+ }
101
+ )
80
102
  );
81
103
  }
82
104
  export {
83
- B as CurrencyButton
105
+ M as CurrencyButton
84
106
  };
@@ -1,9 +1,9 @@
1
- import { jsx as e } from "react/jsx-runtime";
1
+ import { jsx as o } from "react/jsx-runtime";
2
2
  import { IconQuestionCircle as u, IconInfo as v } from "@gearbox-protocol/static";
3
3
  import { cva as T } from "class-variance-authority";
4
4
  import * as l from "react";
5
5
  import "@gearbox-protocol/sdk";
6
- import { cn as p } from "../../utils/cn.js";
6
+ import { cn as c } from "../../utils/cn.js";
7
7
  import "sonner";
8
8
  import { SimpleTooltip as C } from "../tooltip/simple-tooltip.js";
9
9
  const H = T("transition-colors", {
@@ -44,7 +44,7 @@ const H = T("transition-colors", {
44
44
  ({
45
45
  className: t,
46
46
  children: r,
47
- maxWidth: o,
47
+ maxWidth: e,
48
48
  minWidth: a,
49
49
  delayShow: g = 200,
50
50
  placement: y = "bottom",
@@ -55,8 +55,8 @@ const H = T("transition-colors", {
55
55
  onPointerEnter: m,
56
56
  ...d
57
57
  }, f) => {
58
- const h = /* @__PURE__ */ e(
59
- c,
58
+ const h = /* @__PURE__ */ o(
59
+ p,
60
60
  {
61
61
  ref: f,
62
62
  iconSize: n,
@@ -68,13 +68,13 @@ const H = T("transition-colors", {
68
68
  ...d
69
69
  }
70
70
  );
71
- return /* @__PURE__ */ e(
71
+ return /* @__PURE__ */ o(
72
72
  C,
73
73
  {
74
74
  title: h,
75
75
  placement: y,
76
76
  delayShow: g,
77
- maxWidth: o,
77
+ maxWidth: e,
78
78
  minWidth: a,
79
79
  children: r
80
80
  }
@@ -82,48 +82,48 @@ const H = T("transition-colors", {
82
82
  }
83
83
  );
84
84
  I.displayName = "HelpTip";
85
- const c = l.forwardRef(
85
+ const p = l.forwardRef(
86
86
  ({
87
87
  className: t,
88
88
  iconSize: r = 14,
89
- iconColor: o = "gray-90",
89
+ iconColor: e = "gray-90",
90
90
  iconHoverColor: a = "gray-110",
91
91
  iconVariant: g = "question",
92
92
  onPointerEnter: y,
93
93
  ...n
94
94
  }, i) => {
95
95
  const s = g === "question" ? u : v;
96
- return /* @__PURE__ */ e(
96
+ return /* @__PURE__ */ o(
97
97
  "span",
98
98
  {
99
99
  ref: i,
100
100
  role: "img",
101
101
  "aria-hidden": !0,
102
- className: p(
103
- "inline-block cursor-help",
104
- H({ iconColor: o, iconHoverColor: a }),
102
+ className: c(
103
+ "inline-flex items-center justify-center cursor-help",
104
+ H({ iconColor: e, iconHoverColor: a }),
105
105
  t
106
106
  ),
107
107
  style: { width: r, height: r },
108
108
  onPointerEnter: y,
109
109
  ...n,
110
- children: /* @__PURE__ */ e(s, { size: r })
110
+ children: /* @__PURE__ */ o(s, { size: r })
111
111
  }
112
112
  );
113
113
  }
114
114
  );
115
- c.displayName = "HelpTipIcon";
116
- const N = l.forwardRef(({ className: t, ...r }, o) => /* @__PURE__ */ e(
115
+ p.displayName = "HelpTipIcon";
116
+ const N = l.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ o(
117
117
  "span",
118
118
  {
119
- ref: o,
120
- className: p("ml-1.5 inline-block leading-none", t),
119
+ ref: e,
120
+ className: c("ml-1.5 inline-block leading-none", t),
121
121
  ...r
122
122
  }
123
123
  ));
124
124
  N.displayName = "TipWrap";
125
125
  export {
126
126
  I as HelpTip,
127
- c as HelpTipIcon,
127
+ p as HelpTipIcon,
128
128
  N as TipWrap
129
129
  };