@gearbox-protocol/permissionless-ui 1.17.4 → 1.17.5
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("class-variance-authority"),y=require("lucide-react"),c=require("react"),S=require("../input/input.cjs"),l=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk");const b=o.cva("relative w-full transition-all duration-200",{variants:{size:{sm:"max-w-xs",default:"max-w-96",lg:"max-w-lg",full:"max-w-full"}},defaultVariants:{size:"default"}}),N=o.cva("transition-all duration-200 pl-10",{variants:{active:{true:"",false:"bg-transparent border-input"},theme:{light:"",dark:""}},compoundVariants:[{active:!0,theme:"light",className:"bg-card text-foreground"},{active:!0,theme:"dark",className:"bg-[rgb(40,40,40)] text-foreground"},{active:!1,theme:"light",className:"text-foreground placeholder:text-foreground"},{active:!1,theme:"dark",className:"text-foreground placeholder:text-foreground"}],defaultVariants:{active:!1,theme:"light"}});function j({onChange:i,placeholder:u="Search...",className:d,size:h,theme:f="light",value:t}){const[m,g]=c.useState(""),[v,a]=c.useState(!1),r=t!==void 0,s=r?t:m,x=s!==""||v,p=q=>{const n=q.target.value;r||g(n),i(n)};return e.jsx("div",{className:l.cn(b({size:h}),d),children:e.jsxs("div",{className:"relative",children:[e.jsx(y.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground pointer-events-none",size:18}),e.jsx(S.Input,{type:"search",placeholder:u,value:s,onChange:p,onFocus:()=>a(!0),onBlur:()=>a(!1),className:l.cn(N({active:x,theme:f}))})]})})}exports.SearchBar=j;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { cva as
|
|
3
|
-
import { Search as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { cn as
|
|
1
|
+
import { jsx as e, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { cva as i } from "class-variance-authority";
|
|
3
|
+
import { Search as y } from "lucide-react";
|
|
4
|
+
import { useState as n } from "react";
|
|
5
|
+
import { Input as w } from "../input/input.js";
|
|
6
|
+
import { cn as l } from "../../utils/cn.js";
|
|
7
7
|
import "sonner";
|
|
8
8
|
import "@gearbox-protocol/sdk";
|
|
9
|
-
const
|
|
9
|
+
const S = i("relative w-full transition-all duration-200", {
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
12
12
|
sm: "max-w-xs",
|
|
@@ -18,7 +18,7 @@ const b = l("relative w-full transition-all duration-200", {
|
|
|
18
18
|
defaultVariants: {
|
|
19
19
|
size: "default"
|
|
20
20
|
}
|
|
21
|
-
}),
|
|
21
|
+
}), V = i("transition-all duration-200 pl-10", {
|
|
22
22
|
variants: {
|
|
23
23
|
active: {
|
|
24
24
|
true: "",
|
|
@@ -56,39 +56,40 @@ const b = l("relative w-full transition-all duration-200", {
|
|
|
56
56
|
theme: "light"
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
|
-
function
|
|
60
|
-
onChange:
|
|
61
|
-
placeholder:
|
|
62
|
-
className:
|
|
63
|
-
size:
|
|
64
|
-
theme:
|
|
59
|
+
function q({
|
|
60
|
+
onChange: c,
|
|
61
|
+
placeholder: u = "Search...",
|
|
62
|
+
className: m,
|
|
63
|
+
size: d,
|
|
64
|
+
theme: f = "light",
|
|
65
|
+
value: t
|
|
65
66
|
}) {
|
|
66
|
-
const [
|
|
67
|
-
const
|
|
68
|
-
|
|
67
|
+
const [h, g] = n(""), [p, a] = n(!1), r = t !== void 0, s = r ? t : h, v = s !== "" || p, x = (N) => {
|
|
68
|
+
const o = N.target.value;
|
|
69
|
+
r || g(o), c(o);
|
|
69
70
|
};
|
|
70
|
-
return /* @__PURE__ */ e("div", { className:
|
|
71
|
+
return /* @__PURE__ */ e("div", { className: l(S({ size: d }), m), children: /* @__PURE__ */ b("div", { className: "relative", children: [
|
|
71
72
|
/* @__PURE__ */ e(
|
|
72
|
-
|
|
73
|
+
y,
|
|
73
74
|
{
|
|
74
75
|
className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground pointer-events-none",
|
|
75
76
|
size: 18
|
|
76
77
|
}
|
|
77
78
|
),
|
|
78
79
|
/* @__PURE__ */ e(
|
|
79
|
-
|
|
80
|
+
w,
|
|
80
81
|
{
|
|
81
82
|
type: "search",
|
|
82
|
-
placeholder:
|
|
83
|
-
value:
|
|
84
|
-
onChange:
|
|
83
|
+
placeholder: u,
|
|
84
|
+
value: s,
|
|
85
|
+
onChange: x,
|
|
85
86
|
onFocus: () => a(!0),
|
|
86
87
|
onBlur: () => a(!1),
|
|
87
|
-
className:
|
|
88
|
+
className: l(V({ active: v, theme: f }))
|
|
88
89
|
}
|
|
89
90
|
)
|
|
90
91
|
] }) });
|
|
91
92
|
}
|
|
92
93
|
export {
|
|
93
|
-
|
|
94
|
+
q as SearchBar
|
|
94
95
|
};
|
|
@@ -7,6 +7,8 @@ interface SearchBarProps extends VariantProps<typeof searchBarVariants> {
|
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
className?: string;
|
|
9
9
|
theme?: "light" | "dark";
|
|
10
|
+
/** Optional controlled value. If provided, the component becomes controlled. */
|
|
11
|
+
value?: string;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* SearchBar — search input component with icon.
|
|
@@ -29,5 +31,5 @@ interface SearchBarProps extends VariantProps<typeof searchBarVariants> {
|
|
|
29
31
|
* - for simple text inputs (use Input component).
|
|
30
32
|
* - when you don't need search icon (use Input component).
|
|
31
33
|
*/
|
|
32
|
-
export declare function SearchBar({ onChange, placeholder, className, size, theme, }: SearchBarProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function SearchBar({ onChange, placeholder, className, size, theme, value, }: SearchBarProps): import("react/jsx-runtime").JSX.Element;
|
|
33
35
|
export {};
|