@bouko/react 3.0.4 → 3.0.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,2 +1,6 @@
1
1
  import type { Clickable } from "../../core/types";
2
- export default function IconButton({ style, color, icon, action, disabled }: Clickable): import("react/jsx-runtime").JSX.Element;
2
+ type Props = Clickable & {
3
+ variant?: "accent" | "primary" | "outline" | "ghost" | "secondary" | "error" | "future";
4
+ };
5
+ export declare function IconButton({ variant, style, icon, action, disabled }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export default IconButton;
@@ -1,20 +1,23 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn, tv } from "@bouko/style";
2
3
  import Check from "../../assets/icons/check.svg";
3
- import { cn, opacitize } from "@bouko/style";
4
- export default function IconButton({ style, color = "--color-accent", icon, action, disabled = false }) {
5
- return (_jsx("button", { className: cn("flex hover:brightness-115 disabled:!cursor-not-allowed", style), style: styles(color), onClick: action, disabled: !action || disabled, children: icon || _jsx(Check, {}) }));
4
+ export function IconButton({ variant, style, icon, action, disabled = false }) {
5
+ return (_jsx("button", { className: cn(styles({ variant }), style), onClick: action, disabled: !action || disabled, children: icon || _jsx(Check, {}) }));
6
6
  }
7
- const styles = (color) => ({
8
- justifyContent: "center",
9
- itemsCenter: "center",
10
- padding: "0.5rem",
11
- background: opacitize(color, 60),
12
- border: `1px solid var(${color})`,
13
- borderRadius: "100%",
14
- outline: "none",
15
- fontSize: "0.75rem",
16
- fontWeight: "600",
17
- color: opacitize("--color-primary", 80),
18
- transitionDuration: "200ms",
19
- cursor: "pointer"
7
+ const styles = tv({
8
+ base: "flex justify-center items-center p-2 rounded-full outline-none border text-sm text-primary-dark duration-200 cursor-pointer disabled:cursor-not-allowed hover:brightness-115",
9
+ defaultVariants: { variant: "surface" },
10
+ variants: {
11
+ variant: {
12
+ surface: "bg-surface border-border",
13
+ accent: "bg-accent border-accent-darker text-background-light",
14
+ primary: "bg-primary border-primary-dark",
15
+ outline: "bg-transparent border-accent hover:border-accent-dark text-primary",
16
+ ghost: "bg-transparent border-transparent text-primary hover:brightness-110",
17
+ secondary: "bg-background-dark dark:bg-background-light border-border-dark dark:border-border-light text-background-darker dark:text-primary",
18
+ error: "bg-error border-error-dark",
19
+ future: "rounded-lg text-primary border-transparent backdrop-blur-sm test-button"
20
+ }
21
+ }
20
22
  });
23
+ export default IconButton;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn, tv } from "@bouko/style";
3
- export function FadeBox({ style, direction = "left", gradient, children }) {
3
+ export function FadeBox({ style, direction = "up", gradient, children }) {
4
4
  return (_jsxs("div", { className: cn("relative", style), children: [children, _jsx("div", { className: cn(styles({ direction }), gradient) })] }));
5
5
  }
6
6
  const styles = tv({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "3.0.4",
4
+ "version": "3.0.5",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",