@telus-uds/components-web 2.13.0 → 2.15.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.
@@ -1,83 +1,17 @@
1
1
  import styled from 'styled-components'
2
2
 
3
3
  export const InputField = styled.div`
4
- order: 2;
5
- min-width: 3.5rem;
6
- max-width: 5 rem;
7
- height: 28px;
8
- padding: 0;
9
- width: 64px;
4
+ order: 1;
10
5
  text-align: center;
11
6
  z-index: 10;
12
7
  input {
13
8
  text-align: center;
14
9
  }
15
-
16
- &.alternative {
17
- input {
18
- height: 40px;
19
- }
20
- }
21
- `
22
-
23
- const ButtonWrapper = styled.div`
24
- &.alternative {
25
- div[role='button'] {
26
- height: 42px;
27
- > div {
28
- height: 40px;
29
- > div {
30
- padding: 12px 16px;
31
- }
32
- }
33
- }
34
- }
35
- `
36
-
37
- export const LeftButtonWrapper = styled(ButtonWrapper)`
38
- order: 0;
39
- div[role='button'] {
40
- border-radius: 4px 0px 0px 4px !important;
41
- > div {
42
- border-right: none;
43
- border-radius: 4px 0px 0px 4px !important;
44
- }
45
- }
46
-
47
- &.alternative {
48
- div[role='button'] {
49
- border-radius: 36px 0px 0px 36px !important;
50
- > div {
51
- border-radius: 24px 0px 0px 24px !important;
52
- }
53
- }
54
- }
55
- `
56
-
57
- export const RightButtonWrapper = styled(ButtonWrapper)`
58
- order: 3;
59
- div[role='button'] {
60
- border-radius: 0px 4px 4px 0px !important;
61
- > div {
62
- border-left: none;
63
- border-radius: 0px 4px 4px 0px !important;
64
- }
65
- }
66
-
67
- &.alternative {
68
- div[role='button'] {
69
- border-radius: 0px 36px 36px 0px !important;
70
- > div {
71
- border-radius: 0px 36px 36px 0px !important;
72
- }
73
- }
74
- }
75
10
  `
76
11
 
77
12
  export const InputWrapper = styled.div`
78
- textalign: start;
13
+ text-align: start;
79
14
  display: flex;
80
- flexdirection: row;
81
- flexwrap: nowrap;
82
- justifycontent: center;
15
+ flex-direction: row;
16
+ flex-wrap: nowrap;
83
17
  `
@@ -13,7 +13,7 @@ import {
13
13
  import ExpandCollapse from './ExpandCollapse'
14
14
  import OrderedListBase from '../OrderedList/OrderedListBase'
15
15
  import { htmlAttrs, media, renderStructuredContent } from '../utils'
16
- import dictionary from './dictionary'
16
+ import defaultDictionary from './dictionary'
17
17
 
18
18
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
19
19
 
@@ -72,7 +72,18 @@ const NonIndexedContentTitle = styled.div(({ tokens }) => ({
72
72
  * - Use `copy` to set language, ‘en’ for English or ‘fr’ for French
73
73
  */
74
74
  const TermsAndConditions = forwardRef(
75
- ({ copy = 'en', indexedContent, nonIndexedContent, tokens, variant = {}, ...rest }, ref) => {
75
+ (
76
+ {
77
+ copy = 'en',
78
+ indexedContent,
79
+ nonIndexedContent,
80
+ tokens,
81
+ variant = {},
82
+ dictionary = defaultDictionary,
83
+ ...rest
84
+ },
85
+ ref
86
+ ) => {
76
87
  const getCopy = useCopy({ dictionary, copy })
77
88
  const hasIndexedContent = indexedContent.length > 0
78
89
  const hasNonIndexedContent = nonIndexedContent.length > 0
@@ -135,6 +146,13 @@ const TermsAndConditions = forwardRef(
135
146
 
136
147
  TermsAndConditions.displayName = 'TermsAndConditions'
137
148
 
149
+ // If a language dictionary entry is provided, it must contain every key
150
+ const dictionaryContentShape = PropTypes.shape({
151
+ headingHide: PropTypes.string.isRequired,
152
+ headingView: PropTypes.string.isRequired,
153
+ nonIndexedTitle: PropTypes.string.isRequired
154
+ })
155
+
138
156
  TermsAndConditions.propTypes = {
139
157
  ...selectedSystemPropTypes,
140
158
  /**
@@ -161,13 +179,21 @@ TermsAndConditions.propTypes = {
161
179
  *
162
180
  * nonIndexedContent do not have a corresponding superscript and instead apply to the page as a whole.
163
181
  */
164
- nonIndexedContent: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.node, PropTypes.string]))
182
+ nonIndexedContent: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.node, PropTypes.string])),
183
+ /**
184
+ * Custom dictionary containing the labels to use for `TermsAndConditions`
185
+ */
186
+ dictionary: PropTypes.shape({
187
+ en: dictionaryContentShape,
188
+ fr: dictionaryContentShape
189
+ })
165
190
  }
166
191
 
167
192
  TermsAndConditions.defaultProps = {
168
193
  copy: 'en',
169
194
  indexedContent: [],
170
- nonIndexedContent: []
195
+ nonIndexedContent: [],
196
+ dictionary: defaultDictionary
171
197
  }
172
198
 
173
199
  export default TermsAndConditions
@@ -1,7 +1,13 @@
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 {
5
+ Icon,
6
+ selectSystemProps,
7
+ Typography,
8
+ useThemeTokens,
9
+ useViewport
10
+ } from '@telus-uds/components-base'
5
11
  import Image from '../Image'
6
12
  import { htmlAttrs } from '../utils'
7
13
 
@@ -48,11 +54,13 @@ const Testimonial = ({
48
54
  imageSrc,
49
55
  image = imageSrc,
50
56
  additionalInfo,
51
- testimonialStyle = 'heading',
57
+ testimonialStyle = 'large',
52
58
  tokens,
59
+ copy = 'en',
53
60
  variant = {},
54
61
  ...rest
55
62
  }) => {
63
+ const viewport = useViewport()
56
64
  const {
57
65
  testimonialContainerGap,
58
66
  quoteContainerGap,
@@ -61,13 +69,43 @@ const Testimonial = ({
61
69
  figcaptionGap,
62
70
  textColor,
63
71
  icon,
72
+ iconFr,
64
73
  iconColor,
65
- imageSize
66
- } = useThemeTokens('Testimonial', tokens, variant)
74
+ imageSize,
75
+ testimonialFontSizeLarge,
76
+ testimonialLineHeightLarge,
77
+ testimonialFontWeightLarge,
78
+ testimonialFontSizeHeading,
79
+ testimonialLineHeightHeading,
80
+ testimonialFontNameHeading,
81
+ testimonialFontWeightHeading,
82
+ authorFontSize,
83
+ authorLineHeight,
84
+ authorFontName,
85
+ authorFontWeight,
86
+ additionalFontSize,
87
+ additionalLineHeight,
88
+ additionalFontName,
89
+ additionalFontWeight
90
+ } = useThemeTokens('Testimonial', tokens, variant, { viewport })
91
+
92
+ const getQuoteTestimonial = (open) => {
93
+ let quote = ''
94
+
95
+ if (copy === 'en') quote = open ? '\u201C' : '\u201D'
96
+ else quote = open ? '\u00AB ' : ' \u00BB'
97
+
98
+ return quote
99
+ }
100
+
67
101
  return (
68
102
  <TestimonialContainer testimonialContainerGap={testimonialContainerGap} {...selectProps(rest)}>
69
103
  <QuoteContainer quoteContainerGap={quoteContainerGap}>
70
- <Icon tokens={{ color: iconColor }} variant={{ size: 'micro' }} icon={icon} />
104
+ <Icon
105
+ tokens={{ color: iconColor }}
106
+ variant={{ size: 'micro' }}
107
+ icon={copy === 'en' ? icon : iconFr}
108
+ />
71
109
  {showDivider && (
72
110
  <Divider
73
111
  dividerBackgroundColor={dividerBackgroundColor}
@@ -81,10 +119,22 @@ const Testimonial = ({
81
119
  variant={{ size: testimonialStyle === 'large' ? 'large' : 'h3' }}
82
120
  tokens={{
83
121
  color: textColor,
84
- fontWeight: '400'
122
+ fontSize:
123
+ testimonialStyle === 'heading'
124
+ ? testimonialFontSizeHeading
125
+ : testimonialFontSizeLarge,
126
+ lineHeight:
127
+ testimonialStyle === 'heading'
128
+ ? testimonialLineHeightHeading
129
+ : testimonialLineHeightLarge,
130
+ fontName: testimonialFontNameHeading,
131
+ fontWeight:
132
+ testimonialStyle === 'heading'
133
+ ? testimonialFontWeightHeading
134
+ : testimonialFontWeightLarge
85
135
  }}
86
136
  >
87
- {`\u201C${testimonial}\u201D`}
137
+ {`${getQuoteTestimonial(true)}${testimonial}${getQuoteTestimonial()}`}
88
138
  </Typography>
89
139
  </BlockQuote>
90
140
  {(image || title || additionalInfo) && (
@@ -105,16 +155,28 @@ const Testimonial = ({
105
155
  <AuthorInfoContainer>
106
156
  {title && (
107
157
  <Typography
108
- variant={{ size: 'small', colour: 'secondary' }}
109
- tokens={{ fontWeight: '500' }}
158
+ variant={{ size: 'small' }}
159
+ tokens={{
160
+ color: textColor,
161
+ fontSize: authorFontSize,
162
+ lineHeight: authorLineHeight,
163
+ fontName: authorFontName,
164
+ fontWeight: authorFontWeight
165
+ }}
110
166
  >
111
167
  {title}
112
168
  </Typography>
113
169
  )}
114
170
  {additionalInfo && (
115
171
  <Typography
116
- variant={{ size: 'micro', colour: 'secondary' }}
117
- tokens={{ fontWeight: '400' }}
172
+ variant={{ size: 'small' }}
173
+ tokens={{
174
+ color: textColor,
175
+ fontSize: additionalFontSize,
176
+ lineHeight: additionalLineHeight,
177
+ fontName: additionalFontName,
178
+ fontWeight: additionalFontWeight
179
+ }}
118
180
  >
119
181
  {additionalInfo}
120
182
  </Typography>
@@ -80,6 +80,8 @@ const ToastContainer = styled.div`
80
80
  justify-content: center;
81
81
  align-items: center;
82
82
  flex-wrap: wrap;
83
+ padding-left: ${({ padding }) => padding}px;
84
+ padding-right: ${({ padding }) => padding}px;
83
85
  background: ${({ containerBackgroundColor }) => containerBackgroundColor};
84
86
  gap: ${({ containerGap }) => containerGap};
85
87
  height: 0;
@@ -104,7 +106,8 @@ const Toast = ({ toast, copy, headline, link, tokens, variant = {}, ...rest }) =
104
106
  animationBackgroundColorAfter,
105
107
  animationColorBefore,
106
108
  animationColorAfter,
107
- chevronlinkFontWeight
109
+ chevronlinkFontWeight,
110
+ ...extraTokens
108
111
  } = useThemeTokens('Toast', tokens, variant, { viewport })
109
112
 
110
113
  // inherit ChevronLink tokens for animation colors
@@ -131,6 +134,7 @@ const Toast = ({ toast, copy, headline, link, tokens, variant = {}, ...rest }) =
131
134
  animationColorAfter={animationColorAfter}
132
135
  animationFillColorBefore={chevronInverseColor}
133
136
  animationFillColorAfter={chevronDefaultColor}
137
+ {...extraTokens}
134
138
  {...selectProps(rest)}
135
139
  >
136
140
  {headline && <Typography variant={{ bold: true, inverse: true }}>{headline}</Typography>}