@therealtinhtute/baroiplayer 1.0.4 → 1.0.5

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.
@@ -0,0 +1,125 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ interface DeviceInfo {
4
+ isMobile: boolean;
5
+ isTablet: boolean;
6
+ isDesktop: boolean;
7
+ userAgent: string;
8
+ screenWidth: number;
9
+ screenHeight: number;
10
+ }
11
+
12
+ export function useDeviceInfo(): DeviceInfo {
13
+ const [deviceInfo, setDeviceInfo] = useState<DeviceInfo>(() => {
14
+ if (typeof window === 'undefined') {
15
+ return {
16
+ isMobile: false,
17
+ isTablet: false,
18
+ isDesktop: true,
19
+ userAgent: '',
20
+ screenWidth: 1920,
21
+ screenHeight: 1080
22
+ };
23
+ }
24
+
25
+ const userAgent = navigator.userAgent;
26
+ const screenWidth = window.innerWidth;
27
+ const screenHeight = window.innerHeight;
28
+
29
+ const isMobile = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) && screenWidth < 768;
30
+ const isTablet = /iPad|Android/i.test(userAgent) && screenWidth >= 768 && screenWidth < 1024;
31
+ const isDesktop = !isMobile && !isTablet;
32
+
33
+ return {
34
+ isMobile,
35
+ isTablet,
36
+ isDesktop,
37
+ userAgent,
38
+ screenWidth,
39
+ screenHeight
40
+ };
41
+ });
42
+
43
+ useEffect(() => {
44
+ if (typeof window === 'undefined') return;
45
+
46
+ const handleResize = () => {
47
+ const userAgent = navigator.userAgent;
48
+ const screenWidth = window.innerWidth;
49
+ const screenHeight = window.innerHeight;
50
+
51
+ const isMobile = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) && screenWidth < 768;
52
+ const isTablet = /iPad|Android/i.test(userAgent) && screenWidth >= 768 && screenWidth < 1024;
53
+ const isDesktop = !isMobile && !isTablet;
54
+
55
+ setDeviceInfo({
56
+ isMobile,
57
+ isTablet,
58
+ isDesktop,
59
+ userAgent,
60
+ screenWidth,
61
+ screenHeight
62
+ });
63
+ };
64
+
65
+ window.addEventListener('resize', handleResize);
66
+ return () => window.removeEventListener('resize', handleResize);
67
+ }, []);
68
+
69
+ return deviceInfo;
70
+ }
71
+
72
+ export function useContainerQuery(): boolean {
73
+ const [isSmall, setIsSmall] = useState(false);
74
+
75
+ useEffect(() => {
76
+ if (typeof window === 'undefined') return;
77
+
78
+ const checkSize = () => {
79
+ setIsSmall(window.innerWidth < 640);
80
+ };
81
+
82
+ checkSize();
83
+ window.addEventListener('resize', checkSize);
84
+ return () => window.removeEventListener('resize', checkSize);
85
+ }, []);
86
+
87
+ return isSmall;
88
+ }
89
+
90
+ export function useMobileOptimizations() {
91
+ const deviceInfo = useDeviceInfo();
92
+ const [isTouch, setIsTouch] = useState(false);
93
+
94
+ useEffect(() => {
95
+ setIsTouch('ontouchstart' in window || navigator.maxTouchPoints > 0);
96
+ }, []);
97
+
98
+ return {
99
+ ...deviceInfo,
100
+ isTouch,
101
+ preferReducedMotion: window.matchMedia('(prefers-reduced-motion: reduce)').matches,
102
+ prefersDarkScheme: window.matchMedia('(prefers-color-scheme: dark)').matches
103
+ };
104
+ }
105
+
106
+ export function useHapticFeedback() {
107
+ const deviceInfo = useDeviceInfo();
108
+
109
+ const triggerHaptic = (type: 'light' | 'medium' | 'heavy' = 'light') => {
110
+ if (!deviceInfo.isMobile || !('vibrate' in navigator)) return;
111
+
112
+ const patterns = {
113
+ light: [10],
114
+ medium: [20],
115
+ heavy: [50]
116
+ };
117
+
118
+ navigator.vibrate(patterns[type]);
119
+ };
120
+
121
+ return {
122
+ triggerHaptic,
123
+ supported: deviceInfo.isMobile && 'vibrate' in navigator
124
+ };
125
+ }
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import * as React from "react";
3
- import { useDeviceInfo, useHapticFeedback } from "@rp/ui/hooks/use-mobile";
3
+ import { useDeviceInfo, useHapticFeedback } from "./use-mobile";
4
4
  // Default configuration
5
5
  const defaultConfig = {
6
6
  enabledGestures: ['tap', 'double-tap', 'long-press', 'swipe-left', 'swipe-right', 'swipe-up', 'swipe-down', 'pinch-in', 'pinch-out'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@therealtinhtute/baroiplayer",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "A customizable media player component library for React",
@@ -84,11 +84,31 @@
84
84
  "peerDependencies": {
85
85
  "react": ">=18.0.0",
86
86
  "react-dom": ">=18.0.0",
87
- "tailwindcss": ">=4.0.0"
87
+ "tailwindcss": ">=4.0.0",
88
+ "video.js": ">=7.0.0",
89
+ "hls.js": ">=1.0.0",
90
+ "@videojs/http-streaming": ">=2.0.0",
91
+ "videojs-contrib-quality-levels": ">=2.0.0",
92
+ "videojs-hls-quality-selector": ">=2.0.0"
88
93
  },
89
94
  "peerDependenciesMeta": {
90
95
  "tailwindcss": {
91
96
  "optional": true
97
+ },
98
+ "video.js": {
99
+ "optional": true
100
+ },
101
+ "hls.js": {
102
+ "optional": true
103
+ },
104
+ "@videojs/http-streaming": {
105
+ "optional": true
106
+ },
107
+ "videojs-contrib-quality-levels": {
108
+ "optional": true
109
+ },
110
+ "videojs-hls-quality-selector": {
111
+ "optional": true
92
112
  }
93
113
  },
94
114
  "keywords": [
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React from "react"
4
4
  import { useMediaSelector } from "../context/media-context"
5
- import { useDeviceInfo, useContainerQuery } from "@rp/ui/hooks/use-mobile"
5
+ import { useDeviceInfo, useContainerQuery } from "../hooks/use-mobile"
6
6
  import { cn } from "../lib/utils"
7
7
 
8
8
  export interface MediaPlayerControlsProps {
@@ -9,7 +9,7 @@ import {
9
9
  } from "../context/media-context"
10
10
  import { MediaProvider } from "../context/media-provider"
11
11
  import { useMediaGestures } from "../hooks/use-touch-gestures"
12
- import { useMobileOptimizations, useDeviceInfo } from "@rp/ui/hooks/use-mobile"
12
+ import { useMobileOptimizations, useDeviceInfo } from "../hooks/use-mobile"
13
13
  import { cn } from "../lib/utils"
14
14
 
15
15
  // Utility function to compose refs
@@ -0,0 +1,49 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { cn } from '../lib/utils';
3
+
4
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
5
+ variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
6
+ size?: 'default' | 'sm' | 'lg' | 'icon';
7
+ asChild?: boolean;
8
+ }
9
+
10
+ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
11
+ ({ className, variant = 'default', size = 'default', asChild = false, ...props }, ref) => {
12
+ const baseClasses = 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50';
13
+
14
+ const variants = {
15
+ default: 'bg-primary text-primary-foreground hover:bg-primary/90',
16
+ destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
17
+ outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
18
+ secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
19
+ ghost: 'hover:bg-accent hover:text-accent-foreground',
20
+ link: 'text-primary underline-offset-4 hover:underline',
21
+ };
22
+
23
+ const sizes = {
24
+ default: 'h-10 px-4 py-2',
25
+ sm: 'h-9 rounded-md px-3',
26
+ lg: 'h-11 rounded-md px-8',
27
+ icon: 'h-10 w-10',
28
+ };
29
+
30
+ const Comp = asChild ? 'span' : 'button';
31
+
32
+ return (
33
+ <Comp
34
+ className={cn(
35
+ baseClasses,
36
+ variants[variant],
37
+ sizes[size],
38
+ className
39
+ )}
40
+ ref={ref}
41
+ {...props}
42
+ />
43
+ );
44
+ }
45
+ );
46
+
47
+ Button.displayName = 'Button';
48
+
49
+ export { Button };
@@ -0,0 +1,137 @@
1
+ import React, { useState, useRef, useEffect, forwardRef } from 'react';
2
+ import { cn } from '../lib/utils';
3
+
4
+ interface DropdownMenuProps {
5
+ children: React.ReactNode;
6
+ }
7
+
8
+ interface DropdownMenuTriggerProps {
9
+ children: React.ReactNode;
10
+ asChild?: boolean;
11
+ }
12
+
13
+ interface DropdownMenuContentProps {
14
+ children: React.ReactNode;
15
+ className?: string;
16
+ }
17
+
18
+ interface DropdownMenuItemProps {
19
+ children: React.ReactNode;
20
+ className?: string;
21
+ onClick?: () => void;
22
+ }
23
+
24
+ interface DropdownMenuLabelProps {
25
+ children: React.ReactNode;
26
+ className?: string;
27
+ }
28
+
29
+ interface DropdownMenuSeparatorProps {
30
+ className?: string;
31
+ }
32
+
33
+ const DropdownMenu: React.FC<DropdownMenuProps> = ({ children }) => {
34
+ const [isOpen, setIsOpen] = useState(false);
35
+ const dropdownRef = useRef<HTMLDivElement>(null);
36
+
37
+ useEffect(() => {
38
+ const handleClickOutside = (event: MouseEvent) => {
39
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
40
+ setIsOpen(false);
41
+ }
42
+ };
43
+
44
+ document.addEventListener('mousedown', handleClickOutside);
45
+ return () => document.removeEventListener('mousedown', handleClickOutside);
46
+ }, []);
47
+
48
+ return (
49
+ <div ref={dropdownRef} className="relative inline-block text-left">
50
+ {React.Children.map(children, (child) => {
51
+ if (React.isValidElement(child)) {
52
+ return React.cloneElement(child as React.ReactElement, { isOpen, setIsOpen });
53
+ }
54
+ return child;
55
+ })}
56
+ </div>
57
+ );
58
+ };
59
+
60
+ const DropdownMenuTrigger: React.FC<DropdownMenuTriggerProps> = ({ children, asChild = false, isOpen, setIsOpen }) => {
61
+ const handleClick = () => {
62
+ setIsOpen?.(!isOpen);
63
+ };
64
+
65
+ const TriggerComponent = asChild ? 'div' : 'button';
66
+
67
+ return (
68
+ <TriggerComponent
69
+ onClick={handleClick}
70
+ className={cn(
71
+ 'inline-flex justify-center w-full rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500',
72
+ !asChild && 'cursor-pointer'
73
+ )}
74
+ >
75
+ {children}
76
+ </TriggerComponent>
77
+ );
78
+ };
79
+
80
+ const DropdownMenuContent: React.FC<DropdownMenuContentProps> = ({ children, className, isOpen }) => {
81
+ if (!isOpen) return null;
82
+
83
+ return (
84
+ <div className={cn(
85
+ 'absolute right-0 z-10 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none',
86
+ className
87
+ )}>
88
+ <div className="py-1">
89
+ {children}
90
+ </div>
91
+ </div>
92
+ );
93
+ };
94
+
95
+ const DropdownMenuItem: React.FC<DropdownMenuItemProps> = ({ children, className, onClick }) => {
96
+ return (
97
+ <button
98
+ onClick={onClick}
99
+ className={cn(
100
+ 'w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900',
101
+ className
102
+ )}
103
+ role="menuitem"
104
+ >
105
+ {children}
106
+ </button>
107
+ );
108
+ };
109
+
110
+ const DropdownMenuLabel: React.FC<DropdownMenuLabelProps> = ({ children, className }) => {
111
+ return (
112
+ <div className={cn(
113
+ 'px-4 py-2 text-sm font-medium text-gray-700',
114
+ className
115
+ )}>
116
+ {children}
117
+ </div>
118
+ );
119
+ };
120
+
121
+ const DropdownMenuSeparator: React.FC<DropdownMenuSeparatorProps> = ({ className }) => {
122
+ return (
123
+ <div className={cn(
124
+ 'border-t border-gray-100 my-1',
125
+ className
126
+ )} />
127
+ );
128
+ };
129
+
130
+ export {
131
+ DropdownMenu,
132
+ DropdownMenuTrigger,
133
+ DropdownMenuContent,
134
+ DropdownMenuItem,
135
+ DropdownMenuLabel,
136
+ DropdownMenuSeparator
137
+ };
@@ -0,0 +1,174 @@
1
+ import React from 'react';
2
+
3
+ interface IconProps {
4
+ className?: string;
5
+ size?: number | string;
6
+ }
7
+
8
+ // Button Icons
9
+ export const PlayIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
10
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
11
+ <polygon points="5 3 19 12 5 21 5 3"></polygon>
12
+ </svg>
13
+ );
14
+
15
+ export const PauseIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
16
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
17
+ <rect x="6" y="4" width="4" height="16"></rect>
18
+ <rect x="14" y="4" width="4" height="16"></rect>
19
+ </svg>
20
+ );
21
+
22
+ export const VolumeIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
23
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
24
+ <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
25
+ <path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"></path>
26
+ </svg>
27
+ );
28
+
29
+ export const Volume1Icon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
30
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
31
+ <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
32
+ <path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>
33
+ </svg>
34
+ );
35
+
36
+ export const Volume2Icon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
37
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
38
+ <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
39
+ <path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>
40
+ <path d="M19.07 4.93a10 10 0 0 1 0 14.14"></path>
41
+ </svg>
42
+ );
43
+
44
+ export const VolumeXIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
45
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
46
+ <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
47
+ <line x1="23" y1="9" x2="17" y2="15"></line>
48
+ <line x1="17" y1="9" x2="23" y2="15"></line>
49
+ </svg>
50
+ );
51
+
52
+ export const MuteIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
53
+ <VolumeXIcon className={className} size={size} />
54
+ );
55
+
56
+ // Fullscreen Icons
57
+ export const Maximize2Icon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
58
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
59
+ <polyline points="15 3 21 3 21 9"></polyline>
60
+ <polyline points="9 21 3 21 3 15"></polyline>
61
+ <line x1="21" y1="3" x2="14" y2="10"></line>
62
+ <line x1="3" y1="21" x2="10" y2="14"></line>
63
+ </svg>
64
+ );
65
+
66
+ export const Minimize2Icon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
67
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
68
+ <polyline points="4 14 10 14 10 20"></polyline>
69
+ <polyline points="20 10 14 10 14 4"></polyline>
70
+ <line x1="14" y1="10" x2="21" y2="3"></line>
71
+ <line x1="3" y1="21" x2="10" y2="14"></line>
72
+ </svg>
73
+ );
74
+
75
+ export const FullscreenIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
76
+ <Maximize2Icon className={className} size={size} />
77
+ );
78
+
79
+ export const ExitFullscreenIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
80
+ <Minimize2Icon className={className} size={size} />
81
+ );
82
+
83
+ // Control Icons
84
+ export const Rewind10Icon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
85
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
86
+ <polygon points="1 4 1 10 7 7"></polygon>
87
+ <polygon points="15 4 15 10 21 7"></polygon>
88
+ <path d="M7 4a9 9 0 0 1 9 9"></path>
89
+ </svg>
90
+ );
91
+
92
+ export const Forward10Icon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
93
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
94
+ <polygon points="5 4 5 10 11 7"></polygon>
95
+ <polygon points="19 4 19 10 13 7"></polygon>
96
+ <path d="M17 20a9 9 0 0 1-9-9"></path>
97
+ </svg>
98
+ );
99
+
100
+ export const SpeedIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
101
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
102
+ <path d="M3 12h18"></path>
103
+ <path d="M3 6h18"></path>
104
+ <path d="M3 18h18"></path>
105
+ </svg>
106
+ );
107
+
108
+ export const QualityIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
109
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
110
+ <path d="M12 2L2 7l10 5 10-5-10-5z"></path>
111
+ <path d="M2 17l10 5 10-5"></path>
112
+ <path d="M2 12l10 5 10-5"></path>
113
+ </svg>
114
+ );
115
+
116
+ export const SubtitlesIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
117
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
118
+ <rect x="3" y="5" width="18" height="14" rx="2" ry="2"></rect>
119
+ <line x1="8" y1="10" x2="16" y2="10"></line>
120
+ <line x1="8" y1="14" x2="12" y2="14"></line>
121
+ </svg>
122
+ );
123
+
124
+ export const PictureInPictureIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
125
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
126
+ <path d="M8 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"></path>
127
+ <rect x="10" y="8" width="8" height="8" rx="1"></rect>
128
+ </svg>
129
+ );
130
+
131
+ export const DownloadIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
132
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
133
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
134
+ <polyline points="7 10 12 15 17 10"></polyline>
135
+ <line x1="12" y1="15" x2="12" y2="3"></line>
136
+ </svg>
137
+ );
138
+
139
+ export const ShareIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
140
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
141
+ <circle cx="18" cy="5" r="3"></circle>
142
+ <circle cx="6" cy="12" r="3"></circle>
143
+ <circle cx="18" cy="19" r="3"></circle>
144
+ <line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line>
145
+ <line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line>
146
+ </svg>
147
+ );
148
+
149
+ export const LoadingIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
150
+ <svg className={className + ' animate-spin'} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
151
+ <path d="M21 12a9 9 0 1 1-6.219-8.56"></path>
152
+ </svg>
153
+ );
154
+
155
+ // Error Icons
156
+ export const AlertTriangleIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
157
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
158
+ <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path>
159
+ <line x1="12" y1="9" x2="12" y2="13"></line>
160
+ <line x1="12" y1="17" x2="12.01" y2="17"></line>
161
+ </svg>
162
+ );
163
+
164
+ export const RefreshCcwIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
165
+ <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
166
+ <polyline points="1 4 1 10 7 10"></polyline>
167
+ <polyline points="23 20 23 14 17 14"></polyline>
168
+ <path d="M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"></path>
169
+ </svg>
170
+ );
171
+
172
+ export const RotateCcwIcon: React.FC<IconProps> = ({ className = '', size = 16 }) => (
173
+ <RefreshCcwIcon className={className} size={size} />
174
+ );
@@ -0,0 +1,55 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { cn } from '../lib/utils';
3
+
4
+ export interface SliderProps extends React.InputHTMLAttributes<HTMLInputElement> {
5
+ min?: number;
6
+ max?: number;
7
+ step?: number;
8
+ value?: number[];
9
+ onValueChange?: (value: number[]) => void;
10
+ }
11
+
12
+ const Slider = forwardRef<HTMLInputElement, SliderProps>(
13
+ ({ className, min = 0, max = 100, step = 1, value = [0], onValueChange, ...props }, ref) => {
14
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
15
+ const newValue = [Number(e.target.value)];
16
+ onValueChange?.(newValue);
17
+ };
18
+
19
+ return (
20
+ <div className={cn('relative flex w-full touch-none select-none items-center', className)}>
21
+ <div className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
22
+ <div
23
+ className="absolute h-full bg-primary"
24
+ style={{
25
+ left: '0%',
26
+ right: `${100 - ((value[0] - min) / (max - min)) * 100}%`
27
+ }}
28
+ />
29
+ </div>
30
+ <input
31
+ type="range"
32
+ min={min}
33
+ max={max}
34
+ step={step}
35
+ value={value[0]}
36
+ onChange={handleChange}
37
+ className="absolute h-2 w-full cursor-pointer opacity-0 outline-none"
38
+ ref={ref}
39
+ {...props}
40
+ />
41
+ <div
42
+ className="absolute h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
43
+ style={{
44
+ left: `${((value[0] - min) / (max - min)) * 100}%`,
45
+ transform: 'translateX(-50%)'
46
+ }}
47
+ />
48
+ </div>
49
+ );
50
+ }
51
+ );
52
+
53
+ Slider.displayName = 'Slider';
54
+
55
+ export { Slider };