@bouko/react 2.1.1 → 2.1.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.
- package/dist/components/form/index.d.ts +1 -1
- package/dist/components/form/index.js +2 -2
- package/dist/components/form/types.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/layout/fade.d.ts +6 -0
- package/dist/components/layout/fade.js +14 -0
- package/dist/components/layout/heading.d.ts +1 -0
- package/dist/components/layout/heading.js +1 -1
- package/dist/components/search-bar.d.ts +9 -6
- package/dist/components/search-bar.js +5 -5
- package/package.json +1 -1
|
@@ -25,4 +25,4 @@ type Props<T> = FormSection<T> & {
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
export declare function useSound(filename?: string): import("use-sound/dist/types").PlayFunction | undefined;
|
|
28
|
-
export declare function FormBuilder<T>({ fields, validator, data, styles, update, submit, sound, clear }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function FormBuilder<T>({ fields, validator, data, styles, update, setField, submit, sound, clear }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,7 +20,7 @@ export function useSound(filename) {
|
|
|
20
20
|
return;
|
|
21
21
|
return base(filename)[0];
|
|
22
22
|
}
|
|
23
|
-
export function FormBuilder({ fields, validator, data, styles, update, submit, sound, clear }) {
|
|
23
|
+
export function FormBuilder({ fields, validator, data, styles, update, setField, submit, sound, clear }) {
|
|
24
24
|
const isValid = validator.safeParse(data).success;
|
|
25
25
|
const [isLoading, setLoading] = useState(false);
|
|
26
26
|
const play = useSound(sound);
|
|
@@ -31,7 +31,7 @@ export function FormBuilder({ fields, validator, data, styles, update, submit, s
|
|
|
31
31
|
};
|
|
32
32
|
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, disabled, options, required, note }) => {
|
|
33
33
|
if (element === "input")
|
|
34
|
-
return (_jsx(Input, { id: id, styles: { container: "flex-1" }, label: label, placeholder: placeholder, value: data[id], update:
|
|
34
|
+
return (_jsx(Input, { id: id, styles: { container: "flex-1" }, label: label, placeholder: placeholder, value: data[id], update: x => setField(id, x), disabled: disabled, note: note, required: required }, id));
|
|
35
35
|
else if (element === "select")
|
|
36
36
|
return (_jsx(Select, { id: id, label: label, placeholder: placeholder, options: options || [], value: data[id], update: update, note: note, required: required }, id));
|
|
37
37
|
else if (element === "textarea")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as Heading } from "./layout/heading";
|
|
2
2
|
export { default as Separator } from "./layout/separator";
|
|
3
|
+
export { default as FadeBox } from "./layout/fade";
|
|
3
4
|
export * from "./layout/flex";
|
|
4
5
|
export { default as Badge } from "./text/badge";
|
|
5
6
|
export { default as Dropdown } from "./dropdown/normal";
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as Heading } from "./layout/heading";
|
|
2
2
|
export { default as Separator } from "./layout/separator";
|
|
3
|
+
export { default as FadeBox } from "./layout/fade";
|
|
3
4
|
export * from "./layout/flex";
|
|
4
5
|
export { default as Badge } from "./text/badge";
|
|
5
6
|
export { default as Dropdown } from "./dropdown/normal";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn, tv } from "@bouko/style";
|
|
3
|
+
export default function FadeBox({ style, gradient, children }) {
|
|
4
|
+
const direction = "left";
|
|
5
|
+
return (_jsxs("div", { className: cn("relative", style), children: [children, _jsx("div", { className: cn(styles({ direction }), gradient) })] }));
|
|
6
|
+
}
|
|
7
|
+
const styles = tv({
|
|
8
|
+
base: "absolute from-background",
|
|
9
|
+
variants: {
|
|
10
|
+
direction: {
|
|
11
|
+
left: "top-0 right-0 w-12 h-full bg-gradient-to-l"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -18,5 +18,5 @@ const base = {
|
|
|
18
18
|
container: "items-center",
|
|
19
19
|
badge: "mb-2",
|
|
20
20
|
title: "items-center gap-2 text-xl sm:text-2xl 2xl:text-3xl font-bold text-primary",
|
|
21
|
-
subtitle: "items-center gap-2 max-sm:text-sm 2xl:text-lg text-primary-light dark:text-primary-dark"
|
|
21
|
+
subtitle: "items-center gap-2 max-sm:text-sm 2xl:text-lg text-center text-primary-light dark:text-primary-dark"
|
|
22
22
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
button?: ReactElement<{
|
|
4
|
-
onClick: (query: string) => void;
|
|
5
|
-
}>;
|
|
1
|
+
type Props = {
|
|
2
|
+
style?: Styles;
|
|
6
3
|
placeholder?: string;
|
|
7
4
|
action: (query: string) => void;
|
|
8
5
|
};
|
|
9
|
-
|
|
6
|
+
type Styles = {
|
|
7
|
+
container?: string;
|
|
8
|
+
input?: string;
|
|
9
|
+
trigger: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function SearchBar({ style, placeholder, action }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { cn } from "@bouko/style";
|
|
5
|
+
import AnglesRight from "../assets/icons/angles-right.svg";
|
|
4
6
|
import { RowBox } from "./layout/flex";
|
|
5
7
|
import { Button } from "./button";
|
|
6
|
-
export function SearchBar({
|
|
8
|
+
export function SearchBar({ style, placeholder, action }) {
|
|
7
9
|
const [query, search] = useState("");
|
|
8
|
-
return (_jsxs(RowBox, { style: styles.container, children: [_jsxs("div", { className: "relative grow", children: [_jsx("input", { className: "w-full outline-none text-lg placeholder-slate-500 tracking-wide", placeholder: placeholder, value: query, onChange: (e) => search(e.target.value), onKeyUp: (e) => e.key === "Enter" ? action(query) : null }), _jsx("div", { className: "absolute top-0 right-0 w-12 h-full bg-gradient-to-l from-slate-950" })] }),
|
|
9
|
-
onClick: () => action(query)
|
|
10
|
-
}) : _jsx(Button, { size: "sm", style: "gap-[0.4rem] font-extrabold py-1 px-3 font-mono", onClick: () => action(query), children: "GO" })] }));
|
|
10
|
+
return (_jsxs(RowBox, { style: cn(styles.container, style?.container), children: [_jsxs("div", { className: "relative grow", children: [_jsx("input", { className: cn("w-full outline-none text-lg placeholder-slate-500 tracking-wide", style?.input), placeholder: placeholder, value: query, onChange: (e) => search(e.target.value), onKeyUp: (e) => e.key === "Enter" ? action(query) : null }), _jsx("div", { className: "absolute top-0 right-0 w-12 h-full bg-gradient-to-l from-slate-950" })] }), _jsxs(Button, { size: "xs", style: cn("font-mono text-sm font-extrabold", style?.trigger), onClick: () => action(query), children: ["GO ", _jsx(AnglesRight, {})] })] }));
|
|
11
11
|
}
|
|
12
12
|
const styles = {
|
|
13
13
|
container: "items-center gap-6 w-xl max-w-full pl-5 pr-4 py-3 bg-slate-950 border border-border rounded-md"
|