@bouko/react 1.8.0 → 1.8.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.
@@ -10,6 +10,7 @@ type FormBuilderField<T> = (Omit<Field<T>, "value" | "update"> & {
10
10
  })[][];
11
11
  type Props<T> = FormSection<T> & {
12
12
  styles?: {
13
+ container?: string;
13
14
  submit?: string;
14
15
  cancel?: string;
15
16
  };
@@ -22,7 +22,7 @@ export function FormBuilder({ fields, validator, data, styles, update, submit, c
22
22
  await submit.action(data);
23
23
  setLoading(false);
24
24
  };
25
- return (_jsxs("div", { className: "flex flex-col w-full gap-4", children: [fields.map((row, i) => (_jsx(RowBox, { style: "w-full gap-5 overflow-hidden", children: row.map(({ element, id, rows, label, placeholder, options, required, note }) => {
25
+ return (_jsxs("div", { className: cn("flex flex-col w-full gap-4", styles?.container), children: [fields.map((row, i) => (_jsx(RowBox, { style: "w-full gap-5 overflow-hidden", children: row.map(({ element, id, rows, label, placeholder, options, required, note }) => {
26
26
  if (element === "input")
27
27
  return (_jsx(Input, { id: id, styles: { container: "flex-1" }, label: label, placeholder: placeholder, value: data[id], update: update, note: note, required: required }, id));
28
28
  else if (element === "select")
@@ -1,5 +1,9 @@
1
1
  import type { ReactNode } from "react";
2
- export default function Badge({ style, children }: {
2
+ type Color = "accent" | "orange" | "dark";
3
+ type Props = {
3
4
  style?: string;
5
+ color?: Color;
4
6
  children: ReactNode;
5
- }): import("react/jsx-runtime").JSX.Element;
7
+ };
8
+ export default function Badge({ style, color, children }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -1,4 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export default function Badge({ style, children }) {
3
- return (_jsx("span", { className: "w-min px-3 py-1 bg-accent/20 border border-accent-dark rounded-full text-xs text-accent-dark font-semibold", children: children }));
2
+ import { cn, tv } from "@bouko/style";
3
+ export default function Badge({ style, color, children }) {
4
+ return (_jsx("span", { className: cn(styles({ color }), style), children: children }));
4
5
  }
6
+ const styles = tv({
7
+ base: "w-min px-3 py-1 border rounded-full text-xs font-semibold",
8
+ defaultVariants: { color: "accent" },
9
+ variants: {
10
+ color: {
11
+ accent: "bg-accent/20 border-accent-dark text-accent-dark",
12
+ orange: "bg-orange-400/20 border-orange-500 text-orange-500",
13
+ dark: "bg-slate-700/20 border-slate-800 text-slate-800"
14
+ }
15
+ }
16
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "1.8.0",
4
+ "version": "1.8.2",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",