@bouko/react 2.6.6 → 2.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/colors/core.d.ts +10 -10
- package/dist/colors/core.js +25 -25
- package/dist/colors/index.d.ts +26 -26
- package/dist/colors/index.js +43 -43
- package/dist/colors/types.d.ts +11 -11
- package/dist/colors/types.js +7 -7
- 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/audio/timestamp.d.ts +12 -0
- package/dist/components/audio/timestamp.js +10 -0
- package/dist/components/button/icon.d.ts +10 -10
- package/dist/components/button/icon.js +19 -19
- package/dist/components/button/normal.d.ts +11 -11
- package/dist/components/button/normal.js +39 -39
- 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/form/functions.d.ts +1 -1
- package/dist/components/form/functions.js +28 -28
- 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 +15 -14
- package/dist/components/index.js +15 -14
- package/dist/components/input.d.ts +37 -37
- package/dist/components/input.js +40 -40
- package/dist/components/layout/absolute.d.ts +9 -9
- package/dist/components/layout/absolute.js +9 -9
- 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/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-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 +17 -16
- package/dist/components/text/badge.js +35 -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.js +1 -1
- package/dist/core/format.d.ts +3 -3
- package/dist/core/format.js +34 -34
- package/dist/core/functions.d.ts +10 -10
- package/dist/core/functions.js +76 -76
- package/dist/core/types.d.ts +15 -15
- package/dist/core/types.js +2 -2
- package/dist/core/variants.d.ts +5 -5
- package/dist/core/variants.js +6 -6
- package/dist/format/index.d.ts +2 -2
- package/dist/format/index.js +33 -33
- 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/element/container.d.ts +4 -5
- package/dist/hooks/element/container.js +7 -7
- package/dist/hooks/element/index.d.ts +4 -5
- package/dist/hooks/element/index.js +9 -9
- package/dist/hooks/element/resize.d.ts +1 -1
- package/dist/hooks/element/resize.js +12 -12
- package/dist/hooks/index.d.ts +5 -5
- package/dist/hooks/index.js +5 -5
- package/dist/index.d.ts +14 -14
- package/dist/index.js +14 -14
- package/package.json +5 -2
package/dist/format/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
const delimiterConfig = [
|
|
3
|
-
{ delimiter: "**", render: (text, key) => _jsx("span", { className: "font-bold", children: text }, key) },
|
|
4
|
-
{ delimiter: "~~", render: (text, key) => _jsx("span", { className: "font-semibold", children: text }, key) },
|
|
5
|
-
{ delimiter: "^^", render: (text, key) => _jsx("span", { className: "text-accent", children: text }, key) },
|
|
6
|
-
];
|
|
7
|
-
const escapeRegex = (str) => str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
8
|
-
const delimiters = delimiterConfig.map(({ delimiter }) => escapeRegex(delimiter) + ".*?" + escapeRegex(delimiter)).join("|");
|
|
9
|
-
const WRAPPED_TEXT_REGEX = new RegExp(`(${delimiters})`, "g");
|
|
10
|
-
const isWrapped = (x, wrapper) => x.startsWith(wrapper) && x.endsWith(wrapper);
|
|
11
|
-
export const cap = (x) => x.charAt(0).toUpperCase() + x.slice(1, x.length);
|
|
12
|
-
export const formatText = (text) => {
|
|
13
|
-
const parts = text
|
|
14
|
-
.split(WRAPPED_TEXT_REGEX)
|
|
15
|
-
.filter(Boolean);
|
|
16
|
-
const formatted = parts.map((x, i) => {
|
|
17
|
-
if (isWrapped(x, "**")) {
|
|
18
|
-
// Remove only the first and last occurrence of the delimiter
|
|
19
|
-
const content = x.slice(2, -2);
|
|
20
|
-
return _jsx("span", { className: "font-bold", children: content }, i);
|
|
21
|
-
}
|
|
22
|
-
else if (isWrapped(x, "~~")) {
|
|
23
|
-
const content = x.slice(2, -2);
|
|
24
|
-
return _jsx("span", { className: "font-semibold", children: content }, i);
|
|
25
|
-
}
|
|
26
|
-
else if (isWrapped(x, "^^")) {
|
|
27
|
-
const content = x.slice(2, -2);
|
|
28
|
-
return _jsx("span", { className: "text-accent", children: content }, i);
|
|
29
|
-
}
|
|
30
|
-
return x;
|
|
31
|
-
});
|
|
32
|
-
return _jsx("span", { children: formatted }
|
|
33
|
-
};
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const delimiterConfig = [
|
|
3
|
+
{ delimiter: "**", render: (text, key) => _jsx("span", { className: "font-bold", children: text }, key) },
|
|
4
|
+
{ delimiter: "~~", render: (text, key) => _jsx("span", { className: "font-semibold", children: text }, key) },
|
|
5
|
+
{ delimiter: "^^", render: (text, key) => _jsx("span", { className: "text-accent", children: text }, key) },
|
|
6
|
+
];
|
|
7
|
+
const escapeRegex = (str) => str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
8
|
+
const delimiters = delimiterConfig.map(({ delimiter }) => escapeRegex(delimiter) + ".*?" + escapeRegex(delimiter)).join("|");
|
|
9
|
+
const WRAPPED_TEXT_REGEX = new RegExp(`(${delimiters})`, "g");
|
|
10
|
+
const isWrapped = (x, wrapper) => x.startsWith(wrapper) && x.endsWith(wrapper);
|
|
11
|
+
export const cap = (x) => x.charAt(0).toUpperCase() + x.slice(1, x.length);
|
|
12
|
+
export const formatText = (text) => {
|
|
13
|
+
const parts = text
|
|
14
|
+
.split(WRAPPED_TEXT_REGEX)
|
|
15
|
+
.filter(Boolean);
|
|
16
|
+
const formatted = parts.map((x, i) => {
|
|
17
|
+
if (isWrapped(x, "**")) {
|
|
18
|
+
// Remove only the first and last occurrence of the delimiter
|
|
19
|
+
const content = x.slice(2, -2);
|
|
20
|
+
return _jsx("span", { className: "font-bold", children: content }, i);
|
|
21
|
+
}
|
|
22
|
+
else if (isWrapped(x, "~~")) {
|
|
23
|
+
const content = x.slice(2, -2);
|
|
24
|
+
return _jsx("span", { className: "font-semibold", children: content }, i);
|
|
25
|
+
}
|
|
26
|
+
else if (isWrapped(x, "^^")) {
|
|
27
|
+
const content = x.slice(2, -2);
|
|
28
|
+
return _jsx("span", { className: "text-accent", children: content }, i);
|
|
29
|
+
}
|
|
30
|
+
return x;
|
|
31
|
+
});
|
|
32
|
+
return _jsx("span", { children: formatted });
|
|
33
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useSound(filename?: string): import("use-sound/dist/types").PlayFunction | undefined;
|
|
1
|
+
export default function useSound(filename?: string): import("use-sound/dist/types").PlayFunction | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { default as base } from "use-sound";
|
|
2
|
-
export default function useSound(filename) {
|
|
3
|
-
if (!filename)
|
|
4
|
-
return;
|
|
5
|
-
return base(filename)[0];
|
|
6
|
-
}
|
|
1
|
+
import { default as base } from "use-sound";
|
|
2
|
+
export default function useSound(filename) {
|
|
3
|
+
if (!filename)
|
|
4
|
+
return;
|
|
5
|
+
return base(filename)[0];
|
|
6
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
action: () => Promise<boolean | void>;
|
|
3
|
-
duration: number;
|
|
4
|
-
deps: unknown[];
|
|
5
|
-
oops?: (x: string) => void;
|
|
6
|
-
};
|
|
7
|
-
export default function useInterval({ action, duration, deps, oops }: Props): void;
|
|
8
|
-
export {};
|
|
1
|
+
type Props = {
|
|
2
|
+
action: () => Promise<boolean | void>;
|
|
3
|
+
duration: number;
|
|
4
|
+
deps: unknown[];
|
|
5
|
+
oops?: (x: string) => void;
|
|
6
|
+
};
|
|
7
|
+
export default function useInterval({ action, duration, deps, oops }: Props): void;
|
|
8
|
+
export {};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
export default function useInterval({ action, duration, deps = [], oops }) {
|
|
4
|
-
const ref = useRef(async () => false);
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
ref.current = action;
|
|
7
|
-
}, [action]);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
if (deps.some(v => v === undefined || v === null))
|
|
10
|
-
return;
|
|
11
|
-
const tick = async () => {
|
|
12
|
-
try {
|
|
13
|
-
const stop = await ref.current();
|
|
14
|
-
if (stop && id)
|
|
15
|
-
clearInterval(id);
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
oops?.(err.message);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const id = setInterval(tick, duration);
|
|
22
|
-
tick();
|
|
23
|
-
return () => clearInterval(id);
|
|
24
|
-
}, [duration, ...deps]);
|
|
25
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
export default function useInterval({ action, duration, deps = [], oops }) {
|
|
4
|
+
const ref = useRef(async () => false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
ref.current = action;
|
|
7
|
+
}, [action]);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (deps.some(v => v === undefined || v === null))
|
|
10
|
+
return;
|
|
11
|
+
const tick = async () => {
|
|
12
|
+
try {
|
|
13
|
+
const stop = await ref.current();
|
|
14
|
+
if (stop && id)
|
|
15
|
+
clearInterval(id);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
oops?.(err.message);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const id = setInterval(tick, duration);
|
|
22
|
+
tick();
|
|
23
|
+
return () => clearInterval(id);
|
|
24
|
+
}, [duration, ...deps]);
|
|
25
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
1
|
+
export default function useContainer(): {
|
|
2
|
+
ref: import("react").RefObject<HTMLDivElement | null>;
|
|
3
|
+
container: HTMLElement | null | undefined;
|
|
4
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useRef } from "react";
|
|
3
|
-
export default function useContainer() {
|
|
4
|
-
const ref = useRef(null);
|
|
5
|
-
const container = ref.current?.parentElement;
|
|
6
|
-
return { ref, container };
|
|
7
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
export default function useContainer() {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
const container = ref.current?.parentElement;
|
|
6
|
+
return { ref, container };
|
|
7
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
1
|
+
export default function useElement(): {
|
|
2
|
+
ref: import("react").RefObject<HTMLDivElement | null>;
|
|
3
|
+
width: number;
|
|
4
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useRef } from "react";
|
|
3
|
-
export default function useElement() {
|
|
4
|
-
const ref = useRef(null);
|
|
5
|
-
return {
|
|
6
|
-
ref,
|
|
7
|
-
width: ref.current?.clientWidth || 0
|
|
8
|
-
};
|
|
9
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
export default function useElement() {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
return {
|
|
6
|
+
ref,
|
|
7
|
+
width: ref.current?.clientWidth || 0
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useResizeObserver(element: HTMLElement | null | undefined, action: () => void): void;
|
|
1
|
+
export default function useResizeObserver(element: HTMLElement | null | undefined, action: () => void): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
export default function useResizeObserver(element, action) {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
if (!element)
|
|
6
|
-
return;
|
|
7
|
-
const observer = new ResizeObserver(action);
|
|
8
|
-
observer.observe(element);
|
|
9
|
-
action();
|
|
10
|
-
return () => observer.disconnect();
|
|
11
|
-
}, [element, action]);
|
|
12
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
export default function useResizeObserver(element, action) {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (!element)
|
|
6
|
+
return;
|
|
7
|
+
const observer = new ResizeObserver(action);
|
|
8
|
+
observer.observe(element);
|
|
9
|
+
action();
|
|
10
|
+
return () => observer.disconnect();
|
|
11
|
+
}, [element, action]);
|
|
12
|
+
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default as useElement } from "./element";
|
|
2
|
-
export { default as useContainer } from "./element/container";
|
|
3
|
-
export { default as useResize } from "./element/resize";
|
|
4
|
-
export { default as useInterval } from "./clock/interval";
|
|
5
|
-
export { default as useSound } from "./audio/sound";
|
|
1
|
+
export { default as useElement } from "./element";
|
|
2
|
+
export { default as useContainer } from "./element/container";
|
|
3
|
+
export { default as useResize } from "./element/resize";
|
|
4
|
+
export { default as useInterval } from "./clock/interval";
|
|
5
|
+
export { default as useSound } from "./audio/sound";
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default as useElement } from "./element";
|
|
2
|
-
export { default as useContainer } from "./element/container";
|
|
3
|
-
export { default as useResize } from "./element/resize";
|
|
4
|
-
export { default as useInterval } from "./clock/interval";
|
|
5
|
-
export { default as useSound } from "./audio/sound";
|
|
1
|
+
export { default as useElement } from "./element";
|
|
2
|
+
export { default as useContainer } from "./element/container";
|
|
3
|
+
export { default as useResize } from "./element/resize";
|
|
4
|
+
export { default as useInterval } from "./clock/interval";
|
|
5
|
+
export { default as useSound } from "./audio/sound";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { default as Input } from "./components/input";
|
|
2
|
-
export { default as TextArea } from "./components/textarea";
|
|
3
|
-
export { default as Select } from "./components/select";
|
|
4
|
-
export { default as MultipleChoice } from "./components/multiple-choice";
|
|
5
|
-
export { default as Attachment } from "./components/attachment";
|
|
6
|
-
export { default as CheckBox } from "./components/checkbox";
|
|
7
|
-
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
8
|
-
export * from "./components";
|
|
9
|
-
export * from "./components/search-bar";
|
|
10
|
-
export * from "./core/types";
|
|
11
|
-
export * from "./core/functions";
|
|
12
|
-
export * from "./core/format";
|
|
13
|
-
export * from "./components/form/functions";
|
|
14
|
-
export * from "./hooks";
|
|
1
|
+
export { default as Input } from "./components/input";
|
|
2
|
+
export { default as TextArea } from "./components/textarea";
|
|
3
|
+
export { default as Select } from "./components/select";
|
|
4
|
+
export { default as MultipleChoice } from "./components/multiple-choice";
|
|
5
|
+
export { default as Attachment } from "./components/attachment";
|
|
6
|
+
export { default as CheckBox } from "./components/checkbox";
|
|
7
|
+
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
8
|
+
export * from "./components";
|
|
9
|
+
export * from "./components/search-bar";
|
|
10
|
+
export * from "./core/types";
|
|
11
|
+
export * from "./core/functions";
|
|
12
|
+
export * from "./core/format";
|
|
13
|
+
export * from "./components/form/functions";
|
|
14
|
+
export * from "./hooks";
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { default as Input } from "./components/input";
|
|
2
|
-
export { default as TextArea } from "./components/textarea";
|
|
3
|
-
export { default as Select } from "./components/select";
|
|
4
|
-
export { default as MultipleChoice } from "./components/multiple-choice";
|
|
5
|
-
export { default as Attachment } from "./components/attachment";
|
|
6
|
-
export { default as CheckBox } from "./components/checkbox";
|
|
7
|
-
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
8
|
-
export * from "./components";
|
|
9
|
-
export * from "./components/search-bar";
|
|
10
|
-
export * from "./core/types";
|
|
11
|
-
export * from "./core/functions";
|
|
12
|
-
export * from "./core/format";
|
|
13
|
-
export * from "./components/form/functions";
|
|
14
|
-
export * from "./hooks";
|
|
1
|
+
export { default as Input } from "./components/input";
|
|
2
|
+
export { default as TextArea } from "./components/textarea";
|
|
3
|
+
export { default as Select } from "./components/select";
|
|
4
|
+
export { default as MultipleChoice } from "./components/multiple-choice";
|
|
5
|
+
export { default as Attachment } from "./components/attachment";
|
|
6
|
+
export { default as CheckBox } from "./components/checkbox";
|
|
7
|
+
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
8
|
+
export * from "./components";
|
|
9
|
+
export * from "./components/search-bar";
|
|
10
|
+
export * from "./core/types";
|
|
11
|
+
export * from "./core/functions";
|
|
12
|
+
export * from "./core/format";
|
|
13
|
+
export * from "./components/form/functions";
|
|
14
|
+
export * from "./hooks";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
|
|
3
3
|
"name": "@bouko/react",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.8",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@bouko/audio": "^0.1.0",
|
|
24
24
|
"@bouko/form": "^0.5.7",
|
|
25
25
|
"@bouko/style": "^0.1.7",
|
|
26
|
+
"@bouko/ts": "^0.3.5",
|
|
26
27
|
"@wavesurfer/react": "^1.0.11",
|
|
27
28
|
"clsx": "^2.1.1",
|
|
28
29
|
"file-type": "^21.0.0",
|
|
@@ -36,9 +37,11 @@
|
|
|
36
37
|
},
|
|
37
38
|
|
|
38
39
|
"devDependencies": {
|
|
40
|
+
"@types/node": "^24.3.1",
|
|
39
41
|
"@types/react": "^19.1.10",
|
|
40
42
|
"dependency-cruiser": "^17.0.1",
|
|
41
|
-
"react": "^19.1.1"
|
|
43
|
+
"react": "^19.1.1",
|
|
44
|
+
"typescript": "^5.9.2"
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
}
|