funuicss 2.7.7 → 2.7.9

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.
@@ -38,12 +38,12 @@ var react_1 = __importStar(require("react"));
38
38
  var framer_motion_1 = require("framer-motion");
39
39
  var react_intersection_observer_1 = require("react-intersection-observer");
40
40
  var animationVariants = {
41
- 'fade-up': { hidden: { opacity: 0, y: 40 }, visible: { opacity: 1, y: 0 } },
42
- 'fade-down': { hidden: { opacity: 0, y: -40 }, visible: { opacity: 1, y: 0 } },
41
+ 'fade-up': { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0 } },
42
+ 'fade-down': { hidden: { opacity: 0, y: -20 }, visible: { opacity: 1, y: 0 } },
43
43
  'fade-in': { hidden: { opacity: 0 }, visible: { opacity: 1 } },
44
- 'zoom-in': { hidden: { scale: 0.9, opacity: 0 }, visible: { scale: 1, opacity: 1 } },
45
- 'slide-left': { hidden: { x: 40, opacity: 0 }, visible: { x: 0, opacity: 1 } },
46
- 'slide-right': { hidden: { x: -40, opacity: 0 }, visible: { x: 0, opacity: 1 } },
44
+ 'zoom-in': { hidden: { scale: 0.95, opacity: 0 }, visible: { scale: 1, opacity: 1 } },
45
+ 'slide-left': { hidden: { x: 20, opacity: 0 }, visible: { x: 0, opacity: 1 } },
46
+ 'slide-right': { hidden: { x: -20, opacity: 0 }, visible: { x: 0, opacity: 1 } },
47
47
  };
48
48
  var ScrollInView = function (_a) {
49
49
  var children = _a.children, _b = _a.animationType, animationType = _b === void 0 ? 'fade-up' : _b, _c = _a.delay, delay = _c === void 0 ? 0 : _c, _d = _a.duration, duration = _d === void 0 ? 0.6 : _d, _e = _a.threshold, threshold = _e === void 0 ? 0.2 : _e, _f = _a.once, once = _f === void 0 ? false : _f, _g = _a.className, className = _g === void 0 ? '' : _g;
@@ -64,7 +64,7 @@ var ScrollInView = function (_a) {
64
64
  return (react_1.default.createElement(framer_motion_1.motion.div, { ref: ref, variants: variants, initial: "hidden", animate: controls, transition: {
65
65
  delay: delay,
66
66
  duration: duration,
67
- ease: [0.25, 1, 0.5, 1], // Natural cubic bezier
67
+ ease: 'linear', // SMOOTH and STRAIGHT
68
68
  }, className: className }, children));
69
69
  };
70
70
  exports.default = ScrollInView;
@@ -5,12 +5,12 @@ import { motion, useAnimation } from 'framer-motion';
5
5
  import { useInView } from 'react-intersection-observer';
6
6
 
7
7
  const animationVariants = {
8
- 'fade-up': { hidden: { opacity: 0, y: 40 }, visible: { opacity: 1, y: 0 } },
9
- 'fade-down': { hidden: { opacity: 0, y: -40 }, visible: { opacity: 1, y: 0 } },
8
+ 'fade-up': { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0 } },
9
+ 'fade-down': { hidden: { opacity: 0, y: -20 }, visible: { opacity: 1, y: 0 } },
10
10
  'fade-in': { hidden: { opacity: 0 }, visible: { opacity: 1 } },
11
- 'zoom-in': { hidden: { scale: 0.9, opacity: 0 }, visible: { scale: 1, opacity: 1 } },
12
- 'slide-left': { hidden: { x: 40, opacity: 0 }, visible: { x: 0, opacity: 1 } },
13
- 'slide-right': { hidden: { x: -40, opacity: 0 }, visible: { x: 0, opacity: 1 } },
11
+ 'zoom-in': { hidden: { scale: 0.95, opacity: 0 }, visible: { scale: 1, opacity: 1 } },
12
+ 'slide-left': { hidden: { x: 20, opacity: 0 }, visible: { x: 0, opacity: 1 } },
13
+ 'slide-right': { hidden: { x: -20, opacity: 0 }, visible: { x: 0, opacity: 1 } },
14
14
  };
15
15
 
16
16
  interface ScrollInViewProps {
@@ -57,7 +57,7 @@ const ScrollInView: React.FC<ScrollInViewProps> = ({
57
57
  transition={{
58
58
  delay,
59
59
  duration,
60
- ease: [0.25, 1, 0.5, 1], // Natural cubic bezier
60
+ ease: 'linear', // SMOOTH and STRAIGHT
61
61
  }}
62
62
  className={className}
63
63
  >
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, MouseEventHandler } from 'react';
2
2
  import * as React from 'react';
3
3
  interface AvatarProps {
4
4
  funcss?: string;
@@ -8,6 +8,7 @@ interface AvatarProps {
8
8
  bordered?: boolean;
9
9
  color?: string;
10
10
  content?: ReactNode;
11
+ onClick?: MouseEventHandler<HTMLDivElement>;
11
12
  }
12
- export default function Avatar({ funcss, children, size, bordered, bg, content, color }: AvatarProps): React.JSX.Element;
13
+ export default function Avatar({ funcss, children, size, bordered, bg, content, color, onClick, ...rest }: AvatarProps): React.JSX.Element;
13
14
  export {};
@@ -1,5 +1,16 @@
1
1
  "use strict";
2
2
  'use client';
3
+ var __assign = (this && this.__assign) || function () {
4
+ __assign = Object.assign || function(t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
+ t[p] = s[p];
9
+ }
10
+ return t;
11
+ };
12
+ return __assign.apply(this, arguments);
13
+ };
3
14
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
15
  if (k2 === undefined) k2 = k;
5
16
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -33,14 +44,24 @@ var __importStar = (this && this.__importStar) || (function () {
33
44
  return result;
34
45
  };
35
46
  })();
47
+ var __rest = (this && this.__rest) || function (s, e) {
48
+ var t = {};
49
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
+ t[p] = s[p];
51
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
+ t[p[i]] = s[p[i]];
55
+ }
56
+ return t;
57
+ };
36
58
  Object.defineProperty(exports, "__esModule", { value: true });
37
59
  exports.default = Avatar;
38
60
  var React = __importStar(require("react"));
39
61
  function Avatar(_a) {
40
- var funcss = _a.funcss, children = _a.children, _b = _a.size, size = _b === void 0 ? 2 : _b, _c = _a.bordered, bordered = _c === void 0 ? true : _c, bg = _a.bg, content = _a.content, color = _a.color;
41
- return (React.createElement("div", { className: "\n animated \n fade-in \n avatar \n ".concat(funcss || '', " \n ").concat(bg || 'lighter', " \n ").concat(bordered ? 'border' : '', "\n ").concat("text-".concat(color), "\n "), style: {
62
+ var funcss = _a.funcss, children = _a.children, _b = _a.size, size = _b === void 0 ? 2 : _b, _c = _a.bordered, bordered = _c === void 0 ? true : _c, bg = _a.bg, content = _a.content, color = _a.color, onClick = _a.onClick, rest = __rest(_a, ["funcss", "children", "size", "bordered", "bg", "content", "color", "onClick"]);
63
+ return (React.createElement("div", __assign({ className: "\n animated \n pointer\n fade-in \n avatar \n ".concat(funcss || '', " \n ").concat(bg || 'lighter', " \n ").concat(bordered ? 'border' : '', "\n ").concat(color ? "text-".concat(color) : '', "\n "), style: {
42
64
  width: "".concat(size, "rem"),
43
65
  height: "".concat(size, "rem"),
44
- } },
45
- React.createElement(React.Fragment, null, content || children)));
66
+ }, onClick: onClick }, rest), content || children));
46
67
  }
@@ -1,14 +1,17 @@
1
- 'use client';
2
- import { ReactNode } from 'react';
3
- import * as React from 'react'
1
+ 'use client';
2
+
3
+ import { ReactNode, MouseEventHandler } from 'react';
4
+ import * as React from 'react';
5
+
4
6
  interface AvatarProps {
5
7
  funcss?: string;
6
8
  children?: ReactNode;
7
9
  size?: number;
8
10
  bg?: string;
9
- bordered?:boolean ,
10
- color?: string,
11
+ bordered?: boolean;
12
+ color?: string;
11
13
  content?: ReactNode;
14
+ onClick?: MouseEventHandler<HTMLDivElement>;
12
15
  }
13
16
 
14
17
  export default function Avatar({
@@ -18,25 +21,30 @@ export default function Avatar({
18
21
  bordered = true,
19
22
  bg,
20
23
  content,
21
- color
24
+ color,
25
+ onClick,
26
+ ...rest
22
27
  }: AvatarProps) {
23
28
  return (
24
29
  <div
25
30
  className={`
26
31
  animated
32
+ pointer
27
33
  fade-in
28
34
  avatar
29
35
  ${funcss || ''}
30
36
  ${bg || 'lighter'}
31
37
  ${bordered ? 'border' : ''}
32
- ${`text-${color}`}
38
+ ${color ? `text-${color}` : ''}
33
39
  `}
34
40
  style={{
35
41
  width: `${size}rem`,
36
42
  height: `${size}rem`,
37
43
  }}
44
+ onClick={onClick}
45
+ {...rest}
38
46
  >
39
- <>{content || children}</>
47
+ {content || children}
40
48
  </div>
41
49
  );
42
50
  }
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ interface Activity {
3
+ id: string;
4
+ title: string;
5
+ date: Date;
6
+ color?: string;
7
+ }
8
+ interface CalendarProps {
9
+ activities: Activity[];
10
+ onAdd?: (date: Date) => void;
11
+ onActivityClick?: (activity: Activity) => void;
12
+ onDateClick?: (date: Date) => void;
13
+ funcss?: string;
14
+ weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
15
+ renderActivity?: (activity: Activity) => React.ReactNode;
16
+ showAdjacentMonths?: boolean;
17
+ minDate?: Date;
18
+ maxDate?: Date;
19
+ }
20
+ declare const Calendar: React.FC<CalendarProps>;
21
+ export default Calendar;
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ 'use client';
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ var react_1 = __importStar(require("react"));
41
+ var dayjs_1 = __importDefault(require("dayjs"));
42
+ var isSameOrAfter_1 = __importDefault(require("dayjs/plugin/isSameOrAfter"));
43
+ var isSameOrBefore_1 = __importDefault(require("dayjs/plugin/isSameOrBefore"));
44
+ var pi_1 = require("react-icons/pi");
45
+ var Avatar_1 = __importDefault(require("../avatar/Avatar"));
46
+ var Circle_1 = __importDefault(require("../specials/Circle"));
47
+ var RowFlex_1 = __importDefault(require("../specials/RowFlex"));
48
+ var Input_1 = __importDefault(require("../input/Input"));
49
+ var Button_1 = __importDefault(require("../button/Button"));
50
+ var Text_1 = __importDefault(require("../text/Text"));
51
+ dayjs_1.default.extend(isSameOrAfter_1.default);
52
+ dayjs_1.default.extend(isSameOrBefore_1.default);
53
+ var Calendar = function (_a) {
54
+ var activities = _a.activities, onAdd = _a.onAdd, onActivityClick = _a.onActivityClick, onDateClick = _a.onDateClick, _b = _a.funcss, funcss = _b === void 0 ? '' : _b, _c = _a.weekStart, weekStart = _c === void 0 ? 0 : _c, renderActivity = _a.renderActivity, _d = _a.showAdjacentMonths, showAdjacentMonths = _d === void 0 ? true : _d, minDate = _a.minDate, maxDate = _a.maxDate;
55
+ var _e = (0, react_1.useState)((0, dayjs_1.default)()), currentMonth = _e[0], setCurrentMonth = _e[1];
56
+ var _f = (0, react_1.useState)(null), hoveredDate = _f[0], setHoveredDate = _f[1];
57
+ var _g = (0, react_1.useState)(null), selectedDate = _g[0], setSelectedDate = _g[1];
58
+ // Memoized calculations
59
+ var _h = (0, react_1.useMemo)(function () {
60
+ var startOfMonth = currentMonth.startOf('month');
61
+ var endOfMonth = currentMonth.endOf('month');
62
+ // Calculate days grid
63
+ var firstDay = startOfMonth.day();
64
+ var daysBefore = (firstDay - weekStart + 7) % 7;
65
+ var daysInMonth = currentMonth.daysInMonth();
66
+ var totalDays = Math.ceil((daysBefore + daysInMonth) / 7) * 7;
67
+ var days = [];
68
+ // Previous month days
69
+ for (var i = daysBefore - 1; i >= 0; i--) {
70
+ var date = startOfMonth.subtract(i + 1, 'day');
71
+ days.push(showAdjacentMonths ? date : null);
72
+ }
73
+ // Current month days
74
+ for (var i = 0; i < daysInMonth; i++) {
75
+ days.push(startOfMonth.add(i, 'day'));
76
+ }
77
+ // Next month days
78
+ var remaining = totalDays - days.length;
79
+ for (var i = 0; i < remaining; i++) {
80
+ var date = endOfMonth.add(i + 1, 'day');
81
+ days.push(showAdjacentMonths ? date : null);
82
+ }
83
+ // Group activities by date
84
+ var monthActivities = {};
85
+ activities.forEach(function (activity) {
86
+ var date = (0, dayjs_1.default)(activity.date);
87
+ if (date.isSame(currentMonth, 'month') ||
88
+ (showAdjacentMonths && (date.isBefore(endOfMonth) && date.isAfter(startOfMonth)))) {
89
+ var key = date.format('YYYY-MM-DD');
90
+ if (!monthActivities[key])
91
+ monthActivities[key] = [];
92
+ monthActivities[key].push(activity);
93
+ }
94
+ });
95
+ return { days: days, monthActivities: monthActivities };
96
+ }, [currentMonth, activities, weekStart, showAdjacentMonths]), days = _h.days, monthActivities = _h.monthActivities;
97
+ // Navigation handlers
98
+ var prevMonth = function () { return setCurrentMonth(currentMonth.subtract(1, 'month')); };
99
+ var nextMonth = function () { return setCurrentMonth(currentMonth.add(1, 'month')); };
100
+ var goToToday = function () { return setCurrentMonth((0, dayjs_1.default)()); };
101
+ // Date handlers
102
+ var handleDateClick = function (date) {
103
+ if (isDateDisabled(date))
104
+ return;
105
+ setSelectedDate(date.toDate());
106
+ onDateClick === null || onDateClick === void 0 ? void 0 : onDateClick(date.toDate());
107
+ };
108
+ var handleAdd = function (e, date) {
109
+ e.stopPropagation();
110
+ if (isDateDisabled(date))
111
+ return;
112
+ onAdd === null || onAdd === void 0 ? void 0 : onAdd(date.toDate());
113
+ };
114
+ // Utility functions
115
+ var isDateDisabled = function (date) {
116
+ return ((minDate && date.isBefore((0, dayjs_1.default)(minDate), 'day')) ||
117
+ (maxDate && date.isAfter((0, dayjs_1.default)(maxDate), 'day')));
118
+ };
119
+ var isToday = function (date) { return date.isSame((0, dayjs_1.default)(), 'day'); };
120
+ var isSelected = function (date) { return selectedDate && date.isSame(selectedDate, 'day'); };
121
+ var isCurrentMonth = function (date) { return date.isSame(currentMonth, 'month'); };
122
+ // Weekday headers
123
+ var weekdays = (0, react_1.useMemo)(function () {
124
+ var days = [];
125
+ for (var i = 0; i < 7; i++) {
126
+ var day = (0, dayjs_1.default)().day((weekStart + i) % 7);
127
+ days.push(day.format('dd'));
128
+ }
129
+ return days;
130
+ }, [weekStart]);
131
+ return (react_1.default.createElement("div", { className: "calendar ".concat(funcss) },
132
+ react_1.default.createElement("div", { className: "calendar-header" },
133
+ react_1.default.createElement(Avatar_1.default, { funcss: 'border', onClick: prevMonth, "aria-label": "Previous month" },
134
+ react_1.default.createElement(pi_1.PiCaretLeft, null)),
135
+ react_1.default.createElement("div", { className: "calendar-title" },
136
+ react_1.default.createElement(Input_1.default, { value: currentMonth.month(), onChange: function (e) {
137
+ var newMonth = currentMonth.month(parseInt(e.target.value));
138
+ setCurrentMonth(newMonth);
139
+ }, type: "text", label: "Select Month", borderless: true, fullWidth: true, funcss: 'round-edge', select: true, options: [
140
+ { value: "", text: "-- Select month --" },
141
+ { value: "0", text: "January" },
142
+ { value: "1", text: "February" },
143
+ { value: "2", text: "March" },
144
+ { value: "3", text: "April" },
145
+ { value: "4", text: "May" },
146
+ { value: "5", text: "June" },
147
+ { value: "6", text: "July" },
148
+ { value: "7", text: "August" },
149
+ { value: "8", text: "September" },
150
+ { value: "9", text: "October" },
151
+ { value: "10", text: "November" },
152
+ { value: "11", text: "December" }
153
+ ] }),
154
+ react_1.default.createElement(Input_1.default, { type: "text", label: "Select Year", funcss: 'round-edge', fullWidth: true, borderless: true, select: true, value: currentMonth.year().toString(), onChange: function (e) {
155
+ var newYear = currentMonth.year(parseInt(e.target.value));
156
+ setCurrentMonth(newYear);
157
+ }, options: Array.from({ length: 21 }, function (_, i) {
158
+ var year = (0, dayjs_1.default)().year() - 10 + i;
159
+ return {
160
+ value: year.toString(),
161
+ text: year.toString(),
162
+ };
163
+ }) }),
164
+ react_1.default.createElement(Button_1.default, { bg: 'lighter border', onClick: goToToday }, "Today")),
165
+ react_1.default.createElement(Avatar_1.default, { funcss: 'border', onClick: nextMonth, "aria-label": "Next month" },
166
+ react_1.default.createElement(pi_1.PiCaretRight, null))),
167
+ react_1.default.createElement("div", { className: "calendar-weekdays" }, weekdays.map(function (d, i) { return (react_1.default.createElement("div", { key: i, className: "weekday-header" }, d)); })),
168
+ react_1.default.createElement("div", { className: "calendar-grid" }, days.map(function (date, index) {
169
+ if (!date)
170
+ return react_1.default.createElement("div", { key: index, className: "calendar-cell empty" });
171
+ var key = date.format('YYYY-MM-DD');
172
+ var activitiesToday = monthActivities[key] || [];
173
+ var disabled = isDateDisabled(date);
174
+ var today = isToday(date);
175
+ var selected = isSelected(date);
176
+ var currentMonth = isCurrentMonth(date);
177
+ return (react_1.default.createElement("div", { key: key, className: "calendar-cell ".concat(!currentMonth ? 'adjacent-month' : '', " ").concat(disabled ? 'disabled' : '', " ").concat(today ? 'today' : '', " ").concat(selected ? 'selected' : ''), onClick: function () { return handleDateClick(date); }, onMouseEnter: function () { return setHoveredDate(key); }, onMouseLeave: function () { return setHoveredDate(null); }, "aria-disabled": disabled, "aria-label": date.format('MMMM D, YYYY'), role: "button", tabIndex: 0 },
178
+ react_1.default.createElement("div", { className: "day-number" },
179
+ react_1.default.createElement(RowFlex_1.default, { justify: 'space-between', align: 'center', gap: 0.5 },
180
+ react_1.default.createElement(Text_1.default, { text: date.date(), color: today ? 'primary' : '', size: 'xl' }),
181
+ today && react_1.default.createElement(pi_1.PiChecks, { className: "text-success" }))),
182
+ react_1.default.createElement("div", { className: "activities" },
183
+ activitiesToday.slice(0, 2).map(function (activity) { return (react_1.default.createElement("div", { key: activity.id, className: "activity-tag", style: { backgroundColor: activity.color || '#e0e0e0' }, onClick: function (e) {
184
+ e.stopPropagation();
185
+ onActivityClick === null || onActivityClick === void 0 ? void 0 : onActivityClick(activity);
186
+ } }, renderActivity ? renderActivity(activity) : activity.title)); }),
187
+ activitiesToday.length > 2 && (react_1.default.createElement("div", { className: "activity-more" },
188
+ "+",
189
+ activitiesToday.length - 2,
190
+ " more"))),
191
+ hoveredDate === key && !disabled && (react_1.default.createElement("div", { className: "add-icon", onClick: function (e) { return handleAdd(e, date); }, "aria-label": "Add event on ".concat(date.format('MMMM D')) },
192
+ react_1.default.createElement(Circle_1.default, { hoverable: true, funcss: 'card bg' },
193
+ react_1.default.createElement(pi_1.PiPlus, null))))));
194
+ }))));
195
+ };
196
+ exports.default = Calendar;