@bouko/react 1.9.2 → 1.9.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.
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/layout/heading.d.ts +17 -3
- package/dist/components/layout/heading.js +39 -6
- package/dist/components/search/index.d.ts +6 -0
- package/dist/components/search/index.js +12 -0
- package/package.json +1 -1
package/dist/components/badge.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export default
|
|
2
|
+
export default function Badge({ style, children }) {
|
|
3
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 }));
|
|
4
4
|
}
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
type Styles = {
|
|
3
|
+
container?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
};
|
|
8
|
+
type Options = {
|
|
9
|
+
size?: "md" | "lg";
|
|
10
|
+
align?: "left" | "center";
|
|
11
|
+
};
|
|
2
12
|
export type HeadingProps = {
|
|
3
|
-
|
|
13
|
+
options?: Options;
|
|
14
|
+
styles?: Styles;
|
|
4
15
|
container?: string;
|
|
5
16
|
badge?: string;
|
|
6
17
|
icon?: ReactNode;
|
|
7
18
|
title: ReactNode;
|
|
19
|
+
size?: "md" | "lg";
|
|
8
20
|
align?: "left" | "center";
|
|
9
21
|
subtitle?: ReactNode;
|
|
10
22
|
reverse?: boolean;
|
|
11
23
|
};
|
|
12
|
-
export
|
|
24
|
+
export declare const rn: (...elements: ReactNode[]) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export default function Heading({ styles, options, container, badge, icon, title, subtitle, reverse }: HeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -1,14 +1,47 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
2
3
|
import { RowBox, ColumnBox } from "../flex";
|
|
3
|
-
import { cn } from "@bouko/style";
|
|
4
4
|
import Badge from "../text/badge";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { cn, tv } from "@bouko/style";
|
|
6
|
+
export const rn = (...elements) => (_jsx(Fragment, { children: elements.map((x, i) => (_jsx(Fragment, { children: x }, i))) }));
|
|
7
|
+
export default function Heading({ styles = {}, options = {}, container, badge, icon, title, subtitle, reverse }) {
|
|
8
|
+
const custom = test(options);
|
|
9
|
+
return (_jsxs(RowBox, { style: cn(base.container, styles.container, container), children: [icon, _jsxs(ColumnBox, { style: cn(custom.subcontainer(), reverse && "flex-col-reverse"), children: [badge && _jsx(Badge, { style: base.badge, children: badge }), _jsx(RowBox, { style: cn(custom.title(), styles.title, styles.text), children: title }), subtitle && _jsx(RowBox, { style: cn(custom.subtitle(), styles.subtitle, styles.text), children: subtitle })] })] }));
|
|
7
10
|
}
|
|
8
11
|
const base = {
|
|
9
12
|
container: "gap-2 items-center",
|
|
10
|
-
subcontainer: "flex grow flex-col",
|
|
11
13
|
badge: "mb-2",
|
|
12
|
-
title: "flex items-center gap-2 text-lg font-bold",
|
|
13
|
-
subtitle: "font-semibold text-primary-lighter"
|
|
14
14
|
};
|
|
15
|
+
const test = tv({
|
|
16
|
+
slots: {
|
|
17
|
+
subcontainer: "grow",
|
|
18
|
+
title: "items-center gap-2 text-xl font-bold text-primary",
|
|
19
|
+
subtitle: "items-center gap-2 font-semibold text-primary-light dark:text-primary-dark"
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
size: "md",
|
|
23
|
+
align: "center"
|
|
24
|
+
},
|
|
25
|
+
variants: {
|
|
26
|
+
size: {
|
|
27
|
+
md: {
|
|
28
|
+
title: "text-xl 2xl:text-2xl",
|
|
29
|
+
subtitle: "text-base 2xl:text-lg"
|
|
30
|
+
},
|
|
31
|
+
lg: {
|
|
32
|
+
subcontainer: "gap-3",
|
|
33
|
+
title: "text-5xl 2xl:text-6xl",
|
|
34
|
+
subtitle: "text-sm sm:text-base 2xl:text-lg"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
align: {
|
|
38
|
+
left: {
|
|
39
|
+
subcontainer: "items-start"
|
|
40
|
+
},
|
|
41
|
+
center: {
|
|
42
|
+
subcontainer: "items-center",
|
|
43
|
+
subtitle: "justify-center text-center"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { RowBox } from "../flex";
|
|
5
|
+
import { Button } from "../button";
|
|
6
|
+
export default function SearchBar({ placeholder, action }) {
|
|
7
|
+
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 lowercase 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" })] }), _jsx(Button, { size: "sm", style: "gap-[0.4rem] font-extrabold py-1 px-3 font-mono", onClick: () => action(query), children: "GO" })] }));
|
|
9
|
+
}
|
|
10
|
+
const styles = {
|
|
11
|
+
container: "items-center gap-6 w-xl pl-5 pr-4 py-3 bg-slate-950 border border-border rounded-md"
|
|
12
|
+
};
|