@gearbox-protocol/permissionless-ui 1.22.0-next.26 → 1.22.0-next.28

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,73 +1,63 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { useState as s, useEffect as u } from "react";
2
+ import { useState as s, useEffect as a } from "react";
3
3
  import { BlockSync as h } from "../block-sync/block-sync.js";
4
4
  import { cn as g } from "../../utils/cn.js";
5
- function w() {
6
- const [t, i] = s(
7
- typeof window < "u" ? window.scrollY : 0
8
- ), [e, c] = s(
9
- typeof document < "u" ? document.documentElement.clientHeight : 0
10
- );
11
- u(() => {
12
- const n = () => {
13
- i(window.scrollY);
14
- }, o = () => {
15
- c(document.documentElement.clientHeight);
16
- };
17
- return window.addEventListener("scroll", n), window.addEventListener("resize", o), () => {
18
- window.removeEventListener("scroll", n), window.removeEventListener("resize", o);
19
- };
20
- }, []);
21
- const d = typeof document < "u" ? Math.max(
22
- document.body.scrollHeight,
23
- document.documentElement.scrollHeight,
24
- document.body.offsetHeight,
25
- document.documentElement.offsetHeight,
26
- document.body.clientHeight,
27
- document.documentElement.clientHeight
28
- ) : 0;
29
- return {
30
- pageVerticalOffset: t,
31
- clientHeight: e,
32
- clientOffsetHeight: d
33
- };
34
- }
35
- function E({
36
- blockSyncProps: t,
5
+ function y({
6
+ blockSyncProps: e,
37
7
  footerHeight: i,
38
- gapFromFooter: e
8
+ gapFromFooter: t
39
9
  }) {
40
- const [c, d] = s(e), { pageVerticalOffset: n, clientOffsetHeight: o, clientHeight: l } = w();
41
- return u(() => {
42
- const r = i + e, m = o - (l + n), a = m < r ? r - m : 0;
43
- d(e + a);
44
- }, [
45
- n,
46
- l,
47
- o,
48
- i,
49
- e
50
- ]), /* @__PURE__ */ f(
10
+ const [c, o] = s(t), { pageVerticalOffset: n, clientOffsetHeight: l, clientHeight: d } = H();
11
+ return a(() => {
12
+ const r = i + t, m = l - (d + n), u = m < r ? r - m : 0;
13
+ o(t + u);
14
+ }, [n, d, l]), /* @__PURE__ */ f(
51
15
  "div",
52
16
  {
53
17
  className: g(
54
18
  // Desktop: fixed position with dynamic bottom
55
19
  "hidden sm:flex",
56
- "fixed right-9 flex-col items-end gap-2 text-xs text-muted-foreground z-[100]",
57
- "transition-[bottom] duration-300 ease-in-out"
20
+ "fixed right-9 flex-col items-end gap-2 text-xs text-muted-foreground z-[100]"
58
21
  ),
59
22
  style: { bottom: `${c}px` },
60
23
  children: /* @__PURE__ */ f(
61
24
  h,
62
25
  {
63
- blockByChain: t.blockByChain,
64
- explorerAddresses: t.explorerAddresses,
65
- networkById: t.networkById
26
+ blockByChain: e.blockByChain,
27
+ explorerAddresses: e.explorerAddresses,
28
+ networkById: e.networkById
66
29
  }
67
30
  )
68
31
  }
69
32
  );
70
33
  }
34
+ const w = () => Math.max(
35
+ document.body.scrollHeight,
36
+ document.documentElement.scrollHeight,
37
+ document.body.offsetHeight,
38
+ document.documentElement.offsetHeight,
39
+ document.body.clientHeight,
40
+ document.documentElement.clientHeight
41
+ );
42
+ function H() {
43
+ const [e, i] = s(window.scrollY), [t, c] = s(
44
+ document.documentElement.clientHeight
45
+ );
46
+ return a(() => {
47
+ const o = () => {
48
+ i(window.scrollY);
49
+ }, n = () => {
50
+ c(document.documentElement.clientHeight);
51
+ };
52
+ return window.addEventListener("scroll", o), window.addEventListener("resize", n), () => {
53
+ window.removeEventListener("scroll", o), window.removeEventListener("resize", n);
54
+ };
55
+ }, []), {
56
+ pageVerticalOffset: e,
57
+ clientHeight: t,
58
+ clientOffsetHeight: w()
59
+ };
60
+ }
71
61
  export {
72
- E as HelpCenterContainer
62
+ y as HelpCenterContainer
73
63
  };
@@ -1,17 +1,59 @@
1
- import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
- import { cva as d } from "class-variance-authority";
3
- import "react";
4
- import { cn as b } from "../../utils/cn.js";
1
+ import { jsxs as f, jsx as r } from "react/jsx-runtime";
2
+ import { cva as y } from "class-variance-authority";
3
+ import * as v from "react";
4
+ import { cn as e } from "../../utils/cn.js";
5
5
  import "sonner";
6
6
  import "@gearbox-protocol/sdk";
7
- const c = d(
8
- "flex w-full rounded-md border border-input px-3 py-1 shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/70 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm bg-[rgb(40,40,40)] text-foreground border-[rgb(100,100,100)] focus:bg-[rgb(40,40,40)] active:bg-[rgb(40,40,40)] [&:not(:placeholder-shown)]:bg-[rgb(40,40,40)] autofill:bg-[rgb(40,40,40)] [-webkit-autofill]:bg-[rgb(40,40,40)] [&:-webkit-autofill]:shadow-[0_0_0_1000px_rgb(40,40,40)_inset] [&:-webkit-autofill]:[text-fill-color:currentColor] outline-none [&::-webkit-search-cancel-button]:cursor-pointer",
7
+ const _ = y(
8
+ e(
9
+ // Layout + typography (matches styled-components: 14/17)
10
+ "flex w-full border shadow-sm transition-colors",
11
+ "!text-sm leading-[17px] font-normal font-feature-settings-normal placeholder:text-sm",
12
+ "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
13
+ "focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",
14
+ "outline-none",
15
+ // Hide built-in search clear / decorations (we render our own endingIcon)
16
+ "[&::-ms-clear]:hidden [&::-ms-reveal]:hidden",
17
+ "[&::-webkit-search-decoration]:hidden [&::-webkit-search-cancel-button]:hidden",
18
+ "[&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden",
19
+ // Error visuals (matches old styled-components data-error approach)
20
+ "data-[error=true]:border-destructive data-[error=true]:ring-2 data-[error=true]:ring-destructive"
21
+ ),
9
22
  {
10
23
  variants: {
11
24
  size: {
12
- sm: "h-8 text-xs px-2",
13
- default: "h-9",
14
- lg: "h-11 text-base px-4"
25
+ // Matches reference paddings/heights (Tailwind uses border-box)
26
+ sm: "h-8 px-3 py-2 rounded-[6px]",
27
+ default: "h-10 px-3 py-[14px] rounded-md",
28
+ lg: "h-11 px-3 py-[14px] rounded-md"
29
+ },
30
+ colorTheme: {
31
+ filledDark: e(
32
+ "bg-gray-20 border-gray-30 text-foreground",
33
+ "placeholder:text-text-secondary",
34
+ "hover:bg-gray-30 hover:border-gray-50",
35
+ "focus:bg-gray-20 focus:border-gray-20",
36
+ "focus:ring-2 focus:ring-ring",
37
+ // WebKit autofill background fix
38
+ "[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--gray-20))_inset] [&:-webkit-autofill]:[text-fill-color:currentColor]"
39
+ ),
40
+ filledLight: e(
41
+ "bg-white border-white text-white-foreground",
42
+ "placeholder:text-gray-100",
43
+ "hover:bg-white hover:border-primary",
44
+ "focus:bg-white focus:border-white",
45
+ "focus:ring-2 focus:ring-ring",
46
+ "[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--white))_inset] [&:-webkit-autofill]:[text-fill-color:currentColor]"
47
+ ),
48
+ outlined: e(
49
+ "bg-transparent border-gray-40 text-foreground",
50
+ "placeholder:text-foreground",
51
+ "hover:bg-transparent hover:border-gray-90",
52
+ "focus:bg-white focus:border-white",
53
+ "focus:text-white-foreground focus:placeholder:text-gray-100",
54
+ "focus:ring-2 focus:ring-ring",
55
+ "[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--white))_inset] [&:-webkit-autofill]:[text-fill-color:currentColor]"
56
+ )
15
57
  },
16
58
  variant: {
17
59
  default: "",
@@ -21,39 +63,85 @@ const c = d(
21
63
  },
22
64
  defaultVariants: {
23
65
  size: "default",
66
+ colorTheme: "filledDark",
24
67
  variant: "default"
25
68
  }
26
69
  }
27
- );
28
- function v({
29
- hasError: e,
30
- errorMessage: t,
31
- value: i,
32
- size: l,
33
- variant: a,
34
- className: n,
35
- ...r
36
- }) {
37
- return /* @__PURE__ */ u("div", { className: "flex flex-col space-y-2", children: [
38
- /* @__PURE__ */ o(
39
- "input",
40
- {
41
- ...r,
42
- value: i,
43
- className: b(
44
- c({
45
- size: l,
46
- variant: e ? "error" : a,
47
- className: n
48
- })
70
+ ), K = v.forwardRef(
71
+ ({
72
+ hasError: t,
73
+ errorMessage: s,
74
+ value: h,
75
+ size: b,
76
+ colorTheme: p,
77
+ variant: m,
78
+ className: g,
79
+ startingIcon: o,
80
+ onStartingIconClick: l,
81
+ endingIcon: a,
82
+ onEndingIconClick: d,
83
+ ...n
84
+ }, x) => {
85
+ const u = p ?? "filledDark", c = u === "filledLight" ? "text-gray-50" : "text-gray-110";
86
+ return /* @__PURE__ */ f("div", { className: "flex flex-col space-y-2", children: [
87
+ /* @__PURE__ */ f("div", { className: "relative", children: [
88
+ o && /* @__PURE__ */ r(
89
+ "button",
90
+ {
91
+ type: "button",
92
+ onClick: l,
93
+ onKeyDown: ((i) => (w) => {
94
+ w.key === "Enter" && i?.();
95
+ })(l),
96
+ className: e(
97
+ "absolute left-0 top-1/2 transform -translate-y-1/2",
98
+ "w-9 h-9 flex items-center justify-center",
99
+ c,
100
+ l ? "cursor-pointer" : "cursor-default"
101
+ ),
102
+ children: o
103
+ }
49
104
  ),
50
- onWheel: r.type === "number" ? (s) => s.currentTarget.blur() : void 0
51
- }
52
- ),
53
- e && t && /* @__PURE__ */ o("p", { className: "text-destructive text-sm", children: t })
54
- ] });
55
- }
105
+ /* @__PURE__ */ r(
106
+ "input",
107
+ {
108
+ ref: x,
109
+ ...n,
110
+ value: h,
111
+ "data-error": t ? "true" : "false",
112
+ className: e(
113
+ _({
114
+ size: b,
115
+ colorTheme: u,
116
+ variant: t ? "error" : m
117
+ }),
118
+ o && "pl-9",
119
+ a && "pr-9",
120
+ g
121
+ ),
122
+ onWheel: n.type === "number" ? (i) => i.currentTarget.blur() : void 0
123
+ }
124
+ ),
125
+ a && /* @__PURE__ */ r(
126
+ "button",
127
+ {
128
+ type: "button",
129
+ onClick: d,
130
+ className: e(
131
+ "absolute right-0 top-1/2 transform -translate-y-1/2 w-9 h-9",
132
+ "flex items-center justify-center",
133
+ c,
134
+ d ? "cursor-pointer" : "cursor-default"
135
+ ),
136
+ children: a
137
+ }
138
+ )
139
+ ] }),
140
+ t && s && /* @__PURE__ */ r("p", { className: "text-destructive text-sm", children: s })
141
+ ] });
142
+ }
143
+ );
56
144
  export {
57
- v as Input,
58
- c as inputVariants
145
+ K as Input,
146
+ _ as inputVariants
59
147
  };