@gearbox-protocol/permissionless-ui 1.9.2 → 1.9.4

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.
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const jsxRuntime = require('react/jsx-runtime');
6
+ require('../buttons/back-button/back-button.cjs');
7
+ const components_buttons_button_button = require('../buttons/button/button.cjs');
8
+ require('../buttons/copy-button/copy-button.cjs');
9
+ require('../buttons/external-button/external-button.cjs');
10
+ require('../buttons/filter-button/filter-button.cjs');
11
+ require('../buttons/navigation-button/navigation-button.cjs');
12
+ require('react');
13
+ require('clsx');
14
+ require('tailwind-merge');
15
+ require('sonner');
16
+ require('@gearbox-protocol/sdk');
17
+ const components_buttons_tabButton_tabButton = require('../buttons/tab-button/tab-button.cjs');
18
+ const connectkit = require('connectkit');
19
+ const wagmi = require('wagmi');
20
+
21
+ function ConnectRequired({
22
+ children,
23
+ owner,
24
+ ...customProps
25
+ }) {
26
+ const { setOpen } = connectkit.useModal();
27
+ const { isConnected, address } = wagmi.useAccount();
28
+ const ButtonComponent = Object.keys(customProps).length > 0 ? components_buttons_button_button.Button : components_buttons_tabButton_tabButton.TabButton;
29
+ if (isConnected && address) {
30
+ if (owner && address?.toLowerCase() !== owner.toLowerCase()) {
31
+ return /* @__PURE__ */ jsxRuntime.jsx(ButtonComponent, { ...customProps, disabled: true, children: "You are not the author" });
32
+ }
33
+ return children;
34
+ }
35
+ return /* @__PURE__ */ jsxRuntime.jsx(ButtonComponent, { ...customProps, onClick: () => setOpen(true), children: "Connect Wallet" });
36
+ }
37
+
38
+ exports.ConnectRequired = ConnectRequired;
@@ -4,8 +4,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const components_auth_signinRequired = require('./signin-required.cjs');
6
6
  const components_auth_siweProvider = require('./siwe-provider.cjs');
7
+ const components_auth_connectRequired = require('./connect-required.cjs');
7
8
 
8
9
 
9
10
 
10
11
  exports.SignInRequired = components_auth_signinRequired.SignInRequired;
11
12
  exports.SIWEClientProvider = components_auth_siweProvider.SIWEClientProvider;
13
+ exports.ConnectRequired = components_auth_connectRequired.ConnectRequired;
@@ -8,6 +8,7 @@ const components_assetsListCell_assetsListCell = require('./assets-list-cell/ass
8
8
  const components_assetsRatio_assetsRatio = require('./assets-ratio/assets-ratio.cjs');
9
9
  const components_auth_signinRequired = require('./auth/signin-required.cjs');
10
10
  const components_auth_siweProvider = require('./auth/siwe-provider.cjs');
11
+ const components_auth_connectRequired = require('./auth/connect-required.cjs');
11
12
  const components_badge_badge = require('./badge/badge.cjs');
12
13
  const components_baseLink_baseLink = require('./base-link/base-link.cjs');
13
14
  const components_blockSync_blockSync = require('./block-sync/block-sync.cjs');
@@ -154,6 +155,7 @@ exports.AssetsListCell = components_assetsListCell_assetsListCell.AssetsListCell
154
155
  exports.AssetsRatio = components_assetsRatio_assetsRatio.AssetsRatio;
155
156
  exports.SignInRequired = components_auth_signinRequired.SignInRequired;
156
157
  exports.SIWEClientProvider = components_auth_siweProvider.SIWEClientProvider;
158
+ exports.ConnectRequired = components_auth_connectRequired.ConnectRequired;
157
159
  exports.Badge = components_badge_badge.Badge;
158
160
  exports.badgeVariants = components_badge_badge.badgeVariants;
159
161
  exports.BaseLink = components_baseLink_baseLink.BaseLink;
@@ -19,6 +19,7 @@ require('tailwind-merge');
19
19
  require('sonner');
20
20
  require('@gearbox-protocol/sdk');
21
21
  const components_buttons_tabButton_tabButton = require('../buttons/tab-button/tab-button.cjs');
22
+ require('wagmi');
22
23
  const components_tokenIcon_tokenIcon = require('../token-icon/token-icon.cjs');
23
24
  const components_table_gridTable = require('./grid-table.cjs');
24
25
  const components_table_updatedValue = require('./updated-value.cjs');
@@ -18,6 +18,7 @@ require('tailwind-merge');
18
18
  require('sonner');
19
19
  require('@gearbox-protocol/sdk');
20
20
  const components_buttons_tabButton_tabButton = require('../buttons/tab-button/tab-button.cjs');
21
+ require('wagmi');
21
22
  const components_tokenIcon_tokenIcon = require('../token-icon/token-icon.cjs');
22
23
  const components_table_table = require('./table.cjs');
23
24
  const components_table_updatedValue = require('./updated-value.cjs');
@@ -35,7 +35,7 @@ const TabsList = React__namespace.forwardRef(({ className, ...props }, ref) => /
35
35
  {
36
36
  ref,
37
37
  className: utils_cn.cn(
38
- "inline-flex h-fit items-center justify-start rounded-lg bg-muted p-1 text-muted-foreground bg-transparent p-0 space-x-6 overflow-x-auto overflow-y-hidden navbar-scrollbar min-w-max",
38
+ "inline-flex h-fit items-center justify-start bg-muted p-1 text-muted-foreground bg-transparent p-0 space-x-6 overflow-x-auto overflow-y-hidden navbar-scrollbar min-w-max",
39
39
  className
40
40
  ),
41
41
  ...props
@@ -47,7 +47,7 @@ const TabsTrigger = React__namespace.forwardRef(({ className, ...props }, ref) =
47
47
  {
48
48
  ref,
49
49
  className: utils_cn.cn(
50
- "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow rounded-none border-b-2 border-transparent px-2 py-2 text-gray-400 hover:text-foreground data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:text-foreground focus:outline-none cursor-pointer shrink-0",
50
+ "inline-flex items-center justify-center whitespace-nowrap px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow rounded-none border-b-2 border-transparent px-2 py-2 text-gray-400 hover:text-foreground data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:text-foreground focus:outline-none cursor-pointer shrink-0",
51
51
  className
52
52
  ),
53
53
  ...props
@@ -8,6 +8,7 @@ const components_assetsListCell_assetsListCell = require('./components/assets-li
8
8
  const components_assetsRatio_assetsRatio = require('./components/assets-ratio/assets-ratio.cjs');
9
9
  const components_auth_signinRequired = require('./components/auth/signin-required.cjs');
10
10
  const components_auth_siweProvider = require('./components/auth/siwe-provider.cjs');
11
+ const components_auth_connectRequired = require('./components/auth/connect-required.cjs');
11
12
  const components_badge_badge = require('./components/badge/badge.cjs');
12
13
  const components_baseLink_baseLink = require('./components/base-link/base-link.cjs');
13
14
  const components_blockSync_blockSync = require('./components/block-sync/block-sync.cjs');
@@ -174,6 +175,7 @@ exports.AssetsListCell = components_assetsListCell_assetsListCell.AssetsListCell
174
175
  exports.AssetsRatio = components_assetsRatio_assetsRatio.AssetsRatio;
175
176
  exports.SignInRequired = components_auth_signinRequired.SignInRequired;
176
177
  exports.SIWEClientProvider = components_auth_siweProvider.SIWEClientProvider;
178
+ exports.ConnectRequired = components_auth_connectRequired.ConnectRequired;
177
179
  exports.Badge = components_badge_badge.Badge;
178
180
  exports.badgeVariants = components_badge_badge.badgeVariants;
179
181
  exports.BaseLink = components_baseLink_baseLink.BaseLink;
@@ -0,0 +1,34 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import '../buttons/back-button/back-button.js';
3
+ import { Button } from '../buttons/button/button.js';
4
+ import '../buttons/copy-button/copy-button.js';
5
+ import '../buttons/external-button/external-button.js';
6
+ import '../buttons/filter-button/filter-button.js';
7
+ import '../buttons/navigation-button/navigation-button.js';
8
+ import 'react';
9
+ import 'clsx';
10
+ import 'tailwind-merge';
11
+ import 'sonner';
12
+ import '@gearbox-protocol/sdk';
13
+ import { TabButton } from '../buttons/tab-button/tab-button.js';
14
+ import { useModal } from 'connectkit';
15
+ import { useAccount } from 'wagmi';
16
+
17
+ function ConnectRequired({
18
+ children,
19
+ owner,
20
+ ...customProps
21
+ }) {
22
+ const { setOpen } = useModal();
23
+ const { isConnected, address } = useAccount();
24
+ const ButtonComponent = Object.keys(customProps).length > 0 ? Button : TabButton;
25
+ if (isConnected && address) {
26
+ if (owner && address?.toLowerCase() !== owner.toLowerCase()) {
27
+ return /* @__PURE__ */ jsx(ButtonComponent, { ...customProps, disabled: true, children: "You are not the author" });
28
+ }
29
+ return children;
30
+ }
31
+ return /* @__PURE__ */ jsx(ButtonComponent, { ...customProps, onClick: () => setOpen(true), children: "Connect Wallet" });
32
+ }
33
+
34
+ export { ConnectRequired };
@@ -1,2 +1,3 @@
1
1
  export { SignInRequired } from './signin-required.js';
2
2
  export { SIWEClientProvider } from './siwe-provider.js';
3
+ export { ConnectRequired } from './connect-required.js';
@@ -4,6 +4,7 @@ export { AssetsListCell } from './assets-list-cell/assets-list-cell.js';
4
4
  export { AssetsRatio } from './assets-ratio/assets-ratio.js';
5
5
  export { SignInRequired } from './auth/signin-required.js';
6
6
  export { SIWEClientProvider } from './auth/siwe-provider.js';
7
+ export { ConnectRequired } from './auth/connect-required.js';
7
8
  export { Badge, badgeVariants } from './badge/badge.js';
8
9
  export { BaseLink } from './base-link/base-link.js';
9
10
  export { BlockSync } from './block-sync/block-sync.js';
@@ -15,6 +15,7 @@ import 'tailwind-merge';
15
15
  import 'sonner';
16
16
  import '@gearbox-protocol/sdk';
17
17
  import { TabButton } from '../buttons/tab-button/tab-button.js';
18
+ import 'wagmi';
18
19
  import { TokenIcon } from '../token-icon/token-icon.js';
19
20
  import { GridTableCell, GridTable } from './grid-table.js';
20
21
  import { UpdatedValue } from './updated-value.js';
@@ -14,6 +14,7 @@ import 'tailwind-merge';
14
14
  import 'sonner';
15
15
  import '@gearbox-protocol/sdk';
16
16
  import { TabButton } from '../buttons/tab-button/tab-button.js';
17
+ import 'wagmi';
17
18
  import { TokenIcon } from '../token-icon/token-icon.js';
18
19
  import { TableCell, Table } from './table.js';
19
20
  import { UpdatedValue } from './updated-value.js';
@@ -11,7 +11,7 @@ const TabsList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
11
11
  {
12
12
  ref,
13
13
  className: cn(
14
- "inline-flex h-fit items-center justify-start rounded-lg bg-muted p-1 text-muted-foreground bg-transparent p-0 space-x-6 overflow-x-auto overflow-y-hidden navbar-scrollbar min-w-max",
14
+ "inline-flex h-fit items-center justify-start bg-muted p-1 text-muted-foreground bg-transparent p-0 space-x-6 overflow-x-auto overflow-y-hidden navbar-scrollbar min-w-max",
15
15
  className
16
16
  ),
17
17
  ...props
@@ -23,7 +23,7 @@ const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PUR
23
23
  {
24
24
  ref,
25
25
  className: cn(
26
- "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow rounded-none border-b-2 border-transparent px-2 py-2 text-gray-400 hover:text-foreground data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:text-foreground focus:outline-none cursor-pointer shrink-0",
26
+ "inline-flex items-center justify-center whitespace-nowrap px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow rounded-none border-b-2 border-transparent px-2 py-2 text-gray-400 hover:text-foreground data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:text-foreground focus:outline-none cursor-pointer shrink-0",
27
27
  className
28
28
  ),
29
29
  ...props
package/dist/esm/index.js CHANGED
@@ -4,6 +4,7 @@ export { AssetsListCell } from './components/assets-list-cell/assets-list-cell.j
4
4
  export { AssetsRatio } from './components/assets-ratio/assets-ratio.js';
5
5
  export { SignInRequired } from './components/auth/signin-required.js';
6
6
  export { SIWEClientProvider } from './components/auth/siwe-provider.js';
7
+ export { ConnectRequired } from './components/auth/connect-required.js';
7
8
  export { Badge, badgeVariants } from './components/badge/badge.js';
8
9
  export { BaseLink } from './components/base-link/base-link.js';
9
10
  export { BlockSync } from './components/block-sync/block-sync.js';
package/dist/globals.css CHANGED
@@ -158,6 +158,10 @@
158
158
  "cv03" on;
159
159
  }
160
160
 
161
+ html {
162
+ scrollbar-gutter: stable;
163
+ }
164
+
161
165
  html.dark {
162
166
  color-scheme: dark;
163
167
  }
@@ -0,0 +1,32 @@
1
+ import { TabButtonProps } from '../buttons';
2
+ import { ReactNode } from '../../../node_modules/.pnpm/react@19.2.0/node_modules/react';
3
+ import { Address } from 'viem';
4
+ /**
5
+ * SignInRequired — component that requires SIWE authentication to display content.
6
+ *
7
+ * @usage
8
+ * Use SignInRequired to protect content that requires authentication:
9
+ * action buttons, editable content, owner-specific features, authenticated actions.
10
+ *
11
+ * Props:
12
+ * - `owner` — optional address that must match signed-in address to display content.
13
+ * - `children` — content displayed when authenticated (required).
14
+ * - All Button props are supported (variant, size, className, onClick, etc.).
15
+ *
16
+ * Behavior:
17
+ * - If user is connected: renders children (or "You are not the author" if owner mismatch).
18
+ * - If wallet connected but not signed in: shows "Sign In as {address}" button or "Try Again" if rejected.
19
+ * - If wallet not connected: shows "Connect Wallet" button.
20
+ *
21
+ * Note: Uses TabButton by default, but switches to Button if custom props are provided.
22
+ * Button text changes based on authentication state and loading status.
23
+ *
24
+ * Do NOT use SignInRequired:
25
+ * - for public content that doesn't require authentication (render content directly).
26
+ * - when you need different authentication flow (use appropriate authentication components).
27
+ */
28
+ export interface ConnectRequiredProps extends TabButtonProps {
29
+ owner?: Address;
30
+ children: ReactNode;
31
+ }
32
+ export declare function ConnectRequired({ children, owner, ...customProps }: ConnectRequiredProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('../../../node_modules/.pnpm/react@19.2.0/node_modules/react').ReactPortal | import('../../../node_modules/.pnpm/react@19.2.0/node_modules/react').ReactElement<unknown, string | import('../../../node_modules/.pnpm/react@19.2.0/node_modules/react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
@@ -1,2 +1,3 @@
1
1
  export * from './signin-required';
2
2
  export * from './siwe-provider';
3
+ export * from './connect-required';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/permissionless-ui",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "description": "Internal UI components",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/index.js",