uibee 3.1.0 → 3.1.2
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.
|
@@ -825,14 +825,17 @@ function SearchInput({ placeholder = "Search...", variant = "default" }) {
|
|
|
825
825
|
className: "pl-10 pr-4 py-2 border-b outline-none w-64"
|
|
826
826
|
})]
|
|
827
827
|
});
|
|
828
|
-
else return /* @__PURE__ */ jsx(
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
828
|
+
else return /* @__PURE__ */ jsx("div", {
|
|
829
|
+
className: "w-fit min-w-48",
|
|
830
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
831
|
+
name: "search",
|
|
832
|
+
icon: /* @__PURE__ */ jsx(Search, { className: "w-5 h-5" }),
|
|
833
|
+
value: searchValue,
|
|
834
|
+
onChange: handleChange,
|
|
835
|
+
onKeyDown: handleKeyDown,
|
|
836
|
+
onBlur: () => handleSearch(searchValue),
|
|
837
|
+
placeholder
|
|
838
|
+
})
|
|
836
839
|
});
|
|
837
840
|
}
|
|
838
841
|
//#endregion
|
|
@@ -2646,7 +2649,9 @@ const variants = {
|
|
|
2646
2649
|
success: "bg-green-600 text-white hover:brightness-110",
|
|
2647
2650
|
info: "bg-blue-600 text-white hover:brightness-110"
|
|
2648
2651
|
};
|
|
2649
|
-
const base = "cursor-pointer
|
|
2652
|
+
const base = "cursor-pointer rounded-md h-9 flex items-center justify-center gap-2 select-none text-sm font-medium transition-all duration-150";
|
|
2653
|
+
const withText = "px-4 w-fit";
|
|
2654
|
+
const iconOnly = "w-9";
|
|
2650
2655
|
const disabledCls = "opacity-40 cursor-not-allowed pointer-events-none";
|
|
2651
2656
|
const iconWrap = (icon) => icon ? /* @__PURE__ */ jsx("span", {
|
|
2652
2657
|
className: "[&>svg]:w-4 [&>svg]:h-4 flex items-center",
|
|
@@ -2654,7 +2659,8 @@ const iconWrap = (icon) => icon ? /* @__PURE__ */ jsx("span", {
|
|
|
2654
2659
|
}) : null;
|
|
2655
2660
|
function Button({ text, className, icon, path, variant = "primary", type, onClick, disabled }) {
|
|
2656
2661
|
const color = variants[variant];
|
|
2657
|
-
const
|
|
2662
|
+
const sizing = icon && !text ? iconOnly : withText;
|
|
2663
|
+
const cls = `${base} ${sizing} ${color} ${disabled ? disabledCls : ""} ${className || ""}`;
|
|
2658
2664
|
if (!path) return /* @__PURE__ */ jsxs("button", {
|
|
2659
2665
|
type: type || "button",
|
|
2660
2666
|
disabled,
|
|
@@ -2669,7 +2675,7 @@ function Button({ text, className, icon, path, variant = "primary", type, onClic
|
|
|
2669
2675
|
});
|
|
2670
2676
|
return /* @__PURE__ */ jsxs(Link, {
|
|
2671
2677
|
href: path,
|
|
2672
|
-
className: `${base} ${color} ${className || ""}`,
|
|
2678
|
+
className: `${base} ${sizing} ${color} ${className || ""}`,
|
|
2673
2679
|
children: [iconWrap(icon), text]
|
|
2674
2680
|
});
|
|
2675
2681
|
}
|
package/dist/style.css
CHANGED
package/package.json
CHANGED
|
@@ -21,7 +21,9 @@ const variants = {
|
|
|
21
21
|
info: 'bg-blue-600 text-white hover:brightness-110',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const base = 'cursor-pointer
|
|
24
|
+
const base = 'cursor-pointer rounded-md h-9 flex items-center justify-center gap-2 select-none text-sm font-medium transition-all duration-150'
|
|
25
|
+
const withText = 'px-4 w-fit'
|
|
26
|
+
const iconOnly = 'w-9'
|
|
25
27
|
const disabledCls = 'opacity-40 cursor-not-allowed pointer-events-none'
|
|
26
28
|
|
|
27
29
|
const iconWrap = (icon: ButtonProps['icon']) =>
|
|
@@ -38,7 +40,8 @@ export default function Button({
|
|
|
38
40
|
disabled,
|
|
39
41
|
}: ButtonProps) {
|
|
40
42
|
const color = variants[variant]
|
|
41
|
-
const
|
|
43
|
+
const sizing = icon && !text ? iconOnly : withText
|
|
44
|
+
const cls = `${base} ${sizing} ${color} ${disabled ? disabledCls : ''} ${className || ''}`
|
|
42
45
|
|
|
43
46
|
if (!path) {
|
|
44
47
|
return (
|
|
@@ -65,7 +68,7 @@ export default function Button({
|
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
return (
|
|
68
|
-
<Link href={path} className={`${base} ${color} ${className || ''}`}>
|
|
71
|
+
<Link href={path} className={`${base} ${sizing} ${color} ${className || ''}`}>
|
|
69
72
|
{iconWrap(icon)}
|
|
70
73
|
{text}
|
|
71
74
|
</Link>
|
|
@@ -59,14 +59,18 @@ export default function SearchInput({ placeholder = 'Search...', variant = 'defa
|
|
|
59
59
|
</div>
|
|
60
60
|
)
|
|
61
61
|
} else {
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
return (
|
|
63
|
+
<div className='w-fit min-w-48'>
|
|
64
|
+
<Input
|
|
65
|
+
name='search'
|
|
66
|
+
icon={<Search className='w-5 h-5' />}
|
|
67
|
+
value={searchValue}
|
|
68
|
+
onChange={handleChange}
|
|
69
|
+
onKeyDown={handleKeyDown}
|
|
70
|
+
onBlur={() => handleSearch(searchValue)}
|
|
71
|
+
placeholder={placeholder}
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
71
75
|
}
|
|
72
76
|
}
|