@bouko/react 0.4.3 → 0.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.
|
@@ -4,12 +4,12 @@ export function Button({ variant, style, ...props }) {
|
|
|
4
4
|
return (_jsx("button", { className: cn(styles({ variant }), style), ...props }));
|
|
5
5
|
}
|
|
6
6
|
const styles = tv({
|
|
7
|
-
base: "px-4 py-2 bg-accent hover:bg-accent-dark border border-accent-dark rounded font-semibold text-
|
|
7
|
+
base: "px-4 py-2 bg-accent hover:bg-accent-dark border border-accent-dark rounded font-semibold text-background-light duration-200 cursor-pointer",
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
|
-
primary: "bg-primary hover:bg-primary-dark border-primary-dark
|
|
11
|
-
outline: "!bg-transparent border-2 border-accent hover:border-accent-dark",
|
|
12
|
-
ghost: "bg-transparent border-transparent"
|
|
10
|
+
primary: "bg-primary hover:bg-primary-dark border-primary-dark",
|
|
11
|
+
outline: "!bg-transparent border-2 border-accent hover:border-accent-dark text-primary",
|
|
12
|
+
ghost: "bg-transparent hover:bg-primary border-transparent hover:border-primary-dark text-primary hover:text-background-light"
|
|
13
13
|
},
|
|
14
14
|
size: {
|
|
15
15
|
sm: "px-3 py-1 text-sm",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function MultipleChoice({ label, options, style, value, update, required }: OptionField): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { type OptionField } from "@bouko/form";
|
|
2
|
+
export default function MultipleChoice<T>({ id, label, options, style, value, update, required }: OptionField<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Field from "./field";
|
|
3
|
+
import { setField } from "@bouko/form";
|
|
3
4
|
import { cn } from "@bouko/style";
|
|
4
|
-
export default function MultipleChoice({ label, options, style, value, update, required = true }) {
|
|
5
|
-
return (_jsx(Field, { style: style, label: label, required: required, children: _jsx("div", { className: styles.options, children: options.map((x, i) => (_jsxs("div", { className: styles.item, children: [_jsx(Dot, { ...x, active: x.id === value, select: () => update
|
|
5
|
+
export default function MultipleChoice({ id, label, options, style, value, update, required = true }) {
|
|
6
|
+
return (_jsx(Field, { style: style, label: label, required: required, children: _jsx("div", { className: styles.options, children: options.map((x, i) => (_jsxs("div", { className: styles.item, children: [_jsx(Dot, { ...x, active: x.id === value, select: () => setField(update, id, x.id) }), x.label] }, i))) }) }));
|
|
6
7
|
}
|
|
7
8
|
const Dot = ({ active, select }) => (_jsx("div", { className: cn(styles.dot, active && "bg-accent border-accent-dark"), onClick: select }));
|
|
8
9
|
const styles = {
|