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

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 (47) 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/index.cjs +1 -1
  8. package/dist/cjs/components/smart-number-input/balance-indicator.cjs +1 -0
  9. package/dist/cjs/components/smart-number-input/index.cjs +1 -1
  10. package/dist/cjs/components/smart-number-input/smart-number-input.cjs +1 -1
  11. package/dist/cjs/hooks/index.cjs +1 -1
  12. package/dist/cjs/hooks/use-debounce-call.cjs +1 -1
  13. package/dist/cjs/hooks/use-hf.cjs +1 -1
  14. package/dist/cjs/hooks/use-media-query.cjs +1 -1
  15. package/dist/cjs/hooks/use-smart-number-input.cjs +1 -0
  16. package/dist/cjs/index.cjs +1 -1
  17. package/dist/cjs/utils/format-money.cjs +1 -1
  18. package/dist/esm/components/block-sync/block-sync.js +7 -5
  19. package/dist/esm/components/checkbox/checkbox-labeled.js +5 -3
  20. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +5 -3
  21. package/dist/esm/components/complex-input/complex-input.js +57 -102
  22. package/dist/esm/components/complex-input/index.js +2 -3
  23. package/dist/esm/components/currency-button/currency-button.js +96 -74
  24. package/dist/esm/components/index.js +456 -455
  25. package/dist/esm/components/smart-number-input/balance-indicator.js +60 -0
  26. package/dist/esm/components/smart-number-input/index.js +4 -2
  27. package/dist/esm/components/smart-number-input/smart-number-input.js +139 -146
  28. package/dist/esm/hooks/index.js +38 -35
  29. package/dist/esm/hooks/use-debounce-call.js +7 -14
  30. package/dist/esm/hooks/use-hf.js +33 -25
  31. package/dist/esm/hooks/use-media-query.js +12 -11
  32. package/dist/esm/hooks/use-smart-number-input.js +10 -0
  33. package/dist/esm/index.js +590 -586
  34. package/dist/esm/utils/format-money.js +3 -5
  35. package/dist/globals.css +1 -1
  36. package/dist/types/components/complex-input/complex-input.d.ts +1 -33
  37. package/dist/types/components/currency-button/currency-button.d.ts +26 -61
  38. package/dist/types/components/smart-number-input/balance-indicator.d.ts +41 -0
  39. package/dist/types/components/smart-number-input/index.d.ts +1 -0
  40. package/dist/types/components/smart-number-input/smart-number-input.d.ts +29 -102
  41. package/dist/types/components/token-template/token-template.d.ts +2 -5
  42. package/dist/types/hooks/index.d.ts +1 -0
  43. package/dist/types/hooks/use-debounce-call.d.ts +1 -19
  44. package/dist/types/hooks/use-hf.d.ts +2 -1
  45. package/dist/types/hooks/use-media-query.d.ts +4 -0
  46. package/dist/types/hooks/use-smart-number-input.d.ts +1 -0
  47. 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
  };