@telus-uds/components-web 2.1.0 → 2.2.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,27 @@
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 Wed, 24 May 2023 23:40:09 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.2.0
8
+
9
+ Wed, 24 May 2023 23:40:09 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Add `onStartVideo` and `onSelectVideo` for `VideoPicker` (shahzaibkhalidmalik@outlook.com)
14
+ - Added cellMinWidth token to Table (wlsdud194@hotmail.com)
15
+ - Bump @telus-uds/components-base to v1.44.0
16
+ - Bump @telus-uds/system-theme-tokens to v2.27.0
17
+
18
+ ### Patches
19
+
20
+ - Fix an issue where `Card` may show double spacing when custom padding tokens are passed (shahzaibkhalidmalik@outlook.com)
21
+
7
22
  ## 2.1.0
8
23
 
9
- Wed, 24 May 2023 01:36:34 GMT
24
+ Wed, 24 May 2023 01:43:02 GMT
10
25
 
11
26
  ### Minor changes
12
27
 
@@ -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"
package/lib/Card/Card.js CHANGED
@@ -97,7 +97,6 @@ const Card = /*#__PURE__*/(0, _react.forwardRef)(function () {
97
97
  variant: { ...variant,
98
98
  padding: 'custom'
99
99
  },
100
- tokens: tokens,
101
100
  ...selectProps(rest),
102
101
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
103
102
  space: 0,
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;
@@ -78,7 +78,6 @@ const Card = /*#__PURE__*/forwardRef(function () {
78
78
  variant: { ...variant,
79
79
  padding: 'custom'
80
80
  },
81
- tokens: tokens,
82
81
  ...selectProps(rest),
83
82
  children: /*#__PURE__*/_jsxs(StackView, {
84
83
  space: 0,
@@ -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.44.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.27.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.2.0"
66
66
  }
package/src/Card/Card.jsx CHANGED
@@ -92,12 +92,7 @@ const Card = forwardRef(
92
92
  }
93
93
 
94
94
  return (
95
- <CardBase
96
- ref={ref}
97
- variant={{ ...variant, padding: 'custom' }}
98
- tokens={tokens}
99
- {...selectProps(rest)}
100
- >
95
+ <CardBase ref={ref} variant={{ ...variant, padding: 'custom' }} {...selectProps(rest)}>
101
96
  <StackView space={0} tokens={columnFlex}>
102
97
  <StackView
103
98
  direction={contentStackDirection}
@@ -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