@telus-uds/components-web 1.10.0 → 1.12.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 (110) hide show
  1. package/CHANGELOG.md +47 -2
  2. package/lib/Breadcrumbs/Item/Item.js +31 -6
  3. package/lib/Callout/Callout.js +24 -3
  4. package/lib/DatePicker/CalendarContainer.js +60 -71
  5. package/lib/DatePicker/DatePicker.js +66 -22
  6. package/lib/Disclaimer/Disclaimer.js +72 -0
  7. package/lib/Disclaimer/index.js +15 -0
  8. package/lib/Footnote/Footnote.js +3 -4
  9. package/lib/Footnote/FootnoteLink.js +11 -13
  10. package/lib/List/List.js +11 -0
  11. package/lib/List/ListItem.js +48 -0
  12. package/lib/List/index.js +16 -0
  13. package/lib/NavigationBar/NavigationBar.js +231 -0
  14. package/lib/NavigationBar/NavigationItem.js +111 -0
  15. package/lib/NavigationBar/NavigationSubMenu.js +179 -0
  16. package/lib/NavigationBar/collapseItems.js +51 -0
  17. package/lib/NavigationBar/index.js +13 -0
  18. package/lib/PriceLockup/PriceLockup.js +60 -23
  19. package/lib/PriceLockup/tokens.js +49 -116
  20. package/lib/Progress/ProgressBar.js +100 -0
  21. package/lib/Progress/index.js +16 -0
  22. package/lib/Ribbon/Ribbon.js +53 -32
  23. package/lib/SkeletonProvider/SkeletonImage.js +55 -0
  24. package/lib/SkeletonProvider/SkeletonProvider.js +84 -0
  25. package/lib/SkeletonProvider/SkeletonTypography.js +54 -0
  26. package/lib/SkeletonProvider/index.js +13 -0
  27. package/lib/Spinner/Spinner.js +18 -14
  28. package/lib/Table/Cell.js +15 -1
  29. package/lib/Table/Table.js +14 -5
  30. package/lib/Toast/Toast.js +1 -1
  31. package/lib/VideoPicker/VideoPicker.js +177 -0
  32. package/lib/VideoPicker/VideoPickerPlayer.js +54 -0
  33. package/lib/VideoPicker/VideoPickerThumbnail.js +201 -0
  34. package/lib/VideoPicker/VideoSlider.js +100 -0
  35. package/lib/VideoPicker/index.js +13 -0
  36. package/lib/VideoPicker/videoPropType.js +25 -0
  37. package/lib/index.js +55 -1
  38. package/lib-module/Breadcrumbs/Item/Item.js +32 -7
  39. package/lib-module/Callout/Callout.js +24 -3
  40. package/lib-module/DatePicker/CalendarContainer.js +61 -72
  41. package/lib-module/DatePicker/DatePicker.js +67 -23
  42. package/lib-module/Disclaimer/Disclaimer.js +54 -0
  43. package/lib-module/Disclaimer/index.js +1 -0
  44. package/lib-module/Footnote/Footnote.js +3 -3
  45. package/lib-module/Footnote/FootnoteLink.js +12 -14
  46. package/lib-module/List/List.js +2 -0
  47. package/lib-module/List/ListItem.js +31 -0
  48. package/lib-module/List/index.js +4 -0
  49. package/lib-module/NavigationBar/NavigationBar.js +207 -0
  50. package/lib-module/NavigationBar/NavigationItem.js +87 -0
  51. package/lib-module/NavigationBar/NavigationSubMenu.js +161 -0
  52. package/lib-module/NavigationBar/collapseItems.js +43 -0
  53. package/lib-module/NavigationBar/index.js +2 -0
  54. package/lib-module/PriceLockup/PriceLockup.js +62 -25
  55. package/lib-module/PriceLockup/tokens.js +54 -119
  56. package/lib-module/Progress/ProgressBar.js +83 -0
  57. package/lib-module/Progress/index.js +4 -0
  58. package/lib-module/Ribbon/Ribbon.js +53 -32
  59. package/lib-module/SkeletonProvider/SkeletonImage.js +42 -0
  60. package/lib-module/SkeletonProvider/SkeletonProvider.js +65 -0
  61. package/lib-module/SkeletonProvider/SkeletonTypography.js +41 -0
  62. package/lib-module/SkeletonProvider/index.js +2 -0
  63. package/lib-module/Spinner/Spinner.js +17 -14
  64. package/lib-module/Table/Cell.js +15 -1
  65. package/lib-module/Table/Table.js +14 -5
  66. package/lib-module/Toast/Toast.js +1 -1
  67. package/lib-module/VideoPicker/VideoPicker.js +151 -0
  68. package/lib-module/VideoPicker/VideoPickerPlayer.js +41 -0
  69. package/lib-module/VideoPicker/VideoPickerThumbnail.js +180 -0
  70. package/lib-module/VideoPicker/VideoSlider.js +83 -0
  71. package/lib-module/VideoPicker/index.js +2 -0
  72. package/lib-module/VideoPicker/videoPropType.js +9 -0
  73. package/lib-module/index.js +6 -0
  74. package/package.json +3 -3
  75. package/src/Breadcrumbs/Item/Item.jsx +18 -4
  76. package/src/Callout/Callout.jsx +27 -3
  77. package/src/DatePicker/CalendarContainer.jsx +61 -71
  78. package/src/DatePicker/DatePicker.jsx +47 -19
  79. package/src/Disclaimer/Disclaimer.jsx +39 -0
  80. package/src/Disclaimer/index.js +1 -0
  81. package/src/Footnote/Footnote.jsx +3 -3
  82. package/src/Footnote/FootnoteLink.jsx +28 -18
  83. package/src/List/List.jsx +3 -0
  84. package/src/List/ListItem.jsx +21 -0
  85. package/src/List/index.js +6 -0
  86. package/src/NavigationBar/NavigationBar.jsx +217 -0
  87. package/src/NavigationBar/NavigationItem.jsx +83 -0
  88. package/src/NavigationBar/NavigationSubMenu.jsx +121 -0
  89. package/src/NavigationBar/collapseItems.js +29 -0
  90. package/src/NavigationBar/index.js +3 -0
  91. package/src/PriceLockup/PriceLockup.jsx +58 -26
  92. package/src/PriceLockup/tokens.js +34 -54
  93. package/src/Progress/ProgressBar.jsx +67 -0
  94. package/src/Progress/index.js +6 -0
  95. package/src/Ribbon/Ribbon.jsx +21 -9
  96. package/src/SkeletonProvider/SkeletonImage.jsx +33 -0
  97. package/src/SkeletonProvider/SkeletonProvider.jsx +62 -0
  98. package/src/SkeletonProvider/SkeletonTypography.jsx +31 -0
  99. package/src/SkeletonProvider/index.js +3 -0
  100. package/src/Spinner/Spinner.jsx +20 -17
  101. package/src/Table/Cell.jsx +22 -5
  102. package/src/Table/Table.jsx +7 -4
  103. package/src/Toast/Toast.jsx +1 -0
  104. package/src/VideoPicker/VideoPicker.jsx +144 -0
  105. package/src/VideoPicker/VideoPickerPlayer.jsx +21 -0
  106. package/src/VideoPicker/VideoPickerThumbnail.jsx +182 -0
  107. package/src/VideoPicker/VideoSlider.jsx +85 -0
  108. package/src/VideoPicker/index.js +3 -0
  109. package/src/VideoPicker/videoPropType.js +12 -0
  110. package/src/index.js +6 -0
@@ -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;
@@ -93,19 +93,50 @@ const RateTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig(
93
93
  const StrikeThroughContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
94
94
  displayName: "PriceLockup__StrikeThroughContainer",
95
95
  componentId: "components-web__sc-1x6duay-7"
96
- })(["display:flex;position:relative;align-items:center;::before{content:'';width:100%;height:", ";background:", ";position:absolute;}"], _ref7 => {
96
+ })(["display:flex;position:relative;align-items:center;::before{content:'';width:100%;top:", ";height:", ";background:", ";position:absolute;}"], _ref7 => {
97
97
  let {
98
- strikeThroughHeight
98
+ strikeThroughPosition
99
99
  } = _ref7;
100
- return strikeThroughHeight;
100
+ return `${strikeThroughPosition}px`;
101
101
  }, _ref8 => {
102
102
  let {
103
- strikeThroughBackground
103
+ strikeThroughHeight
104
104
  } = _ref8;
105
- return strikeThroughBackground;
105
+ return `${strikeThroughHeight}px`;
106
+ }, _ref9 => {
107
+ let {
108
+ strikeThroughColor
109
+ } = _ref9;
110
+ return strikeThroughColor;
106
111
  });
107
112
 
108
- const PriceLockup = _ref9 => {
113
+ const selectFootnoteLinkStyles = _ref10 => {
114
+ let {
115
+ footnoteLinkColor,
116
+ footnoteLinkFontName,
117
+ footnoteLinkFontWeight
118
+ } = _ref10;
119
+ return {
120
+ color: footnoteLinkColor,
121
+ fontName: footnoteLinkFontName,
122
+ fontWeight: footnoteLinkFontWeight
123
+ };
124
+ };
125
+
126
+ const selectStrikeThroughTokens = _ref11 => {
127
+ let {
128
+ strikeThroughPosition,
129
+ strikeThroughHeight,
130
+ strikeThroughColor
131
+ } = _ref11;
132
+ return {
133
+ strikeThroughHeight,
134
+ strikeThroughPosition,
135
+ strikeThroughColor
136
+ };
137
+ };
138
+
139
+ const PriceLockup = _ref12 => {
109
140
  let {
110
141
  size = 'medium',
111
142
  signDirection = 'left',
@@ -121,7 +152,8 @@ const PriceLockup = _ref9 => {
121
152
  tokens: priceLockupTokens,
122
153
  variant = {},
123
154
  ...rest
124
- } = _ref9;
155
+ } = _ref12;
156
+ const viewport = (0, _componentsBase.useViewport)();
125
157
  const {
126
158
  footnoteMarginTop,
127
159
  footnoteGap,
@@ -129,11 +161,17 @@ const PriceLockup = _ref9 => {
129
161
  priceMarginBottom,
130
162
  bottomLinksMarginLeft,
131
163
  topTextMarginBottom,
132
- strikeThroughHeight,
133
- strikeThroughBackground,
134
164
  fontColor,
135
- dividerColor
136
- } = (0, _componentsBase.useThemeTokens)('PriceLockup', priceLockupTokens, variant);
165
+ dividerColor,
166
+ footnoteLinkFontSize,
167
+ ...themeTokens
168
+ } = (0, _componentsBase.useThemeTokens)('PriceLockup', priceLockupTokens, { ...variant,
169
+ size
170
+ }, {
171
+ viewport,
172
+ strikeThrough
173
+ });
174
+ const typographyTokens = (0, _tokens.default)(themeTokens);
137
175
  const priceString = String(price);
138
176
  const lastDotPosition = priceString.lastIndexOf('.');
139
177
  const lastCommaPosition = priceString.lastIndexOf(',');
@@ -143,32 +181,31 @@ const PriceLockup = _ref9 => {
143
181
  const hasCents = separatorPosition !== -1 && separatorPosition >= priceString.length - 3;
144
182
  const amount = hasCents ? priceString.substring(0, separatorPosition) : priceString;
145
183
  const cents = hasCents ? priceString.substring(separatorPosition + 1) : null;
146
- const color = strikeThrough ? strikeThroughBackground : fontColor;
147
184
 
148
185
  const renderTypography = (value, tokens) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
149
186
  tokens: { ...tokens,
150
- color
187
+ color: fontColor
151
188
  },
152
189
  children: value
153
190
  });
154
191
 
155
- const renderCurrencySymbol = () => renderTypography(`${currencySymbol}`, _tokens.default.dollarSign[size]);
192
+ const renderCurrencySymbol = () => renderTypography(`${currencySymbol}`, typographyTokens.dollarSign);
156
193
 
157
194
  const renderFootnoteLinks = () => footnoteLinks && footnoteLinks.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FootnoteLink.default, {
195
+ fontSize: footnoteLinkFontSize,
196
+ tokens: selectFootnoteLinkStyles(themeTokens),
158
197
  number: footnoteLinks,
159
198
  onClick: onClickFootnote
160
199
  }) : null;
161
200
 
162
201
  const renderAmount = () => {
163
- const amountComponent = renderTypography(amount, _tokens.default.amount[size]);
202
+ const amountComponent = renderTypography(amount, typographyTokens.amount);
164
203
 
165
204
  if (strikeThrough) {
166
205
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
167
206
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.A11yText, {
168
207
  text: a11yText
169
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StrikeThroughContainer, {
170
- strikeThroughHeight: `${strikeThroughHeight}px`,
171
- strikeThroughBackground: strikeThroughBackground,
208
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StrikeThroughContainer, { ...selectStrikeThroughTokens(themeTokens),
172
209
  children: amountComponent
173
210
  })]
174
211
  });
@@ -180,10 +217,10 @@ const PriceLockup = _ref9 => {
180
217
  const renderPrice = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
181
218
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceContainer, {
182
219
  priceMarginBottom: `${priceMarginBottom}px`,
183
- children: [signDirection === 'left' && renderCurrencySymbol(), renderAmount(), cents && renderTypography(`${separator}${cents}`, _tokens.default.cents[size]), signDirection === 'right' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
220
+ children: [signDirection === 'left' && renderCurrencySymbol(), renderAmount(), cents && renderTypography(`${separator}${cents}`, typographyTokens.cents), signDirection === 'right' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
184
221
  children: ["\xA0", renderCurrencySymbol()]
185
222
  }), rateText && /*#__PURE__*/(0, _jsxRuntime.jsx)(RateTextContainer, {
186
- children: renderTypography(rateText, _tokens.default.rate[size])
223
+ children: renderTypography(rateText, typographyTokens.rate)
187
224
  }), !bottomText && footnoteLinks.length <= 3 && /*#__PURE__*/(0, _jsxRuntime.jsx)(BottomLinksContainer, {
188
225
  bottomLinksMarginLeft: `${bottomLinksMarginLeft}px`,
189
226
  children: renderFootnoteLinks()
@@ -197,7 +234,7 @@ const PriceLockup = _ref9 => {
197
234
  footnoteGap: `${footnoteGap}px`,
198
235
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BottomTextContainer, {
199
236
  bottomTextMarginTop: `${bottomTextMarginTop}px`,
200
- children: renderTypography(bottomText, _tokens.default.bottomText[size])
237
+ children: renderTypography(bottomText, typographyTokens.bottomText)
201
238
  }), footnoteLinks.length <= 3 && renderFootnoteLinks()]
202
239
  }), footnoteLinks.length > 3 && renderFootnoteLinks()]
203
240
  });
@@ -209,12 +246,12 @@ const PriceLockup = _ref9 => {
209
246
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceLockupContainer, { ...selectProps(rest),
210
247
  children: [topText && /*#__PURE__*/(0, _jsxRuntime.jsx)(TopTextContainer, {
211
248
  topTextMarginBottom: `${topTextMarginBottom}px`,
212
- children: renderTypography(topText, _tokens.default.topText[size])
249
+ children: renderTypography(topText, typographyTokens.topText)
213
250
  }), renderPrice(), bottomText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Divider, {
214
251
  testID: "price-lockup-divider",
215
252
  role: "separator",
216
253
  tokens: {
217
- color: dividerColor
254
+ color: dividerColor ?? 'rgba(0, 0, 0, 0)'
218
255
  }
219
256
  }), bottomText && renderFootnoteContent()]
220
257
  });
@@ -5,127 +5,60 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _palette = _interopRequireDefault(require("@telus-uds/palette-allium/build/rn/palette"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- const {
13
- fontSize: {
14
- size14,
15
- size16,
16
- size20,
17
- size28,
18
- size36,
19
- size40,
20
- size64
21
- },
22
- lineHeight: {
23
- ratio1to1,
24
- ratio10to7,
25
- ratio3to2,
26
- ratio8to5,
27
- ratio5to4,
28
- ratio6to5,
29
- ratio9to8,
30
- ratio4to3,
31
- ratio8to7
32
- },
33
- letterSpacing: {
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
- large: {
62
- fontSize: size36,
63
- lineHeight: ratio9to8
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
- medium: {
75
- fontSize: size40,
76
- lineHeight: ratio1to1,
77
- letterSpacing: condensed,
78
- fontWeight: '300'
40
+ amount: {
41
+ color: fontColor,
42
+ fontSize: amountFontSize,
43
+ lineHeight: amountLineHeight,
44
+ letterSpacing: amountLetterSpacing,
45
+ fontWeight: amountFontWeight
79
46
  },
80
- large: {
81
- fontSize: size64,
82
- lineHeight: ratio1to1,
83
- letterSpacing: condensed,
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
- medium: {
93
- fontSize: size20,
94
- lineHeight: ratio6to5
52
+ rate: {
53
+ fontSize: rateFontSize,
54
+ lineHeight: rateLineHeight,
55
+ fontWeight: rateFontWeight
95
56
  },
96
- large: {
97
- fontSize: size36,
98
- lineHeight: ratio9to8
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
- var _default = typographyTokens;
63
+
131
64
  exports.default = _default;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(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 _jsxRuntime = require("react/jsx-runtime");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ // Passes React Native-oriented system props through UDS Progress
21
+ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_componentsBase.a11yProps, _componentsBase.viewProps]);
22
+ const {
23
+ Bar: ProgressBarBase
24
+ } = _componentsBase.Progress;
25
+
26
+ const Gradient = /*#__PURE__*/_styledComponents.default.div.attrs({
27
+ 'data-testid': 'ProgressBar-Gradient'
28
+ }).withConfig({
29
+ displayName: "ProgressBar__Gradient",
30
+ componentId: "components-web__sc-1vmzyq5-0"
31
+ })(_ref => {
32
+ let {
33
+ percentage,
34
+ gradient: {
35
+ angle,
36
+ stops,
37
+ type
38
+ }
39
+ } = _ref;
40
+ return {
41
+ height: '100%',
42
+ // As per the design specs, we need to have the gradient expanding to 100% and being
43
+ // revealed by bar width, so we need to stretch it beyond the parent (progress element)
44
+ // to the full length of the progress bar
45
+ width: `${100 * 100 / percentage}%`,
46
+ background: `${type}-gradient(${angle}deg, ${stops[0].color}, ${stops[1].color})`
47
+ };
48
+ });
49
+ /**
50
+ * The `ProgressBar` is a visual representation of linear progression.
51
+ * It provides simple but important information at a quick glance.
52
+ * This is a Web-specific progress bar.
53
+ *
54
+ * ## Component API
55
+ *
56
+ * Use props and tokens from the base ProgressBar component. The difference is that the
57
+ * `gradient` is being used here to provide gradient filling.
58
+ *
59
+ */
60
+
61
+
62
+ const ProgressBar = _ref2 => {
63
+ let {
64
+ percentage,
65
+ tokens,
66
+ variant,
67
+ ...rest
68
+ } = _ref2;
69
+ const themeTokens = (0, _componentsBase.useThemeTokens)('ProgressBar', tokens, variant);
70
+ const selectedProps = selectProps(rest);
71
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ProgressBarBase, {
72
+ percentage: percentage,
73
+ tokens: tokens,
74
+ variant: variant,
75
+ ...selectedProps,
76
+ children: themeTokens.gradient && /*#__PURE__*/(0, _jsxRuntime.jsx)(Gradient, { ...themeTokens,
77
+ percentage: percentage
78
+ })
79
+ });
80
+ };
81
+
82
+ ProgressBar.propTypes = { ...selectedSystemPropTypes,
83
+
84
+ /**
85
+ * Percentage of completion.
86
+ */
87
+ percentage: _propTypes.default.number,
88
+
89
+ /**
90
+ * ProgressBar tokens.
91
+ */
92
+ tokens: (0, _componentsBase.getTokensPropType)('ProgressBar'),
93
+
94
+ /**
95
+ * ProgressBar variant.
96
+ */
97
+ variant: _componentsBase.variantProp.propType
98
+ };
99
+ var _default = ProgressBar;
100
+ exports.default = _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _componentsBase = require("@telus-uds/components-base");
9
+
10
+ var _ProgressBar = _interopRequireDefault(require("./ProgressBar"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ _componentsBase.Progress.Bar = _ProgressBar.default;
15
+ var _default = _componentsBase.Progress;
16
+ exports.default = _default;
@@ -45,7 +45,7 @@ const RibbonWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
45
45
  const RibbonContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
46
46
  displayName: "Ribbon__RibbonContainer",
47
47
  componentId: "components-web__sc-186270k-1"
48
- })(["display:flex;justify-content:center;background:", ";padding:", ";border-radius:", ";width:fit-content;box-shadow:", ";"], _ref4 => {
48
+ })(["display:flex;justify-content:center;background:", ";padding:", ";border-radius:", ";width:fit-content;box-shadow:", ";border-bottom-right-radius:", ";border-bottom-left-radius:", ";"], _ref4 => {
49
49
  let {
50
50
  backgroundColor
51
51
  } = _ref4;
@@ -66,54 +66,64 @@ const RibbonContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
66
66
  shouldWrap
67
67
  } = _ref7;
68
68
  return shouldWrap && boxShadow;
69
+ }, _ref8 => {
70
+ let {
71
+ borderRadiusBottomLeft
72
+ } = _ref8;
73
+ return borderRadiusBottomLeft;
74
+ }, _ref9 => {
75
+ let {
76
+ borderRadiusBottomRight
77
+ } = _ref9;
78
+ return borderRadiusBottomRight;
69
79
  });
70
80
 
71
81
  const RibbonCurve = /*#__PURE__*/_styledComponents.default.div.withConfig({
72
82
  displayName: "Ribbon__RibbonCurve",
73
83
  componentId: "components-web__sc-186270k-2"
74
- })(["background:", ";width:", ";height:", ";margin-top:-", ";border-radius:0 0 0 100%;position:relative;z-index:-1;&::after{content:'';border-bottom-left-radius:", ";position:absolute;height:", ";background:", ";width:", ";}"], _ref8 => {
84
+ })(["background:", ";width:", ";height:", ";margin-top:-", ";border-radius:0 0 0 100%;position:relative;z-index:-1;&::after{content:'';border-bottom-left-radius:", ";position:absolute;height:", ";background:", ";width:", ";}"], _ref10 => {
75
85
  let {
76
86
  curveBackgroundColor
77
- } = _ref8;
87
+ } = _ref10;
78
88
  return curveBackgroundColor;
79
- }, _ref9 => {
89
+ }, _ref11 => {
80
90
  let {
81
91
  curveWidth
82
- } = _ref9;
92
+ } = _ref11;
83
93
  return curveWidth;
84
- }, _ref10 => {
94
+ }, _ref12 => {
85
95
  let {
86
96
  curveHeight
87
- } = _ref10;
97
+ } = _ref12;
88
98
  return curveHeight;
89
- }, _ref11 => {
99
+ }, _ref13 => {
90
100
  let {
91
101
  curveMarginTop
92
- } = _ref11;
102
+ } = _ref13;
93
103
  return curveMarginTop;
94
- }, _ref12 => {
104
+ }, _ref14 => {
95
105
  let {
96
106
  curveAfterRadius
97
- } = _ref12;
107
+ } = _ref14;
98
108
  return curveAfterRadius;
99
- }, _ref13 => {
109
+ }, _ref15 => {
100
110
  let {
101
111
  curveAfterHeight
102
- } = _ref13;
112
+ } = _ref15;
103
113
  return curveAfterHeight;
104
- }, _ref14 => {
114
+ }, _ref16 => {
105
115
  let {
106
116
  curveAfterBackgroundColor
107
- } = _ref14;
117
+ } = _ref16;
108
118
  return curveAfterBackgroundColor;
109
- }, _ref15 => {
119
+ }, _ref17 => {
110
120
  let {
111
121
  curveAfterWidth
112
- } = _ref15;
122
+ } = _ref17;
113
123
  return curveAfterWidth;
114
124
  });
115
125
 
116
- const Ribbon = _ref16 => {
126
+ const Ribbon = _ref18 => {
117
127
  let {
118
128
  children,
119
129
  tokens,
@@ -122,7 +132,7 @@ const Ribbon = _ref16 => {
122
132
  top,
123
133
  variant = {},
124
134
  ...rest
125
- } = _ref16;
135
+ } = _ref18;
126
136
  const {
127
137
  backgroundColor,
128
138
  borderRadius,
@@ -143,19 +153,25 @@ const Ribbon = _ref16 => {
143
153
  paddingLeft,
144
154
  paddingRight,
145
155
  paddingTop,
146
- gradient
147
- } = (0, _componentsBase.useThemeTokens)('Ribbon', tokens, variant);
148
- const {
149
- purpose
150
- } = variant;
151
- const {
152
- type: gradientType,
153
- angle: gradientAngle,
154
- stops: gradientColors
155
- } = gradient;
156
- const isOfferPurpose = purpose === 'offer';
157
- const gradientBackground = `${gradientType}-gradient(${gradientAngle}deg, ${gradientColors[0].color}, ${gradientColors[1].color})`;
158
- const background = isOfferPurpose ? gradientBackground : backgroundColor;
156
+ gradient,
157
+ fontColor,
158
+ borderRadiusBottomLeft,
159
+ borderRadiusBottomRight
160
+ } = (0, _componentsBase.useThemeTokens)('Ribbon', tokens, { ...variant,
161
+ wrap: shouldWrap
162
+ });
163
+ let background = backgroundColor;
164
+
165
+ if (gradient) {
166
+ const {
167
+ type: gradientType,
168
+ angle: gradientAngle,
169
+ stops: gradientColors
170
+ } = gradient;
171
+ const gradientBackground = `${gradientType}-gradient(${gradientAngle}deg, ${gradientColors[0].color}, ${gradientColors[1].color})`;
172
+ background = gradientBackground;
173
+ }
174
+
159
175
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RibbonWrapper, {
160
176
  left: left,
161
177
  top: top,
@@ -167,12 +183,17 @@ const Ribbon = _ref16 => {
167
183
  padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
168
184
  borderRadius: `${borderRadius}px`,
169
185
  boxShadow: `${boxShadowPaddingTop}px ${boxShadowPaddingRight}px ${boxShadowPaddingBottom}px ${boxShadowPaddingLeft}px ${boxShadowColor}`,
186
+ borderRadiusBottomLeft: `${borderRadiusBottomLeft}px`,
187
+ borderRadiusBottomRight: `${borderRadiusBottomRight}px`,
170
188
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
171
189
  variant: {
172
190
  size: 'micro',
173
191
  bold: true,
174
192
  inverse: true
175
193
  },
194
+ tokens: {
195
+ color: fontColor
196
+ },
176
197
  children: children
177
198
  })
178
199
  }), shouldWrap && /*#__PURE__*/(0, _jsxRuntime.jsx)(RibbonCurve, {