funuicss 2.7.16 → 3.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/css/fun.css +6663 -6653
- package/index.d.ts +2 -0
- package/index.js +5 -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/button/Button.js +1 -1
- package/ui/flex/Flex.d.ts +3 -3
- package/ui/flex/Flex.js +2 -2
- 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/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 -58
- 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 -97
- package/ui/flex/FlexItem.tsx +0 -64
- 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 -348
- package/ui/video/videoFunctions.tsx +0 -19
- package/ui/video/videoShortcuts.ts +0 -13
- 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/button/Button.tsx
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { ReactNode, HTMLProps, MouseEvent, ChangeEvent } from 'react';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { PiInfo , PiCheck , PiWarning , PiX , PiSpinner } from "react-icons/pi";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
interface ButtonProps {
|
|
8
|
-
color?: string;
|
|
9
|
-
bg?: string;
|
|
10
|
-
funcss?: string;
|
|
11
|
-
startIcon?: ReactNode;
|
|
12
|
-
endIcon?: ReactNode;
|
|
13
|
-
text?: string;
|
|
14
|
-
rounded?: boolean;
|
|
15
|
-
raised?: boolean;
|
|
16
|
-
height?: string;
|
|
17
|
-
width?: string;
|
|
18
|
-
float?: boolean;
|
|
19
|
-
hoverUp?: boolean;
|
|
20
|
-
fullWidth?: boolean;
|
|
21
|
-
outlined?: boolean;
|
|
22
|
-
small?: boolean;
|
|
23
|
-
smaller?: boolean;
|
|
24
|
-
big?: boolean;
|
|
25
|
-
bigger?: boolean;
|
|
26
|
-
jumbo?: boolean;
|
|
27
|
-
flat?: boolean;
|
|
28
|
-
hoverNone?: boolean;
|
|
29
|
-
fillAnimation?:boolean;
|
|
30
|
-
bold?:boolean;
|
|
31
|
-
hoverless?:boolean;
|
|
32
|
-
fillDirection?:string;
|
|
33
|
-
fillTextColor?:string;
|
|
34
|
-
buttonFillStyle?:React.CSSProperties ,
|
|
35
|
-
outlineSize?:number ,
|
|
36
|
-
isLoading?:boolean ,
|
|
37
|
-
status?: 'success' | 'warning' | 'info' | 'danger'
|
|
38
|
-
children?:React.ReactNode,
|
|
39
|
-
style?:React.CSSProperties ,
|
|
40
|
-
onClick?: (...args: unknown[]) => void;
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default function Button({
|
|
45
|
-
color,
|
|
46
|
-
bg,
|
|
47
|
-
funcss,
|
|
48
|
-
startIcon,
|
|
49
|
-
endIcon,
|
|
50
|
-
text,
|
|
51
|
-
rounded,
|
|
52
|
-
raised,
|
|
53
|
-
height,
|
|
54
|
-
width,
|
|
55
|
-
float,
|
|
56
|
-
hoverUp,
|
|
57
|
-
fullWidth,
|
|
58
|
-
outlined,
|
|
59
|
-
small,
|
|
60
|
-
hoverless,
|
|
61
|
-
smaller,
|
|
62
|
-
big,
|
|
63
|
-
bigger,
|
|
64
|
-
jumbo,
|
|
65
|
-
flat,
|
|
66
|
-
hoverNone,
|
|
67
|
-
fillAnimation ,
|
|
68
|
-
fillDirection,
|
|
69
|
-
fillTextColor,
|
|
70
|
-
outlineSize,
|
|
71
|
-
isLoading,
|
|
72
|
-
status,
|
|
73
|
-
children,
|
|
74
|
-
bold ,
|
|
75
|
-
style,
|
|
76
|
-
onClick,
|
|
77
|
-
...rest
|
|
78
|
-
}: ButtonProps) {
|
|
79
|
-
function removeNumbers(text:any) {
|
|
80
|
-
return text.replace(/[0-9]/g, '');
|
|
81
|
-
}
|
|
82
|
-
function hasNumberAbove(text:any) {
|
|
83
|
-
const matches = text.match(/\d+/g); // find all numbers in the string
|
|
84
|
-
if (!matches) return false;
|
|
85
|
-
return matches.some((num: string) => parseInt(num) >= 400);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function hasNumber(text:any) {
|
|
89
|
-
return /\d/.test(text);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const classNames = [
|
|
94
|
-
'button',
|
|
95
|
-
`text-${bg ? color ? color : !hasNumber(bg) && !outlined ? "white" : hasNumberAbove(bg) && !outlined ? "white" : removeNumbers(bg) : color}`,
|
|
96
|
-
funcss || '',
|
|
97
|
-
rounded ? 'roundBtn' : '',
|
|
98
|
-
hoverless ? 'hoverless' : '',
|
|
99
|
-
bold ? 'text-bold' : '',
|
|
100
|
-
float ? 'floatBtn' : '',
|
|
101
|
-
raised ? 'raisedBtn' : '',
|
|
102
|
-
hoverUp ? 'hover-up' : '',
|
|
103
|
-
flat ? 'flat' : '',
|
|
104
|
-
hoverNone ? 'hoverNone' : '',
|
|
105
|
-
small ? 'smallBtn' :
|
|
106
|
-
smaller ? 'smallerBtn' : '',
|
|
107
|
-
big ? 'bigBtn' : '',
|
|
108
|
-
bigger ? 'biggerBtn' : '',
|
|
109
|
-
jumbo ? 'jumboBtn' : '',
|
|
110
|
-
outlined ? `outlined outline-${bg || '' } text-${color ? color : removeNumbers(bg)}` : bg || '',
|
|
111
|
-
`${fillAnimation ? `${fillTextColor ? `hover-text-${fillTextColor}`: ''} button-fill fill-${fillDirection ? fillDirection : 'left'}` : '' }`
|
|
112
|
-
].join(' ');
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<span >
|
|
118
|
-
<button
|
|
119
|
-
className={`${classNames} ${startIcon || endIcon || status || isLoading ? 'iconic' : ''}`}
|
|
120
|
-
style={{
|
|
121
|
-
height: height || '',
|
|
122
|
-
width: fullWidth ? '100%' : width || '',
|
|
123
|
-
borderRadius: flat ? '0rem' : '',
|
|
124
|
-
...style
|
|
125
|
-
}}
|
|
126
|
-
onClick={onClick}
|
|
127
|
-
{...rest}
|
|
128
|
-
>
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
isLoading &&
|
|
132
|
-
<span className='rotate btn_left_icon' style={{lineHeight:"0"}}>
|
|
133
|
-
<PiSpinner/>
|
|
134
|
-
</span>
|
|
135
|
-
}
|
|
136
|
-
{
|
|
137
|
-
status &&
|
|
138
|
-
<span className=' btn_left_icon' style={{lineHeight:"0"}}>
|
|
139
|
-
{status === "success" && <PiCheck />}
|
|
140
|
-
{status === "info" && <PiInfo />}
|
|
141
|
-
{status === "warning" && <PiWarning />}
|
|
142
|
-
{status === "danger" && <PiX />}
|
|
143
|
-
</span>
|
|
144
|
-
}
|
|
145
|
-
{fillAnimation ? <span className={`button_fill_span ${bg}`} ></span> : ''}
|
|
146
|
-
{startIcon && <span className="btn_left_icon" style={{lineHeight:"0"}}>{startIcon}</span>}
|
|
147
|
-
{text ? text : children}
|
|
148
|
-
{endIcon && <span className="btn_right_icon" style={{lineHeight:"0"}}>{endIcon}</span>}
|
|
149
|
-
|
|
150
|
-
</button>
|
|
151
|
-
</span>
|
|
152
|
-
)
|
|
153
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Activity } from './Calendar';
|
|
4
|
-
import Text from '../text/Text';
|
|
5
|
-
|
|
6
|
-
type ActivityCardProps = {
|
|
7
|
-
activity: Activity;
|
|
8
|
-
onClick?: (activity: Activity) => void;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const ActivityCard: React.FC<ActivityCardProps> = ({ activity, onClick }) => {
|
|
12
|
-
return (
|
|
13
|
-
<div
|
|
14
|
-
className={`activity-tag animated slide-up ${activity.funcss || ''}`}
|
|
15
|
-
style={{ backgroundColor: activity.color || '' }}
|
|
16
|
-
onClick={(e) => {
|
|
17
|
-
e.stopPropagation();
|
|
18
|
-
onClick?.(activity);
|
|
19
|
-
}}
|
|
20
|
-
>
|
|
21
|
-
<Text text={activity.title} size="xs" block truncate={2} />
|
|
22
|
-
{activity.footer && <div>{activity.footer}</div>}
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default ActivityCard;
|
package/ui/calendar/Calendar.tsx
DELETED
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import dayjs, { Dayjs } from 'dayjs';
|
|
4
|
-
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
5
|
-
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
6
|
-
import { PiCaretLeft, PiCaretRight, PiPlus, PiCircle, PiChecks, PiEmpty } from 'react-icons/pi';
|
|
7
|
-
import Avatar from '../avatar/Avatar';
|
|
8
|
-
import Circle from '../specials/Circle';
|
|
9
|
-
import RowFlex from '../specials/RowFlex';
|
|
10
|
-
import Input from '../input/Input';
|
|
11
|
-
import Button from '../button/Button';
|
|
12
|
-
import Text from '../text/Text';
|
|
13
|
-
import ActivityCard from './ActivityCard';
|
|
14
|
-
import View from '../view/View';
|
|
15
|
-
import Dropdown from '../drop/Dropdown';
|
|
16
|
-
import { HiOutlineDotsVertical } from "react-icons/hi";
|
|
17
|
-
|
|
18
|
-
dayjs.extend(isSameOrAfter);
|
|
19
|
-
dayjs.extend(isSameOrBefore);
|
|
20
|
-
|
|
21
|
-
export type Activity = {
|
|
22
|
-
id: string;
|
|
23
|
-
title: string;
|
|
24
|
-
date: Date;
|
|
25
|
-
color?: string;
|
|
26
|
-
funcss?: string;
|
|
27
|
-
data?: any;
|
|
28
|
-
footer?: React.ReactNode;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface CalendarProps {
|
|
32
|
-
activities: Activity[];
|
|
33
|
-
onAdd?: (date: Date) => void;
|
|
34
|
-
onActivityClick?: (activity: Activity) => void;
|
|
35
|
-
onDateClick?: (date: Date) => void;
|
|
36
|
-
funcss?: string;
|
|
37
|
-
weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
38
|
-
renderActivity?: (activity: Activity) => React.ReactNode;
|
|
39
|
-
showAdjacentMonths?: boolean;
|
|
40
|
-
minDate?: Date;
|
|
41
|
-
maxDate?: Date;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const Calendar: React.FC<CalendarProps> = ({
|
|
45
|
-
activities,
|
|
46
|
-
onAdd,
|
|
47
|
-
onActivityClick,
|
|
48
|
-
onDateClick,
|
|
49
|
-
funcss = '',
|
|
50
|
-
weekStart = 0,
|
|
51
|
-
renderActivity,
|
|
52
|
-
showAdjacentMonths = true,
|
|
53
|
-
minDate,
|
|
54
|
-
maxDate,
|
|
55
|
-
}) => {
|
|
56
|
-
const [currentMonth, setCurrentMonth] = useState<Dayjs>(dayjs());
|
|
57
|
-
const [hoveredDate, setHoveredDate] = useState<string | null>(null);
|
|
58
|
-
const [selectedDate, setSelectedDate] = useState<Date | null>(null);
|
|
59
|
-
const [showMoreActivities, setShowMoreActivities] = useState(false);
|
|
60
|
-
|
|
61
|
-
// ✅ NEW: View mode state
|
|
62
|
-
const [viewMode, setViewMode] = useState<'month' | 'week'>('month');
|
|
63
|
-
|
|
64
|
-
const startOfWeek = currentMonth.startOf('week').add(weekStart, 'day');
|
|
65
|
-
|
|
66
|
-
const { days, monthActivities } = useMemo(() => {
|
|
67
|
-
let days: (Dayjs | null)[] = [];
|
|
68
|
-
|
|
69
|
-
if (viewMode === 'month') {
|
|
70
|
-
const startOfMonth = currentMonth.startOf('month');
|
|
71
|
-
const endOfMonth = currentMonth.endOf('month');
|
|
72
|
-
const firstDay = startOfMonth.day();
|
|
73
|
-
const daysBefore = (firstDay - weekStart + 7) % 7;
|
|
74
|
-
const daysInMonth = currentMonth.daysInMonth();
|
|
75
|
-
const totalDays = Math.ceil((daysBefore + daysInMonth) / 7) * 7;
|
|
76
|
-
|
|
77
|
-
for (let i = daysBefore - 1; i >= 0; i--) {
|
|
78
|
-
const date = startOfMonth.subtract(i + 1, 'day');
|
|
79
|
-
days.push(showAdjacentMonths ? date : null);
|
|
80
|
-
}
|
|
81
|
-
for (let i = 0; i < daysInMonth; i++) {
|
|
82
|
-
days.push(startOfMonth.add(i, 'day'));
|
|
83
|
-
}
|
|
84
|
-
const remaining = totalDays - days.length;
|
|
85
|
-
for (let i = 0; i < remaining; i++) {
|
|
86
|
-
const date = endOfMonth.add(i + 1, 'day');
|
|
87
|
-
days.push(showAdjacentMonths ? date : null);
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
// ✅ Week View: only 7 days
|
|
91
|
-
for (let i = 0; i < 7; i++) {
|
|
92
|
-
days.push(startOfWeek.add(i, 'day'));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const monthActivities: Record<string, Activity[]> = {};
|
|
97
|
-
activities.forEach(activity => {
|
|
98
|
-
const date = dayjs(activity.date);
|
|
99
|
-
const key = date.format('YYYY-MM-DD');
|
|
100
|
-
|
|
101
|
-
if (
|
|
102
|
-
viewMode === 'month' &&
|
|
103
|
-
(date.isSame(currentMonth, 'month') || (showAdjacentMonths &&
|
|
104
|
-
(date.isBefore(currentMonth.endOf('month')) && date.isAfter(currentMonth.startOf('month')))))
|
|
105
|
-
) {
|
|
106
|
-
if (!monthActivities[key]) monthActivities[key] = [];
|
|
107
|
-
monthActivities[key].push(activity);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (viewMode === 'week' && date.isSame(startOfWeek, 'week')) {
|
|
111
|
-
if (!monthActivities[key]) monthActivities[key] = [];
|
|
112
|
-
monthActivities[key].push(activity);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
return { days, monthActivities };
|
|
117
|
-
}, [currentMonth, activities, viewMode, weekStart, showAdjacentMonths]);
|
|
118
|
-
|
|
119
|
-
const prevPeriod = () =>
|
|
120
|
-
setCurrentMonth(currentMonth.subtract(1, viewMode === 'month' ? 'month' : 'week'));
|
|
121
|
-
const nextPeriod = () =>
|
|
122
|
-
setCurrentMonth(currentMonth.add(1, viewMode === 'month' ? 'month' : 'week'));
|
|
123
|
-
const goToToday = () => setCurrentMonth(dayjs());
|
|
124
|
-
|
|
125
|
-
const handleDateClick = (date: Dayjs) => {
|
|
126
|
-
if (isDateDisabled(date)) return;
|
|
127
|
-
setSelectedDate(date.toDate());
|
|
128
|
-
onDateClick?.(date.toDate());
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const handleAdd = (e: React.MouseEvent, date: Dayjs) => {
|
|
132
|
-
e.stopPropagation();
|
|
133
|
-
if (isDateDisabled(date)) return;
|
|
134
|
-
onAdd?.(date.toDate());
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const isDateDisabled = (date: Dayjs) =>
|
|
138
|
-
(minDate && date.isBefore(dayjs(minDate), 'day')) ||
|
|
139
|
-
(maxDate && date.isAfter(dayjs(maxDate), 'day'));
|
|
140
|
-
|
|
141
|
-
const isToday = (date: Dayjs) => date.isSame(dayjs(), 'day');
|
|
142
|
-
const isSelected = (date: Dayjs) => selectedDate && date.isSame(selectedDate, 'day');
|
|
143
|
-
|
|
144
|
-
const weekdays = useMemo(() => {
|
|
145
|
-
const days = [];
|
|
146
|
-
for (let i = 0; i < 7; i++) {
|
|
147
|
-
const day = dayjs().day((weekStart + i) % 7);
|
|
148
|
-
days.push(day.format('dd'));
|
|
149
|
-
}
|
|
150
|
-
return days;
|
|
151
|
-
}, [weekStart]);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
155
|
-
|
|
156
|
-
useEffect(() => {
|
|
157
|
-
const updateViewMode = () => {
|
|
158
|
-
const small = window.innerWidth < 768;
|
|
159
|
-
setIsMobile(small);
|
|
160
|
-
setViewMode(small ? 'week' : 'month');
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
updateViewMode(); // initial check
|
|
164
|
-
window.addEventListener('resize', updateViewMode);
|
|
165
|
-
return () => window.removeEventListener('resize', updateViewMode);
|
|
166
|
-
}, []);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return (
|
|
171
|
-
<div className={`calendar ${funcss}`}>
|
|
172
|
-
<div className="calendar-header">
|
|
173
|
-
<Avatar funcss="border" onClick={prevPeriod}>
|
|
174
|
-
<PiCaretLeft />
|
|
175
|
-
</Avatar>
|
|
176
|
-
|
|
177
|
-
<div className="calendar-title">
|
|
178
|
-
<RowFlex gap={1} align="center">
|
|
179
|
-
<Input
|
|
180
|
-
type="text"
|
|
181
|
-
select
|
|
182
|
-
value={currentMonth.month().toString()}
|
|
183
|
-
onChange={(e) =>
|
|
184
|
-
setCurrentMonth(currentMonth.month(parseInt(e.target.value)))
|
|
185
|
-
}
|
|
186
|
-
options={Array.from({ length: 12 }, (_, i) => ({
|
|
187
|
-
value: i.toString(),
|
|
188
|
-
text: dayjs().month(i).format('MMMM'),
|
|
189
|
-
}))}
|
|
190
|
-
borderless
|
|
191
|
-
funcss="round-edge"
|
|
192
|
-
/>
|
|
193
|
-
|
|
194
|
-
<Input
|
|
195
|
-
type="text"
|
|
196
|
-
select
|
|
197
|
-
value={currentMonth.year().toString()}
|
|
198
|
-
onChange={(e) =>
|
|
199
|
-
setCurrentMonth(currentMonth.year(parseInt(e.target.value)))
|
|
200
|
-
}
|
|
201
|
-
options={Array.from({ length: 21 }, (_, i) => {
|
|
202
|
-
const year = dayjs().year() - 10 + i;
|
|
203
|
-
return { value: year.toString(), text: year.toString() };
|
|
204
|
-
})}
|
|
205
|
-
borderless
|
|
206
|
-
funcss="round-edge"
|
|
207
|
-
/>
|
|
208
|
-
|
|
209
|
-
<Dropdown
|
|
210
|
-
direction="dropdown"
|
|
211
|
-
position='right'
|
|
212
|
-
openOnHover={false}
|
|
213
|
-
button={
|
|
214
|
-
<Avatar>
|
|
215
|
-
<HiOutlineDotsVertical />
|
|
216
|
-
</Avatar>
|
|
217
|
-
}
|
|
218
|
-
items={[
|
|
219
|
-
{
|
|
220
|
-
label: <span className="text-sm">Today</span>,
|
|
221
|
-
onClick: () => goToToday(),
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
label: <div className="text-sm" onClick={() =>
|
|
225
|
-
setViewMode(viewMode === 'month' ? 'week' : 'month')
|
|
226
|
-
}>
|
|
227
|
-
{viewMode === 'month' ? 'Switch to Week' : 'Switch to Month'}
|
|
228
|
-
</div>,
|
|
229
|
-
},
|
|
230
|
-
]}
|
|
231
|
-
/>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
</RowFlex>
|
|
235
|
-
</div>
|
|
236
|
-
|
|
237
|
-
<Avatar funcss="border" onClick={nextPeriod}>
|
|
238
|
-
<PiCaretRight />
|
|
239
|
-
</Avatar>
|
|
240
|
-
</div>
|
|
241
|
-
|
|
242
|
-
<div className="calendar-weekdays">
|
|
243
|
-
{weekdays.map((d, i) => (
|
|
244
|
-
<div key={i} className="weekday-header">
|
|
245
|
-
{d}
|
|
246
|
-
</div>
|
|
247
|
-
))}
|
|
248
|
-
</div>
|
|
249
|
-
|
|
250
|
-
<div className="calendar-grid">
|
|
251
|
-
{days.map((date, index) => {
|
|
252
|
-
if (!date || (viewMode === 'month' && !date.isSame(currentMonth, 'month'))) {
|
|
253
|
-
return <div key={index} className="calendar-cell empty" />;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const key = date.format('YYYY-MM-DD');
|
|
257
|
-
const activitiesToday = monthActivities[key] || [];
|
|
258
|
-
const disabled = isDateDisabled(date);
|
|
259
|
-
const today = isToday(date);
|
|
260
|
-
const selected = isSelected(date);
|
|
261
|
-
|
|
262
|
-
return (
|
|
263
|
-
<div
|
|
264
|
-
key={key}
|
|
265
|
-
className={`calendar-cell hoverable ${disabled ? 'disabled' : ''} ${today ? 'today' : ''} ${selected ? 'selected' : ''}`}
|
|
266
|
-
onClick={() => handleDateClick(date)}
|
|
267
|
-
onMouseEnter={() => setHoveredDate(key)}
|
|
268
|
-
onMouseLeave={() => setHoveredDate(null)}
|
|
269
|
-
>
|
|
270
|
-
<div className={`day-number ${today ? 'today' : ''}`}>
|
|
271
|
-
{date.date()}
|
|
272
|
-
</div>
|
|
273
|
-
|
|
274
|
-
{
|
|
275
|
-
!isMobile && (
|
|
276
|
-
<div className="activities ">
|
|
277
|
-
{activitiesToday.slice(0, showMoreActivities ? activitiesToday.length : 3).map((activity) => (
|
|
278
|
-
<ActivityCard activity={activity} onClick={(e) => {
|
|
279
|
-
onActivityClick?.(activity);
|
|
280
|
-
}}/>
|
|
281
|
-
))}
|
|
282
|
-
{activitiesToday.length > 3 && (
|
|
283
|
-
<Button smaller funcss='p-0' color="primary" onClick={() => setShowMoreActivities(!showMoreActivities)}>
|
|
284
|
-
{showMoreActivities ? 'Show Less' : <>+{activitiesToday.length - 3} more</>}
|
|
285
|
-
</Button>
|
|
286
|
-
)}
|
|
287
|
-
</div>
|
|
288
|
-
)
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
{hoveredDate === key && !disabled && (
|
|
292
|
-
<div className="add-icon hide-small" onClick={(e) => handleAdd(e, date)}>
|
|
293
|
-
<Circle bg='primary'>
|
|
294
|
-
<PiPlus />
|
|
295
|
-
</Circle>
|
|
296
|
-
</div>
|
|
297
|
-
)}
|
|
298
|
-
</div>
|
|
299
|
-
);
|
|
300
|
-
})}
|
|
301
|
-
</div>
|
|
302
|
-
|
|
303
|
-
{isMobile && selectedDate && (
|
|
304
|
-
<div className="calendar-activities-mobile p-1">
|
|
305
|
-
<RowFlex gap={0.5} justify="space-between" align="center" className="mt-3 mb-2">
|
|
306
|
-
<Text
|
|
307
|
-
text={dayjs(selectedDate).format('dddd, MMMM D')}
|
|
308
|
-
weight={600}
|
|
309
|
-
funcss="mb-2"
|
|
310
|
-
/>
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
<div onClick={(e) => handleAdd(e, dayjs(selectedDate))}>
|
|
314
|
-
<Circle bg="primary">
|
|
315
|
-
<PiPlus />
|
|
316
|
-
</Circle>
|
|
317
|
-
</div>
|
|
318
|
-
|
|
319
|
-
</RowFlex>
|
|
320
|
-
{(monthActivities[dayjs(selectedDate).format('YYYY-MM-DD')] || []).map((activity) => (
|
|
321
|
-
<ActivityCard activity={activity} onClick={(e) => {
|
|
322
|
-
onActivityClick?.(activity);
|
|
323
|
-
}}/>
|
|
324
|
-
))}
|
|
325
|
-
{(monthActivities[dayjs(selectedDate).format('YYYY-MM-DD')] || []).length === 0 && (
|
|
326
|
-
<View funcss='mt-2 text-center'>
|
|
327
|
-
<div> <PiEmpty size={30}/></div>
|
|
328
|
-
<Text text="No activities for this day." size="sm" opacity={2} />
|
|
329
|
-
<div className="mt-2">
|
|
330
|
-
<span onClick={(e) => handleAdd(e, dayjs(selectedDate))}>
|
|
331
|
-
<Button small bg='lighter' startIcon={<PiPlus />}>Add Activity</Button>
|
|
332
|
-
</span>
|
|
333
|
-
</div>
|
|
334
|
-
</View>
|
|
335
|
-
)}
|
|
336
|
-
</div>
|
|
337
|
-
)}
|
|
338
|
-
|
|
339
|
-
</div>
|
|
340
|
-
);
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
export default Calendar;
|
package/ui/card/Card.tsx
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React, { ReactNode } from 'react';
|
|
3
|
-
import CardHeader from './CardHeader';
|
|
4
|
-
import CardBody from './CardBody';
|
|
5
|
-
import CardFooter from './CardFooter';
|
|
6
|
-
|
|
7
|
-
interface CardProps {
|
|
8
|
-
color?: string;
|
|
9
|
-
bg?: string;
|
|
10
|
-
width?: string;
|
|
11
|
-
height?: string;
|
|
12
|
-
minHeight?: string;
|
|
13
|
-
minWidth?: string;
|
|
14
|
-
margin?: string;
|
|
15
|
-
padding?: string;
|
|
16
|
-
funcss?: string;
|
|
17
|
-
children?: ReactNode;
|
|
18
|
-
roundEdge?: boolean;
|
|
19
|
-
maxHeight?: string;
|
|
20
|
-
maxWidth?: string;
|
|
21
|
-
horizontal?: boolean;
|
|
22
|
-
flat?: boolean;
|
|
23
|
-
id?: string;
|
|
24
|
-
header?:ReactNode
|
|
25
|
-
body?:ReactNode
|
|
26
|
-
footer?:ReactNode
|
|
27
|
-
image?:ReactNode,
|
|
28
|
-
noGap?:boolean ,
|
|
29
|
-
shadowless?:boolean,
|
|
30
|
-
fab?:ReactNode ,
|
|
31
|
-
responsiveSmall?:boolean;
|
|
32
|
-
responsiveMedium?:boolean ,
|
|
33
|
-
xl?:boolean ,
|
|
34
|
-
style?:React.CSSProperties
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default function Card({
|
|
38
|
-
color,
|
|
39
|
-
bg,
|
|
40
|
-
width,
|
|
41
|
-
height,
|
|
42
|
-
minHeight,
|
|
43
|
-
minWidth,
|
|
44
|
-
margin,
|
|
45
|
-
padding,
|
|
46
|
-
funcss,
|
|
47
|
-
children,
|
|
48
|
-
roundEdge,
|
|
49
|
-
maxHeight,
|
|
50
|
-
maxWidth,
|
|
51
|
-
horizontal,
|
|
52
|
-
id,
|
|
53
|
-
header ,
|
|
54
|
-
body ,
|
|
55
|
-
footer ,
|
|
56
|
-
noGap,
|
|
57
|
-
fab,
|
|
58
|
-
image,
|
|
59
|
-
shadowless,
|
|
60
|
-
flat,
|
|
61
|
-
responsiveMedium ,
|
|
62
|
-
xl,
|
|
63
|
-
responsiveSmall ,
|
|
64
|
-
style,
|
|
65
|
-
...rest
|
|
66
|
-
}: CardProps) {
|
|
67
|
-
return (
|
|
68
|
-
<div
|
|
69
|
-
id={id || ''}
|
|
70
|
-
className={`
|
|
71
|
-
card
|
|
72
|
-
card_flex
|
|
73
|
-
${noGap ? 'no-gap' : ''}
|
|
74
|
-
${xl ? 'xl' : ''}
|
|
75
|
-
text-${color || ''}
|
|
76
|
-
${bg || ''}
|
|
77
|
-
${funcss || ''}
|
|
78
|
-
${roundEdge ? 'round-edge' : ''}
|
|
79
|
-
${shadowless ? 'shadowless' : ''}
|
|
80
|
-
${flat ? 'flat' : ''}
|
|
81
|
-
${horizontal ? 'horizontalCard' : ''}
|
|
82
|
-
${responsiveMedium ? 'responsiveMedium' : ''}
|
|
83
|
-
${responsiveSmall ? 'responsiveSmall' : ''}
|
|
84
|
-
|
|
85
|
-
`}
|
|
86
|
-
style={{
|
|
87
|
-
width: `${width || ''}`,
|
|
88
|
-
height: `${height || ''}`,
|
|
89
|
-
minHeight: `${minHeight || ''}`,
|
|
90
|
-
minWidth: `${minWidth || ''}`,
|
|
91
|
-
maxHeight: maxHeight || '',
|
|
92
|
-
maxWidth: maxWidth || '',
|
|
93
|
-
margin: `${margin || ''}`,
|
|
94
|
-
padding: `${padding || ''}`,
|
|
95
|
-
...style
|
|
96
|
-
}}
|
|
97
|
-
{...rest}
|
|
98
|
-
>
|
|
99
|
-
{image ? <div className={`${fab ? 'relative' : ''}`}>{image} {fab ? fab : ''}</div>: ''}
|
|
100
|
-
|
|
101
|
-
{header && !horizontal ? <CardHeader>{header}</CardHeader> : ''}
|
|
102
|
-
|
|
103
|
-
{body ?
|
|
104
|
-
<div>
|
|
105
|
-
{horizontal ? <CardHeader>{header}</CardHeader> : ''}
|
|
106
|
-
<CardBody> {body} </CardBody>
|
|
107
|
-
{horizontal ? <CardFooter>{footer}</CardFooter> : ''}
|
|
108
|
-
</div>
|
|
109
|
-
: ''
|
|
110
|
-
}
|
|
111
|
-
{children && <CardBody>{children}</CardBody>}
|
|
112
|
-
|
|
113
|
-
{footer && !horizontal ? <CardFooter>{footer}</CardFooter> : ''}
|
|
114
|
-
|
|
115
|
-
</div>
|
|
116
|
-
);
|
|
117
|
-
}
|
package/ui/card/CardBody.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, HTMLProps } from 'react';
|
|
2
|
-
|
|
3
|
-
interface CardBodyProps extends HTMLProps<HTMLDivElement> {
|
|
4
|
-
funcss?: string;
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default function CardBody({ funcss, children, ...rest }: CardBodyProps) {
|
|
9
|
-
return (
|
|
10
|
-
<div className={`card-body ${funcss || ''}`} {...rest}>
|
|
11
|
-
{children}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
}
|
package/ui/card/CardFab.tsx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React, { ReactNode, HTMLProps } from 'react';
|
|
3
|
-
|
|
4
|
-
interface CardFabProps extends HTMLProps<HTMLDivElement> {
|
|
5
|
-
funcss?: string;
|
|
6
|
-
position?: string;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default function CardFab({ funcss, position, children, ...rest }: CardFabProps) {
|
|
11
|
-
return (
|
|
12
|
-
<div className={`card-fab ${funcss || ''} ${position || ''}`} {...rest}>
|
|
13
|
-
{children}
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
}
|
package/ui/card/CardFooter.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, HTMLProps } from 'react';
|
|
2
|
-
|
|
3
|
-
interface CardFooterProps extends HTMLProps<HTMLDivElement> {
|
|
4
|
-
funcss?: string;
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default function CardFooter({ funcss, children, ...rest }: CardFooterProps) {
|
|
9
|
-
return (
|
|
10
|
-
<div className={`card-footer ${funcss || ''}`} {...rest}>
|
|
11
|
-
{children}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
}
|
package/ui/card/CardHeader.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, HTMLProps } from 'react';
|
|
2
|
-
|
|
3
|
-
interface CardHeaderProps extends HTMLProps<HTMLDivElement> {
|
|
4
|
-
funcss?: string;
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default function CardHeader({ funcss, children, ...rest }: CardHeaderProps) {
|
|
9
|
-
return (
|
|
10
|
-
<div className={`card-header ${funcss || ''}`} {...rest}>
|
|
11
|
-
{children}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
}
|