@cfx-dev/ui-components 4.2.11 → 4.2.13
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/assets/css/Accordion.css +1 -1
- package/dist/assets/css/Text.css +1 -1
- package/dist/assets/general/global.css +1 -1
- package/dist/components/Accordion/Accordion.d.ts +5 -11
- package/dist/components/Accordion/Accordion.js +113 -86
- package/dist/components/Accordion/AccordionShowcase.js +56 -26
- package/dist/components/DropdownSelect/DropdownSelect.js +1040 -802
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Slider/Slider.js +374 -294
- package/dist/components/Text/Text.js +63 -59
- package/dist/components/Text/Text.types.d.ts +2 -0
- package/dist/index-CjTSD6zB.js +161 -0
- package/dist/{index-Bz27DCHt.js → index-DBus3GoO.js} +2 -2
- package/dist/styles-scss/tokens.scss +3 -1
- package/dist/utils/math.d.ts +1 -0
- package/dist/utils/math.js +10 -6
- package/package.json +5 -5
- package/dist/index-AweK2ufS.js +0 -171
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import { default as React
|
|
1
|
+
import { default as React } from 'react';
|
|
2
2
|
import { IconName } from '../Icon';
|
|
3
3
|
|
|
4
4
|
export interface AccordionContextProps {
|
|
5
|
-
openItems:
|
|
5
|
+
openItems: Record<string, boolean>;
|
|
6
6
|
toggleItem: (id: string) => void;
|
|
7
7
|
}
|
|
8
8
|
export interface AccordionProps {
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const Accordion: React.FC<PropsWithChildren<AccordionProps>>;
|
|
12
|
-
export declare const AccordionItem: React.FC<React.PropsWithChildren
|
|
13
|
-
id: string;
|
|
14
|
-
}>>;
|
|
11
|
+
export declare const Accordion: React.FC<React.PropsWithChildren<AccordionProps>>;
|
|
12
|
+
export declare const AccordionItem: React.FC<React.PropsWithChildren>;
|
|
15
13
|
export declare const AccordionHeader: React.FC<React.PropsWithChildren>;
|
|
16
14
|
interface AccordionTriggerProps {
|
|
17
|
-
id: string;
|
|
18
15
|
text: string;
|
|
19
16
|
iconLeft?: IconName;
|
|
20
17
|
}
|
|
21
18
|
export declare const AccordionTrigger: React.FC<AccordionTriggerProps>;
|
|
22
|
-
|
|
23
|
-
id: string;
|
|
24
|
-
}
|
|
25
|
-
export declare const AccordionContent: React.FC<React.PropsWithChildren<AccordionContentProps>>;
|
|
19
|
+
export declare const AccordionContent: React.FC<React.PropsWithChildren>;
|
|
26
20
|
export {};
|
|
@@ -1,119 +1,146 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { Icon as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import "
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
s
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
children: c,
|
|
36
|
-
|
|
1
|
+
import { jsx as c, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import e from "react";
|
|
3
|
+
import { Icon as C } from "../Icon/Icon.js";
|
|
4
|
+
import { Text as A } from "../Text/Text.js";
|
|
5
|
+
import { ui as I } from "../ui.js";
|
|
6
|
+
import { clsx as b } from "../../utils/clsx.js";
|
|
7
|
+
import { debounce as y } from "../../utils/execution.js";
|
|
8
|
+
import { minmax as T } from "../../utils/math.js";
|
|
9
|
+
const R = "cfxui__Accordion__triggerContainer__b92c1", k = "cfxui__Accordion__iconFlip__367de", D = "cfxui__Accordion__iconUp__28d27", N = "cfxui__Accordion__iconDown__b9e95", E = "cfxui__Accordion__text__03dc4", U = "cfxui__Accordion__iconLeft__e348b", $ = "cfxui__Accordion__iconRight__bbf0c", F = "cfxui__Accordion__content__5ecaf", H = "cfxui__Accordion__open__ed604", L = "cfxui__Accordion__contentText__1384b", z = "cfxui__Accordion__closed__be897", o = {
|
|
10
|
+
triggerContainer: R,
|
|
11
|
+
iconFlip: k,
|
|
12
|
+
iconUp: D,
|
|
13
|
+
iconDown: N,
|
|
14
|
+
text: E,
|
|
15
|
+
iconLeft: U,
|
|
16
|
+
iconRight: $,
|
|
17
|
+
content: F,
|
|
18
|
+
open: H,
|
|
19
|
+
contentText: L,
|
|
20
|
+
closed: z,
|
|
21
|
+
"content-text-closing": "cfxui__Accordion__content-text-closing__163e4"
|
|
22
|
+
}, g = e.createContext(void 0), V = function(i) {
|
|
23
|
+
const {
|
|
24
|
+
children: t,
|
|
25
|
+
className: s
|
|
26
|
+
} = i, [n, r] = e.useState({}), l = e.useCallback((d) => {
|
|
27
|
+
r((u) => ({
|
|
28
|
+
...u,
|
|
29
|
+
[d]: !u[d]
|
|
30
|
+
}));
|
|
31
|
+
}, []), a = e.useMemo(() => ({
|
|
32
|
+
openItems: n,
|
|
33
|
+
toggleItem: l
|
|
34
|
+
}), [n, l]);
|
|
35
|
+
return /* @__PURE__ */ c(g.Provider, { value: a, children: /* @__PURE__ */ c("div", { className: s, role: "presentation", children: t }) });
|
|
36
|
+
}, h = e.createContext(""), G = function({
|
|
37
|
+
children: i
|
|
37
38
|
}) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const t = e.useId();
|
|
40
|
+
return /* @__PURE__ */ c(h.Provider, { value: t, children: /* @__PURE__ */ c("div", { className: o.item, id: t, role: "region", "aria-labelledby": `${t}-header`, children: i }) });
|
|
41
|
+
}, J = function({
|
|
42
|
+
children: i
|
|
41
43
|
}) {
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
},
|
|
44
|
-
text:
|
|
45
|
-
id: o,
|
|
44
|
+
return /* @__PURE__ */ c("div", { className: o.header, children: i });
|
|
45
|
+
}, Q = function({
|
|
46
|
+
text: i,
|
|
46
47
|
iconLeft: t
|
|
47
48
|
}) {
|
|
48
|
-
const s =
|
|
49
|
+
const s = e.useContext(g), n = e.useContext(h);
|
|
49
50
|
if (!s)
|
|
50
51
|
throw new Error("AccordionTrigger must be used within an Accordion");
|
|
51
52
|
const {
|
|
52
|
-
toggleItem:
|
|
53
|
+
toggleItem: r,
|
|
53
54
|
openItems: l
|
|
54
|
-
} = s,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
} = s, a = l[n], [d, u] = e.useState(!1), [_, m] = e.useState(a ? "UpChevron" : "DownChevron"), p = e.useCallback(() => {
|
|
56
|
+
r(n);
|
|
57
|
+
}, [n, r]), w = e.useCallback((x) => {
|
|
58
|
+
(x.key === "Enter" || x.key === " ") && r(n);
|
|
59
|
+
}, [n, r]);
|
|
60
|
+
return e.useEffect(() => {
|
|
61
|
+
const x = setTimeout(() => {
|
|
62
|
+
m(a ? "UpChevron" : "DownChevron"), u(!1);
|
|
58
63
|
}, 300);
|
|
59
|
-
return
|
|
60
|
-
}, [
|
|
64
|
+
return u(!0), () => clearTimeout(x);
|
|
65
|
+
}, [a]), /* @__PURE__ */ v(
|
|
61
66
|
"div",
|
|
62
67
|
{
|
|
63
|
-
className:
|
|
64
|
-
onClick:
|
|
65
|
-
onKeyDown:
|
|
66
|
-
(d.key === "Enter" || d.key === " ") && _(o);
|
|
67
|
-
},
|
|
68
|
+
className: o.triggerContainer,
|
|
69
|
+
onClick: p,
|
|
70
|
+
onKeyDown: w,
|
|
68
71
|
role: "button",
|
|
69
72
|
tabIndex: 0,
|
|
70
|
-
"aria-expanded":
|
|
71
|
-
"aria-controls": `${
|
|
72
|
-
id: `${
|
|
73
|
+
"aria-expanded": a,
|
|
74
|
+
"aria-controls": `${n}-content`,
|
|
75
|
+
id: `${n}-header`,
|
|
73
76
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
/* @__PURE__ */ e(C, { centered: !0, children: /* @__PURE__ */ e(
|
|
79
|
-
x,
|
|
77
|
+
t && /* @__PURE__ */ c(C, { name: t, className: o.iconLeft }),
|
|
78
|
+
/* @__PURE__ */ c(A, { size: "normal", className: o.text, children: i }),
|
|
79
|
+
/* @__PURE__ */ c(
|
|
80
|
+
C,
|
|
80
81
|
{
|
|
81
|
-
className:
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[
|
|
82
|
+
className: b(o.iconRight, {
|
|
83
|
+
[o.iconFlip]: d,
|
|
84
|
+
[o.iconUp]: _ === "UpChevron",
|
|
85
|
+
[o.iconDown]: _ === "DownChevron"
|
|
85
86
|
}),
|
|
86
|
-
name:
|
|
87
|
+
name: _
|
|
87
88
|
}
|
|
88
|
-
)
|
|
89
|
+
)
|
|
89
90
|
]
|
|
90
91
|
}
|
|
91
92
|
);
|
|
92
|
-
},
|
|
93
|
-
children:
|
|
94
|
-
id: o
|
|
93
|
+
}, W = function({
|
|
94
|
+
children: i
|
|
95
95
|
}) {
|
|
96
|
-
const t =
|
|
96
|
+
const t = e.useContext(g), s = e.useContext(h), [n, r] = e.useState(null), l = e.useRef(null);
|
|
97
97
|
if (!t)
|
|
98
98
|
throw new Error("AccordionContent must be used within an Accordion");
|
|
99
99
|
const {
|
|
100
|
-
openItems:
|
|
101
|
-
} = t
|
|
102
|
-
|
|
100
|
+
openItems: a
|
|
101
|
+
} = t, d = a[s], u = e.useMemo(() => n === null ? 250 : T(n / 150 * 250, 250, 500), [n]), _ = e.useCallback(() => {
|
|
102
|
+
r(null);
|
|
103
|
+
}, []), m = e.useMemo(() => y(_, 250), [_]);
|
|
104
|
+
return e.useEffect(() => (window.addEventListener("resize", m), () => {
|
|
105
|
+
window.removeEventListener("resize", m);
|
|
106
|
+
}), [m]), e.useEffect(() => {
|
|
107
|
+
if (n === null && l.current) {
|
|
108
|
+
const p = l.current.getBoundingClientRect().height;
|
|
109
|
+
r(p);
|
|
110
|
+
}
|
|
111
|
+
}, [n]), /* @__PURE__ */ c(
|
|
103
112
|
"div",
|
|
104
113
|
{
|
|
105
|
-
|
|
106
|
-
id: `${o}-content`,
|
|
114
|
+
id: `${s}-content`,
|
|
107
115
|
role: "region",
|
|
108
|
-
"aria-labelledby": `${
|
|
109
|
-
|
|
116
|
+
"aria-labelledby": `${s}-header`,
|
|
117
|
+
className: b(o.content, {
|
|
118
|
+
[o.open]: d,
|
|
119
|
+
[o.closed]: !d
|
|
120
|
+
}),
|
|
121
|
+
style: {
|
|
122
|
+
"--content-display": n === null ? "inline-block" : "none",
|
|
123
|
+
"--content-height": n === null ? I.q(30) : `${n}px`,
|
|
124
|
+
"--content-animation-time": `${u}ms`
|
|
125
|
+
},
|
|
126
|
+
children: /* @__PURE__ */ c(
|
|
127
|
+
A,
|
|
128
|
+
{
|
|
129
|
+
color: "secondary",
|
|
130
|
+
size: "normal",
|
|
131
|
+
typographic: !0,
|
|
132
|
+
className: o.contentText,
|
|
133
|
+
ref: l,
|
|
134
|
+
children: i
|
|
135
|
+
}
|
|
136
|
+
)
|
|
110
137
|
}
|
|
111
138
|
);
|
|
112
139
|
};
|
|
113
140
|
export {
|
|
114
141
|
V as Accordion,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
142
|
+
W as AccordionContent,
|
|
143
|
+
J as AccordionHeader,
|
|
144
|
+
G as AccordionItem,
|
|
145
|
+
Q as AccordionTrigger
|
|
119
146
|
};
|
|
@@ -1,65 +1,95 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { Flex as
|
|
4
|
-
import { Text as
|
|
2
|
+
import h from "react";
|
|
3
|
+
import { Flex as a } from "../Layout/Flex/Flex.js";
|
|
4
|
+
import { Text as c } from "../Text/Text.js";
|
|
5
5
|
import "../ui.js";
|
|
6
|
-
import { Accordion as
|
|
7
|
-
function
|
|
8
|
-
return /* @__PURE__ */ e(
|
|
9
|
-
/* @__PURE__ */ e(
|
|
10
|
-
/* @__PURE__ */ t(
|
|
11
|
-
/* @__PURE__ */ t(
|
|
12
|
-
/* @__PURE__ */ e(
|
|
6
|
+
import { Accordion as l, AccordionItem as o, AccordionHeader as i, AccordionTrigger as n, AccordionContent as r } from "./Accordion.js";
|
|
7
|
+
function s() {
|
|
8
|
+
return /* @__PURE__ */ e(a, { fullWidth: !0, vertical: !0, children: /* @__PURE__ */ t(a, { fullWidth: !0, vertical: !0, children: [
|
|
9
|
+
/* @__PURE__ */ e(c, { size: "large", children: "Accordion" }),
|
|
10
|
+
/* @__PURE__ */ t(l, { children: [
|
|
11
|
+
/* @__PURE__ */ t(o, { children: [
|
|
12
|
+
/* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
|
|
13
13
|
n,
|
|
14
14
|
{
|
|
15
|
-
id: "item1",
|
|
16
15
|
text: "Will I get banned from GTA:O?",
|
|
17
16
|
iconLeft: "MoreInfo"
|
|
18
17
|
}
|
|
19
18
|
) }),
|
|
20
|
-
/* @__PURE__ */ t(r, {
|
|
19
|
+
/* @__PURE__ */ t(r, { children: [
|
|
21
20
|
"Nope! ",
|
|
22
21
|
/* @__PURE__ */ e("a", { href: "https://cfx.re", children: "FiveM" }),
|
|
23
22
|
" does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it."
|
|
24
23
|
] })
|
|
25
24
|
] }),
|
|
26
|
-
/* @__PURE__ */ t(
|
|
27
|
-
/* @__PURE__ */ e(
|
|
25
|
+
/* @__PURE__ */ t(o, { children: [
|
|
26
|
+
/* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
|
|
28
27
|
n,
|
|
29
28
|
{
|
|
30
|
-
id: "item2",
|
|
31
29
|
text: "Can I cheat on FiveM?",
|
|
32
30
|
iconLeft: "MoreInfo"
|
|
33
31
|
}
|
|
34
32
|
) }),
|
|
35
|
-
/* @__PURE__ */ e(r, {
|
|
33
|
+
/* @__PURE__ */ e(r, { children: "Dont be a cheater, you will get banned! Dont be a cheater, you will get banned! Dont be a cheater, you will get banned! Dont be a cheater, you will get banned! Dont be a cheater, you will get banned! Dont be a cheater, you will get banned! Dont be a cheater, you will get banned!" })
|
|
36
34
|
] }),
|
|
37
|
-
/* @__PURE__ */ t(
|
|
38
|
-
/* @__PURE__ */ e(
|
|
35
|
+
/* @__PURE__ */ t(o, { children: [
|
|
36
|
+
/* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
|
|
39
37
|
n,
|
|
40
38
|
{
|
|
41
|
-
id: "item3",
|
|
42
39
|
text: "Is this accordion any good?",
|
|
43
40
|
iconLeft: "MoreInfo"
|
|
44
41
|
}
|
|
45
42
|
) }),
|
|
46
|
-
/* @__PURE__ */ e(r, {
|
|
43
|
+
/* @__PURE__ */ e(r, { children: "Obviously!" })
|
|
47
44
|
] }),
|
|
48
|
-
/* @__PURE__ */ t(
|
|
49
|
-
/* @__PURE__ */ e(
|
|
45
|
+
/* @__PURE__ */ t(o, { children: [
|
|
46
|
+
/* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
|
|
50
47
|
n,
|
|
51
48
|
{
|
|
52
|
-
id: "item4",
|
|
53
49
|
text: "Who said?",
|
|
54
50
|
iconLeft: "MoreInfo"
|
|
55
51
|
}
|
|
56
52
|
) }),
|
|
57
|
-
/* @__PURE__ */ e(r, {
|
|
53
|
+
/* @__PURE__ */ e(r, { children: "Me!" })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ t(o, { children: [
|
|
56
|
+
/* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
|
|
57
|
+
n,
|
|
58
|
+
{
|
|
59
|
+
text: "Long long text, Long long text, Long long text, Long long text, Long long text, Long long text to test the overflow, will it work? Let's see!",
|
|
60
|
+
iconLeft: "MoreInfo"
|
|
61
|
+
}
|
|
62
|
+
) }),
|
|
63
|
+
/* @__PURE__ */ t(r, { children: [
|
|
64
|
+
"Nope! ",
|
|
65
|
+
/* @__PURE__ */ e("a", { href: "https://cfx.re", children: "FiveM" }),
|
|
66
|
+
" does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it."
|
|
67
|
+
] })
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ t(o, { children: [
|
|
70
|
+
/* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
|
|
71
|
+
n,
|
|
72
|
+
{
|
|
73
|
+
text: "Long long text, Long long text, Long long text, Long long text, Long long text, Long long text to test the overflow, will it work? Let's see!",
|
|
74
|
+
iconLeft: "MoreInfo"
|
|
75
|
+
}
|
|
76
|
+
) }),
|
|
77
|
+
/* @__PURE__ */ t(r, { children: [
|
|
78
|
+
"Nope! ",
|
|
79
|
+
/* @__PURE__ */ e("a", { href: "https://cfx.re", children: "FiveM" }),
|
|
80
|
+
" does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! ",
|
|
81
|
+
/* @__PURE__ */ e("a", { href: "https://cfx.re", children: "FiveM" }),
|
|
82
|
+
" does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! ",
|
|
83
|
+
/* @__PURE__ */ e("a", { href: "https://cfx.re", children: "FiveM" }),
|
|
84
|
+
" does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! ",
|
|
85
|
+
/* @__PURE__ */ e("a", { href: "https://cfx.re", children: "FiveM" }),
|
|
86
|
+
" does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it. Nope! FiveM does not interact with the Rockstar Online Services other than to validate your game copy the first time you launch it."
|
|
87
|
+
] })
|
|
58
88
|
] })
|
|
59
89
|
] })
|
|
60
90
|
] }) });
|
|
61
91
|
}
|
|
62
|
-
const
|
|
92
|
+
const p = h.memo(s);
|
|
63
93
|
export {
|
|
64
|
-
|
|
94
|
+
p as default
|
|
65
95
|
};
|