@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.
Files changed (95) hide show
  1. package/dist/{Combination-BRUj3CHE.js → Combination-Cbiw1XRb.js} +1 -1
  2. package/dist/assets/css/DropdownSelect.css +1 -1
  3. package/dist/assets/css/Flex.css +1 -1
  4. package/dist/assets/css/Input.css +1 -1
  5. package/dist/assets/css/RichInput.css +1 -1
  6. package/dist/assets/css/Select.css +1 -1
  7. package/dist/assets/css/Tabular.css +1 -1
  8. package/dist/assets/css/ToggleGroup.css +1 -1
  9. package/dist/assets/general/global.css +1 -1
  10. package/dist/components/Accordion/Accordion.js +18 -17
  11. package/dist/components/Accordion/AccordionShowcase.js +3 -2
  12. package/dist/components/Avatar/AvatarShowcase.js +3 -2
  13. package/dist/components/Badge/BadgeShowcase.js +5 -4
  14. package/dist/components/Button/ButtonShowcase.js +3 -2
  15. package/dist/components/Checkbox/Checkbox.js +6 -5
  16. package/dist/components/DropdownSelect/DropdownSelect.d.ts +4 -1
  17. package/dist/components/DropdownSelect/DropdownSelect.js +739 -715
  18. package/dist/components/DropdownSelect/DropdownSelectShowcase.js +11 -10
  19. package/dist/components/Flyout/Flyout.js +1 -1
  20. package/dist/components/Icon/Icon.d.ts +4 -3
  21. package/dist/components/Icon/Icon.js +27 -25
  22. package/dist/components/IconBig/IconBig.js +3 -2
  23. package/dist/components/InfoPanel/InfoPanelShowcase.js +11 -10
  24. package/dist/components/Input/Input.d.ts +2 -1
  25. package/dist/components/Input/Input.js +96 -75
  26. package/dist/components/Input/InputShowcase.js +6 -5
  27. package/dist/components/Input/RichInput.d.ts +2 -1
  28. package/dist/components/Input/RichInput.js +60 -43
  29. package/dist/components/Layout/Box/Box.d.ts +4 -11
  30. package/dist/components/Layout/Box/Box.js +58 -96
  31. package/dist/components/Layout/Flex/Flex.d.ts +7 -3
  32. package/dist/components/Layout/Flex/Flex.js +70 -62
  33. package/dist/components/Layout/Flex/Flex.types.d.ts +42 -0
  34. package/dist/components/Layout/Flex/Flex.types.js +7 -0
  35. package/dist/components/Layout/Scrollable/ScrollableShowcase.js +1 -0
  36. package/dist/components/Link/LinkShowcase.js +1 -0
  37. package/dist/components/Logos/LogosShowcase.js +3 -2
  38. package/dist/components/Modal/Modal.js +1 -0
  39. package/dist/components/Overlay/Overlay.js +1 -1
  40. package/dist/components/Select/Select.d.ts +2 -3
  41. package/dist/components/Select/Select.js +1922 -7
  42. package/dist/components/Select/SelectShowcase.js +4 -3
  43. package/dist/components/Select/index.d.ts +1 -1
  44. package/dist/components/Select/index.js +2 -3
  45. package/dist/components/Separator/Separator.d.ts +2 -2
  46. package/dist/components/Separator/Separator.js +35 -25
  47. package/dist/components/Skeleton/Skeleton.d.ts +7 -6
  48. package/dist/components/Skeleton/Skeleton.js +35 -22
  49. package/dist/components/Skeleton/SkeletonShowcase.js +14 -13
  50. package/dist/components/Slider/Slider.js +11 -9
  51. package/dist/components/Slider/SliderShowcase.js +10 -9
  52. package/dist/components/Spacer/Spacer.d.ts +1 -1
  53. package/dist/components/Switch/Switch.js +6 -5
  54. package/dist/components/Table/Table.js +3 -2
  55. package/dist/components/Table/TableShowcase.js +7 -6
  56. package/dist/components/Tabular/Tabular.d.ts +6 -1
  57. package/dist/components/Tabular/Tabular.js +93 -64
  58. package/dist/components/Tabular/TabularShowcase.js +51 -25
  59. package/dist/components/Text/Text.d.ts +3 -1
  60. package/dist/components/Text/Text.js +61 -52
  61. package/dist/components/Text/Text.types.d.ts +4 -13
  62. package/dist/components/Text/Text.types.js +1 -4
  63. package/dist/components/Text/index.d.ts +3 -2
  64. package/dist/components/Text/index.js +9 -6
  65. package/dist/components/Title/TitleShowcase.js +4 -3
  66. package/dist/components/ToggleGroup/ToggleGroup.d.ts +1 -0
  67. package/dist/components/ToggleGroup/ToggleGroup.js +36 -33
  68. package/dist/components/ToggleGroup/ToggleGroupShowcase.d.ts +5 -0
  69. package/dist/components/ToggleGroup/ToggleGroupShowcase.js +60 -0
  70. package/dist/components/ToggleGroup/index.d.ts +2 -0
  71. package/dist/components/ToggleGroup/index.js +4 -0
  72. package/dist/components/ui.d.ts +37 -12
  73. package/dist/components/ui.js +61 -57
  74. package/dist/index-BZPx6jYI.js +8 -0
  75. package/dist/index-ByaXH_ih.js +10 -0
  76. package/dist/index-Cf5Yu9oD.js +67 -0
  77. package/dist/index-DBus3GoO.js +1342 -0
  78. package/dist/index-rKs9bXHr.js +6 -0
  79. package/dist/main.d.ts +1 -1
  80. package/dist/main.js +14 -14
  81. package/dist/{medium-JVtzoF2c.js → medium-BA3EQDZW.js} +2 -2
  82. package/dist/styles-scss/_ui.scss +10 -1
  83. package/dist/styles-scss/global.scss +39 -26
  84. package/dist/styles-scss/themes/theme_cfx.scss +2 -0
  85. package/dist/styles-scss/themes/theme_fivem.scss +2 -0
  86. package/dist/styles-scss/themes/theme_redm.scss +2 -0
  87. package/dist/styles-scss/themes/theme_wireframe.scss +2 -0
  88. package/dist/styles-scss/themes.scss +4 -4
  89. package/dist/styles-scss/tokens.scss +30 -17
  90. package/package.json +1 -1
  91. package/dist/Select-Ds-fm4CN.js +0 -3245
  92. package/dist/index-BCnz73Lm.js +0 -72
  93. package/dist/index-BW3WdIgK.js +0 -14
  94. package/dist/types/Offset.d.ts +0 -1
  95. 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
+ };
@@ -0,0 +1,2 @@
1
+ export { ToggleGroup } from './ToggleGroup';
2
+ export type { ToggleGroupOption, ToggleGroupProps } from './ToggleGroup';
@@ -0,0 +1,4 @@
1
+ import { ToggleGroup as e } from "./ToggleGroup.js";
2
+ export {
3
+ e as ToggleGroup
4
+ };
@@ -1,5 +1,24 @@
1
- import { TextProps } from './Text/Text.types';
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 OffesetType = keyof typeof OffsetEnum;
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 ResponsiveOffsetType = OffesetType | number | {
35
- [key in MediaQueryType]?: OffesetType | number;
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: OffesetType): string;
55
- export function fontSize(size?: TextProps['size']): string;
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 borderRadius(size?: 'xsmall' | 'small' | 'normal'): string;
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 const getOffsetAttrs: (name: string, value: ResponsiveOffsetType) => Record<string, string>;
76
- export const getOffsetStyles: (name: string, value: ResponsiveOffsetType) => Record<string, string>;
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 getAllMPAttrs: (props: Partial<MPProps>) => Record<string, string>;
105
+ export const getAllMPClassnames: (props: Partial<MPProps>) => string;
81
106
  export {};
82
107
  }
@@ -1,69 +1,73 @@
1
- var A = /* @__PURE__ */ ((r) => (r.zero = "zero", r.first = "first", r.second = "second", r.max = "max", r))(A || {}), v = /* @__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))(v || {}), 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 || {}), h;
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 i(t = 1) {
4
- return `calc(var(--quant) * ${t})`;
4
+ function s(e = 1) {
5
+ return `calc(var(--quant) * ${e})`;
5
6
  }
6
- r.q = i;
7
- function s(t) {
8
- return `var(--offset-${t})`;
7
+ r.q = s;
8
+ function f(e) {
9
+ return `var(--offset-${e})`;
9
10
  }
10
- r.offset = s;
11
- function u(t = "normal") {
12
- return `var(--font-size-${t})`;
11
+ r.offset = f;
12
+ function h(e = "normal") {
13
+ return `var(--font-size-${e})`;
13
14
  }
14
- r.fontSize = u;
15
- function z(t = "first") {
16
- return `var(--zindex-${t})`;
15
+ r.fontSize = h;
16
+ function b(e = "first") {
17
+ return `var(--zindex-${e})`;
17
18
  }
18
- r.zindex = z;
19
- function S(t = "normal") {
20
- return `var(--border-radius-${t})`;
19
+ r.zindex = b;
20
+ function d(e = "normal") {
21
+ return `var(--line-height-${e})`;
21
22
  }
22
- r.borderRadius = S;
23
- function b(t, e, n = 1) {
24
- let l = e;
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.color = b, ((t) => {
28
- t.fullWidth = "util-full-width", t.fullHeight = "util-full-height", t.flexGrow = "util-flex-grow", t.flexNoShrink = "util-flex-no-shrink", t.userSelectableText = "util-text-selectable", t.zIndex9000 = "util-z-index-9000";
29
- })(r.cls || (r.cls = {})), r.pc = (t) => `${t}%`, r.px = (t) => `${t}px`, r.ch = (t) => `${t}ch`, r.em = (t) => `${t}em`, r.rem = (t) => `${t}rem`, r.vh = (t) => `${t}vh`, r.vw = (t) => `${t}vw`, r.url = (t) => `url(${t})`, r.getOffsetAttrs = (t, e) => typeof e == "string" || typeof e == "number" ? {
30
- [`data-${t}-initial`]: e.toString()
31
- } : Object.entries(e).reduce((n, [l, o]) => (n[`data-${t}-${l}`] = o.toString(), n), {}), r.getOffsetStyles = (t, e) => typeof e == "string" ? {
32
- [`--${t}-initial`]: s(e)
33
- } : typeof e == "number" ? {
34
- [`--${t}-initial`]: i(e)
35
- } : Object.entries(e).reduce((n, [l, o]) => (n[`--${t}-${l}`] = typeof o == "number" ? i(o) : s(o), n), {});
36
- function f(t, e) {
37
- const {
38
- m: n,
39
- mt: l,
40
- mr: o,
41
- mb: m,
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.callAllMPProps = f, r.getAllMPStyles = (t) => f(t, r.getOffsetStyles), r.getAllMPAttrs = (t) => f(t, r.getOffsetAttrs);
63
- })(h || (h = {}));
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
- v as OffsetEnum,
67
- A as ZIndexEnum,
68
- h as ui
69
+ F as OffsetEnum,
70
+ j as TextSizeEnum,
71
+ u as ZIndexEnum,
72
+ p as ui
69
73
  };
@@ -0,0 +1,8 @@
1
+ import * as u from "react";
2
+ function t(r) {
3
+ const e = u.useRef({ value: r, previous: r });
4
+ return u.useMemo(() => (e.current.value !== r && (e.current.previous = e.current.value, e.current.value = r), e.current.previous), [r]);
5
+ }
6
+ export {
7
+ t as u
8
+ };
@@ -0,0 +1,10 @@
1
+ import * as t from "react";
2
+ import "react/jsx-runtime";
3
+ var r = t.createContext(void 0);
4
+ function n(o) {
5
+ const e = t.useContext(r);
6
+ return o || e || "ltr";
7
+ }
8
+ export {
9
+ n as u
10
+ };
@@ -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
+ };