@telus-uds/components-base 1.38.0 → 1.39.0
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/CHANGELOG.md +12 -2
- package/component-docs.json +7 -5
- package/lib/Link/ChevronLink.js +5 -2
- package/lib/Link/LinkBase.js +3 -8
- package/lib/List/ListItem.js +3 -10
- package/lib/List/ListItemBase.js +25 -4
- package/lib-module/Link/ChevronLink.js +5 -2
- package/lib-module/Link/LinkBase.js +3 -8
- package/lib-module/List/ListItem.js +3 -10
- package/lib-module/List/ListItemBase.js +24 -5
- package/package.json +2 -2
- package/src/Link/ChevronLink.jsx +14 -4
- package/src/Link/LinkBase.jsx +2 -3
- package/src/List/ListItem.jsx +1 -3
- package/src/List/ListItemBase.jsx +20 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 01 May 2023 22:02:12 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.39.0
|
|
8
|
+
|
|
9
|
+
Mon, 01 May 2023 22:02:12 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- added adjustments to IconText (kyle.king2@telus.com)
|
|
14
|
+
- list component standardization (akshay.pandey1@telus.com)
|
|
15
|
+
- Bump @telus-uds/system-theme-tokens to v2.24.0
|
|
16
|
+
|
|
7
17
|
## 1.38.0
|
|
8
18
|
|
|
9
|
-
Thu, 27 Apr 2023 14:
|
|
19
|
+
Thu, 27 Apr 2023 14:41:57 GMT
|
|
10
20
|
|
|
11
21
|
### Minor changes
|
|
12
22
|
|
package/component-docs.json
CHANGED
|
@@ -414,7 +414,7 @@
|
|
|
414
414
|
"labelMarginLeft": "size"
|
|
415
415
|
},
|
|
416
416
|
"ChevronLink": {
|
|
417
|
-
"
|
|
417
|
+
"fontSize": "fontSize",
|
|
418
418
|
"textLineHeight": "lineHeight",
|
|
419
419
|
"color": "color",
|
|
420
420
|
"outerBorderColor": "color",
|
|
@@ -1360,9 +1360,7 @@
|
|
|
1360
1360
|
"animationColorBefore": "color",
|
|
1361
1361
|
"animationColorAfter": "color",
|
|
1362
1362
|
"animationDivColorBefore": "color",
|
|
1363
|
-
"animationDivColorAfter": "color"
|
|
1364
|
-
"animationFillColorBefore": "color",
|
|
1365
|
-
"animationFillColorAfter": "color"
|
|
1363
|
+
"animationDivColorAfter": "color"
|
|
1366
1364
|
},
|
|
1367
1365
|
"ToggleSwitch": {
|
|
1368
1366
|
"borderColor": "color",
|
|
@@ -12810,10 +12808,14 @@
|
|
|
12810
12808
|
"description": ""
|
|
12811
12809
|
},
|
|
12812
12810
|
"tokens": {
|
|
12811
|
+
"defaultValue": {
|
|
12812
|
+
"value": "{}",
|
|
12813
|
+
"computed": false
|
|
12814
|
+
},
|
|
12813
12815
|
"type": {
|
|
12814
12816
|
"name": "custom",
|
|
12815
12817
|
"raw": {
|
|
12816
|
-
"
|
|
12818
|
+
"fontSize": "fontSize",
|
|
12817
12819
|
"textLineHeight": "lineHeight",
|
|
12818
12820
|
"color": "color",
|
|
12819
12821
|
"outerBorderColor": "color",
|
package/lib/Link/ChevronLink.js
CHANGED
|
@@ -33,7 +33,7 @@ const ChevronLink = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
33
33
|
let {
|
|
34
34
|
direction = 'right',
|
|
35
35
|
children,
|
|
36
|
-
tokens,
|
|
36
|
+
tokens = {},
|
|
37
37
|
variant,
|
|
38
38
|
dataSet,
|
|
39
39
|
...linkProps
|
|
@@ -47,10 +47,13 @@ const ChevronLink = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
47
47
|
iconDisplace,
|
|
48
48
|
height,
|
|
49
49
|
textLineHeight,
|
|
50
|
+
fontSize,
|
|
50
51
|
...otherTokens
|
|
51
52
|
} = getChevronTokens(linkState);
|
|
52
|
-
|
|
53
|
+
const linkTokens = (0, _utils.selectTokens)('Link', otherTokens);
|
|
54
|
+
return { ...linkTokens,
|
|
53
55
|
height,
|
|
56
|
+
blockFontSize: tokens.fontSize ?? fontSize,
|
|
54
57
|
textLineHeight,
|
|
55
58
|
icon: direction === 'right' ? rightIcon : leftIcon,
|
|
56
59
|
iconTranslateX: iconDisplace * (direction === 'right' ? 1 : -1) || 0
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -204,15 +204,10 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
204
204
|
,
|
|
205
205
|
ref: ref,
|
|
206
206
|
style: linkState => {
|
|
207
|
-
const
|
|
208
|
-
height,
|
|
209
|
-
...themeTokens
|
|
210
|
-
} = resolveLinkTokens(linkState);
|
|
207
|
+
const themeTokens = resolveLinkTokens(linkState);
|
|
211
208
|
const outerBorderStyles = selectOuterBorderStyles(themeTokens);
|
|
212
209
|
const decorationStyles = selectDecorationStyles(themeTokens);
|
|
213
|
-
return [
|
|
214
|
-
height
|
|
215
|
-
} : {}, outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
|
|
210
|
+
return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
|
|
216
211
|
},
|
|
217
212
|
children: linkState => {
|
|
218
213
|
const themeTokens = resolveLinkTokens(linkState);
|
|
@@ -278,7 +273,7 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
278
273
|
justifyContent: 'flex-start'
|
|
279
274
|
},
|
|
280
275
|
baseline: {
|
|
281
|
-
alignSelf: '
|
|
276
|
+
alignSelf: 'baseline'
|
|
282
277
|
}
|
|
283
278
|
});
|
|
284
279
|
|
package/lib/List/ListItem.js
CHANGED
|
@@ -9,8 +9,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _ListItemBase = _interopRequireDefault(require("./ListItemBase"));
|
|
11
11
|
|
|
12
|
-
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
13
|
-
|
|
14
12
|
var _ThemeProvider = require("../ThemeProvider");
|
|
15
13
|
|
|
16
14
|
var _utils = require("../utils");
|
|
@@ -35,17 +33,12 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
35
33
|
...listItemProps
|
|
36
34
|
} = _ref;
|
|
37
35
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('List', tokens, variant);
|
|
38
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
36
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemBase.default, {
|
|
39
37
|
tokens: themeTokens,
|
|
40
38
|
ref: ref,
|
|
41
39
|
...listItemProps,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
size: 'h4',
|
|
45
|
-
bold: true
|
|
46
|
-
},
|
|
47
|
-
children: title
|
|
48
|
-
}), children]
|
|
40
|
+
title: title,
|
|
41
|
+
children: children
|
|
49
42
|
});
|
|
50
43
|
});
|
|
51
44
|
ListItem.displayName = 'ListItem';
|
package/lib/List/ListItemBase.js
CHANGED
|
@@ -21,6 +21,8 @@ var _ListItemContent = _interopRequireDefault(require("./ListItemContent"));
|
|
|
21
21
|
|
|
22
22
|
var _ListItemMark = _interopRequireDefault(require("./ListItemMark"));
|
|
23
23
|
|
|
24
|
+
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
25
|
+
|
|
24
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
27
|
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -66,6 +68,7 @@ const ListItemBase = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
66
68
|
iconSize,
|
|
67
69
|
showDivider,
|
|
68
70
|
children,
|
|
71
|
+
title,
|
|
69
72
|
isLastItem,
|
|
70
73
|
accessibilityRole = _Platform.default.select({
|
|
71
74
|
web: 'listitem',
|
|
@@ -105,15 +108,30 @@ const ListItemBase = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
105
108
|
iconColor,
|
|
106
109
|
iconSize,
|
|
107
110
|
isLastItem
|
|
108
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
111
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
112
|
+
style: [{
|
|
113
|
+
flexDirection: 'row',
|
|
114
|
+
flex: 'wrap'
|
|
115
|
+
}, !title && {
|
|
116
|
+
alignItems: 'center'
|
|
117
|
+
}],
|
|
109
118
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemMark.default, {
|
|
110
119
|
tokens: tokens,
|
|
111
120
|
icon: icon,
|
|
112
121
|
iconColor: iconColor,
|
|
113
122
|
iconSize: iconSize
|
|
114
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
115
|
-
|
|
116
|
-
children:
|
|
123
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
124
|
+
style: staticStyles.titleAndContentContainer,
|
|
125
|
+
children: [Boolean(title) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
126
|
+
variant: {
|
|
127
|
+
size: 'h4',
|
|
128
|
+
bold: true
|
|
129
|
+
},
|
|
130
|
+
children: title
|
|
131
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemContent.default, {
|
|
132
|
+
tokens: tokens,
|
|
133
|
+
children: children
|
|
134
|
+
})]
|
|
117
135
|
})]
|
|
118
136
|
})
|
|
119
137
|
});
|
|
@@ -123,6 +141,9 @@ ListItemBase.displayName = 'ListItem';
|
|
|
123
141
|
const staticStyles = _StyleSheet.default.create({
|
|
124
142
|
itemContainer: {
|
|
125
143
|
flexDirection: 'row'
|
|
144
|
+
},
|
|
145
|
+
titleAndContentContainer: {
|
|
146
|
+
flexDirection: 'column'
|
|
126
147
|
}
|
|
127
148
|
});
|
|
128
149
|
|
|
@@ -15,7 +15,7 @@ const ChevronLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
15
15
|
let {
|
|
16
16
|
direction = 'right',
|
|
17
17
|
children,
|
|
18
|
-
tokens,
|
|
18
|
+
tokens = {},
|
|
19
19
|
variant,
|
|
20
20
|
dataSet,
|
|
21
21
|
...linkProps
|
|
@@ -29,10 +29,13 @@ const ChevronLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
29
29
|
iconDisplace,
|
|
30
30
|
height,
|
|
31
31
|
textLineHeight,
|
|
32
|
+
fontSize,
|
|
32
33
|
...otherTokens
|
|
33
34
|
} = getChevronTokens(linkState);
|
|
34
|
-
|
|
35
|
+
const linkTokens = selectTokens('Link', otherTokens);
|
|
36
|
+
return { ...linkTokens,
|
|
35
37
|
height,
|
|
38
|
+
blockFontSize: tokens.fontSize ?? fontSize,
|
|
36
39
|
textLineHeight,
|
|
37
40
|
icon: direction === 'right' ? rightIcon : leftIcon,
|
|
38
41
|
iconTranslateX: iconDisplace * (direction === 'right' ? 1 : -1) || 0
|
|
@@ -176,15 +176,10 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
176
176
|
,
|
|
177
177
|
ref: ref,
|
|
178
178
|
style: linkState => {
|
|
179
|
-
const
|
|
180
|
-
height,
|
|
181
|
-
...themeTokens
|
|
182
|
-
} = resolveLinkTokens(linkState);
|
|
179
|
+
const themeTokens = resolveLinkTokens(linkState);
|
|
183
180
|
const outerBorderStyles = selectOuterBorderStyles(themeTokens);
|
|
184
181
|
const decorationStyles = selectDecorationStyles(themeTokens);
|
|
185
|
-
return [
|
|
186
|
-
height
|
|
187
|
-
} : {}, outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
|
|
182
|
+
return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
|
|
188
183
|
},
|
|
189
184
|
children: linkState => {
|
|
190
185
|
const themeTokens = resolveLinkTokens(linkState);
|
|
@@ -249,7 +244,7 @@ const staticStyles = StyleSheet.create({
|
|
|
249
244
|
justifyContent: 'flex-start'
|
|
250
245
|
},
|
|
251
246
|
baseline: {
|
|
252
|
-
alignSelf: '
|
|
247
|
+
alignSelf: 'baseline'
|
|
253
248
|
}
|
|
254
249
|
});
|
|
255
250
|
export default withLinkRouter(LinkBase);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import ListItemBase from './ListItemBase';
|
|
3
|
-
import Typography from '../Typography';
|
|
4
3
|
import { useThemeTokens } from '../ThemeProvider';
|
|
5
4
|
import { variantProp } from '../utils';
|
|
6
5
|
/**
|
|
@@ -8,7 +7,6 @@ import { variantProp } from '../utils';
|
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
10
|
const ListItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
13
11
|
let {
|
|
14
12
|
tokens,
|
|
@@ -18,17 +16,12 @@ const ListItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
18
16
|
...listItemProps
|
|
19
17
|
} = _ref;
|
|
20
18
|
const themeTokens = useThemeTokens('List', tokens, variant);
|
|
21
|
-
return /*#__PURE__*/
|
|
19
|
+
return /*#__PURE__*/_jsx(ListItemBase, {
|
|
22
20
|
tokens: themeTokens,
|
|
23
21
|
ref: ref,
|
|
24
22
|
...listItemProps,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
size: 'h4',
|
|
28
|
-
bold: true
|
|
29
|
-
},
|
|
30
|
-
children: title
|
|
31
|
-
}), children]
|
|
23
|
+
title: title,
|
|
24
|
+
children: children
|
|
32
25
|
});
|
|
33
26
|
});
|
|
34
27
|
ListItem.displayName = 'ListItem';
|
|
@@ -6,8 +6,8 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils';
|
|
7
7
|
import ListItemContent from './ListItemContent';
|
|
8
8
|
import ListItemMark from './ListItemMark';
|
|
9
|
+
import Typography from '../Typography';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
13
13
|
|
|
@@ -46,6 +46,7 @@ const ListItemBase = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
46
46
|
iconSize,
|
|
47
47
|
showDivider,
|
|
48
48
|
children,
|
|
49
|
+
title,
|
|
49
50
|
isLastItem,
|
|
50
51
|
accessibilityRole = Platform.select({
|
|
51
52
|
web: 'listitem',
|
|
@@ -85,15 +86,30 @@ const ListItemBase = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
85
86
|
iconColor,
|
|
86
87
|
iconSize,
|
|
87
88
|
isLastItem
|
|
88
|
-
}) : /*#__PURE__*/_jsxs(
|
|
89
|
+
}) : /*#__PURE__*/_jsxs(View, {
|
|
90
|
+
style: [{
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
flex: 'wrap'
|
|
93
|
+
}, !title && {
|
|
94
|
+
alignItems: 'center'
|
|
95
|
+
}],
|
|
89
96
|
children: [/*#__PURE__*/_jsx(ListItemMark, {
|
|
90
97
|
tokens: tokens,
|
|
91
98
|
icon: icon,
|
|
92
99
|
iconColor: iconColor,
|
|
93
100
|
iconSize: iconSize
|
|
94
|
-
}), /*#__PURE__*/
|
|
95
|
-
|
|
96
|
-
children:
|
|
101
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
102
|
+
style: staticStyles.titleAndContentContainer,
|
|
103
|
+
children: [Boolean(title) && /*#__PURE__*/_jsx(Typography, {
|
|
104
|
+
variant: {
|
|
105
|
+
size: 'h4',
|
|
106
|
+
bold: true
|
|
107
|
+
},
|
|
108
|
+
children: title
|
|
109
|
+
}), /*#__PURE__*/_jsx(ListItemContent, {
|
|
110
|
+
tokens: tokens,
|
|
111
|
+
children: children
|
|
112
|
+
})]
|
|
97
113
|
})]
|
|
98
114
|
})
|
|
99
115
|
});
|
|
@@ -102,6 +118,9 @@ ListItemBase.displayName = 'ListItem';
|
|
|
102
118
|
const staticStyles = StyleSheet.create({
|
|
103
119
|
itemContainer: {
|
|
104
120
|
flexDirection: 'row'
|
|
121
|
+
},
|
|
122
|
+
titleAndContentContainer: {
|
|
123
|
+
flexDirection: 'column'
|
|
105
124
|
}
|
|
106
125
|
});
|
|
107
126
|
ListItemBase.propTypes = { ...selectedSystemPropTypes,
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@floating-ui/react-native": "^0.8.1",
|
|
12
12
|
"@gorhom/portal": "^1.0.14",
|
|
13
13
|
"@telus-uds/system-constants": "^1.2.0",
|
|
14
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
14
|
+
"@telus-uds/system-theme-tokens": "^2.24.0",
|
|
15
15
|
"airbnb-prop-types": "^2.16.0",
|
|
16
16
|
"lodash.debounce": "^4.0.8",
|
|
17
17
|
"lodash.merge": "^4.6.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"standard-engine": {
|
|
73
73
|
"skip": true
|
|
74
74
|
},
|
|
75
|
-
"version": "1.
|
|
75
|
+
"version": "1.39.0"
|
|
76
76
|
}
|
package/src/Link/ChevronLink.jsx
CHANGED
|
@@ -12,14 +12,24 @@ import LinkBase from './LinkBase'
|
|
|
12
12
|
* ChevronLink is not intended to be deeply themable; variants passed to ChevronLink are forwarded to Link.
|
|
13
13
|
*/
|
|
14
14
|
const ChevronLink = forwardRef(
|
|
15
|
-
({ direction = 'right', children, tokens, variant, dataSet, ...linkProps }, ref) => {
|
|
15
|
+
({ direction = 'right', children, tokens = {}, variant, dataSet, ...linkProps }, ref) => {
|
|
16
16
|
const getChevronTokens = useThemeTokensCallback('ChevronLink', tokens, variant)
|
|
17
17
|
const applyChevronTokens = (linkState) => {
|
|
18
|
-
const {
|
|
19
|
-
|
|
18
|
+
const {
|
|
19
|
+
leftIcon,
|
|
20
|
+
rightIcon,
|
|
21
|
+
iconDisplace,
|
|
22
|
+
height,
|
|
23
|
+
textLineHeight,
|
|
24
|
+
fontSize,
|
|
25
|
+
...otherTokens
|
|
26
|
+
} = getChevronTokens(linkState)
|
|
27
|
+
const linkTokens = selectTokens('Link', otherTokens)
|
|
28
|
+
|
|
20
29
|
return {
|
|
21
|
-
...
|
|
30
|
+
...linkTokens,
|
|
22
31
|
height,
|
|
32
|
+
blockFontSize: tokens.fontSize ?? fontSize,
|
|
23
33
|
textLineHeight,
|
|
24
34
|
icon: direction === 'right' ? rightIcon : leftIcon,
|
|
25
35
|
iconTranslateX: iconDisplace * (direction === 'right' ? 1 : -1) || 0
|
package/src/Link/LinkBase.jsx
CHANGED
|
@@ -150,12 +150,11 @@ const LinkBase = forwardRef(
|
|
|
150
150
|
inlineFlex={hasIcon} // assuming links without icons should be inline (even if they are long)
|
|
151
151
|
ref={ref}
|
|
152
152
|
style={(linkState) => {
|
|
153
|
-
const
|
|
153
|
+
const themeTokens = resolveLinkTokens(linkState)
|
|
154
154
|
const outerBorderStyles = selectOuterBorderStyles(themeTokens)
|
|
155
155
|
const decorationStyles = selectDecorationStyles(themeTokens)
|
|
156
156
|
|
|
157
157
|
return [
|
|
158
|
-
height ? { height } : {},
|
|
159
158
|
outerBorderStyles,
|
|
160
159
|
blockLeftStyle,
|
|
161
160
|
decorationStyles,
|
|
@@ -226,7 +225,7 @@ const staticStyles = StyleSheet.create({
|
|
|
226
225
|
justifyContent: 'flex-start'
|
|
227
226
|
},
|
|
228
227
|
baseline: {
|
|
229
|
-
alignSelf: '
|
|
228
|
+
alignSelf: 'baseline'
|
|
230
229
|
}
|
|
231
230
|
})
|
|
232
231
|
|
package/src/List/ListItem.jsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
2
|
|
|
3
3
|
import ListItemBase from './ListItemBase'
|
|
4
|
-
import Typography from '../Typography'
|
|
5
4
|
import { useThemeTokens } from '../ThemeProvider'
|
|
6
5
|
import { variantProp } from '../utils'
|
|
7
6
|
|
|
@@ -11,8 +10,7 @@ import { variantProp } from '../utils'
|
|
|
11
10
|
const ListItem = forwardRef(({ tokens, variant, children, title, ...listItemProps }, ref) => {
|
|
12
11
|
const themeTokens = useThemeTokens('List', tokens, variant)
|
|
13
12
|
return (
|
|
14
|
-
<ListItemBase tokens={themeTokens} ref={ref} {...listItemProps}>
|
|
15
|
-
{Boolean(title) && <Typography variant={{ size: 'h4', bold: true }}>{title}</Typography>}
|
|
13
|
+
<ListItemBase tokens={themeTokens} ref={ref} {...listItemProps} title={title}>
|
|
16
14
|
{children}
|
|
17
15
|
</ListItemBase>
|
|
18
16
|
)
|
|
@@ -5,6 +5,7 @@ import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps
|
|
|
5
5
|
|
|
6
6
|
import ListItemContent from './ListItemContent'
|
|
7
7
|
import ListItemMark from './ListItemMark'
|
|
8
|
+
import Typography from '../Typography'
|
|
8
9
|
|
|
9
10
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
|
|
10
11
|
|
|
@@ -31,6 +32,7 @@ const ListItemBase = forwardRef(
|
|
|
31
32
|
iconSize,
|
|
32
33
|
showDivider,
|
|
33
34
|
children,
|
|
35
|
+
title,
|
|
34
36
|
isLastItem,
|
|
35
37
|
accessibilityRole = Platform.select({ web: 'listitem', default: undefined }),
|
|
36
38
|
...rest
|
|
@@ -69,10 +71,23 @@ const ListItemBase = forwardRef(
|
|
|
69
71
|
{typeof children === 'function' ? (
|
|
70
72
|
children({ tokens, icon, iconColor, iconSize, isLastItem })
|
|
71
73
|
) : (
|
|
72
|
-
|
|
74
|
+
<View
|
|
75
|
+
style={[
|
|
76
|
+
{
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
flex: 'wrap'
|
|
79
|
+
},
|
|
80
|
+
!title && { alignItems: 'center' }
|
|
81
|
+
]}
|
|
82
|
+
>
|
|
73
83
|
<ListItemMark tokens={tokens} icon={icon} iconColor={iconColor} iconSize={iconSize} />
|
|
74
|
-
<
|
|
75
|
-
|
|
84
|
+
<View style={staticStyles.titleAndContentContainer}>
|
|
85
|
+
{Boolean(title) && (
|
|
86
|
+
<Typography variant={{ size: 'h4', bold: true }}>{title}</Typography>
|
|
87
|
+
)}
|
|
88
|
+
<ListItemContent tokens={tokens}>{children}</ListItemContent>
|
|
89
|
+
</View>
|
|
90
|
+
</View>
|
|
76
91
|
)}
|
|
77
92
|
</View>
|
|
78
93
|
)
|
|
@@ -83,7 +98,8 @@ ListItemBase.displayName = 'ListItem'
|
|
|
83
98
|
const staticStyles = StyleSheet.create({
|
|
84
99
|
itemContainer: {
|
|
85
100
|
flexDirection: 'row'
|
|
86
|
-
}
|
|
101
|
+
},
|
|
102
|
+
titleAndContentContainer: { flexDirection: 'column' }
|
|
87
103
|
})
|
|
88
104
|
|
|
89
105
|
ListItemBase.propTypes = {
|