@telus-uds/components-web 2.13.0 → 2.14.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.
@@ -104,11 +104,13 @@ const Testimonial = _ref5 => {
104
104
  imageSrc,
105
105
  image = imageSrc,
106
106
  additionalInfo,
107
- testimonialStyle = 'heading',
107
+ testimonialStyle = 'large',
108
108
  tokens,
109
+ copy = 'en',
109
110
  variant = {},
110
111
  ...rest
111
112
  } = _ref5;
113
+ const viewport = (0, _componentsBase.useViewport)();
112
114
  const {
113
115
  testimonialContainerGap,
114
116
  quoteContainerGap,
@@ -117,9 +119,34 @@ const Testimonial = _ref5 => {
117
119
  figcaptionGap,
118
120
  textColor,
119
121
  icon,
122
+ iconFr,
120
123
  iconColor,
121
- imageSize
122
- } = (0, _componentsBase.useThemeTokens)('Testimonial', tokens, variant);
124
+ imageSize,
125
+ testimonialFontSizeLarge,
126
+ testimonialLineHeightLarge,
127
+ testimonialFontWeightLarge,
128
+ testimonialFontSizeHeading,
129
+ testimonialLineHeightHeading,
130
+ testimonialFontNameHeading,
131
+ testimonialFontWeightHeading,
132
+ authorFontSize,
133
+ authorLineHeight,
134
+ authorFontName,
135
+ authorFontWeight,
136
+ additionalFontSize,
137
+ additionalLineHeight,
138
+ additionalFontName,
139
+ additionalFontWeight
140
+ } = (0, _componentsBase.useThemeTokens)('Testimonial', tokens, variant, {
141
+ viewport
142
+ });
143
+
144
+ const getQuoteTestimonial = open => {
145
+ let quote = '';
146
+ if (copy === 'en') quote = open ? '\u201C' : '\u201D';else quote = open ? '\u00AB ' : ' \u00BB';
147
+ return quote;
148
+ };
149
+
123
150
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(TestimonialContainer, {
124
151
  testimonialContainerGap: testimonialContainerGap,
125
152
  ...selectProps(rest),
@@ -132,7 +159,7 @@ const Testimonial = _ref5 => {
132
159
  variant: {
133
160
  size: 'micro'
134
161
  },
135
- icon: icon
162
+ icon: copy === 'en' ? icon : iconFr
136
163
  }), showDivider && /*#__PURE__*/(0, _jsxRuntime.jsx)(Divider, {
137
164
  dividerBackgroundColor: dividerBackgroundColor,
138
165
  dividerBorder: dividerBorder,
@@ -145,9 +172,12 @@ const Testimonial = _ref5 => {
145
172
  },
146
173
  tokens: {
147
174
  color: textColor,
148
- fontWeight: '400'
175
+ fontSize: testimonialStyle === 'heading' ? testimonialFontSizeHeading : testimonialFontSizeLarge,
176
+ lineHeight: testimonialStyle === 'heading' ? testimonialLineHeightHeading : testimonialLineHeightLarge,
177
+ fontName: testimonialFontNameHeading,
178
+ fontWeight: testimonialStyle === 'heading' ? testimonialFontWeightHeading : testimonialFontWeightLarge
149
179
  },
150
- children: `\u201C${testimonial}\u201D`
180
+ children: `${getQuoteTestimonial(true)}${testimonial}${getQuoteTestimonial()}`
151
181
  })
152
182
  }), (image || title || additionalInfo) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(Figcaption, {
153
183
  figcaptionGap: figcaptionGap,
@@ -160,20 +190,26 @@ const Testimonial = _ref5 => {
160
190
  }) : image), (title || additionalInfo) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(AuthorInfoContainer, {
161
191
  children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
162
192
  variant: {
163
- size: 'small',
164
- colour: 'secondary'
193
+ size: 'small'
165
194
  },
166
195
  tokens: {
167
- fontWeight: '500'
196
+ color: textColor,
197
+ fontSize: authorFontSize,
198
+ lineHeight: authorLineHeight,
199
+ fontName: authorFontName,
200
+ fontWeight: authorFontWeight
168
201
  },
169
202
  children: title
170
203
  }), additionalInfo && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
171
204
  variant: {
172
- size: 'micro',
173
- colour: 'secondary'
205
+ size: 'small'
174
206
  },
175
207
  tokens: {
176
- fontWeight: '400'
208
+ color: textColor,
209
+ fontSize: additionalFontSize,
210
+ lineHeight: additionalLineHeight,
211
+ fontName: additionalFontName,
212
+ fontWeight: additionalFontWeight
177
213
  },
178
214
  children: additionalInfo
179
215
  })]
@@ -61,7 +61,8 @@ const Badge = _ref6 => {
61
61
  paddingTop,
62
62
  paddingBottom,
63
63
  fontName,
64
- fontWeight
64
+ fontWeight,
65
+ fontSize
65
66
  } = useThemeTokens('Badge', tokens, variant);
66
67
  const semanticGradient = gradient && transformGradient(gradient);
67
68
  const {
@@ -78,6 +79,11 @@ const Badge = _ref6 => {
78
79
  background = semanticGradient;
79
80
  }
80
81
 
82
+ const fontSizeMapping = {
83
+ 12: 'micro',
84
+ 14: 'small',
85
+ 16: 'h6'
86
+ };
81
87
  return /*#__PURE__*/_jsx(BadgeContainer, {
82
88
  isOutlineOffer: isOutlineOffer,
83
89
  isAlternative: alternative,
@@ -95,6 +101,9 @@ const Badge = _ref6 => {
95
101
  fontWeight,
96
102
  color
97
103
  },
104
+ variant: {
105
+ size: fontSizeMapping[fontSize]
106
+ },
98
107
  children: children
99
108
  })
100
109
  });
@@ -7,6 +7,7 @@ import SingleDatePicker from 'react-dates/lib/components/SingleDatePicker';
7
7
  import DayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController';
8
8
  import { IconButton, TextInput, selectSystemProps, useCopy, useViewport, useThemeTokens, applyTextStyles } from '@telus-uds/components-base';
9
9
  import moment from 'moment';
10
+ import { isUndefined } from 'lodash';
10
11
  import CalendarContainer from './CalendarContainer';
11
12
  import dictionary from './dictionary';
12
13
  import { htmlAttrs } from '../utils';
@@ -111,7 +112,11 @@ const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
111
112
  copy
112
113
  });
113
114
  useEffect(() => {
114
- if (!moment(date).isSame(inputDate)) {
115
+ /**
116
+ * `date` could be passed as `null` to reset the value so explicitly
117
+ * checking for not being `undefined`
118
+ */
119
+ if (!isUndefined(date) && !moment(date).isSame(inputDate)) {
115
120
  setInputDate(date);
116
121
  setInputText(date instanceof moment ? date.format(dateFormat) : '');
117
122
  }
@@ -153,6 +158,7 @@ const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
153
158
  const onChange = value => {
154
159
  setInputDate(value);
155
160
  setInputText(value.format(dateFormat));
161
+ setIsFocused(false);
156
162
  if (onDateChange) onDateChange(value);
157
163
  };
158
164
 
@@ -1,9 +1,9 @@
1
1
  import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { getThemeTokens, Box, TextInput, Spacer, Feedback, InputLabel, useInputValue, useCopy, useThemeTokens, useTheme } from '@telus-uds/components-base';
4
- import IconButton from '../IconButton';
5
- import { InputField, InputWrapper, LeftButtonWrapper, RightButtonWrapper } from './styles';
3
+ import { Box, TextInput, Spacer, Feedback, InputLabel, useInputValue, useCopy, useThemeTokensCallback } from '@telus-uds/components-base';
4
+ import { InputField, InputWrapper } from './styles';
6
5
  import defaultDictionary from './dictionary';
6
+ import SideButton from './SideButton';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const {
@@ -20,6 +20,7 @@ const QuantitySelector = _ref => {
20
20
  minNumber,
21
21
  maxNumber,
22
22
  defaultValue,
23
+ value,
23
24
  label,
24
25
  hint,
25
26
  hintPosition,
@@ -33,19 +34,9 @@ const QuantitySelector = _ref => {
33
34
  testID
34
35
  } = _ref;
35
36
  const {
36
- components: {
37
- QuantitySelector: componentTheme
38
- }
39
- } = useTheme();
40
- const {
41
- leftIcon,
42
- rightIcon,
43
- padding
44
- } = useThemeTokens('QuantitySelector', tokens, variant);
45
- const [error, setError] = useState('');
46
- const {
47
- alternative
37
+ disabled
48
38
  } = variant;
39
+ const [error, setError] = useState('');
49
40
  const getCopy = useCopy({
50
41
  dictionary,
51
42
  copy
@@ -58,17 +49,16 @@ const QuantitySelector = _ref => {
58
49
  return numberToEvaluate;
59
50
  };
60
51
 
61
- const initialValue = getValidatedNumber(defaultValue);
62
52
  const {
63
53
  currentValue: number,
64
54
  setValue: setNumber
65
55
  } = useInputValue({
66
- value: undefined,
67
- initialValue,
56
+ value: getValidatedNumber(value),
57
+ initialValue: getValidatedNumber(defaultValue),
68
58
  onChange
69
59
  });
70
- const isDecreaseEnabled = !isNumber(minNumber) || number > minNumber;
71
- const isIncreaseEnabled = !isNumber(maxNumber) || number < maxNumber;
60
+ const isDecreaseEnabled = !disabled && !isNumber(minNumber) || number > minNumber;
61
+ const isIncreaseEnabled = !disabled && !isNumber(maxNumber) || number < maxNumber;
72
62
  const inputValue = isNumber(number) ? number.toString() : '';
73
63
 
74
64
  const updateNumber = (newNumber, originalInputEvent) => {
@@ -100,20 +90,31 @@ const QuantitySelector = _ref => {
100
90
  tooltip: tooltip
101
91
  }) : null;
102
92
 
93
+ const getTokens = useThemeTokensCallback('QuantitySelector', tokens, variant);
94
+
103
95
  const renderTextInput = () => /*#__PURE__*/_jsx(TextInput, {
104
96
  nativeID: id,
105
97
  value: inputValue,
98
+ defaultValue: defaultValue,
106
99
  tokens: textInputState => {
107
100
  const {
101
+ inputWidth,
102
+ inputBorderWidth,
108
103
  inputBorderColor,
109
- inputBackgroundColor
110
- } = getThemeTokens(componentTheme, tokens, variant, textInputState);
111
- return {
112
- borderRadius: 0,
113
- margin: 0,
114
- padding: 0,
104
+ textColor,
105
+ inputBackgroundColor,
106
+ ...rest
107
+ } = getTokens({ ...textInputState
108
+ });
109
+ return { ...rest,
110
+ order: 1,
111
+ borderWidth: inputBorderWidth,
112
+ backgroundColor: inputBackgroundColor,
113
+ color: textColor,
114
+ width: inputWidth,
115
115
  borderColor: inputBorderColor,
116
- backgroundColor: inputBackgroundColor
116
+ borderRadius: 0,
117
+ outerBorderWidth: 0
117
118
  };
118
119
  },
119
120
  onChange: inputChangeHandler // Using title as an accessibility workaround
@@ -127,38 +128,6 @@ const QuantitySelector = _ref => {
127
128
  accessibilityValueNow: number
128
129
  });
129
130
 
130
- const getButtonTokens = isEnabled => buttonState => {
131
- const disabled = !isEnabled;
132
- const { ...buttonTokens
133
- } = getThemeTokens(componentTheme, tokens, variant, { ...buttonState,
134
- disabled
135
- });
136
- return { ...buttonTokens,
137
- outerBorderGap: 0,
138
- padding
139
- };
140
- };
141
-
142
- const renderLeftButton = () => {
143
- return /*#__PURE__*/_jsx(IconButton, {
144
- icon: leftIcon,
145
- tokens: getButtonTokens(isDecreaseEnabled),
146
- onPress: event => updateNumber(number - 1, event),
147
- onDoubleClick: event => updateNumber(number - 1, event),
148
- accessibilityLabel: getCopy('accessibility').decreaseButton,
149
- accessibilityDisabled: !isDecreaseEnabled
150
- });
151
- };
152
-
153
- const renderRightButton = () => /*#__PURE__*/_jsx(IconButton, {
154
- icon: rightIcon,
155
- tokens: getButtonTokens(isIncreaseEnabled),
156
- onPress: () => updateNumber(number + 1),
157
- onDoubleClick: () => updateNumber(number + 1),
158
- accessibilityLabel: getCopy('accessibility').increaseButton,
159
- accessibilityDisabled: !isIncreaseEnabled
160
- });
161
-
162
131
  return /*#__PURE__*/_jsxs(Box, {
163
132
  space: 2,
164
133
  testID: testID,
@@ -166,14 +135,39 @@ const QuantitySelector = _ref => {
166
135
  space: 2
167
136
  }), /*#__PURE__*/_jsxs(InputWrapper, {
168
137
  children: [/*#__PURE__*/_jsx(InputField, {
169
- className: `${alternative ? 'alternative' : ''}`,
170
138
  children: renderTextInput()
171
- }), /*#__PURE__*/_jsx(RightButtonWrapper, {
172
- className: `${alternative ? 'alternative' : ''}`,
173
- children: renderRightButton()
174
- }), /*#__PURE__*/_jsx(LeftButtonWrapper, {
175
- className: `${alternative ? 'alternative' : ''}`,
176
- children: renderLeftButton()
139
+ }), /*#__PURE__*/_jsx("div", {
140
+ style: {
141
+ order: 0
142
+ },
143
+ children: /*#__PURE__*/_jsx(SideButton, {
144
+ isEnabled: isDecreaseEnabled,
145
+ onPress: () => updateNumber(number - 1),
146
+ onDoubleClick: () => updateNumber(number - 1),
147
+ tokens: tokens,
148
+ variant: {
149
+ decrease: true,
150
+ ...variant
151
+ },
152
+ accessibilityLabel: getCopy('accessibility').decreaseButton,
153
+ accessibilityDisabled: !isDecreaseEnabled
154
+ })
155
+ }), /*#__PURE__*/_jsx("div", {
156
+ style: {
157
+ order: 2
158
+ },
159
+ children: /*#__PURE__*/_jsx(SideButton, {
160
+ isEnabled: isIncreaseEnabled,
161
+ onPress: () => updateNumber(number + 1),
162
+ onDoubleClick: () => updateNumber(number + 1),
163
+ accessibilityLabel: getCopy('accessibility').increaseButton,
164
+ accessibilityDisabled: !isIncreaseEnabled,
165
+ tokens: tokens,
166
+ variant: {
167
+ increase: true,
168
+ ...variant
169
+ }
170
+ })
177
171
  })]
178
172
  }), error ? /*#__PURE__*/_jsx(Box, {
179
173
  vertical: 2,
@@ -224,6 +218,12 @@ QuantitySelector.propTypes = {
224
218
  */
225
219
  defaultValue: PropTypes.number,
226
220
 
221
+ /**
222
+ * If the input's state is to be controlled by a parent component, use this prop
223
+ * together with the `onChange` to pass down and update the lifted state.
224
+ */
225
+ value: PropTypes.number,
226
+
227
227
  /**
228
228
  * The label of the input field
229
229
  */
@@ -262,7 +262,8 @@ QuantitySelector.propTypes = {
262
262
  */
263
263
  copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr'])]),
264
264
  variant: PropTypes.exact({
265
- alternative: PropTypes.bool
265
+ alternative: PropTypes.bool,
266
+ disabled: PropTypes.bool
266
267
  }),
267
268
  tokens: PropTypes.oneOf([PropTypes.object, PropTypes.func]),
268
269
 
@@ -0,0 +1,80 @@
1
+ import { IconButton, useThemeTokensCallback } from '@telus-uds/components-base';
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+
6
+ const SideButton = _ref => {
7
+ let {
8
+ isEnabled,
9
+ onPress,
10
+ onDoubleClick,
11
+ accessibilityLabel,
12
+ accessibilityDisabled,
13
+ tokens,
14
+ variant
15
+ } = _ref;
16
+ const getTokens = useThemeTokensCallback('QuantitySelectorSideButton', tokens, variant);
17
+
18
+ const getButtonTokens = _ref2 => {
19
+ let {
20
+ buttonState,
21
+ disabled
22
+ } = _ref2;
23
+ const {
24
+ borderRadius,
25
+ borderTopLeftRadius,
26
+ borderTopRightRadius,
27
+ borderBottomLeftRadius,
28
+ borderBottomRightRadius,
29
+ ...rest
30
+ } = getTokens({ ...buttonState,
31
+ disabled
32
+ });
33
+ return { ...rest,
34
+ borderRadius,
35
+ borderTopLeftRadius,
36
+ borderTopRightRadius,
37
+ borderBottomLeftRadius,
38
+ borderBottomRightRadius,
39
+ outerBorderRadius: borderRadius,
40
+ outerBorderTopLeftRadius: borderTopLeftRadius,
41
+ outerBorderTopRightRadius: borderTopRightRadius,
42
+ outerBorderBottomLeftRadius: borderBottomLeftRadius,
43
+ outerBorderBottomRightRadius: borderBottomRightRadius,
44
+ outerBorderGap: 0,
45
+ outerBorderWidth: 0
46
+ };
47
+ };
48
+
49
+ return /*#__PURE__*/_jsx(IconButton, {
50
+ tokens: buttonState => getButtonTokens({
51
+ disabled: !isEnabled,
52
+ buttonState
53
+ }),
54
+ onPress: onPress,
55
+ onDoubleClick: onDoubleClick,
56
+ accessibilityLabel: accessibilityLabel,
57
+ accessibilityDisabled: accessibilityDisabled
58
+ });
59
+ };
60
+
61
+ SideButton.displayName = 'QuantitySelectorSideButton';
62
+ SideButton.defaultProps = {
63
+ isEnabled: true,
64
+ onPress: () => {},
65
+ onDoubleClick: () => {},
66
+ accessibilityLabel: '',
67
+ accessibilityDisabled: false,
68
+ tokens: {},
69
+ variant: {}
70
+ };
71
+ SideButton.propTypes = {
72
+ isEnabled: PropTypes.bool,
73
+ onPress: PropTypes.func,
74
+ onDoubleClick: PropTypes.func,
75
+ accessibilityLabel: PropTypes.string,
76
+ accessibilityDisabled: PropTypes.bool,
77
+ tokens: PropTypes.object,
78
+ variant: PropTypes.object
79
+ };
80
+ export default SideButton;
@@ -2,20 +2,8 @@ import styled from 'styled-components';
2
2
  export const InputField = /*#__PURE__*/styled.div.withConfig({
3
3
  displayName: "styles__InputField",
4
4
  componentId: "components-web__sc-1lrz1xk-0"
5
- })(["order:2;min-width:3.5rem;max-width:5 rem;height:28px;padding:0;width:64px;text-align:center;z-index:10;input{text-align:center;}&.alternative{input{height:40px;}}"]);
6
- const ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
7
- displayName: "styles__ButtonWrapper",
8
- componentId: "components-web__sc-1lrz1xk-1"
9
- })(["&.alternative{div[role='button']{height:42px;> div{height:40px;> div{padding:12px 16px;}}}}"]);
10
- export const LeftButtonWrapper = /*#__PURE__*/styled(ButtonWrapper).withConfig({
11
- displayName: "styles__LeftButtonWrapper",
12
- componentId: "components-web__sc-1lrz1xk-2"
13
- })(["order:0;div[role='button']{border-radius:4px 0px 0px 4px !important;> div{border-right:none;border-radius:4px 0px 0px 4px !important;}}&.alternative{div[role='button']{border-radius:36px 0px 0px 36px !important;> div{border-radius:24px 0px 0px 24px !important;}}}"]);
14
- export const RightButtonWrapper = /*#__PURE__*/styled(ButtonWrapper).withConfig({
15
- displayName: "styles__RightButtonWrapper",
16
- componentId: "components-web__sc-1lrz1xk-3"
17
- })(["order:3;div[role='button']{border-radius:0px 4px 4px 0px !important;> div{border-left:none;border-radius:0px 4px 4px 0px !important;}}&.alternative{div[role='button']{border-radius:0px 36px 36px 0px !important;> div{border-radius:0px 36px 36px 0px !important;}}}"]);
5
+ })(["order:1;text-align:center;z-index:10;input{text-align:center;}"]);
18
6
  export const InputWrapper = /*#__PURE__*/styled.div.withConfig({
19
7
  displayName: "styles__InputWrapper",
20
- componentId: "components-web__sc-1lrz1xk-4"
21
- })(["textalign:start;display:flex;flexdirection:row;flexwrap:nowrap;justifycontent:center;"]);
8
+ componentId: "components-web__sc-1lrz1xk-1"
9
+ })(["text-align:start;display:flex;flex-direction:row;flex-wrap:nowrap;"]);
@@ -5,7 +5,7 @@ import { Box, Divider, selectSystemProps, Typography, useCopy, useThemeTokens, u
5
5
  import ExpandCollapse from './ExpandCollapse';
6
6
  import OrderedListBase from '../OrderedList/OrderedListBase';
7
7
  import { htmlAttrs, media, renderStructuredContent } from '../utils';
8
- import dictionary from './dictionary';
8
+ import defaultDictionary from './dictionary';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
11
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
@@ -106,6 +106,7 @@ const TermsAndConditions = /*#__PURE__*/forwardRef((_ref6, ref) => {
106
106
  nonIndexedContent,
107
107
  tokens,
108
108
  variant = {},
109
+ dictionary = defaultDictionary,
109
110
  ...rest
110
111
  } = _ref6;
111
112
  const getCopy = useCopy({
@@ -172,7 +173,13 @@ const TermsAndConditions = /*#__PURE__*/forwardRef((_ref6, ref) => {
172
173
  })]
173
174
  });
174
175
  });
175
- TermsAndConditions.displayName = 'TermsAndConditions';
176
+ TermsAndConditions.displayName = 'TermsAndConditions'; // If a language dictionary entry is provided, it must contain every key
177
+
178
+ const dictionaryContentShape = PropTypes.shape({
179
+ headingHide: PropTypes.string.isRequired,
180
+ headingView: PropTypes.string.isRequired,
181
+ nonIndexedTitle: PropTypes.string.isRequired
182
+ });
176
183
  TermsAndConditions.propTypes = { ...selectedSystemPropTypes,
177
184
 
178
185
  /**
@@ -198,11 +205,20 @@ TermsAndConditions.propTypes = { ...selectedSystemPropTypes,
198
205
  *
199
206
  * nonIndexedContent do not have a corresponding superscript and instead apply to the page as a whole.
200
207
  */
201
- nonIndexedContent: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.node, PropTypes.string]))
208
+ nonIndexedContent: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.node, PropTypes.string])),
209
+
210
+ /**
211
+ * Custom dictionary containing the labels to use for `TermsAndConditions`
212
+ */
213
+ dictionary: PropTypes.shape({
214
+ en: dictionaryContentShape,
215
+ fr: dictionaryContentShape
216
+ })
202
217
  };
203
218
  TermsAndConditions.defaultProps = {
204
219
  copy: 'en',
205
220
  indexedContent: [],
206
- nonIndexedContent: []
221
+ nonIndexedContent: [],
222
+ dictionary: defaultDictionary
207
223
  };
208
224
  export default TermsAndConditions;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
- import { Icon, selectSystemProps, Typography, useThemeTokens } from '@telus-uds/components-base';
4
+ import { Icon, selectSystemProps, Typography, useThemeTokens, useViewport } from '@telus-uds/components-base';
5
5
  import Image from '../Image';
6
6
  import { htmlAttrs } from '../utils';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -83,11 +83,13 @@ const Testimonial = _ref5 => {
83
83
  imageSrc,
84
84
  image = imageSrc,
85
85
  additionalInfo,
86
- testimonialStyle = 'heading',
86
+ testimonialStyle = 'large',
87
87
  tokens,
88
+ copy = 'en',
88
89
  variant = {},
89
90
  ...rest
90
91
  } = _ref5;
92
+ const viewport = useViewport();
91
93
  const {
92
94
  testimonialContainerGap,
93
95
  quoteContainerGap,
@@ -96,9 +98,34 @@ const Testimonial = _ref5 => {
96
98
  figcaptionGap,
97
99
  textColor,
98
100
  icon,
101
+ iconFr,
99
102
  iconColor,
100
- imageSize
101
- } = useThemeTokens('Testimonial', tokens, variant);
103
+ imageSize,
104
+ testimonialFontSizeLarge,
105
+ testimonialLineHeightLarge,
106
+ testimonialFontWeightLarge,
107
+ testimonialFontSizeHeading,
108
+ testimonialLineHeightHeading,
109
+ testimonialFontNameHeading,
110
+ testimonialFontWeightHeading,
111
+ authorFontSize,
112
+ authorLineHeight,
113
+ authorFontName,
114
+ authorFontWeight,
115
+ additionalFontSize,
116
+ additionalLineHeight,
117
+ additionalFontName,
118
+ additionalFontWeight
119
+ } = useThemeTokens('Testimonial', tokens, variant, {
120
+ viewport
121
+ });
122
+
123
+ const getQuoteTestimonial = open => {
124
+ let quote = '';
125
+ if (copy === 'en') quote = open ? '\u201C' : '\u201D';else quote = open ? '\u00AB ' : ' \u00BB';
126
+ return quote;
127
+ };
128
+
102
129
  return /*#__PURE__*/_jsxs(TestimonialContainer, {
103
130
  testimonialContainerGap: testimonialContainerGap,
104
131
  ...selectProps(rest),
@@ -111,7 +138,7 @@ const Testimonial = _ref5 => {
111
138
  variant: {
112
139
  size: 'micro'
113
140
  },
114
- icon: icon
141
+ icon: copy === 'en' ? icon : iconFr
115
142
  }), showDivider && /*#__PURE__*/_jsx(Divider, {
116
143
  dividerBackgroundColor: dividerBackgroundColor,
117
144
  dividerBorder: dividerBorder,
@@ -124,9 +151,12 @@ const Testimonial = _ref5 => {
124
151
  },
125
152
  tokens: {
126
153
  color: textColor,
127
- fontWeight: '400'
154
+ fontSize: testimonialStyle === 'heading' ? testimonialFontSizeHeading : testimonialFontSizeLarge,
155
+ lineHeight: testimonialStyle === 'heading' ? testimonialLineHeightHeading : testimonialLineHeightLarge,
156
+ fontName: testimonialFontNameHeading,
157
+ fontWeight: testimonialStyle === 'heading' ? testimonialFontWeightHeading : testimonialFontWeightLarge
128
158
  },
129
- children: `\u201C${testimonial}\u201D`
159
+ children: `${getQuoteTestimonial(true)}${testimonial}${getQuoteTestimonial()}`
130
160
  })
131
161
  }), (image || title || additionalInfo) && /*#__PURE__*/_jsxs(Figcaption, {
132
162
  figcaptionGap: figcaptionGap,
@@ -139,20 +169,26 @@ const Testimonial = _ref5 => {
139
169
  }) : image), (title || additionalInfo) && /*#__PURE__*/_jsxs(AuthorInfoContainer, {
140
170
  children: [title && /*#__PURE__*/_jsx(Typography, {
141
171
  variant: {
142
- size: 'small',
143
- colour: 'secondary'
172
+ size: 'small'
144
173
  },
145
174
  tokens: {
146
- fontWeight: '500'
175
+ color: textColor,
176
+ fontSize: authorFontSize,
177
+ lineHeight: authorLineHeight,
178
+ fontName: authorFontName,
179
+ fontWeight: authorFontWeight
147
180
  },
148
181
  children: title
149
182
  }), additionalInfo && /*#__PURE__*/_jsx(Typography, {
150
183
  variant: {
151
- size: 'micro',
152
- colour: 'secondary'
184
+ size: 'small'
153
185
  },
154
186
  tokens: {
155
- fontWeight: '400'
187
+ color: textColor,
188
+ fontSize: additionalFontSize,
189
+ lineHeight: additionalLineHeight,
190
+ fontName: additionalFontName,
191
+ fontWeight: additionalFontWeight
156
192
  },
157
193
  children: additionalInfo
158
194
  })]
package/package.json CHANGED
@@ -5,14 +5,14 @@
5
5
  ],
6
6
  "dependencies": {
7
7
  "@gorhom/portal": "^1.0.14",
8
- "@telus-uds/components-base": "1.54.0",
9
- "@telus-uds/system-constants": "^1.2.1",
8
+ "@telus-uds/components-base": "1.55.0",
9
+ "@telus-uds/system-constants": "^1.3.0",
10
10
  "fscreen": "^1.2.0",
11
11
  "lodash.omit": "^4.5.0",
12
12
  "react-dates": "^21.8.0",
13
13
  "react-helmet-async": "^1.3.0",
14
14
  "react-moment-proptypes": "^1.8.1",
15
- "@telus-uds/system-theme-tokens": "^2.37.0",
15
+ "@telus-uds/system-theme-tokens": "^2.38.0",
16
16
  "prop-types": "^15.7.2",
17
17
  "lodash.throttle": "^4.1.1",
18
18
  "react-youtube": "^10.1.0",
@@ -63,5 +63,5 @@
63
63
  "skip": true
64
64
  },
65
65
  "types": "types/index.d.ts",
66
- "version": "2.13.0"
66
+ "version": "2.14.0"
67
67
  }