funuicss 2.7.16 → 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.
Files changed (115) hide show
  1. package/css/fun.css +6663 -6653
  2. package/index.d.ts +2 -0
  3. package/index.js +5 -1
  4. package/js/google/AnalyticsHandler.d.ts +10 -0
  5. package/js/google/AnalyticsHandler.js +20 -0
  6. package/js/google/analytics.d.ts +6 -0
  7. package/js/google/analytics.js +53 -0
  8. package/package.json +1 -1
  9. package/tsconfig.tsbuildinfo +1 -1
  10. package/ui/flex/Flex.d.ts +3 -3
  11. package/ui/flex/Flex.js +2 -2
  12. package/ui/notification/Notification.d.ts +7 -3
  13. package/ui/notification/Notification.js +18 -14
  14. package/ui/scrolltotop/ScrollToTop.d.ts +3 -0
  15. package/ui/scrolltotop/ScrollToTop.js +61 -0
  16. package/ui/view/View.d.ts +27 -38
  17. package/ui/view/View.js +10 -38
  18. package/ui/vista/Vista.d.ts +6 -1
  19. package/ui/vista/Vista.js +33 -4
  20. package/assets/colors/colors.d.ts +0 -347
  21. package/assets/colors/colors.js +0 -348
  22. package/assets/colors/colors.tsx +0 -697
  23. package/hooks/useHls.tsx +0 -69
  24. package/index.tsx +0 -58
  25. package/js/Cookie.tsx +0 -91
  26. package/js/Fun.jsx +0 -225
  27. package/js/Fun.tsx +0 -239
  28. package/tsconfig.json +0 -20
  29. package/types/react-easy-export.d.ts +0 -4
  30. package/ui/ScrollInView/ScrollInView.tsx +0 -69
  31. package/ui/accordion/Accordion.tsx +0 -125
  32. package/ui/alert/Alert.tsx +0 -106
  33. package/ui/aos/AOS.tsx +0 -24
  34. package/ui/appbar/AppBar.tsx +0 -115
  35. package/ui/appbar/Hamburger.tsx +0 -30
  36. package/ui/avatar/Avatar.tsx +0 -52
  37. package/ui/blob/Blob.tsx +0 -34
  38. package/ui/breadcrumb/BreadCrumb.tsx +0 -48
  39. package/ui/button/Button.tsx +0 -153
  40. package/ui/calendar/ActivityCard.tsx +0 -27
  41. package/ui/calendar/Calendar.tsx +0 -343
  42. package/ui/card/Card.tsx +0 -117
  43. package/ui/card/CardBody.tsx +0 -14
  44. package/ui/card/CardFab.tsx +0 -16
  45. package/ui/card/CardFooter.tsx +0 -14
  46. package/ui/card/CardHeader.tsx +0 -14
  47. package/ui/carousel/Carousel.tsx +0 -148
  48. package/ui/chart/Bar.tsx +0 -121
  49. package/ui/chart/Line.tsx +0 -186
  50. package/ui/chart/Pie.tsx +0 -127
  51. package/ui/container/Container.tsx +0 -38
  52. package/ui/datepicker/DatePicker.tsx +0 -148
  53. package/ui/div/Div.tsx +0 -61
  54. package/ui/drop/Action.tsx +0 -16
  55. package/ui/drop/Down.tsx +0 -18
  56. package/ui/drop/Dropdown.tsx +0 -117
  57. package/ui/drop/Item.tsx +0 -15
  58. package/ui/drop/Menu.tsx +0 -40
  59. package/ui/drop/Up.tsx +0 -18
  60. package/ui/flex/Flex.tsx +0 -97
  61. package/ui/flex/FlexItem.tsx +0 -64
  62. package/ui/grid/Col.tsx +0 -43
  63. package/ui/grid/Grid.tsx +0 -37
  64. package/ui/input/Iconic.tsx +0 -43
  65. package/ui/input/Input.tsx +0 -409
  66. package/ui/list/Item.tsx +0 -18
  67. package/ui/list/List.tsx +0 -45
  68. package/ui/loader/Loader.tsx +0 -47
  69. package/ui/modal/Action.tsx +0 -14
  70. package/ui/modal/Close.tsx +0 -14
  71. package/ui/modal/Content.tsx +0 -15
  72. package/ui/modal/Header.tsx +0 -19
  73. package/ui/modal/Modal.tsx +0 -140
  74. package/ui/notification/Content.tsx +0 -14
  75. package/ui/notification/Footer.tsx +0 -14
  76. package/ui/notification/Header.tsx +0 -14
  77. package/ui/notification/Notification.tsx +0 -62
  78. package/ui/page/NotFound.tsx +0 -67
  79. package/ui/page/UnAuthorized.tsx +0 -64
  80. package/ui/progress/Bar.tsx +0 -114
  81. package/ui/richtext/RichText.tsx +0 -156
  82. package/ui/sidebar/SideBar.tsx +0 -202
  83. package/ui/sidebar/SideContent.tsx +0 -16
  84. package/ui/slider/Slider.tsx +0 -75
  85. package/ui/snackbar/SnackBar.tsx +0 -56
  86. package/ui/specials/Circle.tsx +0 -49
  87. package/ui/specials/CircleGroup.tsx +0 -49
  88. package/ui/specials/FullCenteredPage.tsx +0 -25
  89. package/ui/specials/Hr.tsx +0 -16
  90. package/ui/specials/RowFlex.tsx +0 -56
  91. package/ui/specials/Section.tsx +0 -18
  92. package/ui/step/Container.tsx +0 -27
  93. package/ui/step/Header.tsx +0 -16
  94. package/ui/step/Line.tsx +0 -17
  95. package/ui/step/Step.tsx +0 -17
  96. package/ui/table/Body.tsx +0 -10
  97. package/ui/table/Data.tsx +0 -15
  98. package/ui/table/Head.tsx +0 -10
  99. package/ui/table/Row.tsx +0 -16
  100. package/ui/table/Table.tsx +0 -372
  101. package/ui/text/Text.tsx +0 -179
  102. package/ui/theme/dark.tsx +0 -45
  103. package/ui/theme/darkenUtils.ts +0 -15
  104. package/ui/theme/theme.tsx +0 -48
  105. package/ui/theme/themes.ts +0 -154
  106. package/ui/tooltip/Tip.tsx +0 -34
  107. package/ui/tooltip/ToolTip.tsx +0 -20
  108. package/ui/video/Video.tsx +0 -348
  109. package/ui/video/videoFunctions.tsx +0 -19
  110. package/ui/video/videoShortcuts.ts +0 -13
  111. package/ui/view/View.tsx +0 -157
  112. package/ui/vista/Vista.tsx +0 -165
  113. package/utils/Emojis.tsx +0 -59
  114. package/utils/Functions.tsx +0 -9
  115. package/utils/getCssVariable.tsx +0 -9
@@ -1,154 +0,0 @@
1
- // components/ThemeProvider/themes.ts
2
-
3
- export const colorVarsToDarken = [
4
- '--primary50', '--primary100', '--primary200', '--primary300', '--primary400',
5
- '--secondary50', '--secondary100', '--secondary200', '--secondary300', '--secondary400',
6
- '--accent50', '--accent100', '--accent200', '--accent300', '--accent400',
7
- ];
8
-
9
- export const darkerDefaults = {
10
- '--success50': '#c1dbc7',
11
- '--success100': '#b0d1b3',
12
- '--success200': '#92bb97',
13
- '--success300': '#6aa375',
14
- '--success400': '#3f864e',
15
-
16
- '--warning50': '#e6dcd4',
17
- '--warning100': '#e6d1bb',
18
- '--warning200': '#e2b783',
19
- '--warning300': '#e09b59',
20
- '--warning400': '#d57627',
21
-
22
- '--info50': '#c1d3e6',
23
- '--info100': '#b3c8e0',
24
- '--info200': '#91b3d4',
25
- '--info300': '#5a9bcb',
26
- '--info400': '#2f85c3',
27
-
28
- '--error50': '#e6cfcf',
29
- '--error100': '#e6bebe',
30
- '--error200': '#e29e9e',
31
- '--error300': '#da7373',
32
- '--error400': '#cc4646',
33
- };
34
-
35
- export const themes = {
36
- light: {
37
- '--page-bg': '#FFFFFF',
38
- '--text-color': '#000000',
39
- },
40
- dark: {
41
- '--page-bg': '#1E1E1E',
42
- '--text-color': '#FFFFFF',
43
- '--raiseThemes': 'rgba(32, 32, 32, 0.5)',
44
- '--raiseOpaque': 'rgba(32, 32, 32, 0.8)',
45
- '--borderColor': '#4a4a4a',
46
- '--borderRgb': '74, 74, 74',
47
- '--lighter': '#2a2a2a',
48
- '--linkColor': '#9ab',
49
- '--cardBg': '#1e1e1e',
50
- '--card': `4px 4px 6px #141414, -4px -4px 6px #272727`,
51
- ...darkerDefaults,
52
- },
53
- 'dark-blue': {
54
- '--page-bg': '#0d1b2a',
55
- '--text-color': '#f0f4f8',
56
- '--text-muted': '#a9bcd0',
57
- '--raiseThemes': 'rgba(13, 27, 42, 0.5)',
58
- '--raiseOpaque': 'rgba(13, 27, 42, 0.8)',
59
- '--borderColor': '#1e3249',
60
- '--borderRgb': '30, 50, 73',
61
- '--lighter': '#1b2c3f',
62
- '--linkColor': '#56ccf2',
63
- '--accent': '#66d9ef',
64
- '--cardBg': '#0d1b2a',
65
- '--card': `4px 4px 6px #08121d, -4px -4px 6px #15273b`,
66
- ...darkerDefaults,
67
- },
68
- 'light-gray': {
69
- '--page-bg': '#e8e8e8',
70
- '--text-color': '#2a2a2a',
71
- '--text-muted': '#777777',
72
- '--raiseThemes': 'rgba(255, 255, 255, 0.6)',
73
- '--raiseOpaque': 'rgba(255, 255, 255, 0.94)',
74
- '--borderColor': '#d0d0d0',
75
- '--borderRgb': '208, 208, 208',
76
- '--lighter': '#f4f4f4',
77
- '--linkColor': '#202020',
78
- '--accent': '#4a90e2',
79
- '--cardBg': '#e8e8e8',
80
- '--card': `8px 8px 16px #c5c5c5, -8px -8px 16px #ffffff`,
81
- },
82
- 'pastel-green': {
83
- '--page-bg': '#e6f5ea',
84
- '--text-color': '#2f4f4f',
85
- '--text-muted': '#5a7d7d',
86
- '--raiseThemes': 'rgba(230, 245, 234, 0.6)',
87
- '--raiseOpaque': 'rgba(230, 245, 234, 0.9)',
88
- '--borderColor': '#b5d3c5',
89
- '--borderRgb': '181, 211, 197',
90
- '--lighter': '#f1faf3',
91
- '--linkColor': '#4caf50',
92
- '--accent': '#81c784',
93
- '--cardBg': '#e6f5ea',
94
- '--card': `6px 6px 12px #cde3d5, -6px -6px 12px #ffffff`,
95
- },
96
- 'warm-orange': {
97
- '--page-bg': '#fff3e0',
98
- '--text-color': '#4e342e',
99
- '--text-muted': '#8d6e63',
100
- '--raiseThemes': 'rgba(255, 243, 224, 0.6)',
101
- '--raiseOpaque': 'rgba(255, 243, 224, 0.94)',
102
- '--borderColor': '#ffccbc',
103
- '--borderRgb': '255, 204, 188',
104
- '--lighter': '#ffecb3',
105
- '--linkColor': '#ff7043',
106
- '--accent': '#ff8a65',
107
- '--cardBg': '#fff3e0',
108
- '--card': `6px 6px 14px #e0c7b3, -6px -6px 14px #ffffff`,
109
- },
110
- 'frosted-glass': {
111
- '--page-bg': 'rgba(255, 255, 255, 0.75)',
112
- '--text-color': '#111',
113
- '--text-muted': '#666',
114
- '--raiseThemes': 'rgba(255, 255, 255, 0.4)',
115
- '--raiseOpaque': 'rgba(255, 255, 255, 0.9)',
116
- '--borderColor': '#ccc',
117
- '--borderRgb': '204, 204, 204',
118
- '--lighter': '#fafafa',
119
- '--linkColor': '#0099cc',
120
- '--accent': '#00c2ff',
121
- '--cardBg': 'rgba(255, 255, 255, 0.6)',
122
- '--card': `4px 4px 10px rgba(0, 0, 0, 0.05), -4px -4px 10px rgba(255, 255, 255, 0.5)`,
123
- },
124
- 'midnight-purple': {
125
- '--page-bg': '#1a1333',
126
- '--text-color': '#e0e0ff',
127
- '--text-muted': '#b39ddb',
128
- '--raiseThemes': 'rgba(26, 19, 51, 0.5)',
129
- '--raiseOpaque': 'rgba(26, 19, 51, 0.85)',
130
- '--borderColor': '#443a66',
131
- '--borderRgb': '68, 58, 102',
132
- '--lighter': '#241b3f',
133
- '--linkColor': '#d1c4e9',
134
- '--accent': '#9575cd',
135
- '--cardBg': '#1a1333',
136
- '--card': `4px 4px 8px #120c26, -4px -4px 8px #221a40`,
137
- ...darkerDefaults,
138
- },
139
- 'cyber-metal': {
140
- '--page-bg': '#0f1115',
141
- '--text-color': '#d0d0d0',
142
- '--text-muted': '#888',
143
- '--raiseThemes': 'rgba(15, 17, 21, 0.4)',
144
- '--raiseOpaque': 'rgba(15, 17, 21, 0.85)',
145
- '--borderColor': '#2a2a2a',
146
- '--borderRgb': '42, 42, 42',
147
- '--lighter': '#1a1a1a',
148
- '--linkColor': '#00ffe0',
149
- '--accent': '#39ff14',
150
- '--cardBg': '#0f1115',
151
- '--card': `6px 6px 12px #050607, -6px -6px 12px #1c1f25`,
152
- ...darkerDefaults,
153
- }
154
- };
@@ -1,34 +0,0 @@
1
- import * as React from 'react';
2
-
3
- interface TipProps {
4
- tip: string;
5
- funcss?: string;
6
- children?: React.ReactNode;
7
- content?: React.ReactNode;
8
- message?: React.ReactNode;
9
- animation?: string;
10
- duration?: number;
11
- }
12
-
13
- export default function Tip({
14
- tip,
15
- funcss,
16
- children,
17
- content,
18
- message,
19
- animation,
20
- duration,
21
- ...rest
22
- }: TipProps) {
23
- const text = message || content || children;
24
- return (
25
- <span
26
- className={`tip-${tip} tip ${funcss ? funcss : ''}`}
27
- style={{ animation: ` ${duration ? duration : 0}s ${animation ? animation : ''}`}}
28
- {...rest}
29
- >
30
- {text}
31
-
32
- </span>
33
- );
34
- }
@@ -1,20 +0,0 @@
1
- import * as React from 'react';
2
- import Tip from './Tip';
3
-
4
- interface ToolTipProps {
5
- funcss?: string;
6
- children?: React.ReactNode;
7
- }
8
-
9
- export default function ToolTip({ funcss, children, ...rest }: ToolTipProps) {
10
-
11
- return (
12
- <span
13
-
14
- className={`tooltip ${funcss ?? ''}`}
15
- {...rest}
16
- >
17
- {children}
18
- </span>
19
- );
20
- }
@@ -1,348 +0,0 @@
1
-
2
- 'use client';
3
- import React, { useState, useRef, useEffect, useCallback } from 'react';
4
- import {
5
- PiCornersOut,
6
- PiFastForward,
7
- PiPause,
8
- PiPlay,
9
- PiRewind,
10
- PiSpeakerLow,
11
- } from 'react-icons/pi';
12
- import { IoCloudDownloadOutline } from 'react-icons/io5';
13
- import Text from '../text/Text';
14
- import RowFlex from '../specials/RowFlex';
15
- import ToolTip from '../tooltip/ToolTip';
16
- import Circle from '../specials/Circle';
17
- import Tip from '../tooltip/Tip';
18
- import Image from 'next/image';
19
-
20
- import { formatTime, getBufferedPercent } from './videoFunctions';
21
- import { handleKeyDown } from './videoShortcuts';
22
-
23
- interface VideoProps {
24
- src: string;
25
- poster?: string;
26
- onDuration?: (duration: number) => void;
27
- isPause?: boolean;
28
- spacebarPlay?: boolean;
29
- className?: string;
30
- autoPlay?: boolean;
31
- }
32
-
33
- export default function Video({ src, poster, onDuration, isPause, className, autoPlay , spacebarPlay = true, ...rest }: VideoProps) {
34
- const videoRef = useRef<HTMLVideoElement | null>(null);
35
- const containerRef = useRef<HTMLDivElement | null>(null);
36
- const animationFrameRef = useRef<number | null>(null);
37
-
38
- const [isPlaying, setIsPlaying] = useState(false);
39
- const [currentTime, setCurrentTime] = useState(0);
40
- const [duration, setDuration] = useState(0);
41
- const [volume, setVolume] = useState(1);
42
- const [isFullScreen, setIsFullScreen] = useState(false);
43
- const [showVolume, setShowVolume] = useState(false);
44
- const [isMouseMoving, setIsMouseMoving] = useState(true);
45
- const [hasStarted, setHasStarted] = useState(false);
46
-
47
-
48
-
49
- const handleVideoEnd = () => {
50
- setIsPlaying(false);
51
- setCurrentTime(duration); // optional
52
- };
53
-
54
- useEffect(() => {
55
- const video = videoRef.current;
56
- if (!video) return;
57
-
58
- video.addEventListener('ended', handleVideoEnd);
59
- return () => {
60
- video.removeEventListener('ended', handleVideoEnd);
61
- };
62
- }, [duration]);
63
-
64
-
65
- const playVideo = () => {
66
- const video = videoRef.current;
67
- if (video) {
68
- // ✅ if video ended, reset it to start
69
- if (video.currentTime === video.duration) {
70
- video.currentTime = 0;
71
- }
72
-
73
- video.play().then(() => {
74
- setIsPlaying(true);
75
- setHasStarted(true);
76
- }).catch(() => {});
77
- }
78
- };
79
-
80
- const pauseVideo = () => {
81
- const video = videoRef.current;
82
- if (video && !video.paused) {
83
- video.pause();
84
- setIsPlaying(false);
85
- }
86
- };
87
-
88
-
89
-
90
- useEffect(() => {
91
- const handleKey = (e: KeyboardEvent) => handleKeyDown(e, isPlaying, playVideo, pauseVideo, spacebarPlay);
92
- document.addEventListener('keydown', handleKey);
93
- return () => document.removeEventListener('keydown', handleKey);
94
- }, [isPlaying]);
95
-
96
- const handlePlayPauseToggle = () => {
97
- isPlaying ? pauseVideo() : playVideo();
98
- };
99
-
100
- const handleRewind = () => {
101
- const video = videoRef.current;
102
- if (video) video.currentTime = Math.max(video.currentTime - 10, 0);
103
- };
104
-
105
- const handleForward = () => {
106
- const video = videoRef.current;
107
- if (video) video.currentTime = Math.min(video.currentTime + 10, duration);
108
- };
109
-
110
- const handleToggleFullScreen = () => {
111
- const element = containerRef.current;
112
- if (!element) return;
113
- if (!document.fullscreenElement) {
114
- element.requestFullscreen?.();
115
- } else {
116
- document.exitFullscreen?.();
117
- }
118
- };
119
-
120
- const updateCurrentTime = useCallback(() => {
121
- const video = videoRef.current;
122
- if (video) {
123
- setCurrentTime(video.currentTime);
124
- animationFrameRef.current = requestAnimationFrame(updateCurrentTime);
125
- }
126
- }, []);
127
-
128
- const handleLoadedMetadata = () => {
129
- const video = videoRef.current;
130
- if (video) {
131
- setDuration(video.duration || 0);
132
- onDuration?.(video.duration);
133
- if (autoPlay) {
134
- video.play().then(() => {
135
- setIsPlaying(true); // ✅ update UI state
136
- setHasStarted(true);
137
- }).catch(() => {});
138
- }
139
- }
140
- };
141
-
142
-
143
- useEffect(() => {
144
- if (autoPlay && videoRef.current) {
145
- videoRef.current.muted = true; // ✅ important for autoplay to work
146
- videoRef.current.play().then(() => {
147
- setIsPlaying(true);
148
- setHasStarted(true);
149
- }).catch((err) => {
150
- console.warn('Autoplay failed', err);
151
- });
152
- }
153
- }, [autoPlay]);
154
-
155
-
156
- const handleProgressBarChange = (e: React.ChangeEvent<HTMLInputElement>) => {
157
- const newTime = parseFloat(e.target.value);
158
- if (videoRef.current) {
159
- videoRef.current.currentTime = newTime;
160
- }
161
- setCurrentTime(newTime);
162
- };
163
-
164
- const handleVolumeChange = (e: React.ChangeEvent<HTMLInputElement>) => {
165
- if(videoRef.current){
166
- videoRef.current.muted = false;
167
- }
168
- const newVolume = parseFloat(e.target.value);
169
- setVolume(newVolume);
170
- if (videoRef.current) videoRef.current.volume = newVolume;
171
- };
172
-
173
- useEffect(() => {
174
- if (autoPlay && videoRef.current) {
175
- const playPromise = videoRef.current.play();
176
- if (playPromise !== undefined) {
177
- playPromise.catch(() => {});
178
- }
179
- }
180
- }, [autoPlay]);
181
-
182
- useEffect(() => {
183
- if (videoRef.current) {
184
- videoRef.current.volume = volume;
185
- }
186
- }, [volume]);
187
-
188
- useEffect(() => {
189
- if (isPause) pauseVideo();
190
- }, [isPause]);
191
-
192
- useEffect(() => {
193
- const handleFullscreenChange = () => {
194
- setIsFullScreen(!!document.fullscreenElement);
195
- };
196
- document.addEventListener('fullscreenchange', handleFullscreenChange);
197
- return () => document.removeEventListener('fullscreenchange', handleFullscreenChange);
198
- }, []);
199
-
200
- useEffect(() => {
201
- let timer: NodeJS.Timeout;
202
- const handleMouseMove = (e: MouseEvent | TouchEvent) => {
203
- if (containerRef.current?.contains(e.target as Node)) {
204
- setIsMouseMoving(true);
205
- clearTimeout(timer);
206
- timer = setTimeout(() => setIsMouseMoving(false), 2000);
207
- }
208
- };
209
- document.addEventListener('mousemove', handleMouseMove);
210
- document.addEventListener('touchstart', handleMouseMove);
211
- return () => {
212
- document.removeEventListener('mousemove', handleMouseMove);
213
- document.removeEventListener('touchstart', handleMouseMove);
214
- clearTimeout(timer);
215
- };
216
- }, []);
217
-
218
- useEffect(() => {
219
- if (isPlaying) {
220
- animationFrameRef.current = requestAnimationFrame(updateCurrentTime);
221
- } else if (animationFrameRef.current) {
222
- cancelAnimationFrame(animationFrameRef.current);
223
- }
224
- return () => {
225
- if (animationFrameRef.current) cancelAnimationFrame(animationFrameRef.current);
226
- };
227
- }, [isPlaying, updateCurrentTime]);
228
-
229
- useEffect(() => {
230
- return () => {
231
- pauseVideo();
232
- };
233
- }, []);
234
-
235
-
236
- useEffect(() => {
237
- const video = videoRef.current;
238
- if (!video) return;
239
-
240
- const onEnd = () => {
241
- setIsPlaying(false);
242
- };
243
-
244
- video.addEventListener('ended', onEnd);
245
- return () => video.removeEventListener('ended', onEnd);
246
- }, []);
247
-
248
-
249
- return (
250
- <div ref={containerRef} className={`video_container fit ${className || ''}`} id="fun_video_container">
251
- {poster && !hasStarted && !isPlaying && (
252
- <div
253
- style={{ backgroundImage: `url(${poster})` }}
254
- className="video_poster"
255
- />
256
- )}
257
- <video
258
- ref={videoRef}
259
- preload="auto"
260
- src={src}
261
- className="video_player fit min-w-200"
262
- onClick={handlePlayPauseToggle}
263
- onLoadedMetadata={handleLoadedMetadata}
264
- playsInline
265
- controls={false}
266
- {...rest}
267
- />
268
-
269
- <div className={`video_controls ${isMouseMoving ? 'show_controls' : 'hide_controls'}`}>
270
- <div className="w-80-p center animated fade-in">
271
- <RowFlex gap={0.3} funcss='mb-2' alignItems="center">
272
- <div className='video_time'>
273
- <Text text={formatTime(currentTime)} funcss='m-0' size="sm" />
274
- </div>
275
- <div className="col width-100-p">
276
- <input
277
- type="range"
278
- min={0}
279
- max={duration}
280
- value={currentTime}
281
- onChange={handleProgressBarChange}
282
- className="width-100-p videoSlider styled-slider m-0"
283
- aria-label="Progress bar"
284
- style={{ '--progress': `${(currentTime / duration) * 100}` } as React.CSSProperties}
285
- />
286
- </div>
287
- <div className="video_time">
288
- <Text text={`${formatTime(duration - currentTime)}`} funcss='m-0' size="sm" />
289
- </div>
290
- </RowFlex>
291
- </div>
292
-
293
- <div className="center-play-icon animated fade-in" onClick={handlePlayPauseToggle}>
294
- <div className='play-button'>
295
- {isPlaying ? <PiPause size={30} /> : <PiPlay size={30} />}
296
- </div>
297
- </div>
298
-
299
- <RowFlex funcss='animated slide-up' gap={1} justify="center">
300
- <RowFlex gap={0.5}>
301
- <ToolTip>
302
- <Circle bordered size={2} onClick={handleRewind}><PiRewind /></Circle>
303
- <Tip tip="top" animation="ScaleUp" duration={0.5} content="10 sec Back" />
304
- </ToolTip>
305
-
306
- <ToolTip>
307
- <Circle bordered size={2} onClick={handleForward}><PiFastForward /></Circle>
308
- <Tip tip="top" animation="ScaleUp" duration={0.5} content="10 sec Forward" />
309
- </ToolTip>
310
-
311
- <div onMouseEnter={() => setShowVolume(true)} onMouseLeave={() => setShowVolume(false)}>
312
- <RowFlex>
313
- <Circle bordered size={2}><PiSpeakerLow /></Circle>
314
- {showVolume && (
315
- <input
316
- type="range"
317
- min={0}
318
- max={1}
319
- step={0.01}
320
- value={volume}
321
- onChange={handleVolumeChange}
322
- className="width-100 max-w-50 animated slide-right"
323
- style={{ height: '3px', marginLeft: 8 }}
324
- aria-label="Volume"
325
- />
326
- )}
327
- </RowFlex>
328
- </div>
329
- </RowFlex>
330
-
331
- <RowFlex gap={0.3}>
332
- <ToolTip>
333
- <Circle bordered size={2} onClick={handleToggleFullScreen}><PiCornersOut /></Circle>
334
- <Tip tip="top" animation="ScaleUp" duration={0.5} content="Expand" />
335
- </ToolTip>
336
-
337
- <ToolTip>
338
- <Circle bordered size={2} onClick={() => window.open(src || '', '_blank')}>
339
- <IoCloudDownloadOutline />
340
- </Circle>
341
- <Tip tip="top" animation="ScaleUp" duration={0.5} content="Download" />
342
- </ToolTip>
343
- </RowFlex>
344
- </RowFlex>
345
- </div>
346
- </div>
347
- );
348
- }
@@ -1,19 +0,0 @@
1
- // videoFunctions.tsx
2
- import { MutableRefObject } from 'react';
3
-
4
- export const formatTime = (time: number): string => {
5
- if (isNaN(time)) return '00:00';
6
- const minutes = Math.floor(time / 60);
7
- const seconds = Math.floor(time % 60);
8
- return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
9
- };
10
-
11
- export const getBufferedPercent = (
12
- videoRef: MutableRefObject<HTMLVideoElement | null>,
13
- duration: number
14
- ): number => {
15
- const video = videoRef.current;
16
- if (!video || video.buffered.length === 0) return 0;
17
- const end = video.buffered.end(video.buffered.length - 1);
18
- return (end / duration) * 100;
19
- };
@@ -1,13 +0,0 @@
1
- // videoShortcuts.ts
2
- export const handleKeyDown = (
3
- e: KeyboardEvent,
4
- isPlaying: boolean,
5
- playVideo: () => void,
6
- pauseVideo: () => void ,
7
- spacebarPlay?: boolean
8
- ) => {
9
- if (e.key === ' ' && spacebarPlay) {
10
- e.preventDefault();
11
- isPlaying ? pauseVideo() : playVideo();
12
- }
13
- };