@telus-uds/components-web 2.38.0 → 2.39.1
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 +27 -2
- package/lib/Card/Card.js +62 -8
- package/lib/Footnote/Footnote.js +3 -3
- package/lib/Table/Table.js +3 -1
- package/lib/shared/ConditionalWrapper/ConditionalWrapper.js +30 -0
- package/lib/shared/ConditionalWrapper/index.js +10 -0
- package/lib/utils/theming/with-client-theme.js +1 -1
- package/lib-module/Card/Card.js +62 -8
- package/lib-module/Footnote/Footnote.js +3 -3
- package/lib-module/Table/Table.js +3 -1
- package/lib-module/shared/ConditionalWrapper/ConditionalWrapper.js +22 -0
- package/lib-module/shared/ConditionalWrapper/index.js +2 -0
- package/lib-module/utils/theming/with-client-theme.js +1 -1
- package/package.json +3 -3
- package/src/Card/Card.jsx +56 -4
- package/src/Footnote/Footnote.jsx +3 -3
- package/src/Table/Table.jsx +2 -1
- package/src/shared/ConditionalWrapper/ConditionalWrapper.jsx +14 -0
- package/src/shared/ConditionalWrapper/index.js +3 -0
- package/src/utils/theming/with-client-theme.jsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-web
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon,
|
|
3
|
+
This log was last generated on Mon, 26 Aug 2024 16:19:45 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.39.1
|
|
8
|
+
|
|
9
|
+
Mon, 26 Aug 2024 16:19:45 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @telus-uds/components-base to v1.93.0
|
|
14
|
+
|
|
15
|
+
## 2.39.0
|
|
16
|
+
|
|
17
|
+
Thu, 22 Aug 2024 18:25:10 GMT
|
|
18
|
+
|
|
19
|
+
### Minor changes
|
|
20
|
+
|
|
21
|
+
- `Card`: `plain` variant added (35577399+JoshHC@users.noreply.github.com)
|
|
22
|
+
- `FullBleedContent`: add imgCol and position prop to allow for image size adjustment (<tony.eng@telus.com>)
|
|
23
|
+
- `Card`: use ConditionalWrapper on CardContent and FullBleedContent to dynamically set width of full bleed image (<tony.eng@telus.com>)
|
|
24
|
+
- Bump @telus-uds/components-base to v1.92.0
|
|
25
|
+
- Bump @telus-uds/system-theme-tokens to v2.62.0
|
|
26
|
+
|
|
27
|
+
### Patches
|
|
28
|
+
|
|
29
|
+
- `Image`: fix border-radius token override and default border-radius (guillermo.peitzner@telus.com)
|
|
30
|
+
- `Table`: fix unexpected horizontal scrolling on table component (jaime.tuyuc@telus.com)
|
|
31
|
+
|
|
7
32
|
## 2.38.0
|
|
8
33
|
|
|
9
|
-
Mon, 12 Aug 2024 06:
|
|
34
|
+
Mon, 12 Aug 2024 06:35:32 GMT
|
|
10
35
|
|
|
11
36
|
### Minor changes
|
|
12
37
|
|
package/lib/Card/Card.js
CHANGED
|
@@ -7,9 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
+
var _componentsWeb = require("@telus-uds/components-web");
|
|
11
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
12
|
var _CardContent = _interopRequireDefault(require("./CardContent"));
|
|
11
13
|
var _CardFooter = _interopRequireDefault(require("./CardFooter"));
|
|
12
14
|
var _FullBleedContent = _interopRequireWildcard(require("../shared/FullBleedContent"));
|
|
15
|
+
var _ConditionalWrapper = _interopRequireDefault(require("../shared/ConditionalWrapper"));
|
|
13
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
17
|
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); }
|
|
15
18
|
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; }
|
|
@@ -34,6 +37,7 @@ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemP
|
|
|
34
37
|
* - `alt`: alt tag for an image,
|
|
35
38
|
* - `src`: default image source,
|
|
36
39
|
* - `position`: `none`, `bottom`, `left`, `right` or `top`, depending on where you would like your full bleed image to be placed,
|
|
40
|
+
* - `imgCol`: set the span of the image per viewport (based on 12 column value for width of card) when `position` of image is on `left` or `right`
|
|
37
41
|
* - all the props from the `ResponsiveImage` component in case you want that full bleed image to be responsive,
|
|
38
42
|
* - `content`: pass a custom JSX to be used for rendering of the full bleed content (defaults to `ResponsiveImage`
|
|
39
43
|
* receiving the other props).
|
|
@@ -45,6 +49,23 @@ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemP
|
|
|
45
49
|
* ## Accessibility
|
|
46
50
|
* `Card` component accepts all the standard accessibility props.
|
|
47
51
|
*/
|
|
52
|
+
const DynamicWidthContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
53
|
+
displayName: "Card__DynamicWidthContainer",
|
|
54
|
+
componentId: "components-web__sc-1elbtwd-0"
|
|
55
|
+
})(_ref => {
|
|
56
|
+
let {
|
|
57
|
+
width,
|
|
58
|
+
display,
|
|
59
|
+
borderRadius,
|
|
60
|
+
overflow
|
|
61
|
+
} = _ref;
|
|
62
|
+
return {
|
|
63
|
+
width,
|
|
64
|
+
display,
|
|
65
|
+
borderRadius,
|
|
66
|
+
overflow
|
|
67
|
+
};
|
|
68
|
+
});
|
|
48
69
|
const Card = /*#__PURE__*/_react.default.forwardRef(function () {
|
|
49
70
|
let {
|
|
50
71
|
children,
|
|
@@ -70,6 +91,9 @@ const Card = /*#__PURE__*/_react.default.forwardRef(function () {
|
|
|
70
91
|
fullBleedContentPosition,
|
|
71
92
|
fullBleedContentProps
|
|
72
93
|
} = (0, _FullBleedContent.useFullBleedContentProps)(fullBleedContent);
|
|
94
|
+
const {
|
|
95
|
+
imgCol
|
|
96
|
+
} = fullBleedContentProps;
|
|
73
97
|
|
|
74
98
|
// If the card has rounded corners and a full bleed image, we need to apply
|
|
75
99
|
// those corners on the image as well, but partially
|
|
@@ -82,6 +106,25 @@ const Card = /*#__PURE__*/_react.default.forwardRef(function () {
|
|
|
82
106
|
});
|
|
83
107
|
const hasFooter = Boolean(footer);
|
|
84
108
|
const fullBleedBorderRadius = (0, _FullBleedContent.getFullBleedBorderRadius)(borderRadius, fullBleedContentPosition, hasFooter);
|
|
109
|
+
|
|
110
|
+
// takes imgCol from fullBleedContent if present, to dynamically set width of image
|
|
111
|
+
// card content will adapt to the size of image to add up to 100% width of card width
|
|
112
|
+
// pass as props to ConditionalWrapper
|
|
113
|
+
const imgColCurrentViewport = (0, _componentsWeb.useResponsiveProp)(imgCol);
|
|
114
|
+
const maxCol = 12;
|
|
115
|
+
const fullBleedImageWidth = `${imgColCurrentViewport / maxCol * 100}%`;
|
|
116
|
+
const adaptiveContentWidth = `${(maxCol - imgColCurrentViewport) / maxCol * 100}%`;
|
|
117
|
+
const isImageWidthAdjustable = imgCol && (fullBleedContentPosition === 'left' || fullBleedContentPosition === 'right');
|
|
118
|
+
const contentWrapperStyleProps = {
|
|
119
|
+
width: adaptiveContentWidth,
|
|
120
|
+
display: imgColCurrentViewport >= maxCol ? 'none' : undefined
|
|
121
|
+
};
|
|
122
|
+
const imageWrapperStyleProps = {
|
|
123
|
+
width: fullBleedImageWidth,
|
|
124
|
+
borderRadius: imgColCurrentViewport >= maxCol ? borderRadius : undefined,
|
|
125
|
+
overflow: imgColCurrentViewport >= maxCol ? 'hidden' : undefined,
|
|
126
|
+
display: imgColCurrentViewport === 0 ? 'none' : undefined
|
|
127
|
+
};
|
|
85
128
|
const columnFlex = {
|
|
86
129
|
flexGrow: interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? 0 : 1,
|
|
87
130
|
flexShrink: 1,
|
|
@@ -118,14 +161,25 @@ const Card = /*#__PURE__*/_react.default.forwardRef(function () {
|
|
|
118
161
|
alignItems: contentStackAlign
|
|
119
162
|
},
|
|
120
163
|
space: 0,
|
|
121
|
-
children: [children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
children:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
164
|
+
children: [children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConditionalWrapper.default, {
|
|
165
|
+
WrapperComponent: DynamicWidthContainer,
|
|
166
|
+
wrapperProps: contentWrapperStyleProps,
|
|
167
|
+
condition: isImageWidthAdjustable,
|
|
168
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardContent.default, {
|
|
169
|
+
tokens: tokens,
|
|
170
|
+
variant: variant,
|
|
171
|
+
withFooter: hasFooter,
|
|
172
|
+
children: children
|
|
173
|
+
})
|
|
174
|
+
}) : null, fullBleedContentPosition !== 'none' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConditionalWrapper.default, {
|
|
175
|
+
WrapperComponent: DynamicWidthContainer,
|
|
176
|
+
wrapperProps: imageWrapperStyleProps,
|
|
177
|
+
condition: isImageWidthAdjustable,
|
|
178
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullBleedContent.default, {
|
|
179
|
+
borderRadius: fullBleedBorderRadius,
|
|
180
|
+
...fullBleedContentProps,
|
|
181
|
+
position: fullBleedContentPosition
|
|
182
|
+
})
|
|
129
183
|
})]
|
|
130
184
|
}) : null, footer && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardFooter.default, {
|
|
131
185
|
padding: footerPadding,
|
package/lib/Footnote/Footnote.js
CHANGED
|
@@ -152,13 +152,13 @@ const ListItem = /*#__PURE__*/(0, _styledComponents.default)(_OrderedListBase.de
|
|
|
152
152
|
return {
|
|
153
153
|
display: 'list-item',
|
|
154
154
|
'&::marker': {
|
|
155
|
-
fontFamily: '
|
|
155
|
+
fontFamily: 'HNforTELUSSA400normal',
|
|
156
156
|
fontSize: listItemMarkerFontSize,
|
|
157
157
|
lineHeight: listItemMarkerLineHeight,
|
|
158
158
|
textAlign: 'end !important'
|
|
159
159
|
},
|
|
160
160
|
color: listItemColor,
|
|
161
|
-
fontFamily: '
|
|
161
|
+
fontFamily: 'HNforTELUSSA400normal',
|
|
162
162
|
fontSize: listItemFontSize,
|
|
163
163
|
lineHeight: listItemLineHeight,
|
|
164
164
|
paddingLeft: listItemPaddingLeft
|
|
@@ -220,7 +220,7 @@ const StyledCustomContentContainer = /*#__PURE__*/_styledComponents.default.div.
|
|
|
220
220
|
lineHeight: listItemLineHeight,
|
|
221
221
|
paddingLeft: listItemPaddingLeft,
|
|
222
222
|
color: listItemColor,
|
|
223
|
-
fontFamily: '
|
|
223
|
+
fontFamily: 'HNforTELUSSA400normal'
|
|
224
224
|
};
|
|
225
225
|
});
|
|
226
226
|
const usePrevious = value => {
|
package/lib/Table/Table.js
CHANGED
|
@@ -22,9 +22,10 @@ const StyledTable = /*#__PURE__*/_styledComponents.default.table.withConfig({
|
|
|
22
22
|
componentId: "components-web__sc-10d9q3m-1"
|
|
23
23
|
})(["margin:0;padding:0;width:", ";border:", ";"], _ref => {
|
|
24
24
|
let {
|
|
25
|
+
fullWidth,
|
|
25
26
|
tableWidth
|
|
26
27
|
} = _ref;
|
|
27
|
-
return `${tableWidth}px`;
|
|
28
|
+
return fullWidth ? '100%' : `${tableWidth}px`;
|
|
28
29
|
}, props => `${props.borderWidth}px solid ${props.borderColor}`);
|
|
29
30
|
const TableContext = /*#__PURE__*/_react.default.createContext({});
|
|
30
31
|
const useTableContext = () => _react.default.useContext(TableContext);
|
|
@@ -101,6 +102,7 @@ const Table = _ref2 => {
|
|
|
101
102
|
tableWidth: tableWidth,
|
|
102
103
|
cellSpacing: 0,
|
|
103
104
|
ref: tableRef,
|
|
105
|
+
fullWidth: fullWidth,
|
|
104
106
|
...selectProps(rest),
|
|
105
107
|
children: children
|
|
106
108
|
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const ConditionalWrapper = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
children,
|
|
14
|
+
condition,
|
|
15
|
+
WrapperComponent,
|
|
16
|
+
wrapperProps
|
|
17
|
+
} = _ref;
|
|
18
|
+
return condition ? /*#__PURE__*/(0, _jsxRuntime.jsx)(WrapperComponent, {
|
|
19
|
+
...wrapperProps,
|
|
20
|
+
children: children
|
|
21
|
+
}) : children;
|
|
22
|
+
};
|
|
23
|
+
ConditionalWrapper.propTypes = {
|
|
24
|
+
children: _propTypes.default.node,
|
|
25
|
+
condition: _propTypes.default.bool,
|
|
26
|
+
WrapperComponent: _propTypes.default.elementType,
|
|
27
|
+
wrapperProps: _propTypes.default.object
|
|
28
|
+
};
|
|
29
|
+
var _default = ConditionalWrapper;
|
|
30
|
+
exports.default = _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ConditionalWrapper = _interopRequireDefault(require("./ConditionalWrapper"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = _ConditionalWrapper.default;
|
|
10
|
+
exports.default = _default;
|
|
@@ -16,7 +16,7 @@ const withClientTheme = Component => {
|
|
|
16
16
|
variant,
|
|
17
17
|
...props
|
|
18
18
|
} = _ref;
|
|
19
|
-
const theme = (0, _componentsBase.useThemeTokens)(Component.displayName,
|
|
19
|
+
const theme = (0, _componentsBase.useThemeTokens)(Component.displayName, tokenOverrides, variant);
|
|
20
20
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
21
21
|
theme: theme,
|
|
22
22
|
...props
|
package/lib-module/Card/Card.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Card as CardBase, getTokensPropType, paddingProp, responsiveProps, selectSystemProps, StackView, useThemeTokens, useThemeTokensCallback, variantProp, a11yProps, viewProps, PressableCardBase } from '@telus-uds/components-base';
|
|
4
|
+
import { useResponsiveProp } from '@telus-uds/components-web';
|
|
5
|
+
import styled from 'styled-components';
|
|
4
6
|
import CardContent from './CardContent';
|
|
5
7
|
import CardFooter from './CardFooter';
|
|
6
8
|
import FullBleedContent, { getFullBleedBorderRadius, useFullBleedContentProps } from '../shared/FullBleedContent';
|
|
9
|
+
import ConditionalWrapper from '../shared/ConditionalWrapper';
|
|
7
10
|
|
|
8
11
|
// Passes React Native-oriented system props through UDS Card
|
|
9
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -27,6 +30,7 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
27
30
|
* - `alt`: alt tag for an image,
|
|
28
31
|
* - `src`: default image source,
|
|
29
32
|
* - `position`: `none`, `bottom`, `left`, `right` or `top`, depending on where you would like your full bleed image to be placed,
|
|
33
|
+
* - `imgCol`: set the span of the image per viewport (based on 12 column value for width of card) when `position` of image is on `left` or `right`
|
|
30
34
|
* - all the props from the `ResponsiveImage` component in case you want that full bleed image to be responsive,
|
|
31
35
|
* - `content`: pass a custom JSX to be used for rendering of the full bleed content (defaults to `ResponsiveImage`
|
|
32
36
|
* receiving the other props).
|
|
@@ -38,6 +42,23 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
38
42
|
* ## Accessibility
|
|
39
43
|
* `Card` component accepts all the standard accessibility props.
|
|
40
44
|
*/
|
|
45
|
+
const DynamicWidthContainer = /*#__PURE__*/styled.div.withConfig({
|
|
46
|
+
displayName: "Card__DynamicWidthContainer",
|
|
47
|
+
componentId: "components-web__sc-1elbtwd-0"
|
|
48
|
+
})(_ref => {
|
|
49
|
+
let {
|
|
50
|
+
width,
|
|
51
|
+
display,
|
|
52
|
+
borderRadius,
|
|
53
|
+
overflow
|
|
54
|
+
} = _ref;
|
|
55
|
+
return {
|
|
56
|
+
width,
|
|
57
|
+
display,
|
|
58
|
+
borderRadius,
|
|
59
|
+
overflow
|
|
60
|
+
};
|
|
61
|
+
});
|
|
41
62
|
const Card = /*#__PURE__*/React.forwardRef(function () {
|
|
42
63
|
let {
|
|
43
64
|
children,
|
|
@@ -63,6 +84,9 @@ const Card = /*#__PURE__*/React.forwardRef(function () {
|
|
|
63
84
|
fullBleedContentPosition,
|
|
64
85
|
fullBleedContentProps
|
|
65
86
|
} = useFullBleedContentProps(fullBleedContent);
|
|
87
|
+
const {
|
|
88
|
+
imgCol
|
|
89
|
+
} = fullBleedContentProps;
|
|
66
90
|
|
|
67
91
|
// If the card has rounded corners and a full bleed image, we need to apply
|
|
68
92
|
// those corners on the image as well, but partially
|
|
@@ -75,6 +99,25 @@ const Card = /*#__PURE__*/React.forwardRef(function () {
|
|
|
75
99
|
});
|
|
76
100
|
const hasFooter = Boolean(footer);
|
|
77
101
|
const fullBleedBorderRadius = getFullBleedBorderRadius(borderRadius, fullBleedContentPosition, hasFooter);
|
|
102
|
+
|
|
103
|
+
// takes imgCol from fullBleedContent if present, to dynamically set width of image
|
|
104
|
+
// card content will adapt to the size of image to add up to 100% width of card width
|
|
105
|
+
// pass as props to ConditionalWrapper
|
|
106
|
+
const imgColCurrentViewport = useResponsiveProp(imgCol);
|
|
107
|
+
const maxCol = 12;
|
|
108
|
+
const fullBleedImageWidth = `${imgColCurrentViewport / maxCol * 100}%`;
|
|
109
|
+
const adaptiveContentWidth = `${(maxCol - imgColCurrentViewport) / maxCol * 100}%`;
|
|
110
|
+
const isImageWidthAdjustable = imgCol && (fullBleedContentPosition === 'left' || fullBleedContentPosition === 'right');
|
|
111
|
+
const contentWrapperStyleProps = {
|
|
112
|
+
width: adaptiveContentWidth,
|
|
113
|
+
display: imgColCurrentViewport >= maxCol ? 'none' : undefined
|
|
114
|
+
};
|
|
115
|
+
const imageWrapperStyleProps = {
|
|
116
|
+
width: fullBleedImageWidth,
|
|
117
|
+
borderRadius: imgColCurrentViewport >= maxCol ? borderRadius : undefined,
|
|
118
|
+
overflow: imgColCurrentViewport >= maxCol ? 'hidden' : undefined,
|
|
119
|
+
display: imgColCurrentViewport === 0 ? 'none' : undefined
|
|
120
|
+
};
|
|
78
121
|
const columnFlex = {
|
|
79
122
|
flexGrow: interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? 0 : 1,
|
|
80
123
|
flexShrink: 1,
|
|
@@ -111,14 +154,25 @@ const Card = /*#__PURE__*/React.forwardRef(function () {
|
|
|
111
154
|
alignItems: contentStackAlign
|
|
112
155
|
},
|
|
113
156
|
space: 0,
|
|
114
|
-
children: [children ? /*#__PURE__*/_jsx(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
children:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
157
|
+
children: [children ? /*#__PURE__*/_jsx(ConditionalWrapper, {
|
|
158
|
+
WrapperComponent: DynamicWidthContainer,
|
|
159
|
+
wrapperProps: contentWrapperStyleProps,
|
|
160
|
+
condition: isImageWidthAdjustable,
|
|
161
|
+
children: /*#__PURE__*/_jsx(CardContent, {
|
|
162
|
+
tokens: tokens,
|
|
163
|
+
variant: variant,
|
|
164
|
+
withFooter: hasFooter,
|
|
165
|
+
children: children
|
|
166
|
+
})
|
|
167
|
+
}) : null, fullBleedContentPosition !== 'none' && /*#__PURE__*/_jsx(ConditionalWrapper, {
|
|
168
|
+
WrapperComponent: DynamicWidthContainer,
|
|
169
|
+
wrapperProps: imageWrapperStyleProps,
|
|
170
|
+
condition: isImageWidthAdjustable,
|
|
171
|
+
children: /*#__PURE__*/_jsx(FullBleedContent, {
|
|
172
|
+
borderRadius: fullBleedBorderRadius,
|
|
173
|
+
...fullBleedContentProps,
|
|
174
|
+
position: fullBleedContentPosition
|
|
175
|
+
})
|
|
122
176
|
})]
|
|
123
177
|
}) : null, footer && /*#__PURE__*/_jsx(CardFooter, {
|
|
124
178
|
padding: footerPadding,
|
|
@@ -144,13 +144,13 @@ const ListItem = /*#__PURE__*/styled(OrderedListBase.Item).withConfig({
|
|
|
144
144
|
return {
|
|
145
145
|
display: 'list-item',
|
|
146
146
|
'&::marker': {
|
|
147
|
-
fontFamily: '
|
|
147
|
+
fontFamily: 'HNforTELUSSA400normal',
|
|
148
148
|
fontSize: listItemMarkerFontSize,
|
|
149
149
|
lineHeight: listItemMarkerLineHeight,
|
|
150
150
|
textAlign: 'end !important'
|
|
151
151
|
},
|
|
152
152
|
color: listItemColor,
|
|
153
|
-
fontFamily: '
|
|
153
|
+
fontFamily: 'HNforTELUSSA400normal',
|
|
154
154
|
fontSize: listItemFontSize,
|
|
155
155
|
lineHeight: listItemLineHeight,
|
|
156
156
|
paddingLeft: listItemPaddingLeft
|
|
@@ -212,7 +212,7 @@ const StyledCustomContentContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
212
212
|
lineHeight: listItemLineHeight,
|
|
213
213
|
paddingLeft: listItemPaddingLeft,
|
|
214
214
|
color: listItemColor,
|
|
215
|
-
fontFamily: '
|
|
215
|
+
fontFamily: 'HNforTELUSSA400normal'
|
|
216
216
|
};
|
|
217
217
|
});
|
|
218
218
|
const usePrevious = value => {
|
|
@@ -15,9 +15,10 @@ const StyledTable = /*#__PURE__*/styled.table.withConfig({
|
|
|
15
15
|
componentId: "components-web__sc-10d9q3m-1"
|
|
16
16
|
})(["margin:0;padding:0;width:", ";border:", ";"], _ref => {
|
|
17
17
|
let {
|
|
18
|
+
fullWidth,
|
|
18
19
|
tableWidth
|
|
19
20
|
} = _ref;
|
|
20
|
-
return `${tableWidth}px`;
|
|
21
|
+
return fullWidth ? '100%' : `${tableWidth}px`;
|
|
21
22
|
}, props => `${props.borderWidth}px solid ${props.borderColor}`);
|
|
22
23
|
const TableContext = /*#__PURE__*/React.createContext({});
|
|
23
24
|
export const useTableContext = () => React.useContext(TableContext);
|
|
@@ -93,6 +94,7 @@ const Table = _ref2 => {
|
|
|
93
94
|
tableWidth: tableWidth,
|
|
94
95
|
cellSpacing: 0,
|
|
95
96
|
ref: tableRef,
|
|
97
|
+
fullWidth: fullWidth,
|
|
96
98
|
...selectProps(rest),
|
|
97
99
|
children: children
|
|
98
100
|
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
const ConditionalWrapper = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
children,
|
|
7
|
+
condition,
|
|
8
|
+
WrapperComponent,
|
|
9
|
+
wrapperProps
|
|
10
|
+
} = _ref;
|
|
11
|
+
return condition ? /*#__PURE__*/_jsx(WrapperComponent, {
|
|
12
|
+
...wrapperProps,
|
|
13
|
+
children: children
|
|
14
|
+
}) : children;
|
|
15
|
+
};
|
|
16
|
+
ConditionalWrapper.propTypes = {
|
|
17
|
+
children: PropTypes.node,
|
|
18
|
+
condition: PropTypes.bool,
|
|
19
|
+
WrapperComponent: PropTypes.elementType,
|
|
20
|
+
wrapperProps: PropTypes.object
|
|
21
|
+
};
|
|
22
|
+
export default ConditionalWrapper;
|
|
@@ -9,7 +9,7 @@ const withClientTheme = Component => {
|
|
|
9
9
|
variant,
|
|
10
10
|
...props
|
|
11
11
|
} = _ref;
|
|
12
|
-
const theme = useThemeTokens(Component.displayName,
|
|
12
|
+
const theme = useThemeTokens(Component.displayName, tokenOverrides, variant);
|
|
13
13
|
return /*#__PURE__*/_jsx(Component, {
|
|
14
14
|
theme: theme,
|
|
15
15
|
...props
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@gorhom/portal": "^1.0.14",
|
|
8
|
-
"@telus-uds/components-base": "1.
|
|
8
|
+
"@telus-uds/components-base": "1.93.0",
|
|
9
9
|
"@telus-uds/system-constants": "^1.3.0",
|
|
10
10
|
"fscreen": "^1.2.0",
|
|
11
11
|
"lodash.omit": "^4.5.0",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"react-dates": "^21.8.0",
|
|
14
14
|
"react-helmet-async": "^1.3.0",
|
|
15
15
|
"react-moment-proptypes": "^1.8.1",
|
|
16
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
16
|
+
"@telus-uds/system-theme-tokens": "^2.62.0",
|
|
17
17
|
"prop-types": "^15.7.2",
|
|
18
18
|
"lodash.throttle": "^4.1.1",
|
|
19
19
|
"react-youtube": "^10.1.0",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"skip": true
|
|
84
84
|
},
|
|
85
85
|
"types": "types/index.d.ts",
|
|
86
|
-
"version": "2.
|
|
86
|
+
"version": "2.39.1"
|
|
87
87
|
}
|
package/src/Card/Card.jsx
CHANGED
|
@@ -14,12 +14,15 @@ import {
|
|
|
14
14
|
viewProps,
|
|
15
15
|
PressableCardBase
|
|
16
16
|
} from '@telus-uds/components-base'
|
|
17
|
+
import { useResponsiveProp } from '@telus-uds/components-web'
|
|
18
|
+
import styled from 'styled-components'
|
|
17
19
|
import CardContent from './CardContent'
|
|
18
20
|
import CardFooter from './CardFooter'
|
|
19
21
|
import FullBleedContent, {
|
|
20
22
|
getFullBleedBorderRadius,
|
|
21
23
|
useFullBleedContentProps
|
|
22
24
|
} from '../shared/FullBleedContent'
|
|
25
|
+
import ConditionalWrapper from '../shared/ConditionalWrapper'
|
|
23
26
|
|
|
24
27
|
// Passes React Native-oriented system props through UDS Card
|
|
25
28
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
|
|
@@ -41,6 +44,7 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
41
44
|
* - `alt`: alt tag for an image,
|
|
42
45
|
* - `src`: default image source,
|
|
43
46
|
* - `position`: `none`, `bottom`, `left`, `right` or `top`, depending on where you would like your full bleed image to be placed,
|
|
47
|
+
* - `imgCol`: set the span of the image per viewport (based on 12 column value for width of card) when `position` of image is on `left` or `right`
|
|
44
48
|
* - all the props from the `ResponsiveImage` component in case you want that full bleed image to be responsive,
|
|
45
49
|
* - `content`: pass a custom JSX to be used for rendering of the full bleed content (defaults to `ResponsiveImage`
|
|
46
50
|
* receiving the other props).
|
|
@@ -52,6 +56,13 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
52
56
|
* ## Accessibility
|
|
53
57
|
* `Card` component accepts all the standard accessibility props.
|
|
54
58
|
*/
|
|
59
|
+
const DynamicWidthContainer = styled.div(({ width, display, borderRadius, overflow }) => ({
|
|
60
|
+
width,
|
|
61
|
+
display,
|
|
62
|
+
borderRadius,
|
|
63
|
+
overflow
|
|
64
|
+
}))
|
|
65
|
+
|
|
55
66
|
const Card = React.forwardRef(
|
|
56
67
|
(
|
|
57
68
|
{
|
|
@@ -78,6 +89,8 @@ const Card = React.forwardRef(
|
|
|
78
89
|
fullBleedContentProps
|
|
79
90
|
} = useFullBleedContentProps(fullBleedContent)
|
|
80
91
|
|
|
92
|
+
const { imgCol } = fullBleedContentProps
|
|
93
|
+
|
|
81
94
|
// If the card has rounded corners and a full bleed image, we need to apply
|
|
82
95
|
// those corners on the image as well, but partially
|
|
83
96
|
const { borderRadius } = useThemeTokens('Card', tokens, variant)
|
|
@@ -92,6 +105,29 @@ const Card = React.forwardRef(
|
|
|
92
105
|
hasFooter
|
|
93
106
|
)
|
|
94
107
|
|
|
108
|
+
// takes imgCol from fullBleedContent if present, to dynamically set width of image
|
|
109
|
+
// card content will adapt to the size of image to add up to 100% width of card width
|
|
110
|
+
// pass as props to ConditionalWrapper
|
|
111
|
+
const imgColCurrentViewport = useResponsiveProp(imgCol)
|
|
112
|
+
const maxCol = 12
|
|
113
|
+
const fullBleedImageWidth = `${(imgColCurrentViewport / maxCol) * 100}%`
|
|
114
|
+
const adaptiveContentWidth = `${((maxCol - imgColCurrentViewport) / maxCol) * 100}%`
|
|
115
|
+
|
|
116
|
+
const isImageWidthAdjustable =
|
|
117
|
+
imgCol && (fullBleedContentPosition === 'left' || fullBleedContentPosition === 'right')
|
|
118
|
+
|
|
119
|
+
const contentWrapperStyleProps = {
|
|
120
|
+
width: adaptiveContentWidth,
|
|
121
|
+
display: imgColCurrentViewport >= maxCol ? 'none' : undefined
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const imageWrapperStyleProps = {
|
|
125
|
+
width: fullBleedImageWidth,
|
|
126
|
+
borderRadius: imgColCurrentViewport >= maxCol ? borderRadius : undefined,
|
|
127
|
+
overflow: imgColCurrentViewport >= maxCol ? 'hidden' : undefined,
|
|
128
|
+
display: imgColCurrentViewport === 0 ? 'none' : undefined
|
|
129
|
+
}
|
|
130
|
+
|
|
95
131
|
const columnFlex = {
|
|
96
132
|
flexGrow: interactiveCard?.body ? 0 : 1,
|
|
97
133
|
flexShrink: 1,
|
|
@@ -128,12 +164,28 @@ const Card = React.forwardRef(
|
|
|
128
164
|
space={0}
|
|
129
165
|
>
|
|
130
166
|
{children ? (
|
|
131
|
-
<
|
|
132
|
-
{
|
|
133
|
-
|
|
167
|
+
<ConditionalWrapper
|
|
168
|
+
WrapperComponent={DynamicWidthContainer}
|
|
169
|
+
wrapperProps={contentWrapperStyleProps}
|
|
170
|
+
condition={isImageWidthAdjustable}
|
|
171
|
+
>
|
|
172
|
+
<CardContent tokens={tokens} variant={variant} withFooter={hasFooter}>
|
|
173
|
+
{children}
|
|
174
|
+
</CardContent>
|
|
175
|
+
</ConditionalWrapper>
|
|
134
176
|
) : null}
|
|
135
177
|
{fullBleedContentPosition !== 'none' && (
|
|
136
|
-
<
|
|
178
|
+
<ConditionalWrapper
|
|
179
|
+
WrapperComponent={DynamicWidthContainer}
|
|
180
|
+
wrapperProps={imageWrapperStyleProps}
|
|
181
|
+
condition={isImageWidthAdjustable}
|
|
182
|
+
>
|
|
183
|
+
<FullBleedContent
|
|
184
|
+
borderRadius={fullBleedBorderRadius}
|
|
185
|
+
{...fullBleedContentProps}
|
|
186
|
+
position={fullBleedContentPosition}
|
|
187
|
+
/>
|
|
188
|
+
</ConditionalWrapper>
|
|
137
189
|
)}
|
|
138
190
|
</StackView>
|
|
139
191
|
) : null}
|
|
@@ -123,13 +123,13 @@ const ListItem = styled(OrderedListBase.Item)(
|
|
|
123
123
|
}) => ({
|
|
124
124
|
display: 'list-item',
|
|
125
125
|
'&::marker': {
|
|
126
|
-
fontFamily: '
|
|
126
|
+
fontFamily: 'HNforTELUSSA400normal',
|
|
127
127
|
fontSize: listItemMarkerFontSize,
|
|
128
128
|
lineHeight: listItemMarkerLineHeight,
|
|
129
129
|
textAlign: 'end !important'
|
|
130
130
|
},
|
|
131
131
|
color: listItemColor,
|
|
132
|
-
fontFamily: '
|
|
132
|
+
fontFamily: 'HNforTELUSSA400normal',
|
|
133
133
|
fontSize: listItemFontSize,
|
|
134
134
|
lineHeight: listItemLineHeight,
|
|
135
135
|
paddingLeft: listItemPaddingLeft
|
|
@@ -176,7 +176,7 @@ const StyledCustomContentContainer = styled.div(
|
|
|
176
176
|
lineHeight: listItemLineHeight,
|
|
177
177
|
paddingLeft: listItemPaddingLeft,
|
|
178
178
|
color: listItemColor,
|
|
179
|
-
fontFamily: '
|
|
179
|
+
fontFamily: 'HNforTELUSSA400normal'
|
|
180
180
|
})
|
|
181
181
|
)
|
|
182
182
|
|
package/src/Table/Table.jsx
CHANGED
|
@@ -20,7 +20,7 @@ const StyledContainer = styled.div`
|
|
|
20
20
|
const StyledTable = styled.table`
|
|
21
21
|
margin: 0;
|
|
22
22
|
padding: 0;
|
|
23
|
-
width: ${({ tableWidth }) => `${tableWidth}px`};
|
|
23
|
+
width: ${({ fullWidth, tableWidth }) => (fullWidth ? '100%' : `${tableWidth}px`)};
|
|
24
24
|
border: ${(props) => `${props.borderWidth}px solid ${props.borderColor}`};
|
|
25
25
|
`
|
|
26
26
|
|
|
@@ -94,6 +94,7 @@ const Table = ({
|
|
|
94
94
|
tableWidth={tableWidth}
|
|
95
95
|
cellSpacing={0}
|
|
96
96
|
ref={tableRef}
|
|
97
|
+
fullWidth={fullWidth}
|
|
97
98
|
{...selectProps(rest)}
|
|
98
99
|
>
|
|
99
100
|
{children}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
|
|
4
|
+
const ConditionalWrapper = ({ children, condition, WrapperComponent, wrapperProps }) =>
|
|
5
|
+
condition ? <WrapperComponent {...wrapperProps}>{children}</WrapperComponent> : children
|
|
6
|
+
|
|
7
|
+
ConditionalWrapper.propTypes = {
|
|
8
|
+
children: PropTypes.node,
|
|
9
|
+
condition: PropTypes.bool,
|
|
10
|
+
WrapperComponent: PropTypes.elementType,
|
|
11
|
+
wrapperProps: PropTypes.object
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default ConditionalWrapper
|
|
@@ -5,7 +5,7 @@ import { getTokensPropType, useThemeTokens } from '@telus-uds/components-base'
|
|
|
5
5
|
|
|
6
6
|
const withClientTheme = (Component) => {
|
|
7
7
|
const UdsStyledComponent = ({ tokens: tokenOverrides, variant, ...props }) => {
|
|
8
|
-
const theme = useThemeTokens(Component.displayName,
|
|
8
|
+
const theme = useThemeTokens(Component.displayName, tokenOverrides, variant)
|
|
9
9
|
return <Component theme={theme} {...props} />
|
|
10
10
|
}
|
|
11
11
|
|