@telus-uds/components-base 1.74.0 → 1.76.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/Carousel/CarouselThumbnail.js +10 -4
- package/lib/Carousel/CarouselThumbnailNavigation.js +3 -3
- package/lib/Footnote/Footnote.js +9 -13
- package/lib/Link/ChevronLink.js +2 -0
- package/lib/Link/InlinePressable.js +15 -2
- package/lib/Link/LinkBase.js +1 -0
- package/lib/Notification/Notification.js +213 -35
- package/lib/OrderedList/OrderedList.js +21 -20
- package/lib/PriceLockup/PriceLockup.js +220 -0
- package/lib/PriceLockup/index.js +10 -0
- package/lib/PriceLockup/utils/renderFootnoteContent.js +93 -0
- package/lib/PriceLockup/utils/renderFootnoteLinks.js +36 -0
- package/lib/PriceLockup/utils/renderPrice.js +147 -0
- package/lib/PriceLockup/utils/renderTypography.js +31 -0
- package/lib/index.js +8 -0
- package/lib/utils/ssr-media-query/create-stylesheet/index.js +1 -2
- package/lib-module/Carousel/CarouselThumbnail.js +10 -4
- package/lib-module/Carousel/CarouselThumbnailNavigation.js +3 -3
- package/lib-module/Footnote/Footnote.js +9 -13
- package/lib-module/Link/ChevronLink.js +2 -0
- package/lib-module/Link/InlinePressable.js +16 -2
- package/lib-module/Link/LinkBase.js +1 -0
- package/lib-module/Notification/Notification.js +216 -38
- package/lib-module/OrderedList/OrderedList.js +21 -20
- package/lib-module/PriceLockup/PriceLockup.js +214 -0
- package/lib-module/PriceLockup/index.js +2 -0
- package/lib-module/PriceLockup/utils/renderFootnoteContent.js +87 -0
- package/lib-module/PriceLockup/utils/renderFootnoteLinks.js +28 -0
- package/lib-module/PriceLockup/utils/renderPrice.js +141 -0
- package/lib-module/PriceLockup/utils/renderTypography.js +23 -0
- package/lib-module/index.js +1 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/index.js +1 -2
- package/package.json +2 -2
- package/src/Carousel/CarouselThumbnail.jsx +8 -6
- package/src/Carousel/CarouselThumbnailNavigation.jsx +3 -4
- package/src/Footnote/Footnote.jsx +3 -6
- package/src/Link/ChevronLink.jsx +5 -1
- package/src/Link/InlinePressable.jsx +36 -15
- package/src/Link/LinkBase.jsx +1 -0
- package/src/Notification/Notification.jsx +213 -34
- package/src/OrderedList/OrderedList.jsx +17 -20
- package/src/PriceLockup/PriceLockup.jsx +218 -0
- package/src/PriceLockup/index.js +3 -0
- package/src/PriceLockup/utils/renderFootnoteContent.jsx +77 -0
- package/src/PriceLockup/utils/renderFootnoteLinks.jsx +38 -0
- package/src/PriceLockup/utils/renderPrice.jsx +201 -0
- package/src/PriceLockup/utils/renderTypography.jsx +13 -0
- package/src/index.js +1 -0
- package/src/utils/ssr-media-query/create-stylesheet/index.js +3 -2
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
9
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _Divider = _interopRequireDefault(require("../Divider"));
|
|
12
|
+
var _ViewportProvider = require("../ViewportProvider");
|
|
13
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
14
|
+
var _utils = require("../utils");
|
|
15
|
+
var _renderFootnoteContent = _interopRequireDefault(require("./utils/renderFootnoteContent"));
|
|
16
|
+
var _renderPrice = _interopRequireDefault(require("./utils/renderPrice"));
|
|
17
|
+
var _renderTypography = _interopRequireDefault(require("./utils/renderTypography"));
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.htmlAttrs, _utils.viewProps]);
|
|
21
|
+
const selectTopTextTypographyTokens = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
topTextFontSize,
|
|
24
|
+
topTextLineHeight
|
|
25
|
+
} = _ref;
|
|
26
|
+
return {
|
|
27
|
+
fontSize: topTextFontSize,
|
|
28
|
+
lineHeight: topTextLineHeight
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const selectCurrencySymbolTypographyTokens = _ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
currencySymbolFontSize,
|
|
34
|
+
currencySymbolLineHeight,
|
|
35
|
+
currencySymbolFontWeight
|
|
36
|
+
} = _ref2;
|
|
37
|
+
return {
|
|
38
|
+
fontSize: currencySymbolFontSize,
|
|
39
|
+
lineHeight: currencySymbolLineHeight,
|
|
40
|
+
fontWeight: currencySymbolFontWeight
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const selectAmountTypographyTokens = _ref3 => {
|
|
44
|
+
let {
|
|
45
|
+
amountFontSize,
|
|
46
|
+
amountLineHeight,
|
|
47
|
+
amountLetterSpacing,
|
|
48
|
+
amountFontWeight,
|
|
49
|
+
fontColor
|
|
50
|
+
} = _ref3;
|
|
51
|
+
// This is used to apply the proper line height to the amount
|
|
52
|
+
const lineHeightMultiplier = 1.18;
|
|
53
|
+
return {
|
|
54
|
+
color: fontColor,
|
|
55
|
+
fontSize: amountFontSize,
|
|
56
|
+
lineHeight: amountLineHeight * lineHeightMultiplier,
|
|
57
|
+
letterSpacing: amountLetterSpacing,
|
|
58
|
+
fontWeight: amountFontWeight
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const selectCentsTypographyTokens = _ref4 => {
|
|
62
|
+
let {
|
|
63
|
+
centsFontSize,
|
|
64
|
+
centsLineHeight,
|
|
65
|
+
centsFontWeight
|
|
66
|
+
} = _ref4;
|
|
67
|
+
return {
|
|
68
|
+
fontSize: centsFontSize,
|
|
69
|
+
lineHeight: centsLineHeight,
|
|
70
|
+
fontWeight: centsFontWeight
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
const selectRateTypographyTokens = _ref5 => {
|
|
74
|
+
let {
|
|
75
|
+
rateFontSize,
|
|
76
|
+
rateLineHeight,
|
|
77
|
+
rateFontWeight
|
|
78
|
+
} = _ref5;
|
|
79
|
+
return {
|
|
80
|
+
fontSize: rateFontSize,
|
|
81
|
+
lineHeight: rateLineHeight,
|
|
82
|
+
fontWeight: rateFontWeight
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const selectBottomTextTypographyTokens = _ref6 => {
|
|
86
|
+
let {
|
|
87
|
+
bottomTextFontSize,
|
|
88
|
+
bottomTextLineHeight
|
|
89
|
+
} = _ref6;
|
|
90
|
+
return {
|
|
91
|
+
fontSize: bottomTextFontSize,
|
|
92
|
+
lineHeight: bottomTextLineHeight
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
const PriceLockup = _ref7 => {
|
|
96
|
+
let {
|
|
97
|
+
size = 'medium',
|
|
98
|
+
signDirection = 'left',
|
|
99
|
+
footnoteLinks,
|
|
100
|
+
topText,
|
|
101
|
+
price,
|
|
102
|
+
currencySymbol = '$',
|
|
103
|
+
rateText,
|
|
104
|
+
ratePosition = 'right',
|
|
105
|
+
bottomText,
|
|
106
|
+
onClickFootnote,
|
|
107
|
+
strikeThrough,
|
|
108
|
+
a11yText,
|
|
109
|
+
tokens: priceLockupTokens,
|
|
110
|
+
variant = {},
|
|
111
|
+
...rest
|
|
112
|
+
} = _ref7;
|
|
113
|
+
const viewport = (0, _ViewportProvider.useViewport)();
|
|
114
|
+
const {
|
|
115
|
+
footnoteMarginTop,
|
|
116
|
+
footnoteGap,
|
|
117
|
+
bottomTextMarginTop,
|
|
118
|
+
priceMarginBottom,
|
|
119
|
+
bottomLinksMarginLeft,
|
|
120
|
+
topTextMarginBottom,
|
|
121
|
+
fontColor,
|
|
122
|
+
dividerColor,
|
|
123
|
+
...themeTokens
|
|
124
|
+
} = (0, _ThemeProvider.useThemeTokens)('PriceLockup', priceLockupTokens, {
|
|
125
|
+
...variant,
|
|
126
|
+
size
|
|
127
|
+
}, {
|
|
128
|
+
viewport,
|
|
129
|
+
strikeThrough
|
|
130
|
+
});
|
|
131
|
+
const currencySymbolTypographyTokens = selectCurrencySymbolTypographyTokens(themeTokens);
|
|
132
|
+
const amountTypographyTokens = selectAmountTypographyTokens(themeTokens);
|
|
133
|
+
const centsTypographyTokens = selectCentsTypographyTokens(themeTokens);
|
|
134
|
+
const rateTypographyTokens = selectRateTypographyTokens(themeTokens);
|
|
135
|
+
const topTextTypographyTokens = selectTopTextTypographyTokens(themeTokens);
|
|
136
|
+
const bottomTextTypographyTokens = selectBottomTextTypographyTokens(themeTokens);
|
|
137
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
138
|
+
style: [staticStyles.priceLockupContainer, {
|
|
139
|
+
...selectProps(rest)
|
|
140
|
+
}],
|
|
141
|
+
children: [topText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
142
|
+
children: (0, _renderTypography.default)(topText, topTextTypographyTokens)
|
|
143
|
+
}) : null, (0, _renderPrice.default)(price, rateText, ratePosition, signDirection, currencySymbol, currencySymbolTypographyTokens, amountTypographyTokens, centsTypographyTokens, rateTypographyTokens, fontColor, strikeThrough, a11yText, bottomText, bottomLinksMarginLeft, footnoteLinks, onClickFootnote, themeTokens), bottomText ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
144
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
145
|
+
testID: "price-lockup-divider",
|
|
146
|
+
role: "separator",
|
|
147
|
+
tokens: {
|
|
148
|
+
color: dividerColor
|
|
149
|
+
}
|
|
150
|
+
}), (0, _renderFootnoteContent.default)(footnoteMarginTop, bottomTextMarginTop, bottomText, bottomTextTypographyTokens, fontColor, footnoteLinks, bottomLinksMarginLeft, onClickFootnote, themeTokens)]
|
|
151
|
+
}) : null]
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
PriceLockup.displayName = 'PriceLockup';
|
|
155
|
+
PriceLockup.propTypes = {
|
|
156
|
+
...selectedSystemPropTypes,
|
|
157
|
+
/**
|
|
158
|
+
* Size of the component
|
|
159
|
+
*
|
|
160
|
+
* Small for pricing in product catalogue pages, medium for pricing in product comparison cards.
|
|
161
|
+
*/
|
|
162
|
+
size: _propTypes.default.oneOf(['small', 'medium']),
|
|
163
|
+
/**
|
|
164
|
+
* If currency symbol other than `$` to be used
|
|
165
|
+
*/
|
|
166
|
+
currencySymbol: _propTypes.default.string,
|
|
167
|
+
/**
|
|
168
|
+
* Shows additional info above the price
|
|
169
|
+
*/
|
|
170
|
+
topText: _propTypes.default.string,
|
|
171
|
+
/**
|
|
172
|
+
* Monetary value (including decimals separated by ".")
|
|
173
|
+
*/
|
|
174
|
+
price: _propTypes.default.string.isRequired,
|
|
175
|
+
/**
|
|
176
|
+
* Shows month/year unit
|
|
177
|
+
*/
|
|
178
|
+
rateText: _propTypes.default.string,
|
|
179
|
+
/**
|
|
180
|
+
* Shows additional info below the price with a `Divider`
|
|
181
|
+
*/
|
|
182
|
+
bottomText: _propTypes.default.string,
|
|
183
|
+
/**
|
|
184
|
+
* Displays which side the currency should appear (left, right)
|
|
185
|
+
*/
|
|
186
|
+
signDirection: _propTypes.default.oneOf(['right', 'left']),
|
|
187
|
+
/**
|
|
188
|
+
* Displays where the rate should appear (bottom, right)
|
|
189
|
+
*/
|
|
190
|
+
ratePosition: _propTypes.default.oneOf(['right', 'bottom']),
|
|
191
|
+
/**
|
|
192
|
+
* Shows additional link for context
|
|
193
|
+
*/
|
|
194
|
+
footnoteLinks: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])),
|
|
195
|
+
/**
|
|
196
|
+
* Function to be called when a footnote link is clicked
|
|
197
|
+
*/
|
|
198
|
+
onClickFootnote: _propTypes.default.func,
|
|
199
|
+
/**
|
|
200
|
+
* To show price savings comparison
|
|
201
|
+
*/
|
|
202
|
+
strikeThrough: _propTypes.default.bool,
|
|
203
|
+
/**
|
|
204
|
+
* To provide a11y text for `PriceLockup` component
|
|
205
|
+
*
|
|
206
|
+
* **Note:** a11yText will override strikethrough price, so it must include price (ie. "was 50 dollars per month")
|
|
207
|
+
*/
|
|
208
|
+
a11yText: _propTypes.default.string,
|
|
209
|
+
/**
|
|
210
|
+
* `PriceLockup` tokens
|
|
211
|
+
*/
|
|
212
|
+
tokens: (0, _utils.getTokensPropType)('PriceLockup')
|
|
213
|
+
};
|
|
214
|
+
var _default = PriceLockup;
|
|
215
|
+
exports.default = _default;
|
|
216
|
+
const staticStyles = _StyleSheet.default.create({
|
|
217
|
+
priceLockupContainer: {
|
|
218
|
+
alignSelf: 'flex-start'
|
|
219
|
+
}
|
|
220
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _PriceLockup = _interopRequireDefault(require("./PriceLockup"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = _PriceLockup.default;
|
|
10
|
+
exports.default = _default;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
9
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
10
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
11
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
12
|
+
var _renderTypography = _interopRequireDefault(require("./renderTypography"));
|
|
13
|
+
var _renderFootnoteLinks = _interopRequireDefault(require("./renderFootnoteLinks"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
const selectFootnoteContainer = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
footnoteMarginTop
|
|
19
|
+
} = _ref;
|
|
20
|
+
return {
|
|
21
|
+
marginTop: footnoteMarginTop
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const selectFootnoteBottomTextContainer = _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
bottomTextMarginTop
|
|
27
|
+
} = _ref2;
|
|
28
|
+
return {
|
|
29
|
+
marginTop: bottomTextMarginTop
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const selectFootnoteLinksStyles = _ref3 => {
|
|
33
|
+
let {
|
|
34
|
+
bottomLinksMarginLeft
|
|
35
|
+
} = _ref3;
|
|
36
|
+
return {
|
|
37
|
+
marginLeft: bottomLinksMarginLeft
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const renderFootnoteContent = (footnoteMarginTop, bottomTextMarginTop, bottomText, bottomTextTypographyTokens, fontColor, footnoteLinks, bottomLinksMarginLeft, onClickFootnote, themeTokens) => {
|
|
41
|
+
const MAX_FOOTNOTE_LINKS_ALLOWED = 3;
|
|
42
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
43
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
44
|
+
style: [staticStyles.footnoteContainer, selectFootnoteContainer({
|
|
45
|
+
footnoteMarginTop
|
|
46
|
+
})],
|
|
47
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Text.default, {
|
|
48
|
+
style: selectFootnoteBottomTextContainer({
|
|
49
|
+
bottomTextMarginTop
|
|
50
|
+
}),
|
|
51
|
+
children: [(0, _renderTypography.default)(bottomText, bottomTextTypographyTokens, undefined, fontColor), ' ']
|
|
52
|
+
}), footnoteLinks.length <= MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
53
|
+
style: [staticStyles.footnoteLinkContainer, selectFootnoteLinksStyles({
|
|
54
|
+
bottomLinksMarginLeft
|
|
55
|
+
})],
|
|
56
|
+
children: (0, _renderFootnoteLinks.default)(footnoteLinks, themeTokens, onClickFootnote)
|
|
57
|
+
}) : null]
|
|
58
|
+
}), footnoteLinks.length > MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
59
|
+
style: staticStyles.verticalFootnoteLinkContainer,
|
|
60
|
+
children: (0, _renderFootnoteLinks.default)(footnoteLinks, themeTokens, onClickFootnote)
|
|
61
|
+
}) : null]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var _default = renderFootnoteContent;
|
|
65
|
+
exports.default = _default;
|
|
66
|
+
const staticStyles = _StyleSheet.default.create({
|
|
67
|
+
footnoteContainer: {
|
|
68
|
+
flexDirection: 'row'
|
|
69
|
+
},
|
|
70
|
+
footnoteLinkContainer: {
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
..._Platform.default.select({
|
|
73
|
+
ios: {
|
|
74
|
+
alignSelf: 'flex-end',
|
|
75
|
+
top: 2
|
|
76
|
+
},
|
|
77
|
+
android: {
|
|
78
|
+
alignSelf: 'center',
|
|
79
|
+
top: -8
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
},
|
|
83
|
+
verticalFootnoteLinkContainer: {
|
|
84
|
+
..._Platform.default.select({
|
|
85
|
+
ios: {
|
|
86
|
+
top: 10
|
|
87
|
+
},
|
|
88
|
+
android: {
|
|
89
|
+
top: -2
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _FootnoteLink = _interopRequireDefault(require("../../Footnote/FootnoteLink"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const selectFootnoteLinkStyles = (_ref, footnoteLinks) => {
|
|
12
|
+
let {
|
|
13
|
+
footnoteLinkColor,
|
|
14
|
+
footnoteLinkFontName,
|
|
15
|
+
footnoteLinkFontWeight,
|
|
16
|
+
footnoteLinkLineHeight,
|
|
17
|
+
footnoteLinkFontSize
|
|
18
|
+
} = _ref;
|
|
19
|
+
// This is used to apply the proper line height when there is 4 or more footnote links
|
|
20
|
+
const MAX_FOOTNOTE_LINKS_ALLOWED = 3;
|
|
21
|
+
const lineHeight = footnoteLinks.length > MAX_FOOTNOTE_LINKS_ALLOWED ? footnoteLinkFontSize * footnoteLinkLineHeight : undefined;
|
|
22
|
+
return {
|
|
23
|
+
color: footnoteLinkColor,
|
|
24
|
+
fontName: footnoteLinkFontName,
|
|
25
|
+
fontWeight: footnoteLinkFontWeight,
|
|
26
|
+
lineHeight,
|
|
27
|
+
fontSize: footnoteLinkFontSize
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const renderFootnoteLinks = (footnoteLinks, themeTokens, onClickFootnote) => footnoteLinks && footnoteLinks.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FootnoteLink.default, {
|
|
31
|
+
tokens: selectFootnoteLinkStyles(themeTokens, footnoteLinks),
|
|
32
|
+
content: footnoteLinks,
|
|
33
|
+
onClick: onClickFootnote
|
|
34
|
+
}) : null;
|
|
35
|
+
var _default = renderFootnoteLinks;
|
|
36
|
+
exports.default = _default;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
9
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
10
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
11
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
12
|
+
var _A11yText = _interopRequireDefault(require("../../A11yText"));
|
|
13
|
+
var _renderTypography = _interopRequireDefault(require("./renderTypography"));
|
|
14
|
+
var _renderFootnoteLinks = _interopRequireDefault(require("./renderFootnoteLinks"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
const selectStrikeThroughStyles = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
strikeThroughColor
|
|
20
|
+
} = _ref;
|
|
21
|
+
return {
|
|
22
|
+
textDecorationColor: strikeThroughColor
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const selectFootnoteLinksStyles = _ref2 => {
|
|
26
|
+
let {
|
|
27
|
+
bottomLinksMarginLeft
|
|
28
|
+
} = _ref2;
|
|
29
|
+
return {
|
|
30
|
+
marginLeft: bottomLinksMarginLeft
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const renderCurrencySymbol = (currencySymbol, currencySymbolTypographyTokens, ratePosition, fontColor) => (0, _renderTypography.default)(`${currencySymbol}`, currencySymbolTypographyTokens, ratePosition, fontColor);
|
|
34
|
+
const renderAmount = (amount, amountTypographyTokens, strikeThrough, a11yText, fontColor, themeTokens) => {
|
|
35
|
+
const amountText = (0, _renderTypography.default)(amount, amountTypographyTokens, undefined, fontColor); // undefined is ratePosition
|
|
36
|
+
if (strikeThrough) {
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
38
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_A11yText.default, {
|
|
39
|
+
text: a11yText
|
|
40
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
41
|
+
style: [staticStyles.strikeThroughContainer, selectStrikeThroughStyles(themeTokens)],
|
|
42
|
+
children: amountText
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return amountText;
|
|
47
|
+
};
|
|
48
|
+
const renderPrice = (price, rateText, ratePosition, signDirection, currencySymbol, currencySymbolTypographyTokens, amountTypographyTokens, centsTypographyTokens, rateTypographyTokens, fontColor, strikeThrough, a11yText, bottomText, bottomLinksMarginLeft, footnoteLinks, onClickFootnote, themeTokens) => {
|
|
49
|
+
const priceString = price;
|
|
50
|
+
const lastDotPosition = priceString.lastIndexOf('.');
|
|
51
|
+
const lastCommaPosition = priceString.lastIndexOf(',');
|
|
52
|
+
const [separator, separatorPosition] = lastDotPosition > lastCommaPosition ? ['.', lastDotPosition] : [',', lastCommaPosition];
|
|
53
|
+
|
|
54
|
+
// If the separator is at the fourth character from the end of the string or more, it's most probably
|
|
55
|
+
// a part of the amount, and the cents are not included in the price string
|
|
56
|
+
const EXCLUDE_CENTS = 3;
|
|
57
|
+
const hasCents = separatorPosition !== -1 && separatorPosition >= priceString.length - EXCLUDE_CENTS;
|
|
58
|
+
const amount = hasCents ? priceString.substring(0, separatorPosition) : priceString;
|
|
59
|
+
const cents = hasCents ? priceString.substring(separatorPosition + 1) : null;
|
|
60
|
+
const footnoteLinkPositionStyles = rateText ? staticStyles.footnoteLinksWithoutBottomText : staticStyles.footnoteLinksWithoutBottomTextAndRateText;
|
|
61
|
+
const MAX_FOOTNOTE_LINKS_ALLOWED = 3;
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
64
|
+
style: ratePosition === 'bottom' ? staticStyles.priceContainerColumn : staticStyles.priceContainerRow,
|
|
65
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
66
|
+
style: staticStyles.priceContainer,
|
|
67
|
+
children: [signDirection === 'left' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
68
|
+
children: renderCurrencySymbol(currencySymbol, currencySymbolTypographyTokens, ratePosition, fontColor)
|
|
69
|
+
}) : null, renderAmount(amount, amountTypographyTokens, strikeThrough, a11yText, fontColor, themeTokens), cents ? (0, _renderTypography.default)(`${separator}${cents}`, centsTypographyTokens, undefined, fontColor) : null, signDirection === 'right' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
70
|
+
style: staticStyles.currencySymbol,
|
|
71
|
+
children: renderCurrencySymbol(currencySymbol, currencySymbolTypographyTokens, ratePosition, fontColor)
|
|
72
|
+
}) : null]
|
|
73
|
+
}), rateText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
74
|
+
style: ratePosition === 'bottom' ? staticStyles.rateTextVerticalPosition : [staticStyles.rateTextPosition, staticStyles.rateTextVerticalPosition],
|
|
75
|
+
children: (0, _renderTypography.default)(rateText, rateTypographyTokens, ratePosition, fontColor)
|
|
76
|
+
}) : null, !bottomText && footnoteLinks.length <= MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
77
|
+
style: [footnoteLinkPositionStyles, selectFootnoteLinksStyles({
|
|
78
|
+
bottomLinksMarginLeft
|
|
79
|
+
})],
|
|
80
|
+
children: (0, _renderFootnoteLinks.default)(footnoteLinks, themeTokens, onClickFootnote)
|
|
81
|
+
}) : null]
|
|
82
|
+
}), !bottomText && footnoteLinks.length > MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
83
|
+
style: staticStyles.verticalFootnoteLinkContainer,
|
|
84
|
+
children: (0, _renderFootnoteLinks.default)(footnoteLinks, themeTokens, onClickFootnote)
|
|
85
|
+
}) : null]
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
var _default = renderPrice;
|
|
89
|
+
exports.default = _default;
|
|
90
|
+
const staticStyles = _StyleSheet.default.create({
|
|
91
|
+
priceContainerRow: {
|
|
92
|
+
flexDirection: 'row'
|
|
93
|
+
},
|
|
94
|
+
priceContainerColumn: {
|
|
95
|
+
flexDirection: 'column'
|
|
96
|
+
},
|
|
97
|
+
priceContainer: {
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
alignSelf: 'flex-start',
|
|
100
|
+
marginTop: 4
|
|
101
|
+
},
|
|
102
|
+
currencySymbol: {
|
|
103
|
+
paddingLeft: 4
|
|
104
|
+
},
|
|
105
|
+
verticalFootnoteLinkContainer: {
|
|
106
|
+
..._Platform.default.select({
|
|
107
|
+
ios: {
|
|
108
|
+
top: 10
|
|
109
|
+
},
|
|
110
|
+
android: {
|
|
111
|
+
top: -2
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
},
|
|
115
|
+
footnoteLinksWithoutBottomText: {
|
|
116
|
+
..._Platform.default.select({
|
|
117
|
+
ios: {
|
|
118
|
+
alignSelf: 'flex-end',
|
|
119
|
+
top: -10
|
|
120
|
+
},
|
|
121
|
+
android: {
|
|
122
|
+
alignSelf: 'center',
|
|
123
|
+
top: -14
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
},
|
|
127
|
+
footnoteLinksWithoutBottomTextAndRateText: {
|
|
128
|
+
..._Platform.default.select({
|
|
129
|
+
ios: {
|
|
130
|
+
alignSelf: 'center'
|
|
131
|
+
},
|
|
132
|
+
android: {
|
|
133
|
+
alignSelf: 'flex-start'
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
},
|
|
137
|
+
strikeThroughContainer: {
|
|
138
|
+
textDecorationLine: 'line-through',
|
|
139
|
+
textDecorationThickness: '1px'
|
|
140
|
+
},
|
|
141
|
+
rateTextPosition: {
|
|
142
|
+
alignSelf: 'flex-end'
|
|
143
|
+
},
|
|
144
|
+
rateTextVerticalPosition: {
|
|
145
|
+
top: -8
|
|
146
|
+
}
|
|
147
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Typography = _interopRequireDefault(require("../../Typography"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const renderTypography = (value, themeTokens, ratePosition, fontColor) => {
|
|
12
|
+
const customProps = ratePosition === 'bottom' ? {
|
|
13
|
+
variant: {
|
|
14
|
+
size: 'micro'
|
|
15
|
+
},
|
|
16
|
+
tokens: {
|
|
17
|
+
color: fontColor
|
|
18
|
+
}
|
|
19
|
+
} : {
|
|
20
|
+
tokens: {
|
|
21
|
+
...themeTokens,
|
|
22
|
+
color: fontColor
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
26
|
+
...customProps,
|
|
27
|
+
children: value
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var _default = renderTypography;
|
|
31
|
+
exports.default = _default;
|
package/lib/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var _exportNames = {
|
|
|
36
36
|
Notification: true,
|
|
37
37
|
OrderedList: true,
|
|
38
38
|
Pagination: true,
|
|
39
|
+
PriceLockup: true,
|
|
39
40
|
Progress: true,
|
|
40
41
|
QuickLinks: true,
|
|
41
42
|
QuickLinksFeature: true,
|
|
@@ -285,6 +286,12 @@ Object.defineProperty(exports, "PressableCardBase", {
|
|
|
285
286
|
return _Card.PressableCardBase;
|
|
286
287
|
}
|
|
287
288
|
});
|
|
289
|
+
Object.defineProperty(exports, "PriceLockup", {
|
|
290
|
+
enumerable: true,
|
|
291
|
+
get: function () {
|
|
292
|
+
return _PriceLockup.default;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
288
295
|
Object.defineProperty(exports, "Progress", {
|
|
289
296
|
enumerable: true,
|
|
290
297
|
get: function () {
|
|
@@ -592,6 +599,7 @@ var _MultiSelectFilter = _interopRequireDefault(require("./MultiSelectFilter"));
|
|
|
592
599
|
var _Notification = _interopRequireDefault(require("./Notification"));
|
|
593
600
|
var _OrderedList = _interopRequireDefault(require("./OrderedList"));
|
|
594
601
|
var _Pagination = _interopRequireDefault(require("./Pagination"));
|
|
602
|
+
var _PriceLockup = _interopRequireDefault(require("./PriceLockup"));
|
|
595
603
|
var _Progress = _interopRequireDefault(require("./Progress"));
|
|
596
604
|
var _QuickLinks = _interopRequireDefault(require("./QuickLinks"));
|
|
597
605
|
var _QuickLinksFeature = _interopRequireDefault(require("./QuickLinksFeature"));
|
|
@@ -15,12 +15,11 @@ const createStyleSheet = stylesWithQuery => {
|
|
|
15
15
|
styles: {},
|
|
16
16
|
fullStyles: {}
|
|
17
17
|
};
|
|
18
|
-
let cleanStyles;
|
|
19
18
|
let ids = {};
|
|
19
|
+
const cleanStyles = (0, _common.deepClone)(stylesWithQuery);
|
|
20
20
|
Object.keys(stylesWithQuery).forEach(key => {
|
|
21
21
|
if (!(stylesWithQuery !== null && stylesWithQuery !== void 0 && stylesWithQuery[key])) return;
|
|
22
22
|
const mediaQueriesAndPseudoClasses = Object.keys(stylesWithQuery[key]).filter(_common.isMediaOrPseudo);
|
|
23
|
-
cleanStyles = (0, _common.deepClone)(stylesWithQuery);
|
|
24
23
|
mediaQueriesAndPseudoClasses.forEach(query => {
|
|
25
24
|
var _ids;
|
|
26
25
|
const css = (0, _createDeclarationBlock.default)(stylesWithQuery[key][query]);
|
|
@@ -54,7 +54,8 @@ const CarouselThumbnail = _ref2 => {
|
|
|
54
54
|
padding,
|
|
55
55
|
selectedBorderColor,
|
|
56
56
|
selectedBorderWidth,
|
|
57
|
-
size
|
|
57
|
+
size,
|
|
58
|
+
margin
|
|
58
59
|
} = getThumbnailTokens({
|
|
59
60
|
viewport
|
|
60
61
|
});
|
|
@@ -66,7 +67,12 @@ const CarouselThumbnail = _ref2 => {
|
|
|
66
67
|
selected: {
|
|
67
68
|
borderColor: selectedBorderColor,
|
|
68
69
|
borderWidth: selectedBorderWidth,
|
|
69
|
-
padding: padding - selectedBorderWidth
|
|
70
|
+
padding: padding - selectedBorderWidth,
|
|
71
|
+
marginBottom: margin + selectedBorderWidth
|
|
72
|
+
},
|
|
73
|
+
nonSelected: {
|
|
74
|
+
padding: padding - borderWidth,
|
|
75
|
+
marginBottom: margin + selectedBorderWidth
|
|
70
76
|
}
|
|
71
77
|
};
|
|
72
78
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
@@ -83,9 +89,9 @@ const CarouselThumbnail = _ref2 => {
|
|
|
83
89
|
pressed,
|
|
84
90
|
focus: focused
|
|
85
91
|
}));
|
|
86
|
-
return [pressableStyles, index === activeIndex
|
|
92
|
+
return [pressableStyles, index === activeIndex ? [styles.selected, {
|
|
87
93
|
outline: 'none'
|
|
88
|
-
}];
|
|
94
|
+
}] : styles.nonSelected];
|
|
89
95
|
},
|
|
90
96
|
children: /*#__PURE__*/_jsx(Image, {
|
|
91
97
|
accessibilityIgnoresInvertColors: true,
|
|
@@ -24,8 +24,7 @@ const CarouselThumbnailNavigation = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
24
24
|
throw new Error('Thumbnail set provided does not match the number of slides in the carousel');
|
|
25
25
|
}
|
|
26
26
|
const {
|
|
27
|
-
containerPaddingTop: thumbnailContainerPaddingTop
|
|
28
|
-
margin: thumbnailMargin
|
|
27
|
+
containerPaddingTop: thumbnailContainerPaddingTop
|
|
29
28
|
} = useThemeTokens('CarouselThumbnail');
|
|
30
29
|
const stackWrapTokens = {
|
|
31
30
|
justifyContent: 'flex-start'
|
|
@@ -33,13 +32,14 @@ const CarouselThumbnailNavigation = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
33
32
|
const containerStyles = {
|
|
34
33
|
justifyContent: 'center',
|
|
35
34
|
alignItems,
|
|
36
|
-
paddingTop: thumbnailContainerPaddingTop
|
|
35
|
+
paddingTop: thumbnailContainerPaddingTop
|
|
37
36
|
};
|
|
38
37
|
return /*#__PURE__*/_jsx(View, {
|
|
39
38
|
style: containerStyles,
|
|
40
39
|
children: /*#__PURE__*/_jsx(StackWrap, {
|
|
41
40
|
direction: "row",
|
|
42
41
|
tokens: stackWrapTokens,
|
|
42
|
+
space: 2,
|
|
43
43
|
ref: ref,
|
|
44
44
|
children: thumbnails.map((_ref2, index) => {
|
|
45
45
|
let {
|
|
@@ -165,19 +165,15 @@ const Footnote = _ref6 => {
|
|
|
165
165
|
children: content
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
return (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
})
|
|
178
|
-
}, number)]
|
|
179
|
-
})
|
|
180
|
-
);
|
|
168
|
+
return /*#__PURE__*/_jsx(OrderedList, {
|
|
169
|
+
start: number,
|
|
170
|
+
children: /*#__PURE__*/_jsx(OrderedList.Item, {
|
|
171
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
172
|
+
style: selectCustomContentFontStyle(themeTokens),
|
|
173
|
+
children: content
|
|
174
|
+
})
|
|
175
|
+
}, number)
|
|
176
|
+
});
|
|
181
177
|
}, [content, number, themeTokens]);
|
|
182
178
|
useEffect(() => {
|
|
183
179
|
if (isOpen) {
|