@bouko/react 1.6.6 → 1.6.8
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/button.d.ts +1 -1
- package/dist/components/button.js +1 -0
- package/dist/components/search/index.d.ts +6 -0
- package/dist/components/search/index.js +12 -0
- package/dist/components/search-bar.d.ts +5 -0
- package/dist/components/search-bar.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/dist/components/heading.d.ts +0 -13
- package/dist/components/heading.js +0 -14
- package/dist/components/mcq.d.ts +0 -2
- package/dist/components/mcq.js +0 -12
|
@@ -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
|
+
};
|
|
@@ -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 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
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { default as FadeCarousel } from "./components/fade-carousel";
|
|
|
9
9
|
export * from "./components";
|
|
10
10
|
export * from "./components/flex";
|
|
11
11
|
export * from "./components/button";
|
|
12
|
+
export * from "./components/search-bar";
|
|
12
13
|
export * from "./core/types";
|
|
13
14
|
export * from "./core/functions";
|
|
14
15
|
export * from "./core/format";
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { default as FadeCarousel } from "./components/fade-carousel";
|
|
|
9
9
|
export * from "./components";
|
|
10
10
|
export * from "./components/flex";
|
|
11
11
|
export * from "./components/button";
|
|
12
|
+
export * from "./components/search-bar";
|
|
12
13
|
export * from "./core/types";
|
|
13
14
|
export * from "./core/functions";
|
|
14
15
|
export * from "./core/format";
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
type Props = {
|
|
3
|
-
styles?: Record<string, string>;
|
|
4
|
-
container?: string;
|
|
5
|
-
badge?: string;
|
|
6
|
-
icon?: ReactNode;
|
|
7
|
-
title: ReactNode;
|
|
8
|
-
align?: "left" | "center";
|
|
9
|
-
subtitle: ReactNode;
|
|
10
|
-
reverse?: boolean;
|
|
11
|
-
};
|
|
12
|
-
export default function Heading({ styles, container, badge, icon, title, align, subtitle, reverse }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { RowBox, ColumnBox } from "./flex";
|
|
3
|
-
import { cn } from "@bouko/style";
|
|
4
|
-
import Badge from "./badge";
|
|
5
|
-
export default function Heading({ styles = {}, container, badge, icon, title, align = "left", subtitle, reverse }) {
|
|
6
|
-
return (_jsxs(RowBox, { style: cn(base.container, styles.container, container), children: [icon, _jsxs(ColumnBox, { style: cn(base.subcontainer, align === "center" && "items-center", reverse && "flex-col-reverse"), children: [badge && _jsx(Badge, { style: base.badge, children: badge }), _jsx("span", { className: cn(base.title, styles.title), children: title }), _jsx("span", { className: cn(base.subtitle, styles.subtitle), children: subtitle })] })] }));
|
|
7
|
-
}
|
|
8
|
-
const base = {
|
|
9
|
-
container: "gap-2 items-center",
|
|
10
|
-
subcontainer: "flex grow flex-col",
|
|
11
|
-
badge: "mb-2",
|
|
12
|
-
title: "flex items-center gap-2 font-bold",
|
|
13
|
-
subtitle: "text-sm font-semibold text-primary-lighter"
|
|
14
|
-
};
|
package/dist/components/mcq.d.ts
DELETED
package/dist/components/mcq.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Field from "./field";
|
|
3
|
-
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(x.id) }), x.label] }, i))) }) }));
|
|
6
|
-
}
|
|
7
|
-
const Dot = ({ active, select }) => (_jsx("div", { className: cn(styles.dot, active && "bg-accent border-accent-dark"), onClick: select }));
|
|
8
|
-
const styles = {
|
|
9
|
-
options: "flex flex-col gap-1 w-full",
|
|
10
|
-
item: "flex items-center gap-3 text-sm",
|
|
11
|
-
dot: "size-3 bg-background-dark/50 hover:bg-background-dark duration-200 cursor-pointer border border-background-dark rounded-full"
|
|
12
|
-
};
|