@telus-uds/components-web 2.1.0 → 2.3.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 CHANGED
@@ -1,12 +1,41 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- This log was last generated on Wed, 24 May 2023 01:36:34 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 27 May 2023 00:37:34 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.3.0
8
+
9
+ Sat, 27 May 2023 00:37:34 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - chore: test update for list (samuraix221@hotmail.com)
14
+ - Bump @telus-uds/components-base to v1.45.0
15
+ - Bump @telus-uds/system-theme-tokens to v2.28.0
16
+
17
+ ### Patches
18
+
19
+ - Fix an issue where some tokens might not work on `Card` (shahzaibkhalidmalik@outlook.com)
20
+
21
+ ## 2.2.0
22
+
23
+ Wed, 24 May 2023 23:46:34 GMT
24
+
25
+ ### Minor changes
26
+
27
+ - Add `onStartVideo` and `onSelectVideo` for `VideoPicker` (shahzaibkhalidmalik@outlook.com)
28
+ - Added cellMinWidth token to Table (wlsdud194@hotmail.com)
29
+ - Bump @telus-uds/components-base to v1.44.0
30
+ - Bump @telus-uds/system-theme-tokens to v2.27.0
31
+
32
+ ### Patches
33
+
34
+ - Fix an issue where `Card` may show double spacing when custom padding tokens are passed (shahzaibkhalidmalik@outlook.com)
35
+
7
36
  ## 2.1.0
8
37
 
9
- Wed, 24 May 2023 01:36:34 GMT
38
+ Wed, 24 May 2023 01:43:02 GMT
10
39
 
11
40
  ### Minor changes
12
41
 
@@ -3254,6 +3254,13 @@
3254
3254
  "required": false,
3255
3255
  "description": "Defines the text alignment within the cell"
3256
3256
  },
3257
+ "tokens": {
3258
+ "type": {
3259
+ "name": "object"
3260
+ },
3261
+ "required": false,
3262
+ "description": ""
3263
+ },
3257
3264
  "children": {
3258
3265
  "type": {
3259
3266
  "name": "node"
@@ -3758,6 +3765,28 @@
3758
3765
  "required": false,
3759
3766
  "description": "Id of the currently selected video (defaults to the first video if not set)."
3760
3767
  },
3768
+ "onStartVideo": {
3769
+ "defaultValue": {
3770
+ "value": "() => {}",
3771
+ "computed": false
3772
+ },
3773
+ "type": {
3774
+ "name": "func"
3775
+ },
3776
+ "required": false,
3777
+ "description": "Callback function trigerred when the video player starts playing video.\n@param {object} video - The video object that is playing."
3778
+ },
3779
+ "onSelectVideo": {
3780
+ "defaultValue": {
3781
+ "value": "() => {}",
3782
+ "computed": false
3783
+ },
3784
+ "type": {
3785
+ "name": "func"
3786
+ },
3787
+ "required": false,
3788
+ "description": "Callback function trigerred when a video is selected from the thumbnail list.\n@param {object} video - The video object that is selected."
3789
+ },
3761
3790
  "frame": {
3762
3791
  "type": {
3763
3792
  "name": "bool"
@@ -10077,7 +10106,14 @@
10077
10106
  "name": "custom",
10078
10107
  "raw": {
10079
10108
  "space": "integer",
10080
- "fieldSpace": "integer"
10109
+ "fieldSpace": "integer",
10110
+ "showIcon": "show",
10111
+ "outlineWidth": "border",
10112
+ "borderBottomLeftRadius": "radius",
10113
+ "borderBottomRightRadius": "radius",
10114
+ "borderTopLeftRadius": "radius",
10115
+ "borderTopRightRadius": "radius",
10116
+ "outlineOffset": "size"
10081
10117
  }
10082
10118
  },
10083
10119
  "required": false,
package/lib/Card/Card.js CHANGED
@@ -26,7 +26,26 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
26
26
  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
27
 
28
28
  /* eslint-disable react/require-default-props */
29
- // Passes React Native-oriented system props through UDS Card
29
+ const selectCardBaseTokens = _ref => {
30
+ let {
31
+ backgroundColor,
32
+ borderColor,
33
+ borderWidth,
34
+ borderRadius,
35
+ shadow,
36
+ minWidth
37
+ } = _ref;
38
+ return {
39
+ backgroundColor,
40
+ borderColor,
41
+ borderWidth,
42
+ borderRadius,
43
+ shadow,
44
+ minWidth
45
+ };
46
+ }; // Passes React Native-oriented system props through UDS Card
47
+
48
+
30
49
  const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_componentsBase.a11yProps, _componentsBase.viewProps]);
31
50
  /**
32
51
  * A basic card component, unstyled by default.
@@ -81,11 +100,9 @@ const Card = /*#__PURE__*/(0, _react.forwardRef)(function () {
81
100
  } = (0, _FullBleedContent.useFullBleedContentProps)(fullBleedContent); // If the card has rounded corners and a full bleed image, we need to apply
82
101
  // those corners on the image as well, but partially
83
102
 
84
- const {
85
- borderRadius
86
- } = (0, _componentsBase.useThemeTokens)('Card', tokens, variant);
103
+ const cardTokens = (0, _componentsBase.useThemeTokens)('Card', tokens, variant);
87
104
  const hasFooter = Boolean(footer);
88
- const fullBleedBorderRadius = (0, _FullBleedContent.getFullBleedBorderRadius)(borderRadius, fullBleedContentPosition, hasFooter); // Make multiple cards in a row have equal heights with even space between content items
105
+ const fullBleedBorderRadius = (0, _FullBleedContent.getFullBleedBorderRadius)(cardTokens === null || cardTokens === void 0 ? void 0 : cardTokens.borderRadius, fullBleedContentPosition, hasFooter); // Make multiple cards in a row have equal heights with even space between content items
89
106
 
90
107
  const columnFlex = {
91
108
  flexGrow: 1,
@@ -97,7 +114,7 @@ const Card = /*#__PURE__*/(0, _react.forwardRef)(function () {
97
114
  variant: { ...variant,
98
115
  padding: 'custom'
99
116
  },
100
- tokens: tokens,
117
+ tokens: selectCardBaseTokens(cardTokens),
101
118
  ...selectProps(rest),
102
119
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
103
120
  space: 0,
@@ -26,20 +26,18 @@ const CardContentContainer = /*#__PURE__*/_styledComponents.default.div.withConf
26
26
  componentId: "components-web__sc-1k2501q-0"
27
27
  })(_ref => {
28
28
  let {
29
- backgroundColor,
30
29
  borderRadius,
31
30
  paddingBottom,
32
31
  paddingLeft,
33
32
  paddingRight,
34
33
  paddingTop,
35
34
  withFooter,
36
- contentAlignItem: alignItem,
35
+ contentAlignItems: alignItems,
37
36
  contentFlexGrow: flexGrow,
38
37
  contentFlexShrink: flexShrink,
39
38
  contentJustifyContent: justifyContent
40
39
  } = _ref;
41
40
  return {
42
- backgroundColor,
43
41
  // We need to make sure to have sharp corners on the bottom
44
42
  // if the card has a footer
45
43
  borderBottomLeftRadius: withFooter ? 0 : borderRadius,
@@ -52,7 +50,7 @@ const CardContentContainer = /*#__PURE__*/_styledComponents.default.div.withConf
52
50
  paddingTop,
53
51
  display: 'flex',
54
52
  flexDirection: 'column',
55
- alignItem,
53
+ alignItems,
56
54
  flexGrow,
57
55
  flexShrink,
58
56
  justifyContent
package/lib/Table/Cell.js CHANGED
@@ -37,9 +37,10 @@ const sharedStyles = /*#__PURE__*/(0, _styledComponents.css)(["", ""], _ref2 =>
37
37
  cellPaddingTop,
38
38
  cellPaddingRight,
39
39
  cellPaddingBottom,
40
- cellPaddingLeft
40
+ cellPaddingLeft,
41
+ cellMinWidth
41
42
  } = _ref2;
42
- return (0, _styledComponents.css)(["", ";box-shadow:inset 0 -1px 0 ", ";text-align:", ";padding:", "px ", "px ", "px ", "px;"], isSticky ? stickyStyles : undefined, cellBoxShadowColor, align, cellPaddingTop, cellPaddingRight, cellPaddingBottom, cellPaddingLeft);
43
+ return (0, _styledComponents.css)(["", ";box-shadow:inset 0 -1px 0 ", ";text-align:", ";min-width:", "px;padding:", "px ", "px ", "px ", "px;"], isSticky ? stickyStyles : undefined, cellBoxShadowColor, align, cellMinWidth, cellPaddingTop, cellPaddingRight, cellPaddingBottom, cellPaddingLeft);
43
44
  });
44
45
 
45
46
  const StyledHeading = /*#__PURE__*/_styledComponents.default.th.withConfig({
@@ -90,15 +91,20 @@ const Cell = _ref7 => {
90
91
  children,
91
92
  type = 'default',
92
93
  isFirstInRow,
93
- align = 'left'
94
+ align = 'left',
95
+ tokens: cellTokens
94
96
  } = _ref7;
95
97
  const {
96
98
  text,
97
99
  isScrollable: isTableScrollable,
98
100
  variant,
99
- tokens
101
+ tokens: tableTokens
100
102
  } = (0, _Table.useTableContext)();
103
+ const themeTokens = { ...tableTokens,
104
+ ...cellTokens
105
+ };
101
106
  const {
107
+ cellMinWidth,
102
108
  cellHeadingBackground,
103
109
  cellHeadingBoxShadowColor,
104
110
  cellBoxShadowColor,
@@ -113,10 +119,11 @@ const Cell = _ref7 => {
113
119
  fontName,
114
120
  fontWeight,
115
121
  fontSize
116
- } = (0, _componentsBase.useThemeTokens)('Table', tokens, variant);
122
+ } = (0, _componentsBase.useThemeTokens)('Table', themeTokens, variant);
117
123
  const sharedProps = {
118
124
  align,
119
125
  isSticky: isTableScrollable && isFirstInRow,
126
+ cellMinWidth,
120
127
  cellStickyShadow,
121
128
  cellPaddingTop,
122
129
  cellPaddingRight,
@@ -192,6 +199,7 @@ const Cell = _ref7 => {
192
199
  };
193
200
 
194
201
  Cell.propTypes = {
202
+ tokens: _propTypes.default.object,
195
203
  children: _propTypes.default.node,
196
204
 
197
205
  /**
@@ -95,6 +95,8 @@ const VideoPicker = _ref6 => {
95
95
  videoList = [],
96
96
  selectedVideo = (_videoList$ = videoList[0]) === null || _videoList$ === void 0 ? void 0 : _videoList$.videoId,
97
97
  frame,
98
+ onStartVideo = () => {},
99
+ onSelectVideo = () => {},
98
100
  ...rest
99
101
  } = _ref6;
100
102
  const viewport = (0, _componentsBase.useViewport)();
@@ -116,7 +118,10 @@ const VideoPicker = _ref6 => {
116
118
  video: video,
117
119
  videoPlayerRef: videoPlayerRef,
118
120
  selectedVideoId: currentVideoId,
119
- onSelectVideo: current => setCurrentVideoId(current.videoId),
121
+ onSelectVideo: current => {
122
+ setCurrentVideoId(current.videoId);
123
+ onSelectVideo(current);
124
+ },
120
125
  layout: !hasSlider ? 'horizontal' : 'vertical',
121
126
  index: index,
122
127
  isFramed: isFramed
@@ -142,7 +147,8 @@ const VideoPicker = _ref6 => {
142
147
  isFramed: isFramed,
143
148
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoPickerPlayer.default, {
144
149
  video: currentVideo,
145
- videoPlayerRef: videoPlayerRef
150
+ videoPlayerRef: videoPlayerRef,
151
+ onStartVideo: onStartVideo
146
152
  })
147
153
  }), hasSlider ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoSlider.default, {
148
154
  children: listElements
@@ -171,7 +177,19 @@ VideoPicker.propTypes = { ...selectedSystemPropTypes,
171
177
  /**
172
178
  * Use to display the picker in a container and the playlist as a sidebar (only available for breakpoints LG and larger)
173
179
  */
174
- frame: _propTypes.default.bool
180
+ frame: _propTypes.default.bool,
181
+
182
+ /**
183
+ * Callback function trigerred when the video player starts playing video.
184
+ * @param {object} video - The video object that is playing.
185
+ */
186
+ onStartVideo: _propTypes.default.func,
187
+
188
+ /**
189
+ * Callback function trigerred when a video is selected from the thumbnail list.
190
+ * @param {object} video - The video object that is selected.
191
+ */
192
+ onSelectVideo: _propTypes.default.func
175
193
  };
176
194
  var _default = VideoPicker;
177
195
  exports.default = _default;
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _componentsBase = require("@telus-uds/components-base");
11
11
 
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
12
14
  var _WebVideo = _interopRequireDefault(require("../WebVideo/WebVideo"));
13
15
 
14
16
  var _videoPropType = require("./videoPropType");
@@ -20,7 +22,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
22
  const VideoPickerPlayer = _ref => {
21
23
  let {
22
24
  video = {},
23
- videoPlayerRef
25
+ videoPlayerRef,
26
+ onStartVideo = () => {}
24
27
  } = _ref;
25
28
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
26
29
  space: 3,
@@ -29,7 +32,8 @@ const VideoPickerPlayer = _ref => {
29
32
  },
30
33
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
31
34
  ref: videoPlayerRef,
32
- children: video.videoId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_WebVideo.default, { ...video
35
+ children: video.videoId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_WebVideo.default, { ...video,
36
+ onStart: () => onStartVideo(video)
33
37
  })
34
38
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
35
39
  space: 2,
@@ -48,7 +52,8 @@ const VideoPickerPlayer = _ref => {
48
52
 
49
53
  VideoPickerPlayer.propTypes = {
50
54
  video: _videoPropType.VideoPropType,
51
- videoPlayerRef: _videoPropType.RefPropType
55
+ videoPlayerRef: _videoPropType.RefPropType,
56
+ onStartVideo: _propTypes.default.func
52
57
  };
53
58
  var _default = VideoPickerPlayer;
54
59
  exports.default = _default;
@@ -4,10 +4,30 @@ import PropTypes from 'prop-types';
4
4
  import { Card as CardBase, getTokensPropType, paddingProp, responsiveProps, selectSystemProps, StackView, useThemeTokens, variantProp, a11yProps, viewProps } from '@telus-uds/components-base';
5
5
  import CardContent from './CardContent';
6
6
  import CardFooter from './CardFooter';
7
- import FullBleedContent, { getFullBleedBorderRadius, useFullBleedContentProps } from '../shared/FullBleedContent'; // Passes React Native-oriented system props through UDS Card
8
-
7
+ import FullBleedContent, { getFullBleedBorderRadius, useFullBleedContentProps } from '../shared/FullBleedContent';
9
8
  import { jsx as _jsx } from "react/jsx-runtime";
10
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
+
11
+ const selectCardBaseTokens = _ref => {
12
+ let {
13
+ backgroundColor,
14
+ borderColor,
15
+ borderWidth,
16
+ borderRadius,
17
+ shadow,
18
+ minWidth
19
+ } = _ref;
20
+ return {
21
+ backgroundColor,
22
+ borderColor,
23
+ borderWidth,
24
+ borderRadius,
25
+ shadow,
26
+ minWidth
27
+ };
28
+ }; // Passes React Native-oriented system props through UDS Card
29
+
30
+
11
31
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
12
32
  /**
13
33
  * A basic card component, unstyled by default.
@@ -62,11 +82,9 @@ const Card = /*#__PURE__*/forwardRef(function () {
62
82
  } = useFullBleedContentProps(fullBleedContent); // If the card has rounded corners and a full bleed image, we need to apply
63
83
  // those corners on the image as well, but partially
64
84
 
65
- const {
66
- borderRadius
67
- } = useThemeTokens('Card', tokens, variant);
85
+ const cardTokens = useThemeTokens('Card', tokens, variant);
68
86
  const hasFooter = Boolean(footer);
69
- const fullBleedBorderRadius = getFullBleedBorderRadius(borderRadius, fullBleedContentPosition, hasFooter); // Make multiple cards in a row have equal heights with even space between content items
87
+ const fullBleedBorderRadius = getFullBleedBorderRadius(cardTokens === null || cardTokens === void 0 ? void 0 : cardTokens.borderRadius, fullBleedContentPosition, hasFooter); // Make multiple cards in a row have equal heights with even space between content items
70
88
 
71
89
  const columnFlex = {
72
90
  flexGrow: 1,
@@ -78,7 +96,7 @@ const Card = /*#__PURE__*/forwardRef(function () {
78
96
  variant: { ...variant,
79
97
  padding: 'custom'
80
98
  },
81
- tokens: tokens,
99
+ tokens: selectCardBaseTokens(cardTokens),
82
100
  ...selectProps(rest),
83
101
  children: /*#__PURE__*/_jsxs(StackView, {
84
102
  space: 0,
@@ -10,20 +10,18 @@ const CardContentContainer = /*#__PURE__*/styled.div.withConfig({
10
10
  componentId: "components-web__sc-1k2501q-0"
11
11
  })(_ref => {
12
12
  let {
13
- backgroundColor,
14
13
  borderRadius,
15
14
  paddingBottom,
16
15
  paddingLeft,
17
16
  paddingRight,
18
17
  paddingTop,
19
18
  withFooter,
20
- contentAlignItem: alignItem,
19
+ contentAlignItems: alignItems,
21
20
  contentFlexGrow: flexGrow,
22
21
  contentFlexShrink: flexShrink,
23
22
  contentJustifyContent: justifyContent
24
23
  } = _ref;
25
24
  return {
26
- backgroundColor,
27
25
  // We need to make sure to have sharp corners on the bottom
28
26
  // if the card has a footer
29
27
  borderBottomLeftRadius: withFooter ? 0 : borderRadius,
@@ -36,7 +34,7 @@ const CardContentContainer = /*#__PURE__*/styled.div.withConfig({
36
34
  paddingTop,
37
35
  display: 'flex',
38
36
  flexDirection: 'column',
39
- alignItem,
37
+ alignItems,
40
38
  flexGrow,
41
39
  flexShrink,
42
40
  justifyContent
@@ -18,9 +18,10 @@ const sharedStyles = /*#__PURE__*/css(["", ""], _ref2 => {
18
18
  cellPaddingTop,
19
19
  cellPaddingRight,
20
20
  cellPaddingBottom,
21
- cellPaddingLeft
21
+ cellPaddingLeft,
22
+ cellMinWidth
22
23
  } = _ref2;
23
- return css(["", ";box-shadow:inset 0 -1px 0 ", ";text-align:", ";padding:", "px ", "px ", "px ", "px;"], isSticky ? stickyStyles : undefined, cellBoxShadowColor, align, cellPaddingTop, cellPaddingRight, cellPaddingBottom, cellPaddingLeft);
24
+ return css(["", ";box-shadow:inset 0 -1px 0 ", ";text-align:", ";min-width:", "px;padding:", "px ", "px ", "px ", "px;"], isSticky ? stickyStyles : undefined, cellBoxShadowColor, align, cellMinWidth, cellPaddingTop, cellPaddingRight, cellPaddingBottom, cellPaddingLeft);
24
25
  });
25
26
  const StyledHeading = /*#__PURE__*/styled.th.withConfig({
26
27
  displayName: "Cell__StyledHeading",
@@ -67,15 +68,20 @@ const Cell = _ref7 => {
67
68
  children,
68
69
  type = 'default',
69
70
  isFirstInRow,
70
- align = 'left'
71
+ align = 'left',
72
+ tokens: cellTokens
71
73
  } = _ref7;
72
74
  const {
73
75
  text,
74
76
  isScrollable: isTableScrollable,
75
77
  variant,
76
- tokens
78
+ tokens: tableTokens
77
79
  } = useTableContext();
80
+ const themeTokens = { ...tableTokens,
81
+ ...cellTokens
82
+ };
78
83
  const {
84
+ cellMinWidth,
79
85
  cellHeadingBackground,
80
86
  cellHeadingBoxShadowColor,
81
87
  cellBoxShadowColor,
@@ -90,10 +96,11 @@ const Cell = _ref7 => {
90
96
  fontName,
91
97
  fontWeight,
92
98
  fontSize
93
- } = useThemeTokens('Table', tokens, variant);
99
+ } = useThemeTokens('Table', themeTokens, variant);
94
100
  const sharedProps = {
95
101
  align,
96
102
  isSticky: isTableScrollable && isFirstInRow,
103
+ cellMinWidth,
97
104
  cellStickyShadow,
98
105
  cellPaddingTop,
99
106
  cellPaddingRight,
@@ -169,6 +176,7 @@ const Cell = _ref7 => {
169
176
  };
170
177
 
171
178
  Cell.propTypes = {
179
+ tokens: PropTypes.object,
172
180
  children: PropTypes.node,
173
181
 
174
182
  /**
@@ -70,6 +70,8 @@ const VideoPicker = _ref6 => {
70
70
  videoList = [],
71
71
  selectedVideo = (_videoList$ = videoList[0]) === null || _videoList$ === void 0 ? void 0 : _videoList$.videoId,
72
72
  frame,
73
+ onStartVideo = () => {},
74
+ onSelectVideo = () => {},
73
75
  ...rest
74
76
  } = _ref6;
75
77
  const viewport = useViewport();
@@ -91,7 +93,10 @@ const VideoPicker = _ref6 => {
91
93
  video: video,
92
94
  videoPlayerRef: videoPlayerRef,
93
95
  selectedVideoId: currentVideoId,
94
- onSelectVideo: current => setCurrentVideoId(current.videoId),
96
+ onSelectVideo: current => {
97
+ setCurrentVideoId(current.videoId);
98
+ onSelectVideo(current);
99
+ },
95
100
  layout: !hasSlider ? 'horizontal' : 'vertical',
96
101
  index: index,
97
102
  isFramed: isFramed
@@ -117,7 +122,8 @@ const VideoPicker = _ref6 => {
117
122
  isFramed: isFramed,
118
123
  children: /*#__PURE__*/_jsx(VideoPickerPlayer, {
119
124
  video: currentVideo,
120
- videoPlayerRef: videoPlayerRef
125
+ videoPlayerRef: videoPlayerRef,
126
+ onStartVideo: onStartVideo
121
127
  })
122
128
  }), hasSlider ? /*#__PURE__*/_jsx(VideoSlider, {
123
129
  children: listElements
@@ -146,6 +152,18 @@ VideoPicker.propTypes = { ...selectedSystemPropTypes,
146
152
  /**
147
153
  * Use to display the picker in a container and the playlist as a sidebar (only available for breakpoints LG and larger)
148
154
  */
149
- frame: PropTypes.bool
155
+ frame: PropTypes.bool,
156
+
157
+ /**
158
+ * Callback function trigerred when the video player starts playing video.
159
+ * @param {object} video - The video object that is playing.
160
+ */
161
+ onStartVideo: PropTypes.func,
162
+
163
+ /**
164
+ * Callback function trigerred when a video is selected from the thumbnail list.
165
+ * @param {object} video - The video object that is selected.
166
+ */
167
+ onSelectVideo: PropTypes.func
150
168
  };
151
169
  export default VideoPicker;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { StackView, Typography } from '@telus-uds/components-base';
3
+ import PropTypes from 'prop-types';
3
4
  import WebVideo from '../WebVideo/WebVideo';
4
5
  import { VideoPropType, RefPropType } from './videoPropType';
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -8,7 +9,8 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
8
9
  const VideoPickerPlayer = _ref => {
9
10
  let {
10
11
  video = {},
11
- videoPlayerRef
12
+ videoPlayerRef,
13
+ onStartVideo = () => {}
12
14
  } = _ref;
13
15
  return /*#__PURE__*/_jsxs(StackView, {
14
16
  space: 3,
@@ -17,7 +19,8 @@ const VideoPickerPlayer = _ref => {
17
19
  },
18
20
  children: [/*#__PURE__*/_jsx("div", {
19
21
  ref: videoPlayerRef,
20
- children: video.videoId && /*#__PURE__*/_jsx(WebVideo, { ...video
22
+ children: video.videoId && /*#__PURE__*/_jsx(WebVideo, { ...video,
23
+ onStart: () => onStartVideo(video)
21
24
  })
22
25
  }), /*#__PURE__*/_jsxs(StackView, {
23
26
  space: 2,
@@ -36,6 +39,7 @@ const VideoPickerPlayer = _ref => {
36
39
 
37
40
  VideoPickerPlayer.propTypes = {
38
41
  video: VideoPropType,
39
- videoPlayerRef: RefPropType
42
+ videoPlayerRef: RefPropType,
43
+ onStartVideo: PropTypes.func
40
44
  };
41
45
  export default VideoPickerPlayer;
package/package.json CHANGED
@@ -5,14 +5,14 @@
5
5
  ],
6
6
  "dependencies": {
7
7
  "@gorhom/portal": "^1.0.14",
8
- "@telus-uds/components-base": "1.43.0",
8
+ "@telus-uds/components-base": "1.45.0",
9
9
  "@telus-uds/system-constants": "^1.2.1",
10
10
  "fscreen": "^1.2.0",
11
11
  "lodash.omit": "^4.5.0",
12
12
  "react-dates": "^21.8.0",
13
13
  "react-helmet-async": "^1.3.0",
14
14
  "react-moment-proptypes": "^1.8.1",
15
- "@telus-uds/system-theme-tokens": "^2.26.1",
15
+ "@telus-uds/system-theme-tokens": "^2.28.0",
16
16
  "prop-types": "^15.7.2",
17
17
  "lodash.throttle": "^4.1.1",
18
18
  "react-youtube": "^10.1.0"
@@ -62,5 +62,5 @@
62
62
  "skip": true
63
63
  },
64
64
  "types": "types/index.d.ts",
65
- "version": "2.1.0"
65
+ "version": "2.3.0"
66
66
  }
package/src/Card/Card.jsx CHANGED
@@ -20,6 +20,22 @@ import FullBleedContent, {
20
20
  useFullBleedContentProps
21
21
  } from '../shared/FullBleedContent'
22
22
 
23
+ const selectCardBaseTokens = ({
24
+ backgroundColor,
25
+ borderColor,
26
+ borderWidth,
27
+ borderRadius,
28
+ shadow,
29
+ minWidth
30
+ }) => ({
31
+ backgroundColor,
32
+ borderColor,
33
+ borderWidth,
34
+ borderRadius,
35
+ shadow,
36
+ minWidth
37
+ })
38
+
23
39
  // Passes React Native-oriented system props through UDS Card
24
40
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
25
41
 
@@ -76,10 +92,10 @@ const Card = forwardRef(
76
92
 
77
93
  // If the card has rounded corners and a full bleed image, we need to apply
78
94
  // those corners on the image as well, but partially
79
- const { borderRadius } = useThemeTokens('Card', tokens, variant)
95
+ const cardTokens = useThemeTokens('Card', tokens, variant)
80
96
  const hasFooter = Boolean(footer)
81
97
  const fullBleedBorderRadius = getFullBleedBorderRadius(
82
- borderRadius,
98
+ cardTokens?.borderRadius,
83
99
  fullBleedContentPosition,
84
100
  hasFooter
85
101
  )
@@ -95,7 +111,7 @@ const Card = forwardRef(
95
111
  <CardBase
96
112
  ref={ref}
97
113
  variant={{ ...variant, padding: 'custom' }}
98
- tokens={tokens}
114
+ tokens={selectCardBaseTokens(cardTokens)}
99
115
  {...selectProps(rest)}
100
116
  >
101
117
  <StackView space={0} tokens={columnFlex}>
@@ -14,19 +14,17 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
14
14
 
15
15
  const CardContentContainer = styled.div(
16
16
  ({
17
- backgroundColor,
18
17
  borderRadius,
19
18
  paddingBottom,
20
19
  paddingLeft,
21
20
  paddingRight,
22
21
  paddingTop,
23
22
  withFooter,
24
- contentAlignItem: alignItem,
23
+ contentAlignItems: alignItems,
25
24
  contentFlexGrow: flexGrow,
26
25
  contentFlexShrink: flexShrink,
27
26
  contentJustifyContent: justifyContent
28
27
  }) => ({
29
- backgroundColor,
30
28
  // We need to make sure to have sharp corners on the bottom
31
29
  // if the card has a footer
32
30
  borderBottomLeftRadius: withFooter ? 0 : borderRadius,
@@ -39,7 +37,7 @@ const CardContentContainer = styled.div(
39
37
  paddingTop,
40
38
  display: 'flex',
41
39
  flexDirection: 'column',
42
- alignItem,
40
+ alignItems,
43
41
  flexGrow,
44
42
  flexShrink,
45
43
  justifyContent
@@ -30,11 +30,13 @@ const sharedStyles = css`
30
30
  cellPaddingTop,
31
31
  cellPaddingRight,
32
32
  cellPaddingBottom,
33
- cellPaddingLeft
33
+ cellPaddingLeft,
34
+ cellMinWidth
34
35
  }) => css`
35
36
  ${isSticky ? stickyStyles : undefined};
36
37
  box-shadow: inset 0 -1px 0 ${cellBoxShadowColor};
37
38
  text-align: ${align};
39
+ min-width: ${cellMinWidth}px;
38
40
  padding: ${cellPaddingTop}px ${cellPaddingRight}px ${cellPaddingBottom}px ${cellPaddingLeft}px;
39
41
  `}
40
42
  `
@@ -60,9 +62,12 @@ const StyledRowHeading = styled.th`
60
62
  background-color: ${({ cellRowHeadingBackground }) => cellRowHeadingBackground};
61
63
  `
62
64
 
63
- const Cell = ({ children, type = 'default', isFirstInRow, align = 'left' }) => {
64
- const { text, isScrollable: isTableScrollable, variant, tokens } = useTableContext()
65
+ const Cell = ({ children, type = 'default', isFirstInRow, align = 'left', tokens: cellTokens }) => {
66
+ const { text, isScrollable: isTableScrollable, variant, tokens: tableTokens } = useTableContext()
67
+ const themeTokens = { ...tableTokens, ...cellTokens }
68
+
65
69
  const {
70
+ cellMinWidth,
66
71
  cellHeadingBackground,
67
72
  cellHeadingBoxShadowColor,
68
73
  cellBoxShadowColor,
@@ -77,10 +82,12 @@ const Cell = ({ children, type = 'default', isFirstInRow, align = 'left' }) => {
77
82
  fontName,
78
83
  fontWeight,
79
84
  fontSize
80
- } = useThemeTokens('Table', tokens, variant)
85
+ } = useThemeTokens('Table', themeTokens, variant)
86
+
81
87
  const sharedProps = {
82
88
  align,
83
89
  isSticky: isTableScrollable && isFirstInRow,
90
+ cellMinWidth,
84
91
  cellStickyShadow,
85
92
  cellPaddingTop,
86
93
  cellPaddingRight,
@@ -146,6 +153,7 @@ const Cell = ({ children, type = 'default', isFirstInRow, align = 'left' }) => {
146
153
  }
147
154
 
148
155
  Cell.propTypes = {
156
+ tokens: PropTypes.object,
149
157
  children: PropTypes.node,
150
158
  /**
151
159
  * Defines the visual styles of a cell, and whether it should be a `td` or `th` element
@@ -65,7 +65,14 @@ const VideoListContainer = styled.div`
65
65
  ${(props) => props.isFramed && framedVideoListContainerStyle}
66
66
  `
67
67
 
68
- const VideoPicker = ({ videoList = [], selectedVideo = videoList[0]?.videoId, frame, ...rest }) => {
68
+ const VideoPicker = ({
69
+ videoList = [],
70
+ selectedVideo = videoList[0]?.videoId,
71
+ frame,
72
+ onStartVideo = () => {},
73
+ onSelectVideo = () => {},
74
+ ...rest
75
+ }) => {
69
76
  const viewport = useViewport()
70
77
  const { stackViewDividerColor, ...themeTokens } = useThemeTokens('VideoPicker')
71
78
  const [currentVideoId, setCurrentVideoId] = useState(selectedVideo)
@@ -88,7 +95,10 @@ const VideoPicker = ({ videoList = [], selectedVideo = videoList[0]?.videoId, fr
88
95
  video={video}
89
96
  videoPlayerRef={videoPlayerRef}
90
97
  selectedVideoId={currentVideoId}
91
- onSelectVideo={(current) => setCurrentVideoId(current.videoId)}
98
+ onSelectVideo={(current) => {
99
+ setCurrentVideoId(current.videoId)
100
+ onSelectVideo(current)
101
+ }}
92
102
  layout={!hasSlider ? 'horizontal' : 'vertical'}
93
103
  index={index}
94
104
  isFramed={isFramed}
@@ -107,7 +117,11 @@ const VideoPicker = ({ videoList = [], selectedVideo = videoList[0]?.videoId, fr
107
117
  direction={isFramed ? 'row' : 'column'}
108
118
  >
109
119
  <VideoPlayerContainer {...themeTokens} isFramed={isFramed}>
110
- <VideoPickerPlayer video={currentVideo} videoPlayerRef={videoPlayerRef} />
120
+ <VideoPickerPlayer
121
+ video={currentVideo}
122
+ videoPlayerRef={videoPlayerRef}
123
+ onStartVideo={onStartVideo}
124
+ />
111
125
  </VideoPlayerContainer>
112
126
  {hasSlider ? (
113
127
  <VideoSlider>{listElements}</VideoSlider>
@@ -138,7 +152,17 @@ VideoPicker.propTypes = {
138
152
  /**
139
153
  * Use to display the picker in a container and the playlist as a sidebar (only available for breakpoints LG and larger)
140
154
  */
141
- frame: PropTypes.bool
155
+ frame: PropTypes.bool,
156
+ /**
157
+ * Callback function trigerred when the video player starts playing video.
158
+ * @param {object} video - The video object that is playing.
159
+ */
160
+ onStartVideo: PropTypes.func,
161
+ /**
162
+ * Callback function trigerred when a video is selected from the thumbnail list.
163
+ * @param {object} video - The video object that is selected.
164
+ */
165
+ onSelectVideo: PropTypes.func
142
166
  }
143
167
 
144
168
  export default VideoPicker
@@ -1,11 +1,14 @@
1
1
  import React from 'react'
2
2
  import { StackView, Typography } from '@telus-uds/components-base'
3
+ import PropTypes from 'prop-types'
3
4
  import WebVideo from '../WebVideo/WebVideo'
4
5
  import { VideoPropType, RefPropType } from './videoPropType'
5
6
 
6
- const VideoPickerPlayer = ({ video = {}, videoPlayerRef }) => (
7
+ const VideoPickerPlayer = ({ video = {}, videoPlayerRef, onStartVideo = () => {} }) => (
7
8
  <StackView space={3} tokens={{ flexShrink: 1 }}>
8
- <div ref={videoPlayerRef}>{video.videoId && <WebVideo {...video} />}</div>
9
+ <div ref={videoPlayerRef}>
10
+ {video.videoId && <WebVideo {...video} onStart={() => onStartVideo(video)} />}
11
+ </div>
9
12
  <StackView space={2}>
10
13
  <Typography variant={{ size: 'h2', colour: 'secondary' }}>{video.title}</Typography>
11
14
  <Typography>{video.description}</Typography>
@@ -15,7 +18,8 @@ const VideoPickerPlayer = ({ video = {}, videoPlayerRef }) => (
15
18
 
16
19
  VideoPickerPlayer.propTypes = {
17
20
  video: VideoPropType,
18
- videoPlayerRef: RefPropType
21
+ videoPlayerRef: RefPropType,
22
+ onStartVideo: PropTypes.func
19
23
  }
20
24
 
21
25
  export default VideoPickerPlayer