@ovotech/element-native 0.0.0-canary-2c27ccc-7 → 0.0.0-canary-69eaeb8-8

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.
@@ -54,21 +54,27 @@ var react_1 = __importStar(require("react"));
54
54
  var react_native_1 = require("react-native");
55
55
  var hooks_1 = require("../../hooks");
56
56
  var styled_native_1 = __importStar(require("../../styled.native"));
57
- var theme_1 = require("../../theme");
58
57
  var utils_1 = require("../../utils");
59
58
  var Stack_1 = require("../Stack");
60
59
  var UlBullet = styled_native_1.default.View(function (_a) {
61
- var _b = _a.theme, colors = _b.colors, list = _b.list, _c = _a.visible, visible = _c === void 0 ? true : _c;
62
- return (0, styled_native_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-right: ", ";\n width: ", ";\n height: ", ";\n background-color: ", ";\n "], ["\n margin-right: ", ";\n width: ", ";\n height: ", ";\n background-color: ", ";\n "])), list.listItem.bulletGap, list.listItem.bulletWidth, list.listItem.bulletWidth, visible ? colors.body : 'transparent');
60
+ var _b = _a.theme, colors = _b.colors, list = _b.list, _c = _a.visible, visible = _c === void 0 ? true : _c, smallAndUp = _a.smallAndUp;
61
+ var lineHeight = smallAndUp
62
+ ? list.listItem.lineHeight[1]
63
+ : list.listItem.lineHeight[0];
64
+ var topMargin = ((0, utils_1.pxToNumber)(lineHeight) - (0, utils_1.pxToNumber)(list.listItem.bulletWidth)) / 2;
65
+ return (0, styled_native_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-right: ", ";\n margin-top: ", "px;\n width: ", ";\n height: ", ";\n background-color: ", ";\n "], ["\n margin-right: ", ";\n margin-top: ", "px;\n width: ", ";\n height: ", ";\n background-color: ", ";\n "])), list.listItem.bulletGap, topMargin, list.listItem.bulletWidth, list.listItem.bulletWidth, visible ? colors.body : 'transparent');
63
66
  });
64
67
  var StyledBullet = styled_native_1.default.Text(function (_a) {
65
68
  var _b = _a.theme, text = _b.text, list = _b.list, space = _b.space, smallAndUp = _a.smallAndUp;
66
69
  var fontSize = smallAndUp
67
70
  ? list.listItem.fontSize[1]
68
71
  : list.listItem.fontSize[0];
69
- return (0, styled_native_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "])), text.fontFamily, (0, theme_1.calculateLineHeight)(fontSize, text.lineHeight), text.fontWeight, text.color, fontSize, list.listItem.bulletGap, space[4]);
72
+ var lineHeight = smallAndUp
73
+ ? list.listItem.lineHeight[1]
74
+ : list.listItem.lineHeight[0];
75
+ return (0, styled_native_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize, list.listItem.bulletGap, space[4]);
70
76
  });
71
- var StyledUlItem = styled_native_1.default.View(function () { return (0, styled_native_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: center;\n justify-content: center;\n "], ["\n flex-direction: row;\n align-items: center;\n justify-content: center;\n "]))); });
77
+ var StyledUlItem = styled_native_1.default.View(function () { return (0, styled_native_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: top;\n justify-content: center;\n "], ["\n flex-direction: row;\n align-items: top;\n justify-content: center;\n "]))); });
72
78
  var Bullet = (0, utils_1.styledComponentWithBreakpoints)(StyledBullet);
73
79
  var ListBulletItem = function (_a) {
74
80
  var children = _a.children, _b = _a.showBullets, showBullets = _b === void 0 ? true : _b;
@@ -106,18 +112,24 @@ var StyledLi = styled_native_1.default.Text(function (_a) {
106
112
  var fontSize = smallAndUp
107
113
  ? list.listItem.fontSize[1]
108
114
  : list.listItem.fontSize[0];
109
- return (0, styled_native_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, (0, theme_1.calculateLineHeight)(fontSize, text.lineHeight), text.fontWeight, text.color, fontSize);
115
+ var lineHeight = smallAndUp
116
+ ? list.listItem.lineHeight[1]
117
+ : list.listItem.lineHeight[0];
118
+ return (0, styled_native_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize);
110
119
  });
111
120
  var Li = (0, utils_1.styledComponentWithBreakpoints)(StyledLi);
112
121
  exports.Li = Li;
113
122
  var Dl = ListWrapper;
114
123
  exports.Dl = Dl;
115
124
  var StyledDtText = styled_native_1.default.Text(function (_a) {
116
- var _b = _a.theme, text = _b.text, list = _b.list, smallAndUp = _a.smallAndUp;
125
+ var list = _a.theme.list, smallAndUp = _a.smallAndUp;
117
126
  var fontSize = smallAndUp
118
127
  ? list.listItem.fontSize[1]
119
128
  : list.listItem.fontSize[0];
120
- return (0, styled_native_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), list.descriptionTerm.fontFamily, list.descriptionTerm.fontWeight, (0, theme_1.calculateLineHeight)(fontSize, text.lineHeight), list.descriptionTerm.color, fontSize);
129
+ var lineHeight = smallAndUp
130
+ ? list.listItem.lineHeight[1]
131
+ : list.listItem.lineHeight[0];
132
+ return (0, styled_native_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), list.descriptionTerm.fontFamily, list.descriptionTerm.fontWeight, lineHeight, list.descriptionTerm.color, fontSize);
121
133
  });
122
134
  var DtText = (0, utils_1.styledComponentWithBreakpoints)(StyledDtText);
123
135
  var StyledDtItem = styled_native_1.default.View(function (_a) {
@@ -142,7 +154,10 @@ var StyledDdText = styled_native_1.default.Text(function (_a) {
142
154
  var fontSize = smallAndUp
143
155
  ? list.listItem.fontSize[1]
144
156
  : list.listItem.fontSize[0];
145
- return (0, styled_native_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, (0, theme_1.calculateLineHeight)(fontSize, text.lineHeight), text.fontWeight, text.color, fontSize);
157
+ var lineHeight = smallAndUp
158
+ ? list.listItem.lineHeight[1]
159
+ : list.listItem.lineHeight[0];
160
+ return (0, styled_native_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize);
146
161
  });
147
162
  var Dd = function (_a) {
148
163
  var children = _a.children, rest = __rest(_a, ["children"]);
@@ -28,21 +28,27 @@ import React, { Children, useContext, } from 'react';
28
28
  import { View } from 'react-native';
29
29
  import { useBreakpoint } from '../../hooks';
30
30
  import styled, { css, ThemeContext } from '../../styled.native';
31
- import { calculateLineHeight } from '../../theme';
32
- import { styledComponentWithBreakpoints } from '../../utils';
31
+ import { pxToNumber, styledComponentWithBreakpoints } from '../../utils';
33
32
  import { Stack } from '../Stack';
34
33
  var UlBullet = styled.View(function (_a) {
35
- var _b = _a.theme, colors = _b.colors, list = _b.list, _c = _a.visible, visible = _c === void 0 ? true : _c;
36
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-right: ", ";\n width: ", ";\n height: ", ";\n background-color: ", ";\n "], ["\n margin-right: ", ";\n width: ", ";\n height: ", ";\n background-color: ", ";\n "])), list.listItem.bulletGap, list.listItem.bulletWidth, list.listItem.bulletWidth, visible ? colors.body : 'transparent');
34
+ var _b = _a.theme, colors = _b.colors, list = _b.list, _c = _a.visible, visible = _c === void 0 ? true : _c, smallAndUp = _a.smallAndUp;
35
+ var lineHeight = smallAndUp
36
+ ? list.listItem.lineHeight[1]
37
+ : list.listItem.lineHeight[0];
38
+ var topMargin = (pxToNumber(lineHeight) - pxToNumber(list.listItem.bulletWidth)) / 2;
39
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-right: ", ";\n margin-top: ", "px;\n width: ", ";\n height: ", ";\n background-color: ", ";\n "], ["\n margin-right: ", ";\n margin-top: ", "px;\n width: ", ";\n height: ", ";\n background-color: ", ";\n "])), list.listItem.bulletGap, topMargin, list.listItem.bulletWidth, list.listItem.bulletWidth, visible ? colors.body : 'transparent');
37
40
  });
38
41
  var StyledBullet = styled.Text(function (_a) {
39
42
  var _b = _a.theme, text = _b.text, list = _b.list, space = _b.space, smallAndUp = _a.smallAndUp;
40
43
  var fontSize = smallAndUp
41
44
  ? list.listItem.fontSize[1]
42
45
  : list.listItem.fontSize[0];
43
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "])), text.fontFamily, calculateLineHeight(fontSize, text.lineHeight), text.fontWeight, text.color, fontSize, list.listItem.bulletGap, space[4]);
46
+ var lineHeight = smallAndUp
47
+ ? list.listItem.lineHeight[1]
48
+ : list.listItem.lineHeight[0];
49
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize, list.listItem.bulletGap, space[4]);
44
50
  });
45
- var StyledUlItem = styled.View(function () { return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: center;\n justify-content: center;\n "], ["\n flex-direction: row;\n align-items: center;\n justify-content: center;\n "]))); });
51
+ var StyledUlItem = styled.View(function () { return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: top;\n justify-content: center;\n "], ["\n flex-direction: row;\n align-items: top;\n justify-content: center;\n "]))); });
46
52
  var Bullet = styledComponentWithBreakpoints(StyledBullet);
47
53
  var ListBulletItem = function (_a) {
48
54
  var children = _a.children, _b = _a.showBullets, showBullets = _b === void 0 ? true : _b;
@@ -78,16 +84,22 @@ var StyledLi = styled.Text(function (_a) {
78
84
  var fontSize = smallAndUp
79
85
  ? list.listItem.fontSize[1]
80
86
  : list.listItem.fontSize[0];
81
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, calculateLineHeight(fontSize, text.lineHeight), text.fontWeight, text.color, fontSize);
87
+ var lineHeight = smallAndUp
88
+ ? list.listItem.lineHeight[1]
89
+ : list.listItem.lineHeight[0];
90
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize);
82
91
  });
83
92
  var Li = styledComponentWithBreakpoints(StyledLi);
84
93
  var Dl = ListWrapper;
85
94
  var StyledDtText = styled.Text(function (_a) {
86
- var _b = _a.theme, text = _b.text, list = _b.list, smallAndUp = _a.smallAndUp;
95
+ var list = _a.theme.list, smallAndUp = _a.smallAndUp;
87
96
  var fontSize = smallAndUp
88
97
  ? list.listItem.fontSize[1]
89
98
  : list.listItem.fontSize[0];
90
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), list.descriptionTerm.fontFamily, list.descriptionTerm.fontWeight, calculateLineHeight(fontSize, text.lineHeight), list.descriptionTerm.color, fontSize);
99
+ var lineHeight = smallAndUp
100
+ ? list.listItem.lineHeight[1]
101
+ : list.listItem.lineHeight[0];
102
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), list.descriptionTerm.fontFamily, list.descriptionTerm.fontWeight, lineHeight, list.descriptionTerm.color, fontSize);
91
103
  });
92
104
  var DtText = styledComponentWithBreakpoints(StyledDtText);
93
105
  var StyledDtItem = styled.View(function (_a) {
@@ -111,7 +123,10 @@ var StyledDdText = styled.Text(function (_a) {
111
123
  var fontSize = smallAndUp
112
124
  ? list.listItem.fontSize[1]
113
125
  : list.listItem.fontSize[0];
114
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, calculateLineHeight(fontSize, text.lineHeight), text.fontWeight, text.color, fontSize);
126
+ var lineHeight = smallAndUp
127
+ ? list.listItem.lineHeight[1]
128
+ : list.listItem.lineHeight[0];
129
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize);
115
130
  });
116
131
  var Dd = function (_a) {
117
132
  var children = _a.children, rest = __rest(_a, ["children"]);
@@ -359,6 +359,7 @@ export function createTheme(customTheme, additional) {
359
359
  marginLeft: space[6],
360
360
  listItem: {
361
361
  fontSize: responsiveFontSizes.body,
362
+ lineHeight: responsiveLineHeights.body,
362
363
  marginVertical: 2,
363
364
  bulletGap: space[2],
364
365
  bulletWidth: space[2],
@@ -365,6 +365,7 @@ function createTheme(customTheme, additional) {
365
365
  marginLeft: space[6],
366
366
  listItem: {
367
367
  fontSize: responsiveFontSizes.body,
368
+ lineHeight: responsiveLineHeights.body,
368
369
  marginVertical: 2,
369
370
  bulletGap: space[2],
370
371
  bulletWidth: space[2],
@@ -73,6 +73,7 @@ export declare type Theme = {
73
73
  marginLeft: string;
74
74
  listItem: {
75
75
  fontSize: string[];
76
+ lineHeight: string[];
76
77
  marginVertical: keyof Theme['space'];
77
78
  bulletGap: string;
78
79
  bulletWidth: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovotech/element-native",
3
- "version": "0.0.0-canary-2c27ccc-7",
3
+ "version": "0.0.0-canary-69eaeb8-8",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",