@cfx-dev/ui-components 4.4.0 → 4.5.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/assets/css/TextShowcase.css +1 -1
- package/dist/assets/general/global.css +1 -1
- package/dist/components/Text/Text.d.ts +2 -2
- package/dist/components/Text/Text.js +69 -72
- package/dist/components/Text/Text.types.d.ts +4 -1
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/Text/index.js +8 -7
- package/dist/main.d.ts +2 -2
- package/dist/main.js +154 -153
- package/dist/styles-scss/_ui.scss +34 -32
- package/dist/styles-scss/tokens.scss +61 -11
- package/dist/utils/ui/index.d.ts +1 -1
- package/dist/utils/ui/ui.types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TextOpacity, ResponsiveTextSize, TextPropsWithRef } from './Text.types';
|
|
1
|
+
import { TextOpacity, ResponsiveTextSize, TextPropsWithRef, TextSpecificOpacity } from './Text.types';
|
|
2
2
|
|
|
3
3
|
export declare const textSizeResponsiveValueFormatter: (val: ResponsiveTextSize) => string;
|
|
4
4
|
export declare const lineHeightResponsiveValueFormatter: (val: ResponsiveTextSize) => string;
|
|
5
|
-
export declare const TEXT_OPACITY_MAP: Record<
|
|
5
|
+
export declare const TEXT_OPACITY_MAP: Record<TextSpecificOpacity, number | string>;
|
|
6
6
|
export declare const getTextOpacity: (opacity?: TextOpacity, otherwise?: string | number) => string | number;
|
|
7
7
|
export declare const DEFAULT_TEXT_COLOR = "primary";
|
|
8
8
|
export declare function Text(props: TextPropsWithRef): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,105 +1,102 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { clsx as
|
|
3
|
-
import { getColor as
|
|
4
|
-
import { ui as
|
|
5
|
-
import { TextSizeEnum as
|
|
6
|
-
const
|
|
7
|
-
root:
|
|
8
|
-
centered:
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as H } from "../../utils/clsx.js";
|
|
3
|
+
import { getColor as N } from "../../utils/color.js";
|
|
4
|
+
import { ui as t } from "../../utils/ui/ui.js";
|
|
5
|
+
import { TextSizeEnum as s } from "../../utils/ui/ui.types.js";
|
|
6
|
+
const O = "cfxui__Text__root__2fe11", P = "cfxui__Text__centered__4d7bd", $ = "cfxui__Text__underlined__5860e", w = "cfxui__Text__strikethrough__e3ee3", B = "cfxui__Text__truncated__417f4", D = "cfxui__Text__typographic__d8155", I = "cfxui__Text__block__cb1b6", r = {
|
|
7
|
+
root: O,
|
|
8
|
+
centered: P,
|
|
9
9
|
underlined: $,
|
|
10
10
|
strikethrough: w,
|
|
11
|
-
truncated:
|
|
12
|
-
typographic:
|
|
13
|
-
block:
|
|
14
|
-
},
|
|
11
|
+
truncated: B,
|
|
12
|
+
typographic: D,
|
|
13
|
+
block: I
|
|
14
|
+
}, L = (e) => e in s ? t.fontSize(e) : typeof e == "number" ? t.q(e) : e, M = (e) => e in s ? t.lineHeight(e) : typeof e == "number" ? e >= 100 ? (e / 100).toFixed(2) : t.lineHeight(s.normal) : e, V = {
|
|
15
15
|
0: 0,
|
|
16
16
|
25: "var(--text-opacity-25)",
|
|
17
17
|
50: "var(--text-opacity-50)",
|
|
18
18
|
75: "var(--text-opacity-75)",
|
|
19
19
|
100: 1
|
|
20
|
-
},
|
|
20
|
+
}, X = {
|
|
21
21
|
h1: "h1",
|
|
22
22
|
h2: "h2",
|
|
23
23
|
h3: "h3",
|
|
24
24
|
h4: "h4",
|
|
25
25
|
h5: "h5",
|
|
26
26
|
h6: "h6"
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
return typeof t == "string" || typeof t == "number" ? t : n;
|
|
30
|
-
}, X = "primary";
|
|
31
|
-
function j(e) {
|
|
27
|
+
}, j = (e, o = 1) => typeof e == "number" ? e : typeof e == "string" && V[e] || o, q = "primary";
|
|
28
|
+
function G(e) {
|
|
32
29
|
const {
|
|
33
|
-
family:
|
|
34
|
-
size:
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
family: o,
|
|
31
|
+
size: n = "normal",
|
|
32
|
+
lineHeight: l = n,
|
|
33
|
+
weight: f = "normal",
|
|
34
|
+
letterSpacing: u = "normal",
|
|
37
35
|
color: _,
|
|
38
|
-
opacity:
|
|
36
|
+
opacity: p,
|
|
39
37
|
as: i = "span",
|
|
40
|
-
centered:
|
|
41
|
-
truncated:
|
|
42
|
-
typographic:
|
|
38
|
+
centered: h = !1,
|
|
39
|
+
truncated: m = !1,
|
|
40
|
+
typographic: d = !1,
|
|
43
41
|
uppercase: g = !1,
|
|
44
|
-
userSelectable:
|
|
42
|
+
userSelectable: x = !1,
|
|
45
43
|
underlined: y = !1,
|
|
46
|
-
strikethrough:
|
|
47
|
-
children:
|
|
48
|
-
className:
|
|
49
|
-
style:
|
|
50
|
-
ref:
|
|
51
|
-
htmlFor:
|
|
52
|
-
id:
|
|
53
|
-
} = e,
|
|
44
|
+
strikethrough: T = !1,
|
|
45
|
+
children: b,
|
|
46
|
+
className: k,
|
|
47
|
+
style: S,
|
|
48
|
+
ref: C,
|
|
49
|
+
htmlFor: R,
|
|
50
|
+
id: F
|
|
51
|
+
} = e, z = i === "div", v = H(
|
|
54
52
|
r.root,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
k,
|
|
54
|
+
t.getResponsiveClassnames("font-size", n),
|
|
55
|
+
t.getResponsiveClassnames("line-height", n),
|
|
58
56
|
{
|
|
59
|
-
[r.block]:
|
|
60
|
-
[r.centered]:
|
|
61
|
-
[r.truncated]:
|
|
57
|
+
[r.block]: z,
|
|
58
|
+
[r.centered]: h,
|
|
59
|
+
[r.truncated]: m,
|
|
62
60
|
[r.underlined]: y,
|
|
63
|
-
[r.strikethrough]:
|
|
64
|
-
[r.typographic]:
|
|
65
|
-
[
|
|
61
|
+
[r.strikethrough]: T,
|
|
62
|
+
[r.typographic]: d,
|
|
63
|
+
[t.cls.userSelectableText]: x
|
|
66
64
|
}
|
|
67
|
-
),
|
|
65
|
+
), A = N({
|
|
68
66
|
...e,
|
|
69
|
-
color: _ ||
|
|
70
|
-
opacity:
|
|
71
|
-
}),
|
|
72
|
-
color:
|
|
73
|
-
fontFamily: `var(--font-family-${
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
...
|
|
78
|
-
...
|
|
79
|
-
...k
|
|
67
|
+
color: _ || q,
|
|
68
|
+
opacity: j(p)
|
|
69
|
+
}), E = typeof o == "string" ? o : X[i] || "primary", c = {
|
|
70
|
+
color: A,
|
|
71
|
+
fontFamily: `var(--font-family-${E})`,
|
|
72
|
+
letterSpacing: `var(--letter-spacing-${u})`,
|
|
73
|
+
fontWeight: `var(--font-weight-${f})`,
|
|
74
|
+
...t.getResponsiveStyles("font-size", n, L),
|
|
75
|
+
...t.getResponsiveStyles("line-height", l, M),
|
|
76
|
+
...S
|
|
80
77
|
};
|
|
81
|
-
return g && (
|
|
78
|
+
return g && (c.textTransform = "uppercase"), /* @__PURE__ */ a(
|
|
82
79
|
i,
|
|
83
80
|
{
|
|
84
|
-
ref:
|
|
81
|
+
ref: C,
|
|
85
82
|
dir: "auto",
|
|
86
|
-
className:
|
|
87
|
-
style:
|
|
88
|
-
htmlFor:
|
|
89
|
-
id:
|
|
90
|
-
children:
|
|
83
|
+
className: v,
|
|
84
|
+
style: c,
|
|
85
|
+
htmlFor: R,
|
|
86
|
+
id: F,
|
|
87
|
+
children: b
|
|
91
88
|
}
|
|
92
89
|
);
|
|
93
90
|
}
|
|
94
|
-
function
|
|
95
|
-
return /* @__PURE__ */
|
|
91
|
+
function Z(e) {
|
|
92
|
+
return /* @__PURE__ */ a(G, { ...e, as: "div" });
|
|
96
93
|
}
|
|
97
94
|
export {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
95
|
+
q as DEFAULT_TEXT_COLOR,
|
|
96
|
+
V as TEXT_OPACITY_MAP,
|
|
97
|
+
G as Text,
|
|
98
|
+
Z as TextBlock,
|
|
99
|
+
j as getTextOpacity,
|
|
100
|
+
M as lineHeightResponsiveValueFormatter,
|
|
101
|
+
L as textSizeResponsiveValueFormatter
|
|
105
102
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { GetColorProps } from '../../utils/color';
|
|
3
3
|
import { ResponsiveValueType, TextSize as RawTextSize } from '../../utils/ui';
|
|
4
|
+
import { OpacityRange } from '../../utils/ui/ui.types';
|
|
4
5
|
|
|
5
6
|
export type TextSize = RawTextSize;
|
|
6
7
|
export type ResponsiveTextSize = TextSize | string | number;
|
|
7
8
|
export type TextWeight = 'thin' | 'normal' | 'bold' | 'bolder';
|
|
8
|
-
export type
|
|
9
|
+
export type TextSpecificOpacity = '0' | '25' | '50' | '75' | '100';
|
|
10
|
+
export type TextOpacity = TextSpecificOpacity | OpacityRange;
|
|
9
11
|
export type TextAs = 'span' | 'div' | 'p' | 'label' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
10
12
|
export type TextLetterSpacing = 'normal' | 'large';
|
|
11
13
|
export type TextFamaly = 'primary' | 'secondary';
|
|
@@ -27,6 +29,7 @@ interface TextPropsBase {
|
|
|
27
29
|
size?: ResponsiveValueType<ResponsiveTextSize>;
|
|
28
30
|
weight?: TextWeight;
|
|
29
31
|
letterSpacing?: TextLetterSpacing;
|
|
32
|
+
lineHeight?: ResponsiveValueType<number>;
|
|
30
33
|
family?: TextFamaly;
|
|
31
34
|
children?: React.ReactNode;
|
|
32
35
|
className?: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Text, TextBlock, TEXT_OPACITY_MAP, DEFAULT_TEXT_COLOR, getTextOpacity, textSizeResponsiveValueFormatter, } from './Text';
|
|
1
|
+
export { Text, TextBlock, TEXT_OPACITY_MAP, DEFAULT_TEXT_COLOR, getTextOpacity, textSizeResponsiveValueFormatter, lineHeightResponsiveValueFormatter, } from './Text';
|
|
2
2
|
export { TextSizeEnum } from '../../utils/ui';
|
|
3
3
|
export type { TextSize, TextWeight, TextOpacity, TextAs, TextLetterSpacing, TextProps, TextColorProps, ResponsiveTextSize, TextFamaly, TextPropsWithRef, } from './Text.types';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { DEFAULT_TEXT_COLOR as
|
|
1
|
+
import { DEFAULT_TEXT_COLOR as T, TEXT_OPACITY_MAP as r, Text as i, TextBlock as x, getTextOpacity as m, lineHeightResponsiveValueFormatter as p, textSizeResponsiveValueFormatter as a } from "./Text.js";
|
|
2
2
|
import "../../utils/ui/ui.js";
|
|
3
|
-
import { TextSizeEnum as
|
|
3
|
+
import { TextSizeEnum as n } from "../../utils/ui/ui.types.js";
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
T as DEFAULT_TEXT_COLOR,
|
|
6
6
|
r as TEXT_OPACITY_MAP,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
i as Text,
|
|
8
|
+
x as TextBlock,
|
|
9
|
+
n as TextSizeEnum,
|
|
10
10
|
m as getTextOpacity,
|
|
11
|
-
p as
|
|
11
|
+
p as lineHeightResponsiveValueFormatter,
|
|
12
|
+
a as textSizeResponsiveValueFormatter
|
|
12
13
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type { SetTimeoutReturn } from './utils/execution';
|
|
|
16
16
|
export { getColor } from './utils/color';
|
|
17
17
|
export type { GetColorProps } from './utils/color';
|
|
18
18
|
export { ui, OffsetEnum, MediaQueryEnum, BorderRadiusEnum, ZIndexEnum, ColorEnum, } from './utils/ui';
|
|
19
|
-
export type { OffsetType, MediaQueryType, ResponsiveOffsetType, ResponsiveValueType, MPProps, BorderRadiusType, ZIndexType, ColorType, } from './utils/ui';
|
|
19
|
+
export type { OffsetType, MediaQueryType, ResponsiveOffsetType, ResponsiveValueType, MPProps, BorderRadiusType, ZIndexType, ColorType, OpacityRange, } from './utils/ui';
|
|
20
20
|
export { isInEnum } from './utils/enum';
|
|
21
21
|
export { joaat32 } from './utils/joaat32';
|
|
22
22
|
export { IconButton } from './components/IconButton';
|
|
@@ -125,7 +125,7 @@ export { Table, TableIconButton, } from './components/Table';
|
|
|
125
125
|
export type { TableRootProps, TableBodyProps, TableHeaderProps, TableCellProps, TableRowProps, } from './components/Table';
|
|
126
126
|
export { TableResponsiveText } from './components/TableResponsiveText';
|
|
127
127
|
export type { TableResponsiveTextProps } from './components/TableResponsiveText';
|
|
128
|
-
export { TextSizeEnum, Text, TextBlock, getTextOpacity, DEFAULT_TEXT_COLOR, TEXT_OPACITY_MAP, textSizeResponsiveValueFormatter, } from './components/Text';
|
|
128
|
+
export { TextSizeEnum, Text, TextBlock, getTextOpacity, DEFAULT_TEXT_COLOR, TEXT_OPACITY_MAP, textSizeResponsiveValueFormatter, lineHeightResponsiveValueFormatter, } from './components/Text';
|
|
129
129
|
export type { TextSize, TextWeight, TextOpacity, TextAs, TextLetterSpacing, TextProps, TextColorProps, TextFamaly, TextPropsWithRef, } from './components/Text';
|
|
130
130
|
export { Label } from './components/Label';
|
|
131
131
|
export type { LabelProps } from './components/Label';
|