funuicss 2.7.15 → 3.0.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/css/fun.css +6663 -6653
- package/index.d.ts +3 -0
- package/index.js +7 -1
- package/js/google/AnalyticsHandler.d.ts +10 -0
- package/js/google/AnalyticsHandler.js +20 -0
- package/js/google/analytics.d.ts +6 -0
- package/js/google/analytics.js +53 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/ui/flex/Flex.d.ts +3 -8
- package/ui/flex/Flex.js +15 -9
- package/ui/flex/FlexItem.d.ts +17 -0
- package/ui/flex/FlexItem.js +39 -0
- package/ui/notification/Notification.d.ts +7 -3
- package/ui/notification/Notification.js +18 -14
- package/ui/scrolltotop/ScrollToTop.d.ts +3 -0
- package/ui/scrolltotop/ScrollToTop.js +61 -0
- package/ui/video/Video.d.ts +2 -1
- package/ui/video/Video.js +10 -10
- package/ui/video/videoShortcuts.d.ts +1 -1
- package/ui/video/videoShortcuts.js +2 -2
- package/ui/view/View.d.ts +27 -38
- package/ui/view/View.js +10 -38
- package/ui/vista/Vista.d.ts +6 -1
- package/ui/vista/Vista.js +33 -4
- package/assets/colors/colors.d.ts +0 -347
- package/assets/colors/colors.js +0 -348
- package/assets/colors/colors.tsx +0 -697
- package/hooks/useHls.tsx +0 -69
- package/index.tsx +0 -57
- package/js/Cookie.tsx +0 -91
- package/js/Fun.jsx +0 -225
- package/js/Fun.tsx +0 -239
- package/tsconfig.json +0 -20
- package/types/react-easy-export.d.ts +0 -4
- package/ui/ScrollInView/ScrollInView.tsx +0 -69
- package/ui/accordion/Accordion.tsx +0 -125
- package/ui/alert/Alert.tsx +0 -106
- package/ui/aos/AOS.tsx +0 -24
- package/ui/appbar/AppBar.tsx +0 -115
- package/ui/appbar/Hamburger.tsx +0 -30
- package/ui/avatar/Avatar.tsx +0 -52
- package/ui/blob/Blob.tsx +0 -34
- package/ui/breadcrumb/BreadCrumb.tsx +0 -48
- package/ui/button/Button.tsx +0 -153
- package/ui/calendar/ActivityCard.tsx +0 -27
- package/ui/calendar/Calendar.tsx +0 -343
- package/ui/card/Card.tsx +0 -117
- package/ui/card/CardBody.tsx +0 -14
- package/ui/card/CardFab.tsx +0 -16
- package/ui/card/CardFooter.tsx +0 -14
- package/ui/card/CardHeader.tsx +0 -14
- package/ui/carousel/Carousel.tsx +0 -148
- package/ui/chart/Bar.tsx +0 -121
- package/ui/chart/Line.tsx +0 -186
- package/ui/chart/Pie.tsx +0 -127
- package/ui/container/Container.tsx +0 -38
- package/ui/datepicker/DatePicker.tsx +0 -148
- package/ui/div/Div.tsx +0 -61
- package/ui/drop/Action.tsx +0 -16
- package/ui/drop/Down.tsx +0 -18
- package/ui/drop/Dropdown.tsx +0 -117
- package/ui/drop/Item.tsx +0 -15
- package/ui/drop/Menu.tsx +0 -40
- package/ui/drop/Up.tsx +0 -18
- package/ui/flex/Flex.tsx +0 -115
- package/ui/grid/Col.tsx +0 -43
- package/ui/grid/Grid.tsx +0 -37
- package/ui/input/Iconic.tsx +0 -43
- package/ui/input/Input.tsx +0 -409
- package/ui/list/Item.tsx +0 -18
- package/ui/list/List.tsx +0 -45
- package/ui/loader/Loader.tsx +0 -47
- package/ui/modal/Action.tsx +0 -14
- package/ui/modal/Close.tsx +0 -14
- package/ui/modal/Content.tsx +0 -15
- package/ui/modal/Header.tsx +0 -19
- package/ui/modal/Modal.tsx +0 -140
- package/ui/notification/Content.tsx +0 -14
- package/ui/notification/Footer.tsx +0 -14
- package/ui/notification/Header.tsx +0 -14
- package/ui/notification/Notification.tsx +0 -62
- package/ui/page/NotFound.tsx +0 -67
- package/ui/page/UnAuthorized.tsx +0 -64
- package/ui/progress/Bar.tsx +0 -114
- package/ui/richtext/RichText.tsx +0 -156
- package/ui/sidebar/SideBar.tsx +0 -202
- package/ui/sidebar/SideContent.tsx +0 -16
- package/ui/slider/Slider.tsx +0 -75
- package/ui/snackbar/SnackBar.tsx +0 -56
- package/ui/specials/Circle.tsx +0 -49
- package/ui/specials/CircleGroup.tsx +0 -49
- package/ui/specials/FullCenteredPage.tsx +0 -25
- package/ui/specials/Hr.tsx +0 -16
- package/ui/specials/RowFlex.tsx +0 -56
- package/ui/specials/Section.tsx +0 -18
- package/ui/step/Container.tsx +0 -27
- package/ui/step/Header.tsx +0 -16
- package/ui/step/Line.tsx +0 -17
- package/ui/step/Step.tsx +0 -17
- package/ui/table/Body.tsx +0 -10
- package/ui/table/Data.tsx +0 -15
- package/ui/table/Head.tsx +0 -10
- package/ui/table/Row.tsx +0 -16
- package/ui/table/Table.tsx +0 -372
- package/ui/text/Text.tsx +0 -179
- package/ui/theme/dark.tsx +0 -45
- package/ui/theme/darkenUtils.ts +0 -15
- package/ui/theme/theme.tsx +0 -48
- package/ui/theme/themes.ts +0 -154
- package/ui/tooltip/Tip.tsx +0 -34
- package/ui/tooltip/ToolTip.tsx +0 -20
- package/ui/video/Video.tsx +0 -347
- package/ui/video/videoFunctions.tsx +0 -19
- package/ui/video/videoShortcuts.ts +0 -12
- package/ui/view/View.tsx +0 -157
- package/ui/vista/Vista.tsx +0 -165
- package/utils/Emojis.tsx +0 -59
- package/utils/Functions.tsx +0 -9
- package/utils/getCssVariable.tsx +0 -9
package/ui/modal/Modal.tsx
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import ModalHeader from './Header';
|
|
4
|
-
import ModalContent from './Content';
|
|
5
|
-
import ModalAction from './Action';
|
|
6
|
-
import { PiX , PiPaperPlaneRight} from 'react-icons/pi';
|
|
7
|
-
import Button from '../button/Button';
|
|
8
|
-
|
|
9
|
-
interface ModalProps {
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
funcss?: string;
|
|
12
|
-
animation?: string;
|
|
13
|
-
duration?: number;
|
|
14
|
-
open: boolean;
|
|
15
|
-
hideClose: boolean;
|
|
16
|
-
setOpen: (val: boolean) => void;
|
|
17
|
-
maxWidth?: string;
|
|
18
|
-
maxHeight?: string;
|
|
19
|
-
height?: string;
|
|
20
|
-
width?: string;
|
|
21
|
-
backdrop?: boolean;
|
|
22
|
-
body?: React.ReactNode;
|
|
23
|
-
bodycss?: string;
|
|
24
|
-
title?: React.ReactNode;
|
|
25
|
-
okIcon?: React.ReactNode;
|
|
26
|
-
titlecss?: string;
|
|
27
|
-
footer?: React.ReactNode;
|
|
28
|
-
footercss?: string;
|
|
29
|
-
close?: React.ReactNode;
|
|
30
|
-
closecss?: string;
|
|
31
|
-
id?: string;
|
|
32
|
-
position?: string;
|
|
33
|
-
flat?: boolean;
|
|
34
|
-
onOk?: () => void; // 👈 new
|
|
35
|
-
onOkText?: string; // 👈 new
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default function Modal({
|
|
39
|
-
children,
|
|
40
|
-
funcss,
|
|
41
|
-
animation,
|
|
42
|
-
duration,
|
|
43
|
-
open,
|
|
44
|
-
setOpen,
|
|
45
|
-
maxWidth,
|
|
46
|
-
maxHeight,
|
|
47
|
-
okIcon,
|
|
48
|
-
height,
|
|
49
|
-
hideClose = false,
|
|
50
|
-
width,
|
|
51
|
-
backdrop = false,
|
|
52
|
-
title,
|
|
53
|
-
titlecss,
|
|
54
|
-
body,
|
|
55
|
-
bodycss,
|
|
56
|
-
footer,
|
|
57
|
-
footercss,
|
|
58
|
-
close,
|
|
59
|
-
closecss,
|
|
60
|
-
position,
|
|
61
|
-
id,
|
|
62
|
-
flat,
|
|
63
|
-
onOk, // 👈 added
|
|
64
|
-
onOkText, // 👈 added
|
|
65
|
-
...rest
|
|
66
|
-
}: ModalProps) {
|
|
67
|
-
const modalId = id || '_mymodal';
|
|
68
|
-
|
|
69
|
-
const handleClickOutside = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
70
|
-
if (e.target && (e.target as HTMLElement).id === modalId) {
|
|
71
|
-
setOpen(false);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const handleOkClick = () => {
|
|
76
|
-
if (onOk) onOk();
|
|
77
|
-
else setOpen(false); // default behavior if no onOk is provided
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
if (!open) return null;
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<div
|
|
84
|
-
className={`modal ${backdrop ? 'backdrop' : ''} ${position || ''}`}
|
|
85
|
-
id={modalId}
|
|
86
|
-
onClick={handleClickOutside}
|
|
87
|
-
>
|
|
88
|
-
<div
|
|
89
|
-
className={`modal-content ${funcss || ''} ${flat ? 'flat' : ''}`}
|
|
90
|
-
style={{
|
|
91
|
-
animation: `${duration || 0.2}s ${animation || 'ScaleUp'}`,
|
|
92
|
-
maxWidth: maxWidth || undefined,
|
|
93
|
-
maxHeight: maxHeight || undefined,
|
|
94
|
-
width: width || '100%',
|
|
95
|
-
height: height || undefined,
|
|
96
|
-
}}
|
|
97
|
-
{...rest}
|
|
98
|
-
>
|
|
99
|
-
{title && (
|
|
100
|
-
<ModalHeader
|
|
101
|
-
funcss={titlecss || ''}
|
|
102
|
-
title={title}
|
|
103
|
-
close={!hideClose ?
|
|
104
|
-
|
|
105
|
-
<div
|
|
106
|
-
onClick={() => setOpen(false)}
|
|
107
|
-
className={`${closecss || ''} pointer hover-text-error`}
|
|
108
|
-
>
|
|
109
|
-
{close || <PiX size={25} />}
|
|
110
|
-
</div>
|
|
111
|
-
: ""
|
|
112
|
-
}
|
|
113
|
-
/>
|
|
114
|
-
)}
|
|
115
|
-
|
|
116
|
-
<ModalContent funcss={bodycss || ''}>
|
|
117
|
-
{body || children}
|
|
118
|
-
</ModalContent>
|
|
119
|
-
|
|
120
|
-
{/* Show default Ok button if no custom footer */}
|
|
121
|
-
{footer ? (
|
|
122
|
-
<ModalAction funcss={footercss || ''}>
|
|
123
|
-
{footer}
|
|
124
|
-
</ModalAction>
|
|
125
|
-
) : (
|
|
126
|
-
<ModalAction funcss='text-right'>
|
|
127
|
-
<Button
|
|
128
|
-
bg='success800'
|
|
129
|
-
endIcon={okIcon || <PiPaperPlaneRight />}
|
|
130
|
-
raised
|
|
131
|
-
onClick={handleOkClick}
|
|
132
|
-
>
|
|
133
|
-
{onOkText || 'OK'}
|
|
134
|
-
</Button>
|
|
135
|
-
</ModalAction>
|
|
136
|
-
)}
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
type NotificationContentProps = {
|
|
4
|
-
funcss?: string;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default function NotificationContent({ funcss, children }: NotificationContentProps) {
|
|
9
|
-
return (
|
|
10
|
-
<div className={`notificationContent ${funcss ? funcss : ''}`}>
|
|
11
|
-
{children}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
type NotificationFooterProps = {
|
|
4
|
-
funcss?: string;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default function NotificationFooter({ funcss, children }: NotificationFooterProps) {
|
|
9
|
-
return (
|
|
10
|
-
<div className={`notificationFooter ${funcss ? funcss : ''}`}>
|
|
11
|
-
{children}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
type NotificationHeaderProps = {
|
|
4
|
-
funcss?: string;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default function NotificationHeader({ funcss, children }: NotificationHeaderProps) {
|
|
9
|
-
return (
|
|
10
|
-
<div className={`notificationHeader ${funcss ? funcss : ''}`}>
|
|
11
|
-
{children}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import NotificationHeader from './Header';
|
|
4
|
-
import NotificationContent from './Content';
|
|
5
|
-
import NotificationFooter from './Footer';
|
|
6
|
-
|
|
7
|
-
type NotificationProps = {
|
|
8
|
-
position: string;
|
|
9
|
-
funcss?: string;
|
|
10
|
-
animation?: string;
|
|
11
|
-
duration?: number;
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
state: boolean;
|
|
14
|
-
width?: string;
|
|
15
|
-
header?: React.ReactNode;
|
|
16
|
-
content?: React.ReactNode;
|
|
17
|
-
footer?: React.ReactNode;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default function Notification({
|
|
21
|
-
position,
|
|
22
|
-
funcss,
|
|
23
|
-
animation,
|
|
24
|
-
duration,
|
|
25
|
-
children,
|
|
26
|
-
state,
|
|
27
|
-
width,
|
|
28
|
-
header,
|
|
29
|
-
content,
|
|
30
|
-
footer
|
|
31
|
-
}: NotificationProps) {
|
|
32
|
-
if (state) {
|
|
33
|
-
return (
|
|
34
|
-
<div
|
|
35
|
-
className={`notification ${position} ${funcss}`}
|
|
36
|
-
style={{ animation: ` ${duration ? duration : 0.2}s ${animation}`, width: width ? width : '450px' }}
|
|
37
|
-
>
|
|
38
|
-
{
|
|
39
|
-
header &&
|
|
40
|
-
<NotificationHeader>
|
|
41
|
-
{header}
|
|
42
|
-
</NotificationHeader>
|
|
43
|
-
}
|
|
44
|
-
{
|
|
45
|
-
content &&
|
|
46
|
-
<NotificationContent>
|
|
47
|
-
{content}
|
|
48
|
-
</NotificationContent>
|
|
49
|
-
}
|
|
50
|
-
{
|
|
51
|
-
footer &&
|
|
52
|
-
<NotificationFooter>
|
|
53
|
-
{footer}
|
|
54
|
-
</NotificationFooter>
|
|
55
|
-
}
|
|
56
|
-
{children}
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
} else {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
}
|
package/ui/page/NotFound.tsx
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import Button from '../button/Button';
|
|
4
|
-
import {PiArrowLeft} from 'react-icons/pi'
|
|
5
|
-
import Text from '../text/Text';
|
|
6
|
-
|
|
7
|
-
interface NotFoundProps {
|
|
8
|
-
header?:React.ReactNode
|
|
9
|
-
code?:number
|
|
10
|
-
content?:React.ReactNode
|
|
11
|
-
action?:React.ReactNode
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default function NotFound(
|
|
15
|
-
{
|
|
16
|
-
header ,
|
|
17
|
-
code ,
|
|
18
|
-
content ,
|
|
19
|
-
action
|
|
20
|
-
}:NotFoundProps
|
|
21
|
-
) {
|
|
22
|
-
return (
|
|
23
|
-
<div>
|
|
24
|
-
<div>
|
|
25
|
-
<div className="central" style={{ minHeight: "100vh", width: "100%", padding: "4rem 0px" }}>
|
|
26
|
-
<div className="text-center width-600-max">
|
|
27
|
-
{
|
|
28
|
-
code ?
|
|
29
|
-
code :
|
|
30
|
-
<div className="h2 text-warning round-edge">
|
|
31
|
-
404
|
|
32
|
-
</div>
|
|
33
|
-
}
|
|
34
|
-
<div style={{ margin: "1.4rem 0px" }}>
|
|
35
|
-
{
|
|
36
|
-
header ? header
|
|
37
|
-
:
|
|
38
|
-
<div className="text-big text-bold text-dark300" style={{ display: "block", transition: "all 0.2s linear 0s" }}>
|
|
39
|
-
Page not found 🤔
|
|
40
|
-
</div>
|
|
41
|
-
}
|
|
42
|
-
</div>
|
|
43
|
-
{
|
|
44
|
-
content ? content :
|
|
45
|
-
<div className="article">
|
|
46
|
-
<Text article text={`Don't worry, it happens to the best of us 😅. We'll help you find what you're looking for.`} color="dark300" block/>
|
|
47
|
-
</div>
|
|
48
|
-
}
|
|
49
|
-
<div style={{ margin: "2rem 0px" }}>
|
|
50
|
-
{
|
|
51
|
-
action ? action :
|
|
52
|
-
<div className="row-flex gap" style={{ justifyContent: "center", gap: "0.4rem" }}>
|
|
53
|
-
<Button raised rounded startIcon={<PiArrowLeft />} bg='primary' onClick={() => {
|
|
54
|
-
window.history.back()
|
|
55
|
-
}}>
|
|
56
|
-
Take me back 🏠
|
|
57
|
-
</Button>
|
|
58
|
-
</div>
|
|
59
|
-
}
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
package/ui/page/UnAuthorized.tsx
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import Button from '../button/Button';
|
|
3
|
-
import {PiArrowLeft} from 'react-icons/pi'
|
|
4
|
-
|
|
5
|
-
interface UnAuthorizedProps {
|
|
6
|
-
header?:React.ReactNode
|
|
7
|
-
code?:number
|
|
8
|
-
content?:React.ReactNode
|
|
9
|
-
action?:React.ReactNode
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default function UnAuthorized(
|
|
13
|
-
{
|
|
14
|
-
header ,
|
|
15
|
-
code ,
|
|
16
|
-
content ,
|
|
17
|
-
action
|
|
18
|
-
}:UnAuthorizedProps
|
|
19
|
-
) {
|
|
20
|
-
return (
|
|
21
|
-
<div>
|
|
22
|
-
<div>
|
|
23
|
-
<div className="central" style={{ minHeight: "100vh", width: "100%", padding: "4rem 0px" }}>
|
|
24
|
-
<div className="text-center width-600-max">
|
|
25
|
-
{
|
|
26
|
-
code ?
|
|
27
|
-
code :
|
|
28
|
-
<div className="h2 text-warning round-edge">
|
|
29
|
-
401
|
|
30
|
-
</div>
|
|
31
|
-
}
|
|
32
|
-
<div style={{ margin: "1.4rem 0px" }}>
|
|
33
|
-
{
|
|
34
|
-
header ? header
|
|
35
|
-
:
|
|
36
|
-
<div className="text-big text-bold text-dark300" style={{ display: "block", transition: "all 0.2s linear 0s" }}>
|
|
37
|
-
🚫 Unauthorized Access
|
|
38
|
-
</div>
|
|
39
|
-
}
|
|
40
|
-
</div>
|
|
41
|
-
{
|
|
42
|
-
content ? content :
|
|
43
|
-
<div className="article">
|
|
44
|
-
Sorry! You do not have access to this resource.
|
|
45
|
-
</div>
|
|
46
|
-
}
|
|
47
|
-
<div style={{ margin: "2rem 0px" }}>
|
|
48
|
-
{
|
|
49
|
-
action ? action :
|
|
50
|
-
<div className="row-flex gap" style={{ justifyContent: "center", gap: "0.4rem" }}>
|
|
51
|
-
<Button raised rounded startIcon={<PiArrowLeft />} bg='primary' onClick={() => {
|
|
52
|
-
window.history.back()
|
|
53
|
-
}}>
|
|
54
|
-
Take Me Back
|
|
55
|
-
</Button>
|
|
56
|
-
</div>
|
|
57
|
-
}
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
}
|
package/ui/progress/Bar.tsx
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { PiCheck } from 'react-icons/pi';
|
|
4
|
-
|
|
5
|
-
interface ProgressBarProps {
|
|
6
|
-
funcss?: string;
|
|
7
|
-
progress: number;
|
|
8
|
-
height?: number;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
content?: ((progress: number) => React.ReactNode) | React.ReactNode;
|
|
11
|
-
bg?: string; // Now CSS class names, e.g. 'primary', 'success'
|
|
12
|
-
raised?: boolean;
|
|
13
|
-
rounded?: boolean;
|
|
14
|
-
type?: 'linear' | 'circle';
|
|
15
|
-
size?: number;
|
|
16
|
-
strokeWidth?: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default function ProgressBar({
|
|
20
|
-
funcss,
|
|
21
|
-
progress,
|
|
22
|
-
height = 16,
|
|
23
|
-
children,
|
|
24
|
-
content,
|
|
25
|
-
raised,
|
|
26
|
-
rounded,
|
|
27
|
-
bg = 'primary', // default CSS class name
|
|
28
|
-
type = 'linear',
|
|
29
|
-
size = 60,
|
|
30
|
-
strokeWidth = 6,
|
|
31
|
-
}: ProgressBarProps) {
|
|
32
|
-
const clampedProgress = Math.min(100, Math.max(0, progress));
|
|
33
|
-
const isComplete = clampedProgress >= 100;
|
|
34
|
-
const effectiveBg = isComplete ? 'success' : bg;
|
|
35
|
-
|
|
36
|
-
const renderContent = () => {
|
|
37
|
-
if (React.isValidElement(content)) return content;
|
|
38
|
-
if (typeof content === 'function') return content(clampedProgress);
|
|
39
|
-
if (typeof content === 'string') return content;
|
|
40
|
-
return `${clampedProgress}%`;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
if (type === 'circle') {
|
|
44
|
-
const radius = (size - strokeWidth) / 2;
|
|
45
|
-
const circumference = 2 * Math.PI * radius;
|
|
46
|
-
const offset = circumference - (clampedProgress / 100) * circumference;
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div className={`relative flex justify-center items-center ${funcss}`} style={{ width: size, height: size }}>
|
|
50
|
-
<svg width={size} height={size} className="rotate-[-90deg]">
|
|
51
|
-
<circle
|
|
52
|
-
cx={size / 2}
|
|
53
|
-
cy={size / 2}
|
|
54
|
-
r={radius}
|
|
55
|
-
strokeWidth={strokeWidth}
|
|
56
|
-
fill="none"
|
|
57
|
-
stroke="#e5e7eb" // light gray background stroke
|
|
58
|
-
/>
|
|
59
|
-
<circle
|
|
60
|
-
cx={size / 2}
|
|
61
|
-
cy={size / 2}
|
|
62
|
-
r={radius}
|
|
63
|
-
strokeWidth={strokeWidth}
|
|
64
|
-
fill="none"
|
|
65
|
-
className={effectiveBg}
|
|
66
|
-
strokeDasharray={circumference}
|
|
67
|
-
strokeDashoffset={offset}
|
|
68
|
-
strokeLinecap="round"
|
|
69
|
-
style={{ transition: 'stroke-dashoffset 0.4s ease, stroke 0.3s ease' }}
|
|
70
|
-
/>
|
|
71
|
-
</svg>
|
|
72
|
-
<div
|
|
73
|
-
className="absolute text-center font-bold text-sm"
|
|
74
|
-
style={{
|
|
75
|
-
top: '50%',
|
|
76
|
-
left: '50%',
|
|
77
|
-
transform: 'translate(-50%, -50%)',
|
|
78
|
-
display: 'flex',
|
|
79
|
-
alignItems: 'center',
|
|
80
|
-
justifyContent: 'center',
|
|
81
|
-
width: size,
|
|
82
|
-
height: size,
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
{isComplete ? <PiCheck className="text-success800" size={size / 2.2} /> : renderContent()}
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Linear bar
|
|
92
|
-
return (
|
|
93
|
-
<div className={`progressBar ${raised ? 'raised' : ''} ${rounded ? 'rounded' : ''} ${funcss || ''}`}>
|
|
94
|
-
<div
|
|
95
|
-
className={`progressInner ${rounded ? 'rounded' : ''} ${effectiveBg}`}
|
|
96
|
-
style={{
|
|
97
|
-
width: `${clampedProgress}%`,
|
|
98
|
-
height: `${height}px`,
|
|
99
|
-
padding: '0 1rem',
|
|
100
|
-
transition: 'width 0.3s ease, background-color 0.3s ease',
|
|
101
|
-
display: 'flex',
|
|
102
|
-
alignItems: 'center',
|
|
103
|
-
justifyContent: 'flex-end',
|
|
104
|
-
fontWeight: 'bold',
|
|
105
|
-
color: '#fff',
|
|
106
|
-
overflow: 'hidden',
|
|
107
|
-
whiteSpace: 'nowrap',
|
|
108
|
-
}}
|
|
109
|
-
>
|
|
110
|
-
{isComplete ? <PiCheck /> : renderContent()} {children}
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
);
|
|
114
|
-
}
|
package/ui/richtext/RichText.tsx
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React, { useEffect, useRef } from 'react';
|
|
3
|
-
import { useQuill } from 'react-quilljs';
|
|
4
|
-
import 'quill/dist/quill.bubble.css';
|
|
5
|
-
import 'quill/dist/quill.snow.css'; // Add support for snow theme
|
|
6
|
-
import { MdOutlineEmojiEmotions } from 'react-icons/md';
|
|
7
|
-
import { AllEmojis } from '../../utils/Emojis';
|
|
8
|
-
import Dropdown from '../drop/Dropdown';
|
|
9
|
-
import RowFlex from '../specials/RowFlex';
|
|
10
|
-
import ToolTip from '../tooltip/ToolTip';
|
|
11
|
-
import Circle from '../specials/Circle';
|
|
12
|
-
import Tip from '../tooltip/Tip';
|
|
13
|
-
|
|
14
|
-
type RangeStatic = {
|
|
15
|
-
index: number;
|
|
16
|
-
length: number;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
interface RichTextProps {
|
|
20
|
-
value: string;
|
|
21
|
-
onChange: (content: string) => void;
|
|
22
|
-
showEmojis?: boolean;
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
afterEmoji?: React.ReactNode;
|
|
25
|
-
funcss?: string;
|
|
26
|
-
|
|
27
|
-
/** Custom Quill modules (e.g., additional toolbar items) */
|
|
28
|
-
modules?: any;
|
|
29
|
-
|
|
30
|
-
/** Quill theme (e.g. 'bubble' | 'snow') */
|
|
31
|
-
theme?: 'bubble' | 'snow';
|
|
32
|
-
|
|
33
|
-
/** Optional fontFamily override */
|
|
34
|
-
fontFamily?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const RichText: React.FC<RichTextProps> = ({
|
|
38
|
-
value,
|
|
39
|
-
onChange,
|
|
40
|
-
showEmojis = false,
|
|
41
|
-
placeholder = 'Write something...',
|
|
42
|
-
afterEmoji,
|
|
43
|
-
funcss = '',
|
|
44
|
-
modules,
|
|
45
|
-
theme = 'bubble',
|
|
46
|
-
fontFamily,
|
|
47
|
-
}) => {
|
|
48
|
-
const savedRange = useRef<RangeStatic | null>(null);
|
|
49
|
-
|
|
50
|
-
// Default modules (basic toolbar)
|
|
51
|
-
const defaultModules = {
|
|
52
|
-
toolbar: [['bold', 'italic', 'underline'], [{ list: 'bullet' }]],
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const { quill, quillRef } = useQuill({
|
|
56
|
-
theme,
|
|
57
|
-
placeholder,
|
|
58
|
-
modules: modules || defaultModules,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (!quill) return;
|
|
63
|
-
|
|
64
|
-
const handleSelectionChange = (range: RangeStatic | null) => {
|
|
65
|
-
if (range) savedRange.current = range;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const handleTextChange = () => {
|
|
69
|
-
onChange(quill.root.innerHTML);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
quill.on('selection-change', handleSelectionChange);
|
|
73
|
-
quill.on('text-change', handleTextChange);
|
|
74
|
-
|
|
75
|
-
return () => {
|
|
76
|
-
quill.off('selection-change', handleSelectionChange);
|
|
77
|
-
quill.off('text-change', handleTextChange);
|
|
78
|
-
};
|
|
79
|
-
}, [quill, onChange]);
|
|
80
|
-
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
if (quill && value !== quill.root.innerHTML) {
|
|
83
|
-
quill.root.innerHTML = value;
|
|
84
|
-
}
|
|
85
|
-
}, [quill, value]);
|
|
86
|
-
|
|
87
|
-
const insertEmoji = (emoji: string) => {
|
|
88
|
-
if (quill && savedRange.current) {
|
|
89
|
-
quill.insertText(savedRange.current.index, emoji);
|
|
90
|
-
quill.setSelection(savedRange.current.index + emoji.length);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const renderEmojiSection = (title: string, emojis: string[]) => (
|
|
95
|
-
<>
|
|
96
|
-
<div className="mb-2 mt-2 text-sm">{title}</div>
|
|
97
|
-
<RowFlex gap={0.3}>
|
|
98
|
-
{emojis.map((emoji, i) => (
|
|
99
|
-
<span key={i} className="h6 pointer" onClick={() => insertEmoji(emoji)}>
|
|
100
|
-
{emoji}
|
|
101
|
-
</span>
|
|
102
|
-
))}
|
|
103
|
-
</RowFlex>
|
|
104
|
-
</>
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<div
|
|
109
|
-
className={funcss}
|
|
110
|
-
>
|
|
111
|
-
<div id="editor-container" className="bubble-editor-container p-0">
|
|
112
|
-
<div ref={quillRef} className={theme === 'bubble' ? "bubble-editor " : "snow-editor "}
|
|
113
|
-
style={{
|
|
114
|
-
fontFamily: fontFamily || 'inherit',
|
|
115
|
-
}}/>
|
|
116
|
-
</div>
|
|
117
|
-
|
|
118
|
-
{(showEmojis || afterEmoji) && (
|
|
119
|
-
<RowFlex gap={0.5} funcss='mt-1'>
|
|
120
|
-
{showEmojis && (
|
|
121
|
-
<Dropdown
|
|
122
|
-
closableOnlyOutside
|
|
123
|
-
direction="dropdown"
|
|
124
|
-
openOnHover={false}
|
|
125
|
-
button={
|
|
126
|
-
<ToolTip>
|
|
127
|
-
<Circle funcss="bg border">
|
|
128
|
-
<MdOutlineEmojiEmotions />
|
|
129
|
-
</Circle>
|
|
130
|
-
<Tip tip="top" animation="ScaleUp" duration={0.5} content="Emojis" />
|
|
131
|
-
</ToolTip>
|
|
132
|
-
}
|
|
133
|
-
items={[
|
|
134
|
-
{
|
|
135
|
-
label: (
|
|
136
|
-
<div className="w-200 h-300" style={{ overflowY: 'auto' }}>
|
|
137
|
-
{renderEmojiSection('❤️ Smileys & People', AllEmojis.Smiley)}
|
|
138
|
-
{renderEmojiSection('👍 Gestures & Body Parts', AllEmojis.Gesture)}
|
|
139
|
-
{renderEmojiSection('🔥 Symbols & Expressions', AllEmojis.Symbols)}
|
|
140
|
-
{renderEmojiSection('🚀 Travel, Objects & Activities', AllEmojis.Travel)}
|
|
141
|
-
{renderEmojiSection('👨👩👧👦 People & Professions', AllEmojis.People)}
|
|
142
|
-
{renderEmojiSection('🐶 Animals & Nature', AllEmojis.Animals)}
|
|
143
|
-
</div>
|
|
144
|
-
),
|
|
145
|
-
},
|
|
146
|
-
]}
|
|
147
|
-
/>
|
|
148
|
-
)}
|
|
149
|
-
{afterEmoji}
|
|
150
|
-
</RowFlex>
|
|
151
|
-
)}
|
|
152
|
-
</div>
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export default RichText;
|