@gearbox-protocol/permissionless-ui 1.6.0 → 1.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.
Files changed (38) hide show
  1. package/dist/cjs/components/block-sync.js +2 -2
  2. package/dist/cjs/components/buttons/button.js +3 -3
  3. package/dist/cjs/components/buttons/tab-button.js +2 -6
  4. package/dist/cjs/components/cards/card.js +4 -3
  5. package/dist/cjs/components/cards/expandable-card.js +3 -3
  6. package/dist/cjs/components/checkbox.js +1 -1
  7. package/dist/cjs/components/detailed-page-title.js +1 -1
  8. package/dist/cjs/components/input.js +4 -4
  9. package/dist/cjs/components/label.js +3 -3
  10. package/dist/cjs/components/layout/layout.js +2 -2
  11. package/dist/cjs/components/next/index.js +2 -5
  12. package/dist/cjs/components/search-bar.js +81 -12
  13. package/dist/cjs/components/signatures/vertical-timeline.js +2 -2
  14. package/dist/cjs/components/stat-badge.js +1 -1
  15. package/dist/cjs/components/table/table.js +14 -4
  16. package/dist/esm/components/block-sync.js +2 -2
  17. package/dist/esm/components/buttons/button.js +3 -3
  18. package/dist/esm/components/buttons/tab-button.js +2 -6
  19. package/dist/esm/components/cards/card.js +4 -3
  20. package/dist/esm/components/cards/expandable-card.js +3 -3
  21. package/dist/esm/components/checkbox.js +1 -1
  22. package/dist/esm/components/detailed-page-title.js +1 -1
  23. package/dist/esm/components/input.js +4 -4
  24. package/dist/esm/components/label.js +3 -3
  25. package/dist/esm/components/layout/layout.js +2 -2
  26. package/dist/esm/components/next/index.js +1 -3
  27. package/dist/esm/components/search-bar.js +71 -12
  28. package/dist/esm/components/signatures/vertical-timeline.js +2 -2
  29. package/dist/esm/components/stat-badge.js +1 -1
  30. package/dist/esm/components/table/table.js +14 -4
  31. package/dist/globals.css +6 -13
  32. package/dist/types/components/cards/card.d.ts +1 -1
  33. package/dist/types/components/next/index.d.ts +0 -1
  34. package/dist/types/components/search-bar.d.ts +11 -4
  35. package/package.json +1 -1
  36. package/dist/cjs/components/next/web3-providers.js +0 -116
  37. package/dist/esm/components/next/web3-providers.js +0 -92
  38. package/dist/types/components/next/web3-providers.d.ts +0 -29
@@ -57,7 +57,7 @@ function BlockSync({
57
57
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
58
58
  "span",
59
59
  {
60
- className: (0, import_cn.cn)("text-xs", isError ? "text-red-500" : "text-green-500"),
60
+ className: (0, import_cn.cn)("text-xs", isError ? "text-destructive" : "text-success"),
61
61
  children: "Status"
62
62
  }
63
63
  ),
@@ -66,7 +66,7 @@ function BlockSync({
66
66
  {
67
67
  className: (0, import_cn.cn)(
68
68
  "w-2 h-2 rounded-full",
69
- isError ? "bg-red-500" : "bg-green-500"
69
+ isError ? "bg-destructive" : "bg-success"
70
70
  )
71
71
  }
72
72
  )
@@ -44,11 +44,11 @@ const buttonVariants = (0, import_class_variance_authority.cva)(
44
44
  variant: {
45
45
  default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
46
46
  destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
47
- outline: "border-border bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
47
+ outline: "border-input bg-background shadow-sm hover:bg-secondary hover:text-white text-white",
48
48
  secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
49
- ghost: "hover:bg-accent hover:text-accent-foreground",
49
+ ghost: "hover:bg-secondary hover:text-accent-foreground",
50
50
  link: "text-primary underline-offset-4 hover:underline",
51
- text: "text-muted-foreground hover:text-white",
51
+ text: "text-muted-foreground hover:text-white hover:bg-transparent",
52
52
  pink: "bg-pink-700 hover:bg-pink-600 disabled:bg-pink-700 text-white",
53
53
  "pink-outline": "border-pink-700 hover:border-pink-600 disabled:border-pink-700 text-white",
54
54
  blue: "bg-blue-800 hover:bg-blue-700 disabled:bg-blue-700 text-white",
@@ -33,20 +33,16 @@ __export(tab_button_exports, {
33
33
  module.exports = __toCommonJS(tab_button_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var React = __toESM(require("react"));
36
- var import_utils = __toESM(require('../../utils/index.js'));
37
36
  var import_button = require('./button.js');
38
37
  const TabButton = React.forwardRef(
39
- ({ className, children, size = "sm", ...props }, ref) => {
38
+ ({ className, children, size, ...props }, ref) => {
40
39
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
41
40
  import_button.Button,
42
41
  {
43
42
  ref,
44
43
  variant: "outline",
45
44
  size,
46
- className: (0, import_utils.default)(
47
- "bg-gray-900 text-gray-100 border-gray-700 hover:bg-gray-800 border-gray-300",
48
- className
49
- ),
45
+ className,
50
46
  ...props,
51
47
  children
52
48
  }
@@ -41,13 +41,14 @@ var import_class_variance_authority = require("class-variance-authority");
41
41
  var React = __toESM(require("react"));
42
42
  var import_utils = __toESM(require('../../utils/index.js'));
43
43
  const cardVariants = (0, import_class_variance_authority.cva)(
44
- "rounded-xl border border-border bg-card text-card-foreground",
44
+ "rounded-xl border border-border bg-card text-card-foreground hover:bg-secondary",
45
45
  {
46
46
  variants: {
47
47
  variant: {
48
48
  default: "",
49
- interactive: "hover:bg-secondary transition-colors cursor-pointer",
50
- transparent: "bg-card/0"
49
+ interactive: "hover:bg-card transition-colors cursor-pointer",
50
+ transparent: "bg-card/0",
51
+ nohover: "hover:bg-card hover:border-border"
51
52
  }
52
53
  },
53
54
  defaultVariants: {
@@ -43,13 +43,13 @@ function ExpandableCard({
43
43
  alwaysExpanded = false
44
44
  }) {
45
45
  const [isExpanded, setIsExpanded] = React.useState(alwaysExpanded);
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.Card, { children: [
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.Card, { variant: "nohover", children: [
47
47
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
48
48
  "div",
49
49
  {
50
50
  className: (0, import_utils.default)(
51
51
  "flex items-center justify-between gap-4 p-4 rounded-t-xl",
52
- alwaysExpanded ? "" : "cursor-pointer hover:bg-accent/50",
52
+ alwaysExpanded ? "" : "cursor-pointer",
53
53
  isExpanded ? "" : "rounded-b-xl"
54
54
  ),
55
55
  onClick: () => {
@@ -71,7 +71,7 @@ function ExpandableCard({
71
71
  ]
72
72
  }
73
73
  ),
74
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardContent, { className: "border-t bg-gray-900/30", children })
74
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardContent, { className: "border-t border-input bg-gray-900/30", children })
75
75
  ] });
76
76
  }
77
77
  // Annotate the CommonJS export names for ESM import in node:
@@ -41,7 +41,7 @@ const Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
41
41
  {
42
42
  ref,
43
43
  className: (0, import_utils.default)(
44
- "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
44
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
45
45
  className
46
46
  ),
47
47
  ...props,
@@ -48,7 +48,7 @@ function DetailedPageTitle({
48
48
  explorerLinks,
49
49
  className
50
50
  }) {
51
- const intl = (0, import_typed_intl.useIntlTyped)();
51
+ const _intl = (0, import_typed_intl.useIntlTyped)();
52
52
  const [isPressed, setIsPressed] = React.useState(false);
53
53
  const handleCopy = () => {
54
54
  if (toCopy) {
@@ -36,7 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_class_variance_authority = require("class-variance-authority");
37
37
  var import_utils = __toESM(require('../utils/index.js'));
38
38
  const inputVariants = (0, import_class_variance_authority.cva)(
39
- "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 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm bg-[rgb(40,40,40)] text-white 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:rgb(255,255,255)]",
39
+ "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-white 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:rgb(255,255,255)] outline-none",
40
40
  {
41
41
  variants: {
42
42
  size: {
@@ -46,8 +46,8 @@ const inputVariants = (0, import_class_variance_authority.cva)(
46
46
  },
47
47
  variant: {
48
48
  default: "",
49
- error: "border-red-500 focus-visible:ring-red-500",
50
- success: "border-green-500 focus-visible:ring-green-500"
49
+ error: "border-red-500",
50
+ success: "border-green-500"
51
51
  }
52
52
  },
53
53
  defaultVariants: {
@@ -81,7 +81,7 @@ function Input({
81
81
  onWheel: props.type === "number" ? (e) => e.currentTarget.blur() : void 0
82
82
  }
83
83
  ),
84
- hasError && value !== "" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-red-500 text-sm", children: errorMessage })
84
+ hasError && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-destructive text-sm", children: errorMessage })
85
85
  ] });
86
86
  }
87
87
  // Annotate the CommonJS export names for ESM import in node:
@@ -38,16 +38,16 @@ var import_class_variance_authority = require("class-variance-authority");
38
38
  var React = __toESM(require("react"));
39
39
  var import_utils = __toESM(require('../utils//index.js'));
40
40
  const labelVariants = (0, import_class_variance_authority.cva)(
41
- "font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
41
+ "flex font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 mb-2 ",
42
42
  {
43
43
  variants: {
44
44
  size: {
45
45
  sm: "text-sm",
46
- default: "text-lg",
46
+ default: "text-md",
47
47
  lg: "text-xl"
48
48
  },
49
49
  variant: {
50
- default: "text-white",
50
+ default: "text-foreground",
51
51
  muted: "text-muted-foreground",
52
52
  error: "text-destructive",
53
53
  success: "text-green-500"
@@ -57,8 +57,8 @@ const Layout = import_react.default.forwardRef(
57
57
  className: "overflow-x-hidden py-6",
58
58
  style: {
59
59
  gridArea: "main",
60
- backgroundColor: "hsl(var(--main-background))",
61
- color: "hsl(var(--main-foreground))"
60
+ backgroundColor: "hsl(var(--background))",
61
+ color: "hsl(var(--foreground))"
62
62
  },
63
63
  children
64
64
  }
@@ -22,8 +22,7 @@ __export(next_exports, {
22
22
  MarkdownViewer: () => import_markdown_viewer.MarkdownViewer,
23
23
  SIWEClientProvider: () => import_siwe_provider.SIWEClientProvider,
24
24
  SignInRequired: () => import_signin_required.SignInRequired,
25
- TokenIcon: () => import_token_icon.TokenIcon,
26
- Web3Providers: () => import_web3_providers.Web3Providers
25
+ TokenIcon: () => import_token_icon.TokenIcon
27
26
  });
28
27
  module.exports = __toCommonJS(next_exports);
29
28
  var import_signin_required = require('../auth/signin-required.js');
@@ -31,13 +30,11 @@ var import_back_button = require('./back-button.js');
31
30
  var import_markdown_viewer = require('./markdown-viewer.js');
32
31
  var import_siwe_provider = require('./siwe-provider.js');
33
32
  var import_token_icon = require('./token-icon.js');
34
- var import_web3_providers = require('./web3-providers.js');
35
33
  // Annotate the CommonJS export names for ESM import in node:
36
34
  0 && (module.exports = {
37
35
  BackButton,
38
36
  MarkdownViewer,
39
37
  SIWEClientProvider,
40
38
  SignInRequired,
41
- TokenIcon,
42
- Web3Providers
39
+ TokenIcon
43
40
  });
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var search_bar_exports = {};
21
31
  __export(search_bar_exports, {
@@ -23,39 +33,98 @@ __export(search_bar_exports, {
23
33
  });
24
34
  module.exports = __toCommonJS(search_bar_exports);
25
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_class_variance_authority = require("class-variance-authority");
26
37
  var import_lucide_react = require("lucide-react");
27
38
  var import_react = require("react");
39
+ var import_utils = __toESM(require('../utils/index.js'));
28
40
  var import_input = require('./input.js');
41
+ const searchBarVariants = (0, import_class_variance_authority.cva)("relative w-full transition-all duration-200", {
42
+ variants: {
43
+ size: {
44
+ sm: "max-w-xs",
45
+ default: "max-w-96",
46
+ lg: "max-w-lg",
47
+ full: "max-w-full"
48
+ }
49
+ },
50
+ defaultVariants: {
51
+ size: "default"
52
+ }
53
+ });
54
+ const searchBarInputVariants = (0, import_class_variance_authority.cva)("transition-all duration-200 pl-10", {
55
+ variants: {
56
+ active: {
57
+ true: "",
58
+ false: "bg-transparent border-input"
59
+ },
60
+ theme: {
61
+ light: "",
62
+ dark: ""
63
+ }
64
+ },
65
+ compoundVariants: [
66
+ {
67
+ active: true,
68
+ theme: "light",
69
+ className: "bg-card text-foreground"
70
+ },
71
+ {
72
+ active: true,
73
+ theme: "dark",
74
+ className: "bg-[rgb(40,40,40)] text-white"
75
+ },
76
+ {
77
+ active: false,
78
+ theme: "light",
79
+ className: "text-foreground placeholder:text-foreground"
80
+ },
81
+ {
82
+ active: false,
83
+ theme: "dark",
84
+ className: "text-white placeholder:text-white"
85
+ }
86
+ ],
87
+ defaultVariants: {
88
+ active: false,
89
+ theme: "light"
90
+ }
91
+ });
29
92
  function SearchBar({
30
93
  onChange,
31
94
  placeholder = "Search...",
32
- className = "w-64"
95
+ className,
96
+ size,
97
+ theme = "light"
33
98
  }) {
34
99
  const [searchQuery, setSearchQuery] = (0, import_react.useState)("");
100
+ const [focused, setFocused] = (0, import_react.useState)(false);
101
+ const active = searchQuery !== "" || focused;
35
102
  const handleSearch = (e) => {
36
103
  const query = e.target.value;
37
104
  setSearchQuery(query);
38
105
  onChange(query);
39
106
  };
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `relative ${className}`, children: [
107
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_utils.default)(searchBarVariants({ size }), className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
41
108
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
- import_input.Input,
109
+ import_lucide_react.Search,
43
110
  {
44
- type: "text",
45
- placeholder,
46
- value: searchQuery,
47
- onChange: handleSearch,
48
- className: "pl-10"
111
+ className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground pointer-events-none",
112
+ size: 18
49
113
  }
50
114
  ),
51
115
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
52
- import_lucide_react.Search,
116
+ import_input.Input,
53
117
  {
54
- className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground",
55
- size: 18
118
+ type: "search",
119
+ placeholder,
120
+ value: searchQuery,
121
+ onChange: handleSearch,
122
+ onFocus: () => setFocused(true),
123
+ onBlur: () => setFocused(false),
124
+ className: (0, import_utils.default)(searchBarInputVariants({ active, theme }))
56
125
  }
57
126
  )
58
- ] });
127
+ ] }) });
59
128
  }
60
129
  // Annotate the CommonJS export names for ESM import in node:
61
130
  0 && (module.exports = {
@@ -61,8 +61,8 @@ function VerticalTimeline({
61
61
  !showAll[index],
62
62
  ...showAll.slice(index + 1)
63
63
  ]),
64
- className: "ml-10 text-green-500 hover:underline",
65
- children: showAll ? "Hide all" : "Show all"
64
+ className: "ml-10 text-green-500 hover:underline cursor-pointer",
65
+ children: showAll[index] ? "Hide all" : "Show all"
66
66
  }
67
67
  )
68
68
  ] }),
@@ -105,7 +105,7 @@ const StatBadge = React.forwardRef(
105
105
  className: (0, import_utils.default)(
106
106
  "inline-flex items-center gap-1 text-xs font-medium",
107
107
  isNegative && "text-destructive",
108
- isPositive && "text-green-600 dark:text-green-400"
108
+ isPositive && "text-success"
109
109
  ),
110
110
  children: [
111
111
  isPositive && (delta.positiveIcon || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.TrendingUp, { className: "h-3 w-3" })),
@@ -62,7 +62,7 @@ const tableVariants = (0, import_class_variance_authority.cva)("w-full caption-b
62
62
  }
63
63
  });
64
64
  const Table = React.forwardRef(
65
- ({ className, size, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ ({ className, size, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative w-full overflow-auto rounded-lg border border-input bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
66
  "table",
67
67
  {
68
68
  ref,
@@ -72,7 +72,17 @@ const Table = React.forwardRef(
72
72
  ) })
73
73
  );
74
74
  Table.displayName = "Table";
75
- const TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { ref, className: (0, import_utils.default)("[&_tr]:border-b ", className), ...props }));
75
+ const TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
76
+ "thead",
77
+ {
78
+ ref,
79
+ className: (0, import_utils.default)(
80
+ "[&_tr]:border-b border-input [&_tr]:hover:bg-transparent",
81
+ className
82
+ ),
83
+ ...props
84
+ }
85
+ ));
76
86
  TableHeader.displayName = "TableHeader";
77
87
  const TableBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78
88
  "tbody",
@@ -100,7 +110,7 @@ const TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
100
110
  {
101
111
  ref,
102
112
  className: (0, import_utils.default)(
103
- "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
113
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted border-border",
104
114
  className
105
115
  ),
106
116
  ...props
@@ -108,7 +118,7 @@ const TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
108
118
  ));
109
119
  TableRow.displayName = "TableRow";
110
120
  const tableHeadVariants = (0, import_class_variance_authority.cva)(
111
- "border-b bg-muted/50 text-left align-middle font-medium text-muted-foreground",
121
+ "border-b bg-muted/50 text-left align-middle font-medium text-muted-foreground border-input",
112
122
  {
113
123
  variants: {
114
124
  size: {
@@ -39,7 +39,7 @@ function BlockSync({
39
39
  /* @__PURE__ */ jsx(
40
40
  "span",
41
41
  {
42
- className: cn("text-xs", isError ? "text-red-500" : "text-green-500"),
42
+ className: cn("text-xs", isError ? "text-destructive" : "text-success"),
43
43
  children: "Status"
44
44
  }
45
45
  ),
@@ -48,7 +48,7 @@ function BlockSync({
48
48
  {
49
49
  className: cn(
50
50
  "w-2 h-2 rounded-full",
51
- isError ? "bg-red-500" : "bg-green-500"
51
+ isError ? "bg-destructive" : "bg-success"
52
52
  )
53
53
  }
54
54
  )
@@ -10,11 +10,11 @@ const buttonVariants = cva(
10
10
  variant: {
11
11
  default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
12
12
  destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
13
- outline: "border-border bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
13
+ outline: "border-input bg-background shadow-sm hover:bg-secondary hover:text-white text-white",
14
14
  secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
15
- ghost: "hover:bg-accent hover:text-accent-foreground",
15
+ ghost: "hover:bg-secondary hover:text-accent-foreground",
16
16
  link: "text-primary underline-offset-4 hover:underline",
17
- text: "text-muted-foreground hover:text-white",
17
+ text: "text-muted-foreground hover:text-white hover:bg-transparent",
18
18
  pink: "bg-pink-700 hover:bg-pink-600 disabled:bg-pink-700 text-white",
19
19
  "pink-outline": "border-pink-700 hover:border-pink-600 disabled:border-pink-700 text-white",
20
20
  blue: "bg-blue-800 hover:bg-blue-700 disabled:bg-blue-700 text-white",
@@ -1,19 +1,15 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import cn from "../../utils/index.js";
4
3
  import { Button } from "./button.js";
5
4
  const TabButton = React.forwardRef(
6
- ({ className, children, size = "sm", ...props }, ref) => {
5
+ ({ className, children, size, ...props }, ref) => {
7
6
  return /* @__PURE__ */ jsx(
8
7
  Button,
9
8
  {
10
9
  ref,
11
10
  variant: "outline",
12
11
  size,
13
- className: cn(
14
- "bg-gray-900 text-gray-100 border-gray-700 hover:bg-gray-800 border-gray-300",
15
- className
16
- ),
12
+ className,
17
13
  ...props,
18
14
  children
19
15
  }
@@ -3,13 +3,14 @@ import { cva } from "class-variance-authority";
3
3
  import * as React from "react";
4
4
  import cn from "../../utils/index.js";
5
5
  const cardVariants = cva(
6
- "rounded-xl border border-border bg-card text-card-foreground",
6
+ "rounded-xl border border-border bg-card text-card-foreground hover:bg-secondary",
7
7
  {
8
8
  variants: {
9
9
  variant: {
10
10
  default: "",
11
- interactive: "hover:bg-secondary transition-colors cursor-pointer",
12
- transparent: "bg-card/0"
11
+ interactive: "hover:bg-card transition-colors cursor-pointer",
12
+ transparent: "bg-card/0",
13
+ nohover: "hover:bg-card hover:border-border"
13
14
  }
14
15
  },
15
16
  defaultVariants: {
@@ -10,13 +10,13 @@ function ExpandableCard({
10
10
  alwaysExpanded = false
11
11
  }) {
12
12
  const [isExpanded, setIsExpanded] = React.useState(alwaysExpanded);
13
- return /* @__PURE__ */ jsxs(Card, { children: [
13
+ return /* @__PURE__ */ jsxs(Card, { variant: "nohover", children: [
14
14
  /* @__PURE__ */ jsxs(
15
15
  "div",
16
16
  {
17
17
  className: cn(
18
18
  "flex items-center justify-between gap-4 p-4 rounded-t-xl",
19
- alwaysExpanded ? "" : "cursor-pointer hover:bg-accent/50",
19
+ alwaysExpanded ? "" : "cursor-pointer",
20
20
  isExpanded ? "" : "rounded-b-xl"
21
21
  ),
22
22
  onClick: () => {
@@ -38,7 +38,7 @@ function ExpandableCard({
38
38
  ]
39
39
  }
40
40
  ),
41
- isExpanded && /* @__PURE__ */ jsx(CardContent, { className: "border-t bg-gray-900/30", children })
41
+ isExpanded && /* @__PURE__ */ jsx(CardContent, { className: "border-t border-input bg-gray-900/30", children })
42
42
  ] });
43
43
  }
44
44
  export {
@@ -8,7 +8,7 @@ const Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
8
8
  {
9
9
  ref,
10
10
  className: cn(
11
- "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
11
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
12
12
  className
13
13
  ),
14
14
  ...props,
@@ -20,7 +20,7 @@ function DetailedPageTitle({
20
20
  explorerLinks,
21
21
  className
22
22
  }) {
23
- const intl = useIntlTyped();
23
+ const _intl = useIntlTyped();
24
24
  const [isPressed, setIsPressed] = React.useState(false);
25
25
  const handleCopy = () => {
26
26
  if (toCopy) {
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { cva } from "class-variance-authority";
3
3
  import cn from "../utils/index.js";
4
4
  const inputVariants = cva(
5
- "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 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm bg-[rgb(40,40,40)] text-white 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:rgb(255,255,255)]",
5
+ "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-white 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:rgb(255,255,255)] outline-none",
6
6
  {
7
7
  variants: {
8
8
  size: {
@@ -12,8 +12,8 @@ const inputVariants = cva(
12
12
  },
13
13
  variant: {
14
14
  default: "",
15
- error: "border-red-500 focus-visible:ring-red-500",
16
- success: "border-green-500 focus-visible:ring-green-500"
15
+ error: "border-red-500",
16
+ success: "border-green-500"
17
17
  }
18
18
  },
19
19
  defaultVariants: {
@@ -47,7 +47,7 @@ function Input({
47
47
  onWheel: props.type === "number" ? (e) => e.currentTarget.blur() : void 0
48
48
  }
49
49
  ),
50
- hasError && value !== "" && /* @__PURE__ */ jsx("p", { className: "text-red-500 text-sm", children: errorMessage })
50
+ hasError && errorMessage && /* @__PURE__ */ jsx("p", { className: "text-destructive text-sm", children: errorMessage })
51
51
  ] });
52
52
  }
53
53
  export {
@@ -4,16 +4,16 @@ import { cva } from "class-variance-authority";
4
4
  import * as React from "react";
5
5
  import cn from "../utils//index.js";
6
6
  const labelVariants = cva(
7
- "font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
7
+ "flex font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 mb-2 ",
8
8
  {
9
9
  variants: {
10
10
  size: {
11
11
  sm: "text-sm",
12
- default: "text-lg",
12
+ default: "text-md",
13
13
  lg: "text-xl"
14
14
  },
15
15
  variant: {
16
- default: "text-white",
16
+ default: "text-foreground",
17
17
  muted: "text-muted-foreground",
18
18
  error: "text-destructive",
19
19
  success: "text-green-500"
@@ -24,8 +24,8 @@ const Layout = React.forwardRef(
24
24
  className: "overflow-x-hidden py-6",
25
25
  style: {
26
26
  gridArea: "main",
27
- backgroundColor: "hsl(var(--main-background))",
28
- color: "hsl(var(--main-foreground))"
27
+ backgroundColor: "hsl(var(--background))",
28
+ color: "hsl(var(--foreground))"
29
29
  },
30
30
  children
31
31
  }
@@ -3,12 +3,10 @@ import { BackButton } from "./back-button.js";
3
3
  import { MarkdownViewer } from "./markdown-viewer.js";
4
4
  import { SIWEClientProvider } from "./siwe-provider.js";
5
5
  import { TokenIcon } from "./token-icon.js";
6
- import { Web3Providers } from "./web3-providers.js";
7
6
  export {
8
7
  BackButton,
9
8
  MarkdownViewer,
10
9
  SIWEClientProvider,
11
10
  SignInRequired,
12
- TokenIcon,
13
- Web3Providers
11
+ TokenIcon
14
12
  };
@@ -1,38 +1,97 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cva } from "class-variance-authority";
3
4
  import { Search } from "lucide-react";
4
5
  import { useState } from "react";
6
+ import cn from "../utils/index.js";
5
7
  import { Input } from "./input.js";
8
+ const searchBarVariants = cva("relative w-full transition-all duration-200", {
9
+ variants: {
10
+ size: {
11
+ sm: "max-w-xs",
12
+ default: "max-w-96",
13
+ lg: "max-w-lg",
14
+ full: "max-w-full"
15
+ }
16
+ },
17
+ defaultVariants: {
18
+ size: "default"
19
+ }
20
+ });
21
+ const searchBarInputVariants = cva("transition-all duration-200 pl-10", {
22
+ variants: {
23
+ active: {
24
+ true: "",
25
+ false: "bg-transparent border-input"
26
+ },
27
+ theme: {
28
+ light: "",
29
+ dark: ""
30
+ }
31
+ },
32
+ compoundVariants: [
33
+ {
34
+ active: true,
35
+ theme: "light",
36
+ className: "bg-card text-foreground"
37
+ },
38
+ {
39
+ active: true,
40
+ theme: "dark",
41
+ className: "bg-[rgb(40,40,40)] text-white"
42
+ },
43
+ {
44
+ active: false,
45
+ theme: "light",
46
+ className: "text-foreground placeholder:text-foreground"
47
+ },
48
+ {
49
+ active: false,
50
+ theme: "dark",
51
+ className: "text-white placeholder:text-white"
52
+ }
53
+ ],
54
+ defaultVariants: {
55
+ active: false,
56
+ theme: "light"
57
+ }
58
+ });
6
59
  function SearchBar({
7
60
  onChange,
8
61
  placeholder = "Search...",
9
- className = "w-64"
62
+ className,
63
+ size,
64
+ theme = "light"
10
65
  }) {
11
66
  const [searchQuery, setSearchQuery] = useState("");
67
+ const [focused, setFocused] = useState(false);
68
+ const active = searchQuery !== "" || focused;
12
69
  const handleSearch = (e) => {
13
70
  const query = e.target.value;
14
71
  setSearchQuery(query);
15
72
  onChange(query);
16
73
  };
17
- return /* @__PURE__ */ jsxs("div", { className: `relative ${className}`, children: [
74
+ return /* @__PURE__ */ jsx("div", { className: cn(searchBarVariants({ size }), className), children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
18
75
  /* @__PURE__ */ jsx(
19
- Input,
76
+ Search,
20
77
  {
21
- type: "text",
22
- placeholder,
23
- value: searchQuery,
24
- onChange: handleSearch,
25
- className: "pl-10"
78
+ className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground pointer-events-none",
79
+ size: 18
26
80
  }
27
81
  ),
28
82
  /* @__PURE__ */ jsx(
29
- Search,
83
+ Input,
30
84
  {
31
- className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground",
32
- size: 18
85
+ type: "search",
86
+ placeholder,
87
+ value: searchQuery,
88
+ onChange: handleSearch,
89
+ onFocus: () => setFocused(true),
90
+ onBlur: () => setFocused(false),
91
+ className: cn(searchBarInputVariants({ active, theme }))
33
92
  }
34
93
  )
35
- ] });
94
+ ] }) });
36
95
  }
37
96
  export {
38
97
  SearchBar
@@ -38,8 +38,8 @@ function VerticalTimeline({
38
38
  !showAll[index],
39
39
  ...showAll.slice(index + 1)
40
40
  ]),
41
- className: "ml-10 text-green-500 hover:underline",
42
- children: showAll ? "Hide all" : "Show all"
41
+ className: "ml-10 text-green-500 hover:underline cursor-pointer",
42
+ children: showAll[index] ? "Hide all" : "Show all"
43
43
  }
44
44
  )
45
45
  ] }),
@@ -72,7 +72,7 @@ const StatBadge = React.forwardRef(
72
72
  className: cn(
73
73
  "inline-flex items-center gap-1 text-xs font-medium",
74
74
  isNegative && "text-destructive",
75
- isPositive && "text-green-600 dark:text-green-400"
75
+ isPositive && "text-success"
76
76
  ),
77
77
  children: [
78
78
  isPositive && (delta.positiveIcon || /* @__PURE__ */ jsx(TrendingUp, { className: "h-3 w-3" })),
@@ -23,7 +23,7 @@ const tableVariants = cva("w-full caption-bottom", {
23
23
  }
24
24
  });
25
25
  const Table = React.forwardRef(
26
- ({ className, size, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
26
+ ({ className, size, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto rounded-lg border border-input bg-card", children: /* @__PURE__ */ jsx(
27
27
  "table",
28
28
  {
29
29
  ref,
@@ -33,7 +33,17 @@ const Table = React.forwardRef(
33
33
  ) })
34
34
  );
35
35
  Table.displayName = "Table";
36
- const TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b ", className), ...props }));
36
+ const TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
37
+ "thead",
38
+ {
39
+ ref,
40
+ className: cn(
41
+ "[&_tr]:border-b border-input [&_tr]:hover:bg-transparent",
42
+ className
43
+ ),
44
+ ...props
45
+ }
46
+ ));
37
47
  TableHeader.displayName = "TableHeader";
38
48
  const TableBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
39
49
  "tbody",
@@ -61,7 +71,7 @@ const TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
61
71
  {
62
72
  ref,
63
73
  className: cn(
64
- "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
74
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted border-border",
65
75
  className
66
76
  ),
67
77
  ...props
@@ -69,7 +79,7 @@ const TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
69
79
  ));
70
80
  TableRow.displayName = "TableRow";
71
81
  const tableHeadVariants = cva(
72
- "border-b bg-muted/50 text-left align-middle font-medium text-muted-foreground",
82
+ "border-b bg-muted/50 text-left align-middle font-medium text-muted-foreground border-input",
73
83
  {
74
84
  variants: {
75
85
  size: {
package/dist/globals.css CHANGED
@@ -32,20 +32,18 @@
32
32
  --white: 0 0% 100%;
33
33
  --black: 0 0% 0%;
34
34
  --border: 0 0% 89.8%;
35
- --main-background: 240 10% 3.9%;
36
- --main-foreground: 0 0% 98%;
37
35
  }
38
36
 
39
37
  .dark {
40
38
  color-scheme: dark;
41
39
 
42
- --background: 240 7% 7.5%;
40
+ --background: 240, 3%, 8%;
43
41
  --foreground: 0 0% 100%;
44
- --card: 240 7% 10%;
42
+ --card: 240, 4%, 10%;
45
43
  --card-foreground: 0 0% 100%;
46
44
  --popover: 240 6% 12%;
47
45
  --popover-foreground: 0 0% 100%;
48
- --primary: 330 98% 48%;
46
+ --primary: 328, 65%, 47%;
49
47
  --primary-foreground: 0 0% 100%;
50
48
  --secondary: 240 7% 17%;
51
49
  --secondary-foreground: 0 0% 100%;
@@ -55,7 +53,7 @@
55
53
  --accent-foreground: 0 0% 100%;
56
54
  --destructive: 0 100% 65%;
57
55
  --destructive-foreground: 0 0% 100%;
58
- --success: 143 100% 78%;
56
+ --success: 137, 100%, 79%;
59
57
  --warning: 44 100% 69%;
60
58
  --liquidation: 274 67% 58%;
61
59
  --input: 225 6% 19%;
@@ -75,17 +73,11 @@
75
73
  --dropdown-dark-button: 225 6% 19%;
76
74
  --white: 0 0% 100%;
77
75
  --black: 0 0% 0%;
78
- --border: 225 7% 22%;
79
- --main-background: 240 10% 3.9%;
80
- --main-foreground: 0 0% 98%;
76
+ --border: 0 0% 100% / 0.05;
81
77
  }
82
78
  }
83
79
 
84
80
  @layer base {
85
- * {
86
- border-color: hsl(var(--border));
87
- }
88
-
89
81
  body {
90
82
  margin: 0;
91
83
  padding: 0;
@@ -98,6 +90,7 @@
98
90
  line-height: 1.1875rem;
99
91
  background-color: hsl(var(--background));
100
92
  color: hsl(var(--foreground));
93
+ border-color: hsl(var(--border));
101
94
  -webkit-font-smoothing: antialiased;
102
95
  -moz-osx-font-smoothing: grayscale;
103
96
  -webkit-tap-highlight-color: transparent;
@@ -1,7 +1,7 @@
1
1
  import { type VariantProps } from "class-variance-authority";
2
2
  import * as React from "react";
3
3
  declare const cardVariants: (props?: ({
4
- variant?: "default" | "transparent" | "interactive" | null | undefined;
4
+ variant?: "default" | "transparent" | "interactive" | "nohover" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  export interface CardProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof cardVariants> {
7
7
  asChild?: boolean;
@@ -8,4 +8,3 @@ export { BackButton } from "./back-button";
8
8
  export { MarkdownViewer } from "./markdown-viewer";
9
9
  export { SIWEClientProvider } from "./siwe-provider";
10
10
  export { TokenIcon } from "./token-icon";
11
- export { Web3Providers } from "./web3-providers";
@@ -1,7 +1,12 @@
1
- interface SearchBarProps {
1
+ import { type VariantProps } from "class-variance-authority";
2
+ declare const searchBarVariants: (props?: ({
3
+ size?: "full" | "default" | "sm" | "lg" | null | undefined;
4
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
+ interface SearchBarProps extends VariantProps<typeof searchBarVariants> {
2
6
  onChange: (query: string) => void;
3
7
  placeholder?: string;
4
8
  className?: string;
9
+ theme?: "light" | "dark";
5
10
  }
6
11
  /**
7
12
  * SearchBar — search input component with icon.
@@ -13,14 +18,16 @@ interface SearchBarProps {
13
18
  * Props:
14
19
  * - `onChange` — callback function called when search query changes (required).
15
20
  * - `placeholder` — placeholder text (defaults to "Search...").
16
- * - `className` — additional CSS classes for styling (defaults to "w-64").
21
+ * - `className` — additional CSS classes for styling.
22
+ * - `size` — size variant: "sm", "default", "lg", "full" (defaults to "default").
23
+ * - `theme` — theme variant: "light" or "dark" (defaults to "light").
17
24
  *
18
25
  * Note: Includes search icon on the left side. Manages internal state for search query.
19
- * Calls onChange callback on every input change.
26
+ * Calls onChange callback on every input change. Includes animated states for active/focused.
20
27
  *
21
28
  * Do NOT use SearchBar:
22
29
  * - for simple text inputs (use Input component).
23
30
  * - when you don't need search icon (use Input component).
24
31
  */
25
- export declare function SearchBar({ onChange, placeholder, className, }: SearchBarProps): import("react/jsx-runtime").JSX.Element;
32
+ export declare function SearchBar({ onChange, placeholder, className, size, theme, }: SearchBarProps): import("react/jsx-runtime").JSX.Element;
26
33
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/permissionless-ui",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Internal UI components",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/index.js",
@@ -1,116 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var web3_providers_exports = {};
21
- __export(web3_providers_exports, {
22
- Web3Providers: () => Web3Providers
23
- });
24
- module.exports = __toCommonJS(web3_providers_exports);
25
- var import_jsx_runtime = require("react/jsx-runtime");
26
- var import_react_query = require("@tanstack/react-query");
27
- var import_connectkit = require("connectkit");
28
- var import_react = require("react");
29
- var import_siwe = require("viem/siwe");
30
- var import_wagmi = require("wagmi");
31
- function makeQueryClient() {
32
- return new import_react_query.QueryClient({
33
- defaultOptions: {
34
- queries: {
35
- staleTime: 60 * 1e3
36
- }
37
- }
38
- });
39
- }
40
- let browserQueryClient;
41
- function getQueryClient() {
42
- if (typeof window === "undefined") {
43
- return makeQueryClient();
44
- }
45
- if (!browserQueryClient) browserQueryClient = makeQueryClient();
46
- return browserQueryClient;
47
- }
48
- function Web3Providers({
49
- config,
50
- apiRoutePrefix,
51
- statement = "Sign In With Ethereum.",
52
- children
53
- }) {
54
- const [queryClient] = (0, import_react.useState)(() => getQueryClient());
55
- const getNonce = async () => {
56
- const res = await fetch(`${apiRoutePrefix}/nonce`);
57
- if (!res.ok) {
58
- throw new Error("Failed to fetch SIWE nonce");
59
- }
60
- return await res.text();
61
- };
62
- const createMessage = ({
63
- nonce,
64
- address,
65
- chainId
66
- }) => (0, import_siwe.createSiweMessage)({
67
- version: "1",
68
- domain: window.location.host,
69
- uri: window.location.origin,
70
- address,
71
- chainId,
72
- nonce,
73
- statement
74
- });
75
- const verifyMessage = async ({
76
- message,
77
- signature
78
- }) => {
79
- const res = await fetch(`${apiRoutePrefix}/signin`, {
80
- method: "POST",
81
- body: JSON.stringify({ message, signature })
82
- });
83
- if (!res.ok) {
84
- throw new Error("Failed to verify SIWE message");
85
- }
86
- return true;
87
- };
88
- const getSession = async () => {
89
- const res = await fetch(`${apiRoutePrefix}/session`);
90
- if (!res.ok) {
91
- return null;
92
- }
93
- return res.json();
94
- };
95
- const signOut = async () => {
96
- await fetch(`${apiRoutePrefix}/logout`, {
97
- method: "POST"
98
- });
99
- return true;
100
- };
101
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wagmi.WagmiProvider, { config, reconnectOnMount: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
- import_connectkit.SIWEProvider,
103
- {
104
- getNonce,
105
- createMessage,
106
- verifyMessage,
107
- getSession,
108
- signOut,
109
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_connectkit.ConnectKitProvider, { children })
110
- }
111
- ) }) });
112
- }
113
- // Annotate the CommonJS export names for ESM import in node:
114
- 0 && (module.exports = {
115
- Web3Providers
116
- });
@@ -1,92 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
- import { ConnectKitProvider, SIWEProvider } from "connectkit";
5
- import { useState } from "react";
6
- import { createSiweMessage } from "viem/siwe";
7
- import { WagmiProvider } from "wagmi";
8
- function makeQueryClient() {
9
- return new QueryClient({
10
- defaultOptions: {
11
- queries: {
12
- staleTime: 60 * 1e3
13
- }
14
- }
15
- });
16
- }
17
- let browserQueryClient;
18
- function getQueryClient() {
19
- if (typeof window === "undefined") {
20
- return makeQueryClient();
21
- }
22
- if (!browserQueryClient) browserQueryClient = makeQueryClient();
23
- return browserQueryClient;
24
- }
25
- function Web3Providers({
26
- config,
27
- apiRoutePrefix,
28
- statement = "Sign In With Ethereum.",
29
- children
30
- }) {
31
- const [queryClient] = useState(() => getQueryClient());
32
- const getNonce = async () => {
33
- const res = await fetch(`${apiRoutePrefix}/nonce`);
34
- if (!res.ok) {
35
- throw new Error("Failed to fetch SIWE nonce");
36
- }
37
- return await res.text();
38
- };
39
- const createMessage = ({
40
- nonce,
41
- address,
42
- chainId
43
- }) => createSiweMessage({
44
- version: "1",
45
- domain: window.location.host,
46
- uri: window.location.origin,
47
- address,
48
- chainId,
49
- nonce,
50
- statement
51
- });
52
- const verifyMessage = async ({
53
- message,
54
- signature
55
- }) => {
56
- const res = await fetch(`${apiRoutePrefix}/signin`, {
57
- method: "POST",
58
- body: JSON.stringify({ message, signature })
59
- });
60
- if (!res.ok) {
61
- throw new Error("Failed to verify SIWE message");
62
- }
63
- return true;
64
- };
65
- const getSession = async () => {
66
- const res = await fetch(`${apiRoutePrefix}/session`);
67
- if (!res.ok) {
68
- return null;
69
- }
70
- return res.json();
71
- };
72
- const signOut = async () => {
73
- await fetch(`${apiRoutePrefix}/logout`, {
74
- method: "POST"
75
- });
76
- return true;
77
- };
78
- return /* @__PURE__ */ jsx(WagmiProvider, { config, reconnectOnMount: true, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(
79
- SIWEProvider,
80
- {
81
- getNonce,
82
- createMessage,
83
- verifyMessage,
84
- getSession,
85
- signOut,
86
- children: /* @__PURE__ */ jsx(ConnectKitProvider, { children })
87
- }
88
- ) }) });
89
- }
90
- export {
91
- Web3Providers
92
- };
@@ -1,29 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import type { Config } from "wagmi";
3
- /**
4
- * Web3Providers — all-in-one provider component for Web3 apps with Wagmi, ConnectKit, SIWE, and React Query.
5
- *
6
- * @usage
7
- * Use Web3Providers to wrap your Next.js application and enable Web3 functionality:
8
- * app root, authentication context, wallet connection.
9
- *
10
- * Props:
11
- * - `config` — Wagmi config object (required).
12
- * - `apiRoutePrefix` — API route prefix for SIWE endpoints (required):
13
- * - `/api/nonce` — endpoint for fetching nonce.
14
- * - `/api/signin` — endpoint for verifying signature.
15
- * - `/api/session` — endpoint for getting current session.
16
- * - `/api/logout` — endpoint for signing out.
17
- * - `statement` — optional custom statement for SIWE message (defaults to "Sign In With Ethereum.").
18
- * - `children` — application content wrapped by provider (required).
19
- *
20
- * Note: Web3Providers wraps WagmiProvider, QueryClientProvider, ConnectKitProvider, and SIWEProvider with correct order and configuration.
21
- */
22
- interface Web3ProvidersProps {
23
- config: Config;
24
- apiRoutePrefix: string;
25
- statement?: string;
26
- children: ReactNode;
27
- }
28
- export declare function Web3Providers({ config, apiRoutePrefix, statement, children, }: Web3ProvidersProps): import("react/jsx-runtime").JSX.Element;
29
- export {};