react-frontend-common-components 0.0.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/index.d.ts +85 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +26 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +34 -0
- package/rollup.config.js +44 -0
- package/src/components/app-avatar/app-avatar.tsx +24 -0
- package/src/components/app-back-arrow/app-back-arrow.css +17 -0
- package/src/components/app-back-arrow/app-back-arrow.tsx +30 -0
- package/src/components/app-badge/app-badge.css +11 -0
- package/src/components/app-badge/app-badge.tsx +44 -0
- package/src/components/app-bread-crumb/app-bread-crumb.tsx +16 -0
- package/src/components/app-button/app-button.css +13 -0
- package/src/components/app-button/app-button.tsx +51 -0
- package/src/components/app-card/app-card.css +8 -0
- package/src/components/app-card/app-card.tsx +43 -0
- package/src/components/app-carousel/app-carousel.css +68 -0
- package/src/components/app-carousel/app-carousel.tsx +62 -0
- package/src/components/app-chart/app-chart.css +6 -0
- package/src/components/app-chart/app-chart.tsx +97 -0
- package/src/components/app-checkbox-text/app-checkbox-text.css +12 -0
- package/src/components/app-checkbox-text/app-checkbox-text.tsx +20 -0
- package/src/components/app-collapse/app-collapse.tsx +57 -0
- package/src/components/app-custom-loader/app-custom-loader.css +116 -0
- package/src/components/app-custom-loader/app-custom-loader.tsx +23 -0
- package/src/components/app-divider/app-divider.tsx +16 -0
- package/src/components/app-float-button/app-float-button.tsx +23 -0
- package/src/components/app-image-box/app-image-box.css +23 -0
- package/src/components/app-image-box/app-image-box.tsx +38 -0
- package/src/components/app-input/app-input.css +61 -0
- package/src/components/app-input/app-input.tsx +89 -0
- package/src/components/app-label/app-label.css +5 -0
- package/src/components/app-label/app-label.tsx +34 -0
- package/src/components/app-list/app-list.tsx +26 -0
- package/src/components/app-loader/app-loader.css +16 -0
- package/src/components/app-loader/app-loader.tsx +28 -0
- package/src/components/app-location-map/app-location-map.css +4 -0
- package/src/components/app-location-map/app-location-map.tsx +62 -0
- package/src/components/app-modal/app-modal.css +35 -0
- package/src/components/app-modal/app-modal.tsx +58 -0
- package/src/components/app-otp-field/app-otp-field.css +31 -0
- package/src/components/app-otp-field/app-otp-field.tsx +70 -0
- package/src/components/app-pagination/app-pagination.tsx +40 -0
- package/src/components/app-password-input/app-password-input.css +41 -0
- package/src/components/app-password-input/app-password-input.tsx +79 -0
- package/src/components/app-phone-field/app-phone-field.css +61 -0
- package/src/components/app-phone-field/app-phone-field.tsx +60 -0
- package/src/components/app-popover/app-popover.css +5 -0
- package/src/components/app-popover/app-popover.tsx +45 -0
- package/src/components/app-progress/app-progress.tsx +40 -0
- package/src/components/app-radio-group/app-radio-group.css +6 -0
- package/src/components/app-radio-group/app-radio-group.tsx +45 -0
- package/src/components/app-select/app-select.css +21 -0
- package/src/components/app-select/app-select.tsx +53 -0
- package/src/components/app-select-add/app-select-add.css +21 -0
- package/src/components/app-select-add/app-select-add.tsx +34 -0
- package/src/components/app-sidebar/app-sidebar.css +46 -0
- package/src/components/app-sidebar/app-sidebar.tsx +60 -0
- package/src/components/app-tab/app-tab.css +22 -0
- package/src/components/app-tab/app-tab.tsx +31 -0
- package/src/components/app-table/app-table.tsx +42 -0
- package/src/components/app-tag/app-tag.css +11 -0
- package/src/components/app-tag/app-tag.tsx +48 -0
- package/src/components/app-textarea/app-textarea.css +19 -0
- package/src/components/app-textarea/app-textarea.tsx +59 -0
- package/src/components/app-title/app-title.css +12 -0
- package/src/components/app-title/app-title.tsx +28 -0
- package/src/components/app-toggle-button/app-toggle-button.css +27 -0
- package/src/components/app-toggle-button/app-toggle-button.tsx +43 -0
- package/src/components/app-upload-image/app-upload-image.css +26 -0
- package/src/components/app-upload-image/app-upload-image.tsx +90 -0
- package/src/components/over-view-card/over-view-card.css +16 -0
- package/src/components/over-view-card/over-view-card.tsx +22 -0
- package/src/index.ts +5 -0
- package/src/themes/icons/icons.tsx +131 -0
- package/src/themes/images/profile-img.svg +14 -0
- package/tsconfig.json +20 -0
package/package.json
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"name": "react-frontend-common-components",
|
3
|
+
"version": "0.0.1",
|
4
|
+
"description": "Reusable frontend library",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"module": "dist/index.mjs",
|
7
|
+
"types": "dist/index.d.ts",
|
8
|
+
"scripts": {
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
10
|
+
"rollup": "rollup -c --bundleConfigAsCjs"
|
11
|
+
},
|
12
|
+
"author": "",
|
13
|
+
"license": "ISC",
|
14
|
+
"devDependencies": {
|
15
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
16
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
17
|
+
"@rollup/plugin-terser": "^0.4.4",
|
18
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
19
|
+
"react": "^18.3.1",
|
20
|
+
"rollup-plugin-dts": "^6.1.1",
|
21
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
22
|
+
"tslib": "^2.7.0",
|
23
|
+
"typescript": "^5.5.4"
|
24
|
+
},
|
25
|
+
"dependencies": {
|
26
|
+
"@types/react": "^18.3.5",
|
27
|
+
"@types/uuid": "^10.0.0",
|
28
|
+
"antd": "^5.20.5",
|
29
|
+
"react-icons": "^5.3.0",
|
30
|
+
"rollup": "^4.21.2",
|
31
|
+
"rollup-plugin-postcss": "^4.0.2",
|
32
|
+
"uuid": "^10.0.0"
|
33
|
+
}
|
34
|
+
}
|
package/rollup.config.js
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
import resolve from "@rollup/plugin-node-resolve";
|
2
|
+
import commonjs from "@rollup/plugin-commonjs";
|
3
|
+
import typescript from "@rollup/plugin-typescript";
|
4
|
+
import dts from "rollup-plugin-dts";
|
5
|
+
import terser from "@rollup/plugin-terser";
|
6
|
+
import peerDepsExternal from "rollup-plugin-peer-deps-external";
|
7
|
+
import postcss from "rollup-plugin-postcss";
|
8
|
+
|
9
|
+
const packageJson = require("./package.json");
|
10
|
+
|
11
|
+
export default [
|
12
|
+
// CommonJS and ES module output
|
13
|
+
{
|
14
|
+
input: "src/index.ts",
|
15
|
+
output: [
|
16
|
+
{
|
17
|
+
file: packageJson.main, // CommonJS
|
18
|
+
format: "cjs",
|
19
|
+
sourcemap: true,
|
20
|
+
},
|
21
|
+
{
|
22
|
+
file: packageJson.module, // ES module
|
23
|
+
format: "esm",
|
24
|
+
sourcemap: true,
|
25
|
+
},
|
26
|
+
],
|
27
|
+
plugins: [
|
28
|
+
peerDepsExternal(),
|
29
|
+
resolve(),
|
30
|
+
commonjs(),
|
31
|
+
typescript({ tsconfig: "./tsconfig.json" }),
|
32
|
+
terser(),
|
33
|
+
postcss(),
|
34
|
+
],
|
35
|
+
external: ["react", "react-dom"],
|
36
|
+
},
|
37
|
+
// TypeScript declaration files
|
38
|
+
{
|
39
|
+
input: "src/index.ts",
|
40
|
+
output: [{ file: packageJson.types }],
|
41
|
+
plugins: [dts.default()],
|
42
|
+
external: [/\.css/],
|
43
|
+
},
|
44
|
+
];
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Avatar } from "antd";
|
3
|
+
import type { AvatarProps } from "antd";
|
4
|
+
import { UserOutlined } from "@ant-design/icons";
|
5
|
+
|
6
|
+
interface AppAvatarProps extends AvatarProps {
|
7
|
+
fallbackIcon?: React.ReactNode;
|
8
|
+
className?: string;
|
9
|
+
}
|
10
|
+
|
11
|
+
const AppAvatar = ({
|
12
|
+
src,
|
13
|
+
fallbackIcon = <UserOutlined />,
|
14
|
+
className,
|
15
|
+
...props
|
16
|
+
}: AppAvatarProps) => {
|
17
|
+
return (
|
18
|
+
<div className={className}>
|
19
|
+
<Avatar src={src} icon={!src ? fallbackIcon : undefined} {...props} />
|
20
|
+
</div>
|
21
|
+
);
|
22
|
+
};
|
23
|
+
|
24
|
+
export default AppAvatar;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import Icons from "../../themes/icons/icons";
|
3
|
+
import "./app-back-arrow.css";
|
4
|
+
|
5
|
+
interface BackArrowProps {
|
6
|
+
text?: string;
|
7
|
+
href: string;
|
8
|
+
className?: string;
|
9
|
+
backIcon?: React.ReactNode;
|
10
|
+
}
|
11
|
+
|
12
|
+
const AppBackArrow = ({
|
13
|
+
text = "Back",
|
14
|
+
href,
|
15
|
+
className,
|
16
|
+
backIcon,
|
17
|
+
}: BackArrowProps) => {
|
18
|
+
const handleNavigation = () => {
|
19
|
+
window.location.href = href;
|
20
|
+
};
|
21
|
+
|
22
|
+
return (
|
23
|
+
<div className={`backArrow ${className}`} onClick={handleNavigation}>
|
24
|
+
<span className={"icon"}>{backIcon || Icons.backArrow}</span>
|
25
|
+
{text && <span className={"text"}>{text}</span>}
|
26
|
+
</div>
|
27
|
+
);
|
28
|
+
};
|
29
|
+
|
30
|
+
export default AppBackArrow;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Badge, BadgeProps as AntdBadgeProps } from "antd";
|
3
|
+
import "./app-badge.css";
|
4
|
+
|
5
|
+
interface AppBadgeProps extends AntdBadgeProps {
|
6
|
+
content?: React.ReactNode;
|
7
|
+
children: React.ReactNode;
|
8
|
+
className?: string;
|
9
|
+
ribbon?: {
|
10
|
+
text: React.ReactNode;
|
11
|
+
color?: string;
|
12
|
+
placement?: "start" | "end";
|
13
|
+
};
|
14
|
+
}
|
15
|
+
|
16
|
+
const AppBadge = ({
|
17
|
+
content,
|
18
|
+
children,
|
19
|
+
className,
|
20
|
+
ribbon,
|
21
|
+
...props
|
22
|
+
}: AppBadgeProps) => {
|
23
|
+
return (
|
24
|
+
<div className={`appBadge ${className}`}>
|
25
|
+
<Badge count={content} {...props}>
|
26
|
+
{ribbon ? (
|
27
|
+
<div className={"ribbonWrapper"}>
|
28
|
+
<Badge.Ribbon
|
29
|
+
text={ribbon.text}
|
30
|
+
color={ribbon.color}
|
31
|
+
placement={ribbon.placement}
|
32
|
+
>
|
33
|
+
{children}
|
34
|
+
</Badge.Ribbon>
|
35
|
+
</div>
|
36
|
+
) : (
|
37
|
+
children
|
38
|
+
)}
|
39
|
+
</Badge>
|
40
|
+
</div>
|
41
|
+
);
|
42
|
+
};
|
43
|
+
|
44
|
+
export default AppBadge;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Breadcrumb, BreadcrumbProps } from "antd";
|
3
|
+
|
4
|
+
interface AppBreadcrumbProps extends BreadcrumbProps {
|
5
|
+
className?: string;
|
6
|
+
}
|
7
|
+
|
8
|
+
const AppBreadcrumb = ({ className, ...props }: AppBreadcrumbProps) => {
|
9
|
+
return (
|
10
|
+
<div className={className}>
|
11
|
+
<Breadcrumb {...props} />
|
12
|
+
</div>
|
13
|
+
);
|
14
|
+
};
|
15
|
+
|
16
|
+
export default AppBreadcrumb;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { Button } from "antd";
|
2
|
+
import { MouseEventHandler } from "react";
|
3
|
+
import { SizeType } from "antd/lib/config-provider/SizeContext";
|
4
|
+
import "./app-button.css";
|
5
|
+
import React from "react";
|
6
|
+
|
7
|
+
interface AppButtonProps {
|
8
|
+
size?: "small" | "middle" | "large" | "default" | undefined;
|
9
|
+
className?: string;
|
10
|
+
handleClick?: MouseEventHandler<HTMLElement>;
|
11
|
+
icon?: React.ReactNode;
|
12
|
+
text?: string;
|
13
|
+
disabled?: boolean;
|
14
|
+
iconPosition?: string;
|
15
|
+
isLoading?: boolean;
|
16
|
+
type?: "default" | "text" | "link" | "primary" | "dashed" | undefined;
|
17
|
+
}
|
18
|
+
|
19
|
+
const AppButton = ({
|
20
|
+
type,
|
21
|
+
size,
|
22
|
+
className,
|
23
|
+
handleClick,
|
24
|
+
icon,
|
25
|
+
text,
|
26
|
+
disabled,
|
27
|
+
iconPosition,
|
28
|
+
isLoading,
|
29
|
+
}: AppButtonProps) => {
|
30
|
+
return (
|
31
|
+
<div className={`appButton ${className}`}>
|
32
|
+
<Button
|
33
|
+
disabled={disabled}
|
34
|
+
type={type}
|
35
|
+
className={[
|
36
|
+
"customBtn",
|
37
|
+
icon ? "btn-icon" : "",
|
38
|
+
iconPosition === "right" ? "iconRight" : "",
|
39
|
+
].join(" ")}
|
40
|
+
size={size as SizeType}
|
41
|
+
onClick={handleClick}
|
42
|
+
icon={icon}
|
43
|
+
loading={isLoading}
|
44
|
+
>
|
45
|
+
{text}
|
46
|
+
</Button>
|
47
|
+
</div>
|
48
|
+
);
|
49
|
+
};
|
50
|
+
|
51
|
+
export default AppButton;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Card } from "antd";
|
3
|
+
import { CardProps } from "antd/lib/card";
|
4
|
+
import "./app-card.css";
|
5
|
+
|
6
|
+
interface AppCardProps extends CardProps {
|
7
|
+
title?: React.ReactNode;
|
8
|
+
extra?: React.ReactNode;
|
9
|
+
cover?: React.ReactNode;
|
10
|
+
hoverable?: boolean;
|
11
|
+
actions?: React.ReactNode[];
|
12
|
+
className?: string;
|
13
|
+
borderless?: boolean;
|
14
|
+
}
|
15
|
+
|
16
|
+
const AppCard = ({
|
17
|
+
title,
|
18
|
+
extra,
|
19
|
+
cover,
|
20
|
+
hoverable = false,
|
21
|
+
actions,
|
22
|
+
className,
|
23
|
+
borderless,
|
24
|
+
...cardProps
|
25
|
+
}: AppCardProps) => {
|
26
|
+
return (
|
27
|
+
<div className={`appCard ${className}`}>
|
28
|
+
<Card
|
29
|
+
title={title}
|
30
|
+
extra={extra}
|
31
|
+
cover={cover}
|
32
|
+
hoverable={hoverable}
|
33
|
+
className={`${borderless ? "borderless" : ""}`}
|
34
|
+
actions={actions}
|
35
|
+
{...cardProps}
|
36
|
+
>
|
37
|
+
{cardProps.children}
|
38
|
+
</Card>
|
39
|
+
</div>
|
40
|
+
);
|
41
|
+
};
|
42
|
+
|
43
|
+
export default AppCard;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
.appCarousel {
|
2
|
+
position: relative;
|
3
|
+
width: 100%;
|
4
|
+
|
5
|
+
.ant-carousel .slick-slide {
|
6
|
+
display: flex;
|
7
|
+
justify-content: center;
|
8
|
+
align-items: center;
|
9
|
+
overflow: hidden;
|
10
|
+
}
|
11
|
+
|
12
|
+
.slick-dots {
|
13
|
+
gap: 0.5rem;
|
14
|
+
align-items: center;
|
15
|
+
li {
|
16
|
+
width: 6px !important;
|
17
|
+
border-radius: 50%;
|
18
|
+
margin: 0;
|
19
|
+
button {
|
20
|
+
height: 6px;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
.carouselItem {
|
27
|
+
width: 100%;
|
28
|
+
height: 100%;
|
29
|
+
display: flex;
|
30
|
+
justify-content: center;
|
31
|
+
align-items: center;
|
32
|
+
|
33
|
+
img {
|
34
|
+
max-width: 100%;
|
35
|
+
max-height: 100%;
|
36
|
+
object-fit: cover;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
.prevArrow,
|
41
|
+
.nextArrow {
|
42
|
+
position: absolute;
|
43
|
+
top: 50%;
|
44
|
+
transform: translateY(-50%);
|
45
|
+
border: none;
|
46
|
+
color: rgb(0, 0, 0);
|
47
|
+
font-size: 1.5rem;
|
48
|
+
cursor: pointer;
|
49
|
+
z-index: 1;
|
50
|
+
display: flex;
|
51
|
+
cursor: pointer;
|
52
|
+
transition: background 0.3s ease;
|
53
|
+
}
|
54
|
+
|
55
|
+
.prevArrow {
|
56
|
+
left: 10px;
|
57
|
+
}
|
58
|
+
|
59
|
+
.nextArrow {
|
60
|
+
right: 10px;
|
61
|
+
}
|
62
|
+
|
63
|
+
.carouselLines {
|
64
|
+
display: flex;
|
65
|
+
justify-content: center;
|
66
|
+
align-items: center;
|
67
|
+
margin-top: 10px;
|
68
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import React, { useRef } from "react";
|
2
|
+
import { Carousel } from "antd";
|
3
|
+
import type { CarouselProps } from "antd";
|
4
|
+
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
5
|
+
import "./app-carousel.css";
|
6
|
+
|
7
|
+
interface AppCarouselProps extends CarouselProps {
|
8
|
+
items: React.ReactNode[];
|
9
|
+
className?: string;
|
10
|
+
nxtIcon?: React.ReactNode;
|
11
|
+
prevIcon?: React.ReactNode;
|
12
|
+
showIcon?: boolean;
|
13
|
+
showDots?: boolean;
|
14
|
+
showLines?: boolean;
|
15
|
+
autoplay?: boolean;
|
16
|
+
}
|
17
|
+
|
18
|
+
const AppCarousel = ({
|
19
|
+
items,
|
20
|
+
className,
|
21
|
+
nxtIcon,
|
22
|
+
prevIcon,
|
23
|
+
showIcon,
|
24
|
+
showDots = true,
|
25
|
+
autoplay,
|
26
|
+
...rest
|
27
|
+
}: AppCarouselProps) => {
|
28
|
+
const carouselRef = useRef<any>(null);
|
29
|
+
|
30
|
+
const handlePrev = () => {
|
31
|
+
carouselRef.current?.prev();
|
32
|
+
};
|
33
|
+
|
34
|
+
const handleNext = () => {
|
35
|
+
carouselRef.current?.next();
|
36
|
+
};
|
37
|
+
|
38
|
+
return (
|
39
|
+
<div className={`appCarousel ${className}`}>
|
40
|
+
{showIcon && (
|
41
|
+
<>
|
42
|
+
<span className={"prevArrow"} onClick={handlePrev}>
|
43
|
+
{prevIcon || <LeftOutlined />}
|
44
|
+
</span>
|
45
|
+
<span className={"nextArrow"} onClick={handleNext}>
|
46
|
+
{nxtIcon || <RightOutlined />}
|
47
|
+
</span>
|
48
|
+
</>
|
49
|
+
)}
|
50
|
+
|
51
|
+
<Carousel autoplay={autoplay} ref={carouselRef} dots={showDots} {...rest}>
|
52
|
+
{items.map((item, index) => (
|
53
|
+
<div key={index} className={"carouselItem"}>
|
54
|
+
{item}
|
55
|
+
</div>
|
56
|
+
))}
|
57
|
+
</Carousel>
|
58
|
+
</div>
|
59
|
+
);
|
60
|
+
};
|
61
|
+
|
62
|
+
export default AppCarousel;
|
@@ -0,0 +1,97 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Bar, Line, Pie, Doughnut } from "react-chartjs-2";
|
3
|
+
import {
|
4
|
+
Chart as ChartJS,
|
5
|
+
CategoryScale,
|
6
|
+
LinearScale,
|
7
|
+
BarElement,
|
8
|
+
LineElement,
|
9
|
+
PointElement,
|
10
|
+
ArcElement,
|
11
|
+
Title,
|
12
|
+
Tooltip,
|
13
|
+
Legend,
|
14
|
+
ChartData,
|
15
|
+
ChartOptions,
|
16
|
+
} from "chart.js";
|
17
|
+
import "./app-chart.css";
|
18
|
+
|
19
|
+
// Register the necessary modules
|
20
|
+
ChartJS.register(
|
21
|
+
CategoryScale,
|
22
|
+
LinearScale,
|
23
|
+
BarElement,
|
24
|
+
LineElement,
|
25
|
+
PointElement,
|
26
|
+
ArcElement,
|
27
|
+
Title,
|
28
|
+
Tooltip,
|
29
|
+
Legend
|
30
|
+
);
|
31
|
+
|
32
|
+
type ChartType = "bar" | "line" | "pie" | "doughnut";
|
33
|
+
|
34
|
+
interface AppChartProps {
|
35
|
+
type: ChartType;
|
36
|
+
data: ChartData<"bar" | "line" | "pie" | "doughnut">;
|
37
|
+
options?: ChartOptions<"bar" | "line" | "pie" | "doughnut">;
|
38
|
+
className?: string;
|
39
|
+
height?: number;
|
40
|
+
width?: number;
|
41
|
+
}
|
42
|
+
|
43
|
+
const AppChart = ({
|
44
|
+
type,
|
45
|
+
data,
|
46
|
+
options,
|
47
|
+
className,
|
48
|
+
height = 400,
|
49
|
+
width = 600,
|
50
|
+
}: AppChartProps) => {
|
51
|
+
const renderChart = () => {
|
52
|
+
switch (type) {
|
53
|
+
case "bar":
|
54
|
+
return (
|
55
|
+
<Bar
|
56
|
+
data={data as ChartData<"bar">}
|
57
|
+
options={options as ChartOptions<"bar">}
|
58
|
+
className={className}
|
59
|
+
/>
|
60
|
+
);
|
61
|
+
case "line":
|
62
|
+
return (
|
63
|
+
<Line
|
64
|
+
data={data as ChartData<"line">}
|
65
|
+
options={options as ChartOptions<"line">}
|
66
|
+
className={className}
|
67
|
+
/>
|
68
|
+
);
|
69
|
+
case "pie":
|
70
|
+
return (
|
71
|
+
<Pie
|
72
|
+
data={data as ChartData<"pie">}
|
73
|
+
options={options as ChartOptions<"pie">}
|
74
|
+
className={className}
|
75
|
+
/>
|
76
|
+
);
|
77
|
+
case "doughnut":
|
78
|
+
return (
|
79
|
+
<Doughnut
|
80
|
+
data={data as ChartData<"doughnut">}
|
81
|
+
options={options as ChartOptions<"doughnut">}
|
82
|
+
className={className}
|
83
|
+
/>
|
84
|
+
);
|
85
|
+
default:
|
86
|
+
return null;
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
return (
|
91
|
+
<div style={{ height, width }} className={`appChart ${className}`}>
|
92
|
+
{renderChart()}
|
93
|
+
</div>
|
94
|
+
);
|
95
|
+
};
|
96
|
+
|
97
|
+
export default AppChart;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Checkbox } from "antd";
|
3
|
+
import "./app-checkbox-text.css";
|
4
|
+
|
5
|
+
interface Type {
|
6
|
+
text: string;
|
7
|
+
className?: string;
|
8
|
+
}
|
9
|
+
|
10
|
+
const AppCheckboxText = ({ text, className }: Type) => {
|
11
|
+
return (
|
12
|
+
<div className={`appCheckboxText ${className}`}>
|
13
|
+
<Checkbox className={"checkboxText"}>
|
14
|
+
<span dangerouslySetInnerHTML={{ __html: text }} />
|
15
|
+
</Checkbox>
|
16
|
+
</div>
|
17
|
+
);
|
18
|
+
};
|
19
|
+
|
20
|
+
export default AppCheckboxText;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Collapse } from "antd";
|
3
|
+
import { CollapseProps, CollapsePanelProps } from "antd/lib/collapse";
|
4
|
+
|
5
|
+
const { Panel } = Collapse;
|
6
|
+
|
7
|
+
interface AppCollapseProps extends CollapseProps {
|
8
|
+
panels?: {
|
9
|
+
key: string;
|
10
|
+
header: React.ReactNode;
|
11
|
+
content: React.ReactNode;
|
12
|
+
collapsible?: CollapsePanelProps["collapsible"];
|
13
|
+
}[];
|
14
|
+
className?: string;
|
15
|
+
}
|
16
|
+
|
17
|
+
const AppCollapse = ({
|
18
|
+
panels = [],
|
19
|
+
defaultActiveKey,
|
20
|
+
onChange,
|
21
|
+
expandIconPosition,
|
22
|
+
ghost,
|
23
|
+
accordion,
|
24
|
+
expandIcon,
|
25
|
+
size,
|
26
|
+
bordered,
|
27
|
+
activeKey,
|
28
|
+
className,
|
29
|
+
...restProps
|
30
|
+
}: AppCollapseProps) => {
|
31
|
+
const items = panels.map((panel) => ({
|
32
|
+
key: panel.key,
|
33
|
+
label: panel.header,
|
34
|
+
children: panel.content,
|
35
|
+
collapsible: panel.collapsible,
|
36
|
+
}));
|
37
|
+
|
38
|
+
return (
|
39
|
+
<div className={className}>
|
40
|
+
<Collapse
|
41
|
+
defaultActiveKey={defaultActiveKey}
|
42
|
+
onChange={onChange}
|
43
|
+
expandIconPosition={expandIconPosition}
|
44
|
+
ghost={ghost}
|
45
|
+
accordion={accordion}
|
46
|
+
expandIcon={expandIcon}
|
47
|
+
size={size}
|
48
|
+
bordered={bordered}
|
49
|
+
activeKey={activeKey}
|
50
|
+
items={items}
|
51
|
+
{...restProps}
|
52
|
+
/>
|
53
|
+
</div>
|
54
|
+
);
|
55
|
+
};
|
56
|
+
|
57
|
+
export default AppCollapse;
|