@telus-uds/components-web 2.25.1 → 2.27.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 CHANGED
@@ -1,16 +1,46 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- This log was last generated on Mon, 27 Nov 2023 21:13:27 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 13 Dec 2023 21:13:56 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.27.0
8
+
9
+ Wed, 13 Dec 2023 21:13:56 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - fixed WebVideo youtube callback type by adding event params (kristina.kirpichnikova@telus.com)
14
+ - Bump @telus-uds/components-base to v1.72.0
15
+ - Bump @telus-uds/system-theme-tokens to v2.48.0
16
+
17
+ ### Patches
18
+
19
+ - `DatePicker`: Fix stacking context and positioning issue (shahzaibkhalidmalik@outlook.com)
20
+ - fixes the size-by-height property (guillermo.peitzner@telus.com)
21
+ - adding colour toggle to imports (mauricio.batresmontejo@telus.com)
22
+
23
+ ## 2.26.0
24
+
25
+ Fri, 01 Dec 2023 21:08:36 GMT
26
+
27
+ ### Minor changes
28
+
29
+ - `Card`: Add interactive section (shahzaibkhalidmalik@outlook.com)
30
+ - Bump @telus-uds/components-base to v1.71.0
31
+ - Bump @telus-uds/system-theme-tokens to v2.47.0
32
+
33
+ ### Patches
34
+
35
+ - fix tokens type for Multiselect props (email not defined)
36
+
7
37
  ## 2.25.1
8
38
 
9
- Mon, 27 Nov 2023 21:13:27 GMT
39
+ Mon, 27 Nov 2023 21:20:44 GMT
10
40
 
11
41
  ### Patches
12
42
 
13
- - TS defenitions for WebVideo (srikanthkhari@gmail.com)
43
+ - TS defenitions for WebVideo (srikanthkhari@gmail.com)
14
44
  - Bump @telus-uds/components-base to v1.70.0
15
45
 
16
46
  ## 2.25.0
package/lib/Card/Card.js CHANGED
@@ -16,27 +16,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  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; }
17
17
  /* eslint-disable react/require-default-props */
18
18
 
19
- const selectCardBaseTokens = _ref => {
20
- let {
21
- backgroundColor,
22
- borderColor,
23
- gradient,
24
- borderWidth,
25
- borderRadius,
26
- shadow,
27
- minWidth
28
- } = _ref;
29
- return {
30
- backgroundColor,
31
- borderColor,
32
- gradient,
33
- borderWidth,
34
- borderRadius,
35
- shadow,
36
- minWidth
37
- };
38
- };
39
-
40
19
  // Passes React Native-oriented system props through UDS Card
41
20
  const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_componentsBase.a11yProps, _componentsBase.viewProps]);
42
21
 
@@ -75,8 +54,11 @@ const Card = /*#__PURE__*/(0, _react.forwardRef)(function () {
75
54
  footerPadding,
76
55
  fullBleedImage,
77
56
  fullBleedContent = fullBleedImage,
78
- tokens,
57
+ tokens = {},
79
58
  variant,
59
+ interactiveCard,
60
+ onPress,
61
+ dataSet,
80
62
  ...rest
81
63
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
82
64
  fullBleedContent: {
@@ -93,9 +75,15 @@ const Card = /*#__PURE__*/(0, _react.forwardRef)(function () {
93
75
 
94
76
  // If the card has rounded corners and a full bleed image, we need to apply
95
77
  // those corners on the image as well, but partially
96
- const cardTokens = (0, _componentsBase.useThemeTokens)('Card', tokens, variant);
78
+ const {
79
+ borderRadius
80
+ } = (0, _componentsBase.useThemeTokens)('Card', tokens, variant);
81
+ const getThemeTokens = (0, _componentsBase.useThemeTokensCallback)('Card', interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.tokens, {
82
+ interactive: true,
83
+ ...((interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.variant) || {})
84
+ });
97
85
  const hasFooter = Boolean(footer);
98
- const fullBleedBorderRadius = (0, _FullBleedContent.getFullBleedBorderRadius)(cardTokens === null || cardTokens === void 0 ? void 0 : cardTokens.borderRadius, fullBleedContentPosition, hasFooter);
86
+ const fullBleedBorderRadius = (0, _FullBleedContent.getFullBleedBorderRadius)(borderRadius, fullBleedContentPosition, hasFooter);
99
87
 
100
88
  // Make multiple cards in a row have equal heights with even space between content items
101
89
  const columnFlex = {
@@ -103,30 +91,46 @@ const Card = /*#__PURE__*/(0, _react.forwardRef)(function () {
103
91
  flexShrink: 1,
104
92
  justifyContent: 'space-between'
105
93
  };
94
+ // When interactive area is present, spacing tokens should only be applied
95
+ // to individual Card sections, not Card as a whole
96
+ const {
97
+ paddingTop,
98
+ paddingBottom,
99
+ paddingLeft,
100
+ paddingRight,
101
+ ...restOfTokens
102
+ } = tokens;
106
103
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Card, {
107
104
  ref: ref,
108
105
  variant: {
109
106
  ...variant,
110
107
  padding: 'custom'
111
108
  },
112
- tokens: selectCardBaseTokens(cardTokens),
109
+ tokens: restOfTokens,
113
110
  ...selectProps(rest),
114
111
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
115
112
  space: 0,
116
113
  tokens: columnFlex,
117
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
114
+ children: [interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.PressableCardBase, {
115
+ ref: ref,
116
+ tokens: getThemeTokens,
117
+ dataSet: dataSet,
118
+ onPress: onPress,
119
+ ...selectProps(rest),
120
+ children: interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body
121
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
118
122
  direction: contentStackDirection,
119
123
  tokens: {
120
124
  ...columnFlex,
121
125
  alignItems: contentStackAlign
122
126
  },
123
127
  space: 0,
124
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardContent.default, {
128
+ children: [children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardContent.default, {
125
129
  tokens: tokens,
126
130
  variant: variant,
127
131
  withFooter: hasFooter,
128
132
  children: children
129
- }), fullBleedContentPosition !== 'none' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullBleedContent.default, {
133
+ }) : null, fullBleedContentPosition !== 'none' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullBleedContent.default, {
130
134
  borderRadius: fullBleedBorderRadius,
131
135
  ...fullBleedContentProps
132
136
  })]
@@ -179,7 +183,20 @@ Card.propTypes = {
179
183
  /**
180
184
  * Card variant.
181
185
  */
182
- variant: _componentsBase.variantProp.propType
186
+ variant: _componentsBase.variantProp.propType,
187
+ /**
188
+ * Function to call on pressing the card.
189
+ * Note: This is only available when `interactive` variant is used.
190
+ */
191
+ onPress: _propTypes.default.func,
192
+ /**
193
+ * Object to set interactive card's properties
194
+ */
195
+ interactiveCard: _propTypes.default.shape({
196
+ body: _propTypes.default.node,
197
+ tokens: (0, _componentsBase.getTokensPropType)('Card'),
198
+ variant: _componentsBase.variantProp.propType
199
+ })
183
200
  };
184
201
  var _default = Card;
185
202
  exports.default = _default;
@@ -54,6 +54,24 @@ const DateInputWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
54
54
  display: 'flex',
55
55
  flexDirection: 'column'
56
56
  });
57
+ const PortalPositionedContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
58
+ displayName: "DatePicker__PortalPositionedContainer",
59
+ componentId: "components-web__sc-mz8fi3-2"
60
+ })({
61
+ position: 'absolute',
62
+ left: _ref => {
63
+ let {
64
+ left
65
+ } = _ref;
66
+ return `${left}px`;
67
+ },
68
+ top: _ref2 => {
69
+ let {
70
+ top
71
+ } = _ref2;
72
+ return `${top}px`;
73
+ }
74
+ });
57
75
 
58
76
  /**
59
77
  * Use DatePicker to select a date on a calendar.
@@ -76,7 +94,7 @@ const DateInputWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
76
94
  * - Optimized for keyboard interaction and tablet touch
77
95
  * - Recommended for viewports greater than or equal to 576px
78
96
  */
79
- const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
97
+ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
80
98
  var _dictionary$copy;
81
99
  let {
82
100
  copy = 'en',
@@ -97,9 +115,33 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
97
115
  prevTestID,
98
116
  nextTestID,
99
117
  ...rest
100
- } = _ref;
118
+ } = _ref3;
101
119
  const [inputDate, setInputDate] = (0, _react.useState)(date instanceof _moment.default ? date : undefined);
102
120
  const [inputText, setInputText] = (0, _react.useState)(date instanceof _moment.default ? date.format(dateFormat) : '');
121
+ const textInputRef = (0, _react.useRef)();
122
+ const [datePickerPosition, setDatePickerPosition] = (0, _react.useState)({
123
+ left: 0,
124
+ top: 0
125
+ });
126
+ (0, _componentsBase.useSafeLayoutEffect)(() => {
127
+ const updateDimensions = () => {
128
+ if (inline) return;
129
+ const {
130
+ left,
131
+ top
132
+ } = textInputRef.current.getBoundingClientRect();
133
+ setDatePickerPosition({
134
+ left,
135
+ top: top + textInputRef.current.offsetHeight
136
+ });
137
+ };
138
+ const throttledUpdateDimensions = (0, _lodash.throttle)(updateDimensions, 100, {
139
+ leading: false
140
+ });
141
+ updateDimensions();
142
+ window.addEventListener('resize', throttledUpdateDimensions);
143
+ return () => window.removeEventListener('resize', throttledUpdateDimensions);
144
+ }, []);
103
145
  const [isFocused, setIsFocused] = (0, _react.useState)(false);
104
146
  const [isClickedInside, setIsClickedInside] = (0, _react.useState)(false);
105
147
  const getCopy = (0, _componentsBase.useCopy)({
@@ -116,10 +158,10 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
116
158
  setInputText(date instanceof _moment.default ? date.format(dateFormat) : '');
117
159
  }
118
160
  }, [date, inputDate]);
119
- const onFocusChange = _ref2 => {
161
+ const onFocusChange = _ref4 => {
120
162
  let {
121
163
  focused
122
- } = _ref2;
164
+ } = _ref4;
123
165
  if (!isClickedInside) {
124
166
  setIsFocused(focused);
125
167
  }
@@ -164,7 +206,7 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
164
206
  const circleSize = getResponsiveCircleSize(inline, viewport);
165
207
  const HiddenInputFieldContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
166
208
  displayName: "DatePicker__HiddenInputFieldContainer",
167
- componentId: "components-web__sc-mz8fi3-2"
209
+ componentId: "components-web__sc-mz8fi3-3"
168
210
  })(["height:", ";width:", ";overflow:hidden;"], props => props.height, props => props.width);
169
211
  const {
170
212
  hiddenInputFieldContainerHeight,
@@ -190,10 +232,10 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
190
232
  fontName: remainingTokens.dayPickerWeekHeaderFontName,
191
233
  fontWeight: remainingTokens.dayPickerWeekHeaderFontWeight
192
234
  });
193
- const renderPrevButton = _ref3 => {
235
+ const renderPrevButton = _ref5 => {
194
236
  let {
195
237
  onClick
196
- } = _ref3;
238
+ } = _ref5;
197
239
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.IconButton, {
198
240
  onPress: () => {
199
241
  onClick();
@@ -205,10 +247,10 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
205
247
  testID: prevTestID
206
248
  });
207
249
  };
208
- const renderNextButton = _ref4 => {
250
+ const renderNextButton = _ref6 => {
209
251
  let {
210
252
  onClick
211
- } = _ref4;
253
+ } = _ref6;
212
254
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.IconButton, {
213
255
  onPress: () => {
214
256
  onClick();
@@ -220,18 +262,7 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
220
262
  testID: nextTestID
221
263
  });
222
264
  };
223
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarContainer.default, {
224
- ...selectProps(rest),
225
- daySize: daySize,
226
- validation: validation,
227
- remainingTokens: {
228
- ...remainingTokens
229
- },
230
- calendarDayDefaultHeight: circleSize,
231
- calendarDayDefaultWidth: circleSize,
232
- calendarMonthFontTokens: calendarMonthFontTokens,
233
- calendarWeekFontTokens: calendarWeekFontTokens,
234
- defaultFontTokens: defaultFontTokens,
265
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
235
266
  children: inline ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
236
267
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HiddenInputFieldContainer, {
237
268
  height: hiddenInputFieldContainerHeight,
@@ -243,68 +274,33 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
243
274
  value: inputText,
244
275
  readOnly: true
245
276
  })
246
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DayPickerSingleDateController.default, {
247
- date: inputDate,
248
- onDateChange: onChange,
249
- focused: isFocused,
250
- onFocusChange: onFocusChange,
251
- numberOfMonths: 1,
252
- hideKeyboardShortcutsPanel: true,
253
- keepOpenOnDateSelect: false,
277
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarContainer.default, {
278
+ ...selectProps(rest),
254
279
  daySize: daySize,
255
- renderNavPrevButton: renderPrevButton,
256
- renderNavNextButton: renderNextButton,
257
- isOutsideRange: isDayDisabled,
258
- phrases: getCopy(),
259
- renderMonthElement: _ref5 => {
260
- let {
261
- month
262
- } = _ref5;
263
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(MonthCenterContainer, {
264
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
265
- children: [_dictionary.default[copy] ? _dictionary.default[copy].months[month.month()] : month.format('MMMM'), ' ', month.year()]
266
- })
267
- });
268
- },
269
- renderWeekHeaderElement: day => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
270
- children: _dictionary.default[copy] ? _dictionary.default[copy].weekDays[day] : day
271
- })
272
- })]
273
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(DateInputWrapper, {
274
- onMouseDown: handleMouseDown,
275
- onFocus: handleFocus,
276
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.TextInput, {
277
- copy: copy,
278
- feedback: feedback,
279
- hint: hint,
280
- placeholder: "DD / MM / YYYY",
281
- onChange: onChangeInput,
282
- tooltip: tooltip,
283
- hintPosition: hintPosition,
284
- label: ((_dictionary$copy = _dictionary.default[copy]) === null || _dictionary$copy === void 0 ? void 0 : _dictionary$copy.roleDescription) ?? label,
285
- value: inputText,
286
280
  validation: validation,
287
- inactive: disabled,
288
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SingleDatePicker.default, {
281
+ remainingTokens: remainingTokens,
282
+ calendarDayDefaultHeight: circleSize,
283
+ calendarDayDefaultWidth: circleSize,
284
+ calendarMonthFontTokens: calendarMonthFontTokens,
285
+ calendarWeekFontTokens: calendarWeekFontTokens,
286
+ defaultFontTokens: defaultFontTokens,
287
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DayPickerSingleDateController.default, {
289
288
  date: inputDate,
290
- disabled: disabled,
291
289
  onDateChange: onChange,
292
290
  focused: isFocused,
293
291
  onFocusChange: onFocusChange,
294
292
  numberOfMonths: 1,
295
293
  hideKeyboardShortcutsPanel: true,
296
- keepOpenOnDateSelect: true,
294
+ keepOpenOnDateSelect: false,
297
295
  daySize: daySize,
298
- ref: ref,
299
296
  renderNavPrevButton: renderPrevButton,
297
+ renderNavNextButton: renderNextButton,
300
298
  isOutsideRange: isDayDisabled,
301
299
  phrases: getCopy(),
302
- id: id,
303
- renderNavNextButton: renderNextButton,
304
- renderMonthElement: _ref6 => {
300
+ renderMonthElement: _ref7 => {
305
301
  let {
306
302
  month
307
- } = _ref6;
303
+ } = _ref7;
308
304
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(MonthCenterContainer, {
309
305
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
310
306
  children: [_dictionary.default[copy] ? _dictionary.default[copy].months[month.month()] : month.format('MMMM'), ' ', month.year()]
@@ -315,6 +311,70 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
315
311
  children: _dictionary.default[copy] ? _dictionary.default[copy].weekDays[day] : day
316
312
  })
317
313
  })
314
+ })]
315
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(DateInputWrapper, {
316
+ onMouseDown: handleMouseDown,
317
+ onFocus: handleFocus,
318
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.TextInput, {
319
+ copy: copy,
320
+ feedback: feedback,
321
+ hint: hint,
322
+ placeholder: "DD / MM / YYYY",
323
+ onChange: onChangeInput,
324
+ tooltip: tooltip,
325
+ hintPosition: hintPosition,
326
+ label: ((_dictionary$copy = _dictionary.default[copy]) === null || _dictionary$copy === void 0 ? void 0 : _dictionary$copy.roleDescription) ?? label,
327
+ value: inputText,
328
+ validation: validation,
329
+ inactive: disabled,
330
+ ref: textInputRef,
331
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Portal, {
332
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PortalPositionedContainer, {
333
+ top: datePickerPosition.top,
334
+ left: datePickerPosition.left,
335
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarContainer.default, {
336
+ ...selectProps(rest),
337
+ daySize: daySize,
338
+ validation: validation,
339
+ remainingTokens: remainingTokens,
340
+ calendarDayDefaultHeight: circleSize,
341
+ calendarDayDefaultWidth: circleSize,
342
+ calendarMonthFontTokens: calendarMonthFontTokens,
343
+ calendarWeekFontTokens: calendarWeekFontTokens,
344
+ defaultFontTokens: defaultFontTokens,
345
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SingleDatePicker.default, {
346
+ date: inputDate,
347
+ disabled: disabled,
348
+ onDateChange: onChange,
349
+ focused: isFocused,
350
+ onFocusChange: onFocusChange,
351
+ numberOfMonths: 1,
352
+ hideKeyboardShortcutsPanel: true,
353
+ keepOpenOnDateSelect: true,
354
+ daySize: daySize,
355
+ ref: ref,
356
+ renderNavPrevButton: renderPrevButton,
357
+ isOutsideRange: isDayDisabled,
358
+ phrases: getCopy(),
359
+ id: id,
360
+ renderNavNextButton: renderNextButton,
361
+ renderMonthElement: _ref8 => {
362
+ let {
363
+ month
364
+ } = _ref8;
365
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(MonthCenterContainer, {
366
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
367
+ children: [_dictionary.default[copy] ? _dictionary.default[copy].months[month.month()] : month.format('MMMM'), ' ', month.year()]
368
+ })
369
+ });
370
+ },
371
+ renderWeekHeaderElement: day => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
372
+ children: _dictionary.default[copy] ? _dictionary.default[copy].weekDays[day] : day
373
+ })
374
+ })
375
+ })
376
+ })
377
+ })
318
378
  })
319
379
  })
320
380
  });
@@ -42,7 +42,7 @@ const OptimizeImage = _ref => {
42
42
  mdSrc: (0, _utils.getOptimizedUrl)(contentfulAssetUrl, dimension, md, quality, disableRetina, supportsWebp),
43
43
  lgSrc: (0, _utils.getOptimizedUrl)(contentfulAssetUrl, dimension, lg, quality, disableRetina, supportsWebp),
44
44
  xlSrc: (0, _utils.getOptimizedUrl)(contentfulAssetUrl, dimension, xl, quality, disableRetina, supportsWebp),
45
- fallbackSrc: (0, _utils.getFallbackUrl)(contentfulAssetUrl, xl, quality)
45
+ fallbackSrc: (0, _utils.getFallbackUrl)(contentfulAssetUrl, dimension, xl, quality)
46
46
  });
47
47
  });
48
48
  }, [contentfulAssetUrl, dimension, disableRetina, lg, md, quality, sm, xl, xs]);
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = getFallbackUrl;
7
7
  var _isSvgUrl = _interopRequireDefault(require("./isSvgUrl"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- function getFallbackUrl(url, width, quality) {
9
+ function getFallbackUrl(url, dimension, size, quality) {
10
10
  if (!(0, _isSvgUrl.default)(url)) {
11
- return `${url}?w=${width}&q=${quality}`;
11
+ return `${url}?${dimension}=${size}&q=${quality}`;
12
12
  }
13
13
  return url;
14
14
  }
@@ -93,6 +93,12 @@ Object.defineProperty(exports, "ChevronLink", {
93
93
  return _componentsBase.ChevronLink;
94
94
  }
95
95
  });
96
+ Object.defineProperty(exports, "ColourToggle", {
97
+ enumerable: true,
98
+ get: function () {
99
+ return _componentsBase.ColourToggle;
100
+ }
101
+ });
96
102
  Object.defineProperty(exports, "Divider", {
97
103
  enumerable: true,
98
104
  get: function () {
@@ -1,34 +1,14 @@
1
1
  /* eslint-disable react/require-default-props */
2
2
  import React, { forwardRef } from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { Card as CardBase, getTokensPropType, paddingProp, responsiveProps, selectSystemProps, StackView, useThemeTokens, variantProp, a11yProps, viewProps } from '@telus-uds/components-base';
4
+ import { Card as CardBase, getTokensPropType, paddingProp, responsiveProps, selectSystemProps, StackView, useThemeTokens, useThemeTokensCallback, variantProp, a11yProps, viewProps, PressableCardBase } from '@telus-uds/components-base';
5
5
  import CardContent from './CardContent';
6
6
  import CardFooter from './CardFooter';
7
7
  import FullBleedContent, { getFullBleedBorderRadius, useFullBleedContentProps } from '../shared/FullBleedContent';
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- import { jsxs as _jsxs } from "react/jsx-runtime";
10
- const selectCardBaseTokens = _ref => {
11
- let {
12
- backgroundColor,
13
- borderColor,
14
- gradient,
15
- borderWidth,
16
- borderRadius,
17
- shadow,
18
- minWidth
19
- } = _ref;
20
- return {
21
- backgroundColor,
22
- borderColor,
23
- gradient,
24
- borderWidth,
25
- borderRadius,
26
- shadow,
27
- minWidth
28
- };
29
- };
30
8
 
31
9
  // Passes React Native-oriented system props through UDS Card
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
32
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
33
13
 
34
14
  /**
@@ -66,8 +46,11 @@ const Card = /*#__PURE__*/forwardRef(function () {
66
46
  footerPadding,
67
47
  fullBleedImage,
68
48
  fullBleedContent = fullBleedImage,
69
- tokens,
49
+ tokens = {},
70
50
  variant,
51
+ interactiveCard,
52
+ onPress,
53
+ dataSet,
71
54
  ...rest
72
55
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
73
56
  fullBleedContent: {
@@ -84,9 +67,15 @@ const Card = /*#__PURE__*/forwardRef(function () {
84
67
 
85
68
  // If the card has rounded corners and a full bleed image, we need to apply
86
69
  // those corners on the image as well, but partially
87
- const cardTokens = useThemeTokens('Card', tokens, variant);
70
+ const {
71
+ borderRadius
72
+ } = useThemeTokens('Card', tokens, variant);
73
+ const getThemeTokens = useThemeTokensCallback('Card', interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.tokens, {
74
+ interactive: true,
75
+ ...((interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.variant) || {})
76
+ });
88
77
  const hasFooter = Boolean(footer);
89
- const fullBleedBorderRadius = getFullBleedBorderRadius(cardTokens === null || cardTokens === void 0 ? void 0 : cardTokens.borderRadius, fullBleedContentPosition, hasFooter);
78
+ const fullBleedBorderRadius = getFullBleedBorderRadius(borderRadius, fullBleedContentPosition, hasFooter);
90
79
 
91
80
  // Make multiple cards in a row have equal heights with even space between content items
92
81
  const columnFlex = {
@@ -94,30 +83,46 @@ const Card = /*#__PURE__*/forwardRef(function () {
94
83
  flexShrink: 1,
95
84
  justifyContent: 'space-between'
96
85
  };
86
+ // When interactive area is present, spacing tokens should only be applied
87
+ // to individual Card sections, not Card as a whole
88
+ const {
89
+ paddingTop,
90
+ paddingBottom,
91
+ paddingLeft,
92
+ paddingRight,
93
+ ...restOfTokens
94
+ } = tokens;
97
95
  return /*#__PURE__*/_jsx(CardBase, {
98
96
  ref: ref,
99
97
  variant: {
100
98
  ...variant,
101
99
  padding: 'custom'
102
100
  },
103
- tokens: selectCardBaseTokens(cardTokens),
101
+ tokens: restOfTokens,
104
102
  ...selectProps(rest),
105
103
  children: /*#__PURE__*/_jsxs(StackView, {
106
104
  space: 0,
107
105
  tokens: columnFlex,
108
- children: [/*#__PURE__*/_jsxs(StackView, {
106
+ children: [interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? /*#__PURE__*/_jsx(PressableCardBase, {
107
+ ref: ref,
108
+ tokens: getThemeTokens,
109
+ dataSet: dataSet,
110
+ onPress: onPress,
111
+ ...selectProps(rest),
112
+ children: interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body
113
+ }) : null, /*#__PURE__*/_jsxs(StackView, {
109
114
  direction: contentStackDirection,
110
115
  tokens: {
111
116
  ...columnFlex,
112
117
  alignItems: contentStackAlign
113
118
  },
114
119
  space: 0,
115
- children: [/*#__PURE__*/_jsx(CardContent, {
120
+ children: [children ? /*#__PURE__*/_jsx(CardContent, {
116
121
  tokens: tokens,
117
122
  variant: variant,
118
123
  withFooter: hasFooter,
119
124
  children: children
120
- }), fullBleedContentPosition !== 'none' && /*#__PURE__*/_jsx(FullBleedContent, {
125
+ }) : null, fullBleedContentPosition !== 'none' && /*#__PURE__*/_jsx(FullBleedContent, {
121
126
  borderRadius: fullBleedBorderRadius,
122
127
  ...fullBleedContentProps
123
128
  })]
@@ -170,6 +175,19 @@ Card.propTypes = {
170
175
  /**
171
176
  * Card variant.
172
177
  */
173
- variant: variantProp.propType
178
+ variant: variantProp.propType,
179
+ /**
180
+ * Function to call on pressing the card.
181
+ * Note: This is only available when `interactive` variant is used.
182
+ */
183
+ onPress: PropTypes.func,
184
+ /**
185
+ * Object to set interactive card's properties
186
+ */
187
+ interactiveCard: PropTypes.shape({
188
+ body: PropTypes.node,
189
+ tokens: getTokensPropType('Card'),
190
+ variant: variantProp.propType
191
+ })
174
192
  };
175
193
  export default Card;