@telus-uds/components-web 2.24.0 → 2.25.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, 15 Nov 2023 18:34:44 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 18 Nov 2023 02:25:11 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.25.0
8
+
9
+ Sat, 18 Nov 2023 02:25:11 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - added onPlay, onPause and onEnd callbacks for youtube video analytics (kristina.kirpichnikova@telus.com)
14
+ - Bump @telus-uds/components-base to v1.69.0
15
+ - Bump @telus-uds/system-theme-tokens to v2.46.0
16
+
17
+ ### Patches
18
+
19
+ - `TermsAndConditions`: Fix unexpected state handling in `ExpandCollapse.Panel` (shahzaibkhalidmalik@outlook.com)
20
+ - adding types for Countdown component (jacqui.koroll@telus.com)
21
+
7
22
  ## 2.24.0
8
23
 
9
- Wed, 15 Nov 2023 18:34:44 GMT
24
+ Wed, 15 Nov 2023 18:45:58 GMT
10
25
 
11
26
  ### Minor changes
12
27
 
@@ -72,7 +72,6 @@ const ExpandCollapse = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
72
72
  expandTitleBorderColor,
73
73
  expandTitleUnderline
74
74
  } = getTokens();
75
- const [isExpanded, setIsExpanded] = (0, _react.useState)(false);
76
75
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ExpandCollapse, {
77
76
  tokens: {
78
77
  borderWidth: expandBaseBorderWidth
@@ -100,7 +99,6 @@ const ExpandCollapse = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
100
99
  } = getTokens({
101
100
  expanded
102
101
  });
103
- setIsExpanded(expanded);
104
102
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ExpandCollapseControl, {
105
103
  ref: ref,
106
104
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandCollapseIconContainer, {
@@ -125,7 +123,7 @@ const ExpandCollapse = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
125
123
  borderColor: contentBorderColor,
126
124
  marginBottom: contentMarginBottom
127
125
  },
128
- children: isExpanded ? children : null
126
+ children: children
129
127
  })
130
128
  });
131
129
  });
@@ -4,17 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.VideoProps = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
7
+ var _componentsBase = require("@telus-uds/components-base");
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _styledComponents = _interopRequireDefault(require("styled-components"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
10
  var _reactYoutube = _interopRequireDefault(require("react-youtube"));
11
- var _componentsBase = require("@telus-uds/components-base");
11
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
12
12
  var _VideoSplash = _interopRequireDefault(require("../shared/VideoSplash/VideoSplash"));
13
13
  var _utils = require("../utils");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
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); }
17
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; }
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
  const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
19
19
  const StyledPlayerContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
20
20
  displayName: "WebVideo__StyledPlayerContainer",
@@ -61,6 +61,9 @@ const WebVideo = _ref => {
61
61
  beginMuted = false,
62
62
  videoLength,
63
63
  copy,
64
+ onPlay,
65
+ onPause,
66
+ onEnd,
64
67
  onStart = () => {},
65
68
  ...rest
66
69
  } = _ref;
@@ -91,7 +94,10 @@ const WebVideo = _ref => {
91
94
  rel: 0
92
95
  }
93
96
  },
94
- onReady: initializeYoutubePlayer
97
+ onReady: initializeYoutubePlayer,
98
+ onPlay: onPlay,
99
+ onPause: onPause,
100
+ onEnd: onEnd
95
101
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoSplash.default, {
96
102
  poster: posterSrc || `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`,
97
103
  videoLength: videoLength,
@@ -136,7 +142,19 @@ const VideoProps = {
136
142
  /**
137
143
  * A function to be run when the play button is pressed on the video splash screen and the video is ready to play.
138
144
  */
139
- onStart: _propTypes.default.func
145
+ onStart: _propTypes.default.func,
146
+ /**
147
+ * A function to be run when the video is played.
148
+ */
149
+ onPlay: _propTypes.default.func,
150
+ /**
151
+ * A function to be run when the video is paused.
152
+ */
153
+ onPause: _propTypes.default.func,
154
+ /**
155
+ * A function to be run when the video ends.
156
+ */
157
+ onEnd: _propTypes.default.func
140
158
  };
141
159
  exports.VideoProps = VideoProps;
142
160
  WebVideo.propTypes = VideoProps;
@@ -1,4 +1,4 @@
1
- import React, { useState, forwardRef } from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { ExpandCollapse as ExpandCollapseBase, IconButton, useThemeTokensCallback } from '@telus-uds/components-base';
4
4
  import styled from 'styled-components';
@@ -64,7 +64,6 @@ const ExpandCollapse = /*#__PURE__*/forwardRef((_ref3, ref) => {
64
64
  expandTitleBorderColor,
65
65
  expandTitleUnderline
66
66
  } = getTokens();
67
- const [isExpanded, setIsExpanded] = useState(false);
68
67
  return /*#__PURE__*/_jsx(ExpandCollapseBase, {
69
68
  tokens: {
70
69
  borderWidth: expandBaseBorderWidth
@@ -92,7 +91,6 @@ const ExpandCollapse = /*#__PURE__*/forwardRef((_ref3, ref) => {
92
91
  } = getTokens({
93
92
  expanded
94
93
  });
95
- setIsExpanded(expanded);
96
94
  return /*#__PURE__*/_jsxs(ExpandCollapseControl, {
97
95
  ref: ref,
98
96
  children: [/*#__PURE__*/_jsx(ExpandCollapseIconContainer, {
@@ -117,7 +115,7 @@ const ExpandCollapse = /*#__PURE__*/forwardRef((_ref3, ref) => {
117
115
  borderColor: contentBorderColor,
118
116
  marginBottom: contentMarginBottom
119
117
  },
120
- children: isExpanded ? children : null
118
+ children: children
121
119
  })
122
120
  });
123
121
  });
@@ -1,8 +1,8 @@
1
- import React, { useState } from 'react';
1
+ import { selectSystemProps } from '@telus-uds/components-base';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
3
+ import React, { useState } from 'react';
4
4
  import YouTube from 'react-youtube';
5
- import { selectSystemProps } from '@telus-uds/components-base';
5
+ import styled from 'styled-components';
6
6
  import VideoSplash from '../shared/VideoSplash/VideoSplash';
7
7
  import { htmlAttrs } from '../utils';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -52,6 +52,9 @@ const WebVideo = _ref => {
52
52
  beginMuted = false,
53
53
  videoLength,
54
54
  copy,
55
+ onPlay,
56
+ onPause,
57
+ onEnd,
55
58
  onStart = () => {},
56
59
  ...rest
57
60
  } = _ref;
@@ -82,7 +85,10 @@ const WebVideo = _ref => {
82
85
  rel: 0
83
86
  }
84
87
  },
85
- onReady: initializeYoutubePlayer
88
+ onReady: initializeYoutubePlayer,
89
+ onPlay: onPlay,
90
+ onPause: onPause,
91
+ onEnd: onEnd
86
92
  }) : /*#__PURE__*/_jsx(VideoSplash, {
87
93
  poster: posterSrc || `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`,
88
94
  videoLength: videoLength,
@@ -127,7 +133,19 @@ export const VideoProps = {
127
133
  /**
128
134
  * A function to be run when the play button is pressed on the video splash screen and the video is ready to play.
129
135
  */
130
- onStart: PropTypes.func
136
+ onStart: PropTypes.func,
137
+ /**
138
+ * A function to be run when the video is played.
139
+ */
140
+ onPlay: PropTypes.func,
141
+ /**
142
+ * A function to be run when the video is paused.
143
+ */
144
+ onPause: PropTypes.func,
145
+ /**
146
+ * A function to be run when the video ends.
147
+ */
148
+ onEnd: PropTypes.func
131
149
  };
132
150
  WebVideo.propTypes = VideoProps;
133
151
  export default WebVideo;
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.68.0",
8
+ "@telus-uds/components-base": "1.69.0",
9
9
  "@telus-uds/system-constants": "^1.3.0",
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.45.0",
15
+ "@telus-uds/system-theme-tokens": "^2.46.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.24.0"
65
+ "version": "2.25.0"
66
66
  }
@@ -1,4 +1,4 @@
1
- import React, { useState, forwardRef } from 'react'
1
+ import React, { forwardRef } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import {
4
4
  ExpandCollapse as ExpandCollapseBase,
@@ -47,8 +47,6 @@ const ExpandCollapse = forwardRef(
47
47
  expandTitleBorderColor,
48
48
  expandTitleUnderline
49
49
  } = getTokens()
50
- const [isExpanded, setIsExpanded] = useState(false)
51
-
52
50
  return (
53
51
  <ExpandCollapseBase
54
52
  tokens={{
@@ -72,7 +70,6 @@ const ExpandCollapse = forwardRef(
72
70
  control={(pressableState) => {
73
71
  const { expanded } = pressableState || {}
74
72
  const { icon } = getTokens({ expanded })
75
- setIsExpanded(expanded)
76
73
 
77
74
  return (
78
75
  <ExpandCollapseControl ref={ref}>
@@ -95,7 +92,7 @@ const ExpandCollapse = forwardRef(
95
92
  marginBottom: contentMarginBottom
96
93
  }}
97
94
  >
98
- {isExpanded ? children : null}
95
+ {children}
99
96
  </ExpandCollapseBase.Panel>
100
97
  )}
101
98
  </ExpandCollapseBase>
@@ -1,8 +1,8 @@
1
- import React, { useState } from 'react'
1
+ import { selectSystemProps } from '@telus-uds/components-base'
2
2
  import PropTypes from 'prop-types'
3
- import styled from 'styled-components'
3
+ import React, { useState } from 'react'
4
4
  import YouTube from 'react-youtube'
5
- import { selectSystemProps } from '@telus-uds/components-base'
5
+ import styled from 'styled-components'
6
6
  import VideoSplash from '../shared/VideoSplash/VideoSplash'
7
7
  import { htmlAttrs } from '../utils'
8
8
 
@@ -41,6 +41,9 @@ const WebVideo = ({
41
41
  beginMuted = false,
42
42
  videoLength,
43
43
  copy,
44
+ onPlay,
45
+ onPause,
46
+ onEnd,
44
47
  onStart = () => {},
45
48
  ...rest
46
49
  }) => {
@@ -74,6 +77,9 @@ const WebVideo = ({
74
77
  }
75
78
  }}
76
79
  onReady={initializeYoutubePlayer}
80
+ onPlay={onPlay}
81
+ onPause={onPause}
82
+ onEnd={onEnd}
77
83
  />
78
84
  ) : (
79
85
  <VideoSplash
@@ -123,7 +129,22 @@ export const VideoProps = {
123
129
  /**
124
130
  * A function to be run when the play button is pressed on the video splash screen and the video is ready to play.
125
131
  */
126
- onStart: PropTypes.func
132
+ onStart: PropTypes.func,
133
+
134
+ /**
135
+ * A function to be run when the video is played.
136
+ */
137
+ onPlay: PropTypes.func,
138
+
139
+ /**
140
+ * A function to be run when the video is paused.
141
+ */
142
+ onPause: PropTypes.func,
143
+
144
+ /**
145
+ * A function to be run when the video ends.
146
+ */
147
+ onEnd: PropTypes.func
127
148
  }
128
149
 
129
150
  WebVideo.propTypes = VideoProps
@@ -0,0 +1,53 @@
1
+ import type { ComponentType } from 'react'
2
+ import type { HTMLAttrs } from './common'
3
+
4
+ interface CountdownVariant {
5
+ label?: boolean
6
+ noDivider?: boolean
7
+ large?: boolean
8
+ feature?: boolean
9
+ inverse?: boolean
10
+ }
11
+
12
+ interface GradientStop {
13
+ color: string
14
+ stop: number
15
+ }
16
+
17
+ interface ContainerGradient {
18
+ angle: number
19
+ stops: GradientStop[]
20
+ type: string
21
+ }
22
+
23
+ interface CountdownTokens {
24
+ containerBorderRadius?: string | number
25
+ containerGradient?: ContainerGradient
26
+ containerBorderWidth?: string | number
27
+ containerBorderColor?: string
28
+ containerInverseBorder?: string | number
29
+ containerInverseBorderColor?: string
30
+ inverseBorderColor?: string
31
+ containerPaddingBottomTop?: string | number
32
+ containerPaddingLeftRight?: string | number
33
+ labelBorderColor?: string
34
+ labelLineHeight?: number
35
+ textLineHeight?: number
36
+ labelFontSize?: number
37
+ textFontSize?: number
38
+ labelFontName?: string
39
+ textTimerFontName?: string
40
+ labelFontWeight?: string | number
41
+ textTimerFontWeight?: string | number
42
+ }
43
+
44
+ export interface CountdownProps extends HTMLAttrs {
45
+ tokens?: CountdownTokens
46
+ targetTime: Date | string
47
+ copy?: string
48
+ variant?: CountdownVariant
49
+ }
50
+
51
+ declare const Countdown: ComponentType<CountdownProps>
52
+
53
+ export default Countdown
package/types/index.d.ts CHANGED
@@ -17,6 +17,9 @@ export type { BoxProps } from './Box'
17
17
  export { default as Breadcrumbs } from './Breadcrumbs'
18
18
  export type { BreadcrumbsProps, BreadcrumbRouteProps } from './Breadcrumbs'
19
19
 
20
+ export { default as Countdown } from './Countdown'
21
+ export type { CountdownProps } from './Countdown'
22
+
20
23
  export { default as MultiSelectFilter } from './MultiSelectFilter'
21
24
  export type { MultiSelectFilterProps } from './MultiSelectFilter'
22
25