@gearbox-protocol/permissionless-ui 1.22.0-next.44 → 1.22.0-next.46
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.
- package/dist/cjs/components/block-sync/block-sync.cjs +1 -1
- package/dist/cjs/components/buttons/button/button.cjs +1 -1
- package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
- package/dist/cjs/components/complex-input/complex-input.cjs +1 -1
- package/dist/cjs/components/search-line/search-line.cjs +1 -1
- package/dist/cjs/components/segmented-control/segmented-control.cjs +1 -1
- package/dist/cjs/components/split-list/split-list.cjs +1 -1
- package/dist/esm/components/block-sync/block-sync.js +3 -2
- package/dist/esm/components/buttons/button/button.js +6 -6
- package/dist/esm/components/checkbox/checkbox-labeled.js +1 -0
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -0
- package/dist/esm/components/complex-input/complex-input.js +3 -2
- package/dist/esm/components/search-line/search-line.js +47 -35
- package/dist/esm/components/segmented-control/segmented-control.js +77 -101
- package/dist/esm/components/split-list/split-list.js +48 -30
- package/dist/globals.css +1 -1
- package/dist/types/components/search-line/search-line.d.ts +5 -5
- package/dist/types/components/segmented-control/segmented-control.d.ts +23 -66
- package/dist/types/components/split-list/split-list.d.ts +16 -21
- package/package.json +1 -1
|
@@ -1,116 +1,92 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cva as
|
|
3
|
-
import * as
|
|
1
|
+
import { jsxs as p, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { cva as u } from "class-variance-authority";
|
|
3
|
+
import * as g from "react";
|
|
4
4
|
import "@gearbox-protocol/sdk";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as m } from "../../utils/cn.js";
|
|
6
6
|
import "sonner";
|
|
7
|
-
const
|
|
8
|
-
"relative flex flex-row flex-nowrap items-center bg-
|
|
7
|
+
const h = u(
|
|
8
|
+
"relative z-0 flex w-full flex-row flex-nowrap items-center bg-gray-30",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
md: "h-10 text-sm",
|
|
15
|
-
default: "h-8 text-xs sm:h-10 sm:text-sm",
|
|
16
|
-
lg: "h-10 text-sm sm:h-12 sm:text-base"
|
|
17
|
-
},
|
|
18
|
-
fullWidth: {
|
|
19
|
-
true: "w-full",
|
|
20
|
-
false: "w-fit"
|
|
12
|
+
sm: "h-[28px] rounded-sm text-xs leading-[130%]",
|
|
13
|
+
md: "h-[40px] rounded-lg text-[0.9375rem] leading-[18px]"
|
|
21
14
|
}
|
|
22
15
|
},
|
|
23
|
-
defaultVariants: {
|
|
24
|
-
size: "md",
|
|
25
|
-
fullWidth: !0
|
|
26
|
-
}
|
|
16
|
+
defaultVariants: { size: "md" }
|
|
27
17
|
}
|
|
28
|
-
),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
xs: "rounded-sm",
|
|
18
|
+
), x = u("", {
|
|
19
|
+
variants: {
|
|
20
|
+
size: {
|
|
32
21
|
sm: "rounded-sm",
|
|
33
|
-
md: "rounded-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
md: "rounded-lg"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: { size: "md" }
|
|
26
|
+
}), b = g.forwardRef(({ className: l, name: d, items: a, size: r = "md", ...n }, e) => {
|
|
27
|
+
const s = a.findIndex((t) => t.checked), i = s < 0 ? 0 : s, c = a.length;
|
|
28
|
+
return /* @__PURE__ */ p("div", { ref: e, className: m(h({ size: r }), l), ...n, children: [
|
|
29
|
+
a.map((t, f) => /* @__PURE__ */ o(
|
|
30
|
+
v,
|
|
31
|
+
{
|
|
32
|
+
...t,
|
|
33
|
+
name: d
|
|
34
|
+
},
|
|
35
|
+
typeof t.value == "string" ? t.value : f
|
|
36
|
+
)),
|
|
37
|
+
/* @__PURE__ */ o(
|
|
38
38
|
"div",
|
|
39
39
|
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
size: n,
|
|
44
|
-
fullWidth: o
|
|
45
|
-
}),
|
|
46
|
-
u
|
|
40
|
+
className: m(
|
|
41
|
+
"absolute top-0 left-0 z-[-1] h-full bg-gray-60 shadow-[0_2px_2px_rgba(0,0,0,0.25)] transition-transform duration-200 ease-in-out",
|
|
42
|
+
x({ size: r })
|
|
47
43
|
),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return /* @__PURE__ */ i(
|
|
53
|
-
"label",
|
|
54
|
-
{
|
|
55
|
-
className: s(
|
|
56
|
-
"relative z-10 m-0 p-0 flex h-full cursor-pointer select-none",
|
|
57
|
-
o ? "flex-1" : "shrink-0",
|
|
58
|
-
e.disabled && "cursor-not-allowed opacity-50"
|
|
59
|
-
),
|
|
60
|
-
style: b,
|
|
61
|
-
"data-checked": e.checked,
|
|
62
|
-
"data-disabled": e.disabled,
|
|
63
|
-
children: [
|
|
64
|
-
/* @__PURE__ */ r(
|
|
65
|
-
"input",
|
|
66
|
-
{
|
|
67
|
-
type: "radio",
|
|
68
|
-
name: h,
|
|
69
|
-
value: c,
|
|
70
|
-
checked: e.checked,
|
|
71
|
-
disabled: e.disabled,
|
|
72
|
-
onChange: y,
|
|
73
|
-
className: "absolute h-0 w-0 opacity-0 cursor-pointer"
|
|
74
|
-
}
|
|
75
|
-
),
|
|
76
|
-
/* @__PURE__ */ r(
|
|
77
|
-
"span",
|
|
78
|
-
{
|
|
79
|
-
className: s(
|
|
80
|
-
"flex h-full w-full items-center justify-center px-2 sm:px-3 whitespace-nowrap",
|
|
81
|
-
e.checked ? "text-foreground" : "text-muted-foreground"
|
|
82
|
-
),
|
|
83
|
-
children: v
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
c ?? w
|
|
89
|
-
);
|
|
90
|
-
}),
|
|
91
|
-
/* @__PURE__ */ r(
|
|
92
|
-
"div",
|
|
93
|
-
{
|
|
94
|
-
className: s(
|
|
95
|
-
"absolute z-0 h-full bg-gray-600 shadow transition-all duration-200 ease-in-out",
|
|
96
|
-
g[n]
|
|
97
|
-
),
|
|
98
|
-
style: o ? {
|
|
99
|
-
width: l > 0 ? `${100 / l}%` : "0%",
|
|
100
|
-
transform: t >= 0 ? `translateX(${100 * t}%)` : "translateX(0%)"
|
|
101
|
-
} : {
|
|
102
|
-
width: t >= 0 ? `calc(100% / ${l})` : d || "auto",
|
|
103
|
-
left: t >= 0 ? `calc(${t} * 100% / ${l})` : "0"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
]
|
|
44
|
+
style: {
|
|
45
|
+
width: c > 0 ? `${100 / c}%` : "0%",
|
|
46
|
+
transform: `translateX(${c > 0 ? 100 * i : 0}%)`
|
|
47
|
+
}
|
|
108
48
|
}
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
|
|
49
|
+
)
|
|
50
|
+
] });
|
|
51
|
+
});
|
|
52
|
+
b.displayName = "SegmentedControl";
|
|
53
|
+
function v({
|
|
54
|
+
name: l,
|
|
55
|
+
switchLabel: d,
|
|
56
|
+
label: a,
|
|
57
|
+
onChange: r,
|
|
58
|
+
onSelect: n,
|
|
59
|
+
...e
|
|
60
|
+
}) {
|
|
61
|
+
const s = r ?? (n ? (i) => {
|
|
62
|
+
i.preventDefault(), n();
|
|
63
|
+
} : void 0);
|
|
64
|
+
return /* @__PURE__ */ p(
|
|
65
|
+
"label",
|
|
66
|
+
{
|
|
67
|
+
className: m(
|
|
68
|
+
"relative m-0 block h-full grow shrink-0 basis-0 cursor-pointer select-none",
|
|
69
|
+
e.disabled && "cursor-default opacity-50"
|
|
70
|
+
),
|
|
71
|
+
"data-checked": e.checked,
|
|
72
|
+
"data-disabled": e.disabled,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ o(
|
|
75
|
+
"input",
|
|
76
|
+
{
|
|
77
|
+
type: "radio",
|
|
78
|
+
name: l,
|
|
79
|
+
className: "absolute h-0 w-0 cursor-pointer opacity-0",
|
|
80
|
+
...e,
|
|
81
|
+
onChange: s
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ o("span", { className: "flex h-full grow shrink-0 basis-0 items-center justify-center px-2 py-1", children: d ?? a })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
113
89
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
90
|
+
b as SegmentedControl,
|
|
91
|
+
h as segmentedControlVariants
|
|
116
92
|
};
|
|
@@ -1,39 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cva as c } from "class-variance-authority";
|
|
3
|
+
import * as t from "react";
|
|
3
4
|
import "@gearbox-protocol/sdk";
|
|
4
|
-
import { cn as
|
|
5
|
+
import { cn as m } from "../../utils/cn.js";
|
|
5
6
|
import "sonner";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const u = c(
|
|
8
|
+
[
|
|
9
|
+
/* layout */
|
|
10
|
+
"relative flex items-center",
|
|
11
|
+
/* padding: 0 18px, no padding on first/last edges */
|
|
12
|
+
"px-[18px] first:pl-0 last:pr-0",
|
|
13
|
+
/* vertical divider (::before): 60% height, centered, gray40; hidden on first item */
|
|
14
|
+
"before:absolute before:left-0 before:top-[20%] before:h-[60%] before:border-l before:border-gray-40 before:content-[''] first:before:border-l-transparent"
|
|
15
|
+
].join(" "),
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
colSize: {
|
|
19
|
+
equal: "grow shrink-0 basis-0",
|
|
20
|
+
auto: "w-auto grow-0 shrink-0 basis-auto"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: { colSize: "equal" }
|
|
12
24
|
}
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
colSize: r = !0,
|
|
18
|
-
className: c
|
|
19
|
-
}) {
|
|
20
|
-
const i = l.Children.toArray(t).filter(Boolean);
|
|
21
|
-
return /* @__PURE__ */ s("div", { className: u("flex flex-wrap items-stretch", c), children: i.map((e, n) => {
|
|
22
|
-
const o = typeof r == "function" ? r(n) : r, a = n === i.length - 1, f = d(o), m = typeof o == "number" && !f ? { width: `${o / 12 * 100}%` } : void 0, p = l.isValidElement(e) && e.key ? e.key : `split-item-${n}`;
|
|
23
|
-
return /* @__PURE__ */ s(
|
|
25
|
+
), b = t.forwardRef(
|
|
26
|
+
({ children: i, colSize: r = !0, className: l }, s) => {
|
|
27
|
+
const n = t.Children.toArray(i).filter(Boolean);
|
|
28
|
+
return /* @__PURE__ */ a(
|
|
24
29
|
"div",
|
|
25
30
|
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
ref: s,
|
|
32
|
+
className: m(
|
|
33
|
+
"flex w-full flex-row flex-nowrap",
|
|
34
|
+
"items-stretch",
|
|
35
|
+
l
|
|
29
36
|
),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
children: n.map((e, o) => {
|
|
38
|
+
const f = typeof r == "function" ? r(o) : r, p = t.isValidElement(e) && e.key != null ? e.key : `split-item-${o}`;
|
|
39
|
+
return /* @__PURE__ */ a(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: u({
|
|
43
|
+
colSize: f === "auto" ? "auto" : "equal"
|
|
44
|
+
}),
|
|
45
|
+
children: e
|
|
46
|
+
},
|
|
47
|
+
p
|
|
48
|
+
);
|
|
49
|
+
})
|
|
50
|
+
}
|
|
34
51
|
);
|
|
35
|
-
}
|
|
36
|
-
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
b.displayName = "SplitList";
|
|
37
55
|
export {
|
|
38
|
-
|
|
56
|
+
b as SplitList
|
|
39
57
|
};
|