@bouko/react 1.7.1 → 1.7.3

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.
@@ -14,7 +14,7 @@ const styles = tv({
14
14
  },
15
15
  size: {
16
16
  xs: "px-3 py-1 text-xs",
17
- sm: "px-4 py-2 text-sm",
17
+ sm: "px-4 py-2 text-xs sm:text-sm",
18
18
  md: "px-4 py-2",
19
19
  lg: "px-5 py-3 text-lg"
20
20
  }
@@ -0,0 +1,13 @@
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 {};
@@ -0,0 +1,14 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ import type { OptionField } from "../core/types";
2
+ export default function MultipleChoice({ label, options, style, value, update, required }: OptionField): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
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
+ };
@@ -16,3 +16,8 @@ export type Option = {
16
16
  export type OptionField = Field & {
17
17
  options: Option[];
18
18
  };
19
+ export type Attachment = {
20
+ filename: string;
21
+ mimetype: string;
22
+ data: string;
23
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "1.7.1",
4
+ "version": "1.7.3",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",
@@ -1,6 +0,0 @@
1
- type Props = {
2
- placeholder?: string;
3
- action: (query: string) => void;
4
- };
5
- export default function SearchBar({ placeholder, action }: Props): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,12 +0,0 @@
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
- };