@gearbox-protocol/permissionless-ui 1.10.6 → 1.10.8

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 (70) hide show
  1. package/dist/cjs/components/buttons/back-button/back-button.cjs +3 -3
  2. package/dist/cjs/components/buttons/button/button.cjs +12 -2
  3. package/dist/cjs/components/dialog/dialog-form.cjs +66 -0
  4. package/dist/cjs/components/dialog/index.cjs +4 -0
  5. package/dist/cjs/components/dialog/one-field-dialog.cjs +104 -0
  6. package/dist/cjs/components/dropdown-menu/dropdown-menu.cjs +6 -1
  7. package/dist/cjs/components/error-message/error-line-message.cjs +26 -0
  8. package/dist/cjs/components/error-message/index.cjs +2 -0
  9. package/dist/cjs/components/error-view/error-view.cjs +50 -0
  10. package/dist/cjs/components/error-view/index.cjs +9 -0
  11. package/dist/cjs/components/filter/filter-modal.cjs +4 -1
  12. package/dist/cjs/components/index.cjs +14 -0
  13. package/dist/cjs/components/layout/block/block.cjs +53 -0
  14. package/dist/cjs/components/layout/block/index.cjs +9 -0
  15. package/dist/cjs/components/layout/index.cjs +2 -0
  16. package/dist/cjs/components/layout/page-layout/page-layout.cjs +16 -15
  17. package/dist/cjs/components/loader-guard/loader-guard.cjs +4 -0
  18. package/dist/cjs/components/next/markdown-viewer.cjs +2 -0
  19. package/dist/cjs/components/page-title/page-title.cjs +17 -14
  20. package/dist/cjs/components/select/select.cjs +5 -1
  21. package/dist/cjs/components/skeleton/index.cjs +2 -0
  22. package/dist/cjs/components/skeleton/skeleton-stack.cjs +35 -0
  23. package/dist/cjs/components/with-copy/index.cjs +9 -0
  24. package/dist/cjs/components/with-copy/with-copy.cjs +57 -0
  25. package/dist/cjs/index.cjs +14 -0
  26. package/dist/esm/components/buttons/back-button/back-button.js +3 -3
  27. package/dist/esm/components/buttons/button/button.js +12 -2
  28. package/dist/esm/components/dialog/dialog-form.js +62 -0
  29. package/dist/esm/components/dialog/index.js +2 -0
  30. package/dist/esm/components/dialog/one-field-dialog.js +100 -0
  31. package/dist/esm/components/dropdown-menu/dropdown-menu.js +6 -1
  32. package/dist/esm/components/error-message/error-line-message.js +22 -0
  33. package/dist/esm/components/error-message/index.js +1 -0
  34. package/dist/esm/components/error-view/error-view.js +46 -0
  35. package/dist/esm/components/error-view/index.js +1 -0
  36. package/dist/esm/components/filter/filter-modal.js +4 -1
  37. package/dist/esm/components/index.js +7 -0
  38. package/dist/esm/components/layout/block/block.js +49 -0
  39. package/dist/esm/components/layout/block/index.js +1 -0
  40. package/dist/esm/components/layout/index.js +1 -0
  41. package/dist/esm/components/layout/page-layout/page-layout.js +16 -15
  42. package/dist/esm/components/loader-guard/loader-guard.js +4 -0
  43. package/dist/esm/components/next/markdown-viewer.js +2 -0
  44. package/dist/esm/components/page-title/page-title.js +17 -14
  45. package/dist/esm/components/select/select.js +5 -1
  46. package/dist/esm/components/skeleton/index.js +1 -0
  47. package/dist/esm/components/skeleton/skeleton-stack.js +31 -0
  48. package/dist/esm/components/with-copy/index.js +1 -0
  49. package/dist/esm/components/with-copy/with-copy.js +53 -0
  50. package/dist/esm/index.js +7 -0
  51. package/dist/globals.css +1 -1
  52. package/dist/types/components/dialog/dialog-form.d.ts +50 -0
  53. package/dist/types/components/dialog/index.d.ts +2 -0
  54. package/dist/types/components/dialog/one-field-dialog.d.ts +43 -0
  55. package/dist/types/components/dropdown-menu/dropdown-menu.d.ts +10 -6
  56. package/dist/types/components/error-message/error-line-message.d.ts +19 -0
  57. package/dist/types/components/error-message/index.d.ts +1 -0
  58. package/dist/types/components/error-view/error-view.d.ts +28 -0
  59. package/dist/types/components/error-view/index.d.ts +1 -0
  60. package/dist/types/components/index.d.ts +2 -0
  61. package/dist/types/components/layout/block/block.d.ts +23 -0
  62. package/dist/types/components/layout/block/index.d.ts +1 -0
  63. package/dist/types/components/layout/index.d.ts +1 -0
  64. package/dist/types/components/select/select.d.ts +4 -1
  65. package/dist/types/components/skeleton/index.d.ts +1 -0
  66. package/dist/types/components/skeleton/skeleton-stack.d.ts +19 -0
  67. package/dist/types/components/with-copy/index.d.ts +1 -0
  68. package/dist/types/components/with-copy/with-copy.d.ts +29 -0
  69. package/dist/types/index.d.ts +2 -0
  70. package/package.json +1 -1
@@ -0,0 +1,49 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import 'react';
3
+ import { cn } from '../../../utils/cn.js';
4
+ import 'sonner';
5
+ import '@gearbox-protocol/sdk';
6
+
7
+ const marginClasses = {
8
+ none: "mb-0",
9
+ sm: "mb-4",
10
+ md: "mb-6",
11
+ lg: "mb-8"
12
+ };
13
+ const justifyClasses = {
14
+ "flex-start": "justify-start",
15
+ center: "justify-center",
16
+ "flex-end": "justify-end",
17
+ between: "justify-between"
18
+ };
19
+ const alignClasses = {
20
+ "flex-start": "items-start",
21
+ center: "items-center",
22
+ "flex-end": "items-end",
23
+ stretch: "items-stretch"
24
+ };
25
+ function Block({
26
+ children,
27
+ margin = "md",
28
+ justify = "flex-start",
29
+ align = "flex-start",
30
+ className,
31
+ ...props
32
+ }) {
33
+ return /* @__PURE__ */ jsx(
34
+ "div",
35
+ {
36
+ className: cn(
37
+ "flex flex-row flex-nowrap",
38
+ marginClasses[margin],
39
+ justifyClasses[justify],
40
+ alignClasses[align],
41
+ className
42
+ ),
43
+ ...props,
44
+ children
45
+ }
46
+ );
47
+ }
48
+
49
+ export { Block };
@@ -0,0 +1 @@
1
+ export { Block } from './block.js';
@@ -1,4 +1,5 @@
1
1
  export { AppLogo } from './app-logo/app-logo.js';
2
+ export { Block } from './block/block.js';
2
3
  export { Col } from './col/col.js';
3
4
  export { Container } from './container/container.js';
4
5
  export { Footer, FooterLink, FooterLinkSection, GearboxFooter } from './footer/footer.js';
@@ -1,5 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { BackButton } from '../../buttons/back-button/back-button.js';
3
+ import { PageTitle } from '../../page-title/page-title.js';
3
4
  import { Container } from '../container/container.js';
4
5
 
5
6
  function PageLayout({
@@ -13,24 +14,24 @@ function PageLayout({
13
14
  containerClassName
14
15
  }) {
15
16
  return /* @__PURE__ */ jsxs(Container, { maxWidth: maxContainerWidth, className: containerClassName, children: [
16
- backButton && /* @__PURE__ */ jsx(
17
- BackButton,
17
+ /* @__PURE__ */ jsx(
18
+ PageTitle,
18
19
  {
19
- href: backButton.href,
20
- text: backButton.text,
21
- onClick: backButton.onClick
20
+ backButton: backButton ? /* @__PURE__ */ jsx(
21
+ BackButton,
22
+ {
23
+ href: backButton.href,
24
+ text: backButton.text,
25
+ onClick: backButton.onClick
26
+ }
27
+ ) : void 0,
28
+ icon,
29
+ actions: actionButton,
30
+ subtitle: description,
31
+ className: "mb-6",
32
+ children: title
22
33
  }
23
34
  ),
24
- /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-4 mb-6 w-full", children: [
25
- icon,
26
- /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
27
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center w-full", children: [
28
- /* @__PURE__ */ jsx("h1", { className: " text-xl md:text-3xl font-bold max-w-64 md:max-w-128 truncate", children: title }),
29
- actionButton && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: actionButton })
30
- ] }),
31
- description
32
- ] })
33
- ] }),
34
35
  children
35
36
  ] });
36
37
  }
@@ -2,6 +2,9 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { Guard } from '../guard/guard.js';
3
3
  import 'clsx';
4
4
  import 'tailwind-merge';
5
+ import 'react';
6
+ import 'sonner';
7
+ import '@gearbox-protocol/sdk';
5
8
  import '../layout/col/col.js';
6
9
  import { Container } from '../layout/container/container.js';
7
10
  import '../layout/footer/footer.js';
@@ -10,6 +13,7 @@ import '../layout/header/header.js';
10
13
  import '../layout/layout/layout.js';
11
14
  import '../base-link/base-link.js';
12
15
  import '../buttons/back-button/back-button.js';
16
+ import '../page-title/page-title.js';
13
17
  import { Skeleton } from '../skeleton/skeleton.js';
14
18
 
15
19
  function LoaderGuard({
@@ -5,6 +5,8 @@ import ReactMarkdown from 'react-markdown';
5
5
  import remarkGfm from 'remark-gfm';
6
6
  import 'clsx';
7
7
  import 'tailwind-merge';
8
+ import 'sonner';
9
+ import '@gearbox-protocol/sdk';
8
10
  import '../layout/col/col.js';
9
11
  import '../layout/container/container.js';
10
12
  import '../layout/footer/footer.js';
@@ -28,18 +28,21 @@ const pageTitleVariants = cva(
28
28
  }
29
29
  }
30
30
  );
31
- const pageTitleRootVariants = cva("flex items-center", {
32
- variants: {
33
- spacing: {
34
- sm: "gap-2",
35
- default: "gap-4",
36
- lg: "gap-6"
31
+ const pageTitleRootVariants = cva(
32
+ "flex flex-col md:flex-row items-start md:items-center",
33
+ {
34
+ variants: {
35
+ spacing: {
36
+ sm: "gap-2",
37
+ default: "gap-4",
38
+ lg: "gap-6"
39
+ }
40
+ },
41
+ defaultVariants: {
42
+ spacing: "default"
37
43
  }
38
- },
39
- defaultVariants: {
40
- spacing: "default"
41
44
  }
42
- });
45
+ );
43
46
  const PageTitle = React.forwardRef(
44
47
  ({
45
48
  className,
@@ -55,10 +58,10 @@ const PageTitle = React.forwardRef(
55
58
  ...props
56
59
  }, ref) => {
57
60
  return /* @__PURE__ */ jsx("div", { ref, className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: cn(pageTitleRootVariants({ spacing })), children: [
58
- backButton && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: backButton }),
59
- /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col md:flex-row md:items-center gap-4", children: [
61
+ backButton && /* @__PURE__ */ jsx("div", { className: "shrink-0 flex items-center md:order-first", children: backButton }),
62
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col md:flex-row md:items-center gap-4 w-full md:w-auto", children: [
60
63
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [
61
- icon && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: icon }),
64
+ icon && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: icon }),
62
65
  /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
63
66
  /* @__PURE__ */ jsx(
64
67
  Component,
@@ -70,7 +73,7 @@ const PageTitle = React.forwardRef(
70
73
  subtitle && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground mt-1", children: subtitle })
71
74
  ] })
72
75
  ] }),
73
- actions && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0 flex items-center gap-2 md:ml-auto", children: actions })
76
+ actions && /* @__PURE__ */ jsx("div", { className: "shrink-0 flex items-center gap-2 ml-auto md:ml-auto", children: actions })
74
77
  ] })
75
78
  ] }) });
76
79
  }
@@ -7,7 +7,11 @@ import { cn } from '../../utils/cn.js';
7
7
  import 'sonner';
8
8
  import '@gearbox-protocol/sdk';
9
9
 
10
- const Select = SelectPrimitive.Root;
10
+ const Select = ({
11
+ modal = false,
12
+ ...props
13
+ }) => /* @__PURE__ */ jsx(SelectPrimitive.Root, { modal, ...props });
14
+ Select.displayName = "Select";
11
15
  const SelectGroup = SelectPrimitive.Group;
12
16
  const SelectValue = SelectPrimitive.Value;
13
17
  const selectTriggerVariants = cva(
@@ -1 +1,2 @@
1
1
  export { Skeleton, skeletonVariants } from './skeleton.js';
2
+ export { SkeletonStack } from './skeleton-stack.js';
@@ -0,0 +1,31 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { cn } from '../../utils/cn.js';
4
+ import 'sonner';
5
+ import '@gearbox-protocol/sdk';
6
+ import { Skeleton } from './skeleton.js';
7
+
8
+ const gapClasses = {
9
+ sm: "space-y-2",
10
+ md: "space-y-3",
11
+ lg: "space-y-4"
12
+ };
13
+ function SkeletonStack({
14
+ lines = 5,
15
+ className,
16
+ gap = "md"
17
+ }) {
18
+ const skeletonKeys = useMemo(
19
+ () => Array.from({ length: lines }, () => crypto.randomUUID()),
20
+ [lines]
21
+ );
22
+ return /* @__PURE__ */ jsx("div", { className: cn(gapClasses[gap], className), children: skeletonKeys.map((key, index) => /* @__PURE__ */ jsx(
23
+ Skeleton,
24
+ {
25
+ className: cn("h-4 w-full", index === lines - 1 && "w-3/4")
26
+ },
27
+ key
28
+ )) });
29
+ }
30
+
31
+ export { SkeletonStack };
@@ -0,0 +1 @@
1
+ export { WithCopy } from './with-copy.js';
@@ -0,0 +1,53 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { Copy } from 'lucide-react';
3
+ import { useState } from 'react';
4
+ import { toast } from 'sonner';
5
+ import { cn } from '../../utils/cn.js';
6
+ import '@gearbox-protocol/sdk';
7
+
8
+ function WithCopy({
9
+ toCopy,
10
+ children,
11
+ onCopySuccess,
12
+ successMessage = "Copied to clipboard",
13
+ iconSize = 14,
14
+ icon,
15
+ className,
16
+ buttonClassName
17
+ }) {
18
+ const [isPressed, setIsPressed] = useState(false);
19
+ const handleCopy = async () => {
20
+ try {
21
+ await navigator.clipboard.writeText(toCopy);
22
+ setIsPressed(true);
23
+ setTimeout(() => setIsPressed(false), 150);
24
+ if (onCopySuccess) {
25
+ onCopySuccess();
26
+ } else {
27
+ toast.success(successMessage);
28
+ }
29
+ } catch (error) {
30
+ console.error("Failed to copy:", error);
31
+ toast.error("Failed to copy");
32
+ }
33
+ };
34
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center", className), children: [
35
+ children,
36
+ /* @__PURE__ */ jsx(
37
+ "button",
38
+ {
39
+ type: "button",
40
+ onClick: handleCopy,
41
+ className: cn(
42
+ "ml-1 text-gray-400 cursor-pointer hover:text-white transition-all",
43
+ isPressed ? "scale-75" : "scale-100",
44
+ buttonClassName
45
+ ),
46
+ title: "Copy to clipboard",
47
+ children: icon ?? /* @__PURE__ */ jsx(Copy, { size: iconSize })
48
+ }
49
+ )
50
+ ] });
51
+ }
52
+
53
+ export { WithCopy };
package/dist/esm/index.js CHANGED
@@ -32,9 +32,11 @@ export { DialogContainer } from './components/dialog/dialog-container.js';
32
32
  export { DialogContent } from './components/dialog/dialog-content.js';
33
33
  export { DialogDescription } from './components/dialog/dialog-description.js';
34
34
  export { DialogFooter } from './components/dialog/dialog-footer.js';
35
+ export { DialogForm } from './components/dialog/dialog-form.js';
35
36
  export { DialogHeader } from './components/dialog/dialog-header.js';
36
37
  export { DialogOverlay } from './components/dialog/dialog-overlay.js';
37
38
  export { DialogTitle } from './components/dialog/dialog-title.js';
39
+ export { OneFieldDialog } from './components/dialog/one-field-dialog.js';
38
40
  export { DropdownMenu, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuSub, DropdownMenuTrigger } from './components/dropdown-menu/dropdown-menu.js';
39
41
  export { DropdownMenuCheckboxItem } from './components/dropdown-menu/dropdown-menu-checkbox-item.js';
40
42
  export { DropdownMenuContent } from './components/dropdown-menu/dropdown-menu-content.js';
@@ -45,7 +47,9 @@ export { DropdownMenuSeparator } from './components/dropdown-menu/dropdown-menu-
45
47
  export { DropdownMenuShortcut } from './components/dropdown-menu/dropdown-menu-shortcut.js';
46
48
  export { DropdownMenuSubContent } from './components/dropdown-menu/dropdown-menu-sub-content.js';
47
49
  export { DropdownMenuSubTrigger } from './components/dropdown-menu/dropdown-menu-sub-trigger.js';
50
+ export { ErrorLineMessage } from './components/error-message/error-line-message.js';
48
51
  export { ErrorMessage } from './components/error-message/error-message.js';
52
+ export { ErrorView } from './components/error-view/error-view.js';
49
53
  export { FilterBlock } from './components/filter/filter-block.js';
50
54
  export { FilterCheckboxItem } from './components/filter/filter-checkbox-item.js';
51
55
  export { FilterChip } from './components/filter/filter-chip.js';
@@ -74,6 +78,7 @@ export { HorizontalIndicator } from './components/horizontal-indicator/horizonta
74
78
  export { Input, inputVariants } from './components/input/input.js';
75
79
  export { Label, labelVariants } from './components/label/label.js';
76
80
  export { AppLogo } from './components/layout/app-logo/app-logo.js';
81
+ export { Block } from './components/layout/block/block.js';
77
82
  export { Col } from './components/layout/col/col.js';
78
83
  export { Container } from './components/layout/container/container.js';
79
84
  export { Footer, FooterLink, FooterLinkSection, GearboxFooter } from './components/layout/footer/footer.js';
@@ -103,6 +108,7 @@ export { ConfirmationItem } from './components/signatures/confirmation-item.js';
103
108
  export { Identicon } from './components/signatures/identicon.js';
104
109
  export { VerticalTimeline } from './components/signatures/vertical-timeline.js';
105
110
  export { Skeleton, skeletonVariants } from './components/skeleton/skeleton.js';
111
+ export { SkeletonStack } from './components/skeleton/skeleton-stack.js';
106
112
  export { StatBadge, StatBadgeGrid, statBadgeContentVariants, statBadgeGridVariants, statBadgeTitleVariants, statBadgeVariants } from './components/stat-badge/stat-badge.js';
107
113
  export { TabControl, TabItem, useHashTabs, useSectionTab, useTabControl } from './components/tab-control/tab-control.js';
108
114
  export { EditButton } from './components/table/edit-button.js';
@@ -129,6 +135,7 @@ export { GraphDropdown } from './components/trading-view/graph-dropdown.js';
129
135
  export { TradingView } from './components/trading-view/trading-view.js';
130
136
  export { FormattedMessageTyped, useIntlTyped } from './components/typed-intl/index.js';
131
137
  export { VSpace } from './components/vspace/vspace.js';
138
+ export { WithCopy } from './components/with-copy/with-copy.js';
132
139
  export { WithFilterButton } from './components/with-filter-button/with-filter-button.js';
133
140
  export { designTokens } from './configs/design-tokens.js';
134
141
  export { interactiveVariants, paddingVariants, sizeVariants, stateVariants } from './configs/variants.js';