@cfx-dev/ui-components 4.0.1 → 4.1.1

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 (85) 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/general/global.css +1 -1
  8. package/dist/components/Accordion/Accordion.js +18 -17
  9. package/dist/components/Accordion/AccordionShowcase.js +3 -2
  10. package/dist/components/Avatar/AvatarShowcase.js +3 -2
  11. package/dist/components/Badge/BadgeShowcase.js +5 -4
  12. package/dist/components/Button/ButtonShowcase.js +3 -2
  13. package/dist/components/Checkbox/Checkbox.js +6 -5
  14. package/dist/components/DropdownSelect/DropdownSelect.d.ts +4 -1
  15. package/dist/components/DropdownSelect/DropdownSelect.js +783 -755
  16. package/dist/components/DropdownSelect/DropdownSelectShowcase.js +11 -10
  17. package/dist/components/Flyout/Flyout.js +1 -1
  18. package/dist/components/Icon/Icon.d.ts +4 -3
  19. package/dist/components/Icon/Icon.js +27 -25
  20. package/dist/components/IconBig/IconBig.js +3 -2
  21. package/dist/components/InfoPanel/InfoPanelShowcase.js +11 -10
  22. package/dist/components/Input/Input.d.ts +2 -1
  23. package/dist/components/Input/Input.js +96 -75
  24. package/dist/components/Input/InputShowcase.js +6 -5
  25. package/dist/components/Input/RichInput.d.ts +2 -1
  26. package/dist/components/Input/RichInput.js +60 -43
  27. package/dist/components/Layout/Box/Box.d.ts +4 -11
  28. package/dist/components/Layout/Box/Box.js +58 -96
  29. package/dist/components/Layout/Flex/Flex.d.ts +7 -3
  30. package/dist/components/Layout/Flex/Flex.js +70 -62
  31. package/dist/components/Layout/Flex/Flex.types.d.ts +42 -0
  32. package/dist/components/Layout/Flex/Flex.types.js +7 -0
  33. package/dist/components/Layout/Scrollable/ScrollableShowcase.js +1 -0
  34. package/dist/components/Link/LinkShowcase.js +1 -0
  35. package/dist/components/Logos/LogosShowcase.js +3 -2
  36. package/dist/components/Modal/Modal.js +1 -0
  37. package/dist/components/Overlay/Overlay.js +1 -1
  38. package/dist/components/Select/Select.d.ts +2 -3
  39. package/dist/components/Select/Select.js +1922 -7
  40. package/dist/components/Select/SelectShowcase.js +4 -3
  41. package/dist/components/Select/index.d.ts +1 -1
  42. package/dist/components/Select/index.js +2 -3
  43. package/dist/components/Separator/Separator.d.ts +2 -2
  44. package/dist/components/Separator/Separator.js +35 -25
  45. package/dist/components/Skeleton/Skeleton.d.ts +7 -6
  46. package/dist/components/Skeleton/Skeleton.js +35 -22
  47. package/dist/components/Skeleton/SkeletonShowcase.js +14 -13
  48. package/dist/components/Slider/Slider.js +11 -9
  49. package/dist/components/Slider/SliderShowcase.js +10 -9
  50. package/dist/components/Spacer/Spacer.d.ts +1 -1
  51. package/dist/components/Switch/Switch.js +6 -5
  52. package/dist/components/Table/Table.js +3 -2
  53. package/dist/components/Table/TableShowcase.js +7 -6
  54. package/dist/components/Tabular/TabularShowcase.js +3 -2
  55. package/dist/components/Text/Text.d.ts +3 -1
  56. package/dist/components/Text/Text.js +61 -52
  57. package/dist/components/Text/Text.types.d.ts +4 -13
  58. package/dist/components/Text/Text.types.js +1 -4
  59. package/dist/components/Text/index.d.ts +3 -2
  60. package/dist/components/Text/index.js +9 -6
  61. package/dist/components/Title/TitleShowcase.js +4 -3
  62. package/dist/components/ui.d.ts +45 -12
  63. package/dist/components/ui.js +64 -55
  64. package/dist/index-BZPx6jYI.js +8 -0
  65. package/dist/index-ByaXH_ih.js +10 -0
  66. package/dist/index-Cf5Yu9oD.js +67 -0
  67. package/dist/index-DBus3GoO.js +1342 -0
  68. package/dist/index-rKs9bXHr.js +6 -0
  69. package/dist/main.d.ts +1 -1
  70. package/dist/main.js +14 -14
  71. package/dist/{medium-JVtzoF2c.js → medium-BA3EQDZW.js} +2 -2
  72. package/dist/styles-scss/_ui.scss +10 -1
  73. package/dist/styles-scss/global.scss +39 -25
  74. package/dist/styles-scss/themes/theme_cfx.scss +2 -0
  75. package/dist/styles-scss/themes/theme_fivem.scss +2 -0
  76. package/dist/styles-scss/themes/theme_redm.scss +2 -0
  77. package/dist/styles-scss/themes/theme_wireframe.scss +2 -0
  78. package/dist/styles-scss/themes.scss +4 -4
  79. package/dist/styles-scss/tokens.scss +28 -15
  80. package/package.json +1 -1
  81. package/dist/Select-Ds-fm4CN.js +0 -3245
  82. package/dist/index-BCnz73Lm.js +0 -72
  83. package/dist/index-BW3WdIgK.js +0 -14
  84. package/dist/types/Offset.d.ts +0 -1
  85. package/dist/types/Offset.js +0 -1
@@ -1,73 +1,82 @@
1
- import { jsx as s } from "react/jsx-runtime";
1
+ import { jsx as f } from "react/jsx-runtime";
2
2
  import l from "react";
3
- import { ui as C } from "../ui.js";
4
- import { clsx as w } from "../../utils/clsx.js";
5
- import { getColor as A } from "../../utils/color.js";
6
- const O = "cfxui__Text__root__2fe11", R = "cfxui__Text__centered__4d7bd", S = "cfxui__Text__underlined__5860e", $ = "cfxui__Text__truncated__417f4", E = "cfxui__Text__typographic__d8155", N = "cfxui__Text__block__cb1b6", o = {
7
- root: O,
8
- centered: R,
9
- underlined: S,
10
- truncated: $,
11
- typographic: E,
12
- block: N
13
- }, z = {
3
+ import { ui as t, TextSizeEnum as _ } from "../ui.js";
4
+ import { clsx as v } from "../../utils/clsx.js";
5
+ import { getColor as z } from "../../utils/color.js";
6
+ const w = "cfxui__Text__root__2fe11", A = "cfxui__Text__centered__4d7bd", E = "cfxui__Text__underlined__5860e", O = "cfxui__Text__truncated__417f4", F = "cfxui__Text__typographic__d8155", H = "cfxui__Text__block__cb1b6", r = {
7
+ root: w,
8
+ centered: A,
9
+ underlined: E,
10
+ truncated: O,
11
+ typographic: F,
12
+ block: H
13
+ }, N = (e) => e in _ ? t.fontSize(e) : typeof e == "number" ? t.q(e) : e, $ = (e) => e in _ ? t.lineHeight(e) : typeof e == "number" ? t.q(e) : e, B = {
14
14
  0: 0,
15
15
  25: "var(--text-opacity-25)",
16
16
  50: "var(--text-opacity-50)",
17
17
  75: "var(--text-opacity-75)",
18
18
  100: 1
19
- }, B = {
19
+ }, P = {
20
20
  h1: "h1",
21
21
  h2: "h2",
22
22
  h3: "h3",
23
23
  h4: "h4",
24
24
  h5: "h5",
25
25
  h6: "h6"
26
- }, P = (r, t = 1) => {
27
- const e = typeof r == "string" && z[r];
28
- return typeof e == "string" || typeof e == "number" ? e : t;
29
- }, D = "primary", F = l.forwardRef(function(t, e) {
26
+ }, q = (e, n = 1) => {
27
+ const o = typeof e == "string" && B[e];
28
+ return typeof o == "string" || typeof o == "number" ? o : n;
29
+ }, D = "primary", I = l.forwardRef(function(n, o) {
30
30
  const {
31
- family: n,
32
- size: a = "normal",
33
- weight: _ = "normal",
34
- letterSpacing: f = "normal",
31
+ family: s,
32
+ size: i = "normal",
33
+ weight: p = "normal",
34
+ letterSpacing: u = "normal",
35
35
  as: c = "span",
36
- centered: p = !1,
36
+ centered: m = !1,
37
37
  truncated: d = !1,
38
- typographic: u = !1,
39
- uppercase: m = !1,
40
- userSelectable: x = !1,
41
- underlined: h = !1,
42
- children: y,
43
- className: T
44
- } = t, g = c === "div", b = w(o.root, T, {
45
- [o.block]: g,
46
- [o.centered]: p,
47
- [o.truncated]: d,
48
- [o.underlined]: h,
49
- [o.typographic]: u,
50
- [C.cls.userSelectableText]: x
51
- }), v = A({
52
- ...t,
53
- color: t.color || D,
54
- opacity: P(t.opacity)
55
- }), k = typeof n == "string" ? n : B[c] || "primary", i = {
56
- color: v,
38
+ typographic: h = !1,
39
+ uppercase: x = !1,
40
+ userSelectable: y = !1,
41
+ underlined: g = !1,
42
+ children: T,
43
+ className: b
44
+ } = n, R = c === "div", S = v(
45
+ r.root,
46
+ b,
47
+ t.getResponsiveClassnames("font-size", i),
48
+ t.getResponsiveClassnames("line-height", i),
49
+ {
50
+ [r.block]: R,
51
+ [r.centered]: m,
52
+ [r.truncated]: d,
53
+ [r.underlined]: g,
54
+ [r.typographic]: h,
55
+ [t.cls.userSelectableText]: y
56
+ }
57
+ ), C = z({
58
+ ...n,
59
+ color: n.color || D,
60
+ opacity: q(n.opacity)
61
+ }), k = typeof s == "string" ? s : P[c] || "primary", a = {
62
+ color: C,
57
63
  fontFamily: `var(--font-family-${k})`,
58
- fontSize: `var(--font-size-${a})`,
59
- lineHeight: `var(--line-height-${a})`,
60
- letterSpacing: `var(--letter-spacing-${f})`,
61
- fontWeight: `var(--font-weight-${_})`
64
+ lineHeight: `var(--line-height-${i})`,
65
+ letterSpacing: `var(--letter-spacing-${u})`,
66
+ fontWeight: `var(--font-weight-${p})`,
67
+ ...t.getResponsiveStyles("font-size", i, N),
68
+ ...t.getResponsiveStyles("line-height", i, $)
62
69
  };
63
- return m && (i.textTransform = "uppercase"), /* @__PURE__ */ s(c, { ref: e, dir: "auto", className: b, style: i, children: y });
64
- }), G = l.forwardRef(function(t, e) {
65
- return /* @__PURE__ */ s(F, { ref: e, ...t, as: "div" });
70
+ return x && (a.textTransform = "uppercase"), /* @__PURE__ */ f(c, { ref: o, dir: "auto", className: S, style: a, children: T });
71
+ }), U = l.forwardRef(function(n, o) {
72
+ return /* @__PURE__ */ f(I, { ref: o, ...n, as: "div" });
66
73
  });
67
74
  export {
68
75
  D as DEFAULT_TEXT_COLOR,
69
- z as TEXT_OPACITY_MAP,
70
- F as Text,
71
- G as TextBlock,
72
- P as getTextOpacity
76
+ B as TEXT_OPACITY_MAP,
77
+ I as Text,
78
+ U as TextBlock,
79
+ q as getTextOpacity,
80
+ $ as lineHeightResponsiveValueFormatter,
81
+ N as textSizeResponsiveValueFormatter
73
82
  };
@@ -1,17 +1,8 @@
1
+ import { ResponsiveValueType, TextSize as RawTextSize } from '../ui';
1
2
  import { GetColorProps } from '../../utils/color';
2
3
 
3
- export declare enum TextSizeEnum {
4
- xxsmall = "xxsmall",
5
- xsmall = "xsmall",
6
- small = "small",
7
- normal = "normal",
8
- medium = "medium",
9
- large = "large",
10
- xlarge = "xlarge",
11
- xxlarge = "xxlarge",
12
- xxxlarge = "xxxlarge"
13
- }
14
- export type TextSize = keyof typeof TextSizeEnum;
4
+ export type TextSize = RawTextSize;
5
+ export type ResponsiveTextSize = TextSize | string | number;
15
6
  export type TextWeight = 'thin' | 'normal' | 'bold' | 'bolder';
16
7
  export type TextOpacity = '0' | '25' | '50' | '75' | '100';
17
8
  export type TextAs = 'span' | 'div' | 'p' | 'label' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
@@ -30,7 +21,7 @@ interface TextPropsBase {
30
21
  userSelectable?: boolean;
31
22
  uppercase?: boolean;
32
23
  underlined?: boolean;
33
- size?: TextSize;
24
+ size?: ResponsiveValueType<ResponsiveTextSize>;
34
25
  weight?: TextWeight;
35
26
  letterSpacing?: TextLetterSpacing;
36
27
  family?: 'primary' | 'secondary';
@@ -1,4 +1 @@
1
- var a = /* @__PURE__ */ ((l) => (l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.normal = "normal", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.xxlarge = "xxlarge", l.xxxlarge = "xxxlarge", l))(a || {});
2
- export {
3
- a as TextSizeEnum
4
- };
1
+
@@ -1,2 +1,3 @@
1
- export { Text, TextBlock, TEXT_OPACITY_MAP, DEFAULT_TEXT_COLOR, getTextOpacity, } from './Text';
2
- export type { TextSize, TextWeight, TextOpacity, TextAs, TextLetterSpacing, TextProps, TextColorProps, } from './Text.types';
1
+ export { Text, TextBlock, TEXT_OPACITY_MAP, DEFAULT_TEXT_COLOR, getTextOpacity, textSizeResponsiveValueFormatter, } from './Text';
2
+ export { TextSizeEnum } from '../ui';
3
+ export type { TextSize, TextWeight, TextOpacity, TextAs, TextLetterSpacing, TextProps, TextColorProps, ResponsiveTextSize, } from './Text.types';
@@ -1,8 +1,11 @@
1
- import { DEFAULT_TEXT_COLOR as e, TEXT_OPACITY_MAP as x, Text as O, TextBlock as _, getTextOpacity as o } from "./Text.js";
1
+ import { DEFAULT_TEXT_COLOR as T, TEXT_OPACITY_MAP as o, Text as x, TextBlock as r, getTextOpacity as i, textSizeResponsiveValueFormatter as m } from "./Text.js";
2
+ import { TextSizeEnum as E } from "../ui.js";
2
3
  export {
3
- e as DEFAULT_TEXT_COLOR,
4
- x as TEXT_OPACITY_MAP,
5
- O as Text,
6
- _ as TextBlock,
7
- o as getTextOpacity
4
+ T as DEFAULT_TEXT_COLOR,
5
+ o as TEXT_OPACITY_MAP,
6
+ x as Text,
7
+ r as TextBlock,
8
+ E as TextSizeEnum,
9
+ i as getTextOpacity,
10
+ m as textSizeResponsiveValueFormatter
8
11
  };
@@ -2,8 +2,9 @@ import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
2
  import i from "react";
3
3
  import { Flex as r } from "../Layout/Flex/Flex.js";
4
4
  import { Text as o } from "../Text/Text.js";
5
+ import "../ui.js";
5
6
  import { Title as l } from "./Title.js";
6
- function a() {
7
+ function m() {
7
8
  return /* @__PURE__ */ e(r, { gap: "large", vertical: !0, children: /* @__PURE__ */ t(r, { gap: "normal", vertical: !0, children: [
8
9
  /* @__PURE__ */ e(o, { children: "Hover case" }),
9
10
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
@@ -16,7 +17,7 @@ function a() {
16
17
  ) })
17
18
  ] }) });
18
19
  }
19
- const d = i.memo(a);
20
+ const f = i.memo(m);
20
21
  export {
21
- d as default
22
+ f as default
22
23
  };
@@ -1,5 +1,31 @@
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;
22
+ export declare enum ZIndexEnum {
23
+ zero = "zero",
24
+ first = "first",
25
+ second = "second",
26
+ max = "max"
27
+ }
28
+ export type ZIndexType = keyof typeof ZIndexEnum;
3
29
  export declare enum OffsetEnum {
4
30
  none = "none",
5
31
  hairthin = "hairthin",
@@ -13,7 +39,7 @@ export declare enum OffsetEnum {
13
39
  xlarge = "xlarge",
14
40
  safezone = "safezone"
15
41
  }
16
- export type OffesetType = keyof typeof OffsetEnum;
42
+ export type OffsetType = keyof typeof OffsetEnum;
17
43
  export declare enum MediaQueryEnum {
18
44
  initial = "initial",
19
45
  small = "small",
@@ -24,9 +50,10 @@ export declare enum MediaQueryEnum {
24
50
  xlarge = "xlarge"
25
51
  }
26
52
  export type MediaQueryType = keyof typeof MediaQueryEnum;
27
- export type ResponsiveOffsetType = OffesetType | number | {
28
- [key in MediaQueryType]?: OffesetType | number;
53
+ export type ResponsiveValueType<T = string | number> = T | {
54
+ [key in MediaQueryType]?: T;
29
55
  };
56
+ export type ResponsiveOffsetType = ResponsiveValueType<OffsetType | number>;
30
57
  export interface MPProps {
31
58
  m?: ResponsiveOffsetType;
32
59
  mt?: ResponsiveOffsetType;
@@ -44,9 +71,11 @@ export declare namespace ui {
44
71
  * Returns CSS value of quant value with applied multiplier
45
72
  */
46
73
  export function q(multiplier?: number): string;
47
- export function offset(size: OffesetType): string;
48
- export function fontSize(size?: TextProps['size']): string;
49
- export function borderRadius(size?: 'xsmall' | 'small' | 'normal'): string;
74
+ export function offset(size: OffsetType): string;
75
+ export function fontSize(size?: TextSize): string;
76
+ export function zindex(name?: ZIndexType): string;
77
+ export function lineHeight(size?: TextSize): string;
78
+ export function borderRadius(size?: BorderRadiusType): string;
50
79
  export function color(name: string, variantRaw?: string | number, alpha?: number): string;
51
80
  export namespace cls {
52
81
  const fullWidth = "util-full-width";
@@ -64,11 +93,15 @@ export declare namespace ui {
64
93
  export const vh: (x: number | string) => string;
65
94
  export const vw: (x: number | string) => string;
66
95
  export const url: (u: unknown) => string;
67
- export const getOffsetAttrs: (name: string, value: ResponsiveOffsetType) => Record<string, string>;
68
- 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;
69
102
  type CallbackType<T> = (name: string, value: ResponsiveOffsetType) => T;
70
- export function callAllMPProps<T>(props: Partial<MPProps>, callback: CallbackType<T>): {};
103
+ export function callAllMPProps<T extends object>(props: Partial<MPProps>, callback: CallbackType<T>): T;
71
104
  export const getAllMPStyles: (props: Partial<MPProps>) => React.CSSProperties;
72
- export const getAllMPAttrs: (props: Partial<MPProps>) => Record<string, string>;
105
+ export const getAllMPClassnames: (props: Partial<MPProps>) => string;
73
106
  export {};
74
107
  }
@@ -1,64 +1,73 @@
1
- var z = /* @__PURE__ */ ((t) => (t.none = "none", t.hairthin = "hairthin", t.thin = "thin", t.xxsmall = "xxsmall", t.xsmall = "xsmall", t.small = "small", t.normal = "normal", t.medium = "medium", t.large = "large", t.xlarge = "xlarge", t.safezone = "safezone", t))(z || {}), A = /* @__PURE__ */ ((t) => (t.initial = "initial", t.small = "small", t["small-medium"] = "small-medium", t.medium = "medium", t["medium-large"] = "medium-large", t.large = "large", t.xlarge = "xlarge", t))(A || {}), d;
2
- ((t) => {
3
- function i(r = 1) {
4
- return `calc(var(--quant) * ${r})`;
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;
3
+ ((r) => {
4
+ function s(e = 1) {
5
+ return `calc(var(--quant) * ${e})`;
5
6
  }
6
- t.q = i;
7
- function m(r) {
8
- return `var(--offset-${r})`;
7
+ r.q = s;
8
+ function f(e) {
9
+ return `var(--offset-${e})`;
9
10
  }
10
- t.offset = m;
11
- function u(r = "normal") {
12
- return `var(--font-size-${r})`;
11
+ r.offset = f;
12
+ function h(e = "normal") {
13
+ return `var(--font-size-${e})`;
13
14
  }
14
- t.fontSize = u;
15
- function S(r = "normal") {
16
- return `var(--border-radius-${r})`;
15
+ r.fontSize = h;
16
+ function b(e = "first") {
17
+ return `var(--zindex-${e})`;
17
18
  }
18
- t.borderRadius = S;
19
- function b(r, l, n = 1) {
20
- let e = l;
21
- return e === "pure" && (e = ""), typeof e == "number" && (e = `${e}`), `rgba(var(--color-${r}${e ? `-${e}` : ""}), ${n})`;
19
+ r.zindex = b;
20
+ function d(e = "normal") {
21
+ return `var(--line-height-${e})`;
22
22
  }
23
- t.color = b, ((r) => {
24
- r.fullWidth = "util-full-width", r.fullHeight = "util-full-height", r.flexGrow = "util-flex-grow", r.flexNoShrink = "util-flex-no-shrink", r.userSelectableText = "util-text-selectable", r.zIndex9000 = "util-z-index-9000";
25
- })(t.cls || (t.cls = {})), t.pc = (r) => `${r}%`, t.px = (r) => `${r}px`, t.ch = (r) => `${r}ch`, t.em = (r) => `${r}em`, t.rem = (r) => `${r}rem`, t.vh = (r) => `${r}vh`, t.vw = (r) => `${r}vw`, t.url = (r) => `url(${r})`, t.getOffsetAttrs = (r, l) => typeof l == "string" || typeof l == "number" ? {
26
- [`data-${r}-initial`]: l.toString()
27
- } : Object.entries(l).reduce((n, [e, o]) => (n[`data-${r}-${e}`] = o.toString(), n), {}), t.getOffsetStyles = (r, l) => typeof l == "string" ? {
28
- [`--${r}-initial`]: m(l)
29
- } : typeof l == "number" ? {
30
- [`--${r}-initial`]: i(l)
31
- } : Object.entries(l).reduce((n, [e, o]) => (n[`--${r}-${e}`] = typeof o == "number" ? i(o) : m(o), n), {});
32
- function s(r, l) {
33
- const {
34
- m: n,
35
- mt: e,
36
- mr: o,
37
- mb: f,
38
- ml: g,
39
- p: $,
40
- pt: p,
41
- pr: x,
42
- pb: a,
43
- pl: h
44
- } = r;
45
- return {
46
- ...n ? l("m", n) : null,
47
- ...e ? l("mt", e) : null,
48
- ...o ? l("mr", o) : null,
49
- ...f ? l("mb", f) : null,
50
- ...g ? l("ml", g) : null,
51
- ...$ ? l("p", $) : null,
52
- ...p ? l("pt", p) : null,
53
- ...x ? l("pr", x) : null,
54
- ...a ? l("pb", a) : null,
55
- ...h ? l("pl", h) : null
23
+ r.lineHeight = d;
24
+ function v(e = "normal") {
25
+ return `var(--border-radius-${e})`;
26
+ }
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)
56
42
  };
57
43
  }
58
- t.callAllMPProps = s, t.getAllMPStyles = (r) => s(r, t.getOffsetStyles), t.getAllMPAttrs = (r) => s(r, t.getOffsetAttrs);
59
- })(d || (d = {}));
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 = {}));
60
66
  export {
61
- A as MediaQueryEnum,
62
- z as OffsetEnum,
63
- d as ui
67
+ R as BorderRadiusEnum,
68
+ P as MediaQueryEnum,
69
+ F as OffsetEnum,
70
+ j as TextSizeEnum,
71
+ u as ZIndexEnum,
72
+ p as ui
64
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
+ };