@telus-uds/components-web 1.10.0 → 1.11.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 +26 -2
- package/lib/Breadcrumbs/Item/Item.js +31 -6
- package/lib/Callout/Callout.js +24 -3
- package/lib/Disclaimer/Disclaimer.js +72 -0
- package/lib/Disclaimer/index.js +15 -0
- package/lib/Footnote/Footnote.js +3 -4
- package/lib/Footnote/FootnoteLink.js +11 -13
- package/lib/NavigationBar/NavigationBar.js +231 -0
- package/lib/NavigationBar/NavigationItem.js +111 -0
- package/lib/NavigationBar/NavigationSubMenu.js +179 -0
- package/lib/NavigationBar/collapseItems.js +51 -0
- package/lib/NavigationBar/index.js +13 -0
- package/lib/PriceLockup/PriceLockup.js +40 -17
- package/lib/PriceLockup/tokens.js +49 -116
- package/lib/Progress/ProgressBar.js +100 -0
- package/lib/Progress/index.js +16 -0
- package/lib/Ribbon/Ribbon.js +53 -32
- package/lib/Spinner/Spinner.js +18 -14
- package/lib/Table/Cell.js +15 -1
- package/lib/VideoPicker/VideoPicker.js +177 -0
- package/lib/VideoPicker/VideoPickerPlayer.js +54 -0
- package/lib/VideoPicker/VideoPickerThumbnail.js +201 -0
- package/lib/VideoPicker/VideoSlider.js +100 -0
- package/lib/VideoPicker/index.js +13 -0
- package/lib/VideoPicker/videoPropType.js +25 -0
- package/lib/index.js +37 -1
- package/lib-module/Breadcrumbs/Item/Item.js +32 -7
- package/lib-module/Callout/Callout.js +24 -3
- package/lib-module/Disclaimer/Disclaimer.js +54 -0
- package/lib-module/Disclaimer/index.js +1 -0
- package/lib-module/Footnote/Footnote.js +3 -3
- package/lib-module/Footnote/FootnoteLink.js +12 -14
- package/lib-module/NavigationBar/NavigationBar.js +207 -0
- package/lib-module/NavigationBar/NavigationItem.js +87 -0
- package/lib-module/NavigationBar/NavigationSubMenu.js +161 -0
- package/lib-module/NavigationBar/collapseItems.js +43 -0
- package/lib-module/NavigationBar/index.js +2 -0
- package/lib-module/PriceLockup/PriceLockup.js +42 -19
- package/lib-module/PriceLockup/tokens.js +54 -119
- package/lib-module/Progress/ProgressBar.js +83 -0
- package/lib-module/Progress/index.js +4 -0
- package/lib-module/Ribbon/Ribbon.js +53 -32
- package/lib-module/Spinner/Spinner.js +17 -14
- package/lib-module/Table/Cell.js +15 -1
- package/lib-module/VideoPicker/VideoPicker.js +151 -0
- package/lib-module/VideoPicker/VideoPickerPlayer.js +41 -0
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +180 -0
- package/lib-module/VideoPicker/VideoSlider.js +83 -0
- package/lib-module/VideoPicker/index.js +2 -0
- package/lib-module/VideoPicker/videoPropType.js +9 -0
- package/lib-module/index.js +4 -0
- package/package.json +3 -3
- package/src/Breadcrumbs/Item/Item.jsx +18 -4
- package/src/Callout/Callout.jsx +27 -3
- package/src/Disclaimer/Disclaimer.jsx +39 -0
- package/src/Disclaimer/index.js +1 -0
- package/src/Footnote/Footnote.jsx +3 -3
- package/src/Footnote/FootnoteLink.jsx +28 -18
- package/src/NavigationBar/NavigationBar.jsx +217 -0
- package/src/NavigationBar/NavigationItem.jsx +83 -0
- package/src/NavigationBar/NavigationSubMenu.jsx +121 -0
- package/src/NavigationBar/collapseItems.js +29 -0
- package/src/NavigationBar/index.js +3 -0
- package/src/PriceLockup/PriceLockup.jsx +47 -21
- package/src/PriceLockup/tokens.js +34 -54
- package/src/Progress/ProgressBar.jsx +67 -0
- package/src/Progress/index.js +6 -0
- package/src/Ribbon/Ribbon.jsx +21 -9
- package/src/Spinner/Spinner.jsx +20 -17
- package/src/Table/Cell.jsx +22 -5
- package/src/VideoPicker/VideoPicker.jsx +144 -0
- package/src/VideoPicker/VideoPickerPlayer.jsx +21 -0
- package/src/VideoPicker/VideoPickerThumbnail.jsx +182 -0
- package/src/VideoPicker/VideoSlider.jsx +85 -0
- package/src/VideoPicker/index.js +3 -0
- package/src/VideoPicker/videoPropType.js +12 -0
- package/src/index.js +4 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _utils = require("../utils");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
27
|
+
const defaultMaxWidth = 192;
|
|
28
|
+
|
|
29
|
+
const ItemContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
30
|
+
displayName: "NavigationItem__ItemContainer",
|
|
31
|
+
componentId: "components-web__sc-ql9x7c-0"
|
|
32
|
+
})(_ref => {
|
|
33
|
+
let {
|
|
34
|
+
targetWidth
|
|
35
|
+
} = _ref;
|
|
36
|
+
return {
|
|
37
|
+
display: 'flex',
|
|
38
|
+
flexDirection: 'column',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
maxWidth: `${Math.max(defaultMaxWidth, targetWidth ?? 0)}px`,
|
|
41
|
+
flexGrow: targetWidth ? 1 : 0,
|
|
42
|
+
flexShrink: 1
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* NavigationItem within a NavigationBar component.
|
|
47
|
+
*
|
|
48
|
+
* This is rendered automatically by `NavigationBar` and isn't intended be used directly.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const NavigationItem = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
53
|
+
let {
|
|
54
|
+
accessibilityRole = 'link',
|
|
55
|
+
// @todo switch to 'button' for dropdowns
|
|
56
|
+
children,
|
|
57
|
+
id,
|
|
58
|
+
onClick: handleClick = () => {},
|
|
59
|
+
selected,
|
|
60
|
+
accessibilityState = {
|
|
61
|
+
current: selected ? 'page' : false
|
|
62
|
+
},
|
|
63
|
+
href,
|
|
64
|
+
tokens,
|
|
65
|
+
variant = {},
|
|
66
|
+
...rest
|
|
67
|
+
} = _ref2;
|
|
68
|
+
const selectedProps = selectProps(rest);
|
|
69
|
+
const targetWidth = (0, _componentsBase.useResponsiveProp)({
|
|
70
|
+
xs: 288,
|
|
71
|
+
lg: null
|
|
72
|
+
});
|
|
73
|
+
const viewport = (0, _componentsBase.useViewport)();
|
|
74
|
+
const getTokens = (0, _componentsBase.useThemeTokensCallback)('NavigationBar', tokens, variant);
|
|
75
|
+
|
|
76
|
+
const getStateTokens = state => getTokens({ ...state,
|
|
77
|
+
viewport
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemContainer, {
|
|
81
|
+
targetWidth: targetWidth,
|
|
82
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Button, {
|
|
83
|
+
accessibilityRole: accessibilityRole,
|
|
84
|
+
accessibilityState: accessibilityState,
|
|
85
|
+
onPress: handleClick,
|
|
86
|
+
ref: ref,
|
|
87
|
+
tokens: getStateTokens,
|
|
88
|
+
variant: {
|
|
89
|
+
selected
|
|
90
|
+
},
|
|
91
|
+
href: href,
|
|
92
|
+
...selectedProps,
|
|
93
|
+
children: children
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
NavigationItem.displayName = 'NavigationItem';
|
|
98
|
+
NavigationItem.propTypes = { ...selectedSystemPropTypes,
|
|
99
|
+
..._componentsBase.withLinkRouter.propTypes,
|
|
100
|
+
onClick: _propTypes.default.func,
|
|
101
|
+
selected: _propTypes.default.bool,
|
|
102
|
+
children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]).isRequired
|
|
103
|
+
};
|
|
104
|
+
NavigationItem.defaultProps = {
|
|
105
|
+
onClick: () => {},
|
|
106
|
+
selected: false
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var _default = (0, _componentsBase.withLinkRouter)(NavigationItem);
|
|
110
|
+
|
|
111
|
+
exports.default = _default;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
13
|
+
|
|
14
|
+
var _NavigationItem = _interopRequireDefault(require("./NavigationItem"));
|
|
15
|
+
|
|
16
|
+
var _Listbox = _interopRequireDefault(require("../Listbox"));
|
|
17
|
+
|
|
18
|
+
var _useOverlaidPosition = _interopRequireDefault(require("../utils/useOverlaidPosition"));
|
|
19
|
+
|
|
20
|
+
var _resolveItemSelection = _interopRequireDefault(require("./resolveItemSelection"));
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A NavigationItem that opens or closes a Listbox of other NavigationItems.
|
|
32
|
+
*
|
|
33
|
+
* This is rendered automatically by `NavigationBar` and isn't intended be used directly.
|
|
34
|
+
*/
|
|
35
|
+
const NavigationSubMenu = _ref => {
|
|
36
|
+
let {
|
|
37
|
+
children,
|
|
38
|
+
id,
|
|
39
|
+
isOpen = false,
|
|
40
|
+
label,
|
|
41
|
+
onClick,
|
|
42
|
+
selectedId,
|
|
43
|
+
items = [],
|
|
44
|
+
openOverlayRef,
|
|
45
|
+
LinkRouter,
|
|
46
|
+
linkRouterProps
|
|
47
|
+
} = _ref;
|
|
48
|
+
const focusTrapRef = (0, _react.useRef)();
|
|
49
|
+
const maxWidth = 289; // Slightly over 288 of nav item to account for subpixel rounding
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
align,
|
|
53
|
+
offsets,
|
|
54
|
+
minWidth
|
|
55
|
+
} = (0, _componentsBase.useResponsiveProp)({
|
|
56
|
+
xs: {
|
|
57
|
+
align: {
|
|
58
|
+
top: 'top',
|
|
59
|
+
left: 'left'
|
|
60
|
+
},
|
|
61
|
+
minWidth: maxWidth
|
|
62
|
+
},
|
|
63
|
+
sm: {
|
|
64
|
+
align: {
|
|
65
|
+
top: 'top',
|
|
66
|
+
right: 'right'
|
|
67
|
+
},
|
|
68
|
+
minWidth: maxWidth
|
|
69
|
+
},
|
|
70
|
+
lg: {
|
|
71
|
+
align: {
|
|
72
|
+
top: 'bottom',
|
|
73
|
+
center: 'center'
|
|
74
|
+
},
|
|
75
|
+
offsets: {
|
|
76
|
+
vertical: 4
|
|
77
|
+
},
|
|
78
|
+
minWidth: 192
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const {
|
|
82
|
+
overlaidPosition,
|
|
83
|
+
sourceRef,
|
|
84
|
+
targetRef,
|
|
85
|
+
onTargetLayout,
|
|
86
|
+
isReady
|
|
87
|
+
} = (0, _useOverlaidPosition.default)({
|
|
88
|
+
isShown: isOpen,
|
|
89
|
+
offsets,
|
|
90
|
+
align
|
|
91
|
+
});
|
|
92
|
+
const {
|
|
93
|
+
selected
|
|
94
|
+
} = (0, _resolveItemSelection.default)({
|
|
95
|
+
id,
|
|
96
|
+
label,
|
|
97
|
+
items
|
|
98
|
+
}, selectedId);
|
|
99
|
+
|
|
100
|
+
const handleClick = event => {
|
|
101
|
+
if (typeof onClick === 'function') onClick(event);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const {
|
|
105
|
+
icoMenu
|
|
106
|
+
} = (0, _componentsBase.useThemeTokens)('NavigationBar', {}, {}, {
|
|
107
|
+
expanded: isOpen
|
|
108
|
+
});
|
|
109
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
110
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_NavigationItem.default, {
|
|
111
|
+
ref: sourceRef,
|
|
112
|
+
accessibilityRole: "button",
|
|
113
|
+
id: id,
|
|
114
|
+
selected: selected,
|
|
115
|
+
onClick: handleClick,
|
|
116
|
+
icon: icoMenu,
|
|
117
|
+
children: _ref2 => {
|
|
118
|
+
var _textStyles$, _textStyles$2;
|
|
119
|
+
|
|
120
|
+
let {
|
|
121
|
+
textStyles
|
|
122
|
+
} = _ref2;
|
|
123
|
+
return [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
|
|
124
|
+
space: 1,
|
|
125
|
+
direction: "row"
|
|
126
|
+
}, `${id}_spacer`), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
|
|
127
|
+
icon: icoMenu,
|
|
128
|
+
variant: {
|
|
129
|
+
size: 'small'
|
|
130
|
+
},
|
|
131
|
+
tokens: {
|
|
132
|
+
color: (_textStyles$ = textStyles[0]) === null || _textStyles$ === void 0 ? void 0 : _textStyles$.color,
|
|
133
|
+
size: (_textStyles$2 = textStyles[0]) === null || _textStyles$2 === void 0 ? void 0 : _textStyles$2.fontSize
|
|
134
|
+
}
|
|
135
|
+
}, `${id}_icon`)];
|
|
136
|
+
}
|
|
137
|
+
}), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
138
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Listbox.default.Overlay, {
|
|
139
|
+
overlaidPosition: overlaidPosition,
|
|
140
|
+
maxWidth: maxWidth,
|
|
141
|
+
minWidth: minWidth,
|
|
142
|
+
isReady: isReady,
|
|
143
|
+
onLayout: onTargetLayout,
|
|
144
|
+
ref: openOverlayRef,
|
|
145
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Listbox.default, {
|
|
146
|
+
items: items,
|
|
147
|
+
firstItemRef: targetRef,
|
|
148
|
+
parentRef: sourceRef,
|
|
149
|
+
selectedId: selectedId,
|
|
150
|
+
LinkRouter: LinkRouter,
|
|
151
|
+
linkRouterProps: linkRouterProps
|
|
152
|
+
})
|
|
153
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
154
|
+
// This catches and shifts focus to other interactive elements.
|
|
155
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
156
|
+
tabIndex: 0,
|
|
157
|
+
ref: focusTrapRef,
|
|
158
|
+
onFocus: () => targetRef.current.focus()
|
|
159
|
+
})]
|
|
160
|
+
})]
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
NavigationSubMenu.displayName = 'NavigationSubMenu'; // @TODO - proper prop types and comments
|
|
165
|
+
|
|
166
|
+
NavigationSubMenu.propTypes = {
|
|
167
|
+
children: _propTypes.default.node,
|
|
168
|
+
id: _propTypes.default.string,
|
|
169
|
+
isOpen: _propTypes.default.bool,
|
|
170
|
+
label: _propTypes.default.string,
|
|
171
|
+
onClick: _propTypes.default.func,
|
|
172
|
+
selectedId: _propTypes.default.string,
|
|
173
|
+
items: _propTypes.default.array,
|
|
174
|
+
openOverlayRef: _propTypes.default.object,
|
|
175
|
+
LinkRouter: _propTypes.default.elementType,
|
|
176
|
+
linkRouterProps: _propTypes.default.object
|
|
177
|
+
};
|
|
178
|
+
var _default = NavigationSubMenu;
|
|
179
|
+
exports.default = _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Make a list of items into a one-item list where all items are nested under the first item
|
|
10
|
+
*/
|
|
11
|
+
const collapseItems = (items, selectedId) => {
|
|
12
|
+
if (!(items !== null && items !== void 0 && items.length)) return items; // Give the root item the label of the current active link
|
|
13
|
+
// (or the first item if for some reason there's no match on the selectedId)
|
|
14
|
+
|
|
15
|
+
let rootLabel = items[0].label;
|
|
16
|
+
|
|
17
|
+
const isSelected = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
label,
|
|
20
|
+
id
|
|
21
|
+
} = _ref;
|
|
22
|
+
return selectedId === id ?? label;
|
|
23
|
+
}; // Linter doesn't like for loops, simulate loop that breaks
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
items.some(item => {
|
|
27
|
+
var _item$items;
|
|
28
|
+
|
|
29
|
+
if (isSelected(item)) {
|
|
30
|
+
rootLabel = item.label;
|
|
31
|
+
return true; // break
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const nestedMatch = (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.find(isSelected);
|
|
35
|
+
|
|
36
|
+
if (nestedMatch) {
|
|
37
|
+
rootLabel = nestedMatch.label;
|
|
38
|
+
return true; // break
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return false; // continue
|
|
42
|
+
});
|
|
43
|
+
return [{
|
|
44
|
+
id: 'navigation-bar-root',
|
|
45
|
+
label: rootLabel,
|
|
46
|
+
items
|
|
47
|
+
}];
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var _default = collapseItems;
|
|
51
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _NavigationBar = _interopRequireDefault(require("./NavigationBar"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _NavigationBar.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -100,12 +100,25 @@ const StrikeThroughContainer = /*#__PURE__*/_styledComponents.default.div.withCo
|
|
|
100
100
|
return strikeThroughHeight;
|
|
101
101
|
}, _ref8 => {
|
|
102
102
|
let {
|
|
103
|
-
|
|
103
|
+
strikeThroughColor
|
|
104
104
|
} = _ref8;
|
|
105
|
-
return
|
|
105
|
+
return strikeThroughColor;
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
const
|
|
108
|
+
const selectFootnoteLinkStyles = _ref9 => {
|
|
109
|
+
let {
|
|
110
|
+
footnoteLinkColor,
|
|
111
|
+
footnoteLinkFontName,
|
|
112
|
+
footnoteLinkFontWeight
|
|
113
|
+
} = _ref9;
|
|
114
|
+
return {
|
|
115
|
+
color: footnoteLinkColor,
|
|
116
|
+
fontName: footnoteLinkFontName,
|
|
117
|
+
fontWeight: footnoteLinkFontWeight
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const PriceLockup = _ref10 => {
|
|
109
122
|
let {
|
|
110
123
|
size = 'medium',
|
|
111
124
|
signDirection = 'left',
|
|
@@ -121,7 +134,8 @@ const PriceLockup = _ref9 => {
|
|
|
121
134
|
tokens: priceLockupTokens,
|
|
122
135
|
variant = {},
|
|
123
136
|
...rest
|
|
124
|
-
} =
|
|
137
|
+
} = _ref10;
|
|
138
|
+
const viewport = (0, _componentsBase.useViewport)();
|
|
125
139
|
const {
|
|
126
140
|
footnoteMarginTop,
|
|
127
141
|
footnoteGap,
|
|
@@ -130,10 +144,18 @@ const PriceLockup = _ref9 => {
|
|
|
130
144
|
bottomLinksMarginLeft,
|
|
131
145
|
topTextMarginBottom,
|
|
132
146
|
strikeThroughHeight,
|
|
133
|
-
|
|
147
|
+
strikeThroughColor,
|
|
134
148
|
fontColor,
|
|
135
|
-
dividerColor
|
|
136
|
-
|
|
149
|
+
dividerColor,
|
|
150
|
+
footnoteLinkFontSize,
|
|
151
|
+
...themeTokens
|
|
152
|
+
} = (0, _componentsBase.useThemeTokens)('PriceLockup', priceLockupTokens, { ...variant,
|
|
153
|
+
size
|
|
154
|
+
}, {
|
|
155
|
+
viewport,
|
|
156
|
+
strikeThrough
|
|
157
|
+
});
|
|
158
|
+
const typographyTokens = (0, _tokens.default)(themeTokens);
|
|
137
159
|
const priceString = String(price);
|
|
138
160
|
const lastDotPosition = priceString.lastIndexOf('.');
|
|
139
161
|
const lastCommaPosition = priceString.lastIndexOf(',');
|
|
@@ -143,24 +165,25 @@ const PriceLockup = _ref9 => {
|
|
|
143
165
|
const hasCents = separatorPosition !== -1 && separatorPosition >= priceString.length - 3;
|
|
144
166
|
const amount = hasCents ? priceString.substring(0, separatorPosition) : priceString;
|
|
145
167
|
const cents = hasCents ? priceString.substring(separatorPosition + 1) : null;
|
|
146
|
-
const color = strikeThrough ? strikeThroughBackground : fontColor;
|
|
147
168
|
|
|
148
169
|
const renderTypography = (value, tokens) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
149
170
|
tokens: { ...tokens,
|
|
150
|
-
color
|
|
171
|
+
color: fontColor
|
|
151
172
|
},
|
|
152
173
|
children: value
|
|
153
174
|
});
|
|
154
175
|
|
|
155
|
-
const renderCurrencySymbol = () => renderTypography(`${currencySymbol}`,
|
|
176
|
+
const renderCurrencySymbol = () => renderTypography(`${currencySymbol}`, typographyTokens.dollarSign);
|
|
156
177
|
|
|
157
178
|
const renderFootnoteLinks = () => footnoteLinks && footnoteLinks.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FootnoteLink.default, {
|
|
179
|
+
fontSize: footnoteLinkFontSize,
|
|
180
|
+
tokens: selectFootnoteLinkStyles(themeTokens),
|
|
158
181
|
number: footnoteLinks,
|
|
159
182
|
onClick: onClickFootnote
|
|
160
183
|
}) : null;
|
|
161
184
|
|
|
162
185
|
const renderAmount = () => {
|
|
163
|
-
const amountComponent = renderTypography(amount,
|
|
186
|
+
const amountComponent = renderTypography(amount, typographyTokens.amount);
|
|
164
187
|
|
|
165
188
|
if (strikeThrough) {
|
|
166
189
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -168,7 +191,7 @@ const PriceLockup = _ref9 => {
|
|
|
168
191
|
text: a11yText
|
|
169
192
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StrikeThroughContainer, {
|
|
170
193
|
strikeThroughHeight: `${strikeThroughHeight}px`,
|
|
171
|
-
|
|
194
|
+
strikeThroughColor: strikeThroughColor,
|
|
172
195
|
children: amountComponent
|
|
173
196
|
})]
|
|
174
197
|
});
|
|
@@ -180,10 +203,10 @@ const PriceLockup = _ref9 => {
|
|
|
180
203
|
const renderPrice = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
181
204
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceContainer, {
|
|
182
205
|
priceMarginBottom: `${priceMarginBottom}px`,
|
|
183
|
-
children: [signDirection === 'left' && renderCurrencySymbol(), renderAmount(), cents && renderTypography(`${separator}${cents}`,
|
|
206
|
+
children: [signDirection === 'left' && renderCurrencySymbol(), renderAmount(), cents && renderTypography(`${separator}${cents}`, typographyTokens.cents), signDirection === 'right' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
184
207
|
children: ["\xA0", renderCurrencySymbol()]
|
|
185
208
|
}), rateText && /*#__PURE__*/(0, _jsxRuntime.jsx)(RateTextContainer, {
|
|
186
|
-
children: renderTypography(rateText,
|
|
209
|
+
children: renderTypography(rateText, typographyTokens.rate)
|
|
187
210
|
}), !bottomText && footnoteLinks.length <= 3 && /*#__PURE__*/(0, _jsxRuntime.jsx)(BottomLinksContainer, {
|
|
188
211
|
bottomLinksMarginLeft: `${bottomLinksMarginLeft}px`,
|
|
189
212
|
children: renderFootnoteLinks()
|
|
@@ -197,7 +220,7 @@ const PriceLockup = _ref9 => {
|
|
|
197
220
|
footnoteGap: `${footnoteGap}px`,
|
|
198
221
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BottomTextContainer, {
|
|
199
222
|
bottomTextMarginTop: `${bottomTextMarginTop}px`,
|
|
200
|
-
children: renderTypography(bottomText,
|
|
223
|
+
children: renderTypography(bottomText, typographyTokens.bottomText)
|
|
201
224
|
}), footnoteLinks.length <= 3 && renderFootnoteLinks()]
|
|
202
225
|
}), footnoteLinks.length > 3 && renderFootnoteLinks()]
|
|
203
226
|
});
|
|
@@ -209,12 +232,12 @@ const PriceLockup = _ref9 => {
|
|
|
209
232
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceLockupContainer, { ...selectProps(rest),
|
|
210
233
|
children: [topText && /*#__PURE__*/(0, _jsxRuntime.jsx)(TopTextContainer, {
|
|
211
234
|
topTextMarginBottom: `${topTextMarginBottom}px`,
|
|
212
|
-
children: renderTypography(topText,
|
|
235
|
+
children: renderTypography(topText, typographyTokens.topText)
|
|
213
236
|
}), renderPrice(), bottomText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Divider, {
|
|
214
237
|
testID: "price-lockup-divider",
|
|
215
238
|
role: "separator",
|
|
216
239
|
tokens: {
|
|
217
|
-
color: dividerColor
|
|
240
|
+
color: dividerColor ?? 'rgba(0, 0, 0, 0)'
|
|
218
241
|
}
|
|
219
242
|
}), bottomText && renderFootnoteContent()]
|
|
220
243
|
});
|
|
@@ -5,127 +5,60 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
condensed
|
|
35
|
-
}
|
|
36
|
-
} = _palette.default;
|
|
37
|
-
const typographyTokens = {
|
|
38
|
-
topText: {
|
|
39
|
-
small: {
|
|
40
|
-
fontSize: size14,
|
|
41
|
-
lineHeight: ratio10to7
|
|
42
|
-
},
|
|
43
|
-
medium: {
|
|
44
|
-
fontSize: size16,
|
|
45
|
-
lineHeight: ratio3to2
|
|
46
|
-
},
|
|
47
|
-
large: {
|
|
48
|
-
fontSize: size20,
|
|
49
|
-
lineHeight: ratio8to5
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
dollarSign: {
|
|
53
|
-
small: {
|
|
54
|
-
fontSize: size16,
|
|
55
|
-
lineHeight: ratio5to4
|
|
56
|
-
},
|
|
57
|
-
medium: {
|
|
58
|
-
fontSize: size20,
|
|
59
|
-
lineHeight: ratio6to5
|
|
8
|
+
// map typography tokens accordenly
|
|
9
|
+
var _default = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
topTextFontSize,
|
|
12
|
+
fontColor,
|
|
13
|
+
topTextLineHeight,
|
|
14
|
+
currencySymbolFontSize,
|
|
15
|
+
currencySymbolLineHeight,
|
|
16
|
+
currencySymbolFontWeight,
|
|
17
|
+
amountFontSize,
|
|
18
|
+
amountLineHeight,
|
|
19
|
+
amountLetterSpacing,
|
|
20
|
+
amountFontWeight,
|
|
21
|
+
centsFontSize,
|
|
22
|
+
centsLineHeight,
|
|
23
|
+
rateFontSize,
|
|
24
|
+
rateLineHeight,
|
|
25
|
+
bottomTextFontSize,
|
|
26
|
+
bottomTextLineHeight,
|
|
27
|
+
rateFontWeight,
|
|
28
|
+
centsFontWeight
|
|
29
|
+
} = _ref;
|
|
30
|
+
return {
|
|
31
|
+
topText: {
|
|
32
|
+
fontSize: topTextFontSize,
|
|
33
|
+
lineHeight: topTextLineHeight
|
|
60
34
|
},
|
|
61
|
-
|
|
62
|
-
fontSize:
|
|
63
|
-
lineHeight:
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
// TODO - fontWeight should have its own const on palette
|
|
67
|
-
amount: {
|
|
68
|
-
small: {
|
|
69
|
-
fontSize: size28,
|
|
70
|
-
lineHeight: ratio1to1,
|
|
71
|
-
letterSpacing: condensed,
|
|
72
|
-
fontWeight: '300'
|
|
35
|
+
dollarSign: {
|
|
36
|
+
fontSize: currencySymbolFontSize,
|
|
37
|
+
lineHeight: currencySymbolLineHeight,
|
|
38
|
+
fontWeight: currencySymbolFontWeight
|
|
73
39
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
40
|
+
amount: {
|
|
41
|
+
color: fontColor,
|
|
42
|
+
fontSize: amountFontSize,
|
|
43
|
+
lineHeight: amountLineHeight,
|
|
44
|
+
letterSpacing: amountLetterSpacing,
|
|
45
|
+
fontWeight: amountFontWeight
|
|
79
46
|
},
|
|
80
|
-
|
|
81
|
-
fontSize:
|
|
82
|
-
lineHeight:
|
|
83
|
-
|
|
84
|
-
fontWeight: '300'
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
cents: {
|
|
88
|
-
small: {
|
|
89
|
-
fontSize: size16,
|
|
90
|
-
lineHeight: ratio4to3
|
|
47
|
+
cents: {
|
|
48
|
+
fontSize: centsFontSize,
|
|
49
|
+
lineHeight: centsLineHeight,
|
|
50
|
+
fontWeight: centsFontWeight
|
|
91
51
|
},
|
|
92
|
-
|
|
93
|
-
fontSize:
|
|
94
|
-
lineHeight:
|
|
52
|
+
rate: {
|
|
53
|
+
fontSize: rateFontSize,
|
|
54
|
+
lineHeight: rateLineHeight,
|
|
55
|
+
fontWeight: rateFontWeight
|
|
95
56
|
},
|
|
96
|
-
|
|
97
|
-
fontSize:
|
|
98
|
-
lineHeight:
|
|
57
|
+
bottomText: {
|
|
58
|
+
fontSize: bottomTextFontSize,
|
|
59
|
+
lineHeight: bottomTextLineHeight
|
|
99
60
|
}
|
|
100
|
-
}
|
|
101
|
-
rate: {
|
|
102
|
-
small: {
|
|
103
|
-
fontSize: size14,
|
|
104
|
-
lineHeight: ratio8to7
|
|
105
|
-
},
|
|
106
|
-
medium: {
|
|
107
|
-
fontSize: size16,
|
|
108
|
-
lineHeight: ratio5to4
|
|
109
|
-
},
|
|
110
|
-
large: {
|
|
111
|
-
fontSize: size20,
|
|
112
|
-
lineHeight: ratio8to5
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
bottomText: {
|
|
116
|
-
small: {
|
|
117
|
-
fontSize: size14,
|
|
118
|
-
lineHeight: ratio10to7
|
|
119
|
-
},
|
|
120
|
-
medium: {
|
|
121
|
-
fontSize: size16,
|
|
122
|
-
lineHeight: ratio3to2
|
|
123
|
-
},
|
|
124
|
-
large: {
|
|
125
|
-
fontSize: size20,
|
|
126
|
-
lineHeight: ratio8to5
|
|
127
|
-
}
|
|
128
|
-
}
|
|
61
|
+
};
|
|
129
62
|
};
|
|
130
|
-
|
|
63
|
+
|
|
131
64
|
exports.default = _default;
|