@bouko/react 2.5.6 → 2.5.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/assets/icons/check copy.svg +6 -0
- package/dist/assets/icons/check-circle copy.svg +6 -0
- package/dist/assets/icons/chevron copy.svg +6 -0
- package/dist/assets/icons/paperclip copy.svg +6 -0
- package/dist/assets/icons/spinner copy.svg +6 -0
- package/dist/assets/icons/x-circle copy.svg +6 -0
- package/dist/colors/core.d.ts +10 -0
- package/dist/colors/core.js +25 -0
- package/dist/colors/index.d.ts +26 -0
- package/dist/colors/index.js +43 -0
- package/dist/colors/types.d.ts +11 -0
- package/dist/colors/types.js +7 -0
- package/dist/components/animate/configs.d.ts +136 -136
- package/dist/components/animate/configs.js +62 -62
- package/dist/components/animate/index.d.ts +54 -54
- package/dist/components/animate/index.js +33 -33
- package/dist/components/attachment.d.ts +2 -2
- package/dist/components/attachment.js +18 -18
- package/dist/components/badge.d.ts +5 -0
- package/dist/components/badge.js +4 -0
- package/dist/components/button/ghost.d.ts +7 -7
- package/dist/components/button/ghost.js +8 -8
- package/dist/components/button/icon.d.ts +9 -9
- package/dist/components/button/icon.js +20 -19
- package/dist/components/button/load.d.ts +10 -11
- package/dist/components/button/load.js +35 -35
- package/dist/components/button/normal.d.ts +11 -11
- package/dist/components/button/normal.js +39 -39
- package/dist/components/button.d.ts +10 -10
- package/dist/components/button.js +22 -22
- package/dist/components/carousel/index.d.ts +11 -11
- package/dist/components/carousel/index.js +19 -19
- package/dist/components/checkbox.d.ts +8 -8
- package/dist/components/checkbox.js +13 -13
- package/dist/components/dropdown/normal.d.ts +10 -10
- package/dist/components/dropdown/normal.js +19 -19
- package/dist/components/fade-carousel.d.ts +4 -4
- package/dist/components/fade-carousel.js +14 -14
- package/dist/components/field.d.ts +10 -10
- package/dist/components/field.js +10 -10
- package/dist/components/flex.d.ts +16 -0
- package/dist/components/flex.js +8 -0
- package/dist/components/form/fields.d.ts +16 -0
- package/dist/components/form/fields.js +21 -0
- package/dist/components/form/footer.js +2 -2
- package/dist/components/form/functions.d.ts +1 -1
- package/dist/components/form/functions.js +28 -28
- package/dist/components/form/loaders.d.ts +3 -0
- package/dist/components/form/loaders.js +11 -0
- package/dist/components/form/test-next.d.ts +1 -0
- package/dist/components/form/test-next.js +6 -0
- package/dist/components/form/types.d.ts +38 -38
- package/dist/components/form/types.js +1 -1
- package/dist/components/heading/normal.d.ts +29 -29
- package/dist/components/heading/normal.js +22 -22
- package/dist/components/heading/page.d.ts +25 -25
- package/dist/components/heading/page.js +23 -23
- package/dist/components/index.d.ts +13 -13
- package/dist/components/index.js +13 -13
- package/dist/components/input.d.ts +37 -37
- package/dist/components/input.js +40 -40
- package/dist/components/layout/fade.d.ts +7 -7
- package/dist/components/layout/fade.js +15 -15
- package/dist/components/layout/flex.d.ts +16 -16
- package/dist/components/layout/flex.js +42 -42
- package/dist/components/layout/heading.d.ts +3 -1
- package/dist/components/layout/heading.js +2 -2
- package/dist/components/layout/separator.d.ts +3 -3
- package/dist/components/layout/separator.js +5 -5
- package/dist/components/list/index.d.ts +2 -2
- package/dist/components/list/index.js +2 -2
- package/dist/components/list/item.d.ts +9 -9
- package/dist/components/list/item.js +7 -7
- package/dist/components/list/variants/bullet.d.ts +9 -9
- package/dist/components/list/variants/bullet.js +16 -16
- package/dist/components/list/variants/number.d.ts +10 -10
- package/dist/components/list/variants/number.js +18 -18
- package/dist/components/multiple-choice.d.ts +2 -2
- package/dist/components/multiple-choice.js +12 -12
- package/dist/components/search/index.d.ts +6 -0
- package/dist/components/search/index.js +12 -0
- package/dist/components/search-bar.d.ts +13 -14
- package/dist/components/search-bar.js +22 -22
- package/dist/components/select.d.ts +6 -6
- package/dist/components/select.js +24 -24
- package/dist/components/text/badge.d.ts +16 -16
- package/dist/components/text/badge.js +28 -28
- package/dist/components/textarea.d.ts +7 -7
- package/dist/components/textarea.js +11 -11
- package/dist/components/upload/file.d.ts +8 -8
- package/dist/components/upload/file.js +23 -23
- package/dist/components/waveform/index.d.ts +8 -8
- package/dist/components/waveform/index.js +11 -11
- package/dist/components/waveform/patterns.d.ts +1 -1
- package/dist/components/waveform/patterns.js +27 -27
- package/dist/core/classes.d.ts +0 -0
- package/dist/core/classes.js +1 -0
- package/dist/core/format.d.ts +3 -3
- package/dist/core/format.js +34 -34
- package/dist/core/functions.d.ts +13 -13
- package/dist/core/functions.js +79 -79
- package/dist/core/types.d.ts +15 -15
- package/dist/core/types.js +2 -2
- package/dist/core/variants.d.ts +5 -0
- package/dist/core/variants.js +6 -0
- package/dist/format/index.d.ts +2 -0
- package/dist/format/index.js +33 -0
- package/dist/hooks/audio/sound.d.ts +1 -1
- package/dist/hooks/audio/sound.js +6 -6
- package/dist/hooks/clock/interval.d.ts +8 -8
- package/dist/hooks/clock/interval.js +25 -25
- package/dist/hooks/color.d.ts +7 -0
- package/dist/hooks/color.js +8 -0
- package/dist/hooks/element/container.d.ts +4 -5
- package/dist/hooks/element/container.js +7 -7
- package/dist/hooks/element/resize.d.ts +1 -1
- package/dist/hooks/element/resize.js +12 -12
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.js +4 -4
- package/dist/index.d.ts +14 -14
- package/dist/index.js +14 -14
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
interface Props {
|
|
3
|
-
style?: string;
|
|
4
|
-
marker?: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
items: ReactNode[];
|
|
7
|
-
centerMarker?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export default function NumberList({ style, marker, title, items, centerMarker }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
style?: string;
|
|
4
|
+
marker?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
items: ReactNode[];
|
|
7
|
+
centerMarker?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export default function NumberList({ style, marker, title, items, centerMarker }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import Item from "../item";
|
|
4
|
-
import { Animation } from "../../animate";
|
|
5
|
-
import { cn } from "@bouko/style";
|
|
6
|
-
;
|
|
7
|
-
export default function NumberList({ style, marker, title, items, centerMarker }) {
|
|
8
|
-
return (_jsxs(Animation, { style: cn(styles.base, style), children: [!!title && _jsx("span", { className: styles.title, children: title }
|
|
9
|
-
}
|
|
10
|
-
function Marker({ style, x }) {
|
|
11
|
-
return (_jsx("div", { className: cn(styles.marker, style), children: _jsx("span", { className: styles.label, children: x }
|
|
12
|
-
}
|
|
13
|
-
const styles = {
|
|
14
|
-
base: "flex flex-col gap-6 w-full text-primary-dark",
|
|
15
|
-
title: "mb-1 text-base text-primary",
|
|
16
|
-
marker: "flex justify-center items-center mt-1 mr-6 min-w-7 w-7 aspect-square bg-radial-[at_50%_75%] from-accent-light to-accent to-accent-dark to-90% border border-accent-darker rounded-full shadow-glow-soft",
|
|
17
|
-
label: "font-bold text-background-lighter select-none"
|
|
18
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Item from "../item";
|
|
4
|
+
import { Animation } from "../../animate";
|
|
5
|
+
import { cn } from "@bouko/style";
|
|
6
|
+
;
|
|
7
|
+
export default function NumberList({ style, marker, title, items, centerMarker }) {
|
|
8
|
+
return (_jsxs(Animation, { style: cn(styles.base, style), children: [!!title && _jsx("span", { className: styles.title, children: title }), _jsx(Animation, { style: cn(styles.base, style, !!title && "ml-2"), children: items.map((x, i) => (_jsx(Item, { marker: _jsx(Marker, { style: marker, x: i + 1 }), content: x, index: i, centerMarker: centerMarker }, i))) }, "content")] }, "list"));
|
|
9
|
+
}
|
|
10
|
+
function Marker({ style, x }) {
|
|
11
|
+
return (_jsx("div", { className: cn(styles.marker, style), children: _jsx("span", { className: styles.label, children: x }) }));
|
|
12
|
+
}
|
|
13
|
+
const styles = {
|
|
14
|
+
base: "flex flex-col gap-6 w-full text-primary-dark",
|
|
15
|
+
title: "mb-1 text-base text-primary",
|
|
16
|
+
marker: "flex justify-center items-center mt-1 mr-6 min-w-7 w-7 aspect-square bg-radial-[at_50%_75%] from-accent-light to-accent to-accent-dark to-90% border border-accent-darker rounded-full shadow-glow-soft",
|
|
17
|
+
label: "font-bold text-background-lighter select-none"
|
|
18
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type OptionField } from "./form/types";
|
|
2
|
-
export default function MultipleChoice<T>({ id, label, options, style, value, update, required }: OptionField<string>): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { type OptionField } from "./form/types";
|
|
2
|
+
export default function MultipleChoice<T>({ id, label, options, style, value, update, required }: OptionField<string>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +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({ id, 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: () => id ? update(x.id) : null }
|
|
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 shrink-0 flex-col gap-1 mt-px 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-darker rounded-full"
|
|
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({ id, 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: () => id ? update(x.id) : null }), 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 shrink-0 flex-col gap-1 mt-px 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-darker rounded-full"
|
|
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
|
+
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
export
|
|
14
|
-
export {};
|
|
1
|
+
type Props<T> = {
|
|
2
|
+
style?: Styles;
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
trigger?: React.ReactNode;
|
|
5
|
+
submit: (query: string) => Promise<T>;
|
|
6
|
+
};
|
|
7
|
+
type Styles = {
|
|
8
|
+
container?: string;
|
|
9
|
+
input?: string;
|
|
10
|
+
trigger?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function SearchBar<T>({ style, placeholder, trigger, submit }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { RowBox } from "./layout/flex";
|
|
5
|
-
import { FadeBox } from "./layout/fade";
|
|
6
|
-
import { Button } from "./button/normal";
|
|
7
|
-
import Input from "./input";
|
|
8
|
-
import { mergeStyles } from "@bouko/style";
|
|
9
|
-
export function SearchBar({ style = {}, placeholder, trigger, submit }) {
|
|
10
|
-
const [query, setQuery] = useState("");
|
|
11
|
-
const styles = mergeStyles(base, style);
|
|
12
|
-
const search = async () => {
|
|
13
|
-
if (query === "")
|
|
14
|
-
return;
|
|
15
|
-
await submit(query);
|
|
16
|
-
};
|
|
17
|
-
return (_jsxs(RowBox, { style: styles.container, children: [_jsx(FadeBox, { style: "grow", gradient: "from-slate-950", children: _jsx(Input, { variant: "ghost", style: styles.input, placeholder: placeholder, value: query, update: setQuery, onEnter: search }
|
|
18
|
-
}
|
|
19
|
-
const base = {
|
|
20
|
-
container: "items-center gap-5 w-xl max-w-full pl-5 pr-4 py-3 bg-slate-950 border border-border rounded-md",
|
|
21
|
-
input: "text-lg tracking-wide"
|
|
22
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { RowBox } from "./layout/flex";
|
|
5
|
+
import { FadeBox } from "./layout/fade";
|
|
6
|
+
import { Button } from "./button/normal";
|
|
7
|
+
import Input from "./input";
|
|
8
|
+
import { mergeStyles } from "@bouko/style";
|
|
9
|
+
export function SearchBar({ style = {}, placeholder, trigger, submit }) {
|
|
10
|
+
const [query, setQuery] = useState("");
|
|
11
|
+
const styles = mergeStyles(base, style);
|
|
12
|
+
const search = async () => {
|
|
13
|
+
if (query === "")
|
|
14
|
+
return;
|
|
15
|
+
await submit(query);
|
|
16
|
+
};
|
|
17
|
+
return (_jsxs(RowBox, { style: styles.container, children: [_jsx(FadeBox, { style: "grow", gradient: "from-slate-950", children: _jsx(Input, { variant: "ghost", style: styles.input, placeholder: placeholder, value: query, update: setQuery, onEnter: search }) }), trigger && (_jsx(Button, { variant: "ghost", style: style?.trigger, action: search, children: trigger }))] }));
|
|
18
|
+
}
|
|
19
|
+
const base = {
|
|
20
|
+
container: "items-center gap-5 w-xl max-w-full pl-5 pr-4 py-3 bg-slate-950 border border-border rounded-md",
|
|
21
|
+
input: "text-lg tracking-wide"
|
|
22
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type OptionField } from "./form/types";
|
|
2
|
-
|
|
3
|
-
placeholder?: string;
|
|
4
|
-
};
|
|
5
|
-
export default function Select({ id, style, label, required, value, options, update, note }: Props<string>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
1
|
+
import { type OptionField } from "./form/types";
|
|
2
|
+
type Props<T> = OptionField<T> & {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
};
|
|
5
|
+
export default function Select({ id, style, label, required, value, options, update, note }: Props<string>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { AnimatePresence, motion } from "framer-motion";
|
|
5
|
-
import Chevron from "../assets/icons/chevron.svg";
|
|
6
|
-
import { cn } from "@bouko/style";
|
|
7
|
-
export default function Select({ id, style, label, required = true, value, options, update, note }) {
|
|
8
|
-
const [isOpen, setOpen] = useState(false);
|
|
9
|
-
const active = options.find(x => x.id === value);
|
|
10
|
-
const select = (x) => {
|
|
11
|
-
if (id)
|
|
12
|
-
update(x);
|
|
13
|
-
setOpen(false);
|
|
14
|
-
};
|
|
15
|
-
return (_jsxs("div", { className: cn(styles.container, style), children: [_jsxs("div", { className: styles.subcontainer, children: [label && _jsxs("span", { className: styles.label, children: [label, " ", !required ? _jsx("span", { className: "italic text-slate-400", children: "(optional)" }
|
|
16
|
-
}
|
|
17
|
-
const styles = {
|
|
18
|
-
container: "relative shrink-0 w-full",
|
|
19
|
-
subcontainer: "flex flex-col gap-1 w-full",
|
|
20
|
-
label: "text-xs text-slate-600",
|
|
21
|
-
trigger: "flex justify-between items-center px-3 py-2 bg-slate-200/50 hover:bg-slate-200/80 border border-slate-300 outline-blue-500 rounded text-sm duration-200 cursor-pointer",
|
|
22
|
-
dropdown: "absolute mt-2 z-50 flex flex-col gap-1 w-full bg-slate-100 rounded border border-slate-300 py-1 text-xs max-h-46 overflow-y-auto",
|
|
23
|
-
note: "mt-1 text-xs text-slate-500"
|
|
24
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
5
|
+
import Chevron from "../assets/icons/chevron.svg";
|
|
6
|
+
import { cn } from "@bouko/style";
|
|
7
|
+
export default function Select({ id, style, label, required = true, value, options, update, note }) {
|
|
8
|
+
const [isOpen, setOpen] = useState(false);
|
|
9
|
+
const active = options.find(x => x.id === value);
|
|
10
|
+
const select = (x) => {
|
|
11
|
+
if (id)
|
|
12
|
+
update(x);
|
|
13
|
+
setOpen(false);
|
|
14
|
+
};
|
|
15
|
+
return (_jsxs("div", { className: cn(styles.container, style), children: [_jsxs("div", { className: styles.subcontainer, children: [label && _jsxs("span", { className: styles.label, children: [label, " ", !required ? _jsx("span", { className: "italic text-slate-400", children: "(optional)" }) : ""] }), _jsxs("div", { className: cn(styles.trigger, !active?.label && "capitalize"), onClick: () => setOpen(x => !x), children: [active ? active.label ?? active.id : "None", _jsx(Chevron, { className: cn("text-xs text-slate-400 duration-200", isOpen && "rotate-180") })] }), note && !isOpen && _jsx("span", { className: styles.note, children: note })] }), _jsx(AnimatePresence, { children: isOpen && (_jsx(motion.div, { className: styles.dropdown, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: options.map(({ id, label }) => (_jsx("span", { className: cn("w-full p-2 border-l-3 border-transparent hover:text-blue-600 duration-200 cursor-pointer", active?.id === id && "border-blue-600 bg-blue-500/10", !label && "capitalize"), onClick: () => select(id), children: label ?? id }, id))) }, "dropdown")) })] }));
|
|
16
|
+
}
|
|
17
|
+
const styles = {
|
|
18
|
+
container: "relative shrink-0 w-full",
|
|
19
|
+
subcontainer: "flex flex-col gap-1 w-full",
|
|
20
|
+
label: "text-xs text-slate-600",
|
|
21
|
+
trigger: "flex justify-between items-center px-3 py-2 bg-slate-200/50 hover:bg-slate-200/80 border border-slate-300 outline-blue-500 rounded text-sm duration-200 cursor-pointer",
|
|
22
|
+
dropdown: "absolute mt-2 z-50 flex flex-col gap-1 w-full bg-slate-100 rounded border border-slate-300 py-1 text-xs max-h-46 overflow-y-auto",
|
|
23
|
+
note: "mt-1 text-xs text-slate-500"
|
|
24
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Component } from "../../core/types";
|
|
2
|
-
|
|
3
|
-
color?: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Color-themed badge component.
|
|
7
|
-
*
|
|
8
|
-
* To use a CSS variable it must exist and be passed in the
|
|
9
|
-
* form `--variable-name`. Any other format may cause unexpected
|
|
10
|
-
* results. CSS variables use 'color-mix' which is not supported in
|
|
11
|
-
* some old browsers such as Safari 15.3 and Internet Explorer.
|
|
12
|
-
*
|
|
13
|
-
* @param {string} color - Color of badge. (optional, default = accent)
|
|
14
|
-
**/
|
|
15
|
-
export declare function Badge({ style, color, children }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
-
export default Badge;
|
|
1
|
+
import type { Component } from "../../core/types";
|
|
2
|
+
type Props = Component & {
|
|
3
|
+
color?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Color-themed badge component.
|
|
7
|
+
*
|
|
8
|
+
* To use a CSS variable it must exist and be passed in the
|
|
9
|
+
* form `--variable-name`. Any other format may cause unexpected
|
|
10
|
+
* results. CSS variables use 'color-mix' which is not supported in
|
|
11
|
+
* some old browsers such as Safari 15.3 and Internet Explorer.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} color - Color of badge. (optional, default = accent)
|
|
14
|
+
**/
|
|
15
|
+
export declare function Badge({ style, color, children }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export default Badge;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { opacitize } from "@bouko/style";
|
|
3
|
-
/**
|
|
4
|
-
* Color-themed badge component.
|
|
5
|
-
*
|
|
6
|
-
* To use a CSS variable it must exist and be passed in the
|
|
7
|
-
* form `--variable-name`. Any other format may cause unexpected
|
|
8
|
-
* results. CSS variables use 'color-mix' which is not supported in
|
|
9
|
-
* some old browsers such as Safari 15.3 and Internet Explorer.
|
|
10
|
-
*
|
|
11
|
-
* @param {string} color - Color of badge. (optional, default = accent)
|
|
12
|
-
**/
|
|
13
|
-
export function Badge({ style, color = "--color-accent", children }) {
|
|
14
|
-
if (!children)
|
|
15
|
-
return null;
|
|
16
|
-
return (_jsx("span", { className: style, style: styles(color), children: children }
|
|
17
|
-
}
|
|
18
|
-
const styles = (color) => ({
|
|
19
|
-
width: "min-content",
|
|
20
|
-
padding: "0.25rem 0.75rem",
|
|
21
|
-
background: opacitize(color),
|
|
22
|
-
border: `1px solid var(${color})`,
|
|
23
|
-
borderRadius: "100%",
|
|
24
|
-
fontSize: "0.75rem",
|
|
25
|
-
fontWeight: "600",
|
|
26
|
-
color: "var(--color-primary)"
|
|
27
|
-
});
|
|
28
|
-
export default Badge;
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { opacitize } from "@bouko/style";
|
|
3
|
+
/**
|
|
4
|
+
* Color-themed badge component.
|
|
5
|
+
*
|
|
6
|
+
* To use a CSS variable it must exist and be passed in the
|
|
7
|
+
* form `--variable-name`. Any other format may cause unexpected
|
|
8
|
+
* results. CSS variables use 'color-mix' which is not supported in
|
|
9
|
+
* some old browsers such as Safari 15.3 and Internet Explorer.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} color - Color of badge. (optional, default = accent)
|
|
12
|
+
**/
|
|
13
|
+
export function Badge({ style, color = "--color-accent", children }) {
|
|
14
|
+
if (!children)
|
|
15
|
+
return null;
|
|
16
|
+
return (_jsx("span", { className: style, style: styles(color), children: children }));
|
|
17
|
+
}
|
|
18
|
+
const styles = (color) => ({
|
|
19
|
+
width: "min-content",
|
|
20
|
+
padding: "0.25rem 0.75rem",
|
|
21
|
+
background: opacitize(color),
|
|
22
|
+
border: `1px solid var(${color})`,
|
|
23
|
+
borderRadius: "100%",
|
|
24
|
+
fontSize: "0.75rem",
|
|
25
|
+
fontWeight: "600",
|
|
26
|
+
color: "var(--color-primary)"
|
|
27
|
+
});
|
|
28
|
+
export default Badge;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type Field as FieldProps } from "./form/types";
|
|
2
|
-
|
|
3
|
-
rows?: number;
|
|
4
|
-
placeholder?: string;
|
|
5
|
-
};
|
|
6
|
-
export default function TextArea({ id, style, label, required, note, value, update, ...props }: Props<string>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
import { type Field as FieldProps } from "./form/types";
|
|
2
|
+
type Props<T> = FieldProps<T> & {
|
|
3
|
+
rows?: number;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
};
|
|
6
|
+
export default function TextArea({ id, style, label, required, note, value, update, ...props }: Props<string>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import Field from "./field";
|
|
3
|
-
export default function TextArea({ id, style, label, required = true, note, value, update, ...props }) {
|
|
4
|
-
return (_jsx(Field, { style: style, label: label, required: required, note: note, children: _jsx("textarea", { className: styles.textarea, onChange: ({ target: { value } }) => update(value), value: value ?? "", ...props }
|
|
5
|
-
}
|
|
6
|
-
const styles = {
|
|
7
|
-
container: "flex flex-col gap-1 overflow-hidden",
|
|
8
|
-
label: "text-xs text-slate-600",
|
|
9
|
-
textarea: "px-3 py-2 bg-input border border-outline focus:border-outline-light rounded text-sm resize-none",
|
|
10
|
-
note: "mt-1 text-xs text-slate-500"
|
|
11
|
-
};
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Field from "./field";
|
|
3
|
+
export default function TextArea({ id, style, label, required = true, note, value, update, ...props }) {
|
|
4
|
+
return (_jsx(Field, { style: style, label: label, required: required, note: note, children: _jsx("textarea", { className: styles.textarea, onChange: ({ target: { value } }) => update(value), value: value ?? "", ...props }) }));
|
|
5
|
+
}
|
|
6
|
+
const styles = {
|
|
7
|
+
container: "flex flex-col gap-1 overflow-hidden",
|
|
8
|
+
label: "text-xs text-slate-600",
|
|
9
|
+
textarea: "px-3 py-2 bg-input border border-outline focus:border-outline-light rounded text-sm resize-none",
|
|
10
|
+
note: "mt-1 text-xs text-slate-500"
|
|
11
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { SetState } from "@bouko/form";
|
|
2
|
-
|
|
3
|
-
style?: string;
|
|
4
|
-
accept?: string[];
|
|
5
|
-
update: SetState<File>;
|
|
6
|
-
};
|
|
7
|
-
export declare function FileUploader({ style, accept, update }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export default FileUploader;
|
|
1
|
+
import type { SetState } from "@bouko/form";
|
|
2
|
+
type Props = {
|
|
3
|
+
style?: string;
|
|
4
|
+
accept?: string[];
|
|
5
|
+
update: SetState<File>;
|
|
6
|
+
};
|
|
7
|
+
export declare function FileUploader({ style, accept, update }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default FileUploader;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import { useDropzone } from "react-dropzone";
|
|
4
|
-
import { cn } from "@bouko/style";
|
|
5
|
-
import PaperClip from "../../assets/icons/paperclip.svg";
|
|
6
|
-
export function FileUploader({ style, accept = [], update }) {
|
|
7
|
-
const onDrop = useCallback((files) => {
|
|
8
|
-
if (files.length > 0)
|
|
9
|
-
update(files[0]);
|
|
10
|
-
}, []);
|
|
11
|
-
const { getRootProps, getInputProps, isDragActive, inputRef } = useDropzone({
|
|
12
|
-
onDrop
|
|
13
|
-
});
|
|
14
|
-
const upload = () => inputRef.current?.click();
|
|
15
|
-
const save = (e) => update((e.target.files ?? [])[0]);
|
|
16
|
-
return (_jsxs("div", { className: cn(styles.container, isDragActive && "bg-background-light/40 border-border-light", style), onClick: upload, ...getRootProps(), children: [_jsxs("span", { className: styles.title, children: [_jsx(PaperClip, {}
|
|
17
|
-
}
|
|
18
|
-
const styles = {
|
|
19
|
-
container: "flex flex-col justify-center items-center gap-1 w-full py-3 hover:bg-background-light/40 border-2 border-dashed border-border hover:border-border-light rounded overflow-hidden duration-200 cursor-pointer",
|
|
20
|
-
title: "flex gap-2 items-center font-semibold text-sm",
|
|
21
|
-
subtitle: "text-xs text-primary-darker"
|
|
22
|
-
};
|
|
23
|
-
export default FileUploader;
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { useDropzone } from "react-dropzone";
|
|
4
|
+
import { cn } from "@bouko/style";
|
|
5
|
+
import PaperClip from "../../assets/icons/paperclip.svg";
|
|
6
|
+
export function FileUploader({ style, accept = [], update }) {
|
|
7
|
+
const onDrop = useCallback((files) => {
|
|
8
|
+
if (files.length > 0)
|
|
9
|
+
update(files[0]);
|
|
10
|
+
}, []);
|
|
11
|
+
const { getRootProps, getInputProps, isDragActive, inputRef } = useDropzone({
|
|
12
|
+
onDrop
|
|
13
|
+
});
|
|
14
|
+
const upload = () => inputRef.current?.click();
|
|
15
|
+
const save = (e) => update((e.target.files ?? [])[0]);
|
|
16
|
+
return (_jsxs("div", { className: cn(styles.container, isDragActive && "bg-background-light/40 border-border-light", style), onClick: upload, ...getRootProps(), children: [_jsxs("span", { className: styles.title, children: [_jsx(PaperClip, {}), "Drag and drop a file, or"] }), _jsx("span", { className: styles.subtitle, children: "browse" }), _jsx("input", { type: "file", className: "hidden", onChange: save, accept: accept.join(","), multiple: false, ...getInputProps() })] }));
|
|
17
|
+
}
|
|
18
|
+
const styles = {
|
|
19
|
+
container: "flex flex-col justify-center items-center gap-1 w-full py-3 hover:bg-background-light/40 border-2 border-dashed border-border hover:border-border-light rounded overflow-hidden duration-200 cursor-pointer",
|
|
20
|
+
title: "flex gap-2 items-center font-semibold text-sm",
|
|
21
|
+
subtitle: "text-xs text-primary-darker"
|
|
22
|
+
};
|
|
23
|
+
export default FileUploader;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type GenericPlugin } from "wavesurfer.js/dist/base-plugin";
|
|
2
|
-
|
|
3
|
-
file: File;
|
|
4
|
-
height: number;
|
|
5
|
-
plugins: GenericPlugin[];
|
|
6
|
-
};
|
|
7
|
-
export default function Waveform({ file, height, plugins }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
1
|
+
import { type GenericPlugin } from "wavesurfer.js/dist/base-plugin";
|
|
2
|
+
type Props = {
|
|
3
|
+
file: File;
|
|
4
|
+
height: number;
|
|
5
|
+
plugins: GenericPlugin[];
|
|
6
|
+
};
|
|
7
|
+
export default function Waveform({ file, height, plugins }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { squiggly } from "./patterns";
|
|
5
|
-
import { default as Player } from "@wavesurfer/react";
|
|
6
|
-
export default function Waveform({ file, height, plugins }) {
|
|
7
|
-
const url = useMemo(() => URL.createObjectURL(file), [file]);
|
|
8
|
-
const plugins2 = useMemo(() => plugins, [plugins]);
|
|
9
|
-
const waves = useMemo(() => squiggly, []);
|
|
10
|
-
return (_jsx(Player, { height: height, url: url, waveColor: "#1c1d23", progressColor: "#0085e4", cursorWidth: 2, renderFunction: waves, plugins: plugins2 }
|
|
11
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { squiggly } from "./patterns";
|
|
5
|
+
import { default as Player } from "@wavesurfer/react";
|
|
6
|
+
export default function Waveform({ file, height, plugins }) {
|
|
7
|
+
const url = useMemo(() => URL.createObjectURL(file), [file]);
|
|
8
|
+
const plugins2 = useMemo(() => plugins, [plugins]);
|
|
9
|
+
const waves = useMemo(() => squiggly, []);
|
|
10
|
+
return (_jsx(Player, { height: height, url: url, waveColor: "#1c1d23", progressColor: "#0085e4", cursorWidth: 2, renderFunction: waves, plugins: plugins2 }));
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function squiggly(channels: (Float32Array | number[])[], ctx: CanvasRenderingContext2D): void;
|
|
1
|
+
export declare function squiggly(channels: (Float32Array | number[])[], ctx: CanvasRenderingContext2D): void;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export function squiggly(channels, ctx) {
|
|
2
|
-
const { width, height } = ctx.canvas;
|
|
3
|
-
const scale = channels[0].length / width;
|
|
4
|
-
const step = 12;
|
|
5
|
-
ctx.translate(0, height / 2);
|
|
6
|
-
ctx.strokeStyle = ctx.fillStyle;
|
|
7
|
-
ctx.lineWidth = 3;
|
|
8
|
-
ctx.beginPath();
|
|
9
|
-
for (let i = 0; i < width; i += step * 2) {
|
|
10
|
-
const index = Math.floor(i * scale);
|
|
11
|
-
const value = Math.abs(channels[0][index]);
|
|
12
|
-
let x = i;
|
|
13
|
-
let y = value * height;
|
|
14
|
-
ctx.moveTo(x, 0);
|
|
15
|
-
ctx.lineTo(x, y);
|
|
16
|
-
ctx.arc(x + step / 2, y, step / 2, Math.PI, 0, true);
|
|
17
|
-
ctx.lineTo(x + step, 0);
|
|
18
|
-
x = x + step;
|
|
19
|
-
y = -y;
|
|
20
|
-
ctx.moveTo(x, 0);
|
|
21
|
-
ctx.lineTo(x, y);
|
|
22
|
-
ctx.arc(x + step / 2, y, step / 2, Math.PI, 0, false);
|
|
23
|
-
ctx.lineTo(x + step, 0);
|
|
24
|
-
}
|
|
25
|
-
ctx.stroke();
|
|
26
|
-
ctx.closePath();
|
|
27
|
-
}
|
|
1
|
+
export function squiggly(channels, ctx) {
|
|
2
|
+
const { width, height } = ctx.canvas;
|
|
3
|
+
const scale = channels[0].length / width;
|
|
4
|
+
const step = 12;
|
|
5
|
+
ctx.translate(0, height / 2);
|
|
6
|
+
ctx.strokeStyle = ctx.fillStyle;
|
|
7
|
+
ctx.lineWidth = 3;
|
|
8
|
+
ctx.beginPath();
|
|
9
|
+
for (let i = 0; i < width; i += step * 2) {
|
|
10
|
+
const index = Math.floor(i * scale);
|
|
11
|
+
const value = Math.abs(channels[0][index]);
|
|
12
|
+
let x = i;
|
|
13
|
+
let y = value * height;
|
|
14
|
+
ctx.moveTo(x, 0);
|
|
15
|
+
ctx.lineTo(x, y);
|
|
16
|
+
ctx.arc(x + step / 2, y, step / 2, Math.PI, 0, true);
|
|
17
|
+
ctx.lineTo(x + step, 0);
|
|
18
|
+
x = x + step;
|
|
19
|
+
y = -y;
|
|
20
|
+
ctx.moveTo(x, 0);
|
|
21
|
+
ctx.lineTo(x, y);
|
|
22
|
+
ctx.arc(x + step / 2, y, step / 2, Math.PI, 0, false);
|
|
23
|
+
ctx.lineTo(x + step, 0);
|
|
24
|
+
}
|
|
25
|
+
ctx.stroke();
|
|
26
|
+
ctx.closePath();
|
|
27
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/core/format.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
export declare const rn: (...elements: ReactNode[]) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export declare const formatText: (text: string) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export declare const rn: (...elements: ReactNode[]) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const formatText: (text: string) => import("react/jsx-runtime").JSX.Element;
|