@umituz/web-design-system 3.1.14 → 3.1.15
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/package.json
CHANGED
|
@@ -44,15 +44,29 @@ export const performanceUtils = {
|
|
|
44
44
|
|
|
45
45
|
// Get performance metrics
|
|
46
46
|
getMetrics: () => {
|
|
47
|
-
if (typeof performance === 'undefined'
|
|
47
|
+
if (typeof performance === 'undefined') {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// performance.memory is not in standard TypeScript lib but available in Chrome-based browsers
|
|
52
|
+
type PerformanceWithMemory = typeof performance & {
|
|
53
|
+
memory?: {
|
|
54
|
+
usedJSHeapSize: number;
|
|
55
|
+
totalJSHeapSize: number;
|
|
56
|
+
jsHeapSizeLimit: number;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const mem = (performance as PerformanceWithMemory).memory;
|
|
61
|
+
if (!mem) {
|
|
48
62
|
return null;
|
|
49
63
|
}
|
|
50
64
|
|
|
51
65
|
return {
|
|
52
66
|
memory: {
|
|
53
|
-
usedJSHeapSize:
|
|
54
|
-
totalJSHeapSize:
|
|
55
|
-
jsHeapSizeLimit:
|
|
67
|
+
usedJSHeapSize: mem.usedJSHeapSize,
|
|
68
|
+
totalJSHeapSize: mem.totalJSHeapSize,
|
|
69
|
+
jsHeapSizeLimit: mem.jsHeapSizeLimit,
|
|
56
70
|
},
|
|
57
71
|
navigation: performance.getEntriesByType('navigation')[0] as PerformanceNavigationTiming | undefined,
|
|
58
72
|
};
|
|
@@ -7,7 +7,7 @@ import { useState, useEffect, useRef, useCallback } from 'react';
|
|
|
7
7
|
|
|
8
8
|
export function useDebounce<T>(value: T, delay: number = 500): T {
|
|
9
9
|
const [debouncedValue, setDebouncedValue] = useState<T>(value);
|
|
10
|
-
const timeoutRef = useRef<number>();
|
|
10
|
+
const timeoutRef = useRef<number | null>(null);
|
|
11
11
|
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
// Clear previous timeout
|
|
@@ -40,7 +40,7 @@ export function useThrottle<T extends (...args: any[]) => any>(
|
|
|
40
40
|
delay: number = 300
|
|
41
41
|
): T {
|
|
42
42
|
const lastRun = useRef<Date>(new Date());
|
|
43
|
-
const timeoutRef = useRef<number>();
|
|
43
|
+
const timeoutRef = useRef<number | null>(null);
|
|
44
44
|
|
|
45
45
|
return useCallback((...args: Parameters<T>) => {
|
|
46
46
|
const now = new Date();
|
|
@@ -22,7 +22,7 @@ export interface FooterProps extends HTMLAttributes<HTMLElement>, BaseProps {
|
|
|
22
22
|
|
|
23
23
|
// Memoize social icon component to prevent unnecessary re-renders
|
|
24
24
|
const SocialIcon = memo<{
|
|
25
|
-
item: FooterProps['social'][number];
|
|
25
|
+
item: NonNullable<FooterProps['social']>[number];
|
|
26
26
|
}>(({ item }) => (
|
|
27
27
|
<a
|
|
28
28
|
href={item.href}
|
|
@@ -27,8 +27,8 @@ export const Modal = React.memo(forwardRef<HTMLDivElement, ModalProps>(
|
|
|
27
27
|
({ open = false, onClose, showCloseButton = true, size = 'md', className, children, ...props }, ref) => {
|
|
28
28
|
const [shouldRender, setShouldRender] = useState(open);
|
|
29
29
|
const [isAnimating, setIsAnimating] = useState(false);
|
|
30
|
-
const rafRef = useRef<number>();
|
|
31
|
-
const timerRef = useRef<number>();
|
|
30
|
+
const rafRef = useRef<number | null>(null);
|
|
31
|
+
const timerRef = useRef<number | null>(null);
|
|
32
32
|
|
|
33
33
|
useEffect(() => {
|
|
34
34
|
if (open) {
|