@cfx-dev/ui-components 4.0.2 → 4.2.0
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/{Combination-BRUj3CHE.js → Combination-Cbiw1XRb.js} +1 -1
- package/dist/assets/css/DropdownSelect.css +1 -1
- package/dist/assets/css/Flex.css +1 -1
- package/dist/assets/css/Input.css +1 -1
- package/dist/assets/css/RichInput.css +1 -1
- package/dist/assets/css/Select.css +1 -1
- package/dist/assets/css/Tabular.css +1 -1
- package/dist/assets/css/ToggleGroup.css +1 -1
- package/dist/assets/general/global.css +1 -1
- package/dist/components/Accordion/Accordion.js +18 -17
- package/dist/components/Accordion/AccordionShowcase.js +3 -2
- package/dist/components/Avatar/AvatarShowcase.js +3 -2
- package/dist/components/Badge/BadgeShowcase.js +5 -4
- package/dist/components/Button/ButtonShowcase.js +3 -2
- package/dist/components/Checkbox/Checkbox.js +6 -5
- package/dist/components/DropdownSelect/DropdownSelect.d.ts +4 -1
- package/dist/components/DropdownSelect/DropdownSelect.js +739 -715
- package/dist/components/DropdownSelect/DropdownSelectShowcase.js +11 -10
- package/dist/components/Flyout/Flyout.js +1 -1
- package/dist/components/Icon/Icon.d.ts +4 -3
- package/dist/components/Icon/Icon.js +27 -25
- package/dist/components/IconBig/IconBig.js +3 -2
- package/dist/components/InfoPanel/InfoPanelShowcase.js +11 -10
- package/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Input/Input.js +96 -75
- package/dist/components/Input/InputShowcase.js +6 -5
- package/dist/components/Input/RichInput.d.ts +2 -1
- package/dist/components/Input/RichInput.js +60 -43
- package/dist/components/Layout/Box/Box.d.ts +4 -11
- package/dist/components/Layout/Box/Box.js +58 -96
- package/dist/components/Layout/Flex/Flex.d.ts +7 -3
- package/dist/components/Layout/Flex/Flex.js +70 -62
- package/dist/components/Layout/Flex/Flex.types.d.ts +42 -0
- package/dist/components/Layout/Flex/Flex.types.js +7 -0
- package/dist/components/Layout/Scrollable/ScrollableShowcase.js +1 -0
- package/dist/components/Link/LinkShowcase.js +1 -0
- package/dist/components/Logos/LogosShowcase.js +3 -2
- package/dist/components/Modal/Modal.js +1 -0
- package/dist/components/Overlay/Overlay.js +1 -1
- package/dist/components/Select/Select.d.ts +2 -3
- package/dist/components/Select/Select.js +1922 -7
- package/dist/components/Select/SelectShowcase.js +4 -3
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.js +2 -3
- package/dist/components/Separator/Separator.d.ts +2 -2
- package/dist/components/Separator/Separator.js +35 -25
- package/dist/components/Skeleton/Skeleton.d.ts +7 -6
- package/dist/components/Skeleton/Skeleton.js +35 -22
- package/dist/components/Skeleton/SkeletonShowcase.js +14 -13
- package/dist/components/Slider/Slider.js +11 -9
- package/dist/components/Slider/SliderShowcase.js +10 -9
- package/dist/components/Spacer/Spacer.d.ts +1 -1
- package/dist/components/Switch/Switch.js +6 -5
- package/dist/components/Table/Table.js +3 -2
- package/dist/components/Table/TableShowcase.js +7 -6
- package/dist/components/Tabular/Tabular.d.ts +6 -1
- package/dist/components/Tabular/Tabular.js +93 -64
- package/dist/components/Tabular/TabularShowcase.js +51 -25
- package/dist/components/Text/Text.d.ts +3 -1
- package/dist/components/Text/Text.js +61 -52
- package/dist/components/Text/Text.types.d.ts +4 -13
- package/dist/components/Text/Text.types.js +1 -4
- package/dist/components/Text/index.d.ts +3 -2
- package/dist/components/Text/index.js +9 -6
- package/dist/components/Title/TitleShowcase.js +4 -3
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +36 -33
- package/dist/components/ToggleGroup/ToggleGroupShowcase.d.ts +5 -0
- package/dist/components/ToggleGroup/ToggleGroupShowcase.js +60 -0
- package/dist/components/ToggleGroup/index.d.ts +2 -0
- package/dist/components/ToggleGroup/index.js +4 -0
- package/dist/components/ui.d.ts +37 -12
- package/dist/components/ui.js +61 -57
- package/dist/index-BZPx6jYI.js +8 -0
- package/dist/index-ByaXH_ih.js +10 -0
- package/dist/index-Cf5Yu9oD.js +67 -0
- package/dist/index-DBus3GoO.js +1342 -0
- package/dist/index-rKs9bXHr.js +6 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +14 -14
- package/dist/{medium-JVtzoF2c.js → medium-BA3EQDZW.js} +2 -2
- package/dist/styles-scss/_ui.scss +10 -1
- package/dist/styles-scss/global.scss +39 -26
- package/dist/styles-scss/themes/theme_cfx.scss +2 -0
- package/dist/styles-scss/themes/theme_fivem.scss +2 -0
- package/dist/styles-scss/themes/theme_redm.scss +2 -0
- package/dist/styles-scss/themes/theme_wireframe.scss +2 -0
- package/dist/styles-scss/themes.scss +4 -4
- package/dist/styles-scss/tokens.scss +30 -17
- package/package.json +1 -1
- package/dist/Select-Ds-fm4CN.js +0 -3245
- package/dist/index-BCnz73Lm.js +0 -72
- package/dist/index-BW3WdIgK.js +0 -14
- package/dist/types/Offset.d.ts +0 -1
- package/dist/types/Offset.js +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import u from "react";
|
|
3
|
+
import { Flex as r } from "../Layout/Flex/Flex.js";
|
|
4
|
+
import { Text as a } from "../Text/Text.js";
|
|
5
|
+
import "../ui.js";
|
|
6
|
+
import { ToggleGroup as i } from "./ToggleGroup.js";
|
|
7
|
+
const n = [
|
|
8
|
+
{
|
|
9
|
+
value: "weekly",
|
|
10
|
+
label: "Weekly"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "monthly",
|
|
14
|
+
label: "Monthly"
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
function c() {
|
|
18
|
+
const [o, t] = u.useState("weekly");
|
|
19
|
+
return /* @__PURE__ */ l(r, { gap: "large", vertical: !0, children: [
|
|
20
|
+
/* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
|
|
21
|
+
/* @__PURE__ */ e(a, { children: "Default ToggleGroup" }),
|
|
22
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
23
|
+
i,
|
|
24
|
+
{
|
|
25
|
+
value: o,
|
|
26
|
+
onChange: t,
|
|
27
|
+
options: n
|
|
28
|
+
}
|
|
29
|
+
) })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
|
|
32
|
+
/* @__PURE__ */ e(a, { children: "Full Width ToggleGroup" }),
|
|
33
|
+
/* @__PURE__ */ e("div", { style: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
34
|
+
i,
|
|
35
|
+
{
|
|
36
|
+
value: o,
|
|
37
|
+
onChange: t,
|
|
38
|
+
options: n,
|
|
39
|
+
fullWidth: !0
|
|
40
|
+
}
|
|
41
|
+
) })
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
|
|
44
|
+
/* @__PURE__ */ e(a, { children: "Disabled ToggleGroup" }),
|
|
45
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
46
|
+
i,
|
|
47
|
+
{
|
|
48
|
+
value: o,
|
|
49
|
+
onChange: t,
|
|
50
|
+
options: n,
|
|
51
|
+
disabled: !0
|
|
52
|
+
}
|
|
53
|
+
) })
|
|
54
|
+
] })
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
const f = u.memo(c);
|
|
58
|
+
export {
|
|
59
|
+
f as default
|
|
60
|
+
};
|
package/dist/components/ui.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare enum TextSizeEnum {
|
|
2
|
+
xxsmall = "xxsmall",
|
|
3
|
+
xsmall = "xsmall",
|
|
4
|
+
small = "small",
|
|
5
|
+
normal = "normal",
|
|
6
|
+
medium = "medium",
|
|
7
|
+
large = "large",
|
|
8
|
+
xlarge = "xlarge",
|
|
9
|
+
xxlarge = "xxlarge",
|
|
10
|
+
xxxlarge = "xxxlarge"
|
|
11
|
+
}
|
|
12
|
+
export type TextSize = keyof typeof TextSizeEnum;
|
|
13
|
+
export declare enum BorderRadiusEnum {
|
|
14
|
+
none = "none",
|
|
15
|
+
xxsmall = "xxsmall",
|
|
16
|
+
xsmall = "xsmall",
|
|
17
|
+
small = "small",
|
|
18
|
+
normal = "normal",
|
|
19
|
+
pill = "pill"
|
|
20
|
+
}
|
|
21
|
+
export type BorderRadiusType = keyof typeof BorderRadiusEnum;
|
|
3
22
|
export declare enum ZIndexEnum {
|
|
4
23
|
zero = "zero",
|
|
5
24
|
first = "first",
|
|
@@ -20,7 +39,7 @@ export declare enum OffsetEnum {
|
|
|
20
39
|
xlarge = "xlarge",
|
|
21
40
|
safezone = "safezone"
|
|
22
41
|
}
|
|
23
|
-
export type
|
|
42
|
+
export type OffsetType = keyof typeof OffsetEnum;
|
|
24
43
|
export declare enum MediaQueryEnum {
|
|
25
44
|
initial = "initial",
|
|
26
45
|
small = "small",
|
|
@@ -31,9 +50,10 @@ export declare enum MediaQueryEnum {
|
|
|
31
50
|
xlarge = "xlarge"
|
|
32
51
|
}
|
|
33
52
|
export type MediaQueryType = keyof typeof MediaQueryEnum;
|
|
34
|
-
export type
|
|
35
|
-
[key in MediaQueryType]?:
|
|
53
|
+
export type ResponsiveValueType<T = string | number> = T | {
|
|
54
|
+
[key in MediaQueryType]?: T;
|
|
36
55
|
};
|
|
56
|
+
export type ResponsiveOffsetType = ResponsiveValueType<OffsetType | number>;
|
|
37
57
|
export interface MPProps {
|
|
38
58
|
m?: ResponsiveOffsetType;
|
|
39
59
|
mt?: ResponsiveOffsetType;
|
|
@@ -51,10 +71,11 @@ export declare namespace ui {
|
|
|
51
71
|
* Returns CSS value of quant value with applied multiplier
|
|
52
72
|
*/
|
|
53
73
|
export function q(multiplier?: number): string;
|
|
54
|
-
export function offset(size:
|
|
55
|
-
export function fontSize(size?:
|
|
74
|
+
export function offset(size: OffsetType): string;
|
|
75
|
+
export function fontSize(size?: TextSize): string;
|
|
56
76
|
export function zindex(name?: ZIndexType): string;
|
|
57
|
-
export function
|
|
77
|
+
export function lineHeight(size?: TextSize): string;
|
|
78
|
+
export function borderRadius(size?: BorderRadiusType): string;
|
|
58
79
|
export function color(name: string, variantRaw?: string | number, alpha?: number): string;
|
|
59
80
|
export namespace cls {
|
|
60
81
|
const fullWidth = "util-full-width";
|
|
@@ -72,11 +93,15 @@ export declare namespace ui {
|
|
|
72
93
|
export const vh: (x: number | string) => string;
|
|
73
94
|
export const vw: (x: number | string) => string;
|
|
74
95
|
export const url: (u: unknown) => string;
|
|
75
|
-
export
|
|
76
|
-
export
|
|
96
|
+
export function defaultResponsiveValueFormatter<A>(val: A): string;
|
|
97
|
+
export function getResponsiveStyles<T = string | number>(name: string, value?: ResponsiveValueType<T>, formatter?: (val: T) => string): React.CSSProperties;
|
|
98
|
+
export function getResponsiveClassnames<T = string | number>(name: string, value?: ResponsiveValueType<T>): string;
|
|
99
|
+
export function getResponsiveFlatClassnames<T = string | number>(name: string, value?: ResponsiveValueType<T>, formatter?: (val: T) => string): string[];
|
|
100
|
+
export function offsetResponsiveValueFormatter(value: OffsetType | number): string;
|
|
101
|
+
export const getOffsetStyles: (name: string, value?: ResponsiveValueType<OffsetType | number>) => import("react").CSSProperties;
|
|
77
102
|
type CallbackType<T> = (name: string, value: ResponsiveOffsetType) => T;
|
|
78
|
-
export function callAllMPProps<T>(props: Partial<MPProps>, callback: CallbackType<T>):
|
|
103
|
+
export function callAllMPProps<T extends object>(props: Partial<MPProps>, callback: CallbackType<T>): T;
|
|
79
104
|
export const getAllMPStyles: (props: Partial<MPProps>) => React.CSSProperties;
|
|
80
|
-
export const
|
|
105
|
+
export const getAllMPClassnames: (props: Partial<MPProps>) => string;
|
|
81
106
|
export {};
|
|
82
107
|
}
|
package/dist/components/ui.js
CHANGED
|
@@ -1,69 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
import { clsx as $ } from "../utils/clsx.js";
|
|
2
|
+
var j = /* @__PURE__ */ ((r) => (r.xxsmall = "xxsmall", r.xsmall = "xsmall", r.small = "small", r.normal = "normal", r.medium = "medium", r.large = "large", r.xlarge = "xlarge", r.xxlarge = "xxlarge", r.xxxlarge = "xxxlarge", r))(j || {}), R = /* @__PURE__ */ ((r) => (r.none = "none", r.xxsmall = "xxsmall", r.xsmall = "xsmall", r.small = "small", r.normal = "normal", r.pill = "pill", r))(R || {}), u = /* @__PURE__ */ ((r) => (r.zero = "zero", r.first = "first", r.second = "second", r.max = "max", r))(u || {}), F = /* @__PURE__ */ ((r) => (r.none = "none", r.hairthin = "hairthin", r.thin = "thin", r.xxsmall = "xxsmall", r.xsmall = "xsmall", r.small = "small", r.normal = "normal", r.medium = "medium", r.large = "large", r.xlarge = "xlarge", r.safezone = "safezone", r))(F || {}), P = /* @__PURE__ */ ((r) => (r.initial = "initial", r.small = "small", r["small-medium"] = "small-medium", r.medium = "medium", r["medium-large"] = "medium-large", r.large = "large", r.xlarge = "xlarge", r))(P || {}), p;
|
|
2
3
|
((r) => {
|
|
3
|
-
function
|
|
4
|
-
return `calc(var(--quant) * ${
|
|
4
|
+
function s(e = 1) {
|
|
5
|
+
return `calc(var(--quant) * ${e})`;
|
|
5
6
|
}
|
|
6
|
-
r.q =
|
|
7
|
-
function
|
|
8
|
-
return `var(--offset-${
|
|
7
|
+
r.q = s;
|
|
8
|
+
function f(e) {
|
|
9
|
+
return `var(--offset-${e})`;
|
|
9
10
|
}
|
|
10
|
-
r.offset =
|
|
11
|
-
function
|
|
12
|
-
return `var(--font-size-${
|
|
11
|
+
r.offset = f;
|
|
12
|
+
function h(e = "normal") {
|
|
13
|
+
return `var(--font-size-${e})`;
|
|
13
14
|
}
|
|
14
|
-
r.fontSize =
|
|
15
|
-
function
|
|
16
|
-
return `var(--zindex-${
|
|
15
|
+
r.fontSize = h;
|
|
16
|
+
function b(e = "first") {
|
|
17
|
+
return `var(--zindex-${e})`;
|
|
17
18
|
}
|
|
18
|
-
r.zindex =
|
|
19
|
-
function
|
|
20
|
-
return `var(--
|
|
19
|
+
r.zindex = b;
|
|
20
|
+
function d(e = "normal") {
|
|
21
|
+
return `var(--line-height-${e})`;
|
|
21
22
|
}
|
|
22
|
-
r.
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
return l === "pure" && (l = ""), typeof l == "number" && (l = `${l}`), `rgba(var(--color-${t}${l ? `-${l}` : ""}), ${n})`;
|
|
23
|
+
r.lineHeight = d;
|
|
24
|
+
function v(e = "normal") {
|
|
25
|
+
return `var(--border-radius-${e})`;
|
|
26
26
|
}
|
|
27
|
-
r.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ml: $,
|
|
43
|
-
p: g,
|
|
44
|
-
pt: a,
|
|
45
|
-
pr: p,
|
|
46
|
-
pb: x,
|
|
47
|
-
pl: d
|
|
48
|
-
} = t;
|
|
49
|
-
return {
|
|
50
|
-
...n ? e("m", n) : null,
|
|
51
|
-
...l ? e("mt", l) : null,
|
|
52
|
-
...o ? e("mr", o) : null,
|
|
53
|
-
...m ? e("mb", m) : null,
|
|
54
|
-
...$ ? e("ml", $) : null,
|
|
55
|
-
...g ? e("p", g) : null,
|
|
56
|
-
...a ? e("pt", a) : null,
|
|
57
|
-
...p ? e("pr", p) : null,
|
|
58
|
-
...x ? e("pb", x) : null,
|
|
59
|
-
...d ? e("pl", d) : null
|
|
27
|
+
r.borderRadius = v;
|
|
28
|
+
function y(e, l, n = 1) {
|
|
29
|
+
let t = l;
|
|
30
|
+
return t === "pure" && (t = ""), typeof t == "number" && (t = `${t}`), `rgba(var(--color-${e}${t ? `-${t}` : ""}), ${n})`;
|
|
31
|
+
}
|
|
32
|
+
r.color = y, ((e) => {
|
|
33
|
+
e.fullWidth = "util-full-width", e.fullHeight = "util-full-height", e.flexGrow = "util-flex-grow", e.flexNoShrink = "util-flex-no-shrink", e.userSelectableText = "util-text-selectable", e.zIndex9000 = "util-z-index-9000";
|
|
34
|
+
})(r.cls || (r.cls = {})), r.pc = (e) => `${e}%`, r.px = (e) => `${e}px`, r.ch = (e) => `${e}ch`, r.em = (e) => `${e}em`, r.rem = (e) => `${e}rem`, r.vh = (e) => `${e}vh`, r.vw = (e) => `${e}vw`, r.url = (e) => `url(${e})`;
|
|
35
|
+
function a(e) {
|
|
36
|
+
return e == null ? "" : typeof e == "number" ? s(e) : e.toString();
|
|
37
|
+
}
|
|
38
|
+
r.defaultResponsiveValueFormatter = a;
|
|
39
|
+
function x(e, l, n = a) {
|
|
40
|
+
return l == null ? {} : typeof l == "object" && !Array.isArray(l) ? Object.entries(l).reduce((t, [o, i]) => (t[`--${e}-${o}`] = n(i), t), {}) : {
|
|
41
|
+
[`--${e}-initial`]: n(l)
|
|
60
42
|
};
|
|
61
43
|
}
|
|
62
|
-
r.
|
|
63
|
-
|
|
44
|
+
r.getResponsiveStyles = x;
|
|
45
|
+
function g(e, l) {
|
|
46
|
+
return l == null ? "" : typeof l == "object" && !Array.isArray(l) ? $(Object.keys(l).map((n) => `ui-${e}-${n}`)) : `ui-${e}-initial`;
|
|
47
|
+
}
|
|
48
|
+
r.getResponsiveClassnames = g;
|
|
49
|
+
function A(e, l, n = a) {
|
|
50
|
+
return l == null ? [] : typeof l == "object" && !Array.isArray(l) ? Object.entries(l).reduce((t, [o, i]) => (t.push(`${e}-${o}-${n(i)}`), t), []) : [`${e}-initial-${n(l)}`];
|
|
51
|
+
}
|
|
52
|
+
r.getResponsiveFlatClassnames = A;
|
|
53
|
+
function m(e) {
|
|
54
|
+
return typeof e == "number" ? s(e) : f(e);
|
|
55
|
+
}
|
|
56
|
+
r.offsetResponsiveValueFormatter = m, r.getOffsetStyles = (e, l) => x(e, l, m);
|
|
57
|
+
function c(e, l) {
|
|
58
|
+
return Object.entries(e).reduce((n, [t, o]) => (Object.assign(n, l(t, o)), n), {});
|
|
59
|
+
}
|
|
60
|
+
r.callAllMPProps = c, r.getAllMPStyles = (e) => c(e, r.getOffsetStyles), r.getAllMPClassnames = (e) => $(
|
|
61
|
+
Object.entries(e).map(
|
|
62
|
+
([l, n]) => g(l, n)
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
})(p || (p = {}));
|
|
64
66
|
export {
|
|
67
|
+
R as BorderRadiusEnum,
|
|
65
68
|
P as MediaQueryEnum,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
F as OffsetEnum,
|
|
70
|
+
j as TextSizeEnum,
|
|
71
|
+
u as ZIndexEnum,
|
|
72
|
+
p as ui
|
|
69
73
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
function d(e) {
|
|
3
|
+
const r = i.useRef(e);
|
|
4
|
+
return i.useEffect(() => {
|
|
5
|
+
r.current = e;
|
|
6
|
+
}), i.useMemo(() => (...o) => {
|
|
7
|
+
var t;
|
|
8
|
+
return (t = r.current) == null ? void 0 : t.call(r, ...o);
|
|
9
|
+
}, []);
|
|
10
|
+
}
|
|
11
|
+
function v({
|
|
12
|
+
prop: e,
|
|
13
|
+
defaultProp: r,
|
|
14
|
+
onChange: o = () => {
|
|
15
|
+
}
|
|
16
|
+
}) {
|
|
17
|
+
const [t, s] = b({ defaultProp: r, onChange: o }), n = e !== void 0, f = n ? e : t, c = d(o), a = i.useCallback(
|
|
18
|
+
(u) => {
|
|
19
|
+
if (n) {
|
|
20
|
+
const l = typeof u == "function" ? u(e) : u;
|
|
21
|
+
l !== e && c(l);
|
|
22
|
+
} else
|
|
23
|
+
s(u);
|
|
24
|
+
},
|
|
25
|
+
[n, e, s, c]
|
|
26
|
+
);
|
|
27
|
+
return [f, a];
|
|
28
|
+
}
|
|
29
|
+
function b({
|
|
30
|
+
defaultProp: e,
|
|
31
|
+
onChange: r
|
|
32
|
+
}) {
|
|
33
|
+
const o = i.useState(e), [t] = o, s = i.useRef(t), n = d(r);
|
|
34
|
+
return i.useEffect(() => {
|
|
35
|
+
s.current !== t && (n(t), s.current = t);
|
|
36
|
+
}, [t, s, n]), o;
|
|
37
|
+
}
|
|
38
|
+
var h = globalThis != null && globalThis.document ? i.useLayoutEffect : () => {
|
|
39
|
+
};
|
|
40
|
+
function z(e) {
|
|
41
|
+
const [r, o] = i.useState(void 0);
|
|
42
|
+
return h(() => {
|
|
43
|
+
if (e) {
|
|
44
|
+
o({ width: e.offsetWidth, height: e.offsetHeight });
|
|
45
|
+
const t = new ResizeObserver((s) => {
|
|
46
|
+
if (!Array.isArray(s) || !s.length)
|
|
47
|
+
return;
|
|
48
|
+
const n = s[0];
|
|
49
|
+
let f, c;
|
|
50
|
+
if ("borderBoxSize" in n) {
|
|
51
|
+
const a = n.borderBoxSize, u = Array.isArray(a) ? a[0] : a;
|
|
52
|
+
f = u.inlineSize, c = u.blockSize;
|
|
53
|
+
} else
|
|
54
|
+
f = e.offsetWidth, c = e.offsetHeight;
|
|
55
|
+
o({ width: f, height: c });
|
|
56
|
+
});
|
|
57
|
+
return t.observe(e, { box: "border-box" }), () => t.unobserve(e);
|
|
58
|
+
} else
|
|
59
|
+
o(void 0);
|
|
60
|
+
}, [e]), r;
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
z as a,
|
|
64
|
+
h as b,
|
|
65
|
+
d as c,
|
|
66
|
+
v as u
|
|
67
|
+
};
|