@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.
Files changed (43) hide show
  1. package/dist/{BurgerMenu.module-DA0ojIYf.js → BurgerMenu.module-Dy-zFg88.js} +4 -3
  2. package/dist/assets/all_css.css +1 -0
  3. package/dist/assets/css/BurgerMenu.css +1 -1
  4. package/dist/assets/css/Button.css +1 -1
  5. package/dist/assets/css/Lightbox.css +1 -0
  6. package/dist/assets/general/global.css +1 -1
  7. package/dist/components/BurgerMenu/BurgerMenu.d.ts +4 -2
  8. package/dist/components/BurgerMenu/BurgerMenu.js +55 -54
  9. package/dist/components/BurgerMenu/BurgerMenuButton.js +1 -1
  10. package/dist/components/BurgerMenu/BurgerMenuShowcase.js +26 -23
  11. package/dist/components/Button/Button.d.ts +2 -1
  12. package/dist/components/Button/Button.js +71 -65
  13. package/dist/components/Button/ButtonShowcase.js +46 -22
  14. package/dist/components/Lightbox/Lightbox.d.ts +9 -0
  15. package/dist/components/Lightbox/Lightbox.js +172 -0
  16. package/dist/components/Lightbox/LightboxShowcase.d.ts +6 -0
  17. package/dist/components/Lightbox/LightboxShowcase.js +137 -0
  18. package/dist/components/Lightbox/index.d.ts +2 -0
  19. package/dist/components/Lightbox/index.js +4 -0
  20. package/dist/components/Lightbox/types.d.ts +51 -0
  21. package/dist/components/Lightbox/types.js +1 -0
  22. package/dist/components/Logos/fivem/WhiteLogo.js +9 -9
  23. package/dist/components/Logos/redm/WhiteLogo.js +8 -30
  24. package/dist/components/Shroud/Shroud.js +3 -3
  25. package/dist/components/Table/TableCell.js +35 -33
  26. package/dist/embla-carousel-react.esm-BE464U1q.js +1252 -0
  27. package/dist/main.d.ts +2 -1
  28. package/dist/main.js +225 -224
  29. package/dist/styles-scss/tokens.scss +1 -1
  30. package/dist/utils/contexts/AnalyticsContext/AnalyticsContext.d.ts +15 -2
  31. package/dist/utils/contexts/AnalyticsContext/AnalyticsContext.js +9 -3
  32. package/dist/utils/contexts/AnalyticsContext/index.d.ts +2 -2
  33. package/dist/utils/contexts/AnalyticsContext/index.js +8 -7
  34. package/dist/utils/contexts/AnalyticsContext/useSiteLinkClick.js +12 -12
  35. package/dist/utils/hooks/useBodyScrollLock.d.ts +1 -0
  36. package/dist/utils/hooks/useBodyScrollLock.js +9 -0
  37. package/dist/utils/hooks/useCarousel.js +17 -1264
  38. package/dist/utils/hooks/useKeyboardArrows.d.ts +5 -0
  39. package/dist/utils/hooks/useKeyboardArrows.js +13 -0
  40. package/dist/utils/hooks/useLightbox.d.ts +21 -0
  41. package/dist/utils/hooks/useLightbox.js +80 -0
  42. package/dist/utils/hooks/usePopoverController.js +25 -22
  43. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { default as React } from 'react';
2
+ import { IconName } from '../Icon';
2
3
 
3
4
  export interface BurgerMenuItem {
4
5
  label: string;
@@ -7,6 +8,7 @@ export interface BurgerMenuItem {
7
8
  openByDefault?: boolean;
8
9
  className?: string;
9
10
  submenu?: BurgerMenuItem[];
11
+ icon?: IconName;
10
12
  }
11
13
  export interface BurgerMenuProps {
12
14
  items: BurgerMenuItem[];
@@ -17,6 +19,6 @@ export interface BurgerMenuProps {
17
19
  subItemContainerClassName?: string;
18
20
  itemInteractiveClassName?: string;
19
21
  itemClassName?: string;
20
- showHighlightBorder?: boolean;
22
+ highlightedItemClassname?: string;
21
23
  }
22
- export declare function BurgerMenu({ items, onItemClick, isOpen, className, menuClassName, subItemContainerClassName, itemInteractiveClassName, itemClassName, showHighlightBorder, }: BurgerMenuProps): React.ReactElement;
24
+ export declare function BurgerMenu({ items, onItemClick, isOpen, className, menuClassName, subItemContainerClassName, itemInteractiveClassName, itemClassName, highlightedItemClassname, }: BurgerMenuProps): React.ReactElement;
@@ -1,113 +1,114 @@
1
- import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
- import { useState as N, useCallback as b } from "react";
1
+ import { jsx as o, jsxs as m } from "react/jsx-runtime";
2
+ import { useState as S, useCallback as f } from "react";
3
3
  import r from "../Flex/Flex.js";
4
- import { clsx as u } from "../../utils/clsx.js";
5
- import { Icon as S } from "../Icon/Icon.js";
6
- import { Interactive as f } from "../Interactive/Interactive.js";
4
+ import { clsx as i } from "../../utils/clsx.js";
5
+ import { Icon as g } from "../Icon/Icon.js";
6
+ import { Interactive as y } from "../Interactive/Interactive.js";
7
7
  import { Text as D } from "../Text/Text.js";
8
8
  import "../../utils/ui/ui.js";
9
- import { s as l } from "../../BurgerMenu.module-DA0ojIYf.js";
9
+ import { s as u } from "../../BurgerMenu.module-Dy-zFg88.js";
10
10
  function z({
11
- items: a,
12
- onItemClick: s,
13
- isOpen: g,
11
+ items: c,
12
+ onItemClick: a,
13
+ isOpen: k,
14
14
  className: w,
15
- menuClassName: y,
15
+ menuClassName: x,
16
16
  subItemContainerClassName: C,
17
- itemInteractiveClassName: t,
18
- itemClassName: c,
19
- showHighlightBorder: k
17
+ itemInteractiveClassName: s,
18
+ itemClassName: t,
19
+ highlightedItemClassname: d
20
20
  }) {
21
- const [d, x] = N(() => {
22
- const e = {};
23
- return a.forEach((n) => {
24
- n.openByDefault && (e[n.id] = !0);
25
- }), e;
26
- }), i = b((e) => {
27
- s(e);
28
- }, [s]), h = b((e) => {
29
- x((n) => ({
30
- ...n,
31
- [e]: !n[e]
21
+ const [h, N] = S(() => {
22
+ const n = {};
23
+ return c.forEach((e) => {
24
+ e.openByDefault && (n[e.id] = !0);
25
+ }), n;
26
+ }), l = f((n) => {
27
+ a(n);
28
+ }, [a]), p = f((n) => {
29
+ N((e) => ({
30
+ ...e,
31
+ [n]: !e[n]
32
32
  }));
33
33
  }, []);
34
34
  return /* @__PURE__ */ o(
35
35
  r,
36
36
  {
37
- className: u(l.burgerMenuContentContainer, w),
37
+ className: i(u.burgerMenuContentContainer, w),
38
38
  direction: "column",
39
- children: g && /* @__PURE__ */ o(r, { direction: "column", className: u(l.menu, y), children: a.map((e) => /* @__PURE__ */ p("div", { children: [
39
+ children: k && /* @__PURE__ */ o(r, { direction: "column", className: i(u.menu, x), children: c.map((n) => /* @__PURE__ */ m("div", { children: [
40
40
  /* @__PURE__ */ o(
41
- f,
41
+ y,
42
42
  {
43
43
  showPointer: !0,
44
44
  "aria-label": "Toggle item",
45
45
  role: "button",
46
46
  onClick: () => {
47
- e.submenu ? h(e.id) : i(e.id);
47
+ n.submenu ? p(n.id) : l(n.id);
48
48
  },
49
- onKeyDown: (n) => {
50
- (n.key === "Enter" || n.key === " ") && (e.submenu ? h(e.id) : i(e.id));
49
+ onKeyDown: (e) => {
50
+ (e.key === "Enter" || e.key === " ") && (n.submenu ? p(n.id) : l(n.id));
51
51
  },
52
- className: t,
53
- children: /* @__PURE__ */ p(
52
+ className: s,
53
+ children: /* @__PURE__ */ m(
54
54
  r,
55
55
  {
56
56
  p: 2,
57
57
  justifyContent: "space-between",
58
- className: u(
59
- e.highlighted && k ? l.showHighlightBorder : null,
60
- c
58
+ className: i(
59
+ n.highlighted && d ? d : null,
60
+ t
61
61
  ),
62
62
  children: [
63
63
  /* @__PURE__ */ o(
64
64
  D,
65
65
  {
66
66
  size: "xsmall",
67
- weight: e.highlighted ? "bold" : "regular",
68
- children: e.label
67
+ weight: n.highlighted ? "bold" : "regular",
68
+ children: n.label
69
69
  }
70
70
  ),
71
- e.submenu && /* @__PURE__ */ o(
72
- S,
71
+ n.submenu && /* @__PURE__ */ o(
72
+ g,
73
73
  {
74
- name: d[e.id] ? "UpChevron" : "DownChevron"
74
+ name: h[n.id] ? "UpChevron" : "DownChevron"
75
75
  }
76
- )
76
+ ),
77
+ n.icon && /* @__PURE__ */ o(g, { name: n.icon })
77
78
  ]
78
79
  }
79
80
  )
80
81
  }
81
82
  ),
82
- e.submenu && /* @__PURE__ */ o(
83
+ n.submenu && /* @__PURE__ */ o(
83
84
  r,
84
85
  {
85
- className: u(
86
- l.subItemContainer,
86
+ className: i(
87
+ u.subItemContainer,
87
88
  C,
88
89
  {
89
- [l.subItemContainerOpen]: d[e.id]
90
+ [u.subItemContainerOpen]: h[n.id]
90
91
  }
91
92
  ),
92
93
  direction: "column",
93
- children: e.submenu.map((n) => /* @__PURE__ */ o(
94
- f,
94
+ children: n.submenu.map((e) => /* @__PURE__ */ o(
95
+ y,
95
96
  {
96
97
  showPointer: !0,
97
98
  "aria-label": "Toggle sub item",
98
99
  role: "button",
99
- onClick: () => i(n.id),
100
- onKeyDown: (m) => {
101
- (m.key === "Enter" || m.key === " ") && i(n.id);
100
+ onClick: () => l(e.id),
101
+ onKeyDown: (b) => {
102
+ (b.key === "Enter" || b.key === " ") && l(e.id);
102
103
  },
103
- className: t,
104
- children: /* @__PURE__ */ o(r, { p: 2, className: c, children: n.label })
104
+ className: s,
105
+ children: /* @__PURE__ */ o(r, { p: 2, className: t, children: e.label })
105
106
  },
106
- n.id
107
+ e.id
107
108
  ))
108
109
  }
109
110
  )
110
- ] }, e.id)) })
111
+ ] }, n.id)) })
111
112
  }
112
113
  );
113
114
  }
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
2
  import u from "../Flex/Flex.js";
3
3
  import { clsx as o } from "../../utils/clsx.js";
4
4
  import { Interactive as m } from "../Interactive/Interactive.js";
5
- import { s as r } from "../../BurgerMenu.module-DA0ojIYf.js";
5
+ import { s as r } from "../../BurgerMenu.module-Dy-zFg88.js";
6
6
  function g({
7
7
  isOpen: n,
8
8
  onToggle: t,
@@ -1,10 +1,11 @@
1
- import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
- import g, { useState as d, useCallback as h } from "react";
3
- import l from "../Flex/Flex.js";
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import d, { useState as h, useCallback as p } from "react";
3
+ import i from "../Flex/Flex.js";
4
4
  import { Text as o } from "../Text/Text.js";
5
5
  import "../../utils/ui/ui.js";
6
6
  import { BurgerMenu as n } from "./BurgerMenu.js";
7
- import { BurgerMenuButton as u } from "./BurgerMenuButton.js";
7
+ import { BurgerMenuButton as s } from "./BurgerMenuButton.js";
8
+ import { s as m } from "../../BurgerMenu.module-Dy-zFg88.js";
8
9
  const a = [
9
10
  {
10
11
  id: "1",
@@ -31,44 +32,46 @@ const a = [
31
32
  },
32
33
  {
33
34
  id: "4",
34
- label: "Settings"
35
+ label: "Settings",
36
+ icon: "ExternalLink"
35
37
  }
36
- ], m = (e) => {
38
+ ], u = (e) => {
37
39
  console.log(`Item clicked: ${e}`);
38
40
  };
39
- function p() {
40
- const [e, s] = d(!1), i = h(() => {
41
- s((c) => !c);
41
+ function b() {
42
+ const [e, c] = h(!1), l = p(() => {
43
+ c((g) => !g);
42
44
  }, []);
43
- return /* @__PURE__ */ t(l, { gap: "large", vertical: !0, pb: 20, children: [
44
- /* @__PURE__ */ t(l, { gap: "medium", vertical: !0, children: [
45
- /* @__PURE__ */ r(o, { children: "Burger Menu" }),
46
- /* @__PURE__ */ r(u, { isOpen: e, onToggle: i }),
47
- /* @__PURE__ */ r(
45
+ return /* @__PURE__ */ r(i, { gap: "large", vertical: !0, pb: 20, children: [
46
+ /* @__PURE__ */ r(i, { gap: "medium", vertical: !0, children: [
47
+ /* @__PURE__ */ t(o, { children: "Burger Menu" }),
48
+ /* @__PURE__ */ t(s, { isOpen: e, onToggle: l }),
49
+ /* @__PURE__ */ t(
48
50
  n,
49
51
  {
50
52
  items: a,
51
- onItemClick: m,
53
+ onItemClick: u,
52
54
  isOpen: e
53
55
  }
54
56
  )
55
57
  ] }),
56
- /* @__PURE__ */ t(l, { gap: "medium", vertical: !0, children: [
57
- /* @__PURE__ */ r(o, { children: "Burger Menu With highlighted border" }),
58
- /* @__PURE__ */ r(u, { isOpen: e, onToggle: i }),
59
- /* @__PURE__ */ r(
58
+ /* @__PURE__ */ r(i, { gap: "medium", vertical: !0, children: [
59
+ /* @__PURE__ */ t(o, { children: "Burger Menu With highlighted borders to show custom styling" }),
60
+ /* @__PURE__ */ t(s, { isOpen: e, onToggle: l }),
61
+ /* @__PURE__ */ t(
60
62
  n,
61
63
  {
62
64
  items: a,
63
- onItemClick: m,
65
+ onItemClick: u,
64
66
  isOpen: e,
65
- showHighlightBorder: !0
67
+ highlightedItemClassname: m.highlightTest,
68
+ itemClassName: m.borderTest
66
69
  }
67
70
  )
68
71
  ] })
69
72
  ] });
70
73
  }
71
- const k = g.memo(p);
74
+ const C = d.memo(b);
72
75
  export {
73
- k as default
76
+ C as default
74
77
  };
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { IconName } from '../Icon';
3
3
 
4
- export type ButtonTheme = 'primary' | 'secondary' | 'on-light' | 'tertiary' | 'linked' | 'quicklink';
4
+ export type ButtonTheme = 'primary' | 'secondary' | 'tertiary' | 'on-light' | 'linked' | 'quicklink';
5
5
  export interface ButtonProps<T = HTMLButtonElement> {
6
6
  text?: React.ReactNode;
7
7
  title?: string;
@@ -16,6 +16,7 @@ export interface ButtonProps<T = HTMLButtonElement> {
16
16
  fullWidth?: boolean;
17
17
  disabled?: boolean;
18
18
  autofocus?: boolean;
19
+ borderShredded?: boolean;
19
20
  onClick?: (event: React.MouseEvent<T>) => void;
20
21
  onMouseDown?: (event: React.MouseEvent<T>) => void;
21
22
  onMouseUp?: (event: React.MouseEvent<T>) => void;
@@ -1,86 +1,91 @@
1
- import { jsx as a, jsxs as q, Fragment as I } from "react/jsx-runtime";
2
- import x from "react";
3
- import { Icon as h } from "../Icon/Icon.js";
4
- import { clsx as b } from "../../utils/clsx.js";
5
- import { noop as m } from "../../utils/functional.js";
6
- const M = "cfxui__Button__unsetAll__44b96", j = "cfxui__Button__root__e2ace", F = "cfxui__Button__fullWidth__f61d9", v = "cfxui__Button__primary__1c59f", w = "cfxui__Button__secondary__b2b84", D = "cfxui__Button__linked__330cb", P = "cfxui__Button__quicklink__204ac", R = "cfxui__Button__icon__44e51", U = "cfxui__Button__icononly__4f786", $ = "cfxui__Button__decorator__39a9b", t = {
1
+ import { jsx as r, jsxs as q, Fragment as I } from "react/jsx-runtime";
2
+ import b from "react";
3
+ import { Icon as k } from "../Icon/Icon.js";
4
+ import { clsx as h } from "../../utils/clsx.js";
5
+ import { noop as x } from "../../utils/functional.js";
6
+ const M = "cfxui__Button__unsetAll__44b96", j = "cfxui__Button__root__e2ace", F = "cfxui__Button__fullWidth__f61d9", v = "cfxui__Button__borderShredded__2388c", w = "cfxui__Button__primary__1c59f", D = "cfxui__Button__secondary__b2b84", P = "cfxui__Button__linked__330cb", R = "cfxui__Button__quicklink__204ac", U = "cfxui__Button__icon__44e51", $ = "cfxui__Button__icononly__4f786", z = "cfxui__Button__decorator__39a9b", o = {
7
7
  unsetAll: M,
8
8
  root: j,
9
9
  fullWidth: F,
10
- primary: v,
11
- secondary: w,
10
+ borderShredded: v,
11
+ primary: w,
12
+ secondary: D,
12
13
  "on-light": "cfxui__Button__on-light__ae69c",
13
- linked: D,
14
- quicklink: P,
15
- icon: R,
16
- icononly: U,
17
- decorator: $
14
+ linked: P,
15
+ quicklink: R,
16
+ icon: U,
17
+ icononly: $,
18
+ decorator: z
18
19
  };
19
- function z(l) {
20
+ function E(l) {
20
21
  const {
21
- text: o = null,
22
+ text: t = null,
22
23
  icon: n,
23
24
  iconLeft: e,
24
- iconClassName: u,
25
+ iconClassName: _,
25
26
  decorator: i = null
26
27
  } = l;
27
28
  return /* @__PURE__ */ q(I, { children: [
28
- !!e && /* @__PURE__ */ a(h, { name: e, className: b(t.icon, u) }),
29
- o,
30
- !!n && /* @__PURE__ */ a(h, { name: n, className: b(t.icon, u) }),
31
- !!i && /* @__PURE__ */ a("div", { className: t.decorator, children: i })
29
+ !!e && /* @__PURE__ */ r(k, { name: e, className: h(o.icon, _) }),
30
+ t,
31
+ !!n && /* @__PURE__ */ r(k, { name: n, className: h(o.icon, _) }),
32
+ !!i && /* @__PURE__ */ r("div", { className: o.decorator, children: i })
32
33
  ] });
33
34
  }
34
- function E(l) {
35
+ function G(l) {
35
36
  const {
36
- text: o = null,
37
+ text: t = null,
37
38
  icon: n,
38
39
  iconLeft: e,
39
- theme: u = "tertiary",
40
+ theme: _ = "tertiary",
40
41
  disabled: i = !1,
41
- className: r = "",
42
+ className: d = "",
42
43
  autofocus: s = !1,
43
- fullWidth: _ = !1,
44
- tabIndex: c
44
+ fullWidth: u = !1,
45
+ borderShredded: c = !1,
46
+ tabIndex: a
45
47
  } = l;
46
- return b(t.unsetAll, t.root, t[u], r, {
47
- [t.disabled]: i,
48
- [t.icononly]: (!!n || !!e) && (o === null || typeof o > "u"),
49
- [t.text]: !!o,
50
- [t.autofocus]: s || typeof c < "u",
51
- [t.fullWidth]: _
48
+ return h(o.unsetAll, o.root, o[_], d, {
49
+ [o.disabled]: i,
50
+ [o.icononly]: (!!n || !!e) && (t === null || typeof t > "u"),
51
+ [o.text]: !!t,
52
+ [o.autofocus]: s || typeof a < "u",
53
+ [o.fullWidth]: u,
54
+ [o.borderShredded]: c
52
55
  });
53
56
  }
54
- function G(l) {
57
+ function H(l) {
55
58
  const {
56
- text: o = null,
59
+ text: t = null,
57
60
  icon: n,
58
61
  iconLeft: e,
59
- iconClassName: u,
62
+ iconClassName: _,
60
63
  title: i = "",
61
- type: r = "button",
64
+ type: d = "button",
62
65
  className: s = "",
63
- theme: _ = "tertiary",
66
+ theme: u = "tertiary",
64
67
  disabled: c = !1,
65
- onClick: y = m,
66
- onMouseDown: k = m,
67
- onMouseUp: p = m,
68
+ onClick: a = x,
69
+ onMouseDown: p = x,
70
+ onMouseUp: N = x,
68
71
  autofocus: f = !1,
69
- tabIndex: d,
72
+ tabIndex: m,
70
73
  fullWidth: B = !1,
71
- ariaLabel: N = "",
72
- ref: C,
74
+ ariaLabel: C = "",
75
+ borderShredded: y = !1,
76
+ ref: S,
73
77
  ...W
74
- } = l, g = x.useMemo(() => E({
75
- text: o,
78
+ } = l, g = b.useMemo(() => G({
79
+ text: t,
76
80
  icon: n,
77
81
  iconLeft: e,
78
- theme: _,
82
+ theme: u,
79
83
  disabled: c,
80
84
  className: s,
81
85
  autofocus: f,
82
86
  fullWidth: B,
83
- tabIndex: d
87
+ tabIndex: m,
88
+ borderShredded: y
84
89
  }), [
85
90
  f,
86
91
  s,
@@ -88,34 +93,35 @@ function G(l) {
88
93
  c,
89
94
  n,
90
95
  e,
91
- d,
92
- o,
93
- _
94
- ]), A = x.useCallback((L) => {
95
- c || y(L);
96
- }, [c, y]);
97
- return /* @__PURE__ */ a(
96
+ m,
97
+ t,
98
+ u,
99
+ y
100
+ ]), A = b.useCallback((L) => {
101
+ c || a(L);
102
+ }, [c, a]);
103
+ return /* @__PURE__ */ r(
98
104
  "button",
99
105
  {
100
- ref: C,
106
+ ref: S,
101
107
  disabled: c,
102
108
  className: g,
103
109
  onClick: A,
104
- onMouseDown: k,
105
- onMouseUp: p,
110
+ onMouseDown: p,
111
+ onMouseUp: N,
106
112
  autoFocus: f,
107
- tabIndex: d,
113
+ tabIndex: m,
108
114
  title: i,
109
- type: r,
110
- "aria-label": N,
115
+ type: d,
116
+ "aria-label": C,
111
117
  ...W,
112
- children: /* @__PURE__ */ a(z, { ...l })
118
+ children: /* @__PURE__ */ r(E, { ...l })
113
119
  }
114
120
  );
115
121
  }
116
- const S = x.memo(G);
122
+ const V = b.memo(H);
117
123
  export {
118
- z as ButtonContent,
119
- S as default,
120
- E as getButtonClassName
124
+ E as ButtonContent,
125
+ V as default,
126
+ G as getButtonClassName
121
127
  };