@bouko/react 2.1.2 → 2.1.4
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.
|
@@ -3,7 +3,7 @@ export type SetState<T> = Dispatch<SetStateAction<T>>;
|
|
|
3
3
|
export type FormSection<T> = {
|
|
4
4
|
data: T;
|
|
5
5
|
update: SetState<T>;
|
|
6
|
-
setField: (
|
|
6
|
+
setField: (x: keyof T, value: unknown) => void;
|
|
7
7
|
clear: () => void;
|
|
8
8
|
};
|
|
9
9
|
export type Field<T, K = string> = {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { Component } from "../../core/types";
|
|
1
|
+
import type { Component } from "../../core/types";
|
|
2
2
|
type Props = Component & {
|
|
3
|
-
variant?: "accent" | "background";
|
|
4
3
|
color?: string;
|
|
5
4
|
};
|
|
6
|
-
export declare const Badge: ({ style,
|
|
5
|
+
export declare const Badge: ({ style, color, children }: Props) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
7
6
|
export default Badge;
|
|
8
7
|
/**
|
|
9
8
|
* Problems:
|
|
10
9
|
*
|
|
11
|
-
* -
|
|
10
|
+
* - Perfect `opacitize`
|
|
12
11
|
**/
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn,
|
|
3
|
-
export const Badge = ({ style,
|
|
2
|
+
import { cn, css, opacitize } from "@bouko/style";
|
|
3
|
+
export const Badge = ({ style, color = "var(--color-accent)", children }) => {
|
|
4
4
|
if (children)
|
|
5
|
-
return (_jsx("span", { className: cn(styles(
|
|
5
|
+
return (_jsx("span", { className: cn(styles(color), style), children: children }));
|
|
6
6
|
};
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
defaultVariants: { variant: "accent" },
|
|
17
|
-
variants: {
|
|
18
|
-
variant: {
|
|
19
|
-
accent: "bg-accent-light/50 border-accent-light",
|
|
20
|
-
background: "bg-background-lighter/50 border-background-lighter"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
7
|
+
const styles = (color) => css({
|
|
8
|
+
width: "min-content",
|
|
9
|
+
padding: "0.25rem 0.75rem",
|
|
10
|
+
background: opacitize(color),
|
|
11
|
+
border: `1px solid ${color}`,
|
|
12
|
+
borderRadius: "100%",
|
|
13
|
+
fontSize: "0.75rem",
|
|
14
|
+
fontWeight: "600",
|
|
15
|
+
color: "var(--color-primary)"
|
|
23
16
|
});
|
|
24
17
|
export default Badge;
|