Comparing version 0.0.4 to 0.0.5
@@ -1,11 +0,8 @@ | ||
import { FC, MouseEventHandler } from "react"; | ||
type Variant = "primary" | "secondary" | "tertiary"; | ||
import React, { MouseEventHandler } from "react"; | ||
type Variant = "primary" | "secondary" | "tertiary" | "primaryInverse" | "tertiaryInverse"; | ||
type Size = "small" | "medium" | "large"; | ||
export interface Button { | ||
export interface Button extends React.ButtonHTMLAttributes<HTMLButtonElement> { | ||
className?: string; | ||
content: string; | ||
variant?: Variant; | ||
size?: Size; | ||
inverse?: boolean; | ||
icon?: boolean; | ||
disabled?: boolean; | ||
@@ -16,10 +13,10 @@ onClick?: MouseEventHandler; | ||
variant?: "secondary"; | ||
destructive?: never; | ||
variantColor?: never; | ||
} | { | ||
variant: "primary" | "tertiary"; | ||
destructive?: Boolean; | ||
variant?: "primary" | "tertiary"; | ||
variantColor?: "inverse" | "destructive"; | ||
}; | ||
type AriaLabel = { | ||
icon?: false; | ||
ariaLabel: never; | ||
ariaLabel?: never; | ||
} | { | ||
@@ -29,4 +26,4 @@ icon: true; | ||
}; | ||
type Props = Button & Destructive & AriaLabel; | ||
export declare const Button: FC<Props>; | ||
export type ButtonProps = Button & AriaLabel & Destructive; | ||
export declare const Button: (props: ButtonProps) => JSX.Element; | ||
export {}; |
42
index.js
@@ -1,27 +0,37 @@ | ||
import m from "react"; | ||
const d = "_kbutton_1yzq7_2", l = "_primary_1yzq7_17", q = "_destructive_1yzq7_33", z = "_secondary_1yzq7_48", v = "_tertiary_1yzq7_67", b = "_inverse_1yzq7_87", $ = "_large_1yzq7_102", p = "_icon_1yzq7_107", k = "_medium_1yzq7_110", g = "_small_1yzq7_118", t = { | ||
kbutton: d, | ||
primary: l, | ||
import d from "react"; | ||
const u = "_kbutton_1yzq7_2", z = "_primary_1yzq7_17", q = "_destructive_1yzq7_33", b = "_secondary_1yzq7_48", v = "_tertiary_1yzq7_67", $ = "_inverse_1yzq7_87", k = "_large_1yzq7_102", p = "_icon_1yzq7_107", g = "_medium_1yzq7_110", C = "_small_1yzq7_118", t = { | ||
kbutton: u, | ||
primary: z, | ||
destructive: q, | ||
secondary: z, | ||
secondary: b, | ||
tertiary: v, | ||
inverse: b, | ||
large: $, | ||
inverse: $, | ||
large: k, | ||
icon: p, | ||
medium: k, | ||
small: g | ||
}, x = ({ content: n, variant: r = "secondary", size: o = "medium", className: e, inverse: _, destructive: s = !1, icon: c, ariaLabel: i, disabled: y, onClick: a }) => { | ||
const u = ` | ||
medium: g, | ||
small: C | ||
}, h = (n) => { | ||
const { | ||
variant: r = "secondary", | ||
size: o = "medium", | ||
className: e, | ||
variantColor: s, | ||
icon: a, | ||
ariaLabel: c, | ||
disabled: i, | ||
onClick: _, | ||
style: y, | ||
children: l | ||
} = n, m = ` | ||
${t.kbutton} | ||
${t[r]} | ||
${t[o]} | ||
${_ && t.inverse} | ||
${s && t.destructive} | ||
${s} | ||
${e != null ? e : ""} | ||
${c && t.icon} | ||
${a && t.icon} | ||
`; | ||
return m.createElement("button", { disabled: y, "aria-label": i, className: u, onClick: a }, n); | ||
return d.createElement("button", { disabled: i, "aria-label": c, className: m, onClick: _, style: y }, l); | ||
}; | ||
export { | ||
x as Button | ||
h as Button | ||
}; |
{ | ||
"name": "kzkzkz", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
18551
375