@telus-uds/components-web 2.0.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 +30 -2
- package/README.md +40 -1
- package/component-docs.json +13513 -0
- package/lib/Card/Card.js +0 -1
- package/lib/Table/Cell.js +13 -5
- package/lib/VideoPicker/VideoPicker.js +21 -3
- package/lib/VideoPicker/VideoPickerPlayer.js +8 -3
- package/lib/index.js +7 -0
- package/lib/utils/index.js +16 -2
- package/lib/utils/ssr.js +50 -0
- package/lib-module/Card/Card.js +0 -1
- package/lib-module/Table/Cell.js +13 -5
- package/lib-module/VideoPicker/VideoPicker.js +21 -3
- package/lib-module/VideoPicker/VideoPickerPlayer.js +7 -3
- package/lib-module/index.js +1 -0
- package/lib-module/utils/index.js +3 -2
- package/lib-module/utils/ssr.js +41 -0
- package/package.json +8 -7
- package/src/Card/Card.jsx +1 -6
- package/src/Table/Cell.jsx +12 -4
- package/src/VideoPicker/VideoPicker.jsx +28 -4
- package/src/VideoPicker/VideoPickerPlayer.jsx +7 -3
- package/src/index.js +2 -0
- package/src/utils/index.js +4 -1
- package/src/utils/ssr.js +37 -0
- package/types/BlockQuote.d.ts +16 -0
- package/types/Box.d.ts +38 -0
- package/types/BreadcrumbItem.d.ts +11 -0
- package/types/Breadcrumbs.d.ts +21 -0
- package/types/ComponentTypeWithForwardRef.d.ts +5 -0
- package/types/MultiSelectFilter.d.ts +27 -0
- package/types/QuantitySelector.d.ts +20 -0
- package/types/ReactNative.d.ts +256 -0
- package/types/Tooltip.d.ts +17 -0
- package/types/TooltipButton.d.ts +12 -0
- package/types/Typography.d.ts +27 -0
- package/types/WebVideo.d.ts +17 -0
- package/types/common.d.ts +162 -0
- package/types/index.d.ts +244 -0
package/lib/Card/Card.js
CHANGED
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',
|
|
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 =>
|
|
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;
|
package/lib/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var _exportNames = {
|
|
|
22
22
|
QuantitySelector: true,
|
|
23
23
|
IconButton: true,
|
|
24
24
|
transformGradient: true,
|
|
25
|
+
ssrStyles: true,
|
|
25
26
|
Breadcrumbs: true,
|
|
26
27
|
BlockQuote: true,
|
|
27
28
|
OptimizeImage: true,
|
|
@@ -272,6 +273,12 @@ Object.defineProperty(exports, "WebVideo", {
|
|
|
272
273
|
return _WebVideo.default;
|
|
273
274
|
}
|
|
274
275
|
});
|
|
276
|
+
Object.defineProperty(exports, "ssrStyles", {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function () {
|
|
279
|
+
return _utils.ssrStyles;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
275
282
|
Object.defineProperty(exports, "transformGradient", {
|
|
276
283
|
enumerable: true,
|
|
277
284
|
get: function () {
|
package/lib/utils/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "deprecate", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _logger.deprecate;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "htmlAttrs", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -21,6 +27,12 @@ Object.defineProperty(exports, "renderStructuredContent", {
|
|
|
21
27
|
return _renderStructuredContent.default;
|
|
22
28
|
}
|
|
23
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "ssrStyles", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _ssr.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
24
36
|
Object.defineProperty(exports, "transformGradient", {
|
|
25
37
|
enumerable: true,
|
|
26
38
|
get: function () {
|
|
@@ -46,16 +58,18 @@ Object.defineProperty(exports, "warn", {
|
|
|
46
58
|
}
|
|
47
59
|
});
|
|
48
60
|
|
|
61
|
+
var _logger = require("./logger");
|
|
62
|
+
|
|
49
63
|
var _transforms = require("./transforms");
|
|
50
64
|
|
|
51
65
|
var _useTypographyTheme = _interopRequireDefault(require("./useTypographyTheme"));
|
|
52
66
|
|
|
53
67
|
var _htmlAttrs = _interopRequireDefault(require("./htmlAttrs"));
|
|
54
68
|
|
|
55
|
-
var _logger = require("./logger");
|
|
56
|
-
|
|
57
69
|
var _media = _interopRequireDefault(require("./media"));
|
|
58
70
|
|
|
71
|
+
var _ssr = _interopRequireDefault(require("./ssr"));
|
|
72
|
+
|
|
59
73
|
var _renderStructuredContent = _interopRequireDefault(require("./renderStructuredContent"));
|
|
60
74
|
|
|
61
75
|
var _useOverlaidPosition = _interopRequireDefault(require("./useOverlaidPosition"));
|
package/lib/utils/ssr.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = require("styled-components");
|
|
9
|
+
|
|
10
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns object with `renderApp` and `getStyles` functions.
|
|
14
|
+
* Weave these into your app's server-side render process:
|
|
15
|
+
*
|
|
16
|
+
* - Call `renderApp` first to do the actual server-side render
|
|
17
|
+
* - After the render is complete, call `getStyles`
|
|
18
|
+
* - Include the style tags returned by `getStyles` in the SSR <head>
|
|
19
|
+
*
|
|
20
|
+
* This wraps ssrStyles from @telus-uds/components-base and adds Styled Components support.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} [appName] - optional unique identifier if ssrStyles is called multiple times for multiple apps
|
|
23
|
+
* @param {object} [options] -
|
|
24
|
+
* - `styleGetters`: optional array of additional style getter functions to call after render
|
|
25
|
+
* - `collectStyles`: optional function, takes the rendered app, returns either the same or a new app element
|
|
26
|
+
* @param {boolean} [options.styleGetters]
|
|
27
|
+
* @param {(ReactElement) => ReactElement} [options.collectStyles]
|
|
28
|
+
*/
|
|
29
|
+
const ssrStyles = function () {
|
|
30
|
+
let appName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Allium app';
|
|
31
|
+
let {
|
|
32
|
+
styleGetters = [],
|
|
33
|
+
collectStyles = renderedApp => renderedApp
|
|
34
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
35
|
+
const sheet = new _styledComponents.ServerStyleSheet();
|
|
36
|
+
|
|
37
|
+
const getStyledComponentsStyles = () => {
|
|
38
|
+
const styles = sheet.getStyleElement();
|
|
39
|
+
sheet.seal();
|
|
40
|
+
return styles;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return (0, _componentsBase.ssrStyles)(appName, {
|
|
44
|
+
styleGetters: [getStyledComponentsStyles, ...styleGetters],
|
|
45
|
+
collectStyles: renderedApp => collectStyles(sheet.collectStyles(renderedApp))
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var _default = ssrStyles;
|
|
50
|
+
exports.default = _default;
|
package/lib-module/Card/Card.js
CHANGED
package/lib-module/Table/Cell.js
CHANGED
|
@@ -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',
|
|
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 =>
|
|
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/lib-module/index.js
CHANGED
|
@@ -37,4 +37,5 @@ export { default as TermsAndConditions } from './TermsAndConditions';
|
|
|
37
37
|
export { default as NavigationBar } from './NavigationBar';
|
|
38
38
|
export { default as Progress } from './Progress';
|
|
39
39
|
export { default as SkeletonProvider } from './SkeletonProvider';
|
|
40
|
+
export { ssrStyles } from './utils';
|
|
40
41
|
export * from './baseExports';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { warn, deprecate } from './logger';
|
|
1
2
|
import { transformGradient } from './transforms';
|
|
2
3
|
import useTypographyTheme from './useTypographyTheme';
|
|
3
4
|
import htmlAttrs from './htmlAttrs';
|
|
4
|
-
import { warn } from './logger';
|
|
5
5
|
import media from './media';
|
|
6
|
+
import ssrStyles from './ssr';
|
|
6
7
|
import renderStructuredContent from './renderStructuredContent';
|
|
7
8
|
import useOverlaidPosition from './useOverlaidPosition';
|
|
8
|
-
export { htmlAttrs, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, useOverlaidPosition };
|
|
9
|
+
export { deprecate, htmlAttrs, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, useOverlaidPosition };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ServerStyleSheet } from 'styled-components';
|
|
2
|
+
import { ssrStyles as baseSsrStyles } from '@telus-uds/components-base';
|
|
3
|
+
/**
|
|
4
|
+
* Returns object with `renderApp` and `getStyles` functions.
|
|
5
|
+
* Weave these into your app's server-side render process:
|
|
6
|
+
*
|
|
7
|
+
* - Call `renderApp` first to do the actual server-side render
|
|
8
|
+
* - After the render is complete, call `getStyles`
|
|
9
|
+
* - Include the style tags returned by `getStyles` in the SSR <head>
|
|
10
|
+
*
|
|
11
|
+
* This wraps ssrStyles from @telus-uds/components-base and adds Styled Components support.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} [appName] - optional unique identifier if ssrStyles is called multiple times for multiple apps
|
|
14
|
+
* @param {object} [options] -
|
|
15
|
+
* - `styleGetters`: optional array of additional style getter functions to call after render
|
|
16
|
+
* - `collectStyles`: optional function, takes the rendered app, returns either the same or a new app element
|
|
17
|
+
* @param {boolean} [options.styleGetters]
|
|
18
|
+
* @param {(ReactElement) => ReactElement} [options.collectStyles]
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const ssrStyles = function () {
|
|
22
|
+
let appName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Allium app';
|
|
23
|
+
let {
|
|
24
|
+
styleGetters = [],
|
|
25
|
+
collectStyles = renderedApp => renderedApp
|
|
26
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
+
const sheet = new ServerStyleSheet();
|
|
28
|
+
|
|
29
|
+
const getStyledComponentsStyles = () => {
|
|
30
|
+
const styles = sheet.getStyleElement();
|
|
31
|
+
sheet.seal();
|
|
32
|
+
return styles;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return baseSsrStyles(appName, {
|
|
36
|
+
styleGetters: [getStyledComponentsStyles, ...styleGetters],
|
|
37
|
+
collectStyles: renderedApp => collectStyles(sheet.collectStyles(renderedApp))
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default ssrStyles;
|
package/package.json
CHANGED
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@gorhom/portal": "^1.0.14",
|
|
8
|
-
"@telus-uds/components-base": "1.
|
|
9
|
-
"@telus-uds/system-constants": "^1.2.
|
|
8
|
+
"@telus-uds/components-base": "1.44.0",
|
|
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.
|
|
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"
|
|
19
19
|
},
|
|
20
20
|
"description": "UDS mult-brand web components",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@telus-uds/browserslist-config": "^1.0.
|
|
22
|
+
"@telus-uds/browserslist-config": "^1.0.5",
|
|
23
23
|
"@testing-library/jest-dom": "^5.16.1",
|
|
24
24
|
"@testing-library/react": "^13.3.0",
|
|
25
25
|
"@types/react": "^18.0.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"webpack": "5.x"
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/telus/universal-design-system#readme",
|
|
35
|
-
"license": "
|
|
35
|
+
"license": "MIT",
|
|
36
36
|
"main": "lib/index.js",
|
|
37
37
|
"module": "lib-module/index.js",
|
|
38
38
|
"name": "@telus-uds/components-web",
|
|
@@ -47,10 +47,11 @@
|
|
|
47
47
|
"url": "git+https://github.com/telus/universal-design-system.git"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
|
-
"build": "npm run build:code",
|
|
50
|
+
"build": "npm run build:code && npm run build:docs",
|
|
51
51
|
"build:main": "babel src -d lib",
|
|
52
52
|
"build:module": "babel src -d lib-module --env-name module",
|
|
53
53
|
"build:code": "npm run build:main && npm run build:module",
|
|
54
|
+
"build:docs": "babel-node --plugins=@telus-uds/babel-plugin-react-docgen generate-component-docs.js",
|
|
54
55
|
"format": "prettier --write .",
|
|
55
56
|
"lint": "telus-standard",
|
|
56
57
|
"lint:fix": "telus-standard --fix",
|
|
@@ -61,5 +62,5 @@
|
|
|
61
62
|
"skip": true
|
|
62
63
|
},
|
|
63
64
|
"types": "types/index.d.ts",
|
|
64
|
-
"version": "2.
|
|
65
|
+
"version": "2.2.0"
|
|
65
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}
|
package/src/Table/Cell.jsx
CHANGED
|
@@ -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',
|
|
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 = ({
|
|
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) =>
|
|
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
|
|
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
|