@cfx-dev/ui-components 5.0.25 → 5.0.27
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/dist/{BurgerMenu.module-DA0ojIYf.js → BurgerMenu.module-Dy-zFg88.js} +4 -3
- package/dist/assets/all_css.css +1 -0
- package/dist/assets/css/BurgerMenu.css +1 -1
- package/dist/assets/css/Button.css +1 -1
- package/dist/assets/css/Lightbox.css +1 -0
- package/dist/assets/general/global.css +1 -1
- package/dist/components/BurgerMenu/BurgerMenu.d.ts +4 -2
- package/dist/components/BurgerMenu/BurgerMenu.js +55 -54
- package/dist/components/BurgerMenu/BurgerMenuButton.js +1 -1
- package/dist/components/BurgerMenu/BurgerMenuShowcase.js +26 -23
- package/dist/components/Button/Button.d.ts +2 -1
- package/dist/components/Button/Button.js +71 -65
- package/dist/components/Button/ButtonShowcase.js +46 -22
- package/dist/components/Lightbox/Lightbox.d.ts +9 -0
- package/dist/components/Lightbox/Lightbox.js +172 -0
- package/dist/components/Lightbox/LightboxShowcase.d.ts +6 -0
- package/dist/components/Lightbox/LightboxShowcase.js +137 -0
- package/dist/components/Lightbox/index.d.ts +2 -0
- package/dist/components/Lightbox/index.js +4 -0
- package/dist/components/Lightbox/types.d.ts +51 -0
- package/dist/components/Lightbox/types.js +1 -0
- package/dist/components/Logos/fivem/WhiteLogo.js +9 -9
- package/dist/components/Logos/redm/WhiteLogo.js +8 -30
- package/dist/components/Shroud/Shroud.js +3 -3
- package/dist/components/Table/TableCell.js +35 -33
- package/dist/embla-carousel-react.esm-BE464U1q.js +1252 -0
- package/dist/main.d.ts +2 -1
- package/dist/main.js +225 -224
- package/dist/styles-scss/tokens.scss +1 -1
- package/dist/utils/contexts/AnalyticsContext/AnalyticsContext.d.ts +15 -2
- package/dist/utils/contexts/AnalyticsContext/AnalyticsContext.js +9 -3
- package/dist/utils/contexts/AnalyticsContext/index.d.ts +2 -2
- package/dist/utils/contexts/AnalyticsContext/index.js +8 -7
- package/dist/utils/contexts/AnalyticsContext/useSiteLinkClick.js +12 -12
- package/dist/utils/hooks/useBodyScrollLock.d.ts +1 -0
- package/dist/utils/hooks/useBodyScrollLock.js +9 -0
- package/dist/utils/hooks/useCarousel.js +17 -1264
- package/dist/utils/hooks/useKeyboardArrows.d.ts +5 -0
- package/dist/utils/hooks/useKeyboardArrows.js +13 -0
- package/dist/utils/hooks/useLightbox.d.ts +21 -0
- package/dist/utils/hooks/useLightbox.js +80 -0
- package/dist/utils/hooks/usePopoverController.js +25 -22
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useDynamicRef as t } from "./useDynamicRef.js";
|
|
2
|
+
import { useGlobalKeyboardEvent as f } from "./useGlobalKeyboardEvent.js";
|
|
3
|
+
function o(r) {
|
|
4
|
+
const e = t((i) => {
|
|
5
|
+
o.isArrowLeft(i) && r("left"), o.isArrowRight(i) && r("right");
|
|
6
|
+
});
|
|
7
|
+
f(e);
|
|
8
|
+
}
|
|
9
|
+
o.isArrowLeft = (r) => r.key === "ArrowLeft";
|
|
10
|
+
o.isArrowRight = (r) => r.key === "ArrowRight";
|
|
11
|
+
export {
|
|
12
|
+
o as useKeyboardArrows
|
|
13
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MediaItem, UseLightboxOptions } from '../../components/Lightbox/types';
|
|
3
|
+
|
|
4
|
+
export declare function useLightboxOpener(initialIndex?: number): {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
openLightbox: (idx: number) => void;
|
|
7
|
+
closeLightbox: () => void;
|
|
8
|
+
currentIndex: number;
|
|
9
|
+
handleIndexChange: (idx: number) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function useLightbox({ currentIndex, isOpen, onClose, onIndexChange, initialIndex, }: UseLightboxOptions & {
|
|
12
|
+
initialIndex?: number;
|
|
13
|
+
}): {
|
|
14
|
+
emblaRef: import('embla-carousel-react').EmblaViewportRefType;
|
|
15
|
+
getSelectedIndex: () => number;
|
|
16
|
+
handlePrevious: () => void;
|
|
17
|
+
handleNext: () => void;
|
|
18
|
+
handleOverlayClick: (e: React.MouseEvent) => void;
|
|
19
|
+
handleOverlayKeyDown: (e: React.KeyboardEvent) => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const usePreloadMedia: (items: MediaItem[], open: boolean) => void;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { u as b } from "../../embla-carousel-react.esm-BE464U1q.js";
|
|
2
|
+
import { useCallback as c, useEffect as i, useState as g } from "react";
|
|
3
|
+
import { useBodyScrollLock as y } from "./useBodyScrollLock.js";
|
|
4
|
+
function L(o = 0) {
|
|
5
|
+
const [s, t] = g(!1), [l, n] = g(o), f = c((a) => {
|
|
6
|
+
n(a), t(!0);
|
|
7
|
+
}, []), e = c(() => {
|
|
8
|
+
t(!1);
|
|
9
|
+
}, []), u = c((a) => {
|
|
10
|
+
n(a);
|
|
11
|
+
}, []);
|
|
12
|
+
return {
|
|
13
|
+
isOpen: s,
|
|
14
|
+
openLightbox: f,
|
|
15
|
+
closeLightbox: e,
|
|
16
|
+
currentIndex: l,
|
|
17
|
+
handleIndexChange: u
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function v({
|
|
21
|
+
currentIndex: o,
|
|
22
|
+
isOpen: s,
|
|
23
|
+
onClose: t,
|
|
24
|
+
onIndexChange: l,
|
|
25
|
+
initialIndex: n
|
|
26
|
+
}) {
|
|
27
|
+
const [f, e] = b({
|
|
28
|
+
loop: !1,
|
|
29
|
+
startIndex: typeof n == "number" ? n : o
|
|
30
|
+
}), u = c(() => {
|
|
31
|
+
e && e.scrollPrev();
|
|
32
|
+
}, [e]), a = c(() => {
|
|
33
|
+
e && e.scrollNext();
|
|
34
|
+
}, [e]), d = c(
|
|
35
|
+
(r) => {
|
|
36
|
+
r.target === r.currentTarget && t();
|
|
37
|
+
},
|
|
38
|
+
[t]
|
|
39
|
+
), p = c(
|
|
40
|
+
(r) => {
|
|
41
|
+
(r.key === "Enter" || r.key === " ") && r.target === r.currentTarget && t();
|
|
42
|
+
},
|
|
43
|
+
[t]
|
|
44
|
+
), h = c(() => e ? e.selectedScrollSnap() : o, [e, o]);
|
|
45
|
+
return i(() => {
|
|
46
|
+
e && s && e.scrollTo(o);
|
|
47
|
+
}, [e, o, s]), i(() => {
|
|
48
|
+
if (!e)
|
|
49
|
+
return;
|
|
50
|
+
const r = () => {
|
|
51
|
+
const m = e.selectedScrollSnap();
|
|
52
|
+
l(m);
|
|
53
|
+
};
|
|
54
|
+
return e.on("select", r), () => {
|
|
55
|
+
e.off("select", r);
|
|
56
|
+
};
|
|
57
|
+
}, [e, l]), y(s), {
|
|
58
|
+
emblaRef: f,
|
|
59
|
+
getSelectedIndex: h,
|
|
60
|
+
handlePrevious: u,
|
|
61
|
+
handleNext: a,
|
|
62
|
+
handleOverlayClick: d,
|
|
63
|
+
handleOverlayKeyDown: p
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const w = (o, s) => {
|
|
67
|
+
i(() => {
|
|
68
|
+
s && o.forEach((t) => {
|
|
69
|
+
if (t.type === "image" && t.src) {
|
|
70
|
+
const l = new window.Image();
|
|
71
|
+
l.src = t.src;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}, [s, o]);
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
v as useLightbox,
|
|
78
|
+
L as useLightboxOpener,
|
|
79
|
+
w as usePreloadMedia
|
|
80
|
+
};
|
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
import e from "react";
|
|
2
|
-
import { fastRandomId as
|
|
2
|
+
import { fastRandomId as h } from "../random.js";
|
|
3
3
|
let n = null;
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
const k = 80, w = 350;
|
|
5
|
+
function m(u) {
|
|
6
|
+
n && u && n.id === u.id || (n = u);
|
|
7
|
+
}
|
|
8
|
+
function C() {
|
|
9
|
+
const [u, f] = e.useState(!1), l = e.useRef(!1), o = e.useRef(null), c = e.useRef(null), s = e.useRef(!1), i = e.useRef(h()), d = e.useCallback((t) => {
|
|
10
|
+
const b = t ? k : w;
|
|
11
|
+
c.current !== null && clearTimeout(c.current), c.current = setTimeout(() => {
|
|
12
|
+
c.current = null, !(!t && s.current) && (f(t), l.current = t, t && (n == null ? void 0 : n.id) !== i.current && (n == null || n.update(!1)), t && m({
|
|
13
|
+
id: i.current,
|
|
14
|
+
update: f
|
|
15
|
+
}), !t && (n == null ? void 0 : n.id) === i.current && m(null));
|
|
16
|
+
}, b);
|
|
14
17
|
}, []), r = e.useCallback((t) => {
|
|
15
|
-
!t &&
|
|
16
|
-
}, [
|
|
18
|
+
!t && s.current || d(t);
|
|
19
|
+
}, [d]), p = e.useCallback(() => {
|
|
17
20
|
r(!0);
|
|
18
|
-
}, [r]), m = e.useCallback(() => {
|
|
19
|
-
r(!1);
|
|
20
21
|
}, [r]), v = e.useCallback(() => {
|
|
21
|
-
|
|
22
|
+
r(!1);
|
|
23
|
+
}, [r]), R = e.useCallback(() => {
|
|
24
|
+
s.current = !0;
|
|
22
25
|
}, []), a = e.useCallback((t) => {
|
|
23
|
-
|
|
26
|
+
s.current = !1, o.current && (o.current.contains(t.target) || l.current && r(!1));
|
|
24
27
|
}, [r]);
|
|
25
28
|
return e.useEffect(() => (window.addEventListener("mouseup", a), () => window.removeEventListener("mouseup", a)), [a]), {
|
|
26
|
-
active:
|
|
27
|
-
wrapperRef:
|
|
29
|
+
active: u,
|
|
30
|
+
wrapperRef: o,
|
|
28
31
|
handleMouseEnter: p,
|
|
29
|
-
handleMouseLeave:
|
|
30
|
-
handleMouseDown:
|
|
32
|
+
handleMouseLeave: v,
|
|
33
|
+
handleMouseDown: R
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
36
|
export {
|
|
34
|
-
|
|
37
|
+
C as usePopoverController
|
|
35
38
|
};
|