@telus-uds/components-community.content-card 1.0.1 → 1.0.3
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 +22 -2
- package/lib/ContentCard.js +11 -32
- package/lib/index.js +0 -3
- package/lib/index.native.js +0 -3
- package/lib-module/ContentCard.js +10 -17
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-community.content-card
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 10 Nov 2023 22:28:25 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.0.3
|
|
8
|
+
|
|
9
|
+
Fri, 10 Nov 2023 22:28:25 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @telus-uds/components-base to v1.67.1
|
|
14
|
+
- Bump @telus-uds/browserslist-config to v1.0.5
|
|
15
|
+
- Bump @telus-uds/system-theme-tokens to v2.44.1
|
|
16
|
+
|
|
17
|
+
## 1.0.2
|
|
18
|
+
|
|
19
|
+
Tue, 07 Nov 2023 16:32:21 GMT
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- Bump @telus-uds/components-base to v1.67.0
|
|
24
|
+
- Bump @telus-uds/browserslist-config to v1.0.5
|
|
25
|
+
- Bump @telus-uds/system-theme-tokens to v2.44.0
|
|
26
|
+
|
|
7
27
|
## 1.0.1
|
|
8
28
|
|
|
9
|
-
Wed, 01 Nov 2023
|
|
29
|
+
Wed, 01 Nov 2023 01:05:43 GMT
|
|
10
30
|
|
|
11
31
|
### Patches
|
|
12
32
|
|
package/lib/ContentCard.js
CHANGED
|
@@ -4,28 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.styles = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _componentsBase = require("@telus-uds/components-base");
|
|
13
|
-
|
|
14
10
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
15
|
-
|
|
16
11
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
17
|
-
|
|
18
12
|
var _ImageBackground = _interopRequireDefault(require("react-native-web/dist/cjs/exports/ImageBackground"));
|
|
19
|
-
|
|
20
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
17
|
/* eslint-disable react/require-default-props */
|
|
18
|
+
|
|
29
19
|
const styles = _StyleSheet.default.create({
|
|
30
20
|
rowReverse: {
|
|
31
21
|
flexDirection: 'row-reverse'
|
|
@@ -40,9 +30,9 @@ const styles = _StyleSheet.default.create({
|
|
|
40
30
|
informationContainer: {
|
|
41
31
|
width: '65%'
|
|
42
32
|
}
|
|
43
|
-
});
|
|
44
|
-
|
|
33
|
+
});
|
|
45
34
|
|
|
35
|
+
// Passes React Native-oriented system props through UDS PressableCardBase
|
|
46
36
|
exports.styles = styles;
|
|
47
37
|
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_componentsBase.a11yProps, _componentsBase.focusHandlerProps, _componentsBase.viewProps]);
|
|
48
38
|
const ContentCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
@@ -67,18 +57,16 @@ const ContentCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
67
57
|
const cardTokens = (0, _componentsBase.useThemeTokens)('Card', tokens, {}, {
|
|
68
58
|
viewport
|
|
69
59
|
});
|
|
70
|
-
|
|
71
60
|
const {
|
|
72
61
|
hrefAttrs,
|
|
73
62
|
rest: unusedRest
|
|
74
63
|
} = _componentsBase.hrefAttrsProp.bundle(rest);
|
|
75
|
-
|
|
76
64
|
const getPressableCardTokens = cardState => {
|
|
77
|
-
return {
|
|
65
|
+
return {
|
|
66
|
+
...cardTokens,
|
|
78
67
|
...getTokens(cardState)
|
|
79
68
|
};
|
|
80
69
|
};
|
|
81
|
-
|
|
82
70
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.PressableCardBase, {
|
|
83
71
|
ref: ref,
|
|
84
72
|
onPress: onPress,
|
|
@@ -89,8 +77,9 @@ const ContentCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
89
77
|
children: cardState => {
|
|
90
78
|
const {
|
|
91
79
|
borderWidth
|
|
92
|
-
} = getPressableCardTokens(cardState);
|
|
80
|
+
} = getPressableCardTokens(cardState);
|
|
93
81
|
|
|
82
|
+
// Stop content jumping around as border size changes
|
|
94
83
|
const borderOffset = borderWidth - generalTokens.borderWidth;
|
|
95
84
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Box, {
|
|
96
85
|
horizontal: {
|
|
@@ -132,7 +121,8 @@ const ContentCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
132
121
|
children: linkText
|
|
133
122
|
})]
|
|
134
123
|
}), customImage || /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageBackground.default, {
|
|
135
|
-
source: imageSrc
|
|
124
|
+
source: imageSrc
|
|
125
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
136
126
|
,
|
|
137
127
|
style: {
|
|
138
128
|
flex: 1,
|
|
@@ -148,53 +138,44 @@ const ContentCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
148
138
|
});
|
|
149
139
|
});
|
|
150
140
|
ContentCard.displayName = 'ContentCard';
|
|
151
|
-
ContentCard.propTypes = {
|
|
152
|
-
|
|
141
|
+
ContentCard.propTypes = {
|
|
142
|
+
...selectedSystemPropTypes,
|
|
153
143
|
/**
|
|
154
144
|
* The URL to be navigated to.
|
|
155
145
|
*/
|
|
156
146
|
href: _propTypes.default.string,
|
|
157
|
-
|
|
158
147
|
/**
|
|
159
148
|
* Text stating the title or headline.
|
|
160
149
|
*/
|
|
161
150
|
title: _propTypes.default.string.isRequired,
|
|
162
|
-
|
|
163
151
|
/**
|
|
164
152
|
* Text giving a short content of the card. One paragraph of plain text.
|
|
165
153
|
*/
|
|
166
154
|
content: _propTypes.default.string.isRequired,
|
|
167
|
-
|
|
168
155
|
/**
|
|
169
156
|
* Text for the ChevronLink.
|
|
170
157
|
*/
|
|
171
158
|
linkText: _propTypes.default.string.isRequired,
|
|
172
|
-
|
|
173
159
|
/**
|
|
174
160
|
* Optional function to be called on press e.g. for within-page navigation.
|
|
175
161
|
*/
|
|
176
162
|
onPress: _propTypes.default.func,
|
|
177
|
-
|
|
178
163
|
/**
|
|
179
164
|
* Src of the Image.
|
|
180
165
|
*/
|
|
181
166
|
imageSrc: _propTypes.default.string,
|
|
182
|
-
|
|
183
167
|
/**
|
|
184
168
|
* Height of the Image.
|
|
185
169
|
*/
|
|
186
170
|
imageHeight: _propTypes.default.number,
|
|
187
|
-
|
|
188
171
|
/**
|
|
189
172
|
* Width of the Image.
|
|
190
173
|
*/
|
|
191
174
|
imageWidth: _propTypes.default.number,
|
|
192
|
-
|
|
193
175
|
/**
|
|
194
176
|
* Custom Image to be used instead of the default image.
|
|
195
177
|
*/
|
|
196
178
|
customImage: _propTypes.default.node,
|
|
197
|
-
|
|
198
179
|
/**
|
|
199
180
|
* Controls if the content is on the right side of the image.
|
|
200
181
|
*/
|
|
@@ -203,7 +184,5 @@ ContentCard.propTypes = { ...selectedSystemPropTypes,
|
|
|
203
184
|
ContentCard.defaultProps = {
|
|
204
185
|
isContentOnRight: false
|
|
205
186
|
};
|
|
206
|
-
|
|
207
187
|
var _default = (0, _componentsBase.withLinkRouter)(ContentCard);
|
|
208
|
-
|
|
209
188
|
exports.default = _default;
|
package/lib/index.js
CHANGED
|
@@ -10,10 +10,7 @@ Object.defineProperty(exports, "ContentCard", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.default = void 0;
|
|
13
|
-
|
|
14
13
|
var _ContentCard = _interopRequireDefault(require("./ContentCard"));
|
|
15
|
-
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
15
|
var _default = _ContentCard.default;
|
|
19
16
|
exports.default = _default;
|
package/lib/index.native.js
CHANGED
|
@@ -10,10 +10,7 @@ Object.defineProperty(exports, "ContentCard", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.default = void 0;
|
|
13
|
-
|
|
14
13
|
var _ContentCard = _interopRequireDefault(require("./ContentCard"));
|
|
15
|
-
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
15
|
var _default = _ContentCard.default;
|
|
19
16
|
exports.default = _default;
|
|
@@ -21,8 +21,9 @@ export const styles = StyleSheet.create({
|
|
|
21
21
|
informationContainer: {
|
|
22
22
|
width: '65%'
|
|
23
23
|
}
|
|
24
|
-
});
|
|
24
|
+
});
|
|
25
25
|
|
|
26
|
+
// Passes React Native-oriented system props through UDS PressableCardBase
|
|
26
27
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, viewProps]);
|
|
27
28
|
const ContentCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
28
29
|
let {
|
|
@@ -50,13 +51,12 @@ const ContentCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
50
51
|
hrefAttrs,
|
|
51
52
|
rest: unusedRest
|
|
52
53
|
} = hrefAttrsProp.bundle(rest);
|
|
53
|
-
|
|
54
54
|
const getPressableCardTokens = cardState => {
|
|
55
|
-
return {
|
|
55
|
+
return {
|
|
56
|
+
...cardTokens,
|
|
56
57
|
...getTokens(cardState)
|
|
57
58
|
};
|
|
58
59
|
};
|
|
59
|
-
|
|
60
60
|
return /*#__PURE__*/_jsx(PressableCardBase, {
|
|
61
61
|
ref: ref,
|
|
62
62
|
onPress: onPress,
|
|
@@ -67,8 +67,9 @@ const ContentCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
67
67
|
children: cardState => {
|
|
68
68
|
const {
|
|
69
69
|
borderWidth
|
|
70
|
-
} = getPressableCardTokens(cardState);
|
|
70
|
+
} = getPressableCardTokens(cardState);
|
|
71
71
|
|
|
72
|
+
// Stop content jumping around as border size changes
|
|
72
73
|
const borderOffset = borderWidth - generalTokens.borderWidth;
|
|
73
74
|
return /*#__PURE__*/_jsx(Box, {
|
|
74
75
|
horizontal: {
|
|
@@ -110,7 +111,8 @@ const ContentCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
110
111
|
children: linkText
|
|
111
112
|
})]
|
|
112
113
|
}), customImage || /*#__PURE__*/_jsx(ImageBackground, {
|
|
113
|
-
source: imageSrc
|
|
114
|
+
source: imageSrc
|
|
115
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
114
116
|
,
|
|
115
117
|
style: {
|
|
116
118
|
flex: 1,
|
|
@@ -126,53 +128,44 @@ const ContentCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
126
128
|
});
|
|
127
129
|
});
|
|
128
130
|
ContentCard.displayName = 'ContentCard';
|
|
129
|
-
ContentCard.propTypes = {
|
|
130
|
-
|
|
131
|
+
ContentCard.propTypes = {
|
|
132
|
+
...selectedSystemPropTypes,
|
|
131
133
|
/**
|
|
132
134
|
* The URL to be navigated to.
|
|
133
135
|
*/
|
|
134
136
|
href: PropTypes.string,
|
|
135
|
-
|
|
136
137
|
/**
|
|
137
138
|
* Text stating the title or headline.
|
|
138
139
|
*/
|
|
139
140
|
title: PropTypes.string.isRequired,
|
|
140
|
-
|
|
141
141
|
/**
|
|
142
142
|
* Text giving a short content of the card. One paragraph of plain text.
|
|
143
143
|
*/
|
|
144
144
|
content: PropTypes.string.isRequired,
|
|
145
|
-
|
|
146
145
|
/**
|
|
147
146
|
* Text for the ChevronLink.
|
|
148
147
|
*/
|
|
149
148
|
linkText: PropTypes.string.isRequired,
|
|
150
|
-
|
|
151
149
|
/**
|
|
152
150
|
* Optional function to be called on press e.g. for within-page navigation.
|
|
153
151
|
*/
|
|
154
152
|
onPress: PropTypes.func,
|
|
155
|
-
|
|
156
153
|
/**
|
|
157
154
|
* Src of the Image.
|
|
158
155
|
*/
|
|
159
156
|
imageSrc: PropTypes.string,
|
|
160
|
-
|
|
161
157
|
/**
|
|
162
158
|
* Height of the Image.
|
|
163
159
|
*/
|
|
164
160
|
imageHeight: PropTypes.number,
|
|
165
|
-
|
|
166
161
|
/**
|
|
167
162
|
* Width of the Image.
|
|
168
163
|
*/
|
|
169
164
|
imageWidth: PropTypes.number,
|
|
170
|
-
|
|
171
165
|
/**
|
|
172
166
|
* Custom Image to be used instead of the default image.
|
|
173
167
|
*/
|
|
174
168
|
customImage: PropTypes.node,
|
|
175
|
-
|
|
176
169
|
/**
|
|
177
170
|
* Controls if the content is on the right side of the image.
|
|
178
171
|
*/
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"prop-types": "^15.7.2",
|
|
8
|
-
"@telus-uds/components-base": "^1.
|
|
8
|
+
"@telus-uds/components-base": "^1.67.1"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@telus-uds/browserslist-config": "^1.0.4",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"jest-styled-components": "^7.0.8",
|
|
14
14
|
"babel-plugin-react-native-web": "^0.17.0",
|
|
15
15
|
"@testing-library/react-native": "11.0.0",
|
|
16
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
16
|
+
"@telus-uds/system-theme-tokens": "^2.44.1"
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/telus/universal-design-system#readme",
|
|
19
19
|
"license": "MIT",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"standard-engine": {
|
|
45
45
|
"skip": true
|
|
46
46
|
},
|
|
47
|
-
"version": "1.0.
|
|
47
|
+
"version": "1.0.3"
|
|
48
48
|
}
|