@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.
@@ -1,116 +1,92 @@
1
- import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
- import { cva as k } from "class-variance-authority";
3
- import * as z from "react";
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 s } from "../../utils/cn.js";
5
+ import { cn as m } from "../../utils/cn.js";
6
6
  import "sonner";
7
- const C = k(
8
- "relative flex flex-row flex-nowrap items-center bg-muted rounded-md",
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
- xs: "h-6 text-[10px]",
13
- sm: "h-7 text-xs",
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
- ), N = z.forwardRef(
29
- ({ className: u, name: h, items: a, size: m, fullWidth: f, minItemWidth: d, ...x }, p) => {
30
- const n = m ?? "md", o = f ?? !0, t = a.findIndex((e) => e.checked), l = a.length, g = {
31
- xs: "rounded-sm",
18
+ ), x = u("", {
19
+ variants: {
20
+ size: {
32
21
  sm: "rounded-sm",
33
- md: "rounded-md",
34
- default: "rounded-md",
35
- lg: "rounded-md"
36
- }, b = d ? { minWidth: d, flex: "0 0 auto" } : {};
37
- return /* @__PURE__ */ i(
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
- ref: p,
41
- className: s(
42
- C({
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
- ...x,
49
- children: [
50
- a.map((e, w) => {
51
- const v = e.switchLabel ?? e.label, y = e.onChange ?? e.onSelect, c = typeof e.value == "string" ? e.value : void 0;
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
- N.displayName = "SegmentedControl";
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
- N as SegmentedControl,
115
- C as segmentedControlVariants
90
+ b as SegmentedControl,
91
+ h as segmentedControlVariants
116
92
  };
@@ -1,39 +1,57 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import * as l from "react";
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 u } from "../../utils/cn.js";
5
+ import { cn as m } from "../../utils/cn.js";
5
6
  import "sonner";
6
- function d(t) {
7
- if (t === !0) return "flex-1";
8
- if (t === "auto") return "flex-none";
9
- if (typeof t == "number") {
10
- const r = t / 12;
11
- return r === 1 ? "w-full" : r === 0.5 ? "w-1/2" : r === 0.25 ? "w-1/4" : r === 0.75 ? "w-3/4" : r === 1 / 3 ? "w-1/3" : r === 2 / 3 ? "w-2/3" : "";
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
- return "";
14
- }
15
- function x({
16
- children: t,
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
- className: u(
27
- f,
28
- !a && "border-r border-border pr-4 mr-4"
31
+ ref: s,
32
+ className: m(
33
+ "flex w-full flex-row flex-nowrap",
34
+ "items-stretch",
35
+ l
29
36
  ),
30
- style: m,
31
- children: e
32
- },
33
- p
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
- x as SplitList
56
+ b as SplitList
39
57
  };