@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.
- 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/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 +783 -755
- 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/TabularShowcase.js +3 -2
- 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/ui.d.ts +45 -12
- package/dist/components/ui.js +64 -55
- 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 -25
- 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 +28 -15
- 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
|
@@ -1,73 +1,82 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
2
|
import l from "react";
|
|
3
|
-
import { ui as
|
|
4
|
-
import { clsx as
|
|
5
|
-
import { getColor as
|
|
6
|
-
const
|
|
7
|
-
root:
|
|
8
|
-
centered:
|
|
9
|
-
underlined:
|
|
10
|
-
truncated:
|
|
11
|
-
typographic:
|
|
12
|
-
block:
|
|
13
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
27
|
-
const
|
|
28
|
-
return typeof
|
|
29
|
-
}, D = "primary",
|
|
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:
|
|
32
|
-
size:
|
|
33
|
-
weight:
|
|
34
|
-
letterSpacing:
|
|
31
|
+
family: s,
|
|
32
|
+
size: i = "normal",
|
|
33
|
+
weight: p = "normal",
|
|
34
|
+
letterSpacing: u = "normal",
|
|
35
35
|
as: c = "span",
|
|
36
|
-
centered:
|
|
36
|
+
centered: m = !1,
|
|
37
37
|
truncated: d = !1,
|
|
38
|
-
typographic:
|
|
39
|
-
uppercase:
|
|
40
|
-
userSelectable:
|
|
41
|
-
underlined:
|
|
42
|
-
children:
|
|
43
|
-
className:
|
|
44
|
-
} =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
|
64
|
-
}),
|
|
65
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
|
4
|
-
|
|
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?:
|
|
24
|
+
size?: ResponsiveValueType<ResponsiveTextSize>;
|
|
34
25
|
weight?: TextWeight;
|
|
35
26
|
letterSpacing?: TextLetterSpacing;
|
|
36
27
|
family?: 'primary' | 'secondary';
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
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
|
|
20
|
+
const f = i.memo(m);
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
f as default
|
|
22
23
|
};
|
package/dist/components/ui.d.ts
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
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;
|
|
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
|
|
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
|
|
28
|
-
[key in MediaQueryType]?:
|
|
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:
|
|
48
|
-
export function fontSize(size?:
|
|
49
|
-
export function
|
|
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
|
|
68
|
-
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;
|
|
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
|
|
105
|
+
export const getAllMPClassnames: (props: Partial<MPProps>) => string;
|
|
73
106
|
export {};
|
|
74
107
|
}
|
package/dist/components/ui.js
CHANGED
|
@@ -1,64 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
((
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
function
|
|
8
|
-
return `var(--offset-${
|
|
7
|
+
r.q = s;
|
|
8
|
+
function f(e) {
|
|
9
|
+
return `var(--offset-${e})`;
|
|
9
10
|
}
|
|
10
|
-
|
|
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
|
-
|
|
15
|
-
function
|
|
16
|
-
return `var(--
|
|
15
|
+
r.fontSize = h;
|
|
16
|
+
function b(e = "first") {
|
|
17
|
+
return `var(--zindex-${e})`;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
59
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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,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
|
+
};
|