@cfx-dev/ui-components 5.0.3 → 5.0.5

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,4 +1,10 @@
1
1
  import { default as React } from 'react';
2
+ import { ResponsiveTextSize, TextColorProps } from '../Text';
3
+ import { ResponsiveValueType } from '../../utils/ui';
2
4
 
3
- export type ProseProps = React.PropsWithChildren;
4
- export declare function Prose({ children, }: ProseProps): import("react/jsx-runtime").JSX.Element;
5
+ export type ProseProps = React.PropsWithChildren & TextColorProps & {
6
+ size?: ResponsiveValueType<ResponsiveTextSize>;
7
+ className?: string;
8
+ lineHeight?: ResponsiveValueType<number>;
9
+ };
10
+ export declare function Prose(props: ProseProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,35 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- const t = "cfxui__Prose__root__e03c1", s = {
3
- root: t
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { getTextOpacity as g, DEFAULT_TEXT_COLOR as f, lineHeightResponsiveValueFormatter as _, textSizeResponsiveValueFormatter as h } from "../Text/Text.js";
3
+ import { ui as e } from "../../utils/ui/ui.js";
4
+ import { clsx as v } from "../../utils/clsx.js";
5
+ import { getColor as R } from "../../utils/color.js";
6
+ const u = "cfxui__Prose__root__e03c1", x = {
7
+ root: u
4
8
  };
5
- function e({
6
- children: o
7
- }) {
8
- return /* @__PURE__ */ r("div", { className: s.root, children: o });
9
+ function d(t) {
10
+ const {
11
+ size: o = "normal",
12
+ lineHeight: s = o,
13
+ color: i,
14
+ opacity: r,
15
+ className: n,
16
+ children: l
17
+ } = t, c = R({
18
+ ...t,
19
+ color: i || f,
20
+ opacity: g(r)
21
+ }), a = v(
22
+ x.root,
23
+ n,
24
+ e.getResponsiveClassnames("font-size", o),
25
+ e.getResponsiveClassnames("line-height", o)
26
+ ), m = {
27
+ color: c,
28
+ ...e.getResponsiveStyles("font-size", o, h),
29
+ ...e.getResponsiveStyles("line-height", s, _)
30
+ };
31
+ return /* @__PURE__ */ p("div", { className: a, style: m, children: l });
9
32
  }
10
33
  export {
11
- e as Prose
34
+ d as Prose
12
35
  };
@@ -1,107 +1,110 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import { clsx as v } from "../../utils/clsx.js";
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { clsx as H } from "../../utils/clsx.js";
3
3
  import { getColor as N } from "../../utils/color.js";
4
4
  import { ui as t } from "../../utils/ui/ui.js";
5
- import { TextSizeEnum as i } from "../../utils/ui/ui.types.js";
6
- const O = "cfxui__Text__root__2fe11", P = "cfxui__Text__centered__4d7bd", V = "cfxui__Text__underlined__5860e", $ = "cfxui__Text__strikethrough__e3ee3", q = "cfxui__Text__truncated__417f4", w = "cfxui__Text__typographic__d8155", B = "cfxui__Text__block__cb1b6", r = {
5
+ import { TextSizeEnum as o } from "../../utils/ui/ui.types.js";
6
+ const O = "cfxui__Text__root__2fe11", P = "cfxui__Text__verticalTrimDisabled__34631", V = "cfxui__Text__centered__4d7bd", $ = "cfxui__Text__underlined__5860e", q = "cfxui__Text__strikethrough__e3ee3", w = "cfxui__Text__truncated__417f4", B = "cfxui__Text__typographic__d8155", I = "cfxui__Text__block__cb1b6", r = {
7
7
  root: O,
8
- centered: P,
9
- underlined: V,
10
- strikethrough: $,
11
- truncated: q,
12
- typographic: w,
13
- block: B
14
- }, D = (e) => e in i ? t.fontSize(e) : typeof e == "number" ? t.q(e) : e, I = (e) => e in i ? t.lineHeight(e) : typeof e == "number" ? e >= 100 ? (e / 100).toFixed(2) : t.lineHeight(i.small) : e, L = (e) => e in i ? t.paragraphSpacing(e) : typeof e == "number" ? t.q(e) : e, M = {
8
+ verticalTrimDisabled: P,
9
+ centered: V,
10
+ underlined: $,
11
+ strikethrough: q,
12
+ truncated: w,
13
+ typographic: B,
14
+ block: I
15
+ }, L = (e) => e in o ? t.fontSize(e) : typeof e == "number" ? t.q(e) : e, M = (e) => e in o ? t.lineHeight(e) : typeof e == "number" ? e >= 100 ? (e / 100).toFixed(2) : t.lineHeight(o.small) : e, X = (e) => e in o ? t.paragraphSpacing(e) : typeof e == "number" ? t.q(e) : e, j = {
15
16
  0: 0,
16
17
  25: "var(--text-opacity-25)",
17
18
  50: "var(--text-opacity-50)",
18
19
  75: "var(--text-opacity-75)",
19
20
  100: 1
20
- }, X = {
21
+ }, G = {
21
22
  h1: "h1",
22
23
  h2: "h2",
23
24
  h3: "h3",
24
25
  h4: "h4",
25
26
  h5: "h5",
26
27
  h6: "h6"
27
- }, j = (e, n = 1) => typeof e == "number" ? e : typeof e == "string" && M[e] || n, G = "primary";
28
- function U(e) {
28
+ }, U = (e, i = 1) => typeof e == "number" ? e : typeof e == "string" && j[e] || i, W = "primary";
29
+ function Y(e) {
29
30
  const {
30
- family: n,
31
- size: o = "small",
32
- lineHeight: c = o,
33
- weight: l = "regular",
31
+ family: i,
32
+ size: n = "small",
33
+ lineHeight: a = n,
34
+ weight: p = "regular",
34
35
  letterSpacing: u = "small",
35
36
  color: f,
36
37
  opacity: _,
37
38
  as: s = "span",
38
- centered: h = !1,
39
- truncated: g = !1,
40
- typographic: m = !1,
39
+ centered: m = !1,
40
+ truncated: h = !1,
41
+ typographic: g = !1,
41
42
  uppercase: d = !1,
42
43
  userSelectable: x = !1,
43
44
  underlined: y = !1,
44
45
  strikethrough: T = !1,
45
- children: b,
46
- className: S,
47
- style: k,
48
- ref: R,
46
+ verticalTrimDisabled: b = !1,
47
+ children: S,
48
+ className: k,
49
+ style: R,
50
+ ref: v,
49
51
  htmlFor: C,
50
52
  id: F
51
- } = e, z = s === "div", A = v(
53
+ } = e, D = s === "div", z = H(
52
54
  r.root,
53
- S,
55
+ k,
54
56
  // TODO: do we need reposive in text now?
55
57
  // all sizes is responsive by default
56
- t.getResponsiveClassnames("font-size", o),
57
- t.getResponsiveClassnames("line-height", o),
58
- t.getResponsiveClassnames("paragraph-spacing", o),
58
+ t.getResponsiveClassnames("font-size", n),
59
+ t.getResponsiveClassnames("line-height", n),
60
+ t.getResponsiveClassnames("paragraph-spacing", n),
59
61
  {
60
- [r.block]: z,
61
- [r.centered]: h,
62
- [r.truncated]: g,
62
+ [r.block]: D,
63
+ [r.centered]: m,
64
+ [r.truncated]: h,
63
65
  [r.underlined]: y,
64
66
  [r.strikethrough]: T,
65
- [r.typographic]: m,
67
+ [r.typographic]: g,
68
+ [r.verticalTrimDisabled]: b,
66
69
  [t.cls.userSelectableText]: x
67
70
  }
68
- ), E = N({
71
+ ), A = N({
69
72
  ...e,
70
- color: f || G,
71
- opacity: j(_)
72
- }), H = typeof n == "string" ? n : X[s] || "primary", a = {
73
- color: E,
74
- fontFamily: `var(--font-family-${H})`,
73
+ color: f || W,
74
+ opacity: U(_)
75
+ }), E = typeof i == "string" ? i : G[s] || "primary", c = {
76
+ color: A,
77
+ fontFamily: `var(--font-family-${E})`,
75
78
  letterSpacing: `var(--letter-spacing-${u})`,
76
- fontWeight: `var(--font-weight-${l})`,
77
- ...t.getResponsiveStyles("font-size", o, D),
78
- ...t.getResponsiveStyles("line-height", c, I),
79
- ...t.getResponsiveStyles("paragraph-spacing", c, L),
80
- ...k
79
+ fontWeight: `var(--font-weight-${p})`,
80
+ ...t.getResponsiveStyles("font-size", n, L),
81
+ ...t.getResponsiveStyles("line-height", a, M),
82
+ ...t.getResponsiveStyles("paragraph-spacing", a, X),
83
+ ...R
81
84
  };
82
- return d && (a.textTransform = "uppercase"), /* @__PURE__ */ p(
85
+ return d && (c.textTransform = "uppercase"), /* @__PURE__ */ l(
83
86
  s,
84
87
  {
85
- ref: R,
88
+ ref: v,
86
89
  dir: "auto",
87
- className: A,
88
- style: a,
90
+ className: z,
91
+ style: c,
89
92
  htmlFor: C,
90
93
  id: F,
91
- children: b
94
+ children: S
92
95
  }
93
96
  );
94
97
  }
95
- function ee(e) {
96
- return /* @__PURE__ */ p(U, { ...e, as: "div" });
98
+ function re(e) {
99
+ return /* @__PURE__ */ l(Y, { ...e, as: "div" });
97
100
  }
98
101
  export {
99
- G as DEFAULT_TEXT_COLOR,
100
- M as TEXT_OPACITY_MAP,
101
- U as Text,
102
- ee as TextBlock,
103
- j as getTextOpacity,
104
- I as lineHeightResponsiveValueFormatter,
105
- L as paragraphSpacingResponsiveValueFormatter,
106
- D as textSizeResponsiveValueFormatter
102
+ W as DEFAULT_TEXT_COLOR,
103
+ j as TEXT_OPACITY_MAP,
104
+ Y as Text,
105
+ re as TextBlock,
106
+ U as getTextOpacity,
107
+ M as lineHeightResponsiveValueFormatter,
108
+ X as paragraphSpacingResponsiveValueFormatter,
109
+ L as textSizeResponsiveValueFormatter
107
110
  };
@@ -20,6 +20,10 @@ interface TextPropsBase {
20
20
  * If it'll be a multiline text, use this to add extra spacing between lines
21
21
  */
22
22
  typographic?: boolean;
23
+ /**
24
+ * Will remove vertical trim feature based on before and after pseudo elements with negative margins
25
+ */
26
+ verticalTrimDisabled?: boolean;
23
27
  /**
24
28
  * Allow users to select text
25
29
  */
@@ -23,6 +23,8 @@
23
23
  @each $name, $value in ui.$mediaMap {
24
24
  @include ui.media-min($name) {
25
25
  .ui-#{$propName}-#{$name} {
26
+ @include ui.def('#{$propName}-current', var(--#{$propName}-#{$name}));
27
+
26
28
  #{$propName}: var(--#{$propName}-#{$name});
27
29
  }
28
30
  }
@@ -17,6 +17,7 @@ export declare enum ColorEnum {
17
17
  }
18
18
  export type ColorType = keyof typeof ColorEnum;
19
19
  export declare enum TextSizeEnum {
20
+ xxxsmall = "xxxsmall",
20
21
  xxsmall = "xxsmall",
21
22
  xsmall = "xsmall",
22
23
  small = "small",
@@ -1,4 +1,4 @@
1
- var a = /* @__PURE__ */ ((l) => (l.accent = "accent", l.primary = "primary", l.secondary = "secondary", l.tertiary = "tertiary", l.green = "green", l.yellow = "yellow", l.red = "red", l.argentum = "argentum", l.aurum = "aurum", l.platinum = "platinum", l.bg = "bg", l["bg-light"] = "bg-light", l["bg-dark"] = "bg-dark", l["bg-dark-grey"] = "bg-dark-grey", l["bg-black"] = "bg-black", l))(a || {}), x = /* @__PURE__ */ ((l) => (l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.xxlarge = "xxlarge", l.xxxlarge = "xxxlarge", l.xxxxlarge = "xxxxlarge", l))(x || {}), r = /* @__PURE__ */ ((l) => (l.xsmall = "xsmall", l.small = "small", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l))(r || {}), s = /* @__PURE__ */ ((l) => (l.none = "none", l.xsmall = "xsmall", l.small = "small", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.pill = "pill", l))(s || {}), e = /* @__PURE__ */ ((l) => (l.zero = "zero", l.first = "first", l.second = "second", l.max = "max", l))(e || {}), g = /* @__PURE__ */ ((l) => (l.none = "none", l.hairthin = "hairthin", l.thin = "thin", l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.normal = "normal", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.safezone = "safezone", l))(g || {}), p = /* @__PURE__ */ ((l) => (l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.xxlarge = "xxlarge", l.xxxlarge = "xxxlarge", l.xxxxlarge = "xxxxlarge", l.xxxxxlarge = "xxxxxlarge", l))(p || {}), t = /* @__PURE__ */ ((l) => (l.sp25 = "sp25", l.sp100 = "sp100", l.sp110 = "sp110", l.sp150 = "sp150", l.sp175 = "sp175", l.sp200 = "sp200", l.sp250 = "sp250", l.sp300 = "sp300", l.sp400 = "sp400", l.sp450 = "sp450", l.sp600 = "sp600", l.sp700 = "sp700", l.sp800 = "sp800", l.sp900 = "sp900", l.sp1000 = "sp1000", l.sp1200 = "sp1200", l.sp1600 = "sp1600", l.sp2400 = "sp2400", l))(t || {}), b = /* @__PURE__ */ ((l) => (l.initial = "initial", l.small = "small", l["small-medium"] = "small-medium", l.medium = "medium", l["medium-large"] = "medium-large", l.large = "large", l.xlarge = "xlarge", l))(b || {});
1
+ var a = /* @__PURE__ */ ((l) => (l.accent = "accent", l.primary = "primary", l.secondary = "secondary", l.tertiary = "tertiary", l.green = "green", l.yellow = "yellow", l.red = "red", l.argentum = "argentum", l.aurum = "aurum", l.platinum = "platinum", l.bg = "bg", l["bg-light"] = "bg-light", l["bg-dark"] = "bg-dark", l["bg-dark-grey"] = "bg-dark-grey", l["bg-black"] = "bg-black", l))(a || {}), x = /* @__PURE__ */ ((l) => (l.xxxsmall = "xxxsmall", l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.xxlarge = "xxlarge", l.xxxlarge = "xxxlarge", l.xxxxlarge = "xxxxlarge", l))(x || {}), s = /* @__PURE__ */ ((l) => (l.xsmall = "xsmall", l.small = "small", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l))(s || {}), r = /* @__PURE__ */ ((l) => (l.none = "none", l.xsmall = "xsmall", l.small = "small", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.pill = "pill", l))(r || {}), g = /* @__PURE__ */ ((l) => (l.zero = "zero", l.first = "first", l.second = "second", l.max = "max", l))(g || {}), e = /* @__PURE__ */ ((l) => (l.none = "none", l.hairthin = "hairthin", l.thin = "thin", l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.normal = "normal", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.safezone = "safezone", l))(e || {}), p = /* @__PURE__ */ ((l) => (l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.xxlarge = "xxlarge", l.xxxlarge = "xxxlarge", l.xxxxlarge = "xxxxlarge", l.xxxxxlarge = "xxxxxlarge", l))(p || {}), t = /* @__PURE__ */ ((l) => (l.sp25 = "sp25", l.sp100 = "sp100", l.sp110 = "sp110", l.sp150 = "sp150", l.sp175 = "sp175", l.sp200 = "sp200", l.sp250 = "sp250", l.sp300 = "sp300", l.sp400 = "sp400", l.sp450 = "sp450", l.sp600 = "sp600", l.sp700 = "sp700", l.sp800 = "sp800", l.sp900 = "sp900", l.sp1000 = "sp1000", l.sp1200 = "sp1200", l.sp1600 = "sp1600", l.sp2400 = "sp2400", l))(t || {}), b = /* @__PURE__ */ ((l) => (l.initial = "initial", l.small = "small", l["small-medium"] = "small-medium", l.medium = "medium", l["medium-large"] = "medium-large", l.large = "large", l.xlarge = "xlarge", l))(b || {});
2
2
  const d = {
3
3
  initial: 0,
4
4
  small: 360,
@@ -9,14 +9,14 @@ const d = {
9
9
  xlarge: 2560
10
10
  };
11
11
  export {
12
- s as BorderRadiusEnum,
12
+ r as BorderRadiusEnum,
13
13
  a as ColorEnum,
14
- r as IconSizeEnum,
14
+ s as IconSizeEnum,
15
15
  b as MediaQueryEnum,
16
16
  d as MediaQueryValuesMap,
17
- g as OffsetEnum,
17
+ e as OffsetEnum,
18
18
  p as SpacerEnum,
19
19
  t as SpacingEnum,
20
20
  x as TextSizeEnum,
21
- e as ZIndexEnum
21
+ g as ZIndexEnum
22
22
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cfx-dev/ui-components",
3
3
  "private": false,
4
- "version": "5.0.3",
4
+ "version": "5.0.5",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "dist/main.js",