@bouko/react 2.0.4 → 2.0.6
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/layout/flex.d.ts +2 -9
- package/dist/components/layout/flex.js +5 -7
- package/dist/core/format.d.ts +0 -2
- package/dist/core/format.js +0 -2
- package/dist/core/functions.d.ts +6 -0
- package/dist/core/functions.js +10 -0
- package/dist/core/types.d.ts +7 -7
- package/dist/core/types.js +1 -0
- package/package.json +6 -27
- package/dist/components/badge.d.ts +0 -5
- package/dist/components/badge.js +0 -4
- package/dist/components/flex.d.ts +0 -16
- package/dist/components/flex.js +0 -8
- package/dist/components/search/index.d.ts +0 -6
- package/dist/components/search/index.js +0 -12
- package/dist/hooks/color.d.ts +0 -7
- package/dist/hooks/color.js +0 -8
|
@@ -11,13 +11,6 @@ type Props = Component & {
|
|
|
11
11
|
* @param {ReactNode} children - Child elements to render inside the row.
|
|
12
12
|
* @param {Props} opts - Variant options for styling.
|
|
13
13
|
**/
|
|
14
|
-
export declare const RowBox: ({ style, children, ...opts }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export declare const ColumnBox: ({ style, children, ...opts }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const RowBox: ({ style, children, ...opts }: Props) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
15
|
+
export declare const ColumnBox: ({ style, children, ...opts }: Props) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
16
16
|
export {};
|
|
17
|
-
/**
|
|
18
|
-
* Problems
|
|
19
|
-
*
|
|
20
|
-
* - Perfect `Component`
|
|
21
|
-
* - Perfect `cn`
|
|
22
|
-
* - Perfect `tv`
|
|
23
|
-
**/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn, tv } from "@bouko/style";
|
|
3
3
|
/**
|
|
4
4
|
* Flex containers with configurable alignment and styling.
|
|
@@ -8,14 +8,12 @@ import { cn, tv } from "@bouko/style";
|
|
|
8
8
|
* @param {Props} opts - Variant options for styling.
|
|
9
9
|
**/
|
|
10
10
|
export const RowBox = ({ style, children, ...opts }) => {
|
|
11
|
-
if (
|
|
12
|
-
return _jsx(
|
|
13
|
-
return (_jsx("div", { className: cn(row(opts), style), children: children }));
|
|
11
|
+
if (children)
|
|
12
|
+
return (_jsx("div", { className: cn(row(opts), style), children: children }));
|
|
14
13
|
};
|
|
15
14
|
export const ColumnBox = ({ style, children, ...opts }) => {
|
|
16
|
-
if (
|
|
17
|
-
return _jsx(
|
|
18
|
-
return (_jsx("div", { className: cn(column(opts), style), children: children }));
|
|
15
|
+
if (children)
|
|
16
|
+
return (_jsx("div", { className: cn(column(opts), style), children: children }));
|
|
19
17
|
};
|
|
20
18
|
/**
|
|
21
19
|
* Styling variants for flex options.
|
package/dist/core/format.d.ts
CHANGED
package/dist/core/format.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from "react";
|
|
3
2
|
const delimiterConfig = [
|
|
4
3
|
{ delimiter: "**", render: (text, key) => _jsx("span", { className: "font-bold", children: text }, key) },
|
|
5
4
|
{ delimiter: "~~", render: (text, key) => _jsx("span", { className: "font-semibold", children: text }, key) },
|
|
@@ -9,7 +8,6 @@ const escapeRegex = (str) => str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
|
9
8
|
const delimiters = delimiterConfig.map(({ delimiter }) => escapeRegex(delimiter) + ".*?" + escapeRegex(delimiter)).join("|");
|
|
10
9
|
const WRAPPED_TEXT_REGEX = new RegExp(`(${delimiters})`, "g");
|
|
11
10
|
const isWrapped = (x, wrapper) => x.startsWith(wrapper) && x.endsWith(wrapper);
|
|
12
|
-
export const rn = (...elements) => (_jsx(Fragment, { children: elements.map((x, i) => (_jsx(Fragment, { children: x }, i))) }));
|
|
13
11
|
export const formatText = (text) => {
|
|
14
12
|
const parts = text
|
|
15
13
|
.split(WRAPPED_TEXT_REGEX)
|
package/dist/core/functions.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export declare const getFileData: (files: File[]) => Promise<unknown[]>;
|
|
2
|
+
type Props = {
|
|
3
|
+
name?: string;
|
|
4
|
+
ext: "mp3";
|
|
5
|
+
};
|
|
6
|
+
export declare const bufferToFile: (buffer: Buffer<ArrayBuffer>, { name, ext }: Props) => File;
|
|
2
7
|
export declare const getAudioDuration: (file: File) => Promise<number>;
|
|
3
8
|
export declare const getEnv: (key: string) => string;
|
|
4
9
|
export declare function getBase64(image: string): Promise<string>;
|
|
10
|
+
export {};
|
package/dist/core/functions.js
CHANGED
|
@@ -13,6 +13,16 @@ export const getFileData = (files) => Promise.all(files.map((file) => {
|
|
|
13
13
|
reader.readAsDataURL(file);
|
|
14
14
|
});
|
|
15
15
|
}));
|
|
16
|
+
const getMimeType = (ext) => {
|
|
17
|
+
if (ext === "mp3")
|
|
18
|
+
return "audio/mpeg";
|
|
19
|
+
else
|
|
20
|
+
return;
|
|
21
|
+
};
|
|
22
|
+
export const bufferToFile = (buffer, { name, ext }) => new File([buffer], `${name ?? "file"}.${ext}`, {
|
|
23
|
+
type: getMimeType(ext),
|
|
24
|
+
lastModified: Date.now()
|
|
25
|
+
});
|
|
16
26
|
export const getAudioDuration = (file) => {
|
|
17
27
|
return new Promise((resolve, reject) => {
|
|
18
28
|
const url = URL.createObjectURL(file);
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ReactNode
|
|
2
|
-
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Common props for React components.
|
|
4
|
+
*
|
|
5
|
+
* @property style - Tailwind class name(s) (optional)
|
|
6
|
+
* @property children - React children nodes (optional)
|
|
7
|
+
**/
|
|
3
8
|
export type Component = {
|
|
4
9
|
style?: string;
|
|
5
10
|
children?: ReactNode;
|
|
6
11
|
};
|
|
7
|
-
export type Attachment = {
|
|
8
|
-
filename: string;
|
|
9
|
-
mimetype: string;
|
|
10
|
-
data: string;
|
|
11
|
-
};
|
package/dist/core/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,54 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
|
|
3
3
|
"name": "@bouko/react",
|
|
4
|
-
|
|
5
|
-
"version": "2.0.4",
|
|
6
|
-
|
|
4
|
+
"version": "2.0.6",
|
|
7
5
|
"main": "./dist/index.js",
|
|
8
|
-
|
|
9
6
|
"types": "./dist/index.d.ts",
|
|
10
|
-
|
|
11
7
|
"license": "MIT",
|
|
12
|
-
|
|
13
8
|
"files": [
|
|
14
|
-
|
|
15
9
|
"dist"
|
|
16
|
-
|
|
17
10
|
],
|
|
18
|
-
|
|
19
11
|
"publishConfig": {
|
|
20
|
-
|
|
21
12
|
"access": "public"
|
|
22
|
-
|
|
23
13
|
},
|
|
24
|
-
|
|
25
14
|
"author": "",
|
|
26
|
-
|
|
27
15
|
"description": "",
|
|
28
|
-
|
|
29
16
|
"engines": {},
|
|
30
17
|
|
|
31
18
|
"scripts": {
|
|
32
|
-
|
|
33
19
|
"build": "tsc"
|
|
34
|
-
|
|
35
20
|
},
|
|
36
21
|
|
|
37
22
|
"dependencies": {
|
|
38
|
-
|
|
39
|
-
"@bouko/style": "^0.1.5",
|
|
40
|
-
|
|
23
|
+
"@bouko/style": "^0.1.6",
|
|
41
24
|
"clsx": "^2.1.1",
|
|
42
|
-
|
|
43
25
|
"framer-motion": "^12.23.6",
|
|
44
|
-
|
|
45
|
-
"tailwind-merge": "^3.3.0",
|
|
46
|
-
|
|
26
|
+
"tailwind-merge": "^3.3.1",
|
|
47
27
|
"tailwind-variants": "^1.0.0",
|
|
48
|
-
|
|
49
28
|
"zod": "^4.0.13"
|
|
29
|
+
},
|
|
50
30
|
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
31
|
+
"devDependencies": {}
|
|
54
32
|
|
|
33
|
+
}
|
package/dist/components/badge.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export default function Badge({ style, children }) {
|
|
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
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
type Props = Position & {
|
|
3
|
-
style?: string;
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
};
|
|
6
|
-
type Position = {
|
|
7
|
-
center?: boolean;
|
|
8
|
-
centerX?: boolean;
|
|
9
|
-
centerY?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare function ColumnBox({ style, center, centerX, centerY, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare function RowBox({ style, children }: {
|
|
13
|
-
style?: string;
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
package/dist/components/flex.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "@bouko/style";
|
|
3
|
-
export function ColumnBox({ style, center, centerX, centerY, children }) {
|
|
4
|
-
return (_jsx("div", { className: cn("flex flex-col", center && "items-center justify-center", centerX && "items-center", centerY && "justify-center", style), children: children }));
|
|
5
|
-
}
|
|
6
|
-
export function RowBox({ style, children }) {
|
|
7
|
-
return (_jsx("div", { className: cn("flex", style), children: children }));
|
|
8
|
-
}
|
|
@@ -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
|
-
};
|
package/dist/hooks/color.d.ts
DELETED
package/dist/hooks/color.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
export default function useColor({ variable, color, original }) {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
document.documentElement.style.setProperty(`--${variable}`, color);
|
|
6
|
-
return () => document.documentElement.style.setProperty(`--${variable}`, original);
|
|
7
|
-
}, []);
|
|
8
|
-
}
|