@ovotech/element-native 2.2.0-canary-252a50d-89 → 2.2.0-canary-668a0ee-91

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.
@@ -53,9 +53,14 @@ exports.Heading4 = exports.Heading3 = exports.Heading2 = exports.Heading1 = void
53
53
  var jsx_runtime_1 = require("react/jsx-runtime");
54
54
  var hooks_1 = require("../../hooks");
55
55
  var styled_native_1 = __importStar(require("../../styled.native"));
56
+ var utils_1 = require("../../utils");
57
+ var calculateLetterSpacing = function (fontSize, letterSpacing) {
58
+ return (0, utils_1.numToPx)((0, utils_1.pxToNumber)(fontSize) * letterSpacing);
59
+ };
56
60
  var StyledHeading1 = styled_native_1.default.Text(function (_a) {
57
61
  var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
58
- return (0, styled_native_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, core.fontSize.heading1[smallAndUp ? 'large' : 'small'], core.lineHeight.heading1[smallAndUp ? 'large' : 'small'], semantic.message.branded);
62
+ var fontSize = core.fontSize.heading1[smallAndUp ? 'large' : 'small'];
63
+ return (0, styled_native_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, fontSize, core.lineHeight.heading1[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.extraCompressed), semantic.message.branded);
59
64
  });
60
65
  var Heading1 = function (_a) {
61
66
  var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
@@ -65,7 +70,8 @@ var Heading1 = function (_a) {
65
70
  exports.Heading1 = Heading1;
66
71
  var StyledHeading2 = styled_native_1.default.Text(function (_a) {
67
72
  var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
68
- return (0, styled_native_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, core.fontSize.heading2[smallAndUp ? 'large' : 'small'], core.lineHeight.heading2[smallAndUp ? 'large' : 'small'], semantic.message.branded);
73
+ var fontSize = core.fontSize.heading2[smallAndUp ? 'large' : 'small'];
74
+ return (0, styled_native_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, fontSize, core.lineHeight.heading2[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.extraCompressed), semantic.message.branded);
69
75
  });
70
76
  var Heading2 = function (_a) {
71
77
  var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
@@ -75,7 +81,8 @@ var Heading2 = function (_a) {
75
81
  exports.Heading2 = Heading2;
76
82
  var StyledHeading3 = styled_native_1.default.Text(function (_a) {
77
83
  var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
78
- return (0, styled_native_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, core.fontSize.heading3[smallAndUp ? 'large' : 'small'], core.lineHeight.heading3[smallAndUp ? 'large' : 'small'], semantic.message.branded);
84
+ var fontSize = core.fontSize.heading3[smallAndUp ? 'large' : 'small'];
85
+ return (0, styled_native_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.bodyBold.native, fontSize, core.lineHeight.heading3[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.compressed), semantic.message.branded);
79
86
  });
80
87
  var Heading3 = function (_a) {
81
88
  var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
@@ -85,7 +92,8 @@ var Heading3 = function (_a) {
85
92
  exports.Heading3 = Heading3;
86
93
  var StyledHeading4 = styled_native_1.default.Text(function (_a) {
87
94
  var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
88
- return (0, styled_native_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, core.fontSize.heading4[smallAndUp ? 'large' : 'small'], core.lineHeight.heading4[smallAndUp ? 'large' : 'small'], semantic.message.branded);
95
+ var fontSize = core.fontSize.heading4[smallAndUp ? 'large' : 'small'];
96
+ return (0, styled_native_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.bodyBold.native, fontSize, core.lineHeight.heading4[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.compressed), semantic.message.branded);
89
97
  });
90
98
  var Heading4 = function (_a) {
91
99
  var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
@@ -27,9 +27,14 @@ var __rest = (this && this.__rest) || function (s, e) {
27
27
  import { jsx as _jsx } from "react/jsx-runtime";
28
28
  import { useBreakpoint } from '../../hooks';
29
29
  import styled, { css } from '../../styled.native';
30
+ import { pxToNumber, numToPx } from '../../utils';
31
+ var calculateLetterSpacing = function (fontSize, letterSpacing) {
32
+ return numToPx(pxToNumber(fontSize) * letterSpacing);
33
+ };
30
34
  var StyledHeading1 = styled.Text(function (_a) {
31
35
  var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
32
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, core.fontSize.heading1[smallAndUp ? 'large' : 'small'], core.lineHeight.heading1[smallAndUp ? 'large' : 'small'], semantic.message.branded);
36
+ var fontSize = core.fontSize.heading1[smallAndUp ? 'large' : 'small'];
37
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, fontSize, core.lineHeight.heading1[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.extraCompressed), semantic.message.branded);
33
38
  });
34
39
  export var Heading1 = function (_a) {
35
40
  var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
@@ -38,7 +43,8 @@ export var Heading1 = function (_a) {
38
43
  };
39
44
  var StyledHeading2 = styled.Text(function (_a) {
40
45
  var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
41
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, core.fontSize.heading2[smallAndUp ? 'large' : 'small'], core.lineHeight.heading2[smallAndUp ? 'large' : 'small'], semantic.message.branded);
46
+ var fontSize = core.fontSize.heading2[smallAndUp ? 'large' : 'small'];
47
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, fontSize, core.lineHeight.heading2[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.extraCompressed), semantic.message.branded);
42
48
  });
43
49
  export var Heading2 = function (_a) {
44
50
  var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
@@ -47,7 +53,8 @@ export var Heading2 = function (_a) {
47
53
  };
48
54
  var StyledHeading3 = styled.Text(function (_a) {
49
55
  var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
50
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, core.fontSize.heading3[smallAndUp ? 'large' : 'small'], core.lineHeight.heading3[smallAndUp ? 'large' : 'small'], semantic.message.branded);
56
+ var fontSize = core.fontSize.heading3[smallAndUp ? 'large' : 'small'];
57
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.bodyBold.native, fontSize, core.lineHeight.heading3[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.compressed), semantic.message.branded);
51
58
  });
52
59
  export var Heading3 = function (_a) {
53
60
  var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
@@ -56,7 +63,8 @@ export var Heading3 = function (_a) {
56
63
  };
57
64
  var StyledHeading4 = styled.Text(function (_a) {
58
65
  var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
59
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, core.fontSize.heading4[smallAndUp ? 'large' : 'small'], core.lineHeight.heading4[smallAndUp ? 'large' : 'small'], semantic.message.branded);
66
+ var fontSize = core.fontSize.heading4[smallAndUp ? 'large' : 'small'];
67
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.bodyBold.native, fontSize, core.lineHeight.heading4[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.compressed), semantic.message.branded);
60
68
  });
61
69
  export var Heading4 = function (_a) {
62
70
  var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
@@ -41,6 +41,9 @@ function getText(children) {
41
41
  function pxToNumber(px) {
42
42
  return parseFloat(px);
43
43
  }
44
+ function numToPx(num) {
45
+ return "".concat(num, "px");
46
+ }
44
47
  function styledComponentWithBreakpoints(Component) {
45
48
  return forwardRef(function (props, ref) {
46
49
  var breakpoints = useBreakpoint();
@@ -91,4 +94,4 @@ function callAll() {
91
94
  function filterChildrenByType(children, type) {
92
95
  return Children.toArray(children).filter(function (child) { return (child === null || child === void 0 ? void 0 : child.type) === type; });
93
96
  }
94
- export { styledComponentWithBreakpoints, responsiveStyle, pxToNumber, mergeRefs, getText, getErrorMessage, callAll, filterChildrenByType, };
97
+ export { styledComponentWithBreakpoints, responsiveStyle, pxToNumber, numToPx, mergeRefs, getText, getErrorMessage, callAll, filterChildrenByType, };
@@ -4,6 +4,7 @@ import { BreakpointNames, Breakpoints } from '../hooks';
4
4
  declare function mergeRefs<T>(ref1: undefined | Ref<T>, ref2: undefined | Ref<T>): (element: T) => void;
5
5
  declare function getText(children: ReactNode): string;
6
6
  declare function pxToNumber(px: string): number;
7
+ declare function numToPx(num: number): string;
7
8
  declare function styledComponentWithBreakpoints<T = ViewProps, C = View>(Component: ComponentType<T>): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<Omit<T, BreakpointNames>> & import("react").RefAttributes<C>>;
8
9
  declare function responsiveStyle(property: string, value: any, breakpoints: Breakpoints, formatter?: (v: any) => string): any;
9
10
  declare function getErrorMessage(id: string, errors: Array<{
@@ -12,4 +13,4 @@ declare function getErrorMessage(id: string, errors: Array<{
12
13
  }>): null | ReactNode;
13
14
  declare function callAll(...fns: Array<Function | undefined>): (...args: any[]) => void;
14
15
  declare function filterChildrenByType(children: ReactNode, type: ComponentType): ReactElement<any, string | import("react").JSXElementConstructor<any>>[];
15
- export { styledComponentWithBreakpoints, responsiveStyle, pxToNumber, mergeRefs, getText, getErrorMessage, callAll, filterChildrenByType, };
16
+ export { styledComponentWithBreakpoints, responsiveStyle, pxToNumber, numToPx, mergeRefs, getText, getErrorMessage, callAll, filterChildrenByType, };
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.filterChildrenByType = exports.callAll = exports.getErrorMessage = exports.getText = exports.mergeRefs = exports.pxToNumber = exports.responsiveStyle = exports.styledComponentWithBreakpoints = void 0;
14
+ exports.filterChildrenByType = exports.callAll = exports.getErrorMessage = exports.getText = exports.mergeRefs = exports.numToPx = exports.pxToNumber = exports.responsiveStyle = exports.styledComponentWithBreakpoints = void 0;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var react_1 = require("react");
17
17
  var hooks_1 = require("../hooks");
@@ -47,6 +47,10 @@ function pxToNumber(px) {
47
47
  return parseFloat(px);
48
48
  }
49
49
  exports.pxToNumber = pxToNumber;
50
+ function numToPx(num) {
51
+ return "".concat(num, "px");
52
+ }
53
+ exports.numToPx = numToPx;
50
54
  function styledComponentWithBreakpoints(Component) {
51
55
  return (0, react_1.forwardRef)(function (props, ref) {
52
56
  var breakpoints = (0, hooks_1.useBreakpoint)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovotech/element-native",
3
- "version": "2.2.0-canary-252a50d-89",
3
+ "version": "2.2.0-canary-668a0ee-91",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "url": "@ovotech/element"
14
14
  },
15
15
  "dependencies": {
16
- "@ovotech/element-core": "^1.1.0-canary-252a50d-89",
16
+ "@ovotech/element-core": "^1.1.0-canary-668a0ee-91",
17
17
  "deepmerge": "^4.2.2"
18
18
  },
19
19
  "devDependencies": {