@telus-uds/components-web 1.12.0 → 2.1.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 +32 -2
- package/README.md +40 -1
- package/component-docs.json +13484 -0
- package/lib/Breadcrumbs/Breadcrumbs.js +7 -10
- package/lib/Breadcrumbs/Item/Item.js +10 -37
- package/lib/Footnote/Footnote.js +26 -9
- package/lib/index.js +7 -0
- package/lib/utils/index.js +16 -2
- package/lib/utils/ssr.js +50 -0
- package/lib-module/Breadcrumbs/Breadcrumbs.js +7 -10
- package/lib-module/Breadcrumbs/Item/Item.js +11 -35
- package/lib-module/Footnote/Footnote.js +26 -9
- 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/Breadcrumbs/Breadcrumbs.jsx +19 -22
- package/src/Breadcrumbs/Item/Item.jsx +16 -42
- package/src/Footnote/Footnote.jsx +42 -11
- 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
|
@@ -95,10 +95,16 @@ const getItems = (items, params, concatenatePaths) => {
|
|
|
95
95
|
const isLast = i === filteredItems.length - 1;
|
|
96
96
|
const breadcrumbName = getBreadcrumbName(item, params);
|
|
97
97
|
const href = getPath(item.path, params, concatenatePaths, paths);
|
|
98
|
+
const {
|
|
99
|
+
LinkRouter,
|
|
100
|
+
linkRouterProps
|
|
101
|
+
} = item;
|
|
98
102
|
return {
|
|
99
103
|
breadcrumbName,
|
|
100
104
|
href,
|
|
101
105
|
current: isLast,
|
|
106
|
+
LinkRouter,
|
|
107
|
+
linkRouterProps,
|
|
102
108
|
...omitProps(selectProps(item))
|
|
103
109
|
};
|
|
104
110
|
});
|
|
@@ -126,7 +132,6 @@ const Breadcrumbs = _ref2 => {
|
|
|
126
132
|
linkRouterProps,
|
|
127
133
|
params = {},
|
|
128
134
|
tokens,
|
|
129
|
-
reactRouterLinkComponent,
|
|
130
135
|
routes,
|
|
131
136
|
variant,
|
|
132
137
|
LinkRouter,
|
|
@@ -183,7 +188,6 @@ const Breadcrumbs = _ref2 => {
|
|
|
183
188
|
href,
|
|
184
189
|
current,
|
|
185
190
|
breadcrumbName,
|
|
186
|
-
reactRouterLinkComponent: linkComponent = reactRouterLinkComponent,
|
|
187
191
|
LinkRouter: ItemLinkRouter = LinkRouter,
|
|
188
192
|
linkRouterProps: itemLinkRouterProps,
|
|
189
193
|
...itemRest
|
|
@@ -194,9 +198,8 @@ const Breadcrumbs = _ref2 => {
|
|
|
194
198
|
tokens: tokens,
|
|
195
199
|
key: href,
|
|
196
200
|
linkRouterProps: { ...linkRouterProps,
|
|
197
|
-
itemLinkRouterProps
|
|
201
|
+
...itemLinkRouterProps
|
|
198
202
|
},
|
|
199
|
-
reactRouterLinkComponent: linkComponent,
|
|
200
203
|
variant: { ...variant,
|
|
201
204
|
size: 'micro'
|
|
202
205
|
},
|
|
@@ -225,12 +228,6 @@ Breadcrumbs.propTypes = { ...selectedSystemPropTypes,
|
|
|
225
228
|
*/
|
|
226
229
|
params: _propTypes.default.object,
|
|
227
230
|
|
|
228
|
-
/**
|
|
229
|
-
* React Router Link component.
|
|
230
|
-
* @deprecated please use `LinkRouter` and `linkRouterProps` instead
|
|
231
|
-
*/
|
|
232
|
-
reactRouterLinkComponent: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
233
|
-
|
|
234
231
|
/**
|
|
235
232
|
* An array of routes to be displayed as breadcrumbs.
|
|
236
233
|
*/
|
|
@@ -71,7 +71,6 @@ const IconContainer = /*#__PURE__*/_styledComponents.default.span.withConfig({
|
|
|
71
71
|
const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
72
72
|
let {
|
|
73
73
|
href,
|
|
74
|
-
reactRouterLinkComponent: ReactRouterLink,
|
|
75
74
|
children,
|
|
76
75
|
current = false,
|
|
77
76
|
tokens,
|
|
@@ -79,6 +78,8 @@ const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
79
78
|
light: true
|
|
80
79
|
},
|
|
81
80
|
// `light` variant (shared with the `Link` component) is default by design
|
|
81
|
+
LinkRouter,
|
|
82
|
+
linkRouterProps,
|
|
82
83
|
...rest
|
|
83
84
|
} = _ref5;
|
|
84
85
|
const {
|
|
@@ -90,15 +91,9 @@ const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
90
91
|
fontSize,
|
|
91
92
|
...themeTokens
|
|
92
93
|
} = (0, _componentsBase.useThemeTokens)('Breadcrumbs', tokens, variant);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (ReactRouterLink) {
|
|
97
|
-
linkOptions.to = href;
|
|
98
|
-
} else {
|
|
99
|
-
linkOptions.href = href;
|
|
100
|
-
}
|
|
101
|
-
|
|
94
|
+
const linkOptions = { ..._componentsBase.clickProps.toPressProps(selectProps(rest)),
|
|
95
|
+
href
|
|
96
|
+
};
|
|
102
97
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledItemContainer, { ...themeTokens,
|
|
103
98
|
children: current ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
104
99
|
tokens: {
|
|
@@ -109,26 +104,14 @@ const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
109
104
|
},
|
|
110
105
|
children: children
|
|
111
106
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
112
|
-
children: [
|
|
113
|
-
tokens: {
|
|
114
|
-
color,
|
|
115
|
-
blockFontSize: fontSize
|
|
116
|
-
} // TODO refactor
|
|
117
|
-
// eslint-disable-next-line react/no-unstable-nested-components
|
|
118
|
-
,
|
|
119
|
-
component: props => {
|
|
120
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Link, { ...props,
|
|
121
|
-
variant: variant
|
|
122
|
-
});
|
|
123
|
-
},
|
|
107
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Link, { ...linkOptions,
|
|
124
108
|
ref: ref,
|
|
125
|
-
children: children
|
|
126
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Link, { ...linkOptions,
|
|
127
109
|
tokens: {
|
|
128
110
|
color,
|
|
129
111
|
blockFontSize: fontSize
|
|
130
112
|
},
|
|
131
|
-
|
|
113
|
+
LinkRouter: LinkRouter,
|
|
114
|
+
linkRouterProps: linkRouterProps,
|
|
132
115
|
variant: variant,
|
|
133
116
|
children: children
|
|
134
117
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconContainer, { ...themeTokens,
|
|
@@ -156,18 +139,11 @@ Item.propTypes = { ...selectedSystemPropTypes,
|
|
|
156
139
|
current: _propTypes.default.bool,
|
|
157
140
|
|
|
158
141
|
/**
|
|
159
|
-
* Target URL. This will be converted to `to` if the `
|
|
142
|
+
* Target URL. This will be converted to `to` if the `LinkRouter`
|
|
160
143
|
* prop is provided to the `Item` or parent `Breadcrumbs` element.
|
|
161
144
|
*/
|
|
162
145
|
href: _propTypes.default.string.isRequired,
|
|
163
146
|
|
|
164
|
-
/**
|
|
165
|
-
* React Router Link component. This will be passed down from the parent
|
|
166
|
-
* `<Breadcrumbs>` if the parent has a `reactRouterLinkComponent` provided.
|
|
167
|
-
* @deprecated please use `LinkRouter` and `linkRouterProps` instead
|
|
168
|
-
*/
|
|
169
|
-
reactRouterLinkComponent: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
170
|
-
|
|
171
147
|
/**
|
|
172
148
|
* Variant to render.
|
|
173
149
|
*/
|
|
@@ -179,12 +155,9 @@ Item.propTypes = { ...selectedSystemPropTypes,
|
|
|
179
155
|
|
|
180
156
|
Item.defaultProps = {
|
|
181
157
|
current: false,
|
|
182
|
-
reactRouterLinkComponent: undefined,
|
|
183
158
|
variant: {
|
|
184
159
|
light: true
|
|
185
160
|
}
|
|
186
161
|
};
|
|
187
|
-
|
|
188
|
-
var _default = (0, _componentsBase.withLinkRouter)(Item);
|
|
189
|
-
|
|
162
|
+
var _default = Item;
|
|
190
163
|
exports.default = _default;
|
package/lib/Footnote/Footnote.js
CHANGED
|
@@ -52,7 +52,6 @@ const StyledFootnote = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
52
52
|
width: '100vw',
|
|
53
53
|
backgroundColor: footnoteBackground,
|
|
54
54
|
display: 'block',
|
|
55
|
-
boxShadow: '0 0 16px 0 rgba(0, 0, 0, 0.1)',
|
|
56
55
|
transform: 'translateY(100%)',
|
|
57
56
|
transition: 'transform 500ms ease-out',
|
|
58
57
|
'@media() (prefers-reduced-motion: reduce)': {
|
|
@@ -95,14 +94,20 @@ const StyledHeader = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
95
94
|
componentId: "components-web__sc-1563bo5-2"
|
|
96
95
|
})(_ref3 => {
|
|
97
96
|
let {
|
|
98
|
-
|
|
97
|
+
footnoteHeaderPaddingLeft,
|
|
98
|
+
footnoteHeaderPaddingRight,
|
|
99
|
+
footnoteHeaderPaddingTop,
|
|
100
|
+
footnoteHeaderPaddingBottom
|
|
99
101
|
} = _ref3;
|
|
100
102
|
return {
|
|
101
103
|
alignItems: 'center',
|
|
102
104
|
display: 'flex',
|
|
103
105
|
flexDirection: 'row',
|
|
104
106
|
justifyContent: 'space-between',
|
|
105
|
-
|
|
107
|
+
paddingTop: footnoteHeaderPaddingTop,
|
|
108
|
+
paddingBottom: footnoteHeaderPaddingBottom,
|
|
109
|
+
paddingRight: footnoteHeaderPaddingRight,
|
|
110
|
+
paddingLeft: footnoteHeaderPaddingLeft
|
|
106
111
|
};
|
|
107
112
|
});
|
|
108
113
|
|
|
@@ -202,6 +207,7 @@ const CloseButton = /*#__PURE__*/_styledComponents.default.button.withConfig({
|
|
|
202
207
|
cursor: 'pointer',
|
|
203
208
|
display: 'flex',
|
|
204
209
|
justifyContent: 'center',
|
|
210
|
+
backgroundColor: 'white',
|
|
205
211
|
border: closeButtonBorder,
|
|
206
212
|
height: closeButtonHeight,
|
|
207
213
|
margin: closeButtonMargin,
|
|
@@ -295,6 +301,14 @@ const Footnote = props => {
|
|
|
295
301
|
footnoteBodyPaddingRight,
|
|
296
302
|
footnoteBodyPaddingTop,
|
|
297
303
|
footnoteBodyPaddingBottom,
|
|
304
|
+
footnoteHeaderPaddingLeft,
|
|
305
|
+
footnoteHeaderPaddingRight,
|
|
306
|
+
footnoteHeaderPaddingTop,
|
|
307
|
+
footnoteHeaderPaddingBottom,
|
|
308
|
+
headerLineHeight,
|
|
309
|
+
headerFontSize,
|
|
310
|
+
headerFontName,
|
|
311
|
+
headerFontWeight,
|
|
298
312
|
listPaddingLeft,
|
|
299
313
|
listItemMarkerFontSize,
|
|
300
314
|
listItemMarkerLineHeight,
|
|
@@ -506,13 +520,16 @@ const Footnote = props => {
|
|
|
506
520
|
ref: headerRef,
|
|
507
521
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledHeader, {
|
|
508
522
|
ref: headingRef,
|
|
523
|
+
footnoteHeaderPaddingLeft: footnoteHeaderPaddingLeft,
|
|
524
|
+
footnoteHeaderPaddingRight: footnoteHeaderPaddingRight,
|
|
525
|
+
footnoteHeaderPaddingTop: footnoteHeaderPaddingTop,
|
|
526
|
+
footnoteHeaderPaddingBottom: footnoteHeaderPaddingBottom,
|
|
509
527
|
headerMargin: headerMargin,
|
|
510
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
size: 'h4'
|
|
528
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
529
|
+
style: {
|
|
530
|
+
fontSize: `${headerFontSize}px`,
|
|
531
|
+
lineHeight: `${headerLineHeight}px`,
|
|
532
|
+
fontFamily: `${headerFontName}${headerFontWeight}normal`
|
|
516
533
|
},
|
|
517
534
|
children: getCopy('heading')
|
|
518
535
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CloseButton, {
|
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;
|
|
@@ -75,10 +75,16 @@ const getItems = (items, params, concatenatePaths) => {
|
|
|
75
75
|
const isLast = i === filteredItems.length - 1;
|
|
76
76
|
const breadcrumbName = getBreadcrumbName(item, params);
|
|
77
77
|
const href = getPath(item.path, params, concatenatePaths, paths);
|
|
78
|
+
const {
|
|
79
|
+
LinkRouter,
|
|
80
|
+
linkRouterProps
|
|
81
|
+
} = item;
|
|
78
82
|
return {
|
|
79
83
|
breadcrumbName,
|
|
80
84
|
href,
|
|
81
85
|
current: isLast,
|
|
86
|
+
LinkRouter,
|
|
87
|
+
linkRouterProps,
|
|
82
88
|
...omitProps(selectProps(item))
|
|
83
89
|
};
|
|
84
90
|
});
|
|
@@ -106,7 +112,6 @@ const Breadcrumbs = _ref2 => {
|
|
|
106
112
|
linkRouterProps,
|
|
107
113
|
params = {},
|
|
108
114
|
tokens,
|
|
109
|
-
reactRouterLinkComponent,
|
|
110
115
|
routes,
|
|
111
116
|
variant,
|
|
112
117
|
LinkRouter,
|
|
@@ -165,7 +170,6 @@ const Breadcrumbs = _ref2 => {
|
|
|
165
170
|
href,
|
|
166
171
|
current,
|
|
167
172
|
breadcrumbName,
|
|
168
|
-
reactRouterLinkComponent: linkComponent = reactRouterLinkComponent,
|
|
169
173
|
LinkRouter: ItemLinkRouter = LinkRouter,
|
|
170
174
|
linkRouterProps: itemLinkRouterProps,
|
|
171
175
|
...itemRest
|
|
@@ -176,9 +180,8 @@ const Breadcrumbs = _ref2 => {
|
|
|
176
180
|
tokens: tokens,
|
|
177
181
|
key: href,
|
|
178
182
|
linkRouterProps: { ...linkRouterProps,
|
|
179
|
-
itemLinkRouterProps
|
|
183
|
+
...itemLinkRouterProps
|
|
180
184
|
},
|
|
181
|
-
reactRouterLinkComponent: linkComponent,
|
|
182
185
|
variant: { ...variant,
|
|
183
186
|
size: 'micro'
|
|
184
187
|
},
|
|
@@ -207,12 +210,6 @@ Breadcrumbs.propTypes = { ...selectedSystemPropTypes,
|
|
|
207
210
|
*/
|
|
208
211
|
params: PropTypes.object,
|
|
209
212
|
|
|
210
|
-
/**
|
|
211
|
-
* React Router Link component.
|
|
212
|
-
* @deprecated please use `LinkRouter` and `linkRouterProps` instead
|
|
213
|
-
*/
|
|
214
|
-
reactRouterLinkComponent: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
215
|
-
|
|
216
213
|
/**
|
|
217
214
|
* An array of routes to be displayed as breadcrumbs.
|
|
218
215
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { Link, Typography, applyTextStyles, clickProps, selectSystemProps, useThemeTokens
|
|
4
|
+
import { Link, Typography, applyTextStyles, clickProps, selectSystemProps, useThemeTokens } from '@telus-uds/components-base';
|
|
5
5
|
import { htmlAttrs } from '../../utils';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -51,7 +51,6 @@ const IconContainer = /*#__PURE__*/styled.span.withConfig({
|
|
|
51
51
|
const Item = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
52
52
|
let {
|
|
53
53
|
href,
|
|
54
|
-
reactRouterLinkComponent: ReactRouterLink,
|
|
55
54
|
children,
|
|
56
55
|
current = false,
|
|
57
56
|
tokens,
|
|
@@ -59,6 +58,8 @@ const Item = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
59
58
|
light: true
|
|
60
59
|
},
|
|
61
60
|
// `light` variant (shared with the `Link` component) is default by design
|
|
61
|
+
LinkRouter,
|
|
62
|
+
linkRouterProps,
|
|
62
63
|
...rest
|
|
63
64
|
} = _ref5;
|
|
64
65
|
const {
|
|
@@ -70,14 +71,9 @@ const Item = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
70
71
|
fontSize,
|
|
71
72
|
...themeTokens
|
|
72
73
|
} = useThemeTokens('Breadcrumbs', tokens, variant);
|
|
73
|
-
const linkOptions = clickProps.toPressProps(selectProps(rest))
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
linkOptions.to = href;
|
|
77
|
-
} else {
|
|
78
|
-
linkOptions.href = href;
|
|
79
|
-
}
|
|
80
|
-
|
|
74
|
+
const linkOptions = { ...clickProps.toPressProps(selectProps(rest)),
|
|
75
|
+
href
|
|
76
|
+
};
|
|
81
77
|
return /*#__PURE__*/_jsx(StyledItemContainer, { ...themeTokens,
|
|
82
78
|
children: current ? /*#__PURE__*/_jsx(Typography, {
|
|
83
79
|
tokens: {
|
|
@@ -88,26 +84,14 @@ const Item = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
88
84
|
},
|
|
89
85
|
children: children
|
|
90
86
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
91
|
-
children: [
|
|
92
|
-
tokens: {
|
|
93
|
-
color,
|
|
94
|
-
blockFontSize: fontSize
|
|
95
|
-
} // TODO refactor
|
|
96
|
-
// eslint-disable-next-line react/no-unstable-nested-components
|
|
97
|
-
,
|
|
98
|
-
component: props => {
|
|
99
|
-
return /*#__PURE__*/_jsx(Link, { ...props,
|
|
100
|
-
variant: variant
|
|
101
|
-
});
|
|
102
|
-
},
|
|
87
|
+
children: [/*#__PURE__*/_jsx(Link, { ...linkOptions,
|
|
103
88
|
ref: ref,
|
|
104
|
-
children: children
|
|
105
|
-
}) : /*#__PURE__*/_jsx(Link, { ...linkOptions,
|
|
106
89
|
tokens: {
|
|
107
90
|
color,
|
|
108
91
|
blockFontSize: fontSize
|
|
109
92
|
},
|
|
110
|
-
|
|
93
|
+
LinkRouter: LinkRouter,
|
|
94
|
+
linkRouterProps: linkRouterProps,
|
|
111
95
|
variant: variant,
|
|
112
96
|
children: children
|
|
113
97
|
}), /*#__PURE__*/_jsx(IconContainer, { ...themeTokens,
|
|
@@ -135,18 +119,11 @@ Item.propTypes = { ...selectedSystemPropTypes,
|
|
|
135
119
|
current: PropTypes.bool,
|
|
136
120
|
|
|
137
121
|
/**
|
|
138
|
-
* Target URL. This will be converted to `to` if the `
|
|
122
|
+
* Target URL. This will be converted to `to` if the `LinkRouter`
|
|
139
123
|
* prop is provided to the `Item` or parent `Breadcrumbs` element.
|
|
140
124
|
*/
|
|
141
125
|
href: PropTypes.string.isRequired,
|
|
142
126
|
|
|
143
|
-
/**
|
|
144
|
-
* React Router Link component. This will be passed down from the parent
|
|
145
|
-
* `<Breadcrumbs>` if the parent has a `reactRouterLinkComponent` provided.
|
|
146
|
-
* @deprecated please use `LinkRouter` and `linkRouterProps` instead
|
|
147
|
-
*/
|
|
148
|
-
reactRouterLinkComponent: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
149
|
-
|
|
150
127
|
/**
|
|
151
128
|
* Variant to render.
|
|
152
129
|
*/
|
|
@@ -158,9 +135,8 @@ Item.propTypes = { ...selectedSystemPropTypes,
|
|
|
158
135
|
|
|
159
136
|
Item.defaultProps = {
|
|
160
137
|
current: false,
|
|
161
|
-
reactRouterLinkComponent: undefined,
|
|
162
138
|
variant: {
|
|
163
139
|
light: true
|
|
164
140
|
}
|
|
165
141
|
};
|
|
166
|
-
export default
|
|
142
|
+
export default Item;
|
|
@@ -31,7 +31,6 @@ const StyledFootnote = /*#__PURE__*/styled.div.withConfig({
|
|
|
31
31
|
width: '100vw',
|
|
32
32
|
backgroundColor: footnoteBackground,
|
|
33
33
|
display: 'block',
|
|
34
|
-
boxShadow: '0 0 16px 0 rgba(0, 0, 0, 0.1)',
|
|
35
34
|
transform: 'translateY(100%)',
|
|
36
35
|
transition: 'transform 500ms ease-out',
|
|
37
36
|
'@media() (prefers-reduced-motion: reduce)': {
|
|
@@ -72,14 +71,20 @@ const StyledHeader = /*#__PURE__*/styled.div.withConfig({
|
|
|
72
71
|
componentId: "components-web__sc-1563bo5-2"
|
|
73
72
|
})(_ref3 => {
|
|
74
73
|
let {
|
|
75
|
-
|
|
74
|
+
footnoteHeaderPaddingLeft,
|
|
75
|
+
footnoteHeaderPaddingRight,
|
|
76
|
+
footnoteHeaderPaddingTop,
|
|
77
|
+
footnoteHeaderPaddingBottom
|
|
76
78
|
} = _ref3;
|
|
77
79
|
return {
|
|
78
80
|
alignItems: 'center',
|
|
79
81
|
display: 'flex',
|
|
80
82
|
flexDirection: 'row',
|
|
81
83
|
justifyContent: 'space-between',
|
|
82
|
-
|
|
84
|
+
paddingTop: footnoteHeaderPaddingTop,
|
|
85
|
+
paddingBottom: footnoteHeaderPaddingBottom,
|
|
86
|
+
paddingRight: footnoteHeaderPaddingRight,
|
|
87
|
+
paddingLeft: footnoteHeaderPaddingLeft
|
|
83
88
|
};
|
|
84
89
|
});
|
|
85
90
|
const StyledFootnoteBody = /*#__PURE__*/styled.div.withConfig({
|
|
@@ -176,6 +181,7 @@ const CloseButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
176
181
|
cursor: 'pointer',
|
|
177
182
|
display: 'flex',
|
|
178
183
|
justifyContent: 'center',
|
|
184
|
+
backgroundColor: 'white',
|
|
179
185
|
border: closeButtonBorder,
|
|
180
186
|
height: closeButtonHeight,
|
|
181
187
|
margin: closeButtonMargin,
|
|
@@ -267,6 +273,14 @@ const Footnote = props => {
|
|
|
267
273
|
footnoteBodyPaddingRight,
|
|
268
274
|
footnoteBodyPaddingTop,
|
|
269
275
|
footnoteBodyPaddingBottom,
|
|
276
|
+
footnoteHeaderPaddingLeft,
|
|
277
|
+
footnoteHeaderPaddingRight,
|
|
278
|
+
footnoteHeaderPaddingTop,
|
|
279
|
+
footnoteHeaderPaddingBottom,
|
|
280
|
+
headerLineHeight,
|
|
281
|
+
headerFontSize,
|
|
282
|
+
headerFontName,
|
|
283
|
+
headerFontWeight,
|
|
270
284
|
listPaddingLeft,
|
|
271
285
|
listItemMarkerFontSize,
|
|
272
286
|
listItemMarkerLineHeight,
|
|
@@ -478,13 +492,16 @@ const Footnote = props => {
|
|
|
478
492
|
ref: headerRef,
|
|
479
493
|
children: /*#__PURE__*/_jsxs(StyledHeader, {
|
|
480
494
|
ref: headingRef,
|
|
495
|
+
footnoteHeaderPaddingLeft: footnoteHeaderPaddingLeft,
|
|
496
|
+
footnoteHeaderPaddingRight: footnoteHeaderPaddingRight,
|
|
497
|
+
footnoteHeaderPaddingTop: footnoteHeaderPaddingTop,
|
|
498
|
+
footnoteHeaderPaddingBottom: footnoteHeaderPaddingBottom,
|
|
481
499
|
headerMargin: headerMargin,
|
|
482
|
-
children: [/*#__PURE__*/_jsx(
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
size: 'h4'
|
|
500
|
+
children: [/*#__PURE__*/_jsx("h2", {
|
|
501
|
+
style: {
|
|
502
|
+
fontSize: `${headerFontSize}px`,
|
|
503
|
+
lineHeight: `${headerLineHeight}px`,
|
|
504
|
+
fontFamily: `${headerFontName}${headerFontWeight}normal`
|
|
488
505
|
},
|
|
489
506
|
children: getCopy('heading')
|
|
490
507
|
}), /*#__PURE__*/_jsx(CloseButton, {
|
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;
|