@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.
@@ -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<TextOpacity, number | string>;
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 c } from "react/jsx-runtime";
2
- import { clsx as E } from "../../utils/clsx.js";
3
- import { getColor as O } from "../../utils/color.js";
4
- import { ui as o } from "../../utils/ui/ui.js";
5
- import { TextSizeEnum as a } from "../../utils/ui/ui.types.js";
6
- const H = "cfxui__Text__root__2fe11", N = "cfxui__Text__centered__4d7bd", $ = "cfxui__Text__underlined__5860e", w = "cfxui__Text__strikethrough__e3ee3", P = "cfxui__Text__truncated__417f4", q = "cfxui__Text__typographic__d8155", B = "cfxui__Text__block__cb1b6", r = {
7
- root: H,
8
- centered: N,
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: P,
12
- typographic: q,
13
- block: B
14
- }, D = (e) => e in a ? o.fontSize(e) : typeof e == "number" ? o.q(e) : e, I = (e) => e in a ? o.lineHeight(e) : typeof e == "number" ? o.q(e) : e, L = {
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
- }, M = {
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
- }, V = (e, n = 1) => {
28
- const t = typeof e == "string" && L[e];
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: n,
34
- size: t = "normal",
35
- weight: l = "normal",
36
- letterSpacing: f = "normal",
30
+ family: o,
31
+ size: n = "normal",
32
+ lineHeight: l = n,
33
+ weight: f = "normal",
34
+ letterSpacing: u = "normal",
37
35
  color: _,
38
- opacity: u,
36
+ opacity: p,
39
37
  as: i = "span",
40
- centered: p = !1,
41
- truncated: h = !1,
42
- typographic: m = !1,
38
+ centered: h = !1,
39
+ truncated: m = !1,
40
+ typographic: d = !1,
43
41
  uppercase: g = !1,
44
- userSelectable: d = !1,
42
+ userSelectable: x = !1,
45
43
  underlined: y = !1,
46
- strikethrough: x = !1,
47
- children: T,
48
- className: b,
49
- style: k,
50
- ref: S,
51
- htmlFor: C,
52
- id: R
53
- } = e, v = i === "div", z = 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
- b,
56
- o.getResponsiveClassnames("font-size", t),
57
- o.getResponsiveClassnames("line-height", t),
53
+ k,
54
+ t.getResponsiveClassnames("font-size", n),
55
+ t.getResponsiveClassnames("line-height", n),
58
56
  {
59
- [r.block]: v,
60
- [r.centered]: p,
61
- [r.truncated]: h,
57
+ [r.block]: z,
58
+ [r.centered]: h,
59
+ [r.truncated]: m,
62
60
  [r.underlined]: y,
63
- [r.strikethrough]: x,
64
- [r.typographic]: m,
65
- [o.cls.userSelectableText]: d
61
+ [r.strikethrough]: T,
62
+ [r.typographic]: d,
63
+ [t.cls.userSelectableText]: x
66
64
  }
67
- ), F = O({
65
+ ), A = N({
68
66
  ...e,
69
- color: _ || X,
70
- opacity: V(u)
71
- }), A = typeof n == "string" ? n : M[i] || "primary", s = {
72
- color: F,
73
- fontFamily: `var(--font-family-${A})`,
74
- lineHeight: `var(--line-height-${t})`,
75
- letterSpacing: `var(--letter-spacing-${f})`,
76
- fontWeight: `var(--font-weight-${l})`,
77
- ...o.getResponsiveStyles("font-size", t, D),
78
- ...o.getResponsiveStyles("line-height", t, I),
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 && (s.textTransform = "uppercase"), /* @__PURE__ */ c(
78
+ return g && (c.textTransform = "uppercase"), /* @__PURE__ */ a(
82
79
  i,
83
80
  {
84
- ref: S,
81
+ ref: C,
85
82
  dir: "auto",
86
- className: z,
87
- style: s,
88
- htmlFor: C,
89
- id: R,
90
- children: T
83
+ className: v,
84
+ style: c,
85
+ htmlFor: R,
86
+ id: F,
87
+ children: b
91
88
  }
92
89
  );
93
90
  }
94
- function Q(e) {
95
- return /* @__PURE__ */ c(j, { ...e, as: "div" });
91
+ function Z(e) {
92
+ return /* @__PURE__ */ a(G, { ...e, as: "div" });
96
93
  }
97
94
  export {
98
- X as DEFAULT_TEXT_COLOR,
99
- L as TEXT_OPACITY_MAP,
100
- j as Text,
101
- Q as TextBlock,
102
- V as getTextOpacity,
103
- I as lineHeightResponsiveValueFormatter,
104
- D as textSizeResponsiveValueFormatter
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 TextOpacity = '0' | '25' | '50' | '75' | '100';
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 o, TEXT_OPACITY_MAP as r, Text as x, TextBlock as i, getTextOpacity as m, textSizeResponsiveValueFormatter as p } from "./Text.js";
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 O } from "../../utils/ui/ui.types.js";
3
+ import { TextSizeEnum as n } from "../../utils/ui/ui.types.js";
4
4
  export {
5
- o as DEFAULT_TEXT_COLOR,
5
+ T as DEFAULT_TEXT_COLOR,
6
6
  r as TEXT_OPACITY_MAP,
7
- x as Text,
8
- i as TextBlock,
9
- O as TextSizeEnum,
7
+ i as Text,
8
+ x as TextBlock,
9
+ n as TextSizeEnum,
10
10
  m as getTextOpacity,
11
- p as textSizeResponsiveValueFormatter
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';