@bouko/react 2.4.4 → 2.4.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.
- package/dist/components/button/ghost.d.ts +7 -0
- package/dist/components/button/ghost.js +8 -0
- package/dist/components/button/normal.d.ts +11 -0
- package/dist/components/button/normal.js +23 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/search-bar.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "./normal";
|
|
3
|
+
import { cn } from "@bouko/style";
|
|
4
|
+
export default function GhostButton({ style, action, children }) {
|
|
5
|
+
if (!children)
|
|
6
|
+
return null;
|
|
7
|
+
return (_jsx(Button, { variant: "ghost", style: cn("p-0 hover:brightness-110", style), onClick: action, children: children }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type ButtonProps = {
|
|
3
|
+
variant?: "primary" | "outline" | "ghost";
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
5
|
+
style?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare function Button({ size, variant, style, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Button;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn, tv } from "@bouko/style";
|
|
3
|
+
export function Button({ size, variant, style, ...props }) {
|
|
4
|
+
return (_jsx("button", { className: cn(styles({ variant, size }), style), ...props }));
|
|
5
|
+
}
|
|
6
|
+
const styles = tv({
|
|
7
|
+
base: "flex justify-center items-center gap-2 bg-accent hover:bg-accent-dark border border-accent-dark rounded font-semibold text-background-light duration-200 cursor-pointer disabled:cursor-not-allowed",
|
|
8
|
+
defaultVariants: { size: "md" },
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
primary: "bg-primary hover:bg-primary-dark border-primary-dark",
|
|
12
|
+
outline: "!bg-transparent border-accent hover:border-accent-dark text-primary",
|
|
13
|
+
ghost: "!bg-transparent border-transparent text-accent hover:text-accent-dark"
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
xs: "px-3 py-1 text-xs",
|
|
17
|
+
sm: "px-4 py-2 text-xs sm:text-sm",
|
|
18
|
+
md: "px-4 py-2",
|
|
19
|
+
lg: "px-5 py-3 text-lg"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export default Button;
|
|
@@ -3,7 +3,9 @@ export { default as FadeBox } from "./layout/fade";
|
|
|
3
3
|
export { default as Heading } from "./heading/normal";
|
|
4
4
|
export { default as PageHeading } from "./heading/page";
|
|
5
5
|
export * from "./layout/flex";
|
|
6
|
+
export { default as Button } from "./button/normal";
|
|
6
7
|
export { default as LoadButton } from "./button/load";
|
|
8
|
+
export { default as GhostButton } from "./button/ghost";
|
|
7
9
|
export { default as Badge } from "./text/badge";
|
|
8
10
|
export { default as Dropdown } from "./dropdown/normal";
|
|
9
11
|
export { default as FileUploader } from "./upload/file";
|
package/dist/components/index.js
CHANGED
|
@@ -3,7 +3,9 @@ export { default as FadeBox } from "./layout/fade";
|
|
|
3
3
|
export { default as Heading } from "./heading/normal";
|
|
4
4
|
export { default as PageHeading } from "./heading/page";
|
|
5
5
|
export * from "./layout/flex";
|
|
6
|
+
export { default as Button } from "./button/normal";
|
|
6
7
|
export { default as LoadButton } from "./button/load";
|
|
8
|
+
export { default as GhostButton } from "./button/ghost";
|
|
7
9
|
export { default as Badge } from "./text/badge";
|
|
8
10
|
export { default as Dropdown } from "./dropdown/normal";
|
|
9
11
|
export { default as FileUploader } from "./upload/file";
|
|
@@ -4,7 +4,7 @@ import { useState } from "react";
|
|
|
4
4
|
import { cn } from "@bouko/style";
|
|
5
5
|
import AnglesRight from "../assets/icons/angles-right.svg";
|
|
6
6
|
import { RowBox } from "./layout/flex";
|
|
7
|
-
import { Button } from "./button";
|
|
7
|
+
import { Button } from "./button/normal";
|
|
8
8
|
export function SearchBar({ style, placeholder, action }) {
|
|
9
9
|
const [query, search] = useState("");
|
|
10
10
|
return (_jsxs(RowBox, { style: cn(styles.container, style?.container), children: [_jsxs("div", { className: "relative grow", children: [_jsx("input", { className: cn("w-full outline-none text-lg placeholder-slate-500 tracking-wide", style?.input), placeholder: placeholder, value: query, onChange: (e) => search(e.target.value), onKeyUp: (e) => e.key === "Enter" ? action(query) : null }), _jsx("div", { className: "absolute top-0 right-0 w-12 h-full bg-gradient-to-l from-slate-950" })] }), _jsxs(Button, { size: "xs", style: cn("font-mono text-sm font-extrabold", style?.trigger), onClick: () => action(query), children: ["GO ", _jsx(AnglesRight, {})] })] }));
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { default as Attachment } from "./components/attachment";
|
|
|
6
6
|
export { default as CheckBox } from "./components/checkbox";
|
|
7
7
|
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
8
8
|
export * from "./components";
|
|
9
|
-
export * from "./components/button";
|
|
10
9
|
export * from "./components/search-bar";
|
|
11
10
|
export * from "./core/types";
|
|
12
11
|
export * from "./core/functions";
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,6 @@ export { default as Attachment } from "./components/attachment";
|
|
|
6
6
|
export { default as CheckBox } from "./components/checkbox";
|
|
7
7
|
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
8
8
|
export * from "./components";
|
|
9
|
-
export * from "./components/button";
|
|
10
9
|
export * from "./components/search-bar";
|
|
11
10
|
export * from "./core/types";
|
|
12
11
|
export * from "./core/functions";
|