@gearbox-protocol/permissionless-ui 1.2.13 → 1.2.14

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.
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var table_exports = {};
30
30
  __export(table_exports, {
31
+ SortingTableHead: () => SortingTableHead,
31
32
  Table: () => Table,
32
33
  TableBody: () => TableBody,
33
34
  TableCaption: () => TableCaption,
@@ -39,8 +40,10 @@ __export(table_exports, {
39
40
  });
40
41
  module.exports = __toCommonJS(table_exports);
41
42
  var import_jsx_runtime = require("react/jsx-runtime");
43
+ var import_lucide_react = require("lucide-react");
42
44
  var React = __toESM(require("react"));
43
45
  var import_utils = __toESM(require('../utils/index.js'));
46
+ var import_button = require('./buttons/button.js');
44
47
  const Table = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "rounded-xl border relative w-full overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
48
  "table",
46
49
  {
@@ -108,8 +111,54 @@ const TableCaption = React.forwardRef(({ className, ...props }, ref) => /* @__PU
108
111
  }
109
112
  ));
110
113
  TableCaption.displayName = "TableCaption";
114
+ const SortingTableHead = React.forwardRef(
115
+ ({
116
+ isSorted,
117
+ direction,
118
+ setSort,
119
+ placement = "right",
120
+ children,
121
+ className,
122
+ ...props
123
+ }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, { ref, className, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
124
+ "div",
125
+ {
126
+ className: (0, import_utils.default)(
127
+ "group flex items-center gap-1 w-fit cursor-pointer hover:text-white",
128
+ placement === "left" ? "flex-row-reverse" : "flex-row"
129
+ ),
130
+ onClick: () => setSort(direction === "asc" ? "desc" : "asc"),
131
+ children: [
132
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children }),
133
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
134
+ import_button.Button,
135
+ {
136
+ variant: "ghost",
137
+ size: "sm",
138
+ className: (0, import_utils.default)(
139
+ "hover:bg-accent/0 group-hover:text-white p-0 h-auto",
140
+ isSorted ? void 0 : "opacity-0 group-hover:opacity-100"
141
+ ),
142
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
143
+ import_lucide_react.ArrowDown,
144
+ {
145
+ className: (0, import_utils.default)(
146
+ `h-${4} w-${4}`,
147
+ direction === "desc" ? "rotate-180" : "",
148
+ "transition-transform duration-200 ease-in-out"
149
+ )
150
+ }
151
+ )
152
+ }
153
+ )
154
+ ]
155
+ }
156
+ ) })
157
+ );
158
+ SortingTableHead.displayName = "SortTableHead";
111
159
  // Annotate the CommonJS export names for ESM import in node:
112
160
  0 && (module.exports = {
161
+ SortingTableHead,
113
162
  Table,
114
163
  TableBody,
115
164
  TableCaption,
@@ -1,6 +1,8 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { ArrowDown } from "lucide-react";
2
3
  import * as React from "react";
3
4
  import cn from "../utils/index.js";
5
+ import { Button } from "./buttons/button.js";
4
6
  const Table = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "rounded-xl border relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
5
7
  "table",
6
8
  {
@@ -68,7 +70,53 @@ const TableCaption = React.forwardRef(({ className, ...props }, ref) => /* @__PU
68
70
  }
69
71
  ));
70
72
  TableCaption.displayName = "TableCaption";
73
+ const SortingTableHead = React.forwardRef(
74
+ ({
75
+ isSorted,
76
+ direction,
77
+ setSort,
78
+ placement = "right",
79
+ children,
80
+ className,
81
+ ...props
82
+ }, ref) => /* @__PURE__ */ jsx(TableHead, { ref, className, ...props, children: /* @__PURE__ */ jsxs(
83
+ "div",
84
+ {
85
+ className: cn(
86
+ "group flex items-center gap-1 w-fit cursor-pointer hover:text-white",
87
+ placement === "left" ? "flex-row-reverse" : "flex-row"
88
+ ),
89
+ onClick: () => setSort(direction === "asc" ? "desc" : "asc"),
90
+ children: [
91
+ /* @__PURE__ */ jsx("span", { children }),
92
+ /* @__PURE__ */ jsx(
93
+ Button,
94
+ {
95
+ variant: "ghost",
96
+ size: "sm",
97
+ className: cn(
98
+ "hover:bg-accent/0 group-hover:text-white p-0 h-auto",
99
+ isSorted ? void 0 : "opacity-0 group-hover:opacity-100"
100
+ ),
101
+ children: /* @__PURE__ */ jsx(
102
+ ArrowDown,
103
+ {
104
+ className: cn(
105
+ `h-${4} w-${4}`,
106
+ direction === "desc" ? "rotate-180" : "",
107
+ "transition-transform duration-200 ease-in-out"
108
+ )
109
+ }
110
+ )
111
+ }
112
+ )
113
+ ]
114
+ }
115
+ ) })
116
+ );
117
+ SortingTableHead.displayName = "SortTableHead";
71
118
  export {
119
+ SortingTableHead,
72
120
  Table,
73
121
  TableBody,
74
122
  TableCaption,
@@ -7,4 +7,11 @@ declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
7
7
  declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
8
8
  declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
9
9
  declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
10
- export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, };
10
+ export interface SortTableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {
11
+ isSorted: boolean;
12
+ direction: "asc" | "desc";
13
+ setSort: (direction: "asc" | "desc") => void;
14
+ placement?: "left" | "right";
15
+ }
16
+ declare const SortingTableHead: React.ForwardRefExoticComponent<SortTableHeadProps & React.RefAttributes<HTMLTableCellElement>>;
17
+ export { SortingTableHead, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/permissionless-ui",
3
- "version": "1.2.13",
3
+ "version": "1.2.14",
4
4
  "description": "Internal UI components",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/index.js",