@bouko/react 1.5.8 → 1.6.0
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/animate/configs.d.ts +136 -0
- package/dist/components/animate/configs.js +62 -0
- package/dist/components/animate/index.d.ts +12 -0
- package/dist/components/animate/index.js +7 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/layout/separator.d.ts +3 -0
- package/dist/components/layout/separator.js +24 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +2 -0
- package/dist/components/list/item.d.ts +9 -0
- package/dist/components/list/item.js +7 -0
- package/dist/components/list/variants/bullet.d.ts +9 -0
- package/dist/components/list/variants/bullet.js +16 -0
- package/dist/components/list/variants/number.d.ts +10 -0
- package/dist/components/list/variants/number.js +18 -0
- package/dist/hooks/element/container.d.ts +4 -0
- package/dist/hooks/element/container.js +7 -0
- package/dist/hooks/element/resize.d.ts +1 -0
- package/dist/hooks/element/resize.js +12 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export declare const animations: {
|
|
2
|
+
fadeUp: {
|
|
3
|
+
initial: {
|
|
4
|
+
opacity: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
animate: {
|
|
8
|
+
opacity: number;
|
|
9
|
+
y: number;
|
|
10
|
+
transition: {
|
|
11
|
+
duration: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
fadeInAndOut: {
|
|
16
|
+
initial: {
|
|
17
|
+
opacity: number;
|
|
18
|
+
};
|
|
19
|
+
animate: {
|
|
20
|
+
opacity: number;
|
|
21
|
+
};
|
|
22
|
+
exit: {
|
|
23
|
+
opacity: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
fadeUpAndOut: {
|
|
27
|
+
initial: {
|
|
28
|
+
opacity: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
animate: {
|
|
32
|
+
opacity: number;
|
|
33
|
+
y: number;
|
|
34
|
+
};
|
|
35
|
+
exit: {
|
|
36
|
+
opacity: number;
|
|
37
|
+
y: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
fadeUpAndOutSlow: {
|
|
41
|
+
initial: {
|
|
42
|
+
opacity: number;
|
|
43
|
+
y: string;
|
|
44
|
+
};
|
|
45
|
+
animate: {
|
|
46
|
+
opacity: number;
|
|
47
|
+
y: number;
|
|
48
|
+
transition: {
|
|
49
|
+
duration: number;
|
|
50
|
+
ease: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
exit: {
|
|
54
|
+
opacity: number;
|
|
55
|
+
y: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
fadeLeft: {
|
|
59
|
+
initial: {
|
|
60
|
+
x: number;
|
|
61
|
+
opacity: number;
|
|
62
|
+
};
|
|
63
|
+
animate: {
|
|
64
|
+
x: number;
|
|
65
|
+
opacity: number;
|
|
66
|
+
};
|
|
67
|
+
exit: {
|
|
68
|
+
x: number;
|
|
69
|
+
opacity: number;
|
|
70
|
+
};
|
|
71
|
+
transition: {
|
|
72
|
+
duration: number;
|
|
73
|
+
ease: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
growUpAndOut: {
|
|
77
|
+
initial: {
|
|
78
|
+
opacity: number;
|
|
79
|
+
height: number;
|
|
80
|
+
};
|
|
81
|
+
animate: {
|
|
82
|
+
opacity: number;
|
|
83
|
+
height: string;
|
|
84
|
+
};
|
|
85
|
+
exit: {
|
|
86
|
+
opacity: number;
|
|
87
|
+
height: number;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
fadeStagger: {
|
|
91
|
+
initial: {
|
|
92
|
+
opacity: number;
|
|
93
|
+
};
|
|
94
|
+
animate: {
|
|
95
|
+
opacity: number;
|
|
96
|
+
transition: {
|
|
97
|
+
staggerChildren: number;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
fadeList: {
|
|
102
|
+
hidden: {
|
|
103
|
+
opacity: number;
|
|
104
|
+
x: number;
|
|
105
|
+
y: number;
|
|
106
|
+
};
|
|
107
|
+
visible: {
|
|
108
|
+
opacity: number;
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
transition: {
|
|
112
|
+
type: string;
|
|
113
|
+
stiffness: number;
|
|
114
|
+
damping: number;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
popUp: {
|
|
119
|
+
initial: {
|
|
120
|
+
opacity: number;
|
|
121
|
+
scale: number;
|
|
122
|
+
};
|
|
123
|
+
animate: {
|
|
124
|
+
opacity: number;
|
|
125
|
+
scale: number;
|
|
126
|
+
};
|
|
127
|
+
exit: {
|
|
128
|
+
opacity: number;
|
|
129
|
+
scale: number;
|
|
130
|
+
};
|
|
131
|
+
transition: {
|
|
132
|
+
duration: number;
|
|
133
|
+
ease: number[];
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export const animations = {
|
|
2
|
+
"fadeUp": {
|
|
3
|
+
"initial": { "opacity": 0, "y": 30 },
|
|
4
|
+
"animate": {
|
|
5
|
+
"opacity": 1,
|
|
6
|
+
"y": 0,
|
|
7
|
+
"transition": { "duration": 0.3 }
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"fadeInAndOut": {
|
|
11
|
+
"initial": { "opacity": 0 },
|
|
12
|
+
"animate": { "opacity": 1 },
|
|
13
|
+
"exit": { "opacity": 0 }
|
|
14
|
+
},
|
|
15
|
+
"fadeUpAndOut": {
|
|
16
|
+
"initial": { "opacity": 0, "y": 10 },
|
|
17
|
+
"animate": { "opacity": 1, "y": 0 },
|
|
18
|
+
"exit": { "opacity": 1, "y": -10 }
|
|
19
|
+
},
|
|
20
|
+
"fadeUpAndOutSlow": {
|
|
21
|
+
"initial": { "opacity": 0, "y": "-100%" },
|
|
22
|
+
"animate": { "opacity": 1, "y": 0,
|
|
23
|
+
"transition": { "duration": 0.2, "ease": "easeInOut" }
|
|
24
|
+
},
|
|
25
|
+
"exit": { "opacity": 0, "y": "100%" }
|
|
26
|
+
},
|
|
27
|
+
"fadeLeft": {
|
|
28
|
+
"initial": { "x": -50, "opacity": 0 },
|
|
29
|
+
"animate": { "x": 0, "opacity": 1 },
|
|
30
|
+
"exit": { "x": 50, "opacity": 0 },
|
|
31
|
+
"transition": { "duration": 0.4, "ease": "easeOut" }
|
|
32
|
+
},
|
|
33
|
+
"growUpAndOut": {
|
|
34
|
+
"initial": { "opacity": 0, "height": 0 },
|
|
35
|
+
"animate": { "opacity": 1, "height": "auto" },
|
|
36
|
+
"exit": { "opacity": 0, "height": 0 }
|
|
37
|
+
},
|
|
38
|
+
"fadeStagger": {
|
|
39
|
+
"initial": { "opacity": 0 },
|
|
40
|
+
"animate": {
|
|
41
|
+
"opacity": 1,
|
|
42
|
+
"transition": { "staggerChildren": 0.2 }
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"fadeList": {
|
|
46
|
+
"hidden": { "opacity": 0, "x": -10, "y": 5 },
|
|
47
|
+
"visible": {
|
|
48
|
+
"opacity": 1, "x": 0, "y": 0,
|
|
49
|
+
"transition": {
|
|
50
|
+
"type": "spring",
|
|
51
|
+
"stiffness": 350,
|
|
52
|
+
"damping": 25
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"popUp": {
|
|
57
|
+
"initial": { "opacity": 0, "scale": 0.9 },
|
|
58
|
+
"animate": { "opacity": 1, "scale": 1 },
|
|
59
|
+
"exit": { "opacity": 0, "scale": 0.9 },
|
|
60
|
+
"transition": { "duration": 0.2, "ease": [0.23, 1, 0.32, 1] }
|
|
61
|
+
}
|
|
62
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { animations } from "./configs";
|
|
3
|
+
type Props = {
|
|
4
|
+
style?: string;
|
|
5
|
+
variant?: keyof typeof animations;
|
|
6
|
+
inherit?: boolean;
|
|
7
|
+
layout?: boolean;
|
|
8
|
+
ref?: React.RefObject<HTMLDivElement | null>;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare function Animation({ style, variant, inherit, layout, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { motion } from "framer-motion";
|
|
4
|
+
import { animations } from "./configs";
|
|
5
|
+
export function Animation({ style, variant = "fadeInAndOut", inherit, layout, children }) {
|
|
6
|
+
return (_jsx(motion.div, { className: style, variants: animations[variant], initial: inherit ? undefined : "initial", animate: inherit ? undefined : "animate", exit: inherit ? undefined : "exit", layout: layout, children: children }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useContainer, useResize } from "../../hooks";
|
|
5
|
+
import { cn, tv } from "@bouko/style";
|
|
6
|
+
export default function Separator({ style }) {
|
|
7
|
+
const { container, ref } = useContainer();
|
|
8
|
+
const [flow, setFlow] = useState();
|
|
9
|
+
useResize(container, () => {
|
|
10
|
+
const css = getComputedStyle(container);
|
|
11
|
+
setFlow(css.flexDirection);
|
|
12
|
+
});
|
|
13
|
+
return (_jsx("div", { className: cn(styles({ flow }), style), ref: ref }));
|
|
14
|
+
}
|
|
15
|
+
;
|
|
16
|
+
const styles = tv({
|
|
17
|
+
base: "bg-border-dark",
|
|
18
|
+
variants: {
|
|
19
|
+
flow: {
|
|
20
|
+
row: "w-px min-w-px h-full",
|
|
21
|
+
column: "w-full h-px min-h-px"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
marker: ReactNode;
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
index: number;
|
|
6
|
+
centerMarker?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function Item({ marker, content, centerMarker, index }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Animation } from "../animate";
|
|
3
|
+
import { cn } from "@bouko/style";
|
|
4
|
+
;
|
|
5
|
+
export default function Item({ marker, content, centerMarker, index }) {
|
|
6
|
+
return (_jsxs(Animation, { style: cn("flex items-start text-sm", centerMarker && "items-center"), variant: "fadeList", children: [marker, content] }, index));
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
style?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
items: ReactNode[];
|
|
6
|
+
centerMarker?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function BulletList({ style, title, items, centerMarker }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 BulletList({ style, title, items, centerMarker }) {
|
|
8
|
+
return (_jsxs(Animation, { style: cn(styles.base, style), variant: "fadeList", children: [!!title && _jsx("span", { className: styles.title, children: title }), _jsx(Animation, { style: cn(styles.base, style, !!title && "ml-2"), variant: "fadeList", children: items.map((x, i) => (_jsx(Item, { marker: _jsx(Marker, {}), content: x, index: i, centerMarker: centerMarker }, i))) })] }, title));
|
|
9
|
+
}
|
|
10
|
+
function Marker() {
|
|
11
|
+
return (_jsx("span", { className: "mr-3 text-accent", children: "\u2022" }));
|
|
12
|
+
}
|
|
13
|
+
const styles = {
|
|
14
|
+
base: "flex flex-col gap-1 w-full text-primary-dark",
|
|
15
|
+
title: "mb-1 text-base text-primary"
|
|
16
|
+
};
|
|
@@ -0,0 +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 {};
|
|
@@ -0,0 +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), variant: "fadeList", children: [!!title && _jsx("span", { className: styles.title, children: title }), _jsx(Animation, { style: cn(styles.base, style, !!title && "ml-2"), variant: "fadeList", 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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useResizeObserver(element: HTMLElement | null | undefined, action: () => void): void;
|
|
@@ -0,0 +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
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { default as CheckBox } from "./components/checkbox";
|
|
|
7
7
|
export { default as Heading } from "./components/heading";
|
|
8
8
|
export { default as Badge } from "./components/badge";
|
|
9
9
|
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
10
|
+
export * from "./components";
|
|
10
11
|
export * from "./components/flex";
|
|
11
12
|
export * from "./components/button";
|
|
12
13
|
export * from "./core/types";
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { default as CheckBox } from "./components/checkbox";
|
|
|
7
7
|
export { default as Heading } from "./components/heading";
|
|
8
8
|
export { default as Badge } from "./components/badge";
|
|
9
9
|
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
10
|
+
export * from "./components";
|
|
10
11
|
export * from "./components/flex";
|
|
11
12
|
export * from "./components/button";
|
|
12
13
|
export * from "./core/types";
|