@telus-uds/components-base 1.75.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/lib/Carousel/CarouselThumbnail.js +10 -4
  3. package/lib/Carousel/CarouselThumbnailNavigation.js +3 -3
  4. package/lib/Footnote/Footnote.js +9 -13
  5. package/lib/Link/ChevronLink.js +2 -0
  6. package/lib/Link/InlinePressable.js +15 -2
  7. package/lib/Link/LinkBase.js +1 -0
  8. package/lib/OrderedList/OrderedList.js +21 -20
  9. package/lib/PriceLockup/PriceLockup.js +220 -0
  10. package/lib/PriceLockup/index.js +10 -0
  11. package/lib/PriceLockup/utils/renderFootnoteContent.js +93 -0
  12. package/lib/PriceLockup/utils/renderFootnoteLinks.js +36 -0
  13. package/lib/PriceLockup/utils/renderPrice.js +147 -0
  14. package/lib/PriceLockup/utils/renderTypography.js +31 -0
  15. package/lib/index.js +8 -0
  16. package/lib-module/Carousel/CarouselThumbnail.js +10 -4
  17. package/lib-module/Carousel/CarouselThumbnailNavigation.js +3 -3
  18. package/lib-module/Footnote/Footnote.js +9 -13
  19. package/lib-module/Link/ChevronLink.js +2 -0
  20. package/lib-module/Link/InlinePressable.js +16 -2
  21. package/lib-module/Link/LinkBase.js +1 -0
  22. package/lib-module/OrderedList/OrderedList.js +21 -20
  23. package/lib-module/PriceLockup/PriceLockup.js +214 -0
  24. package/lib-module/PriceLockup/index.js +2 -0
  25. package/lib-module/PriceLockup/utils/renderFootnoteContent.js +87 -0
  26. package/lib-module/PriceLockup/utils/renderFootnoteLinks.js +28 -0
  27. package/lib-module/PriceLockup/utils/renderPrice.js +141 -0
  28. package/lib-module/PriceLockup/utils/renderTypography.js +23 -0
  29. package/lib-module/index.js +1 -0
  30. package/package.json +1 -1
  31. package/src/Carousel/CarouselThumbnail.jsx +8 -6
  32. package/src/Carousel/CarouselThumbnailNavigation.jsx +3 -4
  33. package/src/Footnote/Footnote.jsx +3 -6
  34. package/src/Link/ChevronLink.jsx +5 -1
  35. package/src/Link/InlinePressable.jsx +36 -15
  36. package/src/Link/LinkBase.jsx +1 -0
  37. package/src/OrderedList/OrderedList.jsx +17 -20
  38. package/src/PriceLockup/PriceLockup.jsx +218 -0
  39. package/src/PriceLockup/index.js +3 -0
  40. package/src/PriceLockup/utils/renderFootnoteContent.jsx +77 -0
  41. package/src/PriceLockup/utils/renderFootnoteLinks.jsx +38 -0
  42. package/src/PriceLockup/utils/renderPrice.jsx +201 -0
  43. package/src/PriceLockup/utils/renderTypography.jsx +13 -0
  44. package/src/index.js +1 -0
package/CHANGELOG.md CHANGED
@@ -1,12 +1,27 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Mon, 29 Jan 2024 18:26:01 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 07 Feb 2024 19:09:40 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.76.0
8
+
9
+ Wed, 07 Feb 2024 19:09:40 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Changes to enable the key recogniztion in the press state (35577399+JoshHC@users.noreply.github.com)
14
+ - carouselThumbnail component modified to match design intention (35577399+JoshHC@users.noreply.github.com)
15
+ - refactor(PriceLockup): started the migration to component-base (chris.tafts@telus.com)
16
+ - refactor(PriceLuckup): started the migration to component-base (chris.tafts@telus.com)
17
+
18
+ ### Patches
19
+
20
+ - fix ordered-list component single child render (guillermo.peitzner@telus.com)
21
+
7
22
  ## 1.75.0
8
23
 
9
- Mon, 29 Jan 2024 18:26:01 GMT
24
+ Mon, 29 Jan 2024 18:41:50 GMT
10
25
 
11
26
  ### Minor changes
12
27
 
@@ -61,7 +61,8 @@ const CarouselThumbnail = _ref2 => {
61
61
  padding,
62
62
  selectedBorderColor,
63
63
  selectedBorderWidth,
64
- size
64
+ size,
65
+ margin
65
66
  } = getThumbnailTokens({
66
67
  viewport
67
68
  });
@@ -73,7 +74,12 @@ const CarouselThumbnail = _ref2 => {
73
74
  selected: {
74
75
  borderColor: selectedBorderColor,
75
76
  borderWidth: selectedBorderWidth,
76
- padding: padding - selectedBorderWidth + borderWidth
77
+ padding: padding - selectedBorderWidth,
78
+ marginBottom: margin + selectedBorderWidth
79
+ },
80
+ nonSelected: {
81
+ padding: padding - borderWidth,
82
+ marginBottom: margin + selectedBorderWidth
77
83
  }
78
84
  };
79
85
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
@@ -90,9 +96,9 @@ const CarouselThumbnail = _ref2 => {
90
96
  pressed,
91
97
  focus: focused
92
98
  }));
93
- return [pressableStyles, index === activeIndex && styles.selected, {
99
+ return [pressableStyles, index === activeIndex ? [styles.selected, {
94
100
  outline: 'none'
95
- }];
101
+ }] : styles.nonSelected];
96
102
  },
97
103
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.default, {
98
104
  accessibilityIgnoresInvertColors: true,
@@ -33,8 +33,7 @@ const CarouselThumbnailNavigation = /*#__PURE__*/(0, _react.forwardRef)((_ref, r
33
33
  throw new Error('Thumbnail set provided does not match the number of slides in the carousel');
34
34
  }
35
35
  const {
36
- containerPaddingTop: thumbnailContainerPaddingTop,
37
- margin: thumbnailMargin
36
+ containerPaddingTop: thumbnailContainerPaddingTop
38
37
  } = (0, _ThemeProvider.useThemeTokens)('CarouselThumbnail');
39
38
  const stackWrapTokens = {
40
39
  justifyContent: 'flex-start'
@@ -42,13 +41,14 @@ const CarouselThumbnailNavigation = /*#__PURE__*/(0, _react.forwardRef)((_ref, r
42
41
  const containerStyles = {
43
42
  justifyContent: 'center',
44
43
  alignItems,
45
- paddingTop: thumbnailContainerPaddingTop - thumbnailMargin
44
+ paddingTop: thumbnailContainerPaddingTop
46
45
  };
47
46
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
48
47
  style: containerStyles,
49
48
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, {
50
49
  direction: "row",
51
50
  tokens: stackWrapTokens,
51
+ space: 2,
52
52
  ref: ref,
53
53
  children: thumbnails.map((_ref2, index) => {
54
54
  let {
@@ -173,19 +173,15 @@ const Footnote = _ref6 => {
173
173
  children: content
174
174
  });
175
175
  }
176
- return (
177
- /*#__PURE__*/
178
- // TODO: Extract the OrderedList.Item from the array when the issue #4361 is fixed
179
- (0, _jsxRuntime.jsx)(_OrderedList.default, {
180
- start: number,
181
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedList.default.Item, {
182
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
183
- style: selectCustomContentFontStyle(themeTokens),
184
- children: content
185
- })
186
- }, number)]
187
- })
188
- );
176
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedList.default, {
177
+ start: number,
178
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedList.default.Item, {
179
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
180
+ style: selectCustomContentFontStyle(themeTokens),
181
+ children: content
182
+ })
183
+ }, number)
184
+ });
189
185
  }, [content, number, themeTokens]);
190
186
  (0, _react.useEffect)(() => {
191
187
  if (isOpen) {
@@ -25,6 +25,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
25
25
  tokens = {},
26
26
  variant,
27
27
  dataSet,
28
+ onPress,
28
29
  ...otherlinkProps
29
30
  } = _ref;
30
31
  const getChevronTokens = (0, _ThemeProvider.useThemeTokensCallback)('ChevronLink', tokens, variant);
@@ -53,6 +54,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
53
54
  tokens: getTokens,
54
55
  dataSet: dataSet,
55
56
  ref: ref,
57
+ onPress: onPress,
56
58
  children: children
57
59
  });
58
60
  });
@@ -7,6 +7,7 @@ exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
9
9
  var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
10
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
10
11
  var _jsxRuntime = require("react/jsx-runtime");
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13
  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); }
@@ -24,17 +25,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
24
25
  * @param {PressableProps} PressableProps
25
26
  */
26
27
  // React Native exports prop Types but not propTypes, use JSDoc types here rather than duplicate RN
27
- // eslint-disable-next-line react/prop-types
28
- const InlinePressable = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
28
+ /* eslint-disable react/prop-types */const InlinePressable = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
29
29
  let {
30
30
  children,
31
31
  inlineFlex = true,
32
32
  style,
33
+ onPress,
33
34
  ...props
34
35
  } = _ref;
36
+ const handlePress = (0, _react.useCallback)(() => {
37
+ if (onPress) {
38
+ onPress();
39
+ }
40
+ }, [onPress]);
41
+ const handleKeyPress = (0, _react.useCallback)(e => {
42
+ if (e.key === 'Enter' || e.key === ' ') {
43
+ handlePress();
44
+ }
45
+ }, [handlePress]);
35
46
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
36
47
  ref: ref,
37
48
  style: pressState => [typeof style === 'function' ? style(pressState) : style, staticStyles[inlineFlex ? 'inlineFlex' : 'inline']],
49
+ onPress: handlePress,
50
+ onKeyDown: _Platform.default.OS === 'web' ? handleKeyPress : undefined,
38
51
  ...props,
39
52
  children: pressState => typeof children === 'function' ? children(pressState) : children
40
53
  });
@@ -187,6 +187,7 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
187
187
  // assuming links without icons should be inline (even if they are long)
188
188
  ,
189
189
  ref: ref,
190
+ keyboardShouldPersistTaps: "handled",
190
191
  style: linkState => {
191
192
  const themeTokens = resolveLinkTokens(linkState);
192
193
  const outerBorderStyles = selectOuterBorderStyles(themeTokens);
@@ -14,25 +14,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
14
14
  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); }
15
15
  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; }
16
16
  const [selectProps, selectedSystemPropsTypes] = (0, _utils.selectSystemProps)([_utils.htmlAttrs, _utils.viewProps]);
17
- const getChildrenWithParentVariants = (variant, children, start) => {
18
- if (variant) return children.map((child, i) => {
19
- var _child$props;
20
- const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
21
- return {
22
- ...child,
23
- props: {
24
- ...child.props,
25
- index: start + i,
26
- isLastChild: i === children.length - 1,
27
- variant: {
28
- ...existingChildVariants,
29
- ...variant
30
- }
31
- }
32
- };
33
- });
34
- return children;
35
- };
36
17
  const OrderedList = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
37
18
  let {
38
19
  children,
@@ -40,7 +21,27 @@ const OrderedList = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
40
21
  variant,
41
22
  ...rest
42
23
  } = _ref;
43
- const childrenWithParentVariants = (0, _react.useMemo)(() => getChildrenWithParentVariants(variant, children, start), [children, variant, start]);
24
+ const childrenWithParentVariants = (0, _react.useMemo)(() => {
25
+ const addVariantToProps = (child, i, isLastChild) => {
26
+ var _child$props;
27
+ const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
28
+ return /*#__PURE__*/_react.default.cloneElement(child, {
29
+ index: start + i,
30
+ isLastChild,
31
+ variant: {
32
+ ...existingChildVariants,
33
+ ...variant
34
+ }
35
+ });
36
+ };
37
+ if (variant) {
38
+ if (Array.isArray(children)) {
39
+ return children.map((child, i) => addVariantToProps(child, i, i === children.length - 1));
40
+ }
41
+ return [addVariantToProps(children, 0, true)];
42
+ }
43
+ return children;
44
+ }, [children, variant, start]);
44
45
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedListBase.default, {
45
46
  ref: ref,
46
47
  ...selectProps(rest),
@@ -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;