@bouko/react 1.5.9 → 1.6.1
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/heading.js +2 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/layout/heading.d.ts +12 -0
- package/dist/components/layout/heading.js +14 -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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export declare const animations: {
|
|
2
|
+
readonly fadeUp: {
|
|
3
|
+
readonly initial: {
|
|
4
|
+
readonly opacity: 0;
|
|
5
|
+
readonly y: 30;
|
|
6
|
+
};
|
|
7
|
+
readonly animate: {
|
|
8
|
+
readonly opacity: 1;
|
|
9
|
+
readonly y: 0;
|
|
10
|
+
readonly transition: {
|
|
11
|
+
readonly duration: 0.3;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
readonly fadeInAndOut: {
|
|
16
|
+
readonly initial: {
|
|
17
|
+
readonly opacity: 0;
|
|
18
|
+
};
|
|
19
|
+
readonly animate: {
|
|
20
|
+
readonly opacity: 1;
|
|
21
|
+
};
|
|
22
|
+
readonly exit: {
|
|
23
|
+
readonly opacity: 0;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly fadeUpAndOut: {
|
|
27
|
+
readonly initial: {
|
|
28
|
+
readonly opacity: 0;
|
|
29
|
+
readonly y: 10;
|
|
30
|
+
};
|
|
31
|
+
readonly animate: {
|
|
32
|
+
readonly opacity: 1;
|
|
33
|
+
readonly y: 0;
|
|
34
|
+
};
|
|
35
|
+
readonly exit: {
|
|
36
|
+
readonly opacity: 1;
|
|
37
|
+
readonly y: -10;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
readonly fadeUpAndOutSlow: {
|
|
41
|
+
readonly initial: {
|
|
42
|
+
readonly opacity: 0;
|
|
43
|
+
readonly y: "-100%";
|
|
44
|
+
};
|
|
45
|
+
readonly animate: {
|
|
46
|
+
readonly opacity: 1;
|
|
47
|
+
readonly y: 0;
|
|
48
|
+
readonly transition: {
|
|
49
|
+
readonly duration: 0.2;
|
|
50
|
+
readonly ease: "easeInOut";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
readonly exit: {
|
|
54
|
+
readonly opacity: 0;
|
|
55
|
+
readonly y: "100%";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
readonly fadeLeft: {
|
|
59
|
+
readonly initial: {
|
|
60
|
+
readonly x: -50;
|
|
61
|
+
readonly opacity: 0;
|
|
62
|
+
};
|
|
63
|
+
readonly animate: {
|
|
64
|
+
readonly x: 0;
|
|
65
|
+
readonly opacity: 1;
|
|
66
|
+
};
|
|
67
|
+
readonly exit: {
|
|
68
|
+
readonly x: 50;
|
|
69
|
+
readonly opacity: 0;
|
|
70
|
+
};
|
|
71
|
+
readonly transition: {
|
|
72
|
+
readonly duration: 0.4;
|
|
73
|
+
readonly ease: "easeOut";
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
readonly growUpAndOut: {
|
|
77
|
+
readonly initial: {
|
|
78
|
+
readonly opacity: 0;
|
|
79
|
+
readonly height: 0;
|
|
80
|
+
};
|
|
81
|
+
readonly animate: {
|
|
82
|
+
readonly opacity: 1;
|
|
83
|
+
readonly height: "auto";
|
|
84
|
+
};
|
|
85
|
+
readonly exit: {
|
|
86
|
+
readonly opacity: 0;
|
|
87
|
+
readonly height: 0;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
readonly fadeStagger: {
|
|
91
|
+
readonly initial: {
|
|
92
|
+
readonly opacity: 0;
|
|
93
|
+
};
|
|
94
|
+
readonly animate: {
|
|
95
|
+
readonly opacity: 1;
|
|
96
|
+
readonly transition: {
|
|
97
|
+
readonly staggerChildren: 0.2;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
readonly fadeList: {
|
|
102
|
+
readonly hidden: {
|
|
103
|
+
readonly opacity: 0;
|
|
104
|
+
readonly x: -10;
|
|
105
|
+
readonly y: 5;
|
|
106
|
+
};
|
|
107
|
+
readonly visible: {
|
|
108
|
+
readonly opacity: 1;
|
|
109
|
+
readonly x: 0;
|
|
110
|
+
readonly y: 0;
|
|
111
|
+
readonly transition: {
|
|
112
|
+
readonly type: "spring";
|
|
113
|
+
readonly stiffness: 350;
|
|
114
|
+
readonly damping: 25;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly popUp: {
|
|
119
|
+
readonly initial: {
|
|
120
|
+
readonly opacity: 0;
|
|
121
|
+
readonly scale: 0.9;
|
|
122
|
+
};
|
|
123
|
+
readonly animate: {
|
|
124
|
+
readonly opacity: 1;
|
|
125
|
+
readonly scale: 1;
|
|
126
|
+
};
|
|
127
|
+
readonly exit: {
|
|
128
|
+
readonly opacity: 0;
|
|
129
|
+
readonly scale: 0.9;
|
|
130
|
+
};
|
|
131
|
+
readonly transition: {
|
|
132
|
+
readonly duration: 0.2;
|
|
133
|
+
readonly ease: readonly [0.23, 1, 0.32, 1];
|
|
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
|
+
}
|
|
@@ -9,6 +9,6 @@ const base = {
|
|
|
9
9
|
container: "gap-2 items-center",
|
|
10
10
|
subcontainer: "flex grow flex-col",
|
|
11
11
|
badge: "mb-2",
|
|
12
|
-
title: "flex items-center gap-2
|
|
13
|
-
subtitle: "font-semibold text-primary-lighter"
|
|
12
|
+
title: "flex items-center gap-2 font-bold",
|
|
13
|
+
subtitle: "text-sm font-semibold text-primary-lighter"
|
|
14
14
|
};
|
package/dist/components/index.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type HeadingProps = {
|
|
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 }: HeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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 text-lg font-bold",
|
|
13
|
+
subtitle: "font-semibold text-primary-lighter"
|
|
14
|
+
};
|
|
@@ -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
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { default as Select } from "./components/select";
|
|
|
4
4
|
export { default as MultipleChoice } from "./components/multiple-choice";
|
|
5
5
|
export { default as Attachment } from "./components/attachment";
|
|
6
6
|
export { default as CheckBox } from "./components/checkbox";
|
|
7
|
-
export { default as Heading } from "./components/heading";
|
|
8
7
|
export { default as Badge } from "./components/badge";
|
|
9
8
|
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
10
9
|
export * from "./components";
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export { default as Select } from "./components/select";
|
|
|
4
4
|
export { default as MultipleChoice } from "./components/multiple-choice";
|
|
5
5
|
export { default as Attachment } from "./components/attachment";
|
|
6
6
|
export { default as CheckBox } from "./components/checkbox";
|
|
7
|
-
export { default as Heading } from "./components/heading";
|
|
8
7
|
export { default as Badge } from "./components/badge";
|
|
9
8
|
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
10
9
|
export * from "./components";
|